<?php

use libAllure\HtmlLinksCollection;
$menu = new HtmlLinksCollection('Gallery admin');
$menu->addIfPriv('GALLERY_EDIT', 'updateGallery.php?id=' . $_REQUEST['id'], 'Update gallery');
if ($menu->hasLinks()) {
    $tpl->assign('links', $menu);
    $tpl->display('sidebarLinks.tpl');
}
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$menu = new HtmlLinksCollection('Gallery admin');
$menu->addIf(Session::hasPriv('GALLERY_SCAN'), 'doScanImageGallery.php', 'Scan gallery for problems');
$menu->addIf(Session::hasPriv('GALLERY_CREATE'), 'createGallery.php', 'Create');
if ($menu->hasLinks()) {
    $tpl->assign('links', $menu);
    $tpl->display('sidebarLinks.tpl');
}
<?php

use libAllure\HtmlLinksCollection;
$links = new HtmlLinksCollection();
$links->add('form.php?form=FormCreateFinanceEntry', 'Create');
$links->add('listFinanceAccounts.php', 'Finance accounts');
$tpl->assign('links', $links);
$tpl->display('sidebarLinks.tpl');
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$linksCollection = new HtmlLinksCollection('Group Admin');
if (isset($group)) {
    $linksCollection->addIf(Session::hasPriv('EDIT_GROUP_PRIVILEGES'), 'group.php?action=privileges&amp;id=' . $group->getId(), 'Privileges');
    $linksCollection->addIf(Session::hasPriv('EDIT_GROUP_SETTINGS'), 'group.php?action=edit&amp;id=' . $group->getId(), 'Settings', null, 'siteSettings');
    $linksCollection->addIf(Session::hasPriv('GROUP_DELETE'), 'group.php?action=delete&amp;id=' . $group->getId(), 'Delete', null, 'delete');
} else {
    $linksCollection->addIf(Session::hasPriv('GROUP_CREATE'), 'group.php?action=create', 'Create');
}
$tpl->assign('links', $linksCollection);
$tpl->display('sidebarLinks.tpl');
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$linksCollection = new HtmlLinksCollection('Group Admin');
$linksCollection->addIf(Session::hasPriv('GROUP_CREATE'), 'group.php?action=create', 'Create');
$tpl->assign('links', $linksCollection);
$tpl->display('sidebarLinks.tpl');
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$linksCollection = new HtmlLinksCollection('Event admin');
//$linksCollection->addIf(Session::hasPriv('EVENT_DELETE'), 'deleteEvent.php?id=' . $_REQUEST['id'], 'Delete event', null, 'delete');
$linksCollection->addIf(Session::hasPriv('EVENT_UPDATE'), 'updateEvent.php?id=' . $event['id'], 'Update');
$linksCollection->addIf(Session::hasPriv('ADMIN_SEATING'), 'seatingplan.php?event=' . $event['id'], 'Seating plan');
if ($linksCollection->hasLinks()) {
    $tpl->assign('links', $linksCollection);
    $tpl->display('sidebarLinks.tpl');
}
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
if (!Session::isLoggedIn()) {
    return;
}
$isMe = Session::getUser()->getId() == $user->getId() && Session::hasPriv('CHANGE_AVATAR');
$linksCollection = new HtmlLinksCollection('User admin');
$linksCollection->addIf(Session::hasPriv('DELETE_USER'), 'users.php?action=delete&amp;id=' . $user->getId(), 'Delete', null, 'delete');
$linksCollection->addIf(Session::hasPriv('VIEW_ATTENDANCE'), 'viewAttendance.php?user='******'Attendance');
$linksCollection->addIf(Session::hasPriv('EDIT_USER') || $isMe, 'users.php?action=edit&amp;user='******'Update my profile' : 'Edit user', null, 'update');
$linksCollection->addIf(Session::hasPriv('SEND_EMAIL'), 'sendEmail.php?userId=' . $user->getId(), 'Send email');
$linksCollection->addIf(Session::hasPriv('EDIT_OTHERS_AVATAR') || $isMe, 'updateAvatar.php?user='******'Avatar', null, 'avatar');
$linksCollection->addIfPriv('SUDO', 'formSudo.php?username='******'SUDO');
if ($linksCollection->hasLinks()) {
    $tpl->assign('links', $linksCollection);
    $tpl->display('sidebarLinks.tpl');
}
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$menu = new HtmlLinksCollection('Gallery image');
if ($image['inDatabase']) {
    $menu->addIf(Session::hasPriv('GALLERY_UPDATE_IMAGE'), 'gallery.php?mode=editImage&amp;gallery=' . $gallery['id'] . '&amp;filename=' . $image['filename'], 'Edit database entry');
    $menu->addIf(Session::hasPriv('GALLERY_SET_COVER_IMAGE'), 'gallery.php?mode=makeCoverImage&amp;filename=' . $image['filename'] . '&amp;gallery=' . $gallery['id'], 'Make this the gallery cover image</a>');
} else {
    $menu->addIf(Session::hasPriv('GALLERY_CREATE_IMAGE'), 'gallery.php?mode=addImage&amp;gallery=' . $gallery['id'] . '&amp;filename=' . $image['filename'], 'Add database entry for image</a>');
}
$menu->addIfPriv('GALLERY_DELETE_IMAGE', 'deleteGalleryImage.php?filename=' . $image['filename'] . '&amp;gallery=' . $gallery['id'], 'Delete');
if ($menu->hasLinks()) {
    $tpl->assign('links', $menu);
    $tpl->display('sidebarLinks.tpl');
}
<?php

