Completed
Push — develop ( 4e806c...6a553b )
by Agel_Nash
10:03
created
manager/processors/duplicate_htmlsnippet.processor.php 1 patch
Indentation   +9 added lines, -9 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('new_chunk')) {
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
 // count duplicates
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate htmlsnippet
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'snippet'=>'',
26
-		'category'=>'',
27
-		), $modx->getDatabase()->getFullTableName('site_htmlsnippets'), // Insert into
28
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'category'=>'',
27
+        ), $modx->getDatabase()->getFullTableName('site_htmlsnippets'), // Insert into
28
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // Set the item name for logger
31 31
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 1 patch
Indentation   +30 added lines, -30 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('new_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
 // count duplicates
14 14
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"));
@@ -18,40 +18,40 @@  discard block
 block discarded – undo
18 18
 
19 19
 // duplicate module
20 20
 $newid = $modx->getDatabase()->insert(
21
-	array(
22
-		'name'=>'',
23
-		'description'=>'',
24
-		'disabled'=>'',
25
-		'category'=>'',
26
-		'wrap'=>'',
27
-		'icon'=>'',
28
-		'enable_resource'=>'',
29
-		'resourcefile'=>'',
30
-		'createdon'=>'',
31
-		'editedon'=>'',
32
-		'guid'=>'',
33
-		'enable_sharedparams'=>'',
34
-		'properties'=>'',
35
-		'modulecode'=>'',
36
-		), $modx->getDatabase()->getFullTableName('site_modules'), // Insert into
37
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
21
+    array(
22
+        'name'=>'',
23
+        'description'=>'',
24
+        'disabled'=>'',
25
+        'category'=>'',
26
+        'wrap'=>'',
27
+        'icon'=>'',
28
+        'enable_resource'=>'',
29
+        'resourcefile'=>'',
30
+        'createdon'=>'',
31
+        'editedon'=>'',
32
+        'guid'=>'',
33
+        'enable_sharedparams'=>'',
34
+        'properties'=>'',
35
+        'modulecode'=>'',
36
+        ), $modx->getDatabase()->getFullTableName('site_modules'), // Insert into
37
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
38 38
 
39 39
 // duplicate module dependencies
40 40
 $modx->getDatabase()->insert(
41
-	array(
42
-		'module'=>'',
43
-		'resource'=>'',
44
-		'type'=>'',
45
-		), $modx->getDatabase()->getFullTableName('site_module_depobj'), // Insert into
46
-	"'{$newid}', resource, type", $modx->getDatabase()->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
41
+    array(
42
+        'module'=>'',
43
+        'resource'=>'',
44
+        'type'=>'',
45
+        ), $modx->getDatabase()->getFullTableName('site_module_depobj'), // Insert into
46
+    "'{$newid}', resource, type", $modx->getDatabase()->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
47 47
 
48 48
 // duplicate module user group access
49 49
 $modx->getDatabase()->insert(
50
-	array(
51
-		'module'=>'',
52
-		'usergroup'=>'',
53
-		), $modx->getDatabase()->getFullTableName('site_module_access'), // Insert into
54
-	"'{$newid}', usergroup", $modx->getDatabase()->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
50
+    array(
51
+        'module'=>'',
52
+        'usergroup'=>'',
53
+        ), $modx->getDatabase()->getFullTableName('site_module_access'), // Insert into
54
+    "'{$newid}', usergroup", $modx->getDatabase()->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
55 55
 
56 56
 // Set the item name for logger
57 57
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/duplicate_template.processor.php 1 patch
Indentation   +15 added lines, -15 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('new_template')) {
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
 // count duplicates
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate template
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'templatename'=>'',
24
-		'description'=>'',
25
-		'content'=>'',
26
-		'category'=>'',
27
-		), $modx->getDatabase()->getFullTableName('site_templates'), // Insert into
28
-	"CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'templatename'=>'',
24
+        'description'=>'',
25
+        'content'=>'',
26
+        'category'=>'',
27
+        ), $modx->getDatabase()->getFullTableName('site_templates'), // Insert into
28
+    "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // duplicate TV values
31 31
 $modx->getDatabase()->insert(
32
-	array(
33
-		'tmplvarid'=>'',
34
-		'templateid'=>'',
35
-		'rank'=>'',
36
-		), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), // Insert into
37
-	"tmplvarid, '{$newid}', rank", $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
32
+    array(
33
+        'tmplvarid'=>'',
34
+        'templateid'=>'',
35
+        'rank'=>'',
36
+        ), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), // Insert into
37
+    "tmplvarid, '{$newid}', rank", $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
38 38
 
39 39
 // Set the item name for logger
40 40
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/delete_tmplvars.processor.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  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('delete_template')) {
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
 $forced = isset($_GET['force']) ? $_GET['force'] : 0;
15 15
 
16 16
 // check for relations
17 17
 if(!$forced) {
18
-	$drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content') . " AS sc
18
+    $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content') . " AS sc
19 19
 			INNER JOIN " . $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'");
20
-	$count = $modx->getDatabase()->getRecordCount($drs);
21
-	if($count > 0) {
22
-		include_once "header.inc.php";
23
-		?>
20
+    $count = $modx->getDatabase()->getRecordCount($drs);
21
+    if($count > 0) {
22
+        include_once "header.inc.php";
23
+        ?>
24 24
 		<script>
25 25
 			var actions = {
26 26
 				delete: function() {
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 				<p><?= $_lang['tmplvar_inuse'] ?></p>
43 43
 				<ul>
44 44
 					<?php
45
-					while($row = $modx->getDatabase()->getRow($drs)) {
46
-						echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
47
-					}
48
-					?>
45
+                    while($row = $modx->getDatabase()->getRow($drs)) {
46
+                        echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
47
+                    }
48
+                    ?>
49 49
 				</ul>
50 50
 			</div>
51 51
 		</div>
52 52
 		<?php
53
-		include_once "footer.inc.php";
54
-		exit;
55
-	}
53
+        include_once "footer.inc.php";
54
+        exit;
55
+    }
56 56
 }
57 57
 
58 58
 // Set the item name for logger
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 // invoke OnBeforeTVFormDelete event
63 63
 $modx->invokeEvent("OnBeforeTVFormDelete", array(
64
-	"id" => $id
64
+    "id" => $id
65 65
 ));
66 66
 
67 67
 // delete variable
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 // invoke OnTVFormDelete event
80 80
 $modx->invokeEvent("OnTVFormDelete", array(
81
-	"id" => $id
81
+    "id" => $id
82 82
 ));
83 83
 
84 84
 // empty cache
Please login to merge, or discard this patch.
manager/processors/login.processor.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
3
-	header('HTTP/1.0 404 Not Found');
4
-	exit('error');
3
+    header('HTTP/1.0 404 Not Found');
4
+    exit('error');
5 5
 }
6 6
 define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
7 7
 define('MODX_API_MODE', true);
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
 include_once("{$core_path}lang/english.inc.php");
17 17
 
18 18
 if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
19
-	include_once("{$core_path}lang/{$manager_language}.inc.php");
19
+    include_once("{$core_path}lang/{$manager_language}.inc.php");
20 20
 }
