Passed
Branch master (ef3387)
by Anthony
09:36
created
libs/ckfinder/core/connector/php/php4/Core/Factory.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -27,41 +27,41 @@
 block discarded – undo
27 27
  */
28 28
 class CKFinder_Connector_Core_Factory
29 29
 {
30
-    /**
31
-     * Initiate factory
32
-     * @static
33
-     */
34
-    function initFactory()
35
-    {
36
-        $GLOBALS['CKFinder_Connector_Factory']=array();
37
-    }
30
+	/**
31
+	 * Initiate factory
32
+	 * @static
33
+	 */
34
+	function initFactory()
35
+	{
36
+		$GLOBALS['CKFinder_Connector_Factory']=array();
37
+	}
38 38
 
39
-    /**
40
-     * Get instance of specified class
41
-     * Short and Long class names are possible
42
-     * <code>
43
-     * $obj1 =& CKFinder_Connector_Core_Factory::getInstance("Ckfinder_Connector_Core_Xml");
44
-     * $obj2 =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
45
-     * </code>
46
-     *
47
-     * @param string $className class name
48
-     * @static
49
-     * @access public
50
-     * @return object
51
-     */
52
-    function &getInstance($className)
53
-    {
54
-        $namespace = "CKFinder_Connector_";
39
+	/**
40
+	 * Get instance of specified class
41
+	 * Short and Long class names are possible
42
+	 * <code>
43
+	 * $obj1 =& CKFinder_Connector_Core_Factory::getInstance("Ckfinder_Connector_Core_Xml");
44
+	 * $obj2 =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
45
+	 * </code>
46
+	 *
47
+	 * @param string $className class name
48
+	 * @static
49
+	 * @access public
50
+	 * @return object
51
+	 */
52
+	function &getInstance($className)
53
+	{
54
+		$namespace = "CKFinder_Connector_";
55 55
 
56
-        $baseName = str_replace($namespace,"",$className);
56
+		$baseName = str_replace($namespace,"",$className);
57 57
 
58
-        $className = $namespace.$baseName;
58
+		$className = $namespace.$baseName;
59 59
 
60
-        if (!isset($GLOBALS['CKFinder_Connector_Factory'][$className])) {
61
-            require_once CKFINDER_CONNECTOR_LIB_DIR . "/" . str_replace("_","/",$baseName).".php";
62
-            $GLOBALS['CKFinder_Connector_Factory'][$className] =& new $className;
63
-        }
60
+		if (!isset($GLOBALS['CKFinder_Connector_Factory'][$className])) {
61
+			require_once CKFINDER_CONNECTOR_LIB_DIR . "/" . str_replace("_","/",$baseName).".php";
62
+			$GLOBALS['CKFinder_Connector_Factory'][$className] =& new $className;
63
+		}
64 64
 
65
-        return $GLOBALS['CKFinder_Connector_Factory'][$className];
66
-    }
65
+		return $GLOBALS['CKFinder_Connector_Factory'][$className];
66
+	}
67 67
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     function initFactory()
35 35
     {
36
-        $GLOBALS['CKFinder_Connector_Factory']=array();
36
+        $GLOBALS['CKFinder_Connector_Factory'] = array();
37 37
     }
38 38
 
39 39
     /**
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $namespace = "CKFinder_Connector_";
55 55
 
56
-        $baseName = str_replace($namespace,"",$className);
56
+        $baseName = str_replace($namespace, "", $className);
57 57
 
58 58
         $className = $namespace.$baseName;
59 59
 
60 60
         if (!isset($GLOBALS['CKFinder_Connector_Factory'][$className])) {
61
-            require_once CKFINDER_CONNECTOR_LIB_DIR . "/" . str_replace("_","/",$baseName).".php";
62
-            $GLOBALS['CKFinder_Connector_Factory'][$className] =& new $className;
61
+            require_once CKFINDER_CONNECTOR_LIB_DIR."/".str_replace("_", "/", $baseName).".php";
62
+            $GLOBALS['CKFinder_Connector_Factory'][$className] = & new $className;
63 63
         }
64 64
 
65 65
         return $GLOBALS['CKFinder_Connector_Factory'][$className];
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  * modifying or distribute this file or part of its contents. The contents of
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/php4/Core/Xml.php 3 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -32,99 +32,99 @@
 block discarded – undo
32 32
  */
33 33
 class CKFinder_Connector_Core_Xml
34 34
 {
35
-    /**
36
-     * Connector node (root)
37
-     *
38
-     * @var Ckfinder_Connector_Utils_XmlNode
39
-     * @access private
40
-     */
41
-    var $_connectorNode;
42
-    /**
43
-     * Error node
44
-     *
45
-     * @var Ckfinder_Connector_Utils_XmlNode
46
-     * @access private
47
-     */
48
-    var $_errorNode;
35
+	/**
36
+	 * Connector node (root)
37
+	 *
38
+	 * @var Ckfinder_Connector_Utils_XmlNode
39
+	 * @access private
40
+	 */
41
+	var $_connectorNode;
42
+	/**
43
+	 * Error node
44
+	 *
45
+	 * @var Ckfinder_Connector_Utils_XmlNode
46
+	 * @access private
47
+	 */
48
+	var $_errorNode;
49 49
 
50
-    function CKFinder_Connector_Core_Xml()
51
-    {
52
-        $this->sendXmlHeaders();
53
-        echo $this->getXMLDeclaration();
54
-        $this->_connectorNode = new Ckfinder_Connector_Utils_XmlNode("Connector");
55
-        $this->_errorNode = new Ckfinder_Connector_Utils_XmlNode("Error");
56
-        $this->_connectorNode->addChild($this->_errorNode);
57
-    }
50
+	function CKFinder_Connector_Core_Xml()
51
+	{
52
+		$this->sendXmlHeaders();
53
+		echo $this->getXMLDeclaration();
54
+		$this->_connectorNode = new Ckfinder_Connector_Utils_XmlNode("Connector");
55
+		$this->_errorNode = new Ckfinder_Connector_Utils_XmlNode("Error");
56
+		$this->_connectorNode->addChild($this->_errorNode);
57
+	}
58 58
 
59
-    /**
60
-     * Return connector node
61
-     *
62
-     * @access public
63
-     * @return Ckfinder_Connector_Utils_XmlNode
64
-     */
65
-    function &getConnectorNode()
66
-    {
67
-    	return $this->_connectorNode;
68
-    }
59
+	/**
60
+	 * Return connector node
61
+	 *
62
+	 * @access public
63
+	 * @return Ckfinder_Connector_Utils_XmlNode
64
+	 */
65
+	function &getConnectorNode()
66
+	{
67
+		return $this->_connectorNode;
68
+	}
69 69
 
70
-    /**
71
-     * Return error node
72
-     *
73
-     * @access public
74
-     * @return Ckfinder_Connector_Utils_XmlNode
75
-     */
76
-    function &getErrorNode()
77
-    {
78
-    	return $this->_errorNode;
79
-    }
70
+	/**
71
+	 * Return error node
72
+	 *
73
+	 * @access public
74
+	 * @return Ckfinder_Connector_Utils_XmlNode
75
+	 */
76
+	function &getErrorNode()
77
+	{
78
+		return $this->_errorNode;
79
+	}
80 80
 
81
-    /**
82
-     * Send XML headers to the browser (and force browser not to use cache)
83
-     * @access private
84
-     */
85
-    function sendXmlHeaders()
86
-    {
87
-        // Prevent the browser from caching the result.
88
-        // Date in the past
89
-        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
90
-        // always modified
91
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
92
-        // HTTP/1.1
93
-        header('Cache-Control: no-store, no-cache, must-revalidate') ;
94
-        header('Cache-Control: post-check=0, pre-check=0', false) ;
95
-        // HTTP/1.0
96
-        header('Pragma: no-cache') ;
81
+	/**
82
+	 * Send XML headers to the browser (and force browser not to use cache)
83
+	 * @access private
84
+	 */
85
+	function sendXmlHeaders()
86
+	{
87
+		// Prevent the browser from caching the result.
88
+		// Date in the past
89
+		header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
90
+		// always modified
91
+		header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
92
+		// HTTP/1.1
93
+		header('Cache-Control: no-store, no-cache, must-revalidate') ;
94
+		header('Cache-Control: post-check=0, pre-check=0', false) ;
95
+		// HTTP/1.0
96
+		header('Pragma: no-cache') ;
97 97
 
98
-        // Set the response format.
99
-        header( 'Content-Type:text/xml; charset=utf-8' ) ;
100
-    }
98
+		// Set the response format.
99
+		header( 'Content-Type:text/xml; charset=utf-8' ) ;
100
+	}
101 101
 
102
-    /**
103
-     * Return XML declaration
104
-     *
105
-     * @access private
106
-     * @return string
107
-     */
108
-    function getXMLDeclaration()
109
-    {
110
-    	return '<?xml version="1.0" encoding="utf-8"?>';
111
-    }
102
+	/**
103
+	 * Return XML declaration
104
+	 *
105
+	 * @access private
106
+	 * @return string
107
+	 */
108
+	function getXMLDeclaration()
109
+	{
110
+		return '<?xml version="1.0" encoding="utf-8"?>';
111
+	}
112 112
 
113
-    /**
114
-     * Send error message to the browser. If error number is set to 1, $text (custom error message) will be displayed
115
-     * Don't call this function directly
116
-     *
117
-     * @access public
118
-     * @param int $number error number
119
-     * @param string $text Custom error message (optional)
120
-     */
121
-    function raiseError( $number, $text = false)
122
-    {
123
-        $this->_errorNode->addAttribute("number", intval($number));
124
-        if (false!=$text) {
125
-            $this->_errorNode->addAttribute("text", $text);
126
-        }
113
+	/**
114
+	 * Send error message to the browser. If error number is set to 1, $text (custom error message) will be displayed
115
+	 * Don't call this function directly
116
+	 *
117
+	 * @access public
118
+	 * @param int $number error number
119
+	 * @param string $text Custom error message (optional)
120
+	 */
121
+	function raiseError( $number, $text = false)
122
+	{
123
+		$this->_errorNode->addAttribute("number", intval($number));
124
+		if (false!=$text) {
125
+			$this->_errorNode->addAttribute("text", $text);
126
+		}
127 127
 
128
-        echo $this->_connectorNode->asXML();
129
-    }
128
+		echo $this->_connectorNode->asXML();
129
+	}
130 130
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * Include basic Xml library
23 23
  */
24
-require_once CKFINDER_CONNECTOR_LIB_DIR . "/Utils/XmlNode.php";
24
+require_once CKFINDER_CONNECTOR_LIB_DIR."/Utils/XmlNode.php";
25 25
 
26 26
 /**
27 27
  * XML document
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
     {
87 87
         // Prevent the browser from caching the result.
88 88
         // Date in the past
89
-        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
89
+        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
90 90
         // always modified
91
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
91
+        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
92 92
         // HTTP/1.1
93
-        header('Cache-Control: no-store, no-cache, must-revalidate') ;
94
-        header('Cache-Control: post-check=0, pre-check=0', false) ;
93
+        header('Cache-Control: no-store, no-cache, must-revalidate');
94
+        header('Cache-Control: post-check=0, pre-check=0', false);
95 95
         // HTTP/1.0
96
-        header('Pragma: no-cache') ;
96
+        header('Pragma: no-cache');
97 97
 
98 98
         // Set the response format.
99
-        header( 'Content-Type:text/xml; charset=utf-8' ) ;
99
+        header('Content-Type:text/xml; charset=utf-8');
100 100
     }
101 101
 
102 102
     /**
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
      * @param int $number error number
119 119
      * @param string $text Custom error message (optional)
120 120
      */
121
-    function raiseError( $number, $text = false)
121
+    function raiseError($number, $text = false)
122 122
     {
123 123
         $this->_errorNode->addAttribute("number", intval($number));
124
-        if (false!=$text) {
124
+        if (false != $text) {
125 125
             $this->_errorNode->addAttribute("text", $text);
126 126
         }
127 127
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  * modifying or distribute this file or part of its contents. The contents of
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/php4/ErrorHandler/Http.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -32,42 +32,42 @@
 block discarded – undo
32 32
  */
33 33
 class CKFinder_Connector_ErrorHandler_Http extends CKFinder_Connector_ErrorHandler_Base
34 34
 {
35
-    /**
36
-     * Throw file upload error, return true if error has been thrown, false if error has been catched
37
-     *
38
-     * @param int $number
39
-     * @param string $text
40
-     * @access public
41
-     */
42
-    function throwError($number, $text = false, $exit = true)
43
-    {
44
-        if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
45
-            return false;
46
-        }
35
+	/**
36
+	 * Throw file upload error, return true if error has been thrown, false if error has been catched
37
+	 *
38
+	 * @param int $number
39
+	 * @param string $text
40
+	 * @access public
41
+	 */
42
+	function throwError($number, $text = false, $exit = true)
43
+	{
44
+		if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
45
+			return false;
46
+		}
47 47
 
48
-        switch ($number)
49
-        {
50
-            case CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST:
51
-            case CKFINDER_CONNECTOR_ERROR_INVALID_NAME:
52
-            case CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED:
53
-            case CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED:
54
-                header("HTTP/1.0 403 Forbidden");
55
-                header("X-CKFinder-Error: ". $number);
56
-                break;
48
+		switch ($number)
49
+		{
50
+			case CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST:
51
+			case CKFINDER_CONNECTOR_ERROR_INVALID_NAME:
52
+			case CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED:
53
+			case CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED:
54
+				header("HTTP/1.0 403 Forbidden");
55
+				header("X-CKFinder-Error: ". $number);
56
+				break;
57 57
 
58
-            case CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED:
59
-                header("HTTP/1.0 500 Internal Server Error");
60
-                header("X-CKFinder-Error: ".$number);
61
-                break;
58
+			case CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED:
59
+				header("HTTP/1.0 500 Internal Server Error");
60
+				header("X-CKFinder-Error: ".$number);
61
+				break;
62 62
 
63
-            default:
64
-                header("HTTP/1.0 404 Not Found");
65
-                header("X-CKFinder-Error: ". $number);
66
-                break;
67
-        }
63
+			default:
64
+				header("HTTP/1.0 404 Not Found");
65
+				header("X-CKFinder-Error: ". $number);
66
+				break;
67
+		}
68 68
 
69
-        if ($exit) {
70
-            exit;
71
-        }
72
-    }
69
+		if ($exit) {
70
+			exit;
71
+		}
72
+	}
73 73
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * Include base error handling class
23 23
  */
24
-require_once CKFINDER_CONNECTOR_LIB_DIR . "/ErrorHandler/Base.php";
24
+require_once CKFINDER_CONNECTOR_LIB_DIR."/ErrorHandler/Base.php";
25 25
 
26 26
 /**
27 27
  * HTTP error handler
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             case CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED:
53 53
             case CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED:
54 54
                 header("HTTP/1.0 403 Forbidden");
55
-                header("X-CKFinder-Error: ". $number);
55
+                header("X-CKFinder-Error: ".$number);
56 56
                 break;
57 57
 
58 58
             case CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED:
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
             default:
64 64
                 header("HTTP/1.0 404 Not Found");
65
-                header("X-CKFinder-Error: ". $number);
65
+                header("X-CKFinder-Error: ".$number);
66 66
                 break;
67 67
         }
68 68
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  * modifying or distribute this file or part of its contents. The contents of
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/php4/ErrorHandler/Base.php 3 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -27,60 +27,60 @@
 block discarded – undo
27 27
  */
28 28
 class CKFinder_Connector_ErrorHandler_Base
29 29
 {
30
-    /**
31
-     * Try/catch emulation, if set to true, error handler will not throw any error
32
-     *
33
-     * @var boolean
34
-     * @access protected
35
-     */
36
-    var $_catchAllErrors = false;
37
-    /**
38
-     * Array with error numbers that should be ignored
39
-     *
40
-     * @var array[]int
41
-     * @access protected
42
-     */
43
-    var $_skipErrorsArray = array();
30
+	/**
31
+	 * Try/catch emulation, if set to true, error handler will not throw any error
32
+	 *
33
+	 * @var boolean
34
+	 * @access protected
35
+	 */
36
+	var $_catchAllErrors = false;
37
+	/**
38
+	 * Array with error numbers that should be ignored
39
+	 *
40
+	 * @var array[]int
41
+	 * @access protected
42
+	 */
43
+	var $_skipErrorsArray = array();
44 44
 
45
-    /**
46
-     * Set whether all errors should be ignored
47
-     *
48
-     * @param boolean $newValue
49
-     * @access public
50
-     */
51
-    function setCatchAllErros($newValue)
52
-    {
53
-        $this->_catchAllErrors = $newValue ? true : false;
54
-    }
45
+	/**
46
+	 * Set whether all errors should be ignored
47
+	 *
48
+	 * @param boolean $newValue
49
+	 * @access public
50
+	 */
51
+	function setCatchAllErros($newValue)
52
+	{
53
+		$this->_catchAllErrors = $newValue ? true : false;
54
+	}
55 55
 
56
-    /**
57
-     * Set which errors should be ignored
58
-     *
59
-     * @param array $newArray
60
-     */
61
-    function setSkipErrorsArray($newArray)
62
-    {
63
-        if (is_array($newArray)) {
64
-            $this->_skipErrorsArray = $newArray;
65
-        }
66
-    }
56
+	/**
57
+	 * Set which errors should be ignored
58
+	 *
59
+	 * @param array $newArray
60
+	 */
61
+	function setSkipErrorsArray($newArray)
62
+	{
63
+		if (is_array($newArray)) {
64
+			$this->_skipErrorsArray = $newArray;
65
+		}
66
+	}
67 67
 
68
-    /**
69
-     * Throw connector error, return true if error has been thrown, false if error has been catched
70
-     *
71
-     * @param int $number
72
-     * @param string $text
73
-     * @access public
74
-     */
75
-    function throwError($number, $text = false)
76
-    {
77
-        if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
78
-            return false;
79
-        }
68
+	/**
69
+	 * Throw connector error, return true if error has been thrown, false if error has been catched
70
+	 *
71
+	 * @param int $number
72
+	 * @param string $text
73
+	 * @access public
74
+	 */
75
+	function throwError($number, $text = false)
76
+	{
77
+		if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
78
+			return false;
79
+		}
80 80
 
81
-        $_xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
82
-        $_xml->raiseError($number,$text);
81
+		$_xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
82
+		$_xml->raiseError($number,$text);
83 83
 
84
-        exit;
85
-    }
84
+		exit;
85
+	}
86 86
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@
 block discarded – undo
78 78
             return false;
79 79
         }
80 80
 
81
-        $_xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
82
-        $_xml->raiseError($number,$text);
81
+        $_xml = & CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
82
+        $_xml->raiseError($number, $text);
83 83
 
84 84
         exit;
85 85
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  * modifying or distribute this file or part of its contents. The contents of
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
Please login to merge, or discard this patch.
ckfinder/core/connector/php/php4/CommandHandler/XmlCommandHandlerBase.php 3 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -38,85 +38,85 @@
 block discarded – undo
38 38
  */
39 39
 class CKFinder_Connector_CommandHandler_XmlCommandHandlerBase extends CKFinder_Connector_CommandHandler_CommandHandlerBase
40 40
 {
41
-    /**
42
-     * Connector node - Ckfinder_Connector_Utils_XmlNode object
43
-     *
44
-     * @var Ckfinder_Connector_Utils_XmlNode
45
-     * @access protected
46
-     */
47
-    var $_connectorNode;
48
-
49
-    /**
50
-     * send response
51
-     * @access public
52
-     *
53
-     */
54
-    function sendResponse()
55
-    {
56
-        $xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
57
-        $this->_connectorNode =& $xml->getConnectorNode();
58
-
59
-        $this->checkConnector();
60
-        if ($this->mustCheckRequest()) {
61
-            $this->checkRequest();
62
-        }
63
-
64
-        $resourceTypeName = $this->_currentFolder->getResourceTypeName();
65
-        if (!empty($resourceTypeName)) {
66
-            $this->_connectorNode->addAttribute("resourceType", $this->_currentFolder->getResourceTypeName());
67
-        }
68
-
69
-        if ($this->mustAddCurrentFolderNode()) {
70
-            $_currentFolder = new Ckfinder_Connector_Utils_XmlNode("CurrentFolder");
71
-            $this->_connectorNode->addChild($_currentFolder);
72
-            $_currentFolder->addAttribute("path", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($this->_currentFolder->getClientPath()));
73
-
74
-            $this->_errorHandler->setCatchAllErros(true);
75
-            $_url = $this->_currentFolder->getUrl();
76
-            $_currentFolder->addAttribute("url", is_null($_url) ? "" : CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($_url));
77
-            $this->_errorHandler->setCatchAllErros(false);
78
-
79
-            $_currentFolder->addAttribute("acl", $this->_currentFolder->getAclMask());
80
-        }
81
-
82
-        $this->buildXml();
83
-
84
-        $_oErrorNode =& $xml->getErrorNode();
85
-        $_oErrorNode->addAttribute("number", "0");
86
-
87
-        echo $this->_connectorNode->asXML();
88
-        exit;
89
-    }
90
-
91
-    /**
92
-     * Must check request?
93
-     *
94
-     * @return boolean
95
-     * @access protected
96
-     */
97
-    function mustCheckRequest()
98
-    {
99
-        return true;
100
-    }
101
-
102
-    /**
103
-     * Must add CurrentFolder node?
104
-     *
105
-     * @return boolean
106
-     * @access protected
107
-     */
108
-    function mustAddCurrentFolderNode()
109
-    {
110
-        return true;
111
-    }
112
-
113
-    /**
114
-     * @access protected
115
-     * @abstract
116
-     * @return void
117
-     */
118
-    function buildXml()
119
-    {
120
-
121
-    }
41
+	/**
42
+	 * Connector node - Ckfinder_Connector_Utils_XmlNode object
43
+	 *
44
+	 * @var Ckfinder_Connector_Utils_XmlNode
45
+	 * @access protected
46
+	 */
47
+	var $_connectorNode;
48
+
49
+	/**
50
+	 * send response
51
+	 * @access public
52
+	 *
53
+	 */
54
+	function sendResponse()
55
+	{
56
+		$xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
57
+		$this->_connectorNode =& $xml->getConnectorNode();
58
+
59
+		$this->checkConnector();
60
+		if ($this->mustCheckRequest()) {
61
+			$this->checkRequest();
62
+		}
63
+
64
+		$resourceTypeName = $this->_currentFolder->getResourceTypeName();
65
+		if (!empty($resourceTypeName)) {
66
+			$this->_connectorNode->addAttribute("resourceType", $this->_currentFolder->getResourceTypeName());
67
+		}
68
+
69
+		if ($this->mustAddCurrentFolderNode()) {
70
+			$_currentFolder = new Ckfinder_Connector_Utils_XmlNode("CurrentFolder");
71
+			$this->_connectorNode->addChild($_currentFolder);
72
+			$_currentFolder->addAttribute("path", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($this->_currentFolder->getClientPath()));
73
+
74
+			$this->_errorHandler->setCatchAllErros(true);
75
+			$_url = $this->_currentFolder->getUrl();
76
+			$_currentFolder->addAttribute("url", is_null($_url) ? "" : CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($_url));
77
+			$this->_errorHandler->setCatchAllErros(false);
78
+
79
+			$_currentFolder->addAttribute("acl", $this->_currentFolder->getAclMask());
80
+		}
81
+
82
+		$this->buildXml();
83
+
84
+		$_oErrorNode =& $xml->getErrorNode();
85
+		$_oErrorNode->addAttribute("number", "0");
86
+
87
+		echo $this->_connectorNode->asXML();
88
+		exit;
89
+	}
90
+
91
+	/**
92
+	 * Must check request?
93
+	 *
94
+	 * @return boolean
95
+	 * @access protected
96
+	 */
97
+	function mustCheckRequest()
98
+	{
99
+		return true;
100
+	}
101
+
102
+	/**
103
+	 * Must add CurrentFolder node?
104
+	 *
105
+	 * @return boolean
106
+	 * @access protected
107
+	 */
108
+	function mustAddCurrentFolderNode()
109
+	{
110
+		return true;
111
+	}
112
+
113
+	/**
114
+	 * @access protected
115
+	 * @abstract
116
+	 * @return void
117
+	 */
118
+	function buildXml()
119
+	{
120
+
121
+	}
122 122
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * Include base command handler
23 23
  */
24
-require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/CommandHandlerBase.php";
24
+require_once CKFINDER_CONNECTOR_LIB_DIR."/CommandHandler/CommandHandlerBase.php";
25 25
 /**
26 26
  * Include xml utils
27 27
  */
28
-require_once CKFINDER_CONNECTOR_LIB_DIR . "/Core/Xml.php";
28
+require_once CKFINDER_CONNECTOR_LIB_DIR."/Core/Xml.php";
29 29
 
30 30
 /**
31 31
  * Base XML commands handler
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
      */
54 54
     function sendResponse()
55 55
     {
56
-        $xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
57
-        $this->_connectorNode =& $xml->getConnectorNode();
56
+        $xml = & CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
57
+        $this->_connectorNode = & $xml->getConnectorNode();
58 58
 
59 59
         $this->checkConnector();
60 60
         if ($this->mustCheckRequest()) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
         $this->buildXml();
83 83
 
84
-        $_oErrorNode =& $xml->getErrorNode();
84
+        $_oErrorNode = & $xml->getErrorNode();
85 85
         $_oErrorNode->addAttribute("number", "0");
86 86
 
87 87
         echo $this->_connectorNode->asXML();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
 * modifying or distribute this file or part of its contents. The contents of
11 11
 * this file is part of the Source Code of CKFinder.
12 12
 */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/php4/CommandHandler/Thumbnail.php 3 patches
Indentation   +287 added lines, -287 removed lines patch added patch discarded remove patch
@@ -27,296 +27,296 @@
 block discarded – undo
27 27
  */
28 28
 class CKFinder_Connector_CommandHandler_Thumbnail extends CKFinder_Connector_CommandHandler_CommandHandlerBase
29 29
 {
30
-    /**
31
-     * Command name
32
-     *
33
-     * @access private
34
-     * @var string
35
-     */
36
-    var $command = "Thumbnail";
37
-
38
-    /**
39
-     * Send response
40
-     * @access public
41
-     *
42
-     */
43
-    function sendResponse()
44
-    {
45
-        if (!function_exists('ob_list_handlers') || ob_list_handlers()) {
46
-            @ob_end_clean();
47
-        }
48
-        header("Content-Encoding: none");
49
-
50
-        $this->checkConnector();
51
-        $this->checkRequest();
52
-
53
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
54
-
55
-        $_thumbnails = $_config->getThumbnailsConfig();
56
-        if (!$_thumbnails->getIsEnabled()) {
57
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED);
58
-        }
59
-
60
-        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
61
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
62
-        }
63
-
64
-        if (!isset($_GET["FileName"])) {
65
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
66
-        }
67
-
68
-        $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
69
-        $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
70
-
71
-        if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
72
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
73
-        }
74
-        $sourceFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
75
-
76
-        if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($sourceFilePath)) {
77
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
78
-        }
79
-
80
-        $thumbFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $fileName);
81
-
82
-        // If the thumbnail file doesn't exists, create it now.
83
-        if (!file_exists($thumbFilePath)) {
84
-            if(!$this->createThumb($sourceFilePath, $thumbFilePath, $_thumbnails->getMaxWidth(), $_thumbnails->getMaxHeight(), $_thumbnails->getQuality(), true, $_thumbnails->getBmpSupported())) {
85
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
86
-            }
87
-        }
88
-
89
-        $size = filesize($thumbFilePath);
90
-        $sourceImageAttr = getimagesize($thumbFilePath);
91
-        $mime = $sourceImageAttr["mime"];
92
-
93
-        $rtime = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])?strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]):0;
94
-        $mtime =  filemtime($thumbFilePath);
95
-        $etag = dechex($mtime) . "-" . dechex($size);
96
-
97
-        $is304 = false;
98
-
99
-        if (isset($_SERVER["HTTP_IF_NONE_MATCH"]) && $_SERVER["HTTP_IF_NONE_MATCH"] === $etag) {
100
-            $is304 = true;
101
-        }
102
-        else if($rtime == $mtime) {
103
-            $is304 = true;
104
-        }
105
-
106
-        if ($is304) {
107
-            header("HTTP/1.0 304 Not Modified");
108
-            exit();
109
-        }
110
-
111
-        //header("Cache-Control: cache, must-revalidate");
112
-        //header("Pragma: public");
113
-        //header("Expires: 0");
114
-        header('Cache-control: public');
115
-        header('Etag: ' . $etag);
116
-        header("Content-type: " . $mime . "; name=\"" . CKFinder_Connector_Utils_Misc::mbBasename($thumbFilePath) . "\"");
117
-        header("Last-Modified: ".gmdate('D, d M Y H:i:s', $mtime) . " GMT");
118
-        //header("Content-type: application/octet-stream; name=\"{$file}\"");
119
-        //header("Content-Disposition: attachment; filename=\"{$file}\"");
120
-        header("Content-Length: ".$size);
121
-        readfile($thumbFilePath);
122
-        exit;
123
-    }
124
-
125
-    /**
126
-     * Create thumbnail
127
-     *
128
-     * @param string $sourceFile
129
-     * @param string $targetFile
130
-     * @param int $maxWidth
131
-     * @param int $maxHeight
132
-     * @param boolean $preserverAspectRatio
133
-     * @param boolean $bmpSupported
134
-     * @return boolean
135
-     * @static
136
-     * @access public
137
-     */
138
-    function createThumb($sourceFile, $targetFile, $maxWidth, $maxHeight, $quality, $preserverAspectRatio, $bmpSupported = false)
139
-    {
140
-        $sourceImageAttr = @getimagesize($sourceFile);
141
-        if ($sourceImageAttr === false) {
142
-            return false;
143
-        }
144
-        $sourceImageWidth = isset($sourceImageAttr[0]) ? $sourceImageAttr[0] : 0;
145
-        $sourceImageHeight = isset($sourceImageAttr[1]) ? $sourceImageAttr[1] : 0;
146
-        $sourceImageMime = isset($sourceImageAttr["mime"]) ? $sourceImageAttr["mime"] : "";
147
-        $sourceImageBits = isset($sourceImageAttr["bits"]) ? $sourceImageAttr["bits"] : 8;
148
-        $sourceImageChannels = isset($sourceImageAttr["channels"]) ? $sourceImageAttr["channels"] : 3;
149
-
150
-        if (!$sourceImageWidth || !$sourceImageHeight || !$sourceImageMime) {
151
-            return false;
152
-        }
153
-
154
-        $iFinalWidth = $maxWidth == 0 ? $sourceImageWidth : $maxWidth;
155
-        $iFinalHeight = $maxHeight == 0 ? $sourceImageHeight : $maxHeight;
156
-
157
-        if ($sourceImageWidth <= $iFinalWidth && $sourceImageHeight <= $iFinalHeight) {
158
-            if ($sourceFile != $targetFile) {
159
-                copy($sourceFile, $targetFile);
160
-            }
161
-            return true;
162
-        }
163
-
164
-        if ($preserverAspectRatio)
165
-        {
166
-            // Gets the best size for aspect ratio resampling
167
-            $oSize = CKFinder_Connector_CommandHandler_Thumbnail::GetAspectRatioSize($iFinalWidth, $iFinalHeight, $sourceImageWidth, $sourceImageHeight );
168
-        }
169
-        else {
170
-            $oSize = array('Width' => $iFinalWidth, 'Height' => $iFinalHeight);
171
-        }
172
-
173
-        CKFinder_Connector_Utils_Misc::setMemoryForImage($sourceImageWidth, $sourceImageHeight, $sourceImageBits, $sourceImageChannels);
174
-
175
-        switch ($sourceImageAttr['mime'])
176
-        {
177
-            case 'image/gif':
178
-                {
179
-                    if (@imagetypes() & IMG_GIF) {
180
-                        $oImage = @imagecreatefromgif($sourceFile);
181
-                    } else {
182
-                        $ermsg = 'GIF images are not supported';
183
-                    }
184
-                }
185
-                break;
186
-            case 'image/jpeg':
187
-                {
188
-                    if (@imagetypes() & IMG_JPG) {
189
-                        $oImage = @imagecreatefromjpeg($sourceFile) ;
190
-                    } else {
191
-                        $ermsg = 'JPEG images are not supported';
192
-                    }
193
-                }
194
-                break;
195
-            case 'image/png':
196
-                {
197
-                    if (@imagetypes() & IMG_PNG) {
198
-                        $oImage = @imagecreatefrompng($sourceFile) ;
199
-                    } else {
200
-                        $ermsg = 'PNG images are not supported';
201
-                    }
202
-                }
203
-                break;
204
-            case 'image/wbmp':
205
-                {
206
-                    if (@imagetypes() & IMG_WBMP) {
207
-                        $oImage = @imagecreatefromwbmp($sourceFile);
208
-                    } else {
209
-                        $ermsg = 'WBMP images are not supported';
210
-                    }
211
-                }
212
-                break;
213
-            case 'image/bmp':
214
-                {
215
-                    /*
30
+	/**
31
+	 * Command name
32
+	 *
33
+	 * @access private
34
+	 * @var string
35
+	 */
36
+	var $command = "Thumbnail";
37
+
38
+	/**
39
+	 * Send response
40
+	 * @access public
41
+	 *
42
+	 */
43
+	function sendResponse()
44
+	{
45
+		if (!function_exists('ob_list_handlers') || ob_list_handlers()) {
46
+			@ob_end_clean();
47
+		}
48
+		header("Content-Encoding: none");
49
+
50
+		$this->checkConnector();
51
+		$this->checkRequest();
52
+
53
+		$_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
54
+
55
+		$_thumbnails = $_config->getThumbnailsConfig();
56
+		if (!$_thumbnails->getIsEnabled()) {
57
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED);
58
+		}
59
+
60
+		if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
61
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
62
+		}
63
+
64
+		if (!isset($_GET["FileName"])) {
65
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
66
+		}
67
+
68
+		$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
69
+		$_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
70
+
71
+		if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
72
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
73
+		}
74
+		$sourceFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
75
+
76
+		if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($sourceFilePath)) {
77
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
78
+		}
79
+
80
+		$thumbFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $fileName);
81
+
82
+		// If the thumbnail file doesn't exists, create it now.
83
+		if (!file_exists($thumbFilePath)) {
84
+			if(!$this->createThumb($sourceFilePath, $thumbFilePath, $_thumbnails->getMaxWidth(), $_thumbnails->getMaxHeight(), $_thumbnails->getQuality(), true, $_thumbnails->getBmpSupported())) {
85
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
86
+			}
87
+		}
88
+
89
+		$size = filesize($thumbFilePath);
90
+		$sourceImageAttr = getimagesize($thumbFilePath);
91
+		$mime = $sourceImageAttr["mime"];
92
+
93
+		$rtime = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])?strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]):0;
94
+		$mtime =  filemtime($thumbFilePath);
95
+		$etag = dechex($mtime) . "-" . dechex($size);
96
+
97
+		$is304 = false;
98
+
99
+		if (isset($_SERVER["HTTP_IF_NONE_MATCH"]) && $_SERVER["HTTP_IF_NONE_MATCH"] === $etag) {
100
+			$is304 = true;
101
+		}
102
+		else if($rtime == $mtime) {
103
+			$is304 = true;
104
+		}
105
+
106
+		if ($is304) {
107
+			header("HTTP/1.0 304 Not Modified");
108
+			exit();
109
+		}
110
+
111
+		//header("Cache-Control: cache, must-revalidate");
112
+		//header("Pragma: public");
113
+		//header("Expires: 0");
114
+		header('Cache-control: public');
115
+		header('Etag: ' . $etag);
116
+		header("Content-type: " . $mime . "; name=\"" . CKFinder_Connector_Utils_Misc::mbBasename($thumbFilePath) . "\"");
117
+		header("Last-Modified: ".gmdate('D, d M Y H:i:s', $mtime) . " GMT");
118
+		//header("Content-type: application/octet-stream; name=\"{$file}\"");
119
+		//header("Content-Disposition: attachment; filename=\"{$file}\"");
120
+		header("Content-Length: ".$size);
121
+		readfile($thumbFilePath);
122
+		exit;
123
+	}
124
+
125
+	/**
126
+	 * Create thumbnail
127
+	 *
128
+	 * @param string $sourceFile
129
+	 * @param string $targetFile
130
+	 * @param int $maxWidth
131
+	 * @param int $maxHeight
132
+	 * @param boolean $preserverAspectRatio
133
+	 * @param boolean $bmpSupported
134
+	 * @return boolean
135
+	 * @static
136
+	 * @access public
137
+	 */
138
+	function createThumb($sourceFile, $targetFile, $maxWidth, $maxHeight, $quality, $preserverAspectRatio, $bmpSupported = false)
139
+	{
140
+		$sourceImageAttr = @getimagesize($sourceFile);
141
+		if ($sourceImageAttr === false) {
142
+			return false;
143
+		}
144
+		$sourceImageWidth = isset($sourceImageAttr[0]) ? $sourceImageAttr[0] : 0;
145
+		$sourceImageHeight = isset($sourceImageAttr[1]) ? $sourceImageAttr[1] : 0;
146
+		$sourceImageMime = isset($sourceImageAttr["mime"]) ? $sourceImageAttr["mime"] : "";
147
+		$sourceImageBits = isset($sourceImageAttr["bits"]) ? $sourceImageAttr["bits"] : 8;
148
+		$sourceImageChannels = isset($sourceImageAttr["channels"]) ? $sourceImageAttr["channels"] : 3;
149
+
150
+		if (!$sourceImageWidth || !$sourceImageHeight || !$sourceImageMime) {
151
+			return false;
152
+		}
153
+
154
+		$iFinalWidth = $maxWidth == 0 ? $sourceImageWidth : $maxWidth;
155
+		$iFinalHeight = $maxHeight == 0 ? $sourceImageHeight : $maxHeight;
156
+
157
+		if ($sourceImageWidth <= $iFinalWidth && $sourceImageHeight <= $iFinalHeight) {
158
+			if ($sourceFile != $targetFile) {
159
+				copy($sourceFile, $targetFile);
160
+			}
161
+			return true;
162
+		}
163
+
164
+		if ($preserverAspectRatio)
165
+		{
166
+			// Gets the best size for aspect ratio resampling
167
+			$oSize = CKFinder_Connector_CommandHandler_Thumbnail::GetAspectRatioSize($iFinalWidth, $iFinalHeight, $sourceImageWidth, $sourceImageHeight );
168
+		}
169
+		else {
170
+			$oSize = array('Width' => $iFinalWidth, 'Height' => $iFinalHeight);
171
+		}
172
+
173
+		CKFinder_Connector_Utils_Misc::setMemoryForImage($sourceImageWidth, $sourceImageHeight, $sourceImageBits, $sourceImageChannels);
174
+
175
+		switch ($sourceImageAttr['mime'])
176
+		{
177
+			case 'image/gif':
178
+				{
179
+					if (@imagetypes() & IMG_GIF) {
180
+						$oImage = @imagecreatefromgif($sourceFile);
181
+					} else {
182
+						$ermsg = 'GIF images are not supported';
183
+					}
184
+				}
185
+				break;
186
+			case 'image/jpeg':
187
+				{
188
+					if (@imagetypes() & IMG_JPG) {
189
+						$oImage = @imagecreatefromjpeg($sourceFile) ;
190
+					} else {
191
+						$ermsg = 'JPEG images are not supported';
192
+					}
193
+				}
194
+				break;
195
+			case 'image/png':
196
+				{
197
+					if (@imagetypes() & IMG_PNG) {
198
+						$oImage = @imagecreatefrompng($sourceFile) ;
199
+					} else {
200
+						$ermsg = 'PNG images are not supported';
201
+					}
202
+				}
203
+				break;
204
+			case 'image/wbmp':
205
+				{
206
+					if (@imagetypes() & IMG_WBMP) {
207
+						$oImage = @imagecreatefromwbmp($sourceFile);
208
+					} else {
209
+						$ermsg = 'WBMP images are not supported';
210
+					}
211
+				}
212
+				break;
213
+			case 'image/bmp':
214
+				{
215
+					/*
216 216
                     * This is sad that PHP doesn't support bitmaps.
217 217
                     * Anyway, we will use our custom function at least to display thumbnails.
218 218
                     * We'll not resize images this way (if $sourceFile === $targetFile),
219 219
                     * because user defined imagecreatefrombmp and imagecreatebmp are horribly slow
220 220
                     */
221
-                    if ($bmpSupported && (@imagetypes() & IMG_JPG) && $sourceFile != $targetFile) {
222
-                        $oImage = CKFinder_Connector_Utils_Misc::imageCreateFromBmp($sourceFile);
223
-                    } else {
224
-                        $ermsg = 'BMP/JPG images are not supported';
225
-                    }
226
-                }
227
-                break;
228
-            default:
229
-                $ermsg = $sourceImageAttr['mime'].' images are not supported';
230
-                break;
231
-        }
232
-
233
-        if (isset($ermsg) || false === $oImage) {
234
-            return false;
235
-        }
236
-
237
-
238
-        $oThumbImage = imagecreatetruecolor($oSize["Width"], $oSize["Height"]);
239
-        //imagecopyresampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight);
240
-        CKFinder_Connector_Utils_Misc::fastImageCopyResampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight, (int)max(floor($quality/20), 1));
241
-
242
-        switch ($sourceImageAttr['mime'])
243
-        {
244
-            case 'image/gif':
245
-                imagegif($oThumbImage, $targetFile);
246
-                break;
247
-            case 'image/jpeg':
248
-            case 'image/bmp':
249
-                imagejpeg($oThumbImage, $targetFile, $quality);
250
-                break;
251
-            case 'image/png':
252
-                imagepng($oThumbImage, $targetFile);
253
-                break;
254
-            case 'image/wbmp':
255
-                imagewbmp($oThumbImage, $targetFile);
256
-                break;
257
-        }
258
-
259
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
260
-        if (file_exists($targetFile) && ($perms = $_config->getChmodFiles())) {
261
-            $oldUmask = umask(0);
262
-            chmod($targetFile, $perms);
263
-            umask($oldUmask);
264
-        }
265
-
266
-        imageDestroy($oImage);
267
-        imageDestroy($oThumbImage);
268
-
269
-        return true;
270
-    }
271
-
272
-
273
-
274
-    /**
275
-     * Return aspect ratio size, returns associative array:
276
-     * <pre>
277
-     * Array
278
-     * (
279
-     *      [Width] => 80
280
-     *      [Heigth] => 120
281
-     * )
282
-     * </pre>
283
-     *
284
-     * @param int $maxWidth
285
-     * @param int $maxHeight
286
-     * @param int $actualWidth
287
-     * @param int $actualHeight
288
-     * @return array
289
-     * @static
290
-     * @access public
291
-     */
292
-    function getAspectRatioSize($maxWidth, $maxHeight, $actualWidth, $actualHeight)
293
-    {
294
-        $oSize = array("Width"=>$maxWidth, "Height"=>$maxHeight);
295
-
296
-        // Calculates the X and Y resize factors
297
-        $iFactorX = (float)$maxWidth / (float)$actualWidth;
298
-        $iFactorY = (float)$maxHeight / (float)$actualHeight;
299
-
300
-        // If some dimension have to be scaled
301
-        if ($iFactorX != 1 || $iFactorY != 1)
302
-        {
303
-            // Uses the lower Factor to scale the oposite size
304
-            if ($iFactorX < $iFactorY) {
305
-                $oSize["Height"] = (int)round($actualHeight * $iFactorX);
306
-            }
307
-            else if ($iFactorX > $iFactorY) {
308
-                $oSize["Width"] = (int)round($actualWidth * $iFactorY);
309
-            }
310
-        }
311
-
312
-        if ($oSize["Height"] <= 0) {
313
-            $oSize["Height"] = 1;
314
-        }
315
-        if ($oSize["Width"] <= 0) {
316
-            $oSize["Width"] = 1;
317
-        }
318
-
319
-        // Returns the Size
320
-        return $oSize;
321
-    }
221
+					if ($bmpSupported && (@imagetypes() & IMG_JPG) && $sourceFile != $targetFile) {
222
+						$oImage = CKFinder_Connector_Utils_Misc::imageCreateFromBmp($sourceFile);
223
+					} else {
224
+						$ermsg = 'BMP/JPG images are not supported';
225
+					}
226
+				}
227
+				break;
228
+			default:
229
+				$ermsg = $sourceImageAttr['mime'].' images are not supported';
230
+				break;
231
+		}
232
+
233
+		if (isset($ermsg) || false === $oImage) {
234
+			return false;
235
+		}
236
+
237
+
238
+		$oThumbImage = imagecreatetruecolor($oSize["Width"], $oSize["Height"]);
239
+		//imagecopyresampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight);
240
+		CKFinder_Connector_Utils_Misc::fastImageCopyResampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight, (int)max(floor($quality/20), 1));
241
+
242
+		switch ($sourceImageAttr['mime'])
243
+		{
244
+			case 'image/gif':
245
+				imagegif($oThumbImage, $targetFile);
246
+				break;
247
+			case 'image/jpeg':
248
+			case 'image/bmp':
249
+				imagejpeg($oThumbImage, $targetFile, $quality);
250
+				break;
251
+			case 'image/png':
252
+				imagepng($oThumbImage, $targetFile);
253
+				break;
254
+			case 'image/wbmp':
255
+				imagewbmp($oThumbImage, $targetFile);
256
+				break;
257
+		}
258
+
259
+		$_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
260
+		if (file_exists($targetFile) && ($perms = $_config->getChmodFiles())) {
261
+			$oldUmask = umask(0);
262
+			chmod($targetFile, $perms);
263
+			umask($oldUmask);
264
+		}
265
+
266
+		imageDestroy($oImage);
267
+		imageDestroy($oThumbImage);
268
+
269
+		return true;
270
+	}
271
+
272
+
273
+
274
+	/**
275
+	 * Return aspect ratio size, returns associative array:
276
+	 * <pre>
277
+	 * Array
278
+	 * (
279
+	 *      [Width] => 80
280
+	 *      [Heigth] => 120
281
+	 * )
282
+	 * </pre>
283
+	 *
284
+	 * @param int $maxWidth
285
+	 * @param int $maxHeight
286
+	 * @param int $actualWidth
287
+	 * @param int $actualHeight
288
+	 * @return array
289
+	 * @static
290
+	 * @access public
291
+	 */
292
+	function getAspectRatioSize($maxWidth, $maxHeight, $actualWidth, $actualHeight)
293
+	{
294
+		$oSize = array("Width"=>$maxWidth, "Height"=>$maxHeight);
295
+
296
+		// Calculates the X and Y resize factors
297
+		$iFactorX = (float)$maxWidth / (float)$actualWidth;
298
+		$iFactorY = (float)$maxHeight / (float)$actualHeight;
299
+
300
+		// If some dimension have to be scaled
301
+		if ($iFactorX != 1 || $iFactorY != 1)
302
+		{
303
+			// Uses the lower Factor to scale the oposite size
304
+			if ($iFactorX < $iFactorY) {
305
+				$oSize["Height"] = (int)round($actualHeight * $iFactorX);
306
+			}
307
+			else if ($iFactorX > $iFactorY) {
308
+				$oSize["Width"] = (int)round($actualWidth * $iFactorY);
309
+			}
310
+		}
311
+
312
+		if ($oSize["Height"] <= 0) {
313
+			$oSize["Height"] = 1;
314
+		}
315
+		if ($oSize["Width"] <= 0) {
316
+			$oSize["Width"] = 1;
317
+		}
318
+
319
+		// Returns the Size
320
+		return $oSize;
321
+	}
322 322
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $this->checkConnector();
51 51
         $this->checkRequest();
