Exemplo n.º 1
0
         }
         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 {
         if ($user->isGuest()) {
             $process = $modules->get("ProcessLogin");
             $content = $process->execute();
         } else {
             $this->error($e->getMessage());
         }
     }
 } catch (Exception $e) {
     $msg = $e->getMessage();
Exemplo n.º 2
0
    $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
     *
     */
    $errorMessage = "Exception: " . $e->getMessage() . " (in " . $e->getFile() . " line " . $e->getLine() . ")";
    if ($config->debug || $wire && $wire->user && $wire->user->isSuperuser()) {