Passed
Push — develop ( b26832...ec0c25 )
by Jens
03:44 queued 01:05
created
cloudcontrol/templates/cms/documents/function.renderDocument.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <? function renderDocument($document, $cmsPrefix, $slugPrefix = '') {?>
2 2
 	<div class="grid-box-10">
3 3
 		<h3>
4
-			<a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit">
4
+			<a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit">
5 5
 				<i class="fa fa-file-text-o"></i>
6 6
 				<small class="state <?=strtolower($document->state)?>"><i class="fa <?=$document->state == 'published' ? 'fa-check-circle-o' : 'fa-times-circle-o' ?>"></i></small>
7 7
 				<?=$document->title?>
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 	</div>
21 21
 	<div class="documentActions grid-box-2">
22 22
 		<? if ($document->state == 'unpublished' || $document->unpublishedChanges) : ?>
23
-			<a class="btn publish" title="Publish" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/publish-document?slug=<?=$slugPrefix . $document->slug?>"><i class="fa fa-check"></i></a>
23
+			<a class="btn publish" title="Publish" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/publish-document?slug=<?=$slugPrefix.$document->slug?>"><i class="fa fa-check"></i></a>
24 24
 		<? endif ?>
25 25
 		<? if ($document->state == 'published') : ?>
26
-			<a class="btn unpublish" title="Unpublish" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/unpublish-document?slug=<?=$slugPrefix . $document->slug?>"><i class="fa fa-times"></i></a>
26
+			<a class="btn unpublish" title="Unpublish" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/unpublish-document?slug=<?=$slugPrefix.$document->slug?>"><i class="fa fa-times"></i></a>
27 27
 		<? endif ?>
28
-		<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
28
+		<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
29 29
 		<? if ($document->state == 'unpublished') : ?>
30
-			<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-trash"></i></a>
30
+			<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-trash"></i></a>
31 31
 		<? endif ?>
32 32
 	</div>
33 33
 <?}?>
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/storage/Storage.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		 */
83 83
 		private function config()
