Completed
Pull Request — develop (#522)
by Agel_Nash
07:16
created
manager/actions/welcome.static.php 1 patch
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
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 8
 if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9
-	// seems to be a new install - send the user to the configuration page
10
-	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
9
+    // seems to be a new install - send the user to the configuration page
10
+    exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
12 12
 
13 13
 // set placeholders
@@ -17,70 +17,70 @@  discard block
 block discarded – undo
17 17
 
18 18
 // setup message info
19 19
 if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
-	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
-	$_SESSION['nrnewmessages'] = $nrnewmessages;
23
-
24
-	$msg = array();
25
-	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
-	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
-	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
-	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
-	$ph['MessageInfo'] = join("\n", $msg);
20
+    include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
+    $_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
+    $_SESSION['nrnewmessages'] = $nrnewmessages;
23
+
24
+    $msg = array();
25
+    $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
+    $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
+    $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
+    $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
+    $ph['MessageInfo'] = join("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35 35
 if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
-	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
-	$ph['SecurityIcon'] = wrapIcon($icon, 75);
36
+    $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
+    $ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39 39
 if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
-	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
-	$ph['WebUserIcon'] = wrapIcon($icon, 99);
40
+    $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
+    $ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43 43
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
-	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
-	$ph['ModulesIcon'] = wrapIcon($icon, 106);
44
+    $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
+    $ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47 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
-	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
-	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
48
+    $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
+    $ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51 51
 if($modx->hasPermission('bk_manager')) {
52
-	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
-	$ph['BackupIcon'] = wrapIcon($icon, 93);
52
+    $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
+    $ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55 55
 if($modx->hasPermission('help')) {
56
-	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
-	$ph['HelpIcon'] = wrapIcon($icon, 9);
56
+    $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
+    $ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60 60
 if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
63
-		$ph['config_check_results'] = $config_check_results;
64
-		$ph['config_display'] = 'block';
65
-	} else {
66
-		$ph['config_display'] = 'none';
67
-	}
61
+    include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
+    if($config_check_results != $_lang['configcheck_ok']) {
63
+        $ph['config_check_results'] = $config_check_results;
64
+        $ph['config_display'] = 'block';
65
+    } else {
66
+        $ph['config_display'] = 'none';
67
+    }
68 68
 } else {
69
-	$ph['config_display'] = 'none';
69
+    $ph['config_display'] = 'none';
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73 73
 if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
75
-		case 'logout_reminder':
76
-			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77
-			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
78
-			break;
79
-	}
80
-	$ph['show_logout_reminder'] = 'block';
81
-	unset($_SESSION['show_logout_reminder']);
74
+    switch($_SESSION['show_logout_reminder']['type']) {
75
+        case 'logout_reminder':
76
+            $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77
+            $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
78
+            break;
79
+    }
80
+    $ph['show_logout_reminder'] = 'block';
81
+    unset($_SESSION['show_logout_reminder']);
82 82
 } else {
83
-	$ph['show_logout_reminder'] = 'none';
83
+    $ph['show_logout_reminder'] = 'none';
84 84
 }
85 85
 
86 86
 // Check multiple sessions
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
129 129
 
130 130
 $ph['UserInfo'] = $modx->parseText($tpl, array(
131
-	'username' => $modx->getLoginUserName(),
132
-	'role' => $_SESSION['mgrPermissions']['name'],
133
-	'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
134
-	'logincount' => $_SESSION['mgrLogincount'] + 1,
135
-	'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
131
+    'username' => $modx->getLoginUserName(),
132
+    'role' => $_SESSION['mgrPermissions']['name'],
133
+    'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
134
+    'logincount' => $_SESSION['mgrLogincount'] + 1,
135
+    'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
136 136
 ));
137 137
 
138 138
 $from = array();
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143 143
 if($modx->db->getRecordCount($rs) < 1) {
144
-	$html = '<p>[%no_active_users_found%]</p>';
144
+    $html = '<p>[%no_active_users_found%]</p>';
145 145
 } else {
146
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147
-	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148
-	$ph['now'] = strftime('%H:%M:%S', $now);
149
-	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
150
-	$html = '
146
+    include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147
+    $now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148
+    $ph['now'] = strftime('%H:%M:%S', $now);
149
+    $timetocheck = ($now - (60 * 20)); //+$server_offset_time;
150
+    $html = '
151 151
 	<div class="card-body">
152 152
 		[%onlineusers_message%] 
153 153
 		<b>[+now+]</b>):
@@ -165,33 +165,33 @@  discard block
 block discarded – undo
165 165
 	</thead>
166 166
 	<tbody>';
167 167
 
168
-	$userList = array();
169
-	$userCount = array();
170
-	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
172
-		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173
-
174
-		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
175
-		$webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
176
-		$ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
177
-		$currentaction = getAction($activeusers['action'], $activeusers['id']);
178
-		$userList[] = array(
179
-			$idle,
180
-			'',
181
-			$activeusers['username'],
182
-			$webicon,
183
-			abs($activeusers['internalKey']),
184
-			$ip,
185
-			strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
186
-			$currentaction
187
-		);
188
-	}
189
-	foreach($userList as $params) {
190
-		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
-		$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);
192
-	}
193
-
194
-	$html .= '
168
+    $userList = array();
169
+    $userCount = array();
170
+    // Create userlist with session-count first before output
171
+    while($activeusers = $modx->db->getRow($rs)) {
172
+        $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173
+
174
+        $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
175
+        $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
176
+        $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
177
+        $currentaction = getAction($activeusers['action'], $activeusers['id']);
178
+        $userList[] = array(
179
+            $idle,
180
+            '',
181
+            $activeusers['username'],
182
+            $webicon,
183
+            abs($activeusers['internalKey']),
184
+            $ip,
185
+            strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
186
+            $currentaction
187
+        );
188
+    }
189
+    foreach($userList as $params) {
190
+        $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
+        $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);
192
+    }
193
+
194
+    $html .= '
195 195
 	</tbody>
196 196
 	</table>
197 197
 </div>
