Пример #1
0
    case 'verify':
        if ($pingPassword == trim($_REQUEST['password'])) {
            $result = array('result' => 'OK');
        } else {
            $result = array('result' => 'fail', 'reason' => 'wrong ping password');
        }
        print json_encode($result);
        break;
    case 'ping':
        if (trim(cfg('ping/password')) == trim($_REQUEST['password'])) {
            $baseCtr = h2_getController('endpoint');
            h2_invokeAction($baseCtr, 'cron');
            print h2_invokeView($baseCtr, 'cron');
            h2_statlog('cron', 'cron');
            $result = array('result' => 'OK', 'stamp' => time(), 'runtime' => profiler_microtime_diff(microtime(), $GLOBALS['profiler_start']));
        } else {
            $result = array('result' => 'fail', 'reason' => 'wrong ping password');
        }
        print json_encode($result);
        break;
    default:
        if ($_SERVER['SERVER_PROTOCOL'] != '') {
            print json_encode(array('result' => 'fail', 'reason' => 'invalid ping request'));
        } else {
            $baseCtr = h2_getController('endpoint');
            h2_invokeAction($baseCtr, 'cron');
            print h2_invokeView($baseCtr, 'cron');
            h2_statlog('cron', 'cron');
        }
        break;
}
Пример #2
0
chdir($GLOBALS['APP.BASEDIR']);
require 'lib/genlib.php';
require 'lib/hubbub2.php';
require 'lib/database.php';
profile_point('classes ready');
require 'lib/config.php';
profile_point('config loaded');
h2_init_hubbub_environment();
// if there was output up to this point, it has to be an error message
$GLOBALS['content.startuperrors'] = trim(ob_get_clean());
// enable gzip compression by default
profile_point('environment ready');
WriteToFile('log/activity.log', 'call ' . $_REQUEST['controller'] . '-' . $_REQUEST['action'] . "\n");
// instantiate controller, invoke action, render view
$_REQUEST['controller'] = getDefault($_REQUEST['controller'], cfg('service/defaultcontroller'));
$baseCtr = h2_getController($_REQUEST['controller']);
profile_point('controller invoked');
h2_invokeAction($baseCtr, $_REQUEST['action']);
profile_point('action executed');
$GLOBALS['content']['main'] = h2_invokeView($baseCtr, $_REQUEST['action']);
profile_point('view executed');
// output through page template
$templateName = cfg('page/template', 'default');
switch ($templateName) {
    case 'blank':
        print $GLOBALS['content']['main'];
        break;
    default:
        header('content-type: text/html;charset=UTF-8');
        require 'themes/' . cfg('theme/name', 'default') . '/' . $templateName . '.php';
        break;
Пример #3
0
 function integrate($subController)
 {
     // first let's init the sub controller
     // fixme: technically, we'd need this only if it's actually used so it would make
     // sense to only init the sub controller as needed when it's called
     $this->subControllers[$subController] = h2_getController($subController, false);
     $this->subControllers[$subController]->parent =& $this;
     // sub controllers are awesome to compartmentalize functionality into smaller
     // packages, but they break the default behavior of actionUrl() - so we need to
     // make sure actionUrl() knows that this controller is slaved to its parent or
     // else we're screwing up the URL call path for it:
     $GLOBALS['subcontrollers'][$subController] = $this->name;
 }