@@ -4,8 +4,8 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!$modx->hasPermission('delete_plugin')) { |
7 | - $e->setError(3); |
|
8 | - $e->dumpError(); |
|
7 | + $e->setError(3); |
|
8 | + $e->dumpError(); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $tbl_site_plugins = $modx->getFullTablename('site_plugins'); |
@@ -3,7 +3,7 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -3,7 +3,7 @@ discard block |
||
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 |
||
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); |
@@ -3,7 +3,7 @@ |
||
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('settings')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $modx->db->truncate($modx->getFullTableName('manager_log')); |
@@ -3,7 +3,7 @@ discard block |
||
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 |
||
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->db->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->getFullTableName('user_messages')); |
|
19 | + if($userid==0) { |
|
20 | + $modx->webAlertAndQuit($_lang["error_no_user_selected"]); |
|
21 | + } |
|
22 | + $modx->db->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->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->db->select('internalKey', $modx->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
39 | - while ($row=$modx->db->getRow($rs)) { |
|
40 | - $modx->db->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->getFullTableName('user_messages')); |
|
50 | - } |
|
35 | + if($groupid==0) { |
|
36 | + $modx->webAlertAndQuit($_lang["error_no_group_selected"]); |
|
37 | + } |
|
38 | + $rs = $modx->db->select('internalKey', $modx->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
39 | + while ($row=$modx->db->getRow($rs)) { |
|
40 | + $modx->db->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->getFullTableName('user_messages')); |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | if($sendto=='a') { |
55 | - $rs = $modx->db->select('id', $modx->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'"); |
|
56 | - while ($row=$modx->db->getRow($rs)) { |
|
57 | - $modx->db->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->getFullTableName('user_messages')); |
|
67 | - } |
|
55 | + $rs = $modx->db->select('id', $modx->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'"); |
|
56 | + while ($row=$modx->db->getRow($rs)) { |
|
57 | + $modx->db->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->getFullTableName('user_messages')); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $header = "Location: index.php?a=10"; |
@@ -1,12 +1,12 @@ discard block |
||
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 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | 8 | if(is_array($evtOut)) { |
9 | - echo implode("\n", $evtOut); |
|
9 | + echo implode("\n", $evtOut); |
|
10 | 10 | } |
11 | 11 | ?> |
12 | 12 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | <div id="treeHolder"> |
54 | 54 | <?php |
55 | - // invoke OnManagerTreePrerender event |
|
56 | - $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->db->escape($_REQUEST)); |
|
57 | - if(is_array($evtOut)) { |
|
58 | - echo implode("\n", $evtOut); |
|
59 | - } |
|
60 | - ?> |
|
55 | + // invoke OnManagerTreePrerender event |
|
56 | + $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->db->escape($_REQUEST)); |
|
57 | + if(is_array($evtOut)) { |
|
58 | + echo implode("\n", $evtOut); |
|
59 | + } |
|
60 | + ?> |
|
61 | 61 | <div id="node0" class="rootNode"><a class="node" onclick="modx.tree.treeAction(event, 0)" data-id="0" data-title-esc="<?php $site_name = htmlspecialchars($site_name, ENT_QUOTES, $modx->config['modx_charset']); |
62 | - echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
62 | + echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
63 | 63 | <div id="treeloader"><i class="fa fa-cog fa-spin fa-3x fa-fw"></i></div> |
64 | 64 | </div> |
65 | 65 | <div id="treeRoot"></div> |
66 | 66 | <?php |
67 | - // invoke OnManagerTreeRender event |
|
68 | - $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->db->escape($_REQUEST)); |
|
69 | - if(is_array($evtOut)) { |
|
70 | - echo implode("\n", $evtOut); |
|
71 | - } |
|
72 | - ?> |
|
67 | + // invoke OnManagerTreeRender event |
|
68 | + $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->db->escape($_REQUEST)); |
|
69 | + if(is_array($evtOut)) { |
|
70 | + echo implode("\n", $evtOut); |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | </div> |
74 | 74 | </div> |
@@ -4,141 +4,141 @@ |
||
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | 6 | class SqlParser { |
7 | - public $host; |
|
8 | - public $dbname; |
|
9 | - public $prefix; |
|
10 | - public $user; |
|
11 | - public $password; |
|
12 | - public $mysqlErrors; |
|
13 | - public $conn; |
|
14 | - public $installFailed; |
|
15 | - public $sitename; |
|
16 | - public $adminname; |
|
17 | - public $adminemail; |
|
18 | - public $adminpass; |
|
19 | - public $managerlanguage; |
|
20 | - public $mode; |
|
21 | - public $fileManagerPath; |
|
22 | - public $imgPath; |
|
23 | - public $imgUrl; |
|
24 | - public $dbMODx; |
|
25 | - public $dbVersion; |
|
7 | + public $host; |
|
8 | + public $dbname; |
|
9 | + public $prefix; |
|
10 | + public $user; |
|
11 | + public $password; |
|
12 | + public $mysqlErrors; |
|
13 | + public $conn; |
|
14 | + public $installFailed; |
|
15 | + public $sitename; |
|
16 | + public $adminname; |
|
17 | + public $adminemail; |
|
18 | + public $adminpass; |
|
19 | + public $managerlanguage; |
|
20 | + public $mode; |
|
21 | + public $fileManagerPath; |
|
22 | + public $imgPath; |
|
23 | + public $imgUrl; |
|
24 | + public $dbMODx; |
|
25 | + public $dbVersion; |
|
26 | 26 | public $connection_charset; |
27 | 27 | public $connection_method; |
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | public $autoTemplateLogic; |
30 | 30 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | - $this->host = $host; |
|
33 | - $this->dbname = $db; |
|
34 | - $this->prefix = $prefix; |
|
35 | - $this->user = $user; |
|
36 | - $this->password = $password; |
|
37 | - $this->adminpass = $adminpass; |
|
38 | - $this->adminname = $adminname; |
|
39 | - $this->adminemail = $adminemail; |
|
40 | - $this->connection_charset = $connection_charset; |
|
41 | - $this->connection_method = $connection_method; |
|
42 | - $this->ignoreDuplicateErrors = false; |
|
43 | - $this->managerlanguage = $managerlanguage; |
|
31 | + public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | + $this->host = $host; |
|
33 | + $this->dbname = $db; |
|
34 | + $this->prefix = $prefix; |
|
35 | + $this->user = $user; |
|
36 | + $this->password = $password; |
|
37 | + $this->adminpass = $adminpass; |
|
38 | + $this->adminname = $adminname; |
|
39 | + $this->adminemail = $adminemail; |
|
40 | + $this->connection_charset = $connection_charset; |
|
41 | + $this->connection_method = $connection_method; |
|
42 | + $this->ignoreDuplicateErrors = false; |
|
43 | + $this->managerlanguage = $managerlanguage; |
|
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - public function connect() { |
|
48 | - $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
49 | - mysqli_select_db($this->conn, $this->dbname); |
|
50 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
47 | + public function connect() { |
|
48 | + $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
49 | + mysqli_select_db($this->conn, $this->dbname); |
|
50 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
51 | 51 | |
52 | - $this->dbVersion = 3.23; // assume version 3.23 |
|
53 | - if(function_exists("mysqli_get_server_info")) { |
|
54 | - $ver = mysqli_get_server_info($this->conn); |
|
55 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
56 | - $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
57 | - } |
|
52 | + $this->dbVersion = 3.23; // assume version 3.23 |
|
53 | + if(function_exists("mysqli_get_server_info")) { |
|
54 | + $ver = mysqli_get_server_info($this->conn); |
|
55 | + $this->dbMODx = version_compare($ver,"4.0.2"); |
|
56 | + $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
57 | + } |
|
58 | 58 | |
59 | 59 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | public function process($filename) { |
63 | - global $custom_placeholders; |
|
64 | - |
|
65 | - // check to make sure file exists |
|
66 | - if (!file_exists($filename)) { |
|
67 | - $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
68 | - $this->installFailed = true ; |
|
69 | - return false; |
|
70 | - } |
|
71 | - |
|
72 | - $fh = fopen($filename, 'r'); |
|
73 | - $idata = ''; |
|
74 | - |
|
75 | - while (!feof($fh)) { |
|
76 | - $idata .= fread($fh, 1024); |
|
77 | - } |
|
78 | - |
|
79 | - fclose($fh); |
|
80 | - $idata = str_replace("\r", '', $idata); |
|
81 | - |
|
82 | - // check if in upgrade mode |
|
83 | - if ($this->mode === 'upd') { |
|
84 | - // remove non-upgradeable parts |
|
85 | - $s = strpos($idata,'non-upgrade-able[['); |
|
86 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | - if($s && $e) { |
|
88 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
63 | + global $custom_placeholders; |
|
64 | + |
|
65 | + // check to make sure file exists |
|
66 | + if (!file_exists($filename)) { |
|
67 | + $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
68 | + $this->installFailed = true ; |
|
69 | + return false; |
|
70 | + } |
|
71 | + |
|
72 | + $fh = fopen($filename, 'r'); |
|
73 | + $idata = ''; |
|
74 | + |
|
75 | + while (!feof($fh)) { |
|
76 | + $idata .= fread($fh, 1024); |
|
77 | + } |
|
78 | + |
|
79 | + fclose($fh); |
|
80 | + $idata = str_replace("\r", '', $idata); |
|
81 | + |
|
82 | + // check if in upgrade mode |
|
83 | + if ($this->mode === 'upd') { |
|
84 | + // remove non-upgradeable parts |
|
85 | + $s = strpos($idata,'non-upgrade-able[['); |
|
86 | + $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | + if($s && $e) { |
|
88 | + $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
89 | 89 | } |
90 | - } |
|
91 | - |
|
92 | - // replace {} tags |
|
93 | - $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
94 | - $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
95 | - $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
96 | - $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
97 | - $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
98 | - $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
99 | - $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
100 | - $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
101 | - $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
102 | - /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
103 | - |
|
104 | - // Replace custom placeholders |
|
105 | - foreach($custom_placeholders as $key=>$val) { |
|
106 | - if (strpos($idata, '{'.$key.'}') !== false) { |
|
107 | - $idata = str_replace('{'.$key.'}', $val, $idata); |
|
108 | - } |
|
109 | - } |
|
110 | - |
|
111 | - $sql_array = explode("\n\n", $idata); |
|
112 | - |
|
113 | - $num = 0; |
|
114 | - foreach($sql_array as $sql_entry) { |
|
115 | - $sql_do = trim($sql_entry, "\r\n; "); |
|
116 | - |
|
117 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
118 | - |
|
119 | - // strip out comments and \n for mysql 3.x |
|
120 | - if ($this->dbVersion <4.0) { |
|
121 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
122 | - $sql_do = str_replace('\r', "", $sql_do); |
|
123 | - $sql_do = str_replace('\n', "", $sql_do); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - $num = $num + 1; |
|
128 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
129 | - if(mysqli_error($this->conn)) { |
|
130 | - // Ignore duplicate and drop errors - Raymond |
|
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
133 | - } |
|
134 | - // End Ignore duplicate |
|
135 | - $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
136 | - $this->installFailed = true; |
|
137 | - } |
|
138 | - } |
|
139 | - } |
|
90 | + } |
|
91 | + |
|
92 | + // replace {} tags |
|
93 | + $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
94 | + $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
95 | + $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
96 | + $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
97 | + $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
98 | + $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
99 | + $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
100 | + $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
101 | + $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
102 | + /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
103 | + |
|
104 | + // Replace custom placeholders |
|
105 | + foreach($custom_placeholders as $key=>$val) { |
|
106 | + if (strpos($idata, '{'.$key.'}') !== false) { |
|
107 | + $idata = str_replace('{'.$key.'}', $val, $idata); |
|
108 | + } |
|
109 | + } |
|
110 | + |
|
111 | + $sql_array = explode("\n\n", $idata); |
|
112 | + |
|
113 | + $num = 0; |
|
114 | + foreach($sql_array as $sql_entry) { |
|
115 | + $sql_do = trim($sql_entry, "\r\n; "); |
|
116 | + |
|
117 | + if (preg_match('/^\#/', $sql_do)) continue; |
|
118 | + |
|
119 | + // strip out comments and \n for mysql 3.x |
|
120 | + if ($this->dbVersion <4.0) { |
|
121 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
122 | + $sql_do = str_replace('\r', "", $sql_do); |
|
123 | + $sql_do = str_replace('\n', "", $sql_do); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + $num = $num + 1; |
|
128 | + if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
129 | + if(mysqli_error($this->conn)) { |
|
130 | + // Ignore duplicate and drop errors - Raymond |
|
131 | + if ($this->ignoreDuplicateErrors){ |
|
132 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
133 | + } |
|
134 | + // End Ignore duplicate |
|
135 | + $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
136 | + $this->installFailed = true; |
|
137 | + } |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | public function close() { |
142 | - mysqli_close($this->conn); |
|
143 | - } |
|
142 | + mysqli_close($this->conn); |
|
143 | + } |
|
144 | 144 | } |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 12: |
|
8 | - if(!$modx->hasPermission('edit_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 11: |
|
13 | - if(!$modx->hasPermission('new_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 12: |
|
8 | + if(!$modx->hasPermission('edit_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 11: |
|
13 | + if(!$modx->hasPermission('new_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -23,75 +23,75 @@ discard block |
||
23 | 23 | // check to see the snippet editor isn't locked |
24 | 24 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
25 | 25 | if($username = $modx->db->getValue($rs)) { |
26 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
26 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
27 | 27 | } |
28 | 28 | // end check for lock |
29 | 29 | |
30 | 30 | if($modx->manager->action == '12') { |
31 | - // get user attribute |
|
32 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
33 | - $userdata = $modx->db->getRow($rs); |
|
34 | - if(!$userdata) { |
|
35 | - $modx->webAlertAndQuit("No user returned!"); |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - // get user settings |
|
40 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'"); |
|
41 | - $usersettings = array(); |
|
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | - // manually extract so that user display settings are not overwritten |
|
44 | - foreach($usersettings as $k => $v) { |
|
45 | - if($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | - ${$k} = $v; |
|
47 | - } |
|
48 | - } |
|
49 | - |
|
50 | - // get user name |
|
51 | - $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'"); |
|
52 | - $usernamedata = $modx->db->getRow($rs); |
|
53 | - if(!$usernamedata) { |
|
54 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
55 | - } |
|
56 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
31 | + // get user attribute |
|
32 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
33 | + $userdata = $modx->db->getRow($rs); |
|
34 | + if(!$userdata) { |
|
35 | + $modx->webAlertAndQuit("No user returned!"); |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + // get user settings |
|
40 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'"); |
|
41 | + $usersettings = array(); |
|
42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | + // manually extract so that user display settings are not overwritten |
|
44 | + foreach($usersettings as $k => $v) { |
|
45 | + if($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | + ${$k} = $v; |
|
47 | + } |
|
48 | + } |
|
49 | + |
|
50 | + // get user name |
|
51 | + $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'"); |
|
52 | + $usernamedata = $modx->db->getRow($rs); |
|
53 | + if(!$usernamedata) { |
|
54 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
55 | + } |
|
56 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
57 | 57 | } else { |
58 | - $userdata = array(); |
|
59 | - $usersettings = array(); |
|
60 | - $usernamedata = array(); |
|
61 | - $_SESSION['itemname'] = $_lang["new_user"]; |
|
58 | + $userdata = array(); |
|
59 | + $usersettings = array(); |
|
60 | + $usernamedata = array(); |
|
61 | + $_SESSION['itemname'] = $_lang["new_user"]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
65 | 65 | foreach($userdata as $key => $val) { |
66 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
66 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
67 | 67 | }; |
68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
69 | 69 | |
70 | 70 | // restore saved form |
71 | 71 | $formRestored = false; |
72 | 72 | if($modx->manager->hasFormValues()) { |
73 | - $modx->manager->loadFormValues(); |
|
74 | - // restore post values |
|
75 | - $userdata = array_merge($userdata, $_POST); |
|
76 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
77 | - $usernamedata['username'] = $userdata['newusername']; |
|
78 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
79 | - $usersettings = array_merge($usersettings, $userdata); |
|
80 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
81 | - extract($usersettings, EXTR_OVERWRITE); |
|
73 | + $modx->manager->loadFormValues(); |
|
74 | + // restore post values |
|
75 | + $userdata = array_merge($userdata, $_POST); |
|
76 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
77 | + $usernamedata['username'] = $userdata['newusername']; |
|
78 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
79 | + $usersettings = array_merge($usersettings, $userdata); |
|
80 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
81 | + extract($usersettings, EXTR_OVERWRITE); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // include the country list language file |
85 | 85 | $_country_lang = array(); |
86 | 86 | include_once "lang/country/english_country.inc.php"; |
87 | 87 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
88 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
89 | 89 | } |
90 | 90 | asort($_country_lang); |
91 | 91 | |
92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
93 | 93 | if($which_browser == 'default') { |
94 | - $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
94 | + $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
95 | 95 | } |
96 | 96 | ?> |
97 | 97 | <script type="text/javascript"> |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | <form action="index.php?a=32" method="post" name="userform"> |
202 | 202 | <?php |
203 | 203 | |
204 | - // invoke OnUserFormPrerender event |
|
205 | - $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
206 | - "id" => $user |
|
207 | - )); |
|
208 | - if(is_array($evtOut)) { |
|
209 | - echo implode("", $evtOut); |
|
210 | - } |
|
211 | - ?> |
|
204 | + // invoke OnUserFormPrerender event |
|
205 | + $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
206 | + "id" => $user |
|
207 | + )); |
|
208 | + if(is_array($evtOut)) { |
|
209 | + echo implode("", $evtOut); |
|
210 | + } |
|
211 | + ?> |
|
212 | 212 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>"> |
213 | 213 | <input type="hidden" name="id" value="<?php echo $user ?>"> |
214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -301,21 +301,21 @@ discard block |
||
301 | 301 | <td> </td> |
302 | 302 | <td><?php |
303 | 303 | |
304 | - $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1'); |
|
305 | - ?> |
|
304 | + $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1'); |
|
305 | + ?> |
|
306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
307 | 307 | <?php |
308 | - while($row = $modx->db->getRow($rs)) { |
|
309 | - if($modx->manager->action == '11') { |
|
310 | - $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
311 | - } else { |
|
312 | - $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
313 | - } |
|
314 | - ?> |
|
308 | + while($row = $modx->db->getRow($rs)) { |
|
309 | + if($modx->manager->action == '11') { |
|
310 | + $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
311 | + } else { |
|
312 | + $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
313 | + } |
|
314 | + ?> |
|
315 | 315 | <option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option> |
316 | 316 | <?php |
317 | - } |
|
318 | - ?> |
|
317 | + } |
|
318 | + ?> |
|
319 | 319 | </select></td> |
320 | 320 | </tr> |
321 | 321 | <tr> |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
362 | 362 | <?php |
363 | - foreach($_country_lang as $key => $country) { |
|
364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
365 | - } |
|
366 | - ?> |
|
363 | + foreach($_country_lang as $key => $country) { |
|
364 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
365 | + } |
|
366 | + ?> |
|
367 | 367 | </select></td> |
368 | 368 | </tr> |
369 | 369 | <tr> |
@@ -439,21 +439,21 @@ discard block |
||
439 | 439 | <td><select name="manager_language" class="inputBox" onChange="documentDirty=true"> |
440 | 440 | <option value=""></option> |
441 | 441 | <?php |
442 | - $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
443 | - $dir = dir("includes/lang"); |
|
444 | - while($file = $dir->read()) { |
|
445 | - if(strpos($file, ".inc.php") > 0) { |
|
446 | - $endpos = strpos($file, "."); |
|
447 | - $languagename = substr($file, 0, $endpos); |
|
448 | - $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
449 | - ?> |
|
442 | + $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
443 | + $dir = dir("includes/lang"); |
|
444 | + while($file = $dir->read()) { |
|
445 | + if(strpos($file, ".inc.php") > 0) { |
|
446 | + $endpos = strpos($file, "."); |
|
447 | + $languagename = substr($file, 0, $endpos); |
|
448 | + $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
449 | + ?> |
|
450 | 450 | <option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option> |
451 | 451 | <?php |
452 | 452 | |
453 | - } |
|
454 | - } |
|
455 | - $dir->close(); |
|
456 | - ?> |
|
453 | + } |
|
454 | + } |
|
455 | + $dir->close(); |
|
456 | + ?> |
|
457 | 457 | </select></td> |
458 | 458 | </tr> |
459 | 459 | <tr> |
@@ -528,22 +528,22 @@ discard block |
||
528 | 528 | <td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());"> |
529 | 529 | <option value=""></option> |
530 | 530 | <?php |
531 | - $dir = dir("media/style/"); |
|
532 | - while($file = $dir->read()) { |
|
533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | - $themename = $file; |
|
535 | - if($themename === 'common') { |
|
536 | - continue; |
|
537 | - } |
|
538 | - $attr = 'value="' . $themename . '" '; |
|
539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
540 | - $attr .= 'selected="selected" '; |
|
541 | - } |
|
542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
543 | - } |
|
544 | - } |
|
545 | - $dir->close(); |
|
546 | - ?> |
|
531 | + $dir = dir("media/style/"); |
|
532 | + while($file = $dir->read()) { |
|
533 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | + $themename = $file; |
|
535 | + if($themename === 'common') { |
|
536 | + continue; |
|
537 | + } |
|
538 | + $attr = 'value="' . $themename . '" '; |
|
539 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
540 | + $attr .= 'selected="selected" '; |
|
541 | + } |
|
542 | + echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
543 | + } |
|
544 | + } |
|
545 | + $dir->close(); |
|
546 | + ?> |
|
547 | 547 | </select> |
548 | 548 | <input type="hidden" name="theme_refresher" value=""></td> |
549 | 549 | </tr> |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | <th><?php echo $_lang["which_browser_title"] ?></th> |
556 | 556 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
557 | 557 | <?php |
558 | - $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
559 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
561 | - $dir = str_replace('\\', '/', $dir); |
|
562 | - $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
563 | - $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
564 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
565 | - } |
|
566 | - ?> |
|
558 | + $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
559 | + echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
560 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
561 | + $dir = str_replace('\\', '/', $dir); |
|
562 | + $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
563 | + $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
564 | + echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
565 | + } |
|
566 | + ?> |
|
567 | 567 | </select></td> |
568 | 568 | </tr> |
569 | 569 | <tr> |
@@ -640,17 +640,17 @@ discard block |
||
640 | 640 | <option value=""></option> |
641 | 641 | <?php |
642 | 642 | |
643 | - $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
644 | - // invoke OnRichTextEditorRegister event |
|
645 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
646 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
647 | - if(is_array($evtOut)) { |
|
648 | - for($i = 0; $i < count($evtOut); $i++) { |
|
649 | - $editor = $evtOut[$i]; |
|
650 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
651 | - } |
|
652 | - } |
|
653 | - ?> |
|
643 | + $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
644 | + // invoke OnRichTextEditorRegister event |
|
645 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
646 | + echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
647 | + if(is_array($evtOut)) { |
|
648 | + for($i = 0; $i < count($evtOut); $i++) { |
|
649 | + $editor = $evtOut[$i]; |
|
650 | + echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
651 | + } |
|
652 | + } |
|
653 | + ?> |
|
654 | 654 | </select></td> |
655 | 655 | </tr> |
656 | 656 | <tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>"> |
@@ -683,12 +683,12 @@ discard block |
||
683 | 683 | </tr> |
684 | 684 | </table> |
685 | 685 | <?php |
686 | - // invoke OnInterfaceSettingsRender event |
|
687 | - $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
688 | - if(is_array($evtOut)) { |
|
689 | - echo implode("", $evtOut); |
|
690 | - } |
|
691 | - ?> |
|
686 | + // invoke OnInterfaceSettingsRender event |
|
687 | + $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
688 | + if(is_array($evtOut)) { |
|
689 | + echo implode("", $evtOut); |
|
690 | + } |
|
691 | + ?> |
|
692 | 692 | </div> |
693 | 693 | |
694 | 694 | <!-- Photo --> |
@@ -737,39 +737,39 @@ discard block |
||
737 | 737 | </div> |
738 | 738 | <?php if($use_udperms == 1) { |
739 | 739 | |
740 | - $groupsarray = array(); |
|
741 | - |
|
742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
743 | - $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
|
744 | - $groupsarray = $modx->db->getColumn('user_group', $rs); |
|
745 | - } |
|
746 | - // retain selected doc groups between post |
|
747 | - if(is_array($_POST['user_groups'])) { |
|
748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
749 | - } |
|
750 | - ?> |
|
740 | + $groupsarray = array(); |
|
741 | + |
|
742 | + if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
743 | + $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
|
744 | + $groupsarray = $modx->db->getColumn('user_group', $rs); |
|
745 | + } |
|
746 | + // retain selected doc groups between post |
|
747 | + if(is_array($_POST['user_groups'])) { |
|
748 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
749 | + } |
|
750 | + ?> |
|
751 | 751 | <div class="tab-page" id="tabAccess"> |
752 | 752 | <h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2> |
753 | 753 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script> |
754 | 754 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
755 | 755 | <?php |
756 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name'); |
|
757 | - while($row = $modx->db->getRow($rs)) { |
|
758 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
759 | - } |
|
760 | - } |
|
761 | - ?> |
|
756 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name'); |
|
757 | + while($row = $modx->db->getRow($rs)) { |
|
758 | + echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
759 | + } |
|
760 | + } |
|
761 | + ?> |
|
762 | 762 | </div> |
763 | 763 | </div> |
764 | 764 | </div> |
765 | 765 | <input type="submit" name="save" style="display:none"> |
766 | 766 | <?php |
767 | - // invoke OnUserFormRender event |
|
768 | - $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
769 | - "id" => $user |
|
770 | - )); |
|
771 | - if(is_array($evtOut)) { |
|
772 | - echo implode("", $evtOut); |
|
773 | - } |
|
774 | - ?> |
|
767 | + // invoke OnUserFormRender event |
|
768 | + $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
769 | + "id" => $user |
|
770 | + )); |
|
771 | + if(is_array($evtOut)) { |
|
772 | + echo implode("", $evtOut); |
|
773 | + } |
|
774 | + ?> |
|
775 | 775 | </form> |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 88: |
|
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 87: |
|
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 88: |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 87: |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,64 +24,64 @@ discard block |
||
24 | 24 | // check to see the snippet editor isn't locked |
25 | 25 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
26 | 26 | if($username = $modx->db->getValue($rs)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | 31 | if($modx->manager->action == '88') { |
32 | - // get user attributes |
|
33 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | - $userdata = $modx->db->getRow($rs); |
|
35 | - if(!$userdata) { |
|
36 | - $modx->webAlertAndQuit("No user returned!"); |
|
37 | - } |
|
38 | - |
|
39 | - // get user settings |
|
40 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | - $usersettings = array(); |
|
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | - extract($usersettings, EXTR_OVERWRITE); |
|
44 | - |
|
45 | - // get user name |
|
46 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | - $usernamedata = $modx->db->getRow($rs); |
|
48 | - if(!$usernamedata) { |
|
49 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | - } |
|
51 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
32 | + // get user attributes |
|
33 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | + $userdata = $modx->db->getRow($rs); |
|
35 | + if(!$userdata) { |
|
36 | + $modx->webAlertAndQuit("No user returned!"); |
|
37 | + } |
|
38 | + |
|
39 | + // get user settings |
|
40 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | + $usersettings = array(); |
|
42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | + extract($usersettings, EXTR_OVERWRITE); |
|
44 | + |
|
45 | + // get user name |
|
46 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | + $usernamedata = $modx->db->getRow($rs); |
|
48 | + if(!$usernamedata) { |
|
49 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | + } |
|
51 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
52 | 52 | } else { |
53 | - $userdata = array(); |
|
54 | - $usersettings = array(); |
|
55 | - $usernamedata = array(); |
|
56 | - $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
53 | + $userdata = array(); |
|
54 | + $usersettings = array(); |
|
55 | + $usernamedata = array(); |
|
56 | + $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | 60 | foreach($userdata as $key => $val) { |
61 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
61 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
62 | 62 | }; |
63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 64 | |
65 | 65 | // restore saved form |
66 | 66 | $formRestored = false; |
67 | 67 | if($modx->manager->hasFormValues()) { |
68 | - $modx->manager->loadFormValues(); |
|
69 | - // restore post values |
|
70 | - $userdata = array_merge($userdata, $_POST); |
|
71 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | - $usernamedata['username'] = $userdata['newusername']; |
|
73 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | - $usersettings = array_merge($usersettings, $userdata); |
|
75 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | - extract($usersettings, EXTR_OVERWRITE); |
|
68 | + $modx->manager->loadFormValues(); |
|
69 | + // restore post values |
|
70 | + $userdata = array_merge($userdata, $_POST); |
|
71 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | + $usernamedata['username'] = $userdata['newusername']; |
|
73 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | + $usersettings = array_merge($usersettings, $userdata); |
|
75 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | + extract($usersettings, EXTR_OVERWRITE); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // include the country list language file |
80 | 80 | $_country_lang = array(); |
81 | 81 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
82 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
82 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
83 | 83 | } else { |
84 | - include_once "lang/country/english_country.inc.php"; |
|
84 | + include_once "lang/country/english_country.inc.php"; |
|
85 | 85 | } |
86 | 86 | asort($_country_lang); |
87 | 87 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | |
190 | 190 | <form action="index.php?a=89" method="post" name="userform"> |
191 | 191 | <?php |
192 | - // invoke OnWUsrFormPrerender event |
|
193 | - $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | - if(is_array($evtOut)) { |
|
195 | - echo implode("", $evtOut); |
|
196 | - } |
|
197 | - ?> |
|
192 | + // invoke OnWUsrFormPrerender event |
|
193 | + $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | + if(is_array($evtOut)) { |
|
195 | + echo implode("", $evtOut); |
|
196 | + } |
|
197 | + ?> |
|
198 | 198 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>" /> |
199 | 199 | <input type="hidden" name="id" value="<?php echo $user ?>" /> |
200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
325 | 325 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
326 | 326 | <?php |
327 | - foreach($_country_lang as $key => $country) { |
|
328 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
329 | - } |
|
330 | - ?> |
|
327 | + foreach($_country_lang as $key => $country) { |
|
328 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
329 | + } |
|
330 | + ?> |
|
331 | 331 | </select></td> |
332 | 332 | </tr> |
333 | 333 | <tr> |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | <i onClick="document.userform.blockedafter.value=''; return true;" class="clearDate <?php echo $_style["actions_calendar_delete"] ?>" data-tooltip="<?php echo $_lang['remove_date']; ?>"></i></td> |
388 | 388 | </tr> |
389 | 389 | <?php |
390 | - } |
|
391 | - ?> |
|
390 | + } |
|
391 | + ?> |
|
392 | 392 | </table> |
393 | 393 | </div> |
394 | 394 | |
@@ -496,40 +496,40 @@ discard block |
||
496 | 496 | </table> |
497 | 497 | </div> |
498 | 498 | <?php |
499 | - if($use_udperms == 1) { |
|
500 | - |
|
501 | - $groupsarray = array(); |
|
502 | - |
|
503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
504 | - $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
505 | - $groupsarray = $modx->db->getColumn('webgroup', $rs); |
|
506 | - } |
|
507 | - // retain selected user groups between post |
|
508 | - if(is_array($_POST['user_groups'])) { |
|
509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | - } |
|
511 | - ?> |
|
499 | + if($use_udperms == 1) { |
|
500 | + |
|
501 | + $groupsarray = array(); |
|
502 | + |
|
503 | + if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
504 | + $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
505 | + $groupsarray = $modx->db->getColumn('webgroup', $rs); |
|
506 | + } |
|
507 | + // retain selected user groups between post |
|
508 | + if(is_array($_POST['user_groups'])) { |
|
509 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | + } |
|
511 | + ?> |
|
512 | 512 | <div class="tab-page" id="tabPermissions"> |
513 | 513 | <h2 class="tab"><?php echo $_lang['web_access_permissions'] ?></h2> |
514 | 514 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabPermissions"));</script> |
515 | 515 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
516 | 516 | <?php |
517 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
|
518 | - while($row = $modx->db->getRow($rs)) { |
|
519 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
520 | - } |
|
521 | - } |
|
522 | - ?> |
|
517 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
|
518 | + while($row = $modx->db->getRow($rs)) { |
|
519 | + echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
520 | + } |
|
521 | + } |
|
522 | + ?> |
|
523 | 523 | </div> |
524 | 524 | <?php |
525 | - // invoke OnWUsrFormRender event |
|
526 | - $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
527 | - "id" => $user |
|
528 | - )); |
|
529 | - if(is_array($evtOut)) { |
|
530 | - echo implode("", $evtOut); |
|
531 | - } |
|
532 | - ?> |
|
525 | + // invoke OnWUsrFormRender event |
|
526 | + $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
527 | + "id" => $user |
|
528 | + )); |
|
529 | + if(is_array($evtOut)) { |
|
530 | + echo implode("", $evtOut); |
|
531 | + } |
|
532 | + ?> |
|
533 | 533 | </div> |
534 | 534 | </div> |
535 | 535 | <input type="submit" name="save" style="display:none"> |