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


PHP UploadBase::isEnabled方法代码示例

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


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

示例1: isUploadEnabled

 function isUploadEnabled()
 {
     if (\UploadBase::isEnabled() == true) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:mediawiki-extensions,项目名称:mediawiki-page-attachment,代码行数:8,代码来源:AbstractUploadPermissionChecker.php

示例2: execute3rdPartyVideo

 private function execute3rdPartyVideo($url)
 {
     if (empty(F::app()->wg->allowNonPremiumVideos)) {
         $this->dieUsage('Only premium videos are allowed', 'onlyallowpremium');
     }
     if (!preg_match('/^https?:\\/\\//', $url)) {
         $url = 'http://' . $url;
     }
     try {
         $apiwrapper = ApiWrapperFactory::getInstance()->getApiWrapper($url);
     } catch (Exception $e) {
         $this->dieUsage('There was an issue with ApiWrapper', 'apiwrapper-error');
     }
     if (empty($apiwrapper)) {
         $this->dieUsageMsg('The supplied video does not exist');
     }
     $duplicate = $this->getVideoDuplicate($apiwrapper->getProvider(), $apiwrapper->getVideoId());
     $result = array('provider' => $apiwrapper->getProvider(), 'videoId' => $apiwrapper->getVideoId());
     if ($duplicate) {
         $result['title'] = $duplicate->getTitle()->getText();
         $result['url'] = $duplicate->getUrl();
     } else {
         // Check whether upload is enabled
         if (!UploadBase::isEnabled()) {
             $this->dieUsageMsg('uploaddisabled');
         }
         F::app()->wg->DisableProxy = true;
         $this->mUpload = new UploadFromUrl();
         $this->mUpload->initializeFromRequest(new FauxRequest(array('wpUpload' => 1, 'wpSourceType' => 'web', 'wpUploadFileURL' => $apiwrapper->getThumbnailUrl()), true));
         $this->mUpload->fetchFile();
         $this->checkPermissions();
         $this->verifyUpload();
         $tempFile = $this->createTempFile($this->mUpload->getTempPath());
         $result['title'] = $apiwrapper->getTitle();
         $result['tempUrl'] = $tempFile->getUrl();
         $result['tempName'] = $tempFile->getName();
     }
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:39,代码来源:ApiAddMediaTemporary.php

示例3: execute

	public function execute() {
		global $wgUser;

		// Check whether upload is enabled
		if ( !UploadBase::isEnabled() ) {
			$this->dieUsageMsg( array( 'uploaddisabled' ) );
		}

		$this->mParams = $this->extractRequestParams();

		$this->validateParams( $this->mParams );

		$request = $this->getMain()->getRequest();
		$this->mUpload = new ResumableUploadHandler;

		$status = $this->mUpload->initialize(
			$request->getVal( 'done', null ),
			$request->getVal( 'offset', null ),
			$request->getVal( 'filename', null ),
			$request->getVal( 'chunksession', null ),
			$request->getFileTempName( 'chunk' ),
			$request->getFileSize( 'chunk' ),
			$request->getSessionData( UploadBase::getSessionKeyname() )
		);

		if ( $status !== true ) {
			$this->dieUsage(  $status, 'chunk-init-error' );
		}

		$ret = $this->performUpload( );

		if(is_array($ret)) {
			foreach($ret as $key => $val) {
				$this->getResult()->addValue(null, $key, $val);
			}
		} else {
			$this->dieUsage($ret, 'error');
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:39,代码来源:ApiResumableUpload.php

示例4: 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

示例5: isEnabled

 /**
  * Checks if the upload from URL feature is enabled
  * @return bool
  */
 public static function isEnabled()
 {
     global $wgAllowCopyUploads;
     return $wgAllowCopyUploads && parent::isEnabled();
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:9,代码来源:UploadFromUrl.php

示例6: execute

 public function execute()
 {
     // Check whether upload is enabled
     if (!UploadBase::isEnabled()) {
         $this->dieUsageMsg('uploaddisabled');
     }
     $user = $this->getUser();
     // Parameter handling
     $this->mParams = $this->extractRequestParams();
     $request = $this->getMain()->getRequest();
     // Add the uploaded file to the params array
     $this->mParams['file'] = $request->getFileName('file');
     $this->mParams['chunk'] = $request->getFileName('chunk');
     // Copy the session key to the file key, for backward compatibility.
     if (!$this->mParams['filekey'] && $this->mParams['sessionkey']) {
         $this->mParams['filekey'] = $this->mParams['sessionkey'];
     }
     // Select an upload module
     if (!$this->selectUploadModule()) {
         // This is not a true upload, but a status request or similar
         return;
     }
     if (!isset($this->mUpload)) {
         $this->dieUsage('No upload module set', 'nomodule');
     }
     // First check permission to upload
     $this->checkPermissions($user);
     // Fetch the file
     $status = $this->mUpload->fetchFile();
     if (!$status->isGood()) {
         $errors = $status->getErrorsArray();
         $error = array_shift($errors[0]);
         $this->dieUsage('Error fetching file from remote source', $error, 0, $errors[0]);
     }
     // Check if the uploaded file is sane
     if ($this->mParams['chunk']) {
         $maxSize = $this->mUpload->getMaxUploadSize();
         if ($this->mParams['filesize'] > $maxSize) {
             $this->dieUsage('The file you submitted was too large', 'file-too-large');
         }
     } else {
         $this->verifyUpload();
     }
     // Check if the user has the rights to modify or overwrite the requested title
     // (This check is irrelevant if stashing is already requested, since the errors
     //  can always be fixed by changing the title)
     if (!$this->mParams['stash']) {
         $permErrors = $this->mUpload->verifyTitlePermissions($user);
         if ($permErrors !== true) {
             $this->dieRecoverableError($permErrors[0], 'filename');
         }
     }
     // Get the result based on the current upload context:
     $result = $this->getContextResult();
     if ($result['result'] === 'Success') {
         $result['imageinfo'] = $this->mUpload->getImageInfo($this->getResult());
     }
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
     // Cleanup any temporary mess
     $this->mUpload->cleanupTempFile();
 }
开发者ID:slackfaith,项目名称:deadbrain_site,代码行数:61,代码来源:ApiUpload.php

示例7: execute

 public function execute()
 {
     global $wgUser;
     // Check whether upload is enabled
     if (!UploadBase::isEnabled()) {
         $this->dieUsageMsg('uploaddisabled');
     }
     // Parameter handling
     $this->mParams = $this->extractRequestParams();
     $request = $this->getMain()->getRequest();
     // Add the uploaded file to the params array
     $this->mParams['file'] = $request->getFileName('file');
     // Copy the session key to the file key, for backward compatibility.
     if (!$this->mParams['filekey'] && $this->mParams['sessionkey']) {
         $this->mParams['filekey'] = $this->mParams['sessionkey'];
     }
     // Select an upload module
     if (!$this->selectUploadModule()) {
         // This is not a true upload, but a status request or similar
         return;
     }
     if (!isset($this->mUpload)) {
         $this->dieUsage('No upload module set', 'nomodule');
     }
     // First check permission to upload
     $this->checkPermissions($wgUser);
     // Fetch the file
     $status = $this->mUpload->fetchFile();
     if (!$status->isGood()) {
         $errors = $status->getErrorsArray();
         $error = array_shift($errors[0]);
         $this->dieUsage('Error fetching file from remote source', $error, 0, $errors[0]);
     }
     // Check if the uploaded file is sane
     $this->verifyUpload();
     // Check if the user has the rights to modify or overwrite the requested title
     // (This check is irrelevant if stashing is already requested, since the errors
     //  can always be fixed by changing the title)
     if (!$this->mParams['stash']) {
         $permErrors = $this->mUpload->verifyTitlePermissions($wgUser);
         if ($permErrors !== true) {
             $this->dieRecoverableError($permErrors[0], 'filename');
         }
     }
     // Prepare the API result
     $result = array();
     $warnings = $this->getApiWarnings();
     if ($warnings) {
         $result['result'] = 'Warning';
         $result['warnings'] = $warnings;
         // in case the warnings can be fixed with some further user action, let's stash this upload
         // and return a key they can use to restart it
         try {
             $result['filekey'] = $this->performStash();
             $result['sessionkey'] = $result['filekey'];
             // backwards compatibility
         } catch (MWException $e) {
             $result['warnings']['stashfailed'] = $e->getMessage();
         }
     } elseif ($this->mParams['stash']) {
         // Some uploads can request they be stashed, so as not to publish them immediately.
         // In this case, a failure to stash ought to be fatal
         try {
             $result['result'] = 'Success';
             $result['filekey'] = $this->performStash();
             $result['sessionkey'] = $result['filekey'];
             // backwards compatibility
         } catch (MWException $e) {
             $this->dieUsage($e->getMessage(), 'stashfailed');
         }
     } else {
         // This is the most common case -- a normal upload with no warnings
         // $result will be formatted properly for the API already, with a status
         $result = $this->performUpload();
     }
     if ($result['result'] === 'Success') {
         $result['imageinfo'] = $this->mUpload->getImageInfo($this->getResult());
     }
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
     // Cleanup any temporary mess
     $this->mUpload->cleanupTempFile();
 }
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:82,代码来源:ApiUpload.php

示例8: 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

示例9: execute

 public function execute()
 {
     global $wgUser, $wgAllowCopyUploads;
     // Check whether upload is enabled
     if (!UploadBase::isEnabled()) {
         $this->dieUsageMsg(array('uploaddisabled'));
     }
     $this->mParams = $this->extractRequestParams();
     $request = $this->getMain()->getRequest();
     // Add the uploaded file to the params array
     $this->mParams['file'] = $request->getFileName('file');
     // One and only one of the following parameters is needed
     $this->requireOnlyOneParameter($this->mParams, 'sessionkey', 'file', 'url');
     if ($this->mParams['sessionkey']) {
         /**
          * Upload stashed in a previous request
          */
         // Check the session key
         if (!isset($_SESSION['wsUploadData'][$this->mParams['sessionkey']])) {
             $this->dieUsageMsg(array('invalid-session-key'));
         }
         $this->mUpload = new UploadFromStash();
         $this->mUpload->initialize($this->mParams['filename'], $this->mParams['sessionkey'], $_SESSION['wsUploadData'][$this->mParams['sessionkey']]);
     } elseif (isset($this->mParams['filename'])) {
         /**
          * Upload from url, etc
          * Parameter filename is required
          */
         if (isset($this->mParams['file'])) {
             $this->mUpload = new UploadFromFile();
             $this->mUpload->initialize($this->mParams['filename'], $request->getFileTempName('file'), $request->getFileSize('file'));
         } elseif (isset($this->mParams['url'])) {
             // make sure upload by url is enabled:
             if (!$wgAllowCopyUploads) {
                 $this->dieUsageMsg(array('uploaddisabled'));
             }
             // make sure the current user can upload
             if (!$wgUser->isAllowed('upload_by_url')) {
                 $this->dieUsageMsg(array('badaccess-groups'));
             }
             $this->mUpload = new UploadFromUrl();
             $this->mUpload->initialize($this->mParams['filename'], $this->mParams['url']);
             $status = $this->mUpload->fetchFile();
             if (!$status->isOK()) {
                 $this->dieUsage($status->getWikiText(), 'fetchfileerror');
             }
         }
     } else {
         $this->dieUsageMsg(array('missingparam', 'filename'));
     }
     if (!isset($this->mUpload)) {
         $this->dieUsage('No upload module set', 'nomodule');
     }
     // Check whether the user has the appropriate permissions to upload anyway
     $permission = $this->mUpload->isAllowed($wgUser);
     if ($permission !== true) {
         if (!$wgUser->isLoggedIn()) {
             $this->dieUsageMsg(array('mustbeloggedin', 'upload'));
         } else {
             $this->dieUsageMsg(array('badaccess-groups'));
         }
     }
     // Perform the upload
     $result = $this->performUpload();
     // Cleanup any temporary mess
     $this->mUpload->cleanupTempFile();
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:68,代码来源:ApiUpload.php

示例10: 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

示例11: isUploadAllowed

 /**
  * Check if anyone can upload (or if other sitewide config prevents this)
  * Side effect: will print error page to wgOut if cannot upload.
  * @return boolean -- true if can upload
  */
 private function isUploadAllowed()
 {
     global $wgEnableAPI;
     // Check uploading enabled
     if (!UploadBase::isEnabled()) {
         $this->getOutput()->showErrorPage('uploaddisabled', 'uploaddisabledtext');
         return false;
     }
     // XXX does wgEnableAPI affect all uploads too?
     // Check whether we actually want to allow changing stuff
     if (wfReadOnly()) {
         $this->getOutput()->readOnlyPage();
         return false;
     }
     // we got all the way here, so it must be okay to upload
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:22,代码来源:SpecialUploadWizard.php

示例12: userCanUpload

 /**
  * Whether the user is allowed to upload
  * @return boolean
  */
 public function userCanUpload()
 {
     $config = $this->getMFConfig();
     $user = $this->getUser();
     // check if upload is enabled local or to remote location (to commons e.g.)
     // TODO: what if the user cannot upload to the destination wiki in $wgMFPhotoUploadEndpoint?
     $uploadEnabled = UploadBase::isEnabled() && UploadBase::isallowed($user) || $config->get('MFPhotoUploadEndpoint');
     if ($uploadEnabled) {
         // Make sure the user is either in desktop mode or meets the special
         // conditions necessary for uploading in mobile mode.
         if (!$this->shouldDisplayMobileView() || $user->isAllowed('mf-uploadbutton') && $user->getEditCount() >= $config->get('MFUploadMinEdits')) {
             return true;
         }
     }
     return false;
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:20,代码来源:MobileContext.php

示例13: appendGeneralInfo

 protected function appendGeneralInfo($property)
 {
     global $wgContLang;
     $config = $this->getConfig();
     $data = [];
     $mainPage = Title::newMainPage();
     $data['mainpage'] = $mainPage->getPrefixedText();
     $data['base'] = wfExpandUrl($mainPage->getFullURL(), PROTO_CURRENT);
     $data['sitename'] = $config->get('Sitename');
     // wgLogo can either be a relative or an absolute path
     // make sure we always return an absolute path
     $data['logo'] = wfExpandUrl($config->get('Logo'), PROTO_RELATIVE);
     $data['generator'] = "MediaWiki {$config->get('Version')}";
     $data['phpversion'] = PHP_VERSION;
     $data['phpsapi'] = PHP_SAPI;
     if (defined('HHVM_VERSION')) {
         $data['hhvmversion'] = HHVM_VERSION;
     }
     $data['dbtype'] = $config->get('DBtype');
     $data['dbversion'] = $this->getDB()->getServerVersion();
     $allowFrom = [''];
     $allowException = true;
     if (!$config->get('AllowExternalImages')) {
         $data['imagewhitelistenabled'] = (bool) $config->get('EnableImageWhitelist');
         $allowFrom = $config->get('AllowExternalImagesFrom');
         $allowException = !empty($allowFrom);
     }
     if ($allowException) {
         $data['externalimages'] = (array) $allowFrom;
         ApiResult::setIndexedTagName($data['externalimages'], 'prefix');
     }
     $data['langconversion'] = !$config->get('DisableLangConversion');
     $data['titleconversion'] = !$config->get('DisableTitleConversion');
     if ($wgContLang->linkPrefixExtension()) {
         $linkPrefixCharset = $wgContLang->linkPrefixCharset();
         $data['linkprefixcharset'] = $linkPrefixCharset;
         // For backwards compatibility
         $data['linkprefix'] = "/^((?>.*[^{$linkPrefixCharset}]|))(.+)\$/sDu";
     } else {
         $data['linkprefixcharset'] = '';
         $data['linkprefix'] = '';
     }
     $linktrail = $wgContLang->linkTrail();
     $data['linktrail'] = $linktrail ?: '';
     $data['legaltitlechars'] = Title::legalChars();
     $data['invalidusernamechars'] = $config->get('InvalidUsernameCharacters');
     global $IP;
     $git = SpecialVersion::getGitHeadSha1($IP);
     if ($git) {
         $data['git-hash'] = $git;
         $data['git-branch'] = SpecialVersion::getGitCurrentBranch($GLOBALS['IP']);
     }
     // 'case-insensitive' option is reserved for future
     $data['case'] = $config->get('CapitalLinks') ? 'first-letter' : 'case-sensitive';
     $data['lang'] = $config->get('LanguageCode');
     $fallbacks = [];
     foreach ($wgContLang->getFallbackLanguages() as $code) {
         $fallbacks[] = ['code' => $code];
     }
     $data['fallback'] = $fallbacks;
     ApiResult::setIndexedTagName($data['fallback'], 'lang');
     if ($wgContLang->hasVariants()) {
         $variants = [];
         foreach ($wgContLang->getVariants() as $code) {
             $variants[] = ['code' => $code, 'name' => $wgContLang->getVariantname($code)];
         }
         $data['variants'] = $variants;
         ApiResult::setIndexedTagName($data['variants'], 'lang');
     }
     $data['rtl'] = $wgContLang->isRTL();
     $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
     $data['readonly'] = wfReadOnly();
     if ($data['readonly']) {
         $data['readonlyreason'] = wfReadOnlyReason();
     }
     $data['writeapi'] = (bool) $config->get('EnableWriteAPI');
     $tz = $config->get('Localtimezone');
     $offset = $config->get('LocalTZoffset');
     if (is_null($tz)) {
         $tz = 'UTC';
         $offset = 0;
     } elseif (is_null($offset)) {
         $offset = 0;
     }
     $data['timezone'] = $tz;
     $data['timeoffset'] = intval($offset);
     $data['articlepath'] = $config->get('ArticlePath');
     $data['scriptpath'] = $config->get('ScriptPath');
     $data['script'] = $config->get('Script');
     $data['variantarticlepath'] = $config->get('VariantArticlePath');
     $data[ApiResult::META_BC_BOOLS][] = 'variantarticlepath';
     $data['server'] = $config->get('Server');
     $data['servername'] = $config->get('ServerName');
     $data['wikiid'] = wfWikiID();
     $data['time'] = wfTimestamp(TS_ISO_8601, time());
     $data['misermode'] = (bool) $config->get('MiserMode');
     $data['uploadsenabled'] = UploadBase::isEnabled();
     $data['maxuploadsize'] = UploadBase::getMaxUploadSize();
     $data['minuploadchunksize'] = (int) $this->getConfig()->get('MinUploadChunkSize');
     $data['thumblimits'] = $config->get('ThumbLimits');
//.........这里部分代码省略.........
开发者ID:claudinec,项目名称:galan-wiki,代码行数:101,代码来源:ApiQuerySiteinfo.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

示例15: execute

	/**
	 * Special page entry point
	 *
	 * What was changed here: the setArticleBodyOnly() line below was added,
	 * and some bits of code were entirely removed.
	 */
	public function execute( $par ) {
		global $wgUser, $wgOut, $wgRequest;

		// Disable the skin etc.
		$wgOut->setArticleBodyOnly( true );

		# Check that uploading is enabled
		if( !UploadBase::isEnabled() ) {
			$wgOut->showErrorPage( 'uploaddisabled', 'uploaddisabledtext' );
			return;
		}

		# Check permissions
		global $wgGroupPermissions;
		if( !$wgUser->isAllowed( 'upload' ) ) {
			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( 'upload' );
			}
			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 {
			$this->showUploadForm( $this->getUploadForm() );
		}

		# Cleanup
		if ( $this->mUpload ) {
			$this->mUpload->cleanupTempFile();
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:63,代码来源:AjaxUploadForm.php


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