Beispiel #1
0
 public function Load()
 {
     if (!file_exists(DATA . "/settings.php")) {
         saveJSON('settings.php', array($this->username => array('codiad.username' => $this->username)));
     }
     $settings = getJSON('settings.php');
     echo formatJSEND("success", $settings[$this->username]);
 }
function saveOwnDictionary($dictionary)
{
    if (!file_exists(DATA . "/config/" . USERDIC)) {
        file_put_contents(DATA . "/config/" . USERDIC, "");
    }
    $content = array('dictionary' => $dictionary);
    saveJSON(USERDIC, $content, "config");
}
Beispiel #3
0
/**
 * @param $objName to save under
 * @return PHP Array
 */
function loadJSON($objName, $default)
{
    $fpath = '../data/' . $objName . '.json';
    if (!file_exists($fpath)) {
        saveJSON($objName, $default);
        return $default;
    }
    //Retrieve the data from our text file.
    $fileContents = file_get_contents($fpath);
    //Convert the JSON string back into an array.
    $decoded = json_decode($fileContents, true);
    if ($decoded == null) {
        $decoded = $default;
    }
    return $decoded;
}
Beispiel #4
0
 public function Save()
 {
     $data = array();
     if (isset($_GET['n'])) {
         foreach ($_GET['n'] as $key => $name) {
             $tmp['n'] = trim($name);
             $tmp['d'] = trim($_GET["d"][$key]);
             $tmp['a'] = trim($_GET["a"][$key]);
             $tmp['t'] = trim($_GET["t"][$key]);
             $tmp['i'] = trim($_GET["i"][$key]);
             $tmp['c'] = trim($_GET["c"][$key]);
             array_push($data, $tmp);
         }
     }
     saveJSON("/config/" . get_called_class() . ".php", $data);
     echo formatJSEND("success", null);
 }
Beispiel #5
0
 public function pull()
 {
     $cli_params = array();
     $cli_params[] = "--non-interactive";
     if ($this->username != '') {
         $cli_params[] = "--username " . $this->username;
     }
     if ($this->password != '') {
         //Need to clean up the password so it can be passed to the cli, If anyone find's or thinks of more let me know tholum@couleetechlink.com
         $this->password = str_replace(array("*", "^", "&", '"'), array('\\*', '\\^', '\\&', '\\"'), $this->password);
         $cli_params[] = "--password " . $this->password;
     }
     if ($this->svnrepo) {
         if (!$this->isAbsPath($this->path)) {
             if (!file_exists(WORKSPACE . '/' . $this->path)) {
                 $this->command_exec = "cd " . WORKSPACE . " && svn co \"" . $this->svnrepo . "\" " . $this->path . " " . implode(" ", $cli_params);
             } else {
                 die(formatJSEND("success", array("message" => "Folder already exists")));
             }
         } else {
             if (!file_exists($this->path)) {
                 $this->command_exec = "cd " . WORKSPACE . " && svn co \"" . $this->svnrepo . "\" " . $this->path . " " . implode(" ", $cli_params);
             } else {
                 die(formatJSEND("success", array("message" => "Folder already exists")));
             }
         }
         if ($this->newproject) {
             $this->projects = getJSON('projects.php');
             $this->projects[] = array("name" => $this->name, "path" => $this->path);
             saveJSON('projects.php', $this->projects);
         }
         $this->ExecuteCMD();
         echo formatJSEND("success", array("message" => "Repo cloned"));
     } else {
         echo formatJSEND("error", array("message" => "No Repo specified"));
     }
 }
    } else {
        $project_path = cleanPath($project_path);
        if (substr($project_path, -1) == '/') {
            $project_path = substr($project_path, 0, strlen($project_path) - 1);
        }
        if (!file_exists($project_path)) {
            if (!mkdir($project_path . '/', 0755, true)) {
                die("Unable to create Absolute Path");
            }
        } else {
            if (!is_writable($project_path) || !is_readable($project_path)) {
                die("No Read/Write Permission");
            }
        }
    }
    $project_data = array("name" => $project_name, "path" => $project_path);
    saveJSON($projects, array($project_data));
    //////////////////////////////////////////////////////////////////
    // Create Users file
    //////////////////////////////////////////////////////////////////
    $user_data = array("username" => $username, "password" => $password, "project" => $project_path);
    saveJSON($users, array($user_data));
    //////////////////////////////////////////////////////////////////
    // Create Active file
    //////////////////////////////////////////////////////////////////
    saveJSON($active, array(''));
    //////////////////////////////////////////////////////////////////
    // Create Config
    //////////////////////////////////////////////////////////////////
}
echo "success";
Beispiel #7
0
 * This information must remain intact.
 */
