Пример #1
0
set_include_path('./library');
spl_autoload_extensions('.php');
spl_autoload_register();
use Core\Application;
use Core\Config;
use Core\Setting;
use Utils\Menu;
use Manage\Authentification;
if (Config::Get('debug')) {
    error_reporting(-1);
    ini_set('display_errors', 1);
} else {
    error_reporting(0);
    ini_set('display_errors', 0);
}
$app = new Application();
$auth = new Authentification();
$navbar = new Menu();
$navbar->item($app->URL(), 'Share')->item($app->URL('review'), 'Review')->item($app->URL('details'), 'Details');
$navbar_right = new Menu();
if ((new Setting('api_display_doc'))->getValue() || $auth->isLogged()) {
    $navbar_right->item($app->URL('api'), 'API');
} else {
    if ((new Setting('api_requests'))->getValue()) {
        $navbar_right->item($app->URL('api/request'), 'API');
    }
}
$app->register(Menu::NAVBAR, $navbar);
$app->register(Menu::NAVBAR_RIGHT, $navbar_right);
// let's party hard
$app->run();
Пример #2
0
 protected function buildPage()
 {
     // theme
     $this->template->assign('theme', $this->theme->getTheme());
     $this->template->assign('themes', $this->theme->getThemes());
     // force to be a specific page
     $page = is_null($this->fake_page) ? $this->page : $this->fake_page;
     // infos
     $this->template->assign('app_name', (new Setting('app_name'))->getValueOrDefault());
     $this->template->assign('app_title', (new Setting('app_title'))->getValueOrDefault());
     $this->template->assign('app_description', (new Setting('app_description'))->getValueOrDefault());
     $this->template->assign('app_copyright', (new Setting('app_copyright'))->getValueOrDefault());
     $this->template->assign('app_robots', (new Setting('app_robots'))->getValueOrDefault());
     $this->template->assign('app_version', TextHelper::niceVersion(self::VERSION));
     $this->template->assign('app_api_version', TextHelper::niceVersion(\Picker\API::VERSION));
     $this->template->assign('app_full_version', self::VERSION);
     $this->template->assign('app_full_api_version', \Picker\API::VERSION);
     // user infos
     $this->template->assign('user_isLogged', $this->auth->isLogged());
     $this->template->assign('user_email', Session::Get(Authentification::SESSION_USER_EMAIL));
     // navbar
     if (!isset($this->modules[Menu::NAVBAR])) {
         $m = new Menu();
         $m->item('./', 'Home');
         $this->modules[Menu::NAVBAR] = $m;
     }
     $this->template->assign(Menu::NAVBAR, $this->modules[Menu::NAVBAR]->generate($this->url . $page));
     // navbar right
     if (isset($this->modules[Menu::NAVBAR_RIGHT])) {
         $this->template->assign(Menu::NAVBAR_RIGHT, $this->modules[Menu::NAVBAR_RIGHT]->generate($this->url . $page));
     }
     // javascript
     if (isset($this->modules['script_file'])) {
         $this->template->assign('script_files', $this->modules['script_file']);
     }
     if (isset($this->modules['script'])) {
         $this->template->assign('scripts', $this->modules['script']);
     }
 }