52 52
 
53
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
53
+        $_config = & CKFinder_Connector_Core_Factory::getInstance("Core_Config");
54 54
 
55 55
         $_thumbnails = $_config->getThumbnailsConfig();
56 56
         if (!$_thumbnails->getIsEnabled()) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
         // If the thumbnail file doesn't exists, create it now.
83 83
         if (!file_exists($thumbFilePath)) {
84
-            if(!$this->createThumb($sourceFilePath, $thumbFilePath, $_thumbnails->getMaxWidth(), $_thumbnails->getMaxHeight(), $_thumbnails->getQuality(), true, $_thumbnails->getBmpSupported())) {
84
+            if (!$this->createThumb($sourceFilePath, $thumbFilePath, $_thumbnails->getMaxWidth(), $_thumbnails->getMaxHeight(), $_thumbnails->getQuality(), true, $_thumbnails->getBmpSupported())) {
85 85
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
86 86
             }
87 87
         }
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
         $sourceImageAttr = getimagesize($thumbFilePath);
91 91
         $mime = $sourceImageAttr["mime"];
92 92
 
93
-        $rtime = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])?strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]):0;
94
-        $mtime =  filemtime($thumbFilePath);
95
-        $etag = dechex($mtime) . "-" . dechex($size);
93
+        $rtime = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) ? strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]) : 0;
94
+        $mtime = filemtime($thumbFilePath);
95
+        $etag = dechex($mtime)."-".dechex($size);
96 96
 
