Passed
Push — develop ( f5d3ab...1cfb3a )
by Jens
03:36
created
cloudcontrol/templates/cms/documents.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders . $cmsPrefix?>/documents?path=/');};</script>
1
+<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders.$cmsPrefix?>/documents?path=/');};</script>
2 2
 <section class="documents">
3 3
 	<h2><i class="fa fa-file-text-o"></i> Documents</h2>
4 4
 	<nav class="actions">
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 			<? foreach ($documents as $document) : ?>
25 25
 				<li class="grid-container">
26 26
 					<? if ($document->type == 'document') : ?>
27
-						<?renderDocument($document, $cmsPrefix);?>
27
+						<?renderDocument($document, $cmsPrefix); ?>
28 28
 					<? elseif ($document->type == 'folder') : ?>
29
-						<?renderFolder($document, $cmsPrefix, '', true);?>
29
+						<?renderFolder($document, $cmsPrefix, '', true); ?>
30 30
 					<? endif ?>
31 31
 				</li>
32 32
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 <? function renderDocument($document, $cmsPrefix, $slugPrefix = '') {?>
38 38
 <div class="grid-box-10">
39 39
 	<h3>
40
-		<a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit">
40
+		<a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit">
41 41
 			<i class="fa fa-file-text-o"></i>
42 42
             <small class="state <?=strtolower($document->state)?>"><i class="fa <?=$document->state == 'published' ? 'fa-check-circle-o' : 'fa-times-circle-o' ?>"></i></small>
43 43
             <?=$document->title?>
@@ -56,36 +56,36 @@  discard block
 block discarded – undo
56 56
 </div>
57 57
 <div class="documentActions grid-box-2">
58 58
     <? if (strtolower($document->state) == 'unpublished' || $document->unpublishedChanges) : ?>
59
-        <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>
59
+        <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>
60 60
     <? endif ?>
61 61
     <? if (strtolower($document->state) == 'published') : ?>
62
-        <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>
62
+        <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>
63 63
     <? endif ?>
64
-	<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>
64
+	<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>
65 65
 	<? if (strtolower($document->state) == 'unpublished') : ?>
66
-	<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>
66
+	<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>
67 67
     <? endif ?>
68 68
 </div>
69 69
 <?}?>
