当前位置: 首页>>代码示例>>PHP>>正文


PHP UploadBase::isAllowed方法代码示例

本文整理汇总了PHP中UploadBase::isAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadBase::isAllowed方法的具体用法?PHP UploadBase::isAllowed怎么用?PHP UploadBase::isAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UploadBase的用法示例。


在下文中一共展示了UploadBase::isAllowed方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isAllowed

 /**
  * Checks if the user is allowed to use the upload-by-URL feature. If the
  * user is allowed, pass on permissions checking to the parent.
  *
  * @param $user User
  *
  * @return bool
  */
 public static function isAllowed($user)
 {
     if (!$user->isAllowed('upload_by_url')) {
         return 'upload_by_url';
     }
     return parent::isAllowed($user);
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:15,代码来源:UploadFromUrl.php

示例2: checkPermission

 protected function checkPermission()
 {
     $permissionRequired = UploadBase::isAllowed($this->getUser());
     if ($permissionRequired !== true) {
         throw new PermissionsError($permissionRequired);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:WikiaVideoAdd_body.php

示例3: isUploadAllowed

 function isUploadAllowed()
 {
     global $wgUser;
     if (\UploadBase::isAllowed($wgUser) == true) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:mediawiki-extensions,项目名称:mediawiki-page-attachment,代码行数:9,代码来源:UploadPermissionChecker_MediaWiki_v1170.php

示例4: checkPermissions

 /**
  * Checks that the user has permissions to perform this upload.
  * Dies with usage message on inadequate permissions.
  * @param User $user The user to check.
  */
 protected function checkPermissions($user)
 {
     // Check whether the user has the appropriate permissions to upload anyway
     $permission = $this->mUpload->isAllowed($user);
     if ($permission !== true) {
         if (!$user->isLoggedIn()) {
             $this->dieUsageMsg(array('mustbeloggedin', 'upload'));
         }
         $this->dieUsageMsg('badaccess-groups');
     }
 }
开发者ID:spicy-tmw,项目名称:wiki-raw,代码行数:16,代码来源:ApiUpload.php

示例5: checkPermissions

 /**
  * Checks that the user has permissions to perform this upload.
  * Dies with usage message on inadequate permissions.
  * @param User $user The user to check.
  */
 protected function checkPermissions($user)
 {
     // Check whether the user has the appropriate permissions to upload anyway
     $permission = $this->mUpload->isAllowed($user);
     if ($permission !== true) {
         if (!$user->isLoggedIn()) {
             $this->dieUsageMsg(['mustbeloggedin', 'upload']);
         }
         $this->dieUsageMsg('badaccess-groups');
     }
     // Check blocks
     if ($user->isBlocked()) {
         $this->dieBlocked($user->getBlock());
     }
     // Global blocks
     if ($user->isBlockedGlobally()) {
         $this->dieBlocked($user->getGlobalBlock());
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:24,代码来源:ApiUpload.php

示例6: topLinks

 function topLinks()
 {
     global $wgOut, $wgUser;
     $sep = " |\n";
     $s = $this->mainPageLink() . $sep . $this->specialLink('Recentchanges');
     if ($wgOut->isArticle()) {
         $s .= $sep . '<strong>' . $this->editThisPage() . '</strong>' . $sep . $this->historyLink();
     }
     /* show links to different language variants */
     $s .= $this->variantLinks();
     $s .= $this->extensionTabLinks();
     if ($wgUser->isAnon()) {
         $s .= $sep . $this->specialLink('Userlogin');
     } else {
         /* show user page and user talk links */
         $s .= $sep . $this->link($wgUser->getUserPage(), wfMsgHtml('mypage'));
         $s .= $sep . $this->link($wgUser->getTalkPage(), wfMsgHtml('mytalk'));
         if ($wgUser->getNewtalk()) {
             $s .= ' *';
         }
         /* show watchlist link */
         $s .= $sep . $this->specialLink('Watchlist');
         /* show my contributions link */
         $s .= $sep . $this->link(SpecialPage::getSafeTitleFor('Contributions', $wgUser->getName()), wfMsgHtml('mycontris'));
         /* show my preferences link */
         $s .= $sep . $this->specialLink('Preferences');
         /* show upload file link */
         if (UploadBase::isEnabled() && UploadBase::isAllowed($wgUser) === true) {
             $s .= $sep . $this->getUploadLink();
         }
         /* show log out link */
         $s .= $sep . $this->specialLink('Userlogout');
     }
     $s .= $sep . $this->specialPagesList();
     return $s;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:36,代码来源:Nostalgia.php

示例7: execute

 /**
  * Special page entry point
  * @param string $par
  * @throws ErrorPageError
  * @throws Exception
  * @throws FatalError
  * @throws MWException
  * @throws PermissionsError
  * @throws ReadOnlyError
  * @throws UserBlockedError
  */
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     # Check uploading enabled
     if (!UploadBase::isEnabled()) {
         throw new ErrorPageError('uploaddisabled', 'uploaddisabledtext');
     }
     $this->addHelpLink('Help:Managing files');
     # Check permissions
     $user = $this->getUser();
     $permissionRequired = UploadBase::isAllowed($user);
     if ($permissionRequired !== true) {
         throw new PermissionsError($permissionRequired);
     }
     # Check blocks
     if ($user->isBlocked()) {
         throw new UserBlockedError($user->getBlock());
     }
     # Check whether we actually want to allow changing stuff
     $this->checkReadOnly();
     $this->loadRequest();
     # Unsave the temporary file in case this was a cancelled upload
     if ($this->mCancelUpload) {
         if (!$this->unsaveUploadedFile()) {
             # Something went wrong, so unsaveUploadedFile showed a warning
             return;
         }
     }
     # Process upload or show a form
     if ($this->mTokenOk && !$this->mCancelUpload && ($this->mUpload && $this->mUploadClicked)) {
         $this->processUpload();
     } else {
         # Backwards compatibility hook
         if (!Hooks::run('UploadForm:initial', array(&$this))) {
             wfDebug("Hook 'UploadForm:initial' broke output of the upload form\n");
             return;
         }
         $this->showUploadForm($this->getUploadForm());
     }
     # Cleanup
     if ($this->mUpload) {
         $this->mUpload->cleanupTempFile();
     }
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:56,代码来源:SpecialUpload.php

示例8: topLinks

 /**
  * @return string
  */
 function topLinks()
 {
     $sep = " |\n";
     $s = $this->getSkin()->mainPageLink() . $sep . Linker::specialLink('Recentchanges');
     if ($this->data['isarticle']) {
         $s .= $sep . '<strong>' . $this->editThisPage() . '</strong>' . $sep . $this->talkLink() . $sep . $this->historyLink();
     }
     /* show links to different language variants */
     $s .= $this->variantLinks();
     $s .= $this->extensionTabLinks();
     if (!$this->data['loggedin']) {
         $s .= $sep . Linker::specialLink('Userlogin');
     } else {
         /* show user page and user talk links */
         $user = $this->getSkin()->getUser();
         $s .= $sep . Linker::link($user->getUserPage(), wfMessage('mypage')->escaped());
         $s .= $sep . Linker::link($user->getTalkPage(), wfMessage('mytalk')->escaped());
         if ($user->getNewtalk()) {
             $s .= ' *';
         }
         /* show watchlist link */
         $s .= $sep . Linker::specialLink('Watchlist');
         /* show my contributions link */
         $s .= $sep . Linker::link(SpecialPage::getSafeTitleFor('Contributions', $this->data['username']), wfMessage('mycontris')->escaped());
         /* show my preferences link */
         $s .= $sep . Linker::specialLink('Preferences');
         /* show upload file link */
         if (UploadBase::isEnabled() && UploadBase::isAllowed($user) === true) {
             $s .= $sep . $this->getUploadLink();
         }
         /* show log out link */
         $s .= $sep . Linker::specialLink('Userlogout');
     }
     $s .= $sep . $this->specialPagesList();
     return $s;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:39,代码来源:Nostalgia.php

示例9: buildNavUrls

 /**
  * build array of common navigation links
  * @return array
  */
 protected function buildNavUrls()
 {
     global $wgUploadNavigationUrl;
     $out = $this->getOutput();
     $request = $this->getRequest();
     $nav_urls = array();
     $nav_urls['mainpage'] = array('href' => self::makeMainPageUrl());
     if ($wgUploadNavigationUrl) {
         $nav_urls['upload'] = array('href' => $wgUploadNavigationUrl);
     } elseif (UploadBase::isEnabled() && UploadBase::isAllowed($this->getUser()) === true) {
         $nav_urls['upload'] = array('href' => self::makeSpecialUrl('Upload'));
     } else {
         $nav_urls['upload'] = false;
     }
     $nav_urls['specialpages'] = array('href' => self::makeSpecialUrl('Specialpages'));
     $nav_urls['print'] = false;
     $nav_urls['permalink'] = false;
     $nav_urls['info'] = false;
     $nav_urls['whatlinkshere'] = false;
     $nav_urls['recentchangeslinked'] = false;
     $nav_urls['contributions'] = false;
     $nav_urls['log'] = false;
     $nav_urls['blockip'] = false;
     $nav_urls['emailuser'] = false;
     $nav_urls['userrights'] = false;
     // A print stylesheet is attached to all pages, but nobody ever
     // figures that out. :)  Add a link...
     if (!$out->isPrintable() && ($out->isArticle() || $this->getTitle()->isSpecialPage())) {
         $nav_urls['print'] = array('text' => $this->msg('printableversion')->text(), 'href' => $this->getTitle()->getLocalURL($request->appendQueryValue('printable', 'yes', true)));
     }
     if ($out->isArticle()) {
         // Also add a "permalink" while we're at it
         $revid = $this->getRevisionId();
         if ($revid) {
             $nav_urls['permalink'] = array('text' => $this->msg('permalink')->text(), 'href' => $this->getTitle()->getLocalURL("oldid={$revid}"));
         }
         // Use the copy of revision ID in case this undocumented, shady hook tries to mess with internals
         Hooks::run('SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array(&$this, &$nav_urls, &$revid, &$revid));
     }
     if ($out->isArticleRelated()) {
         $nav_urls['whatlinkshere'] = array('href' => SpecialPage::getTitleFor('Whatlinkshere', $this->thispage)->getLocalURL());
         $nav_urls['info'] = array('text' => $this->msg('pageinfo-toolboxlink')->text(), 'href' => $this->getTitle()->getLocalURL("action=info"));
         if ($this->getTitle()->exists()) {
             $nav_urls['recentchangeslinked'] = array('href' => SpecialPage::getTitleFor('Recentchangeslinked', $this->thispage)->getLocalURL());
         }
     }
     $user = $this->getRelevantUser();
     if ($user) {
         $rootUser = $user->getName();
         $nav_urls['contributions'] = array('text' => $this->msg('contributions', $rootUser)->text(), 'href' => self::makeSpecialUrlSubpage('Contributions', $rootUser));
         $nav_urls['log'] = array('href' => self::makeSpecialUrlSubpage('Log', $rootUser));
         if ($this->getUser()->isAllowed('block')) {
             $nav_urls['blockip'] = array('text' => $this->msg('blockip', $rootUser)->text(), 'href' => self::makeSpecialUrlSubpage('Block', $rootUser));
         }
         if ($this->showEmailUser($user)) {
             $nav_urls['emailuser'] = array('href' => self::makeSpecialUrlSubpage('Emailuser', $rootUser));
         }
         if (!$user->isAnon()) {
             $sur = new UserrightsPage();
             $sur->setContext($this->getContext());
             if ($sur->userCanExecute($this->getUser())) {
                 $nav_urls['userrights'] = array('href' => self::makeSpecialUrlSubpage('Userrights', $rootUser));
             }
         }
     }
     return $nav_urls;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:71,代码来源:SkinTemplate.php

示例10: quickBar

 /**
  * Compute the sidebar
  * @access private
  *
  * @return string
  */
 function quickBar()
 {
     $s = "\n<div id='quickbar'>";
     $sep = '<br />';
     $s .= $this->menuHead('qbfind');
     $s .= $this->searchForm();
     $s .= $this->menuHead('qbbrowse');
     # Use the first heading from the Monobook sidebar as the "browse" section
     $bar = $this->getSkin()->buildSidebar();
     unset($bar['SEARCH']);
     unset($bar['LANGUAGES']);
     unset($bar['TOOLBOX']);
     $barnumber = 1;
     foreach ($bar as $heading => $browseLinks) {
         if ($barnumber > 1) {
             $headingMsg = wfMessage($heading);
             if ($headingMsg->exists()) {
                 $h = $headingMsg->text();
             } else {
                 $h = $heading;
             }
             $s .= "\n<h6>" . htmlspecialchars($h) . "</h6>";
         }
         if (is_array($browseLinks)) {
             foreach ($browseLinks as $link) {
                 if ($link['text'] != '-') {
                     $s .= "<a href=\"{$link['href']}\">" . htmlspecialchars($link['text']) . '</a>' . $sep;
                 }
             }
         }
         $barnumber++;
     }
     $user = $this->getSkin()->getUser();
     if ($this->data['isarticle']) {
         $s .= $this->menuHead('qbedit');
         $s .= '<strong>' . $this->editThisPage() . '</strong>';
         $s .= $sep . Linker::linkKnown(Title::newFromText(wfMsgForContent('edithelppage')), wfMsg('edithelp'));
         if ($this->data['loggedin']) {
             $s .= $sep . $this->moveThisPage();
         }
         if ($user->isAllowed('delete')) {
             $dtp = $this->deleteThisPage();
             if ($dtp != '') {
                 $s .= $sep . $dtp;
             }
         }
         if ($user->isAllowed('protect')) {
             $ptp = $this->protectThisPage();
             if ($ptp != '') {
                 $s .= $sep . $ptp;
             }
         }
         $s .= $sep;
         $s .= $this->menuHead('qbpageoptions');
         $s .= $this->talkLink() . $sep . $this->commentLink() . $sep . $this->printableLink();
         if ($this->data['loggedin']) {
             $s .= $sep . $this->watchThisPage();
         }
         $s .= $sep;
         $s .= $this->menuHead('qbpageinfo') . $this->historyLink() . $sep . $this->whatLinksHere() . $sep . $this->watchPageLinksLink();
         $title = $this->getSkin()->getTitle();
         $tns = $title->getNamespace();
         if ($tns == NS_USER || $tns == NS_USER_TALK) {
             $id = User::idFromName($title->getText());
             if ($id != 0) {
                 $s .= $sep . $this->userContribsLink();
                 if ($this->getSkin()->showEmailUser($id)) {
                     $s .= $sep . $this->emailUserLink();
                 }
             }
         }
         $s .= $sep;
     }
     $s .= $this->menuHead('qbmyoptions');
     if ($this->data['loggedin']) {
         $tl = Linker::link($user->getTalkPage(), wfMsg('mytalk'), array(), array(), array('known', 'noclasses'));
         if ($user->getNewtalk()) {
             $tl .= ' *';
         }
         $s .= Linker::link($user->getUserPage(), wfMsg('mypage'), array(), array(), array('known', 'noclasses')) . $sep . $tl . $sep . Linker::specialLink('Watchlist') . $sep . Linker::link(SpecialPage::getSafeTitleFor('Contributions', $user->getName()), wfMsg('mycontris'), array(), array(), array('known', 'noclasses')) . $sep . Linker::specialLink('Preferences') . $sep . Linker::specialLink('Userlogout');
     } else {
         $s .= Linker::specialLink('Userlogin');
     }
     $s .= $this->menuHead('qbspecialpages') . Linker::specialLink('Newpages') . $sep . Linker::specialLink('Listfiles') . $sep . Linker::specialLink('Statistics');
     if (UploadBase::isEnabled() && UploadBase::isAllowed($user) === true) {
         $s .= $sep . $this->getUploadLink();
     }
     global $wgSiteSupportPage;
     if ($wgSiteSupportPage) {
         $s .= $sep . '<a href="' . htmlspecialchars($wgSiteSupportPage) . '" class="internal">' . wfMsg('sitesupport') . '</a>';
     }
     $s .= $sep . Linker::link(SpecialPage::getTitleFor('Specialpages'), wfMsg('moredotdotdot'), array(), array(), array('known', 'noclasses'));
     $s .= $sep . "\n</div>\n";
     return $s;
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:CologneBlue.php

示例11: execute

 /**
  * Special page entry point
  */
 public function execute($par)
 {
     // Only output the body of the page.
     $this->getOutput()->setArticleBodyOnly(true);
     // This line is needed to get around Squid caching.
     $this->getOutput()->sendCacheControl();
     $this->setHeaders();
     $this->outputHeader();
     # Check uploading enabled
     if (!UploadBase::isEnabled()) {
         throw new ErrorPageError('uploaddisabled', 'uploaddisabledtext');
     }
     # Check permissions
     $user = $this->getUser();
     $permissionRequired = UploadBase::isAllowed($user);
     if ($permissionRequired !== true) {
         throw new PermissionsError($permissionRequired);
     }
     # Check blocks
     if ($this->getUser()->isBlocked()) {
         throw new UserBlockedError($this->getUser()->getBlock());
     }
     # Check whether we actually want to allow changing stuff
     if (wfReadOnly()) {
         throw new ReadOnlyError();
     }
     # Unsave the temporary file in case this was a cancelled upload
     if ($this->mCancelUpload) {
         if (!$this->unsaveUploadedFile()) {
             # Something went wrong, so unsaveUploadedFile showed a warning
             return;
         }
     }
     # Process upload or show a form
     if ($this->mTokenOk && !$this->mCancelUpload && ($this->mUpload && $this->mUploadClicked)) {
         $this->processUpload();
     } else {
         # Backwards compatibility hook
         if (!Hooks::run('UploadForm:initial', array(&$this))) {
             wfDebug("Hook 'UploadForm:initial' broke output of the upload form");
             return;
         }
         $this->showUploadForm($this->getUploadForm());
     }
     # Cleanup
     if ($this->mUpload) {
         $this->mUpload->cleanupTempFile();
     }
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:52,代码来源:SF_UploadWindow.php

示例12: quickBar


//.........这里部分代码省略.........
                     case NS_FILE_TALK:
                     case NS_MEDIAWIKI_TALK:
                     case NS_TEMPLATE_TALK:
                     case NS_HELP_TALK:
                     case NS_CATEGORY_TALK:
                         $text = wfMsg('viewtalkpage');
                         break;
                     case NS_MAIN:
                         $text = wfMsg('articlepage');
                         break;
                     case NS_USER:
                         $text = wfMsg('userpage');
                         break;
                     case NS_PROJECT:
                         $text = wfMsg('projectpage');
                         break;
                     case NS_FILE:
                         $text = wfMsg('imagepage');
                         break;
                     case NS_MEDIAWIKI:
                         $text = wfMsg('mediawikipage');
                         break;
                     case NS_TEMPLATE:
                         $text = wfMsg('templatepage');
                         break;
                     case NS_HELP:
                         $text = wfMsg('viewhelppage');
                         break;
                     case NS_CATEGORY:
                         $text = wfMsg('categorypage');
                         break;
                     default:
                         $text = wfMsg('articlepage');
                 }
                 $link = $this->getSkin()->getTitle()->getText();
                 $nstext = $wgContLang->getNsText($tns);
                 if ($nstext) {
                     # add namespace if necessary
                     $link = $nstext . ':' . $link;
                 }
                 $s .= Linker::link(Title::newFromText($link), $text);
             } elseif ($this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL) {
                 # we just throw in a "New page" text to tell the user that he's in edit mode,
                 # and to avoid messing with the separator that is prepended to the next item
                 $s .= '<strong>' . wfMsg('newpage') . '</strong>';
             }
         }
         # "Post a comment" link
         if (($this->getSkin()->getTitle()->isTalkPage() || $wgOut->showNewSectionLink()) && $action != 'edit' && !$wpPreview) {
             $s .= '<br />' . $this->getSkin()->link($this->getSkin()->getTitle(), wfMsg('postcomment'), array(), array('action' => 'edit', 'section' => 'new'), array('known', 'noclasses'));
         }
         /*
         watching could cause problems in edit mode:
         if user edits article, then loads "watch this article" in background and then saves
         article with "Watch this article" checkbox disabled, the article is transparently
         unwatched. Therefore we do not show the "Watch this page" link in edit mode
         */
         if ($wgUser->isLoggedIn() && $articleExists) {
             if ($action != 'edit' && $action != 'submit') {
                 $s .= $sep . $this->watchThisPage();
             }
             if ($this->getSkin()->getTitle()->userCan('edit')) {
                 $s .= $sep . $this->moveThisPage();
             }
         }
         if ($wgUser->isAllowed('delete') && $articleExists) {
             $s .= $sep . $this->deleteThisPage() . $sep . $this->protectThisPage();
         }
         $s .= $sep . $this->talkLink();
         if ($articleExists && $action != 'history') {
             $s .= $sep . $this->historyLink();
         }
         $s .= $sep . $this->whatLinksHere();
         if ($wgOut->isArticleRelated()) {
             $s .= $sep . $this->watchPageLinksLink();
         }
         if (NS_USER == $this->getSkin()->getTitle()->getNamespace() || $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK) {
             $id = User::idFromName($this->getSkin()->getTitle()->getText());
             $ip = User::isIP($this->getSkin()->getTitle()->getText());
             if ($id || $ip) {
                 $s .= $sep . $this->userContribsLink();
             }
             if ($this->getSkin()->showEmailUser($id)) {
                 $s .= $sep . $this->emailUserLink();
             }
         }
         $s .= "\n<br /><hr class='sep' />";
     }
     if (UploadBase::isEnabled() && UploadBase::isAllowed($wgUser) === true) {
         $s .= $this->getUploadLink() . $sep;
     }
     $s .= Linker::specialLink('Specialpages');
     global $wgSiteSupportPage;
     if ($wgSiteSupportPage) {
         $s .= "\n<br /><a href=\"" . htmlspecialchars($wgSiteSupportPage) . '" class="internal">' . wfMsg('sitesupport') . '</a>';
     }
     $s .= "\n<br /></div>\n";
     wfProfileOut(__METHOD__);
     return $s;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:101,代码来源:Standard.php

示例13: execute

 /**
  * Special page entry point
  */
 public function execute($par)
 {
     global $wgUser, $wgOut;
     $this->setHeaders();
     $this->outputHeader();
     # Check uploading enabled
     if (!UploadBase::isEnabled()) {
         $wgOut->showErrorPage('uploaddisabled', 'uploaddisabledtext');
         return;
     }
     # Check permissions
     global $wgGroupPermissions;
     $permissionRequired = UploadBase::isAllowed($wgUser);
     if ($permissionRequired !== true) {
         if (!$wgUser->isLoggedIn() && ($wgGroupPermissions['user']['upload'] || $wgGroupPermissions['autoconfirmed']['upload'])) {
             // Custom message if logged-in users without any special rights can upload
             $wgOut->showErrorPage('uploadnologin', 'uploadnologintext');
         } else {
             $wgOut->permissionRequired($permissionRequired);
         }
         return;
     }
     # Check blocks
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     # Check whether we actually want to allow changing stuff
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     # Unsave the temporary file in case this was a cancelled upload
     if ($this->mCancelUpload) {
         if (!$this->unsaveUploadedFile()) {
             # Something went wrong, so unsaveUploadedFile showed a warning
             return;
         }
     }
     # Process upload or show a form
     if ($this->mTokenOk && !$this->mCancelUpload && ($this->mUpload && $this->mUploadClicked)) {
         $this->processUpload();
     } else {
         # Backwards compatibility hook
         if (!wfRunHooks('UploadForm:initial', array(&$this))) {
             wfDebug("Hook 'UploadForm:initial' broke output of the upload form");
             return;
         }
         $this->showUploadForm($this->getUploadForm());
     }
     # Cleanup
     if ($this->mUpload) {
         $this->mUpload->cleanupTempFile();
     }
 }
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:58,代码来源:SpecialUpload.php

示例14: buildNavUrls

 /**
  * build array of common navigation links
  * @return array
  * @private
  */
 protected function buildNavUrls(OutputPage $out)
 {
     global $wgUseTrackbacks, $wgUser, $wgRequest;
     global $wgUploadNavigationUrl;
     wfProfileIn(__METHOD__);
     $action = $wgRequest->getVal('action', 'view');
     $nav_urls = array();
     $nav_urls['mainpage'] = array('href' => self::makeMainPageUrl());
     if ($wgUploadNavigationUrl) {
         $nav_urls['upload'] = array('href' => $wgUploadNavigationUrl);
     } elseif (UploadBase::isEnabled() && UploadBase::isAllowed($wgUser) === true) {
         $nav_urls['upload'] = array('href' => self::makeSpecialUrl('Upload'));
     } else {
         $nav_urls['upload'] = false;
     }
     $nav_urls['specialpages'] = array('href' => self::makeSpecialUrl('Specialpages'));
     // default permalink to being off, will override it as required below.
     $nav_urls['permalink'] = false;
     // A print stylesheet is attached to all pages, but nobody ever
     // figures that out. :)  Add a link...
     if ($this->iscontent && ($action == 'view' || $action == 'purge')) {
         if (!$out->isPrintable()) {
             $nav_urls['print'] = array('text' => wfMsg('printableversion'), 'href' => $this->getTitle()->getLocalURL($wgRequest->appendQueryValue('printable', 'yes', true)));
         }
         // Also add a "permalink" while we're at it
         $revid = $this->getRevisionId();
         if ($revid) {
             $nav_urls['permalink'] = array('text' => wfMsg('permalink'), 'href' => $out->getTitle()->getLocalURL("oldid={$revid}"));
         }
         // Use the copy of revision ID in case this undocumented, shady hook tries to mess with internals
         wfRunHooks('SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array(&$this, &$nav_urls, &$revid, &$revid));
     }
     if ($this->getTitle()->getNamespace() != NS_SPECIAL) {
         $wlhTitle = SpecialPage::getTitleFor('Whatlinkshere', $this->thispage);
         $nav_urls['whatlinkshere'] = array('href' => $wlhTitle->getLocalUrl());
         if ($this->getTitle()->getArticleId()) {
             $rclTitle = SpecialPage::getTitleFor('Recentchangeslinked', $this->thispage);
             $nav_urls['recentchangeslinked'] = array('href' => $rclTitle->getLocalUrl());
         } else {
             $nav_urls['recentchangeslinked'] = false;
         }
         if ($wgUseTrackbacks) {
             $nav_urls['trackbacklink'] = array('href' => $out->getTitle()->trackbackURL());
         }
     }
     $user = $this->getRelevantUser();
     if ($user) {
         $id = $user->getID();
         $ip = $user->isAnon();
         $rootUser = $user->getName();
     } else {
         $id = 0;
         $ip = false;
         $rootUser = null;
     }
     if ($id || $ip) {
         # both anons and non-anons have contribs list
         $nav_urls['contributions'] = array('href' => self::makeSpecialUrlSubpage('Contributions', $rootUser));
         if ($id) {
             $logPage = SpecialPage::getTitleFor('Log');
             $nav_urls['log'] = array('href' => $logPage->getLocalUrl(array('user' => $rootUser)));
         } else {
             $nav_urls['log'] = false;
         }
         if ($wgUser->isAllowed('block')) {
             $nav_urls['blockip'] = array('href' => self::makeSpecialUrlSubpage('Block', $rootUser));
         } else {
             $nav_urls['blockip'] = false;
         }
     } else {
         $nav_urls['contributions'] = false;
         $nav_urls['log'] = false;
         $nav_urls['blockip'] = false;
     }
     $nav_urls['emailuser'] = false;
     if ($this->showEmailUser($id)) {
         $nav_urls['emailuser'] = array('href' => self::makeSpecialUrlSubpage('Emailuser', $rootUser));
     }
     wfProfileOut(__METHOD__);
     return $nav_urls;
 }
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:86,代码来源:SkinTemplate.php


注:本文中的UploadBase::isAllowed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。