97 97
         $is304 = false;
98 98
 
99 99
         if (isset($_SERVER["HTTP_IF_NONE_MATCH"]) && $_SERVER["HTTP_IF_NONE_MATCH"] === $etag) {
100 100
             $is304 = true;
101 101
         }
102
-        else if($rtime == $mtime) {
102
+        else if ($rtime == $mtime) {
103 103
             $is304 = true;
104 104
         }
105 105
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
         //header("Pragma: public");
113 113
         //header("Expires: 0");
114 114
         header('Cache-control: public');
115
-        header('Etag: ' . $etag);
116
-        header("Content-type: " . $mime . "; name=\"" . CKFinder_Connector_Utils_Misc::mbBasename($thumbFilePath) . "\"");
117
-        header("Last-Modified: ".gmdate('D, d M Y H:i:s', $mtime) . " GMT");
115
+        header('Etag: '.$etag);
116
+        header("Content-type: ".$mime."; name=\"".CKFinder_Connector_Utils_Misc::mbBasename($thumbFilePath)."\"");
117
+        header("Last-Modified: ".gmdate('D, d M Y H:i:s', $mtime)." GMT");
118 118
         //header("Content-type: application/octet-stream; name=\"{$file}\"");
119 119
         //header("Content-Disposition: attachment; filename=\"{$file}\"");
120 120
         header("Content-Length: ".$size);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         if ($preserverAspectRatio)
165 165
         {
166 166
             // Gets the best size for aspect ratio resampling
167
-            $oSize = CKFinder_Connector_CommandHandler_Thumbnail::GetAspectRatioSize($iFinalWidth, $iFinalHeight, $sourceImageWidth, $sourceImageHeight );
167
+            $oSize = CKFinder_Connector_CommandHandler_Thumbnail::GetAspectRatioSize($iFinalWidth, $iFinalHeight, $sourceImageWidth, $sourceImageHeight);
168 168
         }
169 169
         else {
170 170
             $oSize = array('Width' => $iFinalWidth, 'Height' => $iFinalHeight);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             case 'image/jpeg':
187 187
                 {
188 188
                     if (@imagetypes() & IMG_JPG) {
189
-                        $oImage = @imagecreatefromjpeg($sourceFile) ;
189
+                        $oImage = @imagecreatefromjpeg($sourceFile);
190 190
                     } else {
191 191
                         $ermsg = 'JPEG images are not supported';
192 192
                     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             case 'image/png':
196 196
                 {
197 197
                     if (@imagetypes() & IMG_PNG) {
198
-                        $oImage = @imagecreatefrompng($sourceFile) ;
198
+                        $oImage = @imagecreatefrompng($sourceFile);
199 199
                     } else {
200 200
                         $ermsg = 'PNG images are not supported';
201 201
                     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         $oThumbImage = imagecreatetruecolor($oSize["Width"], $oSize["Height"]);
239 239
         //imagecopyresampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight);
240
-        CKFinder_Connector_Utils_Misc::fastImageCopyResampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight, (int)max(floor($quality/20), 1));
240
+        CKFinder_Connector_Utils_Misc::fastImageCopyResampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight, (int)max(floor($quality / 20), 1));
241 241
 
242 242
         switch ($sourceImageAttr['mime'])
243 243
         {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                 break;
257 257
         }
258 258
 
259
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
259
+        $_config = & CKFinder_Connector_Core_Factory::getInstance("Core_Config");
260 260
         if (file_exists($targetFile) && ($perms = $_config->getChmodFiles())) {
261 261
             $oldUmask = umask(0);
262 262
             chmod($targetFile, $perms);
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 * modifying or distribute this file or part of its contents. The contents of
11 11
 * this file is part of the Source Code of CKFinder.
12 12
 */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
@@ -98,8 +100,7 @@  discard block
 block discarded – undo
98 100
 
99 101
         if (isset($_SERVER["HTTP_IF_NONE_MATCH"]) && $_SERVER["HTTP_IF_NONE_MATCH"] === $etag) {
100 102
             $is304 = true;
101
-        }
102
-        else if($rtime == $mtime) {
103
+        } else if($rtime == $mtime) {
103 104
             $is304 = true;
104 105
         }
105 106
 
@@ -165,8 +166,7 @@  discard block
 block discarded – undo
165 166
         {
166 167
             // Gets the best size for aspect ratio resampling
167 168
             $oSize = CKFinder_Connector_CommandHandler_Thumbnail::GetAspectRatioSize($iFinalWidth, $iFinalHeight, $sourceImageWidth, $sourceImageHeight );
168
-        }
169
-        else {
169
+        } else {
170 170
             $oSize = array('Width' => $iFinalWidth, 'Height' => $iFinalHeight);
171 171
         }
172 172
 
@@ -303,8 +303,7 @@  discard block
 block discarded – undo
303 303
             // Uses the lower Factor to scale the oposite size
304 304
             if ($iFactorX < $iFactorY) {
305 305
                 $oSize["Height"] = (int)round($actualHeight * $iFactorX);
306
-            }
307
-            else if ($iFactorX > $iFactorY) {
306
+            } else if ($iFactorX > $iFactorY) {
308 307
                 $oSize["Width"] = (int)round($actualWidth * $iFactorY);
309 308
             }
310 309
         }
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/php4/CommandHandler/DeleteFolder.php 3 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,44 +32,44 @@
 block discarded – undo
32 32
  */
33 33
 class CKFinder_Connector_CommandHandler_DeleteFolder extends CKFinder_Connector_CommandHandler_XmlCommandHandlerBase
34 34
 {
35
-    /**
36
-     * Command name
37
-     *
38
-     * @access private
39
-     * @var string
40
-     */
41
-    var $command = "DeleteFolder";
35
+	/**
36
+	 * Command name
37
+	 *
38
+	 * @access private
39
+	 * @var string
40
+	 */
41
+	var $command = "DeleteFolder";
42 42
 
43 43
 
44
-    /**
45
-     * handle request and build XML
46
-     * @access protected
47
-     *
48
-     */
49
-    function buildXml()
50
-    {
51
-        if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
52
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
53
-        }
44
+	/**
45
+	 * handle request and build XML
46
+	 * @access protected
47
+	 *
48
+	 */
49
+	function buildXml()
50
+	{
51
+		if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
52
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
53
+		}
54 54
 
55
-        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
56
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
57
-        }
55
+		if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
56
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
57
+		}
58 58
 
59
-        // The root folder cannot be deleted.
60
-        if ($this->_currentFolder->getClientPath() == "/") {
61
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
62
-        }
59
+		// The root folder cannot be deleted.
60
+		if ($this->_currentFolder->getClientPath() == "/") {
61
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
62
+		}
63 63
 
64
-        $folderServerPath = $this->_currentFolder->getServerPath();
65
-        if (!file_exists($folderServerPath) || !is_dir($folderServerPath)) {
66
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
67
-        }
64
+		$folderServerPath = $this->_currentFolder->getServerPath();
65
+		if (!file_exists($folderServerPath) || !is_dir($folderServerPath)) {
66
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
67
+		}
68 68
 
69
-        if (!CKFinder_Connector_Utils_FileSystem::unlink($folderServerPath)) {
70
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
71
-        }
69
+		if (!CKFinder_Connector_Utils_FileSystem::unlink($folderServerPath)) {
70
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
71
+		}
72 72
 
73
-        CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
74
-    }
73
+		CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
74
+	}
75 75
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 /**
22 22
  * Include base XML command handler
23 23
  */
24
-require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/XmlCommandHandlerBase.php";
24
+require_once CKFINDER_CONNECTOR_LIB_DIR."/CommandHandler/XmlCommandHandlerBase.php";
25 25
 
26 26
 /**
27 27
  * Handle DeleteFolder command
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  * modifying or distribute this file or part of its contents. The contents of
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/php4/CommandHandler/FileUpload.php 3 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -27,177 +27,177 @@
 block discarded – undo
27 27
  */
28 28
 class CKFinder_Connector_CommandHandler_FileUpload extends CKFinder_Connector_CommandHandler_CommandHandlerBase
29 29
 {
30
-    /**
31
-     * Command name
32
-     *
33
-     * @access protected
34
-     * @var string
35
-     */
36
-    var $command = "FileUpload";
37
-
38
-    /**
39
-     * send response (save uploaded file, resize if required)
40
-     * @access public
41
-     *
42
-     */
43
-    function sendResponse()
44
-    {
45
-        $iErrorNumber = CKFINDER_CONNECTOR_ERROR_NONE;
46
-
47
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
48
-        $oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
49
-        $oRegistry->set("FileUpload_fileName", "unknown file");
50
-
51
-        $uploadedFile = array_shift($_FILES);
52
-
53
-        if (!isset($uploadedFile['name'])) {
54
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID);
55
-        }
56
-
57
-        $sUnsafeFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding(CKFinder_Connector_Utils_Misc::mbBasename($uploadedFile['name']));
58
-        $sFileName = str_replace(array(":", "*", "?", "|", "/"), "_", $sUnsafeFileName);
59
-        if ($_config->forceAscii()) {
60
-            $sFileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sFileName);
61
-        }
62
-        if ($sFileName != $sUnsafeFileName) {
63
-          $iErrorNumber = CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID_NAME_RENAMED;
64
-        }
65
-        $oRegistry->set("FileUpload_fileName", $sFileName);
66
-        $oRegistry->set("FileUpload_url", $this->_currentFolder->getUrl());
67
-
68
-        $this->checkConnector();
69
-        $this->checkRequest();
70
-
71
-        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD)) {
72
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
73
-        }
74
-
75
-        $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
76
-        if (!CKFinder_Connector_Utils_FileSystem::checkFileName($sFileName) || $_resourceTypeConfig->checkIsHiddenFile($sFileName)) {
77
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
78
-        }
79
-
80
-        $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
81
-        if (!$resourceTypeInfo->checkExtension($sFileName)) {
82
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
83
-        }
84
-
85
-        $sFileNameOrginal = $sFileName;
86
-        $oRegistry->set("FileUpload_fileName", $sFileName);
87
-
88
-        $maxSize = $resourceTypeInfo->getMaxSize();
89
-        if (!$_config->checkSizeAfterScaling() && $maxSize && $uploadedFile['size']>$maxSize) {
90
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
91
-        }
92
-
93
-        $htmlExtensions = $_config->getHtmlExtensions();
94
-        $sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
95
-
96
-        if ($htmlExtensions
97
-        && !CKFinder_Connector_Utils_Misc::inArrayCaseInsensitive($sExtension, $htmlExtensions)
98
-        && ($detectHtml = CKFinder_Connector_Utils_FileSystem::detectHtml($uploadedFile['tmp_name'])) === true ) {
99
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_WRONG_HTML_FILE);
100
-        }
101
-
102
-        $sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
103
-        $secureImageUploads = $_config->getSecureImageUploads();
104
-        if ($secureImageUploads
105
-        && ($isImageValid = CKFinder_Connector_Utils_FileSystem::isImageValid($uploadedFile['tmp_name'], $sExtension)) === false ) {
106
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
107
-        }
108
-
109
-        switch ($uploadedFile['error']) {
110
-            case UPLOAD_ERR_OK:
111
-                break;
112
-
113
-            case UPLOAD_ERR_INI_SIZE:
114
-            case UPLOAD_ERR_FORM_SIZE:
115
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
116
-                break;
117
-
118
-            case UPLOAD_ERR_PARTIAL:
119
-            case UPLOAD_ERR_NO_FILE:
120
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
121
-                break;
122
-
123
-            case UPLOAD_ERR_NO_TMP_DIR:
124
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_NO_TMP_DIR);
125
-                break;
126
-
127
-            case UPLOAD_ERR_CANT_WRITE:
128
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
129
-                break;
130
-
131
-            case UPLOAD_ERR_EXTENSION:
132
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
133
-                break;
134
-        }
135
-
136
-        $sServerDir = $this->_currentFolder->getServerPath();
137
-        $iCounter = 0;
138
-
139
-        while (true)
140
-        {
141
-            $sFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($sServerDir, $sFileName);
142
-
143
-
144
-            if (file_exists($sFilePath)) {
145
-
146
-                $iCounter++;
147
-                $sFileName =
148
-                CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($sFileNameOrginal) .
149
-                "(" . $iCounter . ")" . "." .
150
-                CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
151
-                $oRegistry->set("FileUpload_fileName", $sFileName);
152
-
153
-                $iErrorNumber = CKFINDER_CONNECTOR_ERROR_UPLOADED_FILE_RENAMED;
154
-            } else {
155
-                if (false === move_uploaded_file($uploadedFile['tmp_name'], $sFilePath)) {
156
-                    $iErrorNumber = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
157
-                }
158
-                else {
159
-                    if (isset($detectHtml) && $detectHtml === -1 && CKFinder_Connector_Utils_FileSystem::detectHtml($sFilePath) === true) {
160
-                        @unlink($sFilePath);
161
-                        $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_WRONG_HTML_FILE);
162
-                    }
163
-                    else if (isset($isImageValid) && $isImageValid === -1 && CKFinder_Connector_Utils_FileSystem::isImageValid($sFilePath, $sExtension) === false) {
164
-                        @unlink($sFilePath);
165
-                        $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
166
-                    }
167
-                }
168
-                if (is_file($sFilePath) && ($perms = $_config->getChmodFiles())) {
169
-                    $oldumask = umask(0);
170
-                    chmod($sFilePath, $perms);
171
-                    umask($oldumask);
172
-                }
173
-                break;
174
-            }
175
-        }
176
-
177
-        if (!$_config->checkSizeAfterScaling()) {
178
-            $this->_errorHandler->throwError($iErrorNumber, true, false);
179
-        }
180
-
181
-        //resize image if required
182
-        require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/Thumbnail.php";
183
-        $_imagesConfig = $_config->getImagesConfig();
184
-
185
-        if ($_imagesConfig->getMaxWidth()>0 && $_imagesConfig->getMaxHeight()>0 && $_imagesConfig->getQuality()>0) {
186
-            CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true) ;
187
-        }
188
-
189
-        if ($_config->checkSizeAfterScaling()) {
190
-            //check file size after scaling, attempt to delete if too big
191
-            clearstatcache();
192
-            if ($maxSize && filesize($sFilePath)>$maxSize) {
193
-                @unlink($sFilePath);
194
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
195
-            }
196
-            else {
197
-                $this->_errorHandler->throwError($iErrorNumber, true, false);
198
-            }
199
-        }
200
-
201
-        CKFinder_Connector_Core_Hooks::run('AfterFileUpload', array(&$this->_currentFolder, &$uploadedFile, &$sFilePath));
202
-    }
30
+	/**
31
+	 * Command name
32
+	 *
33
+	 * @access protected
34
+	 * @var string
35
+	 */
36
+	var $command = "FileUpload";
37
+
38
+	/**
39
+	 * send response (save uploaded file, resize if required)
40
+	 * @access public
41
+	 *
42
+	 */
43
+	function sendResponse()
44
+	{
45
+		$iErrorNumber = CKFINDER_CONNECTOR_ERROR_NONE;
46
+
47
+		$_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
48
+		$oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
49
+		$oRegistry->set("FileUpload_fileName", "unknown file");
50
+
51
+		$uploadedFile = array_shift($_FILES);
52
+
53
+		if (!isset($uploadedFile['name'])) {
54
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID);
55
+		}
56
+
57
+		$sUnsafeFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding(CKFinder_Connector_Utils_Misc::mbBasename($uploadedFile['name']));
58
+		$sFileName = str_replace(array(":", "*", "?", "|", "/"), "_", $sUnsafeFileName);
59
+		if ($_config->forceAscii()) {
60
+			$sFileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sFileName);
61
+		}
62
+		if ($sFileName != $sUnsafeFileName) {
63
+		  $iErrorNumber = CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID_NAME_RENAMED;
64
+		}
65
+		$oRegistry->set("FileUpload_fileName", $sFileName);
66
+		$oRegistry->set("FileUpload_url", $this->_currentFolder->getUrl());
67
+
68
+		$this->checkConnector();
69
+		$this->checkRequest();
70
+
71
+		if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD)) {
72
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
73
+		}
74
+
75
+		$_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
76
+		if (!CKFinder_Connector_Utils_FileSystem::checkFileName($sFileName) || $_resourceTypeConfig->checkIsHiddenFile($sFileName)) {
77
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
78
+		}
79
+
80
+		$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
81
+		if (!$resourceTypeInfo->checkExtension($sFileName)) {
82
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
83
+		}
84
+
85
+		$sFileNameOrginal = $sFileName;
86
+		$oRegistry->set("FileUpload_fileName", $sFileName);
87
+
88
+		$maxSize = $resourceTypeInfo->getMaxSize();
89
+		if (!$_config->checkSizeAfterScaling() && $maxSize && $uploadedFile['size']>$maxSize) {
90
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
91
+		}
92
+
93
+		$htmlExtensions = $_config->getHtmlExtensions();
94
+		$sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
95
+
96
+		if ($htmlExtensions
97
+		&& !CKFinder_Connector_Utils_Misc::inArrayCaseInsensitive($sExtension, $htmlExtensions)
98
+		&& ($detectHtml = CKFinder_Connector_Utils_FileSystem::detectHtml($uploadedFile['tmp_name'])) === true ) {
99
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_WRONG_HTML_FILE);
100
+		}
101
+
102
+		$sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
103
+		$secureImageUploads = $_config->getSecureImageUploads();
104
+		if ($secureImageUploads
105
+		&& ($isImageValid = CKFinder_Connector_Utils_FileSystem::isImageValid($uploadedFile['tmp_name'], $sExtension)) === false ) {
106
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
107
+		}
108
+
109
+		switch ($uploadedFile['error']) {
110
+			case UPLOAD_ERR_OK:
111
+				break;
112
+
113
+			case UPLOAD_ERR_INI_SIZE:
114
+			case UPLOAD_ERR_FORM_SIZE:
115
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
116
+				break;
117
+
118
+			case UPLOAD_ERR_PARTIAL:
119
+			case UPLOAD_ERR_NO_FILE:
120
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
121
+				break;
122
+
123
+			case UPLOAD_ERR_NO_TMP_DIR:
124
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_NO_TMP_DIR);
125
+				break;
126
+
127
+			case UPLOAD_ERR_CANT_WRITE:
128
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
129
+				break;
130
+
131
+			case UPLOAD_ERR_EXTENSION:
132
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
133
+				break;
134
+		}
135
+
136
+		$sServerDir = $this->_currentFolder->getServerPath();
137
+		$iCounter = 0;
138
+
139
+		while (true)
140
+		{
141
+			$sFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($sServerDir, $sFileName);
142
+
143
+
144
+			if (file_exists($sFilePath)) {
145
+
146
+				$iCounter++;
147
+				$sFileName =
148
+				CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($sFileNameOrginal) .
149
+				"(" . $iCounter . ")" . "." .
150
+				CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
151
+				$oRegistry->set("FileUpload_fileName", $sFileName);
152
+
153
+				$iErrorNumber = CKFINDER_CONNECTOR_ERROR_UPLOADED_FILE_RENAMED;
154
+			} else {
155
+				if (false === move_uploaded_file($uploadedFile['tmp_name'], $sFilePath)) {
156
+					$iErrorNumber = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
157
+				}
158
+				else {
159
+					if (isset($detectHtml) && $detectHtml === -1 && CKFinder_Connector_Utils_FileSystem::detectHtml($sFilePath) === true) {
160
+						@unlink($sFilePath);
161
+						$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_WRONG_HTML_FILE);
162
+					}
163
+					else if (isset($isImageValid) && $isImageValid === -1 && CKFinder_Connector_Utils_FileSystem::isImageValid($sFilePath, $sExtension) === false) {
164
+						@unlink($sFilePath);
165
+						$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
166
+					}
167
+				}
168
+				if (is_file($sFilePath) && ($perms = $_config->getChmodFiles())) {
169
+					$oldumask = umask(0);
170
+					chmod($sFilePath, $perms);
171
+					umask($oldumask);
172
+				}
173
+				break;
174
+			}
175
+		}
176
+
177
+		if (!$_config->checkSizeAfterScaling()) {
178
+			$this->_errorHandler->throwError($iErrorNumber, true, false);
179
+		}
180
+
181
+		//resize image if required
182
+		require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/Thumbnail.php";
183
+		$_imagesConfig = $_config->getImagesConfig();
184
+
185
+		if ($_imagesConfig->getMaxWidth()>0 && $_imagesConfig->getMaxHeight()>0 && $_imagesConfig->getQuality()>0) {
186
+			CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true) ;
187
+		}
188
+
189
+		if ($_config->checkSizeAfterScaling()) {
190
+			//check file size after scaling, attempt to delete if too big
191
+			clearstatcache();
192
+			if ($maxSize && filesize($sFilePath)>$maxSize) {
193
+				@unlink($sFilePath);
194
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
195
+			}
196
+			else {
197
+				$this->_errorHandler->throwError($iErrorNumber, true, false);
198
+			}
199
+		}
200
+
201
+		CKFinder_Connector_Core_Hooks::run('AfterFileUpload', array(&$this->_currentFolder, &$uploadedFile, &$sFilePath));
202
+	}
203 203
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $iErrorNumber = CKFINDER_CONNECTOR_ERROR_NONE;
46 46
 