@@ -232,17 +232,17 @@  discard block
 block discarded – undo
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234 234
 if(is_array($evtOut)) {
235
-	$output = implode('', $evtOut);
236
-	$ph['OnManagerWelcomePrerender'] = $output;
235
+    $output = implode('', $evtOut);
236
+    $ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
238 238
 
239 239
 $widgets['welcome'] = array(
240
-	'menuindex' => '10',
241
-	'id' => 'welcome',
242
-	'cols' => 'col-sm-6',
243
-	'icon' => 'fa-home',
244
-	'title' => '[%welcome_title%]',
245
-	'body' => '
240
+    'menuindex' => '10',
241
+    'id' => 'welcome',
242
+    'cols' => 'col-sm-6',
243
+    'icon' => 'fa-home',
244
+    'title' => '[%welcome_title%]',
245
+    'body' => '
246 246
 				<div class="wm_buttons card-body"> 
247 247
 					<!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> 
248 248
 					<span class="wm_button">
@@ -320,25 +320,25 @@  discard block
 block discarded – undo
320 320
 					</table>
321 321
 				</div>
322 322
 		',
323
-	'hide'=>'0'
323
+    'hide'=>'0'
324 324
 );
325 325
 $widgets['onlineinfo'] = array(
326
-	'menuindex' => '20',
327
-	'id' => 'onlineinfo',
328
-	'cols' => 'col-sm-6',
329
-	'icon' => 'fa-user',
330
-	'title' => '[%onlineusers_title%]',
331
-	'body' => '<div class="userstable">[+OnlineInfo+]</div>',
332
-	'hide'=>'0'
326
+    'menuindex' => '20',
327
+    'id' => 'onlineinfo',
328
+    'cols' => 'col-sm-6',
329
+    'icon' => 'fa-user',
330
+    'title' => '[%onlineusers_title%]',
331
+    'body' => '<div class="userstable">[+OnlineInfo+]</div>',
332
+    'hide'=>'0'
333 333
 );
334 334
 $widgets['recentinfo'] = array(
335
-	'menuindex' => '30',
336
-	'id' => 'modxrecent_widget',
337
-	'cols' => 'col-sm-12',
338
-	'icon' => 'fa-pencil-square-o',
339
-	'title' => '[%activity_title%]',
340
-	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341
-	'hide'=>'0'
335
+    'menuindex' => '30',
336
+    'id' => 'modxrecent_widget',
337
+    'cols' => 'col-sm-12',
338
+    'icon' => 'fa-pencil-square-o',
339
+    'title' => '[%activity_title%]',
340
+    'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341
+    'hide'=>'0'
342 342
 );
343 343
 if ($modx->config['rss_url_news']) {
344 344
     $widgets['news'] = array(
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368 368
 if(is_array($sitewidgets)) {
369
-	$newwidgets = array();
369
+    $newwidgets = array();
370 370
     foreach($sitewidgets as $widget){
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
@@ -374,21 +374,21 @@  discard block
 block discarded – undo
374 374
 }
375 375
 
376 376
 usort($widgets, function ($a, $b) {
377
-	return $a['menuindex'] - $b['menuindex'];
377
+    return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382 382
 foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
384
-		$output .= $modx->parseText($tpl, $widget);
385
-	}
383
+    if ($widget['hide'] != '1'){
384
+        $output .= $modx->parseText($tpl, $widget);
385
+    }
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390 390
 if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
391
+    $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
392 392
 }
393 393
 
394 394
 $target = $modx->config['manager_welcome_tpl'];
@@ -396,27 +396,27 @@  discard block
 block discarded – undo
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398 398
 if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
400
-		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
402
-		$content = file_get_contents(trim(substr($target, 6)));
403
-	} else {
404
-		$content = '';
405
-	}
399
+    if(substr($target, 0, 6) === '@CHUNK') {
400
+        $content = $modx->getChunk(trim(substr($target, 7)));
401
+    } elseif(substr($target, 0, 5) === '@FILE') {
402
+        $content = file_get_contents(trim(substr($target, 6)));
403
+    } else {
404
+        $content = '';
405
+    }
406 406
 } else {
407
-	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
409
-		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
411
-		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
415
-	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
-	} else {
418
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419
-	}
407
+    $chunk = $modx->getChunk($target);
408
+    if($chunk !== false && !empty($chunk)) {
409
+        $content = $chunk;
410
+    } elseif(is_file(MODX_BASE_PATH . $target)) {
411
+        $content = file_get_contents(MODX_BASE_PATH . $target);
412
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
415
+    {
416
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
+    } else {
418
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419
+    }
420 420
 }
421 421
 
422 422
 // merge placeholders
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 $content = $modx->mergeSettingsContent($content);
425 425
 $content = $modx->parseText($content, $ph);
426 426
 if(strpos($content, '[+') !== false) {
427
-	$modx->toPlaceholders($ph);
428
-	$content = $modx->mergePlaceholderContent($content);
427
+    $modx->toPlaceholders($ph);
428
+    $content = $modx->mergePlaceholderContent($content);
429 429
 }
430 430
 $content = $modx->parseDocumentSource($content);
431 431
 $content = $modx->parseText($content, $_lang, '[%', '%]');
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 434
 
435 435
 if($js = $modx->getRegisteredClientScripts()) {
436
-	$content .= $js;
436
+    $content .= $js;
437 437
 }
438 438
 
439 439
 echo $content;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 444
 //</span>
445 445
 function getTplWidget() { // recent document info
446
-	return '
446
+    return '
447 447
 		<div class="[+cols+]" id="[+id+]">
448 448
 			<div class="card"[+cardAttr+]>
449 449
 				<div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div>
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 }
455 455
 
456 456
 function getRecentInfo() { // recent document info
457
-	global $modx;
457
+    global $modx;
458 458
 
459
-	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
459
+    $modx->addSnippet('recentInfoList', 'getRecentInfoList');
460 460
 
461
-	$html = '
461
+    $html = '
462 462
 			<div class="table-responsive">
463 463
 				<table class="table data">
464 464
 					<thead>
@@ -476,96 +476,96 @@  discard block
 block discarded – undo
476 476
 				</table>
477 477
 			</div>
478 478
 ';
479
-	return $html;
479
+    return $html;
480 480
 }
481 481
 
482 482
 function getRecentInfoList() {
483
-	global $modx;
484
-
485
-	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486
-
487
-	if($modx->db->getRecordCount($rs) < 1) {
488
-		return '<tr><td>[%no_activity_message%]</td></tr>';
489
-	}
490
-
491
-	$tpl = getRecentInfoRowTpl();
492
-
493
-	$btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
494
-	$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> ';
495
-
496
-	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
498
-		$docid = $ph['id'];
499
-		$_ = $modx->getUserInfo($ph['editedby']);
500
-		$ph['username'] = $_['username'];
501
-
502
-		if($ph['deleted'] == 1) {
503
-			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
505
-			$ph['status'] = 'unpublished font-italic text-muted';
506
-		} else {
507
-			$ph['status'] = 'published';
508
-		}
509
-
510
-		if($modx->hasPermission('edit_document')) {
511
-			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
-		} else {
513
-			$ph['edit_btn'] = '';
514
-		}
515
-
516
-		$preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
517
-		$ph['preview_btn'] = str_replace(array(
518
-			'[+id+]',
519
-			'[+preview_disabled+]'
520
-		), array(
521
-			$docid,
522
-			$preview_disabled
523
-		), $btntpl['preview_btn']);
524
-
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
527
-				$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> ';
528
-			} else {
529
-				$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> ';
530
-			}
531
-			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
-		} else {
533
-			$ph['delete_btn'] = '';
534
-		}
535
-
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
537
-			$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> ';
538
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539
-			$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> ';
540
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541
-			$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> ';
542
-		} else {
543
-			$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> ';
544
-		}
545
-		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546
-
547
-		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548
-
549
-		if($ph['longtitle'] == '') {
550
-			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551
-		}
552
-		if($ph['description'] == '') {
553
-			$ph['description'] = '(<i>[%not_set%]</i>)';
554
-		}
555
-		if($ph['introtext'] == '') {
556
-			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557
-		}
558
-		if($ph['alias'] == '') {
559
-			$ph['alias'] = '(<i>[%not_set%]</i>)';
560
-		}
561
-
562
-		$output[] = $modx->parseText($tpl, $ph);
563
-	}
564
-	return join("\n", $output);
483
+    global $modx;
484
+
485
+    $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486
+
487
+    if($modx->db->getRecordCount($rs) < 1) {
488
+        return '<tr><td>[%no_activity_message%]</td></tr>';
489
+    }
490
+
491
+    $tpl = getRecentInfoRowTpl();
492
+
493
+    $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
494
+    $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> ';
495
+
496
+    $output = array();
497
+    while($ph = $modx->db->getRow($rs)) {
498
+        $docid = $ph['id'];
499
+        $_ = $modx->getUserInfo($ph['editedby']);
500
+        $ph['username'] = $_['username'];
501
+
502
+        if($ph['deleted'] == 1) {
503
+            $ph['status'] = 'deleted text-danger';
504
+        } elseif($ph['published'] == 0) {
505
+            $ph['status'] = 'unpublished font-italic text-muted';
506
+        } else {
507
+            $ph['status'] = 'published';
508
+        }
509
+
510
+        if($modx->hasPermission('edit_document')) {
511
+            $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
+        } else {
513
+            $ph['edit_btn'] = '';
514
+        }
515
+
516
+        $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
517
+        $ph['preview_btn'] = str_replace(array(
518
+            '[+id+]',
519
+            '[+preview_disabled+]'
520
+        ), array(
521
+            $docid,
522
+            $preview_disabled
523
+        ), $btntpl['preview_btn']);
524
+
525
+        if($modx->hasPermission('delete_document')) {
526
+            if($ph['deleted'] == 0) {
527
+                $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> ';
528
+            } else {
529
+                $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> ';
530
+            }
531
+            $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
+        } else {
533
+            $ph['delete_btn'] = '';
534
+        }
535
+
536
+        if($ph['deleted'] == 1 && $ph['published'] == 0) {
537
+            $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> ';
538
+        } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539
+            $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> ';
540
+        } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541
+            $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> ';
542
+        } else {
543
+            $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> ';
544
+        }
545
+        $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546
+
547
+        $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548
+
549
+        if($ph['longtitle'] == '') {
550
+            $ph['longtitle'] = '(<i>[%not_set%]</i>)';
551
+        }
552
+        if($ph['description'] == '') {
553
+            $ph['description'] = '(<i>[%not_set%]</i>)';
554
+        }
555
+        if($ph['introtext'] == '') {
556
+            $ph['introtext'] = '(<i>[%not_set%]</i>)';
557
+        }
558
+        if($ph['alias'] == '') {
559
+            $ph['alias'] = '(<i>[%not_set%]</i>)';
560
+        }
561
+
562
+        $output[] = $modx->parseText($tpl, $ph);
563
+    }
564
+    return join("\n", $output);
565 565
 }
566 566
 
567 567
 function getRecentInfoRowTpl() {
568
-	$tpl = '
568
+    $tpl = '
569 569
 						<tr>
570 570
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
571 571
 							<td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&amp;id=[+id+]" target="main">[+pagetitle+]</a></td>
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 								</div>
590 590
 							</td>
591 591
 						</tr>';
592
-	return $tpl;
592
+    return $tpl;
593 593
 }
594 594
 
595 595
 // setup icons
596 596
 function wrapIcon($i, $action) {
597
-	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
597
+    return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 598
 }
599 599
 
600 600
 function getStartUpScript() {
601
-	$script = '
601
+    $script = '
602 602
         <script type="text/javascript">
603 603
         function hideConfigCheckWarning(key) {
604 604
         	var xhr = new XMLHttpRequest();
@@ -622,5 +622,5 @@  discard block
 block discarded – undo
622 622
 		})(jQuery);        
623 623
         </script>
624 624
 ';
625
-	return $script;
625
+    return $script;
626 626
 }
