Passed
Branch master (ef3387)
by Anthony
09:36
created
libs/ckfinder/ckfinder.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13 13
 
14
-if ( version_compare( phpversion(), '5', '<' ) )
15
-	require_once 'core/ckfinder_php4.php' ;
14
+if (version_compare(phpversion(), '5', '<'))
15
+	require_once 'core/ckfinder_php4.php';
16 16
 else
17
-	require_once 'core/ckfinder_php5.php' ;
17
+	require_once 'core/ckfinder_php5.php';
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@
 block discarded – undo
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13 13
 
14
-if ( version_compare( phpversion(), '5', '<' ) )
14
+if ( version_compare( phpversion(), '5', '<' ) ) {
15 15
 	require_once 'core/ckfinder_php4.php' ;
16
-else
16
+} else {
17 17
 	require_once 'core/ckfinder_php5.php' ;
18
+}
Please login to merge, or discard this patch.
libs/ckfinder/plugins/watermark/plugin.php 3 patches
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -15,174 +15,174 @@
 block discarded – undo
15 15
 
16 16
 class Watermark
17 17
 {
18
-    function onAfterFileUpload($currentFolder, $uploadedFile, $sFilePath)
19
-    {
20
-        global $config;
21
-        $watermarkSettings = $config['Plugin_Watermark'];
18
+	function onAfterFileUpload($currentFolder, $uploadedFile, $sFilePath)
19
+	{
20
+		global $config;
21
+		$watermarkSettings = $config['Plugin_Watermark'];
22 22
 
23
-        $this->createWatermark($sFilePath, $watermarkSettings['source'], $watermarkSettings['marginRight'],
24
-            $watermarkSettings['marginBottom'], $watermarkSettings['quality'], $watermarkSettings['transparency']);
23
+		$this->createWatermark($sFilePath, $watermarkSettings['source'], $watermarkSettings['marginRight'],
24
+			$watermarkSettings['marginBottom'], $watermarkSettings['quality'], $watermarkSettings['transparency']);
25 25
 
26
-        return true;
27
-    }
26
+		return true;
27
+	}
28 28
 
29
-    function createWatermark($sourceFile, $watermarkFile, $marginLeft = 5, $marginBottom = 5, $quality = 90, $transparency = 100)
30
-    {
31
-        if (!file_exists($watermarkFile)) {
32
-            $watermarkFile = dirname(__FILE__) . "/" . $watermarkFile;
33
-        }
34
-        if (!file_exists($watermarkFile)) {
35
-            return false;
36
-        }
29
+	function createWatermark($sourceFile, $watermarkFile, $marginLeft = 5, $marginBottom = 5, $quality = 90, $transparency = 100)
30
+	{
31
+		if (!file_exists($watermarkFile)) {
32
+			$watermarkFile = dirname(__FILE__) . "/" . $watermarkFile;
33
+		}
34
+		if (!file_exists($watermarkFile)) {
35
+			return false;
36
+		}
37 37
 
38
-        $watermarkImageAttr = @getimagesize($watermarkFile);
39
-        $sourceImageAttr = @getimagesize($sourceFile);
40
-        if ($sourceImageAttr === false || $watermarkImageAttr === false) {
41
-            return false;
42
-        }
38
+		$watermarkImageAttr = @getimagesize($watermarkFile);
39
+		$sourceImageAttr = @getimagesize($sourceFile);
40
+		if ($sourceImageAttr === false || $watermarkImageAttr === false) {
41
+			return false;
42
+		}
43 43
 
44
-        switch ($watermarkImageAttr['mime'])
45
-        {
46
-            case 'image/gif':
47
-                {
48
-                    if (@imagetypes() & IMG_GIF) {
49
-                        $oWatermarkImage = @imagecreatefromgif($watermarkFile);
50
-                    } else {
51
-                        $ermsg = 'GIF images are not supported';
52
-                    }
53
-                }
54
-                break;
55
-            case 'image/jpeg':
56
-                {
57
-                    if (@imagetypes() & IMG_JPG) {
58
-                        $oWatermarkImage = @imagecreatefromjpeg($watermarkFile) ;
59
-                    } else {
60
-                        $ermsg = 'JPEG images are not supported';
61
-                    }
62
-                }
63
-                break;
64
-            case 'image/png':
65
-                {
66
-                    if (@imagetypes() & IMG_PNG) {
67
-                        $oWatermarkImage = @imagecreatefrompng($watermarkFile) ;
68
-                    } else {
69
-                        $ermsg = 'PNG images are not supported';
70
-                    }
71
-                }
72
-                break;
73
-            case 'image/wbmp':
74
-                {
75
-                    if (@imagetypes() & IMG_WBMP) {
76
-                        $oWatermarkImage = @imagecreatefromwbmp($watermarkFile);
77
-                    } else {
78
-                        $ermsg = 'WBMP images are not supported';
79
-                    }
80
-                }
81
-                break;
82
-            default:
83
-                $ermsg = $watermarkImageAttr['mime'].' images are not supported';
84
-                break;
85
-        }
44
+		switch ($watermarkImageAttr['mime'])
45
+		{
46
+			case 'image/gif':
47
+				{
48
+					if (@imagetypes() & IMG_GIF) {
49
+						$oWatermarkImage = @imagecreatefromgif($watermarkFile);
50
+					} else {
51
+						$ermsg = 'GIF images are not supported';
52
+					}
53
+				}
54
+				break;
55
+			case 'image/jpeg':
56
+				{
57
+					if (@imagetypes() & IMG_JPG) {
58
+						$oWatermarkImage = @imagecreatefromjpeg($watermarkFile) ;
59
+					} else {
60
+						$ermsg = 'JPEG images are not supported';
61
+					}
62
+				}
63
+				break;
64
+			case 'image/png':
65
+				{
66
+					if (@imagetypes() & IMG_PNG) {
67
+						$oWatermarkImage = @imagecreatefrompng($watermarkFile) ;
68
+					} else {
69
+						$ermsg = 'PNG images are not supported';
70
+					}
71
+				}
72
+				break;
73
+			case 'image/wbmp':
74
+				{
75
+					if (@imagetypes() & IMG_WBMP) {
76
+						$oWatermarkImage = @imagecreatefromwbmp($watermarkFile);
77
+					} else {
78
+						$ermsg = 'WBMP images are not supported';
79
+					}
80
+				}
81
+				break;
82
+			default:
83
+				$ermsg = $watermarkImageAttr['mime'].' images are not supported';
84
+				break;
85
+		}
86 86
 
87
-        switch ($sourceImageAttr['mime'])
88
-        {
89
-            case 'image/gif':
90
-                {
91
-                    if (@imagetypes() & IMG_GIF) {
92
-                        $oImage = @imagecreatefromgif($sourceFile);
93
-                    } else {
94
-                        $ermsg = 'GIF images are not supported';
95
-                    }
96
-                }
97
-                break;
98
-            case 'image/jpeg':
99
-                {
100
-                    if (@imagetypes() & IMG_JPG) {
101
-                        $oImage = @imagecreatefromjpeg($sourceFile) ;
102
-                    } else {
103
-                        $ermsg = 'JPEG images are not supported';
104
-                    }
105
-                }
106
-                break;
107
-            case 'image/png':
108
-                {
109
-                    if (@imagetypes() & IMG_PNG) {
110
-                        $oImage = @imagecreatefrompng($sourceFile) ;
111
-                    } else {
112
-                        $ermsg = 'PNG images are not supported';
113
-                    }
114
-                }
115
-                break;
116
-            case 'image/wbmp':
117
-                {
118
-                    if (@imagetypes() & IMG_WBMP) {
119
-                        $oImage = @imagecreatefromwbmp($sourceFile);
120
-                    } else {
121
-                        $ermsg = 'WBMP images are not supported';
122
-                    }
123
-                }
124
-                break;
125
-            default:
126
-                $ermsg = $sourceImageAttr['mime'].' images are not supported';
127
-                break;
128
-        }
87
+		switch ($sourceImageAttr['mime'])
88
+		{
89
+			case 'image/gif':
90
+				{
91
+					if (@imagetypes() & IMG_GIF) {
92
+						$oImage = @imagecreatefromgif($sourceFile);
93
+					} else {
94
+						$ermsg = 'GIF images are not supported';
95
+					}
96
+				}
97
+				break;
98
+			case 'image/jpeg':
99
+				{
100
+					if (@imagetypes() & IMG_JPG) {
101
+						$oImage = @imagecreatefromjpeg($sourceFile) ;
102
+					} else {
103
+						$ermsg = 'JPEG images are not supported';
104
+					}
105
+				}
106
+				break;
107
+			case 'image/png':
108
+				{
109
+					if (@imagetypes() & IMG_PNG) {
110
+						$oImage = @imagecreatefrompng($sourceFile) ;
111
+					} else {
112
+						$ermsg = 'PNG images are not supported';
113
+					}
114
+				}
115
+				break;
116
+			case 'image/wbmp':
117
+				{
118
+					if (@imagetypes() & IMG_WBMP) {
119
+						$oImage = @imagecreatefromwbmp($sourceFile);
120
+					} else {
121
+						$ermsg = 'WBMP images are not supported';
122
+					}
123
+				}
124
+				break;
125
+			default:
126
+				$ermsg = $sourceImageAttr['mime'].' images are not supported';
127
+				break;
128
+		}
129 129
 
130
-        if (isset($ermsg) || false === $oImage || false === $oWatermarkImage) {
131
-            return false;
132
-        }
130
+		if (isset($ermsg) || false === $oImage || false === $oWatermarkImage) {
131
+			return false;
132
+		}
133 133
 
134
-        $watermark_width = $watermarkImageAttr[0];
135
-        $watermark_height = $watermarkImageAttr[1];
136
-        $dest_x = $sourceImageAttr[0] - $watermark_width - $marginLeft;
137
-        $dest_y = $sourceImageAttr[1] - $watermark_height - $marginBottom;
134
+		$watermark_width = $watermarkImageAttr[0];
135
+		$watermark_height = $watermarkImageAttr[1];
136
+		$dest_x = $sourceImageAttr[0] - $watermark_width - $marginLeft;
137
+		$dest_y = $sourceImageAttr[1] - $watermark_height - $marginBottom;
138 138
 
139
-        if ( $sourceImageAttr['mime'] == 'image/png')
140
-        {
141
-            if(function_exists('imagesavealpha') && function_exists('imagecolorallocatealpha') )
142
-            {
143
-                 $bg = imagecolorallocatealpha($oImage, 255, 255, 255, 127); // (PHP 4 >= 4.3.2, PHP 5)
144
-                 imagefill($oImage, 0, 0 , $bg);
145
-                 imagealphablending($oImage, false);
146
-                 imagesavealpha($oImage, true);  // (PHP 4 >= 4.3.2, PHP 5)
147
-            }
148
-        }
149
-        if ($watermarkImageAttr['mime'] == 'image/png') {
150
-            imagecopy($oImage, $oWatermarkImage, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);
151
-        }
152
-        else {
153
-            imagecopymerge($oImage, $oWatermarkImage, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $transparency);
154
-        }
139
+		if ( $sourceImageAttr['mime'] == 'image/png')
140
+		{
141
+			if(function_exists('imagesavealpha') && function_exists('imagecolorallocatealpha') )
142
+			{
143
+				 $bg = imagecolorallocatealpha($oImage, 255, 255, 255, 127); // (PHP 4 >= 4.3.2, PHP 5)
144
+				 imagefill($oImage, 0, 0 , $bg);
145
+				 imagealphablending($oImage, false);
146
+				 imagesavealpha($oImage, true);  // (PHP 4 >= 4.3.2, PHP 5)
147
+			}
148
+		}
149
+		if ($watermarkImageAttr['mime'] == 'image/png') {
150
+			imagecopy($oImage, $oWatermarkImage, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);
151
+		}
152
+		else {
153
+			imagecopymerge($oImage, $oWatermarkImage, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $transparency);
154
+		}
155 155
 
156
-        switch ($sourceImageAttr['mime'])
157
-        {
158
-            case 'image/gif':
159
-                imagegif($oImage, $sourceFile);
160
-                break;
161
-            case 'image/jpeg':
162
-                imagejpeg($oImage, $sourceFile, $quality);
163
-                break;
164
-            case 'image/png':
165
-                imagepng($oImage, $sourceFile);
166
-                break;
167
-            case 'image/wbmp':
168
-                imagewbmp($oImage, $sourceFile);
169
-                break;
170
-        }
156
+		switch ($sourceImageAttr['mime'])
157
+		{
158
+			case 'image/gif':
159
+				imagegif($oImage, $sourceFile);
160
+				break;
161
+			case 'image/jpeg':
162
+				imagejpeg($oImage, $sourceFile, $quality);
163
+				break;
164
+			case 'image/png':
165
+				imagepng($oImage, $sourceFile);
166
+				break;
167
+			case 'image/wbmp':
168
+				imagewbmp($oImage, $sourceFile);
169
+				break;
170
+		}
171 171
 
172
-        imageDestroy($oImage);
173
-        imageDestroy($oWatermarkImage);
174
-    }
172
+		imageDestroy($oImage);
173
+		imageDestroy($oWatermarkImage);
174
+	}
175 175
 }