47
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
48
-        $oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
47
+        $_config = & CKFinder_Connector_Core_Factory::getInstance("Core_Config");
48
+        $oRegistry = & CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
49 49
         $oRegistry->set("FileUpload_fileName", "unknown file");
50 50
 
51 51
         $uploadedFile = array_shift($_FILES);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $oRegistry->set("FileUpload_fileName", $sFileName);
87 87
 
88 88
         $maxSize = $resourceTypeInfo->getMaxSize();
89
-        if (!$_config->checkSizeAfterScaling() && $maxSize && $uploadedFile['size']>$maxSize) {
89
+        if (!$_config->checkSizeAfterScaling() && $maxSize && $uploadedFile['size'] > $maxSize) {
90 90
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
91 91
         }
92 92
 
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 
96 96
         if ($htmlExtensions
97 97
         && !CKFinder_Connector_Utils_Misc::inArrayCaseInsensitive($sExtension, $htmlExtensions)
98
-        && ($detectHtml = CKFinder_Connector_Utils_FileSystem::detectHtml($uploadedFile['tmp_name'])) === true ) {
98
+        && ($detectHtml = CKFinder_Connector_Utils_FileSystem::detectHtml($uploadedFile['tmp_name'])) === true) {
99 99
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_WRONG_HTML_FILE);
100 100
         }