Please login to merge, or discard this patch.
manager/actions/mutate_web_user.dynamic.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
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
 switch($modx->manager->action) {
7
-	case 88:
8
-		if(!$modx->hasPermission('edit_web_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 87:
13
-		if(!$modx->hasPermission('new_web_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 88:
8
+        if(!$modx->hasPermission('edit_web_user')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 87:
13
+        if(!$modx->hasPermission('new_web_user')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
@@ -24,64 +24,64 @@  discard block
 block discarded – undo
24 24
 // check to see the snippet editor isn't locked
25 25
 $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
26 26
 if($username = $modx->db->getValue($rs)) {
27
-	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user"));
27
+    $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user"));
28 28
 }
29 29
 // end check for lock
30 30
 
31 31
 if($modx->manager->action == '88') {
32
-	// get user attributes
33
-	$rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
34
-	$userdata = $modx->db->getRow($rs);
35
-	if(!$userdata) {
36
-		$modx->webAlertAndQuit("No user returned!");
37
-	}
38
-
39
-	// get user settings
40
-	$rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
41
-	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
-	extract($usersettings, EXTR_OVERWRITE);
44
-
45
-	// get user name
46
-	$rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
47
-	$usernamedata = $modx->db->getRow($rs);
48
-	if(!$usernamedata) {
49
-		$modx->webAlertAndQuit("No user returned while getting username!");
50
-	}
51
-	$_SESSION['itemname'] = $usernamedata['username'];
32
+    // get user attributes
33
+    $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
34
+    $userdata = $modx->db->getRow($rs);
35
+    if(!$userdata) {
36
+        $modx->webAlertAndQuit("No user returned!");
37
+    }
38
+
39
+    // get user settings
40
+    $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'");
41
+    $usersettings = array();
42
+    while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
+    extract($usersettings, EXTR_OVERWRITE);
44
+
45
+    // get user name
46
+    $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
47
+    $usernamedata = $modx->db->getRow($rs);
48
+    if(!$usernamedata) {
49
+        $modx->webAlertAndQuit("No user returned while getting username!");
50
+    }
51
+    $_SESSION['itemname'] = $usernamedata['username'];
52 52
 } else {
53
-	$userdata = array();
54
-	$usersettings = array();
55
-	$usernamedata = array();
56
-	$_SESSION['itemname'] = $_lang["new_web_user"];
53
+    $userdata = array();
54
+    $usersettings = array();
55
+    $usernamedata = array();
56
+    $_SESSION['itemname'] = $_lang["new_web_user"];
57 57
 }
58 58
 
59 59
 // avoid doubling htmlspecialchars (already encoded in DB)
60 60
 foreach($userdata as $key => $val) {
61
-	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
61
+    $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
62 62
 };
63 63
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
64 64
 
65 65
 // restore saved form
66 66
 $formRestored = false;
67 67
 if($modx->manager->hasFormValues()) {
68
-	$modx->manager->loadFormValues();
69
-	// restore post values
70
-	$userdata = array_merge($userdata, $_POST);
71
-	$userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
72
-	$usernamedata['username'] = $userdata['newusername'];
73
-	$usernamedata['oldusername'] = $_POST['oldusername'];
74
-	$usersettings = array_merge($usersettings, $userdata);
75
-	$usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
76
-	extract($usersettings, EXTR_OVERWRITE);
68
+    $modx->manager->loadFormValues();
69
+    // restore post values
70
+    $userdata = array_merge($userdata, $_POST);
71
+    $userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
72
+    $usernamedata['username'] = $userdata['newusername'];
73
+    $usernamedata['oldusername'] = $_POST['oldusername'];
74
+    $usersettings = array_merge($usersettings, $userdata);
75
+    $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
76
+    extract($usersettings, EXTR_OVERWRITE);
77 77
 }
78 78
 
79 79
 // include the country list language file
80 80
 $_country_lang = array();
81 81
 if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
82
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
82
+    include_once "lang/country/" . $manager_language . "_country.inc.php";
83 83
 } else {
84
-	include_once "lang/country/english_country.inc.php";
84
+    include_once "lang/country/english_country.inc.php";
85 85
 }
86 86
 asort($_country_lang);
87 87
 
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 
190 190
 <form action="index.php?a=89" method="post" name="userform">
191 191
 	<?php
192
-	// invoke OnWUsrFormPrerender event
193
-	$evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
194
-	if(is_array($evtOut)) {
195
-		echo implode("", $evtOut);
196
-	}
197
-	?>
192
+    // invoke OnWUsrFormPrerender event
193
+    $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
194
+    if(is_array($evtOut)) {
195
+        echo implode("", $evtOut);
196
+    }
197
+    ?>
198 198
 	<input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>" />
199 199
 	<input type="hidden" name="id" value="<?php echo $user ?>" />
200 200
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
325 325
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
326 326
 								<?php
327
-								foreach($_country_lang as $key => $country) {
328
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
329
-								}
330
-								?>
327
+                                foreach($_country_lang as $key => $country) {
328
+                                    echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
329
+                                }
330
+                                ?>
331 331
 							</select></td>
332 332
 					</tr>
333 333
 					<tr>
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
 								<i onClick="document.userform.blockedafter.value=''; return true;" class="clearDate <?php echo $_style["actions_calendar_delete"] ?>" data-tooltip="<?php echo $_lang['remove_date']; ?>"></i></td>
388 388
 						</tr>
389 389
 						<?php
390
-					}
391
-					?>
390
+                    }
391
+                    ?>
392 392
 				</table>
393 393
 			</div>
394 394
 
@@ -496,40 +496,40 @@  discard block
 block discarded – undo
496 496
 				</table>
497 497
 			</div>
498 498
 			<?php
499
-			if($use_udperms == 1) {
500
-
501
-			$groupsarray = array();
502
-
503
-			if($modx->manager->action == '88') { // only do this bit if the user is being edited
504
-				$rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
505
-				$groupsarray = $modx->db->getColumn('webgroup', $rs);
506
-			}
507
-			// retain selected user groups between post
508
-			if(is_array($_POST['user_groups'])) {
509
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
510
-			}
511
-			?>
499
+            if($use_udperms == 1) {
500
+
501
+            $groupsarray = array();
502
+
503
+            if($modx->manager->action == '88') { // only do this bit if the user is being edited
504
+                $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
505
+                $groupsarray = $modx->db->getColumn('webgroup', $rs);
506
+            }
507
+            // retain selected user groups between post
508
+            if(is_array($_POST['user_groups'])) {
509
+                foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
510
+            }
511
+            ?>
512 512
 			<div class="tab-page" id="tabPermissions">
513 513
 				<h2 class="tab"><?php echo $_lang['web_access_permissions'] ?></h2>
514 514
 				<script type="text/javascript">tpUser.addTabPage(document.getElementById("tabPermissions"));</script>
515 515
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
516 516
 				<?php
517
-				$rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
518
-				while($row = $modx->db->getRow($rs)) {
519
-					echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />';
520
-				}
521
-				}
522
-				?>
517
+                $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
518
+                while($row = $modx->db->getRow($rs)) {
519
+                    echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />';
520
+                }
521
+                }
522
+                ?>
523 523
 			</div>
524 524
 			<?php
525
-			// invoke OnWUsrFormRender event
526
-			$evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
527
-				"id" => $user
528
-			));
529
-			if(is_array($evtOut)) {
530
-				echo implode("", $evtOut);
531
-			}
532
-			?>
525
+            // invoke OnWUsrFormRender event
526
+            $evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
527
+                "id" => $user
528
+            ));
529
+            if(is_array($evtOut)) {
530
+                echo implode("", $evtOut);
531
+            }
532
+            ?>
533 533
 		</div>
534 534
 	</div>
535 535
 	<input type="submit" name="save" style="display:none">
Please login to merge, or discard this patch.
manager/actions/mutate_module_resources.dynamic.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
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
 if(!$modx->hasPermission('edit_module')) {
7
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 }
9 9
 
10 10
 $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
@@ -26,91 +26,91 @@  discard block
 block discarded – undo
26 26
 // check to see the  editor isn't locked
27 27
 $rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'");
28 28
 if($username = $modx->db->getValue($rs)) {
29
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
29
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
30 30
 }
31 31
 // end check for lock
32 32
 
33 33
 // take action