21 21
 
22 22
 // Initialize System Alert Message Queque
23 23
 if(!isset($_SESSION['SystemAlertMsgQueque'])) {
24
-	$_SESSION['SystemAlertMsgQueque'] = array();
24
+    $_SESSION['SystemAlertMsgQueque'] = array();
25 25
 }
26 26
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
27 27
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 
37 37
 // invoke OnBeforeManagerLogin event
38 38
 $modx->invokeEvent('OnBeforeManagerLogin', array(
39
-		'username' => $username,
40
-		'userpassword' => $givenPassword,
41
-		'rememberme' => $rememberme
42
-	));
39
+        'username' => $username,
40
+        'userpassword' => $givenPassword,
41
+        'rememberme' => $rememberme
42
+    ));
43 43
 $fields = 'mu.*, ua.*';
44 44
 $from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' .
45 45
     $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua';
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 $limit = $modx->getDatabase()->getRecordCount($rs);
49 49
 
50 50
 if($limit == 0 || $limit > 1) {
51
-	jsAlert($_lang['login_processor_unknown_user']);
52
-	return;
51
+    jsAlert($_lang['login_processor_unknown_user']);
52
+    return;
53 53
 }
54 54
 
55 55
 $row = $modx->getDatabase()->getRow($rs);
@@ -74,36 +74,36 @@  discard block
 block discarded – undo
