示例#1
0
function handle(array $req)
{
    if (array_key_exists('load', $_REQUEST)) {
        return load_handler('load');
    } else {
        Core\JSON_Response::getInstance()->log($_REQUEST);
    }
}
示例#2
0
/**
 * [load_request description]
 * @param  [type] $request [description]
 * @return [type]          [description]
 */
function load_request($request)
{
    $resp = \shgysk8zer0\Core\JSON_Response::getInstance();
    $dom = \shgysk8zer0\DOM\HTML::getInstance();
    switch ($request) {
        case 'readme':
            $readme = call_user_func($dom->body, 'readme')[0];
            return $resp->append('body', $readme)->showModal("#{$readme->id}");
            break;
        case 'ad_insertion':
            return load_form('ad_insertion');
            break;
        case 'login':
            return load_form('login');
            break;
        default:
            \shgysk8zer0\Core\Console::getInstance()->error(sprintf(ERROR_FORMAT, $request));
            return $resp->notify('Unhandled request', sprintf(ERROR_FORMAT, $_REQUEST['load']), 'images/octicons/svg/bug.svg')->error(['$_REQUEST' => $_REQUEST]);
    }
}
示例#3
0
 /**
  * Log error exceptions to user console using JSON_Response::error
  *
  * @param ErrorException $err_exc The error exception
  * @return void
  * @uses JSON_Response
  */
 public function consoleErrorException(\ErrorException $err_exc)
 {
     Core\JSON_Response::load()->error(['message' => $err_exc->getMessage(), 'code' => $err_exc->getCode(), 'severity' => $err_exc->getSeverity(), 'line' => $err_exc->getLine(), 'file' => $err_exc->getFile(), 'trace' => $err_exc->getTrace()]);
 }
示例#4
0
<?php

$resp = \shgysk8zer0\Core\JSON_Response::load();
switch ($_POST['action']) {
    case 'logout':
        $login->logout();
        $session->destroy();
        $session = new \shgysk8zer0\Core\Session();
        nonce();
        $resp->enable('#main_menu menuitem[label=Login]')->disable('#main_menu menuitem[label=Logout]')->attributes('body > main', 'contextmenu', false)->sessionStorage('nonce', $session->nonce)->notify('User has been logged out', 'Login again to make changes.', 'images/icons/people.png');
        break;
    case 'Clear PHP_errors':
        require_login('admin');
        $DB->resetTable('errors');
        file_put_contents(BASE . '/errors.log', null, LOCK_EX);
        $resp->notify('Success!', "Table (PHP_errors) has been reset", 'images/icons/db.png');
        break;
    case 'restore database':
        require_login('admin');
        $connect = \shgysk8zer0\Core\resources\Parser::parseFile('connect.json');
        $DB->restore($connect->database) ? $resp->notify('Success', "The database has been restored from {$connect->database}.sql", 'images/icons/db.png')->reload() : $resp->notify('Failed', "There was a problem restoring from {$connect->database}.sql", 'images/icons/db.png');
        break;
    case 'backup database':
        require_login('admin');
        $connect = \shgysk8zer0\Core\resources\Parser::parseFile('connect.json');
        $DB->dump() ? $resp->notify('Success', "The database has been backed up to {$connect->database}.sql", 'images/icons/db.png') : $resp->notify("Unable to backup to {$connect->database}.sql", 'Check file permissions', 'images/icons/db.png');
        break;
    case 'update_sitemap':
        require_login('admin');
        update_sitemap();
        $resp->notify('Sitemap has been updated', 'View ' . URL . 'sitemap.xml', 'images/icons/db.png');
示例#5
0
<?php

if (empty($_REQUEST)) {
    load('handlers/pages');
} elseif (array_key_exists('load_form', $_POST)) {
    load('handlers/load_form');
} elseif (array_key_exists('form', $_POST)) {
    load('handlers/form');
} elseif (array_key_exists('load_menu', $_POST)) {
    load('handlers/load_menu');
} elseif (array_key_exists('datalist', $_REQUEST)) {
    load('handlers/datalist');
} elseif (array_key_exists('template', $_REQUEST)) {
    load('handlers/template');
} elseif (array_key_exists('action', $_POST)) {
    load('handlers/action');
} elseif (array_key_exists('request', $_POST)) {
    load('handlers/request');
} elseif (array_key_exists('debug', $_POST)) {
    load('handlers/debug');
} elseif (array_key_exists('hangman', $_REQUEST)) {
    load('handlers/hangman');
} elseif (array_key_exists('view_source', $_REQUEST)) {
    load('handlers/view_source');
}
exit(\shgysk8zer0\Core\JSON_Response::load());