Completed
Pull Request — develop (#522)
by Agel_Nash
07:16
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'])? intval($_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->db->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'snippet'=>'',
26
-		'category'=>'',
27
-		), $modx->getFullTableName('site_htmlsnippets'), // Insert into
28
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'category'=>'',
27
+        ), $modx->getFullTableName('site_htmlsnippets'), // Insert into
28
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // Set the item name for logger
31 31
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/delete_plugin.processor.php 1 patch
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_plugin')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? intval($_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 OnBeforePluginFormDelete event
19 19
 $modx->invokeEvent("OnBeforePluginFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the plugin.
25 25
 $modx->db->delete($modx->getFullTableName('site_plugins'), "id='{$id}'");
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
 // invoke OnPluginFormDelete event
31 31
 $modx->invokeEvent("OnPluginFormDelete",
32
-	array(
33
-		"id"	=> $id
34
-	));
32
+    array(
33
+        "id"	=> $id
34
+    ));
35 35
 
36 36
 // empty cache
37 37
 $modx->clearCache('full');
Please login to merge, or discard this patch.
manager/processors/undelete_content.processor.php 1 patch
Indentation   +26 added lines, -26 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_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'])? intval($_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,50 +32,50 @@  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
 // get the timestamp on which the document was deleted.
39 39
 $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1");
40 40
 $deltime = $modx->db->getValue($rs);
41 41
 if(!$deltime) {
42
-	$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
42
+    $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
43 43
 }
44 44
 
45 45
 $children = array();
46 46
 
47 47
 function getChildren($parent) {
48 48
 
49
-	global $modx;
50
-	global $children;
51
-	global $deltime;
52
-
53
-	$rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'");
54
-		// the document has children documents, we'll need to delete those too
55
-		while ($row=$modx->db->getRow($rs)) {
56
-			$children[] = $row['id'];
57
-			getChildren($row['id']);
58
-			//echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
59
-		}
49
+    global $modx;
50
+    global $children;
51
+    global $deltime;
52
+
53
+    $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'");
54
+        // the document has children documents, we'll need to delete those too
55
+        while ($row=$modx->db->getRow($rs)) {
56
+            $children[] = $row['id'];
57
+            getChildren($row['id']);
58
+            //echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
59
+        }
60 60
 }
61 61
 
62 62
 getChildren($id);
63 63
 
