Ejemplo n.º 1
0
require_once 'constants.php';
require_once 'functions.php';
require_once 'dbConfig.php';
require_once 'config.php';
require_once 'database.php';
require_once 'communication.php';
date_default_timezone_set(Config::timezone());
$p = loadvar('p');
$urid = loadvar('urid');
$db = new Database();
$communication = new Communication();
$returnValue = 'error';
if ($p == 'upload') {
    //upload data!
    $communication->storeUpload($_POST['query'], $urid);
    $communication->importTable($_POST['query']);
    $returnValue = 'ok';
} elseif ($p == 'updateavailable') {
    //is there an update available?
    $returnValue = 'no';
    if (sizeof($communication->getUserQueries($urid)) > 0) {
        $returnValue = 'yes';
    }
    if (sizeof($communication->getUserScripts($urid)) > 0) {
        $returnValue = 'yes';
    }
} elseif ($p == 'receive') {
    //receive the update
    $returnValue = '';
    if (sizeof($communication->getUserQueries($urid)) > 0) {
        //sql