Completed
Pull Request — develop (#716)
by Agel_Nash
09:56
created
manager/actions/mutate_categories.dynamic.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,16 +27,14 @@
 block discarded – undo
27 27
 $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager();
28 28
 
29 29
 // assign module_params to internal params
30
-foreach( $_module_params as $param => $value )
31
-{
30
+foreach( $_module_params as $param => $value ) {
32 31
 	$cm->set( $param, $value );
33 32
 }
34 33
 
35 34
 // catch the request actions
36 35
 include_once $cm->get('inc_dir') . 'request_trigger.inc.php';
37 36
 
38
-if( !$categories = $cm->getCategories() )
39
-{
37
+if( !$categories = $cm->getCategories() ) {
40 38
 	setcookie('webfxtab_manage-categories-pane', 0 );
41 39
 	$cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' );
42 40
 }
Please login to merge, or discard this patch.
manager/actions/resources/mgrResources.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,4 +3,6 @@
 block discarded – undo
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
 
6
-class mgrResources extends EvolutionCMS\Legacy\mgrResources{}
6
+class mgrResources extends EvolutionCMS\Legacy\mgrResources
7
+{
8
+}
Please login to merge, or discard this patch.
manager/actions/resources/functions.inc.php 1 patch
Braces   +37 added lines, -37 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
 
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 	'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl')
12 12
 );
13 13
 
14
-if(!function_exists('parsePh')) {
14
+if(!function_exists('parsePh')) {
15 15
     /**
16 16
      * @param string $tpl
17 17
      * @param array $ph
18 18
      * @return string
19 19
      */
20
-    function parsePh($tpl, $ph)
21
-    {
20
+    function parsePh($tpl, $ph)
21
+    {
22 22
         $modx = evolutionCMS();
23 23
         global $_lang;
24 24
         $tpl = $modx->parseText($tpl, $_lang, '[%', '%]');
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
     }
28 28
 }
29 29
 
30
-if(!function_exists('renderViewSwitchButtons')) {
30
+if(!function_exists('renderViewSwitchButtons')) {
31 31
     /**
32 32
      * @param string|int $cssId
33 33
      * @return string
34 34
      */
35
-    function renderViewSwitchButtons($cssId)
36
-    {
35
+    function renderViewSwitchButtons($cssId)
36
+    {
37 37
         $modx = evolutionCMS();
38 38
         global $_lang, $tpl;
39 39
 
@@ -43,27 +43,27 @@  discard block
 block discarded – undo
43 43
     }
44 44
 }
45 45
 
46
-if(!function_exists('createResourceList')) {
46
+if(!function_exists('createResourceList')) {
47 47
     /**
48 48
      * @param string $resourceTable
49 49
      * @param mgrResources $resources
50 50
      * @return string
51 51
      */
52
-    function createResourceList($resourceTable, $resources)
53
-    {
52
+    function createResourceList($resourceTable, $resources)
53
+    {
54 54
         $modx = evolutionCMS();
55 55
         global $_lang, $_style, $modx_textdir, $tpl;
56 56
 
57 57
         $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false;
58 58
 
59
-        if (!is_array($items) || empty($items)) {
59
+        if (!is_array($items) || empty($items)) {
60 60
             return $_lang['no_results'];
61 61
         }
62 62
 
63 63
         // Prepare elements- and categories-list
64 64
         $elements = array();
65 65
         $categories = array();
66
-        foreach ($items as $row) {
66
+        foreach ($items as $row) {
67 67
             $catid = $row['catid'] ? $row['catid'] : 0;
68 68
             $categories[$catid] = array('name' => stripslashes($row['category']));
69 69
             $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         // Now render categories / panel-collapse
73 73
         $panelGroup = '';
74
-        foreach ($elements as $catid => $elList) {
74
+        foreach ($elements as $catid => $elList) {
75 75
             // Add panel-heading / category-collapse to output
76 76
             $panelGroup .= parsePh($tpl['panelHeading'], array(
77 77
                 'tab'        => $resourceTable,
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
             // Prepare content for panel-collapse
84 84
             $panelCollapse = '';
85
-            foreach ($elList as $el) {
85
+            foreach ($elList as $el) {
86 86
                 $panelCollapse .= parsePh($tpl['elementsRow'], $el);
87 87
             }
88 88
 
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
     }
102 102
 }
103 103
 
104
-if(!function_exists('createCombinedView')) {
104
+if(!function_exists('createCombinedView')) {
105 105
     /**
106 106
      * @param mgrResources $resources
107 107
      * @return string
108 108
      */
109
-    function createCombinedView($resources)
110
-    {
109
+    function createCombinedView($resources)
110
+    {
111 111
         $modx = evolutionCMS();
112 112
         global $_lang, $_style, $modx_textdir;
113 113
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $types = isset($resources->types) ? $resources->types : false;
116 116
         $categories = isset($resources->categories) ? $resources->categories : false;
117 117
 
118
-        if (!$itemsPerCategory) {
118
+        if (!$itemsPerCategory) {
119 119
             return $_lang['no_results'];
120 120
         }
121 121
 
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 
129 129
         // Easily loop through $itemsPerCategory-Array
130 130
         $panelGroup = '';
131
-        foreach ($categories as $catid => $category) {
131
+        foreach ($categories as $catid => $category) {
132 132
             // Prepare collapse content / elements-list
133 133
             $panelCollapse = '';
134
-            foreach ($itemsPerCategory[$catid] as $el) {
134
+            foreach ($itemsPerCategory[$catid] as $el) {
135 135
                 $resourceTable = $el['type'];
136 136
                 $ph = prepareElementRowPh($el, $resourceTable, $resources);
137 137
                 $panelCollapse .= parsePh($tpl['elementsRow'], $ph);
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
     }
161 161
 }
162 162
 
163
-if(!function_exists('prepareElementRowPh')) {
163
+if(!function_exists('prepareElementRowPh')) {
164 164
     /**
165 165
      * @param array $row
166 166
      * @param string $resourceTable
167 167
      * @param mgrResources $resources
168 168
      * @return array
169 169
      */
170
-    function prepareElementRowPh($row, $resourceTable, $resources)
171
-    {
170
+    function prepareElementRowPh($row, $resourceTable, $resources)
171
+    {
172 172
         $modx = evolutionCMS();
173 173
         global $modx_textdir, $_style, $_lang;
174 174
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         $_lang["confirm_delete"] = $_lang["delete"];
178 178
 
179
-        switch ($resourceTable) {
179
+        switch ($resourceTable) {
180 180
             case 'site_templates':
181 181
                 $class = $row['selectable'] ? '' : 'disabledPlugin';
182 182
                 $lockElementType = 1;
@@ -213,56 +213,56 @@  discard block
 block discarded – undo
213 213
         // Prepare displaying user-locks
214 214
         $lockedByUser = '';
215 215
         $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true);
216
-        if ($rowLock && $modx->hasPermission('display_locks')) {
217
-            if ($rowLock['sid'] == $modx->sid) {
216
+        if ($rowLock && $modx->hasPermission('display_locks')) {
217
+            if ($rowLock['sid'] == $modx->sid) {
218 218
                 $title = $modx->parseText($_lang["lock_element_editing"], array(
219 219
                     'element_type' => $_lang["lock_element_type_" . $lockElementType],
220 220
                     'lasthit_df'   => $rowLock['lasthit_df']
221 221
                 ));
222 222
                 $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span>&nbsp;';
223
-            } else {
223
+            } else {
224 224
                 $title = $modx->parseText($_lang["lock_element_locked_by"], array(
225 225
                     'element_type' => $_lang["lock_element_type_" . $lockElementType],
226 226
                     'username'     => $rowLock['username'],
227 227
                     'lasthit_df'   => $rowLock['lasthit_df']
228 228
                 ));
229
-                if ($modx->hasPermission('remove_locks')) {
229
+                if ($modx->hasPermission('remove_locks')) {
230 230
                     $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>';
231
-                } else {
231
+                } else {
232 232
                     $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>';
233 233
                 }
234 234
             }
235 235
         }
236
-        if ($lockedByUser) {
236
+        if ($lockedByUser) {
237 237
             $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>';
238 238
         }
239 239
 
240 240
         // Caption
241
-        if ($resourceTable == 'site_tmplvars') {
241
+        if ($resourceTable == 'site_tmplvars') {
242 242
             $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' &nbsp; <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption'];
243
-        } else {
243
+        } else {
244 244
             $caption = !empty($row['description']) ? ' ' . $row['description'] : '';
245 245
         }
246 246
 
247 247
         // Special marks
248 248
         $tplInfo = array();
249
-        if ($row['locked']) {
249
+        if ($row['locked']) {
250 250
             $tplInfo[] = $_lang['locked'];
251 251
         }
252
-        if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
252
+        if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') {
253 253
             $tplInfo[] = $_lang['defaulttemplate_title'];
254 254
         }
255 255
         $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : '';
256 256
 
257 257
         /* row buttons */
258 258
         $buttons = '';
259
-        if ($modx->hasPermission($types['actions']['edit'][1])) {
259
+        if ($modx->hasPermission($types['actions']['edit'][1])) {
260 260
             $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>';
261 261
         }
262
-        if ($modx->hasPermission($types['actions']['duplicate'][1])) {
262
+        if ($modx->hasPermission($types['actions']['duplicate'][1])) {
263 263
             $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>';
264 264
         }
265
-        if ($modx->hasPermission($types['actions']['remove'][1])) {
265
+        if ($modx->hasPermission($types['actions']['remove'][1])) {
266 266
             $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>';
267 267
         }
268 268
         $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : '';
Please login to merge, or discard this patch.
manager/actions/bkmanager.static.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -491,7 +491,9 @@
 block discarded – undo
491 491
 /**
492 492
  * @deprecated use EvolutionCMS\Support\MysqlDumper
493 493
  */
494
-class Mysqldumper extends EvolutionCMS\Support\MysqlDumper{}
494
+class Mysqldumper extends EvolutionCMS\Support\MysqlDumper
495
+{
496
+}
495 497
 
496 498
 if(!function_exists('import_sql')) {
497 499
     /**
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Categories.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,6 @@
 block discarded – undo
4 4
  * Class to handle the modx-categories
5 5
  * @deprecated use EvolutionCMS\Legacy\Categories
6 6
  */
7
-class Categories extends EvolutionCMS\Legacy\Categories{}
7
+class Categories extends EvolutionCMS\Legacy\Categories
8
+{
9
+}
Please login to merge, or discard this patch.
manager/actions/mutate_module.dynamic.php 1 patch
Braces   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  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
-switch($modx->manager->action) {
5
+switch($modx->manager->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if(!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if(!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 $tbl_site_templates = $modx->getFullTableName('site_templates');
30 30
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
31 31
 
32
-if(!function_exists('createGUID')) {
32
+if(!function_exists('createGUID')) {
33 33
     /**
34 34
      * create globally unique identifiers (guid)
35 35
      *
36 36
      * @return string
37 37
      */
38
-    function createGUID()
39
-    {
38
+    function createGUID()
39
+    {
40 40
         srand((double)microtime() * 1000000);
41 41
         $r = rand();
42 42
         $u = uniqid(getmypid() . $r . (double)microtime() * 1000000, 1);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 // check to see the module editor isn't locked
50
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
50
+if($lockedEl = $modx->elementIsLocked(6, $id)) {
51 51
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
52 52
 }
53 53
 // end check for lock
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 // Lock snippet for other users to edit
56 56
 $modx->lockElement(6, $id);
57 57
 
58
-if(isset($_GET['id'])) {
58
+if(isset($_GET['id'])) {
59 59
 	$rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'");
60 60
 	$content = $modx->db->getRow($rs);
61
-	if(!$content) {
61
+	if(!$content) {
62 62
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
63 63
 	}
64 64
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
65 65
 	$_SESSION['itemname'] = $content['name'];
66
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
66
+	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
67 67
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
68 68
 	}
69
-} else {
69
+} else {
70 70
 	$_SESSION['itemname'] = $_lang["new_module"];
71 71
 	$content['wrap'] = '1';
72 72
 }
73
-if($modx->manager->hasFormValues()) {
73
+if($modx->manager->hasFormValues()) {
74 74
 	$modx->manager->loadFormValues();
75 75
 }
76 76
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	<?php
445 445
 	// invoke OnModFormPrerender event
446 446
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
447
-	if(is_array($evtOut)) {
447
+	if(is_array($evtOut)) {
448 448
 		echo implode('', $evtOut);
449 449
 	}
450 450
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 								<option>&nbsp;</option>
508 508
 								<?php
509 509
 								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
510
-								foreach(getCategories() as $n => $v) {
510
+								foreach(getCategories() as $n => $v) {
511 511
 									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n";
512 512
 								}
513 513
 								?>
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 					$rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'");
660 660
 					$groupsarray = $modx->db->getColumn('usergroup', $rs);
661 661
 
662
-					if($modx->hasPermission('access_permissions')) {
662
+					if($modx->hasPermission('access_permissions')) {
663 663
 						?>
664 664
 						<!-- User Group Access Permissions -->
665 665
 						<script type="text/javascript">
@@ -687,21 +687,21 @@  discard block
 block discarded – undo
687 687
 					}
688 688
 					$chk = '';
689 689
 					$rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name');
690
-					while($row = $modx->db->getRow($rs)) {
690
+					while($row = $modx->db->getRow($rs)) {
691 691
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
692 692
 						$checked = in_array($row['id'], $groupsarray);
693
-						if($modx->hasPermission('access_permissions')) {
694
-							if($checked) {
693
+						if($modx->hasPermission('access_permissions')) {
694
+							if($checked) {
695 695
 								$notPublic = true;
696 696
 							}
697 697
 							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
698
-						} else {
699
-							if($checked) {
698
+						} else {
699
+							if($checked) {
700 700
 								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
701 701
 							}
702 702
 						}
703 703
 					}
704
-					if($modx->hasPermission('access_permissions')) {
704
+					if($modx->hasPermission('access_permissions')) {
705 705
 						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
706 706
 					}
707 707
 					echo $chks;
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 		<?php
724 724
 		// invoke OnModFormRender event
725 725
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
726
-		if(is_array($evtOut)) {
726
+		if(is_array($evtOut)) {
727 727
 			echo implode('', $evtOut);
728 728
 		}
729 729
 		?>
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 1 patch
Braces   +87 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
19
+if($modx->hasPermission('messages')) {
20 20
 	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 
60
-if($modx->hasPermission('new_document')) {
60
+if($modx->hasPermission('new_document')) {
61 61
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62 62
 	$ph['ResourceIcon'] = wrapIcon($icon, 4);
63 63
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64 64
 	$ph['WeblinkIcon'] = wrapIcon($icon, 72);
65 65
 }
66
-if($modx->hasPermission('assets_images')) {
66
+if($modx->hasPermission('assets_images')) {
67 67
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68 68
 	$ph['ImagesIcon'] = wrapIcon($icon, 72);
69 69
 }
70
-if($modx->hasPermission('assets_files')) {
70
+if($modx->hasPermission('assets_files')) {
71 71
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72 72
 	$ph['FilesIcon'] = wrapIcon($icon, 72);
73 73
 }
74
-if($modx->hasPermission('change_password')) {
74
+if($modx->hasPermission('change_password')) {
75 75
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76 76
 	$ph['PasswordIcon'] = wrapIcon($icon, 28);
77 77
 }
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 $ph['LogoutIcon'] = wrapIcon($icon, 8);
80 80
 
81 81
 // do some config checks
82
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
82
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83 83
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
84
+	if($config_check_results != $_lang['configcheck_ok']) {
85 85
 		$ph['config_check_results'] = $config_check_results;
86 86
 		$ph['config_display'] = 'block';
87
-	} else {
87
+	} else {
88 88
 		$ph['config_display'] = 'none';
89 89
 	}
90
-} else {
90
+} else {
91 91
 	$ph['config_display'] = 'none';
92 92
 }
93 93
 
94 94
 // Check logout-reminder
95
-if(isset($_SESSION['show_logout_reminder'])) {
96
-	switch($_SESSION['show_logout_reminder']['type']) {
95
+if(isset($_SESSION['show_logout_reminder'])) {
96
+	switch($_SESSION['show_logout_reminder']['type']) {
97 97
 		case 'logout_reminder':
98 98
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99 99
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	$ph['show_logout_reminder'] = 'block';
103 103
 	unset($_SESSION['show_logout_reminder']);
104
-} else {
104
+} else {
105 105
 	$ph['show_logout_reminder'] = 'none';
106 106
 }
107 107
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
163 163
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
164 164
 
165
-if($modx->db->getRecordCount($rs) < 1) {
165
+if($modx->db->getRecordCount($rs) < 1) {
166 166
 	$html = '<p>[%no_active_users_found%]</p>';
167
-} else {
167
+} else {
168 168
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169 169
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170 170
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	$userList = array();
191 191
 	$userCount = array();
192 192
 	// Create userlist with session-count first before output
193
-	while($activeusers = $modx->db->getRow($rs)) {
193
+	while($activeusers = $modx->db->getRow($rs)) {
194 194
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195 195
 
196 196
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			$currentaction
209 209
 		);
210 210
 	}
211
-	foreach($userList as $params) {
211
+	foreach($userList as $params) {
212 212
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213 213
 		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214 214
 	}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 // invoke event OnManagerWelcomePrerender
255 255
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
256
-if(is_array($evtOut)) {
256
+if(is_array($evtOut)) {
257 257
 	$output = implode('', $evtOut);
258 258
 	$ph['OnManagerWelcomePrerender'] = $output;
259 259
 }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359 359
 	'hide'=>'0'
360 360
 );
361
-if ($modx->config['rss_url_news']) {
361
+if ($modx->config['rss_url_news']) {
362 362
     $widgets['news'] = array(
363 363
         'menuindex' => '40',
364 364
         'id' => 'news',
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         'hide'=>'0'
370 370
     );
371 371
 }
372
-if ($modx->config['rss_url_security']) {
372
+if ($modx->config['rss_url_security']) {
373 373
     $widgets['security'] = array(
374 374
         'menuindex' => '50',
375 375
         'id' => 'security',
@@ -383,29 +383,29 @@  discard block
 block discarded – undo
383 383
 
384 384
 // invoke OnManagerWelcomeHome event
385 385
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
386
-if(is_array($sitewidgets)) {
386
+if(is_array($sitewidgets)) {
387 387
 	$newwidgets = array();
388
-    foreach($sitewidgets as $widget){
388
+    foreach($sitewidgets as $widget) {
389 389
         $newwidgets = array_merge($newwidgets, unserialize($widget));
390 390
     }
391 391
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
392 392
 }
393 393
 
394
-usort($widgets, function ($a, $b) {
394
+usort($widgets, function ($a, $b){
395 395
 	return $a['menuindex'] - $b['menuindex'];
396 396
 });
397 397
 
398 398
 $tpl = getTplWidget();
399 399
 $output = '';
400
-foreach($widgets as $widget) {
401
-	if ($widget['hide'] != '1'){
400
+foreach($widgets as $widget) {
401
+	if ($widget['hide'] != '1') {
402 402
 		$output .= $modx->parseText($tpl, $widget);
403 403
 	}
404 404
 }
405 405
 $ph['widgets'] = $output;
406 406
 
407 407
 // load template
408
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
408
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409 409
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
410 410
 }
411 411
 
@@ -413,26 +413,28 @@  discard block
 block discarded – undo
413 413
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
414 414
 $target = $modx->mergeSettingsContent($target);
415 415
 
416
-if(substr($target, 0, 1) === '@') {
417
-	if(substr($target, 0, 6) === '@CHUNK') {
416
+if(substr($target, 0, 1) === '@') {
417
+	if(substr($target, 0, 6) === '@CHUNK') {
418 418
 		$content = $modx->getChunk(trim(substr($target, 7)));
419
-	} elseif(substr($target, 0, 5) === '@FILE') {
419
+	} elseif(substr($target, 0, 5) === '@FILE') {
420 420
 		$content = file_get_contents(trim(substr($target, 6)));
421
-	} else {
421
+	} else {
422 422
 		$content = '';
423 423
 	}
424
-} else {
424
+} else {
425 425
 	$chunk = $modx->getChunk($target);
426
-	if($chunk !== false && !empty($chunk)) {
426
+	if($chunk !== false && !empty($chunk)) {
427 427
 		$content = $chunk;
428
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
428
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
429 429
 		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
430
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431 431
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
432
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
433
+	    // ClipperCMS compatible
433 434
 	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
-	} else {
435
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
+	}
437
+	} else {
436 438
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437 439
 	}
438 440
 }
@@ -441,7 +443,7 @@  discard block
 block discarded – undo
441 443
 $content = $modx->mergeConditionalTagsContent($content);
442 444
 $content = $modx->mergeSettingsContent($content);
443 445
 $content = $modx->parseText($content, $ph);
444
-if(strpos($content, '[+') !== false) {
446
+if(strpos($content, '[+') !== false) {
445 447
 	$modx->toPlaceholders($ph);
446 448
 	$content = $modx->mergePlaceholderContent($content);
447 449
 }
@@ -450,7 +452,7 @@  discard block
 block discarded – undo
450 452
 $content = $modx->parseText($content, $_style, '[&', '&]');
451 453
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 454
 
453
-if($js = $modx->getRegisteredClientScripts()) {
455
+if($js = $modx->getRegisteredClientScripts()) {
454 456
 	$content .= $js;
455 457
 }
456 458
 
@@ -460,9 +462,10 @@  discard block
 block discarded – undo
460 462
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
461 463
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 464
 //</span>
463
-if(!function_exists('getTplWidget')) {
464
-    function getTplWidget()
465
-    { // recent document info
465
+if(!function_exists('getTplWidget')) {
466
+    function getTplWidget()
467
+    {
468
+// recent document info
466 469
         return '
467 470
 		<div class="[+cols+]" id="[+id+]">
468 471
 			<div class="card"[+cardAttr+]>
@@ -474,9 +477,10 @@  discard block
 block discarded – undo
474 477
     }
475 478
 }
476 479
 
477
-if(!function_exists('getRecentInfo')) {
478
-    function getRecentInfo()
479
-    { // recent document info
480
+if(!function_exists('getRecentInfo')) {
481
+    function getRecentInfo()
482
+    {
483
+// recent document info
480 484
         $modx = evolutionCMS();
481 485
 
482 486
         $modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -504,14 +508,14 @@  discard block
 block discarded – undo
504 508
     }
505 509
 }
506 510
 
507
-if(!function_exists('getRecentInfoList')) {
508
-    function getRecentInfoList()
509
-    {
511
+if(!function_exists('getRecentInfoList')) {
512
+    function getRecentInfoList()
513
+    {
510 514
         $modx = evolutionCMS();
511 515
 
512 516
         $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
513 517
 
514
-        if ($modx->db->getRecordCount($rs) < 1) {
518
+        if ($modx->db->getRecordCount($rs) < 1) {
515 519
             return '<tr><td>[%no_activity_message%]</td></tr>';
516 520
         }
517 521
 
@@ -521,22 +525,22 @@  discard block
 block discarded – undo
521 525
         $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
522 526
 
523 527
         $output = array();
524
-        while ($ph = $modx->db->getRow($rs)) {
528
+        while ($ph = $modx->db->getRow($rs)) {
525 529
             $docid = $ph['id'];
526 530
             $_ = $modx->getUserInfo($ph['editedby']);
527 531
             $ph['username'] = $_['username'];
528 532
 
529
-            if ($ph['deleted'] == 1) {
533
+            if ($ph['deleted'] == 1) {
530 534
                 $ph['status'] = 'deleted text-danger';
531
-            } elseif ($ph['published'] == 0) {
535
+            } elseif ($ph['published'] == 0) {
532 536
                 $ph['status'] = 'unpublished font-italic text-muted';
533
-            } else {
537
+            } else {
534 538
                 $ph['status'] = 'published';
535 539
             }
536 540
 
537
-            if ($modx->hasPermission('edit_document')) {
541
+            if ($modx->hasPermission('edit_document')) {
538 542
                 $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
539
-            } else {
543
+            } else {
540 544
                 $ph['edit_btn'] = '';
541 545
             }
542 546
 
@@ -549,24 +553,24 @@  discard block
 block discarded – undo
549 553
                 $preview_disabled
550 554
             ), $btntpl['preview_btn']);
551 555
 
552
-            if ($modx->hasPermission('delete_document')) {
553
-                if ($ph['deleted'] == 0) {
556
+            if ($modx->hasPermission('delete_document')) {
557
+                if ($ph['deleted'] == 0) {
554 558
                     $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
555
-                } else {
559
+                } else {
556 560
                     $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
557 561
                 }
558 562
                 $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
559
-            } else {
563
+            } else {
560 564
                 $ph['delete_btn'] = '';
561 565
             }
562 566
 
563
-            if ($ph['deleted'] == 1 && $ph['published'] == 0) {
567
+            if ($ph['deleted'] == 1 && $ph['published'] == 0) {
564 568
                 $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
565
-            } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
569
+            } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
566 570
                 $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
567
-            } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
571
+            } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
568 572
                 $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
569
-            } else {
573
+            } else {
570 574
                 $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
571 575
             }
572 576
             $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
@@ -574,16 +578,16 @@  discard block
 block discarded – undo
574 578
             $ph['info_btn'] = str_replace('[+id+]', $docid,
575 579
                 '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
576 580
 
577
-            if ($ph['longtitle'] == '') {
581
+            if ($ph['longtitle'] == '') {
578 582
                 $ph['longtitle'] = '(<i>[%not_set%]</i>)';
579 583
             }
580
-            if ($ph['description'] == '') {
584
+            if ($ph['description'] == '') {
581 585
                 $ph['description'] = '(<i>[%not_set%]</i>)';
582 586
             }
583
-            if ($ph['introtext'] == '') {
587
+            if ($ph['introtext'] == '') {
584 588
                 $ph['introtext'] = '(<i>[%not_set%]</i>)';
585 589
             }
586
-            if ($ph['alias'] == '') {
590
+            if ($ph['alias'] == '') {
587 591
                 $ph['alias'] = '(<i>[%not_set%]</i>)';
588 592
             }
589 593
 
@@ -594,9 +598,9 @@  discard block
 block discarded – undo
594 598
     }
595 599
 }
596 600
 
597
-if(!function_exists('getRecentInfoRowTpl')) {
598
-    function getRecentInfoRowTpl()
599
-    {
601
+if(!function_exists('getRecentInfoRowTpl')) {
602
+    function getRecentInfoRowTpl()
603
+    {
600 604
         $tpl = '
601 605
 						<tr>
602 606
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -626,18 +630,18 @@  discard block
 block discarded – undo
626 630
     }
627 631
 }
628 632
 
629
-if(!function_exists('wrapIcon')) {
633
+if(!function_exists('wrapIcon')) {
630 634
 // setup icons
631
-    function wrapIcon($i, $action)
632
-    {
635
+    function wrapIcon($i, $action)
636
+    {
633 637
         return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>',
634 638
             $action, $i);
635 639
     }
636 640
 }
637 641
 
638
-if(!function_exists('getStartUpScript')) {
639
-    function getStartUpScript()
640
-    {
642
+if(!function_exists('getStartUpScript')) {
643
+    function getStartUpScript()
644
+    {
641 645
         $script = '
642 646
         <script type="text/javascript">
643 647
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
manager/actions/logging.static.php 1 patch
Braces   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@  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
-if (!$modx->hasPermission('logs')) {
5
+if (!$modx->hasPermission('logs')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-if(!function_exists('array_unique_multi')) {
9
+if(!function_exists('array_unique_multi')) {
10 10
     /**
11 11
      * @param array $array
12 12
      * @param string $checkKey
13 13
      * @return array
14 14
      */
15
-    function array_unique_multi($array, $checkKey)
16
-    {
15
+    function array_unique_multi($array, $checkKey)
16
+    {
17 17
         // Use the builtin if we're not a multi-dimensional array
18
-        if (!is_array(current($array)) || empty($checkKey)) {
18
+        if (!is_array(current($array)) || empty($checkKey)) {
19 19
             return array_unique($array);
20 20
         }
21 21
 
22 22
         $ret = array();
23 23
         $checkValues = array(); // contains the unique key Values
24
-        foreach ($array as $key => $current) {
25
-            if (in_array($current[$checkKey], $checkValues)) {
24
+        foreach ($array as $key => $current) {
25
+            if (in_array($current[$checkKey], $checkValues)) {
26 26
                 continue;
27 27
             } // duplicate
28 28
 
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
     }
35 35
 }
36 36
 
37
-if(!function_exists('record_sort')) {
37
+if(!function_exists('record_sort')) {
38 38
     /**
39 39
      * @param array $array
40 40
      * @param string $key
41 41
      * @return array
42 42
      */
43
-    function record_sort($array, $key)
44
-    {
43
+    function record_sort($array, $key)
44
+    {
45 45
         $hash = array();
46
-        foreach ($array as $k => $v) {
46
+        foreach ($array as $k => $v) {
47 47
             $hash[$k] = $v[$key];
48 48
         }
49 49
 
50 50
         natsort($hash);
51 51
 
52 52
         $records = array();
53
-        foreach ($hash as $k => $row) {
53
+        foreach ($hash as $k => $row) {
54 54
             $records[$k] = $array[$k];
55 55
         }
56 56
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                             <?php
79 79
                             // get all users currently in the log
80 80
                             $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username');
81
-                            foreach ($logs_user as $row) {
81
+                            foreach ($logs_user as $row) {
82 82
                                 $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : '';
83 83
                                 echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n";
84 84
                             }
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
                             // get all available actions in the log
96 96
                             include_once "actionlist.inc.php";
97 97
                             $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action');
98
-                            foreach ($logs_actions as $row) {
98
+                            foreach ($logs_actions as $row) {
99 99
                                 $action = getAction($row['action']);
100
-                                if ($action == 'Idle') {
100
+                                if ($action == 'Idle') {
101 101
                                     continue;
102 102
                                 }
103 103
                                 $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : '';
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                             <?php
116 116
                             // get all itemid currently in logging
117 117
                             $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid');
118
-                            foreach ($logs_items as $row) {
118
+                            foreach ($logs_items as $row) {
119 119
                                 $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : '';
120 120
                                 echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n";
121 121
                             }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                             <?php
132 132
                             // get all itemname currently in logging
133 133
                             $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname');
134
-                            foreach ($logs_names as $row) {
134
+                            foreach ($logs_names as $row) {
135 135
                                 $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : '';
136 136
                                 echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n";
137 137
                             }
@@ -187,36 +187,36 @@  discard block
 block discarded – undo
187 187
     <div class="container container-body">
188 188
 
189 189
 <?php
190
-if (isset($_REQUEST['log_submit'])) {
190
+if (isset($_REQUEST['log_submit'])) {
191 191
     // get the selections the user made.
192 192
     $sqladd = array();
193
-    if ($_REQUEST['searchuser'] != 0) {
193
+    if ($_REQUEST['searchuser'] != 0) {
194 194
         $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'";
195 195
     }
196
-    if ($_REQUEST['action'] != 0) {
196
+    if ($_REQUEST['action'] != 0) {
197 197
         $sqladd[] = "action=" . (int)$_REQUEST['action'];
198 198
     }
199
-    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
199
+    if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") {
200 200
         $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'";
201 201
     }
202
-    if ($_REQUEST['itemname'] != '0') {
202
+    if ($_REQUEST['itemname'] != '0') {
203 203
         $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'";
204 204
     }
205
-    if ($_REQUEST['message'] != "") {
205
+    if ($_REQUEST['message'] != "") {
206 206
         $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'";
207 207
     }
208 208
     // date stuff
209
-    if ($_REQUEST['datefrom'] != "") {
209
+    if ($_REQUEST['datefrom'] != "") {
210 210
         $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']);
211 211
     }
212
-    if ($_REQUEST['dateto'] != "") {
212
+    if ($_REQUEST['dateto'] != "") {
213 213
         $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']);
214 214
     }
215 215
 
216 216
     // If current position is not set, set it to zero
217
-    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
217
+    if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
218 218
         $int_cur_position = 0;
219
-    } else {
219
+    } else {
220 220
         $int_cur_position = $_REQUEST['int_cur_position'];
221 221
     }
222 222
 
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 
231 231
     $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}");
232 232
 
233
-if ($limit < 1) {
233
+if ($limit < 1) {
234 234
     echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>';
235
-} else {
235
+} else {
236 236
     echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>';
237 237
 
238 238
     // New instance of the Paging class, you can modify the color and the width of the html table
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
     $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " ");
251 251
     $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " ");
252 252
     $pagesfound = sizeof($array_row_paging);
253
-    if ($pagesfound > 6) {
253
+    if ($pagesfound > 6) {
254 254
         $paging .= $array_row_paging[$current_row - 2]; // ."&nbsp;";
255 255
         $paging .= $array_row_paging[$current_row - 1]; // ."&nbsp;";
256 256
         $paging .= $array_row_paging[$current_row]; // ."&nbsp;";
257 257
         $paging .= $array_row_paging[$current_row + 1]; // ."&nbsp;";
258 258
         $paging .= $array_row_paging[$current_row + 2]; // ."&nbsp;";
259
-    } else {
260
-        for ($i = 0; $i < $pagesfound; $i++) {
259
+    } else {
260
+        for ($i = 0; $i < $pagesfound; $i++) {
261 261
             $paging .= $array_row_paging[$i] . "&nbsp;";
262 262
         }
263 263
     }
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
                 // grab the entire log file...
295 295
                 $logentries = array();
296 296
                 $i = 0;
297
-                while ($logentry = $modx->db->getRow($rs)) {
298
-                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
297
+                while ($logentry = $modx->db->getRow($rs)) {
298
+                    if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) {
299 299
                         $item = '<div style="text-align:center;">-</div>';
300
-                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
300
+                    } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) {
301 301
                         $item = '<a href="index.php?a=3&amp;id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>';
302
-                    } else {
302
+                    } else {
303 303
                         $item = $logentry['itemname'];
304 304
                     }
305 305
                     //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true'
@@ -336,6 +336,6 @@  discard block
 block discarded – undo
336 336
     // @see index.php @ 915
337 337
     global $action;
338 338
     $action = 1;
339
-} else {
339
+} else {
340 340
     echo $_lang["mgrlog_noquery"];
341 341
 }
Please login to merge, or discard this patch.
manager/actions/mutate_settings/functions.inc.php 1 patch
Braces   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('get_lang_keys')) {
2
+if(!function_exists('get_lang_keys')) {
3 3
     /**
4 4
      * get_lang_keys
5 5
      *
6 6
      * @param string $filename
7 7
      * @return array of keys from a language file
8 8
      */
9
-    function get_lang_keys($filename)
10
-    {
9
+    function get_lang_keys($filename)
10
+    {
11 11
         $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename;
12
-        if (is_file($file) && is_readable($file)) {
12
+        if (is_file($file) && is_readable($file)) {
13 13
             include($file);
14 14
             $out = isset($_lang) ? array_keys($_lang) : array();
15
-        } else {
15
+        } else {
16 16
             $out = array();
17 17
         }
18 18
 
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
     }
21 21
 }
22 22
 
23
-if(!function_exists('get_langs_by_key')) {
23
+if(!function_exists('get_langs_by_key')) {
24 24
     /**
25 25
      * get_langs_by_key
26 26
      *
27 27
      * @param string $key
28 28
      * @return array of languages that define the key in their file
29 29
      */
30
-    function get_langs_by_key($key)
31
-    {
30
+    function get_langs_by_key($key)
31
+    {
32 32
         global $lang_keys;
33 33
         $lang_return = array();
34
-        foreach ($lang_keys as $lang => $keys) {
35
-            if (in_array($key, $keys)) {
34
+        foreach ($lang_keys as $lang => $keys) {
35
+            if (in_array($key, $keys)) {
36 36
                 $lang_return[] = $lang;
37 37
             }
38 38
         }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-if(!function_exists('get_lang_options')) {
44
+if(!function_exists('get_lang_options')) {
45 45
     /**
46 46
      * get_lang_options
47 47
      *
@@ -51,25 +51,25 @@  discard block
 block discarded – undo
51 51
      * @param string $selected_lang specify language to select in option list, default none
52 52
      * @return string html option list
53 53
      */
54
-    function get_lang_options($key = '', $selected_lang = '')
55
-    {
54
+    function get_lang_options($key = '', $selected_lang = '')
55
+    {
56 56
         global $lang_keys, $_lang;
57 57
         $lang_options = '';
58
-        if (!empty($key)) {
58
+        if (!empty($key)) {
59 59
             $languages = get_langs_by_key($key);
60 60
             sort($languages);
61 61
             $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>';
62 62
 
63
-            foreach ($languages as $language_name) {
63
+            foreach ($languages as $language_name) {
64 64
                 $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
65 65
                 $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>';
66 66
             }
67 67
 
68 68
             return $lang_options;
69
-        } else {
69
+        } else {
70 70
             $languages = array_keys($lang_keys);
71 71
             sort($languages);
72
-            foreach ($languages as $language_name) {
72
+            foreach ($languages as $language_name) {
73 73
                 $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
74 74
                 $sel = $language_name === $selected_lang ? ' selected="selected"' : '';
75 75
                 $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>';
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     }
81 81
 }
82 82
 
83
-if(!function_exists('form_radio')) {
83
+if(!function_exists('form_radio')) {
84 84
     /**
85 85
      * @param string $name
86 86
      * @param string $value
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
      * @param bool $disabled
89 89
      * @return string
90 90
      */
91
-    function form_radio($name, $value, $add = '', $disabled = false)
92
-    {
91
+    function form_radio($name, $value, $add = '', $disabled = false)
92
+    {
93 93
         global ${$name};
94 94
         $var = ${$name};
95 95
         $checked = ($var == $value) ? ' checked="checked"' : '';
96
-        if ($disabled) {
96
+        if ($disabled) {
97 97
             $disabled = ' disabled';
98
-        } else {
98
+        } else {
99 99
             $disabled = '';
100 100
         }
101
-        if ($add) {
101
+        if ($add) {
102 102
             $add = ' ' . $add;
103 103
         }
104 104
 
@@ -108,31 +108,31 @@  discard block
 block discarded – undo
108 108
     }
109 109
 }
110 110
 
111
-if(!function_exists('wrap_label')) {
111
+if(!function_exists('wrap_label')) {
112 112
     /**
113 113
      * @param string $str
114 114
      * @param string $object
115 115
      * @return string
116 116
      */
117
-    function wrap_label($str = '', $object)
118
-    {
117
+    function wrap_label($str = '', $object)
118
+    {
119 119
         return "<label>{$object}\n{$str}</label>";
120 120
     }
121 121
 }
122 122
 
123
-if(!function_exists('parseText')) {
123
+if(!function_exists('parseText')) {
124 124
     /**
125 125
      * @param string $tpl
126 126
      * @param array $ph
127 127
      * @return string
128 128
      */
129
-    function parseText($tpl = '', $ph = array())
130
-    {
131
-        if (empty($ph) || empty($tpl)) {
129
+    function parseText($tpl = '', $ph = array())
130
+    {
131
+        if (empty($ph) || empty($tpl)) {
132 132
             return $tpl;
133 133
         }
134 134
 
135
-        foreach ($ph as $k => $v) {
135
+        foreach ($ph as $k => $v) {
136 136
             $k = "[+{$k}+]";
137 137
             $tpl = str_replace($k, $v, $tpl);
138 138
         }
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
     }
142 142
 }
143 143
 
144
-if(!function_exists('showHide')) {
144
+if(!function_exists('showHide')) {
145 145
     /**
146 146
      * @param bool $cond
147 147
      * @return string
148 148
      */
149
-    function showHide($cond = true)
150
-    {
149
+    function showHide($cond = true)
150
+    {
151 151
         global $displayStyle;
152 152
         $showHide = $cond ? $displayStyle : 'none';
153 153
 
Please login to merge, or discard this patch.