Completed
Push — develop ( 8dee05 )
by Dmytro
20:08
created
manager/media/browser/mcpuk/lib/class_fastImage.php 4 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -13,227 +13,227 @@
 block discarded – undo
13 13
 
14 14
 class fastImage
15 15
 {
16
-	private $strpos = 0;
17
-	private $str;
18
-	private $uri;
19
-	private $type;
20
-	private $handle;
16
+    private $strpos = 0;
17
+    private $str;
18
+    private $uri;
19
+    private $type;
20
+    private $handle;
21 21
 
22
-	public function __construct($uri = null)
23
-	{
24
-		if ($uri) $this->load($uri);
25
-	}
22
+    public function __construct($uri = null)
23
+    {
24
+        if ($uri) $this->load($uri);
25
+    }
26 26
 
27 27
 
28
-	public function load($uri)
29
-	{
30
-		if ($this->handle) $this->close();
31
-
32
-		$this->uri = $uri;
33
-		$this->handle = fopen($uri, 'r');
34
-	}
35
-
36
-
37
-	public function close()
38
-	{
39
-		if (is_resource($this->handle)) fclose($this->handle);
40
-	}
28
+    public function load($uri)
29
+    {
30
+        if ($this->handle) $this->close();
31
+
32
+        $this->uri = $uri;
33
+        $this->handle = fopen($uri, 'r');
34
+    }
35
+
36
+
37
+    public function close()
38
+    {
39
+        if (is_resource($this->handle)) fclose($this->handle);
40
+    }
41 41
 
42 42
 
43
-	public function getSize()
44
-	{
45
-		$this->strpos = 0;
46
-		if ($this->getType())
47
-		{
48
-			return array_values($this->parseSize());
49
-		}
50
-
51
-		return false;
52
-	}
53
-
54
-
55
-	public function getType()
56
-	{
57
-		$this->strpos = 0;
58
-
59
-		if (!$this->type)
60
-		{
61
-			switch ($this->getChars(2))
62
-			{
63
-				case "BM":
64
-					return $this->type = 'bmp';
65
-				case "GI":
66
-					return $this->type = 'gif';
67
-				case chr(0xFF).chr(0xd8):
68
-					return $this->type = 'jpeg';
69
-				case chr(0x89).'P':
70
-					return $this->type = 'png';
71
-				default:
72
-					return false;
73
-			}
74
-		}
75
-
76
-		return $this->type;
77
-	}
78
-
79
-
80
-	private function parseSize()
81
-	{
82
-		$this->strpos = 0;
83
-
84
-		switch ($this->type)
85
-		{
86
-			case 'png':
87
-				return $this->parseSizeForPNG();
88
-			case 'gif':
89
-				return $this->parseSizeForGIF();
90
-			case 'bmp':
91
-				return $this->parseSizeForBMP();
92
-			case 'jpeg':
93
-				return $this->parseSizeForJPEG();
94
-		}
95
-
96
-		return null;
97
-	}
98
-
99
-
100
-	private function parseSizeForPNG()
101
-	{
102
-		$chars = $this->getChars(25);
103
-
104
-		return unpack("N*", substr($chars, 16, 8));
105
-	}
106
-
107
-
108
-	private function parseSizeForGIF()
109
-	{
110
-		$chars = $this->getChars(11);
111
-
112
-		return unpack("S*", substr($chars, 6, 4));
113
-	}
114
-
115
-
116
-	private function parseSizeForBMP()
117
-	{
118
-		$chars = $this->getChars(29);
119
-	 	$chars = substr($chars, 14, 14);
120
-		$type = unpack('C', $chars);
121
-
122
-		return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8));
123
-	}
124
-
125
-
126
-	private function parseSizeForJPEG()
127
-	{
128
-		$state = null;
129
-
130
-		while (true)
131
-		{
132
-			switch ($state)
133
-			{
134
-				default:
135
-					$this->getChars(2);
136
-					$state = 'started';
137
-					break;
138
-
139
-				case 'started':
140
-					$b = $this->getByte();
141
-					if ($b === false) return false;
142
-
143
-					$state = $b == 0xFF ? 'sof' : 'started';
144
-					break;
145
-
146
-				case 'sof':
147
-					$b = $this->getByte();
148
-					if (in_array($b, range(0xe0, 0xef)))
149
-					{
150
-						$state = 'skipframe';
151
-					}
152
-					elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF))))
153
-					{
154
-						$state = 'readsize';
155
-					}
156
-					elseif ($b == 0xFF)
157
-					{
158
-						$state = 'sof';
159
-					}
160
-					else
161
-					{
162
-						$state = 'skipframe';
163
-					}
164
-					break;
165
-
166
-				case 'skipframe':
167
-					$skip = $this->readInt($this->getChars(2)) - 2;
168
-					$state = 'doskip';
169
-					break;
170
-
171
-				case 'doskip':
172
-					$this->getChars($skip);
173
-					$state = 'started';
174
-					break;
175
-
176
-				case 'readsize':
177
-					$c = $this->getChars(7);
178
-
179
-					return array($this->readInt(substr($c, 5, 2)), $this->readInt(substr($c, 3, 2)));
180
-			}
181
-		}
182
-	}
183
-
184
-
185
-	private function getChars($n)
186
-	{
187
-		$response = null;
188
-
189
-		// do we need more data?
190
-		if ($this->strpos + $n -1 >= strlen($this->str))
191
-		{
192
-			$end = ($this->strpos + $n);
193
-
194
-			while (strlen($this->str) < $end && $response !== false)
195
-			{
196
-				// read more from the file handle
197
-				$need = $end - ftell($this->handle);
198
-
199
-				if ($response = fread($this->handle, $need))
200
-				{
201
-					$this->str .= $response;
202
-				}
203
-				else
204
-				{
205
-					return false;
206
-				}
207
-			}
208
-		}
209
-
210
-		$result = substr($this->str, $this->strpos, $n);
211
-		$this->strpos += $n;
212
-
213
-		// we are dealing with bytes here, so force the encoding
214
-		return mb_convert_encoding($result, "8BIT");
215
-	}
216
-
217
-
218
-	private function getByte()
219
-	{
220
-		$c = $this->getChars(1);
221
-		$b = unpack("C", $c);
222
-
223
-		return reset($b);
224
-	}
225
-
226
-
227
-	private function readInt($str)
228
-	{
229
-		$size = unpack("C*", $str);
230
-
231
-	    	return ($size[1] << 8) + $size[2];
232
-	}
233
-
234
-
235
-	public function __destruct()
236
-	{
237
-		$this->close();
238
-	}
43
+    public function getSize()
44
+    {
45
+        $this->strpos = 0;
46
+        if ($this->getType())
47
+        {
48
+            return array_values($this->parseSize());
49
+        }
50
+
51
+        return false;
52
+    }
53
+
54
+
55
+    public function getType()
56
+    {
57
+        $this->strpos = 0;
58
+
59
+        if (!$this->type)
60
+        {
61
+            switch ($this->getChars(2))
62
+            {
63
+                case "BM":
64
+                    return $this->type = 'bmp';
65
+                case "GI":
66
+                    return $this->type = 'gif';
67
+                case chr(0xFF).chr(0xd8):
68
+                    return $this->type = 'jpeg';
69
+                case chr(0x89).'P':
70
+                    return $this->type = 'png';
71
+                default:
72
+                    return false;
73
+            }
74
+        }
75
+
76
+        return $this->type;
77
+    }
78
+
79
+
80
+    private function parseSize()
81
+    {
82
+        $this->strpos = 0;
83
+
84
+        switch ($this->type)
85
+        {
86
+            case 'png':
87
+                return $this->parseSizeForPNG();
88
+            case 'gif':
89
+                return $this->parseSizeForGIF();
90
+            case 'bmp':
91
+                return $this->parseSizeForBMP();
92
+            case 'jpeg':
93
+                return $this->parseSizeForJPEG();
94
+        }
95
+
96
+        return null;
97
+    }
98
+
99
+
100
+    private function parseSizeForPNG()
101
+    {
102
+        $chars = $this->getChars(25);
103
+
104
+        return unpack("N*", substr($chars, 16, 8));
105
+    }
106
+
107
+
108
+    private function parseSizeForGIF()
109
+    {
110
+        $chars = $this->getChars(11);
111
+
112
+        return unpack("S*", substr($chars, 6, 4));
113
+    }
114
+
115
+
116
+    private function parseSizeForBMP()
117
+    {
118
+        $chars = $this->getChars(29);
119
+            $chars = substr($chars, 14, 14);
120
+        $type = unpack('C', $chars);
121
+
122
+        return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8));
123
+    }
124
+
125
+
126
+    private function parseSizeForJPEG()
127
+    {
128
+        $state = null;
129
+
130
+        while (true)
131
+        {
132
+            switch ($state)
133
+            {
134
+                default:
135
+                    $this->getChars(2);
136
+                    $state = 'started';
137
+                    break;
138
+
139
+                case 'started':
140
+                    $b = $this->getByte();
141
+                    if ($b === false) return false;
142
+
143
+                    $state = $b == 0xFF ? 'sof' : 'started';
144
+                    break;
145
+
146
+                case 'sof':
147
+                    $b = $this->getByte();
148
+                    if (in_array($b, range(0xe0, 0xef)))
149
+                    {
150
+                        $state = 'skipframe';
151
+                    }
152
+                    elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF))))
153
+                    {
154
+                        $state = 'readsize';
155
+                    }
156
+                    elseif ($b == 0xFF)
157
+                    {
158
+                        $state = 'sof';
159
+                    }
160
+                    else
161
+                    {
162
+                        $state = 'skipframe';
163
+                    }
164
+                    break;
165
+
166
+                case 'skipframe':
167
+                    $skip = $this->readInt($this->getChars(2)) - 2;
168
+                    $state = 'doskip';
169
+                    break;
170
+
171
+                case 'doskip':
172
+                    $this->getChars($skip);
173
+                    $state = 'started';
174
+                    break;
175
+
176
+                case 'readsize':
177
+                    $c = $this->getChars(7);
178
+
179
+                    return array($this->readInt(substr($c, 5, 2)), $this->readInt(substr($c, 3, 2)));
180
+            }
181
+        }
182
+    }
183
+
184
+
185
+    private function getChars($n)
186
+    {
187
+        $response = null;
188
+
189
+        // do we need more data?
190
+        if ($this->strpos + $n -1 >= strlen($this->str))
191
+        {
192
+            $end = ($this->strpos + $n);
193
+
194
+            while (strlen($this->str) < $end && $response !== false)
195
+            {
196
+                // read more from the file handle
197
+                $need = $end - ftell($this->handle);
198
+
199
+                if ($response = fread($this->handle, $need))
200
+                {
201
+                    $this->str .= $response;
202
+                }
203
+                else
204
+                {
205
+                    return false;
206
+                }
207
+            }
208
+        }
209
+
210
+        $result = substr($this->str, $this->strpos, $n);
211
+        $this->strpos += $n;
212
+
213
+        // we are dealing with bytes here, so force the encoding
214
+        return mb_convert_encoding($result, "8BIT");
215
+    }
216
+
217
+
218
+    private function getByte()
219
+    {
220
+        $c = $this->getChars(1);
221
+        $b = unpack("C", $c);
222
+
223
+        return reset($b);
224
+    }
225
+
226
+
227
+    private function readInt($str)
228
+    {
229
+        $size = unpack("C*", $str);
230
+
231
+            return ($size[1] << 8) + $size[2];
232
+    }
233
+
234
+
235
+    public function __destruct()
236
+    {
237
+        $this->close();
238
+    }
239 239
 }