176 176
 
177 177
 $watermark = new Watermark();
178 178
 $config['Hooks']['AfterFileUpload'][] = array($watermark, 'onAfterFileUpload');
179 179
 if (empty($config['Plugin_Watermark']))
180 180
 {
181
-    $config['Plugin_Watermark'] = array(
182
-        "source" => "logo.gif",
183
-        "marginRight" => 5,
184
-        "marginBottom" => 5,
185
-        "quality" => 90,
186
-        "transparency" => 80,
187
-    );
181
+	$config['Plugin_Watermark'] = array(
182
+		"source" => "logo.gif",
183
+		"marginRight" => 5,
184
+		"marginBottom" => 5,
185
+		"quality" => 90,
186
+		"transparency" => 80,
187
+	);
188 188
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     function createWatermark($sourceFile, $watermarkFile, $marginLeft = 5, $marginBottom = 5, $quality = 90, $transparency = 100)
30 30
     {
31 31
         if (!file_exists($watermarkFile)) {
32
-            $watermarkFile = dirname(__FILE__) . "/" . $watermarkFile;
32
+            $watermarkFile = dirname(__FILE__)."/".$watermarkFile;
33 33
         }
34 34
         if (!file_exists($watermarkFile)) {
35 35
             return false;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             case 'image/jpeg':
56 56
                 {
57 57
                     if (@imagetypes() & IMG_JPG) {
58
-                        $oWatermarkImage = @imagecreatefromjpeg($watermarkFile) ;
58
+                        $oWatermarkImage = @imagecreatefromjpeg($watermarkFile);
59 59
                     } else {
60 60
                         $ermsg = 'JPEG images are not supported';
61 61
                     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             case 'image/png':
65 65
                 {
66 66
                     if (@imagetypes() & IMG_PNG) {
67
-                        $oWatermarkImage = @imagecreatefrompng($watermarkFile) ;
67
+                        $oWatermarkImage = @imagecreatefrompng($watermarkFile);
68 68
                     } else {
69 69
                         $ermsg = 'PNG images are not supported';
70 70
                     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             case 'image/jpeg':
99 99
                 {
100 100
                     if (@imagetypes() & IMG_JPG) {
101
-                        $oImage = @imagecreatefromjpeg($sourceFile) ;
101
+                        $oImage = @imagecreatefromjpeg($sourceFile);
102 102
                     } else {
103 103
                         $ermsg = 'JPEG images are not supported';
104 104
                     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             case 'image/png':
108 108
                 {
109 109
                     if (@imagetypes() & IMG_PNG) {
110
-                        $oImage = @imagecreatefrompng($sourceFile) ;
110
+                        $oImage = @imagecreatefrompng($sourceFile);
111 111
                     } else {
112 112
                         $ermsg = 'PNG images are not supported';
113 113
                     }
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
         $dest_x = $sourceImageAttr[0] - $watermark_width - $marginLeft;
137 137
         $dest_y = $sourceImageAttr[1] - $watermark_height - $marginBottom;
138 138
 
139
-        if ( $sourceImageAttr['mime'] == 'image/png')
139
+        if ($sourceImageAttr['mime'] == 'image/png')
140 140
         {
141
-            if(function_exists('imagesavealpha') && function_exists('imagecolorallocatealpha') )
141
+            if (function_exists('imagesavealpha') && function_exists('imagecolorallocatealpha'))
142 142
             {
143 143
                  $bg = imagecolorallocatealpha($oImage, 255, 255, 255, 127); // (PHP 4 >= 4.3.2, PHP 5)
144
-                 imagefill($oImage, 0, 0 , $bg);
144
+                 imagefill($oImage, 0, 0, $bg);
145 145
                  imagealphablending($oImage, false);
146
-                 imagesavealpha($oImage, true);  // (PHP 4 >= 4.3.2, PHP 5)
146
+                 imagesavealpha($oImage, true); // (PHP 4 >= 4.3.2, PHP 5)
147 147
             }
148 148
         }
149 149
         if ($watermarkImageAttr['mime'] == 'image/png') {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -148,8 +148,7 @@
 block discarded – undo
148 148
         }
149 149
         if ($watermarkImageAttr['mime'] == 'image/png') {
150 150
             imagecopy($oImage, $oWatermarkImage, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);
151
-        }
152
-        else {
151
+        } else {
153 152
             imagecopymerge($oImage, $oWatermarkImage, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $transparency);
154 153
         }
155 154
 
Please login to merge, or discard this patch.
libs/ckfinder/plugins/fileeditor/plugin.php 3 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -21,79 +21,79 @@
 block discarded – undo
21 21
 
22 22
 class CKFinder_Connector_CommandHandler_FileEditor extends CKFinder_Connector_CommandHandler_XmlCommandHandlerBase
23 23
 {
24
-    /**
25
-     * handle request and build XML
26
-     * @access protected
27
-     */
28
-    function buildXml()
29
-    {
30
-        if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
31
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
32
-        }
24
+	/**
25
+	 * handle request and build XML
26
+	 * @access protected
27
+	 */
28
+	function buildXml()
29
+	{
30
+		if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
31
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
32
+		}
33 33
 
34
-        $this->checkConnector();
35
-        $this->checkRequest();
34
+		$this->checkConnector();
35
+		$this->checkRequest();
36 36
 
37
-        // Saving empty file is equal to deleting a file, that's why FILE_DELETE permissions are required
38
-        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
39
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
40
-        }
37
+		// Saving empty file is equal to deleting a file, that's why FILE_DELETE permissions are required
38
+		if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
39
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
40
+		}
41 41
 
42
-        if (!isset($_POST["fileName"])) {
43
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
44
-        }
45
-        if (!isset($_POST["content"])) {
46
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
47
-        }
42
+		if (!isset($_POST["fileName"])) {
43
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
44
+		}
45
+		if (!isset($_POST["content"])) {
46
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
47
+		}
48 48
 
49
-        $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]);
50
-        $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
49
+		$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]);
50
+		$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
51 51
 
52
-        if (!$resourceTypeInfo->checkExtension($fileName)) {
53
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
54
-        }
52
+		if (!$resourceTypeInfo->checkExtension($fileName)) {
53
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
54
+		}
55 55
 
56
-        if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
57
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
58
-        }
56
+		if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
57
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
58
+		}
59 59
 
60
-        $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
60
+		$filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
61 61
 
62
-        if (!file_exists($filePath) || !is_file($filePath)) {
63
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
64
-        }
62
+		if (!file_exists($filePath) || !is_file($filePath)) {
63
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
64
+		}
65 65
 
66
-        if (!is_writable(dirname($filePath))) {
67
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
68
-        }
66
+		if (!is_writable(dirname($filePath))) {
67
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
68
+		}
69 69
 
70
-        $fp = @fopen($filePath, 'wb');
71
-        if ($fp === false || !flock($fp, LOCK_EX)) {
72
-            $result = false;
73
-        }
74
-        else {
75
-            $result = fwrite($fp, $_POST["content"]);
76
-            flock($fp, LOCK_UN);
77
-            fclose($fp);
78
-        }
79
-        if ($result === false) {
80
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
81
-        }
82
-    }
70
+		$fp = @fopen($filePath, 'wb');
71
+		if ($fp === false || !flock($fp, LOCK_EX)) {
72
+			$result = false;
73
+		}
74
+		else {
75
+			$result = fwrite($fp, $_POST["content"]);
76
+			flock($fp, LOCK_UN);
77
+			fclose($fp);
78
+		}
79
+		if ($result === false) {
80
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
81
+		}
82
+	}
83 83
 
84
-    /**
85
-     * @access public
86
-     */
87
-    function onBeforeExecuteCommand( &$command )
88
-    {
89
-        if ( $command == 'SaveFile' )
90
-        {
91
-            $this->sendResponse();
92
-            return false;
93
-        }
84
+	/**
85
+	 * @access public
86
+	 */
87
+	function onBeforeExecuteCommand( &$command )
88
+	{
89
+		if ( $command == 'SaveFile' )
90
+		{
91
+			$this->sendResponse();
92
+			return false;
93
+		}
94 94
 
95
-        return true ;
96
-    }
95
+		return true ;
96
+	}
97 97
 }
