Passed
Push — develop ( 6fc664...92a637 )
by Jens
08:36
created
cloudcontrol/library/images/methods/SmartCrop.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@
 block discarded – undo
62 62
 
63 63
 			// Preserve transparency
64 64
 			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
65
-            imagealphablending($new, false);
66
-            imagesavealpha($new, true);
65
+			imagealphablending($new, false);
66
+			imagesavealpha($new, true);
67 67
 			
68 68
 			imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight);
69 69
 			
Please login to merge, or discard this patch.
cloudcontrol/library/images/methods/Crop.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@
 block discarded – undo
62 62
 
63 63
 			// Preserve transparency
64 64
 			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
65
-            imagealphablending($new, false);
66
-            imagesavealpha($new, true);
65
+			imagealphablending($new, false);
66
+			imagesavealpha($new, true);
67 67
 			
68 68
 			imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight);
69 69
 			
Please login to merge, or discard this patch.
cloudcontrol/library/images/methods/BoxCrop.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		/**
18 18
 		 * @param resource $imageResource
19 19
 		 * @return resource
20
-         */
20
+		 */
21 21
 		public function Execute($imageResource)
22 22
 		{
23 23
 			// Define the origial width and height
Please login to merge, or discard this patch.
cloudcontrol/library/storage/JsonStorage.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 		/**
787 787
 		 * @param $filename
788 788
 		 * @return null
789
-         */
789
+		 */
790 790
 		public function getImageByName($filename)
791 791
 		{
792 792
 			$images = $this->getImages();
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		/**
877 877
 		 * @param $filename
878 878
 		 * @return null
879
-         */
879
+		 */
880 880
 		public function getFileByName($filename)
881 881
 		{
882 882
 			$files = $this->getFiles();
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 		/**
892 892
 		 * @param $filename
893 893
 		 * @throws \Exception
894
-         */
894
+		 */
895 895
 		public function deleteFileByName($filename)
896 896
 		{
897 897
 			$destinationPath = realpath(__DIR__ . '/../../www/files/');
Please login to merge, or discard this patch.
cloudcontrol/library/cc/errorhandler.php 1 patch
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function shutdownHandler () {
33 33
 	$error = error_get_last(); 
34
-    if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { 
35
-        errorHandler($error['type'],$error['message'],$error['file'],$error['line']);
36
-    }elseif ($error['type'] == 1) {
37
-        dump($error);
38
-    }
34
+	if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { 
35
+		errorHandler($error['type'],$error['message'],$error['file'],$error['line']);
36
+	}elseif ($error['type'] == 1) {
37
+		dump($error);
38
+	}
39 39
 }
40 40
 
41 41
 /**
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 	$jsonErrorNr = json_last_error();
50 50
 	$errstr = '';
51 51
 	switch ($jsonErrorNr) {
52
-        case JSON_ERROR_NONE:
53
-            $errstr .= ' - No errors' . PHP_EOL;
54
-        break;
55
-        case JSON_ERROR_DEPTH:
56
-            $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL;
57
-        break;
58
-        case JSON_ERROR_STATE_MISMATCH:
59
-            $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL;
60
-        break;
61
-        case JSON_ERROR_CTRL_CHAR:
62
-            $errstr .= ' - Unexpected control character found' . PHP_EOL;
63
-        break;
64
-        case JSON_ERROR_SYNTAX:
65
-            $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL;
66
-        break;
67
-        case JSON_ERROR_UTF8:
68
-            $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL;
69
-        break;
70
-        default:
71
-            $errstr = ' - Unknown error' . PHP_EOL;
72
-        break;
73
-    }
52
+		case JSON_ERROR_NONE:
53
+			$errstr .= ' - No errors' . PHP_EOL;
54
+		break;
55
+		case JSON_ERROR_DEPTH:
56
+			$errstr .= ' - Maximum stack depth exceeded' . PHP_EOL;
57
+		break;
58
+		case JSON_ERROR_STATE_MISMATCH:
59
+			$errstr .= ' - Underflow or the modes mismatch' . PHP_EOL;
60
+		break;
61
+		case JSON_ERROR_CTRL_CHAR:
62
+			$errstr .= ' - Unexpected control character found' . PHP_EOL;
63
+		break;
64
+		case JSON_ERROR_SYNTAX:
65
+			$errstr .= ' - Syntax error, malformed JSON' . PHP_EOL;
66
+		break;
67
+		case JSON_ERROR_UTF8:
68
+			$errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL;
69
+		break;
70
+		default:
71
+			$errstr = ' - Unknown error' . PHP_EOL;
72
+		break;
73
+	}
74 74
 	errorHandler ($jsonErrorNr, $errstr, $file, $line);
75 75
 }
76 76
 
@@ -85,102 +85,102 @@  discard block
 block discarded – undo
85 85
  * @param string $httpHeader
86 86
  */
87 87
 function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') {
88
-    if (ob_get_contents()) ob_end_clean();
88
+	if (ob_get_contents()) ob_end_clean();
89 89
 
90
-    if (canShowError()) {
91
-        $file_lines = file_exists($file) ? file($file) : array();
92
-        $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15);
93
-        $lines = array();
90
+	if (canShowError()) {
91
+		$file_lines = file_exists($file) ? file($file) : array();
92
+		$range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15);
93
+		$lines = array();
94 94
 
95
-        foreach ($range as $line_number) {
96
-            if(isset($file_lines[$line_number-1])) {
97
-                $lines[$line_number] = $file_lines[$line_number-1];
98
-            }
99
-        }
95
+		foreach ($range as $line_number) {
96
+			if(isset($file_lines[$line_number-1])) {
97
+				$lines[$line_number] = $file_lines[$line_number-1];
98
+			}
99
+		}
100 100
 
101
-        $error = array(
102
-            'message' 		=> $message,
103
-            'file' 			=> $file,
104
-            'line' 			=> $line,
105
-            'code' 			=> $code,
106
-            'lines' 		=> $lines,
107
-            'trace' 		=> $trace,
108
-            'httpHeader' 	=> $httpHeader,
109
-        );
101
+		$error = array(
102
+			'message' 		=> $message,
103
+			'file' 			=> $file,
104
+			'line' 			=> $line,
105
+			'code' 			=> $code,
106
+			'lines' 		=> $lines,
107
+			'trace' 		=> $trace,
108
+			'httpHeader' 	=> $httpHeader,
109
+		);
110 110
 
111
-        if (PHP_SAPI === 'cli') {
112
-            renderCliException($message, $file, $line, $code, $trace, $lines);
113
-        }
111
+		if (PHP_SAPI === 'cli') {
112
+			renderCliException($message, $file, $line, $code, $trace, $lines);
113
+		}
114 114
 
115
-        if (file_exists(realpath(__DIR__) . '/errorviewdetailed.php')) {
116
-            include(realpath(__DIR__) . '/errorviewdetailed.php');
117
-        } else {
118
-            header('Content-type: application/json');
119
-            die(json_encode($error));
120
-        }
121
-        exit;
122
-    } else {
123
-        header($_SERVER['SERVER_PROTOCOL'] . $httpHeader, true);
124
-        header('X-Error-Message: ' . $message);
125
-        header('X-Error-File: ' . $file);
126
-        header('X-Error-Line: ' . $line);
127
-        if (file_exists(realpath(__DIR__) . '/errorviewcompact.php')) {
128
-            include(realpath(__DIR__) . '/errorviewcompact.php');
129
-        } else {
130
-            header('Content-type: application/json');
131
-            die(json_encode('An error occured.'));
132
-        }
133
-    }
115
+		if (file_exists(realpath(__DIR__) . '/errorviewdetailed.php')) {
116
+			include(realpath(__DIR__) . '/errorviewdetailed.php');
117
+		} else {
118
+			header('Content-type: application/json');
119
+			die(json_encode($error));
120
+		}
121
+		exit;
122
+	} else {
123
+		header($_SERVER['SERVER_PROTOCOL'] . $httpHeader, true);
124
+		header('X-Error-Message: ' . $message);
125
+		header('X-Error-File: ' . $file);
126
+		header('X-Error-Line: ' . $line);
127
+		if (file_exists(realpath(__DIR__) . '/errorviewcompact.php')) {
128
+			include(realpath(__DIR__) . '/errorviewcompact.php');
129
+		} else {
130
+			header('Content-type: application/json');
131
+			die(json_encode('An error occured.'));
132
+		}
133
+	}
134 134
 }
135 135
 
136 136
 function canShowError()
137 137
 {
138
-    if (PHP_SAPI === 'cli') {
139
-        return true;
140
-    }
141
-    if (file_exists('../config.json') && !isset($_SESSION['cloudcontrol'])) {
142
-        $config = file_get_contents('../config.json');
143
-        $config = json_decode($config);
144
-        if (isset($config->showErrorsToAll)) {
145
-            return $config->showErrorsToAll;
146
-        }
147
-    } else {
148
-        return true;
149
-    }
138
+	if (PHP_SAPI === 'cli') {
139
+		return true;
140
+	}
141
+	if (file_exists('../config.json') && !isset($_SESSION['cloudcontrol'])) {
142
+		$config = file_get_contents('../config.json');
143
+		$config = json_decode($config);
144
+		if (isset($config->showErrorsToAll)) {
145
+			return $config->showErrorsToAll;
146
+		}
147
+	} else {
148
+		return true;
149
+	}
150 150
 }
151 151
 
152 152
 function renderCliException($message, $file, $line, $code, $trace, $lines)
153 153
 {
154
-    echo PHP_EOL;
155
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
156
-    echo '| THE FOLLOWING ERROR OCCURED                                                                                                                  |' . PHP_EOL;
157
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
158
-    echo PHP_EOL;
159
-    echo '  ' . $message . PHP_EOL;
160
-    echo PHP_EOL;
161
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
162
-    echo '| IN FILE                                                                                                                                      |' . PHP_EOL;
163
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
164
-    echo PHP_EOL;
165
-    echo '  ' . $file . ':' . $line . PHP_EOL;
166
-    echo PHP_EOL;
167
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
168
-    echo '| CONTENTS OF THE FILE                                                                                                                         |' . PHP_EOL;
169
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
170
-    echo PHP_EOL;
171
-    foreach($lines as $nr => $currentLine) {
172
-        echo ($nr == $line ? '* ' : '  ' ) . str_pad($nr, 3, "0", STR_PAD_LEFT) . ' ' . $currentLine;
173
-    }
174
-    echo PHP_EOL;
175
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
176
-    echo '| STACK TRACE                                                                                                                                  |' . PHP_EOL;
177
-    echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
178
-    foreach($trace as $row) {
179
-        echo (isset($row['file']) ? basename($row['file']) : '') . ':'
180
-            . (isset($row['line']) ? $row['line'] : '') . "\t\t\t"
181
-            . (isset($row['class']) ? $row['class'] : ' ') . "\t\t\t"
182
-            . (isset($row['type']) ? $row['type'] : ' ') . "\t\t\t"
183
-            . (isset($row['function']) ? $row['function'] : ' ') . PHP_EOL;
184
-    }
185
-    exit;
154
+	echo PHP_EOL;
155
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
156
+	echo '| THE FOLLOWING ERROR OCCURED                                                                                                                  |' . PHP_EOL;
157
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
158
+	echo PHP_EOL;
159
+	echo '  ' . $message . PHP_EOL;
160
+	echo PHP_EOL;
161
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
162
+	echo '| IN FILE                                                                                                                                      |' . PHP_EOL;
163
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
164
+	echo PHP_EOL;
165
+	echo '  ' . $file . ':' . $line . PHP_EOL;
166
+	echo PHP_EOL;
167
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
168
+	echo '| CONTENTS OF THE FILE                                                                                                                         |' . PHP_EOL;
169
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
170
+	echo PHP_EOL;
171
+	foreach($lines as $nr => $currentLine) {
172
+		echo ($nr == $line ? '* ' : '  ' ) . str_pad($nr, 3, "0", STR_PAD_LEFT) . ' ' . $currentLine;
173
+	}
174
+	echo PHP_EOL;
175
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
176
+	echo '| STACK TRACE                                                                                                                                  |' . PHP_EOL;
177
+	echo '------------------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
178
+	foreach($trace as $row) {
179
+		echo (isset($row['file']) ? basename($row['file']) : '') . ':'
180
+			. (isset($row['line']) ? $row['line'] : '') . "\t\t\t"
181
+			. (isset($row['class']) ? $row['class'] : ' ') . "\t\t\t"
182
+			. (isset($row['type']) ? $row['type'] : ' ') . "\t\t\t"
183
+			. (isset($row['function']) ? $row['function'] : ' ') . PHP_EOL;
184
+	}
185
+	exit;
186 186
 }
187 187
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/LanguageComponent.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -7,124 +7,124 @@
 block discarded – undo
7 7
 
8 8
 class LanguageComponent implements Component
9 9
 {
10
-    protected $request;
11
-    protected $parameters;
12
-
13
-    protected $defaultLanguage = 'en';
14
-    protected $acceptedLanguages = null;
15
-    protected $languageParameterName = 'language';
16
-    protected $forceRedirect = false;
17
-    protected $sessionValues;
18
-
19
-    /**
20
-     * Component constructor.
21
-     *
22
-     * @param                     $template
23
-     * @param Request $request
24
-     * @param                     $parameters
25
-     * @param                     $matchedSitemapItem
26
-     */
27
-    public function __construct($template, Request $request, $parameters, $matchedSitemapItem)
28
-    {
29
-        $this->parameters = (array) $parameters;
30
-        $this->checkParameters();
31
-
32
-        $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2);
33
-        $_SESSION['LanguageComponent']['detectedLanguage'] = $lang;
34
-
35
-        $this->checkLanguageSwitch($request);
36
-
37
-        if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) {
38
-            $this->detectLanguage($lang, $request);
39
-        } else {
40
-            if ($this->forceRedirect === true) {
41
-                $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request);
42
-            }
43
-        }
44
-
45
-        $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName];
46
-    }
47
-
48
-    /**
49
-     * Checks to see if any parameters are given from the configuration in the CMS
50
-     */
51
-    private function checkParameters()
52
-    {
53
-        if (isset($this->parameters['defaultLanguage'])) {
54
-            $this->defaultLanguage = $this->parameters['defaultLanguage'];
55
-            unset($this->parameters['defaultLanguage']);
56
-        }
57
-        if (isset($this->parameters['acceptedLanguages'])) {
58
-            $this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']);
59
-            unset($this->parameters['acceptedLanguages']);
60
-        }
61
-        if (isset($this->parameters['languageParameterName'])) {
62
-            $this->languageParameterName = $this->parameters['languageParameterName'];
63
-            unset($this->parameters['languageParameterName']);
64
-        }
65
-        if (isset($this->parameters['forceRedirect'])) {
66
-            $this->forceRedirect = (bool) $this->parameters['forceRedirect'];
67
-            unset($this->parameters['forceRedirect']);
68
-        }
69
-    }
70
-
71
-    /**
72
-     * @return array
73
-     */
74
-    public function getParameters()
75
-    {
76
-        return $this->parameters;
77
-    }
78
-
79
-
80
-    /**
81
-     * Check if the found language is allowed and
82
-     * if an action is to be taken.
83
-     *
84
-     * @param $lang
85
-     * @param $request
86
-     */
87
-    private function detectLanguage($lang, $request)
88
-    {
89
-        $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage;
90
-
91
-        if ($this->acceptedLanguages === null) {
92
-            $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
93
-        } else if (in_array($lang, $this->acceptedLanguages)) {
94
-            $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
95
-        } else {
96
-            $lang = $this->defaultLanguage;
97
-        }
98
-
99
-        $this->sessionValues = $_SESSION['LanguageComponent'];
100
-
101
-        if ($this->forceRedirect === true) {
102
-            if (substr($request::$relativeUri, 0, 2) !== $lang ) {
103
-                if ($lang !== $this->defaultLanguage) {
104
-                    header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri);
105
-                    exit;
106
-                }
107
-            }
108
-        }
109
-    }
110
-
111
-    /**
112
-     * Detect if the language is switched manually
113
-     *
114
-     * @param $request
115
-     */
116
-    private function checkLanguageSwitch($request)
117
-    {
118
-        if (isset($request::$get['langSwitch'])) {
119
-            $this->forceRedirect = true;
120
-            $this->detectLanguage($request::$get['langSwitch'], $request);
121
-        }
122
-    }
123
-
124
-    /*
10
+	protected $request;
11
+	protected $parameters;
12
+
13
+	protected $defaultLanguage = 'en';
14
+	protected $acceptedLanguages = null;
15
+	protected $languageParameterName = 'language';
16
+	protected $forceRedirect = false;
17
+	protected $sessionValues;
18
+
19
+	/**
20
+	 * Component constructor.
21
+	 *
22
+	 * @param                     $template
23
+	 * @param Request $request
24
+	 * @param                     $parameters
25
+	 * @param                     $matchedSitemapItem
26
+	 */
27
+	public function __construct($template, Request $request, $parameters, $matchedSitemapItem)
28
+	{
29
+		$this->parameters = (array) $parameters;
30
+		$this->checkParameters();
31
+
32
+		$lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2);
33
+		$_SESSION['LanguageComponent']['detectedLanguage'] = $lang;
34
+
35
+		$this->checkLanguageSwitch($request);
36
+
37
+		if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) {
38
+			$this->detectLanguage($lang, $request);
39
+		} else {
40
+			if ($this->forceRedirect === true) {
41
+				$this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request);
42
+			}
43
+		}
44
+
45
+		$this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName];
46
+	}
47
+
48
+	/**
49
+	 * Checks to see if any parameters are given from the configuration in the CMS
50
+	 */
51
+	private function checkParameters()
52
+	{
53
+		if (isset($this->parameters['defaultLanguage'])) {
54
+			$this->defaultLanguage = $this->parameters['defaultLanguage'];
55
+			unset($this->parameters['defaultLanguage']);
56
+		}
57
+		if (isset($this->parameters['acceptedLanguages'])) {
58
+			$this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']);
59
+			unset($this->parameters['acceptedLanguages']);
60
+		}
61
+		if (isset($this->parameters['languageParameterName'])) {
62
+			$this->languageParameterName = $this->parameters['languageParameterName'];
63
+			unset($this->parameters['languageParameterName']);
64
+		}
65
+		if (isset($this->parameters['forceRedirect'])) {
66
+			$this->forceRedirect = (bool) $this->parameters['forceRedirect'];
67
+			unset($this->parameters['forceRedirect']);
68
+		}
69
+	}
70
+
71
+	/**
72
+	 * @return array
73
+	 */
74
+	public function getParameters()
75
+	{
76
+		return $this->parameters;
77
+	}
78
+
79
+
80
+	/**
81
+	 * Check if the found language is allowed and
82
+	 * if an action is to be taken.
83
+	 *
84
+	 * @param $lang
85
+	 * @param $request
86
+	 */
87
+	private function detectLanguage($lang, $request)
88
+	{
89
+		$_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage;
90
+
91
+		if ($this->acceptedLanguages === null) {
92
+			$_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
93
+		} else if (in_array($lang, $this->acceptedLanguages)) {
94
+			$_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
95
+		} else {
96
+			$lang = $this->defaultLanguage;
97
+		}
98
+
99
+		$this->sessionValues = $_SESSION['LanguageComponent'];
100
+
101
+		if ($this->forceRedirect === true) {
102
+			if (substr($request::$relativeUri, 0, 2) !== $lang ) {
103
+				if ($lang !== $this->defaultLanguage) {
104
+					header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri);
105
+					exit;
106
+				}
107
+			}
108
+		}
109
+	}
110
+
111
+	/**
112
+	 * Detect if the language is switched manually
113
+	 *
114
+	 * @param $request
115
+	 */
116
+	private function checkLanguageSwitch($request)
117
+	{
118
+		if (isset($request::$get['langSwitch'])) {
119
+			$this->forceRedirect = true;
120
+			$this->detectLanguage($request::$get['langSwitch'], $request);
121
+		}
122
+	}
123
+
124
+	/*
125 125
      * These functions are required by the interface, but not for the functionality
126 126
      */