74 74
     "user='{$internalKey}' AND setting_value!=''"
75 75
 );
76 76
 while($row = $modx->getDatabase()->getRow($rs)) {
77
-	extract($row);
78
-	${$setting_name} = $setting_value;
77
+    extract($row);
78
+    ${$setting_name} = $setting_value;
79 79
 }
80 80
 
81 81
 // blocked due to number of login errors.
82 82
 if($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
83
-	@session_destroy();
84
-	session_unset();
85
-	if($cip = getenv("HTTP_CLIENT_IP")) {
86
-		$ip = $cip;
87
-	} elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
88
-		$ip = $cip;
89
-	} elseif($cip = getenv("REMOTE_ADDR")) {
90
-		$ip = $cip;
91
-	} else {
92
-		$ip = "UNKNOWN";
93
-	}
94
-	$log = new EvolutionCMS\Legacy\LogHandler();
95
-	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
96
-	jsAlert($_lang['login_processor_many_failed_logins']);
97
-	return;
83
+    @session_destroy();
84
+    session_unset();
85
+    if($cip = getenv("HTTP_CLIENT_IP")) {
86
+        $ip = $cip;
87
+    } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
88
+        $ip = $cip;
89
+    } elseif($cip = getenv("REMOTE_ADDR")) {
90
+        $ip = $cip;
91
+    } else {
92
+        $ip = "UNKNOWN";
93
+    }
94
+    $log = new EvolutionCMS\Legacy\LogHandler();
95
+    $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
96
+    jsAlert($_lang['login_processor_many_failed_logins']);
97
+    return;
98 98
 }
99 99
 
100 100
 // blocked due to number of login errors, but get to try again
101 101
 if($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
102
-	$fields = array();
103
-	$fields['failedlogincount'] = '0';
104
-	$fields['blockeduntil'] = time() - 1;
105
-	$modx->getDatabase()->update(
106
-	    $fields,
102
+    $fields = array();
103
+    $fields['failedlogincount'] = '0';
104
+    $fields['blockeduntil'] = time() - 1;
105
+    $modx->getDatabase()->update(
106
+        $fields,
107 107
         $modx->getDatabase()->getFullTableName('user_attributes'),
108 108
         "internalKey='{$internalKey}'"
109 109
     );
@@ -111,94 +111,94 @@  discard block
 block discarded – undo
111 111
 
112 112
 // this user has been blocked by an admin, so no way he's loggin in!
113 113
 if($blocked == '1') {
114
-	@session_destroy();
115
-	session_unset();
116
-	jsAlert($_lang['login_processor_blocked1']);
117
-	return;
114
+    @session_destroy();
115
+    session_unset();
116
+    jsAlert($_lang['login_processor_blocked1']);
117
+    return;
118 118
 }
119 119
 
120 120
 // blockuntil: this user has a block until date
121 121
 if($blockeduntildate > time()) {
122
-	@session_destroy();
123
-	session_unset();
124
-	jsAlert($_lang['login_processor_blocked2']);
125
-	return;
122
+    @session_destroy();
123
+    session_unset();
124
+    jsAlert($_lang['login_processor_blocked2']);
125
+    return;
126 126
 }
127 127
 
128 128
 // blockafter: this user has a block after date
129 129
 if($blockedafterdate > 0 && $blockedafterdate < time()) {
130
-	@session_destroy();
131
-	session_unset();
132
-	jsAlert($_lang['login_processor_blocked3']);
133
-	return;
130
+    @session_destroy();
131
+    session_unset();
132
+    jsAlert($_lang['login_processor_blocked3']);
133
+    return;
134 134
 }
135 135
 
136 136
 // allowed ip
137 137
 if($allowed_ip) {
138
-	if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
139
-		if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
140
-			jsAlert($_lang['login_processor_remotehost_ip']);
141
-			return;
142
-		}
143
-	}
144
-	if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
145
-		jsAlert($_lang['login_processor_remote_ip']);
146
-		return;
147
-	}
138
+    if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
139
+        if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
140
+            jsAlert($_lang['login_processor_remotehost_ip']);
141
+            return;
142
+        }
143
+    }
144
+    if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
145
+        jsAlert($_lang['login_processor_remote_ip']);
146
+        return;
147
+    }
148 148
 }