101 101
 
102 102
         $sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
103 103
         $secureImageUploads = $_config->getSecureImageUploads();
104 104
         if ($secureImageUploads
105
-        && ($isImageValid = CKFinder_Connector_Utils_FileSystem::isImageValid($uploadedFile['tmp_name'], $sExtension)) === false ) {
105
+        && ($isImageValid = CKFinder_Connector_Utils_FileSystem::isImageValid($uploadedFile['tmp_name'], $sExtension)) === false) {
106 106
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
107 107
         }
108 108
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 
146 146
                 $iCounter++;
147 147
                 $sFileName =
148
-                CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($sFileNameOrginal) .
149
-                "(" . $iCounter . ")" . "." .
148
+                CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($sFileNameOrginal).
149
+                "(".$iCounter.")".".".
150 150
                 CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal);
151 151
                 $oRegistry->set("FileUpload_fileName", $sFileName);
152 152
 
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
         }
180 180
 
181 181
         //resize image if required
182
-        require_once CKFINDER_CONNECTOR_LIB_DIR . "/CommandHandler/Thumbnail.php";
182
+        require_once CKFINDER_CONNECTOR_LIB_DIR."/CommandHandler/Thumbnail.php";
183 183
         $_imagesConfig = $_config->getImagesConfig();
184 184
 
