Example #1
0
                        $compiler_options_debug = getVar("compiler_options_debug");
                        if ($compiler_options_debug !== NULL) {
                            $json["compiler_options_debug"] = $compiler_options_debug;
                        }
                        $compile = getBoolVar("compile");
                        $json["compile"] = $compile;
                        $run = getBoolVar("run");
                        $json["run"] = $run;
                        $test = getBoolVar("test");
                        $json["test"] = $test;
                        $debug = getBoolVar("debug");
                        $json["debug"] = $debug;
                        $profile = getBoolVar("profile");
                        $json["profile"] = $profile;
                        // Kreiran je json
                        saveJson($fileData, $json);
                        print "Editovanje izvršeno!";
                        admin_log("edit at file {$fileData} (mod={$mod})");
                    }
                }
            }
        }
    }
}
function admin_log($msg)
{
    $login = $_SESSION['login'];
    $conf_base_path = "/usr/local/webide";
    $msg = date("Y-m-d H:i:s") . " - {$login} - {$msg}\n";
    file_put_contents("{$conf_base_path}/log/admin.php.log", $msg, FILE_APPEND);
}
<?php

include __DIR__ . '/content.php';
echo saveJson(__DIR__ . '/content.json');
Example #3
0
require_once "../../lib/webidelib.php";
require_once "../login.php";
$login = $_SESSION['login'];
if (!in_array($login, $conf_admin_users)) {
    print "<p><b><font color=\"red\">Access denied!</font></b></p>\n";
    exit(0);
}
$fileLastId = "last_id.txt";
$fileData = getVar("fileData");
if (!file_exists($fileData)) {
    if (!isset($akoNemaKreiraj) || $akoNemaKreiraj == 0) {
        ispisGreske("Fajl <{$fileData}> ne postoji!");
        exit;
    } else {
        // Kreiranje autotest fajla sa zajednickim postavkama koje su proslijedjene
        saveJson($fileData, getDefDecodedJson());
    }
}
function getVar($var)
{
    // Safe getting variable, any: POST or GET;
    // Returns NULL if no variable
    if (isset($_POST[$var])) {
        return get_magic_quotes_gpc() ? stripslashes($_POST[$var]) : $_POST[$var];
    } else {
        if (isset($_GET[$var])) {
            return get_magic_quotes_gpc() ? stripslashes($_GET[$var]) : $_GET[$var];
        } else {
            return NULL;
        }
    }
Example #4
0
 foreach ($registration_data['products'] as $key => $value) {
     foreach ($omit_properties as $property) {
         if (array_key_exists($property, $value)) {
             unset($registration_data['products'][$key][$property]);
         }
     }
 }
 // If no error, run the API call
 if (!$error) {
     $return = $ws_call->get_data();
     // Run any promotions
     $run_promotions = runPromotions();
     // Save request and return to JSON file
     $json_path = $GLOBALS['app_path_registration'] . 'logs/' . session_id() . '-' . time() . '.json';
     $json_data = array('request' => $registration_data, 'return' => $return);
     $json = saveJson($json_path, $json_data);
     // If no errors
     if (!isset($return['error'])) {
         // Loop thru each serial number and flag the serial numbers that have been registered
         if (count($return['serial_numbers']) > 0) {
             foreach ($return['serial_numbers'] as $key => $value) {
                 updateSessionSerialNumber($value['serial_number'], $value['submitted']);
             }
         }
         // Add R Account to session
         if ($return['r_account']) {
             $_SESSION['registration']['customer']['r_account'] = $return['r_account'];
         }
         // Set flag to indicate registration process is complete
         $t = time();
         if (isset($return['r_account'])) {
Example #5
0
<?php

include __DIR__ . '/../include/content.php';
echo saveJson();
<?php

function saveJson($filename, $contents)
{
    $fp = fopen($filename, "w");
    fwrite($fp, json_encode($contents));
    fclose($fp);
}
$data = $_POST["data"];
$save_json = file_get_contents("save.json");
$save = json_decode($save_json);
array_push($save, json_decode($data));
saveJson("save.json", $save);