98 98
 
99 99
 $CommandHandler_FileEditor = new CKFinder_Connector_CommandHandler_FileEditor();
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * Include base XML command handler
19 19
  */
20
-require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/XmlCommandHandlerBase.php";
20
+require_once CKFINDER_CONNECTOR_LIB_DIR."/CommandHandler/XmlCommandHandlerBase.php";
21 21
 
22 22
 class CKFinder_Connector_CommandHandler_FileEditor extends CKFinder_Connector_CommandHandler_XmlCommandHandlerBase
23 23
 {
@@ -84,15 +84,15 @@  discard block
 block discarded – undo
84 84
     /**
85 85
      * @access public
86 86
      */
87
-    function onBeforeExecuteCommand( &$command )
87
+    function onBeforeExecuteCommand(&$command)
88 88
     {
89
-        if ( $command == 'SaveFile' )
89
+        if ($command == 'SaveFile')
90 90
         {
91 91
             $this->sendResponse();
92 92
             return false;
93 93
         }
94 94
 
95
-        return true ;
95
+        return true;
96 96
     }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 *
13 13
 * CKFinder extension: prodives command that saves edited file.
14 14
 */
15
-if (!defined('IN_CKFINDER')) exit;
15
+if (!defined('IN_CKFINDER')) {
16
+	exit;
17
+}
16 18
 
17 19
 /**
18 20
  * Include base XML command handler
@@ -70,8 +72,7 @@  discard block
 block discarded – undo
70 72
         $fp = @fopen($filePath, 'wb');
71 73
         if ($fp === false || !flock($fp, LOCK_EX)) {
72 74
             $result = false;
73
-        }
74
-        else {
75
+        } else {
75 76
             $result = fwrite($fp, $_POST["content"]);
76 77
             flock($fp, LOCK_UN);
77 78
             fclose($fp);
Please login to merge, or discard this patch.
libs/ckfinder/plugins/imageresize/plugin.php 3 patches
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -21,221 +21,221 @@
 block discarded – undo
21 21
 
22 22
 class CKFinder_Connector_CommandHandler_ImageResize extends CKFinder_Connector_CommandHandler_XmlCommandHandlerBase
23 23
 {
24
-    /**
25
-     * @access private
26
-     */
27
-    function getConfig()
28
-    {
29
-        $config = array();
30
-        if (isset($GLOBALS['config']['plugin_imageresize'])) {
31
-            $config = $GLOBALS['config']['plugin_imageresize'];
32
-        }
33
-        if (!isset($config['smallThumb'])) {
34
-            $config['smallThumb'] = "90x90";
35
-        }
36
-        if (!isset($config['mediumThumb'])) {
37
-            $config['mediumThumb'] = "120x120";
38
-        }
39
-        if (!isset($config['largeThumb'])) {
40
-            $config['largeThumb'] = "180x180";
41
-        }
42
-        return $config;
43
-    }
44
-
45
-    /**
46
-     * handle request and build XML
47
-     * @access protected
48
-     *
49
-     */
50
-    function buildXml()
51
-    {
52
-        if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
53
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
54
-        }
55
-
56
-        $this->checkConnector();
57
-        $this->checkRequest();
58
-
59
-        //resizing to 1x1 is almost equal to deleting a file, that's why FILE_DELETE permissions are required
60
-        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE) || !$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD)) {
61
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
62
-        }
63
-
64
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
65
-        $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
66
-
67
-        if (!isset($_POST["fileName"])) {
68
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
69
-        }
70
-
71
-        $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]);
72
-
73
-        if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
74
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
75
-        }
76
-
77
-        if (!$resourceTypeInfo->checkExtension($fileName, false)) {
78
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
79
-        }
80
-
81
-        $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
82
-
83
-        if (!file_exists($filePath) || !is_file($filePath)) {
84
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
85
-        }
86
-
87
-        $newWidth = trim($_POST['width']);
88
-        $newHeight = trim($_POST['height']);
89
-        $quality = 80;
90
-        $resizeOriginal = !empty($_POST['width']) && !empty($_POST['height']);
91
-
92
-        if ($resizeOriginal) {
93
-            if (!preg_match("/^\d+$/", $newWidth) || !preg_match("/^\d+$/", $newHeight) || !preg_match("/^\d+$/", $newWidth)) {
94
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
95
-            }
96
-            if (!isset($_POST["newFileName"])) {
97
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
98
-            }
99
-            $newFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["newFileName"]);
100
-            if (!$resourceTypeInfo->checkExtension($newFileName)) {
101
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
102
-            }
103
-            if (!CKFinder_Connector_Utils_FileSystem::checkFileName($newFileName) || $resourceTypeInfo->checkIsHiddenFile($newFileName)) {
104
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
105
-            }
106
-            $newFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $newFileName);
107
-            if (!is_writable(dirname($newFilePath))) {
108
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
109
-            }
110
-            if ($_POST['overwrite'] != "1" && file_exists($newFilePath)) {
111
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
112
-            }
113
-            $_imagesConfig = $_config->getImagesConfig();
114
-            $maxWidth = $_imagesConfig->getMaxWidth();
115
-            $maxHeight = $_imagesConfig->getMaxHeight();
116
-            // Shouldn't happen as the JavaScript validation should not allow this.
117
-            if ( ( $maxWidth > 0 && $newWidth > $maxWidth ) || ( $maxHeight > 0 && $newHeight > $maxHeight ) ) {
118
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
119
-            }
120
-        }
121
-
122
-        require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/Thumbnail.php";
123
-
124
-        if ($resizeOriginal) {
125
-            $result = CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $newWidth, $newHeight, $quality, false) ;
126
-            if (!$result) {
127
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
128
-            }
129
-        }
130
-
131
-        $config = $this->getConfig();
132
-        $nameWithoutExt = preg_replace("/^(.+)\_\d+x\d+$/", "$1", CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($fileName));
133
-        $extension = CKFinder_Connector_Utils_FileSystem::getExtension($fileName);
134
-        foreach (array('small', 'medium', 'large') as $size) {
135
-            if (!empty($_POST[$size]) && $_POST[$size] == '1') {
136
-                $thumbName = $nameWithoutExt."_".$size.".".$extension;
137
-                $newFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $thumbName);
138
-                if (!empty($config[$size.'Thumb'])) {
139
-                    if (preg_match("/^(\d+)x(\d+)$/", $config[$size.'Thumb'], $matches)) {
140
-                        CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $matches[1], $matches[2], $quality, true) ;
141
-                    }
142
-                }
143
-            }
144
-        }
145
-
146
-    }
147
-
148
-    /**
149
-     * @access public
150
-     */
151
-    function onInitCommand( &$connectorNode )
152
-    {
153
-        // "@" protects against E_STRICT (Only variables should be assigned by reference)
154
-        @$pluginsInfo = &$connectorNode->getChild("PluginsInfo");
155
-        $imageresize = new CKFinder_Connector_Utils_XmlNode("imageresize");
156
-        $pluginsInfo->addChild($imageresize);
157
-        $config = $this->getConfig();
158
-        foreach (array('small', 'medium', 'large') as $size) {
159
-            if (!empty($config[$size.'Thumb'])) {
160
-                $imageresize->addAttribute($size.'Thumb', $config[$size.'Thumb']);
161
-            }
162
-        }
163
-        return true ;
164
-    }
165
-
166
-    /**
167
-     * @access public
168
-     */
169
-    function onBeforeExecuteCommand( &$command )
170
-    {
171
-        if ( $command == 'ImageResize' )
172
-        {
173
-            $this->sendResponse();
174
-            return false;
175
-        }
176
-
177
-        return true ;
178
-    }
24
+	/**
25
+	 * @access private
26
+	 */
27
+	function getConfig()
28
+	{
29
+		$config = array();
30
+		if (isset($GLOBALS['config']['plugin_imageresize'])) {
31
+			$config = $GLOBALS['config']['plugin_imageresize'];
32
+		}
33
+		if (!isset($config['smallThumb'])) {
34
+			$config['smallThumb'] = "90x90";
35
+		}
36
+		if (!isset($config['mediumThumb'])) {
37
+			$config['mediumThumb'] = "120x120";
38
+		}
39
+		if (!isset($config['largeThumb'])) {
40
+			$config['largeThumb'] = "180x180";
41
+		}
42
+		return $config;
43
+	}
44
+
45
+	/**
46
+	 * handle request and build XML
47
+	 * @access protected
48
+	 *
49
+	 */
50
+	function buildXml()
51
+	{
52
+		if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
53
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
54
+		}
55
+
56
+		$this->checkConnector();
57
+		$this->checkRequest();
58
+
59
+		//resizing to 1x1 is almost equal to deleting a file, that's why FILE_DELETE permissions are required
60
+		if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE) || !$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD)) {
61
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
62
+		}
63
+
64
+		$_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
65
+		$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
66
+
67
+		if (!isset($_POST["fileName"])) {
68
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
69
+		}
70
+
71
+		$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]);
72
+
73
+		if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
74
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
75
+		}
76
+
77
+		if (!$resourceTypeInfo->checkExtension($fileName, false)) {
78
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
79
+		}
80
+
81
+		$filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
82
+
83
+		if (!file_exists($filePath) || !is_file($filePath)) {
84
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
85
+		}
86
+
87
+		$newWidth = trim($_POST['width']);
88
+		$newHeight = trim($_POST['height']);
89
+		$quality = 80;
90
+		$resizeOriginal = !empty($_POST['width']) && !empty($_POST['height']);
91
+
92
+		if ($resizeOriginal) {
93
+			if (!preg_match("/^\d+$/", $newWidth) || !preg_match("/^\d+$/", $newHeight) || !preg_match("/^\d+$/", $newWidth)) {
94
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
95
+			}
96
+			if (!isset($_POST["newFileName"])) {
97
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
98
+			}
99
+			$newFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["newFileName"]);
100
+			if (!$resourceTypeInfo->checkExtension($newFileName)) {
101
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
102
+			}
103
+			if (!CKFinder_Connector_Utils_FileSystem::checkFileName($newFileName) || $resourceTypeInfo->checkIsHiddenFile($newFileName)) {
104
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
105
+			}
106
+			$newFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $newFileName);
107
+			if (!is_writable(dirname($newFilePath))) {
108
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
109
+			}
110
+			if ($_POST['overwrite'] != "1" && file_exists($newFilePath)) {
111
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
112
+			}
113
+			$_imagesConfig = $_config->getImagesConfig();
114
+			$maxWidth = $_imagesConfig->getMaxWidth();
115
+			$maxHeight = $_imagesConfig->getMaxHeight();
116
+			// Shouldn't happen as the JavaScript validation should not allow this.
117
+			if ( ( $maxWidth > 0 && $newWidth > $maxWidth ) || ( $maxHeight > 0 && $newHeight > $maxHeight ) ) {
118
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
119
+			}
120
+		}
121
+
122
+		require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/Thumbnail.php";
123
+
124
+		if ($resizeOriginal) {
125
+			$result = CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $newWidth, $newHeight, $quality, false) ;
126
+			if (!$result) {
127
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
128
+			}
129
+		}
130
+
131
+		$config = $this->getConfig();
132
+		$nameWithoutExt = preg_replace("/^(.+)\_\d+x\d+$/", "$1", CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($fileName));
133
+		$extension = CKFinder_Connector_Utils_FileSystem::getExtension($fileName);
134
+		foreach (array('small', 'medium', 'large') as $size) {
135
+			if (!empty($_POST[$size]) && $_POST[$size] == '1') {
136
+				$thumbName = $nameWithoutExt."_".$size.".".$extension;
137
+				$newFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $thumbName);
138
+				if (!empty($config[$size.'Thumb'])) {
139
+					if (preg_match("/^(\d+)x(\d+)$/", $config[$size.'Thumb'], $matches)) {
140
+						CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $matches[1], $matches[2], $quality, true) ;
141
+					}
142
+				}
143
+			}
144
+		}
145
+
146
+	}
147
+
148
+	/**
149
+	 * @access public
150
+	 */
151
+	function onInitCommand( &$connectorNode )
152
+	{
153
+		// "@" protects against E_STRICT (Only variables should be assigned by reference)
154
+		@$pluginsInfo = &$connectorNode->getChild("PluginsInfo");
155
+		$imageresize = new CKFinder_Connector_Utils_XmlNode("imageresize");
156
+		$pluginsInfo->addChild($imageresize);
157
+		$config = $this->getConfig();
158
+		foreach (array('small', 'medium', 'large') as $size) {
159
+			if (!empty($config[$size.'Thumb'])) {
160
+				$imageresize->addAttribute($size.'Thumb', $config[$size.'Thumb']);
161
+			}
162
+		}
163
+		return true ;
164
+	}
165
+
166
+	/**
167
+	 * @access public
168
+	 */
169
+	function onBeforeExecuteCommand( &$command )
170
+	{
171
+		if ( $command == 'ImageResize' )
172
+		{
173
+			$this->sendResponse();
174
+			return false;
175
+		}
176
+
177
+		return true ;
178
+	}
179 179
 }