127
-    public function run(Storage $storage) {}
128
-    public function render() {}
129
-    public function get() {}
127
+	public function run(Storage $storage) {}
128
+	public function render() {}
129
+	public function get() {}
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/CmsComponent.php 1 patch
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -5,270 +5,270 @@
 block discarded – undo
5 5
 	use library\components\cms\DocumentRouting;
6 6
 	use library\components\cms\FilesRouting;
7 7
 	use library\components\cms\ImagesRouting;
8
-    use library\components\cms\SitemapRouting;
9
-    use library\crypt\Crypt;
10
-    use library\storage\Storage;
8
+	use library\components\cms\SitemapRouting;
9
+	use library\crypt\Crypt;
10
+	use library\storage\Storage;
11 11
 
12 12
 	class CmsComponent extends BaseComponent
13
-    {
14
-        /*
13
+	{
14
+		/*
15 15
          * var \library\storage\Storage
16 16
          */
17 17
 
18 18
 
19 19
 		public $storage;
20 20
 
21
-        const INVALID_CREDENTIALS_MESSAGE = 'Invalid username / password combination';
21
+		const INVALID_CREDENTIALS_MESSAGE = 'Invalid username / password combination';
22 22
 
23
-        const MAIN_NAV_CLASS = 'default';
23
+		const MAIN_NAV_CLASS = 'default';
24 24
 
25 25
 		const PARAMETER_APPLICATION_COMPONENT = 'applicationComponent';
26 26
 		const PARAMETER_APPLICATION_COMPONENTS = 'applicationComponents';
27
-        const PARAMETER_BLACKLIST_IPS = 'blacklistIps';
28
-        const PARAMETER_BODY = 'body';
29
-        const PARAMETER_BRICK = 'brick';
30
-        const PARAMETER_BRICKS = 'bricks';
31
-        const PARAMETER_CMS_PREFIX = 'cmsPrefix';
27
+		const PARAMETER_BLACKLIST_IPS = 'blacklistIps';
28
+		const PARAMETER_BODY = 'body';
29
+		const PARAMETER_BRICK = 'brick';
30
+		const PARAMETER_BRICKS = 'bricks';
31
+		const PARAMETER_CMS_PREFIX = 'cmsPrefix';
32 32
 		const PARAMETER_CONFIGURATION = 'configuration';
33
-        const PARAMETER_DOCUMENT = 'document';
34
-        const PARAMETER_DOCUMENTS = 'documents';
35
-        const PARAMETER_DOCUMENT_TYPE = 'documentType';
36
-        const PARAMETER_DOCUMENT_TYPES = 'documentTypes';
37
-        const PARAMETER_ERROR_MESSAGE = 'errorMsg';
38
-        const PARAMETER_FILES = 'files';
39
-        const PARAMETER_FOLDER = 'folder';
40
-        const PARAMETER_IMAGE = 'image';
41
-        const PARAMETER_IMAGES = 'images';
42
-        const PARAMETER_IMAGE_SET = 'imageSet';
43
-        const PARAMETER_MAIN_NAV_CLASS = 'mainNavClass';
44
-        const PARAMETER_MY_BRICK_SLUG = 'myBrickSlug';
45
-        const PARAMETER_SITEMAP = 'sitemap';
46
-        const PARAMETER_SITEMAP_ITEM = 'sitemapItem';
47
-        const PARAMETER_SMALLEST_IMAGE = 'smallestImage';
48
-        const PARAMETER_STATIC = 'static';
49
-        const PARAMETER_USER = 'user';
50
-        const PARAMETER_USERS = 'users';
51
-        const PARAMETER_USER_RIGHTS = 'userRights';
52
-        const PARAMETER_WHITELIST_IPS = 'whitelistIps';
53
-
54
-        const POST_PARAMETER_COMPONENT = 'component';
55
-        const POST_PARAMETER_PASSWORD = 'password';
56
-        const POST_PARAMETER_SAVE = 'save';
57
-        const POST_PARAMETER_TEMPLATE = 'template';
58
-        const POST_PARAMETER_TITLE = 'title';
59
-        const POST_PARAMETER_USERNAME = 'username';
60
-
61
-        const GET_PARAMETER_PATH = 'path';
62
-        const GET_PARAMETER_SLUG = 'slug';
63
-
64
-        const FILES_PARAMETER_FILE = 'file';
65
-
66
-        const SESSION_PARAMETER_CLOUD_CONTROL = 'cloudcontrol';
67
-
68
-        const LOGIN_TEMPLATE_PATH = 'cms/login';
69
-
70
-        const CONTENT_TYPE_APPLICATION_JSON = 'Content-type:application/json';
71
-
72
-        public $subTemplate = null;
73
-
74
-
75
-        /**
76
-         * @param \library\storage\Storage $storage
77
-         *
78
-         * @return void
79
-         */
80
-        public function run(Storage $storage)
81
-        {
82
-            $this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = self::MAIN_NAV_CLASS;
83
-            $this->storage = $storage;
84
-
85
-            $remoteAddress = $_SERVER['REMOTE_ADDR'];
86
-            $this->checkWhiteList($remoteAddress);
87
-            $this->checkBlackList($remoteAddress);
88
-
89
-            $this->checkLogin();
90
-
91
-            $this->parameters[self::PARAMETER_USER_RIGHTS] = $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]->rights;
92
-
93
-            $this->routing();
94
-        }
95
-
96
-        /**
97
-         * See if a user is logged or wants to log in and
98
-         * takes appropriate actions.
99
-         *
100
-         * @throws \Exception
101
-         */
102
-        protected function checkLogin()
103
-        {
104
-            $request = $this->request;
105
-
106
-            if (!isset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL])) {
107
-                if (isset($request::$post[self::POST_PARAMETER_USERNAME], $request::$post[self::POST_PARAMETER_PASSWORD])) {
108
-                    $user = $this->storage->getUserByUsername($request::$post[self::POST_PARAMETER_USERNAME]);
109
-                    $crypt = new Crypt();
110
-                    if (empty($user)) {
111
-                        $crypt->encrypt($request::$post[self::POST_PARAMETER_PASSWORD], 16); // Buy time, to avoid brute forcing
112
-                        $this->parameters[self::PARAMETER_ERROR_MESSAGE] = self::INVALID_CREDENTIALS_MESSAGE;
113
-                        $this->showLogin();
114
-                    } else {
115
-                        $salt = $user->salt;
116
-                        $password = $user->password;
117
-
118
-                        $passwordCorrect = $crypt->compare($request::$post[self::POST_PARAMETER_PASSWORD], $password, $salt);
119
-
120
-                        if ($passwordCorrect) {
121
-                            $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = $user;
122
-                        } else {
123
-                            $this->parameters[self::PARAMETER_ERROR_MESSAGE] = self::INVALID_CREDENTIALS_MESSAGE;
124
-                            $this->showLogin();
125
-                        }
126
-                    }
127
-                } else {
128
-                    $this->showLogin();
129
-                }
130
-            }
131
-        }
132
-
133
-        /**
134
-         * Overrides normal behaviour and only renders the
135
-         * login screen
136
-         *
137
-         * @throws \Exception
138
-         */
139
-        protected function showLogin()
140
-        {
141
-            $loginTemplatePath = self::LOGIN_TEMPLATE_PATH;
142
-            $this->renderTemplate($loginTemplatePath);
143
-            ob_end_flush();
144
-            exit;
145
-        }
146
-
147
-        /**
148
-         * As an exception, to keep the initial file structure simple
149
-         * the cms implements it's own routing, apart from the regular sitemap functionality
150
-         *
151
-         * @throws \Exception
152
-         */
153
-        protected function routing()
154
-        {
155
-            $relativeCmsUri = $this->getRelativeCmsUri($this->request);
156
-
157
-            $userRights = $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]->rights;
158
-
159
-            if ($relativeCmsUri == '' || $relativeCmsUri == '/') {
160
-                $this->subTemplate = 'cms/dashboard';
161
-            }
162
-
163
-            $this->logOffRouting($this->request, $relativeCmsUri);
164
-
165
-            $this->apiRouting($relativeCmsUri);
166
-
167
-            if (in_array(self::PARAMETER_DOCUMENTS, $userRights)) {
168
-                new DocumentRouting($this->request, $relativeCmsUri, $this);
169
-            }
170
-
171
-            if (in_array(self::PARAMETER_SITEMAP, $userRights)) {
172
-                new SitemapRouting($this->request, $relativeCmsUri, $this);
173
-            }
174
-
175
-            if (in_array(self::PARAMETER_IMAGES, $userRights)) {
176
-                new ImagesRouting($this->request, $relativeCmsUri, $this);
177
-            }
178
-
179
-            if (in_array(self::PARAMETER_FILES, $userRights)) {
180
-                new FilesRouting($this->request, $relativeCmsUri, $this);
181
-            }
182
-
183
-            if (in_array('configuration', $userRights)) {
184
-                new ConfigurationRouting($this->request, $relativeCmsUri, $this);
185
-            }
186
-
187
-            if ($this->subTemplate !== null) {
188
-                $this->parameters[self::PARAMETER_BODY] = $this->renderTemplate($this->subTemplate);
189
-            }
190
-        }
191
-
192
-        /**
193
-         * @param $remoteAddress
194
-         * @throws \Exception
195
-         */
196
-        private function checkWhiteList($remoteAddress)
197
-        {
198
-            if (isset($this->parameters[self::PARAMETER_WHITELIST_IPS])) {
199
-                $whitelistIps = explode(',', $this->parameters[self::PARAMETER_WHITELIST_IPS]);
200
-                $whitelistIps = array_map("trim", $whitelistIps);
201
-                if (!in_array($remoteAddress, $whitelistIps)) {
202
-                    throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist');
203
-                }
204
-            }
205
-        }
206
-
207
-        /**
208
-         * @param $remoteAddress
209
-         * @throws \Exception
210
-         */
211
-        private function checkBlackList($remoteAddress)
212
-        {
213
-            if (isset($this->parameters[self::PARAMETER_BLACKLIST_IPS])) {
214
-                $blacklistIps = explode(',', $this->parameters[self::PARAMETER_BLACKLIST_IPS]);
215
-                $blacklistIps = array_map("trim", $blacklistIps);
216
-                if (in_array($remoteAddress, $blacklistIps)) {
217
-                    throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist');
218
-                }
219
-            }
220
-        }
221
-
222
-        /**
223
-         * @param $request
224
-         * @return mixed|string
225
-         */
226
-        private function getRelativeCmsUri($request)
227
-        {
228
-            // TODO Use regex match parameter instead of calculating relative uri
229
-            $pos = strpos($request::$relativeUri, $this->parameters[self::PARAMETER_CMS_PREFIX]);
230
-            $relativeCmsUri = '/';
231
-            if ($pos !== false) {
232
-                $relativeCmsUri = substr_replace($request::$relativeUri, '', $pos, strlen($this->parameters[self::PARAMETER_CMS_PREFIX]));
233
-            }
234
-            return $relativeCmsUri;
235
-        }
236
-
237
-        /**
238
-         * @param $relativeCmsUri
239
-         */
240
-        private function apiRouting($relativeCmsUri)
241
-        {
242
-            if ($relativeCmsUri == '/images.json') {
243
-                header(self::CONTENT_TYPE_APPLICATION_JSON);
244
-                die(json_encode($this->storage->getImages()));
245
-            } elseif ($relativeCmsUri == '/files.json') {
246
-                header(self::CONTENT_TYPE_APPLICATION_JSON);
247
-                die(json_encode($this->storage->getFiles()));
248
-            } elseif ($relativeCmsUri == '/documents.json') {
249
-                header(self::CONTENT_TYPE_APPLICATION_JSON);
250
-                die(json_encode($this->storage->getDocuments()));
251
-            }
252
-        }
253
-
254
-        private function logOffRouting($request, $relativeCmsUri)
255
-        {
256
-            if ($relativeCmsUri == '/log-off') {
257
-                $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = null;
258
-                unset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]);
259
-                header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX]);
260
-                exit;
261
-            }
262
-        }
263
-
264
-        public function setParameter($parameterName, $parameterValue)
265
-        {
266
-            $this->parameters[$parameterName] = $parameterValue;
267
-        }
268
-
269
-        public function getParameter($parameterName)
270
-        {
271
-            return $this->parameters[$parameterName];
272
-        }
273
-    }
33
+		const PARAMETER_DOCUMENT = 'document';
34
+		const PARAMETER_DOCUMENTS = 'documents';
35
+		const PARAMETER_DOCUMENT_TYPE = 'documentType';
36
+		const PARAMETER_DOCUMENT_TYPES = 'documentTypes';
37
+		const PARAMETER_ERROR_MESSAGE = 'errorMsg';
38
+		const PARAMETER_FILES = 'files';
39
+		const PARAMETER_FOLDER = 'folder';
40
+		const PARAMETER_IMAGE = 'image';
41
+		const PARAMETER_IMAGES = 'images';
42
+		const PARAMETER_IMAGE_SET = 'imageSet';
43
+		const PARAMETER_MAIN_NAV_CLASS = 'mainNavClass';
44
+		const PARAMETER_MY_BRICK_SLUG = 'myBrickSlug';
45
+		const PARAMETER_SITEMAP = 'sitemap';
46
+		const PARAMETER_SITEMAP_ITEM = 'sitemapItem';
47
+		const PARAMETER_SMALLEST_IMAGE = 'smallestImage';
48
+		const PARAMETER_STATIC = 'static';
49
+		const PARAMETER_USER = 'user';
50
+		const PARAMETER_USERS = 'users';
51
+		const PARAMETER_USER_RIGHTS = 'userRights';
52
+		const PARAMETER_WHITELIST_IPS = 'whitelistIps';
53
+
54
+		const POST_PARAMETER_COMPONENT = 'component';
55
+		const POST_PARAMETER_PASSWORD = 'password';
56
+		const POST_PARAMETER_SAVE = 'save';
57
+		const POST_PARAMETER_TEMPLATE = 'template';
58
+		const POST_PARAMETER_TITLE = 'title';
59
+		const POST_PARAMETER_USERNAME = 'username';
60
+
61
+		const GET_PARAMETER_PATH = 'path';
62
+		const GET_PARAMETER_SLUG = 'slug';
63
+
64
+		const FILES_PARAMETER_FILE = 'file';
65
+
66
+		const SESSION_PARAMETER_CLOUD_CONTROL = 'cloudcontrol';
67
+
68
+		const LOGIN_TEMPLATE_PATH = 'cms/login';
69
+
70
+		const CONTENT_TYPE_APPLICATION_JSON = 'Content-type:application/json';
71
+
72
+		public $subTemplate = null;
73
+
74
+
75
+		/**
76
+		 * @param \library\storage\Storage $storage
77
+		 *
78
+		 * @return void
79
+		 */
80
+		public function run(Storage $storage)
81
+		{
82
+			$this->parameters[self::PARAMETER_MAIN_NAV_CLASS] = self::MAIN_NAV_CLASS;
83
+			$this->storage = $storage;
84
+
85
+			$remoteAddress = $_SERVER['REMOTE_ADDR'];
86
+			$this->checkWhiteList($remoteAddress);
87
+			$this->checkBlackList($remoteAddress);
88
+
89
+			$this->checkLogin();
90
+
91
+			$this->parameters[self::PARAMETER_USER_RIGHTS] = $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]->rights;
92
+
93
+			$this->routing();
94
+		}
95
+
96
+		/**
97
+		 * See if a user is logged or wants to log in and
98
+		 * takes appropriate actions.
99
+		 *
100
+		 * @throws \Exception
101
+		 */
102
+		protected function checkLogin()
103
+		{
104
+			$request = $this->request;
105
+
106
+			if (!isset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL])) {
107
+				if (isset($request::$post[self::POST_PARAMETER_USERNAME], $request::$post[self::POST_PARAMETER_PASSWORD])) {
108
+					$user = $this->storage->getUserByUsername($request::$post[self::POST_PARAMETER_USERNAME]);
109
+					$crypt = new Crypt();
110
+					if (empty($user)) {
111
+						$crypt->encrypt($request::$post[self::POST_PARAMETER_PASSWORD], 16); // Buy time, to avoid brute forcing
112
+						$this->parameters[self::PARAMETER_ERROR_MESSAGE] = self::INVALID_CREDENTIALS_MESSAGE;
113
+						$this->showLogin();
114
+					} else {
115
+						$salt = $user->salt;
116
+						$password = $user->password;
117
+
118
+						$passwordCorrect = $crypt->compare($request::$post[self::POST_PARAMETER_PASSWORD], $password, $salt);
119
+
120
+						if ($passwordCorrect) {
121
+							$_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = $user;
122
+						} else {
123
+							$this->parameters[self::PARAMETER_ERROR_MESSAGE] = self::INVALID_CREDENTIALS_MESSAGE;
124
+							$this->showLogin();
125
+						}
126
+					}
127
+				} else {
128
+					$this->showLogin();
129
+				}
130
+			}
131
+		}
132
+
133
+		/**
134
+		 * Overrides normal behaviour and only renders the
135
+		 * login screen
136
+		 *
137
+		 * @throws \Exception
138
+		 */
139
+		protected function showLogin()
140
+		{
141
+			$loginTemplatePath = self::LOGIN_TEMPLATE_PATH;
142
+			$this->renderTemplate($loginTemplatePath);
143
+			ob_end_flush();
144
+			exit;
145
+		}
146
+
147
+		/**
148
+		 * As an exception, to keep the initial file structure simple
149
+		 * the cms implements it's own routing, apart from the regular sitemap functionality
150
+		 *
151
+		 * @throws \Exception
152
+		 */
153
+		protected function routing()
154
+		{
155
+			$relativeCmsUri = $this->getRelativeCmsUri($this->request);
156
+
157
+			$userRights = $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]->rights;
158
+
159
+			if ($relativeCmsUri == '' || $relativeCmsUri == '/') {
160
+				$this->subTemplate = 'cms/dashboard';
161
+			}
162
+
163
+			$this->logOffRouting($this->request, $relativeCmsUri);
164
+
165
+			$this->apiRouting($relativeCmsUri);
166
+
167
+			if (in_array(self::PARAMETER_DOCUMENTS, $userRights)) {
168
+				new DocumentRouting($this->request, $relativeCmsUri, $this);
169
+			}
170
+
171
+			if (in_array(self::PARAMETER_SITEMAP, $userRights)) {
172
+				new SitemapRouting($this->request, $relativeCmsUri, $this);
173
+			}
174
+
175
+			if (in_array(self::PARAMETER_IMAGES, $userRights)) {
176
+				new ImagesRouting($this->request, $relativeCmsUri, $this);
177
+			}
178
+
179
+			if (in_array(self::PARAMETER_FILES, $userRights)) {
180
+				new FilesRouting($this->request, $relativeCmsUri, $this);
181
+			}
182
+
183
+			if (in_array('configuration', $userRights)) {
184
+				new ConfigurationRouting($this->request, $relativeCmsUri, $this);
185
+			}
186
+
187
+			if ($this->subTemplate !== null) {
188
+				$this->parameters[self::PARAMETER_BODY] = $this->renderTemplate($this->subTemplate);
189
+			}
190
+		}
191
+
192
+		/**
193
+		 * @param $remoteAddress
194
+		 * @throws \Exception
195
+		 */
196
+		private function checkWhiteList($remoteAddress)
197
+		{
198
+			if (isset($this->parameters[self::PARAMETER_WHITELIST_IPS])) {
199
+				$whitelistIps = explode(',', $this->parameters[self::PARAMETER_WHITELIST_IPS]);
200
+				$whitelistIps = array_map("trim", $whitelistIps);
201
+				if (!in_array($remoteAddress, $whitelistIps)) {
202
+					throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist');
203
+				}
204
+			}
205
+		}
206
+
207
+		/**
208
+		 * @param $remoteAddress
209
+		 * @throws \Exception
210
+		 */
211
+		private function checkBlackList($remoteAddress)
212
+		{
213
+			if (isset($this->parameters[self::PARAMETER_BLACKLIST_IPS])) {
214
+				$blacklistIps = explode(',', $this->parameters[self::PARAMETER_BLACKLIST_IPS]);
215
+				$blacklistIps = array_map("trim", $blacklistIps);
216
+				if (in_array($remoteAddress, $blacklistIps)) {
217
+					throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist');
218
+				}
219
+			}
220
+		}
221
+
222
+		/**
223
+		 * @param $request
224
+		 * @return mixed|string
225
+		 */
226
+		private function getRelativeCmsUri($request)
227
+		{
228
+			// TODO Use regex match parameter instead of calculating relative uri
229
+			$pos = strpos($request::$relativeUri, $this->parameters[self::PARAMETER_CMS_PREFIX]);
230
+			$relativeCmsUri = '/';
231
+			if ($pos !== false) {
232
+				$relativeCmsUri = substr_replace($request::$relativeUri, '', $pos, strlen($this->parameters[self::PARAMETER_CMS_PREFIX]));
233
+			}
234
+			return $relativeCmsUri;
235
+		}
236
+
237
+		/**
238
+		 * @param $relativeCmsUri
239
+		 */
240
+		private function apiRouting($relativeCmsUri)
241
+		{
242
+			if ($relativeCmsUri == '/images.json') {
243
+				header(self::CONTENT_TYPE_APPLICATION_JSON);
244
+				die(json_encode($this->storage->getImages()));
245
+			} elseif ($relativeCmsUri == '/files.json') {
246
+				header(self::CONTENT_TYPE_APPLICATION_JSON);
247
+				die(json_encode($this->storage->getFiles()));
248
+			} elseif ($relativeCmsUri == '/documents.json') {
249
+				header(self::CONTENT_TYPE_APPLICATION_JSON);
250
+				die(json_encode($this->storage->getDocuments()));
251
+			}
252
+		}
253
+
254
+		private function logOffRouting($request, $relativeCmsUri)
255
+		{
256
+			if ($relativeCmsUri == '/log-off') {
257
+				$_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = null;
258
+				unset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]);
259
+				header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX]);
260
+				exit;
261
+			}
262
+		}
263
+
264
+		public function setParameter($parameterName, $parameterValue)
265
+		{
266
+			$this->parameters[$parameterName] = $parameterValue;
267
+		}
268
+
269
+		public function getParameter($parameterName)
270
+		{
271
+			return $this->parameters[$parameterName];
272
+		}
273
+	}
274 274
 }