185
-        if ($_imagesConfig->getMaxWidth()>0 && $_imagesConfig->getMaxHeight()>0 && $_imagesConfig->getQuality()>0) {
186
-            CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true) ;
185
+        if ($_imagesConfig->getMaxWidth() > 0 && $_imagesConfig->getMaxHeight() > 0 && $_imagesConfig->getQuality() > 0) {
186
+            CKFinder_Connector_CommandHandler_Thumbnail::createThumb($sFilePath, $sFilePath, $_imagesConfig->getMaxWidth(), $_imagesConfig->getMaxHeight(), $_imagesConfig->getQuality(), true);
187 187
         }
188 188
 
189 189
         if ($_config->checkSizeAfterScaling()) {
190 190
             //check file size after scaling, attempt to delete if too big
191 191
             clearstatcache();
192
-            if ($maxSize && filesize($sFilePath)>$maxSize) {
192
+            if ($maxSize && filesize($sFilePath) > $maxSize) {
193 193
                 @unlink($sFilePath);
194 194
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
195 195
             }
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  * modifying or distribute this file or part of its contents. The contents of
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
@@ -154,13 +156,11 @@  discard block
 block discarded – undo
154 156
             } else {
155 157
                 if (false === move_uploaded_file($uploadedFile['tmp_name'], $sFilePath)) {
156 158
                     $iErrorNumber = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
157
-                }
158
-                else {
159
+                } else {
159 160
                     if (isset($detectHtml) && $detectHtml === -1 && CKFinder_Connector_Utils_FileSystem::detectHtml($sFilePath) === true) {
160 161
                         @unlink($sFilePath);
161 162
                         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_WRONG_HTML_FILE);
162
-                    }
163
-                    else if (isset($isImageValid) && $isImageValid === -1 && CKFinder_Connector_Utils_FileSystem::isImageValid($sFilePath, $sExtension) === false) {
163
+                    } else if (isset($isImageValid) && $isImageValid === -1 && CKFinder_Connector_Utils_FileSystem::isImageValid($sFilePath, $sExtension) === false) {
164 164
                         @unlink($sFilePath);
165 165
                         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
166 166
                     }
@@ -192,8 +192,7 @@  discard block
 block discarded – undo
192 192
             if ($maxSize && filesize($sFilePath)>$maxSize) {
193 193
                 @unlink($sFilePath);
194 194
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
195
-            }
196
-            else {
195
+            } else {
197 196
                 $this->_errorHandler->throwError($iErrorNumber, true, false);
198 197
             }
199 198
         }
Please login to merge, or discard this patch.
libs/ckfinder/core/connector/php/php4/CommandHandler/CommandHandlerBase.php 3 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -29,100 +29,100 @@
 block discarded – undo
29 29
  */
30 30
 class CKFinder_Connector_CommandHandler_CommandHandlerBase
31 31
 {
32
-    /**
33
-     * CKFinder_Connector_Core_Connector object
34
-     *
35
-     * @access protected
36
-     * @var CKFinder_Connector_Core_Connector
37
-     */
38
-    var $_connector;
39
-    /**
40
-     * CKFinder_Connector_Core_FolderHandler object
41
-     *
42
-     * @access protected
43
-     * @var CKFinder_Connector_Core_FolderHandler
44
-     */
45
-    var $_currentFolder;
46
-    /**
47
-     * Error handler object
48
-     *
49
-     * @access protected
50
-     * @var CKFinder_Connector_ErrorHandler_Base|CKFinder_Connector_ErrorHandler_FileUpload|CKFinder_Connector_ErrorHandler_Http
51
-     */
52
-    var $_errorHandler;
32
+	/**
33
+	 * CKFinder_Connector_Core_Connector object
34
+	 *
35
+	 * @access protected
36
+	 * @var CKFinder_Connector_Core_Connector
37
+	 */
38
+	var $_connector;
39
+	/**
40
+	 * CKFinder_Connector_Core_FolderHandler object
41
+	 *
42
+	 * @access protected
43
+	 * @var CKFinder_Connector_Core_FolderHandler
44
+	 */
45
+	var $_currentFolder;
46
+	/**
47
+	 * Error handler object
48
+	 *
49
+	 * @access protected
50
+	 * @var CKFinder_Connector_ErrorHandler_Base|CKFinder_Connector_ErrorHandler_FileUpload|CKFinder_Connector_ErrorHandler_Http
51
+	 */
52
+	var $_errorHandler;
53 53
 
54
-    function CKFinder_Connector_CommandHandler_CommandHandlerBase()
55
-    {
56
-        $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
57
-        $this->_connector =& CKFinder_Connector_Core_Factory::getInstance("Core_Connector");
58
-        $this->_errorHandler =& $this->_connector->getErrorHandler();
59
-    }
54
+	function CKFinder_Connector_CommandHandler_CommandHandlerBase()
55
+	{
56
+		$this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
57
+		$this->_connector =& CKFinder_Connector_Core_Factory::getInstance("Core_Connector");
58
+		$this->_errorHandler =& $this->_connector->getErrorHandler();
59
+	}
60 60
 
61
-    /**
62
-     * Get Folder Handler
63
-     *
64
-     * @return CKFinder_Connector_Core_FolderHandler
65
-     * @access public
66
-     */
67
-    function getFolderHandler()
68
-    {
69
-        if (is_null($this->_currentFolder)) {
70
-            $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
71
-        }
61
+	/**
62
+	 * Get Folder Handler
63
+	 *
64
+	 * @return CKFinder_Connector_Core_FolderHandler
65
+	 * @access public
66
+	 */
67
+	function getFolderHandler()
68
+	{
69
+		if (is_null($this->_currentFolder)) {
70
+			$this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
71
+		}
72 72
 
73
-        return $this->_currentFolder;
74
-    }
73
+		return $this->_currentFolder;
74
+	}
75 75
 
76
-    /**
77
-     * Check whether Connector is enabled
78
-     * @access protected
79
-     *
80
-     */
81
-    function checkConnector()
82
-    {
83
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
84
-        if (!$_config->getIsEnabled()) {
85
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);
86
-        }
87
-    }
76
+	/**
77
+	 * Check whether Connector is enabled
78
+	 * @access protected
79
+	 *
80
+	 */
81
+	function checkConnector()
82
+	{
83
+		$_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
84
+		if (!$_config->getIsEnabled()) {
85
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);
86
+		}
87
+	}
88 88
 
