示例#1
0
require_once 'libAllure/FormHandler.php';
require_once 'includes/classes/Plugin.php';
require_once 'includes/classes/SessionBasedNotifications.php';
require_once 'includes/functions.php';
\libAllure\Form::$fullyQualifiedElementNames = false;
//\libAllure\ElementDate::$js = "<script type = \"text/javascript\">$('#NAME').datetimepicker({ dateFormat: 'yy-mm-dd', firstDay: 1, hour: 19, changeYear: true, changeMonth: true }); </script>";
\libAllure\ErrorHandler::getInstance()->beGreedy();
require_once 'libAllure/Template.php';
$tpl = new \libAllure\Template(defined('CFG_DIR_TEMPLATE_CACHE') ? CFG_DIR_TEMPLATE_CACHE : 'lps');
$tpl->addAutoClearVar('excludeBox');
$tpl->registerFunction('hasPriv', '\\libAllure\\Session::hasPriv');
$tpl->registerFunction('getContent', 'tplGetContent');
if (@(include 'includes/config.php') !== false) {
    require_once 'includes/config.php';
    $db = new \libAllure\Database(CFG_DB_DSN, CFG_DB_USER, CFG_DB_PASS);
    \libAllure\DatabaseFactory::registerInstance($db);
    require_once 'libAllure/AuthBackend.php';
    require_once 'libAllure/AuthBackendDatabase.php';
    $backend = new \libAllure\AuthBackendDatabase();
    $backend->setSalt(null, CFG_PASSWORD_SALT);
    $backend->registerAsDefault();
    \libAllure\Session::$cookieDomain = getSiteSetting('cookieDomain');
    \libAllure\Session::setSessionName('westlanUser');
    \libAllure\Session::setCookieLifetimeInSeconds(604800);
    \libAllure\Session::start();
    $tpl->template_dir = getThemeDirectory() . '/templates';
} else {
    if (!defined('INSTALLATION_IN_PROGRESS')) {
        redirect('installer.php', 'No config file found, assuming installation.');
    }
}
示例#2
0
    $tpl->assign('username', Session::getUser()->getUsername());
    $tpl->assign('userId', Session::getUser()->getId());
} else {
    $tpl->assign('avatar', 'resources/images/defaultAvatar.png');
    $tpl->assign('username', 'Guest');
}
// We don't output all the naviagion and whatnot if there has been some sort of error.
if (isset($_GET['error']) || basename($_SERVER['PHP_SELF']) == 'error.php') {
    return;
}
$sql = 'SELECT i.title, i.url FROM additional_menu_items i ';
$stmt = $db->query($sql);
$ll = new HtmlLinksCollection();
foreach ($stmt->fetchAll() as $link) {
    $ll->add($link['url'], $link['title']);
}
if (!empty($_SESSION['userHidden'])) {
    $tpl->assign('userHidden', $_SESSION['userHidden']->getUsername());
}
$tpl->assign('promo', 'resources/themes/westlan.ng/images/logo.png');
$tpl->assign('IS_LOGGED_IN', Session::isLoggedIn());
$tpl->assign('additionalLinks', $ll);
$tpl->assign('globalAnnouncement', getSiteSetting('globalAnnouncement'));
$tpl->assign('newsFeatureEnabled', getSiteSetting('newsFeature'));
$tpl->assign('galleryFeatureEnabled', getSiteSetting('galleryFeature'));
$tpl->assign('notification', SessionBasedNotifications::getInstance()->pop());
$tpl->assign('isMobileBrowser', isMobileBrowser());
$tpl->assign('theme', getThemeDirectory());
$tpl->assign('siteTitle', getSiteSetting('siteTitle'));
$tpl->assign('siteDescription', getSiteSetting('siteDescription'));
$tpl->display('header.tpl');