64 64
 if(count($children)>0) {
65
-	$modx->db->update(
66
-		array(
67
-			'deleted'   => 0,
68
-			'deletedby' => 0,
69
-			'deletedon' => 0,
70
-		), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
65
+    $modx->db->update(
66
+        array(
67
+            'deleted'   => 0,
68
+            'deletedby' => 0,
69
+            'deletedon' => 0,
70
+        ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
71 71
 }
72 72
 //'undelete' the document.
73 73
 $modx->db->update(
74
-	array(
75
-		'deleted'   => 0,
76
-		'deletedby' => 0,
77
-		'deletedon' => 0,
78
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
74
+    array(
75
+        'deleted'   => 0,
76
+        'deletedby' => 0,
77
+        'deletedon' => 0,
78
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
79 79
 
80 80
 $modx->invokeEvent("OnDocFormUnDelete",
81 81
     array(
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'])? intval($_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'   => 1,
43
-		'pub_date'    => 0,
44
-		'unpub_date'  => 0,
45
-		'editedby'    => $modx->getLoginUserID(),
46
-		'editedon'    => time(),
47
-		'publishedby' => $modx->getLoginUserID(),
48
-		'publishedon' => time(),
49
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
41
+    array(
42
+        'published'   => 1,
43
+        'pub_date'    => 0,
44
+        'unpub_date'  => 0,
45
+        'editedby'    => $modx->getLoginUserID(),
46
+        'editedon'    => time(),
47
+        'publishedby' => $modx->getLoginUserID(),
48
+        'publishedon' => time(),
49
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
50 50
 
51 51
 // invoke OnDocPublished  event
52 52
 $modx->invokeEvent("OnDocPublished",array("docid"=>$id));
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->db->select('id', $modx->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->db->delete($modx->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/save_password.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('save_password')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = $_POST['id'];
@@ -11,26 +11,26 @@  discard block
 block discarded – undo
11 11
 $pass2 = $_POST['pass2'];
12 12
 
13 13
 if($pass1!=$pass2){
14
-	$modx->webAlertAndQuit("Passwords don't match!");
14
+    $modx->webAlertAndQuit("Passwords don't match!");
15 15
 }
16 16
 
17 17
 if(strlen($pass1)<6){
18
-	$modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters.");
18
+    $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters.");
19 19
 }
20 20
 
21 21
     $pass1 = $modx->htmlspecialchars($pass1, ENT_NOQUOTES);
22
-	$tbl_manager_users = $modx->getFullTableName('manager_users');
23
-	$uid = $modx->getLoginUserID();
24
-	$modx->loadExtension('phpass');
25
-	$f['password'] = $modx->phpass->HashPassword($pass1);
26
-	$modx->db->update($f,$tbl_manager_users,"id='{$uid}'");
22
+    $tbl_manager_users = $modx->getFullTableName('manager_users');
23
+    $uid = $modx->getLoginUserID();
24
+    $modx->loadExtension('phpass');
25
+    $f['password'] = $modx->phpass->HashPassword($pass1);
26
+    $modx->db->update($f,$tbl_manager_users,"id='{$uid}'");
27 27
 
28
-	// invoke OnManagerChangePassword event
29
-	$modx->invokeEvent('OnManagerChangePassword', array (
30
-		'userid' => $uid,
31
-		'username' => $_SESSION['mgrShortname'],
32
-		'userpassword' => $pass1
33
-	));
28
+    // invoke OnManagerChangePassword event
29
+    $modx->invokeEvent('OnManagerChangePassword', array (
30
+        'userid' => $uid,
31
+        'username' => $_SESSION['mgrShortname'],
32
+        'userpassword' => $pass1
33
+    ));
34 34
 
35 35
 $header="Location: index.php?a=2";
36 36
 header($header);
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'])? intval($_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->db->insert(
22
-	array(
23
-		'templatename'=>'',
24
-		'description'=>'',
25
-		'content'=>'',
26
-		'category'=>'',
27
-		), $modx->getFullTableName('site_templates'), // Insert into
28
-	"CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'templatename'=>'',
24
+        'description'=>'',
25
+        'content'=>'',
26
+        'category'=>'',
27
+        ), $modx->getFullTableName('site_templates'), // Insert into
28
+    "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // duplicate TV values
31 31
 $modx->db->insert(
32
-	array(
33
-		'tmplvarid'=>'',
34
-		'templateid'=>'',
35
-		'rank'=>'',
36
-		), $modx->getFullTableName('site_tmplvar_templates'), // Insert into
37
-	"tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
32
+    array(
33
+        'tmplvarid'=>'',
34
+        'templateid'=>'',
35
+        'rank'=>'',
36
+        ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into
37
+    "tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
38 38
 
39 39
 // Set the item name for logger
40 40
 $name = $modx->db->getValue($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -3,21 +3,21 @@  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'])? intval($_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
 // create globally unique identifiers (guid)
15 15
 function createGUID(){
16
-	srand((double)microtime()*1000000);
17
-	$r = rand() ;
18
-	$u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
19
-	$m = md5 ($u);
20
-	return $m;
16
+    srand((double)microtime()*1000000);
17
+    $r = rand() ;
18
+    $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
19
+    $m = md5 ($u);
20
+    return $m;
21 21
 }
22 22
 
23 23
 // count duplicates
@@ -28,40 +28,40 @@  discard block
 block discarded – undo
28 28
 
29 29
 // duplicate module
30 30
 $newid = $modx->db->insert(
31
-	array(
32
-		'name'=>'',
33
-		'description'=>'',
34
-		'disabled'=>'',
35
-		'category'=>'',
36
-		'wrap'=>'',
37
-		'icon'=>'',
38
-		'enable_resource'=>'',
39
-		'resourcefile'=>'',
40
-		'createdon'=>'',
41
-		'editedon'=>'',
42
-		'guid'=>'',
43
-		'enable_sharedparams'=>'',
44
-		'properties'=>'',
45
-		'modulecode'=>'',
46
-		), $modx->getFullTableName('site_modules'), // Insert into
47
-	"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->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
31
+    array(
32
+        'name'=>'',
33
+        'description'=>'',
34
+        'disabled'=>'',
35
+        'category'=>'',
36
+        'wrap'=>'',
37
+        'icon'=>'',
38
+        'enable_resource'=>'',
39
+        'resourcefile'=>'',
40
+        'createdon'=>'',
41
+        'editedon'=>'',
42
+        'guid'=>'',
43
+        'enable_sharedparams'=>'',
44
+        'properties'=>'',
45
+        'modulecode'=>'',
46
+        ), $modx->getFullTableName('site_modules'), // Insert into
47
+    "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->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
48 48
 
49 49
 // duplicate module dependencies
50 50
 $modx->db->insert(
51
-	array(
52
-		'module'=>'',
53
-		'resource'=>'',
54
-		'type'=>'',
55
-		), $modx->getFullTableName('site_module_depobj'), // Insert into
56
-	"'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
51
+    array(
52
+        'module'=>'',
53
+        'resource'=>'',
54
+        'type'=>'',
55
+        ), $modx->getFullTableName('site_module_depobj'), // Insert into
56
+    "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
57 57
 
58 58
 // duplicate module user group access
59 59
 $modx->db->insert(
60
-	array(
61
-		'module'=>'',
62
-		'usergroup'=>'',
63
-		), $modx->getFullTableName('site_module_access'), // Insert into
64
-	"'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
60
+    array(
61
+        'module'=>'',
62
+        'usergroup'=>'',
63
+        ), $modx->getFullTableName('site_module_access'), // Insert into
64
+    "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
65 65
 
66 66
 // Set the item name for logger
67 67
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/save_web_user.processor.php 1 patch
Indentation   +277 added lines, -277 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('save_web_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $tbl_web_users = $modx->getFullTableName('web_users');
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 $input = $_POST;
14 14
 foreach($input as $k => $v) {
15
-	if($k !== 'comment') {
16
-		$v = sanitize($v);
17
-	}
18
-	$input[$k] = $v;
15
+    if($k !== 'comment') {
16
+        $v = sanitize($v);
17
+    }
18
+    $input[$k] = $v;
19 19
 }
20 20
 
21 21
 $id = intval($input['id']);
@@ -51,80 +51,80 @@  discard block
 block discarded – undo
51 51
 
52 52
 // verify password
53 53
 if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
54
-	webAlertAndQuit("Password typed is mismatched");
54
+    webAlertAndQuit("Password typed is mismatched");
55 55
 }
56 56
 
57 57
 // verify email
58 58
 if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
59
-	webAlertAndQuit("E-mail address doesn't seem to be valid!");
59
+    webAlertAndQuit("E-mail address doesn't seem to be valid!");
60 60
 }
61 61
 
62 62
 switch($input['mode']) {
63
-	case '87' : // new user
64
-		// check if this user name already exist
65
-		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
-		$limit = $modx->db->getValue($rs);
67
-		if($limit > 0) {
68
-			webAlertAndQuit("User name is already in use!");
69
-		}
70
-
71
-		// check if the email address already exist
72
-		$rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
73
-		$limit = $modx->db->getValue($rs);
74
-		if($limit > 0) {
75
-			webAlertAndQuit("Email is already in use!");
76
-		}
77
-
78
-		// generate a new password for this user
79
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
-			if(strlen($specifiedpassword) < 6) {
81
-				webAlertAndQuit("Password is too short!");
82
-			} else {
83
-				$newpassword = $specifiedpassword;
84
-			}
85
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
86
-			webAlertAndQuit("You didn't specify a password for this user!");
87
-		} elseif($passwordgenmethod == 'g') {
88
-			$newpassword = generate_password(8);
89
-		} else {
90
-			webAlertAndQuit("No password generation method specified!");
91
-		}
92
-
93
-		// invoke OnBeforeWUsrFormSave event
94
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
95
-			"mode" => "new",
96
-		));
97
-
98
-		// create the user account
99
-		$field = array();
100
-		$field['username'] = $esc_newusername;
101
-		$field['password'] = md5($newpassword);
102
-		$internalKey = $modx->db->insert($field, $tbl_web_users);
103
-
104
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
105
-		$field = $modx->db->escape($field);
106
-		$modx->db->insert($field, $tbl_web_user_attributes);
107
-
108
-		// Save User Settings
109
-		saveUserSettings($internalKey);
110
-
111
-		// Set the item name for logger
112
-		$_SESSION['itemname'] = $newusername;
113
-
114
-		/*******************************************************************************/
115
-		// put the user in the user_groups he/ she should be in
116
-		// first, check that up_perms are switched on!
117
-		if($use_udperms == 1) {
118
-			if(!empty($user_groups)) {
119
-				for($i = 0; $i < count($user_groups); $i++) {
120
-					$f = array();
121
-					$f['webgroup'] = intval($user_groups[$i]);
122
-					$f['webuser'] = $internalKey;
123
-					$modx->db->insert($f, $tbl_web_groups);
124
-				}
125
-			}
126
-		}
127
-		// end of user_groups stuff!
63
+    case '87' : // new user
64
+        // check if this user name already exist
65
+        $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
+        $limit = $modx->db->getValue($rs);
67
+        if($limit > 0) {
68
+            webAlertAndQuit("User name is already in use!");
69
+        }
70
+
71
+        // check if the email address already exist
72
+        $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
73
+        $limit = $modx->db->getValue($rs);
74
+        if($limit > 0) {
75
+            webAlertAndQuit("Email is already in use!");
76
+        }
77
+
78
+        // generate a new password for this user
79
+        if($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
+            if(strlen($specifiedpassword) < 6) {
81
+                webAlertAndQuit("Password is too short!");
82
+            } else {
83
+                $newpassword = $specifiedpassword;
84
+            }
85
+        } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
86
+            webAlertAndQuit("You didn't specify a password for this user!");
87
+        } elseif($passwordgenmethod == 'g') {
88
+            $newpassword = generate_password(8);
89
+        } else {
90
+            webAlertAndQuit("No password generation method specified!");
91
+        }
92
+
93
+        // invoke OnBeforeWUsrFormSave event
94
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
95
+            "mode" => "new",
96
+        ));
97
+
98
+        // create the user account
99
+        $field = array();
100
+        $field['username'] = $esc_newusername;
101
+        $field['password'] = md5($newpassword);
102
+        $internalKey = $modx->db->insert($field, $tbl_web_users);
103
+
104
+        $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
105
+        $field = $modx->db->escape($field);
106
+        $modx->db->insert($field, $tbl_web_user_attributes);
107
+
108
+        // Save User Settings
109
+        saveUserSettings($internalKey);
110
+
111
+        // Set the item name for logger
112
+        $_SESSION['itemname'] = $newusername;
113
+
114
+        /*******************************************************************************/
115
+        // put the user in the user_groups he/ she should be in
116
+        // first, check that up_perms are switched on!
117
+        if($use_udperms == 1) {
118
+            if(!empty($user_groups)) {
119
+                for($i = 0; $i < count($user_groups); $i++) {
120
+                    $f = array();
121
+                    $f['webgroup'] = intval($user_groups[$i]);
122
+                    $f['webuser'] = $internalKey;
123
+                    $modx->db->insert($f, $tbl_web_groups);
124
+                }
125
+            }
126
+        }
127
+        // end of user_groups stuff!
128 128
 
129 129
         // invoke OnWebSaveUser event
130 130
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -142,26 +142,26 @@  discard block
 block discarded – undo
142 142
             "id" => $internalKey
143 143
         ));
144 144
 
145
-		if($passwordnotifymethod == 'e') {
146
-			sendMailMessage($email, $newusername, $newpassword, $fullname);
147
-			if($input['stay'] != '') {
148
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
149
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
150
-				header($header);
151
-			} else {
152
-				$header = "Location: index.php?a=99&r=2";
153
-				header($header);
154
-			}
155
-		} else {
156
-			if($input['stay'] != '') {
157
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
158
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
159
-			} else {
160
-				$stayUrl = "index.php?a=99&r=2";
161
-			}
162
-
163
-			include_once "header.inc.php";
164
-			?>
145
+        if($passwordnotifymethod == 'e') {
146
+            sendMailMessage($email, $newusername, $newpassword, $fullname);
147
+            if($input['stay'] != '') {
148
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
149
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
150
+                header($header);
151
+            } else {
152
+                $header = "Location: index.php?a=99&r=2";
153
+                header($header);
154
+            }
155
+        } else {
156
+            if($input['stay'] != '') {
157
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
158
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
159
+            } else {
160
+                $stayUrl = "index.php?a=99&r=2";
161
+            }
162
+
163
+            include_once "header.inc.php";
164
+            ?>
165 165
 
166 166
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
167 167
 
@@ -183,84 +183,84 @@  discard block
 block discarded – undo
183 183
 			</div>
184 184
 			<?php
185 185
 
186
-			include_once "footer.inc.php";
187
-		}
188
-		break;
189
-	case '88' : // edit user
190
-		// generate a new password for this user
191
-		if($genpassword == 1) {
192
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
-				if(strlen($specifiedpassword) < 6) {
194
-					webAlertAndQuit("Password is too short!");
195
-				} else {
196
-					$newpassword = $specifiedpassword;
197
-				}
198
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
199
-				webAlertAndQuit("You didn't specify a password for this user!");
200
-			} elseif($passwordgenmethod == 'g') {
201
-				$newpassword = generate_password(8);
202
-			} else {
203
-				webAlertAndQuit("No password generation method specified!");
204
-			}
205
-		}
206
-		if($passwordnotifymethod == 'e') {
207
-			sendMailMessage($email, $newusername, $newpassword, $fullname);
208
-		}
209
-
210
-		// check if the username already exist
211
-		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
212
-		$limit = $modx->db->getValue($rs);
213
-		if($limit > 0) {
214
-			webAlertAndQuit("User name is already in use!");
215
-		}
216
-
217
-		// check if the email address already exists
218
-		$rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
219
-		$limit = $modx->db->getValue($rs);
220
-		if($limit > 0) {
221
-			webAlertAndQuit("Email is already in use!");
222
-		}
223
-
224
-		// invoke OnBeforeWUsrFormSave event
225
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
226
-			"mode" => "upd",
227
-			"id" => $id
228
-		));
229
-
230
-		// update user name and password
231
-		$field = array();
232
-		$field['username'] = $esc_newusername;
233
-		if($genpassword == 1) {
234
-			$field['password'] = md5($newpassword);
235
-		}
236
-		$modx->db->update($field, $tbl_web_users, "id='{$id}'");
237
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
238
-		$field = $modx->db->escape($field);
239
-		$modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
240
-
241
-		// Save User Settings
242
-		saveUserSettings($id);
243
-
244
-		// Set the item name for logger
245
-		$_SESSION['itemname'] = $newusername;
246
-
247
-		/*******************************************************************************/
248
-		// put the user in the user_groups he/ she should be in
249
-		// first, check that up_perms are switched on!
250
-		if($use_udperms == 1) {
251
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
252
-			$modx->db->delete($tbl_web_groups, "webuser='{$id}'");
253
-			if(!empty($user_groups)) {
254
-				for($i = 0; $i < count($user_groups); $i++) {
255
-					$field = array();
256
-					$field['webgroup'] = intval($user_groups[$i]);
257
-					$field['webuser'] = $id;
258
-					$modx->db->insert($field, $tbl_web_groups);
259
-				}
260
-			}
261
-		}
262
-		// end of user_groups stuff!
263
-		/*******************************************************************************/
186
+            include_once "footer.inc.php";
187
+        }
188
+        break;
189
+    case '88' : // edit user
190
+        // generate a new password for this user
191
+        if($genpassword == 1) {
192
+            if($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
+                if(strlen($specifiedpassword) < 6) {
194
+                    webAlertAndQuit("Password is too short!");
195
+                } else {
196
+                    $newpassword = $specifiedpassword;
197
+                }
198
+            } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
199
+                webAlertAndQuit("You didn't specify a password for this user!");
200
+            } elseif($passwordgenmethod == 'g') {
201
+                $newpassword = generate_password(8);
202
+            } else {
203
+                webAlertAndQuit("No password generation method specified!");
204
+            }
205
+        }
206
+        if($passwordnotifymethod == 'e') {
207
+            sendMailMessage($email, $newusername, $newpassword, $fullname);
208
+        }
209
+
210
+        // check if the username already exist
211
+        $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
212
+        $limit = $modx->db->getValue($rs);
213
+        if($limit > 0) {
214
+            webAlertAndQuit("User name is already in use!");
215
+        }
216
+
217
+        // check if the email address already exists
218
+        $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
219
+        $limit = $modx->db->getValue($rs);
220
+        if($limit > 0) {
221
+            webAlertAndQuit("Email is already in use!");
222
+        }
223
+
224
+        // invoke OnBeforeWUsrFormSave event
225
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
226
+            "mode" => "upd",
227
+            "id" => $id
228
+        ));
229
+
230
+        // update user name and password
231
+        $field = array();
232
+        $field['username'] = $esc_newusername;
233
+        if($genpassword == 1) {
234
+            $field['password'] = md5($newpassword);
235
+        }
236
+        $modx->db->update($field, $tbl_web_users, "id='{$id}'");
237
+        $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
238
+        $field = $modx->db->escape($field);
239
+        $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
240
+
241
+        // Save User Settings
242
+        saveUserSettings($id);
243
+
244
+        // Set the item name for logger
245
+        $_SESSION['itemname'] = $newusername;
246
+
247
+        /*******************************************************************************/
248
+        // put the user in the user_groups he/ she should be in
249
+        // first, check that up_perms are switched on!
250
+        if($use_udperms == 1) {
251
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
252
+            $modx->db->delete($tbl_web_groups, "webuser='{$id}'");
253
+            if(!empty($user_groups)) {
254
+                for($i = 0; $i < count($user_groups); $i++) {
255
+                    $field = array();
256
+                    $field['webgroup'] = intval($user_groups[$i]);
257
+                    $field['webuser'] = $id;
258
+                    $modx->db->insert($field, $tbl_web_groups);
259
+                }
260
+            }
261
+        }
262
+        // end of user_groups stuff!
263
+        /*******************************************************************************/
264 264
 
265 265
         // invoke OnWebSaveUser event
266 266
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
             "id" => $id
290 290
         ));