149 149
 
150 150
 // allowed days
151 151
 if($allowed_days) {
152
-	$date = getdate();
153
-	$day = $date['wday'] + 1;
154
-	if(!in_array($day,explode(',',$allowed_days))) {
155
-		jsAlert($_lang['login_processor_date']);
156
-		return;
157
-	}
152
+    $date = getdate();
153
+    $day = $date['wday'] + 1;
154
+    if(!in_array($day,explode(',',$allowed_days))) {
155
+        jsAlert($_lang['login_processor_date']);
156
+        return;
157
+    }
158 158
 }
159 159
 
160 160
 // invoke OnManagerAuthentication event
161 161
 $rt = $modx->invokeEvent('OnManagerAuthentication', array(
162
-		'userid' => $internalKey,
163
-		'username' => $username,
164
-		'userpassword' => $givenPassword,
165
-		'savedpassword' => $dbasePassword,
166
-		'rememberme' => $rememberme
167
-	));
162
+        'userid' => $internalKey,
163
+        'username' => $username,
164
+        'userpassword' => $givenPassword,
165
+        'savedpassword' => $dbasePassword,
166
+        'rememberme' => $rememberme
167
+    ));
168 168
 
169 169
 // check if plugin authenticated the user
170 170
 $matchPassword = false;
171 171
 if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
172
-	// check user password - local authentication
173
-	$hashType = $modx->getManagerApi()->getHashType($dbasePassword);
174
-	if($hashType == 'phpass') {
175
-		$matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
176
-	} elseif($hashType == 'md5') {
177
-		$matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
178
-	} elseif($hashType == 'v1') {
179
-		$matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
180
-	} else {
181
-		$matchPassword = false;
182
-	}
172
+    // check user password - local authentication
173
+    $hashType = $modx->getManagerApi()->getHashType($dbasePassword);
174
+    if($hashType == 'phpass') {
175
+        $matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
176
+    } elseif($hashType == 'md5') {
177
+        $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
178
+    } elseif($hashType == 'v1') {
179
+        $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
180
+    } else {
181
+        $matchPassword = false;
182
+    }
183 183
 } else if($rt === true || (is_array($rt) && in_array(true, $rt))) {
184
-	$matchPassword = true;
184
+    $matchPassword = true;
185 185
 }
186 186
 
187 187
 if(!$matchPassword) {
188
-	jsAlert($_lang['login_processor_wrong_password']);
189
-	incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
190
-	return;
188
+    jsAlert($_lang['login_processor_wrong_password']);
189
+    incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
190
+    return;
191 191
 }
192 192
 
193 193
 if($modx->config['use_captcha'] == 1) {
194
-	if(!isset ($_SESSION['veriword'])) {
195
-		jsAlert($_lang['login_processor_captcha_config']);
196
-		return;
197
-	} elseif($_SESSION['veriword'] != $captcha_code) {
198
-		jsAlert($_lang['login_processor_bad_code']);
199
-		incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
200
-		return;
201
-	}
194
+    if(!isset ($_SESSION['veriword'])) {
195
+        jsAlert($_lang['login_processor_captcha_config']);
196
+        return;
197
+    } elseif($_SESSION['veriword'] != $captcha_code) {
198
+        jsAlert($_lang['login_processor_bad_code']);
199
+        incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
200
+        return;
201
+    }
202 202
 }
203 203
 
204 204
 $modx->cleanupExpiredLocks();
@@ -237,36 +237,36 @@  discard block
 block discarded – undo
237 237
 $_SESSION['mgrToken'] = md5($currentsessionid);
