@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $state = 'skipframe'; |
152 | 152 | } |
153 | - elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) |
|
153 | + elseif (in_array($b, array_merge(range(0xC0, 0xC3), range(0xC5, 0xC7), range(0xC9, 0xCB), range(0xCD, 0xCF)))) |
|
154 | 154 | { |
155 | 155 | $state = 'readsize'; |
156 | 156 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $response = null; |
189 | 189 | |
190 | 190 | // do we need more data? |
191 | - if ($this->strpos + $n -1 >= strlen($this->str)) |
|
191 | + if ($this->strpos + $n - 1 >= strlen($this->str)) |
|
192 | 192 | { |
193 | 193 | $end = ($this->strpos + $n); |
194 | 194 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class httpCache { |
|
15 | +class httpCache{ |
|
16 | 16 | const DEFAULT_TYPE = "text/html"; |
17 | 17 | const DEFAULT_EXPIRE = 604800; // in seconds |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param integer $expire |
26 | 26 | * @param array $headers */ |
27 | 27 | |
28 | - static function file($file, $type=null, $expire=null, array $headers=null) { |
|
28 | + static function file($file, $type = null, $expire = null, array $headers = null){ |
|
29 | 29 | $mtime = @filemtime($file); |
30 | 30 | if ($mtime !== false) self::checkMTime($mtime); |
31 | 31 | |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | * @param array $headers |
48 | 48 | * @param bool $checkMTime */ |
49 | 49 | |
50 | - static function content($content, $mtime, $type=null, $expire=null, array $headers=null, $checkMTime=true) { |
|
50 | + static function content($content, $mtime, $type = null, $expire = null, array $headers = null, $checkMTime = true){ |
|
51 | 51 | if ($checkMTime) self::checkMTime($mtime); |
52 | 52 | if ($type === null) $type = self::DEFAULT_TYPE; |
53 | 53 | if ($expire === null) $expire = self::DEFAULT_EXPIRE; |
54 | 54 | $size = strlen($content); |
55 | - $expires = gmdate("D, d M Y H:i:s", time() + $expire) . " GMT"; |
|
55 | + $expires = gmdate("D, d M Y H:i:s", time() + $expire)." GMT"; |
|
56 | 56 | header("Content-Type: $type"); |
57 | 57 | header("Expires: $expires"); |
58 | 58 | header("Cache-Control: max-age=$expire"); |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * the PHP to be configured as Apache module. |
69 | 69 | * @param integer $mtime */ |
70 | 70 | |
71 | - static function checkMTime($mtime, $sendHeaders=null) { |
|
72 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $mtime) . " GMT"); |
|
71 | + static function checkMTime($mtime, $sendHeaders = null){ |
|
72 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mtime)." GMT"); |
|
73 | 73 | |
74 | 74 | $headers = function_exists("getallheaders") |
75 | 75 | ? getallheaders() |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_gd extends image { |
|
15 | +class image_gd extends image{ |
|
16 | 16 | |
17 | 17 | |
18 | 18 | // ABSTRACT PUBLIC METHODS |
19 | 19 | |
20 | - public function resize($width, $height) { |
|
20 | + public function resize($width, $height){ |
|
21 | 21 | if (!$width) $width = 1; |
22 | 22 | if (!$height) $height = 1; |
23 | 23 | return ( |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ); |
30 | 30 | } |
31 | 31 | |
32 | - public function resizeFit($width, $height, $background=false) { |
|
32 | + public function resizeFit($width, $height, $background = false){ |
|
33 | 33 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
34 | 34 | return true; |
35 | 35 | if (!$width || (($height / $width) < ($this->height / $this->width))) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - public function resizeCrop($width, $height, $offset=false) { |
|
70 | + public function resizeCrop($width, $height, $offset = false){ |
|
71 | 71 | |
72 | 72 | if (($this->width / $this->height) > ($width / $height)) { |
73 | 73 | $h = $height; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return $return; |
118 | 118 | } |
119 | 119 | |
120 | - public function rotate($angle, $background="#000000") { |
|
120 | + public function rotate($angle, $background = "#000000"){ |
|
121 | 121 | $angle = -$angle; |
122 | 122 | $img = @imagerotate($this->image, $angle, $this->gdColor($background)); |
123 | 123 | if ($img === false) |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return true; |
129 | 129 | } |
130 | 130 | |
131 | - public function flipHorizontal() { |
|
131 | + public function flipHorizontal(){ |
|
132 | 132 | $img = imagecreatetruecolor($this->width, $this->height); |
133 | 133 | imagealphablending($img, false); |
134 | 134 | imagesavealpha($img, true); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return true; |
140 | 140 | } |
141 | 141 | |
142 | - public function flipVertical() { |
|
142 | + public function flipVertical(){ |
|
143 | 143 | $img = imagecreatetruecolor($this->width, $this->height); |
144 | 144 | imagealphablending($img, false); |
145 | 145 | imagesavealpha($img, true); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return true; |
151 | 151 | } |
152 | 152 | |
153 | - public function watermark($file, $left=false, $top=false) { |
|
153 | + public function watermark($file, $left = false, $top = false){ |
|
154 | 154 | $info = getimagesize($file); |
155 | 155 | list($w, $h, $t) = $info; |
156 | 156 | if (!in_array($t, array(IMAGETYPE_PNG, IMAGETYPE_GIF))) |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return true; |
188 | 188 | } |
189 | 189 | |
190 | - public function output($type='jpeg', array $options=array()) { |
|
190 | + public function output($type = 'jpeg', array $options = array()){ |
|
191 | 191 | $method = "output_$type"; |
192 | 192 | if (!method_exists($this, $method)) |
193 | 193 | return false; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | // ABSTRACT PROTECTED METHODS |
199 | 199 | |
200 | - protected function getBlankImage($width, $height) { |
|
200 | + protected function getBlankImage($width, $height){ |
|
201 | 201 | $img = @imagecreatetruecolor($width, $height); |
202 | 202 | // imagealphablending($img, false); |
203 | 203 | // imagesavealpha($img, true); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | return $img; |
208 | 208 | } |
209 | 209 | |
210 | - protected function getImage($image, &$width, &$height) { |
|
210 | + protected function getImage($image, &$width, &$height){ |
|
211 | 211 | |
212 | 212 | if (is_resource($image) && (get_resource_type($image) == "gd")) { |
213 | 213 | $width = @imagesx($image); |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | (false !== (list($width, $height, $t) = @getimagesize($image))) |
219 | 219 | ) { |
220 | 220 | $image = |
221 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
221 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
222 | 222 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
223 | 223 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
224 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
225 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
224 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
225 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
226 | 226 | )))); |
227 | 227 | |
228 | 228 | return $image; |
@@ -234,22 +234,22 @@ discard block |
||
234 | 234 | |
235 | 235 | // PSEUDO-ABSTRACT STATIC METHODS |
236 | 236 | |
237 | - static function available() { |
|
237 | + static function available(){ |
|
238 | 238 | return function_exists("imagecreatefromjpeg"); |
239 | 239 | } |
240 | 240 | |
241 | - static function checkImage($file) { |
|
241 | + static function checkImage($file){ |
|
242 | 242 | if (!is_string($file) || |
243 | 243 | ((false === (list($width, $height, $t) = @getimagesize($file)))) |
244 | 244 | ) |
245 | 245 | return false; |
246 | 246 | |
247 | 247 | $img = |
248 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
248 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
249 | 249 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($file) : ( |
250 | 250 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($file) : ( |
251 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
252 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
251 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
252 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
253 | 253 | )))); |
254 | 254 | |
255 | 255 | return ($img !== false); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | // OWN METHODS |
260 | 260 | |
261 | - protected function output_png(array $options=array()) { |
|
261 | + protected function output_png(array $options = array()){ |
|
262 | 262 | $file = isset($options['file']) ? $options['file'] : null; |
263 | 263 | $quality = isset($options['quality']) ? $options['quality'] : null; |
264 | 264 | $filters = isset($options['filters']) ? $options['filters'] : null; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return imagepng($this->image, $file, $quality, $filters); |
269 | 269 | } |
270 | 270 | |
271 | - protected function output_jpeg(array $options=array()) { |
|
271 | + protected function output_jpeg(array $options = array()){ |
|
272 | 272 | $file = isset($options['file']) ? $options['file'] : null; |
273 | 273 | $quality = isset($options['quality']) |
274 | 274 | ? $options['quality'] |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | return imagejpeg($this->image, $file, $quality); |
279 | 279 | } |
280 | 280 | |
281 | - protected function output_gif(array $options=array()) { |
|
281 | + protected function output_gif(array $options = array()){ |
|
282 | 282 | $file = isset($options['file']) ? $options['file'] : null; |
283 | 283 | if (isset($options['file']) && !headers_sent()) |
284 | 284 | header("Content-Type: image/gif"); |
285 | 285 | return imagegif($this->image, $file); |
286 | 286 | } |
287 | 287 | |
288 | - protected function gdColor() { |
|
288 | + protected function gdColor(){ |
|
289 | 289 | $args = func_get_args(); |
290 | 290 | |
291 | 291 | $exprRGB = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | return imagecolorallocate($this->image, $r, $g, $b); |
328 | 328 | } |
329 | 329 | |
330 | - protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) { |
|
330 | + protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color){ |
|
331 | 331 | $color = $this->gdColor($color); |
332 | 332 | if ($color === false) return false; |
333 | 333 | return imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color); |
334 | 334 | } |
335 | 335 | |
336 | 336 | protected function imageCopyResampled( |
337 | - $src, $dstX=0, $dstY=0, $srcX=0, $srcY=0, $dstW=null, $dstH=null, $srcW=null, $srcH=null |
|
338 | - ) { |
|
337 | + $src, $dstX = 0, $dstY = 0, $srcX = 0, $srcY = 0, $dstW = null, $dstH = null, $srcW = null, $srcH = null |
|
338 | + ){ |
|
339 | 339 | $imageDetails = $this->buildImage($src); |
340 | 340 | |
341 | 341 | if ($imageDetails === false) |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class text { |
|
15 | +class text{ |
|
16 | 16 | |
17 | 17 | /** Replace repeated white spaces to single space |
18 | 18 | * @param string $string |
19 | 19 | * @return string */ |
20 | 20 | |
21 | - static function clearWhitespaces($string) { |
|
21 | + static function clearWhitespaces($string){ |
|
22 | 22 | return trim(preg_replace('/\s+/s', " ", $string)); |
23 | 23 | } |
24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string $string |
27 | 27 | * @return string */ |
28 | 28 | |
29 | - static function htmlValue($string) { |
|
29 | + static function htmlValue($string){ |
|
30 | 30 | return |
31 | 31 | str_replace('"', """, |
32 | 32 | str_replace("'", ''', |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $string |
40 | 40 | * @return string */ |
41 | 41 | |
42 | - static function jsValue($string) { |
|
42 | + static function jsValue($string){ |
|
43 | 43 | return |
44 | 44 | preg_replace('/\r?\n/', "\\n", |
45 | 45 | str_replace('"', "\\\"", |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $string |
53 | 53 | * @param bool $cdata */ |
54 | 54 | |
55 | - static function xmlData($string, $cdata=false) { |
|
55 | + static function xmlData($string, $cdata = false){ |
|
56 | 56 | $string = str_replace("]]>", "]]]]><![CDATA[>", $string); |
57 | 57 | if (!$cdata) |
58 | 58 | $string = "<![CDATA[$string]]>"; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param string $code |
64 | 64 | * @return string */ |
65 | 65 | |
66 | - static function compressCSS($code) { |
|
66 | + static function compressCSS($code){ |
|
67 | 67 | $code = self::clearWhitespaces($code); |
68 | 68 | $code = preg_replace('/ ?\{ ?/', "{", $code); |
69 | 69 | $code = preg_replace('/ ?\} ?/', "}", $code); |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | * @link http://kcfinder.sunhater.com |
14 | 14 | */ |
15 | 15 | |
16 | -class zipFolder { |
|
16 | +class zipFolder{ |
|
17 | 17 | protected $zip; |
18 | 18 | protected $root; |
19 | 19 | protected $ignored; |
20 | 20 | |
21 | - function __construct($file, $folder, $ignored=null) { |
|
21 | + function __construct($file, $folder, $ignored = null){ |
|
22 | 22 | $this->zip = new ZipArchive(); |
23 | 23 | |
24 | 24 | $this->ignored = is_array($ignored) |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->zip->close(); |
40 | 40 | } |
41 | 41 | |
42 | - function zip($folder, $parent=null) { |
|
42 | + function zip($folder, $parent = null){ |
|
43 | 43 | $full_path = "{$this->root}$parent$folder"; |
44 | 44 | $zip_path = "$parent$folder"; |
45 | 45 | $this->zip->addEmptyDir($zip_path); |
@@ -14,14 +14,14 @@ |
||
14 | 14 | |
15 | 15 | require "core/autoload.php"; // Init MODX |
16 | 16 | |
17 | -function returnNoPermissionsMessage($role) { |
|
17 | +function returnNoPermissionsMessage($role){ |
|
18 | 18 | global $_lang; |
19 | 19 | echo sprintf($_lang['files_management_no_permission'], $role); |
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
23 | -if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
|
24 | -if( $_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) returnNoPermissionsMessage('assets_files'); |
|
23 | +if ($_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
|
24 | +if ($_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) returnNoPermissionsMessage('assets_files'); |
|
25 | 25 | |
26 | 26 | $browser = new browser($modx); |
27 | 27 | $browser->action(); |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | $modx->config['enable_filter'] = 1; |
3 | 3 | |
4 | -$modx->addSnippet('hasPermission','return $modx->hasPermission($key);'); |
|
4 | +$modx->addSnippet('hasPermission', 'return $modx->hasPermission($key);'); |
|
5 | 5 | |
6 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) |
|
6 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) |
|
7 | 7 | $hasAnyPermission = 1; |
8 | 8 | else $hasAnyPermission = 0; |
9 | -$modx->addSnippet('hasAnyPermission','global $hasAnyPermission; return $hasAnyPermission;'); |
|
10 | -$modx->addSnippet('getLoginUserName','return $modx->getLoginUserName();'); |
|
9 | +$modx->addSnippet('hasAnyPermission', 'global $hasAnyPermission; return $hasAnyPermission;'); |
|
10 | +$modx->addSnippet('getLoginUserName', 'return $modx->getLoginUserName();'); |
|
11 | 11 | $code = 'global $_lang;return $_SESSION["nrtotalmessages"] ? sprintf($_lang["welcome_messages"], $_SESSION["nrtotalmessages"], \'<span style="color:red;">\' . $_SESSION["nrnewmessages"] . "</span>") : $_lang["messages_no_messages"];'; |
12 | -$modx->addSnippet('getMessageCount',$code); |
|
12 | +$modx->addSnippet('getMessageCount', $code); |
|
13 | 13 | |
14 | 14 | // Large Icons |
15 | 15 | $_style['icons_backup_large'] = 'fa fa-database fa-fw fa-2x'; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // using proxy, send entire URI |
150 | 150 | $this->_httprequest($URI, $fp, $URI, $this->_httpmethod); |
151 | 151 | } else { |
152 | - $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : ""); |
|
152 | + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
|
153 | 153 | // no proxy, send only the path |
154 | 154 | $this->_httprequest($path, $fp, $URI, $this->_httpmethod); |
155 | 155 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | /* url was redirected, check if we've hit the max depth */ |
161 | 161 | if ($this->maxredirs > $this->_redirectdepth) { |
162 | 162 | // only follow redirect if it's on this site, or offsiteok is true |
163 | - if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
|
163 | + if (preg_match("|^https?://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) { |
|
164 | 164 | /* follow the redirect */ |
165 | 165 | $this->_redirectdepth++; |
166 | 166 | $this->lastredirectaddr = $this->_redirectaddr; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | break; |
189 | 189 | default: |
190 | 190 | // not a valid protocol |
191 | - $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n'; |
|
191 | + $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; |
|
192 | 192 | return false; |
193 | 193 | break; |
194 | 194 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | // using proxy, send entire URI |
240 | 240 | $this->_httprequest($URI, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
241 | 241 | } else { |
242 | - $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : ""); |
|
242 | + $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : ""); |
|
243 | 243 | // no proxy, send only the path |
244 | 244 | $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); |
245 | 245 | } |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | if ($this->_redirectaddr) { |
250 | 250 | /* url was redirected, check if we've hit the max depth */ |
251 | 251 | if ($this->maxredirs > $this->_redirectdepth) { |
252 | - if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) |
|
253 | - $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]); |
|
252 | + if (!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) |
|
253 | + $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"]."://".$URI_PARTS["host"]); |
|
254 | 254 | |
255 | 255 | // only follow redirect if it's on this site, or offsiteok is true |
256 | - if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) { |
|
256 | + if (preg_match("|^https?://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) { |
|
257 | 257 | /* follow the redirect */ |
258 | 258 | $this->_redirectdepth++; |
259 | 259 | $this->lastredirectaddr = $this->_redirectaddr; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | break; |
286 | 286 | default: |
287 | 287 | // not a valid protocol |
288 | - $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n'; |
|
288 | + $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; |
|
289 | 289 | return false; |
290 | 290 | break; |
291 | 291 | } |
@@ -585,9 +585,9 @@ discard block |
||
585 | 585 | $match = preg_replace("|/$|", "", $match); |
586 | 586 | $match_part = parse_url($match); |
587 | 587 | $match_root = |
588 | - $match_part["scheme"] . "://" . $match_part["host"]; |
|
588 | + $match_part["scheme"]."://".$match_part["host"]; |
|
589 | 589 | |
590 | - $search = array("|^http://" . preg_quote($this->host) . "|i", |
|
590 | + $search = array("|^http://".preg_quote($this->host)."|i", |
|
591 | 591 | "|^(\/)|i", |
592 | 592 | "|^(?!http://)(?!mailto:)|i", |
593 | 593 | "|/\./|", |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | ); |
596 | 596 | |
597 | 597 | $replace = array("", |
598 | - $match_root . "/", |
|
599 | - $match . "/", |
|
598 | + $match_root."/", |
|
599 | + $match."/", |
|
600 | 600 | "/", |
601 | 601 | "/" |
602 | 602 | ); |
@@ -625,17 +625,17 @@ discard block |
||
625 | 625 | $URI_PARTS = parse_url($URI); |
626 | 626 | if (empty($url)) |
627 | 627 | $url = "/"; |
628 | - $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n"; |
|
628 | + $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; |
|
629 | 629 | if (!empty($this->host) && !isset($this->rawheaders['Host'])) { |
630 | - $headers .= "Host: " . $this->host; |
|
630 | + $headers .= "Host: ".$this->host; |
|
631 | 631 | if (!empty($this->port) && $this->port != '80') |
632 | - $headers .= ":" . $this->port; |
|
632 | + $headers .= ":".$this->port; |
|
633 | 633 | $headers .= "\r\n"; |
634 | 634 | } |
635 | 635 | if (!empty($this->agent)) |
636 | - $headers .= "User-Agent: " . $this->agent . "\r\n"; |
|
636 | + $headers .= "User-Agent: ".$this->agent."\r\n"; |
|
637 | 637 | if (!empty($this->accept)) |
638 | - $headers .= "Accept: " . $this->accept . "\r\n"; |
|
638 | + $headers .= "Accept: ".$this->accept."\r\n"; |
|
639 | 639 | if ($this->use_gzip) { |
640 | 640 | // make sure PHP was built with --with-zlib |
641 | 641 | // and we can handle gzipp'ed data |
@@ -643,46 +643,46 @@ discard block |
||
643 | 643 | $headers .= "Accept-encoding: gzip\r\n"; |
644 | 644 | } else { |
645 | 645 | trigger_error( |
646 | - "use_gzip is on, but PHP was built without zlib support." . |
|
646 | + "use_gzip is on, but PHP was built without zlib support.". |
|
647 | 647 | " Requesting file(s) without gzip encoding.", |
648 | 648 | E_USER_NOTICE); |
649 | 649 | } |
650 | 650 | } |
651 | 651 | if (!empty($this->referer)) |
652 | - $headers .= "Referer: " . $this->referer . "\r\n"; |
|
652 | + $headers .= "Referer: ".$this->referer."\r\n"; |
|
653 | 653 | if (!empty($this->cookies)) { |
654 | 654 | if (!is_array($this->cookies)) |
655 | - $this->cookies = (array)$this->cookies; |
|
655 | + $this->cookies = (array) $this->cookies; |
|
656 | 656 | |
657 | 657 | reset($this->cookies); |
658 | 658 | if (count($this->cookies) > 0) { |
659 | 659 | $cookie_headers .= 'Cookie: '; |
660 | 660 | foreach ($this->cookies as $cookieKey => $cookieVal) { |
661 | - $cookie_headers .= $cookieKey . "=" . urlencode($cookieVal) . "; "; |
|
661 | + $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; "; |
|
662 | 662 | } |
663 | - $headers .= substr($cookie_headers, 0, -2) . "\r\n"; |
|
663 | + $headers .= substr($cookie_headers, 0, -2)."\r\n"; |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | if (!empty($this->rawheaders)) { |
667 | 667 | if (!is_array($this->rawheaders)) |
668 | - $this->rawheaders = (array)$this->rawheaders; |
|
668 | + $this->rawheaders = (array) $this->rawheaders; |
|
669 | 669 | while (list($headerKey, $headerVal) = each($this->rawheaders)) |
670 | - $headers .= $headerKey . ": " . $headerVal . "\r\n"; |
|
670 | + $headers .= $headerKey.": ".$headerVal."\r\n"; |
|
671 | 671 | } |
672 | 672 | if (!empty($content_type)) { |
673 | 673 | $headers .= "Content-type: $content_type"; |
674 | 674 | if ($content_type == "multipart/form-data") |
675 | - $headers .= "; boundary=" . $this->_mime_boundary; |
|
675 | + $headers .= "; boundary=".$this->_mime_boundary; |
|
676 | 676 | $headers .= "\r\n"; |
677 | 677 | } |
678 | 678 | if (!empty($body)) |
679 | - $headers .= "Content-length: " . strlen($body) . "\r\n"; |
|
679 | + $headers .= "Content-length: ".strlen($body)."\r\n"; |
|
680 | 680 | if (!empty($this->user) || !empty($this->pass)) |
681 | - $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n"; |
|
681 | + $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; |
|
682 | 682 | |
683 | 683 | //add proxy auth headers |
684 | 684 | if (!empty($this->proxy_user)) |
685 | - $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n"; |
|
685 | + $headers .= 'Proxy-Authorization: '.'Basic '.base64_encode($this->proxy_user.':'.$this->proxy_pass)."\r\n"; |
|
686 | 686 | |
687 | 687 | |
688 | 688 | $headers .= "\r\n"; |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | socket_set_timeout($fp, $this->read_timeout); |
693 | 693 | $this->timed_out = false; |
694 | 694 | |
695 | - fwrite($fp, $headers . $body, strlen($headers . $body)); |
|
695 | + fwrite($fp, $headers.$body, strlen($headers.$body)); |
|
696 | 696 | |
697 | 697 | $this->_redirectaddr = false; |
698 | 698 | unset($this->headers); |
@@ -716,10 +716,10 @@ discard block |
||
716 | 716 | // look for :// in the Location header to see if hostname is included |
717 | 717 | if (!preg_match("|\:\/\/|", $matches[2])) { |
718 | 718 | // no host in the path, so prepend |
719 | - $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port; |
|
719 | + $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
|
720 | 720 | // eliminate double slash |
721 | 721 | if (!preg_match("|^/|", $matches[2])) |
722 | - $this->_redirectaddr .= "/" . $matches[2]; |
|
722 | + $this->_redirectaddr .= "/".$matches[2]; |
|
723 | 723 | else |
724 | 724 | $this->_redirectaddr .= $matches[2]; |
725 | 725 | } else |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) { |
772 | 772 | $this->results[] = $results; |
773 | 773 | for ($x = 0; $x < count($match[1]); $x++) |
774 | - $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host); |
|
774 | + $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"]."://".$this->host); |
|
775 | 775 | } // have we already fetched framed content? |
776 | 776 | elseif (is_array($this->results)) |
777 | 777 | $this->results[] = $results; |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | $context_opts['ssl']['capath'] = $this->capath; |
859 | 859 | } |
860 | 860 | |
861 | - $host = 'ssl://' . $host; |
|
861 | + $host = 'ssl://'.$host; |
|
862 | 862 | } |
863 | 863 | |
864 | 864 | $context = stream_context_create($context_opts); |
865 | 865 | |
866 | 866 | if (version_compare(PHP_VERSION, '5.0.0', '>')) { |
867 | - if($this->scheme == 'http') |
|
868 | - $host = "tcp://" . $host; |
|
867 | + if ($this->scheme == 'http') |
|
868 | + $host = "tcp://".$host; |
|
869 | 869 | $fp = stream_socket_client( |
870 | 870 | "$host:$port", |
871 | 871 | $errno, |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | case -5: |
898 | 898 | $this->error = "connection refused or timed out (-5)"; |
899 | 899 | default: |
900 | - $this->error = "connection failed (" . $errno . ")"; |
|
900 | + $this->error = "connection failed (".$errno.")"; |
|
901 | 901 | } |
902 | 902 | return false; |
903 | 903 | } |
@@ -938,26 +938,26 @@ discard block |
||
938 | 938 | while (list($key, $val) = each($formvars)) { |
939 | 939 | if (is_array($val) || is_object($val)) { |
940 | 940 | while (list($cur_key, $cur_val) = each($val)) { |
941 | - $postdata .= urlencode($key) . "[]=" . urlencode($cur_val) . "&"; |
|
941 | + $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&"; |
|
942 | 942 | } |
943 | 943 | } else |
944 | - $postdata .= urlencode($key) . "=" . urlencode($val) . "&"; |
|
944 | + $postdata .= urlencode($key)."=".urlencode($val)."&"; |
|
945 | 945 | } |
946 | 946 | break; |
947 | 947 | |
948 | 948 | case "multipart/form-data": |
949 | - $this->_mime_boundary = "Snoopy" . md5(uniqid(microtime())); |
|
949 | + $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); |
|
950 | 950 | |
951 | 951 | reset($formvars); |
952 | 952 | while (list($key, $val) = each($formvars)) { |
953 | 953 | if (is_array($val) || is_object($val)) { |
954 | 954 | while (list($cur_key, $cur_val) = each($val)) { |
955 | - $postdata .= "--" . $this->_mime_boundary . "\r\n"; |
|
955 | + $postdata .= "--".$this->_mime_boundary."\r\n"; |
|
956 | 956 | $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n"; |
957 | 957 | $postdata .= "$cur_val\r\n"; |
958 | 958 | } |
959 | 959 | } else { |
960 | - $postdata .= "--" . $this->_mime_boundary . "\r\n"; |
|
960 | + $postdata .= "--".$this->_mime_boundary."\r\n"; |
|
961 | 961 | $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n"; |
962 | 962 | $postdata .= "$val\r\n"; |
963 | 963 | } |
@@ -974,12 +974,12 @@ discard block |
||
974 | 974 | fclose($fp); |
975 | 975 | $base_name = basename($file_name); |
976 | 976 | |
977 | - $postdata .= "--" . $this->_mime_boundary . "\r\n"; |
|
977 | + $postdata .= "--".$this->_mime_boundary."\r\n"; |
|
978 | 978 | $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n"; |
979 | 979 | $postdata .= "$file_content\r\n"; |
980 | 980 | } |
981 | 981 | } |
982 | - $postdata .= "--" . $this->_mime_boundary . "--\r\n"; |
|
982 | + $postdata .= "--".$this->_mime_boundary."--\r\n"; |
|
983 | 983 | break; |
984 | 984 | } |
985 | 985 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$c = &$settings; |
|
3 | +$c = &$settings; |
|
4 | 4 | |
5 | 5 | $c['site_name'] = 'My MODX Site'; |
6 | 6 | $c['site_start'] = 1; |