70
-<? function renderFolder($document, $cmsPrefix, $slugPrefix ='', $root = false) {?>
70
+<? function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false) {?>
71 71
 <div class="grid-box-8">
72 72
 	<h3>
73
-		<a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix . $document->slug?>" title="Open">
73
+		<a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix.$document->slug?>" title="Open">
74 74
 			<i class="fa fa-folder-o "></i> <?=$document->title?>
75 75
 		</a>
76 76
 	</h3>
77 77
 </div>
78 78
 <div class="documentActions grid-box-4">
79
-	<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
80
-	<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-trash"></i></a>
79
+	<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
80
+	<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-trash"></i></a>
81 81
 </div>
82 82
 <ul class="documents grid-wrapper nested<?=$root ? ' root' : '' ?>">
83 83
 	<? foreach ($document->content as $subDocument) : ?>
84 84
 		<li class="grid-container">
85 85
 			<? if ($subDocument->type == 'document') : ?>
86
-				<?renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?>
86
+				<?renderDocument($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?>
87 87
 			<? elseif ($subDocument->type == 'folder') : ?>
88
-				<?renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?>
88
+				<?renderFolder($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?>
89 89
 			<? endif ?>
90 90
 		</li>
91 91
 	<? endforeach ?>
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/documents/brick.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 	<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
4 4
 </div>
5 5
 <?if ($static == true) {
6
-	$fieldPrefix = 'bricks[' . $myBrickSlug . '][' . str_replace('.', '', str_replace(' ', '', microtime())) . '][fields]';
6
+	$fieldPrefix = 'bricks['.$myBrickSlug.']['.str_replace('.', '', str_replace(' ', '', microtime())).'][fields]';
7 7
 } else {
8
-	$fieldPrefix = 'dynamicBricks[' . $brick->slug . '][' . str_replace('.', '', str_replace(' ', '', microtime())) . ']';
8
+	$fieldPrefix = 'dynamicBricks['.$brick->slug.']['.str_replace('.', '', str_replace(' ', '', microtime())).']';
9 9
 }?>
10 10
 <? foreach ($brick->fields as $field) : ?>
11 11
 			<div class="form-element">
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 							<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
31 31
 							<div class="form-element">
32 32
 				<? endif ?>
33
-					<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
33
+					<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
34 34
 				<? if ($field->multiple == true && $field->type != 'Rich Text') : ?>
35 35
 
36 36
 							</div>
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 						<li class="grid-container">
53 53
 							<div class="grid-box-10">
54 54
 								<div class="grid-inner form-element">
55
-									<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
55
+									<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
56 56
 								</div>
57 57
 							</div>
58 58
 							<div class="grid-box-2">
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 								</div>
63 63
 							</div>
64 64
 						</li>
65
-						<?$value='';?>
65
+						<?$value = ''; ?>
66 66
 						<? endforeach ?>
67 67
 					<? endif ?>
68 68
 				</ul>
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 							<a class="btn error js-deletemultiple"><i class="fa fa-trash"></i></a>
80 80
 							<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
81 81
 							<div class="form-element">
82
-							<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
82
+							<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
83 83
 							</div>
84 84
 						</li>
85
-						<?$value='';?>
85
+						<?$value = ''; ?>
86 86
 					<? endforeach ?>
87 87
 					<? endif ?>
88 88
 					</div>
@@ -91,5 +91,5 @@  discard block
 block discarded – undo
91 91
 				<a class="btn js-addrtemultiple">+</a>
92 92
 				<? endif ?>
93 93
 			</div>
94
-			<?$value='';?>
94
+			<?$value = ''; ?>
95 95
 		<? endforeach ?>
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/documents/document-form-form.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?=isset($formId) ? '#' . $formId : '' ?>">
1
+<form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?=isset($formId) ? '#'.$formId : '' ?>">
2 2
     <? if (!isset($hideTitleAndState)) : ?>
3 3
     <input type="hidden" name="path" value="<?=$request::$get['path']?>" />
4 4
     <? else : ?>
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
                     <input required="required" value="<?=isset($document) ? $document->title : '' ?>" type="text" id="title" name="title" placeholder="Title" />
18 18
                 </div>
19 19
 			<? endif ?>
20
-			<?$fieldPrefix='fields';?>
20
+			<?$fieldPrefix = 'fields'; ?>
21 21
 			<? foreach ($documentType->fields as $field) : ?>
22 22
 				<div class="form-element">
23 23
 					<label for="<?=$field->slug?>"><?=$field->title?></label>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 								<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
42 42
 								<div class="form-element">
43 43
 					<? endif ?>
44
-						<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
44
+						<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
45 45
 					<? if ($field->multiple == true && $field->type != 'Rich Text') : ?>
46 46
 
47 47
 								</div>
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 							<li class="grid-container">
64 64
 								<div class="grid-box-10">
65 65
 									<div class="grid-inner form-element">
66
-										<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
66
+										<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
67 67
 									</div>
68 68
 								</div>
69 69
 								<div class="grid-box-2">
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 									</div>
74 74
 								</div>
75 75
 							</li>
76
-							<?$value='';?>
76
+							<?$value = ''; ?>
77 77
 							<? endforeach ?>
78 78
 						<? endif ?>
79 79
 					</ul>
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 								<a class="btn error js-deletemultiple"><i class="fa fa-trash"></i></a>
91 91
 								<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
92 92
 								<div class="form-element">
93
-								<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
93
+								<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
94 94
 								</div>
95 95
 							</li>
96
-							<?$value='';?>
96
+							<?$value = ''; ?>
97 97
 						<? endforeach ?>
98 98
 						<? endif ?>
99 99
 						</div>
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 					<a class="btn js-addrtemultiple">+</a>
103 103
 					<? endif ?>
104 104
 				</div>
105
-				<?$value='';?>
105
+				<?$value = ''; ?>
106 106
 			<? endforeach ?>
107 107
 			<hr />
108
-			<? $static_brick_nr = 0;?>
108
+			<? $static_brick_nr = 0; ?>
109 109
 			<? foreach ($documentType->bricks as $brick) : ?>
110 110
 			<div class="brick">
111 111
 				<label><?=$brick->title?></label>
112 112
 				<? if ($brick->multiple == 'true') : ?>
113 113
 					<input type="hidden" value="<?=$brick->brickSlug?>"/>
114 114
 					<input type="hidden" value="<?=$brick->slug?>"/>
115
-					<?$myBrickSlug=$brick->slug;?>
115
+					<?$myBrickSlug = $brick->slug; ?>
116 116
 					<ul id="newBrickDropzone_<?=$static_brick_nr?>" class="dynamicBricks sortable">
117 117
 						<? if (isset($document)) : ?>
118 118
 							<? foreach ($document->bricks as $currentBrickSlug => $brickArray) : ?>
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 									<li class="brick form-element">
127 127
 										<label><?=$brick->title?></label>
128 128
 										<?$static = true; ?>
129
-										<?include(__DIR__ . '/brick.php')?>
129
+										<?include(__DIR__.'/brick.php')?>
130 130
 									</li>
131 131
 									<? endif ?>
132 132
 								<? endforeach ?>
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 					<a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a>
137 137
 					<?$static_brick_nr += 1?>
138 138
 				<? else : ?>
139
-					<?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?>
139
+					<?$fieldPrefix = 'bricks['.$brick->slug.'][fields]'; ?>
140 140
 					<input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" />
141 141
 					<? foreach ($brick->structure->fields as $field) : ?>
142 142
 						<div class="form-element">
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 									<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
163 163
 									<div class="form-element">
164 164
 						<? endif ?>
165
-							<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
165
+							<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
166 166
 						<? if ($field->multiple == true && $field->type != 'Rich Text') : ?>
167 167
 
168 168
 									</div>
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 								<li class="grid-container">
186 186
 									<div class="grid-box-10">
187 187
 										<div class="grid-inner form-element">
188
-											<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
188
+											<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
189 189
 										</div>
190 190
 									</div>
191 191
 									<div class="grid-box-2">
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 										</div>
196 196
 									</div>
197 197
 								</li>
198
-								<?$value='';?>
198
+								<?$value = ''; ?>
199 199
 								<? endforeach ?>
200 200
 							<? endif ?>
201 201
 						</ul>
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 									<a class="btn error js-deletemultiple"><i class="fa fa-trash"></i></a>
214 214
 									<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
215 215
 									<div class="form-element">
216
-									<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
216
+									<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
217 217
 									</div>
218 218
 								</li>
219
-								<?$value='';?>
219
+								<?$value = ''; ?>
220 220
 							<? endforeach ?>
221 221
 							<? endif ?>
222 222
 							</div>
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 						<a class="btn js-addrtemultiple">+</a>
226 226
 						<? endif ?>
227 227
 					</div>
228
-					<?$value='';?>
228
+					<?$value = ''; ?>
229 229
 				<? endforeach ?>
230 230
 				<? endif ?>
231 231
 				</div>
232 232
 				<hr />
233
-			<? endforeach;?>
233
+			<? endforeach; ?>
234 234
 
235 235
 
236 236
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 						<li class="brick form-element">
254 254
 							<label><?=$brick->title?></label>
255 255
 							<?$static = false; ?>
256
-							<?include(__DIR__ . '/brick.php')?>
256
+							<?include(__DIR__.'/brick.php')?>
257 257
 						</li>
258 258
 					<? endforeach ?>
259 259
 				<? endif ?>
Please login to merge, or discard this patch.
cloudcontrol/library/storage/storage/DocumentStorage.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	public function getDocuments($state = 'published')
22 22
 	{
23 23
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
24
-			throw new \Exception('Unsupported document state: ' . $state);
24
+			throw new \Exception('Unsupported document state: '.$state);
25 25
 		}
26 26
 		return $this->repository->getDocuments($state);
27 27
 	}
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	public function getDocumentBySlug($slug, $state = 'published')
51 51
 	{
52 52
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
53
-			throw new \Exception('Unsupported document state: ' . $state);
53
+			throw new \Exception('Unsupported document state: '.$state);
54 54
 		}
55
-		$path = '/' . $slug;
55
+		$path = '/'.$slug;
56 56
 
57 57
 		return $this->repository->getDocumentByPath($path, $state);
58 58
 	}
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 	public function saveDocument($postValues, $state = 'unpublished')
67 67
 	{
68 68
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
69
-			throw new \Exception('Unsupported document state: ' . $state);
69
+			throw new \Exception('Unsupported document state: '.$state);
70 70
 		}
71
-		$oldPath = '/' . $postValues['path'];
71
+		$oldPath = '/'.$postValues['path'];
72 72
 
73 73
 		$container = $this->getDocumentContainerByPath($oldPath);
74 74
 		$documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository));
