403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/clients/client1/seaside.pacim.de/web/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client1/seaside.pacim.de/web/cockpit-api.php
<?php
/**
 * cockpit-api.php – JSON-Endpunkt fürs Cockpit (Diagramm-Zeitraumfilter).
 * Hinter dem PaCIM-Login.
 *
 * GET action=chart&days=N -> { days, labels[], current[], previous[], sumCurrent, sumPrevious }
 * GET action=stats        -> { inventory, today, season, trend[], year, import }   (KPI-Karten)
 * GET action=events       -> [ ...kommende Termine... ]                            (Slideshow)
 * GET action=recent       -> [ { day, label, items[] } ]                           (letzte 7 Tage)
 */
require_once( __DIR__ . "/includes/config.inc.php" );
@ini_set( 'display_errors', '0' );
header( 'Content-Type: application/json; charset=utf-8' );
header( 'Cache-Control: no-store, no-cache, must-revalidate, max-age=0' );

if ( !isset( $_SESSION['user'] ) || $_SESSION['user'] != LOGIN_USER ) {
    http_response_code( 403 );
    echo json_encode( array( 'error' => 'unauthorized' ) );
    exit();
}

$action = isset( $_GET['action'] ) ? $_GET['action'] : '';
// Performance: gesamte Cockpit-AJAX-Dauer messen (No-Op wenn Logging aus).
if ( class_exists( 'perflog' ) ) perflog::wholeRequest( 'cockpit', $action !== '' ? preg_replace( '/[^a-z_]/i', '', $action ) : '?', 'cockpit_ajax' );
$cp = new cockpit();

if ( $action === 'all' ) {
    // Gebündelt: alle Startseiten-Kacheln in EINEM Request (ein Bootstrap, keine Parallel-Konkurrenz).
    echo json_encode( array(
        'chart'  => $cp->bookingChart( 14 ),
        'stats'  => array(
            'inventory' => $cp->inventory(),
            'today'     => $cp->today(),
            'season'    => $cp->season(),
            'trend'     => $cp->trend( 14 ),
            'year'      => (int) date( 'Y' ),
            'import'    => $cp->lastImport(),
        ),
        'events' => $cp->upcomingEvents( 10 ),
        'recent' => $cp->recentByDay( 7 ),
    ) );
    exit();
}

if ( $action === 'chart' ) {
    $days = isset( $_GET['days'] ) ? (int) $_GET['days'] : 14;
    echo json_encode( $cp->bookingChart( $days ) );
    exit();
}

if ( $action === 'stats' ) {
    echo json_encode( array(
        'inventory' => $cp->inventory(),
        'today'     => $cp->today(),
        'season'    => $cp->season(),
        'trend'     => $cp->trend( 14 ),
        'year'      => (int) date( 'Y' ),
        'import'    => $cp->lastImport(),
    ) );
    exit();
}

if ( $action === 'events' ) {
    echo json_encode( $cp->upcomingEvents( 10 ) );
    exit();
}

if ( $action === 'recent' ) {
    echo json_encode( $cp->recentByDay( 7 ) );
    exit();
}

http_response_code( 400 );
echo json_encode( array( 'error' => 'bad_request' ) );

Youez - 2016 - github.com/yon3zu
LinuXploit