89
-    /**
90
-     * Check request
91
-     * @access protected
92
-     *
93
-     */
94
-    function checkRequest()
95
-    {
96
-        if (preg_match(CKFINDER_REGEX_INVALID_PATH, $this->_currentFolder->getClientPath())) {
97
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
98
-        }
89
+	/**
90
+	 * Check request
91
+	 * @access protected
92
+	 *
93
+	 */
94
+	function checkRequest()
95
+	{
96
+		if (preg_match(CKFINDER_REGEX_INVALID_PATH, $this->_currentFolder->getClientPath())) {
97
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
98
+		}
99 99
 
100
-        $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
100
+		$_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
101 101
 
102
-        if (is_null($_resourceTypeConfig)) {
103
-            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_TYPE);
104
-        }
102
+		if (is_null($_resourceTypeConfig)) {
103
+			$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_TYPE);
104
+		}
105 105
 
106 106
 
107
-        $_clientPath = $this->_currentFolder->getClientPath();
108
-        $_clientPathParts = explode("/", trim($_clientPath, "/"));
109
-        if ($_clientPathParts) {
110
-            foreach ($_clientPathParts as $_part) {
111
-                if ($_resourceTypeConfig->checkIsHiddenFolder($_part)) {
112
-                    $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
113
-                }
114
-            }
115
-        }
107
+		$_clientPath = $this->_currentFolder->getClientPath();
108
+		$_clientPathParts = explode("/", trim($_clientPath, "/"));
109
+		if ($_clientPathParts) {
110
+			foreach ($_clientPathParts as $_part) {
111
+				if ($_resourceTypeConfig->checkIsHiddenFolder($_part)) {
112
+					$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
113
+				}
114
+			}
115
+		}
116 116
 
