Esempio n. 1
0
 public function __construct()
 {
     parent::__construct('mumbleSettings', 'Mumble settings');
     $this->addElement(new ElementTextbox('excludePages', 'Exclude pages', getSiteSetting('plugin.mumble.ignorePages')));
     $this->addElement(new ElementTextbox('excludePagesAdmin', 'Exclude pages as admin', getSiteSetting('plugin.mumble.ignorePages.admin')));
     $this->addDefaultButtons();
 }
 public function __construct($email)
 {
     parent::__construct('sendEmail', 'Send Email to user');
     $this->email = $email;
     $this->addElement(new ElementHtml('email', null, 'Send to: ' . $this->email));
     $this->addElement(new ElementAlphaNumeric('subject', 'Subject', getSiteSetting('defaultEmailSubject')));
     $this->addElement(new ElementTextbox('content', 'Content', 'Your message here', 'Footers will automatically be applied.'));
     $this->addButtons(Form::BTN_SUBMIT);
 }
 public function __construct($user)
 {
     parent::__construct('avatar');
     Session::requirePriv('CHANGE_AVATAR');
     $this->enctype = 'multipart/form-data';
     $this->addElement(new ElementFile('avatar', 'Avatar', null, 'You may upload a png or jpg, maximum size ' . getSiteSetting('avatarMaxWidth') . ' x ' . getSiteSetting('avatarMaxHeight') . ' pixels. Remember to press F5 to refresh your avatar after you have uploaded it!'));
     $this->getElement('avatar')->destinationDir = 'resources/images/avatars/';
     $this->getElement('avatar')->imageMaxW = getSiteSetting('avatarMaxWidth');
     $this->getElement('avatar')->imageMaxH = getSiteSetting('avatarMaxHeight');
     $this->addElement(new ElementHidden('user', 'User', $user));
     $this->addDefaultButtons();
 }
Esempio n. 4
0
 public function __construct()
 {
     parent::__construct('teamspeak3Settings', 'Teamspeak 3 settings');
     $this->addElement(new ElementTextbox('excludePages', 'Exclude pages', getSiteSetting('plugin.teamspeak3.ignorePages')));
     $this->addElement(new ElementTextbox('excludePagesAdmin', 'Exclude pages as admin', getSiteSetting('plugin.teamspeak3.ignorePages.admin')));
     $this->addElement(new ElementInput('teamspeak3Host', 'Teamspeak Host Name', getSiteSetting('plugin.teamspeak3.host')));
     $this->addElement(new ElementNumeric('teamspeak3Port', 'Teamspeak 3 Port', getSiteSetting('plugin.teamspeak3.port')));
     $this->addDefaultButtons();
 }
Esempio n. 5
0
 private function validateSiteQuiesse(User $user)
 {
     if (getSiteSetting('maintenanceMode') && !$user->hasPriv('SUPERUSER')) {
         $this->setElementError('username', 'The site is down for maintenance.');
     }
 }
Esempio n. 6
0
 public function __construct()
 {
     parent::__construct('sidebarWikiSettings', 'Sidebar wiki settings');
     $this->addElement(new ElementTextbox('enabledPages', 'Enabled pages', getSiteSetting('plugins.sidebarWiki.enabledPages')));
     $this->addDefaultButtons();
 }
Esempio n. 7
0
<?php

// Clear any  buffers, which hopefully don't exist by now.
flushOutputBuffers();
global $tpl, $db;
$tpl->assign('queryCount', $db->queryCount);
$tpl->assign('randNum', rand(0, 10));
$tpl->assign('copyright', getSiteSetting('copyright'));
$stuff = array('new processes processed', 'donuts eaten', 'flying waffles avoided', 'spatial anonymity identified', 'whales harpooned', 'umpa lumpas killed', 'monkeys utilized', 'meatballs neutralized', 'hard disks burnt', 'spelling mistakes', 'UFOs identified', 'burnt pizzas', 'processors used', 'admins interfered', 'more minecraft players identified');
$tpl->assign('randTxt', $stuff[array_rand($stuff)]);
$tpl->display('footer.tpl');
exit;
Esempio n. 8
0
if (isset($_REQUEST['username'])) {
    $loginForm->getElement('username')->setValue(filter_var($_REQUEST['username'], FILTER_SANITIZE_STRING));
}
if ($loginForm->validate()) {
    $username = $loginForm->getElementValue('username');
    $password = $loginForm->getElementValue('password');
    try {
        Session::checkCredentials($username, $password);
        applyAchievements();
        logActivity('Logged in');
        redirect('index.php', 'You have sucessfully logged in.');
    } catch (\libAllure\UserNotFoundException $e) {
        $loginForm->setElementError('username', 'User not found.');
    } catch (\libAllure\IncorrectPasswordException $e) {
        $loginForm->setElementError('password', 'Incorrect password.');
    } catch (Exception $e) {
        $loginForm->setGeneralError('Failed to login because of a system problem.');
        Logger::messageException($e);
    }
}
require_once 'includes/widgets/header.php';
require_once 'includes/widgets/sidebar.php';
ob_end_flush();
if (isset($_REQUEST['redirect'])) {
    echo '<p><strong>You will be redirected after you login.</strong></p>';
    $loginForm->addElement(new ElementHidden('redirect', $_REQUEST['redirect']));
}
$tpl->assign('isMaintMode', getSiteSetting('maintenanceMode'));
$tpl->assignForm($loginForm);
$tpl->display('login.tpl');
require_once 'includes/widgets/footer.php';
Esempio n. 9
0
function getThemeDirectory()
{
    $installedThemes = 'resources/themes/';
    if (Session::isLoggedIn()) {
        $theme = Session::getUser()->getData('theme');
        if (is_dir($installedThemes . $theme)) {
            return $installedThemes . $theme;
        }
    }
    return $installedThemes . getSiteSetting('theme', 'airdale');
}
Esempio n. 10
0
<?php

