本文整理汇总了PHP中LogPage类的典型用法代码示例。如果您正苦于以下问题:PHP LogPage类的具体用法?PHP LogPage怎么用?PHP LogPage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trySubmit
function trySubmit()
{
global $wgOut, $wgUser;
$errors = array();
$ip = $this->mUnblockIP;
if (!IP::isIPAddress($ip) && strlen($ip)) {
$errors[] = array('globalblocking-unblock-ipinvalid', $ip);
$ip = '';
}
if (0 == ($id = GlobalBlocking::getGlobalBlockId($ip))) {
$errors[] = array('globalblocking-notblocked', $ip);
}
if (count($errors) > 0) {
return $errors;
}
$dbw = GlobalBlocking::getGlobalBlockingMaster();
$dbw->delete('globalblocks', array('gb_id' => $id), __METHOD__);
$page = new LogPage('gblblock');
$page->addEntry('gunblock', Title::makeTitleSafe(NS_USER, $ip), $this->mReason);
$successmsg = wfMsgExt('globalblocking-unblock-unblocked', array('parse'), $ip, $id);
$wgOut->addHTML($successmsg);
$link = $wgUser->getSkin()->makeKnownLinkObj(SpecialPage::getTitleFor('GlobalBlockList'), wfMsg('globalblocking-return'));
$wgOut->addHTML($link);
$wgOut->setSubtitle(wfMsg('globalblocking-unblock-successsub'));
return array();
}
示例2: execute
function execute($par)
{
global $wgRequest, $wgSitename, $wgLanguageCode;
global $wgDeferredUpdateList, $wgOut, $wgUser, $wgServer;
$fname = "wfChangerealname";
if (!$wgUser->isAllowed('changerealname')) {
$wgOut->permissionRequired('changerealname');
return;
}
if ($wgRequest->wasPosted()) {
if ($wgRequest->getVal('target') && $wgRequest->getVal('realname')) {
// $dbw = wfGetDB(DB_MASTER);
$user = User::newFromName($wgRequest->getVal('target'));
if ($user->getId() == 0) {
$wgOut->addHTML(wfMsg('changerealname_nouser', $user->getName()));
return;
}
//yeah...if you could not go straight to the database, that'd be great... [sc]
// $oldname = $dbw->selectField( 'user', 'user_real_name', array('user_name'=>$wgRequest->getVal('target')) );
// $dbw->update('user', array('user_real_name' => $wgRequest->getVal('realname')), array('user_name'=>$wgRequest->getVal('target')));
$oldname = $user->getRealName();
$user->setRealName($wgRequest->getVal('realname'));
$user->saveSettings();
$summary = wfMsg('changerealname_summary', $wgUser->getName(), $user->getName(), $oldname, $wgRequest->getVal('realname'));
$log = new LogPage('realname', true);
$log->addEntry('realname', $user->getUserPage(), $summary);
$wgOut->addHTML(wfMsg('changerealname_success'));
}
} else {
$me = Title::makeTitle(NS_SPECIAL, "Changerealname");
$wgOut->addHTML("<form method='POST' action='{$me->getFullURL()}'>\n\t\t\t\t\tUsername: <input type='text' name='target'><br/><br/>\n\t\t\t\t\tNew real name: <input type='text' name='realname'><br/>\n\t\t\t\t\t<input type='submit' value='" . wfMsg('changerealname_submit') . "'>\n\t\t\t\t</form>");
}
}
示例3: wfNewuserlogHook
function wfNewuserlogHook($user)
{
global $wgUser, $wgContLang, $wgVersion;
if (is_null($user)) {
// Compatibility with old versions which didn't pass the parameter
$user = $wgUser;
}
$talk = $wgContLang->getFormattedNsText(NS_TALK);
$contribs = wfMsgForContent('contribslink');
$block = wfMsgForContent('blocklink');
if ($user->getName() == $wgUser->getName()) {
$message = '';
$action = 'create';
} else {
// Links not necessary for self-creations, they will appear already in
// recentchanges and special:log view for the creating user.
// For compatability: From 1.10alpha the 'user tools' are used at special:log
// see bug 4756: Long usernames break block link in new user log entries
$action = 'create2';
if (version_compare($wgVersion, '1.10alpha', '>=')) {
$message = '';
} else {
$message = wfMsgForContent('newuserlog-create-text', $user->getName(), $talk, $contribs, $block);
}
}
$log = new LogPage('newusers');
$log->addEntry($action, $user->getUserPage(), $message);
return true;
}
示例4: logFeedback
public function logFeedback($params, $itemId)
{
$title = SpecialPage::getTitleFor('FeedbackDashboard', $itemId);
$reason = wfMessage('moodbar-log-reason')->params($params['type'], $params['comment'])->text();
$log = new LogPage('moodbar');
$log->addEntry('feedback', $title, $reason);
}
示例5: wfNewuserlogAutoCreate
function wfNewuserlogAutoCreate($user)
{
wfLoadExtensionMessages('Newuserlog');
$log = new LogPage('newusers');
$log->addEntry('autocreate', $user->getUserPage(), '', array($user->getId()));
return true;
}
示例6: PureWikiDeletionSaveCompleteHook
/**
* After a page is saved, add or remove it from the blank_page table if
* it has been blanked or unblanked, respectively; if blanked, redirect
* the user to the "Action complete" page
*/
public static function PureWikiDeletionSaveCompleteHook(&$article, &$user, $text, $summary, $minoredit, &$watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect)
{
global $wgOut, $wgInterWikiIntegrationInEffect;
if (!isset($revision)) {
return true;
}
$mTitle = $article->getTitle();
if ($mTitle->getNamespace() == NS_FILE) {
return true;
}
$blankRevId = $revision->getId();
if ($text == "") {
if ($summary == wfMsgForContent('autosumm-blank')) {
$hasHistory = false;
$summary = $article->generateReason($hasHistory);
}
$dbw = wfGetDB(DB_MASTER);
$blank_row = array('blank_page_id' => $article->getID(), 'blank_user_id' => $user->getId(), 'blank_user_name' => $user->getName(), 'blank_timestamp' => $revision->getTimeStamp(), 'blank_summary' => $summary, 'blank_parent_id' => $revision->getParentId());
$dbw->insert('blanked_page', $blank_row);
$log = new LogPage('blank');
$log->addEntry('blank', $mTitle, $summary, array(), $user);
$dbw->commit();
$dbw->delete('recentchanges', array('rc_this_oldid' => $blankRevId));
Article::onArticleDelete($mTitle);
$mTitle->resetArticleID(0);
if ($user->getOption('watchblank')) {
$watchthis = true;
}
wfRunHooks('PureWikiDeletionArticleBlankComplete', array($mTitle));
$redirect = false;
$wgOut->setPagetitle(wfMsg('actioncomplete'));
$wgOut->setRobotPolicy('noindex,nofollow');
$loglink = wfMsg('blank-log-link');
$wgOut->addWikiMsg('purewikideletion-blankedtext', $mTitle->getPrefixedText(), $loglink);
$wgOut->returnToMain(false);
} else {
$dbr = wfGetDB(DB_SLAVE);
$blank_page_id = $article->getID();
$result = $dbr->selectRow('blanked_page', 'blank_page_id', array("blank_page_id" => $blank_page_id));
if (!$result) {
return true;
} else {
if ($summary == '') {
$summary = $article->getAutosummary('', $text, EDIT_NEW);
}
$dbw = wfGetDB(DB_MASTER);
$blank_page_id = $article->getID();
$dbw->delete('blanked_page', array("blank_page_id" => $blank_page_id));
$log = new LogPage('blank');
$log->addEntry('unblank', $mTitle, $summary, array(), $user);
$dbw->commit();
$dbw->delete('recentchanges', array('rc_this_oldid' => $blankRevId));
$mTitle->touchLinks();
$mTitle->invalidateCache();
$mTitle->purgeSquid();
wfRunHooks('PureWikiDeletionArticleUnblankComplete', array($mTitle));
}
}
return true;
}
示例7: logRestore
function logRestore($itemId, $low, $hi, $reason, $count)
{
$title = $this->makeTitle($itemId);
$params = array($itemId, $low, $hi);
$log = new LogPage($this->logType, true);
$log->addEntry($this->logType, $title, wfMsg('clearratings_logrestore', $reason, $title->getFullText(), $count), $params);
}
示例8: hUnwatchArticleComplete
public function hUnwatchArticleComplete(&$user, &$article)
{
$message = wfMsgForContent('watchlog-unwatch-text', $article->mTitle->getPrefixedText());
$log = new LogPage('watchlog');
$log->addEntry('unwatchok', $user->getUserPage(), $message);
return true;
}
示例9: execute
public function execute()
{
global $wgUser, $wgTranslateWorkflowStates;
if (!$wgTranslateWorkflowStates) {
$this->dieUsage('Message group review not in use', 'disabled');
}
if (!$wgUser->isallowed(self::$right)) {
$this->dieUsage('Permission denied', 'permissiondenied');
}
$requestParams = $this->extractRequestParams();
$group = MessageGroups::getGroup($requestParams['group']);
if (!$group) {
$this->dieUsageMsg(array('missingparam', 'group'));
}
$languages = Language::getLanguageNames(false);
if (!isset($languages[$requestParams['language']])) {
$this->dieUsageMsg(array('missingparam', 'language'));
}
$dbr = wfGetDB(DB_SLAVE);
$groupid = $group->getId();
$currentState = $dbr->selectField('translate_groupreviews', 'tgr_state', array('tgr_group' => $groupid, 'tgr_lang' => $requestParams['language']), __METHOD__);
if ($currentState == $requestParams['state']) {
$this->dieUsage('The requested state is identical to the current state', 'sameworkflowstate');
}
$dbw = wfGetDB(DB_MASTER);
$table = 'translate_groupreviews';
$row = array('tgr_group' => $groupid, 'tgr_lang' => $requestParams['language'], 'tgr_state' => $requestParams['state']);
$index = array('tgr_group', 'tgr_language');
$res = $dbw->replace($table, array($index), $row, __METHOD__);
$logger = new LogPage('translationreview');
$logParams = array($requestParams['language'], $group->getLabel(), $currentState, $requestParams['state']);
$logger->addEntry('group', SpecialPage::getTitleFor('Translate', $groupid), '', $logParams, $wgUser);
$output = array('review' => array('group' => $group->getId(), 'language' => $requestParams['language'], 'state' => $requestParams['state']));
$this->getResult()->addValue(null, $this->getModuleName(), $output);
}
示例10: logRestore
function logRestore($itemId, $low, $hi, $reason, $count)
{
$title = Title::newFromId($itemId);
$params = array($itemId, $low, $hi);
$log = new LogPage('accuracy', true);
$log->addEntry($this->logType, $title, wfMessage('clearratings_logrestore', $reason, $title->getFullText(), $count)->text(), $params);
}
示例11: getLogTitle
function getLogTitle($rc)
{
$logtype = $rc->getAttribute('rc_log_type');
$logpage = new LogPage($logtype);
$logname = $logpage->getName()->escaped();
$titleObj = SpecialPage::getTitleFor('Log', $logtype);
return '(' . $this->skin->makeKnownLinkObj($titleObj, $logname) . ')';
}
示例12: dropDocent
function dropDocent($user)
{
global $dbw, $debug, $project_page;
if (!$debug) {
$dbw->query("delete from docentcategories where dc_user={$user->getId()}");
}
$params = array($user->getID());
$log = new LogPage('doc', false);
$log->addEntry('doc', $project_page, wfMsg('doc_logsummary', $user->getName()), $params);
}
示例13: wfUserLoginLogoutComplete
function wfUserLoginLogoutComplete($user)
{
global $wgUser, $wgUserBeforeLogout;
$tmp = $wgUser->mId;
$wgUser->mId = $wgUserBeforeLogout->getId();
$log = new LogPage('userlogin', false);
$log->addEntry('logout', $wgUserBeforeLogout->getUserPage(), $user->getName());
$wgUser->mId = $tmp;
return true;
}
示例14: hEmailUserComplete
public function hEmailUserComplete($to, $from, $subject, $text)
{
global $wgUser;
$toname = $to->name;
$fromname = $from->name;
$message = wfMsgForContent('emaillog-sent-text', $fromname, $toname);
$log = new LogPage('emaillog');
$log->addEntry('sentok', $wgUser->getUserPage(), $message);
return true;
}
示例15: execute
/**
* Show the special page
*
* @param $user Mixed: parameter passed to the page or null
*/
public function execute($par)
{
global $wgUploadAvatarInRecentChanges;
$out = $this->getOutput();
$request = $this->getRequest();
$user = $this->getUser();
// If the user isn't logged in, display an error
if (!$user->isLoggedIn()) {
$this->displayRestrictionError();
return;
}
// If the user doesn't have 'avatarremove' permission, display an error
if (!$user->isAllowed('avatarremove')) {
$this->displayRestrictionError();
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 page title, robot policies, etc.
$this->setHeaders();
$out->setPageTitle($this->msg('avatarupload-removeavatar')->plain());
if ($request->getVal('user') != '') {
$out->redirect($this->getPageTitle()->getFullURL() . '/' . $request->getVal('user'));
}
// If the request was POSTed, then delete the avatar
if ($request->wasPosted()) {
$user_id = $request->getInt('user_id');
$user_deleted = User::newFromId($user_id);
$this->deleteImage($user_id, 's');
$this->deleteImage($user_id, 'm');
$this->deleteImage($user_id, 'l');
$this->deleteImage($user_id, 'ml');
$log = new LogPage('avatar');
if (!$wgUploadAvatarInRecentChanges) {
$log->updateRecentChanges = false;
}
$log->addEntry('avatar', $user->getUserPage(), $this->msg('user-profile-picture-log-delete-entry', $user_deleted->getName())->inContentLanguage()->text());
$out->addHTML('<div>' . $this->msg('avatarupload-removesuccess')->plain() . '</div>');
$out->addHTML('<div><a href="' . htmlspecialchars($this->getPageTitle()->getFullURL()) . '">' . $this->msg('avatarupload-removeanother')->plain() . '</a></div>');
} else {
if ($par) {
$out->addHTML($this->showUserAvatar($par));
} else {
$out->addHTML($this->showUserForm());
}
}
}