291 291
 
292
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
293
-			if($input['stay'] != '') {
294
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
295
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
296
-			} else {
297
-				$stayUrl = "index.php?a=99&r=2";
298
-			}
292
+        if($genpassword == 1 && $passwordnotifymethod == 's') {
293
+            if($input['stay'] != '') {
294
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
295
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
296
+            } else {
297
+                $stayUrl = "index.php?a=99&r=2";
298
+            }
299 299
 
300
-			include_once "header.inc.php";
301
-			?>
300
+            include_once "header.inc.php";
301
+            ?>
302 302
 
303 303
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
304 304
 
@@ -318,124 +318,124 @@  discard block
 block discarded – undo
318 318
 			</div>
319 319
 			<?php
320 320
 
321
-			include_once "footer.inc.php";
322
-		} else {
323
-			if($input['stay'] != '') {
324
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
325
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
326
-				header($header);
327
-			} else {
328
-				$header = "Location: index.php?a=99&r=2";
329
-				header($header);
330
-			}
331
-		}
332
-		break;
333
-	default :
334
-		webAlertAndQuit("No operation set in request.");
321
+            include_once "footer.inc.php";
322
+        } else {
323
+            if($input['stay'] != '') {
324
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
325
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
326
+                header($header);
327
+            } else {
328
+                $header = "Location: index.php?a=99&r=2";
329
+                header($header);
330
+            }
331
+        }
332
+        break;
333
+    default :
334
+        webAlertAndQuit("No operation set in request.");
335 335
 }
