Exemple #1
0
 public function Page()
 {
     if ($this->requireAuth) {
         Tool::requireAuth();
     }
     $this->gatherParameterFromRequest();
     if (Conf::get('PROD')) {
         $this->addScript('js/_prod/lib.js');
         $this->addScript('js/_prod/base.js');
     } else {
         $files = array();
         $files = array_merge($files, array_reverse(Tool::scanDirectory('js/lib', true)));
         $files = array_merge($files, array_reverse(Tool::scanDirectory('js')));
         foreach ($files as $file) {
             $this->addScript($file);
         }
     }
 }
Exemple #2
0
 public function Page()
 {
     if ($this->requireAuth) {
         Tool::requireAuth();
     }
     $this->gatherParameterFromRequest();
     if (Conf::get('PROD')) {
         $this->addScript('_prod/lib.js');
         $this->addScript('_prod/base.js');
     } else {
         $files = array();
         foreach (scandir(Conf::get('ROOT_DIR') . 'js/lib') as $file) {
             if (preg_match('/(\\.js)$/i', $file)) {
                 $files[] = 'lib/' . $file;
             }
         }
         foreach (scandir(Conf::get('ROOT_DIR') . 'js') as $file) {
             if (preg_match('/(\\.js)$/i', $file)) {
                 $files[] = $file;
             }
         }
         if (file_exists(Conf::get('ROOT_DIR') . 'js/order.json')) {
             $order = json_decode(file_get_contents(Conf::get('ROOT_DIR') . 'js/order.json'));
             $n = 0;
             foreach ($order as $file) {
                 $key = array_search($file, $files);
                 if ($key !== false) {
                     $item = $files[$n];
                     $files[$n] = $file;
                     $files[$key] = $item;
                     $n++;
                 }
             }
         }
         foreach ($files as $file) {
             $this->addScript($file);
         }
     }
 }
Exemple #3
0
 public function Remote()
 {
     if ($this->requireAuth) {
         Tool::requireAuth();
     }
 }
Exemple #4
0
    static $tpl;
    static function init()
    {
        self::$tpl = new Template();
    }
}
Globals::init();
// STATS
function addStatsHeaders()
{
    header('X-MySQL_Stats: ' . number_format(DB::$totalQueryTime, 3) . ' sc (nb ' . DB::$totalQuery . ')');
    header('X-PHP_Stats: ' . number_format(microtime(true) - START_TIME, 3) . ' sc (tpl ' . number_format(Globals::$tpl->execTime, 3) . 'sc)');
}
// AUTH
if (Conf::get('AUTH_ENABLED')) {
    Tool::requireAuth();
}
// TEMPLATE ENGINE
Globals::$tpl->cacheTimeCoef = Conf::get('CACHE_TIMECOEF');
Globals::$tpl->assignVar(array('PAGE_TITLE' => Conf::get('PAGE_TITLE'), 'PAGE_DESCRIPTION' => Conf::get('PAGE_DESCRIPTION'), 'PAGE_KEYWORDS' => Conf::get('PAGE_KEYWORDS'), 'ROOT_PATH' => Conf::get('ROOT_PATH'), 'MEDIA_PATH' => Conf::get('MEDIA_PATH'), 'VERSION' => Conf::get('VERSION')));
// DECTECT IF AJAX
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $ajax = true;
    Globals::$tpl->assignSection('AJAX');
} else {
    $ajax = false;
    Globals::$tpl->assignSection('NOT_AJAX');
}
// REMOTES
if (isset($_GET['remote'])) {
    $className = Tool::path2class($_GET['remote'], 'Remote');