275 275
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/SitemapRouting.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,24 +14,24 @@
 block discarded – undo
14 14
 class SitemapRouting implements CmsRouting
15 15
 {
16 16
 
17
-    /**
18
-     * SitemapRouting constructor.
19
-     * @param \library\cc\Request $request
20
-     * @param mixed|string $relativeCmsUri
21
-     * @param CmsComponent $cmsComponent
22
-     */
23
-    public function __construct($request, $relativeCmsUri, $cmsComponent)
24
-    {
25
-        if ($relativeCmsUri == '/sitemap') {
17
+	/**
18
+	 * SitemapRouting constructor.
19
+	 * @param \library\cc\Request $request
20
+	 * @param mixed|string $relativeCmsUri
21
+	 * @param CmsComponent $cmsComponent
22
+	 */
23
+	public function __construct($request, $relativeCmsUri, $cmsComponent)
24
+	{
25
+		if ($relativeCmsUri == '/sitemap') {
26 26
 			$this->overviewRoute($request, $cmsComponent);
27
-        } elseif ($relativeCmsUri == '/sitemap/new') {
27
+		} elseif ($relativeCmsUri == '/sitemap/new') {
28 28
 			$this->newRoute($request, $cmsComponent);
29
-        } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
29
+		} elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
30 30
 			$this->editRoute($request, $cmsComponent);
31
-        } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
31
+		} elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
32 32
 			$this->deleteRoute($request, $cmsComponent);
33
-        }
34
-    }
33
+		}
34
+	}
35 35
 
