Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2953,6 +2953,28 @@ |
2954 | 2954 | global $wgScriptPath, $wgScriptExtension; |
2955 | 2955 | return "{$wgScriptPath}/{$script}{$wgScriptExtension}"; |
2956 | 2956 | } |
| 2957 | +/** |
| 2958 | + * Get the script url. |
| 2959 | + * |
| 2960 | + * @return script url |
| 2961 | + */ |
| 2962 | +function wfGetScriptUrl(){ |
| 2963 | + if( isset( $_SERVER['SCRIPT_NAME'] ) ) { |
| 2964 | + # |
| 2965 | + # as it was called, minus the query string. |
| 2966 | + # |
| 2967 | + # Some sites use Apache rewrite rules to handle subdomains, |
| 2968 | + # and have PHP set up in a weird way that causes PHP_SELF |
| 2969 | + # to contain the rewritten URL instead of the one that the |
| 2970 | + # outside world sees. |
| 2971 | + # |
| 2972 | + # If in this mode, use SCRIPT_URL instead, which mod_rewrite |
| 2973 | + # provides containing the "before" URL. |
| 2974 | + return $_SERVER['SCRIPT_NAME']; |
| 2975 | + } else { |
| 2976 | + return $_SERVER['URL']; |
| 2977 | + } |
| 2978 | +} |
2957 | 2979 | |
2958 | 2980 | /** |
2959 | 2981 | * Convenience function converts boolean values into "true" |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -59,10 +59,10 @@ |
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | | - * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a |
64 | | - * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure. |
| 63 | + * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a |
| 64 | + * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure. |
65 | 65 | * |
66 | | - * Note that this is the definition of editinterface and it can be granted to |
| 66 | + * Note that this is the definition of editinterface and it can be granted to |
67 | 67 | * all users if desired. |
68 | 68 | */ |
69 | 69 | $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface'; |
— | — | @@ -311,6 +311,16 @@ |
312 | 312 | wfProfileOut( $fname.'-misc2' ); |
313 | 313 | wfProfileIn( $fname.'-extensions' ); |
314 | 314 | |
| 315 | +/* |
| 316 | + * load the $wgExtensionMessagesFiles for the script loader |
| 317 | + * this can't be done in a normal extension type way |
| 318 | + * since the script-loader is an entry point |
| 319 | + */ |
| 320 | +if( $wgEnableScriptLoader && strpos( wfGetScriptUrl(), "mwScriptLoader.php" ) !== false ){ |
| 321 | + $wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php"; |
| 322 | +} |
| 323 | + |
| 324 | + |
315 | 325 | # Extension setup functions for extensions other than skins |
316 | 326 | # Entries should be added to this variable during the inclusion |
317 | 327 | # of the extension file. This allows the extension to perform |
Index: trunk/phase3/includes/RawPage.php |
— | — | @@ -111,22 +111,7 @@ |
112 | 112 | function view() { |
113 | 113 | global $wgOut, $wgScript; |
114 | 114 | |
115 | | - if( isset( $_SERVER['SCRIPT_NAME'] ) ) { |
116 | | - # Normally we use PHP_SELF to get the URL to the script |
117 | | - # as it was called, minus the query string. |
118 | | - # |
119 | | - # Some sites use Apache rewrite rules to handle subdomains, |
120 | | - # and have PHP set up in a weird way that causes PHP_SELF |
121 | | - # to contain the rewritten URL instead of the one that the |
122 | | - # outside world sees. |
123 | | - # |
124 | | - # If in this mode, use SCRIPT_URL instead, which mod_rewrite |
125 | | - # provides containing the "before" URL. |
126 | | - $url = $_SERVER['SCRIPT_NAME']; |
127 | | - } else { |
128 | | - $url = $_SERVER['URL']; |
129 | | - } |
130 | | - |
| 115 | + $url = wfGetScriptUrl(); |
131 | 116 | if( $url == '' ) { |
132 | 117 | # This will make the next check fail with a confusing error |
133 | 118 | # message, so we should mention it separately. |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -3684,16 +3684,11 @@ |
3685 | 3685 | $wgMaxShellTime = 180; |
3686 | 3686 | |
3687 | 3687 | /** |
3688 | | -* Executable name of PHP cli client (php/php5) |
| 3688 | +* Executable Path of PHP cli client (php/php5) (should be setup on install) |
3689 | 3689 | */ |
3690 | | -$wgPhpCli = 'php'; |
| 3690 | +$wgPhpCli = '/usr/bin/php'; |
3691 | 3691 | |
3692 | 3692 | /** |
3693 | | - * the full path to shell out to php scripts: |
3694 | | - */ |
3695 | | -$wgPhpCliPath = '/usr/bin/php'; |
3696 | | - |
3697 | | -/** |
3698 | 3693 | * DJVU settings |
3699 | 3694 | * Path of the djvudump executable |
3700 | 3695 | * Enable this and $wgDjvuRenderer to enable djvu rendering |
Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | /** |
27 | 27 | * Simple wrapper for Http::request( 'GET' ) |
28 | 28 | */ |
29 | | - public static function get( $url, $timeout = false) { |
| 29 | + public static function get( $url, $timeout = false ) { |
30 | 30 | $opts = Array(); |
31 | 31 | if( $timeout ) |
32 | 32 | $opts['timeout'] = $timeout; |
— | — | @@ -42,8 +42,9 @@ |
43 | 43 | public static function doDownload( $url, $target_file_path , $dl_mode = self::SYNC_DOWNLOAD , $redirectCount = 0 ){ |
44 | 44 | global $wgPhpCli, $wgMaxUploadSize, $wgMaxRedirects; |
45 | 45 | // do a quick check to HEAD to insure the file size is not > $wgMaxUploadSize |
46 | | - $head = get_headers( $url, 1 ); |
| 46 | + $head = @get_headers( $url, 1 ); |
47 | 47 | |
| 48 | + |
48 | 49 | // check for redirects: |
49 | 50 | if( isset( $head['Location'] ) && strrpos( $head[0], '302' ) !== false ){ |
50 | 51 | if( $redirectCount < $wgMaxRedirects ){ |
Index: trunk/phase3/mwScriptLoader.php |
— | — | @@ -29,13 +29,8 @@ |
30 | 30 | |
31 | 31 | wfProfileIn( 'mvwScriptLoader.php' ); |
32 | 32 | |
33 | | -if( isset( $_SERVER['SCRIPT_URL'] ) ) { |
34 | | - $url = $_SERVER['SCRIPT_URL']; |
35 | | -} else { |
36 | | - $url = $_SERVER['PHP_SELF']; |
37 | | -} |
38 | 33 | |
39 | | -if( strpos( $url, "mwScriptLoader$wgScriptExtension" ) === false ){ |
| 34 | +if( strpos( wfGetScriptUrl(), "mwScriptLoader.php" ) === false ){ |
40 | 35 | wfHttpError( 403, 'Forbidden', |
41 | 36 | 'mvwScriptLoader must be accessed through the primary script entry point.' ); |
42 | 37 | return; |
— | — | @@ -48,10 +43,9 @@ |
49 | 44 | die( 1 ); |
50 | 45 | } |
51 | 46 | |
| 47 | +//moved to setup.php |
52 | 48 | // load the mwEmbed language file: |
53 | | -$wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php"; |
54 | | -// enable the msgs before we go on: |
55 | | -wfLoadExtensionMessages( 'mwEmbed' ); |
| 49 | +//$wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php"; |
56 | 50 | |
57 | 51 | // run jsScriptLoader action: |
58 | 52 | $myScriptLoader = new jsScriptLoader(); |
Index: trunk/phase3/js2/mwEmbed/example_usage/Player_Themable.html |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | <body bgcolor="#FFF"> |
21 | 21 | <h3> Sample Themed Player:</h3> |
22 | 22 | <a id="doThemeRoller" class="ui-icon_link ui-state-default ui-corner-all" href="#">loading theme editor<blink>...</blink></a><p><p> |
23 | | -<video src="media/sample_fish.ogg" thumbnail="media/sample_fish.jpg" durationHint="26"></video> |
| 23 | +<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> |
24 | 24 | </table> |
25 | 25 | |
26 | 26 | </body> |
Index: trunk/phase3/js2/mwEmbed/example_usage/Player_Timed_Text.html |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | <h4>Archive.org video with local SRTs (copied locally until we get srt over json for archive.org ;)</h4> |
41 | 41 | <textarea cols="120" rows="12"> |
42 | 42 | <video poster="http://www.archive.org/download/princess_iron_fan/format=thumbnail" URLTimeEncoding="true" |
43 | | - duration="1:13:0" linkback="http://www.archive.org/details/princess_iron_fan"> |
| 43 | + durationHint="1:13:0" linkback="http://www.archive.org/details/princess_iron_fan"> |
44 | 44 | <source type="video/ogg" src="http://www.archive.org/download/princess_iron_fan/princess_iron_fan.ogv"></source> |
45 | 45 | <source type="video/h264" src="http://www.archive.org/download/princess_iron_fan/princess_iron_fan_512kb.mp4"></source> |
46 | 46 | <text category="SUB" lang="en" type="text/x-srt" default="true" |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/mediaWikiUploadHelper.OFF.js |
— | — | @@ -1,163 +0,0 @@ |
2 | | -/* the upload javascript |
3 | | -presently does hackery to work with Special:Upload page... |
4 | | -will be replaced with upload API once that is ready |
5 | | -*/ |
6 | | - |
7 | | -loadGM({ |
8 | | - "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>", |
9 | | - "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>", |
10 | | - "upload-transcode-in-progress":"Doing Transcode & Upload (do not close this window)", |
11 | | - "upload-in-progress": "Upload in Progress (do not close this window)", |
12 | | - "upload-transcoded-status": "Transcoded", |
13 | | - "uploaded-status": "Uploaded", |
14 | | - "upload-select-file": "Select File...", |
15 | | - "wgfogg_wrong_version": "You have firefogg installed but its outdated, <a href=\"http://firefogg.org\">please upgrade</a> ", |
16 | | - "wgfogg_waring_ogg_upload": "You have selected an ogg file for conversion to ogg (this is probably unnessesary). Maybe disable the video converter?", |
17 | | - "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>", |
18 | | - "upload-stats-fileprogres": "$1 of $2", |
19 | | - |
20 | | - "mv_upload_done" : "Your upload <i>should be</i> accessible <a href=\"$1\">here</a>", |
21 | | - "upload-unknown-size": "Unknown size", |
22 | | - |
23 | | - "successfulupload" : "Successful upload", |
24 | | - "uploaderror" : "Upload error", |
25 | | - "uploadwarning": "Upload warning", |
26 | | - "unknown-error": "Unknown Error", |
27 | | - "return-to-form": "Return to form", |
28 | | - |
29 | | - "file-exists-duplicate" : "This file is a duplicate of the following file", |
30 | | - "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.", |
31 | | - "fileexists-thumb": "<center><b>Existing file</b></center>", |
32 | | - "ignorewarning" : "Ignore warning and save file anyway", |
33 | | - "file-thumbnail-no" : "The filename begins with <b><tt>$1</tt></b>" |
34 | | -}); |
35 | | - |
36 | | -var default_upload_options = { |
37 | | - 'target_div':'', |
38 | | - 'upload_done_action':'redirect', |
39 | | - 'api_url':false |
40 | | -} |
41 | | - |
42 | | -var mediaWikiUploadHelper = function(iObj){ |
43 | | - return this.init( iObj ); |
44 | | -} |
45 | | -mediaWikiUploadHelper.prototype = { |
46 | | - init:function( iObj ){ |
47 | | - var _this = this; |
48 | | - js_log('init uploader'); |
49 | | - if(!iObj) |
50 | | - iObj = {}; |
51 | | - for(var i in default_upload_options){ |
52 | | - if(iObj[i]){ |
53 | | - this[i] = iObj[i]; |
54 | | - }else{ |
55 | | - this[i] = default_upload_options[i]; |
56 | | - } |
57 | | - } |
58 | | - //check if we are on the uplaod page: |
59 | | - this.on_upload_page = ( wgPageName== "Special:Upload")?true:false; |
60 | | - js_log('f:mvUploader: onuppage:' + this.on_upload_page); |
61 | | - //grab firefogg.js: |
62 | | - mvJsLoader.doLoad([ |
63 | | - 'mvFirefogg' |
64 | | - ],function(){ |
65 | | - //if we are not on the upload page grab the upload html via ajax: |
66 | | - //@@todo refactor with |
67 | | - if( !_this.on_upload_page){ |
68 | | - $j.get(wgArticlePath.replace(/\$1/, 'Special:Upload'), {}, function(data){ |
69 | | - //add upload.js: |
70 | | - $j.getScript( stylepath + '/common/upload.js', function(){ |
71 | | - //really _really_ need an "upload api"! |
72 | | - wgAjaxUploadDestCheck = true; |
73 | | - wgAjaxLicensePreview = false; |
74 | | - wgUploadAutoFill = true; |
75 | | - //strip out inline scripts: |
76 | | - sp = data.indexOf('<div id="content">'); |
77 | | - se = data.indexOf('<!-- end content -->'); |
78 | | - if(sp!=-1 && se !=-1){ |
79 | | - result_data = data.substr(sp, (se-sp) ).replace('/\<script\s.*?\<\/script\>/gi',' '); |
80 | | - js_log("trying to set: " + result_data ); |
81 | | - //$j('#'+_this.target_div).html( result_data ); |
82 | | - } |
83 | | - _this.setupFirefogg(); |
84 | | - }); |
85 | | - }); |
86 | | - }else{ |
87 | | - //@@could check if firefogg is enabled here: |
88 | | - _this.setupFirefogg(); |
89 | | - //if only want httpUploadFrom help enable it here: |
90 | | - } |
91 | | - } |
92 | | - ); |
93 | | - }, |
94 | | - /** |
95 | | - * setupBaseUpInterface supports intefaces for progress indication if the browser supports it |
96 | | - * also sets up ajax progress updates for http posts |
97 | | - * //pre |
98 | | - */ |
99 | | - setupBaseUpInterface:function(){ |
100 | | - //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) |
101 | | - this.upForm = new mvBaseUploadInterface( { |
102 | | - 'api_url' : this.api_url, |
103 | | - 'parent_uploader': this |
104 | | - } |
105 | | - ); |
106 | | - this.upForm.setupForm(); |
107 | | - }, |
108 | | - setupFirefogg:function(){ |
109 | | - var _this = this; |
110 | | - //add firefogg html if not already there: ( same as $wgEnableFirebug added in SpecialUpload.php ) |
111 | | - if( $j('#fogg-video-file').length==0 ){ |
112 | | - js_log('add addFirefoggHtml'); |
113 | | - _this.addFirefoggHtml(); |
114 | | - }else{ |
115 | | - js_log('firefogg already init:'); |
116 | | - } |
117 | | - //set up the upload_done action |
118 | | - //redirect if we are on the upload page |
119 | | - //do a callback if in called from gui) |
120 | | - var intFirefoggObj = ( this.on_upload_page )? |
121 | | - {'upload_done_action':'redirect'}: |
122 | | - {'upload_done_action':function( rTitle ){ |
123 | | - js_log( 'add_done_action callback for uploader' ); |
124 | | - //call the parent insert resource preview |
125 | | - _this.upload_done_action( rTitle ); |
126 | | - } |
127 | | - }; |
128 | | - |
129 | | - if( _this.api_url ) |
130 | | - intFirefoggObj['api_url'] = _this.api_url; |
131 | | - |
132 | | - js_log('new mvFirefogg extends mvUploader (this)'); |
133 | | - this.fogg = new mvFirefogg( intFirefoggObj ); |
134 | | - this.fogg.setupForm(); |
135 | | - }, |
136 | | - //same add code as specialUpload if($wgEnableFirefogg){ |
137 | | - addFirefoggHtml:function(){ |
138 | | - var itd_html = $j('#mw-upload-table .mw-input:first').html(); |
139 | | - $j('#mw-upload-table .mw-input').eq(0).html('<div id="wg-base-upload">' + itd_html + '</div>'); |
140 | | - //add in firefogg control |
141 | | - $j('#wg-base-upload').after('<p id="fogg-enable-item" >' + |
142 | | - '<input style="display:none" id="fogg-video-file" name="fogg-video-file" type="button" value="' + gM('upload-select-file') + '">' + |
143 | | - "<span id='wgfogg_not_installed'>" + |
144 | | - gM('upload-fogg_not_installed') + |
145 | | - "</span>" + |
146 | | - "<span class='error' id='wgfogg_wrong_version' style='display:none;'><br>" + |
147 | | - gM('wgfogg_wrong_version') + |
148 | | - "<br>" + |
149 | | - "</span>" + |
150 | | - "<span class='error' id='wgfogg_waring_ogg_upload' style='display:none;'><br>"+ |
151 | | - gM('wgfogg_waring_ogg_upload') + |
152 | | - "<br>" + |
153 | | - "</span>" + |
154 | | - "<span class='error' id='wgfogg_waring_bad_extension' style='display:none;'><br>"+ |
155 | | - gM('wgfogg_waring_bad_extension') + |
156 | | - "<br>" + |
157 | | - "</span>" + |
158 | | - "<span id='wgfogg_installed' style='display:none' >"+ |
159 | | - '<input id="wgEnableFirefogg" type="checkbox" name="wgEnableFirefogg" >' + |
160 | | - gM('upload-enable-converter') + |
161 | | - '</span><br></p>'); |
162 | | - }, |
163 | | - |
164 | | -}; |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -1548,7 +1548,7 @@ |
1549 | 1549 | if( this.content_providers[this.disp_item] ){ |
1550 | 1550 | var cp = this.content_providers[this.disp_item]; |
1551 | 1551 | about_desc ='<span style="position:relative;top:0px;font-style:italic;">' + |
1552 | | - '<i>' + gM('results_from', cp.homepage, cp.title) + '</i></span>'; |
| 1552 | + '<i>' + gM('results_from', [cp.homepage, cp.title]) + '</i></span>'; |
1553 | 1553 | $j('#tab-'+this.disp_item).append( '<div id="rds_results_bar">'+ |
1554 | 1554 | '<span style="float:left;top:0px;font-style:italic;">'+ |
1555 | 1555 | gM('rsd_layout')+' '+ |
Index: trunk/phase3/js2/mwEmbed/jsScriptLoader.php |
— | — | @@ -54,6 +54,7 @@ |
55 | 55 | foreach( $this->jsFileList as $classKey => $file_name ){ |
56 | 56 | // special case: - title classes: |
57 | 57 | if( substr( $classKey, 0, 3 ) == 'WT:' ){ |
| 58 | + global $wgUser; |
58 | 59 | // get just the tile part: |
59 | 60 | $title_block = substr( $classKey, 3 ); |
60 | 61 | if( $title_block[0] == '-' && strpos( $title_block, '|' ) !== false ){ |
— | — | @@ -66,12 +67,13 @@ |
67 | 68 | $skin = $val; |
68 | 69 | } |
69 | 70 | } |
| 71 | + $sk = $wgUser->getSkin(); |
70 | 72 | // make sure the skin name is valid |
71 | 73 | $skinNames = Skin::getSkinNames(); |
72 | 74 | // get the lower case skin name (array keys) |
73 | 75 | $skinNames = array_keys( $skinNames ); |
74 | 76 | if( in_array( strtolower( $skin ), $skinNames ) ){ |
75 | | - $this->jsout .= Skin::generateUserJs( $skin ) . "\n"; |
| 77 | + $this->jsout .= $sk->generateUserJs( $skin ) . "\n"; |
76 | 78 | // success continue: |
77 | 79 | continue; |
78 | 80 | } |
— | — | @@ -147,7 +149,8 @@ |
148 | 150 | * updates the proc Request |
149 | 151 | */ |
150 | 152 | function procRequestVars(){ |
151 | | - global $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $wgStyleVersion; |
| 153 | + global $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses, |
| 154 | + $wgJSAutoloadLocalClasses, $wgStyleVersion, $wgEnableScriptLoaderJsFile; |
152 | 155 | |
153 | 156 | // set debug flag: |
154 | 157 | if( ( isset( $_GET['debug'] ) && $_GET['debug'] == 'true' ) || ( isset( $wgEnableScriptDebug ) && $wgEnableScriptDebug == true ) ){ |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1160,7 +1160,6 @@ |
1161 | 1161 | 'media_tip' => 'File link', |
1162 | 1162 | 'sig_tip' => 'Your signature with timestamp', |
1163 | 1163 | 'hr_tip' => 'Horizontal line (use sparingly)', |
1164 | | -'add_media_wizard' => 'Add media wizard', |
1165 | 1164 | |
1166 | 1165 | # Edit pages |
1167 | 1166 | 'summary' => 'Summary:', |