public function __construct($id, $isNewArticle = false) { $this->id = $id; Session::requirePriv('EDIT_BLOG'); if (empty($isNewArticle)) { parent::__construct('editBlogPost', 'New post'); } else { parent::__construct('editBlogPost', 'Edit post'); } $post = $this->getPost(); $this->addElement(Element::factory('textarea', 'title', 'Title', $post['title'])); $this->addElement(Element::factory('textarea', 'content', 'Content', $post['content'])); $this->addDefaultButtons(); }
public function __construct() { parent::__construct('formEditVenue', 'Edit Venue'); $venue = $this->getVenue(); if (Session::getUser()->getData('organization') != $venue['organizer']) { Session::requirePriv('EDIT_VENUE'); } $this->addElement(Element::factory('hidden', 'id', null, $venue['id'])); $this->addElement(Element::factory('text', 'title', 'Title', $venue['title'])); $this->addElement(Element::factory('text', 'lat', 'Lat', $venue['lat'])); $this->getElement('lat')->setMinMaxLengths(1, 10); $this->addElement(Element::factory('text', 'lng', 'Lng', $venue['lng'])); $this->getElement('lng')->setMinMaxLengths(1, 10); $this->addElement(FormHelpers::getElementCountry($venue['country'])); $this->addElement(FormHelpers::getOrganizerList()); $this->getElement('organizer')->setValue($venue['organizer']); $this->addButtons(Form::BTN_SUBMIT); }
public function __construct() { parent::__construct('formSendEmailToUser', 'Send email to user'); Session::requirePriv('SEND_EMAIL'); $uid = $_REQUEST['formSendEmailToUser-uid']; $uid = intval($uid); $this->user = User::getUserById($uid); $sql = 'SELECT o.* FROM users u LEFT JOIN organizers o ON u.organization = o.id WHERE u.id = :userId LIMIT 1'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->bindValue(':userId', $this->user->getId()); $stmt->execute(); if ($stmt->numRows()) { $this->organizer = $stmt->fetchRow(); } else { $this->organizer = array('title' => '???', 'id' => '0'); } $this->addElement(Element::factory('hidden', 'uid', null, $uid)); $this->addElement(Element::factory('text', 'email', 'Send to', $this->user->getData('email'), 'User: <a href = "viewUser.php?id=' . $this->user->getId() . '">' . $this->user->getData('username') . '</a> Organizer: <a href = "viewOrganizer.php?id=' . $this->organizer['id'] . '">' . $this->organizer['title'] . '</a>')); $this->addElement(Element::factory('text', 'subject', 'Subject', 'Message from a human!')); $this->addElement(Element::factory('textarea', 'body', 'Body', 'Hey ' . $this->user->getUsername() . ', ' . "\n\n" . 'Your message here.' . "\n\n- lanlist.org ", 'No footer will be appended. From: mailer@lanlist.org')); $this->loadTemplate(); $this->addButtons(Form::BTN_SUBMIT); }
<?php require_once 'includes/common.php'; Session::requirePriv('JOIN_REQUESTS'); if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'approve': $id = fromRequestRequireInt('id'); $sql = 'SELECT r.organizer AS organization, r.user AS uid FROM organization_join_requests r WHERE id = :id'; $stmt = $db->prepare($sql); $stmt->bindValue(':id', $id); $stmt->execute(); if ($stmt->numRows() == 0) { redirect('account.php', 'Request not found.'); } $request = $stmt->fetchRow(); $sql = 'UPDATE users u SET u.organization = :organizationId WHERE u.id = :uid LIMIT 1 '; $stmt = $db->prepare($sql); $stmt->bindValue(':organizationId', $request['organization']); $stmt->bindValue(':uid', $request['uid']); $stmt->execute(); $sql = 'DELETE FROM organization_join_requests WHERE id = :id'; $stmt = $db->prepare($sql); $stmt->bindValue(':id', $id); $stmt->execute(); redirect('joinRequests.php', 'Approve'); break; case 'deny': $id = fromRequestRequireInt('id'); $sql = 'DELETE FROM organization_join_requests WHERE id = :id'; $stmt = $db->prepare($sql);
<?php require_once 'includes/widgets/header.php'; Session::requirePriv('SCHEDULER_LIST'); $sql = 'SELECT className, frequency, lastRunTime FROM scheduler_tasks'; $stmt = $db->prepare($sql); $stmt->execute(); $tpl->assign('listScheduledTasks', $stmt->fetchAll()); $tpl->display('listScheduledTasks.tpl'); startSidebar(); require_once 'includes/widgets/adminBox.php'; require_once 'includes/widgets/footer.php';