Completed
Push — develop ( 7e4f1d...c463ba )
by Dmytro
11:42 queued 04:02
created
manager/includes/actionlist.inc.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,11 +139,14 @@
 block discarded – undo
139 139
  * @param string $itemid
140 140
  * @return string
141 141
  */
142
-function getAction($actionId, $itemid='') {
142
+function getAction($actionId, $itemid='')
143
+{
143 144
 	global $action_list;
144 145
 
145 146
 	$ret = sprintf($action_list[$actionId], $itemid);
146
-	if (!$ret) $ret = "Idle (unknown)";
147
+	if (!$ret) {
148
+	    $ret = "Idle (unknown)";
149
+	}
147 150
 
148 151
 	return $ret;
149 152
 }
Please login to merge, or discard this patch.
manager/includes/extenders/ex_dbapi.inc.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,15 +7,17 @@
 block discarded – undo
7 7
 
8 8
 global $database_type;
9 9
 
10
-if (empty($database_type)) $database_type = 'mysql';
10
+if (empty($database_type)) {
11
+    $database_type = 'mysql';
12
+}
11 13
 
12 14
 $out = false;
13 15
 $class = 'DBAPI';
14
-if( ! class_exists($class)){
16
+if( ! class_exists($class)) {
15 17
     include_once MODX_MANAGER_PATH . 'includes/extenders/dbapi.' . $database_type . '.class.inc.php';
16 18
 }
17 19
 
18
-if(class_exists($class)){
20
+if(class_exists($class)) {
19 21
     $this->db= new $class;
20 22
     $out = true;
21 23
 }
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysqli.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -373,7 +373,8 @@  discard block
 block discarded – undo
373 373
      * @return bool|mixed|mysqli_result
374 374
      */
375 375
     public function save($fields, $table, $where = '')
376
-    { // This is similar to "replace into table".
376
+    {
377
+// This is similar to "replace into table".
377 378
 
378 379
         if ($where === '') {
379 380
             $mode = 'insert';
@@ -490,7 +491,7 @@  discard block
 block discarded – undo
490 491
     {
491 492
         $out = false;
492 493
         if ($ds instanceof mysqli_result) {
493
-            switch($mode){
494
+            switch($mode) {
494 495
                 case 'assoc':
495 496
                     $out = $ds->fetch_assoc();
496 497
                     break;
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @return string
18 18
  */
19
-function createGUID(){
19
+function createGUID()
20
+{
20 21
 	srand((double)microtime()*1000000);
21 22
 	$r = rand() ;
22 23
 	$u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
@@ -27,8 +28,11 @@  discard block
 block discarded – undo
27 28
 // count duplicates
28 29
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'"));
29 30
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
30
-if($count>=1) $count = ' '.($count+1);
31
-else $count = '';
31
+if($count>=1) {
32
+    $count = ' '.($count+1);
33
+} else {
34
+    $count = '';
35
+}
32 36
 
33 37
 // duplicate module
34 38
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
manager/processors/remove_installer.processor.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,10 +17,14 @@  discard block
 block discarded – undo
17 17
 $pth = str_replace("\\","/",$pth);
18 18
 if(isset($_GET["rminstall"])) {
19 19
 	if(is_dir($pth)) {
20
-		if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder";
20
+		if(!rmdirRecursive($pth)) {
21
+		    $msg="An error occured while attempting to remove the install folder";
22
+		}
21 23
 	}
22 24
 }
23
-if($msg) echo "<script>alert('".addslashes($msg)."');</script>";
25
+if($msg) {
26
+    echo "<script>alert('".addslashes($msg)."');</script>";
27
+}
24 28
 echo "<script>window.location='../index.php?a=2';</script>";
25 29
 
26 30
 /**
@@ -30,13 +34,13 @@  discard block
 block discarded – undo
30 34
  * @param bool $followLinks
31 35
  * @return bool
32 36
  */
33
-function rmdirRecursive($path, $followLinks=false) {
37
+function rmdirRecursive($path, $followLinks=false)
38
+{
34 39
    $dir = opendir($path) ;
35 40
    while ($entry = readdir($dir)) {
36 41
 	   if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) {
37 42
 		   @unlink( "$path/$entry" );
38
-	   }
39
-	   elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
43
+	   } elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
40 44
 		   rmdirRecursive("$path/$entry"); // recursive
41 45
 	   }
42 46
    }
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,17 +50,23 @@  discard block
 block discarded – undo
50 50
 	include_once($autoloader);
51 51
 }
52 52
 
53
-if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
53
+if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) {
54
+    $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
55
+}
54 56
 
55 57
 $base_path = str_replace('\\','/',dirname(__FILE__)) . '/';
56
-if(is_file($base_path . 'assets/cache/siteManager.php'))
58
+if(is_file($base_path . 'assets/cache/siteManager.php')) {
57 59
     include_once($base_path . 'assets/cache/siteManager.php');
58
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
60
+}
61
+if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
59 62
 	define('MGR_DIR', 'manager');
60
-if(is_file($base_path . 'assets/cache/siteHostnames.php'))
63
+}
64
+if(is_file($base_path . 'assets/cache/siteHostnames.php')) {
61 65
     include_once($base_path . 'assets/cache/siteHostnames.php');
62
-if(!defined('MODX_SITE_HOSTNAMES'))
66
+}
67
+if(!defined('MODX_SITE_HOSTNAMES')) {
63 68
 	define('MODX_SITE_HOSTNAMES', '');
69
+}
64 70
 
65 71
 // get start time
66 72
 $mstart = memory_get_usage();
@@ -129,7 +135,7 @@  discard block
 block discarded – undo
129 135
     @ini_set("display_errors","0");
130 136
 }
131 137
 
132
-if(MODX_CLI){
138
+if(MODX_CLI) {
133 139
     @set_time_limit(0);
134 140
     @ini_set('max_execution_time',0);
135 141
 }
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 1 patch
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -104,7 +104,8 @@  discard block
 block discarded – undo
104 104
 /**
105 105
  * @return string
106 106
  */
107
-function run() {
107
+function run()
108
+{
108 109
 	$modx = evolutionCMS(); global $_lang;
109 110
 
110 111
 	$tbl_site_content = $modx->getFullTableName('site_content');
@@ -171,7 +172,8 @@  discard block
 block discarded – undo
171 172
  * @param array $files
172 173
  * @param string $mode
173 174
  */
174
-function importFiles($parent, $filedir, $files, $mode) {
175
+function importFiles($parent, $filedir, $files, $mode)
176
+{
175 177
 	$modx = evolutionCMS();
176 178
 	global $_lang, $allowedfiles;
177 179
 	global $search_default, $cache_default, $publish_default;
@@ -318,7 +320,8 @@  discard block
 block discarded – undo
318 320
  * @param int $count
319 321
  * @return array
320 322
  */
321
-function getFiles($directory, $listing = array(), $count = 0) {
323
+function getFiles($directory, $listing = array(), $count = 0)
324
+{
322 325
 	global $_lang;
323 326
 	global $filesfound;
324 327
 	$dummy = $count;
@@ -346,7 +349,8 @@  discard block
 block discarded – undo
346 349
  * @param string $filepath
347 350
  * @return bool|string
348 351
  */
349
-function getFileContent($filepath) {
352
+function getFileContent($filepath)
353
+{
350 354
 	global $_lang;
351 355
 	// get the file
352 356
 	if(!$buffer = file_get_contents($filepath)) {
@@ -360,7 +364,8 @@  discard block
 block discarded – undo
360 364
  * @param array $array
361 365
  * @return array
362 366
  */
363
-function pop_index($array) {
367
+function pop_index($array)
368
+{
364 369
 	$new_array = array();
365 370
 	foreach($array as $k => $v) {
366 371
 		if($v !== 'index.html' && $v !== 'index.htm') {
@@ -383,7 +388,8 @@  discard block
 block discarded – undo
383 388
  * @param string $alias
384 389
  * @return array
385 390
  */
386
-function treatContent($src, $filename, $alias) {
391
+function treatContent($src, $filename, $alias)
392
+{
387 393
 	$modx = evolutionCMS();
388 394
 
389 395
 	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
@@ -427,7 +433,8 @@  discard block
 block discarded – undo
427 433
 /**
428 434
  * @return void
429 435
  */
430
-function convertLink() {
436
+function convertLink()
437
+{
431 438
 	$modx = evolutionCMS();
432 439
 	$tbl_site_content = $modx->getFullTableName('site_content');
433 440
 
Please login to merge, or discard this patch.
manager/actions/mutate_content.dynamic.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -478,7 +478,8 @@  discard block
 block discarded – undo
478 478
 			return s;
479 479
 		}
480 480
 
481
-		<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
481
+		<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') {
482
+// Web Link specific ?>
482 483
 		var lastImageCtrl;
483 484
 		var lastFileCtrl;
484 485
 
@@ -694,7 +695,8 @@  discard block
 block discarded – undo
694 695
 									</td>
695 696
 								</tr>
696 697
 
697
-								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
698
+								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') {
699
+// Web Link specific ?>
698 700
 
699 701
 									<tr>
700 702
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -1353,7 +1355,9 @@  discard block
 block discarded – undo
1353 1355
 						if($documentId > 0) {
1354 1356
 							// Load up, the permissions from the parent (if new document) or existing document
1355 1357
 							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1356
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1358
+							while($currentgroup = $modx->db->getRow($rs)) {
1359
+							    $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1360
+							}
1357 1361
 
1358 1362
 							// Load up the current permissions and names
1359 1363
 							$vs = array(
@@ -1415,7 +1419,9 @@  discard block
 block discarded – undo
1415 1419
 
1416 1420
 							// Create attribute string list
1417 1421
 							$inputString = array();
1418
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1422
+							foreach($inputAttributes as $k => $v) {
1423
+							    $inputString[] = $k . '="' . $v . '"';
1424
+							}
1419 1425
 
1420 1426
 							// Make the <input> HTML
1421 1427
 							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
@@ -1535,7 +1541,8 @@  discard block
 block discarded – undo
1535 1541
 /**
1536 1542
  * @return string
1537 1543
  */
1538
-function getDefaultTemplate() {
1544
+function getDefaultTemplate()
1545
+{
1539 1546
 	$modx = evolutionCMS();
1540 1547
 
1541 1548
     $default_template = '';
Please login to merge, or discard this patch.
manager/actions/resources/functions.inc.php 1 patch
Braces   +32 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  * @param array $ph
17 17
  * @return string
18 18
  */
19
-function parsePh($tpl, $ph) {
19
+function parsePh($tpl, $ph)
20
+{
20 21
 	$modx = evolutionCMS(); global $_lang;
21 22
 	$tpl = $modx->parseText($tpl, $_lang, '[%', '%]');
22 23
 	return $modx->parseText($tpl, $ph);
@@ -26,7 +27,8 @@  discard block
 block discarded – undo
26 27
  * @param string|int $cssId
27 28
  * @return string
28 29
  */
29
-function renderViewSwitchButtons($cssId) {
30
+function renderViewSwitchButtons($cssId)
31
+{
30 32
 	$modx = evolutionCMS(); global $_lang, $tpl;
31 33
 
32 34
 	return parsePh($tpl['viewForm'], array(
@@ -39,19 +41,20 @@  discard block
 block discarded – undo
39 41
  * @param mgrResources $resources
40 42
  * @return string
41 43
  */
42
-function createResourceList($resourceTable, $resources) {
44
+function createResourceList($resourceTable, $resources)
45
+{
43 46
 	$modx = evolutionCMS(); global $_lang, $_style, $modx_textdir, $tpl;
44 47
 
45 48
 	$items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false;
46 49
 
47
-	if( ! is_array($items) || empty($items)) {
50
+	if( ! is_array($items) || empty($items)) {
48 51
 		return $_lang['no_results'];
49 52
 	}
50 53
 
51 54
 	// Prepare elements- and categories-list
52 55
 	$elements = array();
53 56
 	$categories = array();
54
-	foreach($items as $row) {
57
+	foreach($items as $row) {
55 58
 		$catid = $row['catid'] ? $row['catid'] : 0;
56 59
 		$categories[$catid] = array('name' => stripslashes($row['category']));
57 60
 		$elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources);
@@ -59,7 +62,7 @@  discard block
 block discarded – undo
59 62
 
60 63
 	// Now render categories / panel-collapse
61 64
 	$panelGroup = '';
62
-	foreach($elements as $catid => $elList) {
65
+	foreach($elements as $catid => $elList) {
63 66
 		// Add panel-heading / category-collapse to output
64 67
 		$panelGroup .= parsePh($tpl['panelHeading'], array(
65 68
 			'tab' => $resourceTable,
@@ -70,7 +73,7 @@  discard block
 block discarded – undo
70 73
 
71 74
 		// Prepare content for panel-collapse
72 75
 		$panelCollapse = '';
73
-		foreach($elList as $el) {
76
+		foreach($elList as $el) {
74 77
 			$panelCollapse .= parsePh($tpl['elementsRow'], $el);
75 78
 		}
76 79
 
@@ -92,14 +95,15 @@  discard block
 block discarded – undo
92 95
  * @param mgrResources $resources
93 96
  * @return string
94 97
  */
95
-function createCombinedView($resources) {
98
+function createCombinedView($resources)
99
+{
96 100
 	$modx = evolutionCMS(); global $_lang, $_style, $modx_textdir;
97 101
 
98 102
 	$itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false;
99 103
 	$types = isset($resources->types) ? $resources->types : false;
100 104
 	$categories = isset($resources->categories) ? $resources->categories : false;
101 105
 
102
-	if(!$itemsPerCategory) {
106
+	if(!$itemsPerCategory) {
103 107
 		return $_lang['no_results'];
104 108
 	}
105 109
 
@@ -112,10 +116,10 @@  discard block
 block discarded – undo
112 116
 
113 117
 	// Easily loop through $itemsPerCategory-Array
114 118
 	$panelGroup = '';
115
-	foreach($categories as $catid => $category) {
119
+	foreach($categories as $catid => $category) {
116 120
 		// Prepare collapse content / elements-list
117 121
 		$panelCollapse = '';
118
-		foreach($itemsPerCategory[$catid] as $el) {
122
+		foreach($itemsPerCategory[$catid] as $el) {
119 123
 			$resourceTable = $el['type'];
120 124
 			$ph = prepareElementRowPh($el, $resourceTable, $resources);
121 125
 			$panelCollapse .= parsePh($tpl['elementsRow'], $ph);
@@ -149,14 +153,15 @@  discard block
 block discarded – undo
149 153
  * @param mgrResources $resources
150 154
  * @return array
151 155
  */
152
-function prepareElementRowPh($row, $resourceTable, $resources) {
156
+function prepareElementRowPh($row, $resourceTable, $resources)
157
+{
153 158
 	$modx = evolutionCMS(); global $modx_textdir, $_style, $_lang;
154 159
 
155 160
 	$types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false;
156 161
 
157 162
 	$_lang["confirm_delete"] = $_lang["delete"];
158 163
 
159
-	switch($resourceTable){
164
+	switch($resourceTable) {
160 165
         case 'site_templates':
161 166
             $class = $row['selectable'] ? '' : 'disabledPlugin';
162 167
             $lockElementType = 1;
@@ -193,56 +198,56 @@  discard block
 block discarded – undo
193 198
 	// Prepare displaying user-locks
194 199
 	$lockedByUser = '';
195 200
 	$rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true);
196
-	if($rowLock && $modx->hasPermission('display_locks')) {
197
-		if($rowLock['sid'] == $modx->sid) {
201
+	if($rowLock && $modx->hasPermission('display_locks')) {
202
+		if($rowLock['sid'] == $modx->sid) {
198 203
 			$title = $modx->parseText($_lang["lock_element_editing"], array(
199 204
 				'element_type' => $_lang["lock_element_type_" . $lockElementType],
200 205
 				'lasthit_df' => $rowLock['lasthit_df']
201 206
 			));
202 207
 			$lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span>&nbsp;';
203
-		} else {
208
+		} else {
204 209
 			$title = $modx->parseText($_lang["lock_element_locked_by"], array(
205 210
 				'element_type' => $_lang["lock_element_type_" . $lockElementType],
206 211
 				'username' => $rowLock['username'],
207 212
 				'lasthit_df' => $rowLock['lasthit_df']
208 213
 			));
209
-			if($modx->hasPermission('remove_locks')) {
214
+			if($modx->hasPermission('remove_locks')) {
210 215
 				$lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
211
-			} else {
216
+			} else {
212 217
 				$lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>';
213 218
 			}
214 219
 		}
215 220
 	}
216
-	if($lockedByUser) {
221
+	if($lockedByUser) {
217 222
 		$lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>';
218 223
 	}
219 224
 
220 225
 	// Caption
221
-	if($resourceTable == 'site_tmplvars') {
226
+	if($resourceTable == 'site_tmplvars') {
222 227
 		$caption = !empty($row['description']) ? ' ' . $row['caption'] . ' &nbsp; <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
223
-	} else {
228
+	} else {
224 229
 		$caption = !empty($row['description']) ? ' ' . $row['description'] : '';
225 230
 	}
226 231
 
227 232
 	// Special marks
228 233
 	$tplInfo = array();
229
-	if($row['locked']) {
234
+	if($row['locked']) {
230 235
 		$tplInfo[] = $_lang['locked'];
231 236
 	}
232
-	if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
237
+	if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
233 238
 		$tplInfo[] = $_lang['defaulttemplate_title'];
234 239
 	}
235 240
 	$marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
236 241
 
237 242
 	/* row buttons */
238 243
 	$buttons = '';
239
-	if($modx->hasPermission($types['actions']['edit'][1])) {
244
+	if($modx->hasPermission($types['actions']['edit'][1])) {
240 245
 		$buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&amp;id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>';
241 246
 	}
242
-	if($modx->hasPermission($types['actions']['duplicate'][1])) {
247
+	if($modx->hasPermission($types['actions']['duplicate'][1])) {
243 248
 		$buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&amp;id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>';
244 249
 	}
245
-	if($modx->hasPermission($types['actions']['remove'][1])) {
250
+	if($modx->hasPermission($types['actions']['remove'][1])) {
246 251
 		$buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&amp;id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>';
247 252
 	}
248 253
 	$buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : '';
Please login to merge, or discard this patch.