Completed
Push — develop ( 24de57...08354f )
by Dmytro
14s
created
manager/processors/unpublish_content.processor.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 /************webber ********/
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 $udperms->role = $_SESSION['mgrRole'];
34 34
 
35 35
 if(!$udperms->checkPermissions()) {
36
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
36
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
37 37
 }
38 38
 
39 39
 // update the document
40 40
 $modx->db->update(
41
-	array(
42
-		'published'   => 0,
43
-		'pub_date'    => 0,
44
-		'unpub_date'  => 0,
45
-		'editedby'    => $modx->getLoginUserID(),
46
-		'editedon'    => time(),
47
-		'publishedby' => 0,
48
-		'publishedon' => 0,
49
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
41
+    array(
42
+        'published'   => 0,
43
+        'pub_date'    => 0,
44
+        'unpub_date'  => 0,
45
+        'editedby'    => $modx->getLoginUserID(),
46
+        'editedon'    => time(),
47
+        'publishedby' => 0,
48
+        'publishedon' => 0,
49
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
50 50
 
51 51
 // invoke OnDocUnPublished  event
52 52
 $modx->invokeEvent("OnDocUnPublished",array("docid"=>$id));
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,38 +1,38 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) {
5
+if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 /************webber ********/
15
-$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
-$pid=($content['parent']==0?$id:$content['parent']);
15
+$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
+$pid = ($content['parent'] == 0 ? $id : $content['parent']);
17 17
 
18 18
 /************** webber *************/
19
-$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC';
20
-$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon';
21
-$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:'';
22
-$add_path=$sd.$sb.$pg;
19
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
20
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
21
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
22
+$add_path = $sd.$sb.$pg;
23 23
 
24 24
 /***********************************/
25 25
 
26 26
 
27 27
 
28 28
 // check permissions on the document
29
-include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
29
+include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
30 30
 $udperms = new udperms();
31 31
 $udperms->user = $modx->getLoginUserID();
32 32
 $udperms->document = $id;
33 33
 $udperms->role = $_SESSION['mgrRole'];
34 34
 
35
-if(!$udperms->checkPermissions()) {
35
+if (!$udperms->checkPermissions()) {
36 36
 	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
37 37
 }
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	), $modx->getFullTableName('site_content'), "id='{$id}'");
50 50
 
51 51
 // invoke OnDocUnPublished  event
52
-$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id));
52
+$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id));
53 53
 
54 54
 // Set the item name for logger
55 55
 $_SESSION['itemname'] = $content['pagetitle'];
@@ -57,6 +57,6 @@  discard block
 block discarded – undo
57 57
 // empty cache
58 58
 $modx->clearCache('full');
59 59
 
60
-$header="Location: index.php?a=3&id=$pid&r=1".$add_path;
60
+$header = "Location: index.php?a=3&id=$pid&r=1".$add_path;
61 61
 
62 62
 header($header);
Please login to merge, or discard this patch.
manager/processors/delete_module.processor.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('delete_module')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // Set the item name for logger
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforeModFormDelete event
19 19
 $modx->invokeEvent("OnBeforeModFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the module.
25 25
 $modx->db->delete($modx->getFullTableName('site_modules'), "id='{$id}'");
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 // invoke OnModFormDelete event
34 34
 $modx->invokeEvent("OnModFormDelete",
35
-	array(
36
-		"id"	=> $id
37
-	));
35
+    array(
36
+        "id"	=> $id
37
+    ));
38 38
 
39 39
 // empty cache
