@@ -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 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> |