84 84
 		{
85
-			$storagePath = __DIR__ . '/../../' . $this->storageDir;
85
+			$storagePath = __DIR__.'/../../'.$this->storageDir;
86 86
 			if (realpath($storagePath) === false) {
87 87
 				initFramework();
88 88
 				if (Repository::create($storagePath)) {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 					$repository->init();
91 91
 					$this->repository = $repository;
92 92
 				} else {
93
-					throw new \Exception('Could not create repository directory: ' . $storagePath);
93
+					throw new \Exception('Could not create repository directory: '.$storagePath);
94 94
 				}
95 95
 			} else {
96 96
 				$this->repository = new Repository($storagePath);
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 		{
134 134
 			$documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues);
135 135
 			if ($postValues['path'] === '/') {
136
-				$documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug;
136
+				$documentFolderObject->path = $postValues['path'].$documentFolderObject->slug;
137 137
 			} else {
138
-				$documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug;
138
+				$documentFolderObject->path = $postValues['path'].'/'.$documentFolderObject->slug;
139 139
 			}
140 140
 			$this->repository->saveDocument($documentFolderObject, 'published');
141 141
 			$this->repository->saveDocument($documentFolderObject, 'unpublished');
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		 */
151 151
 		public function deleteDocumentFolderBySlug($slug)
152 152
 		{
153
-			$path = '/' . $slug;
153
+			$path = '/'.$slug;
154 154
 			$this->repository->deleteDocumentByPath($path, 'published');
155 155
 			$this->repository->deleteDocumentByPath($path, 'unpublished');
156 156
 			$this->repository->cleanPublishedDeletedDocuments();
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 
159 159
 		public function publishDocumentBySlug($slug)
160 160
 		{
161
-			$path = '/' . $slug;
161
+			$path = '/'.$slug;
162 162
 			$this->repository->publishDocumentByPath($path);
163 163
 		}
164 164
 
165 165
 		public function unpublishDocumentBySlug($slug)
166 166
 		{
167
-			$path = '/' . $slug;
167
+			$path = '/'.$slug;
168 168
 			$this->repository->unpublishDocumentByPath($path);
169 169
 		}
170 170
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		 */
179 179
 		public function getDocumentFolderBySlug($slug)
180 180
 		{
181
-			$path = '/' . $slug;
181
+			$path = '/'.$slug;
182 182
 
183 183
 			return $this->repository->getDocumentByPath($path);
184 184
 		}
Please login to merge, or discard this patch.
cloudcontrol/library/storage/Repository.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
             if (in_array($name, $this->fileBasedSubsets)) {
107 107
                 return $this->$name;
108 108
             } else {
109
-                throw new \Exception('Trying to get undefined property from Repository: ' . $name);
109
+                throw new \Exception('Trying to get undefined property from Repository: '.$name);
110 110
             }
111 111
         } else {
112 112
             if (in_array($name, $this->fileBasedSubsets)) {
113 113
                 return $this->loadSubset($name);
114 114
             } else {
115
-                throw new \Exception('Trying to get undefined property from Repository: ' . $name);
115
+                throw new \Exception('Trying to get undefined property from Repository: '.$name);
116 116
             }
117 117
         }
118 118
     }
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
     {
128 128
         if (in_array($name, $this->fileBasedSubsets)) {
129 129
             $this->$name = $value;
130
-            $changes = $name . 'Changes';
130
+            $changes = $name.'Changes';
131 131
             $this->$changes = true;
132 132
         } else {
133
-            throw new \Exception('Trying to persist unknown subset in repository: ' . $name . ' <br /><pre>' . print_r($value, true) . '</pre>');
133
+            throw new \Exception('Trying to persist unknown subset in repository: '.$name.' <br /><pre>'.print_r($value, true).'</pre>');
134 134
         }
135 135
     }
136 136
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function save()
141 141
     {
142
-        array_map(function ($value) {
142
+        array_map(function($value) {
143 143
         	$this->saveSubset($value);
144 144
 		}, $this->fileBasedSubsets);
145 145
     }
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
      */
151 151
     protected function saveSubset($subset)
152 152
     {
153
-		$changes = $subset . 'Changes';
153
+		$changes = $subset.'Changes';
154 154
 		if ($this->$changes === true) {
155 155
 			$json = json_encode($this->$subset, JSON_PRETTY_PRINT);
156
-			$subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json';
156
+			$subsetStoragePath = $this->storagePath.DIRECTORY_SEPARATOR.$subset.'.json';
157 157
 			file_put_contents($subsetStoragePath, $json);
158 158
 
159 159
 			$this->$changes = false;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      */
168 168
     protected function loadSubset($subset)
169 169
     {
170
-        $subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json';
170
+        $subsetStoragePath = $this->storagePath.DIRECTORY_SEPARATOR.$subset.'.json';
171 171
         $json = file_get_contents($subsetStoragePath);
172 172
         $json = json_decode($json);
173 173
         $this->$subset = $json;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     public function getContentDbHandle()
216 216
     {
217 217
         if ($this->contentDbHandle === null) {
218
-            $this->contentDbHandle = new \PDO('sqlite:' . $this->storagePath . DIRECTORY_SEPARATOR . 'content.db');
218
+            $this->contentDbHandle = new \PDO('sqlite:'.$this->storagePath.DIRECTORY_SEPARATOR.'content.db');
219 219
         }
220 220
         return $this->contentDbHandle;
221 221
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     public function getDocuments($state = 'published')
232 232
     {
233 233
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
234
-			throw new \Exception('Unsupported document state: ' . $state);
234
+			throw new \Exception('Unsupported document state: '.$state);
235 235
 		}
236 236
         return $this->getDocumentsByPath('/', $state);
237 237
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	public function getDocumentsWithState($folderPath = '/')
240 240
 	{
241 241
 		$db = $this->getContentDbHandle();
242
-		$folderPathWithWildcard = $folderPath . '%';
242
+		$folderPathWithWildcard = $folderPath.'%';
243 243
 
244 244
 		$ifRootIndex = 1;
245 245
 		if ($folderPath == '/') {
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
               FROM documents_unpublished
255 255
 		 LEFT JOIN documents_published
256 256
          		ON documents_published.path = documents_unpublished.path
257
-             WHERE documents_unpublished.`path` LIKE ' . $db->quote($folderPathWithWildcard) . '
258
-               AND substr(documents_unpublished.`path`, ' . (strlen($folderPath) + $ifRootIndex + 1) . ') NOT LIKE "%/%"
259
-               AND length(documents_unpublished.`path`) > ' . (strlen($folderPath) + $ifRootIndex) . '
260
-               AND documents_unpublished.path != ' . $db->quote($folderPath) . '
257
+             WHERE documents_unpublished.`path` LIKE ' . $db->quote($folderPathWithWildcard).'
258
+               AND substr(documents_unpublished.`path`, ' . (strlen($folderPath) + $ifRootIndex + 1).') NOT LIKE "%/%"
259
+               AND length(documents_unpublished.`path`) > ' . (strlen($folderPath) + $ifRootIndex).'
260
+               AND documents_unpublished.path != ' . $db->quote($folderPath).'
261 261
           ORDER BY documents_unpublished.`type` DESC, documents_unpublished.`path` ASC
262 262
         ';
263 263
 		$stmt = $this->getDbStatement($sql);
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
     public function getDocumentsByPath($folderPath, $state = 'published')
285 285
     {
286 286
     	if (!in_array($state, Document::$DOCUMENT_STATES)) {
287
-    		throw new \Exception('Unsupported document state: ' . $state);
287
+    		throw new \Exception('Unsupported document state: '.$state);
288 288
 		}
289 289
         $db = $this->getContentDbHandle();
290
-        $folderPathWithWildcard = $folderPath . '%';
290
+        $folderPathWithWildcard = $folderPath.'%';
291 291
 
292 292
         $sql = 'SELECT *
293
-              FROM documents_' . $state . '
294
-             WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard) . '
295
-               AND substr(`path`, ' . (strlen($folderPath) + 1) . ') NOT LIKE "%/%"
296
-               AND path != ' . $db->quote($folderPath) . '
293
+              FROM documents_' . $state.'
294
+             WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard).'
295
+               AND substr(`path`, ' . (strlen($folderPath) + 1).') NOT LIKE "%/%"
296
+               AND path != ' . $db->quote($folderPath).'
297 297
           ORDER BY `type` DESC, `path` ASC';
298 298
         $stmt = $this->getDbStatement($sql);
299 299
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         if ($containerPath === '/') {
321 321
             return $this->getRootFolder();
322 322
         }
323
-        if (substr($containerPath, -1) === '/'){
323
+        if (substr($containerPath, -1) === '/') {
324 324
 			$containerPath = substr($containerPath, 0, -1);
325 325
 		}
326 326
         $containerFolder = $this->getDocumentByPath($containerPath, 'unpublished');
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
     public function getDocumentByPath($path, $state = 'published')
338 338
     {
339 339
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
340
-			throw new \Exception('Unsupported document state: ' . $state);
340
+			throw new \Exception('Unsupported document state: '.$state);
341 341
 		}
342 342
         $db = $this->getContentDbHandle();
343 343
         $document = $this->fetchDocument('
344 344
             SELECT *
345
-              FROM documents_' .  $state . '
346
-             WHERE path = ' . $db->quote($path) . '
345
+              FROM documents_' .  $state.'
346
+             WHERE path = ' . $db->quote($path).'
347 347
         ');
348 348
         if ($document instanceof Document && $document->type === 'folder') {
349 349
             $document->dbHandle = $db;
@@ -363,16 +363,16 @@  discard block
 block discarded – undo
363 363
 	public function getTotalDocumentCount($state = 'published')
364 364
 	{
365 365
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
366
-			throw new \Exception('Unsupported document state: ' . $state);
366
+			throw new \Exception('Unsupported document state: '.$state);
367 367
 		}
368 368
 		$db = $this->getContentDbHandle();
369 369
 		$stmt = $db->query('
370 370
 			SELECT count(*)
371
-			  FROM documents_' . $state . '
371
+			  FROM documents_' . $state.'
372 372
 			 WHERE `type` != "folder"
373 373
 		');
374 374
 		$result = $stmt->fetch(\PDO::FETCH_ASSOC);
375
-		if (!is_array($result )) {
375
+		if (!is_array($result)) {
376 376
 			return 0;
377 377
 		}
378 378
 		return intval(current($result));
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 		if ($stmt === false || !$stmt->execute()) {
392 392
 			$errorInfo = $db->errorInfo();
393 393
 			$errorMsg = $errorInfo[2];
394
-			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
394
+			throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
395 395
 		}
396 396
 		return $result;
397 397
 	}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 			$sql = '
402 402
 				INSERT OR REPLACE INTO documents_published 
403 403
 					  (`id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`publicationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
404
-				SELECT `id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,"published" as state,`lastModificationDate`,`creationDate`,' . time() . ' as publicationDate, `lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`
404
+				SELECT `id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,"published" as state,`lastModificationDate`,`creationDate`,' . time().' as publicationDate, `lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`
405 405
 				  FROM documents_unpublished
406 406
 				 WHERE `path` = :path
407 407
 			';
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 		if ($stmt === false) {
415 415
 			$errorInfo = $db->errorInfo();
416 416
 			$errorMsg = $errorInfo[2];
417
-			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
417
+			throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
418 418
 		}
419 419
 		$stmt->bindValue(':path', $path);
420 420
 		$stmt->execute();
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		if ($stmt === false) {
446 446
 			$errorInfo = $db->errorInfo();
447 447
 			$errorMsg = $errorInfo[2];
448
-			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
448
+			throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
449 449
 		}
450 450
 		$stmt->execute();
451 451
 	}
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         if ($stmt === false) {
488 488
             $errorInfo = $db->errorInfo();
489 489
             $errorMsg = $errorInfo[2];
490
-            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
490
+            throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
491 491
         }
492 492
         return $stmt;
493 493
     }
@@ -517,25 +517,25 @@  discard block
 block discarded – undo
517 517
     public function saveDocument($documentObject, $state = 'published')
518 518
     {
519 519
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
520
-			throw new \Exception('Unsupported document state: ' . $state);
520
+			throw new \Exception('Unsupported document state: '.$state);
521 521
 		}
522 522
         $db = $this->getContentDbHandle();
523 523
         $stmt = $this->getDbStatement('
524
-            INSERT OR REPLACE INTO documents_' . $state . ' (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
524
+            INSERT OR REPLACE INTO documents_' . $state.' (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
525 525
             VALUES(
526
-              ' . $db->quote($documentObject->path) . ',
527
-              ' . $db->quote($documentObject->title) . ',
528
-              ' . $db->quote($documentObject->slug) . ',
529
-              ' . $db->quote($documentObject->type) . ',
530
-              ' . $db->quote($documentObject->documentType) . ',
531
-              ' . $db->quote($documentObject->documentTypeSlug) . ',
532
-              ' . $db->quote($documentObject->state) . ',
533
-              ' . $db->quote($documentObject->lastModificationDate) . ',
534
-              ' . $db->quote($documentObject->creationDate) . ',
535
-              ' . $db->quote($documentObject->lastModifiedBy) . ',
536
-              ' . $db->quote(json_encode($documentObject->fields)) . ',
537
-              ' . $db->quote(json_encode($documentObject->bricks)) . ',
538
-              ' . $db->quote(json_encode($documentObject->dynamicBricks)) . '
526
+              ' . $db->quote($documentObject->path).',
527
+              ' . $db->quote($documentObject->title).',
528
+              ' . $db->quote($documentObject->slug).',
529
+              ' . $db->quote($documentObject->type).',
530
+              ' . $db->quote($documentObject->documentType).',
531
+              ' . $db->quote($documentObject->documentTypeSlug).',
532
+              ' . $db->quote($documentObject->state).',
533
+              ' . $db->quote($documentObject->lastModificationDate).',
534
+              ' . $db->quote($documentObject->creationDate).',
535
+              ' . $db->quote($documentObject->lastModifiedBy).',
536
+              ' . $db->quote(json_encode($documentObject->fields)).',
537
+              ' . $db->quote(json_encode($documentObject->bricks)).',
538
+              ' . $db->quote(json_encode($documentObject->dynamicBricks)).'
539 539
             )
540 540
         ');
541 541
         $result = $stmt->execute();
@@ -559,16 +559,16 @@  discard block
 block discarded – undo
559 559
             if ($documentToDelete->type == 'document') {
560 560
                 $stmt = $this->getDbStatement('
561 561
                     DELETE FROM documents_unpublished
562
-                          WHERE path = ' . $db->quote($path) . '
562
+                          WHERE path = ' . $db->quote($path).'
563 563
                 ');
564 564
                 $stmt->execute();
565 565
             } elseif ($documentToDelete->type == 'folder') {
566
-                $folderPathWithWildcard = $path . '%';
566
+                $folderPathWithWildcard = $path.'%';
567 567
                 $stmt = $this->getDbStatement('
568 568
                     DELETE FROM documents_unpublished
569
-                          WHERE (path LIKE ' . $db->quote($folderPathWithWildcard) . '
570
-                            AND substr(`path`, ' . (strlen($path) + 1) . ', 1) = "/")
571
-                            OR path = ' . $db->quote($path) . '
569
+                          WHERE (path LIKE ' . $db->quote($folderPathWithWildcard).'
570
+                            AND substr(`path`, ' . (strlen($path) + 1).', 1) = "/")
571
+                            OR path = ' . $db->quote($path).'
572 572
                 ');
573 573
                 $stmt->execute();
574 574
             }
Please login to merge, or discard this patch.
cloudcontrol/library/search/Indexer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$this->storage->getDocuments()->cleanPublishedDeletedDocuments();
61 61
 		$this->addLog('Retrieving documents to be indexed.');
62 62
 		$documents = $this->storage->getDocuments()->getPublishedDocumentsNoFolders();
63
-		$this->addLog('Start Document Term Count for ' . count($documents) . ' documents');
63
+		$this->addLog('Start Document Term Count for '.count($documents).' documents');
64 64
 		$this->createDocumentTermCount($documents);
65 65
 		$this->addLog('Start Document Term Frequency.');
66 66
 		$this->createDocumentTermFrequency();
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	private function addLog($string)
162 162
 	{
163 163
 		$currentTime = round(microtime(true) * 1000);
164
-		$this->log .= date('d-m-Y H:i:s - ') . str_pad($string, 50, " ", STR_PAD_RIGHT) . "\t" . ($currentTime - $this->lastLog) . 'ms since last log. ' . "\t" . ($currentTime - $this->loggingStart) . 'ms since start.' . PHP_EOL;
164
+		$this->log .= date('d-m-Y H:i:s - ').str_pad($string, 50, " ", STR_PAD_RIGHT)."\t".($currentTime - $this->lastLog).'ms since last log. '."\t".($currentTime - $this->loggingStart).'ms since start.'.PHP_EOL;
165 165
 		$this->lastLog = round(microtime(true) * 1000);
166 166
 	}
167 167
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	protected function getSearchDbHandle()
174 174
 	{
175 175
 		if ($this->searchDbHandle === null) {
176
-			$path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR;
177
-			$this->searchDbHandle = new \PDO('sqlite:' . $path . self::SEARCH_TEMP_DB);
176
+			$path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR;
177
+			$this->searchDbHandle = new \PDO('sqlite:'.$path.self::SEARCH_TEMP_DB);
178 178
 		}
179 179
 		return $this->searchDbHandle;
180 180
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	public function replaceOldIndex()
186 186
 	{
187 187
 		$this->searchDbHandle = null;
188
-		$path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR;
189
-		rename($path . self::SEARCH_TEMP_DB, $path . 'search.db');
188
+		$path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR;
189
+		rename($path.self::SEARCH_TEMP_DB, $path.'search.db');
190 190
 	}
191 191
 }
192 192
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/DocumentRouting.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
 		if ($relativeCmsUri == '/documents/new-document' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) {
42 42
 			$this->documentNewRoute($request, $cmsComponent);
43
-		} elseif (isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])){
43
+		} elseif (isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
44 44
 			switch ($relativeCmsUri) {
45 45
 				case '/documents/edit-document': $this->editDocumentRoute($request, $cmsComponent); break;
46 46
 				case '/documents/get-brick': $this->getBrickRoute($request, $cmsComponent); break;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		if (isset($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE])) {
82 82
 			if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], $request::$get[CmsComponent::GET_PARAMETER_PATH])) {
83 83
 				$cmsComponent->storage->getDocuments()->addDocument($request::$post);
84
-				header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
84
+				header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
85 85
 				exit;
86 86
 			}
87 87
 			$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPE, $cmsComponent->storage->getDocumentTypes()->getDocumentTypeBySlug($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], true));
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		} else {
90 90
 			$documentTypes = $cmsComponent->storage->getDocumentTypes()->getDocumentTypes();
91 91
 			if (count($documentTypes) < 1) {
92
-				throw new \Exception('No Document Types defined yet. <a href="' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/document-types/new">Please do so first.</a>');
92
+				throw new \Exception('No Document Types defined yet. <a href="'.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/document-types/new">Please do so first.</a>');
93 93
 			}
94 94
 			$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPES, $documentTypes);
95 95
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_SMALLEST_IMAGE, $cmsComponent->storage->getImageSet()->getSmallestImageSet()->slug);
107 107
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
108 108
 			$cmsComponent->storage->getDocuments()->saveDocument($request::$post);
109
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
109
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
110 110
 			exit;
111 111
 		}
112 112
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT, $cmsComponent->storage->getDocuments()->getDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG], 'unpublished'));
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	private function deleteDocumentRoute($request, $cmsComponent)
144 144
 	{
145 145
 		$cmsComponent->storage->getDocuments()->deleteDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
146
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
146
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
147 147
 		exit;
148 148
 	}
149 149
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS);
158 158
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::GET_PARAMETER_PATH])) {
159 159
 			$cmsComponent->storage->addDocumentFolder($request::$post);
160
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
160
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
161 161
 			exit;
162 162
 		}
163 163
 	}
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 		array_pop($path);
177 177
 		$path = implode('/', $path);
178 178
 
179
-		$request::$get[CmsComponent::GET_PARAMETER_PATH] = '/' . $path;
179
+		$request::$get[CmsComponent::GET_PARAMETER_PATH] = '/'.$path;
180 180
 
181 181
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post['content'])) {
182 182
 			$cmsComponent->storage->saveDocumentFolder($request::$post);
183
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
183
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
184 184
 			exit;
185 185
 		}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	private function deleteFolderRoute($request, $cmsComponent)