require_once 'includes/common.php';
require_once 'includes/classes/Galleries.php';
require_once 'includes/classes/FormGalleryEdit.php';
require_once 'includes/classes/ItemGallery.php';
use libAllure\Sanitizer;
use libAllure\Session;
$sanitizer = new Sanitizer();
$mode = $sanitizer->filterString('mode');
if (!getSiteSetting('galleryFeature')) {
    redirect('index.php', 'Gallery feature is disabled.');
}
switch ($mode) {
    case 'editImage':
        requirePrivOrRedirect('GALLERY_UPDATE_IMAGE');
        require_once 'updateGalleryImage.php';
        break;
    case 'addImage':
        requirePrivOrRedirect('GALLERY_CREATE_IMAGE');
        $gallery = intval($_REQUEST['gallery']);
        $filename = $_REQUEST['filename'];
        $sql = 'INSERT INTO images (gallery, filename) VALUES (:gallery, :filename) ';
        $stmt = $db->prepare($sql);
        $stmt->bindValue(':gallery', $gallery);
        $stmt->bindValue(':filename', $filename);
        $stmt->execute();
        redirect('viewGalleryImage.php?filename=' . $filename . '&amp;gallery=' . $gallery, 'Image added to database.');
        break;
    case 'makeCoverImage':
        requirePrivOrRedirect('GALLERY_SET_COVER_IMAGE');
Esempio n. 11
0
<?php

if (defined('REDIRECT') && defined('REDIRECT_TIMEOUT') && REDIRECT_TIMEOUT == 0) {
    header('HTTP/1.1 303 See Other');
    header('Location:' . REDIRECT);
}
require_once 'includes/common.php';
global $tpl;
if (defined('REDIRECT')) {
    $tpl->assign('redirect', REDIRECT);
    $tpl->assign('redirectTimeout', REDIRECT_TIMEOUT);
}
$tpl->assign('siteTitle', getSiteSetting('siteTitle', 'Untitled LPS site'));
$tpl->assign('theme', getSiteSetting('theme', 'airdale'));
$tpl->display('header.minimal.tpl');
Esempio n. 12
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.');
    }
}
Esempio n. 13
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');
Esempio n. 14
0
<?php

