* addressed r53282#c3209 moved conditional inclusion of $wgExtensionMessages in mwScr...
authorMichael Dale <dale@users.mediawiki.org>
Wed, 15 Jul 2009 22:41:56 +0000 (22:41 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Wed, 15 Jul 2009 22:41:56 +0000 (22:41 +0000)
* 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

12 files changed:
includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/HttpFunctions.php
includes/RawPage.php
includes/Setup.php
js2/mwEmbed/example_usage/Player_Themable.html
js2/mwEmbed/example_usage/Player_Timed_Text.html
js2/mwEmbed/jsScriptLoader.php
js2/mwEmbed/libAddMedia/mediaWikiUploadHelper.OFF.js [deleted file]
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
languages/messages/MessagesEn.php
mwScriptLoader.php

index c51b038..9e04bb7 100644 (file)
@@ -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
index ddbe939..66cc3ec 100644 (file)
@@ -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"
index 1f812d8..b32ee85 100644 (file)
@@ -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 ){
index 4f8523d..ea698bc 100644 (file)
@@ -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.
index 8c2a5a3..20b4799 100644 (file)
@@ -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
index e7d3167..ca0a416 100644 (file)
@@ -19,7 +19,7 @@ mwAddOnloadHook(function(){
 <body bgcolor="#FFF">
 <h3> Sample Themed Player:</h3>
 <a id="doThemeRoller" class="ui-icon_link ui-state-default ui-corner-all" href="#">loading theme editor<blink>...</blink></a><p><p>
-<video src="media/sample_fish.ogg" thumbnail="media/sample_fish.jpg" durationHint="26"></video>        
+<video src="http://upload.wikimedia.org/wikipedia/commons/e/e2/Herbert_Hoover_video_montage.ogg" thumbnail="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/Herbert_Hoover_video_montage.ogg/mid-Herbert_Hoover_video_montage.ogg.jpg" durationHint="22"></video>     
  </table>
 
 </body>
index 9caa925..bd7ea6c 100644 (file)
@@ -39,7 +39,7 @@ Click on the little lower right "CC" icon to expose the timed text
                        <h4>Archive.org video with local SRTs (copied locally until we get srt over json for archive.org ;)</h4> 
                        <textarea cols="120" rows="12">
 <video poster="http://www.archive.org/download/princess_iron_fan/format=thumbnail"  URLTimeEncoding="true"
-       duration="1:13:0" linkback="http://www.archive.org/details/princess_iron_fan">
+       durationHint="1:13:0" linkback="http://www.archive.org/details/princess_iron_fan">
                <source type="video/ogg" src="http://www.archive.org/download/princess_iron_fan/princess_iron_fan.ogv"></source>
                <source type="video/h264" src="http://www.archive.org/download/princess_iron_fan/princess_iron_fan_512kb.mp4"></source>
        <text category="SUB" lang="en" type="text/x-srt" default="true"
index 3a33a3d..e73612f 100644 (file)
@@ -54,6 +54,7 @@ class jsScriptLoader {
                foreach( $this->jsFileList as $classKey => $file_name ){
                        // special case: - title classes:
                        if( substr( $classKey, 0, 3 ) == 'WT:' ){
+                               global $wgUser;
                                // get just the tile part:
                                $title_block = substr( $classKey, 3 );
                                if( $title_block[0] == '-' && strpos( $title_block, '|' ) !== false ){
@@ -66,12 +67,13 @@ class jsScriptLoader {
                                                        $skin = $val;
                                                }
                                        }
+                                       $sk = $wgUser->getSkin();
                                        // make sure the skin name is valid
                                        $skinNames = Skin::getSkinNames();
                                        // get the lower case skin name (array keys)
                                        $skinNames = array_keys( $skinNames );
                                        if( in_array( strtolower( $skin ), $skinNames ) ){
-                                               $this->jsout .= Skin::generateUserJs( $skin ) . "\n";
+                                               $this->jsout .= $sk->generateUserJs( $skin ) . "\n";
                                                // success continue:
                                                continue;
                                        }
@@ -147,7 +149,8 @@ class jsScriptLoader {
         * updates the proc Request
         */
        function procRequestVars(){
-               global $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $wgStyleVersion;
+               global $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses,
+               $wgJSAutoloadLocalClasses, $wgStyleVersion, $wgEnableScriptLoaderJsFile;
 
                // set debug flag:
                if( ( isset( $_GET['debug'] ) && $_GET['debug'] == 'true' ) || ( isset( $wgEnableScriptDebug ) && $wgEnableScriptDebug == true ) ){
diff --git a/js2/mwEmbed/libAddMedia/mediaWikiUploadHelper.OFF.js b/js2/mwEmbed/libAddMedia/mediaWikiUploadHelper.OFF.js
deleted file mode 100644 (file)
index 5bbeb7e..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/* the upload javascript 
-presently does hackery to work with Special:Upload page...
-will be replaced with upload API once that is ready
-*/
-
-loadGM({ 
-    "upload-enable-converter" : "Enable video converter (to upload source video not yet converted to theora format) <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg\">more info</a>",
-    "upload-fogg_not_installed": "If you want to upload video consider installing <a href=\"http://firefogg.org\">firefogg.org</a>, <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg\">more info</a>",
-    "upload-transcode-in-progress":"Doing Transcode & Upload (do not close this window)",
-    "upload-in-progress": "Upload in Progress (do not close this window)",
-    "upload-transcoded-status": "Transcoded",
-    "uploaded-status": "Uploaded",
-    "upload-select-file": "Select File...",    
-    "wgfogg_wrong_version": "You have firefogg installed but its outdated, <a href=\"http://firefogg.org\">please upgrade</a> ",
-    "wgfogg_waring_ogg_upload": "You have selected an ogg file for conversion to ogg (this is probably unnessesary). Maybe disable the video converter?",
-    "wgfogg_waring_bad_extension" : "You have selected a file with an unsuported extension. <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types\">More help</a>",
-    "upload-stats-fileprogres": "$1 of $2",
-    
-    "mv_upload_done"       : "Your upload <i>should be</i> accessible <a href=\"$1\">here</a>",
-    "upload-unknown-size": "Unknown size",    
-    
-    "successfulupload" : "Successful upload",
-    "uploaderror" : "Upload error",
-    "uploadwarning": "Upload warning",
-    "unknown-error": "Unknown Error",
-    "return-to-form": "Return to form",
-    
-    "file-exists-duplicate" : "This file is a duplicate of the following file",
-    "fileexists" : "A file with this name exists already, please check <b><tt>$1</tt></b> if you are not sure if you want to change it.",
-    "fileexists-thumb": "<center><b>Existing file</b></center>",
-    "ignorewarning" : "Ignore warning and save file anyway",
-    "file-thumbnail-no" :  "The filename begins with <b><tt>$1</tt></b>"    
-});
-
-var default_upload_options = {
-    'target_div':'',
-    'upload_done_action':'redirect',
-    'api_url':false
-}
-
-var mediaWikiUploadHelper = function(iObj){
-    return this.init( iObj );
-}
-mediaWikiUploadHelper.prototype = {
-    init:function( iObj ){
-        var _this = this;    
-        js_log('init uploader');
-        if(!iObj)
-            iObj = {};
-        for(var i in default_upload_options){
-            if(iObj[i]){
-                this[i] = iObj[i];
-            }else{
-                this[i] = default_upload_options[i];
-            }
-        }
-        //check if we are on the uplaod page: 
-        this.on_upload_page = ( wgPageName== "Special:Upload")?true:false;                    
-        js_log('f:mvUploader: onuppage:' + this.on_upload_page);
-        //grab firefogg.js: 
-        mvJsLoader.doLoad([
-                'mvFirefogg'
-            ],function(){
-                //if we are not on the upload page grab the upload html via ajax:
-                //@@todo refactor with         
-                if( !_this.on_upload_page){                    
-                    $j.get(wgArticlePath.replace(/\$1/, 'Special:Upload'), {}, function(data){
-                        //add upload.js: 
-                        $j.getScript( stylepath + '/common/upload.js', function(){     
-                            //really _really_ need an "upload api"!
-                            wgAjaxUploadDestCheck = true;
-                            wgAjaxLicensePreview = false;
-                            wgUploadAutoFill = true;                                    
-                            //strip out inline scripts:
-                            sp = data.indexOf('<div id="content">');
-                            se = data.indexOf('<!-- end content -->');    
-                            if(sp!=-1 && se !=-1){        
-                                result_data = data.substr(sp, (se-sp) ).replace('/\<script\s.*?\<\/script\>/gi',' ');
-                                js_log("trying to set: " + result_data );                                                                            
-                                //$j('#'+_this.target_div).html( result_data );
-                            }                        
-                            _this.setupFirefogg();
-                        });    
-                    });                
-                }else{
-                    //@@could check if firefogg is enabled here: 
-                    _this.setupFirefogg();            
-                    //if only want httpUploadFrom help enable it here:         
-                }                            
-            }
-        );
-    },
-    /**
-     * setupBaseUpInterface supports intefaces for progress indication if the browser supports it
-     * also sets up ajax progress updates for http posts
-     * //pre
-     */     
-    setupBaseUpInterface:function(){    
-        //check if this feature is not false (we want it on by default (null) instances that don't have the upload api or any modifications)              
-        this.upForm = new mvBaseUploadInterface( {
-                'api_url' : this.api_url,
-                'parent_uploader': this
-            } 
-        );        
-        this.upForm.setupForm();        
-    },
-    setupFirefogg:function(){
-        var _this = this;
-        //add firefogg html if not already there: ( same as $wgEnableFirebug added in SpecialUpload.php )  
-        if( $j('#fogg-video-file').length==0 ){
-            js_log('add addFirefoggHtml');
-            _this.addFirefoggHtml();
-        }else{
-            js_log('firefogg already init:');                    
-        }    
-        //set up the upload_done action 
-        //redirect if we are on the upload page  
-        //do a callback if in called from gui) 
-        var intFirefoggObj = ( this.on_upload_page )? 
-                {'upload_done_action':'redirect'}:
-                {'upload_done_action':function( rTitle ){
-                        js_log( 'add_done_action callback for uploader' );
-                        //call the parent insert resource preview    
-                        _this.upload_done_action( rTitle );        
-                    }
-                };
-                
-        if( _this.api_url )
-            intFirefoggObj['api_url'] =  _this.api_url;
-        
-        js_log('new mvFirefogg  extends mvUploader (this)');        
-        this.fogg = new mvFirefogg( intFirefoggObj );        
-        this.fogg.setupForm();                    
-    },
-    //same add code as specialUpload if($wgEnableFirefogg){
-    addFirefoggHtml:function(){        
-        var itd_html = $j('#mw-upload-table .mw-input:first').html();            
-        $j('#mw-upload-table .mw-input').eq(0).html('<div id="wg-base-upload">' + itd_html + '</div>');
-        //add in firefogg control            
-        $j('#wg-base-upload').after('<p id="fogg-enable-item" >' + 
-            '<input style="display:none" id="fogg-video-file" name="fogg-video-file" type="button" value="' + gM('upload-select-file') + '">' +
-            "<span id='wgfogg_not_installed'>" + 
-                gM('upload-fogg_not_installed') +
-            "</span>" +
-            "<span class='error' id='wgfogg_wrong_version'  style='display:none;'><br>" +
-                gM('wgfogg_wrong_version') +
-            "<br>" +
-            "</span>" +
-            "<span class='error' id='wgfogg_waring_ogg_upload' style='display:none;'><br>"+
-                gM('wgfogg_waring_ogg_upload') +
-            "<br>" +
-            "</span>" + 
-            "<span class='error' id='wgfogg_waring_bad_extension' style='display:none;'><br>"+
-                gM('wgfogg_waring_bad_extension') +                         
-            "<br>" +
-            "</span>" +  
-            "<span id='wgfogg_installed' style='display:none' >"+
-                '<input id="wgEnableFirefogg" type="checkbox" name="wgEnableFirefogg" >' +                             
-                    gM('upload-enable-converter') +
-            '</span><br></p>');                    
-    },
-
-};
index 7bc3ed5..3da6010 100644 (file)
@@ -1548,7 +1548,7 @@ remoteSearchDriver.prototype = {
                if( this.content_providers[this.disp_item] ){
                        var cp = this.content_providers[this.disp_item];
                        about_desc ='<span style="position:relative;top:0px;font-style:italic;">' +
-                                       '<i>' + gM('results_from', cp.homepage, cp.title) + '</i></span>';      
+                                       '<i>' + gM('results_from', [cp.homepage, cp.title]) + '</i></span>';    
                        $j('#tab-'+this.disp_item).append( '<div id="rds_results_bar">'+                                                
                                '<span style="float:left;top:0px;font-style:italic;">'+
                                        gM('rsd_layout')+' '+                           
index 9138960..dc9bd4c 100644 (file)
@@ -1160,7 +1160,6 @@ You may have already successfully changed your password or requested a new tempo
 'media_tip'       => 'File link',
 'sig_tip'         => 'Your signature with timestamp',
 'hr_tip'          => 'Horizontal line (use sparingly)',
-'add_media_wizard' => 'Add media wizard',
 
 # Edit pages
 'summary'                          => 'Summary:',
index ea772fc..e307938 100644 (file)
@@ -29,13 +29,8 @@ require_once('includes/WebStart.php');
 
 wfProfileIn( 'mvwScriptLoader.php' );
 
-if( isset( $_SERVER['SCRIPT_URL'] ) ) {
-       $url = $_SERVER['SCRIPT_URL'];
-} else {
-       $url = $_SERVER['PHP_SELF'];
-}
 
-if( strpos( $url, "mwScriptLoader$wgScriptExtension" ) === false ){
+if( strpos( wfGetScriptUrl(), "mwScriptLoader.php" ) === false ){
        wfHttpError( 403, 'Forbidden',
                'mvwScriptLoader must be accessed through the primary script entry point.' );
        return;
@@ -48,10 +43,9 @@ if ( !$wgEnableScriptLoader ) {
        die( 1 );
 }
 
+//moved to setup.php
 // load the mwEmbed language file:
-$wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php";
-// enable the msgs before we go on:
-wfLoadExtensionMessages( 'mwEmbed' );
+//$wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php";
 
 // run jsScriptLoader action:
 $myScriptLoader = new jsScriptLoader();