@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | # |
99 | 99 | if (!function_exists('xml_parser_create')) { |
100 | 100 | $this->error( "Failed to load PHP's XML Extension. " . |
101 | - "http://www.php.net/manual/en/ref.xml.php", |
|
102 | - E_USER_ERROR ); |
|
101 | + "http://www.php.net/manual/en/ref.xml.php", |
|
102 | + E_USER_ERROR ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | list($parser, $source) = $this->create_parser($source, |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | |
109 | 109 | if (!is_resource($parser)) { |
110 | 110 | $this->error( "Failed to create an instance of PHP's XML parser. " . |
111 | - "http://www.php.net/manual/en/ref.xml.php", |
|
112 | - E_USER_ERROR ); |
|
111 | + "http://www.php.net/manual/en/ref.xml.php", |
|
112 | + E_USER_ERROR ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -445,9 +445,9 @@ discard block |
||
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
448 | - * return XML parser, and possibly re-encoded source |
|
449 | - * |
|
450 | - */ |
|
448 | + * return XML parser, and possibly re-encoded source |
|
449 | + * |
|
450 | + */ |
|
451 | 451 | function create_parser($source, $out_enc, $in_enc, $detect) { |
452 | 452 | if ( substr(phpversion(),0,1) == 5) { |
453 | 453 | $parser = $this->php5_create_parser($in_enc, $detect); |
@@ -464,14 +464,14 @@ discard block |
||
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
467 | - * Instantiate an XML parser under PHP5 |
|
468 | - * |
|
469 | - * PHP5 will do a fine job of detecting input encoding |
|
470 | - * if passed an empty string as the encoding. |
|
471 | - * |
|
472 | - * All hail libxml2! |
|
473 | - * |
|
474 | - */ |
|
467 | + * Instantiate an XML parser under PHP5 |
|
468 | + * |
|
469 | + * PHP5 will do a fine job of detecting input encoding |
|
470 | + * if passed an empty string as the encoding. |
|
471 | + * |
|
472 | + * All hail libxml2! |
|
473 | + * |
|
474 | + */ |
|
475 | 475 | function php5_create_parser($in_enc, $detect) { |
476 | 476 | // by default php5 does a fine job of detecting input encodings |
477 | 477 | if(!$detect && $in_enc) { |
@@ -483,20 +483,20 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
486 | - * Instaniate an XML parser under PHP4 |
|
487 | - * |
|
488 | - * Unfortunately PHP4's support for character encodings |
|
489 | - * and especially XML and character encodings sucks. As |
|
490 | - * long as the documents you parse only contain characters |
|
491 | - * from the ISO-8859-1 character set (a superset of ASCII, |
|
492 | - * and a subset of UTF-8) you're fine. However once you |
|
493 | - * step out of that comfy little world things get mad, bad, |
|
494 | - * and dangerous to know. |
|
495 | - * |
|
496 | - * The following code is based on SJM's work with FoF |
|
497 | - * @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss |
|
498 | - * |
|
499 | - */ |
|
486 | + * Instaniate an XML parser under PHP4 |
|
487 | + * |
|
488 | + * Unfortunately PHP4's support for character encodings |
|
489 | + * and especially XML and character encodings sucks. As |
|
490 | + * long as the documents you parse only contain characters |
|
491 | + * from the ISO-8859-1 character set (a superset of ASCII, |
|
492 | + * and a subset of UTF-8) you're fine. However once you |
|
493 | + * step out of that comfy little world things get mad, bad, |
|
494 | + * and dangerous to know. |
|
495 | + * |
|
496 | + * The following code is based on SJM's work with FoF |
|
497 | + * @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss |
|
498 | + * |
|
499 | + */ |
|
500 | 500 | function php4_create_parser($source, $in_enc, $detect) { |
501 | 501 | if ( !$detect ) { |
502 | 502 | return array(xml_parser_create($in_enc), $source); |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | |
541 | 541 | // else |
542 | 542 | $this->error("Feed is in an unsupported character encoding. ($in_enc) " . |
543 | - "You may see strange artifacts, and mangled characters.", |
|
544 | - E_USER_NOTICE); |
|
543 | + "You may see strange artifacts, and mangled characters.", |
|
544 | + E_USER_NOTICE); |
|
545 | 545 | |
546 | 546 | return array(xml_parser_create(), $source); |
547 | 547 | } |
@@ -587,17 +587,17 @@ discard block |
||
587 | 587 | // courtesy, Ryan Currie, [email protected] |
588 | 588 | |
589 | 589 | if (!function_exists('array_change_key_case')) { |
590 | - define("CASE_UPPER",1); |
|
591 | - define("CASE_LOWER",0); |
|
592 | - |
|
593 | - |
|
594 | - function array_change_key_case($array,$case=CASE_LOWER) { |
|
595 | - if ($case=CASE_LOWER) $cmd=strtolower; |
|
596 | - elseif ($case=CASE_UPPER) $cmd=strtoupper; |
|
597 | - foreach($array as $key=>$value) { |
|
598 | - $output[$cmd($key)]=$value; |
|
599 | - } |
|
600 | - return $output; |
|
601 | - } |
|
590 | + define("CASE_UPPER",1); |
|
591 | + define("CASE_LOWER",0); |
|
592 | + |
|
593 | + |
|
594 | + function array_change_key_case($array,$case=CASE_LOWER) { |
|
595 | + if ($case=CASE_LOWER) $cmd=strtolower; |
|
596 | + elseif ($case=CASE_UPPER) $cmd=strtoupper; |
|
597 | + foreach($array as $key=>$value) { |
|
598 | + $output[$cmd($key)]=$value; |
|
599 | + } |
|
600 | + return $output; |
|
601 | + } |
|
602 | 602 | |
603 | 603 | } |
@@ -1,44 +1,44 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc GD extension class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.51 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010, 2011 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc GD extension class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.51 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010, 2011 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class gd { |
16 | 16 | |
17 | - /** GD resource |
|
18 | - * @var resource */ |
|
17 | + /** GD resource |
|
18 | + * @var resource */ |
|
19 | 19 | protected $image; |
20 | 20 | |
21 | - /** Image width |
|
22 | - * @var integer */ |
|
21 | + /** Image width |
|
22 | + * @var integer */ |
|
23 | 23 | protected $width; |
24 | 24 | |
25 | - /** Image height |
|
26 | - * @var integer */ |
|
25 | + /** Image height |
|
26 | + * @var integer */ |
|
27 | 27 | protected $height; |
28 | 28 | |
29 | - /** Init error |
|
30 | - * @var bool */ |
|
29 | + /** Init error |
|
30 | + * @var bool */ |
|
31 | 31 | public $init_error = false; |
32 | 32 | |
33 | - /** Last builded image type constant (IMAGETYPE_XXX) |
|
34 | - * @var integer */ |
|
33 | + /** Last builded image type constant (IMAGETYPE_XXX) |
|
34 | + * @var integer */ |
|
35 | 35 | public $type; |
36 | 36 | |
37 | - /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. |
|
38 | - * Returns FALSE on failure. The only one parameter $image can be an instance of this class, |
|
39 | - * a GD resource, an array(width, height) or path to image file. |
|
40 | - * @param mixed $image |
|
41 | - * @return array */ |
|
37 | + /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. |
|
38 | + * Returns FALSE on failure. The only one parameter $image can be an instance of this class, |
|
39 | + * a GD resource, an array(width, height) or path to image file. |
|
40 | + * @param mixed $image |
|
41 | + * @return array */ |
|
42 | 42 | |
43 | 43 | protected function build_image($image) { |
44 | 44 | |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | return $return; |
88 | 88 | } |
89 | 89 | |
90 | - /** Parameter $image can be: |
|
91 | - * 1. An instance of this class (copy instance). |
|
92 | - * 2. A GD resource. |
|
93 | - * 3. An array with two elements. First - width, second - height. Create a blank image. |
|
94 | - * 4. A filename string. Get image form file. |
|
95 | - * The non-required parameter $bigger_size is the bigger dimension (width or height) the image |
|
96 | - * will be resized to. The other dimension (height or width) will be calculated autamaticaly |
|
97 | - * @param mixed $image |
|
98 | - * @param integer $bigger_size |
|
99 | - * @return gd */ |
|
90 | + /** Parameter $image can be: |
|
91 | + * 1. An instance of this class (copy instance). |
|
92 | + * 2. A GD resource. |
|
93 | + * 3. An array with two elements. First - width, second - height. Create a blank image. |
|
94 | + * 4. A filename string. Get image form file. |
|
95 | + * The non-required parameter $bigger_size is the bigger dimension (width or height) the image |
|
96 | + * will be resized to. The other dimension (height or width) will be calculated autamaticaly |
|
97 | + * @param mixed $image |
|
98 | + * @param integer $bigger_size |
|
99 | + * @return gd */ |
|
100 | 100 | |
101 | 101 | public function __construct($image, $bigger_size=null) { |
102 | 102 | $this->image = $this->width = $this->height = null; |
@@ -123,30 +123,30 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - /** Returns the GD resource |
|
127 | - * @return resource */ |
|
126 | + /** Returns the GD resource |
|
127 | + * @return resource */ |
|
128 | 128 | |
129 | 129 | public function get_image() { |
130 | 130 | return $this->image; |
131 | 131 | } |
132 | 132 | |
133 | - /** Returns the image width |
|
134 | - * @return integer */ |
|
133 | + /** Returns the image width |
|
134 | + * @return integer */ |
|
135 | 135 | |
136 | 136 | public function get_width() { |
137 | 137 | return $this->width; |
138 | 138 | } |
139 | 139 | |
140 | - /** Returns the image height |
|
141 | - * @return integer */ |
|
140 | + /** Returns the image height |
|
141 | + * @return integer */ |
|
142 | 142 | |
143 | 143 | public function get_height() { |
144 | 144 | return $this->height; |
145 | 145 | } |
146 | 146 | |
147 | - /** Returns calculated proportional width from the given height |
|
148 | - * @param integer $resized_height |
|
149 | - * @return integer */ |
|
147 | + /** Returns calculated proportional width from the given height |
|
148 | + * @param integer $resized_height |
|
149 | + * @return integer */ |
|
150 | 150 | |
151 | 151 | public function get_prop_width($resized_height) { |
152 | 152 | $width = intval(($this->width * $resized_height) / $this->height); |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | return $width; |
155 | 155 | } |
156 | 156 | |
157 | - /** Returns calculated proportional height from the given width |
|
158 | - * @param integer $resized_width |
|
159 | - * @return integer */ |
|
157 | + /** Returns calculated proportional height from the given width |
|
158 | + * @param integer $resized_width |
|
159 | + * @return integer */ |
|
160 | 160 | |
161 | 161 | public function get_prop_height($resized_width) { |
162 | 162 | $height = intval(($this->height * $resized_width) / $this->width); |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | return $height; |
165 | 165 | } |
166 | 166 | |
167 | - /** Returns an array with calculated proportional width & height. |
|
168 | - * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
|
169 | - * The other dimension (height or width) will be calculated autamaticaly |
|
170 | - * @param integer $bigger_size |
|
171 | - * @return array */ |
|
167 | + /** Returns an array with calculated proportional width & height. |
|
168 | + * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
|
169 | + * The other dimension (height or width) will be calculated autamaticaly |
|
170 | + * @param integer $bigger_size |
|
171 | + * @return array */ |
|
172 | 172 | |
173 | 173 | public function get_prop_size($bigger_size) { |
174 | 174 | |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | return array($width, $height); |
187 | 187 | } |
188 | 188 | |
189 | - /** Resize image. Returns TRUE on success or FALSE on failure |
|
190 | - * @param integer $width |
|
191 | - * @param integer $height |
|
192 | - * @return bool */ |
|
189 | + /** Resize image. Returns TRUE on success or FALSE on failure |
|
190 | + * @param integer $width |
|
191 | + * @param integer $height |
|
192 | + * @return bool */ |
|
193 | 193 | |
194 | 194 | public function resize($width, $height) { |
195 | 195 | if (!$width) $width = 1; |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | ); |
204 | 204 | } |
205 | 205 | |
206 | - /** Resize the given image source (GD, gd object or image file path) to fit in the own image. |
|
207 | - * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure |
|
208 | - * @param mixed $src |
|
209 | - * @return bool */ |
|
206 | + /** Resize the given image source (GD, gd object or image file path) to fit in the own image. |
|
207 | + * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure |
|
208 | + * @param mixed $src |
|
209 | + * @return bool */ |
|
210 | 210 | |
211 | 211 | public function resize_crop($src) { |
212 | 212 | $image_details = $this->build_image($src); |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | - /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure |
|
237 | - * @param integer $width |
|
238 | - * @param integer $height |
|
239 | - * @return bool */ |
|
236 | + /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure |
|
237 | + * @param integer $width |
|
238 | + * @param integer $height |
|
239 | + * @return bool */ |
|
240 | 240 | |
241 | 241 | public function resize_fit($width, $height) { |
242 | 242 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | return $this->resize($width, $height); |
251 | 251 | } |
252 | 252 | |
253 | - /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. |
|
254 | - * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, |
|
255 | - * no samo po edno (x ili y) izmerenie |
|
256 | - * @param integer $width |
|
257 | - * @param integer $height |
|
258 | - * @return bool */ |
|
253 | + /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. |
|
254 | + * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, |
|
255 | + * no samo po edno (x ili y) izmerenie |
|
256 | + * @param integer $width |
|
257 | + * @param integer $height |
|
258 | + * @return bool */ |
|
259 | 259 | |
260 | 260 | public function resize_overflow($width, $height) { |
261 | 261 | |
@@ -368,30 +368,30 @@ discard block |
||
368 | 368 | |
369 | 369 | |
370 | 370 | |
371 | - /*** gif transparent fix - 1.10.2013 ***/ |
|
371 | + /*** gif transparent fix - 1.10.2013 ***/ |
|
372 | 372 | |
373 | - $transindex = imagecolortransparent($src); |
|
374 | - $palletsize = imagecolorstotal($src); |
|
375 | - if($transindex >= 0 && $transindex < $palletsize) { |
|
376 | - $transcol = imagecolorsforindex($src, $transindex); |
|
373 | + $transindex = imagecolortransparent($src); |
|
374 | + $palletsize = imagecolorstotal($src); |
|
375 | + if($transindex >= 0 && $transindex < $palletsize) { |
|
376 | + $transcol = imagecolorsforindex($src, $transindex); |
|
377 | 377 | |
378 | - /*** end gif transparent fix ***/ |
|
378 | + /*** end gif transparent fix ***/ |
|
379 | 379 | |
380 | - $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
381 | - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
|
382 | - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
383 | - imagecolortransparent($this->image, $transindex); |
|
384 | - for($y=0; $y<$dst_h; ++$y) |
|
385 | - for($x=0; $x<$dst_w; ++$x) |
|
386 | - if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
387 | - imagetruecolortopalette($this->image, true, 255); |
|
388 | - } |
|
389 | - else { |
|
390 | - $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); |
|
391 | - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); |
|
392 | - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
393 | - } |
|
394 | - return $this->image; |
|
380 | + $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
381 | + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
|
382 | + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
383 | + imagecolortransparent($this->image, $transindex); |
|
384 | + for($y=0; $y<$dst_h; ++$y) |
|
385 | + for($x=0; $x<$dst_w; ++$x) |
|
386 | + if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
387 | + imagetruecolortopalette($this->image, true, 255); |
|
388 | + } |
|
389 | + else { |
|
390 | + $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); |
|
391 | + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); |
|
392 | + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
393 | + } |
|
394 | + return $this->image; |
|
395 | 395 | |
396 | 396 | } else |
397 | 397 | return false; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | public function imagegif($filename=null) { |
420 | 420 | if (is_null($filename) && !headers_sent()) |
421 | 421 | header("Content-Type: image/gif"); |
422 | - @imagesavealpha($this->image, true); |
|
422 | + @imagesavealpha($this->image, true); |
|
423 | 423 | return imagegif($this->image, $filename); |
424 | 424 | } |
425 | 425 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Base configuration file |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Base configuration file |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | // IMPORTANT!!! Do not remove uncommented settings in this file even if |
16 | 16 | // you are using session configuration. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'dirnameChangeChars' => array( |
71 | 71 | ' ' => "_", |
72 | 72 | ':' => "." |
73 | - ), |
|
73 | + ), |
|
74 | 74 | 'mime_magic' => "", |
75 | 75 | |
76 | 76 | 'maxImageWidth' => $modx->config['maxImageWidth'], |
@@ -16,35 +16,35 @@ discard block |
||
16 | 16 | $install_language = "english"; |
17 | 17 | |
18 | 18 | $_langFiles= array ( |
19 | - "en" => "english", |
|
20 | - "bg" => "bulgarian", |
|
21 | - "cs" => "czech", |
|
22 | - "da" => "danish", |
|
23 | - "fi" => "finnish-utf8", |
|
24 | - "fr" => "francais-utf8", |
|
25 | - "de" => "german", |
|
26 | - "he" => "hebrew", |
|
27 | - "it" => "italian", |
|
28 | - "ja" => "japanese-utf8", |
|
29 | - "nl" => "nederlands-utf8", |
|
30 | - "no" => "norwegian", |
|
31 | - "fa" => "persian", |
|
32 | - "pl" => "polish-utf8", |
|
33 | - "pt" => "portuguese-br-utf8", |
|
19 | + "en" => "english", |
|
20 | + "bg" => "bulgarian", |
|
21 | + "cs" => "czech", |
|
22 | + "da" => "danish", |
|
23 | + "fi" => "finnish-utf8", |
|
24 | + "fr" => "francais-utf8", |
|
25 | + "de" => "german", |
|
26 | + "he" => "hebrew", |
|
27 | + "it" => "italian", |
|
28 | + "ja" => "japanese-utf8", |
|
29 | + "nl" => "nederlands-utf8", |
|
30 | + "no" => "norwegian", |
|
31 | + "fa" => "persian", |
|
32 | + "pl" => "polish-utf8", |
|
33 | + "pt" => "portuguese-br-utf8", |
|
34 | 34 | // "pt" => "portuguese", |
35 | - "ru" => "russian-UTF8", |
|
36 | - "es" => "spanish-utf8", |
|
37 | - "sv" => "svenska" |
|
35 | + "ru" => "russian-UTF8", |
|
36 | + "es" => "spanish-utf8", |
|
37 | + "sv" => "svenska" |
|
38 | 38 | ); |
39 | 39 | $_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); |
40 | 40 | if (!empty($_langFiles[$_langISO6391])) $install_language = $_langFiles[$_langISO6391]; |
41 | 41 | |
42 | 42 | |
43 | 43 | if (isset($_POST['language']) && !stristr($_POST['language'],"..")) { |
44 | - $install_language = $_POST['language']; |
|
44 | + $install_language = $_POST['language']; |
|
45 | 45 | } else { |
46 | - if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
47 | - $install_language = $_GET['language']; |
|
46 | + if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
47 | + $install_language = $_GET['language']; |
|
48 | 48 | } |
49 | 49 | # load language file |
50 | 50 | require_once("lang/english.inc.php"); // As fallback |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | $manager_language = $install_language; |
54 | 54 | |
55 | 55 | if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) { |
56 | - $manager_language = $_POST['managerlanguage']; |
|
56 | + $manager_language = $_POST['managerlanguage']; |
|
57 | 57 | } else { |
58 | - if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
59 | - $manager_language = $_GET['managerlanguage']; |
|
58 | + if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
59 | + $manager_language = $_GET['managerlanguage']; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | foreach($_lang as $k=>$v) |
63 | 63 | { |
64 | - if(strpos($v,'[+MGR_DIR+]')!==false) |
|
65 | - $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
64 | + if(strpos($v,'[+MGR_DIR+]')!==false) |
|
65 | + $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
66 | 66 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $autoloader = __DIR__.'/vendor/autoload.php'; |
49 | 49 | if (file_exists($autoloader) && is_readable($autoloader)) { |
50 | - include_once($autoloader); |
|
50 | + include_once($autoloader); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | if(is_file($base_path . 'assets/cache/siteManager.php')) |
57 | 57 | include_once($base_path . 'assets/cache/siteManager.php'); |
58 | 58 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
59 | - define('MGR_DIR','manager'); |
|
59 | + define('MGR_DIR','manager'); |
|
60 | 60 | if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
61 | 61 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
62 | 62 | if(!defined('MODX_SITE_HOSTNAMES')) |
63 | - define('MODX_SITE_HOSTNAMES',''); |
|
63 | + define('MODX_SITE_HOSTNAMES',''); |
|
64 | 64 | |
65 | 65 | // get start time |
66 | 66 | $mstart = memory_get_usage(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | define("IN_PARSER_MODE", true); |
86 | 86 | if (!defined('IN_MANAGER_MODE')) { |
87 | - define("IN_MANAGER_MODE", false); |
|
87 | + define("IN_MANAGER_MODE", false); |
|
88 | 88 | } |
89 | 89 | if (!defined('MODX_API_MODE')) { |
90 | 90 | define('MODX_API_MODE', false); |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | |
93 | 93 | // get the required includes |
94 | 94 | if(!isset($database_user) || $database_user=="") { |
95 | - $rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php'); |
|
96 | - // Be sure config.inc.php is there and that it contains some important values |
|
97 | - if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) { |
|
98 | - readfile('install/not_installed.tpl'); |
|
99 | - exit; |
|
100 | - } |
|
95 | + $rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php'); |
|
96 | + // Be sure config.inc.php is there and that it contains some important values |
|
97 | + if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) { |
|
98 | + readfile('install/not_installed.tpl'); |
|
99 | + exit; |
|
100 | + } |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // start session |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | |
106 | 106 | // initiate a new document parser |
107 | 107 | if (isset($coreClass) && class_exists($coreClass)) { |
108 | - $modx = new $coreClass; |
|
108 | + $modx = new $coreClass; |
|
109 | 109 | } |
110 | 110 | if (!isset($modx) || !($modx instanceof \DocumentParser)) { |
111 | - include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
112 | - $modx = new \DocumentParser; |
|
111 | + include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
112 | + $modx = new \DocumentParser; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // set some parser options |
@@ -4,138 +4,138 @@ |
||
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | 6 | class SqlParser { |
7 | - public $host; |
|
8 | - public $dbname; |
|
9 | - public $prefix; |
|
10 | - public $user; |
|
11 | - public $password; |
|
12 | - public $mysqlErrors; |
|
13 | - public $conn; |
|
14 | - public $installFailed; |
|
15 | - public $sitename; |
|
16 | - public $adminname; |
|
17 | - public $adminemail; |
|
18 | - public $adminpass; |
|
19 | - public $managerlanguage; |
|
20 | - public $mode; |
|
21 | - public $fileManagerPath; |
|
22 | - public $imgPath; |
|
23 | - public $imgUrl; |
|
24 | - public $dbMODx; |
|
25 | - public $dbVersion; |
|
7 | + public $host; |
|
8 | + public $dbname; |
|
9 | + public $prefix; |
|
10 | + public $user; |
|
11 | + public $password; |
|
12 | + public $mysqlErrors; |
|
13 | + public $conn; |
|
14 | + public $installFailed; |
|
15 | + public $sitename; |
|
16 | + public $adminname; |
|
17 | + public $adminemail; |
|
18 | + public $adminpass; |
|
19 | + public $managerlanguage; |
|
20 | + public $mode; |
|
21 | + public $fileManagerPath; |
|
22 | + public $imgPath; |
|
23 | + public $imgUrl; |
|
24 | + public $dbMODx; |
|
25 | + public $dbVersion; |
|
26 | 26 | public $connection_charset; |
27 | 27 | public $connection_method; |
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | |
30 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
31 | - $this->host = $host; |
|
32 | - $this->dbname = $db; |
|
33 | - $this->prefix = $prefix; |
|
34 | - $this->user = $user; |
|
35 | - $this->password = $password; |
|
36 | - $this->adminpass = $adminpass; |
|
37 | - $this->adminname = $adminname; |
|
38 | - $this->adminemail = $adminemail; |
|
39 | - $this->connection_charset = $connection_charset; |
|
40 | - $this->connection_method = $connection_method; |
|
41 | - $this->ignoreDuplicateErrors = false; |
|
42 | - $this->managerlanguage = $managerlanguage; |
|
30 | + public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
31 | + $this->host = $host; |
|
32 | + $this->dbname = $db; |
|
33 | + $this->prefix = $prefix; |
|
34 | + $this->user = $user; |
|
35 | + $this->password = $password; |
|
36 | + $this->adminpass = $adminpass; |
|
37 | + $this->adminname = $adminname; |
|
38 | + $this->adminemail = $adminemail; |
|
39 | + $this->connection_charset = $connection_charset; |
|
40 | + $this->connection_method = $connection_method; |
|
41 | + $this->ignoreDuplicateErrors = false; |
|
42 | + $this->managerlanguage = $managerlanguage; |
|
43 | 43 | $this->autoTemplateLogic = $auto_template_logic; |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | - public function connect() { |
|
47 | - $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
48 | - mysqli_select_db($this->conn, $this->dbname); |
|
49 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
46 | + public function connect() { |
|
47 | + $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
48 | + mysqli_select_db($this->conn, $this->dbname); |
|
49 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
50 | 50 | |
51 | - $this->dbVersion = 3.23; // assume version 3.23 |
|
52 | - if(function_exists("mysqli_get_server_info")) { |
|
53 | - $ver = mysqli_get_server_info($this->conn); |
|
54 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
55 | - $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
56 | - } |
|
51 | + $this->dbVersion = 3.23; // assume version 3.23 |
|
52 | + if(function_exists("mysqli_get_server_info")) { |
|
53 | + $ver = mysqli_get_server_info($this->conn); |
|
54 | + $this->dbMODx = version_compare($ver,"4.0.2"); |
|
55 | + $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
56 | + } |
|
57 | 57 | |
58 | 58 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | 61 | public function process($filename) { |
62 | - global $custom_placeholders; |
|
63 | - |
|
64 | - // check to make sure file exists |
|
65 | - if (!file_exists($filename)) { |
|
66 | - $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
67 | - $this->installFailed = true ; |
|
68 | - return false; |
|
69 | - } |
|
70 | - |
|
71 | - $fh = fopen($filename, 'r'); |
|
72 | - $idata = ''; |
|
73 | - |
|
74 | - while (!feof($fh)) { |
|
75 | - $idata .= fread($fh, 1024); |
|
76 | - } |
|
77 | - |
|
78 | - fclose($fh); |
|
79 | - $idata = str_replace("\r", '', $idata); |
|
80 | - |
|
81 | - // check if in upgrade mode |
|
82 | - if ($this->mode=="upd") { |
|
83 | - // remove non-upgradeable parts |
|
84 | - $s = strpos($idata,"non-upgrade-able[["); |
|
85 | - $e = strpos($idata,"]]non-upgrade-able")+17; |
|
86 | - if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata); |
|
87 | - } |
|
88 | - |
|
89 | - // replace {} tags |
|
90 | - $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
91 | - $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
92 | - $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
93 | - $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
94 | - $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
95 | - $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
96 | - $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
97 | - $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
98 | - $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
99 | - /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
100 | - |
|
101 | - // Replace custom placeholders |
|
102 | - foreach($custom_placeholders as $key=>$val) { |
|
103 | - if (strpos($idata, '{'.$key.'}') !== false) { |
|
104 | - $idata = str_replace('{'.$key.'}', $val, $idata); |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - $sql_array = explode("\n\n", $idata); |
|
109 | - |
|
110 | - $num = 0; |
|
111 | - foreach($sql_array as $sql_entry) { |
|
112 | - $sql_do = trim($sql_entry, "\r\n; "); |
|
113 | - |
|
114 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
115 | - |
|
116 | - // strip out comments and \n for mysql 3.x |
|
117 | - if ($this->dbVersion <4.0) { |
|
118 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
119 | - $sql_do = str_replace('\r', "", $sql_do); |
|
120 | - $sql_do = str_replace('\n', "", $sql_do); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - $num = $num + 1; |
|
125 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
126 | - if(mysqli_error($this->conn)) { |
|
127 | - // Ignore duplicate and drop errors - Raymond |
|
128 | - if ($this->ignoreDuplicateErrors){ |
|
129 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
130 | - } |
|
131 | - // End Ignore duplicate |
|
132 | - $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
133 | - $this->installFailed = true; |
|
134 | - } |
|
135 | - } |
|
136 | - } |
|
62 | + global $custom_placeholders; |
|
63 | + |
|
64 | + // check to make sure file exists |
|
65 | + if (!file_exists($filename)) { |
|
66 | + $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
67 | + $this->installFailed = true ; |
|
68 | + return false; |
|
69 | + } |
|
70 | + |
|
71 | + $fh = fopen($filename, 'r'); |
|
72 | + $idata = ''; |
|
73 | + |
|
74 | + while (!feof($fh)) { |
|
75 | + $idata .= fread($fh, 1024); |
|
76 | + } |
|
77 | + |
|
78 | + fclose($fh); |
|
79 | + $idata = str_replace("\r", '', $idata); |
|
80 | + |
|
81 | + // check if in upgrade mode |
|
82 | + if ($this->mode=="upd") { |
|
83 | + // remove non-upgradeable parts |
|
84 | + $s = strpos($idata,"non-upgrade-able[["); |
|
85 | + $e = strpos($idata,"]]non-upgrade-able")+17; |
|
86 | + if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata); |
|
87 | + } |
|
88 | + |
|
89 | + // replace {} tags |
|
90 | + $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
91 | + $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
92 | + $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
93 | + $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
94 | + $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
95 | + $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
96 | + $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
97 | + $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
98 | + $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
99 | + /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
100 | + |
|
101 | + // Replace custom placeholders |
|
102 | + foreach($custom_placeholders as $key=>$val) { |
|
103 | + if (strpos($idata, '{'.$key.'}') !== false) { |
|
104 | + $idata = str_replace('{'.$key.'}', $val, $idata); |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + $sql_array = explode("\n\n", $idata); |
|
109 | + |
|
110 | + $num = 0; |
|
111 | + foreach($sql_array as $sql_entry) { |
|
112 | + $sql_do = trim($sql_entry, "\r\n; "); |
|
113 | + |
|
114 | + if (preg_match('/^\#/', $sql_do)) continue; |
|
115 | + |
|
116 | + // strip out comments and \n for mysql 3.x |
|
117 | + if ($this->dbVersion <4.0) { |
|
118 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
119 | + $sql_do = str_replace('\r', "", $sql_do); |
|
120 | + $sql_do = str_replace('\n', "", $sql_do); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + $num = $num + 1; |
|
125 | + if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
126 | + if(mysqli_error($this->conn)) { |
|
127 | + // Ignore duplicate and drop errors - Raymond |
|
128 | + if ($this->ignoreDuplicateErrors){ |
|
129 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
130 | + } |
|
131 | + // End Ignore duplicate |
|
132 | + $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
133 | + $this->installFailed = true; |
|
134 | + } |
|
135 | + } |
|
136 | + } |
|
137 | 137 | |
138 | 138 | public function close() { |
139 | - mysqli_close($this->conn); |
|
140 | - } |
|
139 | + mysqli_close($this->conn); |
|
140 | + } |
|
141 | 141 | } |