238 238
 
239 239
 if($rememberme == '1') {
240
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
241
-
242
-	// Set a cookie separate from the session cookie with the username in it.
243
-	// Are we using secure connection? If so, make sure the cookie is secure
244
-	global $https_port;
245
-
246
-	$secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
247
-	if(version_compare(PHP_VERSION, '5.2', '<')) {
248
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
249
-	} else {
250
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
251
-	}
240
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
241
+
242
+    // Set a cookie separate from the session cookie with the username in it.
243
+    // Are we using secure connection? If so, make sure the cookie is secure
244
+    global $https_port;
245
+
246
+    $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
247
+    if(version_compare(PHP_VERSION, '5.2', '<')) {
248
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
249
+    } else {
250
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
251
+    }
252 252
 } else {
253
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
253
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
254 254
 
255
-	// Remove the Remember Me cookie
256
-	setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
255
+    // Remove the Remember Me cookie
256
+    setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
257 257
 }
258 258
 
259 259
 // Check if user already has an active session, if not check if user pressed logout end of last session
260 260
 $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'");
261 261
 $activeSession = $modx->getDatabase()->getValue($rs);
262 262
 if(!$activeSession) {
263
-	$rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
264
-	if($lastHit = $modx->getDatabase()->getValue($rs)) {
265
-		$_SESSION['show_logout_reminder'] = array(
266
-			'type' => 'logout_reminder',
267
-			'lastHit' => $lastHit
268
-		);
269
-	}
263
+    $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
264
+    if($lastHit = $modx->getDatabase()->getValue($rs)) {
265
+        $_SESSION['show_logout_reminder'] = array(
266
+            'type' => 'logout_reminder',
267
+            'lastHit' => $lastHit
268
+        );
269
+    }
270 270
 }
271 271
 
272 272
 $log = new EvolutionCMS\Legacy\LogHandler();
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 
275 275
 // invoke OnManagerLogin event
276 276
 $modx->invokeEvent('OnManagerLogin', array(
277
-		'userid' => $internalKey,
278
-		'username' => $username,
279
-		'userpassword' => $givenPassword,
280
-		'rememberme' => $rememberme
281
-	));
277
+        'userid' => $internalKey,
278
+        'username' => $username,
279
+        'userpassword' => $givenPassword,
280
+        'rememberme' => $rememberme
281
+    ));
282 282
 
283 283
 // check if we should redirect user to a web page
284 284
 $rs = $modx->getDatabase()->select(
@@ -288,17 +288,17 @@  discard block
 block discarded – undo
288 288
 );
289 289
 $id = (int)$modx->getDatabase()->getValue($rs);
290 290
 if($id > 0) {
291
-	$header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
292
-	if($_POST['ajax'] == 1) {
293
-		echo $header;
294
-	} else {
295
-		header($header);
296
-	}
291
+    $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
292
+    if($_POST['ajax'] == 1) {
293
+        echo $header;
294
+    } else {
295
+        header($header);
296
+    }
297 297
 } else {
298
-	$header = 'Location: ' . MODX_MANAGER_URL;
299
-	if($_POST['ajax'] == 1) {
300
-		echo $header;
301
-	} else {
302
-		header($header);
303
-	}
298
+    $header = 'Location: ' . MODX_MANAGER_URL;
299
+    if($_POST['ajax'] == 1) {
300
+        echo $header;
301
+    } else {
302
+        header($header);
303
+    }
304 304
 }
Please login to merge, or discard this patch.
manager/processors/remove_content.processor.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  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_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), "deleted=1");
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 
12 12
 // invoke OnBeforeEmptyTrash event
13 13
 $modx->invokeEvent("OnBeforeEmptyTrash",
14
-						array(
15
-							"ids"=>$ids
16
-						));
14
+                        array(
15
+                            "ids"=>$ids
16
+                        ));
17 17
 
18 18
 // remove the document groups link.
19 19
 $sql = "DELETE document_groups
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
 //'undelete' the document.
33 33
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_content'), "deleted=1");
34 34
 