336 336
 
337 337
 // in case any plugins include a quoted_printable function
338 338
 function save_user_quoted_printable($string) {
339
-	$crlf = "\n";
340
-	$string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf;
341
-	$f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e';
342
-	$r[] = "'=' . sprintf('%02X', ord('\\1'))";
343
-	$f[] = '/([\011\040])' . $crlf . '/e';
344
-	$r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'";
345
-	$string = preg_replace($f, $r, $string);
346
-	return trim(wordwrap($string, 70, ' =' . $crlf));
339
+    $crlf = "\n";
340
+    $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf;
341
+    $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e';
342
+    $r[] = "'=' . sprintf('%02X', ord('\\1'))";
343
+    $f[] = '/([\011\040])' . $crlf . '/e';
344
+    $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'";
345
+    $string = preg_replace($f, $r, $string);
346
+    return trim(wordwrap($string, 70, ' =' . $crlf));
347 347
 }
348 348
 
349 349
 // Send an email to the user
350 350
 function sendMailMessage($email, $uid, $pwd, $ufn) {
351
-	global $modx, $_lang, $websignupemail_message;
352
-	global $emailsubject, $emailsender;
353
-	global $site_name, $site_url;
354
-	$message = sprintf($websignupemail_message, $uid, $pwd); // use old method
355
-	// replace placeholders
356
-	$message = str_replace("[+uid+]", $uid, $message);
357
-	$message = str_replace("[+pwd+]", $pwd, $message);
358
-	$message = str_replace("[+ufn+]", $ufn, $message);
359
-	$message = str_replace("[+sname+]", $site_name, $message);
360
-	$message = str_replace("[+saddr+]", $emailsender, $message);
361
-	$message = str_replace("[+semail+]", $emailsender, $message);
362
-	$message = str_replace("[+surl+]", $site_url, $message);
363
-
364
-	$param = array();
365
-	$param['from'] = "{$site_name}<{$emailsender}>";
366
-	$param['subject'] = $emailsubject;
367
-	$param['body'] = $message;
368
-	$param['to'] = $email;
369
-	$param['type'] = 'text';
370
-	$rs = $modx->sendmail($param);
371
-	if(!$rs) {
372
-		$modx->manager->saveFormValues();
373
-		$modx->messageQuit("{$email} - {$_lang['error_sending_email']}");
374
-	}
351
+    global $modx, $_lang, $websignupemail_message;
352
+    global $emailsubject, $emailsender;
353
+    global $site_name, $site_url;
354
+    $message = sprintf($websignupemail_message, $uid, $pwd); // use old method
355
+    // replace placeholders
356
+    $message = str_replace("[+uid+]", $uid, $message);
357
+    $message = str_replace("[+pwd+]", $pwd, $message);
358
+    $message = str_replace("[+ufn+]", $ufn, $message);
359
+    $message = str_replace("[+sname+]", $site_name, $message);
360
+    $message = str_replace("[+saddr+]", $emailsender, $message);
361
+    $message = str_replace("[+semail+]", $emailsender, $message);
362
+    $message = str_replace("[+surl+]", $site_url, $message);
363
+
364
+    $param = array();
365
+    $param['from'] = "{$site_name}<{$emailsender}>";
366
+    $param['subject'] = $emailsubject;
367
+    $param['body'] = $message;
368
+    $param['to'] = $email;
369
+    $param['type'] = 'text';
370
+    $rs = $modx->sendmail($param);
371
+    if(!$rs) {
372
+        $modx->manager->saveFormValues();
373
+        $modx->messageQuit("{$email} - {$_lang['error_sending_email']}");
374
+    }
375 375
 }
