コード例 #1
0
ファイル: app_controller.php プロジェクト: ReneHezser/app
function app_controller()
{
    global $session, $route, $mysqli;
    $result = false;
    include "Modules/app/AppConfig_model.php";
    $appconfig = new AppConfig($mysqli);
    if ($route->format == 'html') {
        if ($route->action == "" && $session['write']) {
            $result = view("Modules/app/client.php", array());
        }
    }
    if ($route->format == 'json') {
        if ($route->action == "setconfig" && $session['write']) {
            $result = $appconfig->set($session['userid'], get('data'));
        }
        if ($route->action == "getconfig" && $session['read']) {
            $result = $appconfig->get($session['userid']);
        }
        if ($route->action == "dataremote") {
            $id = (int) get("id");
            $start = (double) get("start");
            $end = (double) get("end");
            $interval = (int) get("interval");
            $result = json_decode(file_get_contents("http://emoncms.org/feed/data.json?id={$id}&start={$start}&end={$end}&interval={$interval}&skipmissing=0&limitinterval=0"));
        }
        if ($route->action == "valueremote") {
            $id = (int) get("id");
            $result = (double) json_decode(file_get_contents("http://emoncms.org/feed/value.json?id={$id}"));
        }
    }
    return array('content' => $result, 'fullwidth' => true);
}
コード例 #2
0
// variables
$silentRun = false;
if ($argc > 1 && $argv[1] == '-s') {
    $silentRun = true;
}
$cleanupIfFail = true;
if ($argc > 1 && $argv[1] == '-c') {
    $cleanupIfFail = false;
    $silentRun = true;
}
$app = new AppConfig();
$installer = new Installer();
$user = new UserInput();
$db_params = array();
// set the installation ids
$app->set('INSTALLATION_UID', uniqid("IID"));
// unique id per installation
// load or create installation sequence id
if (is_file(FILE_INSTALL_SEQ_ID)) {
    $install_seq = @file_get_contents(FILE_INSTALL_SEQ_ID);
    $app->set('INSTALLATION_SEQUENCE_UID', $install_seq);
} else {
    $install_seq = uniqid("ISEQID");
    // unique id per a set of installations
    $app->set('INSTALLATION_SEQUENCE_UID', $install_seq);
    file_put_contents(FILE_INSTALL_SEQ_ID, $install_seq);
}
// read package version
$version = parse_ini_file('package/version.ini');
logMessage(L_INFO, "Installing Kaltura " . $version['type'] . ' ' . $version['number']);
$app->set('KALTURA_VERSION', 'Kaltura ' . $version['type'] . ' ' . $version['number']);