require_once 'includes/common.php';
require_once 'includes/classes/News.php';
require_once 'includes/classes/FormNewsEdit.php';
require_once 'includes/classes/FormNewsCreate.php';
use libAllure\Sanitizer;
use libAllure\Session;
if (!getSiteSetting('newsFeature')) {
    redirect('index.php', 'News feature is disabled.');
}
$action = Sanitizer::getInstance()->filterString('action');
switch ($action) {
    case 'add':
    case 'new':
        if (!Session::hasPriv('NEWS_ADD')) {
            throw new PermissionsException();
        }
        $f = new FormNewsCreate();
        if ($f->validate()) {
            $f->process();
            logAndRedirect('news.php', 'News item added: ' . $f->getElementValue('title'));
        }
        require_once 'includes/widgets/header.php';
        require_once 'includes/widgets/sidebar.php';
        $tpl->displayForm($f);
        break;
    case 'edit':
        $id = intval($_REQUEST['id']);
        $f = new FormNewsEdit($id);
        if ($f->validate()) {
 private function processUserProvideEmail()
 {
     global $db;
     $resetCode = uniqid();
     $sql = 'UPDATE users u SET u.passwordResetSecret = :resetCode WHERE u.email = :email LIMIT 1';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':resetCode', $resetCode);
     $stmt->bindValue(':email', $this->getElementValue('email'));
     $stmt->execute();
     $content = "Hey,\n\nYou asked for your password to be reset. Your reset code is: {$resetCode} \n\nGo to this page to complete the reset: " . getSiteSetting('baseUrl') . "/forgotPassword.php?state=2 \n\nIf you have any problems, contact us. Do not reply to this email.\n\n";
     sendEmail($this->getElementValue('email'), 'Password reset code', $content);
     echo '<div class = "box"><h2>Password reset email has been sent.</h2><p>Check your email.</p><a href = "forgotPassword.php?state=2">I have the secret code!</a></div>';
     require_once 'includes/widgets/footer.php';
 }
Esempio n. 16
0
function connectDatabase()
{
    try {
        $db = new \libAllure\Database(CFG_DB_DSN, CFG_DB_USER, CFG_DB_PASS);
        \libAllure\DatabaseFactory::registerInstance($db);
    } catch (Exception $e) {
        throw new Exception('Could not connect to database. Check the username, password, host, port and database name.<br />' . $e->getMessage(), null, $e);
    }
    try {
        $maint = getSiteSetting('maintenanceMode', 'NONE');
    } catch (Exception $e) {
        if ($e->getCode() == '42S02') {
            throw new Exception('Settings table not found. Did you import the table schema?', null, $e);
        } else {
            throw new Exception('Unhandled SQL error while getting settings table: ' . $e->getMessage(), null, $e);
        }
    }
    if ($maint === 'NONE') {
        throw new Exception('Essential setting "maintenanceMode" does not exist in the DB. Did you import the initial data?');
    }
    return $db;
}
Esempio n. 17
0
        break;
    case 'paypalFail':
        logAndRedirect('account.php', 'Paypal transaction failed.');
        break;
    case 'paypalComplete':
        logActivity('Started processing PayPal payment notification');
        foreach (Basket::getContents() as $ticket) {
            logActivity('PayPal transaction processing - setting status to PAID for event. Ticket owner _u_, event _e_', $ticket['userId'], array('event' => $ticket['eventId'], 'user' => Session::getUser()->getId()));
            Events::setSignupStatus($ticket['userId'], $ticket['eventId'], 'PAID');
        }
        logActivity('Finished processing PayPal payment notification.');
        Basket::clear();
        redirect('account.php', 'Thanks, payment complete!');
        break;
    default:
        require_once 'includes/widgets/header.php';
        require_once 'includes/widgets/sidebar.php';
        startBox();
        echo str_replace('%BASKETTOTAL%', doubleToGbp($cost), getContent('selectPaymentMethod'));
        $tpl->assign('cost', $cost);
        $tpl->assign('costPaypal', getPaypalCommission($cost));
        $tpl->assign('paypalEmail', getSiteSetting('paypalEmail'));
        $tpl->assign('listBasketContents', Basket::getContents());
        $tpl->assign('baseUrl', getSiteSetting('baseUrl'));
        $tpl->assign('currency', getSiteSetting('currency'));
        $tpl->display('checkout.tpl');
        echo getContent('commissionDisclaimer');
        stopBox('Checkout');
}
box('If you are not yet finished, pop back to your <a href = "basket.php">basket</a>.', 'Agh, no!');
require_once 'includes/widgets/footer.php';
 public function __construct()
 {
     parent::__construct('countdownSettings', 'Countdown settings');
     $this->addElement(new ElementTextbox('excludePages', 'Exclude pages', getSiteSetting('plugin.countdown.ignorePages')));
     $this->addDefaultButtons();
 }
Esempio n. 19
0
<?php

require_once 'includes/common.php';
switch ($_GET['source']) {
    case 'news':
        $sql = 'SELECT n.id, n.title, n.content, n.date FROM news n ORDER BY n.date DESC LIMIT 30';
        $result = $db->query($sql);
        $listArticles = array();
        $baseUrl = getSiteSetting('baseUrl');
        foreach ($result->fetchAll() as $article) {
            $listArticles[] = array('title' => $article['title'], 'description' => $article['content'], 'link' => $baseUrl . '/news.php', 'id' => $article['id'], 'date' => date(DATE_RSS, strtotime($article['date'])));
        }
        $tpl->assign('title', 'RSSFEED');
        $tpl->assign('articles', $result->fetchAll());
        $tpl->assign('baseUrl', getSiteSetting('baseUrl'));
        $tpl->assign('rssUrl', getSiteSetting('baseUrl') . 'extern.php?source=news&amp;format=rss');
        $tpl->assign('lastBuildDate', date(DATE_RSS));
        $tpl->assign('listArticles', $listArticles);
        header('Content-Type: application/rss+xml');
        $tpl->display('rssfeed.tpl');
        break;
    default:
        die('Unknown source.');
}