34 34
 switch($_REQUEST['op']) {
35
-	case 'add':
36
-		// convert ids to numbers
37
-		$opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38
-
39
-		if(count($opids) > 0) {
40
-			// 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41
-			$rt = strtolower($_REQUEST["rt"]);
42
-			if($rt == 'chunk') {
43
-				$type = 10;
44
-			}
45
-			if($rt == 'doc') {
46
-				$type = 20;
47
-			}
48
-			if($rt == 'plug') {
49
-				$type = 30;
50
-			}
51
-			if($rt == 'snip') {
52
-				$type = 40;
53
-			}
54
-			if($rt == 'tpl') {
55
-				$type = 50;
56
-			}
57
-			if($rt == 'tv') {
58
-				$type = 60;
59
-			}
60
-			$modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
-			foreach($opids as $opid) {
62
-				$modx->db->insert(array(
63
-					'module' => $id,
64
-					'resource' => $opid,
65
-					'type' => $type,
66
-				), $tbl_site_module_depobj);
67
-			}
68
-		}
69
-		break;
70
-	case 'del':
71
-		// convert ids to numbers
72
-		$opids = array_filter(array_map('intval', $_REQUEST['depid']));
73
-
74
-		// get resources that needs to be removed
75
-		$ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
76
-		// loop through resources and look for plugins and snippets
77
-		$plids = array();
78
-		$snid = array();
79
-		while($row = $modx->db->getRow($ds)) {
80
-			if($row['type'] == '30') {
81
-				$plids[$i] = $row['resource'];
82
-			}
83
-			if($row['type'] == '40') {
84
-				$snids[$i] = $row['resource'];
85
-			}
86
-		}
87
-		// get guid
88
-		$ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'");
89
-		$guid = $modx->db->getValue($ds);
90
-		// reset moduleguid for deleted resources
91
-		if(($cp = count($plids)) || ($cs = count($snids))) {
92
-			if($cp) {
93
-				$modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
94
-			}
95
-			if($cs) {
96
-				$modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
97
-			}
98
-			// reset cache
99
-			$modx->clearCache('full');
100
-		}
101
-		$modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
102
-		break;
35
+    case 'add':
36
+        // convert ids to numbers
37
+        $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38
+
39
+        if(count($opids) > 0) {
40
+            // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41
+            $rt = strtolower($_REQUEST["rt"]);
42
+            if($rt == 'chunk') {
43
+                $type = 10;
44
+            }
45
+            if($rt == 'doc') {
46
+                $type = 20;
47
+            }
48
+            if($rt == 'plug') {
49
+                $type = 30;
50
+            }
51
+            if($rt == 'snip') {
52
+                $type = 40;
53
+            }
54
+            if($rt == 'tpl') {
55
+                $type = 50;
56
+            }
57
+            if($rt == 'tv') {
58
+                $type = 60;
59
+            }
60
+            $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
+            foreach($opids as $opid) {
62
+                $modx->db->insert(array(
63
+                    'module' => $id,
64
+                    'resource' => $opid,
65
+                    'type' => $type,
66
+                ), $tbl_site_module_depobj);
67
+            }
68
+        }
69
+        break;
70
+    case 'del':
71
+        // convert ids to numbers
72
+        $opids = array_filter(array_map('intval', $_REQUEST['depid']));
73
+
74
+        // get resources that needs to be removed
75
+        $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
76
+        // loop through resources and look for plugins and snippets
77
+        $plids = array();
78
+        $snid = array();
79
+        while($row = $modx->db->getRow($ds)) {
80
+            if($row['type'] == '30') {
81
+                $plids[$i] = $row['resource'];
82
+            }
83
+            if($row['type'] == '40') {
84
+                $snids[$i] = $row['resource'];
85
+            }
86
+        }
87
+        // get guid
88
+        $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'");
89
+        $guid = $modx->db->getValue($ds);
90
+        // reset moduleguid for deleted resources
91
+        if(($cp = count($plids)) || ($cs = count($snids))) {
92
+            if($cp) {
93
+                $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
94
+            }
95
+            if($cs) {
96
+                $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
97
+            }
98
+            // reset cache
99
+            $modx->clearCache('full');
100
+        }
101
+        $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
102
+        break;
103 103
 }
104 104
 
105 105
 // load record
106 106
 $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'");
107 107
 $content = $modx->db->getRow($rs);
108 108
 if(!$content) {
109
-	$modx->webAlertAndQuit("Module not found for id '{$id}'.");
109
+    $modx->webAlertAndQuit("Module not found for id '{$id}'.");
110 110
 }
111 111
 $_SESSION['itemname'] = $content['name'];
112 112
 if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
113
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
113
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
114 114
 }
115 115
 
116 116
 ?>
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 				<tr>
204 204
 					<td valign="top" align="left">
205 205
 						<?php
206
-						$ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name,
206
+                        $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name,
207 207
 				CASE smd.type
208 208
 					WHEN 10 THEN 'Chunk'
209 209
 					WHEN 20 THEN 'Document'
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 					LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40'
219 219
 					LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50'
220 220
 					LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name");
221
-						include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
222
-						$grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
223
-						$grd->noRecordMsg = $_lang["no_records_found"];
224
-						$grd->cssClass = "grid";
225
-						$grd->columnHeaderClass = "gridHeader";
226
-						$grd->itemClass = "gridItem";
227
-						$grd->altItemClass = "gridAltItem";
228
-						$grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
229
-						$grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
230
-						$grd->fields = "name,type";
231
-						echo $grd->render();
232
-						?>
221
+                        include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
222
+                        $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
223
+                        $grd->noRecordMsg = $_lang["no_records_found"];
224
+                        $grd->cssClass = "grid";
225
+                        $grd->columnHeaderClass = "gridHeader";
226
+                        $grd->itemClass = "gridItem";
227
+                        $grd->altItemClass = "gridAltItem";
228
+                        $grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
229
+                        $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
230
+                        $grd->fields = "name,type";
231
+                        echo $grd->render();
232
+                        ?>
233 233
 					</td>
234 234
 					<td valign="top" style="width: 150px;">
235 235
 						<a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a>
Please login to merge, or discard this patch.
manager/actions/mutate_user.dynamic.php 1 patch
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
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
 switch($modx->manager->action) {
7
-	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 12:
8
+        if(!$modx->hasPermission('edit_user')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 11:
13
+        if(!$modx->hasPermission('new_user')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
@@ -23,75 +23,75 @@  discard block
 block discarded – undo
23 23
 // check to see the snippet editor isn't locked
24 24
 $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25 25
 if($username = $modx->db->getValue($rs)) {
26
-	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
26
+    $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30 30
 if($modx->manager->action == '12') {
31
-	// get user attribute
32
-	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
-	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
35
-		$modx->webAlertAndQuit("No user returned!");
36
-	}
37
-
38
-
39
-	// get user settings
40
-	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41
-	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
-	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
46
-			${$k} = $v;
47
-		}
48
-	}
49
-
50
-	// get user name
51
-	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52
-	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
54
-		$modx->webAlertAndQuit("No user returned while getting username!");
55
-	}
56
-	$_SESSION['itemname'] = $usernamedata['username'];
31
+    // get user attribute
32
+    $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
+    $userdata = $modx->db->getRow($rs);
34
+    if(!$userdata) {
35
+        $modx->webAlertAndQuit("No user returned!");
36
+    }
37
+
38
+
39
+    // get user settings
40
+    $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41
+    $usersettings = array();
42
+    while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
+    // manually extract so that user display settings are not overwritten
44
+    foreach($usersettings as $k => $v) {
45
+        if($k != 'manager_language' && $k != 'manager_theme') {
46
+            ${$k} = $v;
47
+        }
48
+    }
49
+
50
+    // get user name
51
+    $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52
+    $usernamedata = $modx->db->getRow($rs);
53
+    if(!$usernamedata) {
54
+        $modx->webAlertAndQuit("No user returned while getting username!");
55
+    }
56
+    $_SESSION['itemname'] = $usernamedata['username'];
57 57
 } else {
58
-	$userdata = array();
59
-	$usersettings = array();
60
-	$usernamedata = array();
61
-	$_SESSION['itemname'] = $_lang["new_user"];
58
+    $userdata = array();
59
+    $usersettings = array();
60
+    $usernamedata = array();
61
+    $_SESSION['itemname'] = $_lang["new_user"];
62 62
 }
63 63
 
64 64
 // avoid doubling htmlspecialchars (already encoded in DB)
65 65
 foreach($userdata as $key => $val) {
66
-	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
66
+    $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 67
 };
68 68
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 69
 
70 70
 // restore saved form
71 71
 $formRestored = false;
72 72
 if($modx->manager->hasFormValues()) {
73
-	$modx->manager->loadFormValues();
74
-	// restore post values
75
-	$userdata = array_merge($userdata, $_POST);
76
-	$userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
77
-	$usernamedata['username'] = $userdata['newusername'];
78
-	$usernamedata['oldusername'] = $_POST['oldusername'];
79
-	$usersettings = array_merge($usersettings, $userdata);
80
-	$usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
81
-	extract($usersettings, EXTR_OVERWRITE);
73
+    $modx->manager->loadFormValues();
74
+    // restore post values
75
+    $userdata = array_merge($userdata, $_POST);
76
+    $userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
77
+    $usernamedata['username'] = $userdata['newusername'];
78
+    $usernamedata['oldusername'] = $_POST['oldusername'];
79
+    $usersettings = array_merge($usersettings, $userdata);
80
+    $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
81
+    extract($usersettings, EXTR_OVERWRITE);
82 82
 }
83 83
 
84 84
 // include the country list language file
85 85
 $_country_lang = array();
86 86
 include_once "lang/country/english_country.inc.php";
87 87
 if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
88
+    include_once "lang/country/" . $manager_language . "_country.inc.php";
89 89
 }
90 90
 asort($_country_lang);
91 91
 
92 92
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93 93
 if($which_browser == 'default') {
94
-	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
94
+    $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 95
 }
96 96
 ?>
97 97
 <script type="text/javascript">
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 <form action="index.php?a=32" method="post" name="userform">
202 202
 	<?php
203 203
 
204
-	// invoke OnUserFormPrerender event
205
-	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206
-		"id" => $user
207
-	));
208
-	if(is_array($evtOut)) {
209
-		echo implode("", $evtOut);
210
-	}
211
-	?>
204
+    // invoke OnUserFormPrerender event
205
+    $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206
+        "id" => $user
207
+    ));
208
+    if(is_array($evtOut)) {
209
+        echo implode("", $evtOut);
210
+    }
211
+    ?>
212 212
 	<input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>">
213 213
 	<input type="hidden" name="id" value="<?php echo $user ?>">
214 214
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
@@ -301,21 +301,21 @@  discard block
 block discarded – undo
301 301
 						<td>&nbsp;</td>
302 302
 						<td><?php
303 303
 
304
-							$rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
305
-							?>
304
+                            $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
305
+                            ?>
306 306
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 307
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
310
-										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311
-									} else {
312
-										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
313
-									}
314
-									?>
308
+                                while($row = $modx->db->getRow($rs)) {
309
+                                    if($modx->manager->action == '11') {
310
+                                        $selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311
+                                    } else {
312
+                                        $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
313
+                                    }
314
+                                    ?>
315 315
 									<option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option>
316 316
 									<?php
317
-								}
318
-								?>
317
+                                }
318
+                                ?>
319 319
 							</select></td>