376 376
 
377 377
 // Save User Settings
378 378
 function saveUserSettings($id) {
379
-	global $modx;
380
-	$tbl_web_user_settings = $modx->getFullTableName('web_user_settings');
381
-
382
-	$settings = array(
383
-		"login_home",
384
-		"allowed_ip",
385
-		"allowed_days"
386
-	);
387
-
388
-	$modx->db->delete($tbl_web_user_settings, "webuser='{$id}'");
389
-
390
-	foreach($settings as $n) {
391
-		$vl = $_POST[$n];
392
-		if(is_array($vl)) {
393
-			$vl = implode(",", $vl);
394
-		}
395
-		if($vl != '') {
396
-			$f = array();
397
-			$f['webuser'] = $id;
398
-			$f['setting_name'] = $n;
399
-			$f['setting_value'] = $vl;
400
-			$f = $modx->db->escape($f);
401
-			$modx->db->insert($f, $tbl_web_user_settings);
402
-		}
403
-	}
379
+    global $modx;
380
+    $tbl_web_user_settings = $modx->getFullTableName('web_user_settings');
381
+
382
+    $settings = array(
383
+        "login_home",
384
+        "allowed_ip",
385
+        "allowed_days"
386
+    );
387
+
388
+    $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'");
389
+
390
+    foreach($settings as $n) {
391
+        $vl = $_POST[$n];
392
+        if(is_array($vl)) {
393
+            $vl = implode(",", $vl);
394
+        }
395
+        if($vl != '') {
396
+            $f = array();
397
+            $f['webuser'] = $id;
398
+            $f['setting_name'] = $n;
399
+            $f['setting_value'] = $vl;
400
+            $f = $modx->db->escape($f);
401
+            $modx->db->insert($f, $tbl_web_user_settings);
402
+        }
403
+    }
404 404
 }
