Completed
Pull Request — develop (#716)
by Serg
06:34
created
manager/actions/welcome.static.php 1 patch
Braces   +48 added lines, -46 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;
@@ -33,46 +33,46 @@  discard block
 block discarded – undo
33 33
 
34 34
 $iconTpl = $managerTheme->getPartial('welcome/WrapIcon');
35 35
 // setup icons
36
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
37 37
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
38 38
 	$ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
39 39
 }
40
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
41 41
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
42 42
 	$ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
43 43
 }
44
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
45 45
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
46 46
 	$ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
47 47
 }
48
-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
+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')) {
49 49
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
50 50
 	$ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
51 51
 }
52
-if($modx->hasPermission('bk_manager')) {
52
+if($modx->hasPermission('bk_manager')) {
53 53
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
54 54
 	$ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
55 55
 }
56
-if($modx->hasPermission('help')) {
56
+if($modx->hasPermission('help')) {
57 57
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
58 58
 	$ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
59 59
 }
60 60
 
61
-if($modx->hasPermission('new_document')) {
61
+if($modx->hasPermission('new_document')) {
62 62
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
63 63
 	$ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
64 64
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
65 65
 	$ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
66 66
 }
67
-if($modx->hasPermission('assets_images')) {
67
+if($modx->hasPermission('assets_images')) {
68 68
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
69 69
 	$ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
70 70
 }
71
-if($modx->hasPermission('assets_files')) {
71
+if($modx->hasPermission('assets_files')) {
72 72
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
73 73
 	$ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
74 74
 }
75
-if($modx->hasPermission('change_password')) {
75
+if($modx->hasPermission('change_password')) {
76 76
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
77 77
 	$ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
78 78
 }
@@ -80,21 +80,21 @@  discard block
 block discarded – undo
80 80
 $ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8);
81 81
 
82 82
 // do some config checks
83
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84 84
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
85
-	if($config_check_results != $_lang['configcheck_ok']) {
85
+	if($config_check_results != $_lang['configcheck_ok']) {
86 86
 		$ph['config_check_results'] = $config_check_results;
87 87
 		$ph['config_display'] = 'block';
88
-	} else {
88
+	} else {
89 89
 		$ph['config_display'] = 'none';
90 90
 	}
91
-} else {
91
+} else {
92 92
 	$ph['config_display'] = 'none';
93 93
 }
94 94
 
95 95
 // Check logout-reminder
96
-if(isset($_SESSION['show_logout_reminder'])) {
97
-	switch($_SESSION['show_logout_reminder']['type']) {
96
+if(isset($_SESSION['show_logout_reminder'])) {
97
+	switch($_SESSION['show_logout_reminder']['type']) {
98 98
 		case 'logout_reminder':
99 99
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
100 100
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 	$ph['show_logout_reminder'] = 'block';
104 104
 	unset($_SESSION['show_logout_reminder']);
105
-} else {
105
+} else {
106 106
 	$ph['show_logout_reminder'] = 'none';
107 107
 }
108 108
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
165 165
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
166 166
 
167
-if($modx->db->getRecordCount($rs) < 1) {
167
+if($modx->db->getRecordCount($rs) < 1) {
168 168
 	$html = '<p>[%no_active_users_found%]</p>';
169
-} else {
169
+} else {
170 170
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
171 171
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
172 172
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	$userList = array();
193 193
 	$userCount = array();
194 194
 	// Create userlist with session-count first before output
195
-	while($activeusers = $modx->db->getRow($rs)) {
195
+	while($activeusers = $modx->db->getRow($rs)) {
196 196
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
197 197
 
198 198
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			$currentaction
211 211
 		);
212 212
 	}
213
-	foreach($userList as $params) {
213
+	foreach($userList as $params) {
214 214
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
215 215
 		$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);
216 216
 	}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
 // invoke event OnManagerWelcomePrerender
257 257
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
258
-if(is_array($evtOut)) {
258
+if(is_array($evtOut)) {
259 259
 	$output = implode('', $evtOut);
260 260
 	$ph['OnManagerWelcomePrerender'] = $output;
261 261
 }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
361 361
 	'hide'=>'0'
362 362
 );
363
-if ($modx->config['rss_url_news']) {
363
+if ($modx->config['rss_url_news']) {
364 364
     $widgets['news'] = array(
365 365
         'menuindex' => '40',
366 366
         'id' => 'news',
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         'hide'=>'0'
372 372
     );
373 373
 }
374
-if ($modx->config['rss_url_security']) {
374
+if ($modx->config['rss_url_security']) {
375 375
     $widgets['security'] = array(
376 376
         'menuindex' => '50',
377 377
         'id' => 'security',
@@ -385,29 +385,29 @@  discard block
 block discarded – undo
385 385
 
386 386
 // invoke OnManagerWelcomeHome event
387 387
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
388
-if(is_array($sitewidgets)) {
388
+if(is_array($sitewidgets)) {
389 389
 	$newwidgets = array();
390
-    foreach($sitewidgets as $widget){
390
+    foreach($sitewidgets as $widget) {
391 391
         $newwidgets = array_merge($newwidgets, unserialize($widget));
392 392
     }
393 393
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
394 394
 }
395 395
 
396
-usort($widgets, function ($a, $b) {
396
+usort($widgets, function ($a, $b){
397 397
 	return $a['menuindex'] - $b['menuindex'];
398 398
 });
399 399
 
400 400
 $tpl = $managerTheme->getPartial('welcome/Widget');
401 401
 $output = '';
402
-foreach($widgets as $widget) {
403
-	if ($widget['hide'] != '1'){
402
+foreach($widgets as $widget) {
403
+	if ($widget['hide'] != '1') {
404 404
 		$output .= $modx->parseText($tpl, $widget);
405 405
 	}
406 406
 }
407 407
 $ph['widgets'] = $output;
408 408
 
409 409
 // load template
410
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
411 411
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
412 412
 }
413 413
 
@@ -415,26 +415,28 @@  discard block
 block discarded – undo
415 415
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
416 416
 $target = $modx->mergeSettingsContent($target);
417 417
 
418
-if(substr($target, 0, 1) === '@') {
419
-	if(substr($target, 0, 6) === '@CHUNK') {
418
+if(substr($target, 0, 1) === '@') {
419
+	if(substr($target, 0, 6) === '@CHUNK') {
420 420
 		$content = $modx->getChunk(trim(substr($target, 7)));
421
-	} elseif(substr($target, 0, 5) === '@FILE') {
421
+	} elseif(substr($target, 0, 5) === '@FILE') {
422 422
 		$content = file_get_contents(trim(substr($target, 6)));
423
-	} else {
423
+	} else {
424 424
 		$content = '';
425 425
 	}
426
-} else {
426
+} else {
427 427
 	$chunk = $modx->getChunk($target);
428
-	if($chunk !== false && !empty($chunk)) {
428
+	if($chunk !== false && !empty($chunk)) {
429 429
 		$content = $chunk;
430
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
430
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
431 431
 		$content = file_get_contents(MODX_BASE_PATH . $target);
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
432
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
433 433
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
434
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
434
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
435
+	    // ClipperCMS compatible
435 436
 	{
436
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
437
-	} else {
437
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
438
+	}
439
+	} else {
438 440
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
439 441
 	}
440 442
 }
@@ -443,7 +445,7 @@  discard block
 block discarded – undo
443 445
 $content = $modx->mergeConditionalTagsContent($content);
444 446
 $content = $modx->mergeSettingsContent($content);
445 447
 $content = $modx->parseText($content, $ph);
446
-if(strpos($content, '[+') !== false) {
448
+if(strpos($content, '[+') !== false) {
447 449
 	$modx->toPlaceholders($ph);
448 450
 	$content = $modx->mergePlaceholderContent($content);
449 451
 }
@@ -452,7 +454,7 @@  discard block
 block discarded – undo
452 454
 $content = $modx->parseText($content, $_style, '[&', '&]');
453 455
 $content = $modx->cleanUpMODXTags($content); //cleanup
454 456
 
455
-if($js = $modx->getRegisteredClientScripts()) {
457
+if($js = $modx->getRegisteredClientScripts()) {
456 458
 	$content .= $js;
457 459
 }
458 460
 
Please login to merge, or discard this patch.
manager/actions/resources/functions.inc.php 1 patch
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@  discard block
 block discarded – undo
21 21
  * @param array $ph
22 22
  * @return string
23 23
  */
24
-function parsePh($tpl, $ph) {
24
+function parsePh($tpl, $ph)
25
+{
25 26
     $modx = evolutionCMS(); global $_lang;
26 27
     $tpl = $modx->parseText($tpl, $_lang, '[%', '%]');
27 28
     return $modx->parseText($tpl, $ph);
@@ -31,7 +32,8 @@  discard block
 block discarded – undo
31 32
  * @param string|int $cssId
32 33
  * @return string
33 34
  */
34
-function renderViewSwitchButtons($cssId) {
35
+function renderViewSwitchButtons($cssId)
36
+{
35 37
     $modx = evolutionCMS(); global $_lang, $tpl;
36 38
 
37 39
     return parsePh($tpl['viewForm'], array(
@@ -44,7 +46,8 @@  discard block
 block discarded – undo
44 46
  * @param mgrResources $resources
45 47
  * @return string
46 48
  */
47
-function createResourceList($resourceTable, $resources) {
49
+function createResourceList($resourceTable, $resources)
50
+{
48 51
     $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir, $tpl;
49 52
 
50 53
     $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false;
@@ -97,7 +100,8 @@  discard block
 block discarded – undo
97 100
  * @param mgrResources $resources
98 101
  * @return string
99 102
  */
100
-function createCombinedView($resources) {
103
+function createCombinedView($resources)
104
+{
101 105
     $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir;
102 106
 
103 107
     $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false;
@@ -154,14 +158,15 @@  discard block
 block discarded – undo
154 158
  * @param mgrResources $resources
155 159
  * @return array
156 160
  */
157
-function prepareElementRowPh($row, $resourceTable, $resources) {
161
+function prepareElementRowPh($row, $resourceTable, $resources)
162
+{
158 163
     $modx = evolutionCMS(); global $modx_textdir, $_style, $_lang;
159 164
 
160 165
     $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false;
161 166
 
162 167
     $_lang["confirm_delete"] = $_lang["delete"];
163 168
 
164
-    switch($resourceTable){
169
+    switch($resourceTable) {
165 170
         case 'site_templates':
166 171
             $class = $row['selectable'] ? '' : 'disabledPlugin';
167 172
             $lockElementType = 1;
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
@@ -6,4 +6,6 @@
 block discarded – undo
6 6
 /**
7 7
  * Don't delete
8 8
  */
9
-class mgrResources extends EvolutionCMS\Legacy\mgrResources{}
9
+class mgrResources extends EvolutionCMS\Legacy\mgrResources
10
+{
11
+}
Please login to merge, or discard this patch.
manager/includes/src/Interfaces/ManagerThemeInterface.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,5 @@
 block discarded – undo
1 1
 <?php namespace EvolutionCMS\Interfaces;
2 2
 
3
-interface ManagerThemeInterface{}
3
+interface ManagerThemeInterface
4
+{
5
+}
Please login to merge, or discard this patch.
manager/includes/functions/processors.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -403,10 +403,12 @@
 block discarded – undo
403 403
         $failedlogins += 1;
404 404
 
405 405
         $fields = array('failedlogincount' => $failedlogins);
406
-        if ($failedlogins >= $failed_allowed) //block user for too many fail attempts
406
+        if ($failedlogins >= $failed_allowed) {
407
+            //block user for too many fail attempts
407 408
         {
408 409
             $fields['blockeduntil'] = time() + ($blocked_minutes * 60);
409 410
         }
411
+        }
410 412
 
411 413
         $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
412 414
 
Please login to merge, or discard this patch.