320 320
 					</tr>
321 321
 					<tr>
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 361
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 362
 								<?php
363
-								foreach($_country_lang as $key => $country) {
364
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
365
-								}
366
-								?>
363
+                                foreach($_country_lang as $key => $country) {
364
+                                    echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
365
+                                }
366
+                                ?>
367 367
 							</select></td>
368 368
 					</tr>
369 369
 					<tr>
@@ -439,21 +439,21 @@  discard block
 block discarded – undo
439 439
 						<td><select name="manager_language" class="inputBox" onChange="documentDirty=true">
440 440
 								<option value=""></option>
441 441
 								<?php
442
-								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443
-								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
446
-										$endpos = strpos($file, ".");
447
-										$languagename = substr($file, 0, $endpos);
448
-										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
449
-										?>
442
+                                $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443
+                                $dir = dir("includes/lang");
444
+                                while($file = $dir->read()) {
445
+                                    if(strpos($file, ".inc.php") > 0) {
446
+                                        $endpos = strpos($file, ".");
447
+                                        $languagename = substr($file, 0, $endpos);
448
+                                        $selectedtext = $languagename == $activelang ? "selected='selected'" : "";
449
+                                        ?>
450 450
 										<option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option>
451 451
 										<?php
452 452
 
453
-									}
454
-								}
455
-								$dir->close();
456
-								?>
453
+                                    }
454
+                                }
455
+                                $dir->close();
456
+                                ?>
457 457
 							</select></td>
458 458
 					</tr>
459 459
 					<tr>
@@ -528,22 +528,22 @@  discard block
 block discarded – undo
528 528
 						<td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());">
529 529
 								<option value=""></option>
530 530
 								<?php
531
-								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534
-										$themename = $file;
535
-										if($themename === 'common') {
536
-											continue;
537
-										}
538
-										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540
-											$attr .= 'selected="selected" ';
541
-										}
542
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
543
-									}
544
-								}
545
-								$dir->close();
546
-								?>
531
+                                $dir = dir("media/style/");
532
+                                while($file = $dir->read()) {
533
+                                    if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534
+                                        $themename = $file;
535
+                                        if($themename === 'common') {
536
+                                            continue;
537
+                                        }
538
+                                        $attr = 'value="' . $themename . '" ';
539
+                                        if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540
+                                            $attr .= 'selected="selected" ';
541
+                                        }
542
+                                        echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
543
+                                    }
544
+                                }
545
+                                $dir->close();
546
+                                ?>
547 547
 							</select>
548 548
 							<input type="hidden" name="theme_refresher" value=""></td>
549 549
 					</tr>
@@ -555,15 +555,15 @@  discard block
 block discarded – undo
555 555
 						<th><?php echo $_lang["which_browser_title"] ?></th>
556 556
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
557 557
 								<?php
558
-								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
559
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
560
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
561
-									$dir = str_replace('\\', '/', $dir);
562
-									$browser_name = substr($dir, strrpos($dir, '/') + 1);
563
-									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
564
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
565
-								}
566
-								?>
558
+                                $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
559
+                                echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
560
+                                foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
561
+                                    $dir = str_replace('\\', '/', $dir);
562
+                                    $browser_name = substr($dir, strrpos($dir, '/') + 1);
563
+                                    $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
564
+                                    echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
565
+                                }
566
+                                ?>
567 567
 							</select></td>
568 568
 					</tr>
569 569
 					<tr>
@@ -640,17 +640,17 @@  discard block
 block discarded – undo
640 640
 								<option value=""></option>
641 641
 								<?php
642 642
 
643
-								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
644
-								// invoke OnRichTextEditorRegister event
645
-								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
646
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
647
-								if(is_array($evtOut)) {
648
-									for($i = 0; $i < count($evtOut); $i++) {
649
-										$editor = $evtOut[$i];
650
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
651
-									}
652
-								}
653
-								?>
643
+                                $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
644
+                                // invoke OnRichTextEditorRegister event
645
+                                $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
646
+                                echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
647
+                                if(is_array($evtOut)) {
648
+                                    for($i = 0; $i < count($evtOut); $i++) {
649
+                                        $editor = $evtOut[$i];
650
+                                        echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
651
+                                    }
652
+                                }
653
+                                ?>
654 654
 							</select></td>
655 655
 					</tr>
656 656
 					<tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>">
@@ -683,12 +683,12 @@  discard block
 block discarded – undo
683 683
 					</tr>
684 684
 				</table>
685 685
 				<?php
686
-				// invoke OnInterfaceSettingsRender event
687
-				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
688
-				if(is_array($evtOut)) {
689
-					echo implode("", $evtOut);
690
-				}
691
-				?>
686
+                // invoke OnInterfaceSettingsRender event
687
+                $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
688
+                if(is_array($evtOut)) {
689
+                    echo implode("", $evtOut);
690
+                }
691
+                ?>
692 692
 			</div>
693 693
 
694 694
 			<!-- Photo -->
@@ -737,39 +737,39 @@  discard block
 block discarded – undo
737 737
 			</div>
738 738
 			<?php if($use_udperms == 1) {
739 739
 
740
-			$groupsarray = array();
741
-
742
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
743
-				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
744
-				$groupsarray = $modx->db->getColumn('user_group', $rs);
745
-			}
746
-			// retain selected doc groups between post
747
-			if(is_array($_POST['user_groups'])) {
748
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
749
-			}
750
-			?>
740
+            $groupsarray = array();
741
+
742
+            if($modx->manager->action == '12') { // only do this bit if the user is being edited
743
+                $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
744
+                $groupsarray = $modx->db->getColumn('user_group', $rs);
745
+            }
746
+            // retain selected doc groups between post
747
+            if(is_array($_POST['user_groups'])) {
748
+                foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
749
+            }
750
+            ?>
751 751
 			<div class="tab-page" id="tabAccess">
752 752
 				<h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2>
753 753
 				<script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script>
754 754
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
755 755
 				<?php
756
-				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
757
-				while($row = $modx->db->getRow($rs)) {
758
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
759
-				}
760
-				}
761
-				?>
756
+                $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
757
+                while($row = $modx->db->getRow($rs)) {
758
+                    echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
759
+                }
760
+                }
761
+                ?>
762 762
 			</div>
763 763
 		</div>
764 764
 	</div>
765 765
 	<input type="submit" name="save" style="display:none">
766 766
 	<?php
767
-	// invoke OnUserFormRender event
768
-	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
769
-		"id" => $user
770
-	));
771
-	if(is_array($evtOut)) {
772
-		echo implode("", $evtOut);
773
-	}
774
-	?>
767
+    // invoke OnUserFormRender event
768
+    $evtOut = $modx->invokeEvent("OnUserFormRender", array(
769
+        "id" => $user
770
+    ));
771
+    if(is_array($evtOut)) {
772
+        echo implode("", $evtOut);
773
+    }
774
+    ?>
775 775
 </form>
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/request_trigger.inc.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
             if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
23 23
             {
24
-               $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
24
+                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 25
             }
26 26
 
27 27
             foreach( $cm->getCategories() as $category )
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 
107 107
     if( empty( $category ) )
108 108
     {
109
-       $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110
-       return;
109
+        $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110
+        return;
111 111
     }
112 112
 
113 113
     if( $cm->isCategoryExists( $category ) )
114 114
     {
115
-       $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116
-       return;
115
+        $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' );
116
+        return;
117 117
     }
118 118
 
119 119
     if( $cm->addCategory( $category, $rank ) !== 0 )
