示例#1
0
文件: main.php 项目: Anaphore/viewer
if (!defined('DEFAULT_PICTURE')) {
    define('DEFAULT_PICTURE', 'main.jpg');
}
$app->hook('slim.before.dispatch', function () use($app, $conf, $lang, $app_base_url) {
    //let's send view parameters before dispatching
    $v = $app->view();
    $ui = $conf->getUI();
    $v->setData('app_base_url', $app_base_url);
    $v->setData('app_web_url', str_replace(array('/index.php', '/debug.php'), array('', ''), $app_base_url));
    $v->setData('enable_right_click', $ui['enable_right_click']);
    $v->setData('lang', $lang);
    $v->setData('negate', $ui['negate']);
    $v->setData('contrast', $ui['contrast']);
    $v->setData('brightness', $ui['brightness']);
    $v->setData('print', $ui['print']);
    $v->setData('comment', $conf->getComment());
    $fmts = $conf->getFormats();
    $v->setData('thumb_format', $fmts['thumb']);
    $remote_infos = $conf->getRemoteInfos();
    if ($remote_infos !== false) {
        $v->setData('remote_method', $remote_infos['method']);
        $v->setData('remote_uri', $remote_infos['uri']);
    }
});
//set default conditions
Route::setDefaultConditions(array('image' => '.+\\.[a-zA-Z]{3,4}', 'series' => '.+', 'format' => 'full|' . implode('|', array_keys($conf->getFormats()))));
//404 handler
$app->notFound(function () use($app) {
    $app->render('404.html.twig');
});
//custom error handler
示例#2
0
文件: Conf.php 项目: Anaphore/viewer
 /**
  * Test comment settings
  *
  * @return void
  */
 public function testGetComment()
 {
     //first, test default configuration
     $conf = new Viewer\Conf();
     $commentParam = $conf->getComment();
     $this->boolean($commentParam)->isTrue();
 }