error_reporting(0);
require_once '../../common.php';
checkSession();
switch ($_GET['action']) {
    case 'load':
        if (file_exists(DATA . "/config/" . getFileName())) {
            echo json_encode(getJSON(getFileName(), "config"));
        } else {
            echo json_encode(array());
        }
        break;
    case 'save':
        if (isset($_POST['data'])) {
            saveJSON(getFileName(), json_decode($_POST['data']), "config");
            echo '{"status":"success","message":"Data saved"}';
        } else {
            echo '{"status":"error","message":"Missing Parameter"}';
        }
        break;
    case 'isDir':
        if (isset($_GET['path'])) {
            $result = array();
            $result['status'] = "success";
            $result['result'] = is_dir(getWorkspacePath($_GET['path']));
            echo json_encode($result);
        } else {
            echo '{"status":"error","message":"Missing Parameter"}';
        }
        break;
// Only admins.
if (empty($_SESSION[$RootSession])) {
    $_SESSION[$RootSession] = false;
}
$session = $_SESSION[$RootSession];
if ($session === true) {
    unset($_SESSION['redirlink']);
    if (isset($_POST['submitted'])) {
        $BetaModeStatus = $_POST['betamode'];
        if ($BetaModeStatus == "true") {
            $finalarray = array(true);
        }
        if ($BetaModeStatus == "false") {
            $finalarray = array(false);
        }
        saveJSON("beta_mode", $finalarray);
        echo "Updated!";
        $finaladdr = $CurrentDirectory . "BetaMode.php";
        echo "<META http-equiv='refresh' content='1;URL={$finaladdr}'>";
    } else {
        $betamode = getJSON("beta_mode");
        if ($betamode[0] == true) {
            $betamodeword = "true";
        } elseif ($betamode[0] == false) {
            $betamodeword = "false";
        } else {
            $betamodeword = "error :(";
        }
        if ($detect->isiOS()) {
            ?>
<!DOCTYPE html>
Beispiel #9
0
 public function OptOut()
 {
     $current = getJSON('version.php');
     $version[] = array("version" => $current[0]['version'], "time" => $current[0]['time'], "optout" => "true", "name" => $current[0]['name']);
     saveJSON('version.php', $version);
 }
Beispiel #10
0
 public function setSettings($update, $path)
 {
     $settings = getJSON(CONFIG, 'config');
     foreach ($update as $i => $item) {
         if (strlen($item) == 0) {
             unset($update[$i]);
             unset($settings[$i]);
             if (strpos($i, "local_") !== false) {
                 unset($settings[$path]);
             }
             continue;
         }
         if (strpos($i, "local_") !== false) {
             if (!isset($settings[$path])) {
                 $settings[$path] = array();
             }
             $index = str_replace("local_", "", $i);
             $settings[$path][$index] = $item;
             unset($settings[$i]);
             unset($update[$i]);
         }
         if (isset($update[$i])) {
             $settings[$i] = $update[$i];
         }
     }
     saveJSON(CONFIG, $settings, 'config');
 }
                    }
                }
                saveJSON("approved_udids_2", $approved_udids);
                echo "User deleted!";
                $finaladdr = $CurrentDirectory . "ManageUDID.php";
                echo "<META http-equiv='refresh' content='1;URL={$finaladdr}'>";
            }
        } else {
            // If it doesn't exist
            $userudid = $_POST['udid'];
            $newuserlevel = $_POST['level'];
            $newusername = $_POST['name'];
            $oldarray = getJSON("approved_udids_2");
            $newarray = array($userudid, $newuserlevel, $newusername);
            array_push($oldarray, $newarray);
            saveJSON("approved_udids_2", $oldarray);
            echo "User added!";
            $finaladdr = $CurrentDirectory . "ManageUDID.php";
            echo "<META http-equiv='refresh' content='1;URL={$finaladdr}'>";
        }
    } else {
        // Otherwise, show.
        $approved_udids = getJSON("approved_udids_2");
        if ($detect->isiOS()) {
            ?>
<!DOCTYPE html>
<html>
<head>
    <link href="ios7css.css" rel="stylesheet">
    <meta content="width=device-width, user-scalable=no" name="viewport">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title>All UDIDs</title></head><body>
            } else {
                $prepDebs = $originalArrayDebs;
            }
            if (!array_key_exists($ident, $prepName)) {
                $newArrayNames = array($ident => $name);
                $newArrayDescs = array($ident => $desc);
                $newArrayDebs = array($ident => $debnames);
                // name merge
                $finalName = array_merge($prepName, $newArrayNames);
                saveJSON("descriptions/names", $finalName);
                // description merge
                $finalDesc = array_merge($prepDesc, $newArrayDescs);
                saveJSON("descriptions/description", $finalDesc);
                // deb merge
                $finalDebs = array_merge($prepDebs, $newArrayDebs);
                saveJSON("debnames", $finalDebs);
                $usedindep = true;
            } else {
                echo "Depiction already exists.<br><br>";
            }
            //////////////////////////////////////////////
        }
        if ($usedindep === false) {
            if ($detect->isiOS()) {
                ?>
<!DOCTYPE html>
<html>
<head>
    <link href="ios7css.css" rel="stylesheet">
    <meta content="width=device-width, user-scalable=no" name="viewport">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title><?php 
Beispiel #13
0
 public function MarkFileAsFocused()
 {
     foreach ($this->actives as $active => $data) {
         if (is_array($data) && isset($data['username']) && $this->username == $data['username']) {
             $this->actives[$active]['focused'] = false;
             if ($this->path == $data['path']) {
                 $this->actives[$active]['focused'] = true;
             }
         }
     }
     saveJSON('active.php', $this->actives);
     echo formatJSEND("success");
 }
Beispiel #14
0
<?php

/*
 * Copyright (c) Codiad & Andr3as, distributed
 * as-is and without warranty under the MIT License. 
 * See http://opensource.org/licenses/MIT for more information.
 * This information must remain intact.
 */
error_reporting(0);
require_once '../../common.php';
checkSession();
switch ($_GET['action']) {
    case 'save':
        if (isset($_POST['settings'])) {
            saveJSON("beautify.settings.php", json_decode($_POST['settings']), "config");
            echo '{"status":"success","message":"Settings saved"}';
        } else {
            echo '{"status":"error","message":"Missing parameter"}';
        }
        break;
    case 'load':
        if (file_exists(DATA . "/config/beautify.settings.php")) {
            echo json_encode(getJSON("beautify.settings.php", "config"));
        } else {
            echo file_get_contents("default.settings.json");
        }
        break;
    case 'saveContent':
        if (isset($_GET['path']) && isset($_POST['content'])) {
            if (file_put_contents(getWorkspacePath($_GET['path']), $_POST['content']) === false) {
                echo '{"status":"error","message":"Failed to save content"}';
Beispiel #15
0
    case 'abba':
        $rowsABBA = array();
        foreach ($rowsKeys as $k => $row) {
            $tab = explode(' | ', $row['ga:eventLabel']);
            /** variant */
            $abba_label = $tab[0];
            /** views | goals */
            $action_type = $tab[1];
            switch ($action_type) {
                case 'views':
                    $rowsABBA[$abba_label]['number_of_trials'] = $row['ga:totalEvents'];
                    break;
                case 'goal':
                    $rowsABBA[$abba_label]['number_of_successes'] = $row['ga:totalEvents'];
                    break;
                default:
                    break;
            }
        }
        $abba = array('config' => array('intervalConfidenceLevel' => $config['intervalConfidenceLevel'], 'multipleTestingCorrection' => $config['multipleTestingCorrection']));
        $abba['data'] = $rowsABBA;
        $json = json_encode($abba);
        $filename = prepareFilename($configFile, $config['outputFormat']);
        if (saveJSON($filename, $config['outputDirectory'], $json)) {
            echo info("Saved to file " . $filename . "\n");
        }
        break;
    default:
        echo error("Unknown output format\n");
        break;
}
        $prepName = $oldNameArray;
        $oldDescArray = getJSON("description");
        $prepDesc = $oldDescArray;
        if (array_key_exists($identifier_orig, $prepName)) {
            // if already exists, remove it from prep
            unset($prepName[$identifier_orig]);
            unset($prepDesc[$identifier_orig]);
            // now we create new arrays
            $newArrayNames = array($identifier_new => $name);
            $newArrayDescs = array($identifier_new => $desc);
            // name merge
            $finalName = array_merge($prepName, $newArrayNames);
            saveJSON("names", $finalName);
            // description merge
            $finalDesc = array_merge($prepDesc, $newArrayDescs);
            saveJSON("description", $finalDesc);
            // Ok, they're saved
        } else {
            $noExist = true;
            if ($detect->isiOS()) {
                ?>
<!DOCTYPE html>
<html>
<head>
    <link href="ios7css.css" rel="stylesheet">
    <meta content="width=device-width, user-scalable=no" name="viewport">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title>Change Depiction</title></head><body>
    <header><h1>Change Depiction</h1></header>
    <h2>Uh oh...</h2>
		<ul><li><p>Depiction didn't already exist.</p>
		<meta http-equiv='refresh' content='1; url=<?php 
Beispiel #17
0
<?php

$data = $_REQUEST["json"];
$data = str_replace("+", " ", $data);
$data = str_replace("SUMAR", "+", $data);
$nameFile = $_REQUEST["nameFile"];
saveJSON($data, $nameFile);
createImage($data, $nameFile);
function saveJSON($data, $nameFile)
{
    $file = 'images/photo_' . $nameFile . '.txt';
    $success = file_put_contents($file, $data);
}
function createImage($json, $nameFile)
{
    header("Content-type: image/gif");
    $obj = json_decode($json);
    $file = 'images/photo_' . $nameFile . '.jpg';
    $success = file_put_contents($file, base64_decode($obj->{'json'}));
}
            $allDepictionIdentifiers = array_keys($names);
            if (in_array($ident, $allDepictionIdentifiers)) {
                // Delete from names
                unset($names[$ident]);
                saveJSON("names", $names);
                // Delete from descriptions
                unset($descriptions[$ident]);
                saveJSON("description", $descriptions);
                $packagejson = $ident . ".json";
                if (file_exists("../all_packages/{$packagejson}")) {
                    // Don't delete from debnames if this is an existing package
                    echo "Successfully removed {$ident}'s depiction! NOTE: This still exists in ../debnames!";
                } else {
                    // Otherwise, it's probably a test depiction (or something leftover from a deleted package), so we can delete it.
                    unset($debnames[$ident]);
                    saveJSON("../debnames", $debnames);
                    echo "Successfully removed {$ident}'s depiction! NOTE: This does NOT exist in ../debnames! (It's not in the package listing, so we can assume it was a test.)";
                }
            } else {
                echo "That depiction doesn't exist!";
                exit;
            }
        } else {
            echo "Mmm, be sure to confirm it.";
            exit;
        }
    } else {
        if ($detect->isiOS()) {
            ?>
<!DOCTYPE html>
<html>
Beispiel #19
0
 $auth = ldap_bind($socket, $data[0]['dn'], $User->password);
 // Check the return value of the bind action.
 if ($auth === -1) {
     // Deny login and send message, An LDAP error occurred.
     die(formatJSEND("error", "An LDAP error has occurred: " . ldap_error($socket)));
 } elseif ($auth == false) {
     // Invalid login.
     die(formatJSEND("error", "Invalid user name or password."));
 } elseif ($auth == true) {
     // Check if user already exists within users.php.
     if ($User->CheckDuplicate()) {
         // Check if we can create a user within users.php.
         if ($createuser == true) {
             // Save array back to JSON and set the session username.
             $User->users[] = array('username' => $User->username, 'password' => null, 'project' => "");
             saveJSON("users.php", $User->users);
             $_SESSION['user'] = $User->username;
         } else {
             // Deny login and send message, the user doesn't exist within users.php.
             die(formatJSEND("error", "User " . $User->username . " does not exist within Codiad."));
         }
     } else {
         // Set the session username.
         $_SESSION['user'] = $User->username;
     }
     // Set the session language, if given, or set it to english as default.
     if (isset($_POST['language'])) {
         $_SESSION['lang'] = $_POST['language'];
     } else {
         $_SESSION['lang'] = "en";
     }
Beispiel #20
0
function saveMessages($forDest, $appMessages)
{
    saveJSON("messages/" . $forDest, $appMessages);
}
 public function existDir()
 {
     if (!file_exists($this->getFilePath())) {
         saveJSON($this->getFileName(), array(), "config");
     }
 }
Beispiel #22
0
//Uncomment these lines of code to echo PHP errors during debug.
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);
require '../shared/shared.php';
function dpathFor($appId)
{
    return 'appdata/' . $appId;
}
//Get the JSON body
$entityBody = file_get_contents('php://input');
if (isPOST() || isPUT()) {
    if (isset($_REQUEST['appid'])) {
        $appId = $_REQUEST['appid'];
        $dataToSave = array("payload" => json_decode($entityBody), "lastUpdated" => getMSTime());
        saveJSON(dpathFor($appId), $dataToSave);
        jsonOut($entityBody);
    } else {
        badReq('missing appid');
    }
} elseif (isDELETE()) {
    if (isset($_REQUEST['appid'])) {
        $rmRes = rmJSON(dpathFor($_REQUEST['appid']));
        if ($rmRes) {
            echo 'deleted';
        } else {
            badReq('No data for that app');
        }
    } else {
        badReq('missing appid');
    }
                // This is where we'd delete the depiction, if that's ok
                // Ok, removed from debnames. Now we're done, show success message.
                echo "Successfully deleted {$ident}!";
            } else {
                echo "That doesn't exist!";
                exit;
            }
            if ($_POST['depictiondelete'] === "yes") {
                // if they said yes, delete from depiction
                $desc_names = getJSON("descriptions/names");
                $desc_desc = getJSON("descriptions/description");
                $identifier = $_POST['identifier'];
                unset($desc_names[$identifier]);
                saveJSON("descriptions/names", $desc_names);
                unset($desc_desc[$identifier]);
                saveJSON("descriptions/description", $desc_desc);
            }
        } else {
            echo "Mmm, be sure to confirm it.";
        }
    } else {
        if ($detect->isiOS()) {
            ?>
<!DOCTYPE html>
<html>
<head>
    <link href="ios7css.css" rel="stylesheet">
    <meta content="width=device-width, user-scalable=no" name="viewport">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title>Delete File</title></head><body>
    <header><h1>Delete File</h1></header>
    <h2>Fill out this form...</h2>
Beispiel #24
0
 public function Remove()
 {
     foreach ($this->actives as $active => $data) {
         if ($this->username == $data['username'] && $this->path == $data['path']) {
             unset($this->actives[$active]);
         }
     }
     saveJSON('active.php', $this->actives);
     echo formatJSEND("success");
 }
Beispiel #25
0
 public function Project()
 {
     $revised_array = array();
     foreach ($this->users as $user => $data) {
         if ($this->username == $data['username']) {
             $revised_array[] = array("username" => $data['username'], "password" => $data['password'], "project" => $this->project);
         } else {
             $revised_array[] = array("username" => $data['username'], "password" => $data['password'], "project" => $data['project']);
         }
     }
     // Save array back to JSON
     saveJSON('users.php', $revised_array);
     // Response
     echo formatJSEND("success", null);
 }
            // desc_desc
            $theolddesc = $desc_desc[$oldident];
            unset($desc_desc[$oldident]);
            $new_desc_desc = array($newident => $theolddesc);
            $merged_desc_desc = array_merge($new_desc_desc, $desc_desc);
            saveJSON("descriptions/description", $merged_desc_desc);
            // all_packages
            $oldjsonidentname = $oldident . ".json";
            unlink("all_packages/{$oldjsonidentname}");
            // Ok, now we removed all old identifiers.
        }
        if ($old_debname != $debname) {
            // Remove all rements of old debname
            $package_groups = getJSON("package_groups");
            unset($package_groups[$old_debname]);
            saveJSON("package_groups", $package_groups);
        }
        echo "File edited!";
    } else {
        if ($detect->isiOS()) {
            ?>
<!DOCTYPE html>
<html>
<head>
    <link href="ios7css.css" rel="stylesheet">
    <meta content="width=device-width, user-scalable=no" name="viewport">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title>Change File</title></head><body>
    <header><h1>Change File</h1></header>
<script type = "text/javascript">
function copyIt() {
var x = document.getElementByName("identifier").value;
Beispiel #27
0
function setIframePositions()
{
    //Do the widgets first
    $sm = screenMap();
    //TODO HACK ALERT implement screen size feedback
    $screenRect = loadJSON("screenRect", array("width" => 1920, "height" => 1080));
    for ($widx = 0; $widx < count($sm["widgetAppMap"]); $widx++) {
        if (!$sm['widgetAppMap'][$widx]) {
            continue;
        }
        $sm['widgetAppMap'][$widx]['location'] = array("top" => 0, "left" => 0);
        //TODO implement server side nudge
        //var nudge = {
        //top:
        //0, left: 0 };
        $nudge = array("top" => 0, "left" => 0);
        switch ($widx) {
            case 0:
                $sm['widgetAppMap'][$widx]['location']['top'] = floor(0.05 * $screenRect['height']) + $nudge['top'] . 'px';
                $sm['widgetAppMap'][$widx]['location']['left'] = floor(0.03 * $screenRect['width']) + $nudge['left'] . 'px';
                break;
            case 1:
                $sm['widgetAppMap'][$widx]['location']['top'] = floor(0.05 * $screenRect['height']) + $nudge['top'] . 'px';
                $sm['widgetAppMap'][$widx]['location']['left'] = floor(0.85 * $screenRect['width']) + $nudge['left'] . 'px';
                break;
            case 2:
                $sm['widgetAppMap'][$widx]['location']['top'] = floor(0.6 * $screenRect['height']) + $nudge['top'] . 'px';
                $sm['widgetAppMap'][$widx]['location']['left'] = floor(0.85 * $screenRect['width']) + $nudge['left'] . 'px';
                break;
            case 3:
                $sm['widgetAppMap'][$widx]['location']['top'] = floor(0.6 * $screenRect['height']) + $nudge['top'] . 'px';
                $sm['widgetAppMap'][$widx]['location']['left'] = floor(0.03 * $screenRect['width']) + $nudge['left'] . 'px';
                break;
        }
    }
    //Do the crawler next
    for ($cidx = 0; $cidx < count($sm["crawlerAppMap"]); $cidx++) {
        if (!$sm['widgetAppMap'][$cidx]) {
            continue;
        }
        $sm['widgetAppMap'][$cidx]['location'] = array("top" => 0, "left" => 0);
        //TODO implement server side nudge
        //var nudge = {
        //top:
        //0, left: 0 };
        $nudge = array("top" => 0, "left" => 0);
        //HARD CODE for DEMO
        $sm['widgetAppMap'][$cidx]['location']['left'] = '0px';
        switch ($cidx) {
            case 0:
                $sm['widgetAppMap'][$cidx]['location']['top'] = floor(0.89 * $screenRect['height']) . $nudge['top'] . 'px';
                break;
            case 1:
                $sm['widgetAppMap'][$cidx]['location']['top'] = floor(0.03 * $screenRect['height']) . $nudge['top'] . 'px';
                break;
        }
    }
    if (count($sm['fullScreenAppMap']) > 0) {
        $sm['fullScreenAppMap'][0]['location'] = array("top" => 0, "left" => 0);
    }
    saveJSON("screenMap", $sm);
}
Beispiel #28
0
    //////////////////////////////////////////////////////////////////
    // Create Projects files
    //////////////////////////////////////////////////////////////////
    $project_path = str_replace(" ", "_", preg_replace('/[^\\w-]/', '', $project_name));
    mkdir($workspace . "/" . $project_path);
    $project_data = array("name" => $project_name, "path" => $project_path);
    saveJSON($projects, $project_data);
    //////////////////////////////////////////////////////////////////
    // Create Users file
    //////////////////////////////////////////////////////////////////
    $user_data = array("username" => $username, "password" => $password, "project" => $project_path);
    saveJSON($users, $user_data);
    //////////////////////////////////////////////////////////////////
    // Create Active file
    //////////////////////////////////////////////////////////////////
    saveJSON($active, '');
    //////////////////////////////////////////////////////////////////
    // Create Config
    //////////////////////////////////////////////////////////////////
    $config_data = '<?php

/*
*  Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
*  as-is and without warranty under the MIT License. See 
*  [root]/license.txt for more. This information must remain intact.
*/

//////////////////////////////////////////////////////////////////
// PATH
//////////////////////////////////////////////////////////////////
Beispiel #29
0
 public function Delete()
 {
     $revised_array = array();
     foreach ($this->projects as $project => $data) {
         if ($data['path'] != $this->path) {
             $revised_array[] = array("name" => $data['name'], "path" => $data['path']);
         }
     }
     // Save array back to JSON
     saveJSON('projects.php', $revised_array);
     // Response
     echo formatJSEND("success", null);
 }
Beispiel #30
0
error_reporting(E_ALL);
require '../shared/shared.php';
require '../shared/messaging.php';
if (isset($_REQUEST['command'])) {
    $cmd = $_REQUEST['command'];
    switch ($cmd) {
        case 'jsave':
            //Save JSON
            $arr = array("beer" => "cold", "hamburger" => "vtasty");
            saveJSON("test", $arr);
            break;
        case 'nest':
            //Save JSON
            $arr = array("nest" => array(), "hamburger" => "tasty");
            array_push($arr["nest"], array("chicken" => "white", "beef" => "red"));
            saveJSON("nest", $arr);
            echo var_dump($arr);
            break;
        case 'msg':
            //Save JSON
            postAppMessage('io.overplay.mainframe', 'io.overplay.test', array("msg" => 'payload'));
            echo 'ok';
            break;
        case 'msg2':
            //Save JSON
            postAppMessage('io.overplay.mainframe', 'io.overplay.testa', array("msg" => 'payload'));
            echo 'ok';
            break;
        case 'poptest':
            $msg = popAppMessage('io.overplay.testa');
            echo json_encode($msg);