Please login to merge, or discard this patch.
manager/actions/eventlog_details.dynamic.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
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
 if(!$modx->hasPermission('view_eventlog')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // get id
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 	<div class="tab-page">
42 42
 		<div class="container container-body">
43 43
 			<?php
44
-			$date = $modx->toDateFormat($content["createdon"]);
45
-			if($content["type"] == 1) {
46
-				$icon = $_style['actions_info'] . ' text-info';
47
-				$msgtype = $_lang["information"];
48
-			} else if($content["type"] == 2) {
49
-				$icon = $_style['actions_triangle'] . ' text-warning';
50
-				$msgtype = $_lang["warning"];
51
-			} else if($content["type"] == 3) {
52
-				$icon = $_style['actions_error'] . ' text-danger';
53
-				$msgtype = $_lang["error"];
54
-			}
55
-			?>
44
+            $date = $modx->toDateFormat($content["createdon"]);
45
+            if($content["type"] == 1) {
46
+                $icon = $_style['actions_info'] . ' text-info';
47
+                $msgtype = $_lang["information"];
48
+            } else if($content["type"] == 2) {
49
+                $icon = $_style['actions_triangle'] . ' text-warning';
50
+                $msgtype = $_lang["warning"];
51
+            } else if($content["type"] == 3) {
52
+                $icon = $_style['actions_error'] . ' text-danger';
53
+                $msgtype = $_lang["error"];
54
+            }
55
+            ?>
56 56
 			<p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p>
57 57
 			<p>
58 58
 				<i class="<?= $icon ?>"></i> <?= $msgtype ?>
Please login to merge, or discard this patch.
manager/includes/actionlist.inc.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -5,140 +5,140 @@
 block discarded – undo
5 5
 
6 6
 // action list
7 7
 $GLOBALS['action_list'] = array(
8
-	'1'	=> 'Loading a frame(set)',
9
-	'2'	=> 'Viewing home page/ online users',
10
-	'3'	=> 'Viewing data for resource',
11
-	'4'	=> 'Creating a resource',
12
-	'5'	=> 'Saving resource',
13
-	'6'	=> 'Deleting resource',
14
-	'7'	=> 'Waiting while MODX cleans up',
15
-	'8'	=> 'Logged out',
16
-	'9'	=> 'Viewing help',
17
-	'10'	=> 'Viewing/ composing messages',
18
-	'11'	=> 'Creating a user',
19
-	'12'	=> 'Editing user',
20
-	'13'	=> 'Viewing logging',
21
-	'14'	=> 'Editing a parser',
22
-	'15'	=> 'Saving a parser',
23
-	'16'	=> 'Editing template',
24
-	'17'	=> 'Editing settings',
25
-	'18'	=> 'Viewing Credits :)',
26
-	'19'	=> 'Creating a new template',
27
-	'20'	=> 'Saving template',
28
-	'21'	=> 'Deleting template',
29
-	'22'	=> 'Editing Snippet',
30
-	'23'	=> 'Creating a new Snippet',
31
-	'24'	=> 'Saving Snippet',
32
-	'25'	=> 'Deleting Snippet',
33
-	'26'	=> 'Refreshing site',
34
-	'27'	=> 'Editing resource',
35
-	'28'	=> 'Changing password',
36
-	'29'	=> 'Error',
37
-	'30'	=> 'Saving settings',
38
-	'31'	=> 'Using file manager',
39
-	'32'	=> 'Saving user',
40
-	'33'	=> 'Deleting user',
41
-	'34'	=> 'Saving new password',
42
-	'35'	=> 'Editing role',
43
-	'36'	=> 'Saving role',
44
-	'37'	=> 'Deleting role',
45
-	'38'	=> 'Creating new role',
46
-	'40'	=> 'Editing Access Permissions',
47
-	'41'	=> 'Editing Access Permissions',
48
-	'42'	=> 'Editing Access Permissions',
49
-	'43'	=> 'Editing Access Permissions',
50
-	'44'	=> 'Editing Access Permissions',
51
-	'45'	=> 'Idle',
52
-	'46'	=> 'Editing Access Permissions',
53
-	'47'	=> 'Editing Access Permissions',
54
-	'48'	=> 'Editing Access Permissions',
55
-	'49'	=> 'Editing Access Permissions',
56
-	'50'	=> 'Editing Access Permissions',
57
-	'51'	=> 'Moving resource',
58
-	'52'	=> 'Moved resource',
59
-	'53'	=> 'Viewing system info',
60
-	'54'	=> 'Optimizing a table',
61
-	'55'	=> 'Empty logs',
62
-	'56'	=> 'Refresh resource tree',
63
-	'57'	=> 'Refresh menu',
64
-	'58'	=> 'Logged in',
65
-	'59'    => 'About MODX',
66
-	'60'	=> 'Emptying Recycle Bin',
67
-	'61'	=> 'Publishing a resource',
68
-	'62'	=> 'Un-publishing a resource',
69
-	'63'	=> 'Un-deleting a resource',
70
-	'64'	=> 'Removing deleted content',
71
-	'65'	=> 'Deleting a message',
72
-	'66'	=> 'Sending a message',
73
-	'67'	=> 'Removing locks',
74
-	'68'	=> 'Viewing site logging',
75
-	'69'	=> 'Viewing online visitors',
76
-	'70'	=> 'Viewing site schedule',
77
-	'71'	=> 'Searching',
78
-	'72'	=> 'Adding a weblink',
79
-	'73'	=> 'Editing a weblink',
80
-		//case "74" : return "Changing personal preferences"; break;
81
-	'75'	=> 'User/ role management',
82
-	'76'	=> 'Element management',
83
-	'77'	=> 'Creating a new Chunk (HTML Snippet)',
84
-	'78'	=> 'Editing Chunk (HTML Snippet)',
85
-	'79'	=> 'Saving Chunk (HTML Snippet)',
86
-	'80'	=> 'Deleting Chunk (HTML Snippet)',
87
-	'83'	=> 'Exporting a resource to HTML',
88
-	'84'	=> 'Load Element Selector',
89
-	'85'	=> 'Create Folder',
90
-	'86'	=> 'Role management',
91
-	'87'	=> 'Create new web user',
92
-	'88'	=> 'Editing web user',
93
-	'89'	=> 'Saving web user',
94
-	'90'	=> 'Deleting web user',
95
-	'91'	=> 'Editing Web Access Permissions',
96
-	'92'	=> 'Editing Access Permissions',
97
-	'93'	=> 'Backup Manager',
98
-	'94'	=> 'Duplicate resource',
99
-	'95'	=> 'Importing resources from HTML',
100
-	'96'	=> 'Duplicate Template',
101
-	'97'	=> 'Duplicate Chunk (HTML Snippet)',
102
-	'98'	=> 'Duplicate Snippet',
103
-	'99'	=> 'Manage Web Users',
104
-	'100'	=> 'Previewing resource',
105
-	'101'	=> 'Create new plugin',
106
-	'102'	=> 'Edit plugin',
107
-	'103'	=> 'Saving plugin',
108
-	'104'	=> 'Delete plugin',
109
-	'105'	=> 'Duplicate plugin',
110
-	'106'	=> 'Viewing Modules',
111
-	'107'	=> 'Create new module',
112
-	'108'	=> 'Edit module',
113
-	'109'	=> 'Saving module',
114
-	'110'	=> 'Delete module',
115
-	'111'	=> 'Duplicate module',
116
-	'112'	=> 'Execute module',
117
-	'113'	=> 'Manage module dependencies',
118
-	'114'	=> 'View event log',
119
-	'115'	=> 'View event log details',
120
-	'116'	=> 'Delete event log',
121
-	'117'   => 'Editing tv rank',
122
-	'118'   => 'Call settings ajax include',
123
-	'119'   => 'Login Fail (Temporary Block)',
8
+    '1'	=> 'Loading a frame(set)',
9
+    '2'	=> 'Viewing home page/ online users',
10
+    '3'	=> 'Viewing data for resource',
11
+    '4'	=> 'Creating a resource',
12
+    '5'	=> 'Saving resource',
13
+    '6'	=> 'Deleting resource',
14
+    '7'	=> 'Waiting while MODX cleans up',
15
+    '8'	=> 'Logged out',
16
+    '9'	=> 'Viewing help',
17
+    '10'	=> 'Viewing/ composing messages',
18
+    '11'	=> 'Creating a user',
19
+    '12'	=> 'Editing user',
20
+    '13'	=> 'Viewing logging',
21
+    '14'	=> 'Editing a parser',
22
+    '15'	=> 'Saving a parser',
23
+    '16'	=> 'Editing template',
24
+    '17'	=> 'Editing settings',
25
+    '18'	=> 'Viewing Credits :)',
26
+    '19'	=> 'Creating a new template',
27
+    '20'	=> 'Saving template',
28
+    '21'	=> 'Deleting template',
29
+    '22'	=> 'Editing Snippet',
30
+    '23'	=> 'Creating a new Snippet',
31
+    '24'	=> 'Saving Snippet',
32
+    '25'	=> 'Deleting Snippet',
33
+    '26'	=> 'Refreshing site',
34
+    '27'	=> 'Editing resource',
35
+    '28'	=> 'Changing password',
36
+    '29'	=> 'Error',
37
+    '30'	=> 'Saving settings',
38
+    '31'	=> 'Using file manager',
39
+    '32'	=> 'Saving user',
40
+    '33'	=> 'Deleting user',
41
+    '34'	=> 'Saving new password',
42
+    '35'	=> 'Editing role',
43
+    '36'	=> 'Saving role',
44
+    '37'	=> 'Deleting role',
45
+    '38'	=> 'Creating new role',
46
+    '40'	=> 'Editing Access Permissions',
47
+    '41'	=> 'Editing Access Permissions',
48
+    '42'	=> 'Editing Access Permissions',
49
+    '43'	=> 'Editing Access Permissions',
50
+    '44'	=> 'Editing Access Permissions',
51
+    '45'	=> 'Idle',
52
+    '46'	=> 'Editing Access Permissions',
53
+    '47'	=> 'Editing Access Permissions',
54
+    '48'	=> 'Editing Access Permissions',
55
+    '49'	=> 'Editing Access Permissions',
56
+    '50'	=> 'Editing Access Permissions',
57
+    '51'	=> 'Moving resource',
58
+    '52'	=> 'Moved resource',
59
+    '53'	=> 'Viewing system info',
60
+    '54'	=> 'Optimizing a table',
61
+    '55'	=> 'Empty logs',
62
+    '56'	=> 'Refresh resource tree',
63
+    '57'	=> 'Refresh menu',
64
+    '58'	=> 'Logged in',
65
+    '59'    => 'About MODX',
66
+    '60'	=> 'Emptying Recycle Bin',
67
+    '61'	=> 'Publishing a resource',
68
+    '62'	=> 'Un-publishing a resource',
69
+    '63'	=> 'Un-deleting a resource',
70
+    '64'	=> 'Removing deleted content',
71
+    '65'	=> 'Deleting a message',
72
+    '66'	=> 'Sending a message',
73
+    '67'	=> 'Removing locks',
74
+    '68'	=> 'Viewing site logging',
75
+    '69'	=> 'Viewing online visitors',
76
+    '70'	=> 'Viewing site schedule',
77
+    '71'	=> 'Searching',
78
+    '72'	=> 'Adding a weblink',
79
+    '73'	=> 'Editing a weblink',
80
+        //case "74" : return "Changing personal preferences"; break;
81
+    '75'	=> 'User/ role management',
82
+    '76'	=> 'Element management',
83
+    '77'	=> 'Creating a new Chunk (HTML Snippet)',
84
+    '78'	=> 'Editing Chunk (HTML Snippet)',
85
+    '79'	=> 'Saving Chunk (HTML Snippet)',
86
+    '80'	=> 'Deleting Chunk (HTML Snippet)',
87
+    '83'	=> 'Exporting a resource to HTML',
88
+    '84'	=> 'Load Element Selector',
89
+    '85'	=> 'Create Folder',
90
+    '86'	=> 'Role management',
91
+    '87'	=> 'Create new web user',
92
+    '88'	=> 'Editing web user',
93
+    '89'	=> 'Saving web user',
94
+    '90'	=> 'Deleting web user',
95
+    '91'	=> 'Editing Web Access Permissions',
96
+    '92'	=> 'Editing Access Permissions',
97
+    '93'	=> 'Backup Manager',
98
+    '94'	=> 'Duplicate resource',
99
+    '95'	=> 'Importing resources from HTML',
100
+    '96'	=> 'Duplicate Template',
101
+    '97'	=> 'Duplicate Chunk (HTML Snippet)',
102
+    '98'	=> 'Duplicate Snippet',
103
+    '99'	=> 'Manage Web Users',
104
+    '100'	=> 'Previewing resource',
105
+    '101'	=> 'Create new plugin',
106
+    '102'	=> 'Edit plugin',
107
+    '103'	=> 'Saving plugin',
108
+    '104'	=> 'Delete plugin',
109
+    '105'	=> 'Duplicate plugin',
110
+    '106'	=> 'Viewing Modules',
111
+    '107'	=> 'Create new module',
112
+    '108'	=> 'Edit module',
113
+    '109'	=> 'Saving module',
114
+    '110'	=> 'Delete module',
115
+    '111'	=> 'Duplicate module',
116
+    '112'	=> 'Execute module',
117
+    '113'	=> 'Manage module dependencies',
118
+    '114'	=> 'View event log',
119
+    '115'	=> 'View event log details',
120
+    '116'	=> 'Delete event log',
121
+    '117'   => 'Editing tv rank',
122
+    '118'   => 'Call settings ajax include',
123
+    '119'   => 'Login Fail (Temporary Block)',
124 124
 
125
-	'300'	=> 'Create Template Variable',
126
-	'301'	=> 'Edit Template Variable',
127
-	'302'	=> 'Save Template Variable',
128
-	'303'	=> 'Delete Template Variable',
129
-	'304'	=> 'Duplicate Template Variable',
125
+    '300'	=> 'Create Template Variable',
126
+    '301'	=> 'Edit Template Variable',
127
+    '302'	=> 'Save Template Variable',
128
+    '303'	=> 'Delete Template Variable',
129
+    '304'	=> 'Duplicate Template Variable',
130 130
 
131
-	'200'	=> 'Viewing phpInfo()',
132
-	'501'   => 'Delete category',
133
-	'998'	=> 'Viewing web page',
134
-	'999'	=> 'Viewing test page',
131
+    '200'	=> 'Viewing phpInfo()',
132
+    '501'   => 'Delete category',
133
+    '998'	=> 'Viewing web page',
134
+    '999'	=> 'Viewing test page',
135 135
 );
136 136
 
137 137
 function getAction($actionId, $itemid='') {
138
-	global $action_list;
138
+    global $action_list;
139 139
 
140
-	$ret = sprintf($action_list[$actionId], $itemid);
141
-	if (!$ret) $ret = "Idle (unknown)";
140
+    $ret = sprintf($action_list[$actionId], $itemid);
141
+    if (!$ret) $ret = "Idle (unknown)";
142 142
 
143
-	return $ret;
143
+    return $ret;
144 144
 }
Please login to merge, or discard this patch.
manager/includes/mutate_settings.ajax.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 }
54 54
 