196 196
 	{
197 197
 		$cmsComponent->storage->deleteDocumentFolderBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
198
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
198
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
199 199
 		exit;
200 200
 	}
201 201
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	private function publishDocumentRoute($request, $cmsComponent)
207 207
 	{
208 208
 		$cmsComponent->storage->publishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
209
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
209
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
210 210
 		exit;
211 211
 	}
212 212
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	private function unpublishDocumentRoute($request, $cmsComponent)
218 218
 	{
219 219
 		$cmsComponent->storage->unpublishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
220
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
220
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
221 221
 		exit;
222 222
 	}
223 223
 }
224 224
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/SearchRouting.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	private function showJson($obj, $httpHeader = 'HTTP/1.0 200 OK') {
75
-		header($_SERVER['SERVER_PROTOCOL'] . $httpHeader, true);
75
+		header($_SERVER['SERVER_PROTOCOL'].$httpHeader, true);
76 76
 		header('Content-type: application/json');
77 77
 		die(json_encode($obj));
78 78
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	private function stepRouting($step, $cmsComponent, $indexer)
86 86
 	{
87
-		switch($step) {
87
+		switch ($step) {
88 88
 			case 'resetIndex': $indexer->resetIndex(); break;
89 89
 			case 'cleanPublishedDeletedDocuments': $cmsComponent->storage->getDocuments()->cleanPublishedDeletedDocuments(); break;
90 90
 			case 'createDocumentTermCount':
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			case 'createTermFieldLengthNorm': $indexer->createTermFieldLengthNorm(); break;
96 96
 			case 'createInverseDocumentFrequency': $indexer->createInverseDocumentFrequency(); break;
97 97
 			case 'replaceOldIndex': $indexer->replaceOldIndex(); break;
98
-			default : $this->showJson('Invalid step: ' . $step . '.', 'HTTP/1.0 500 Internal Server Error'); break;
98
+			default : $this->showJson('Invalid step: '.$step.'.', 'HTTP/1.0 500 Internal Server Error'); break;
99 99
 		}
100 100
 		$this->showJson('done');
101 101
 	}
Please login to merge, or discard this patch.