180 180
 
181 181
 class CKFinder_Connector_CommandHandler_ImageResizeInfo extends CKFinder_Connector_CommandHandler_XmlCommandHandlerBase
182 182
 {
183
-    /**
184
-     * handle request and build XML
185
-     * @access protected
186
-     *
187
-     */
188
-    function buildXml()
189
-    {
190
-        $this->checkConnector();
191
-        $this->checkRequest();
192
-
193
-        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
194
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
195
-        }
196
-
197
-        $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
198
-
199
-        if (!isset($_GET["fileName"])) {
200
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
201
-        }
202
-
203
-        $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
204
-
205
-        if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
206
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
207
-        }
208
-
209
-        if (!$resourceTypeInfo->checkExtension($fileName, false)) {
210
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
211
-        }
212
-
213
-        $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
214
-
215
-        if (!file_exists($filePath) || !is_file($filePath)) {
216
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
217
-        }
218
-
219
-        list($width, $height) = getimagesize($filePath);
220
-        $oNode = new Ckfinder_Connector_Utils_XmlNode("ImageInfo");
221
-        $oNode->addAttribute("width", $width);
222
-        $oNode->addAttribute("height", $height);
223
-        $this->_connectorNode->addChild($oNode);
224
-    }
225
-
226
-    /**
227
-     * @access public
228
-     */
229
-    function onBeforeExecuteCommand( &$command )
230
-    {
231
-        if ( $command == 'ImageResizeInfo' )
232
-        {
233
-            $this->sendResponse();
234
-            return false;
235
-        }
236
-
237
-        return true ;
238
-    }
183
+	/**
184
+	 * handle request and build XML
185
+	 * @access protected
186
+	 *
187
+	 */
188
+	function buildXml()
189
+	{
190
+		$this->checkConnector();
191
+		$this->checkRequest();
192
+
193
+		if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
194
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
195
+		}
196
+
197
+		$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
198
+
199
+		if (!isset($_GET["fileName"])) {
200
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
201
+		}
202
+
203
+		$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
204
+
205
+		if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
206
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
207
+		}
208
+
209
+		if (!$resourceTypeInfo->checkExtension($fileName, false)) {
210
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
211
+		}
212
+
213
+		$filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
214
+
215
+		if (!file_exists($filePath) || !is_file($filePath)) {
216
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
217
+		}
218
+
219
+		list($width, $height) = getimagesize($filePath);
220
+		$oNode = new Ckfinder_Connector_Utils_XmlNode("ImageInfo");
221
+		$oNode->addAttribute("width", $width);
222
+		$oNode->addAttribute("height", $height);
223
+		$this->_connectorNode->addChild($oNode);
224
+	}
225
+
226
+	/**
227
+	 * @access public
228
+	 */
229
+	function onBeforeExecuteCommand( &$command )
230
+	{
231
+		if ( $command == 'ImageResizeInfo' )
232
+		{
233
+			$this->sendResponse();
234
+			return false;
235
+		}
236
+
237
+		return true ;
238
+	}
239 239
 }
