當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。