use libAllure\HtmlLinksCollection;
use liballure\Sanitizer;
$sanitizer = new Sanitizer();
$menu = new HtmlLinksCollection('View Finance Account');
$menu->add('form.php?form=FormCreateFinanceEntry&amp;account=' . $sanitizer->filterUint('id'), 'Create finance entry');
$menu->add('updateFinanceAccount.php?id=' . $sanitizer->filterUint('id'), 'Update');
$menu->addIf($sanitizer->filterUint('id') != 1, 'deleteFinanceAccount.php?id=' . $sanitizer->filterUint('id'), 'Delete');
$tpl->assign('links', $menu);
$tpl->display('sidebarLinks.tpl');
<?php

use liballure\HtmlLinksCollection;
$menu = new HtmlLinksCollection('Content admin');
$menu->add('updateContent.php?action=new', 'New block');
$tpl->assign('links', $menu);
$tpl->display('sidebarLinks.tpl');
Example #11
0
<?php

require_once 'includes/widgets/header.php';
use libAllure\DatabaseFactory;
use libAllure\AuthBackend;
use libAllure\HtmlLinksCollection;
$db = DatabaseFactory::getInstance();
$sql = 'SELECT count(u.id) AS count FROM users u';
$stmt = $db->prepare($sql);
$stmt->execute();
$countUsers = $stmt->fetchRow();
$countUsers = $countUsers['count'];
$setupLinks = new HtmlLinksCollection();
if ($countUsers == 1 || isset($_REQUEST['recreate'])) {
    $sql = 'DELETE FROM users WHERE username = "******"';
    $stmt = $db->prepare($sql)->execute();
    $adminPassword = uniqid();
    $sql = 'INSERT INTO users (username, password, `group`) VALUES (:username, :password, 1)';
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':username', 'admin');
    $stmt->bindValue(':password', AuthBackend::getInstance()->hashPassword($adminPassword));
    $stmt->execute();
    $tpl->assign('message', 'User account created. Your username is <strong>admin</strong> and your password is <strong>' . $adminPassword . '</strong>');
    $setupLinks->add('login.php', 'Login');
} else {
    $tpl->assign('message', 'Admin account already exists.');
    $setupLinks->add('login.php', 'Login');
    $setupLinks->add('?recreate', 'Recreate');
}
$tpl->assign('links', $setupLinks);
$tpl->display('notification.tpl');
Example #12
0
global $tpl, $db;
if (Session::isLoggedIn()) {
    $tpl->assign('avatar', 'resources/images/avatars/' . Session::getUser()->getId() . '.png');
    $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());
<?php

