public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new SessionBasedNotifications();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
function redirect($url, $reason, $showRedirectionPage = true, $karma = 0)
{
    define('REDIRECT', $url);
    if (!$showRedirectionPage) {
        SessionBasedNotifications::getInstance()->add($reason, $karma);
        define('REDIRECT_TIMEOUT', 0);
    } else {
        define('REDIRECT_TIMEOUT', 3);
    }
    require_once 'includes/widgets/header.minimal.php';
    echo '<br />';
    startBox();
    echo '<p>You are being redirected to <a href = "' . $url . '">here</a>.</p>';
    stopBox('Redirecting: ' . $reason);
    require_once 'includes/widgets/footer.minimal.php';
}
Exemplo n.º 3
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');