Please login to merge, or discard this patch.
Braces   +26 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,13 +21,17 @@  discard block
 block discarded – undo
21 21
 
22 22
 	public function __construct($uri = null)
23 23
 	{
24
-		if ($uri) $this->load($uri);
24
+		if ($uri) {
25
+		    $this->load($uri);
26
+		}
25 27
 	}
26 28
 
27 29
 
28 30
 	public function load($uri)
29 31
 	{
30
-		if ($this->handle) $this->close();
32
+		if ($this->handle) {
33
+		    $this->close();
34
+		}
31 35
 
32 36
 		$this->uri = $uri;
33 37
 		$this->handle = fopen($uri, 'r');
@@ -36,15 +40,16 @@  discard block
 block discarded – undo
36 40
 
37 41
 	public function close()
38 42
 	{
39
-		if (is_resource($this->handle)) fclose($this->handle);
43
+		if (is_resource($this->handle)) {
44
+		    fclose($this->handle);
45
+		}
40 46
 	}
41 47
 
42 48
 
43 49
 	public function getSize()
44 50
 	{
45 51
 		$this->strpos = 0;
46
-		if ($this->getType())
47
-		{
52
+		if ($this->getType()) {
48 53
 			return array_values($this->parseSize());
49 54
 		}
50 55
 
@@ -56,10 +61,8 @@  discard block
 block discarded – undo
56 61
 	{
57 62
 		$this->strpos = 0;
58 63
 
59
-		if (!$this->type)
60
-		{
61
-			switch ($this->getChars(2))
62
-			{
64
+		if (!$this->type) {
65
+			switch ($this->getChars(2)) {
63 66
 				case "BM":
64 67
 					return $this->type = 'bmp';
65 68
 				case "GI":
@@ -81,8 +84,7 @@  discard block
 block discarded – undo
81 84
 	{
82 85
 		$this->strpos = 0;
83 86
 
84
-		switch ($this->type)
85
-		{
87
+		switch ($this->type) {
86 88
 			case 'png':
87 89
 				return $this->parseSizeForPNG();
88 90
 			case 'gif':
@@ -127,10 +129,8 @@  discard block
 block discarded – undo
127 129
 	{
128 130
 		$state = null;
129 131
 
130
-		while (true)
131
-		{
132
-			switch ($state)
133
-			{
132
+		while (true) {
133
+			switch ($state) {
134 134
 				default:
135 135
 					$this->getChars(2);
136 136
 					$state = 'started';
@@ -138,27 +138,22 @@  discard block
 block discarded – undo
138 138
 
139 139
 				case 'started':
140 140
 					$b = $this->getByte();
141
-					if ($b === false) return false;
141
+					if ($b === false) {
142
+					    return false;
143
+					}
142 144
 
143 145
 					$state = $b == 0xFF ? 'sof' : 'started';
144 146
 					break;
145 147
 
146 148
 				case 'sof':
147 149
 					$b = $this->getByte();
148
-					if (in_array($b, range(0xe0, 0xef)))
149
-					{
150
+					if (in_array($b, range(0xe0, 0xef))) {
150 151
 						$state = 'skipframe';
151
-					}
152
-					elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF))))
153
-					{
152
+					} elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) {
154 153
 						$state = 'readsize';
155
-					}
156
-					elseif ($b == 0xFF)
157
-					{
154
+					} elseif ($b == 0xFF) {
158 155
 						$state = 'sof';
159
-					}
160
-					else
161
-					{
156
+					} else {
162 157
 						$state = 'skipframe';
163 158
 					}
164 159
 					break;
@@ -187,21 +182,16 @@  discard block
 block discarded – undo
187 182
 		$response = null;
188 183
 
189 184
 		// do we need more data?
190
-		if ($this->strpos + $n -1 >= strlen($this->str))
191
-		{
185
+		if ($this->strpos + $n -1 >= strlen($this->str)) {
192 186
 			$end = ($this->strpos + $n);
193 187
 
194
-			while (strlen($this->str) < $end && $response !== false)
195
-			{
188
+			while (strlen($this->str) < $end && $response !== false) {
196 189
 				// read more from the file handle
197 190
 				$need = $end - ftell($this->handle);
198 191
 
199
-				if ($response = fread($this->handle, $need))
200
-				{
192
+				if ($response = fread($this->handle, $need)) {
201 193
 					$this->str .= $response;
202
-				}
203
-				else
204
-				{
194
+				} else {
205 195
 					return false;
206 196
 				}
207 197
 			}
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -182,6 +182,9 @@
 block discarded – undo
182 182
 	}
183 183
 
184 184
 
185
+	/**
186
+	 * @param integer $n
187
+	 */
185 188
 	private function getChars($n)
186 189
 	{
187 190
 		$response = null;
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/helper_httpCache.php 3 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc HTTP cache helper class
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 HTTP cache helper class
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
 class httpCache {
16 16
     const DEFAULT_TYPE = "text/html";
17 17
     const DEFAULT_EXPIRE = 604800; // in seconds
18 18
 
19
-  /** Cache a file. The $type parameter might define the MIME type of the file
20
-    * or path to magic file to autodetect the MIME type. If you skip $type
21
-    * parameter the method will try with the default magic file. Autodetection
22
-    * of MIME type requires Fileinfo PHP extension used in file::getMimeType()
23
-    * @param string $file
24
-    * @param string $type
25
-    * @param integer $expire
26
-    * @param array $headers */
19
+    /** Cache a file. The $type parameter might define the MIME type of the file
20
+     * or path to magic file to autodetect the MIME type. If you skip $type
21
+     * parameter the method will try with the default magic file. Autodetection
22
+     * of MIME type requires Fileinfo PHP extension used in file::getMimeType()
23
+     * @param string $file
24
+     * @param string $type
25
+     * @param integer $expire
26
+     * @param array $headers */
27 27
 
28 28
     static function file($file, $type=null, $expire=null, array $headers=null) {
29 29
         $mtime = @filemtime($file);
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
         self::content(@file_get_contents($file), $mtime, $type, $expire, $headers, false);
40 40
     }
41 41
 
42
-  /** Cache the given $content with $mtime modification time.
43
-    * @param binary $content
44
-    * @param integer $mtime
45
-    * @param string $type
46
-    * @param integer $expire
47
-    * @param array $headers
48
-    * @param bool $checkMTime */
42
+    /** Cache the given $content with $mtime modification time.
43
+     * @param binary $content
44
+     * @param integer $mtime
45
+     * @param string $type
46
+     * @param integer $expire
47
+     * @param array $headers
48
+     * @param bool $checkMTime */
49 49
 
50 50
     static function content($content, $mtime, $type=null, $expire=null, array $headers=null, $checkMTime=true) {
51 51
         if ($checkMTime) self::checkMTime($mtime);
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
         echo $content;
63 63
     }
64 64
 
65
-  /** Check if given modification time is newer than client-side one. If not,
66
-    * the method will tell the client to get the content from its own cache.
67
-    * Afterwards the script process will be terminated. This feature requires
68
-    * the PHP to be configured as Apache module.
69
-    * @param integer $mtime */
65
+    /** Check if given modification time is newer than client-side one. If not,
66
+     * the method will tell the client to get the content from its own cache.
67
+     * Afterwards the script process will be terminated. This feature requires
68
+     * the PHP to be configured as Apache module.
69
+     * @param integer $mtime */
70 70
 
71 71
     static function checkMTime($mtime, $sendHeaders=null) {
72 72
         header("Last-Modified: " . gmdate("D, d M Y H:i:s", $mtime) . " GMT");
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.
Braces   +31 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class httpCache {
15
+class httpCache
16
+{
16 17
     const DEFAULT_TYPE = "text/html";
17 18
     const DEFAULT_EXPIRE = 604800; // in seconds
18 19
 
@@ -25,15 +26,20 @@  discard block
 block discarded – undo
25 26
     * @param integer $expire
26 27
     * @param array $headers */
27 28
 
28
-    static function file($file, $type=null, $expire=null, array $headers=null) {
29
+    static function file($file, $type=null, $expire=null, array $headers=null)
30
+    {
29 31
         $mtime = @filemtime($file);
30
-        if ($mtime !== false) self::checkMTime($mtime);
32
+        if ($mtime !== false) {
33
+            self::checkMTime($mtime);
34
+        }
31 35
 
32 36
         if ($type === null) {
33 37
             $magic = ((substr($type, 0, 1) == "/") || preg_match('/^[a-z]\:/i', $type))
34 38
                 ? $type : null;
35 39
             $type = file::getMimeType($file, $magic);
36
-            if (!$type) $type = null;
40
+            if (!$type) {
41
+                $type = null;
42
+            }
37 43
         }
38 44
 
39 45
         self::content(@file_get_contents($file), $mtime, $type, $expire, $headers, false);
@@ -47,10 +53,17 @@  discard block
 block discarded – undo
47 53
     * @param array $headers
48 54
     * @param bool $checkMTime */
49 55
 
50
-    static function content($content, $mtime, $type=null, $expire=null, array $headers=null, $checkMTime=true) {
51
-        if ($checkMTime) self::checkMTime($mtime);
52
-        if ($type === null) $type = self::DEFAULT_TYPE;
53
-        if ($expire === null) $expire = self::DEFAULT_EXPIRE;
56
+    static function content($content, $mtime, $type=null, $expire=null, array $headers=null, $checkMTime=true)
57
+    {
58
+        if ($checkMTime) {
59
+            self::checkMTime($mtime);
60
+        }
61
+        if ($type === null) {
62
+            $type = self::DEFAULT_TYPE;
63
+        }
64
+        if ($expire === null) {
65
+            $expire = self::DEFAULT_EXPIRE;
66
+        }
54 67
         $size = strlen($content);
55 68
         $expires = gmdate("D, d M Y H:i:s", time() + $expire) . " GMT";
56 69
         header("Content-Type: $type");
@@ -58,7 +71,9 @@  discard block
 block discarded – undo
58 71
         header("Cache-Control: max-age=$expire");
59 72
         header("Pragma: !invalid");
60 73
         header("Content-Length: $size");
61
-        if ($headers !== null) foreach ($headers as $header) header($header);
74
+        if ($headers !== null) {
75
+            foreach ($headers as $header) header($header);
76
+        }
62 77
         echo $content;
63 78
     }
64 79
 
@@ -68,7 +83,8 @@  discard block
 block discarded – undo
68 83
     * the PHP to be configured as Apache module.
69 84
     * @param integer $mtime */
70 85
 
71
-    static function checkMTime($mtime, $sendHeaders=null) {
86
+    static function checkMTime($mtime, $sendHeaders=null)
87
+    {
72 88
         header("Last-Modified: " . gmdate("D, d M Y H:i:s", $mtime) . " GMT");
73 89
 
74 90
         $headers = function_exists("getallheaders")
@@ -82,11 +98,12 @@  discard block
 block discarded – undo
82 98
             $client_mtime = @strtotime($client_mtime[0]);
83 99
             if ($client_mtime >= $mtime) {
84 100
                 header('HTTP/1.1 304 Not Modified');
85
-                if (is_array($sendHeaders) && count($sendHeaders))
86
-                    foreach ($sendHeaders as $header)
101
+                if (is_array($sendHeaders) && count($sendHeaders)) {
102
+                                    foreach ($sendHeaders as $header)
87 103
                         header($header);
88
-                elseif ($sendHeaders !== null)
89
-                    header($sendHeaders);
104
+                } elseif ($sendHeaders !== null) {
105
+                                    header($sendHeaders);
106
+                }
90 107
 
91 108
 
92 109
                 die;
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/helper_text.php 3 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Text processing helper class
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 Text processing helper class
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
 class text {
16 16
 
17
-  /** Replace repeated white spaces to single space
18
-    * @param string $string
19
-    * @return string */
17
+    /** Replace repeated white spaces to single space
18
+     * @param string $string
19
+     * @return string */
20 20
 
21 21
     static function clearWhitespaces($string) {
22 22
         return trim(preg_replace('/\s+/s', " ", $string));
23 23
     }
24 24
 
25
-  /** Normalize the string for HTML attribute value
26
-    * @param string $string
27
-    * @return string */
25
+    /** Normalize the string for HTML attribute value
26
+     * @param string $string
27
+     * @return string */
28 28
 
29 29
     static function htmlValue($string) {
30 30
         return
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
         $string))));
36 36
     }
37 37
 
38
-  /** Normalize the string for JavaScript string value
39
-    * @param string $string
40
-    * @return string */
38
+    /** Normalize the string for JavaScript string value
39
+     * @param string $string
40
+     * @return string */
41 41
 
42 42
     static function jsValue($string) {
43 43
         return
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
         $string))));
49 49
     }
50 50
 
51
-  /** Normalize the string for XML tag content data
52
-    * @param string $string
53
-    * @param bool $cdata */
51
+    /** Normalize the string for XML tag content data
52
+     * @param string $string
53
+     * @param bool $cdata */
54 54
 
55 55
     static function xmlData($string, $cdata=false) {
56 56
         $string = str_replace("]]>", "]]]]><![CDATA[>", $string);
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
         return $string;
60 60
     }
61 61
 
62
-  /** Returns compressed content of given CSS code
63
-    * @param string $code
64
-    * @return string */
62
+    /** Returns compressed content of given CSS code
63
+     * @param string $code
64
+     * @return string */
65 65
 
66 66
     static function compressCSS($code) {
67 67
         $code = self::clearWhitespaces($code);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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('"', "&quot;",
32 32
             str_replace("'", '&#39;',
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,13 +12,15 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class text {
15
+class text
16
+{
16 17
 
17 18
   /** Replace repeated white spaces to single space
18 19
     * @param string $string
19 20
     * @return string */
20 21
 
21
-    static function clearWhitespaces($string) {
22
+    static function clearWhitespaces($string)
23
+    {
22 24
         return trim(preg_replace('/\s+/s', " ", $string));
23 25
     }
24 26
 
@@ -26,7 +28,8 @@  discard block
 block discarded – undo
26 28
     * @param string $string
27 29
     * @return string */
28 30
 
29
-    static function htmlValue($string) {
31
+    static function htmlValue($string)
32
+    {
30 33
         return
31 34
             str_replace('"', "&quot;",
32 35
             str_replace("'", '&#39;',
@@ -39,7 +42,8 @@  discard block
 block discarded – undo
39 42
     * @param string $string
40 43
     * @return string */
41 44
 
42
-    static function jsValue($string) {
45
+    static function jsValue($string)
46
+    {
43 47
         return
44 48
             preg_replace('/\r?\n/', "\\n",
45 49
             str_replace('"', "\\\"",
@@ -52,10 +56,12 @@  discard block
 block discarded – undo
52 56
     * @param string $string
53 57
     * @param bool $cdata */
54 58
 
55
-    static function xmlData($string, $cdata=false) {
59
+    static function xmlData($string, $cdata=false)
60
+    {
56 61
         $string = str_replace("]]>", "]]]]><![CDATA[>", $string);
57
-        if (!$cdata)
58
-            $string = "<![CDATA[$string]]>";
62
+        if (!$cdata) {
63
+                    $string = "<![CDATA[$string]]>";
64
+        }
59 65
         return $string;
60 66
     }
61 67
 
@@ -63,7 +69,8 @@  discard block
 block discarded – undo
63 69
     * @param string $code
64 70
     * @return string */
65 71
 
66
-    static function compressCSS($code) {
72
+    static function compressCSS($code)
73
+    {
67 74
         $code = self::clearWhitespaces($code);
68 75
         $code = preg_replace('/ ?\{ ?/', "{", $code);
69 76
         $code = preg_replace('/ ?\} ?/', "}", $code);
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image_gmagick.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc GraphicsMagick image driver class
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 GraphicsMagick image driver class
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
 class image_gmagick extends image {
16 16
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class image_gmagick extends image {
15
+class image_gmagick extends image{
16 16
 
17 17
     static $MIMES = array(
18 18
         //'tif' => "image/tiff"
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     // ABSTRACT PUBLIC METHODS
23 23
 
24
-    public function resize($width, $height) {//
24
+    public function resize($width, $height){//
25 25
         if (!$width) $width = 1;
26 26
         if (!$height) $height = 1;
27 27
         try {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         return true;
35 35
     }
36 36
 
37
-    public function resizeFit($width, $height, $background=false) {//
37
+    public function resizeFit($width, $height, $background = false){//
38 38
         if (!$width) $width = 1;
39 39
         if (!$height) $height = 1;
40 40
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         }
70 70
     }
71 71
 
72
-    public function resizeCrop($width, $height, $offset=false) {
72
+    public function resizeCrop($width, $height, $offset = false){
73 73
         if (!$width) $width = 1;
74 74
         if (!$height) $height = 1;
75 75
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         return true;
120 120
     }
121 121
 
122
-    public function rotate($angle, $background="#000000") {
122
+    public function rotate($angle, $background = "#000000"){
123 123
         try {
124 124
             $this->image->rotateImage($background, $angle);
125 125
             $w = $this->image->getImageWidth();
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         return true;
133 133
     }
134 134
 
135
-    public function flipHorizontal() {
135
+    public function flipHorizontal(){
136 136
         try {
137 137
             $this->image->flopImage();
138 138
         } catch (Exception $e) {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         return true;
142 142
     }
143 143
 
144
-    public function flipVertical() {
144
+    public function flipVertical(){
145 145
         try {
146 146
             $this->image->flipImage();
147 147
         } catch (Exception $e) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
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
         try {
155 155
             $wm = new Gmagick($file);
156 156
             $w = $wm->getImageWidth();
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
     // ABSTRACT PROTECTED METHODS
187 187
 
188
-    protected function getBlankImage($width, $height) {
188
+    protected function getBlankImage($width, $height){
189 189
         try {
190 190
             $img = new Gmagick();
191 191
             $img->newImage($width, $height, "none");
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         return $img;
196 196
     }
197 197
 
198
-    protected function getImage($image, &$width, &$height) {
198
+    protected function getImage($image, &$width, &$height){
199 199
 
200 200
         if (is_object($image) && ($image instanceof image_gmagick)) {
201 201
             $width = $image->width;
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 
233 233
     // PSEUDO-ABSTRACT STATIC METHODS
234 234
 
235
-    static function available() {
235
+    static function available(){
236 236
         return class_exists("Gmagick");
237 237
     }
238 238
 
239
-    static function checkImage($file) {
239
+    static function checkImage($file){
240 240
         try {
241 241
             new Gmagick($file);
242 242
         } catch (Exception $e) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
     // INHERIT METHODS
250 250
 
251
-    public function output($type="jpeg", array $options=array()) {
251
+    public function output($type = "jpeg", array $options = array()){
252 252
         $type = strtolower($type);
253 253
         try {
254 254
             $this->image->setImageFormat($type);
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             echo $this->image;
268 268
 
269 269
         } else {
270
-            $file = $options['file'] . ".$type";
270
+            $file = $options['file'].".$type";
271 271
             try {
272 272
                 $this->image->writeImage($file);
273 273
             } catch (Exception $e) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 
288 288
     // OWN METHODS
289 289
 
290
-    protected function optimize_jpeg(array $options=array()) {
290
+    protected function optimize_jpeg(array $options = array()){
291 291
         $quality = isset($options['quality']) ? $options['quality'] : self::DEFAULT_JPEG_QUALITY;
292 292
         try {
293 293
             $this->image->setCompressionQuality($quality);
Please login to merge, or discard this patch.
Braces   +81 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class image_gmagick extends image {
15
+class image_gmagick extends image
16
+{
16 17
 
17 18
     static $MIMES = array(
18 19
         //'tif' => "image/tiff"
@@ -21,9 +22,15 @@  discard block
 block discarded – undo
21 22
 
22 23
     // ABSTRACT PUBLIC METHODS
23 24
 
24
-    public function resize($width, $height) {//
25
-        if (!$width) $width = 1;
26
-        if (!$height) $height = 1;
25
+    public function resize($width, $height)
26
+    {
27
+//
28
+        if (!$width) {
29
+            $width = 1;
30
+        }
31
+        if (!$height) {
32
+            $height = 1;
33
+        }
27 34
         try {
28 35
             $this->image->scaleImage($width, $height);
29 36
         } catch (Exception $e) {
@@ -34,9 +41,15 @@  discard block
 block discarded – undo
34 41
         return true;
35 42
     }
36 43
 
37
-    public function resizeFit($width, $height, $background=false) {//
38
-        if (!$width) $width = 1;
39
-        if (!$height) $height = 1;
44
+    public function resizeFit($width, $height, $background=false)
45
+    {
46
+//
47
+        if (!$width) {
48
+            $width = 1;
49
+        }
50
+        if (!$height) {
51
+            $height = 1;
52
+        }
40 53
 
41 54
         try {
42 55
             $this->image->scaleImage($width, $height, true);
@@ -69,43 +82,58 @@  discard block
 block discarded – undo
69 82
         }
70 83
     }
71 84
 
72
-    public function resizeCrop($width, $height, $offset=false) {
73
-        if (!$width) $width = 1;
74
-        if (!$height) $height = 1;
85
+    public function resizeCrop($width, $height, $offset=false)
86
+    {
87
+        if (!$width) {
88
+            $width = 1;
89
+        }
90
+        if (!$height) {
91
+            $height = 1;
92
+        }
75 93
 
76 94
         if (($this->width / $this->height) > ($width / $height)) {
77 95
             $h = $height;
78 96
             $w = ($this->width * $h) / $this->height;
79 97
             $y = 0;
80 98
             if ($offset !== false) {
81
-                if ($offset > 0)
82
-                    $offset = -$offset;
83
-                if (($w + $offset) <= $width)
84
-                    $offset = $width - $w;
99
+                if ($offset > 0) {
100
+                                    $offset = -$offset;
101
+                }
102
+                if (($w + $offset) <= $width) {
103
+                                    $offset = $width - $w;
104
+                }
85 105
                 $x = $offset;
86
-            } else
87
-                $x = ($width - $w) / 2;
106
+            } else {
107
+                            $x = ($width - $w) / 2;
108
+            }
88 109
 
89 110
         } else {
90 111
             $w = $width;
91 112
             $h = ($this->height * $w) / $this->width;
92 113
             $x = 0;
93 114
             if ($offset !== false) {
94
-                if ($offset > 0)
95
-                    $offset = -$offset;
96
-                if (($h + $offset) <= $height)
97
-                    $offset = $height - $h;
115
+                if ($offset > 0) {
116
+                                    $offset = -$offset;
117
+                }
118
+                if (($h + $offset) <= $height) {
119
+                                    $offset = $height - $h;
120
+                }
98 121
                 $y = $offset;
99
-            } else
100
-                $y = ($height - $h) / 2;
122
+            } else {
123
+                            $y = ($height - $h) / 2;
124
+            }
101 125
         }
102 126
 
103 127
         $x = round($x);
104 128
         $y = round($y);
105 129
         $w = round($w);
106 130
         $h = round($h);
107
-        if (!$w) $w = 1;
108
-        if (!$h) $h = 1;
131
+        if (!$w) {
132
+            $w = 1;
133
+        }
134
+        if (!$h) {
135
+            $h = 1;
136
+        }
109 137
 
110 138
         try {
111 139
             $this->image->scaleImage($w, $h);
@@ -119,7 +147,8 @@  discard block
 block discarded – undo
119 147
         return true;
120 148
     }
121 149
 
122
-    public function rotate($angle, $background="#000000") {
150
+    public function rotate($angle, $background="#000000")
151
+    {
123 152
         try {
124 153
             $this->image->rotateImage($background, $angle);
125 154
             $w = $this->image->getImageWidth();
@@ -132,7 +161,8 @@  discard block
 block discarded – undo
132 161
         return true;
133 162
     }
134 163
 
135
-    public function flipHorizontal() {
164
+    public function flipHorizontal()
165
+    {
136 166
         try {
137 167
             $this->image->flopImage();
138 168
         } catch (Exception $e) {
@@ -141,7 +171,8 @@  discard block
 block discarded – undo
141 171
         return true;
142 172
     }
143 173
 
144
-    public function flipVertical() {
174
+    public function flipVertical()
175
+    {
145 176
         try {
146 177
             $this->image->flipImage();
147 178
         } catch (Exception $e) {
@@ -150,7 +181,8 @@  discard block
 block discarded – undo
150 181
         return true;
151 182
     }
152 183
 
153
-    public function watermark($file, $left=false, $top=false) {
184
+    public function watermark($file, $left=false, $top=false)
185
+    {
154 186
         try {
155 187
             $wm = new Gmagick($file);
156 188
             $w = $wm->getImageWidth();
@@ -171,8 +203,9 @@  discard block
 block discarded – undo
171 203
         if ((($x + $w) > $this->width) ||
172 204
             (($y + $h) > $this->height) ||
173 205
             ($x < 0) || ($y < 0)
174
-        )
175
-            return false;
206
+        ) {
207
+                    return false;
208
+        }
176 209
 
177 210
         try {
178 211
             $this->image->compositeImage($wm, 1, $x, $y);
@@ -185,7 +218,8 @@  discard block
 block discarded – undo
185 218
 
186 219
     // ABSTRACT PROTECTED METHODS
187 220
 
188
-    protected function getBlankImage($width, $height) {
221
+    protected function getBlankImage($width, $height)
222
+    {
189 223
         try {
190 224
             $img = new Gmagick();
191 225
             $img->newImage($width, $height, "none");
@@ -195,7 +229,8 @@  discard block
 block discarded – undo
195 229
         return $img;
196 230
     }
197 231
 
198
-    protected function getImage($image, &$width, &$height) {
232
+    protected function getImage($image, &$width, &$height)
233
+    {
199 234
 
200 235
         if (is_object($image) && ($image instanceof image_gmagick)) {
201 236
             $width = $image->width;
@@ -225,18 +260,21 @@  discard block
 block discarded – undo
225 260
             $height = $h;
226 261
             return $image;
227 262
 
228
-        } else
229
-            return false;
263
+        } else {
264
+                    return false;
265
+        }
230 266
     }
231 267
 
232 268
 
233 269
     // PSEUDO-ABSTRACT STATIC METHODS
234 270
 
235
-    static function available() {
271
+    static function available()
272
+    {
236 273
         return class_exists("Gmagick");
237 274
     }
238 275
 
239
-    static function checkImage($file) {
276
+    static function checkImage($file)
277
+    {
240 278
         try {
241 279
             new Gmagick($file);
242 280
         } catch (Exception $e) {
@@ -248,7 +286,8 @@  discard block
 block discarded – undo
248 286
 
249 287
     // INHERIT METHODS
250 288
 
251
-    public function output($type="jpeg", array $options=array()) {
289
+    public function output($type="jpeg", array $options=array())
290
+    {
252 291
         $type = strtolower($type);
253 292
         try {
254 293
             $this->image->setImageFormat($type);
@@ -256,8 +295,9 @@  discard block
 block discarded – undo
256 295
             return false;
257 296
         }
258 297
         $method = "optimize_$type";
259
-        if (method_exists($this, $method) && !$this->$method($options))
260
-            return false;
298
+        if (method_exists($this, $method) && !$this->$method($options)) {
299
+                    return false;
300
+        }
261 301
 
262 302
         if (!isset($options['file'])) {
263 303
             if (!headers_sent()) {
@@ -287,7 +327,8 @@  discard block
 block discarded – undo
287 327
 
288 328
     // OWN METHODS
289 329
 
290
-    protected function optimize_jpeg(array $options=array()) {
330
+    protected function optimize_jpeg(array $options=array())
331
+    {
291 332
         $quality = isset($options['quality']) ? $options['quality'] : self::DEFAULT_JPEG_QUALITY;
292 333
         try {
293 334
             $this->image->setCompressionQuality($quality);
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/browse.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Browser calling script
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 Browser calling script
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
 require "core/autoload.php"; // Init MODX
16 16
 
17 17
 function returnNoPermissionsMessage($role) {
18
-	global $_lang;
19
-	echo sprintf($_lang['files_management_no_permission'], $role);
20
-	exit;
18
+    global $_lang;
19
+    echo sprintf($_lang['files_management_no_permission'], $role);
20
+    exit;
21 21
 }
22 22
 
23 23
 if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,14 +14,19 @@
 block discarded – undo
14 14
 
15 15
 require "core/autoload.php"; // Init MODX
16 16
 
17
-function returnNoPermissionsMessage($role) {
17
+function returnNoPermissionsMessage($role)
18
+{
18 19
 	global $_lang;
19 20
 	echo sprintf($_lang['files_management_no_permission'], $role);
20 21
 	exit;
21 22
 }
22 23
 
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');
24
+if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) {
25
+    returnNoPermissionsMessage('assets_images');
26
+}
27
+if( $_GET['type'] == 'files'  && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) {
28
+    returnNoPermissionsMessage('assets_files');
29
+}
25 30
 
26 31
 $browser = new browser($modx);
27 32
 $browser->action();
Please login to merge, or discard this patch.
manager/includes/config_check.inc.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
 }
89 89
 </script>
90 90
 
91
-JS;
91
+js;
92 92
         $modx->regClientScript($script);
93 93
         }
94 94
     }
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 
6 6
 // PROCESSOR FIRST
7 7
 if($_SESSION['mgrRole'] == 1) {
8
-	if(!empty($_REQUEST['b']) && $_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9
-		$current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']);
10
-		if(!empty($current)) {
11
-			$modx->getManagerApi()->setSystemChecksum($current);
12
-			$modx->clearCache('full');
13
-			$modx->config['sys_files_checksum'] = $current;
14
-		};
15
-	}
8
+    if(!empty($_REQUEST['b']) && $_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9
+        $current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']);
10
+        if(!empty($current)) {
11
+            $modx->getManagerApi()->setSystemChecksum($current);
12
+            $modx->clearCache('full');
13
+            $modx->config['sys_files_checksum'] = $current;
14
+        };
15
+    }
16 16
 }
17 17
 
18 18
 // NOW CHECK CONFIG
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 
21 21
 $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum();
22 22
 if ($sysfiles_check!=='0'){
23
-      $warningspresent = 1;
24
-      $warnings[] = array($_lang['configcheck_sysfiles_mod']);
23
+        $warningspresent = 1;
24
+        $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27 27
 if (is_writable("includes/config.inc.php")){
28 28
     // Warn if world writable
29 29
     if(@fileperms('includes/config.inc.php') & 0x0002) {
30
-      $warningspresent = 1;
31
-      $warnings[] = array($_lang['configcheck_configinc']);
30
+        $warningspresent = 1;
31
+        $warnings[] = array($_lang['configcheck_configinc']);
32 32
     }
33 33
 }
34 34
 
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
             break;
183 183
         case $_lang['configcheck_sysfiles_mod']:
184 184
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
185
-			$warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
186
-			if($modx->hasPermission('settings')) {
187
-				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
188
-			}
185
+            $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
186
+            if($modx->hasPermission('settings')) {
187
+                $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
188
+            }
189 189
             if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
190 190
             break;
191 191
         case $_lang['configcheck_lang_difference'] :
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 // PROCESSOR FIRST
7
-if($_SESSION['mgrRole'] == 1) {
8
-	if(!empty($_REQUEST['b']) && $_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
7
+if ($_SESSION['mgrRole'] == 1) {
8
+	if (!empty($_REQUEST['b']) && $_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9 9
 		$current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']);
10
-		if(!empty($current)) {
10
+		if (!empty($current)) {
11 11
 			$modx->getManagerApi()->setSystemChecksum($current);
12 12
 			$modx->clearCache('full');
13 13
 			$modx->config['sys_files_checksum'] = $current;
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 $warningspresent = 0;
20 20
 
21 21
 $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum();
22
-if ($sysfiles_check!=='0'){
22
+if ($sysfiles_check !== '0') {
23 23
       $warningspresent = 1;
24 24
       $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27
-if (is_writable("includes/config.inc.php")){
27
+if (is_writable("includes/config.inc.php")) {
28 28
     // Warn if world writable
29
-    if(@fileperms('includes/config.inc.php') & 0x0002) {
29
+    if (@fileperms('includes/config.inc.php') & 0x0002) {
30 30
       $warningspresent = 1;
31 31
       $warnings[] = array($_lang['configcheck_configinc']);
32 32
     }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $warnings[] = array($_lang['configcheck_php_gdzip']);
43 43
 }
44 44
 
45
-if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
-    if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
45
+if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
+    if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
47 47
         if ($modx->getDatabase()->getValue($modx->getDatabase()->select('COUNT(setting_value)', $modx->getDatabase()->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) {
48 48
             $warningspresent = 1;
49 49
             $warnings[] = array($_lang['configcheck_validate_referer']);
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 }
53 53
 
54 54
 // check for Template Switcher plugin
55
-if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
-    if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
55
+if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
+    if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
57 57
         $rs = $modx->getDatabase()->select('name, disabled', $modx->getDatabase()->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'");
58 58
         $row = $modx->getDatabase()->getRow($rs);
59
-        if($row && $row['disabled'] == 0) {
59
+        if ($row && $row['disabled'] == 0) {
60 60
             $warningspresent = 1;
61 61
             $warnings[] = array($_lang['configcheck_templateswitcher_present']);
62 62
             $tplName = $row['name'];
@@ -120,36 +120,36 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return bool
122 122
      */
123
-    function checkSiteCache() {
123
+    function checkSiteCache(){
124 124
         $modx = evolutionCMS();
125
-        $checked= true;
126
-        if (file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php')) {
127
-            $checked= @include_once (MODX_BASE_PATH . 'assets/cache/siteCache.idx.php');
125
+        $checked = true;
126
+        if (file_exists(MODX_BASE_PATH.'assets/cache/siteCache.idx.php')) {
127
+            $checked = @include_once (MODX_BASE_PATH.'assets/cache/siteCache.idx.php');
128 128
         }
129 129
         return $checked;
130 130
     }
131 131
 }
132 132
 
133
-if (!is_writable(MODX_BASE_PATH . "assets/cache/")) {
133
+if (!is_writable(MODX_BASE_PATH."assets/cache/")) {
134 134
     $warningspresent = 1;
135 135
     $warnings[] = array($_lang['configcheck_cache']);
136 136
 }
137 137
 
138 138
 if (!checkSiteCache()) {
139 139
     $warningspresent = 1;
140
-    $warnings[]= array($lang['configcheck_sitecache_integrity']);
140
+    $warnings[] = array($lang['configcheck_sitecache_integrity']);
141 141
 }
142 142
 
143
-if (!is_writable(MODX_BASE_PATH . "assets/images/")) {
143
+if (!is_writable(MODX_BASE_PATH."assets/images/")) {
144 144
     $warningspresent = 1;
145 145
     $warnings[] = array($_lang['configcheck_images']);
146 146
 }
147 147
 
148
-if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) {
148
+if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) {
149 149
     $warningspresent = 1;
150 150
     $warnings[] = array($_lang['configcheck_rb_base_dir']);
151 151
 }
152
-if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) {
152
+if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) {
153 153
     $warningspresent = 1;
154 154
     $warnings[] = array($_lang['configcheck_filemanager_path']);
155 155
 }
@@ -157,36 +157,36 @@  discard block
 block discarded – undo
157 157
 // clear file info cache
158 158
 clearstatcache();
159 159
 
160
-if ($warningspresent==1) {
160
+if ($warningspresent == 1) {
161 161
 
162
-if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3';
162
+if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3';
163 163
 $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>";
164 164
 
165
-for ($i=0;$i<count($warnings);$i++) {
165
+for ($i = 0; $i < count($warnings); $i++) {
166 166
     switch ($warnings[$i][0]) {
167 167
         case $_lang['configcheck_configinc'];
168 168
             $warnings[$i][1] = $_lang['configcheck_configinc_msg'];
169
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
169
+            if (empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']);
170 170
             break;
171 171
         case $_lang['configcheck_installer'] :
172 172
             $warnings[$i][1] = $_lang['configcheck_installer_msg'];
173
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
173
+            if (empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']);
174 174
             break;
175 175
         case $_lang['configcheck_cache'] :
176 176
             $warnings[$i][1] = $_lang['configcheck_cache_msg'];
177
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
177
+            if (empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']);
178 178
             break;
179 179
         case $_lang['configcheck_images'] :
180 180
             $warnings[$i][1] = $_lang['configcheck_images_msg'];
181
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
181
+            if (empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']);
182 182
             break;
183 183
         case $_lang['configcheck_sysfiles_mod']:
184 184
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
185
-			$warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
186
-			if($modx->hasPermission('settings')) {
187
-				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
185
+			$warnings[$i][2] = '<ul><li>'.implode('</li><li>', $sysfiles_check).'</li></ul>';
186
+			if ($modx->hasPermission('settings')) {
187
+				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\''.$_lang["reset_sysfiles_checksum_alert"].'\')">'.$_lang["reset_sysfiles_checksum_button"].'</a></li></ul>';
188 188
 			}
189
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
189
+            if (empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0, 3, $warnings[$i][1]." ".implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']);
190 190
             break;
191 191
         case $_lang['configcheck_lang_difference'] :
192 192
             $warnings[$i][1] = $_lang['configcheck_lang_difference_msg'];
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
             break;
209 209
         case $_lang['configcheck_validate_referer'] :
210 210
             $msg = $_lang['configcheck_validate_referer_msg'];
211
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
211
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
212 212
             $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n";
213 213
             break;
214 214
         case $_lang['configcheck_templateswitcher_present'] :
215 215
             $msg = $_lang["configcheck_templateswitcher_present_msg"];
216
-            if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
217
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"];
216
+            if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
217
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"];
218 218
             }
219
-            if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
220
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"];
219
+            if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
220
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"];
221 221
             }
222
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
222
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
223 223
             $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n";
224 224
             break;
225 225
         case $_lang['configcheck_rb_base_dir'] :
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $warnings[$i][1] = $_lang['configcheck_default_msg'];
233 233
     }
234 234
 
235
-    $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ;
235
+    $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : "";
236 236
     $config_check_results .= "
237 237
             <fieldset>
238 238
             <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p>
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
             ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')."
242 242
             </fieldset>
243 243
 ";
244
-        if ($i!=count($warnings)-1) {
244
+        if ($i != count($warnings) - 1) {
245 245
             $config_check_results .= "<br />";
246 246
         }
247 247
     }
248
-    $_SESSION["mgrConfigCheck"]=true;
248
+    $_SESSION["mgrConfigCheck"] = true;
249 249
 } else {
250 250
     $config_check_results = $_lang['configcheck_ok'];
251 251
 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 $warningspresent = 0;
20 20
 
21 21
 $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum();
22
-if ($sysfiles_check!=='0'){
22
+if ($sysfiles_check!=='0') {
23 23
       $warningspresent = 1;
24 24
       $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27
-if (is_writable("includes/config.inc.php")){
27
+if (is_writable("includes/config.inc.php")) {
28 28
     // Warn if world writable
29 29
     if(@fileperms('includes/config.inc.php') & 0x0002) {
30 30
       $warningspresent = 1;
@@ -120,7 +120,8 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return bool
122 122
      */
123
-    function checkSiteCache() {
123
+    function checkSiteCache()
124
+    {
124 125
         $modx = evolutionCMS();
125 126
         $checked= true;
126 127
         if (file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php')) {
@@ -159,26 +160,36 @@  discard block
 block discarded – undo
159 160
 
160 161
 if ($warningspresent==1) {
161 162
 
162
-if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3';
163
+if(!isset($modx->config['send_errormail'])) {
164
+    $modx->config['send_errormail']='3';
165
+}
163 166
 $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>";
164 167
 
165 168
 for ($i=0;$i<count($warnings);$i++) {
166 169
     switch ($warnings[$i][0]) {
167 170
         case $_lang['configcheck_configinc'];
168 171
             $warnings[$i][1] = $_lang['configcheck_configinc_msg'];
169
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
172
+            if(empty($_SESSION["mgrConfigCheck"])) {
173
+                $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
174
+            }
170 175
             break;
171 176
         case $_lang['configcheck_installer'] :
172 177
             $warnings[$i][1] = $_lang['configcheck_installer_msg'];
173
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
178
+            if(empty($_SESSION["mgrConfigCheck"])) {
179
+                $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
180
+            }
174 181
             break;
175 182
         case $_lang['configcheck_cache'] :
176 183
             $warnings[$i][1] = $_lang['configcheck_cache_msg'];
177
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
184
+            if(empty($_SESSION["mgrConfigCheck"])) {
185
+                $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
186
+            }
178 187
             break;
179 188
         case $_lang['configcheck_images'] :
180 189
             $warnings[$i][1] = $_lang['configcheck_images_msg'];
181
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
190
+            if(empty($_SESSION["mgrConfigCheck"])) {
191
+                $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
192
+            }
182 193
             break;
183 194
         case $_lang['configcheck_sysfiles_mod']:
184 195
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
@@ -186,7 +197,9 @@  discard block
 block discarded – undo
186 197
 			if($modx->hasPermission('settings')) {
187 198
 				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
188 199
 			}
189
-            if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
200
+            if(empty($_SESSION["mgrConfigCheck"])) {
201
+                $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
202
+            }
190 203
             break;
191 204
         case $_lang['configcheck_lang_difference'] :
192 205
             $warnings[$i][1] = $_lang['configcheck_lang_difference_msg'];
Please login to merge, or discard this patch.
manager/includes/extenders/message.quit.inc.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -19,60 +19,60 @@
 block discarded – undo
19 19
 </head><body>
20 20
 ";
21 21
 if($is_error) {
22
-	$parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'>&nbsp;MODX Parse Error </h3>
22
+    $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'>&nbsp;MODX Parse Error </h3>
23 23
 	<table border='0' cellpadding='1' cellspacing='0'>
24 24
 	<tr><td colspan='3'>MODX encountered the following error while attempting to parse the requested resource:</td></tr>
25 25
 	<tr><td colspan='3'><b style='color:red;'>&laquo; $msg &raquo;</b></td></tr>";
26 26
 } else {
27
-	$parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'>&nbsp;MODX Debug/ stop message </h3>
27
+    $parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'>&nbsp;MODX Debug/ stop message </h3>
28 28
 	<table border='0' cellpadding='1' cellspacing='0'>
29 29
 	<tr><td colspan='3'>The MODX parser recieved the following debug/ stop message:</td></tr>
30 30
 	<tr><td colspan='3'><b style='color:#003399;'>&laquo; $msg &raquo;</b></td></tr>";
31 31
 }
32 32
 
33 33
 if(!empty($query)) {
34
-	$parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SQL:&nbsp;<span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/>
34
+    $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SQL:&nbsp;<span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/>
35 35
 	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:copyToClip();' style='color:#821517;font-size: 9px; text-decoration: none'>[Copy SQL to ClipBoard]</a><textarea id='holdtext' style='display:none;'></textarea></td></tr>";
36 36
 }
37 37
 
38 38
 if($text!='') {
39 39
 
40
-	$errortype = array (
41
-		E_ERROR          => "Error",
42
-		E_WARNING        => "Warning",
43
-		E_PARSE          => "Parsing Error",
44
-		E_NOTICE          => "Notice",
45
-		E_CORE_ERROR      => "Core Error",
46
-		E_CORE_WARNING    => "Core Warning",
47
-		E_COMPILE_ERROR  => "Compile Error",
48
-		E_COMPILE_WARNING => "Compile Warning",
49
-		E_USER_ERROR      => "User Error",
50
-		E_USER_WARNING    => "User Warning",
51
-		E_USER_NOTICE    => "User Notice",
52
-	);
40
+    $errortype = array (
41
+        E_ERROR          => "Error",
42
+        E_WARNING        => "Warning",
43
+        E_PARSE          => "Parsing Error",
44
+        E_NOTICE          => "Notice",
45
+        E_CORE_ERROR      => "Core Error",
46
+        E_CORE_WARNING    => "Core Warning",
47
+        E_COMPILE_ERROR  => "Compile Error",
48
+        E_COMPILE_WARNING => "Compile Warning",
49
+        E_USER_ERROR      => "User Error",
50
+        E_USER_WARNING    => "User Warning",
51
+        E_USER_NOTICE    => "User Notice",
52
+    );
53 53
 
54
-	$parsedMessageString .= "<tr><td>&nbsp;</td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>";
54
+    $parsedMessageString .= "<tr><td>&nbsp;</td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>";
55 55
 
56
-	$parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Error: </td>";
57
-	$parsedMessageString .= "<td colspan='2'>$text</td><td>&nbsp;</td>";
58
-	$parsedMessageString .= "</tr>";
56
+    $parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Error: </td>";
57
+    $parsedMessageString .= "<td colspan='2'>$text</td><td>&nbsp;</td>";
58
+    $parsedMessageString .= "</tr>";
59 59
 
60
-	$parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Error type/ Nr.: </td>";
61
-	$parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td>&nbsp;</td>";
62
-	$parsedMessageString .= "</tr>";
60
+    $parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Error type/ Nr.: </td>";
61
+    $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td>&nbsp;</td>";
62
+    $parsedMessageString .= "</tr>";
63 63
 
64
-	$parsedMessageString .= "<tr><td>&nbsp;&nbsp;File: </td>";
65
-	$parsedMessageString .= "<td colspan='2'>$file</td><td>&nbsp;</td>";
66
-	$parsedMessageString .= "</tr>";
64
+    $parsedMessageString .= "<tr><td>&nbsp;&nbsp;File: </td>";
65
+    $parsedMessageString .= "<td colspan='2'>$file</td><td>&nbsp;</td>";
66
+    $parsedMessageString .= "</tr>";
67 67
 
68
-	$parsedMessageString .= "<tr><td>&nbsp;&nbsp;Line: </td>";
69
-	$parsedMessageString .= "<td colspan='2'>$line</td><td>&nbsp;</td>";
70
-	$parsedMessageString .= "</tr>";
71
-	if($source!='') {
72
-		$parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Line $line source: </td>";
73
-		$parsedMessageString .= "<td colspan='2'>$source</td><td>&nbsp;</td>";
74
-		$parsedMessageString .= "</tr>";
75
-	}
68
+    $parsedMessageString .= "<tr><td>&nbsp;&nbsp;Line: </td>";
69
+    $parsedMessageString .= "<td colspan='2'>$line</td><td>&nbsp;</td>";
70
+    $parsedMessageString .= "</tr>";
71
+    if($source!='') {
72
+        $parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Line $line source: </td>";
73
+        $parsedMessageString .= "<td colspan='2'>$source</td><td>&nbsp;</td>";
74
+        $parsedMessageString .= "</tr>";
75
+    }
76 76
 }
77 77
 
78 78
 $parsedMessageString .= "<tr><td>&nbsp;</td></tr><tr><td colspan='3'><b>Parser timing</b></td></tr>";
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Message Quit Template
4 4
  *
5 5
  */
6
-if(( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE!="true") {
6
+if ((!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE != "true") {
7 7
     die("<b>INCLUDE ACCESS ERROR</b><br /><br />Direct access to this file prohibited.");
8 8
 }
9 9
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 </script>
21 21
 </head><body>
22 22
 ";
23
-if($is_error) {
23
+if ($is_error) {
24 24
 	$parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'>&nbsp;MODX Parse Error </h3>
25 25
 	<table border='0' cellpadding='1' cellspacing='0'>
26 26
 	<tr><td colspan='3'>MODX encountered the following error while attempting to parse the requested resource:</td></tr>
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	<tr><td colspan='3'><b style='color:#003399;'>&laquo; $msg &raquo;</b></td></tr>";
33 33
 }
34 34
 
35
-if(!empty($query)) {
35
+if (!empty($query)) {
36 36
 	$parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SQL:&nbsp;<span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/>
37 37
 	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:copyToClip();' style='color:#821517;font-size: 9px; text-decoration: none'>[Copy SQL to ClipBoard]</a><textarea id='holdtext' style='display:none;'></textarea></td></tr>";
38 38
 }
39 39
 
40
-if($text!='') {
40
+if ($text != '') {
41 41
 
42
-	$errortype = array (
42
+	$errortype = array(
43 43
 		E_ERROR          => "Error",
44 44
 		E_WARNING        => "Warning",
45 45
 		E_PARSE          => "Parsing Error",
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	$parsedMessageString .= "<tr><td>&nbsp;&nbsp;Line: </td>";
71 71
 	$parsedMessageString .= "<td colspan='2'>$line</td><td>&nbsp;</td>";
72 72
 	$parsedMessageString .= "</tr>";
73
-	if($source!='') {
73
+	if ($source != '') {
74 74
 		$parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Line $line source: </td>";
75 75
 		$parsedMessageString .= "<td colspan='2'>$source</td><td>&nbsp;</td>";
76 76
 		$parsedMessageString .= "</tr>";
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/request_trigger.inc.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
             if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
23 23
             {
24
-               $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
24
+                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 25
             }
26 26
 
27 27
             foreach( $cm->getCategories() as $category )
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 
107 107
     if( empty( $category ) )
108 108
     {
109
-       $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110
-       return;
109
+        $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110
+        return;
111 111
     }
112 112
 
113 113
     if( $cm->isCategoryExists( $category ) )
114 114
     {
115
-       $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116
-       return;
115
+        $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116
+        return;
117 117
     }
118 118
 
119 119
     if( $cm->addCategory( $category, $rank ) !== 0 )
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Ajax Requests
4 4
  */
5
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
5
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) )
9
+if (isset($_REQUEST[$cm->get('request_key')]['ajax']))
10 10
 {
11 11
     $_data  = $_REQUEST[$cm->get('request_key')];
12 12
     $output = '';
13 13
     $task   = $_data['task'];
14
-    switch( $task )
14
+    switch ($task)
15 15
     {
16 16
         /**
17 17
          * get categories
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
         case 'categorize_load_elements':
20 20
             $elements = $_data['elements'];
21 21
 
22
-            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
22
+            if ($uncategorized_elements = $cm->getAssignedElements(0, $_data['elements']))
23 23
             {
24 24
                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 25
             }
26 26
 
27
-            foreach( $cm->getCategories() as $category )
27
+            foreach ($cm->getCategories() as $category)
28 28
             {
29
-                $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] );
29
+                $category['elements'] = $cm->getAssignedElements($category['id'], $_data['elements']);
30 30
                 $output .= $cm->renderView('chunks/categorize/category', $category);
31 31
             }
32 32
             break;
33 33
     }
34
-    exit( $output );
34
+    exit($output);
35 35
 }
36 36
 /**
37 37
  * Categorize elements
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476
42 42
  *
43 43
  */
44
-if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) )
44
+if (isset($_POST[$cm->get('request_key')]['categorize']['submit']))
45 45
 {
46 46
     $_data = $_POST[$cm->get('request_key')]['categorize'];
47 47
     $_changes = 0;
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
         'categorize'
55 55
     );
56 56
 
57
-    if( !isset( $_data['elements'] ) )
57
+    if (!isset($_data['elements']))
58 58
     {
59
-        $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' );
59
+        $cm->addMessage($cm->txt('cm_unknown_error'), 'categorize');
60 60
         return;
61 61
     }
62 62
 
63
-    foreach( $_data['elements'] as $element_id => $data )
63
+    foreach ($_data['elements'] as $element_id => $data)
64 64
     {
65
-        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) )
65
+        if ($cm->updateElement($_data['elementsgroup'], $element_id, $data['category_id']))
66 66
         {
67 67
             $cm->addMessage(
68 68
                 sprintf(
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
         }
79 79
     }
80 80
 
81
-    if( $_changes === 0 )
81
+    if ($_changes === 0)
82 82
     {
83
-        $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' );
83
+        $cm->addMessage($cm->txt('cm_no_categorization'), 'categorize');
84 84
         return;
85 85
     }
86 86
     else
@@ -98,29 +98,29 @@  discard block
 block discarded – undo
98 98
 /**
99 99
  * Add a new category
100 100
  */
101
-if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) )
101
+if (isset($_POST[$cm->get('request_key')]['add']['submit']))
102 102
 {
103 103
     $_data    = $_POST[$cm->get('request_key')]['add']['data'];
104
-    $category = trim( html_entity_decode($_data['name']) );
104
+    $category = trim(html_entity_decode($_data['name']));
105 105
     $rank     = (int) $_data['rank'];
106 106
 
107
-    if( empty( $category ) )
107
+    if (empty($category))
108 108
     {
109
-       $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
109
+       $cm->addMessage($cm->txt('cm_enter_name_for_category'), 'add');
110 110
        return;
111 111
     }
112 112
 
113
-    if( $cm->isCategoryExists( $category ) )
113
+    if ($cm->isCategoryExists($category))
114 114
     {
115
-       $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
115
+       $cm->addMessage(sprintf($cm->txt('cm_category_x_exists'), $category), 'add');
116 116
        return;
117 117
     }
118 118
 
119
-    if( $cm->addCategory( $category, $rank ) !== 0 )
119
+    if ($cm->addCategory($category, $rank) !== 0)
120 120
     {
121 121
         $cm->addMessage(
122 122
             sprintf(
123
-                $cm->txt( 'cm_category_x_saved_at_position_y' ),
123
+                $cm->txt('cm_category_x_saved_at_position_y'),
124 124
                 $category,
125 125
                 $rank
126 126
             ),
@@ -129,26 +129,26 @@  discard block
 block discarded – undo
129 129
     }
130 130
     else
131 131
     {
132
-        $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' );
132
+        $cm->addMessage($cm->txt('cm_unknown_error'), 'add');
133 133
     }
134 134
 }
135 135
 
136 136
 /**
137 137
  * Sort categories
138 138
  */
139
-if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) )
139
+if (isset($_POST[$cm->get('request_key')]['sort']['submit']))
140 140
 {
141 141
     $categories = $_POST[$cm->get('request_key')]['sort']['data'];
142 142
     $_changes   = 0;
143 143
 
144
-    foreach( $categories as $category_id => $_data  )
144
+    foreach ($categories as $category_id => $_data)
145 145
     {
146 146
         $data = array(
147
-            'category' => urldecode( $_data['category'] ),
147
+            'category' => urldecode($_data['category']),
148 148
             'rank'     => $_data['rank']
149 149
         );
150 150
 
151
-        if( $cm->updateCategory( $category_id, $data ) )
151
+        if ($cm->updateCategory($category_id, $data))
152 152
         {
153 153
             $cm->addMessage(
154 154
                 sprintf(
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         }
163 163
     }
164 164
 
165
-    if( $_changes === 0 )
165
+    if ($_changes === 0)
166 166
     {
167
-        $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort');
167
+        $cm->addMessage($cm->txt('cm_no_changes'), 'sort');
168 168
     }
169 169
     else
170 170
     {
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
 /**
182 182
  * Edit categories
183 183
  */
184
-if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) )
184
+if (isset($_POST[$cm->get('request_key')]['edit']['submit']))
185 185
 {
186 186
     $categories = $_POST[$cm->get('request_key')]['edit']['data'];
187 187
     $_changes   = 0;
188 188
 
189
-    foreach( $categories as $category_id => $_data  )
189
+    foreach ($categories as $category_id => $_data)
190 190
     {
191
-        if( isset( $_data['delete'] ) )
191
+        if (isset($_data['delete']))
192 192
         {
193
-            if( $cm->deleteCategory( $category_id ) )
193
+            if ($cm->deleteCategory($category_id))
194 194
             {
195 195
                 $cm->addMessage(
196 196
                     sprintf(
197 197
                         $cm->txt('cm_category_x_deleted'),
198
-                        urldecode( $_data['origin'] )
198
+                        urldecode($_data['origin'])
199 199
                     ),
200 200
                     'edit'
201 201
                 );
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
         }
206 206
 
207 207
         $data = array(
208
-            'category' => trim( html_entity_decode( $_data['category'] ) ),
208
+            'category' => trim(html_entity_decode($_data['category'])),
209 209
             'rank'     => $_data['rank']
210 210
         );
211 211
 
212
-        if( $cm->updateCategory( $category_id, $data ) )
212
+        if ($cm->updateCategory($category_id, $data))
213 213
         {
214 214
             $cm->addMessage(
215 215
                 sprintf(
216 216
                     $cm->txt('cm_category_x_renamed_to_y'),
217
-                    urldecode( $_data['origin'] ),
217
+                    urldecode($_data['origin']),
218 218
                     $data['category']
219 219
                 ),
220 220
                 'edit'
@@ -223,26 +223,26 @@  discard block
 block discarded – undo
223 223
         }
224 224
     }
225 225
 
226
-    if( $_changes === 0 )
226
+    if ($_changes === 0)
227 227
     {
228
-        $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit');
228
+        $cm->addMessage($cm->txt('cm_no_changes'), 'edit');
229 229
     }
230 230
 }
231 231
 
232 232
 /**
233 233
  * Delete singel category by $_GET
234 234
  */
235
-if( isset( $_GET[$cm->get('request_key')]['delete'] )
236
-    && !empty( $_GET[$cm->get('request_key')]['delete'] ) )
235
+if (isset($_GET[$cm->get('request_key')]['delete'])
236
+    && !empty($_GET[$cm->get('request_key')]['delete']))
237 237
 {
238
-    $category_id = (int)$_GET[$cm->get('request_key')]['delete'];
238
+    $category_id = (int) $_GET[$cm->get('request_key')]['delete'];
239 239
 
240
-    if( $cm->deleteCategory( $category_id ) )
240
+    if ($cm->deleteCategory($category_id))
241 241
     {
242 242
         $cm->addMessage(
243 243
             sprintf(
244 244
                 $cm->txt('cm_category_x_deleted'),
245
-                urldecode( $_GET[$cm->get('request_key')]['category'] )
245
+                urldecode($_GET[$cm->get('request_key')]['category'])
246 246
             ),
247 247
             'edit'
248 248
         );
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 /**
252 252
  * Translate phrases
253 253
  */
254
-if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) )
254
+if (isset($_POST[$cm->get('request_key')]['translate']['submit']))
255 255
 {
256 256
     $translations = $_POST[$cm->get('request_key')]['translate']['data'];
257 257
 
258
-    foreach( $translations as $native_phrase => $translation )
258
+    foreach ($translations as $native_phrase => $translation)
259 259
     {
260
-        $native_phrase = urldecode( $native_phrase );
260
+        $native_phrase = urldecode($native_phrase);
261 261
 
262
-        if( empty( $translation ) )
262
+        if (empty($translation))
263 263
         {
264 264
             $translation = $native_phrase;
265 265
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             );
273 273
         }
274 274
 
275
-        $cm->c('Translator')->addTranslation( $native_phrase, $translation, 'phrase' );
275
+        $cm->c('Translator')->addTranslation($native_phrase, $translation, 'phrase');
276 276
 
277 277
         $cm->addMessage(
278 278
             sprintf(
Please login to merge, or discard this patch.
Braces   +31 added lines, -65 removed lines patch added patch discarded remove patch
@@ -6,26 +6,22 @@  discard block
 block discarded – undo
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) )
10
-{
9
+if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) {
11 10
     $_data  = $_REQUEST[$cm->get('request_key')];
12 11
     $output = '';
13 12
     $task   = $_data['task'];
14
-    switch( $task )
15
-    {
13
+    switch( $task ) {
16 14
         /**
17 15
          * get categories
18 16
          */
19 17
         case 'categorize_load_elements':
20 18
             $elements = $_data['elements'];
21 19
 
22
-            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
23
-            {
20
+            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) {
24 21
                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 22
             }
26 23
 
27
-            foreach( $cm->getCategories() as $category )
28
-            {
24
+            foreach( $cm->getCategories() as $category ) {
29 25
                 $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] );
30 26
                 $output .= $cm->renderView('chunks/categorize/category', $category);
31 27
             }
@@ -41,8 +37,7 @@  discard block
 block discarded – undo
41 37
  * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476
42 38
  *
43 39
  */
44
-if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) )
45
-{
40
+if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) {
46 41
     $_data = $_POST[$cm->get('request_key')]['categorize'];
47 42
     $_changes = 0;
48 43
 
@@ -54,16 +49,13 @@  discard block
 block discarded – undo
54 49
         'categorize'
55 50
     );
56 51
 
57
-    if( !isset( $_data['elements'] ) )
58
-    {
52
+    if( !isset( $_data['elements'] ) ) {
59 53
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' );
60 54
         return;
61 55
     }
62 56
 
63
-    foreach( $_data['elements'] as $element_id => $data )
64
-    {
65
-        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) )
66
-        {
57
+    foreach( $_data['elements'] as $element_id => $data ) {
58
+        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) {
67 59
             $cm->addMessage(
68 60
                 sprintf(
69 61
                     $cm->txt('cm_x_assigned_to_category_y'),
@@ -78,13 +70,10 @@  discard block
 block discarded – undo
78 70
         }
79 71
     }
80 72
 
81
-    if( $_changes === 0 )
82
-    {
73
+    if( $_changes === 0 ) {
83 74
         $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' );
84 75
         return;
85
-    }
86
-    else
87
-    {
76
+    } else {
88 77
         $cm->addMessage(
89 78
             sprintf(
90 79
                 $cm->txt('cm_x_changes_made'),
@@ -98,26 +87,22 @@  discard block
 block discarded – undo
98 87
 /**
99 88
  * Add a new category
100 89
  */
101
-if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) )
102
-{
90
+if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) {
103 91
     $_data    = $_POST[$cm->get('request_key')]['add']['data'];
104 92
     $category = trim( html_entity_decode($_data['name']) );
105 93
     $rank     = (int) $_data['rank'];
106 94
 
107
-    if( empty( $category ) )
108
-    {
95
+    if( empty( $category ) ) {
109 96
        $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110 97
        return;
111 98
     }
112 99
 
113
-    if( $cm->isCategoryExists( $category ) )
114
-    {
100
+    if( $cm->isCategoryExists( $category ) ) {
115 101
        $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116 102
        return;
117 103
     }
118 104
 
119
-    if( $cm->addCategory( $category, $rank ) !== 0 )
120
-    {
105
+    if( $cm->addCategory( $category, $rank ) !== 0 ) {
121 106
         $cm->addMessage(
122 107
             sprintf(
123 108
                 $cm->txt( 'cm_category_x_saved_at_position_y' ),
@@ -126,9 +111,7 @@  discard block
 block discarded – undo
126 111
             ),
127 112
             'add'
128 113
         );
129
-    }
130
-    else
131
-    {
114
+    } else {
132 115
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' );
133 116
     }
134 117
 }
@@ -136,20 +119,17 @@  discard block
 block discarded – undo
136 119
 /**
137 120
  * Sort categories
138 121
  */
139
-if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) )
140
-{
122
+if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) {
141 123
     $categories = $_POST[$cm->get('request_key')]['sort']['data'];
142 124
     $_changes   = 0;
143 125
 
144
-    foreach( $categories as $category_id => $_data  )
145
-    {
126
+    foreach( $categories as $category_id => $_data  ) {
146 127
         $data = array(
147 128
             'category' => urldecode( $_data['category'] ),
148 129
             'rank'     => $_data['rank']
149 130
         );
150 131
 
151
-        if( $cm->updateCategory( $category_id, $data ) )
152
-        {
132
+        if( $cm->updateCategory( $category_id, $data ) ) {
153 133
             $cm->addMessage(
154 134
                 sprintf(
155 135
                     $cm->txt('cm_category_x_moved_to_position_y'),
@@ -162,12 +142,9 @@  discard block
 block discarded – undo
162 142
         }
163 143
     }
164 144
 
165
-    if( $_changes === 0 )
166
-    {
145
+    if( $_changes === 0 ) {
167 146
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort');
168
-    }
169
-    else
170
-    {
147
+    } else {
171 148
         $cm->addMessage(
172 149
             sprintf(
173 150
                 $cm->txt('cm_x_changes_made'),
@@ -181,17 +158,13 @@  discard block
 block discarded – undo
181 158
 /**
182 159
  * Edit categories
183 160
  */
184
-if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) )
185
-{
161
+if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) {
186 162
     $categories = $_POST[$cm->get('request_key')]['edit']['data'];
187 163
     $_changes   = 0;
188 164
 
189
-    foreach( $categories as $category_id => $_data  )
190
-    {
191
-        if( isset( $_data['delete'] ) )
192
-        {
193
-            if( $cm->deleteCategory( $category_id ) )
194
-            {
165
+    foreach( $categories as $category_id => $_data  ) {
166
+        if( isset( $_data['delete'] ) ) {
167
+            if( $cm->deleteCategory( $category_id ) ) {
195 168
                 $cm->addMessage(
196 169
                     sprintf(
197 170
                         $cm->txt('cm_category_x_deleted'),
@@ -209,8 +182,7 @@  discard block
 block discarded – undo
209 182
             'rank'     => $_data['rank']
210 183
         );
211 184
 
212
-        if( $cm->updateCategory( $category_id, $data ) )
213
-        {
185
+        if( $cm->updateCategory( $category_id, $data ) ) {
214 186
             $cm->addMessage(
215 187
                 sprintf(
216 188
                     $cm->txt('cm_category_x_renamed_to_y'),
@@ -223,8 +195,7 @@  discard block
 block discarded – undo
223 195
         }
224 196
     }
225 197
 
226
-    if( $_changes === 0 )
227
-    {
198
+    if( $_changes === 0 ) {
228 199
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit');
229 200
     }
230 201
 }
@@ -233,12 +204,10 @@  discard block
 block discarded – undo
233 204
  * Delete singel category by $_GET
234 205
  */
235 206
 if( isset( $_GET[$cm->get('request_key')]['delete'] )
236
-    && !empty( $_GET[$cm->get('request_key')]['delete'] ) )
237
-{
207
+    && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) {
238 208
     $category_id = (int)$_GET[$cm->get('request_key')]['delete'];
239 209
 
240
-    if( $cm->deleteCategory( $category_id ) )
241
-    {
210
+    if( $cm->deleteCategory( $category_id ) ) {
242 211
         $cm->addMessage(
243 212
             sprintf(
244 213
                 $cm->txt('cm_category_x_deleted'),
@@ -251,16 +220,13 @@  discard block
 block discarded – undo
251 220
 /**
252 221
  * Translate phrases
253 222
  */
254
-if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) )
255
-{
223
+if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) {
256 224
     $translations = $_POST[$cm->get('request_key')]['translate']['data'];
257 225
 
258
-    foreach( $translations as $native_phrase => $translation )
259
-    {
226
+    foreach( $translations as $native_phrase => $translation ) {
260 227
         $native_phrase = urldecode( $native_phrase );
261 228
 
262
-        if( empty( $translation ) )
263
-        {
229
+        if( empty( $translation ) ) {
264 230
             $translation = $native_phrase;
265 231
 
266 232
             $cm->addMessage(
Please login to merge, or discard this patch.
manager/includes/active_user_locks.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         var stay = document.getElementById('stay');
19 19
         // Trigger unlock
20 20
         if ((stay && stay.value !== '2') || !form_save) {
21
-          var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random();
21
+          var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random();
22 22
           if (navigator.sendBeacon) {
23 23
             navigator.sendBeacon(url)
24 24
           } else {
Please login to merge, or discard this patch.