use libAllure\HtmlLinksCollection;
$links = new HtmlLinksCollection('Finance admin');
$links->add('createFinanceAccount.php', 'Create account');
$links->add('updateFinanceAllocator.php', 'Update finance allocator');
$tpl->assign('links', $links);
$tpl->display('sidebarLinks.tpl');
Example #14
0
    $unpublishedUserUploadedImages = $stmt->fetchAll();
    foreach ($unpublishedUserUploadedImages as $image) {
        $notifications[] = 'Image <a href = "viewGalleryImage.php?filename=' . $image['filename'] . '&gallery=' . $image['gallery'] . '">' . $image['filename'] . '</a> in gallery ' . $image['galleryTitle'] . ', uploaded by a user, is unpublished. Please publish or delete.';
    }
}
checkNotificationNotGuarenteedSeats($notifications);
$tpl->assign('notifications', $notifications);
$tpl->assign('emailFlagged', Session::getUser()->getData('emailFlagged'));
$tpl->assign('username', Session::getUser()->getUsername());
$standardLinks = new HtmlLinksCollection();
$standardLinks->addIf(Session::hasPriv('CHANGE_AVATAR'), 'updateAvatar.php', 'Avatar', 'avatar');
$standardLinks->addIf(Session::hasPriv('VIEW_ATTENDANCE'), 'viewAttendance.php', 'Attendance');
$standardLinks->addIfPriv('UPLOAD_GALLERY_IMAGE', 'formUploadImage.php', 'Upload gallery image');
$standardLinks->addIfPriv('VIEW_SURVEYS', 'listSurveys.php', 'Survey', 'survey');
$tpl->assign('standardLinks', $standardLinks);
$privilegedLinks = new HtmlLinksCollection();
$privilegedLinks->addIfPriv('ADMIN_USERS', 'users.php', 'Users', 'users');
$privilegedLinks->addIfPriv('ADMIN_GROUPS', 'listGroups.php', 'Groups');
$privilegedLinks->addIfPriv('ADMIN_USERS', 'formFlagEmail.php', 'Flag bad emails', 'users');
$privilegedLinks->addIfPriv('VIEW_PRIVS', 'listPermissions.php', 'Permissions');
$privilegedLinks->addIfPriv('VIEW_VENUES', 'listVenues.php', 'Venues');
$privilegedLinks->addIfPriv('EDIT_CONTENT', 'listContent.php', 'Content blocks', 'contentBlocks');
$privilegedLinks->addIfPriv('VIEW_LOG', 'listLogs.php', 'Log');
$privilegedLinks->addIfPriv('MAILING_LIST', 'viewMailingList.php', 'Mailing list');
$privilegedLinks->addIfPriv('SITE_SETTINGS', 'siteSettings.php', 'Site settings', 'siteSettings');
$privilegedLinks->addIfPriv('ADMIN_PLUGINS', 'plugins.php', 'Plugins');
$privilegedLinks->addIfPriv('ADDITIONAL_MENU_ITEMS', 'form.php?form=FormAdditionalMenuItems', 'Additional menu items');
$privilegedLinks->addIfPriv('FINANCES', 'listFinanceAccounts.php', 'Finances');
$privilegedLinks->addIfPriv('SUDO', 'formSudo.php', 'SUDO');
$privilegedLinks->addIfPriv('VIEW_SYSTEM_STATISTICS', 'viewSystemStatus.php', 'System Status');
$privilegedLinks->addIfPriv('MACHINE_AUTHENTICATIONS', 'listMachineAuthentications.php', 'Machine Authentications');
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$menu = new HtmlLinksCollection('Survey admin');
$menu->addIf(Session::hasPriv('SURVEY_CREATE'), 'createSurvey.php', 'Create');
if (isset($survey['id'])) {
    $menu->addIf(Session::hasPriv('SURVEY_UPDATE'), 'updateSurvey.php?id=' . $survey['id'], 'Update');
    $menu->addIf(Session::hasPriv('SURVEY_UPDATE'), 'viewSurveyVotes.php?id=' . $survey['id'], 'Show detail');
}
if ($menu->hasLinks()) {
    $tpl->assign('links', $menu);
    $tpl->display('sidebarLinks.tpl');
}
<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$links = new HtmlLinksCollection('Permissions admin');
$links->addIf(Session::hasPriv('CREATE_PERMISSION'), 'createPermission.php', 'Create permission', null, 'create');
$tpl->assign('links', $links);
$tpl->display('sidebarLinks.tpl');
?>

<?php

use libAllure\HtmlLinksCollection;
use libAllure\Session;
$eventAdminLinks = new HtmlLinksCollection('Events admin');
$eventAdminLinks->addIf(Session::hasPriv('EVENT_CREATE'), 'createEvent.php', 'Create event', null, 'create');
$eventAdminLinks->addIf(Session::hasPriv('EVENT_VIEW_SIGNUP_STATS'), 'viewSignupStatus.php', 'Signup status');
if ($eventAdminLinks->hasLinks()) {
    $tpl->assign('linksCollection', $eventAdminLinks);
    $tpl->display('sidebarWidgetLinks.tpl');
}