From 2d5154e634130d200432f59962cf80cd1e114fae Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Wed, 15 Jul 2009 22:41:56 +0000 Subject: [PATCH] * addressed r53282#c3209 moved conditional inclusion of $wgExtensionMessages in mwScriptLoader.php to Setup.php * put a @ in front of get_headers() should hopefully avoid errors where allow_url_fopen=0 * combined $wgPhpCliPath into the similar used $wgPhpCli var * minor js & example file mwEmbed fixes --- includes/DefaultSettings.php | 9 +- includes/GlobalFunctions.php | 22 +++ includes/HttpFunctions.php | 5 +- includes/RawPage.php | 17 +- includes/Setup.php | 16 +- .../example_usage/Player_Themable.html | 2 +- .../example_usage/Player_Timed_Text.html | 2 +- js2/mwEmbed/jsScriptLoader.php | 7 +- .../libAddMedia/mediaWikiUploadHelper.OFF.js | 163 ------------------ js2/mwEmbed/libAddMedia/remoteSearchDriver.js | 2 +- languages/messages/MessagesEn.php | 1 - mwScriptLoader.php | 12 +- 12 files changed, 52 insertions(+), 206 deletions(-) delete mode 100644 js2/mwEmbed/libAddMedia/mediaWikiUploadHelper.OFF.js diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index c51b0386af..9e04bb7028 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3684,14 +3684,9 @@ $wgMaxShellFileSize = 102400; $wgMaxShellTime = 180; /** -* Executable name of PHP cli client (php/php5) +* Executable Path of PHP cli client (php/php5) (should be setup on install) */ -$wgPhpCli = 'php'; - -/** - * the full path to shell out to php scripts: - */ -$wgPhpCliPath = '/usr/bin/php'; +$wgPhpCli = '/usr/bin/php'; /** * DJVU settings diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ddbe93911d..66cc3ecbf3 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2953,6 +2953,28 @@ function wfScript( $script = 'index' ) { global $wgScriptPath, $wgScriptExtension; return "{$wgScriptPath}/{$script}{$wgScriptExtension}"; } +/** + * Get the script url. + * + * @return script url + */ +function wfGetScriptUrl(){ + if( isset( $_SERVER['SCRIPT_NAME'] ) ) { + # + # as it was called, minus the query string. + # + # Some sites use Apache rewrite rules to handle subdomains, + # and have PHP set up in a weird way that causes PHP_SELF + # to contain the rewritten URL instead of the one that the + # outside world sees. + # + # If in this mode, use SCRIPT_URL instead, which mod_rewrite + # provides containing the "before" URL. + return $_SERVER['SCRIPT_NAME']; + } else { + return $_SERVER['URL']; + } +} /** * Convenience function converts boolean values into "true" diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 1f812d85e1..b32ee854c5 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -25,7 +25,7 @@ class Http { /** * Simple wrapper for Http::request( 'GET' ) */ - public static function get( $url, $timeout = false) { + public static function get( $url, $timeout = false ) { $opts = Array(); if( $timeout ) $opts['timeout'] = $timeout; @@ -42,7 +42,8 @@ class Http { public static function doDownload( $url, $target_file_path , $dl_mode = self::SYNC_DOWNLOAD , $redirectCount = 0 ){ global $wgPhpCli, $wgMaxUploadSize, $wgMaxRedirects; // do a quick check to HEAD to insure the file size is not > $wgMaxUploadSize - $head = get_headers( $url, 1 ); + $head = @get_headers( $url, 1 ); + // check for redirects: if( isset( $head['Location'] ) && strrpos( $head[0], '302' ) !== false ){ diff --git a/includes/RawPage.php b/includes/RawPage.php index 4f8523db72..ea698bce73 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -111,22 +111,7 @@ class RawPage { function view() { global $wgOut, $wgScript; - if( isset( $_SERVER['SCRIPT_NAME'] ) ) { - # Normally we use PHP_SELF to get the URL to the script - # as it was called, minus the query string. - # - # Some sites use Apache rewrite rules to handle subdomains, - # and have PHP set up in a weird way that causes PHP_SELF - # to contain the rewritten URL instead of the one that the - # outside world sees. - # - # If in this mode, use SCRIPT_URL instead, which mod_rewrite - # provides containing the "before" URL. - $url = $_SERVER['SCRIPT_NAME']; - } else { - $url = $_SERVER['URL']; - } - + $url = wfGetScriptUrl(); if( $url == '' ) { # This will make the next check fail with a confusing error # message, so we should mention it separately. diff --git a/includes/Setup.php b/includes/Setup.php index 8c2a5a3f0e..20b479905a 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -59,10 +59,10 @@ if ( empty( $wgFileStore['deleted']['directory'] ) ) { } /** - * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a - * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure. + * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a + * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure. * - * Note that this is the definition of editinterface and it can be granted to + * Note that this is the definition of editinterface and it can be granted to * all users if desired. */ $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface'; @@ -311,6 +311,16 @@ $wgArticle = null; wfProfileOut( $fname.'-misc2' ); wfProfileIn( $fname.'-extensions' ); +/* + * load the $wgExtensionMessagesFiles for the script loader + * this can't be done in a normal extension type way + * since the script-loader is an entry point + */ +if( $wgEnableScriptLoader && strpos( wfGetScriptUrl(), "mwScriptLoader.php" ) !== false ){ + $wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php"; +} + + # Extension setup functions for extensions other than skins # Entries should be added to this variable during the inclusion # of the extension file. This allows the extension to perform diff --git a/js2/mwEmbed/example_usage/Player_Themable.html b/js2/mwEmbed/example_usage/Player_Themable.html index e7d31676a2..ca0a416f2f 100644 --- a/js2/mwEmbed/example_usage/Player_Themable.html +++ b/js2/mwEmbed/example_usage/Player_Themable.html @@ -19,7 +19,7 @@ mwAddOnloadHook(function(){

Sample Themed Player:

loading theme editor...

- + diff --git a/js2/mwEmbed/example_usage/Player_Timed_Text.html b/js2/mwEmbed/example_usage/Player_Timed_Text.html index 9caa925bad..bd7ea6cb57 100644 --- a/js2/mwEmbed/example_usage/Player_Timed_Text.html +++ b/js2/mwEmbed/example_usage/Player_Timed_Text.html @@ -39,7 +39,7 @@ Click on the little lower right "CC" icon to expose the timed text

Archive.org video with local SRTs (copied locally until we get srt over json for archive.org ;)