240 240
 
241 241
 if (function_exists('imagecreate')) {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * Include base XML command handler
19 19
  */
20
-require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/XmlCommandHandlerBase.php";
20
+require_once CKFINDER_CONNECTOR_LIB_DIR."/CommandHandler/XmlCommandHandlerBase.php";
21 21
 
22 22
 class CKFinder_Connector_CommandHandler_ImageResize extends CKFinder_Connector_CommandHandler_XmlCommandHandlerBase
23 23
 {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
62 62
         }
63 63
 
64
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
64
+        $_config = & CKFinder_Connector_Core_Factory::getInstance("Core_Config");
65 65
         $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
66 66
 
67 67
         if (!isset($_POST["fileName"])) {
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
             $maxWidth = $_imagesConfig->getMaxWidth();
115 115
             $maxHeight = $_imagesConfig->getMaxHeight();
116 116
             // Shouldn't happen as the JavaScript validation should not allow this.
117
-            if ( ( $maxWidth > 0 && $newWidth > $maxWidth ) || ( $maxHeight > 0 && $newHeight > $maxHeight ) ) {
117
+            if (($maxWidth > 0 && $newWidth > $maxWidth) || ($maxHeight > 0 && $newHeight > $maxHeight)) {
118 118
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
119 119
             }
120 120
         }
121 121
 
122
-        require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/Thumbnail.php";
122
+        require_once CKFINDER_CONNECTOR_LIB_DIR."/CommandHandler/Thumbnail.php";
123 123
 
124 124
         if ($resizeOriginal) {
125
-            $result = CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $newWidth, $newHeight, $quality, false) ;
125
+            $result = CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $newWidth, $newHeight, $quality, false);
126 126
             if (!$result) {
127 127
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
128 128
             }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 $newFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $thumbName);