40 40
 $modx->clearCache('full');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('delete_module')) {
5
+if (!$modx->hasPermission('delete_module')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
@@ -40,5 +40,5 @@  discard block
 block discarded – undo
40 40
 $modx->clearCache('full');
41 41
 
42 42
 // finished emptying cache - redirect
43
-$header="Location: index.php?a=106&r=2";
43
+$header = "Location: index.php?a=106&r=2";
44 44
 header($header);
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 3 patches
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'] = implode("\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'] = implode("\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 implode("\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 implode("\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.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,50 +16,50 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 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>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 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';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if ($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if ($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
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']) {
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 63
 		$ph['config_check_results'] = $config_check_results;
64 64
 		$ph['config_display'] = 'block';
65 65
 	} else {
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73
-if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
73
+if (isset($_SESSION['show_logout_reminder'])) {
74
+	switch ($_SESSION['show_logout_reminder']['type']) {
75 75
 		case 'logout_reminder':
76 76
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77 77
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	</tr>
126 126
 </table>';
127 127
 
128
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
128
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
129 129
 
130 130
 $ph['UserInfo'] = $modx->parseText($tpl, array(
131 131
 	'username' => $modx->getLoginUserName(),
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143
-if($modx->db->getRecordCount($rs) < 1) {
143
+if ($modx->db->getRecordCount($rs) < 1) {
144 144
 	$html = '<p>[%no_active_users_found%]</p>';
145 145
 } else {
146
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
146
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
147 147
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148 148
 	$ph['now'] = strftime('%H:%M:%S', $now);
149 149
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	$userList = array();
169 169
 	$userCount = array();
170 170
 	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
171
+	while ($activeusers = $modx->db->getRow($rs)) {
172 172
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173 173
 
174 174
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 			$currentaction
187 187
 		);
188 188
 	}
189
-	foreach($userList as $params) {
189
+	foreach ($userList as $params) {
190 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);
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 192
 	}
193 193
 
194 194
 	$html .= '
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 $ph['OnlineInfo'] = $html;
201 201
 
202 202
 // include rss feeds for important forum topics
203
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
203
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
204 204
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
205 205
 $ph['modx_news_content'] = $feedData['modx_news_content'];
206 206
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234
-if(is_array($evtOut)) {
234
+if (is_array($evtOut)) {
235 235
 	$output = implode('', $evtOut);
236 236
 	$ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
@@ -365,57 +365,57 @@  discard block
 block discarded – undo
365 365
 
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368
-if(is_array($sitewidgets)) {
368
+if (is_array($sitewidgets)) {
369 369
 	$newwidgets = array();
370
-    foreach($sitewidgets as $widget){
370
+    foreach ($sitewidgets as $widget) {
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
373 373
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
374 374
 }
375 375
 
376
-usort($widgets, function ($a, $b) {
376
+usort($widgets, function($a, $b){
377 377
 	return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382
-foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
382
+foreach ($widgets as $widget) {
383
+	if ($widget['hide'] != '1') {
384 384
 		$output .= $modx->parseText($tpl, $widget);
385 385
 	}
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
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';
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';
392 392
 }
393 393
 
394 394
 $target = $modx->config['manager_welcome_tpl'];
395 395
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398
-if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
398
+if (substr($target, 0, 1) === '@') {
399
+	if (substr($target, 0, 6) === '@CHUNK') {
400 400
 		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
401
+	} elseif (substr($target, 0, 5) === '@FILE') {
402 402
 		$content = file_get_contents(trim(substr($target, 6)));
403 403
 	} else {
404 404
 		$content = '';
405 405
 	}
406 406
 } else {
407 407
 	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
408
+	if ($chunk !== false && !empty($chunk)) {
409 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
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 415
 	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
416
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
417 417
 	} else {
418
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
418
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
419 419
 	}
420 420
 }
421 421
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 $content = $modx->mergeConditionalTagsContent($content);
424 424
 $content = $modx->mergeSettingsContent($content);
425 425
 $content = $modx->parseText($content, $ph);
426
-if(strpos($content, '[+') !== false) {
426
+if (strpos($content, '[+') !== false) {
427 427
 	$modx->toPlaceholders($ph);
428 428
 	$content = $modx->mergePlaceholderContent($content);
429 429
 }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 $content = $modx->parseText($content, $_style, '[&', '&]');
433 433
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 434
 
435
-if($js = $modx->getRegisteredClientScripts()) {
435
+if ($js = $modx->getRegisteredClientScripts()) {
436 436
 	$content .= $js;
437 437
 }
438 438
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
443 443
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 444
 //</span>
445
-function getTplWidget() { // recent document info
445
+function getTplWidget(){ // recent document info
446 446
 	return '
447 447
 		<div class="[+cols+]" id="[+id+]">
448 448
 			<div class="card"[+cardAttr+]>
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 ';
454 454
 }
455 455
 
456
-function getRecentInfo() { // recent document info
456
+function getRecentInfo(){ // recent document info
457 457
 	global $modx;
458 458
 
459 459
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 	return $html;
480 480
 }
481 481
 
482
-function getRecentInfoList() {
482
+function getRecentInfoList(){
483 483
 	global $modx;
484 484
 
485 485
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486 486
 
487
-	if($modx->db->getRecordCount($rs) < 1) {
487
+	if ($modx->db->getRecordCount($rs) < 1) {
488 488
 		return '<tr><td>[%no_activity_message%]</td></tr>';
489 489
 	}
490 490
 
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 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 495
 
496 496
 	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
497
+	while ($ph = $modx->db->getRow($rs)) {
498 498
 		$docid = $ph['id'];
499 499
 		$_ = $modx->getUserInfo($ph['editedby']);
500 500
 		$ph['username'] = $_['username'];
501 501
 
502
-		if($ph['deleted'] == 1) {
502
+		if ($ph['deleted'] == 1) {
503 503
 			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
504
+		} elseif ($ph['published'] == 0) {
505 505
 			$ph['status'] = 'unpublished font-italic text-muted';
506 506
 		} else {
507 507
 			$ph['status'] = 'published';
508 508
 		}
509 509
 
510
-		if($modx->hasPermission('edit_document')) {
510
+		if ($modx->hasPermission('edit_document')) {
511 511
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512 512
 		} else {
513 513
 			$ph['edit_btn'] = '';
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 			$preview_disabled
523 523
 		), $btntpl['preview_btn']);
524 524
 
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
525
+		if ($modx->hasPermission('delete_document')) {
526
+			if ($ph['deleted'] == 0) {
527 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 528
 			} else {
529 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> ';
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 			$ph['delete_btn'] = '';
534 534
 		}
535 535
 
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
536
+		if ($ph['deleted'] == 1 && $ph['published'] == 0) {
537 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) {
538
+		} elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
539 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) {
540
+		} elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
541 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 542
 		} else {
543 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> ';
@@ -546,16 +546,16 @@  discard block
 block discarded – undo
546 546
 
547 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 548
 
549
-		if($ph['longtitle'] == '') {
549
+		if ($ph['longtitle'] == '') {
550 550
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551 551
 		}
552
-		if($ph['description'] == '') {
552
+		if ($ph['description'] == '') {
553 553
 			$ph['description'] = '(<i>[%not_set%]</i>)';
554 554
 		}
555
-		if($ph['introtext'] == '') {
555
+		if ($ph['introtext'] == '') {
556 556
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557 557
 		}
558
-		if($ph['alias'] == '') {
558
+		if ($ph['alias'] == '') {
559 559
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
560 560
 		}
561 561
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	return implode("\n", $output);
565 565
 }
566 566
 
567
-function getRecentInfoRowTpl() {
567
+function getRecentInfoRowTpl(){
568 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>
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 }
594 594
 
595 595
 // setup icons
596
-function wrapIcon($i, $action) {
596
+function wrapIcon($i, $action){
597 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
-function getStartUpScript() {
600
+function getStartUpScript(){
601 601
 	$script = '
602 602
         <script type="text/javascript">
603 603
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
Braces   +77 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
19
+if($modx->hasPermission('messages')) {
20 20
 	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
60
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61 61
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
62
+	if($config_check_results != $_lang['configcheck_ok']) {
63 63
 		$ph['config_check_results'] = $config_check_results;
64 64
 		$ph['config_display'] = 'block';
65
-	} else {
65
+	} else {
66 66
 		$ph['config_display'] = 'none';
67 67
 	}
68
-} else {
68
+} else {
69 69
 	$ph['config_display'] = 'none';
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73
-if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
73
+if(isset($_SESSION['show_logout_reminder'])) {
74
+	switch($_SESSION['show_logout_reminder']['type']) {
75 75
 		case 'logout_reminder':
76 76
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77 77
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 	$ph['show_logout_reminder'] = 'block';
81 81
 	unset($_SESSION['show_logout_reminder']);
82
-} else {
82
+} else {
83 83
 	$ph['show_logout_reminder'] = 'none';
84 84
 }
85 85
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143
-if($modx->db->getRecordCount($rs) < 1) {
143
+if($modx->db->getRecordCount($rs) < 1) {
144 144
 	$html = '<p>[%no_active_users_found%]</p>';
145
-} else {
145
+} else {
146 146
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147 147
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148 148
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	$userList = array();
169 169
 	$userCount = array();
170 170
 	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
171
+	while($activeusers = $modx->db->getRow($rs)) {
172 172
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173 173
 
174 174
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			$currentaction
187 187
 		);
188 188
 	}
189
-	foreach($userList as $params) {
189
+	foreach($userList as $params) {
190 190
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191 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 192
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234
-if(is_array($evtOut)) {
234
+if(is_array($evtOut)) {
235 235
 	$output = implode('', $evtOut);
236 236
 	$ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341 341
 	'hide'=>'0'
342 342
 );
343
-if ($modx->config['rss_url_news']) {
343
+if ($modx->config['rss_url_news']) {
344 344
     $widgets['news'] = array(
345 345
         'menuindex' => '40',
346 346
         'id' => 'news',
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         'hide'=>'0'
352 352
     );
353 353
 }
354
-if ($modx->config['rss_url_security']) {
354
+if ($modx->config['rss_url_security']) {
355 355
     $widgets['security'] = array(
356 356
         'menuindex' => '50',
357 357
         'id' => 'security',
@@ -365,29 +365,29 @@  discard block
 block discarded – undo
365 365
 
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368
-if(is_array($sitewidgets)) {
368
+if(is_array($sitewidgets)) {
369 369
 	$newwidgets = array();
370
-    foreach($sitewidgets as $widget){
370
+    foreach($sitewidgets as $widget) {
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
373 373
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
374 374
 }
375 375
 
376
-usort($widgets, function ($a, $b) {
376
+usort($widgets, function ($a, $b){
377 377
 	return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382
-foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
382
+foreach($widgets as $widget) {
383
+	if ($widget['hide'] != '1') {
384 384
 		$output .= $modx->parseText($tpl, $widget);
385 385
 	}
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
390
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391 391
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
392 392
 }
393 393
 
@@ -395,26 +395,28 @@  discard block
 block discarded – undo
395 395
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398
-if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
398
+if(substr($target, 0, 1) === '@') {
399
+	if(substr($target, 0, 6) === '@CHUNK') {
400 400
 		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
401
+	} elseif(substr($target, 0, 5) === '@FILE') {
402 402
 		$content = file_get_contents(trim(substr($target, 6)));
403
-	} else {
403
+	} else {
404 404
 		$content = '';
405 405
 	}
406
-} else {
406
+} else {
407 407
 	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
408
+	if($chunk !== false && !empty($chunk)) {
409 409
 		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
410
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
411 411
 		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
412
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413 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
414
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
415
+	    // ClipperCMS compatible
415 416
 	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
-	} else {
417
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
418
+	}
419
+	} else {
418 420
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419 421
 	}
420 422
 }
@@ -423,7 +425,7 @@  discard block
 block discarded – undo
423 425
 $content = $modx->mergeConditionalTagsContent($content);
424 426
 $content = $modx->mergeSettingsContent($content);
425 427
 $content = $modx->parseText($content, $ph);
426
-if(strpos($content, '[+') !== false) {
428
+if(strpos($content, '[+') !== false) {
427 429
 	$modx->toPlaceholders($ph);
428 430
 	$content = $modx->mergePlaceholderContent($content);
429 431
 }
@@ -432,7 +434,7 @@  discard block
 block discarded – undo
432 434
 $content = $modx->parseText($content, $_style, '[&', '&]');
433 435
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 436
 
435
-if($js = $modx->getRegisteredClientScripts()) {
437
+if($js = $modx->getRegisteredClientScripts()) {
436 438
 	$content .= $js;
437 439
 }
438 440
 
@@ -442,7 +444,9 @@  discard block
 block discarded – undo
442 444
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
443 445
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 446
 //</span>
445
-function getTplWidget() { // recent document info
447
+function getTplWidget()
448
+{
449
+// recent document info
446 450
 	return '
447 451
 		<div class="[+cols+]" id="[+id+]">
448 452
 			<div class="card"[+cardAttr+]>
@@ -453,7 +457,9 @@  discard block
 block discarded – undo
453 457
 ';
454 458
 }
455 459
 
456
-function getRecentInfo() { // recent document info
460
+function getRecentInfo()
461
+{
462
+// recent document info
457 463
 	global $modx;
458 464
 
459 465
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -479,12 +485,13 @@  discard block
 block discarded – undo
479 485
 	return $html;
480 486
 }
481 487
 
482
-function getRecentInfoList() {
488
+function getRecentInfoList()
489
+{
483 490
 	global $modx;
484 491
 
485 492
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486 493
 
487
-	if($modx->db->getRecordCount($rs) < 1) {
494
+	if($modx->db->getRecordCount($rs) < 1) {
488 495
 		return '<tr><td>[%no_activity_message%]</td></tr>';
489 496
 	}
490 497
 
@@ -494,22 +501,22 @@  discard block
 block discarded – undo
494 501
 	$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 502
 
496 503
 	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
504
+	while($ph = $modx->db->getRow($rs)) {
498 505
 		$docid = $ph['id'];
499 506
 		$_ = $modx->getUserInfo($ph['editedby']);
500 507
 		$ph['username'] = $_['username'];
501 508
 
502
-		if($ph['deleted'] == 1) {
509
+		if($ph['deleted'] == 1) {
503 510
 			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
511
+		} elseif($ph['published'] == 0) {
505 512
 			$ph['status'] = 'unpublished font-italic text-muted';
506
-		} else {
513
+		} else {
507 514
 			$ph['status'] = 'published';
508 515
 		}
509 516
 
510
-		if($modx->hasPermission('edit_document')) {
517
+		if($modx->hasPermission('edit_document')) {
511 518
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
-		} else {
519
+		} else {
513 520
 			$ph['edit_btn'] = '';
514 521
 		}
515 522
 
@@ -522,40 +529,40 @@  discard block
 block discarded – undo
522 529
 			$preview_disabled
523 530
 		), $btntpl['preview_btn']);
524 531
 
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
532
+		if($modx->hasPermission('delete_document')) {
533
+			if($ph['deleted'] == 0) {
527 534
 				$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 {
535
+			} else {
529 536
 				$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 537
 			}
531 538
 			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
-		} else {
539
+		} else {
533 540
 			$ph['delete_btn'] = '';
534 541
 		}
535 542
 
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
543
+		if($ph['deleted'] == 1 && $ph['published'] == 0) {
537 544
 			$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) {
545
+		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539 546
 			$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) {
547
+		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541 548
 			$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 {
549
+		} else {
543 550
 			$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 551
 		}
545 552
 		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546 553
 
547 554
 		$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 555
 
549
-		if($ph['longtitle'] == '') {
556
+		if($ph['longtitle'] == '') {
550 557
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551 558
 		}
552
-		if($ph['description'] == '') {
559
+		if($ph['description'] == '') {
553 560
 			$ph['description'] = '(<i>[%not_set%]</i>)';
554 561
 		}
555
-		if($ph['introtext'] == '') {
562
+		if($ph['introtext'] == '') {
556 563
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557 564
 		}
558
-		if($ph['alias'] == '') {
565
+		if($ph['alias'] == '') {
559 566
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
560 567
 		}
561 568
 
@@ -564,7 +571,8 @@  discard block
 block discarded – undo
564 571
 	return implode("\n", $output);
565 572
 }
566 573
 
567
-function getRecentInfoRowTpl() {
574
+function getRecentInfoRowTpl()
575
+{
568 576
 	$tpl = '
569 577
 						<tr>
570 578
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -593,11 +601,13 @@  discard block
 block discarded – undo
593 601
 }
594 602
 
595 603
 // setup icons
596
-function wrapIcon($i, $action) {
604
+function wrapIcon($i, $action)
605
+{
597 606
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 607
 }
599 608
 
600
-function getStartUpScript() {
609
+function getStartUpScript()
610
+{
601 611
 	$script = '
602 612
         <script type="text/javascript">
603 613
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
manager/includes/veriword.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 $modx->getSettings();
6 6
 $modx->invokeEvent('OnWebPageInit');
7 7
 
8
-$vword = new VeriWord(148,60);
8
+$vword = new VeriWord(148, 60);
9 9
 $vword->output_image();
10 10
 $vword->destroy_image();
11 11
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 ## see sample.php for test and usage
42 42
 ## sample URL: http://www.program-ruti.org/veriword/
43 43
 ####
44
-class VeriWord {
44
+class VeriWord{
45 45
 
46 46
     /* path to font directory*/
47 47
     public $dir_font   = "ttf/";
@@ -52,44 +52,44 @@  discard block
 block discarded – undo
52 52
     public $im_height  = 0;
53 53
     public $im;
54 54
 
55
-    public function __construct($w=200, $h=80) {
55
+    public function __construct($w = 200, $h = 80){
56 56
         /* create session to set word for verification */
57 57
         $this->set_veriword();
58
-        $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font;
58
+        $this->dir_font = dirname(__FILE__).'/'.$this->dir_font;
59 59
         $this->im_width         = $w;
60 60
         $this->im_height        = $h;
61 61
     }
62 62
 
63
-    public function set_veriword() {
63
+    public function set_veriword(){
64 64
         /* create session variable for verification,
65 65
            you may change the session variable name */
66 66
         $this->word             = $this->pick_word();
67 67
         $_SESSION['veriword']   = $this->word;
68 68
     }
69 69
 
70
-    public function output_image() {
70
+    public function output_image(){
71 71
         /* output the image as jpeg */
72 72
         $this->draw_image();
73 73
         header("Content-type: image/jpeg");
74 74
         imagejpeg($this->im);
75 75
     }
76 76
 
77
-    public function pick_word() {
77
+    public function pick_word(){
78 78
         global $modx;
79 79
         // set default words
80
-        $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
80
+        $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
81 81
         $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words;
82 82
         $arr_words = array_filter(array_map('trim', explode(',', $words)));
83 83
 
84 84
         /* pick one randomly for text verification */
85
-        return (string) $arr_words[array_rand($arr_words)].rand(10,999);
85
+        return (string) $arr_words[array_rand($arr_words)].rand(10, 999);
86 86
     }
87 87
 
88
-    public function draw_text() {
88
+    public function draw_text(){
89 89
         $dir = dir($this->dir_font);
90 90
         $fontstmp = array();
91 91
         while (false !== ($file = $dir->read())) {
92
-            if(substr($file, -4) == '.ttf') {
92
+            if (substr($file, -4) == '.ttf') {
93 93
                 $fontstmp[] = $this->dir_font.$file;
94 94
             }
95 95
         }
@@ -97,35 +97,35 @@  discard block
 block discarded – undo
97 97
         $text_font = (string) $fontstmp[array_rand($fontstmp)];
98 98
 
99 99
         /* angle for text inclination */
100
-        $text_angle = rand(-9,9);
100
+        $text_angle = rand(-9, 9);
101 101
         /* initial text size */
102 102
         $text_size  = 30;
103 103
         /* calculate text width and height */
104
-        $box        = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);
105
-        $text_width = $box[2]-$box[0]; //text width
106
-        $text_height= $box[5]-$box[3]; //text height
104
+        $box        = imagettfbbox($text_size, $text_angle, $text_font, $this->word);
105
+        $text_width = $box[2] - $box[0]; //text width
106
+        $text_height = $box[5] - $box[3]; //text height
107 107
 
108 108
         /* adjust text size */
109
-        $text_size  = round((20 * $this->im_width)/$text_width);
109
+        $text_size  = round((20 * $this->im_width) / $text_width);
110 110
 
111 111
         /* recalculate text width and height */
112
-        $box        = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);
113
-        $text_width = $box[2]-$box[0]; //text width
114
-        $text_height= $box[5]-$box[3]; //text height
112
+        $box        = imagettfbbox($text_size, $text_angle, $text_font, $this->word);
113
+        $text_width = $box[2] - $box[0]; //text width
114
+        $text_height = $box[5] - $box[3]; //text height
115 115
 
116 116
         /* calculate center position of text */
117
-        $text_x         = ($this->im_width - $text_width)/2;
118
-        $text_y         = ($this->im_height - $text_height)/2;
117
+        $text_x         = ($this->im_width - $text_width) / 2;
118
+        $text_y         = ($this->im_height - $text_height) / 2;
119 119
 
120 120
         /* create canvas for text drawing */
121
-        $im_text        = imagecreate ($this->im_width, $this->im_height);
122
-        $bg_color       = imagecolorallocate ($im_text, 255, 255, 255);
121
+        $im_text        = imagecreate($this->im_width, $this->im_height);
122
+        $bg_color       = imagecolorallocate($im_text, 255, 255, 255);
123 123
 
124 124
         /* pick color for text */
125
-        $text_color     = imagecolorallocate ($im_text, 0, 51, 153);
125
+        $text_color     = imagecolorallocate($im_text, 0, 51, 153);
126 126
 
127 127
         /* draw text into canvas */
128
-        imagettftext    (   $im_text,
128
+        imagettftext($im_text,
129 129
             $text_size,
130 130
             $text_angle,
131 131
             $text_x,
@@ -140,19 +140,19 @@  discard block
 block discarded – undo
140 140
     }
141 141
 
142 142
 
143
-    public function draw_image() {
143
+    public function draw_image(){
144 144
 
145 145
         /* pick one background image randomly from image directory */
146
-        $img_file       = $this->dir_noise."noise".rand(1,4).".jpg";
146
+        $img_file       = $this->dir_noise."noise".rand(1, 4).".jpg";
147 147
 
148 148
         /* create "noise" background image from your image stock*/
149
-        $noise_img      = @imagecreatefromjpeg ($img_file);
149
+        $noise_img      = @imagecreatefromjpeg($img_file);
150 150
         $noise_width    = imagesx($noise_img);
151 151
         $noise_height   = imagesy($noise_img);
152 152
 
153 153
         /* resize the background image to fit the size of image output */
154
-        $this->im       = imagecreatetruecolor($this->im_width,$this->im_height);
155
-        imagecopyresampled ($this->im,
154
+        $this->im       = imagecreatetruecolor($this->im_width, $this->im_height);
155
+        imagecopyresampled($this->im,
156 156
             $noise_img,
157 157
             0, 0, 0, 0,
158 158
             $this->im_width,
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
             $noise_height);
162 162
 
163 163
         /* put text image into background image */
164
-        imagecopymerge (    $this->im,
164
+        imagecopymerge($this->im,
165 165
             $this->draw_text(),
166 166
             0, 0, 0, 0,
167 167
             $this->im_width,
168 168
             $this->im_height,
169
-            70 );
169
+            70);
170 170
 
171 171
         return $this->im;
172 172
     }
173 173
 
174
-    public function destroy_image() {
174
+    public function destroy_image(){
175 175
 
176 176
         imagedestroy($this->im);
177 177
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
 ## see sample.php for test and usage
42 42
 ## sample URL: http://www.program-ruti.org/veriword/
43 43
 ####
44
-class VeriWord {
44
+class VeriWord
45
+{
45 46
 
46 47
     /* path to font directory*/
47 48
     public $dir_font   = "ttf/";
@@ -52,7 +53,8 @@  discard block
 block discarded – undo
52 53
     public $im_height  = 0;
53 54
     public $im;
54 55
 
55
-    public function __construct($w=200, $h=80) {
56
+    public function __construct($w=200, $h=80)
57
+    {
56 58
         /* create session to set word for verification */
57 59
         $this->set_veriword();
58 60
         $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font;
@@ -60,21 +62,24 @@  discard block
 block discarded – undo
60 62
         $this->im_height        = $h;
61 63
     }
62 64
 
63
-    public function set_veriword() {
65
+    public function set_veriword()
66
+    {
64 67
         /* create session variable for verification,
65 68
            you may change the session variable name */
66 69
         $this->word             = $this->pick_word();
67 70
         $_SESSION['veriword']   = $this->word;
68 71
     }
69 72
 
70
-    public function output_image() {
73
+    public function output_image()
74
+    {
71 75
         /* output the image as jpeg */
72 76
         $this->draw_image();
73 77
         header("Content-type: image/jpeg");
74 78
         imagejpeg($this->im);
75 79
     }
76 80
 
77
-    public function pick_word() {
81
+    public function pick_word()
82
+    {
78 83
         global $modx;
79 84
         // set default words
80 85
         $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
@@ -85,7 +90,8 @@  discard block
 block discarded – undo
85 90
         return (string) $arr_words[array_rand($arr_words)].rand(10,999);
86 91
     }
87 92
 
88
-    public function draw_text() {
93
+    public function draw_text()
94
+    {
89 95
         $dir = dir($this->dir_font);
90 96
         $fontstmp = array();
91 97
         while (false !== ($file = $dir->read())) {
@@ -140,7 +146,8 @@  discard block
 block discarded – undo
140 146
     }
141 147
 
142 148
 
143
-    public function draw_image() {
149
+    public function draw_image()
150
+    {
144 151
 
145 152
         /* pick one background image randomly from image directory */
146 153
         $img_file       = $this->dir_noise."noise".rand(1,4).".jpg";
@@ -171,7 +178,8 @@  discard block
 block discarded – undo
171 178
         return $this->im;
172 179
     }
173 180
 
174
-    public function destroy_image() {
181
+    public function destroy_image()
182
+    {
175 183
 
176 184
         imagedestroy($this->im);
177 185
 
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@
 block discarded – undo
344 344
 
345 345
 /**
346 346
  * @param string $filepath
347
- * @return bool|string
347
+ * @return null|string
348 348
  */
349 349
 function getFileContent($filepath) {
350 350
 	global $_lang;
Please login to merge, or discard this patch.
Indentation   +333 added lines, -333 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  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('import_static')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // Files to upload
10 10
 $allowedfiles = array(
11
-	'html',
12
-	'htm',
13
-	'shtml',
14
-	'xml'
11
+    'html',
12
+    'htm',
13
+    'shtml',
14
+    'xml'
15 15
 );
16 16
 ?>
17 17
 	<script language="javascript">
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	<div class="tab-page">
44 44
 		<div class="container container-body">
45 45
 			<?php
46
-			if(!isset($_POST['import'])) {
47
-				echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
48
-				?>
46
+            if(!isset($_POST['import'])) {
47
+                echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
48
+                ?>
49 49
 				<form action="index.php" method="post" name="importFrm">
50 50
 					<input type="hidden" name="import" value="import" />
51 51
 					<input type="hidden" name="a" value="95" />
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 					<a href="javascript:;" class="btn btn-primary" onclick="window.importFrm.submit();"><i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang["import_site_start"] ?></a>
86 86
 				</form>
87 87
 			<?php
88
-			} else {
89
-			run();
90
-			$modx->clearCache('full');
91
-			?>
88
+            } else {
89
+            run();
90
+            $modx->clearCache('full');
91
+            ?>
92 92
 				<a href="javascript:;" class="btn btn-primary" onclick="window.location.href='index.php?a=2';"><i class="<?= $_style["actions_close"] ?>"></i> <?= $_lang["close"] ?></a>
93 93
 				<script type="text/javascript">
94 94
 					top.mainMenu.reloadtree();
95 95
 					parent.tree.ca = 'open';
96 96
 				</script>
97 97
 				<?php
98
-			}
99
-			?>
98
+            }
99
+            ?>
100 100
 		</div>
101 101
 	</div>
102 102
 
@@ -105,64 +105,64 @@  discard block
 block discarded – undo
105 105
  * @return string
106 106
  */
107 107
 function run() {
108
-	global $modx, $_lang;
108
+    global $modx, $_lang;
109 109
 
110
-	$tbl_site_content = $modx->getFullTableName('site_content');
111
-	$output = '';
112
-	$maxtime = $_POST['maxtime'];
110
+    $tbl_site_content = $modx->getFullTableName('site_content');
111
+    $output = '';
112
+    $maxtime = $_POST['maxtime'];
113 113
 
114
-	if(!is_numeric($maxtime)) {
115
-		$maxtime = 30;
116
-	}
114
+    if(!is_numeric($maxtime)) {
115
+        $maxtime = 30;
116
+    }
117 117
 
118
-	@set_time_limit($maxtime);
118
+    @set_time_limit($maxtime);
119 119
 
120
-	$mtime = microtime();
121
-	$mtime = explode(' ', $mtime);
122
-	$mtime = $mtime[1] + $mtime[0];
123
-	$importstart = $mtime;
120
+    $mtime = microtime();
121
+    $mtime = explode(' ', $mtime);
122
+    $mtime = $mtime[1] + $mtime[0];
123
+    $importstart = $mtime;
124 124
 
125
-	if($_POST['reset'] == 'on') {
126
-		$modx->db->truncate($tbl_site_content);
127
-		$modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
128
-	}
125
+    if($_POST['reset'] == 'on') {
126
+        $modx->db->truncate($tbl_site_content);
127
+        $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
128
+    }
129 129
 
130
-	$parent = (int)$_POST['parent'];
130
+    $parent = (int)$_POST['parent'];
131 131
 
132
-	if(is_dir(MODX_BASE_PATH . 'temp/import')) {
133
-		$filedir = MODX_BASE_PATH . 'temp/import/';
134
-	} elseif(is_dir(MODX_BASE_PATH . 'assets/import')) {
135
-		$filedir = MODX_BASE_PATH . 'assets/import/';
136
-	} else {
132
+    if(is_dir(MODX_BASE_PATH . 'temp/import')) {
133
+        $filedir = MODX_BASE_PATH . 'temp/import/';
134
+    } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) {
135
+        $filedir = MODX_BASE_PATH . 'assets/import/';
136
+    } else {
137 137
         $filedir = '';
138 138
     }
139 139
 
140
-	$filesfound = 0;
140
+    $filesfound = 0;
141 141
 
142
-	$files = getFiles($filedir);
143
-	$files = pop_index($files);
142
+    $files = getFiles($filedir);
143
+    $files = pop_index($files);
144 144
 
145
-	// no. of files to import
146
-	$output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
145
+    // no. of files to import
146
+    $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
147 147
 
148
-	// import files
149
-	if(0 < count($files)) {
150
-		$modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'");
151
-		importFiles($parent, $filedir, $files, 'root');
152
-	}
148
+    // import files
149
+    if(0 < count($files)) {
150
+        $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'");
151
+        importFiles($parent, $filedir, $files, 'root');
152
+    }
153 153
 
154
-	$mtime = microtime();
155
-	$mtime = explode(' ', $mtime);
156
-	$mtime = $mtime[1] + $mtime[0];
157
-	$importend = $mtime;
158
-	$totaltime = ($importend - $importstart);
159
-	$output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
154
+    $mtime = microtime();
155
+    $mtime = explode(' ', $mtime);
156
+    $mtime = $mtime[1] + $mtime[0];
157
+    $importend = $mtime;
158
+    $totaltime = ($importend - $importstart);
159
+    $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
160 160
 
161
-	if($_POST['convert_link'] == 'on') {
162
-		convertLink();
163
-	}
161
+    if($_POST['convert_link'] == 'on') {
162
+        convertLink();
163
+    }
164 164
 
165
-	return $output;
165
+    return $output;
166 166
 }
167 167
 
168 168
 /**
@@ -172,144 +172,144 @@  discard block
 block discarded – undo
172 172
  * @param string $mode
173 173
  */
174 174
 function importFiles($parent, $filedir, $files, $mode) {
175
-	global $modx;
176
-	global $_lang, $allowedfiles;
177
-	global $search_default, $cache_default, $publish_default;
178
-
179
-	$tbl_site_content = $modx->getFullTableName('site_content');
180
-	$tbl_system_settings = $modx->getFullTableName('system_settings');
181
-
182
-	$createdby = $modx->getLoginUserID();
183
-	if(!is_array($files)) {
184
-		return;
185
-	}
186
-	if($_POST['object'] === 'all') {
187
-		$modx->config['default_template'] = '0';
188
-		$richtext = '0';
189
-	} else {
190
-		$richtext = '1';
191
-	}
192
-
193
-	foreach($files as $id => $value) {
194
-		if(is_array($value)) {
195
-			// create folder
196
-			$alias = $id;
197
-			printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
198
-			$field = array();
199
-			$field['type'] = 'document';
200
-			$field['contentType'] = 'text/html';
201
-			$field['published'] = $publish_default;
202
-			$field['parent'] = $parent;
203
-			$field['alias'] = $modx->stripAlias($alias);
204
-			$field['richtext'] = $richtext;
205
-			$field['template'] = $modx->config['default_template'];
206
-			$field['searchable'] = $search_default;
207
-			$field['cacheable'] = $cache_default;
208
-			$field['createdby'] = $createdby;
209
-			$field['isfolder'] = 1;
210
-			$field['menuindex'] = 1;
211
-			$find = false;
212
-			foreach(array(
213
-						'index.html',
214
-						'index.htm'
215
-					) as $filename) {
216
-				$filepath = $filedir . $alias . '/' . $filename;
217
-				if($find === false && file_exists($filepath)) {
218
-					$file = getFileContent($filepath);
219
-					list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
220
-
221
-					$date = filemtime($filepath);
222
-					$field['pagetitle'] = $pagetitle;
223
-					$field['longtitle'] = $pagetitle;
224
-					$field['description'] = $description;
225
-					$field['content'] = $modx->db->escape($content);
226
-					$field['createdon'] = $date;
227
-					$field['editedon'] = $date;
228
-					$newid = $modx->db->insert($field, $tbl_site_content);
229
-					if($newid) {
230
-						$find = true;
231
-						echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
232
-						importFiles($newid, $filedir . $alias . '/', $value, 'sub');
233
-					} else {
234
-						echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
235
-						exit;
236
-					}
237
-				}
238
-			}
239
-			if($find === false) {
240
-				$date = time();
241
-				$field['pagetitle'] = '---';
242
-				$field['content'] = '';
243
-				$field['createdon'] = $date;
244
-				$field['editedon'] = $date;
245
-				$field['hidemenu'] = '1';
246
-				$newid = $modx->db->insert($field, $tbl_site_content);
247
-				if($newid) {
248
-					$find = true;
249
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
250
-					importFiles($newid, $filedir . $alias . '/', $value, 'sub');
251
-				} else {
252
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
253
-					exit;
254
-				}
255
-			}
256
-		} else {
257
-			// create document
258
-			if($mode == 'sub' && $value == 'index.html') {
259
-				continue;
260
-			}
261
-			$filename = $value;
262
-			$fparts = explode('.', $value);
263
-			$alias = $fparts[0];
264
-			$ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
265
-			printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
266
-
267
-			if(!in_array($ext, $allowedfiles)) {
268
-				echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
269
-			} else {
270
-				$filepath = $filedir . $filename;
271
-				$file = getFileContent($filepath);
272
-				list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
273
-
274
-				$date = filemtime($filepath);
275
-				$field = array();
276
-				$field['type'] = 'document';
277
-				$field['contentType'] = 'text/html';
278
-				$field['pagetitle'] = $pagetitle;
279
-				$field['longtitle'] = $pagetitle;
280
-				$field['description'] = $description;
281
-				$field['alias'] = $modx->stripAlias($alias);
282
-				$field['published'] = $publish_default;
283
-				$field['parent'] = $parent;
284
-				$field['content'] = $modx->db->escape($content);
285
-				$field['richtext'] = $richtext;
286
-				$field['template'] = $modx->config['default_template'];
287
-				$field['searchable'] = $search_default;
288
-				$field['cacheable'] = $cache_default;
289
-				$field['createdby'] = $createdby;
290
-				$field['createdon'] = $date;
291
-				$field['editedon'] = $date;
292
-				$field['isfolder'] = 0;
293
-				$field['menuindex'] = ($alias == 'index') ? 0 : 2;
294
-				$newid = $modx->db->insert($field, $tbl_site_content);
295
-				if($newid) {
296
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
297
-				} else {
298
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
299
-					exit;
300
-				}
301
-
302
-				$is_site_start = false;
303
-				if($filename == 'index.html') {
304
-					$is_site_start = true;
305
-				}
306
-				if($is_site_start == true && $_POST['reset'] == 'on') {
307
-					$modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'");
308
-					$modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'");
309
-				}
310
-			}
311
-		}
312
-	}
175
+    global $modx;
176
+    global $_lang, $allowedfiles;
177
+    global $search_default, $cache_default, $publish_default;
178
+
179
+    $tbl_site_content = $modx->getFullTableName('site_content');
180
+    $tbl_system_settings = $modx->getFullTableName('system_settings');
181
+
182
+    $createdby = $modx->getLoginUserID();
183
+    if(!is_array($files)) {
184
+        return;
185
+    }
186
+    if($_POST['object'] === 'all') {
187
+        $modx->config['default_template'] = '0';
188
+        $richtext = '0';
189
+    } else {
190
+        $richtext = '1';
191
+    }
192
+
193
+    foreach($files as $id => $value) {
194
+        if(is_array($value)) {
195
+            // create folder
196
+            $alias = $id;
197
+            printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
198
+            $field = array();
199
+            $field['type'] = 'document';
200
+            $field['contentType'] = 'text/html';
201
+            $field['published'] = $publish_default;
202
+            $field['parent'] = $parent;
203
+            $field['alias'] = $modx->stripAlias($alias);
204
+            $field['richtext'] = $richtext;
205
+            $field['template'] = $modx->config['default_template'];
206
+            $field['searchable'] = $search_default;
207
+            $field['cacheable'] = $cache_default;
208
+            $field['createdby'] = $createdby;
209
+            $field['isfolder'] = 1;
210
+            $field['menuindex'] = 1;
211
+            $find = false;
212
+            foreach(array(
213
+                        'index.html',
214
+                        'index.htm'
215
+                    ) as $filename) {
216
+                $filepath = $filedir . $alias . '/' . $filename;
217
+                if($find === false && file_exists($filepath)) {
218
+                    $file = getFileContent($filepath);
219
+                    list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
220
+
221
+                    $date = filemtime($filepath);
222
+                    $field['pagetitle'] = $pagetitle;
223
+                    $field['longtitle'] = $pagetitle;
224
+                    $field['description'] = $description;
225
+                    $field['content'] = $modx->db->escape($content);
226
+                    $field['createdon'] = $date;
227
+                    $field['editedon'] = $date;
228
+                    $newid = $modx->db->insert($field, $tbl_site_content);
229
+                    if($newid) {
230
+                        $find = true;
231
+                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
232
+                        importFiles($newid, $filedir . $alias . '/', $value, 'sub');
233
+                    } else {
234
+                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
235
+                        exit;
236
+                    }
237
+                }
238
+            }
239
+            if($find === false) {
240
+                $date = time();
241
+                $field['pagetitle'] = '---';
242
+                $field['content'] = '';
243
+                $field['createdon'] = $date;
244
+                $field['editedon'] = $date;
245
+                $field['hidemenu'] = '1';
246
+                $newid = $modx->db->insert($field, $tbl_site_content);
247
+                if($newid) {
248
+                    $find = true;
249
+                    echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
250
+                    importFiles($newid, $filedir . $alias . '/', $value, 'sub');
251
+                } else {
252
+                    echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
253
+                    exit;
254
+                }
255
+            }
256
+        } else {
257
+            // create document
258
+            if($mode == 'sub' && $value == 'index.html') {
259
+                continue;
260
+            }
261
+            $filename = $value;
262
+            $fparts = explode('.', $value);
263
+            $alias = $fparts[0];
264
+            $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
265
+            printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
266
+
267
+            if(!in_array($ext, $allowedfiles)) {
268
+                echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
269
+            } else {
270
+                $filepath = $filedir . $filename;
271
+                $file = getFileContent($filepath);
272
+                list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
273
+
274
+                $date = filemtime($filepath);
275
+                $field = array();
276
+                $field['type'] = 'document';
277
+                $field['contentType'] = 'text/html';
278
+                $field['pagetitle'] = $pagetitle;
279
+                $field['longtitle'] = $pagetitle;
280
+                $field['description'] = $description;
281
+                $field['alias'] = $modx->stripAlias($alias);
282
+                $field['published'] = $publish_default;
283
+                $field['parent'] = $parent;
284
+                $field['content'] = $modx->db->escape($content);
285
+                $field['richtext'] = $richtext;
286
+                $field['template'] = $modx->config['default_template'];
287
+                $field['searchable'] = $search_default;
288
+                $field['cacheable'] = $cache_default;
289
+                $field['createdby'] = $createdby;
290
+                $field['createdon'] = $date;
291
+                $field['editedon'] = $date;
292
+                $field['isfolder'] = 0;
293
+                $field['menuindex'] = ($alias == 'index') ? 0 : 2;
294
+                $newid = $modx->db->insert($field, $tbl_site_content);
295
+                if($newid) {
296
+                    echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
297
+                } else {
298
+                    echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
299
+                    exit;
300
+                }
301
+
302
+                $is_site_start = false;
303
+                if($filename == 'index.html') {
304
+                    $is_site_start = true;
305
+                }
306
+                if($is_site_start == true && $_POST['reset'] == 'on') {
307
+                    $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'");
308
+                    $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'");
309
+                }
310
+            }
311
+        }
312
+    }
313 313
 }
314 314
 
315 315
 /**
@@ -319,27 +319,27 @@  discard block
 block discarded – undo
319 319
  * @return array
320 320
  */
321 321
 function getFiles($directory, $listing = array(), $count = 0) {
322
-	global $_lang;
323
-	global $filesfound;
324
-	$dummy = $count;
325
-	if( ! empty($directory) && $files = scandir($directory)) {
326
-		foreach($files as $file) {
327
-			if($file == '.' || $file == '..') {
328
-				continue;
329
-			} elseif($h = @opendir($directory . $file . "/")) {
330
-				closedir($h);
331
-				$count = -1;
332
-				$listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
333
-			} elseif(strpos($file, '.htm') !== false) {
334
-				$listing[$dummy] = $file;
335
-				$dummy = $dummy + 1;
336
-				$filesfound++;
337
-			}
338
-		}
339
-	} else {
340
-		echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
341
-	}
342
-	return ($listing);
322
+    global $_lang;
323
+    global $filesfound;
324
+    $dummy = $count;
325
+    if( ! empty($directory) && $files = scandir($directory)) {
326
+        foreach($files as $file) {
327
+            if($file == '.' || $file == '..') {
328
+                continue;
329
+            } elseif($h = @opendir($directory . $file . "/")) {
330
+                closedir($h);
331
+                $count = -1;
332
+                $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
333
+            } elseif(strpos($file, '.htm') !== false) {
334
+                $listing[$dummy] = $file;
335
+                $dummy = $dummy + 1;
336
+                $filesfound++;
337
+            }
338
+        }
339
+    } else {
340
+        echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
341
+    }
342
+    return ($listing);
343 343
 }
344 344
 
345 345
 /**
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
  * @return bool|string
348 348
  */
349 349
 function getFileContent($filepath) {
350
-	global $_lang;
351
-	// get the file
352
-	if(!$buffer = file_get_contents($filepath)) {
353
-		echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
354
-	} else {
355
-		return $buffer;
356
-	}
350
+    global $_lang;
351
+    // get the file
352
+    if(!$buffer = file_get_contents($filepath)) {
353
+        echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
354
+    } else {
355
+        return $buffer;
356
+    }
357 357
 }
358 358
 
359 359
 /**
@@ -361,20 +361,20 @@  discard block
 block discarded – undo
361 361
  * @return array
362 362
  */
363 363
 function pop_index($array) {
364
-	$new_array = array();
365
-	foreach($array as $k => $v) {
366
-		if($v !== 'index.html' && $v !== 'index.htm') {
367
-			$new_array[$k] = $v;
368
-		} else {
369
-			array_unshift($new_array, $v);
370
-		}
371
-	}
372
-	foreach($array as $k => $v) {
373
-		if(is_array($v)) {
374
-			$new_array[$k] = $v;
375
-		}
376
-	}
377
-	return $new_array;
364
+    $new_array = array();
365
+    foreach($array as $k => $v) {
366
+        if($v !== 'index.html' && $v !== 'index.htm') {
367
+            $new_array[$k] = $v;
368
+        } else {
369
+            array_unshift($new_array, $v);
370
+        }
371
+    }
372
+    foreach($array as $k => $v) {
373
+        if(is_array($v)) {
374
+            $new_array[$k] = $v;
375
+        }
376
+    }
377
+    return $new_array;
378 378
 }
379 379
 
380 380
 /**
@@ -384,108 +384,108 @@  discard block
 block discarded – undo
384 384
  * @return array
385 385
  */
386 386
 function treatContent($src, $filename, $alias) {
387
-	global $modx;
388
-
389
-	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
390
-
391
-	if(preg_match("@<title>(.*)</title>@i", $src, $matches)) {
392
-		$pagetitle = ($matches[1] !== '') ? $matches[1] : $filename;
393
-		$pagetitle = str_replace('[*pagetitle*]', '', $pagetitle);
394
-	} else {
395
-		$pagetitle = $alias;
396
-	}
397
-	if(!$pagetitle) {
398
-		$pagetitle = $alias;
399
-	}
400
-
401
-	if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
402
-		$description = ($matches[1] !== '') ? $matches[1] : $filename;
403
-		$description = str_replace('[*description*]', '', $description);
404
-	} else {
405
-		$description = '';
406
-	}
407
-
408
-	if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
409
-		$content = $matches[1];
410
-	} else {
411
-		$content = $src;
412
-		$s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
413
-		$r = '$1' . $modx->config['modx_charset'] . '$2';
414
-		$content = preg_replace($s, $r, $content);
415
-		$content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
416
-	}
417
-	$content = str_replace('[*content*]', '[ *content* ]', $content);
418
-	$content = trim($content);
419
-	$pagetitle = $modx->db->escape($pagetitle);
420
-	return array(
421
-		$pagetitle,
422
-		$content,
423
-		$description
424
-	);
387
+    global $modx;
388
+
389
+    $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
390
+
391
+    if(preg_match("@<title>(.*)</title>@i", $src, $matches)) {
392
+        $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename;
393
+        $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle);
394
+    } else {
395
+        $pagetitle = $alias;
396
+    }
397
+    if(!$pagetitle) {
398
+        $pagetitle = $alias;
399
+    }
400
+
401
+    if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
402
+        $description = ($matches[1] !== '') ? $matches[1] : $filename;
403
+        $description = str_replace('[*description*]', '', $description);
404
+    } else {
405
+        $description = '';
406
+    }
407
+
408
+    if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
409
+        $content = $matches[1];
410
+    } else {
411
+        $content = $src;
412
+        $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
413
+        $r = '$1' . $modx->config['modx_charset'] . '$2';
414
+        $content = preg_replace($s, $r, $content);
415
+        $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
416
+    }
417
+    $content = str_replace('[*content*]', '[ *content* ]', $content);
418
+    $content = trim($content);
419
+    $pagetitle = $modx->db->escape($pagetitle);
420
+    return array(
421
+        $pagetitle,
422
+        $content,
423
+        $description
424
+    );
425 425
 }
426 426
 
427 427
 /**
428 428
  * @return void
429 429
  */
430 430
 function convertLink() {
431
-	global $modx;
432
-	$tbl_site_content = $modx->getFullTableName('site_content');
431
+    global $modx;
432
+    $tbl_site_content = $modx->getFullTableName('site_content');
433 433
 
434
-	$rs = $modx->db->select('id,content', $tbl_site_content);
435
-	$p = array();
434
+    $rs = $modx->db->select('id,content', $tbl_site_content);
435
+    $p = array();
436 436
     $target = array();
437
-	$dir = '';
438
-	while($row = $modx->db->getRow($rs)) {
439
-		$id = $row['id'];
440
-		$array = explode('<a href=', $row['content']);
441
-		$c = 0;
442
-		foreach($array as $v) {
443
-			if($v[0] === '"') {
444
-				$v = substr($v, 1);
445
-				list($href, $v) = explode('"', $v, 2);
446
-				$_ = $href;
447
-				if(strpos($_, $modx->config['site_url']) !== false) {
448
-					$_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
449
-				}
450
-				if($_[0] === '/') {
451
-					$_ = substr($_, 1);
452
-				}
453
-				$_ = str_replace('/index.html', '.html', $_);
454
-				$level = substr_count($_, '../');
455
-				if(1 < $level) {
456
-					if(!isset($p[$id])) {
457
-						$p[$id] = $modx->getParentIds($id);
458
-					}
459
-					$k = array_keys($p[$id]);
460
-					while(0 < $level) {
461
-						$dir = array_shift($k);
462
-						$level--;
463
-					}
464
-					if($dir != '') {
465
-						$dir .= '/';
466
-					}
467
-				} else {
468
-					$dir = '';
469
-				}
470
-
471
-				$_ = trim($_, './');
472
-				if(strpos($_, '/') !== false) {
473
-					$_ = substr($_, strrpos($_, '/'));
474
-				}
475
-				$_ = $dir . str_replace('.html', '', $_);
476
-				if(!isset($target[$_])) {
477
-					$target[$_] = $modx->getIdFromAlias($_);
478
-				}
479
-				$target[$_] = trim($target[$_]);
480
-				if(!empty($target[$_])) {
481
-					$href = '[~' . $target[$_] . '~]';
482
-				}
483
-				$array[$c] = '<a href="' . $href . '"' . $v;
484
-			}
485
-			$c++;
486
-		}
487
-		$content = implode('', $array);
488
-		$f['content'] = $modx->db->escape($content);
489
-		$modx->db->update($f, $tbl_site_content, "id='{$id}'");
490
-	}
437
+    $dir = '';
438
+    while($row = $modx->db->getRow($rs)) {
439
+        $id = $row['id'];
440
+        $array = explode('<a href=', $row['content']);
441
+        $c = 0;
442
+        foreach($array as $v) {
443
+            if($v[0] === '"') {
444
+                $v = substr($v, 1);
445
+                list($href, $v) = explode('"', $v, 2);
446
+                $_ = $href;
447
+                if(strpos($_, $modx->config['site_url']) !== false) {
448
+                    $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
449
+                }
450
+                if($_[0] === '/') {
451
+                    $_ = substr($_, 1);
452
+                }
453
+                $_ = str_replace('/index.html', '.html', $_);
454
+                $level = substr_count($_, '../');
455
+                if(1 < $level) {
456
+                    if(!isset($p[$id])) {
457
+                        $p[$id] = $modx->getParentIds($id);
458
+                    }
459
+                    $k = array_keys($p[$id]);
460
+                    while(0 < $level) {
461
+                        $dir = array_shift($k);
462
+                        $level--;
463
+                    }
464
+                    if($dir != '') {
465
+                        $dir .= '/';
466
+                    }
467
+                } else {
468
+                    $dir = '';
469
+                }
470
+
471
+                $_ = trim($_, './');
472
+                if(strpos($_, '/') !== false) {
473
+                    $_ = substr($_, strrpos($_, '/'));
474
+                }
475
+                $_ = $dir . str_replace('.html', '', $_);
476
+                if(!isset($target[$_])) {
477
+                    $target[$_] = $modx->getIdFromAlias($_);
478
+                }
479
+                $target[$_] = trim($target[$_]);
480
+                if(!empty($target[$_])) {
481
+                    $href = '[~' . $target[$_] . '~]';
482
+                }
483
+                $array[$c] = '<a href="' . $href . '"' . $v;
484
+            }
485
+            $c++;
486
+        }
487
+        $content = implode('', $array);
488
+        $f['content'] = $modx->db->escape($content);
489
+        $modx->db->update($f, $tbl_site_content, "id='{$id}'");
490
+    }
491 491
 }
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('import_static')) {
5
+if (!$modx->hasPermission('import_static')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	<div class="tab-page">
44 44
 		<div class="container container-body">
45 45
 			<?php
46
-			if(!isset($_POST['import'])) {
47
-				echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
46
+			if (!isset($_POST['import'])) {
47
+				echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>";
48 48
 				?>
49 49
 				<form action="index.php" method="post" name="importFrm">
50 50
 					<input type="hidden" name="import" value="import" />
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
 /**
105 105
  * @return string
106 106
  */
107
-function run() {
107
+function run(){
108 108
 	global $modx, $_lang;
109 109
 
110 110
 	$tbl_site_content = $modx->getFullTableName('site_content');
111 111
 	$output = '';
112 112
 	$maxtime = $_POST['maxtime'];
113 113
 
114
-	if(!is_numeric($maxtime)) {
114
+	if (!is_numeric($maxtime)) {
115 115
 		$maxtime = 30;
116 116
 	}
117 117
 
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 	$mtime = $mtime[1] + $mtime[0];
123 123
 	$importstart = $mtime;
124 124
 
125
-	if($_POST['reset'] == 'on') {
125
+	if ($_POST['reset'] == 'on') {
126 126
 		$modx->db->truncate($tbl_site_content);
127 127
 		$modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
128 128
 	}
129 129
 
130
-	$parent = (int)$_POST['parent'];
130
+	$parent = (int) $_POST['parent'];
131 131
 
132
-	if(is_dir(MODX_BASE_PATH . 'temp/import')) {
133
-		$filedir = MODX_BASE_PATH . 'temp/import/';
134
-	} elseif(is_dir(MODX_BASE_PATH . 'assets/import')) {
135
-		$filedir = MODX_BASE_PATH . 'assets/import/';
132
+	if (is_dir(MODX_BASE_PATH.'temp/import')) {
133
+		$filedir = MODX_BASE_PATH.'temp/import/';
134
+	} elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
135
+		$filedir = MODX_BASE_PATH.'assets/import/';
136 136
 	} else {
137 137
         $filedir = '';
138 138
     }
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 	$files = pop_index($files);
144 144
 
145 145
 	// no. of files to import
146
-	$output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
146
+	$output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
147 147
 
148 148
 	// import files
149
-	if(0 < count($files)) {
149
+	if (0 < count($files)) {
150 150
 		$modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'");
151 151
 		importFiles($parent, $filedir, $files, 'root');
152 152
 	}
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	$mtime = $mtime[1] + $mtime[0];
157 157
 	$importend = $mtime;
158 158
 	$totaltime = ($importend - $importstart);
159
-	$output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
159
+	$output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
160 160
 
161
-	if($_POST['convert_link'] == 'on') {
161
+	if ($_POST['convert_link'] == 'on') {
162 162
 		convertLink();
163 163
 	}
164 164
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  * @param array $files
172 172
  * @param string $mode
173 173
  */
174
-function importFiles($parent, $filedir, $files, $mode) {
174
+function importFiles($parent, $filedir, $files, $mode){
175 175
 	global $modx;
176 176
 	global $_lang, $allowedfiles;
177 177
 	global $search_default, $cache_default, $publish_default;
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
 	$tbl_system_settings = $modx->getFullTableName('system_settings');
181 181
 
182 182
 	$createdby = $modx->getLoginUserID();
183
-	if(!is_array($files)) {
183
+	if (!is_array($files)) {
184 184
 		return;
185 185
 	}
186
-	if($_POST['object'] === 'all') {
186
+	if ($_POST['object'] === 'all') {
187 187
 		$modx->config['default_template'] = '0';
188 188
 		$richtext = '0';
189 189
 	} else {
190 190
 		$richtext = '1';
191 191
 	}
192 192
 
193
-	foreach($files as $id => $value) {
194
-		if(is_array($value)) {
193
+	foreach ($files as $id => $value) {
194
+		if (is_array($value)) {
195 195
 			// create folder
196 196
 			$alias = $id;
197
-			printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
197
+			printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
198 198
 			$field = array();
199 199
 			$field['type'] = 'document';
200 200
 			$field['contentType'] = 'text/html';
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
 			$field['isfolder'] = 1;
210 210
 			$field['menuindex'] = 1;
211 211
 			$find = false;
212
-			foreach(array(
212
+			foreach (array(
213 213
 						'index.html',
214 214
 						'index.htm'
215 215
 					) as $filename) {
216
-				$filepath = $filedir . $alias . '/' . $filename;
217
-				if($find === false && file_exists($filepath)) {
216
+				$filepath = $filedir.$alias.'/'.$filename;
217
+				if ($find === false && file_exists($filepath)) {
218 218
 					$file = getFileContent($filepath);
219 219
 					list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
220 220
 
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 					$field['createdon'] = $date;
227 227
 					$field['editedon'] = $date;
228 228
 					$newid = $modx->db->insert($field, $tbl_site_content);
229
-					if($newid) {
229
+					if ($newid) {
230 230
 						$find = true;
231
-						echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
232
-						importFiles($newid, $filedir . $alias . '/', $value, 'sub');
231
+						echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
232
+						importFiles($newid, $filedir.$alias.'/', $value, 'sub');
233 233
 					} else {
234
-						echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
234
+						echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
235 235
 						exit;
236 236
 					}
237 237
 				}
238 238
 			}
239
-			if($find === false) {
239
+			if ($find === false) {
240 240
 				$date = time();
241 241
 				$field['pagetitle'] = '---';
242 242
 				$field['content'] = '';
@@ -244,30 +244,30 @@  discard block
 block discarded – undo
244 244
 				$field['editedon'] = $date;
245 245
 				$field['hidemenu'] = '1';
246 246
 				$newid = $modx->db->insert($field, $tbl_site_content);
247
-				if($newid) {
247
+				if ($newid) {
248 248
 					$find = true;
249
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
250
-					importFiles($newid, $filedir . $alias . '/', $value, 'sub');
249
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
250
+					importFiles($newid, $filedir.$alias.'/', $value, 'sub');
251 251
 				} else {
252
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
252
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
253 253
 					exit;
254 254
 				}
255 255
 			}
256 256
 		} else {
257 257
 			// create document
258
-			if($mode == 'sub' && $value == 'index.html') {
258
+			if ($mode == 'sub' && $value == 'index.html') {
259 259
 				continue;
260 260
 			}
261 261
 			$filename = $value;
262 262
 			$fparts = explode('.', $value);
263 263
 			$alias = $fparts[0];
264 264
 			$ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
265
-			printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
265
+			printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
266 266
 
267
-			if(!in_array($ext, $allowedfiles)) {
268
-				echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
267
+			if (!in_array($ext, $allowedfiles)) {
268
+				echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
269 269
 			} else {
270
-				$filepath = $filedir . $filename;
270
+				$filepath = $filedir.$filename;
271 271
 				$file = getFileContent($filepath);
272 272
 				list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
273 273
 
@@ -292,18 +292,18 @@  discard block
 block discarded – undo
292 292
 				$field['isfolder'] = 0;
293 293
 				$field['menuindex'] = ($alias == 'index') ? 0 : 2;
294 294
 				$newid = $modx->db->insert($field, $tbl_site_content);
295
-				if($newid) {
296
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
295
+				if ($newid) {
296
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
297 297
 				} else {
298
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
298
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
299 299
 					exit;
300 300
 				}
301 301
 
302 302
 				$is_site_start = false;
303
-				if($filename == 'index.html') {
303
+				if ($filename == 'index.html') {
304 304
 					$is_site_start = true;
305 305
 				}
306
-				if($is_site_start == true && $_POST['reset'] == 'on') {
306
+				if ($is_site_start == true && $_POST['reset'] == 'on') {
307 307
 					$modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'");
308 308
 					$modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'");
309 309
 				}
@@ -318,26 +318,26 @@  discard block
 block discarded – undo
318 318
  * @param int $count
319 319
  * @return array
320 320
  */
321
-function getFiles($directory, $listing = array(), $count = 0) {
321
+function getFiles($directory, $listing = array(), $count = 0){
322 322
 	global $_lang;
323 323
 	global $filesfound;
324 324
 	$dummy = $count;
325
-	if( ! empty($directory) && $files = scandir($directory)) {
326
-		foreach($files as $file) {
327
-			if($file == '.' || $file == '..') {
325
+	if (!empty($directory) && $files = scandir($directory)) {
326
+		foreach ($files as $file) {
327
+			if ($file == '.' || $file == '..') {
328 328
 				continue;
329
-			} elseif($h = @opendir($directory . $file . "/")) {
329
+			} elseif ($h = @opendir($directory.$file."/")) {
330 330
 				closedir($h);
331 331
 				$count = -1;
332
-				$listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
333
-			} elseif(strpos($file, '.htm') !== false) {
332
+				$listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
333
+			} elseif (strpos($file, '.htm') !== false) {
334 334
 				$listing[$dummy] = $file;
335 335
 				$dummy = $dummy + 1;
336 336
 				$filesfound++;
337 337
 			}
338 338
 		}
339 339
 	} else {
340
-		echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
340
+		echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
341 341
 	}
342 342
 	return ($listing);
343 343
 }
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
  * @param string $filepath
347 347
  * @return bool|string
348 348
  */
349
-function getFileContent($filepath) {
349
+function getFileContent($filepath){
350 350
 	global $_lang;
351 351
 	// get the file
352
-	if(!$buffer = file_get_contents($filepath)) {
353
-		echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
352
+	if (!$buffer = file_get_contents($filepath)) {
353
+		echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
354 354
 	} else {
355 355
 		return $buffer;
356 356
 	}
@@ -360,17 +360,17 @@  discard block
 block discarded – undo
360 360
  * @param array $array
361 361
  * @return array
362 362
  */
363
-function pop_index($array) {
363
+function pop_index($array){
364 364
 	$new_array = array();
365
-	foreach($array as $k => $v) {
366
-		if($v !== 'index.html' && $v !== 'index.htm') {
365
+	foreach ($array as $k => $v) {
366
+		if ($v !== 'index.html' && $v !== 'index.htm') {
367 367
 			$new_array[$k] = $v;
368 368
 		} else {
369 369
 			array_unshift($new_array, $v);
370 370
 		}
371 371
 	}
372
-	foreach($array as $k => $v) {
373
-		if(is_array($v)) {
372
+	foreach ($array as $k => $v) {
373
+		if (is_array($v)) {
374 374
 			$new_array[$k] = $v;
375 375
 		}
376 376
 	}
@@ -383,34 +383,34 @@  discard block
 block discarded – undo
383 383
  * @param string $alias
384 384
  * @return array
385 385
  */
386
-function treatContent($src, $filename, $alias) {
386
+function treatContent($src, $filename, $alias){
387 387
 	global $modx;
388 388
 
389 389
 	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
390 390
 
391
-	if(preg_match("@<title>(.*)</title>@i", $src, $matches)) {
391
+	if (preg_match("@<title>(.*)</title>@i", $src, $matches)) {
392 392
 		$pagetitle = ($matches[1] !== '') ? $matches[1] : $filename;
393 393
 		$pagetitle = str_replace('[*pagetitle*]', '', $pagetitle);
394 394
 	} else {
395 395
 		$pagetitle = $alias;
396 396
 	}
397
-	if(!$pagetitle) {
397
+	if (!$pagetitle) {
398 398
 		$pagetitle = $alias;
399 399
 	}
400 400
 
401
-	if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
401
+	if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
402 402
 		$description = ($matches[1] !== '') ? $matches[1] : $filename;
403 403
 		$description = str_replace('[*description*]', '', $description);
404 404
 	} else {
405 405
 		$description = '';
406 406
 	}
407 407
 
408
-	if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
408
+	if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
409 409
 		$content = $matches[1];
410 410
 	} else {
411 411
 		$content = $src;
412 412
 		$s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
413
-		$r = '$1' . $modx->config['modx_charset'] . '$2';
413
+		$r = '$1'.$modx->config['modx_charset'].'$2';
414 414
 		$content = preg_replace($s, $r, $content);
415 415
 		$content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
416 416
 	}
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 /**
428 428
  * @return void
429 429
  */
430
-function convertLink() {
430
+function convertLink(){
431 431
 	global $modx;
432 432
 	$tbl_site_content = $modx->getFullTableName('site_content');
433 433
 
@@ -435,33 +435,33 @@  discard block
 block discarded – undo
435 435
 	$p = array();
436 436
     $target = array();
437 437
 	$dir = '';
438
-	while($row = $modx->db->getRow($rs)) {
438
+	while ($row = $modx->db->getRow($rs)) {
439 439
 		$id = $row['id'];
440 440
 		$array = explode('<a href=', $row['content']);
441 441
 		$c = 0;
442
-		foreach($array as $v) {
443
-			if($v[0] === '"') {
442
+		foreach ($array as $v) {
443
+			if ($v[0] === '"') {
444 444
 				$v = substr($v, 1);
445 445
 				list($href, $v) = explode('"', $v, 2);
446 446
 				$_ = $href;
447
-				if(strpos($_, $modx->config['site_url']) !== false) {
448
-					$_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
447
+				if (strpos($_, $modx->config['site_url']) !== false) {
448
+					$_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
449 449
 				}
450
-				if($_[0] === '/') {
450
+				if ($_[0] === '/') {
451 451
 					$_ = substr($_, 1);
452 452
 				}
453 453
 				$_ = str_replace('/index.html', '.html', $_);
454 454
 				$level = substr_count($_, '../');
455
-				if(1 < $level) {
456
-					if(!isset($p[$id])) {
455
+				if (1 < $level) {
456
+					if (!isset($p[$id])) {
457 457
 						$p[$id] = $modx->getParentIds($id);
458 458
 					}
459 459
 					$k = array_keys($p[$id]);
460
-					while(0 < $level) {
460
+					while (0 < $level) {
461 461
 						$dir = array_shift($k);
462 462
 						$level--;
463 463
 					}
464
-					if($dir != '') {
464
+					if ($dir != '') {
465 465
 						$dir .= '/';
466 466
 					}
467 467
 				} else {
@@ -469,18 +469,18 @@  discard block
 block discarded – undo
469 469
 				}
470 470
 
471 471
 				$_ = trim($_, './');
472
-				if(strpos($_, '/') !== false) {
472
+				if (strpos($_, '/') !== false) {
473 473
 					$_ = substr($_, strrpos($_, '/'));
474 474
 				}
475
-				$_ = $dir . str_replace('.html', '', $_);
476
-				if(!isset($target[$_])) {
475
+				$_ = $dir.str_replace('.html', '', $_);
476
+				if (!isset($target[$_])) {
477 477
 					$target[$_] = $modx->getIdFromAlias($_);
478 478
 				}
479 479
 				$target[$_] = trim($target[$_]);
480
-				if(!empty($target[$_])) {
481
-					$href = '[~' . $target[$_] . '~]';
480
+				if (!empty($target[$_])) {
481
+					$href = '[~'.$target[$_].'~]';
482 482
 				}
483
-				$array[$c] = '<a href="' . $href . '"' . $v;
483
+				$array[$c] = '<a href="'.$href.'"'.$v;
484 484
 			}
485 485
 			$c++;
486 486
 		}
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -104,7 +104,8 @@  discard block
 block discarded – undo
104 104
 /**
105 105
  * @return string
106 106
  */
107
-function run() {
107
+function run()
108
+{
108 109
 	global $modx, $_lang;
109 110
 
110 111
 	$tbl_site_content = $modx->getFullTableName('site_content');
@@ -171,7 +172,8 @@  discard block
 block discarded – undo
171 172
  * @param array $files
172 173
  * @param string $mode
173 174
  */
174
-function importFiles($parent, $filedir, $files, $mode) {
175
+function importFiles($parent, $filedir, $files, $mode)
176
+{
175 177
 	global $modx;
176 178
 	global $_lang, $allowedfiles;
177 179
 	global $search_default, $cache_default, $publish_default;
@@ -318,7 +320,8 @@  discard block
 block discarded – undo
318 320
  * @param int $count
319 321
  * @return array
320 322
  */
321
-function getFiles($directory, $listing = array(), $count = 0) {
323
+function getFiles($directory, $listing = array(), $count = 0)
324
+{
322 325
 	global $_lang;
323 326
 	global $filesfound;
324 327
 	$dummy = $count;
@@ -346,7 +349,8 @@  discard block
 block discarded – undo
346 349
  * @param string $filepath
347 350
  * @return bool|string
348 351
  */
349
-function getFileContent($filepath) {
352
+function getFileContent($filepath)
353
+{
350 354
 	global $_lang;
351 355
 	// get the file
352 356
 	if(!$buffer = file_get_contents($filepath)) {
@@ -360,7 +364,8 @@  discard block
 block discarded – undo
360 364
  * @param array $array
361 365
  * @return array
362 366
  */
363
-function pop_index($array) {
367
+function pop_index($array)
368
+{
364 369
 	$new_array = array();
365 370
 	foreach($array as $k => $v) {
366 371
 		if($v !== 'index.html' && $v !== 'index.htm') {
@@ -383,7 +388,8 @@  discard block
 block discarded – undo
383 388
  * @param string $alias
384 389
  * @return array
385 390
  */
386
-function treatContent($src, $filename, $alias) {
391
+function treatContent($src, $filename, $alias)
392
+{
387 393
 	global $modx;
388 394
 
389 395
 	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
@@ -427,7 +433,8 @@  discard block
 block discarded – undo
427 433
 /**
428 434
  * @return void
429 435
  */
430
-function convertLink() {
436
+function convertLink()
437
+{
431 438
 	global $modx;
432 439
 	$tbl_site_content = $modx->getFullTableName('site_content');
433 440
 
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysqli.class.inc.php 4 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
     }
241 241
 
242 242
     /**
243
-     * @param string|array $fields
244
-     * @param string|array $from
245
-     * @param string|array $where
243
+     * @param string $fields
244
+     * @param string $from
245
+     * @param string $where
246 246
      * @param string $orderBy
247 247
      * @param string $limit
248 248
      * @return bool|mysqli_result
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
      * @param string $fromtable
327 327
      * @param string $where
328 328
      * @param string $limit
329
-     * @return mixed
329
+     * @return null|integer
330 330
      */
331 331
     public function insert($fields, $intotable, $fromfields = "*", $fromtable = "", $where = "", $limit = "")
332 332
     {
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
     /**
437 437
      * @param null|mysqli $conn
438
-     * @return mixed
438
+     * @return integer
439 439
      */
440 440
     public function getInsertId($conn = null)
441 441
     {
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
     }
514 514
 
515 515
     /**
516
-     * @param $name
516
+     * @param string $name
517 517
      * @param mysqli_result|string $dsq
518 518
      * @return array
519 519
      */
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
     /**
574 574
      * @param string $table
575
-     * @return array
575
+     * @return boolean
576 576
      */
577 577
     public function getTableMetaData($table)
578 578
     {
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
     }
620 620
 
621 621
     /**
622
-     * @param string|mysqli_result $rs
622
+     * @param string $rs
623 623
      * @param bool $index
624 624
      * @return array
625 625
      */
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $pre = null,
31 31
         $charset = '',
32 32
         $connection_method = 'SET CHARACTER SET'
33
-    ) {
33
+    ){
34 34
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
35 35
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
36 36
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
71 71
                         $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']);
72 72
                         $modx->sendmail(array(
73
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
73
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
74 74
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
75 75
                             'type'    => 'text'
76 76
                         ));
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
             $tend = $modx->getMicroTime();
86 86
             $totaltime = $tend - $tstart;
87 87
             if ($modx->dumpSQL) {
88
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
89
-                        $totaltime) . "</fieldset><br />";
88
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
89
+                        $totaltime)."</fieldset><br />";
90 90
             }
91 91
             $this->conn->set_charset($this->config['charset']);
92 92
             $this->isConnected = true;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         if (1000 < $safeCount) {
120 120
             exit("Too many loops '{$safeCount}'");
121 121
         }
122
-        if ( ! ($this->conn instanceof mysqli)) {
122
+        if (!($this->conn instanceof mysqli)) {
123 123
             $this->connect();
124 124
         }
125 125
         if (is_array($s)) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     public function query($sql, $watchError = true)
146 146
     {
147 147
         global $modx;
148
-        if ( ! ($this->conn instanceof mysqli)) {
148
+        if (!($this->conn instanceof mysqli)) {
149 149
             $this->connect();
150 150
         }
151 151
         $tStart = $modx->getMicroTime();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 case 1091:
166 166
                     break;
167 167
                 default:
168
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
168
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
169 169
             }
170 170
         } else {
171 171
             $tend = $modx->getMicroTime();
@@ -179,24 +179,24 @@  discard block
 block discarded – undo
179 179
                     $debug_path[] = $line['function'];
180 180
                 }
181 181
                 $debug_path = implode(' > ', array_reverse($debug_path));
182
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
183
-                        $totalTime * 1000) . "</legend>";
184
-                $modx->queryCode .= $sql . '<br><br>';
182
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
183
+                        $totalTime * 1000)."</legend>";
184
+                $modx->queryCode .= $sql.'<br><br>';
185 185
                 if ($modx->event->name) {
186
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
186
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
187 187
                 }
188 188
                 if ($modx->event->activePlugin) {
189
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
189
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
190 190
                 }
191 191
                 if ($modx->currentSnippet) {
192
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
192
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
193 193
                 }
194 194
                 if (stripos($sql, 'select') === 0) {
195
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
195
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
196 196
                 } else {
197
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
197
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
198 198
                 }
199
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
199
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
200 200
                 $modx->queryCode .= "</fieldset><br />";
201 201
             }
202 202
             $modx->executedQueries++;
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
                     if ($value === null || strtolower($value) === 'null') {
304 304
                         $f = 'NULL';
305 305
                     } else {
306
-                        $f = "'" . $value . "'";
306
+                        $f = "'".$value."'";
307 307
                     }
308
-                    $fields[$key] = "`{$key}` = " . $f;
308
+                    $fields[$key] = "`{$key}` = ".$f;
309 309
                 }
310 310
                 $fields = implode(',', $fields);
311 311
             }
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
                 $this->query("INSERT INTO {$intotable} {$fields}");
341 341
             } else {
342 342
                 if (empty($fromtable)) {
343
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
344
-                            array_values($fields)) . "')";
343
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
344
+                            array_values($fields))."')";
345 345
                     $this->query("INSERT INTO {$intotable} {$fields}");
346 346
                 } else {
347 347
                     $fromtable = $this->replaceFullTableName($fromtable);
348
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
348
+                    $fields = "(".implode(",", array_keys($fields)).")";
349 349
                     $where = trim($where);
350 350
                     $limit = trim($limit);
351 351
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function getInsertId($conn = null)
441 441
     {
442
-        if (! ($conn instanceof mysqli)) {
443
-            $conn =& $this->conn;
442
+        if (!($conn instanceof mysqli)) {
443
+            $conn = & $this->conn;
444 444
         }
445 445
 
446 446
         return $conn->insert_id;
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public function getAffectedRows($conn = null)
454 454
     {
455
-        if (! ($conn instanceof mysqli)) {
456
-            $conn =& $this->conn;
455
+        if (!($conn instanceof mysqli)) {
456
+            $conn = & $this->conn;
457 457
         }
458 458
 
459 459
         return $conn->affected_rows;
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
      */
466 466
     public function getLastError($conn = null)
467 467
     {
468
-        if (! ($conn instanceof mysqli)) {
469
-            $conn =& $this->conn;
468
+        if (!($conn instanceof mysqli)) {
469
+            $conn = & $this->conn;
470 470
         }
471 471
 
472 472
         return $conn->error;
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     {
491 491
         $out = false;
492 492
         if ($ds instanceof mysqli_result) {
493
-            switch($mode){
493
+            switch ($mode) {
494 494
                 case 'assoc':
495 495
                     $out = $ds->fetch_assoc();
496 496
                     break;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     public function getColumn($name, $dsq)
521 521
     {
522 522
         $col = array();
523
-        if ( ! ($dsq instanceof mysqli_result)) {
523
+        if (!($dsq instanceof mysqli_result)) {
524 524
             $dsq = $this->query($dsq);
525 525
         }
526 526
         if ($dsq) {
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
     public function getColumnNames($dsq)
540 540
     {
541 541
         $names = array();
542
-        if ( ! ($dsq instanceof mysqli_result)) {
542
+        if (!($dsq instanceof mysqli_result)) {
543 543
             $dsq = $this->query($dsq);
544 544
         }
545 545
         if ($dsq) {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     public function getValue($dsq)
560 560
     {
561 561
         $out = false;
562
-        if ( ! ($dsq instanceof mysqli_result)) {
562
+        if (!($dsq instanceof mysqli_result)) {
563 563
             $dsq = $this->query($dsq);
564 564
         }
565 565
         if ($dsq) {
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
         $tableName = trim($tableName);
658 658
         $dbase = trim($this->config['dbase'], '`');
659 659
         $prefix = $this->config['table_prefix'];
660
-        if ((bool)$force === true) {
660
+        if ((bool) $force === true) {
661 661
             $result = "`{$dbase}`.`{$prefix}{$tableName}`";
662 662
         } elseif (strpos($tableName, '[+prefix+]') !== false) {
663 663
             $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -373,7 +373,8 @@  discard block
 block discarded – undo
373 373
      * @return bool|mixed|mysqli_result
374 374
      */
375 375
     public function save($fields, $table, $where = '')
376
-    { // This is similar to "replace into table".
376
+    {
377
+// This is similar to "replace into table".
377 378
 
378 379
         if ($where === '') {
379 380
             $mode = 'insert';
@@ -490,7 +491,7 @@  discard block
 block discarded – undo
490 491
     {
491 492
         $out = false;
492 493
         if ($ds instanceof mysqli_result) {
493
-            switch($mode){
494
+            switch($mode) {
494 495
                 case 'assoc':
495 496
                     $out = $ds->fetch_assoc();
496 497
                     break;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
             $orderBy = trim($orderBy);
226 226
             $limit = trim($limit);
227 227
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
228
-                $where = "WHERE {$where}";
228
+                $where = "where {$where}";
229 229
             }
230 230
             if ($orderBy !== '' && stripos($orderBy, 'ORDER BY') !== 0) {
231 231
                 $orderBy = "ORDER BY {$orderBy}";
232 232
             }
233 233
             if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
234
-                $limit = "LIMIT {$limit}";
234
+                $limit = "limit {$limit}";
235 235
             }
236 236
 
237 237
             $out = $this->query("DELETE FROM {$from} {$where} {$orderBy} {$limit}");
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
         $orderBy = trim($orderBy);
273 273
         $limit = trim($limit);
274 274
         if ($where !== '' && stripos($where, 'WHERE') !== 0) {
275
-            $where = "WHERE {$where}";
275
+            $where = "where {$where}";
276 276
         }
277 277
         if ($orderBy !== '' && stripos($orderBy, 'ORDER') !== 0) {
278 278
             $orderBy = "ORDER BY {$orderBy}";
279 279
         }
280 280
         if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
281
-            $limit = "LIMIT {$limit}";
281
+            $limit = "limit {$limit}";
282 282
         }
283 283
 
284
-        return $this->query("SELECT {$fields} FROM {$from} {$where} {$orderBy} {$limit}");
284
+        return $this->query("select {$fields} FROM {$from} {$where} {$orderBy} {$limit}");
285 285
     }
286 286
 
287 287
     /**
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
                     $where = trim($where);
350 350
                     $limit = trim($limit);
351 351
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
352
-                        $where = "WHERE {$where}";
352
+                        $where = "where {$where}";
353 353
                     }
354 354
                     if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
355
-                        $limit = "LIMIT {$limit}";
355
+                        $limit = "limit {$limit}";
356 356
                     }
357 357
                     $this->query("INSERT INTO {$intotable} {$fields} SELECT {$fromfields} FROM {$fromtable} {$where} {$limit}");
358 358
                 }
Please login to merge, or discard this patch.
manager/includes/extenders/maketable.class.php 3 patches
Doc Comments   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -278,8 +278,7 @@  discard block
 block discarded – undo
278 278
     /**
279 279
      * Sets the width attribute of each column in the array.
280 280
      *
281
-     * @param array $value An Array of column widths in the order of the keys in the
282
-     *            source table array.
281
+     * @param string[] $widthArray
283 282
      */
284 283
     public function setColumnWidths($widthArray)
285 284
     {
@@ -289,7 +288,6 @@  discard block
 block discarded – undo
289 288
     /**
290 289
      * An optional array of values that can be preselected when using
291 290
      *
292
-     * @param array $value Indicates the INPUT form element type attribute.
293 291
      */
294 292
     public function setSelectedValues($valueArray)
295 293
     {
@@ -326,7 +324,7 @@  discard block
 block discarded – undo
326 324
     /**
327 325
      * Determines what class the current row should have applied.
328 326
      *
329
-     * @param int $value The position of the current row being rendered.
327
+     * @param integer $position
330 328
      * @return string
331 329
      */
332 330
     public function determineRowClass($position)
@@ -353,7 +351,6 @@  discard block
 block discarded – undo
353 351
      * Generates an onclick action applied to the current cell, to execute
354 352
      * any specified cell actions.
355 353
      *
356
-     * @param string $value Indicates the INPUT form element type attribute.
357 354
      * @return string
358 355
      */
359 356
     public function getCellAction($currentActionFieldValue)
@@ -395,7 +392,7 @@  discard block
 block discarded – undo
395 392
     /**
396 393
      * Function to prepare a link generated in the table cell/link actions.
397 394
      *
398
-     * @param string $value Indicates the INPUT form element type attribute.
395
+     * @param string $link
399 396
      * @return string
400 397
      */
401 398
     public function prepareLink($link)
@@ -414,7 +411,7 @@  discard block
 block discarded – undo
414 411
      *
415 412
      * @param array $fieldsArray The associative array representing the table rows
416 413
      * and columns.
417
-     * @param array $fieldHeadersArray An optional array of values for providing
414
+     * @param string[] $fieldHeadersArray An optional array of values for providing
418 415
      * alternative field headers; this is an associative arrays of keys from
419 416
      * the $fieldsArray where the values represent the alt heading content
420 417
      * for each column.
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function setTableWidth($value)
132 132
     {
133
-        $this->tableWidth = (int)$value;
133
+        $this->tableWidth = (int) $value;
134 134
     }
135 135
 
136 136
     /**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     {
318 318
         $currentWidth = '';
319 319
         if (is_array($this->columnWidths)) {
320
-            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="' . $this->columnWidths[$columnPosition] . '" ' : '';
320
+            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : '';
321 321
         }
322 322
 
323 323
         return $currentWidth;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $currentClass = $this->rowAlternateClass;
347 347
         }
348 348
 
349
-        return ' class="' . $currentClass . '"';
349
+        return ' class="'.$currentClass.'"';
350 350
     }
351 351
 
352 352
     /**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     {
361 361
         $cellAction = '';
362 362
         if ($this->cellAction) {
363
-            $cellAction = ' onClick="javascript:window.location=\'' . $this->cellAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '\'" ';
363
+            $cellAction = ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" ';
364 364
         }
365 365
 
366 366
         return $cellAction;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     {
378 378
         $cell = $value;
379 379
         if ($this->linkAction) {
380
-            $cell = '<a href="' . $this->linkAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '">' . $cell . '</a>';
380
+            $cell = '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>';
381 381
         }
382 382
 
383 383
         return $cell;
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $end = '?';
407 407
         }
408 408
 
409
-        return $link . $end;
409
+        return $link.$end;
410 410
     }
411 411
 
412 412
     /**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         if (is_array($fieldsArray)) {
427 427
             $i = 0;
428 428
             foreach ($fieldsArray as $fieldName => $fieldValue) {
429
-                $table .= "\t<tr" . $this->determineRowClass($i) . ">\n";
429
+                $table .= "\t<tr".$this->determineRowClass($i).">\n";
430 430
                 $currentActionFieldValue = $fieldValue[$this->actionField];
431 431
                 if (is_array($this->selectedValues)) {
432 432
                     $isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1;
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
                 $colPosition = 0;
438 438
                 foreach ($fieldValue as $key => $value) {
439 439
                     if (!in_array($key, $this->excludeFields)) {
440
-                        $table .= "\t\t<td" . $this->getCellAction($currentActionFieldValue) . ">";
440
+                        $table .= "\t\t<td".$this->getCellAction($currentActionFieldValue).">";
441 441
                         $table .= $this->createCellText($currentActionFieldValue, $value);
442 442
                         $table .= "</td>\n";
443 443
                         if ($i == 0) {
444 444
                             if (empty ($header) && $this->formElementType) {
445
-                                $header .= "\t\t<th style=\"width:32px\" " . ($this->thClass ? 'class="' . $this->thClass . '"' : '') . ">" . ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '') . "</th>\n";
445
+                                $header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">".($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n";
446 446
                             }
447 447
                             $headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key;
448
-                            $header .= "\t\t<th" . $this->getColumnWidth($colPosition) . ($this->thClass ? ' class="' . $this->thClass . '" ' : '') . ">" . $headerText . "</th>\n";
448
+                            $header .= "\t\t<th".$this->getColumnWidth($colPosition).($this->thClass ? ' class="'.$this->thClass.'" ' : '').">".$headerText."</th>\n";
449 449
                         }
450 450
                         $colPosition++;
451 451
                     }
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
                 $i++;
454 454
                 $table .= "\t</tr>\n";
455 455
             }
456
-            $table = "\n" . '<table' . ($this->tableWidth > 0 ? ' width="' . $this->tableWidth . '"' : '') . ($this->tableClass ? ' class="' . $this->tableClass . '"' : '') . ($this->tableID ? ' id="' . $this->tableID . '"' : '') . ">\n" . ($header ? "\t<thead>\n\t<tr class=\"" . $this->rowHeaderClass . "\">\n" . $header . "\t</tr>\n\t</thead>\n" : '') . $table . "</table>\n";
456
+            $table = "\n".'<table'.($this->tableWidth > 0 ? ' width="'.$this->tableWidth.'"' : '').($this->tableClass ? ' class="'.$this->tableClass.'"' : '').($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n".($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n";
457 457
             if ($this->formElementType) {
458
-                $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table;
458
+                $table = "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table;
459 459
             }
460 460
             if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists.
461 461
                 /* commented this part because of cookie
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
                 $table .= '</select>'.$_lang["pagination_table_perpage"].'</div>';
471 471
                 */
472
-                $table .= '<div id="pagination" class="paginate">' . $_lang["pagination_table_gotopage"] . '<ul>' . $this->pageNav . '</ul></div>';
472
+                $table .= '<div id="pagination" class="paginate">'.$_lang["pagination_table_gotopage"].'<ul>'.$this->pageNav.'</ul></div>';
473 473
                 //$table .= '<script language="javascript">function updatePageSize(size){window.location = \''.$this->prepareLink($linkpage).'pageSize=\'+size;}</script>';
474 474
 
475 475
             }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 <script language="javascript">
479 479
 	toggled = 0;
480 480
 	function clickAll() {
481
-		myform = document.getElementById("' . $this->formName . '");
481
+		myform = document.getElementById("' . $this->formName.'");
482 482
 		for(i=0;i<myform.length;i++) {
483 483
 			if(myform.elements[i].type==\'checkbox\') {
484 484
 				myform.elements[i].checked=(toggled?false:true);
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
             }
491 491
             if ($this->formElementType) {
492 492
                 if ($this->extra) {
493
-                    $table .= "\n" . $this->extra . "\n";
493
+                    $table .= "\n".$this->extra."\n";
494 494
                 }
495
-                $table .= "\n" . '</form>' . "\n";
495
+                $table .= "\n".'</form>'."\n";
496 496
             }
497 497
 
498 498
             return $table;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         $numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM);
516 516
         $nav = '';
517 517
         if ($numPages > 1) {
518
-            $currentURL = empty($qs) ? '' : '?' . $qs;
518
+            $currentURL = empty($qs) ? '' : '?'.$qs;
519 519
             if ($currentPage > 6) {
520 520
                 $nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]);
521 521
             }
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                 $nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]);
541 541
             }
542 542
         }
543
-        $this->pageNav = ' ' . $nav;
543
+        $this->pageNav = ' '.$nav;
544 544
     }
545 545
 
546 546
     /**
@@ -556,14 +556,14 @@  discard block
 block discarded – undo
556 556
     public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = '')
557 557
     {
558 558
         global $modx;
559
-        $orderBy = !empty($_GET['orderby']) ? '&orderby=' . $_GET['orderby'] : '';
560
-        $orderDir = !empty($_GET['orderdir']) ? '&orderdir=' . $_GET['orderdir'] : '';
559
+        $orderBy = !empty($_GET['orderby']) ? '&orderby='.$_GET['orderby'] : '';
560
+        $orderDir = !empty($_GET['orderdir']) ? '&orderdir='.$_GET['orderdir'] : '';
561 561
         if (!empty($qs)) {
562 562
             $qs = "?$qs";
563 563
         }
564 564
         $link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'],
565
-            $qs . "page=$pageNum$orderBy$orderDir") : $this->prepareLink($link) . "page=$pageNum";
566
-        $nav = '<li' . ($currentPage ? ' class="currentPage"' : '') . '><a' . ($currentPage ? ' class="currentPage"' : '') . ' href="' . $link . '">' . $displayText . '</a></li>' . "\n";
565
+            $qs."page=$pageNum$orderBy$orderDir") : $this->prepareLink($link)."page=$pageNum";
566
+        $nav = '<li'.($currentPage ? ' class="currentPage"' : '').'><a'.($currentPage ? ' class="currentPage"' : '').' href="'.$link.'">'.$displayText.'</a></li>'."\n";
567 567
 
568 568
         return $nav;
569 569
     }
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
         $field = '';
582 582
         if ($this->formElementType) {
583 583
             $checked = $isChecked ? "checked " : "";
584
-            $field = "\t\t" . '<td><input type="' . $this->formElementType . '" name="' . ($this->formElementName ? $this->formElementName : $value) . '"  value="' . $value . '" ' . $checked . '/></td>' . "\n";
584
+            $field = "\t\t".'<td><input type="'.$this->formElementType.'" name="'.($this->formElementName ? $this->formElementName : $value).'"  value="'.$value.'" '.$checked.'/></td>'."\n";
585 585
         }
586 586
 
587 587
         return $field;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
     public function handlePaging()
596 596
     {
597 597
         $offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0;
598
-        $limitClause = ' LIMIT ' . ($offset * MAX_DISPLAY_RECORDS_NUM) . ', ' . MAX_DISPLAY_RECORDS_NUM;
598
+        $limitClause = ' LIMIT '.($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM;
599 599
 
600 600
         return $limitClause;
601 601
     }
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
     public function handleSorting($natural_order = false)
611 611
     {
612 612
         $orderByClause = '';
613
-        if ((bool)$natural_order === false) {
613
+        if ((bool) $natural_order === false) {
614 614
             $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id";
615 615
             $orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC";
616
-            $orderByClause = !empty($orderby) ? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ' : "";
616
+            $orderByClause = !empty($orderby) ? ' ORDER BY '.$orderby.' '.$orderdir.' ' : "";
617 617
         }
618 618
 
619 619
         return $orderByClause;
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
             }
643 643
         }
644 644
 
645
-        return '<a href="[~' . $modx->documentIdentifier . '~]?' . $qs . 'orderby=' . $key . $orderDir . '">' . $text . '</a>';
645
+        return '<a href="[~'.$modx->documentIdentifier.'~]?'.$qs.'orderby='.$key.$orderDir.'">'.$text.'</a>';
646 646
     }
647 647
 
648 648
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -457,7 +457,8 @@
 block discarded – undo
457 457
             if ($this->formElementType) {
458 458
                 $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table;
459 459
             }
460
-            if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists.
460
+            if (strlen($this->pageNav) > 1) {
461
+//changed to display the pagination if exists.
461 462
                 /* commented this part because of cookie
462 463
                 $table .= '<div id="max-display-records" ><select style="display:inline" onchange="javascript:updatePageSize(this[this.selectedIndex].value);">';
463 464
                 $pageSizes= array (10, 25, 50, 100, 250);
Please login to merge, or discard this patch.
manager/includes/paginate.inc.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
     /**
150 150
      * This function returns the current page number.
151 151
      *
152
-     * @return int
152
+     * @return string
153 153
      */
154 154
     public function getCurrentPage()
155 155
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
         $array_paging['total'] = $this->int_nbr_row;
102 102
 
103 103
         if ($this->int_cur_position != 0) {
104
-            $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">";
105
-            $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">";
104
+            $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">";
105
+            $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">";
106 106
         }
107 107
 
108 108
         if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) {
109 109
             $int_new_position = $this->int_cur_position + $this->int_num_result;
110
-            $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">";
111
-            $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">";
110
+            $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">";
111
+            $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">";
112 112
         }
113 113
 
114 114
         return $array_paging;
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
         for ($i = 0; $i < $this->getNumberOfPage(); $i++) {
127 127
             // if current page, do not make a link
128 128
             if ($i == $this->getCurrentPage()) {
129
-                $array_all_page[$i] = "<b>" . ($i + 1) . "</b>&nbsp;";
129
+                $array_all_page[$i] = "<b>".($i + 1)."</b>&nbsp;";
130 130
             } else {
131 131
                 $int_new_position = ($i * $this->int_num_result);
132
-                $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a>&nbsp;";
132
+                $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a>&nbsp;";
133 133
             }
134 134
         }
135 135
 
Please login to merge, or discard this patch.
manager/includes/protect.inc.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 // sanitize array
17 17
 if (!function_exists('modx_sanitize_gpc')) {
18 18
     /**
19
-     * @param array|string $values
19
+     * @param string $values
20 20
      * @param int $depth
21 21
      * @return array|string
22 22
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 }
12 12
 
13 13
 global $sanitize_seed;
14
-$sanitize_seed = 'sanitize_seed_' . base_convert(md5(__FILE__), 16, 36);
14
+$sanitize_seed = 'sanitize_seed_'.base_convert(md5(__FILE__), 16, 36);
15 15
 
16 16
 // sanitize array
17 17
 if (!function_exists('modx_sanitize_gpc')) {
Please login to merge, or discard this patch.