35
-	// invoke OnEmptyTrash event
36
-	$modx->invokeEvent("OnEmptyTrash",
37
-						array(
38
-							"ids"=>$ids
39
-						));
35
+    // invoke OnEmptyTrash event
36
+    $modx->invokeEvent("OnEmptyTrash",
37
+                        array(
38
+                            "ids"=>$ids
39
+                        ));
40 40
 
41
-	// empty cache
42
-	$modx->clearCache('full');
41
+    // empty cache
42
+    $modx->clearCache('full');
43 43
 
44
-	// finished emptying cache - redirect
45
-	$header="Location: index.php?a=2&r=1";
46
-	header($header);
44
+    // finished emptying cache - redirect
45
+    $header="Location: index.php?a=2&r=1";
46
+    header($header);
Please login to merge, or discard this patch.
manager/processors/publish_content.processor.php 1 patch
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 ********/
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 $udperms->role = $_SESSION['mgrRole'];
33 33
 
34 34
 if(!$udperms->checkPermissions()) {
35
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
35
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
36 36
 }
37 37
 
38 38
 // update the document
39 39
 $modx->getDatabase()->update(
40
-	array(
41
-		'published'   => 1,
42
-		'pub_date'    => 0,
43
-		'unpub_date'  => 0,
44
-		'editedby'    => $modx->getLoginUserID(),
45
-		'editedon'    => time(),
46
-		'publishedby' => $modx->getLoginUserID(),
47
-		'publishedon' => time(),
48
-	), $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'");
40
+    array(
41
+        'published'   => 1,
42
+        'pub_date'    => 0,
43
+        'unpub_date'  => 0,
44
+        'editedby'    => $modx->getLoginUserID(),
45
+        'editedon'    => time(),
46
+        'publishedby' => $modx->getLoginUserID(),
47
+        'publishedon' => time(),
48
+    ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'");
49 49
 
50 50
 // invoke OnDocPublished  event
51 51
 $modx->invokeEvent("OnDocPublished",array("docid"=>$id));
Please login to merge, or discard this patch.
manager/processors/delete_template.processor.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  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('delete_template')) {
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
 // delete the template, but first check it doesn't have any documents using it
15 15
 $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getDatabase()->getFullTableName('site_content'), "template='{$id}' AND deleted=0");
16 16
 $limit = $modx->getDatabase()->getRecordCount($rs);
17 17
 if($limit > 0) {
18
-	include "header.inc.php";
19
-	?>
18
+    include "header.inc.php";
19
+    ?>
20 20
 
21 21
 	<h1><?php echo $_lang['manage_templates']; ?></h1>
22 22
 
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 			<p>Documents using this template:</p>
29 29
 			<ul>
30 30
 				<?php
31
-				while($row = $modx->getDatabase()->getRow($rs)) {
32
-					echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
33
-				}
34
-				?>
31
+                while($row = $modx->getDatabase()->getRow($rs)) {
32
+                    echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
33
+                }
34
+                ?>
35 35
 			</ul>
36 36
 		</div>
37 37
 	</div>
38 38
 	<?php
39
-	include_once "footer.inc.php";
40
-	exit;
39
+    include_once "footer.inc.php";
40
+    exit;
41 41
 }
42 42
 
43 43
 if($id == $default_template) {
44
-	$modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
44
+    $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
45 45
 }
46 46
 
47 47
 // Set the item name for logger
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 // invoke OnBeforeTempFormDelete event
52 52
 $modx->invokeEvent("OnBeforeTempFormDelete", array(
53
-		"id" => $id
54
-	));
53
+        "id" => $id
54
+    ));
55 55
 
56 56
 // delete the document.
57 57
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'");
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
 // invoke OnTempFormDelete event
62 62
 $modx->invokeEvent("OnTempFormDelete", array(
63
-		"id" => $id
64
-	));
63
+        "id" => $id
64
+    ));
65 65
 
66 66
 // empty cache
67 67
 $modx->clearCache('full');
Please login to merge, or discard this patch.
manager/processors/send_message.processor.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  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('messages')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $sendto = $_REQUEST['sendto'];
@@ -16,55 +16,55 @@  discard block
 block discarded – undo
