@@ -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"> |
@@ -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 16: |
|
| 8 | - if(!$modx->hasPermission('edit_template')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 19: |
|
| 13 | - if(!$modx->hasPermission('new_template')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 16: |
|
| 8 | + if(!$modx->hasPermission('edit_template')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 19: |
|
| 13 | + if(!$modx->hasPermission('new_template')) { |
|
| 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 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // check to see the snippet editor isn't locked |
| 26 | 26 | if($lockedEl = $modx->elementIsLocked(1, $id)) { |
| 27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
| 27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
| 28 | 28 | } |
| 29 | 29 | // end check for lock |
| 30 | 30 | |
@@ -33,23 +33,23 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $content = array(); |
| 35 | 35 | if(!empty($id)) { |
| 36 | - $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
| 37 | - $content = $modx->db->getRow($rs); |
|
| 38 | - if(!$content) { |
|
| 39 | - $modx->webAlertAndQuit("No database record has been found for this template."); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $_SESSION['itemname'] = $content['templatename']; |
|
| 43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 44 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 45 | - } |
|
| 36 | + $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
| 37 | + $content = $modx->db->getRow($rs); |
|
| 38 | + if(!$content) { |
|
| 39 | + $modx->webAlertAndQuit("No database record has been found for this template."); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $_SESSION['itemname'] = $content['templatename']; |
|
| 43 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
| 44 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 45 | + } |
|
| 46 | 46 | } else { |
| 47 | - $_SESSION['itemname'] = $_lang["new_template"]; |
|
| 48 | - $content['category'] = (int)$_REQUEST['catid']; |
|
| 47 | + $_SESSION['itemname'] = $_lang["new_template"]; |
|
| 48 | + $content['category'] = (int)$_REQUEST['catid']; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if($modx->manager->hasFormValues()) { |
| 52 | - $modx->manager->loadFormValues(); |
|
| 52 | + $modx->manager->loadFormValues(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $content = array_merge($content, $_POST); |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | <form name="mutate" method="post" action="index.php"> |
| 100 | 100 | <?php |
| 101 | - // invoke OnTempFormPrerender event |
|
| 102 | - $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
| 103 | - if(is_array($evtOut)) { |
|
| 104 | - echo implode("", $evtOut); |
|
| 105 | - } |
|
| 106 | - ?> |
|
| 101 | + // invoke OnTempFormPrerender event |
|
| 102 | + $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
| 103 | + if(is_array($evtOut)) { |
|
| 104 | + echo implode("", $evtOut); |
|
| 105 | + } |
|
| 106 | + ?> |
|
| 107 | 107 | <input type="hidden" name="a" value="20"> |
| 108 | 108 | <input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>"> |
| 109 | 109 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | <label class="col-md-3 col-lg-2"> |
| 134 | 134 | <?= $_lang['template_name'] ?> |
| 135 | 135 | <?php if($id == $modx->config['default_template']) { |
| 136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
| 137 | - } ?> |
|
| 136 | + echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
| 137 | + } ?> |
|
| 138 | 138 | </label> |
| 139 | 139 | <div class="col-md-9 col-lg-10"> |
| 140 | 140 | <div class="form-control-name clearfix"> |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
| 163 | 163 | <option> </option> |
| 164 | 164 | <?php |
| 165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 166 | - foreach(getCategories() as $n => $v) { |
|
| 167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 168 | - } |
|
| 169 | - ?> |
|
| 165 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 166 | + foreach(getCategories() as $n => $v) { |
|
| 167 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
| 168 | + } |
|
| 169 | + ?> |
|
| 170 | 170 | </select> |
| 171 | 171 | </div> |
| 172 | 172 | </div> |
@@ -197,38 +197,38 @@ discard block |
||
| 197 | 197 | <input type="submit" name="save" style="display:none"> |
| 198 | 198 | |
| 199 | 199 | <?php |
| 200 | - $selectedTvs = array(); |
|
| 201 | - if(!isset($_POST['assignedTv'])) { |
|
| 202 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
| 200 | + $selectedTvs = array(); |
|
| 201 | + if(!isset($_POST['assignedTv'])) { |
|
| 202 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
| 203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
| 204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
| 205 | - ); |
|
| 206 | - while($row = $modx->db->getRow($rs)) { |
|
| 207 | - $selectedTvs[$row['tvid']] = $row; |
|
| 208 | - } |
|
| 209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - $unselectedTvs = array(); |
|
| 213 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
| 205 | + ); |
|
| 206 | + while($row = $modx->db->getRow($rs)) { |
|
| 207 | + $selectedTvs[$row['tvid']] = $row; |
|
| 208 | + } |
|
| 209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + $unselectedTvs = array(); |
|
| 213 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
| 214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
| 215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "", "category, tvcaption"); |
| 216 | - while($row = $modx->db->getRow($rs)) { |
|
| 217 | - $unselectedTvs[$row['tvid']] = $row; |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - // Catch checkboxes if form not validated |
|
| 221 | - if(isset($_POST['assignedTv'])) { |
|
| 222 | - $selectedTvs = array(); |
|
| 223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
| 224 | - if(isset($unselectedTvs[$tvid])) { |
|
| 225 | - $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
| 226 | - } |
|
| 227 | - }; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - $total = count($selectedTvs); |
|
| 231 | - ?> |
|
| 216 | + while($row = $modx->db->getRow($rs)) { |
|
| 217 | + $unselectedTvs[$row['tvid']] = $row; |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + // Catch checkboxes if form not validated |
|
| 221 | + if(isset($_POST['assignedTv'])) { |
|
| 222 | + $selectedTvs = array(); |
|
| 223 | + foreach($_POST['assignedTv'] as $tvid) { |
|
| 224 | + if(isset($unselectedTvs[$tvid])) { |
|
| 225 | + $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
| 226 | + } |
|
| 227 | + }; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + $total = count($selectedTvs); |
|
| 231 | + ?> |
|
| 232 | 232 | </div> |
| 233 | 233 | |
| 234 | 234 | <div class="tab-page" id="tabAssignedTVs"> |
@@ -238,65 +238,65 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | <div class="container container-body"> |
| 240 | 240 | <?php |
| 241 | - if($total > 0) { |
|
| 242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
| 243 | - } |
|
| 244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
| 245 | - echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // Selected TVs |
|
| 249 | - $tvList = ''; |
|
| 250 | - if($total > 0) { |
|
| 251 | - $tvList .= '<ul>'; |
|
| 252 | - foreach($selectedTvs as $row) { |
|
| 253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 255 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 256 | - } |
|
| 257 | - $tvList .= '</ul>'; |
|
| 258 | - |
|
| 259 | - } else { |
|
| 260 | - echo $_lang['template_no_tv']; |
|
| 261 | - } |
|
| 262 | - echo $tvList; |
|
| 263 | - |
|
| 264 | - // Unselected TVs |
|
| 265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
| 266 | - $preCat = ''; |
|
| 267 | - $insideUl = 0; |
|
| 268 | - while($row = array_shift($unselectedTvs)) { |
|
| 269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
| 270 | - continue; |
|
| 271 | - } // Skip selected |
|
| 272 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 273 | - if($preCat !== $row['category']) { |
|
| 274 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
| 275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 276 | - $insideUl = 1; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 281 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 282 | - $tvList .= '</li>'; |
|
| 283 | - |
|
| 284 | - $preCat = $row['category']; |
|
| 285 | - } |
|
| 286 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
| 287 | - $tvList .= '</ul>'; |
|
| 288 | - echo $tvList; |
|
| 289 | - |
|
| 290 | - ?> |
|
| 241 | + if($total > 0) { |
|
| 242 | + echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
| 243 | + } |
|
| 244 | + if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
| 245 | + echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // Selected TVs |
|
| 249 | + $tvList = ''; |
|
| 250 | + if($total > 0) { |
|
| 251 | + $tvList .= '<ul>'; |
|
| 252 | + foreach($selectedTvs as $row) { |
|
| 253 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 254 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 255 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 256 | + } |
|
| 257 | + $tvList .= '</ul>'; |
|
| 258 | + |
|
| 259 | + } else { |
|
| 260 | + echo $_lang['template_no_tv']; |
|
| 261 | + } |
|
| 262 | + echo $tvList; |
|
| 263 | + |
|
| 264 | + // Unselected TVs |
|
| 265 | + $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
| 266 | + $preCat = ''; |
|
| 267 | + $insideUl = 0; |
|
| 268 | + while($row = array_shift($unselectedTvs)) { |
|
| 269 | + if(isset($selectedTvs[$row['tvid']])) { |
|
| 270 | + continue; |
|
| 271 | + } // Skip selected |
|
| 272 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
| 273 | + if($preCat !== $row['category']) { |
|
| 274 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
| 275 | + $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
| 276 | + $insideUl = 1; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
| 280 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
| 281 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
| 282 | + $tvList .= '</li>'; |
|
| 283 | + |
|
| 284 | + $preCat = $row['category']; |
|
| 285 | + } |
|
| 286 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
| 287 | + $tvList .= '</ul>'; |
|
| 288 | + echo $tvList; |
|
| 289 | + |
|
| 290 | + ?> |
|
| 291 | 291 | </div> |
| 292 | 292 | </div> |
| 293 | 293 | |
| 294 | 294 | <?php |
| 295 | - // invoke OnTempFormRender event |
|
| 296 | - $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
| 297 | - if(is_array($evtOut)) { |
|
| 298 | - echo implode("", $evtOut); |
|
| 299 | - } |
|
| 300 | - ?> |
|
| 295 | + // invoke OnTempFormRender event |
|
| 296 | + $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
| 297 | + if(is_array($evtOut)) { |
|
| 298 | + echo implode("", $evtOut); |
|
| 299 | + } |
|
| 300 | + ?> |
|
| 301 | 301 | </div> |
| 302 | 302 | </form> |
@@ -1,10 +1,10 @@ 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 | if(!$modx->hasPermission('edit_module')) { |
| 7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -26,91 +26,91 @@ discard block |
||
| 26 | 26 | // check to see the editor isn't locked |
| 27 | 27 | $rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
| 28 | 28 | if($username = $modx->db->getValue($rs)) { |
| 29 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 29 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
| 30 | 30 | } |
| 31 | 31 | // end check for lock |
| 32 | 32 | |
| 33 | 33 | // take action |
| 34 | 34 | switch($_REQUEST['op']) { |
| 35 | - case 'add': |
|
| 36 | - // convert ids to numbers |
|
| 37 | - $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | - |
|
| 39 | - if(count($opids) > 0) { |
|
| 40 | - // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | - $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | - if($rt == 'chunk') { |
|
| 43 | - $type = 10; |
|
| 44 | - } |
|
| 45 | - if($rt == 'doc') { |
|
| 46 | - $type = 20; |
|
| 47 | - } |
|
| 48 | - if($rt == 'plug') { |
|
| 49 | - $type = 30; |
|
| 50 | - } |
|
| 51 | - if($rt == 'snip') { |
|
| 52 | - $type = 40; |
|
| 53 | - } |
|
| 54 | - if($rt == 'tpl') { |
|
| 55 | - $type = 50; |
|
| 56 | - } |
|
| 57 | - if($rt == 'tv') { |
|
| 58 | - $type = 60; |
|
| 59 | - } |
|
| 60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | - foreach($opids as $opid) { |
|
| 62 | - $modx->db->insert(array( |
|
| 63 | - 'module' => $id, |
|
| 64 | - 'resource' => $opid, |
|
| 65 | - 'type' => $type, |
|
| 66 | - ), $tbl_site_module_depobj); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - break; |
|
| 70 | - case 'del': |
|
| 71 | - // convert ids to numbers |
|
| 72 | - $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | - |
|
| 74 | - // get resources that needs to be removed |
|
| 75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | - // loop through resources and look for plugins and snippets |
|
| 77 | - $plids = array(); |
|
| 78 | - $snid = array(); |
|
| 79 | - while($row = $modx->db->getRow($ds)) { |
|
| 80 | - if($row['type'] == '30') { |
|
| 81 | - $plids[$i] = $row['resource']; |
|
| 82 | - } |
|
| 83 | - if($row['type'] == '40') { |
|
| 84 | - $snids[$i] = $row['resource']; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - // get guid |
|
| 88 | - $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | - $guid = $modx->db->getValue($ds); |
|
| 90 | - // reset moduleguid for deleted resources |
|
| 91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | - if($cp) { |
|
| 93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | - } |
|
| 95 | - if($cs) { |
|
| 96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | - } |
|
| 98 | - // reset cache |
|
| 99 | - $modx->clearCache('full'); |
|
| 100 | - } |
|
| 101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | - break; |
|
| 35 | + case 'add': |
|
| 36 | + // convert ids to numbers |
|
| 37 | + $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
| 38 | + |
|
| 39 | + if(count($opids) > 0) { |
|
| 40 | + // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
| 41 | + $rt = strtolower($_REQUEST["rt"]); |
|
| 42 | + if($rt == 'chunk') { |
|
| 43 | + $type = 10; |
|
| 44 | + } |
|
| 45 | + if($rt == 'doc') { |
|
| 46 | + $type = 20; |
|
| 47 | + } |
|
| 48 | + if($rt == 'plug') { |
|
| 49 | + $type = 30; |
|
| 50 | + } |
|
| 51 | + if($rt == 'snip') { |
|
| 52 | + $type = 40; |
|
| 53 | + } |
|
| 54 | + if($rt == 'tpl') { |
|
| 55 | + $type = 50; |
|
| 56 | + } |
|
| 57 | + if($rt == 'tv') { |
|
| 58 | + $type = 60; |
|
| 59 | + } |
|
| 60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
| 61 | + foreach($opids as $opid) { |
|
| 62 | + $modx->db->insert(array( |
|
| 63 | + 'module' => $id, |
|
| 64 | + 'resource' => $opid, |
|
| 65 | + 'type' => $type, |
|
| 66 | + ), $tbl_site_module_depobj); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + break; |
|
| 70 | + case 'del': |
|
| 71 | + // convert ids to numbers |
|
| 72 | + $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
| 73 | + |
|
| 74 | + // get resources that needs to be removed |
|
| 75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
| 76 | + // loop through resources and look for plugins and snippets |
|
| 77 | + $plids = array(); |
|
| 78 | + $snid = array(); |
|
| 79 | + while($row = $modx->db->getRow($ds)) { |
|
| 80 | + if($row['type'] == '30') { |
|
| 81 | + $plids[$i] = $row['resource']; |
|
| 82 | + } |
|
| 83 | + if($row['type'] == '40') { |
|
| 84 | + $snids[$i] = $row['resource']; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + // get guid |
|
| 88 | + $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
| 89 | + $guid = $modx->db->getValue($ds); |
|
| 90 | + // reset moduleguid for deleted resources |
|
| 91 | + if(($cp = count($plids)) || ($cs = count($snids))) { |
|
| 92 | + if($cp) { |
|
| 93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
| 94 | + } |
|
| 95 | + if($cs) { |
|
| 96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
| 97 | + } |
|
| 98 | + // reset cache |
|
| 99 | + $modx->clearCache('full'); |
|
| 100 | + } |
|
| 101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
| 102 | + break; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // load record |
| 106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
| 107 | 107 | $content = $modx->db->getRow($rs); |
| 108 | 108 | if(!$content) { |
| 109 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 109 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
| 110 | 110 | } |
| 111 | 111 | $_SESSION['itemname'] = $content['name']; |
| 112 | 112 | if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
| 113 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 113 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | ?> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | <tr> |
| 204 | 204 | <td valign="top" align="left"> |
| 205 | 205 | <?php |
| 206 | - $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 206 | + $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
| 207 | 207 | CASE smd.type |
| 208 | 208 | WHEN 10 THEN 'Chunk' |
| 209 | 209 | WHEN 20 THEN 'Document' |
@@ -218,18 +218,18 @@ discard block |
||
| 218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
| 219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
| 220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
| 221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | - $grd->cssClass = "grid"; |
|
| 225 | - $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | - $grd->itemClass = "gridItem"; |
|
| 227 | - $grd->altItemClass = "gridAltItem"; |
|
| 228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | - $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | - $grd->fields = "name,type"; |
|
| 231 | - echo $grd->render(); |
|
| 232 | - ?> |
|
| 221 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
| 222 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
| 223 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
| 224 | + $grd->cssClass = "grid"; |
|
| 225 | + $grd->columnHeaderClass = "gridHeader"; |
|
| 226 | + $grd->itemClass = "gridItem"; |
|
| 227 | + $grd->altItemClass = "gridAltItem"; |
|
| 228 | + $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
| 229 | + $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
| 230 | + $grd->fields = "name,type"; |
|
| 231 | + echo $grd->render(); |
|
| 232 | + ?> |
|
| 233 | 233 | </td> |
| 234 | 234 | <td valign="top" style="width: 150px;"> |
| 235 | 235 | <a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a> |
@@ -4,71 +4,71 @@ |
||
| 4 | 4 | $ContextMenuCnt = 0; |
| 5 | 5 | |
| 6 | 6 | class ContextMenu { |
| 7 | - public $id; |
|
| 7 | + public $id; |
|
| 8 | 8 | /** |
| 9 | 9 | * @var string |
| 10 | 10 | */ |
| 11 | - public $html = ''; |
|
| 11 | + public $html = ''; |
|
| 12 | 12 | /** |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $visible = false; |
|
| 15 | + public $visible = false; |
|
| 16 | 16 | /** |
| 17 | 17 | * @var int |
| 18 | 18 | */ |
| 19 | - public $width = 120; |
|
| 19 | + public $width = 120; |
|
| 20 | 20 | |
| 21 | 21 | public function __construct($id = '', $width = 120, $visible = false) { |
| 22 | - global $ContextMenuCnt; |
|
| 23 | - $ContextMenuCnt++; |
|
| 24 | - $this->html = ""; |
|
| 25 | - $this->visible = $visible ? $visible : false; |
|
| 26 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 28 | - } |
|
| 22 | + global $ContextMenuCnt; |
|
| 23 | + $ContextMenuCnt++; |
|
| 24 | + $this->html = ""; |
|
| 25 | + $this->visible = $visible ? $visible : false; |
|
| 26 | + $this->width = is_numeric($width) ? (int)$width : 120; |
|
| 27 | + $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | public function addItem($text, $action = "", $img = "", $disabled = 0) { |
| 31 | - global $base_url, $_style; |
|
| 31 | + global $base_url, $_style; |
|
| 32 | 32 | if($disabled) { |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | - if(!$img) { |
|
| 36 | - $img = $base_url . $_style['tx']; |
|
| 37 | - } |
|
| 38 | - if(substr($action, 0, 3) == "js:") { |
|
| 39 | - $action = substr($action, 3); |
|
| 40 | - } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 42 | - } else { |
|
| 43 | - $action = "window.location.href='" . $action . "'"; |
|
| 44 | - } |
|
| 45 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 35 | + if(!$img) { |
|
| 36 | + $img = $base_url . $_style['tx']; |
|
| 37 | + } |
|
| 38 | + if(substr($action, 0, 3) == "js:") { |
|
| 39 | + $action = substr($action, 3); |
|
| 40 | + } else if(substr($action, 0, 3) == "hl:") { |
|
| 41 | + $action = "window.location.href='" . substr($action, 3) . "'"; |
|
| 42 | + } else { |
|
| 43 | + $action = "window.location.href='" . $action . "'"; |
|
| 44 | + } |
|
| 45 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
| 46 | + $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
| 47 | 47 | if(substr($img, 0, 5) == 'fa fa') { |
| 48 | 48 | $img = '<i class="' . $img . '"></i>'; |
| 49 | 49 | } else if(substr($img, 0, 1) != '<') { |
| 50 | 50 | $img = '<img src="' . $img . '" />'; |
| 51 | 51 | } |
| 52 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
| 53 | - } |
|
| 52 | + $this->html .= $img . ' ' . $text . '</div>'; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | public function addSeparator() { |
| 56 | - $this->html .= " |
|
| 56 | + $this->html .= " |
|
| 57 | 57 | <div class='cntxMnuSeparator'></div> |
| 58 | 58 | "; |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | public function render() { |
| 62 | - global $ContextMenuScript; |
|
| 62 | + global $ContextMenuScript; |
|
| 63 | 63 | |
| 64 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 65 | - $ContextMenuScript = ""; // reset css |
|
| 66 | - return $html; |
|
| 67 | - } |
|
| 64 | + $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
| 65 | + $ContextMenuScript = ""; // reset css |
|
| 66 | + return $html; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | public function getClientScriptObject() { |
| 70 | - return "getCntxMenu('" . $this->id . "')"; |
|
| 71 | - } |
|
| 70 | + return "getCntxMenu('" . $this->id . "')"; |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $ContextMenuScript = <<<BLOCK |
@@ -3,12 +3,12 @@ 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_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'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
| 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 |
||
| 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'); |
@@ -3,12 +3,12 @@ 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_snippet')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // invoke OnBeforeChunkFormDelete event |
| 19 | 19 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
| 20 | - array( |
|
| 21 | - "id" => $id |
|
| 22 | - )); |
|
| 20 | + array( |
|
| 21 | + "id" => $id |
|
| 22 | + )); |
|
| 23 | 23 | |
| 24 | 24 | // delete the chunk. |
| 25 | 25 | $modx->db->delete($modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
| 26 | 26 | |
| 27 | 27 | // invoke OnChunkFormDelete event |
| 28 | 28 | $modx->invokeEvent("OnChunkFormDelete", |
| 29 | - array( |
|
| 30 | - "id" => $id |
|
| 31 | - )); |
|
| 29 | + array( |
|
| 30 | + "id" => $id |
|
| 31 | + )); |
|
| 32 | 32 | |
| 33 | 33 | // empty cache |
| 34 | 34 | $modx->clearCache('full'); |