55 55
 if($emptyCache) {
56
-	$modx->clearCache('full');
56
+    $modx->clearCache('full');
57 57
 }
58 58
 
59 59
 echo $str;
Please login to merge, or discard this patch.
manager/includes/accesscontrol.inc.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -1,193 +1,193 @@
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
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
 if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
7
-	header('HTTP/1.0 404 Not Found');
8
-	exit;
7
+    header('HTTP/1.0 404 Not Found');
8
+    exit;
9 9
 }
10 10
 
11 11
 if(isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') {
12
-	//		if (isset($_COOKIE[session_name()])) {
13
-	//			setcookie(session_name(), '', 0, MODX_BASE_URL);
14
-	//		}
15
-	@session_destroy();
16
-	// start session
17
-	//	    startCMSSession();
12
+    //		if (isset($_COOKIE[session_name()])) {
13
+    //			setcookie(session_name(), '', 0, MODX_BASE_URL);
14
+    //		}
15
+    @session_destroy();
16
+    // start session
17
+    //	    startCMSSession();
18 18
 }
19 19
 
20 20
 // andrazk 20070416 - if installer is running, destroy active sessions
21 21
 if(file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) {
22
-	include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
23
-	if(isset($installStartTime)) {
24
-		if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
25
-			unset($installStartTime);
26
-			@ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27
-			unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
28
-		} else {
29
-			if($_SERVER['REQUEST_METHOD'] != 'POST') {
30
-				if(isset($_COOKIE[session_name()])) {
31
-					session_unset();
32
-					@session_destroy();
33
-					//					setcookie(session_name(), '', 0, MODX_BASE_URL);
34
-				}
35
-				$installGoingOn = 1;
36
-			}
37
-		}
38
-	}
22
+    include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
23
+    if(isset($installStartTime)) {
24
+        if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
25
+            unset($installStartTime);
26
+            @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27
+            unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
28
+        } else {
29
+            if($_SERVER['REQUEST_METHOD'] != 'POST') {
30
+                if(isset($_COOKIE[session_name()])) {
31
+                    session_unset();
32
+                    @session_destroy();
33
+                    //					setcookie(session_name(), '', 0, MODX_BASE_URL);
34
+                }
35
+                $installGoingOn = 1;
36
+            }
37
+        }
38
+    }
39 39
 }
40 40
 
41 41
 // andrazk 20070416 - if session started before install and was not destroyed yet
42 42
 if(isset($lastInstallTime)) {
43
-	if(isset($_SESSION['mgrValidated'])) {
44
-		if(isset($_SESSION['modx.session.created.time'])) {
45
-			if($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
-				if($_SERVER['REQUEST_METHOD'] != 'POST') {
47
-					if(isset($_COOKIE[session_name()])) {
48
-						session_unset();
49
-						@session_destroy();
50
-						//						setcookie(session_name(), '', 0, MODX_BASE_URL);
51
-					}
52
-					header('HTTP/1.0 307 Redirect');
53
-					header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2');
54
-				}
55
-			}
56
-		}
57
-	}
43
+    if(isset($_SESSION['mgrValidated'])) {
44
+        if(isset($_SESSION['modx.session.created.time'])) {
45
+            if($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
+                if($_SERVER['REQUEST_METHOD'] != 'POST') {
47
+                    if(isset($_COOKIE[session_name()])) {
48
+                        session_unset();
49
+                        @session_destroy();
50
+                        //						setcookie(session_name(), '', 0, MODX_BASE_URL);
51
+                    }
52
+                    header('HTTP/1.0 307 Redirect');
53
+                    header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2');
54
+                }
55
+            }
56
+        }
57
+    }
58 58
 }
59 59
 
