public function __construct() { parent::__construct('formAdditionalMenuItems', 'Additional Menu Items'); Session::requirePriv('ADDITIONAL_MENU_ITEMS'); $this->addElement(new ElementTextbox('links', 'Links', $this->getLinks(), 'Format: title=url<newline>...')); $this->addDefaultButtons(); }
public function __construct($groupId) { parent::__construct('updateGroupPrivs', 'Update group privs'); Session::requirePriv('SUPERUSER'); $this->addElement(new ElementHidden('id', 'Group', $groupId)); $this->addElement($this->getPermissionElement()); $this->addDefaultButtons('Grant priv'); }
public function __construct($userId) { parent::__construct('addUserToGroup', 'Add user to group'); Session::requirePriv('GROUP_EDIT'); $this->addElement(new ElementHidden('id', 'User', $userId)); $elGroup = $this->getGroupSelection(); $this->addElement($elGroup); $this->addDefaultButtons(); }
public function __construct() { parent::__construct('formPermissionCreate', 'Create permission'); Session::requirePriv('SUPERUSER'); $this->addElement(new ElementAlphaNumeric('permission', 'Permission name', null, 'Even after creating a permission, it needs to be implemented in code for it to take affect.')); $this->getElement('permission')->setPatternToIdentifier(); $this->addElement(new ElementInput('description', 'Description')); $this->getElement('description')->setMinMaxLengths(0, 2555); $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(); }
public function __construct() { $this->settings = $this->getSettings(); Session::requirePriv('SITE_SETTINGS'); $this->addSection('General'); $this->addElement(new ElementCheckbox('maintenanceMode', 'Maintenance Mode', $this->settings['maintenanceMode'], 'Prevesnts user logins, allowing you to quiesse the site.')); $this->addElement(new ElementCheckbox('lanMode', 'LAN Mode', $this->settings['lanMode'], 'Makes this copy of the site a simplified version for the intranet at a LAN.')); $this->addElement(new ElementCheckbox('masterConnectionAvailable', 'Master connection available', $this->settings['masterConnectionAvailable'], 'When the site is in LAN mode, can it connect to the master site?')); $this->addElement(new ElementInput('masterConnectionUrl', 'Master connection URL', $this->settings['masterConnectionUrl'], 'When the site is in LAN mode, where is the master site?')); $this->addElement(new ElementInput('baseUrl', 'Base URL', $this->settings['baseUrl'])); $this->addElement(new ElementInput('siteTitle', 'Site title', $this->settings['siteTitle'])); $this->addElement(new ElementInput('siteDescription', 'Site description (for META tags)', $this->settings['siteDescription'])); $this->addElement(new ElementAlphaNumeric('copyright', 'Copyright', $this->settings['copyright'])); $this->addElement($this->getElementSiteTheme($this->settings['theme'])); $this->addElement(new ElementInput('globalAnnouncement', 'Global Announcement', $this->settings['globalAnnouncement'], 'An announcement displayed on every page of the site'))->setMinMaxLengths(0, 256); $this->addElement(new ElementInput('cookieDomain', 'Cookie Domain', $this->settings['cookieDomain'])); $this->addSection('Enabled site features'); $this->addElement(new ElementCheckbox('newsFeature', 'News feature', $this->settings['newsFeature'])); $this->addElement(new ElementCheckbox('galleryFeature', 'Gallery feature', $this->settings['galleryFeature'])); $this->addSection('Avatars'); $this->addElement(new ElementNumeric('avatarMaxWidth', 'Max width', $this->settings['avatarMaxWidth'], 'Max width of avatar in pixels.')); $this->getElement('avatarMaxWidth')->setBounds(20, 200); $this->addElement(new ElementNumeric('avatarMaxHeight', 'Max height', $this->settings['avatarMaxHeight'], 'Max height of avatar in pixels.')); $this->getElement('avatarMaxHeight')->setBounds(20, 200); $this->addSection('Email'); $this->addElement(new ElementInput('emailFrom', 'Email from', $this->settings['emailFrom'], 'In the footer of emails, who is the email from?')); $this->addElement(new ElementInput('mailerAddress', 'Mailer address ', $this->settings['mailerAddress'])); $this->addElement(new ElementInput('defaultEmailSubject', 'Default email subject', $this->settings['defaultEmailSubject'])); $this->addSection('Finance & Currency'); $this->addElement(new ElementInput('currency', 'Currency', $this->settings['currency']))->setMinMaxLengths(0, 3); $this->addElement(new ElementInput('moneyFormatString', 'Money Format String', $this->settings['moneyFormatString']))->setMinMaxLengths(0, 99); $this->getElement('moneyFormatString')->addSuggestedValue('£%.2n', 'UK Money format'); $this->getElement('moneyFormatString')->addSuggestedValue('%i', 'International format'); $this->addSection('Pay Pal'); $this->addElement(new ElementInput('paypalEmail', 'Paypal Email', $this->settings['paypalEmail']))->setRequired(false); $this->addElement(new ElementInput('paypalCommission', 'Paypal commission', $this->settings['paypalCommission'])); $this->getElement('paypalCommission')->setRequired(false); $this->getElement('paypalCommission')->setMinMaxLengths(0, 64); $this->addDefaultButtons(); }
} require_once 'includes/widgets/header.php'; $tpl->assignForm($f); $tpl->display('form.tpl'); break; case 'view': $id = $sanitizer->filterUint('id'); $group = new Group($id); require_once 'includes/widgets/header.php'; require_once 'includes/widgets/sidebar.php'; $tpl->assign('group', $group->getArray()); $tpl->assign('groupMembers', $group->getMembers()); $tpl->assign('groupPrivilegesList', $group->getPrivs()); $tpl->display('viewGroup.tpl'); break; case 'create': Session::requirePriv('GROUP_CREATE'); $f = new FormGroupCreate(); $f->addElement(new ElementHidden('action', null, 'create')); if ($f->validate()) { $f->process(); } require_once 'includes/widgets/header.php'; require_once 'includes/widgets/sidebar.php'; $tpl->assignForm($f); $tpl->display('form.tpl'); break; default: throw new Exception(); } require_once 'includes/widgets/footer.php';
<?php require_once 'includes/widgets/header.php'; use libAllure\Session; use libAllure\Sanitizer; use libAllure\DatabaseFactory; Session::requirePriv('GALLERY_DELETE_IMAGE'); $filename = Sanitizer::getInstance()->filterString('filename'); $gallery = Sanitizer::getInstance()->filterUint('gallery'); $image = Galleries::getImage($filename, $gallery); if ($image == false) { redirect('index.php', 'Image does not exist.'); } if (is_int($gallery) && $image['inDatabase'] && !empty($filename)) { $sql = 'DELETE FROM images WHERE filename = :filename AND gallery = :gallery'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->bindValue(':filename', $filename); $stmt->bindValue(':gallery', $gallery); $stmt->execute(); @unlink($image['fullPath']); @unlink($image['thumbPath']); } redirect('viewGallery.php?id=' . $image['galleryId'], 'Image deleted'); require_once 'includes/widgets/footer.php';
<?php require_once 'includes/common.php'; require_once 'includes/classes/FormSendEmail.php'; use libAllure\Session; use libAllure\Sanitizer; use libAllure\User; Session::requirePriv('SENDEMAIL'); $userId = Sanitizer::getInstance()->filterUint('userId'); $user = User::getUserById($userId); $email = $user->getData('email'); if (empty($email)) { redirect('account.php', 'Cannot send email to a user with a blank email address.'); } $f = new FormSendEmail($email); $f->addElementHidden('userId', $userId); if ($f->validate()) { $f->process(); redirect('profile.php?id=' . $userId, 'Your contribution to the spam on the internet has been completed.'); } else { require_once 'includes/widgets/header.php'; $tpl->assignForm($f); $tpl->display('form.tpl'); } require_once 'includes/widgets/footer.php';