/** * Show the special page * * @param $gift_category Mixed: parameter passed to the page or null */ public function execute( $gift_category ) { global $wgUser, $wgOut, $wgUserLevels; // If the user doesn't have the required 'awardsmanage' permission, display an error if ( !$wgUser->isAllowed( 'awardsmanage' ) ) { $wgOut->permissionRequired( 'awardsmanage' ); return; } // Show a message if the database is in read-only mode if ( wfReadOnly() ) { $wgOut->readOnlyPage(); return; } // If user is blocked, s/he doesn't need to access this page if ( $wgUser->isBlocked() ) { $wgOut->blockedPage(); return; } $wgUserLevels = ''; $g = new SystemGifts(); $g->update_system_gifts(); }
/** * Show the special page * * @param $gift_category Mixed: parameter passed to the page or null */ public function execute($gift_category) { global $wgUserLevels; $out = $this->getOutput(); $user = $this->getUser(); // If the user doesn't have the required 'awardsmanage' permission, display an error if (!$user->isAllowed('awardsmanage')) { $out->permissionRequired('awardsmanage'); return; } // Show a message if the database is in read-only mode if (wfReadOnly()) { $out->readOnlyPage(); return; } // If user is blocked, s/he doesn't need to access this page if ($user->isBlocked()) { $out->blockedPage(); return; } // Set the robot policies, etc. $out->setArticleRelated(false); $out->setRobotPolicy('noindex,nofollow'); $wgUserLevels = ''; $g = new SystemGifts(); $g->update_system_gifts(); }
/** * Show the special page * * @param $par Mixed: parameter passed to the page or null */ public function execute($par) { $out = $this->getOutput(); $request = $this->getRequest(); $user = $this->getUser(); // Set the page title, robot policies, etc. $this->setHeaders(); // If the user doesn't have the required 'awardsmanage' permission, display an error if (!$user->isAllowed('awardsmanage')) { $out->permissionRequired('awardsmanage'); return; } // Show a message if the database is in read-only mode if (wfReadOnly()) { $out->readOnlyPage(); return; } // If user is blocked, s/he doesn't need to access this page if ($user->isBlocked()) { $out->blockedPage(); return; } // Add CSS $out->addModuleStyles('ext.socialprofile.systemgifts.css'); if ($request->wasPosted()) { $g = new SystemGifts(); $gift_category = $request->getVal('gift_category'); $un_update = $g->getRepeatableGifts(); if (!$request->getInt('id')) { // Add the new system gift to the database $gift_id = $g->addGift($request->getVal('gift_name'), $request->getVal('gift_description'), $request->getVal('gift_category'), $request->getInt('gift_threshold')); $out->addHTML('<span class="view-status">' . $this->msg('ga-created')->plain() . '</span><br /><br />'); } else { $gift_id = $request->getInt('id'); $g->updateGift($gift_id, $request->getVal('gift_name'), $request->getVal('gift_description'), $request->getVal('gift_category'), $request->getInt('gift_threshold')); $out->addHTML('<span class="view-status">' . $this->msg('ga-saved')->plain() . '</span><br /><br />'); } if (!in_array($gift_category, $un_update)) { $g->update_system_gifts($gift_id); } $out->addHTML($this->displayForm($gift_id)); } else { $gift_id = $request->getInt('id'); if ($gift_id || $request->getVal('method') == 'edit') { $out->addHTML($this->displayForm($gift_id)); } else { $out->addHTML('<div><b><a href="' . htmlspecialchars($this->getPageTitle()->getFullURL('method=edit')) . '">' . $this->msg('ga-addnew')->plain() . '</a></b></div>'); $out->addHTML($this->displayGiftList()); } } }
/** * Show the special page * * @param $par Mixed: parameter passed to the page or null */ public function execute($par) { global $wgUser, $wgOut, $wgRequest, $wgScriptPath, $wgSystemGiftsScripts; $wgOut->setPageTitle(wfMsg('systemgiftmanager')); // If the user doesn't have the required 'awardsmanage' permission, display an error if (!$wgUser->isAllowed('awardsmanage')) { $wgOut->permissionRequired('awardsmanage'); return; } // Show a message if the database is in read-only mode if (wfReadOnly()) { $wgOut->readOnlyPage(); return; } // If user is blocked, s/he doesn't need to access this page if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } // Add CSS $wgOut->addExtensionStyle($wgSystemGiftsScripts . '/SystemGift.css'); if ($wgRequest->wasPosted()) { $g = new SystemGifts(); if (!$_POST['id']) { // @todo FIXME/CHECKME: why $_POST? Why not $wgRequest? // Add the new system gift to the database $gift_id = $g->addGift($wgRequest->getVal('gift_name'), $wgRequest->getVal('gift_description'), $wgRequest->getVal('gift_category'), $wgRequest->getVal('gift_threshold')); $wgOut->addHTML('<span class="view-status">' . wfMsg('ga-created') . '</span><br /><br />'); } else { $gift_id = $wgRequest->getVal('id'); $g->updateGift($gift_id, $wgRequest->getVal('gift_name'), $wgRequest->getVal('gift_description'), $wgRequest->getVal('gift_category'), $wgRequest->getVal('gift_threshold')); $wgOut->addHTML('<span class="view-status">' . wfMsg('ga-saved') . '</span><br /><br />'); } $g->update_system_gifts(); $wgOut->addHTML($this->displayForm($gift_id)); } else { $gift_id = $wgRequest->getVal('id'); if ($gift_id || $wgRequest->getVal('method') == 'edit') { $wgOut->addHTML($this->displayForm($gift_id)); } else { $wgOut->addHTML('<div><b><a href="' . $wgScriptPath . '/index.php?title=Special:SystemGiftManager&method=edit">' . wfMsg('ga-addnew') . '</a></b></div>'); $wgOut->addHTML($this->displayGiftList()); } } }