Ticket #3882: 3882.diff
File 3882.diff, 4.3 KB (added by , 18 years ago) |
---|
-
wp-includes/js/tinymce/tiny_mce_gzip.php
17 17 18 18 // gzip_compression(); 19 19 20 // New realpath function 21 { 22 if ($path == "") 23 { 24 return false; 25 } 26 27 $path = trim(preg_replace("/\\\\/", "/", (string)$path)); 28 29 if (!preg_match("/(\.\w{1,4})$/", $path) && 30 !preg_match("/\?[^\\/]+$/", $path) && 31 !preg_match("/\\/$/", $path)) 32 { 33 $path .= '/'; 34 } 35 36 $pattern = "/^(\\/|\w:\\/|https?:\\/\\/[^\\/]+\\/)?(.*)$/i"; 37 38 preg_match_all($pattern, $path, $matches, PREG_SET_ORDER); 39 40 $path_tok_1 = $matches[0][1]; 41 $path_tok_2 = $matches[0][2]; 42 43 $path_tok_2 = preg_replace( 44 array("/^\\/+/", "/\\/+/"), 45 array("", "/"), 46 $path_tok_2); 47 48 $path_parts = explode("/", $path_tok_2); 49 $real_path_parts = array(); 50 51 for ($i = 0, $real_path_parts = array(); $i < count($path_parts); $i++) 52 { 53 if ($path_parts[$i] == '.') 54 { 55 continue; 56 } 57 else if ($path_parts[$i] == '..') 58 { 59 if ( (isset($real_path_parts[0]) && $real_path_parts[0] != '..') 60 || ($path_tok_1 != "") ) 61 { 62 array_pop($real_path_parts); 63 continue; 64 } 65 } 66 67 array_push($real_path_parts, $path_parts[$i]); 68 } 69 70 return $path_tok_1 . implode('/', $real_path_parts); 71 } 72 73 // End of real_path function 74 20 75 function wp_tinymce_lang($path) { 21 76 global $language; 22 77 23 78 $text = ''; 24 79 25 80 // Look for xx_YY.js, xx_yy.js, xx.js 26 $file = real path(sprintf($path, $language));81 $file = real_path(sprintf($path, $language)); 27 82 if ( file_exists($file) ) 28 83 $text = file_get_contents($file); 29 $file = real path(sprintf($path, strtolower($language)));84 $file = real_path(sprintf($path, strtolower($language))); 30 85 if ( file_exists($file) ) 31 86 $text = file_get_contents($file); 32 $file = real path(sprintf($path, substr($language, 0, 2)));87 $file = real_path(sprintf($path, substr($language, 0, 2))); 33 88 if ( file_exists($file) ) 34 89 $text = file_get_contents($file); 35 90 36 91 37 92 // Fall back on en.js 38 $file = real path(sprintf($path, 'en'));93 $file = real_path(sprintf($path, 'en')); 39 94 if ( empty($text) && file_exists($file) ) 40 95 $text = file_get_contents($file); 41 96 … … 78 133 $suffix = ""; // Set to "_src" to use source version 79 134 $expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires 80 135 $diskCache = false; // If you enable this option gzip files will be cached on disk. 81 $cacheDir = real path("."); // Absolute directory path to where cached gz files will be stored136 $cacheDir = real_path("."); // Absolute directory path to where cached gz files will be stored 82 137 $debug = false; // Enable this option if you need debuging info 83 138 84 139 // Headers … … 143 198 } else 144 199 $diskCache = false; 145 200 201 146 202 if ($index > -1) { 147 203 // Write main script and patch some things 148 204 if ($index == 0) { 149 TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(real path("tiny_mce" . $suffix . ".js")))); // WP205 TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(real_path("tiny_mce" . $suffix . ".js")))); // WP 150 206 TinyMCE_echo('TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;'); 151 207 TinyMCE_echo('TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;'); 152 208 } else … … 161 217 162 218 // Load theme, language pack and theme language packs 163 219 if ($theme) { 164 TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(real path("themes/" . $theme . "/editor_template" . $suffix . ".js")))); // WP220 TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(real_path("themes/" . $theme . "/editor_template" . $suffix . ".js")))); // WP 165 221 TinyMCE_echo(wp_tinymce_lang("themes/" . $theme . "/langs/%s.js")); // WP 166 222 } 167 223 … … 171 227 // Load all plugins and their language packs 172 228 $plugins = explode(",", $plugins); 173 229 foreach ($plugins as $plugin) { 174 $pluginFile = real path("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");230 $pluginFile = real_path("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); 175 231 /* WP $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js"); WP */ 176 232 177 233 if ($pluginFile)