60 60
 if(!isset($_SESSION['mgrValidated'])) {
61
-	if(isset($manager_language)) {
62
-		// establish fallback to English default
63
-		include_once "lang/english.inc.php";
64
-		// include localized overrides
65
-		include_once "lang/" . $manager_language . ".inc.php";
66
-	} else {
67
-		include_once "lang/english.inc.php";
68
-	}
69
-
70
-	$modx->setPlaceholder('modx_charset', $modx_manager_charset);
71
-	$modx->setPlaceholder('theme', $manager_theme);
61
+    if(isset($manager_language)) {
62
+        // establish fallback to English default
63
+        include_once "lang/english.inc.php";
64
+        // include localized overrides
65
+        include_once "lang/" . $manager_language . ".inc.php";
66
+    } else {
67
+        include_once "lang/english.inc.php";
68
+    }
69
+
70
+    $modx->setPlaceholder('modx_charset', $modx_manager_charset);
71
+    $modx->setPlaceholder('theme', $manager_theme);
72 72
     $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico'));
73 73
 
74
-	// invoke OnManagerLoginFormPrerender event
75
-	$evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
76
-	$html = is_array($evtOut) ? implode('', $evtOut) : '';
77
-	$modx->setPlaceholder('OnManagerLoginFormPrerender', $html);
78
-
79
-	$modx->setPlaceholder('site_name', $site_name);
80
-	$modx->setPlaceholder('manager_path', MGR_DIR);
81
-	$modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
82
-	$modx->setPlaceholder('login_message', $_lang["login_message"]);
83
-	$modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
84
-	$modx->setPlaceholder('year', date('Y'));
85
-	$modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : ''));
86
-
87
-	// andrazk 20070416 - notify user of install/update
88
-	if(isset($_GET['installGoingOn'])) {
89
-		$installGoingOn = $_GET['installGoingOn'];
90
-	}
91
-	if(isset($installGoingOn)) {
92
-		switch($installGoingOn) {
93
-			case 1 :
94
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
95
-				break;
96
-			case 2 :
97
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
98
-				break;
99
-		}
100
-	}
101
-
102
-	if($modx->config['use_captcha'] == 1) {
103
-		$modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
104
-		$modx->setPlaceholder('captcha_image', '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>');
105
-		$modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
106
-	}
107
-
108
-	// login info
109
-	$uid = isset($_COOKIE['modx_remember_manager']) ? preg_replace('/[^a-zA-Z0-9\-_@\.]*/', '', $_COOKIE['modx_remember_manager']) : '';
110
-	$modx->setPlaceholder('uid', $uid);
111
-	$modx->setPlaceholder('username', $_lang["username"]);
112
-	$modx->setPlaceholder('password', $_lang["password"]);
113
-
114
-	// remember me
115
-	$html = isset($_COOKIE['modx_remember_manager']) ? 'checked="checked"' : '';
116
-	$modx->setPlaceholder('remember_me', $html);
117
-	$modx->setPlaceholder('remember_username', $_lang["remember_username"]);
118
-	$modx->setPlaceholder('login_button', $_lang["login_button"]);
119
-
120
-	// invoke OnManagerLoginFormRender event
121
-	$evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
122
-	$html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
123
-	$modx->setPlaceholder('OnManagerLoginFormRender', $html);
124
-
125
-	// load template
126
-	$target = $modx->getConfig('manager_login_tpl');
127
-	$target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
128
-	$target = $modx->mergeSettingsContent($target);
129
-
130
-	$login_tpl = null;
131
-	if(substr($target, 0, 1) === '@') {
132
-		if(substr($target, 0, 6) === '@CHUNK') {
133
-			$target = trim(substr($target, 7));
134
-			$login_tpl = $modx->getChunk($target);
135
-		} elseif(substr($target, 0, 5) === '@FILE') {
136
-			$target = trim(substr($target, 6));
137
-			$login_tpl = file_get_contents($target);
138
-		}
139
-	} else {
140
-		$theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
141
-		if(is_file($theme_path . 'style.php')) {
142
-			include($theme_path . 'style.php');
143
-		}
144
-		$chunk = $modx->getChunk($target);
145
-		if($chunk !== false && !empty($chunk)) {
146
-			$login_tpl = $chunk;
147
-		} elseif(is_file(MODX_BASE_PATH . $target)) {
148
-			$target = MODX_BASE_PATH . $target;
149
-			$login_tpl = file_get_contents($target);
150
-		} elseif(is_file($target)) {
151
-			$login_tpl = file_get_contents($target);
152
-		} elseif(is_file($theme_path . 'login.tpl')) {
153
-			$target = $theme_path . 'login.tpl';
154
-			$login_tpl = file_get_contents($target);
155
-		} elseif(is_file($theme_path . 'templates/actions/login.tpl')) {
156
-			$target = $theme_path . 'templates/actions/login.tpl';
157
-			$login_tpl = file_get_contents($target);
158
-		} elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
159
-			$target = $theme_path . 'html/login.html';
160
-			$login_tpl = file_get_contents($target);
161
-		} else {
162
-			$target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
163
-			$login_tpl = file_get_contents($target);
164
-		}
165
-	}
166
-
167
-	// merge placeholders
168
-	$login_tpl = $modx->mergePlaceholderContent($login_tpl);
169
-	$regx = strpos($login_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers
170
-	$login_tpl = preg_replace($regx, '', $login_tpl); //cleanup
171
-
172
-	echo $login_tpl;
173
-
174
-	exit;
74
+    // invoke OnManagerLoginFormPrerender event
75
+    $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
76
+    $html = is_array($evtOut) ? implode('', $evtOut) : '';
77
+    $modx->setPlaceholder('OnManagerLoginFormPrerender', $html);
78
+
79
+    $modx->setPlaceholder('site_name', $site_name);
80
+    $modx->setPlaceholder('manager_path', MGR_DIR);
81
+    $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
82
+    $modx->setPlaceholder('login_message', $_lang["login_message"]);
83
+    $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
84
+    $modx->setPlaceholder('year', date('Y'));
85
+    $modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : ''));
86
+
87
+    // andrazk 20070416 - notify user of install/update
88
+    if(isset($_GET['installGoingOn'])) {
89
+        $installGoingOn = $_GET['installGoingOn'];
90
+    }
91
+    if(isset($installGoingOn)) {
92
+        switch($installGoingOn) {
93
+            case 1 :
94
+                $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
95
+                break;
96
+            case 2 :
97
+                $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
98
+                break;
99
+        }
100
+    }
101
+
102
+    if($modx->config['use_captcha'] == 1) {
103
+        $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
104
+        $modx->setPlaceholder('captcha_image', '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>');
105
+        $modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
106
+    }
107
+
108
+    // login info
109
+    $uid = isset($_COOKIE['modx_remember_manager']) ? preg_replace('/[^a-zA-Z0-9\-_@\.]*/', '', $_COOKIE['modx_remember_manager']) : '';
110
+    $modx->setPlaceholder('uid', $uid);
111
+    $modx->setPlaceholder('username', $_lang["username"]);
112
+    $modx->setPlaceholder('password', $_lang["password"]);
113
+
114
+    // remember me
115
+    $html = isset($_COOKIE['modx_remember_manager']) ? 'checked="checked"' : '';
116
+    $modx->setPlaceholder('remember_me', $html);
117
+    $modx->setPlaceholder('remember_username', $_lang["remember_username"]);
118
+    $modx->setPlaceholder('login_button', $_lang["login_button"]);
119
+
120
+    // invoke OnManagerLoginFormRender event
121
+    $evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
122
+    $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
123
+    $modx->setPlaceholder('OnManagerLoginFormRender', $html);
124
+
125
+    // load template
126
+    $target = $modx->getConfig('manager_login_tpl');
127
+    $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
128
+    $target = $modx->mergeSettingsContent($target);
129
+
130
+    $login_tpl = null;
131
+    if(substr($target, 0, 1) === '@') {
132
+        if(substr($target, 0, 6) === '@CHUNK') {
133
+            $target = trim(substr($target, 7));
134
+            $login_tpl = $modx->getChunk($target);
135
+        } elseif(substr($target, 0, 5) === '@FILE') {
136
+            $target = trim(substr($target, 6));
137
+            $login_tpl = file_get_contents($target);
138
+        }
139
+    } else {
140
+        $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
141
+        if(is_file($theme_path . 'style.php')) {
142
+            include($theme_path . 'style.php');
143
+        }
144
+        $chunk = $modx->getChunk($target);
145
+        if($chunk !== false && !empty($chunk)) {
146
+            $login_tpl = $chunk;
147
+        } elseif(is_file(MODX_BASE_PATH . $target)) {
148
+            $target = MODX_BASE_PATH . $target;
149
+            $login_tpl = file_get_contents($target);
150
+        } elseif(is_file($target)) {
151
+            $login_tpl = file_get_contents($target);
152
+        } elseif(is_file($theme_path . 'login.tpl')) {
153
+            $target = $theme_path . 'login.tpl';
154
+            $login_tpl = file_get_contents($target);
155
+        } elseif(is_file($theme_path . 'templates/actions/login.tpl')) {
156
+            $target = $theme_path . 'templates/actions/login.tpl';
157
+            $login_tpl = file_get_contents($target);
158
+        } elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
159
+            $target = $theme_path . 'html/login.html';
160
+            $login_tpl = file_get_contents($target);
161
+        } else {
162
+            $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
163
+            $login_tpl = file_get_contents($target);
164
+        }
165
+    }
166
+
167
+    // merge placeholders
168
+    $login_tpl = $modx->mergePlaceholderContent($login_tpl);
169
+    $regx = strpos($login_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers
170
+    $login_tpl = preg_replace($regx, '', $login_tpl); //cleanup
171
+
172
+    echo $login_tpl;
173
+
174
+    exit;
175 175
 
176 176
 } else {
177
-	// Update table active_user_sessions
178
-	$modx->updateValidatedUserSession();
179
-
180
-	// Update last action in table active_users
181
-	$itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
182
-	$lasthittime = time();
183
-	$action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
184
-
185
-	if($action !== 1) {
186
-		if(!intval($itemid)) {
187
-			$itemid = null;
188
-		}
189
-		$sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table
190
-			, session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, $itemid == null ? var_export(null, true) : $itemid);
191
-		$modx->db->query($sql);
192
-	}
177
+    // Update table active_user_sessions
178
+    $modx->updateValidatedUserSession();
179
+
180
+    // Update last action in table active_users
181
+    $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
182
+    $lasthittime = time();
183
+    $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
184
+
185
+    if($action !== 1) {
186
+        if(!intval($itemid)) {
187
+            $itemid = null;
188
+        }
189
+        $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table
190
+            , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, $itemid == null ? var_export(null, true) : $itemid);
191
+        $modx->db->query($sql);
192
+    }
193 193
 }
Please login to merge, or discard this patch.