75 75
 		if ($container->path === '/') {
76
-			$newPath = $container->path . $documentObject->slug;
76
+			$newPath = $container->path.$documentObject->slug;
77 77
 		} else {
78
-			$newPath = $container->path . '/' . $documentObject->slug;
78
+			$newPath = $container->path.'/'.$documentObject->slug;
79 79
 		}
80 80
 		$documentObject->path = $newPath;
81 81
 		$this->repository->saveDocument($documentObject, $state);
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository));
91 91
 		if ($postValues['path'] === '/') {
92
-			$documentObject->path = $postValues['path'] . $documentObject->slug;
92
+			$documentObject->path = $postValues['path'].$documentObject->slug;
93 93
 		} else {
94
-			$documentObject->path = $postValues['path'] . '/' . $documentObject->slug;
94
+			$documentObject->path = $postValues['path'].'/'.$documentObject->slug;
95 95
 		}
96 96
 
97 97
 		$this->repository->saveDocument($documentObject, $state);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function deleteDocumentBySlug($slug)
104 104
 	{
105
-		$path = '/' . $slug;
105
+		$path = '/'.$slug;
106 106
 		$this->repository->deleteDocumentByPath($path);
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
cloudcontrol/library/storage/Document.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             }
53 53
         } elseif ($name === 'content') {
54 54
             if ($this->dbHandle === null) {
55
-                throw new \Exception('Document doesnt have a dbHandle handle. (path: ' . $this->path . ')');
55
+                throw new \Exception('Document doesnt have a dbHandle handle. (path: '.$this->path.')');
56 56
             } else {
57 57
                 if ($this->content === null) {
58 58
                     return $this->getContent();
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
     	$docs = $this->documentStorage->getDocumentsWithState($this->path);
88 88
     	return $docs;
89 89
     	//dump($this->path, $docs);
90
-        $folderPathWithWildcard = $this->path . '%';
90
+        $folderPathWithWildcard = $this->path.'%';
91 91
         $sql = '    SELECT *
92 92
                       FROM documents_published
93
-                     WHERE `path` LIKE ' . $this->dbHandle->quote($folderPathWithWildcard) . '
94
-                       AND substr(`path`, ' . (strlen($this->path) + 2) . ') NOT LIKE "%/%"
95
-                       AND substr(`path`, ' . (strlen($this->path) + 1) . ', 1) = "/"
96
-                       AND path != ' . $this->dbHandle->quote($this->path) . '
97
-                  ORDER BY ' . (in_array($orderBy, $this->orderableFields) ? $orderBy : 'title') . ' ' . ($order === 'ASC' ? 'ASC' : 'DESC') . '
93
+                     WHERE `path` LIKE ' . $this->dbHandle->quote($folderPathWithWildcard).'
94
+                       AND substr(`path`, ' . (strlen($this->path) + 2).') NOT LIKE "%/%"
95
+                       AND substr(`path`, ' . (strlen($this->path) + 1).', 1) = "/"
96
+                       AND path != ' . $this->dbHandle->quote($this->path).'
97
+                  ORDER BY ' . (in_array($orderBy, $this->orderableFields) ? $orderBy : 'title').' '.($order === 'ASC' ? 'ASC' : 'DESC').'
98 98
                     ';
99 99
         $stmt = $this->dbHandle->prepare($sql);
100 100
 		if ($stmt === false) {
101 101
 			$errorInfo = $this->dbHandle->errorInfo();
102 102
 			$errorMsg = $errorInfo[2];
103
-			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
103
+			throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
104 104
 		}
105 105
         $stmt->bindColumn(':orderBy', $orderBy, \PDO::PARAM_STMT);
106 106
 		$stmt->execute();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function __toString()
122 122
 	{
123
-		return 'Document:' . $this->title;
123
+		return 'Document:'.$this->title;
124 124
 	}
125 125
 
126 126
 
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);
@@ -288,16 +288,16 @@  discard block
 block discarded – undo
288 288
     public function getDocumentsByPath($folderPath, $state = 'published')
289 289
     {
290 290
     	if (!in_array($state, Document::$DOCUMENT_STATES)) {
291
-    		throw new \Exception('Unsupported document state: ' . $state);
291
+    		throw new \Exception('Unsupported document state: '.$state);
292 292
 		}
293 293
         $db = $this->getContentDbHandle();
294
-        $folderPathWithWildcard = $folderPath . '%';
294
+        $folderPathWithWildcard = $folderPath.'%';
295 295
 
296 296
         $sql = 'SELECT *
297
-              FROM documents_' . $state . '
298
-             WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard) . '
299
-               AND substr(`path`, ' . (strlen($folderPath) + 1) . ') NOT LIKE "%/%"
300
-               AND path != ' . $db->quote($folderPath) . '
297
+              FROM documents_' . $state.'
298
+             WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard).'
299
+               AND substr(`path`, ' . (strlen($folderPath) + 1).') NOT LIKE "%/%"
300
+               AND path != ' . $db->quote($folderPath).'
301 301
           ORDER BY `type` DESC, `path` ASC';
302 302
         $stmt = $this->getDbStatement($sql);
303 303
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         if ($containerPath === '/') {
329 329
             return $this->getRootFolder();
330 330
         }
331
-        if (substr($containerPath, -1) === '/'){
331
+        if (substr($containerPath, -1) === '/') {
332 332
 			$containerPath = substr($containerPath, 0, -1);
333 333
 		}
334 334
         $containerFolder = $this->getDocumentByPath($containerPath, 'unpublished');
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
     public function getDocumentByPath($path, $state = 'published')
346 346
     {
347 347
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
348
-			throw new \Exception('Unsupported document state: ' . $state);
348
+			throw new \Exception('Unsupported document state: '.$state);
349 349
 		}
350 350
         $db = $this->getContentDbHandle();
351 351
         $document = $this->fetchDocument('
352 352
             SELECT *
353
-              FROM documents_' .  $state . '
354
-             WHERE path = ' . $db->quote($path) . '
353
+              FROM documents_' .  $state.'
354
+             WHERE path = ' . $db->quote($path).'
355 355
         ');
356 356
         if ($document instanceof Document && $document->type === 'folder') {
357 357
             $document->dbHandle = $db;
@@ -371,16 +371,16 @@  discard block
 block discarded – undo
371 371
 	public function getTotalDocumentCount($state = 'published')
372 372
 	{
373 373
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
374
-			throw new \Exception('Unsupported document state: ' . $state);
374
+			throw new \Exception('Unsupported document state: '.$state);
375 375
 		}
376 376
 		$db = $this->getContentDbHandle();
377 377
 		$stmt = $db->query('
378 378
 			SELECT count(*)
379
-			  FROM documents_' . $state . '
379
+			  FROM documents_' . $state.'
380 380
 			 WHERE `type` != "folder"
381 381
 		');
382 382
 		$result = $stmt->fetch(\PDO::FETCH_ASSOC);
383
-		if (!is_array($result )) {
383
+		if (!is_array($result)) {
384 384
 			return 0;
385 385
 		}
386 386
 		return intval(current($result));
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		if ($stmt === false || !$stmt->execute()) {
400 400
 			$errorInfo = $db->errorInfo();
401 401
 			$errorMsg = $errorInfo[2];
402
-			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
402
+			throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
403 403
 		}
404 404
 		return $result;
405 405
 	}
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 		$sql = '
411 411
 			INSERT OR REPLACE INTO documents_published 
412 412
 				  (`id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`publicationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
413
-		    SELECT `id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,"published" as state,`lastModificationDate`,`creationDate`,' . time() . ' as publicationDate, `lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`
413
+		    SELECT `id`,`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,"published" as state,`lastModificationDate`,`creationDate`,' . time().' as publicationDate, `lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`
414 414
 		      FROM documents_unpublished
415 415
 		     WHERE `path` = :path
416 416
 		';
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		if ($stmt === false) {
419 419
 			$errorInfo = $db->errorInfo();
420 420
 			$errorMsg = $errorInfo[2];
421
-			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
421
+			throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
422 422
 		}
423 423
 		$stmt->bindValue(':path', $path);
424 424
 		$stmt->execute();
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 		if ($stmt === false) {
434 434
 			$errorInfo = $db->errorInfo();
435 435
 			$errorMsg = $errorInfo[2];
436
-			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
436
+			throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
437 437
 		}
438 438
 		$stmt->bindValue(':path', $path);
439 439
 		$stmt->execute();
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         if ($stmt === false) {
477 477
             $errorInfo = $db->errorInfo();
478 478
             $errorMsg = $errorInfo[2];
479
-            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
479
+            throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
480 480
         }
481 481
         return $stmt;
482 482
     }
@@ -506,25 +506,25 @@  discard block
 block discarded – undo
506 506
     public function saveDocument($documentObject, $state = 'published')
507 507
     {
508 508
 		if (!in_array($state, Document::$DOCUMENT_STATES)) {
509
-			throw new \Exception('Unsupported document state: ' . $state);
509
+			throw new \Exception('Unsupported document state: '.$state);
510 510
 		}
511 511
         $db = $this->getContentDbHandle();
512 512
         $stmt = $this->getDbStatement('
513
-            INSERT OR REPLACE INTO documents_' . $state . ' (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
513
+            INSERT OR REPLACE INTO documents_' . $state.' (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
514 514
             VALUES(
515
-              ' . $db->quote($documentObject->path) . ',
516
-              ' . $db->quote($documentObject->title) . ',
517
-              ' . $db->quote($documentObject->slug) . ',
518
-              ' . $db->quote($documentObject->type) . ',
519
-              ' . $db->quote($documentObject->documentType) . ',
520
-              ' . $db->quote($documentObject->documentTypeSlug) . ',
521
-              ' . $db->quote($documentObject->state) . ',
522
-              ' . $db->quote($documentObject->lastModificationDate) . ',
523
-              ' . $db->quote($documentObject->creationDate) . ',
524
-              ' . $db->quote($documentObject->lastModifiedBy) . ',
525
-              ' . $db->quote(json_encode($documentObject->fields)) . ',
526
-              ' . $db->quote(json_encode($documentObject->bricks)) . ',
527
-              ' . $db->quote(json_encode($documentObject->dynamicBricks)) . '
515
+              ' . $db->quote($documentObject->path).',
516
+              ' . $db->quote($documentObject->title).',
517
+              ' . $db->quote($documentObject->slug).',
518
+              ' . $db->quote($documentObject->type).',
519
+              ' . $db->quote($documentObject->documentType).',
520
+              ' . $db->quote($documentObject->documentTypeSlug).',
521
+              ' . $db->quote($documentObject->state).',
522
+              ' . $db->quote($documentObject->lastModificationDate).',
523
+              ' . $db->quote($documentObject->creationDate).',
524
+              ' . $db->quote($documentObject->lastModifiedBy).',
525
+              ' . $db->quote(json_encode($documentObject->fields)).',
526
+              ' . $db->quote(json_encode($documentObject->bricks)).',
527
+              ' . $db->quote(json_encode($documentObject->dynamicBricks)).'
528 528
             )
529 529
         ');
530 530
         $result = $stmt->execute();
@@ -548,16 +548,16 @@  discard block
 block discarded – undo
548 548
             if ($documentToDelete->type == 'document') {
549 549
                 $stmt = $this->getDbStatement('
550 550
                     DELETE FROM documents_unpublished
551
-                          WHERE path = ' . $db->quote($path) . '
551
+                          WHERE path = ' . $db->quote($path).'
552 552
                 ');
553 553
                 $stmt->execute();
554 554
             } elseif ($documentToDelete->type == 'folder') {
555
-                $folderPathWithWildcard = $path . '%';
555
+                $folderPathWithWildcard = $path.'%';
556 556
                 $stmt = $this->getDbStatement('
557 557
                     DELETE FROM documents_unpublished
558
-                          WHERE (path LIKE ' . $db->quote($folderPathWithWildcard) . '
559
-                            AND substr(`path`, ' . (strlen($path) + 1) . ', 1) = "/")
560
-                            OR path = ' . $db->quote($path) . '
558
+                          WHERE (path LIKE ' . $db->quote($folderPathWithWildcard).'
559
+                            AND substr(`path`, ' . (strlen($path) + 1).', 1) = "/")
560
+                            OR path = ' . $db->quote($path).'
561 561
                 ');
562 562
                 $stmt->execute();
563 563
             }
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,20 +150,20 @@  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
 		}
157 157
 
158 158
 		public function publishDocumentBySlug($slug)
159 159
 		{
160
-			$path = '/' . $slug;
160
+			$path = '/'.$slug;
161 161
 			$this->repository->publishDocumentByPath($path);
162 162
 		}
163 163
 
164 164
 		public function unpublishDocumentBySlug($slug)
165 165
 		{
166
-			$path = '/' . $slug;
166
+			$path = '/'.$slug;
167 167
 			$this->repository->unpublishDocumentByPath($path);
168 168
 		}
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		 */
178 178
 		public function getDocumentFolderBySlug($slug)
179 179
 		{
180
-			$path = '/' . $slug;
180
+			$path = '/'.$slug;
181 181
 
182 182
 			return $this->repository->getDocumentByPath($path);
183 183
 		}
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
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$this->resetIndex();
59 59
 		$this->addLog('Retrieving documents to be indexed.');
60 60
 		$documents = $this->storage->getDocuments()->getPublishedDocumentsNoFolders();
61
-		$this->addLog('Start Document Term Count for ' . count($documents) . ' documents');
61
+		$this->addLog('Start Document Term Count for '.count($documents).' documents');
62 62
 		$this->createDocumentTermCount($documents);
63 63
 		$this->addLog('Start Document Term Frequency.');
64 64
 		$this->createDocumentTermFrequency();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	private function addLog($string)
160 160
 	{
161 161
 		$currentTime = round(microtime(true) * 1000);
162
-		$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;
162
+		$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;
163 163
 		$this->lastLog = round(microtime(true) * 1000);
164 164
 	}
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	protected function getSearchDbHandle()
172 172
 	{
173 173
 		if ($this->searchDbHandle === null) {
174
-			$path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR;
175
-			$this->searchDbHandle = new \PDO('sqlite:' . $path . self::SEARCH_TEMP_DB);
174
+			$path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR;
175
+			$this->searchDbHandle = new \PDO('sqlite:'.$path.self::SEARCH_TEMP_DB);
176 176
 		}
177 177
 		return $this->searchDbHandle;
178 178
 	}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	public function replaceOldIndex()
184 184
 	{
185 185
 		$this->searchDbHandle = null;
186
-		$path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR;
187
-		rename($path . self::SEARCH_TEMP_DB, $path . 'search.db');
186
+		$path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR;
187
+		rename($path.self::SEARCH_TEMP_DB, $path.'search.db');
188 188
 	}
189 189
 }
190 190
\ No newline at end of file
Please login to merge, or discard this patch.
cloudcontrol/library/components/cms/DocumentRouting.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		if (isset($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE])) {
84 84
 			if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], $request::$get[CmsComponent::GET_PARAMETER_PATH])) {
85 85
 				$cmsComponent->storage->getDocuments()->addDocument($request::$post);
86
-				header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
86
+				header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
87 87
 				exit;
88 88
 			}
89 89
 			$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPE, $cmsComponent->storage->getDocumentTypes()->getDocumentTypeBySlug($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], true));
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		} else {
92 92
 			$documentTypes = $cmsComponent->storage->getDocumentTypes()->getDocumentTypes();
93 93
 			if (count($documentTypes) < 1) {
94
-				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>');
94
+				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>');
95 95
 			}
96 96
 			$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPES, $documentTypes);
97 97
 		}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_SMALLEST_IMAGE, $cmsComponent->storage->getImageSet()->getSmallestImageSet()->slug);
109 109
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::GET_PARAMETER_SLUG])) {
110 110
 			$cmsComponent->storage->getDocuments()->saveDocument($request::$post);
111
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
111
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
112 112
 			exit;
113 113
 		}