36 36
 	/**
37 37
 	 * @param $request
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/ImagesRouting.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,26 +13,26 @@
 block discarded – undo
13 13
 class ImagesRouting implements CmsRouting
14 14
 {
15 15
 
16
-    /**
17
-     * ImagesRouting constructor.
18
-     * @param \library\cc\Request $request
19
-     * @param mixed|string $relativeCmsUri
20
-     * @param CmsComponent $cmsComponent
21
-     */
22
-    public function __construct($request, $relativeCmsUri, $cmsComponent)
23
-    {
24
-        if ($relativeCmsUri == '/images') {
16
+	/**
17
+	 * ImagesRouting constructor.
18
+	 * @param \library\cc\Request $request
19
+	 * @param mixed|string $relativeCmsUri
20
+	 * @param CmsComponent $cmsComponent
21
+	 */
22
+	public function __construct($request, $relativeCmsUri, $cmsComponent)
23
+	{
24
+		if ($relativeCmsUri == '/images') {
25 25
 			$this->overviewRoute($cmsComponent);
26
-        } elseif ($relativeCmsUri == '/images.json') {
26
+		} elseif ($relativeCmsUri == '/images.json') {
27 27
 			$this->jsonRoute($cmsComponent);
28
-        } elseif ($relativeCmsUri == '/images/new') {
28
+		} elseif ($relativeCmsUri == '/images/new') {
29 29
 			$this->newRoute($request, $cmsComponent);
30
-        } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) {
30
+		} elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) {
31 31
 			$this->deleteRoute($request, $cmsComponent);
32
-        } elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) {
32
+		} elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) {
33 33
 			$this->showRoute($request, $cmsComponent);
34
-        }
35
-    }
34
+		}
35
+	}
36 36
 
37 37
 	/**
38 38
 	 * @param $cmsComponent
Please login to merge, or discard this patch.