function show( $string, $value ) { if ( $value === null ) { $value = 'null'; } elseif ( is_bool( $value ) ) { $value = wfBoolToStr( $value ); } else { $value = htmlspecialchars( $value ); } return Html::openElement( 'tr' ) . Html::openElement( 'td' ) . $string . Html::closeElement( 'td' ) . Html::openElement( 'td' ) . $value . Html::closeElement( 'td' ) . Html::closeElement( 'tr' ) . "\n"; }
/** * Formats the internal list of exposed APIs into an array suitable * to pass to the API's XML formatter. * * @return array */ protected function formatRsdApiList() { $apis = $this->getRsdApiList(); $outputData = array(); foreach ($apis as $name => $info) { $data = array('name' => $name, 'preferred' => wfBoolToStr($name == 'MediaWiki'), 'apiLink' => $info['apiLink'], 'blogID' => isset($info['blogID']) ? $info['blogID'] : ''); $settings = array(); if (isset($info['docs'])) { $settings['docs'] = $info['docs']; ApiResult::setSubelementsList($settings, 'docs'); } if (isset($info['settings'])) { foreach ($info['settings'] as $setting => $val) { if (is_bool($val)) { $xmlVal = wfBoolToStr($val); } else { $xmlVal = $val; } $setting = array('name' => $setting); ApiResult::setContentValue($setting, 'value', $xmlVal); $settings[] = $setting; } } if (count($settings)) { ApiResult::setIndexedTagName($settings, 'setting'); $data['settings'] = $settings; } $outputData[] = $data; } return $outputData; }
/** * @return string */ protected function getDefaultText() { if (!$this->values['wgImageMagickConvertCommand']) { $this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert'; $magic = '#'; } else { $magic = ''; } if (!$this->values['wgShellLocale']) { $this->values['wgShellLocale'] = 'en_US.UTF-8'; $locale = '#'; } else { $locale = ''; } $hashedUploads = $this->safeMode ? '' : '#'; $metaNamespace = ''; if ($this->values['wgMetaNamespace'] !== $this->values['wgSitename']) { $metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n"; } $groupRights = ''; $noFollow = ''; if ($this->groupPermissions) { $groupRights .= "# The following permissions were set based on your choice in the installer\n"; foreach ($this->groupPermissions as $group => $rightArr) { $group = self::escapePhpString($group); foreach ($rightArr as $right => $perm) { $right = self::escapePhpString($right); $groupRights .= "\$wgGroupPermissions['{$group}']['{$right}'] = " . wfBoolToStr($perm) . ";\n"; } } $groupRights .= "\n"; if (isset($this->groupPermissions['*']['edit']) && $this->groupPermissions['*']['edit'] === false && (isset($this->groupPermissions['*']['createaccount']) && $this->groupPermissions['*']['createaccount'] === false) && (isset($this->groupPermissions['*']['read']) && $this->groupPermissions['*']['read'] !== false)) { $noFollow = "# Set \$wgNoFollowLinks to true if you open up your wiki to editing by\n" . "# the general public and wish to apply nofollow to external links as a\n" . "# deterrent to spammers. Nofollow is not a comprehensive anti-spam solution\n" . "# and open wikis will generally require other anti-spam measures; for more\n" . "# information, see https://www.mediawiki.org/wiki/Manual:Combating_spam\n" . "\$wgNoFollowLinks = false;\n\n"; } } $serverSetting = ""; if (array_key_exists('wgServer', $this->values) && $this->values['wgServer'] !== null) { $serverSetting = "\n## The protocol and server name to use in fully-qualified URLs\n"; $serverSetting .= "\$wgServer = \"{$this->values['wgServer']}\";\n"; } switch ($this->values['wgMainCacheType']) { case 'anything': case 'db': case 'memcached': case 'accel': $cacheType = 'CACHE_' . strtoupper($this->values['wgMainCacheType']); break; case 'none': default: $cacheType = 'CACHE_NONE'; } $mcservers = $this->buildMemcachedServerList(); return "<?php\n# This file was automatically generated by the MediaWiki {$GLOBALS['wgVersion']}\n# installer. If you make manual changes, please keep track in case you\n# need to recreate them later.\n#\n# See includes/DefaultSettings.php for all configurable settings\n# and their default values, but don't forget to make changes in _this_\n# file, not there.\n#\n# Further documentation for configuration settings may be found at:\n# https://www.mediawiki.org/wiki/Manual:Configuration_settings\n\n# Protect against web entry\nif ( !defined( 'MEDIAWIKI' ) ) {\n\texit;\n}\n\n## Uncomment this to disable output compression\n# \$wgDisableOutputCompression = true;\n\n\$wgSitename = \"{$this->values['wgSitename']}\";\n{$metaNamespace}\n## The URL base path to the directory containing the wiki;\n## defaults for all runtime URL paths are based off of this.\n## For more information on customizing the URLs\n## (like /w/index.php/Page_title to /wiki/Page_title) please see:\n## https://www.mediawiki.org/wiki/Manual:Short_URL\n\$wgScriptPath = \"{$this->values['wgScriptPath']}\";\n{$serverSetting}\n\n## The relative URL path to the logo. Make sure you change this from the default,\n## or else you'll overwrite your logo when you upgrade!\n\$wgLogo = \"{$this->values['wgLogo']}\";\n\n## UPO means: this is also a user preference option\n\n\$wgEnableEmail = {$this->values['wgEnableEmail']};\n\$wgEnableUserEmail = {$this->values['wgEnableUserEmail']}; # UPO\n\n\$wgEmergencyContact = \"{$this->values['wgEmergencyContact']}\";\n\$wgPasswordSender = \"{$this->values['wgPasswordSender']}\";\n\n\$wgEnotifUserTalk = {$this->values['wgEnotifUserTalk']}; # UPO\n\$wgEnotifWatchlist = {$this->values['wgEnotifWatchlist']}; # UPO\n\$wgEmailAuthentication = {$this->values['wgEmailAuthentication']};\n\n## Database settings\n\$wgDBtype = \"{$this->values['wgDBtype']}\";\n\$wgDBserver = \"{$this->values['wgDBserver']}\";\n\$wgDBname = \"{$this->values['wgDBname']}\";\n\$wgDBuser = \"{$this->values['wgDBuser']}\";\n\$wgDBpassword = \"{$this->values['wgDBpassword']}\";\n\n{$this->dbSettings}\n\n## Shared memory settings\n\$wgMainCacheType = {$cacheType};\n\$wgMemCachedServers = {$mcservers};\n\n## To enable image uploads, make sure the 'images' directory\n## is writable, then set this to true:\n\$wgEnableUploads = {$this->values['wgEnableUploads']};\n{$magic}\$wgUseImageMagick = true;\n{$magic}\$wgImageMagickConvertCommand = \"{$this->values['wgImageMagickConvertCommand']}\";\n\n# InstantCommons allows wiki to use images from https://commons.wikimedia.org\n\$wgUseInstantCommons = {$this->values['wgUseInstantCommons']};\n\n## If you use ImageMagick (or any other shell command) on a\n## Linux server, this will need to be set to the name of an\n## available UTF-8 locale\n{$locale}\$wgShellLocale = \"{$this->values['wgShellLocale']}\";\n\n## If you want to use image uploads under safe mode,\n## create the directories images/archive, images/thumb and\n## images/temp, and make them all writable. Then uncomment\n## this, if it's not already uncommented:\n{$hashedUploads}\$wgHashedUploadDirectory = false;\n\n## Set \$wgCacheDirectory to a writable directory on the web server\n## to make your wiki go slightly faster. The directory should not\n## be publically accessible from the web.\n#\$wgCacheDirectory = \"\$IP/cache\";\n\n# Site language code, should be one of the list in ./languages/Names.php\n\$wgLanguageCode = \"{$this->values['wgLanguageCode']}\";\n\n\$wgSecretKey = \"{$this->values['wgSecretKey']}\";\n\n# Site upgrade key. Must be set to a string (default provided) to turn on the\n# web installer while LocalSettings.php is in place\n\$wgUpgradeKey = \"{$this->values['wgUpgradeKey']}\";\n\n## For attaching licensing metadata to pages, and displaying an\n## appropriate copyright notice / icon. GNU Free Documentation\n## License and Creative Commons licenses are supported so far.\n\$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright\n\$wgRightsUrl = \"{$this->values['wgRightsUrl']}\";\n\$wgRightsText = \"{$this->values['wgRightsText']}\";\n\$wgRightsIcon = \"{$this->values['wgRightsIcon']}\";\n\n# Path to the GNU diff3 utility. Used for conflict resolution.\n\$wgDiff3 = \"{$this->values['wgDiff3']}\";\n\n{$groupRights}{$noFollow}## Default skin: you can change the default skin. Use the internal symbolic\n## names, ie 'vector', 'monobook':\n\$wgDefaultSkin = \"{$this->values['wgDefaultSkin']}\";\n"; }
public function getLocalSettings() { $dbmysql5 = wfBoolToStr($this->getVar('wgDBmysql5', true)); $prefix = LocalSettingsGenerator::escapePhpString($this->getVar('wgDBprefix')); $tblOpts = LocalSettingsGenerator::escapePhpString($this->getTableOptions()); return "# MySQL specific settings\n\$wgDBprefix = \"{$prefix}\";\n\n# MySQL table options to use during installation or update\n\$wgDBTableOptions = \"{$tblOpts}\";\n\n# Experimental charset support for MySQL 5.0.\n\$wgDBmysql5 = {$dbmysql5};"; }
/** * @covers ::wfClientAcceptsGzip */ public function testClientAcceptsGzipTest() { $settings = array('gzip' => true, 'bzip' => false, '*' => false, 'compress, gzip' => true, 'gzip;q=1.0' => true, 'foozip' => false, 'foo*zip' => false, 'gzip;q=abcde' => true, 'gzip;q=12345678.9' => true, ' gzip' => true); if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { $old_server_setting = $_SERVER['HTTP_ACCEPT_ENCODING']; } foreach ($settings as $encoding => $expect) { $_SERVER['HTTP_ACCEPT_ENCODING'] = $encoding; $this->assertEquals($expect, wfClientAcceptsGzip(true), "'{$encoding}' => " . wfBoolToStr($expect)); } if (isset($old_server_setting)) { $_SERVER['HTTP_ACCEPT_ENCODING'] = $old_server_setting; } }
/** * @return String */ private function getDefaultText() { if (!$this->values['wgImageMagickConvertCommand']) { $this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert'; $magic = '#'; } else { $magic = ''; } if (!$this->values['wgShellLocale']) { $this->values['wgShellLocale'] = 'en_US.UTF-8'; $locale = '#'; } else { $locale = ''; } $rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; $hashedUploads = $this->safeMode ? '' : '#'; $metaNamespace = ''; if ($this->values['wgMetaNamespace'] !== $this->values['wgSitename']) { $metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n"; } $groupRights = ''; if ($this->groupPermissions) { $groupRights .= "# The following permissions were set based on your choice in the installer\n"; foreach ($this->groupPermissions as $group => $rightArr) { $group = self::escapePhpString($group); foreach ($rightArr as $right => $perm) { $right = self::escapePhpString($right); $groupRights .= "\$wgGroupPermissions['{$group}']['{$right}'] = " . wfBoolToStr($perm) . ";\n"; } } } switch ($this->values['wgMainCacheType']) { case 'anything': case 'db': case 'memcached': case 'accel': $cacheType = 'CACHE_' . strtoupper($this->values['wgMainCacheType']); break; case 'none': default: $cacheType = 'CACHE_NONE'; } $mcservers = $this->buildMemcachedServerList(); return "<?php\n# This file was automatically generated by the MediaWiki {$GLOBALS['wgVersion']}\n# installer. If you make manual changes, please keep track in case you\n# need to recreate them later.\n#\n# See includes/DefaultSettings.php for all configurable settings\n# and their default values, but don't forget to make changes in _this_\n# file, not there.\n#\n# Further documentation for configuration settings may be found at:\n# http://www.mediawiki.org/wiki/Manual:Configuration_settings\n\n# Protect against web entry\nif ( !defined( 'MEDIAWIKI' ) ) {\n\texit;\n}\n\n## Uncomment this to disable output compression\n# \$wgDisableOutputCompression = true;\n\n\$wgSitename = \"{$this->values['wgSitename']}\";\n{$metaNamespace}\n## The URL base path to the directory containing the wiki;\n## defaults for all runtime URL paths are based off of this.\n## For more information on customizing the URLs please see:\n## http://www.mediawiki.org/wiki/Manual:Short_URL\n\$wgScriptPath = \"{$this->values['wgScriptPath']}\";\n\$wgScriptExtension = \"{$this->values['wgScriptExtension']}\";\n\n## The relative URL path to the skins directory\n\$wgStylePath = \"\$wgScriptPath/skins\";\n\n## The relative URL path to the logo. Make sure you change this from the default,\n## or else you'll overwrite your logo when you upgrade!\n\$wgLogo = \"\$wgStylePath/common/images/wiki.png\";\n\n## UPO means: this is also a user preference option\n\n\$wgEnableEmail = {$this->values['wgEnableEmail']};\n\$wgEnableUserEmail = {$this->values['wgEnableUserEmail']}; # UPO\n\n\$wgEmergencyContact = \"{$this->values['wgEmergencyContact']}\";\n\$wgPasswordSender = \"{$this->values['wgPasswordSender']}\";\n\n\$wgEnotifUserTalk = {$this->values['wgEnotifUserTalk']}; # UPO\n\$wgEnotifWatchlist = {$this->values['wgEnotifWatchlist']}; # UPO\n\$wgEmailAuthentication = {$this->values['wgEmailAuthentication']};\n\n## Database settings\n\$wgDBtype = \"{$this->values['wgDBtype']}\";\n\$wgDBserver = \"{$this->values['wgDBserver']}\";\n\$wgDBname = \"{$this->values['wgDBname']}\";\n\$wgDBuser = \"{$this->values['wgDBuser']}\";\n\$wgDBpassword = \"{$this->values['wgDBpassword']}\";\n\n{$this->dbSettings}\n\n## Shared memory settings\n\$wgMainCacheType = {$cacheType};\n\$wgMemCachedServers = {$mcservers};\n\n## To enable image uploads, make sure the 'images' directory\n## is writable, then set this to true:\n\$wgEnableUploads = {$this->values['wgEnableUploads']};\n{$magic}\$wgUseImageMagick = true;\n{$magic}\$wgImageMagickConvertCommand = \"{$this->values['wgImageMagickConvertCommand']}\";\n\n# InstantCommons allows wiki to use images from http://commons.wikimedia.org\n\$wgUseInstantCommons = {$this->values['wgUseInstantCommons']};\n\n## If you use ImageMagick (or any other shell command) on a\n## Linux server, this will need to be set to the name of an\n## available UTF-8 locale\n{$locale}\$wgShellLocale = \"{$this->values['wgShellLocale']}\";\n\n## If you want to use image uploads under safe mode,\n## create the directories images/archive, images/thumb and\n## images/temp, and make them all writable. Then uncomment\n## this, if it's not already uncommented:\n{$hashedUploads}\$wgHashedUploadDirectory = false;\n\n## If you have the appropriate support software installed\n## you can enable inline LaTeX equations:\n\$wgUseTeX = false;\n\n## Set \$wgCacheDirectory to a writable directory on the web server\n## to make your wiki go slightly faster. The directory should not\n## be publically accessible from the web.\n#\$wgCacheDirectory = \"\$IP/cache\";\n\n# Site language code, should be one of ./languages/Language(.*).php\n\$wgLanguageCode = \"{$this->values['wgLanguageCode']}\";\n\n\$wgSecretKey = \"{$this->values['wgSecretKey']}\";\n\n# Site upgrade key. Must be set to a string (default provided) to turn on the\n# web installer while LocalSettings.php is in place\n\$wgUpgradeKey = \"{$this->values['wgUpgradeKey']}\";\n\n## Default skin: you can change the default skin. Use the internal symbolic\n## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':\n\$wgDefaultSkin = \"{$this->values['wgDefaultSkin']}\";\n\n## For attaching licensing metadata to pages, and displaying an\n## appropriate copyright notice / icon. GNU Free Documentation\n## License and Creative Commons licenses are supported so far.\n{$rightsUrl}\$wgEnableCreativeCommonsRdf = true;\n\$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright\n\$wgRightsUrl = \"{$this->values['wgRightsUrl']}\";\n\$wgRightsText = \"{$this->values['wgRightsText']}\";\n\$wgRightsIcon = \"{$this->values['wgRightsIcon']}\";\n# \$wgRightsCode = \"{$this->values['wgRightsCode']}\"; # Not yet used\n\n# Path to the GNU diff3 utility. Used for conflict resolution.\n\$wgDiff3 = \"{$this->values['wgDiff3']}\";\n\n{$groupRights}\n\n# Query string length limit for ResourceLoader. You should only set this if\n# your web server has a query string length limit (then set it to that limit),\n# or if you have suhosin.get.max_value_length set in php.ini (then set it to\n# that value)\n\$wgResourceLoaderMaxQueryLength = {$this->values['wgResourceLoaderMaxQueryLength']};\n"; }
function execute($par) { global $wgOut, $wgUser, $wgRequest; global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview; if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } if ($wgUser->getID() == 0) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); return; } if (!in_array('staff', $wgUser->getGroups())) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); return; } $this->errorFile = ""; $this->errorTitle = ""; if ($wgRequest->getVal('delete')) { $wgOut->setArticleBodyOnly(true); $hpid = str_replace('delete_', '', $wgRequest->getVal('delete')); $html = self::deleteHPImage($hpid); $wgOut->addHTML($html); return; } $this->postSuccessful = true; if ($wgRequest->wasPosted()) { if ($wgRequest->getVal("updateActive")) { $dbw = wfGetDB(DB_MASTER); //first clear them all $dbw->update(WikihowHomepageAdmin::HP_TABLE, array('hp_active' => 0, 'hp_order' => 0), '*', __METHOD__); $images = $wgRequest->getArray("hp_images"); $count = 1; foreach ($images as $image) { if (!$image) { continue; } $dbw->update(WikihowHomepageAdmin::HP_TABLE, array('hp_active' => 1, 'hp_order' => $count), array('hp_id' => $image)); $count++; } } else { $title = WikiPhoto::getArticleTitleNoCheck($wgRequest->getVal('articleName')); if (!$title->exists()) { $this->postSuccessful = false; $this->errorTitle = "* That article does not exist."; } if ($this->postSuccessful) { //keep going $imageTitle = Title::newFromText($wgRequest->getVal('wpDestFile'), NS_IMAGE); $file = new LocalFile($imageTitle, RepoGroup::singleton()->getLocalRepo()); $file->upload($wgRequest->getFileTempName('wpUploadFile'), '', ''); $filesize = $file->getSize(); if ($filesize > 0) { $dbw = wfGetDB(DB_MASTER); $dbw->insert(WikihowHomepageAdmin::HP_TABLE, array('hp_page' => $title->getArticleID(), 'hp_image' => $imageTitle->getArticleID())); $article = new Article($imageTitle); $limit = array(); $limit['move'] = "sysop"; $limit['edit'] = "sysop"; $protectResult = $article->updateRestrictions($limit, "Used on homepage"); } else { $this->postSuccessful = false; $this->errorFile = "* We encountered an error uploading that file."; } } } } $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview; $adc = wfBoolToStr($useAjaxDestCheck); $alp = wfBoolToStr($useAjaxLicensePreview); $wgOut->setPageTitle('WikiHow Homepage Admin'); $wgOut->addScript("<script type=\"text/javascript\">\nwgAjaxUploadDestCheck = {$adc};\nwgAjaxLicensePreview = {$alp};\n</script>"); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery-ui-1.8.custom.min.js'), 'extensions/wikihow/common/ui/js', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('wikihowhomepageadmin.js'), 'extensions/wikihow/homepage', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('wikihowhomepageadmin.css'), 'extensions/wikihow/homepage', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('upload.js'), 'skins/common', false)); $this->displayHomepageData(); $this->displayForm(); }
function mainUploadForm($msg = '') { global $wgOut, $wgUser, $wgLang, $wgMaxUploadSize; global $wgUseCopyrightUpload, $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview; global $wgRequest, $wgAllowCopyUploads; global $wgStylePath, $wgStyleVersion; $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview; $adc = wfBoolToStr($useAjaxDestCheck); $alp = wfBoolToStr($useAjaxLicensePreview); $autofill = wfBoolToStr($this->mDesiredDestName == ''); $wgOut->addScript("<script type=\"text/javascript\">\nwgAjaxUploadDestCheck = {$adc};\nwgAjaxLicensePreview = {$alp};\nwgUploadAutoFill = {$autofill};\n</script>\n<script type=\"text/javascript\" src=\"{$wgStylePath}/common/upload.js?{$wgStyleVersion}\"></script>\n\t\t"); if (!wfRunHooks('UploadForm:initial', array(&$this))) { wfDebug("Hook 'UploadForm:initial' broke output of the upload form"); return false; } if ($this->mDesiredDestName) { $title = Title::makeTitleSafe(NS_IMAGE, $this->mDesiredDestName); // Show a subtitle link to deleted revisions (to sysops et al only) if ($title instanceof Title && ($count = $title->isDeleted()) > 0 && $wgUser->isAllowed('deletedhistory')) { $link = wfMsgExt($wgUser->isAllowed('delete') ? 'thisisdeleted' : 'viewdeleted', array('parse', 'replaceafter'), $wgUser->getSkin()->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete', $title->getPrefixedText()), wfMsgExt('restorelink', array('parsemag', 'escape'), $count))); $wgOut->addHtml("<div id=\"contentSub2\">{$link}</div>"); } // Show the relevant lines from deletion log (for still deleted files only) if ($title instanceof Title && $title->isDeleted() > 0 && !$title->exists()) { $this->showDeletionLog($wgOut, $title->getPrefixedText()); } } $cols = intval($wgUser->getOption('cols')); if ($wgUser->getOption('editwidth')) { $width = " style=\"width:100%\""; } else { $width = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } //$wgOut->addHTML( '<div id="uploadtext">' ); //$wgOut->addWikiMsg( 'uploadtext', $this->mDesiredDestName ); //$wgOut->addHTML( "</div>\n" ); # Print a list of allowed file extensions, if so configured. We ignore # MIME type here, it's incomprehensible to most people and too long. global $wgCheckFileExtensions, $wgStrictFileExtensions, $wgFileExtensions, $wgFileBlacklist; $allowedExtensions = ''; if ($wgCheckFileExtensions) { $delim = wfMsgExt('comma-separator', array('escapenoentities')); if ($wgStrictFileExtensions) { # Everything not permitted is banned $extensionsList = '<div id="mw-upload-permitted">' . wfMsgWikiHtml('upload-permitted', implode($wgFileExtensions, $delim)) . "</div>\n"; } else { # We have to list both preferred and prohibited $extensionsList = '<div id="mw-upload-preferred">' . wfMsgWikiHtml('upload-preferred', implode($wgFileExtensions, $delim)) . "</div>\n" . '<div id="mw-upload-prohibited">' . wfMsgWikiHtml('upload-prohibited', implode($wgFileBlacklist, $delim)) . "</div>\n"; } } # Get the maximum file size from php.ini as $wgMaxUploadSize works for uploads from URL via CURL only # See http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize for possible values of upload_max_filesize $val = trim(ini_get('upload_max_filesize')); $last = strtoupper(substr($val, -1)); switch ($last) { case 'G': $val2 = substr($val, 0, -1) * 1024 * 1024 * 1024; break; case 'M': $val2 = substr($val, 0, -1) * 1024 * 1024; break; case 'K': $val2 = substr($val, 0, -1) * 1024; break; default: $val2 = $val; } $val2 = $wgAllowCopyUploads ? min($wgMaxUploadSize, $val2) : $val2; $maxUploadSize = wfMsgExt('upload-maxfilesize', array('parseinline', 'escapenoentities'), $wgLang->formatSize($val2)); $sourcefilename = wfMsgExt('sourcefilename', 'escapenoentities'); $destfilename = wfMsgExt('destfilename', 'escapenoentities'); $summary = wfMsgExt('fileuploadsummary', 'parseinline'); $licenses = new Licenses(); $license = wfMsgExt('license', array('parseinline')); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = SpecialPage::getTitleFor('Mv_special_upload'); $encDestName = htmlspecialchars($this->mDesiredDestName); $watchChecked = $this->watchCheck() ? 'checked="checked"' : ''; $warningChecked = $this->mIgnoreWarning ? 'checked' : ''; // Prepare form for upload or upload/copy if ($wgAllowCopyUploads && $wgUser->isAllowed('upload_by_url')) { $filename_form = "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' " . "onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked='checked' />" . "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . "onfocus='" . "toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");" . "toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")' " . "onchange='fillDestFilename(\"wpUploadFile\")' size='60' />" . wfMsgHTML('upload_source_file') . "<br/>" . "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' " . "onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" . "<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' " . "onfocus='" . "toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");" . "toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")' " . "onchange='fillDestFilename(\"wpUploadFileURL\")' size='60' disabled='disabled' />" . wfMsgHtml('upload_source_url'); } else { $filename_form = "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='60' />" . "<input type='hidden' name='wpSourceType' value='file' />"; } if ($useAjaxDestCheck) { $warningRow = "<tr><td colspan='2' id='wpDestFile-warning'> </td></tr>"; $destOnkeyup = 'onkeyup="wgUploadWarningObj.keypress();"'; } else { $warningRow = ''; $destOnkeyup = ''; } $encComment = htmlspecialchars($this->mComment); $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $titleObj->getLocalURL(), 'enctype' => 'multipart/form-data', 'id' => 'mw-upload-form')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('upload')) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-upload-table')) . "<tr>\n\t\t\t \t{$this->uploadFormTextTop}\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpUploadFile'>{$sourcefilename}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t{$filename_form}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t{$maxUploadSize}\n\t\t\t\t\t{$extensionsList}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpDestFile'>{$destfilename}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='60'\n\t\t\t\t\t\tvalue=\"{$encDestName}\" onchange='toggleFilenameFiller()' {$destOnkeyup} />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='file_desc_msg'>stream desc msg</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<input tabindex='3' type='text' name='file_desc_msg' id='file_desc_msg' size='60'\n\t\t\t\t\t\tvalue=\"mv_ogg_low_quality\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpUploadDescription'>{$summary}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<textarea tabindex='4' name='wpUploadDescription' id='wpUploadDescription' rows='6'\n\t\t\t\t\t\tcols='{$cols}'{$width}>{$encComment}</textarea>\n\t\t\t\t\t{$this->uploadFormTextAfterSummary}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t<label for='wpLicense'>{$license}</label>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t\t\t{$licenseshtml}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); if ($useAjaxLicensePreview) { $wgOut->addHtml("\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td id=\"mw-license-preview\"></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>"); } } if ($wgUseCopyrightUpload) { $filestatus = wfMsgExt('filestatus', 'escapenoentities'); $copystatus = htmlspecialchars($this->mCopyrightStatus); $filesource = wfMsgExt('filesource', 'escapenoentities'); $uploadsource = htmlspecialchars($this->mCopyrightSource); $wgOut->addHTML("\n\t\t\t\t\t<td class='mw-label' style='white-space: nowrap;'>\n\t\t\t\t\t\t<label for='wpUploadCopyStatus'>{$filestatus}</label></td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus'\n\t\t\t\t\t\t\tvalue=\"{$copystatus}\" size='60' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t<label for='wpUploadCopyStatus'>{$filesource}</label>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus'\n\t\t\t\t\t\t\tvalue=\"{$uploadsource}\" size='60' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); } $wgOut->addHtml("\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthisupload') . "</label>\n\t\t\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' {$warningChecked}/>\n\t\t\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t{$warningRow}\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\"" . $wgUser->getSkin()->tooltipAndAccesskey('upload') . " />\n\t\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>"); //undesa $stream_id = $wgRequest->getVal('stream_id'); $wgOut->addHTML("<input type=hidden name=stream_id value={$stream_id}></input>"); //undesa $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t\t\t</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::hidden('wpDestFileWarningAck', '', array('id' => 'wpDestFileWarningAck')) . Xml::closeElement('fieldset') . Xml::closeElement('form')); $uploadfooter = wfMsgNoTrans('uploadfooter'); if ($uploadfooter != '-' && !wfEmptyMsg('uploadfooter', $uploadfooter)) { $wgOut->addWikiText(Xml::tags('div', array('id' => 'mw-upload-footer-message'), $uploadfooter)); } }
/** * Build an input for $conf setting with $default as default value * * @param String $conf name of the setting * @param String $type type of the setting * @param String $default default value * @return String xhtml fragment */ protected function buildInput($conf, $type, $default) { $allowed = !in_array($conf, self::$restricted) || $this->isUserAllowedAll(); if ($type == 'text' || $type == 'int') { if (!$allowed) { return htmlspecialchars($default); } return Xml::element('input', array('name' => 'wp' . $conf, 'type' => 'text', 'value' => $default)); } if ($type == 'bool') { if (!$allowed) { return wfBoolToStr($default); } if ($default) { $checked = array('checked' => 'checked'); } else { $checked = array(); } return Xml::element('input', array('name' => 'wp' . $conf, 'type' => 'checkbox', 'value' => '1') + $checked); } if ($type == 'array') { return $this->buildArrayInput($conf, $default, $allowed); } if ($type == 'lang') { // Code taken from Xml.php, Xml::LanguageSelector only available since 1.11 and Xml::option since 1.8 $languages = Language::getLanguageNames(true); if (!array_key_exists($default, $languages)) { $languages[$default] = $default; } ksort($languages); $options = "\n"; foreach ($languages as $code => $name) { $attribs = array('value' => $code); if ($code == $default) { $attribs['selected'] = 'selected'; } $options .= Xml::element('option', $attribs, "{$code} - {$name}") . "\n"; } return Xml::openElement('select', array('id' => 'wp' . $conf, 'name' => 'wp' . $conf)) . $options . "</select>"; } if (is_array($type)) { if (!$allowed) { return htmlspecialchars($default); } $ret = "\n"; foreach ($type as $val => $name) { $ret .= Xml::radioLabel($name, 'wp' . $conf, $val, 'wp' . $conf . $val, $default == $val) . "\n"; } return $ret; } }
/** * Prettify boolean settings to be correctly displayed * * @return String */ public static function prettifyForDisplay($val) { if (is_bool($val)) { return wfBoolToStr($val); } else { return $val; } }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param string $msg as HTML * @access private */ function mainUploadForm($msg = '') { global $wgOut, $wgUser, $wgContLang; global $wgUseCopyrightUpload, $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview; global $wgRequest, $wgAllowCopyUploads; global $wgStylePath, $wgStyleVersion; $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview; $adc = wfBoolToStr($useAjaxDestCheck); $alp = wfBoolToStr($useAjaxLicensePreview); $wgOut->addScript("<script type=\"text/javascript\">\nwgAjaxUploadDestCheck = {$adc};\nwgAjaxLicensePreview = {$alp};\n</script>\n<script type=\"text/javascript\" src=\"{$wgStylePath}/common/upload.js?{$wgStyleVersion}\"></script>\n\t\t"); if (!wfRunHooks('UploadForm:initial', array(&$this))) { wfDebug("Hook 'UploadForm:initial' broke output of the upload form"); return false; } if ($this->mDesiredDestName) { $title = Title::makeTitleSafe(NS_IMAGE, $this->mDesiredDestName); // Show a subtitle link to deleted revisions (to sysops et al only) if ($title instanceof Title && ($count = $title->isDeleted()) > 0 && $wgUser->isAllowed('deletedhistory')) { $link = wfMsgExt($wgUser->isAllowed('delete') ? 'thisisdeleted' : 'viewdeleted', array('parse', 'replaceafter'), $wgUser->getSkin()->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete', $title->getPrefixedText()), wfMsgExt('restorelink', array('parsemag', 'escape'), $count))); $wgOut->addHtml("<div id=\"contentSub2\">{$link}</div>"); } // Show the relevant lines from deletion log (for still deleted files only) if ($title instanceof Title && $title->isDeleted() > 0 && !$title->exists()) { $this->showDeletionLog($wgOut, $title->getPrefixedText()); } } $cols = intval($wgUser->getOption('cols')); if ($wgUser->getOption('editwidth')) { $width = " style=\"width:100%\""; } else { $width = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } $wgOut->addHTML('<div id="uploadtext">'); $wgOut->addWikiMsg('uploadtext', $this->mDesiredDestName); $wgOut->addHTML("</div>\n"); # Print a list of allowed file extensions, if so configured. We ignore # MIME type here, it's incomprehensible to most people and too long. global $wgCheckFileExtensions, $wgStrictFileExtensions, $wgFileExtensions, $wgFileBlacklist; if ($wgCheckFileExtensions) { $delim = wfMsgExt('comma-separator', array('escapenoentities')); if ($wgStrictFileExtensions) { # Everything not permitted is banned $wgOut->addHTML('<div id="mw-upload-permitted">' . wfMsgWikiHtml('upload-permitted', implode($wgFileExtensions, $delim)) . "</div>\n"); } else { # We have to list both preferred and prohibited $wgOut->addHTML('<div id="mw-upload-preferred">' . wfMsgWikiHtml('upload-preferred', implode($wgFileExtensions, $delim)) . "</div>\n" . '<div id="mw-upload-prohibited">' . wfMsgWikiHtml('upload-prohibited', implode($wgFileBlacklist, $delim)) . "</div>\n"); } } $sourcefilename = wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsgExt('fileuploadsummary', 'parseinline'); $licenses = new Licenses(); $license = wfMsgExt('license', array('parseinline')); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = SpecialPage::getTitleFor('Upload'); $action = $titleObj->escapeLocalURL(); $encDestName = htmlspecialchars($this->mDesiredDestName); $watchChecked = $wgUser->getOption('watchdefault') || $wgUser->getOption('watchcreations') && $this->mDesiredDestName == '' ? 'checked="checked"' : ''; $warningChecked = $this->mIgnoreWarning ? 'checked' : ''; // Prepare form for upload or upload/copy if ($wgAllowCopyUploads && $wgUser->isAllowed('upload_by_url')) { $filename_form = "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' " . "onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" . "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . "onfocus='" . "toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");" . "toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . wfMsgHTML('upload_source_file') . "<br/>" . "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' " . "onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" . "<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' " . "onfocus='" . "toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");" . "toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")'" . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFileURL\")' ") . "size='40' DISABLED />" . wfMsgHtml('upload_source_url'); } else { $filename_form = "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . "<input type='hidden' name='wpSourceType' value='file' />"; } if ($useAjaxDestCheck) { $warningRow = "<tr><td colspan='2' id='wpDestFile-warning'> </td></tr>"; $destOnkeyup = 'onkeyup="wgUploadWarningObj.keypress();"'; } else { $warningRow = ''; $destOnkeyup = ''; } $encComment = htmlspecialchars($this->mComment); $align1 = $wgContLang->isRTL() ? 'left' : 'right'; $align2 = $wgContLang->isRTL() ? 'right' : 'left'; $wgOut->addHTML(<<<EOT \t<form id='upload' method='post' enctype='multipart/form-data' action="{$action}"> \t\t<table border='0'> \t\t<tr> \t {$this->uploadFormTextTop} \t\t\t<td align='{$align1}' valign='top'><label for='wpUploadFile'>{$sourcefilename}:</label></td> \t\t\t<td align='{$align2}'> \t\t\t\t{$filename_form} \t\t\t</td> \t\t</tr> \t\t<tr> \t\t\t<td align='{$align1}'><label for='wpDestFile'>{$destfilename}:</label></td> \t\t\t<td align='{$align2}'> \t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' \t\t\t\t\tvalue="{$encDestName}" {$destOnkeyup} /> \t\t\t</td> \t\t</tr> \t\t<tr> \t\t\t<td align='{$align1}'><label for='wpUploadDescription'>{$summary}</label></td> \t\t\t<td align='{$align2}'> \t\t\t\t<textarea tabindex='3' name='wpUploadDescription' id='wpUploadDescription' rows='6' \t\t\t\t\tcols='{$cols}'{$width}>{$encComment}</textarea> \t {$this->uploadFormTextAfterSummary} \t\t\t</td> \t\t</tr> \t\t<tr> EOT ); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='{$align1}'><label for='wpLicense'>{$license}:</label></td>\n\t\t\t<td align='{$align2}'>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); if ($useAjaxLicensePreview) { $wgOut->addHtml("\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td id=\"mw-license-preview\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); } } if ($wgUseCopyrightUpload) { $filestatus = wfMsgHtml('filestatus'); $copystatus = htmlspecialchars($this->mCopyrightStatus); $filesource = wfMsgHtml('filesource'); $uploadsource = htmlspecialchars($this->mCopyrightSource); $wgOut->addHTML("\n\t\t\t <td align='{$align1}' nowrap='nowrap'><label for='wpUploadCopyStatus'>{$filestatus}:</label></td>\n\t\t\t\t\t<td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' \n\t\t\t\t\t value=\"{$copystatus}\" size='40' /></td>\n\t\t </tr>\n\t\t\t<tr>\n\t\t \t<td align='{$align1}'><label for='wpUploadCopyStatus'>{$filesource}:</label></td>\n\t\t\t\t\t<td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' \n\t\t\t\t\t value=\"{$uploadsource}\" size='40' /></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } $wgOut->addHtml("\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthisupload') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' {$warningChecked}/>\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t{$warningRow}\n\t<tr>\n\t\t<td></td>\n\t\t<td align='{$align2}'><input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\"" . $wgUser->getSkin()->tooltipAndAccesskey('upload') . " /></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='{$align2}'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t<input type='hidden' name='wpDestFileWarningAck' id='wpDestFileWarningAck' value=''/>\n\t</form>"); }
function runLaTeX($file = 'Main', $sort = false, $bibtex = false) { global $wgUser; $timer_start = microtime(true); $this->debug = $wgUser->getOption('w2lDebug'); $this->is_admin = in_array('sysop', $wgUser->getGroups()); $command = str_replace('%file%', $file, $this->command); $cur_dir = getcwd(); chdir($this->path); $go = true; $i = 1; $msg = $this->msg; if ($this->debug == true && $this->is_admin == true) { $msg .= "\n== Debug Information ==\n"; $msg .= wfMsg('w2l_compile_command', $command) . "\n"; $msg .= wfMsg('w2l_temppath', $this->path) . "\n"; $msg .= "Current directory: " . getcwd() . "\n"; $msg .= "User: "******"whoami") . "\n"; $msg .= "== PDF-LaTeX Information ==\n" . wfShellExec("pdflatex -version"); } while (true == $go or $i > 5) { $msg .= "\n" . wfMsg('w2l_compile_run', $i) . "\n"; $msg .= wfShellExec($command); if (!file_exists($file . '.pdf')) { $msg .= wfMsg('w2l_pdf_not_created', $file . '.pdf') . "\n"; $msg .= "Current directory: " . getcwd() . "\n"; $msg .= "Is it writable? " . wfBoolToStr(is_writable(getcwd())) . "\n"; $msg .= "Is it a font-problem maybe? " . wfShellExec('kpsewhich -var-value TFMFONTS') . "\n"; $msg .= "Is it a path maybe? " . wfShellExec('kpsewhich -var-value HOME') . "\n"; $compile_error = true; $go = false; } else { $compile_error = false; /* if ( true == $sort ) { // sort it, baby $msg .= '===Sort-Result==='."\n"; $msg .= $this->sortIndexFile($file); $msg .= "\n"; } if ( true == $bibtex ) { // run bibtex $msg .= '===BibTeX-Result==='."\n"; $msg .= $this->doBibTex($file); $msg .= "\n"; } */ if ($this->repeat == $i) { $go = false; } ++$i; } } // Now chmod-ing some files $mod = 0666; if (is_dir($this->path)) { $directory = dir($this->path); while (false !== ($tmp_file = $directory->read())) { if (is_file($tmp_file)) { $res = chmod($tmp_file, $mod); } } $directory->close(); } if (file_exists($file . '.log')) { $this->log = file_get_contents($file . '.log'); } else { $this->log = 'Log file was not created...'; } chdir($cur_dir); $timer_end = microtime(true); $this->timer = $timer_end - $timer_start; $this->timer = round($this->timer, 3); $msg .= "Running time LaTeX: " . $timer . " seconds"; $this->msg = $msg; return $compile_error; }