Example #1
0
}
if ($page->process && $page->process != 'ProcessPageView') {
    try {
        if ($config->demo && !in_array($page->process, array('ProcessLogin'))) {
            if (count($_POST)) {
                $this->error("Saving is disabled in this demo");
            }
            foreach ($_POST as $k => $v) {
                unset($_POST[$k]);
            }
            foreach ($_FILES as $k => $v) {
                unset($_FILES[$k]);
            }
            $input->post->removeAll();
        }
        $controller = new ProcessController();
        $controller->setProcessName($page->process);
        $initFile = $config->paths->adminTemplates . 'init.php';
        if (is_file($initFile)) {
            include $initFile;
        }
        if ($input->get->modal) {
            $session->addHookBefore('redirect', null, '_hookSessionRedirectModal');
        }
        $content = $controller->execute();
    } catch (Wire404Exception $e) {
        $this->error($e->getMessage());
    } catch (WirePermissionException $e) {
        if ($controller && $controller->isAjax()) {
            $content = $controller->jsonMessage($e->getMessage(), true);
        } else {
     *
     */
    $wire = new ProcessWire($config);
    /*
     * Store the admin URL in the configuration
     *
     */
    if ($config->adminRootPageID) {
        $config->urls->admin = $wire->pages->get($config->adminRootPageID)->url;
    }
    /* 
     * If we're not being called from another shell script or PHP page, then run the PageView process
     *
     */
    if (isset($_SERVER['HTTP_HOST']) && realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
        $controller = new ProcessController();
        $controller->setProcessName("ProcessPageView");
        echo $controller->execute();
    } else {
        /*
         * Some other script included this for non-http use or access to the API without 
         * rendering any pages at this time. The $wire var may be used to access 
         * the API after including this file. 
         *
         */
    }
} catch (Exception $e) {
    /*
     * Formulate error message and send to the error handler
     *
     */