16 16
 $postdate = time();
17 17
 
18 18
 if($sendto=='u') {
19
-	if($userid==0) {
20
-		$modx->webAlertAndQuit($_lang["error_no_user_selected"]);
21
-	}
22
-	$modx->getDatabase()->insert(
23
-		array(
24
-			'recipient' => $userid,
25
-			'sender'    => $modx->getLoginUserID(),
26
-			'subject'   => $subject,
27
-			'message'   => $message,
28
-			'postdate'  => $postdate,
29
-			'type'      => 'Message',
30
-			'private'   => 1,
31
-		), $modx->getDatabase()->getFullTableName('user_messages'));
19
+    if($userid==0) {
20
+        $modx->webAlertAndQuit($_lang["error_no_user_selected"]);
21
+    }
22
+    $modx->getDatabase()->insert(
23
+        array(
24
+            'recipient' => $userid,
25
+            'sender'    => $modx->getLoginUserID(),
26
+            'subject'   => $subject,
27
+            'message'   => $message,
28
+            'postdate'  => $postdate,
29
+            'type'      => 'Message',
30
+            'private'   => 1,
31
+        ), $modx->getDatabase()->getFullTableName('user_messages'));
32 32
 }
33 33
 
34 34
 if($sendto=='g') {
35
-	if($groupid==0) {
36
-		$modx->webAlertAndQuit($_lang["error_no_group_selected"]);
37
-	}
38
-	$rs = $modx->getDatabase()->select('internalKey', $modx->getDatabase()->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'");
39
-	while ($row=$modx->getDatabase()->getRow($rs)) {
40
-		$modx->getDatabase()->insert(
41
-			array(
42
-				'recipient' => $row['internalKey'],
43
-				'sender'    => $modx->getLoginUserID(),
44
-				'subject'   => $subject,
45
-				'message'   => $message,
46
-				'postdate'  => $postdate,
47
-				'type'      => 'Message',
48
-				'private'   => 0,
49
-			), $modx->getDatabase()->getFullTableName('user_messages'));
50
-	}
35
+    if($groupid==0) {
36
+        $modx->webAlertAndQuit($_lang["error_no_group_selected"]);
37
+    }
38
+    $rs = $modx->getDatabase()->select('internalKey', $modx->getDatabase()->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'");
39
+    while ($row=$modx->getDatabase()->getRow($rs)) {
40
+        $modx->getDatabase()->insert(
41
+            array(
42
+                'recipient' => $row['internalKey'],
43
+                'sender'    => $modx->getLoginUserID(),
44
+                'subject'   => $subject,
45
+                'message'   => $message,
46
+                'postdate'  => $postdate,
47
+                'type'      => 'Message',
48
+                'private'   => 0,
49
+            ), $modx->getDatabase()->getFullTableName('user_messages'));
50
+    }
51 51
 }
52 52
 
53 53
 
54 54
 if($sendto=='a') {
55
-	$rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'");
56
-	while ($row=$modx->getDatabase()->getRow($rs)) {
57
-		$modx->getDatabase()->insert(
58
-			array(
59
-				'recipient' => $row['id'],
60
-				'sender'    => $modx->getLoginUserID(),
61
-				'subject'   => $subject,
62
-				'message'   => $message,
63
-				'postdate'  => $postdate,
64
-				'type'      => 'Message',
65
-				'private'   => 0,
66
-			), $modx->getDatabase()->getFullTableName('user_messages'));
67
-	}
55
+    $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'");
56
+    while ($row=$modx->getDatabase()->getRow($rs)) {
57
+        $modx->getDatabase()->insert(
58
+            array(
59
+                'recipient' => $row['id'],
60
+                'sender'    => $modx->getLoginUserID(),
61
+                'subject'   => $subject,
62
+                'message'   => $message,
63
+                'postdate'  => $postdate,
64
+                'type'      => 'Message',
65
+                'private'   => 0,
66
+            ), $modx->getDatabase()->getFullTableName('user_messages'));
67
+    }
68 68
 }
69 69
 
70 70
 $header = "Location: index.php?a=10";
Please login to merge, or discard this patch.