138 138
                 if (!empty($config[$size.'Thumb'])) {
139 139
                     if (preg_match("/^(\d+)x(\d+)$/", $config[$size.'Thumb'], $matches)) {
140
-                        CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $matches[1], $matches[2], $quality, true) ;
140
+                        CKFinder_Connector_CommandHandler_Thumbnail::createThumb($filePath, $newFilePath, $matches[1], $matches[2], $quality, true);
141 141
                     }
142 142
                 }
143 143
             }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     /**
149 149
      * @access public
150 150
      */
151
-    function onInitCommand( &$connectorNode )
151
+    function onInitCommand(&$connectorNode)
152 152
     {
153 153
         // "@" protects against E_STRICT (Only variables should be assigned by reference)
154 154
         @$pluginsInfo = &$connectorNode->getChild("PluginsInfo");
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
                 $imageresize->addAttribute($size.'Thumb', $config[$size.'Thumb']);
161 161
             }
162 162
         }
163
-        return true ;
163
+        return true;
164 164
     }
165 165
 
166 166
     /**
167 167
      * @access public
168 168
      */
169
-    function onBeforeExecuteCommand( &$command )
169
+    function onBeforeExecuteCommand(&$command)
170 170
     {
171
-        if ( $command == 'ImageResize' )
171
+        if ($command == 'ImageResize')
172 172
         {
173 173
             $this->sendResponse();
174 174
             return false;
175 175
         }
176 176
 
177
-        return true ;
177
+        return true;
178 178
     }
