Passed
Push — develop ( bdd28d...3cabcb )
by Jens
04:17
created
cloudcontrol/library/storage/storage/RedirectsStorage.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -10,91 +10,91 @@
 block discarded – undo
10 10
 
11 11
 class RedirectsStorage extends AbstractStorage
12 12
 {
13
-    /**
14
-     * Get all redirects
15
-     *
16
-     * @return mixed
17
-     */
18
-    public function getRedirects()
19
-    {
20
-        $redirects = $this->repository->redirects;
21
-        usort($redirects, array($this, 'cmp'));
22
-        return $redirects;
23
-    }
13
+	/**
14
+	 * Get all redirects
15
+	 *
16
+	 * @return mixed
17
+	 */
18
+	public function getRedirects()
19
+	{
20
+		$redirects = $this->repository->redirects;
21
+		usort($redirects, array($this, 'cmp'));
22
+		return $redirects;
23
+	}
24 24
 
25
-    /**
26
-     * Add a new redirect
27
-     * @param $postValues
28
-     */
29
-    public function addRedirect($postValues) {
30
-        $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
31
-        $redirects = $this->repository->redirects;
32
-        $redirects[] = $redirectObject;
33
-        $this->repository->redirects = $redirects;
34
-        $this->save();
35
-    }
25
+	/**
26
+	 * Add a new redirect
27
+	 * @param $postValues
28
+	 */
29
+	public function addRedirect($postValues) {
30
+		$redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
31
+		$redirects = $this->repository->redirects;
32
+		$redirects[] = $redirectObject;
33
+		$this->repository->redirects = $redirects;
34
+		$this->save();
35
+	}
36 36
 
37
-    /**
38
-     * Get a redirect by it's slug
39
-     *
40
-     * @param $slug
41
-     * @return \stdClass|null
42
-     */
43
-    public function getRedirectBySlug($slug)
44
-    {
45
-        $redirects = $this->repository->redirects;
46
-        foreach ($redirects as $redirect) {
47
-            if ($redirect->slug == $slug) {
48
-                return $redirect;
49
-            }
50
-        }
37
+	/**
38
+	 * Get a redirect by it's slug
39
+	 *
40
+	 * @param $slug
41
+	 * @return \stdClass|null
42
+	 */
43
+	public function getRedirectBySlug($slug)
44
+	{
45
+		$redirects = $this->repository->redirects;
46
+		foreach ($redirects as $redirect) {
47
+			if ($redirect->slug == $slug) {
48
+				return $redirect;
49
+			}
50
+		}
51 51
 
52
-        return null;
53
-    }
52
+		return null;
53
+	}
54 54
 
55
-    /**
56
-     * Save a redirect by it's slug
57
-     * @param $slug
58
-     * @param $postValues
59
-     */
60
-    public function saveRedirect($slug, $postValues)
61
-    {
62
-        $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
55
+	/**
56
+	 * Save a redirect by it's slug
57
+	 * @param $slug
58
+	 * @param $postValues
59
+	 */
60
+	public function saveRedirect($slug, $postValues)
61
+	{
62
+		$redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);
63 63
 
64
-        $redirects = $this->repository->redirects;
65
-        foreach ($redirects as $key => $redirect) {
66
-            if ($redirect->slug == $slug) {
67
-                $redirects[$key] = $redirectObject;
68
-            }
69
-        }
70
-        $this->repository->redirects = $redirects;
71
-        $this->save();
72
-    }
64
+		$redirects = $this->repository->redirects;
65
+		foreach ($redirects as $key => $redirect) {
66
+			if ($redirect->slug == $slug) {
67
+				$redirects[$key] = $redirectObject;
68
+			}
69
+		}
70
+		$this->repository->redirects = $redirects;
71
+		$this->save();
72
+	}
73 73
 
74
-    /**
75
-     * Delete a redirect by it's slug
76
-     * @param $slug
77
-     */
78
-    public function deleteRedirectBySlug($slug)
79
-    {
80
-        $redirects = $this->repository->redirects;
81
-        foreach ($redirects as $key => $redirect) {
82
-            if ($redirect->slug == $slug) {
83
-                unset($redirects[$key]);
84
-            }
85
-        }
86
-        $redirects = array_values($redirects);
87
-        $this->repository->redirects = $redirects;
88
-        $this->save();
89
-    }
74
+	/**
75
+	 * Delete a redirect by it's slug
76
+	 * @param $slug
77
+	 */
78
+	public function deleteRedirectBySlug($slug)
79
+	{
80
+		$redirects = $this->repository->redirects;
81
+		foreach ($redirects as $key => $redirect) {
82
+			if ($redirect->slug == $slug) {
83
+				unset($redirects[$key]);
84
+			}
85
+		}
86
+		$redirects = array_values($redirects);
87
+		$this->repository->redirects = $redirects;
88
+		$this->save();
89
+	}
90 90
 
91
-    /**
92
-     * Compare a redirect by it's title
93
-     * @param $a
94
-     * @param $b
95
-     * @return int
96
-     */
97
-    public static function cmp($a, $b) {
98
-        return strcmp($a->title, $b->title);
99
-    }
91
+	/**
92
+	 * Compare a redirect by it's title
93
+	 * @param $a
94
+	 * @param $b
95
+	 * @return int
96
+	 */
97
+	public static function cmp($a, $b) {
98
+		return strcmp($a->title, $b->title);
99
+	}
100 100
 }
101 101
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/storage/factories/RedirectsFactory.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,26 +10,26 @@
 block discarded – undo
10 10
 