114 114
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT, $cmsComponent->storage->getDocuments()->getDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG], 'unpublished'));
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	private function deleteDocumentRoute($request, $cmsComponent)
146 146
 	{
147 147
 		$cmsComponent->storage->getDocuments()->deleteDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
148
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
148
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
149 149
 		exit;
150 150
 	}
151 151
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS);
160 160
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::GET_PARAMETER_PATH])) {
161 161
 			$cmsComponent->storage->addDocumentFolder($request::$post);
162
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
162
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
163 163
 			exit;
164 164
 		}
165 165
 	}
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 		array_pop($path);
179 179
 		$path = implode('/', $path);
180 180
 
181
-		$request::$get[CmsComponent::GET_PARAMETER_PATH] = '/' . $path;
181
+		$request::$get[CmsComponent::GET_PARAMETER_PATH] = '/'.$path;
182 182
 
183 183
 		if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post['content'])) {
184 184
 			$cmsComponent->storage->saveDocumentFolder($request::$post);
185
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
185
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
186 186
 			exit;
187 187
 		}
188 188
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	private function deleteFolderRoute($request, $cmsComponent)
198 198
 	{
199 199
 		$cmsComponent->storage->deleteDocumentFolderBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
200
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
200
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
201 201
 		exit;
202 202
 	}
203 203
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	private function publishDocumentRoute($request, $cmsComponent)
209 209
 	{
210 210
 		$cmsComponent->storage->publishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
211
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
211
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
212 212
 		exit;
213 213
 	}
214 214
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	private function unpublishDocumentRoute($request, $cmsComponent)
220 220
 	{
221 221
 		$cmsComponent->storage->unpublishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]);
222
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents');
222
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents');
223 223
 		exit;
224 224
 	}
225 225
 }
226 226
\ No newline at end of file
Please login to merge, or discard this patch.