Example #1
0
 private function initialize($node)
 {
     $this->title = '';
     $this->keywords = '';
     $this->description = '';
     $this->html = '';
     $this->css = '';
     $this->js = '';
     $is_404 = null === $this->page;
     $this->page = SystemPage::get($node->getProperty('reference'));
     if (null === $this->page) {
         header("HTTP/1.0 404 Not Found");
         $this->initialize(Router::$root->getById(Config::get('404_PAGE')));
         return;
     }
     $this->title = $node->getProperty('title');
     $this->keywords = $node->getProperty('keywords');
     $this->description = $node->getProperty('description');
     $this->render_page();
     $this->render_view();
     ob_start();
     eval('?>' . $this->html);
     if (count(Router::$parts)) {
         ob_end_clean();
         Router::$parts = array();
         header("HTTP/1.0 404 Not Found");
         $this->initialize(Router::$root->getById(Config::get('404_PAGE')));
         return;
     }
     if (Config::get('CACHE_ENABLED')) {
         Cache::add(Router::$url, Router::export() . $this->html);
         $filename = 'cache/' . md5(Router::$url);
         file_put_contents($filename, php_strip_whitespace($filename));
     }
 }
Example #2
0
File: ajax.php Project: fulldump/8
<?php

$param = Router::$parameters;
if (!array_key_exists('{component}', $param)) {
    echo 'show all component list if mode debug on. Else 404';
    return;
}
if (!array_key_exists('{call}', $param)) {
    echo "See all calls for the component '{$parameters['{component}']}' if mode debug on. Else 404";
    return;
}
$component = SystemComponent::getComponentByName($param['{component}']);
if (null === $component) {
    echo "Component does not exist (debug mode). Else 404";
    return;
}
$ajax = $component->getAjax($param['{call}']);
if (null === $ajax) {
    echo "Ajax does not exist (debug mode). Else 404";
    return;
}
eval('?>' . $ajax);
// TODO: fix this !!!
if (Config::get('CACHE_AJAX_ENABLED')) {
    $cached = Router::export() . $ajax;
    Cache::add(Router::$url, $cached);
    $filename = 'cache/' . md5(Router::$url);
    file_put_contents($filename, php_strip_whitespace($filename));
}