11 11
 class RedirectsFactory
12 12
 {
13
-    /**
14
-     * Create a new redirect object from postvalues
15
-     *
16
-     * @param $postValues
17
-     * @return \stdClass
18
-     * @throws \Exception
19
-     */
20
-    public static function createRedirectFromPostValues($postValues)
21
-    {
22
-        if (isset($postValues['title'], $postValues['fromUrl'], $postValues['toUrl'])) {
23
-            $redirectObject = new \stdClass();
24
-            $redirectObject->title = $postValues['title'];
25
-            $redirectObject->slug = StringUtil::slugify($postValues['title']);
26
-            $redirectObject->fromUrl = $postValues['fromUrl'];
27
-            $redirectObject->toUrl = $postValues['toUrl'];
28
-            $redirectObject->type = $postValues['type'];
13
+	/**
14
+	 * Create a new redirect object from postvalues
15
+	 *
16
+	 * @param $postValues
17
+	 * @return \stdClass
18
+	 * @throws \Exception
19
+	 */
20
+	public static function createRedirectFromPostValues($postValues)
21
+	{
22
+		if (isset($postValues['title'], $postValues['fromUrl'], $postValues['toUrl'])) {
23
+			$redirectObject = new \stdClass();
24
+			$redirectObject->title = $postValues['title'];
25
+			$redirectObject->slug = StringUtil::slugify($postValues['title']);
26
+			$redirectObject->fromUrl = $postValues['fromUrl'];
27
+			$redirectObject->toUrl = $postValues['toUrl'];
28
+			$redirectObject->type = $postValues['type'];
29 29
 
30
-            return $redirectObject;
31
-        } else {
32
-            throw new \Exception('Trying to create valuelist with invalid data.');
33
-        }
34
-    }
30
+			return $redirectObject;
31
+		} else {
32
+			throw new \Exception('Trying to create valuelist with invalid data.');
33
+		}
34
+	}
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/storage/Repository.php 1 patch
Indentation   +319 added lines, -319 removed lines patch added patch discarded remove patch
@@ -24,141 +24,141 @@  discard block
 block discarded – undo
24 24
  */
25 25
 class Repository
26 26
 {
27
-    protected $storagePath;
28
-
29
-    protected $fileBasedSubsets = array('sitemap', 'applicationComponents', 'documentTypes', 'bricks', 'imageSet', 'images', 'files', 'users', 'valuelists', 'redirects');
30
-
31
-    protected $sitemap;
32
-    protected $sitemapChanges = false;
33
-
34
-    protected $applicationComponents;
35
-    protected $applicationComponentsChanges = false;
36
-
37
-    protected $documentTypes;
38
-    protected $documentTypesChanges = false;
39
-
40
-    protected $bricks;
41
-    protected $bricksChanges = false;
42
-
43
-    protected $imageSet;
44
-    protected $imageSetChanges = false;
45
-
46
-    protected $images;
47
-    protected $imagesChanges = false;
48
-
49
-    protected $files;
50
-    protected $filesChanges = false;
51
-
52
-    protected $users;
53
-    protected $usersChanges = false;
54
-
55
-    protected $valuelists;
56
-    protected $valuelistsChanges = false;
57
-
58
-    protected $redirects;
59
-    protected $redirectsChanges = false;
60
-
61
-    protected $contentDbHandle;
62
-
63
-
64
-    /**
65
-     * Repository constructor.
66
-     * @param $storagePath
67
-     * @throws \Exception
68
-     */
69
-    public function __construct($storagePath)
70
-    {
71
-        $storagePath = realpath($storagePath);
72
-        if (is_dir($storagePath) && $storagePath !== false) {
73
-            $this->storagePath = $storagePath;
74
-        } else {
75
-            throw new \Exception('Repository not yet initialized.');
76
-        }
77
-    }
78
-
79
-    /**
80
-     * Creates the folder in which to create all storage related files
81
-     *
82
-     * @param $storagePath
83
-     * @return bool
84
-     */
85
-    public static function create($storagePath)
86
-    {
87
-        return mkdir($storagePath);
88
-    }
89
-
90
-    /**
91
-     * Initiates default storage
92
-     * @throws \Exception
93
-     */
94
-    public function init()
95
-    {
96
-        $storageDefaultPath = realpath('../library/cc/install/_storage.json');
97
-        $contentSqlPath = realpath('../library/cc/install/content.sql');
98
-
99
-        $this->initConfigStorage($storageDefaultPath);
100
-        $this->initContentDb($contentSqlPath);
101
-
102
-        $this->save();
103
-    }
104
-
105
-    /**
106
-     * Load filebased subset and return it's contents
107
-     *
108
-     * @param $name
109
-     * @return mixed|string
110
-     * @throws \Exception
111
-     */
112
-    public function __get($name)
113
-    {
114
-        if (isset($this->$name)) {
115
-            if (in_array($name, $this->fileBasedSubsets)) {
116
-                return $this->$name;
117
-            } else {
118
-                throw new \Exception('Trying to get undefined property from Repository: ' . $name);
119
-            }
120
-        } else {
121
-            if (in_array($name, $this->fileBasedSubsets)) {
122
-                return $this->loadSubset($name);
123
-            } else {
124
-                throw new \Exception('Trying to get undefined property from Repository: ' . $name);
125
-            }
126
-        }
127
-    }
128
-
129
-    /**
130
-     * Set filebased subset contents
131
-     * @param $name
132
-     * @param $value
133
-     * @throws \Exception
134
-     */
135
-    public function __set($name, $value)
136
-    {
137
-        if (in_array($name, $this->fileBasedSubsets)) {
138
-            $this->$name = $value;
139
-            $changes = $name . 'Changes';
140
-            $this->$changes = true;
141
-        } else {
142
-            throw new \Exception('Trying to persist unknown subset in repository: ' . $name . ' <br /><pre>' . print_r($value, true) . '</pre>');
143
-        }
144
-    }
145
-
146
-    /**
147
-     * Persist all subsets
148
-     */
149
-    public function save()
150
-    {
151
-        array_map(function ($value) {
152
-        	$this->saveSubset($value);
27
+	protected $storagePath;
28
+
29
+	protected $fileBasedSubsets = array('sitemap', 'applicationComponents', 'documentTypes', 'bricks', 'imageSet', 'images', 'files', 'users', 'valuelists', 'redirects');
30
+
31
+	protected $sitemap;
32
+	protected $sitemapChanges = false;
33
+
34
+	protected $applicationComponents;
35
+	protected $applicationComponentsChanges = false;
36
+
37
+	protected $documentTypes;
38
+	protected $documentTypesChanges = false;
39
+
40
+	protected $bricks;
41
+	protected $bricksChanges = false;
42
+
43
+	protected $imageSet;
44
+	protected $imageSetChanges = false;
45
+
46
+	protected $images;
47
+	protected $imagesChanges = false;
48
+
49
+	protected $files;
50
+	protected $filesChanges = false;
51
+
52
+	protected $users;
53
+	protected $usersChanges = false;
54
+
55
+	protected $valuelists;
56
+	protected $valuelistsChanges = false;
57
+
58
+	protected $redirects;
59
+	protected $redirectsChanges = false;
60
+
61
+	protected $contentDbHandle;
62
+
63
+
64
+	/**
65
+	 * Repository constructor.
66
+	 * @param $storagePath
67
+	 * @throws \Exception
68
+	 */
69
+	public function __construct($storagePath)
70
+	{
71
+		$storagePath = realpath($storagePath);
72
+		if (is_dir($storagePath) && $storagePath !== false) {
73
+			$this->storagePath = $storagePath;
74
+		} else {
75
+			throw new \Exception('Repository not yet initialized.');
76
+		}
77
+	}
78
+
79
+	/**
80
+	 * Creates the folder in which to create all storage related files
81
+	 *
82
+	 * @param $storagePath
83
+	 * @return bool
84
+	 */
85
+	public static function create($storagePath)
86
+	{
87
+		return mkdir($storagePath);
88
+	}
89
+
90
+	/**
91
+	 * Initiates default storage
92
+	 * @throws \Exception
93
+	 */
94
+	public function init()
95
+	{
96
+		$storageDefaultPath = realpath('../library/cc/install/_storage.json');
97
+		$contentSqlPath = realpath('../library/cc/install/content.sql');
98
+
99
+		$this->initConfigStorage($storageDefaultPath);
100
+		$this->initContentDb($contentSqlPath);
101
+
102
+		$this->save();
103
+	}
104
+
105
+	/**
106
+	 * Load filebased subset and return it's contents
107
+	 *
108
+	 * @param $name
109
+	 * @return mixed|string
110
+	 * @throws \Exception
111
+	 */
112
+	public function __get($name)
113
+	{
114
+		if (isset($this->$name)) {
115
+			if (in_array($name, $this->fileBasedSubsets)) {
116
+				return $this->$name;
117
+			} else {
118
+				throw new \Exception('Trying to get undefined property from Repository: ' . $name);
119
+			}
120
+		} else {
121
+			if (in_array($name, $this->fileBasedSubsets)) {
122
+				return $this->loadSubset($name);
123
+			} else {
124
+				throw new \Exception('Trying to get undefined property from Repository: ' . $name);
125
+			}
126
+		}
127
+	}
128
+
129
+	/**
130
+	 * Set filebased subset contents
131
+	 * @param $name
132
+	 * @param $value
133
+	 * @throws \Exception
134
+	 */
135
+	public function __set($name, $value)
136
+	{
137
+		if (in_array($name, $this->fileBasedSubsets)) {
138
+			$this->$name = $value;
139
+			$changes = $name . 'Changes';
140
+			$this->$changes = true;
141
+		} else {
142
+			throw new \Exception('Trying to persist unknown subset in repository: ' . $name . ' <br /><pre>' . print_r($value, true) . '</pre>');
143
+		}
144
+	}
145
+
146
+	/**
147
+	 * Persist all subsets
148
+	 */
149
+	public function save()
150
+	{
151
+		array_map(function ($value) {
152
+			$this->saveSubset($value);
153 153
 		}, $this->fileBasedSubsets);
154
-    }
155
-
156
-    /**
157
-     * Persist subset to disk
158
-     * @param $subset
159
-     */
160
-    protected function saveSubset($subset)
161
-    {
154
+	}
155
+
156
+	/**
157
+	 * Persist subset to disk
158
+	 * @param $subset
159
+	 */
160
+	protected function saveSubset($subset)
161
+	{
162 162
 		$changes = $subset . 'Changes';
163 163
 		if ($this->$changes === true) {
164 164
 			$json = json_encode($this->$subset, JSON_PRETTY_PRINT);
@@ -167,69 +167,69 @@  discard block
 block discarded – undo
167 167
 
168 168
 			$this->$changes = false;
169 169
 		}
170
-    }
171
-
172
-    /**
173
-     * Load subset from disk
174
-     * @param $subset
175
-     * @return mixed|string
176
-     */
177
-    protected function loadSubset($subset)
178
-    {
179
-        $subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json';
180
-        $json = file_get_contents($subsetStoragePath);
181
-        $json = json_decode($json);
182
-        $this->$subset = $json;
183
-        return $json;
184
-    }
185
-
186
-    /**
187
-     * @param $contentSqlPath
188
-     */
189
-    protected function initContentDb($contentSqlPath)
190
-    {
191
-        $db = $this->getContentDbHandle();
192
-        $sql = file_get_contents($contentSqlPath);
193
-        $db->exec($sql);
194
-    }
195
-
196
-    /**
197
-     * @param $storageDefaultPath
198
-     */
199
-    protected function initConfigStorage($storageDefaultPath)
200
-    {
201
-        $json = file_get_contents($storageDefaultPath);
202
-        $json = json_decode($json);
203
-        $this->sitemap = $json->sitemap;
204
-        $this->sitemapChanges = true;
205
-        $this->applicationComponents = $json->applicationComponents;
206
-        $this->applicationComponentsChanges = true;
207
-        $this->documentTypes = $json->documentTypes;
208
-        $this->documentTypesChanges = true;
209
-        $this->bricks = $json->bricks;
210
-        $this->bricksChanges = true;
211
-        $this->imageSet = $json->imageSet;
212
-        $this->imageSetChanges = true;
213
-        $this->images = $json->images;
214
-        $this->imagesChanges = true;
215
-        $this->files = $json->files;
216
-        $this->filesChanges = true;
217
-        $this->users = $json->users;
218
-        $this->usersChanges = true;
219
-        $this->valuelists = $json->valuelists;
220
-        $this->valuelistsChanges = true;
221
-    }
222
-
223
-    /**
224
-     * @return \PDO
225
-     */
226
-    public function getContentDbHandle()
227
-    {
228
-        if ($this->contentDbHandle === null) {
229
-            $this->contentDbHandle = new \PDO('sqlite:' . $this->storagePath . DIRECTORY_SEPARATOR . 'content.db');
230
-        }
231
-        return $this->contentDbHandle;
232
-    }
170
+	}
171
+
172
+	/**
173
+	 * Load subset from disk
174
+	 * @param $subset
175
+	 * @return mixed|string
176
+	 */
177
+	protected function loadSubset($subset)
178
+	{
179
+		$subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json';
180
+		$json = file_get_contents($subsetStoragePath);
181
+		$json = json_decode($json);
182
+		$this->$subset = $json;
183
+		return $json;
184
+	}
185
+
186
+	/**
187
+	 * @param $contentSqlPath
188
+	 */
189
+	protected function initContentDb($contentSqlPath)
190
+	{
191
+		$db = $this->getContentDbHandle();
192
+		$sql = file_get_contents($contentSqlPath);
193
+		$db->exec($sql);
194
+	}
195
+
196
+	/**
197
+	 * @param $storageDefaultPath
198
+	 */
199
+	protected function initConfigStorage($storageDefaultPath)
200
+	{
201
+		$json = file_get_contents($storageDefaultPath);
202
+		$json = json_decode($json);
203
+		$this->sitemap = $json->sitemap;
204
+		$this->sitemapChanges = true;
205
+		$this->applicationComponents = $json->applicationComponents;
206
+		$this->applicationComponentsChanges = true;
207
+		$this->documentTypes = $json->documentTypes;
208
+		$this->documentTypesChanges = true;
209
+		$this->bricks = $json->bricks;
210
+		$this->bricksChanges = true;
211
+		$this->imageSet = $json->imageSet;
212
+		$this->imageSetChanges = true;
213
+		$this->images = $json->images;
214
+		$this->imagesChanges = true;
215
+		$this->files = $json->files;
216
+		$this->filesChanges = true;
217
+		$this->users = $json->users;
218
+		$this->usersChanges = true;
219
+		$this->valuelists = $json->valuelists;
220
+		$this->valuelistsChanges = true;
221
+	}
222
+
223
+	/**
224
+	 * @return \PDO
225
+	 */
226
+	public function getContentDbHandle()
227
+	{
228
+		if ($this->contentDbHandle === null) {
229
+			$this->contentDbHandle = new \PDO('sqlite:' . $this->storagePath . DIRECTORY_SEPARATOR . 'content.db');
230
+		}
231
+		return $this->contentDbHandle;
232
+	}
233 233
 
234 234
 	/**
235 235
 	 * Get all documents
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 	 * @return array
240 240
 	 * @throws \Exception
241 241
 	 */
242
-    public function getDocuments($state = 'published')
243
-    {
242
+	public function getDocuments($state = 'published')
243
+	{
244 244
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
245 245
 			throw new \Exception('Unsupported document state: ' . $state);
246 246
 		}
247
-        return $this->getDocumentsByPath('/', $state);
248
-    }
247
+		return $this->getDocumentsByPath('/', $state);
248
+	}
249 249
 
250 250
 	public function getDocumentsWithState($folderPath = '/')
251 251
 	{
@@ -292,51 +292,51 @@  discard block
 block discarded – undo
292 292
 	 * @return array
293 293
 	 * @throws \Exception
294 294
 	 */
295
-    public function getDocumentsByPath($folderPath, $state = 'published')
296
-    {
297
-    	if (!in_array($state, Document::$DOCUMENT_STATES)) {
298
-    		throw new \Exception('Unsupported document state: ' . $state);
295
+	public function getDocumentsByPath($folderPath, $state = 'published')
296
+	{
297
+		if (!in_array($state, Document::$DOCUMENT_STATES)) {
298
+			throw new \Exception('Unsupported document state: ' . $state);
299 299
 		}
300
-        $db = $this->getContentDbHandle();
301
-        $folderPathWithWildcard = $folderPath . '%';
300
+		$db = $this->getContentDbHandle();
301
+		$folderPathWithWildcard = $folderPath . '%';
302 302
 
303
-        $sql = 'SELECT *
303
+		$sql = 'SELECT *
304 304
               FROM documents_' . $state . '
305 305
              WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard) . '
306 306
                AND substr(`path`, ' . (strlen($folderPath) + 1) . ') NOT LIKE "%/%"
307 307
                AND path != ' . $db->quote($folderPath) . '
308 308
           ORDER BY `type` DESC, `path` ASC';
309
-        $stmt = $this->getDbStatement($sql);
309
+		$stmt = $this->getDbStatement($sql);
310 310
 
311
-        $documents = $stmt->fetchAll(\PDO::FETCH_CLASS, '\library\storage\Document');
312
-        foreach ($documents as $key => $document) {
311
+		$documents = $stmt->fetchAll(\PDO::FETCH_CLASS, '\library\storage\Document');
312
+		foreach ($documents as $key => $document) {
313 313
 			$documents = $this->setAssetsToDocumentFolders($document, $db, $documents, $key);
314
-        }
315
-        return $documents;
316
-    }
317
-
318
-
319
-    /**
320
-     * @param $path
321
-     * @return bool|Document
322
-     */
323
-    public function getDocumentContainerByPath($path)
324
-    {
325
-        $document = $this->getDocumentByPath($path, 'unpublished');
326
-        if ($document === false) {
327
-            return false;
328
-        }
329
-        $slugLength = strlen($document->slug);
330
-        $containerPath = substr($path, 0, -$slugLength);
331
-        if ($containerPath === '/') {
332
-            return $this->getRootFolder();
333
-        }
334
-        if (substr($containerPath, -1) === '/'){
314
+		}
315
+		return $documents;
316
+	}
317
+
318
+
319
+	/**
320
+	 * @param $path
321
+	 * @return bool|Document
322
+	 */
323
+	public function getDocumentContainerByPath($path)
324
+	{
325
+		$document = $this->getDocumentByPath($path, 'unpublished');
326
+		if ($document === false) {
327
+			return false;
328
+		}
329
+		$slugLength = strlen($document->slug);
330
+		$containerPath = substr($path, 0, -$slugLength);
331
+		if ($containerPath === '/') {
332
+			return $this->getRootFolder();
333
+		}
334
+		if (substr($containerPath, -1) === '/'){
335 335
 			$containerPath = substr($containerPath, 0, -1);
336 336
 		}
337
-        $containerFolder = $this->getDocumentByPath($containerPath, 'unpublished');
338
-        return $containerFolder;
339
-    }
337
+		$containerFolder = $this->getDocumentByPath($containerPath, 'unpublished');
338
+		return $containerFolder;
339
+	}
340 340
 
341 341
 	/**
342 342
 	 * @param        $path
@@ -345,23 +345,23 @@  discard block
 block discarded – undo
345 345
 	 * @return bool|\library\storage\Document
346 346
 	 * @throws \Exception
347 347
 	 */
348
-    public function getDocumentByPath($path, $state = 'published')
349
-    {
348
+	public function getDocumentByPath($path, $state = 'published')
349
+	{
350 350
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
351 351
 			throw new \Exception('Unsupported document state: ' . $state);
352 352
 		}
353
-        $db = $this->getContentDbHandle();
354
-        $document = $this->fetchDocument('
353
+		$db = $this->getContentDbHandle();
354
+		$document = $this->fetchDocument('
355 355
             SELECT *
356 356
               FROM documents_' .  $state . '
357 357
              WHERE path = ' . $db->quote($path) . '
358 358
         ');
359
-        if ($document instanceof Document && $document->type === 'folder') {
360
-            $document->dbHandle = $db;
361
-            $document->documentStorage = new DocumentStorage($this);
362
-        }
363
-        return $document;
364
-    }
359
+		if ($document instanceof Document && $document->type === 'folder') {
360
+			$document->dbHandle = $db;
361
+			$document->documentStorage = new DocumentStorage($this);
362
+		}
363
+		return $document;
364
+	}
365 365
 
366 366
 	/**
367 367
 	 * Returns the count of all documents stored in the db
@@ -456,58 +456,58 @@  discard block
 block discarded – undo
456 456
 	}
457 457
 
458 458
 	/**
459
-     * Return the results of the query as array of Documents
460
-     * @param $sql
461
-     * @return array
462
-     * @throws \Exception
463
-     */
464
-    protected function fetchAllDocuments($sql)
465
-    {
466
-        $stmt = $this->getDbStatement($sql);
467
-        return $stmt->fetchAll(\PDO::FETCH_CLASS, '\library\storage\Document');
468
-    }
469
-
470
-    /**
471
-     * Return the result of the query as Document
472
-     * @param $sql
473
-     * @return mixed
474
-     * @throws \Exception
475
-     */
476
-    protected function fetchDocument($sql)
477
-    {
478
-        $stmt = $this->getDbStatement($sql);
479
-        return $stmt->fetchObject('\library\storage\Document');
480
-    }
481
-
482
-    /**
483
-     * Prepare the sql statement
484
-     * @param $sql
485
-     * @return \PDOStatement
486
-     * @throws \Exception
487
-     */
488
-    protected function getDbStatement($sql)
489
-    {
490
-        $db = $this->getContentDbHandle();
491
-        $stmt = $db->query($sql);
492
-        if ($stmt === false) {
493
-            $errorInfo = $db->errorInfo();
494
-            $errorMsg = $errorInfo[2];
495
-            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
496
-        }
497
-        return $stmt;
498
-    }
499
-
500
-    /**
501
-     * Create a (non-existent) root folder Document and return it
502
-     * @return Document
503
-     */
504
-    protected function getRootFolder()
505
-    {
506
-        $rootFolder = new Document();
507
-        $rootFolder->path = '/';
508
-        $rootFolder->type = 'folder';
509
-        return $rootFolder;
510
-    }
459
+	 * Return the results of the query as array of Documents
460
+	 * @param $sql
461
+	 * @return array
462
+	 * @throws \Exception
463
+	 */
464
+	protected function fetchAllDocuments($sql)
465
+	{
466
+		$stmt = $this->getDbStatement($sql);
467
+		return $stmt->fetchAll(\PDO::FETCH_CLASS, '\library\storage\Document');
468
+	}
469
+
470
+	/**
471
+	 * Return the result of the query as Document
472
+	 * @param $sql
473
+	 * @return mixed
474
+	 * @throws \Exception
475
+	 */
476
+	protected function fetchDocument($sql)
477
+	{
478
+		$stmt = $this->getDbStatement($sql);
479
+		return $stmt->fetchObject('\library\storage\Document');
480
+	}
481
+
482
+	/**
483
+	 * Prepare the sql statement
484
+	 * @param $sql
485
+	 * @return \PDOStatement
486
+	 * @throws \Exception
487
+	 */
488
+	protected function getDbStatement($sql)
489
+	{
490
+		$db = $this->getContentDbHandle();
491
+		$stmt = $db->query($sql);
492
+		if ($stmt === false) {
493
+			$errorInfo = $db->errorInfo();
494
+			$errorMsg = $errorInfo[2];
495
+			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
496
+		}
497
+		return $stmt;
498
+	}
499
+
500
+	/**
501
+	 * Create a (non-existent) root folder Document and return it
502
+	 * @return Document
503
+	 */
504
+	protected function getRootFolder()
505
+	{
506
+		$rootFolder = new Document();
507
+		$rootFolder->path = '/';
508
+		$rootFolder->type = 'folder';
509
+		return $rootFolder;
510
+	}
511 511
 
512 512
 	/**
513 513
 	 * Save the document to the database
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
 	 * @throws \Exception
520 520
 	 * @internal param $path
521 521
 	 */
522
-    public function saveDocument($documentObject, $state = 'published')
523
-    {
522
+	public function saveDocument($documentObject, $state = 'published')
523
+	{
524 524
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
525 525
 			throw new \Exception('Unsupported document state: ' . $state);
526 526
 		}
527
-        $db = $this->getContentDbHandle();
528
-        $stmt = $this->getDbStatement('
527
+		$db = $this->getContentDbHandle();
528
+		$stmt = $this->getDbStatement('
529 529
             INSERT OR REPLACE INTO documents_' . $state . ' (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
530 530
             VALUES(
531 531
               ' . $db->quote($documentObject->path) . ',
@@ -543,9 +543,9 @@  discard block
 block discarded – undo
543 543
               ' . $db->quote(json_encode($documentObject->dynamicBricks)) . '
544 544
             )
545 545
         ');
546
-        $result = $stmt->execute();
547
-        return $result;
548
-    }
546
+		$result = $stmt->execute();
547
+		return $result;
548
+	}
549 549
 
550 550
 	/**
551 551
 	 * Delete the document from the database
@@ -556,29 +556,29 @@  discard block
 block discarded – undo
556 556
 	 * @internal param string $state
557 557
 	 *
558 558
 	 */
559
-    public function deleteDocumentByPath($path)
560
-    {
561
-        $db = $this->getContentDbHandle();
562
-        $documentToDelete = $this->getDocumentByPath($path, 'unpublished');
563
-        if ($documentToDelete instanceof Document) {
564
-            if ($documentToDelete->type == 'document') {
565
-                $stmt = $this->getDbStatement('
559
+	public function deleteDocumentByPath($path)
560
+	{
561
+		$db = $this->getContentDbHandle();
562
+		$documentToDelete = $this->getDocumentByPath($path, 'unpublished');
563
+		if ($documentToDelete instanceof Document) {
564
+			if ($documentToDelete->type == 'document') {
565
+				$stmt = $this->getDbStatement('
566 566
                     DELETE FROM documents_unpublished
567 567
                           WHERE path = ' . $db->quote($path) . '
568 568
                 ');
569
-                $stmt->execute();
570
-            } elseif ($documentToDelete->type == 'folder') {
571
-                $folderPathWithWildcard = $path . '%';
572
-                $stmt = $this->getDbStatement('
569
+				$stmt->execute();
570
+			} elseif ($documentToDelete->type == 'folder') {
571
+				$folderPathWithWildcard = $path . '%';
572
+				$stmt = $this->getDbStatement('
573 573
                     DELETE FROM documents_unpublished
574 574
                           WHERE (path LIKE ' . $db->quote($folderPathWithWildcard) . '
575 575
                             AND substr(`path`, ' . (strlen($path) + 1) . ', 1) = "/")
576 576
                             OR path = ' . $db->quote($path) . '
577 577
                 ');
578
-                $stmt->execute();
579
-            }
580
-        }
581
-    }
578
+				$stmt->execute();
579
+			}
580
+		}
581
+	}
582 582
 
583 583
 	/**
584 584
 	 * @param $document
Please login to merge, or discard this patch.
cloudcontrol/library/storage/Storage.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace library\storage {
3 3
 
4
-    use library\storage\factories\DocumentFolderFactory;
5
-    use library\storage\storage\ApplicationComponentsStorage;
6
-    use library\storage\storage\BricksStorage;
7
-    use library\storage\storage\DocumentStorage;
8
-    use library\storage\storage\DocumentTypesStorage;
9
-    use library\storage\storage\FilesStorage;
10
-    use library\storage\storage\ImageSetStorage;
11
-    use library\storage\storage\ImagesStorage;
12
-    use library\storage\storage\RedirectsStorage;
13
-    use library\storage\storage\SitemapStorage;
14
-    use library\storage\storage\UsersStorage;
15
-    use library\storage\storage\ValuelistsStorage;
4
+	use library\storage\factories\DocumentFolderFactory;
5
+	use library\storage\storage\ApplicationComponentsStorage;
6
+	use library\storage\storage\BricksStorage;
7
+	use library\storage\storage\DocumentStorage;
8
+	use library\storage\storage\DocumentTypesStorage;
9
+	use library\storage\storage\FilesStorage;
10
+	use library\storage\storage\ImageSetStorage;
11
+	use library\storage\storage\ImagesStorage;
12
+	use library\storage\storage\RedirectsStorage;
13
+	use library\storage\storage\SitemapStorage;
14
+	use library\storage\storage\UsersStorage;
15
+	use library\storage\storage\ValuelistsStorage;
16 16
 
17
-    /**
17
+	/**
18 18
 	 * Class JsonStorage
19
-     * @package library\storage
19
+	 * @package library\storage
20 20
 	 */
21 21
 	class Storage
22 22
 	{
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 		 * @var DocumentStorage
62 62
 		 */
63 63
 		protected $documents;
64
-        /**
65
-         * @var RedirectsStorage
66
-         */
67
-        protected $redirects;
64
+		/**
65
+		 * @var RedirectsStorage
66
+		 */
67
+		protected $redirects;
68 68
 
69 69
 		/**
70 70
 		 * @var String
@@ -325,16 +325,16 @@  discard block
 block discarded – undo
325 325
 			return $this->valuelists;
326 326
 		}
327 327
 
328
-        /**
329
-         * @return RedirectsStorage
330
-         */
331
-        public function getRedirects()
332
-        {
333
-            if (!$this->redirects instanceof RedirectsStorage) {
334
-                $this->redirects = new RedirectsStorage($this->repository);
335
-            }
336
-            return $this->redirects;
337
-        }
328
+		/**
329
+		 * @return RedirectsStorage
330
+		 */
331
+		public function getRedirects()
332
+		{
333
+			if (!$this->redirects instanceof RedirectsStorage) {
334
+				$this->redirects = new RedirectsStorage($this->repository);
335
+			}
336
+			return $this->redirects;
337
+		}
338 338
 
339 339
 	}
340 340
 }
341 341
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/SitemapRouting.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@  discard block
 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
-        } else {
34
-            $this->redirectRoutes($relativeCmsUri, $request, $cmsComponent);
35
-        }
36
-    }
33
+		} else {
34
+			$this->redirectRoutes($relativeCmsUri, $request, $cmsComponent);
35
+		}
36
+	}
37 37
 
38 38
 	/**
39 39
 	 * @param $request
@@ -92,54 +92,54 @@  discard block
 block discarded – undo
92 92
 		exit;
93 93
 	}
94 94
 
95
-    private function redirectRoutes($relativeCmsUri, $request, $cmsComponent)
96
-    {
97
-        if ($relativeCmsUri == '/sitemap/redirects') {
98
-            $this->redirectsOverviewRoute($cmsComponent);
99
-        } elseif ($relativeCmsUri == '/sitemap/redirects/new') {
100
-            $this->redirectsNewRoute($request, $cmsComponent);
101
-        } elseif ($relativeCmsUri == '/sitemap/redirects/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
102
-            $this->redirectEditRoute($request, $cmsComponent);
103
-        } elseif ($relativeCmsUri == '/sitemap/redirects/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
104
-            $this->redirectDeleteRoute($request, $cmsComponent);
105
-        }
106
-    }
95
+	private function redirectRoutes($relativeCmsUri, $request, $cmsComponent)
96
+	{
97
+		if ($relativeCmsUri == '/sitemap/redirects') {
98
+			$this->redirectsOverviewRoute($cmsComponent);
99
+		} elseif ($relativeCmsUri == '/sitemap/redirects/new') {
100
+			$this->redirectsNewRoute($request, $cmsComponent);
101
+		} elseif ($relativeCmsUri == '/sitemap/redirects/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
102
+			$this->redirectEditRoute($request, $cmsComponent);
103
+		} elseif ($relativeCmsUri == '/sitemap/redirects/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
104
+			$this->redirectDeleteRoute($request, $cmsComponent);
105
+		}
106
+	}
107 107
 
108
-    private function redirectsOverviewRoute($cmsComponent)
109
-    {
110
-        $cmsComponent->subTemplate = 'cms/sitemap/redirects';
111
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
112
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECTS, $cmsComponent->storage->getRedirects()->getRedirects());
113
-    }
108
+	private function redirectsOverviewRoute($cmsComponent)
109
+	{
110
+		$cmsComponent->subTemplate = 'cms/sitemap/redirects';
111
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
112
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECTS, $cmsComponent->storage->getRedirects()->getRedirects());
113
+	}
114 114
 
115
-    private function redirectsNewRoute($request, $cmsComponent)
116
-    {
117
-        $cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
118
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
119
-        if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
120
-            $cmsComponent->storage->getRedirects()->addRedirect($request::$post);
121
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
122
-            exit;
123
-        }
124
-    }
115
+	private function redirectsNewRoute($request, $cmsComponent)
116
+	{
117
+		$cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
118
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
119
+		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
120
+			$cmsComponent->storage->getRedirects()->addRedirect($request::$post);
121
+			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
122
+			exit;
123
+		}
124
+	}
125 125
 
126
-    private function redirectEditRoute($request, $cmsComponent)
127
-    {
128
-        $cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
129
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
130
-        $redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
131
-        if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
132
-            $cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
133
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
134
-            exit;
135
-        }
136
-        $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect);
137
-    }
126
+	private function redirectEditRoute($request, $cmsComponent)
127
+	{
128
+		$cmsComponent->subTemplate = 'cms/sitemap/redirects-form';
129
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
130
+		$redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
131
+		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
132
+			$cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
133
+			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
134
+			exit;
135
+		}
136
+		$cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect);
137
+	}
138 138
 
139
-    private function redirectDeleteRoute($request, $cmsComponent)
140
-    {
141
-        $cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
142
-        header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
143
-        exit;
144
-    }
139
+	private function redirectDeleteRoute($request, $cmsComponent)
140
+	{
141
+		$cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
142
+		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
143
+		exit;
144
+	}
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
60 60
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_TEMPLATE], $request::$post[CmsComponent::POST_PARAMETER_COMPONENT])) {
61 61
 			$cmsComponent->storage->getSitemap()->addSitemapItem($request::$post);
62
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap');
62
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap');
63 63
 			exit;
64 64
 		}
65 65
 	}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$sitemapItem = $cmsComponent->storage->getSitemap()->getSitemapItemBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
76 76
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_TEMPLATE], $request::$post[CmsComponent::POST_PARAMETER_COMPONENT])) {
77 77
 			$cmsComponent->storage->getSitemap()->saveSitemapItem($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
78
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap');
78
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap');
79 79
 			exit;
80 80
 		}
81 81
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_SITEMAP_ITEM, $sitemapItem);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	private function deleteRoute($request, $cmsComponent)
89 89
 	{
90 90
 		$cmsComponent->storage->getSitemap()->deleteSitemapItemBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
91
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap');
91
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap');
92 92
 		exit;
93 93
 	}
94 94
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP);
119 119
         if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
120 120
             $cmsComponent->storage->getRedirects()->addRedirect($request::$post);
121
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
121
+            header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap/redirects');
122 122
             exit;
123 123
         }
124 124
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
131 131
         if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) {
132 132
             $cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post);
133
-            header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
133
+            header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap/redirects');
134 134
             exit;
135 135
         }
136 136
         $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     private function redirectDeleteRoute($request, $cmsComponent)
140 140
     {
141 141
         $cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
142
-        header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects');
142
+        header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap/redirects');
143 143
         exit;
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/CmsComponent.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	class CmsComponent extends BaseComponent
14 14
 	{
15
-        /**
15
+		/**
16 16
 		 * @var \library\storage\Storage
17 17
 		 */
18 18
 		public $storage;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 		const PARAMETER_IMAGE_SET = 'imageSet';
42 42
 		const PARAMETER_MAIN_NAV_CLASS = 'mainNavClass';
43 43
 		const PARAMETER_MY_BRICK_SLUG = 'myBrickSlug';
44
-        const PARAMETER_REDIRECT = 'redirect';
45
-        const PARAMETER_REDIRECTS = 'redirects';
44
+		const PARAMETER_REDIRECT = 'redirect';
45
+		const PARAMETER_REDIRECTS = 'redirects';
46 46
 		const PARAMETER_SEARCH = 'search';
47 47
 		const PARAMETER_SEARCH_LOG = "searchLog";
48 48
 		const PARAMETER_SEARCH_NEEDS_UPDATE = "searchNeedsUpdate";
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		const PARAMETER_VALUELISTS = "valuelists";
58 58
 		const PARAMETER_WHITELIST_IPS = 'whitelistIps';
59 59
 
60
-        const POST_PARAMETER_COMPONENT = 'component';
61
-        const POST_PARAMETER_FROM_URL = "fromUrl";
62
-        const POST_PARAMETER_PASSWORD = 'password';
63
-        const POST_PARAMETER_SAVE = 'save';
64
-        const POST_PARAMETER_TEMPLATE = 'template';
65
-        const POST_PARAMETER_TITLE = 'title';
66
-        const POST_PARAMETER_TO_URL = "toUrl";
67
-        const POST_PARAMETER_USERNAME = 'username';
60
+		const POST_PARAMETER_COMPONENT = 'component';
61
+		const POST_PARAMETER_FROM_URL = "fromUrl";
62
+		const POST_PARAMETER_PASSWORD = 'password';
63
+		const POST_PARAMETER_SAVE = 'save';
64
+		const POST_PARAMETER_TEMPLATE = 'template';
65
+		const POST_PARAMETER_TITLE = 'title';
66
+		const POST_PARAMETER_TO_URL = "toUrl";
67
+		const POST_PARAMETER_USERNAME = 'username';
68 68
 
69 69
 		const GET_PARAMETER_PATH = 'path';
70 70
 		const GET_PARAMETER_SLUG = 'slug';
Please login to merge, or discard this patch.