HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System: Linux atalantini.com 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64
User: root (0)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //opt/plugins/atalantini/data/service_fanpage.php
<?php
/**
 * Atom Publishing Protocol support for WordPress
 *
 * @version 1.0.5-dc
 */

/**
 * WordPress is handling an Atom Publishing Protocol request.
 *
 * @var bool
 */
define('APP_REQUEST', true);

/** Set up WordPress environment */
require_once('../../../../wp-load.php');

/** Atom Publishing Protocol Class */
require_once(ABSPATH . WPINC . '/atomlib.php');

/** Admin Image API for metadata updating */
require_once(ABSPATH . '/wp-admin/includes/image.php');

$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );

/**
 * Whether to enable Atom Publishing Protocol Logging.
 *
 * @name app_logging
 * @var int|bool
 */
$app_logging = 0;

/**
 * Whether to always authenticate user. Permanently set to true.
 *
 * @name always_authenticate
 * @var int|bool
 * @todo Should be an option somewhere
 */
$always_authenticate = 1;

/**
 * Writes logging info to a file.
 *
 * @since 2.2.0
 * @uses $app_logging
 * @package WordPress
 * @subpackage Logging
 *
 * @param string $label Type of logging
 * @param string $msg Information describing logging reason.
 */
function log_app($label,$msg) {
	global $app_logging;
	if ($app_logging) {
		$fp = fopen( 'wp-app.log', 'a+');
		$date = gmdate( 'Y-m-d H:i:s' );
		fwrite($fp, "\n\n$date - $label\n$msg\n");
		fclose($fp);
	}
}

global $wpdb;
$table_fanpage   = $wpdb->prefix . "cineamafanpage";
$azione = $_GET['azione'];
if ($azione == "INSERT") {
        $wpdb->insert(
                $table_fanpage,
                array(
                        'fanpagetitolo' => str_replace("\\","", $_POST['fanpagetitolo']),
                        'fanpagetrailer' => str_replace("\\","", $_POST['fanpagetrailer']),
                        'fanpagefilm' => str_replace("\\","", $_POST['fanpagefilm']),
                        'fanpagebanner' => str_replace("\\","", $_POST['fanpagebanner']),
                        'fanpagedescrizione' => str_replace("\\","", $_POST['fanpagedescrizione'])
                ),
                array(
                        '%s',
                        '%s',
                        '%s',
                        '%s',
                        '%s'
                )
        );
}
if ($azione == "UPDATE") {
        $wpdb->update(
                $table_fanpage,
                array(
                        'fanpagetitolo' => str_replace("\\","", $_POST['fanpagetitolo']),
                        'fanpagetrailer' => str_replace("\\","", $_POST['fanpagetrailer']),
                        'fanpagefilm' => str_replace("\\","", $_POST['fanpagefilm']),
                        'fanpagebanner' => str_replace("\\","", $_POST['fanpagebanner']),
                        'fanpagedescrizione' => str_replace("\\","", $_POST['fanpagedescrizione'])
                ),
                array( 'id' => $_POST['id'] ),
                array(
                        '%s',
                        '%s',
                        '%s',
                        '%s',
                        '%s'
                ),
                array( '%d' )
        );
} 
if ($azione == "DELETE") {
        $wpdb->query("delete from " . $table_fanpage . " where id = " . $_POST['id']);
} 
if ($azione == "LIST") {
        $limit = "";
        if ($_GET['pageNo'] == '1') {
                $limit = "limit 0, " . $_GET['pageSize'];
        }
        if ($_GET['pageNo'] != '1') {
                $page = $_GET['pageNo'];
                $size = $_GET['pageSize'];
                $page = $size * ($page - 1);
                $limit = "limit " . $page . ", " . $_GET['pageSize'];
        }
        $cineamars = $wpdb->get_results("select * from " . $table_fanpage . " " . $limit . ";");
        foreach ( $cineamars as $cineamaline ) {
                $elementiSingoli[] = json_encode(array('id' => $cineamaline->id, 'fanpagetitolo' => $cineamaline->fanpagetitolo, 'fanpagetrailer' => $cineamaline->fanpagetrailer, 'fanpagefilm' => $cineamaline->fanpagefilm, 'fanpagetipocitta' => $cineamaline->fanpagetipocitta, 'fanpagespettatori' => $cineamaline->fanpagespettatori, 'fanpagebanner' => $cineamaline->fanpagebanner, 'fanpagedescrizione' => $cineamaline->fanpagedescrizione));
        }
        // estraggo totaleValori
        $totaleValori = 0;
        $cineamars = $wpdb->get_results("select count(*) as contatore from " . $table_fanpage . ";");
        foreach ( $cineamars as $cineamaline ) {
                $totaleValori = $cineamaline->contatore;
        }
	?>
	{"totaleValori":"<?= $totaleValori ?>","listaFanpage":[<?= implode(",", $elementiSingoli) ?>]}
	<?
} 
if ($azione == "DETAIL") {
        $cineamars = $wpdb->get_results("select * from " . $table_fanpage . " where id = " . $_GET['id'] . ";");
        foreach ( $cineamars as $cineamaline ) {
                $elementiSingoli[] = json_encode(array('id' => $cineamaline->id, 'fanpagetitolo' => $cineamaline->fanpagetitolo, 'fanpagetrailer' => $cineamaline->fanpagetrailer, 'fanpagefilm' => $cineamaline->fanpagefilm, 'fanpagetipocitta' => $cineamaline->fanpagetipocitta, 'fanpagespettatori' => $cineamaline->fanpagespettatori, 'fanpagebanner' => $cineamaline->fanpagebanner, 'fanpagedescrizione' => $cineamaline->fanpagedescrizione));
        }
        ?>
        {"dettaglioFanpage":[<?= implode(",", $elementiSingoli) ?>]}
        <?
} 
if ($azione == "REGISTER") {
        $cineamars = $wpdb->get_results("select * from " . $table_fanpage . " where id = " . $_GET['id'] . ";");
        foreach ( $cineamars as $cineamaline ) {
                $elementiSingoli[] = json_encode(array('id' => $cineamaline->id, 'fanpagetitolo' => $cineamaline->fanpagetitolo, 'fanpagetrailer' => $cineamaline->fanpagetrailer, 'fanpagefilm' => $cineamaline->fanpagefilm, 'fanpagetipocitta' => $cineamaline->fanpagetipocitta, 'fanpagespettatori' => $cineamaline->fanpagespettatori, 'fanpagebanner' => $cineamaline->fanpagebanner, 'fanpagedescrizione' => $cineamaline->fanpagedescrizione));
        }
        ?>
        {"dettaglioFanpage":[<?= implode(",", $elementiSingoli) ?>]}
        <?
}
if ($azione == "ADESIONI") {
        // verifico se utente esiste
        $cineamars = $wpdb->get_results(" select * from wp_cineamafbusersfanpage where idFanpage = " . $_GET['id'] . ";");
        foreach ( $cineamars as $cineamaline ) {
                $cinemaList[] = "{\"id\":\"" . $cineamaline->id . "\",\"username\":\"" . $cineamaline->username . "\",\"idFanpage\":\"" . $cineamaline->idFanpage . "\",\"city\":\"" . $cineamaline->city . "\", \"counter\":\"" . $cineamaline->counter . "\"}";
        }
        ?>
{"listaAdesioni":[<?= implode(",", $cinemaList) ?>]}
        <?
} 
if ($azione == "CANCELLACINEMA") {
        $wpdb->query("delete from wp_cineamafbusersfanpage where id = " . $_GET['id']);
        ?>
{"messaggio":"ok"}
        <?
}
?>