179 179
 }
180 180
 
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
     /**
227 227
      * @access public
228 228
      */
229
-    function onBeforeExecuteCommand( &$command )
229
+    function onBeforeExecuteCommand(&$command)
230 230
     {
231
-        if ( $command == 'ImageResizeInfo' )
231
+        if ($command == 'ImageResizeInfo')
232 232
         {
233 233
             $this->sendResponse();
234 234
             return false;
235 235
         }
236 236
 
237
-        return true ;
237
+        return true;
238 238
     }
239 239
 }
240 240
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
 *
13 13
 * CKFinder extension: resize image according to a given size
14 14
 */
15
-if (!defined('IN_CKFINDER')) exit;
15
+if (!defined('IN_CKFINDER')) {
16
+	exit;
17
+}
16 18
 
17 19
 /**
18 20
  * Include base XML command handler
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/lang/da.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 //  Defines the object, for the Danish language. This is the base file for all translations.
6 6
 
7
-$GLOBALS['CKFLang'] = array (
7
+$GLOBALS['CKFLang'] = array(
8 8
 	'ErrorUnknown' => 'Det var ikke muligt at fuldføre handlingen. (Fejl: %1)',
9
-	'Errors' => array (
9
+	'Errors' => array(
10 10
 		'10' => 'Ugyldig handling.',
11 11
 		'11' => 'Ressourcetypen blev ikke angivet i anmodningen.',
12 12
 		'12' => 'Ressourcetypen er ikke gyldig.',
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/lang/sl.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 //  Defines the object, for the Slovenian language. This is the base file for all translations.
6 6
 
7
-$GLOBALS['CKFLang'] = array (
7
+$GLOBALS['CKFLang'] = array(
8 8
 	'ErrorUnknown' => 'Prišlo je do napake. (Napaka %1)',
9
-	'Errors' => array (
9
+	'Errors' => array(
10 10
 		'10' => 'Napačen ukaz.',
11 11
 		'11' => 'V poizvedbi ni bil jasen tip (resource type).',
12 12
 		'12' => 'Tip datoteke ni primeren.',
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/lang/hu.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 //
6 6
 
7
-$GLOBALS['CKFLang'] = array (
7
+$GLOBALS['CKFLang'] = array(
8 8
 	'ErrorUnknown' => 'A parancsot nem sikerült végrehajtani. (Hiba: %1)',
9
-	'Errors' => array (
9
+	'Errors' => array(
10 10
 		'10' => 'Érvénytelen parancs.',
11 11
 		'11' => 'A fájl típusa nem lett a kérés során beállítva.',
12 12
 		'12' => 'A kívánt fájl típus érvénytelen.',
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/lang/en.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 //  Defines the object, for the English language. This is the base file for all translations.
6 6
 
7
-$GLOBALS['CKFLang'] = array (
7
+$GLOBALS['CKFLang'] = array(
8 8
 	'ErrorUnknown' => 'It was not possible to complete the request. (Error %1)',
9
-	'Errors' => array (
9
+	'Errors' => array(
10 10
 		'10' => 'Invalid command.',
11 11
 		'11' => 'The resource type was not specified in the request.',
12 12
 		'12' => 'The requested resource type is not valid.',
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/lang/es.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 //  Defines the object, for the Spanish language. This is the base file for all translations.
6 6
 
7
-$GLOBALS['CKFLang'] = array (
7
+$GLOBALS['CKFLang'] = array(
8 8
 	'ErrorUnknown' => 'No ha sido posible completar la solicitud. (Error %1)',
9
-	'Errors' => array (
9
+	'Errors' => array(
10 10
 		'10' => 'Comando incorrecto.',
11 11
 		'11' => 'El tipo de recurso no ha sido especificado en la solicitud.',
12 12
 		'12' => 'El tipo de recurso solicitado no es válido.',
Please login to merge, or discard this patch.