117
-        if (!is_dir($this->_currentFolder->getServerPath())) {
118
-            if ($_clientPath == "/") {
119
-                if (!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($this->_currentFolder->getServerPath())) {
117
+		if (!is_dir($this->_currentFolder->getServerPath())) {
118
+			if ($_clientPath == "/") {
119
+				if (!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($this->_currentFolder->getServerPath())) {
120 120
 
121
-                }
122
-            }
123
-            else {
124
-                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
125
-            }
126
-        }
127
-    }
121
+				}
122
+			}
123
+			else {
124
+				$this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
125
+			}
126
+		}
127
+	}
128 128
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
     function CKFinder_Connector_CommandHandler_CommandHandlerBase()
55 55
     {
56
-        $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
57
-        $this->_connector =& CKFinder_Connector_Core_Factory::getInstance("Core_Connector");
58
-        $this->_errorHandler =& $this->_connector->getErrorHandler();
56
+        $this->_currentFolder = & CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
57
+        $this->_connector = & CKFinder_Connector_Core_Factory::getInstance("Core_Connector");
58
+        $this->_errorHandler = & $this->_connector->getErrorHandler();
59 59
     }
60 60
 
61 61
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     function getFolderHandler()
68 68
     {
69 69
         if (is_null($this->_currentFolder)) {
70
-            $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
70
+            $this->_currentFolder = & CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");
71 71
         }
72 72
 
73 73
         return $this->_currentFolder;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     function checkConnector()
82 82
     {
83
-        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
83
+        $_config = & CKFinder_Connector_Core_Factory::getInstance("Core_Config");
84 84
         if (!$_config->getIsEnabled()) {
85 85
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);
86 86
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  * modifying or distribute this file or part of its contents. The contents of
11 11
  * this file is part of the Source Code of CKFinder.
12 12
  */
13
-if (!defined('IN_CKFINDER')) exit;
13
+if (!defined('IN_CKFINDER')) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * @package CKFinder
@@ -119,8 +121,7 @@  discard block
 block discarded – undo
119 121
                 if (!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($this->_currentFolder->getServerPath())) {
120 122
 
121 123
                 }
122
-            }
123
-            else {
124
+            } else {
124 125
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
125 126
             }
126 127
         }
Please login to merge, or discard this patch.