405 405
 
406 406
 // Web alert -  sends an alert to web browser
407 407
 function webAlertAndQuit($msg) {
408
-	global $id, $modx;
409
-	$mode = $_POST['mode'];
410
-	$modx->manager->saveFormValues($mode);
411
-	$modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : ''));
408
+    global $id, $modx;
409
+    $mode = $_POST['mode'];
410
+    $modx->manager->saveFormValues($mode);
411
+    $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : ''));
412 412
 }
413 413
 
414 414
 // Generate password
415 415
 function generate_password($length = 10) {
416
-	$allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
417
-	$ps_len = strlen($allowable_characters);
418
-	mt_srand((double) microtime() * 1000000);
419
-	$pass = "";
420
-	for($i = 0; $i < $length; $i++) {
421
-		$pass .= $allowable_characters[mt_rand(0, $ps_len - 1)];
422
-	}
423
-	return $pass;
416
+    $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
417
+    $ps_len = strlen($allowable_characters);
418
+    mt_srand((double) microtime() * 1000000);
419
+    $pass = "";
420
+    for($i = 0; $i < $length; $i++) {
421
+        $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)];
422
+    }
423
+    return $pass;
424 424
 }
425 425
 
426 426
 function sanitize($str = '', $safecount = 0) {
427
-	global $modx;
428
-	$safecount++;
429
-	if(1000 < $safecount) {
430
-		exit("error too many loops '{$safecount}'");
431
-	}
432
-	if(is_array($str)) {
433
-		foreach($str as $i => $v) {
434
-			$str[$i] = sanitize($v, $safecount);
435
-		}
436
-	} else {
437
-		// $str = strip_tags($str); // LEAVE < and > intact
438
-		$str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']);
439
-	}
440
-	return $str;
427
+    global $modx;
428
+    $safecount++;
429
+    if(1000 < $safecount) {
430
+        exit("error too many loops '{$safecount}'");
431
+    }
432
+    if(is_array($str)) {
433
+        foreach($str as $i => $v) {
434
+            $str[$i] = sanitize($v, $safecount);
435
+        }
436
+    } else {
437
+        // $str = strip_tags($str); // LEAVE < and > intact
438
+        $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']);
439
+    }
440
+    return $str;
441 441
 }
Please login to merge, or discard this patch.