@@ -9,8 +9,8 @@ |
||
9 | 9 | |
10 | 10 | // ajax response |
11 | 11 | if (isset($_POST['updateMsgCount'])) { |
12 | - header("Content-Type: application/json; charset=utf-8"); |
|
13 | - print $nrnewmessages.','.$nrtotalmessages; |
|
14 | - exit; |
|
12 | + header("Content-Type: application/json; charset=utf-8"); |
|
13 | + print $nrnewmessages.','.$nrtotalmessages; |
|
14 | + exit; |
|
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | \ No newline at end of file |
@@ -5,72 +5,72 @@ discard block |
||
5 | 5 | var $errorcode; |
6 | 6 | var $errors = array(); |
7 | 7 | |
8 | - function __construct() { |
|
8 | + function __construct() { |
|
9 | 9 | |
10 | - $_lang = $this->include_lang('errormsg'); |
|
10 | + $_lang = $this->include_lang('errormsg'); |
|
11 | 11 | |
12 | - $this->errors = array( |
|
13 | - 0 => $_lang["No errors occured."], |
|
14 | - 1 => $_lang["An error occured!"], |
|
15 | - 2 => $_lang["Document's ID not passed in request!"], |
|
16 | - 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | - 4 => $_lang["ID passed in request is NaN!"], |
|
18 | - 5 => $_lang["The document is locked!"], |
|
19 | - 6 => $_lang["Too many results returned from database!"], |
|
20 | - 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | - 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | - 9 => $_lang["Logging error!"], |
|
23 | - 10 => $_lang["Table to optimise not found in request!"], |
|
24 | - 11 => $_lang["No settings found in request!"], |
|
25 | - 12 => $_lang["The document must have a title!"], |
|
26 | - 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | - 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | - 15 => $_lang["The document was not found!"], |
|
12 | + $this->errors = array( |
|
13 | + 0 => $_lang["No errors occured."], |
|
14 | + 1 => $_lang["An error occured!"], |
|
15 | + 2 => $_lang["Document's ID not passed in request!"], |
|
16 | + 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | + 4 => $_lang["ID passed in request is NaN!"], |
|
18 | + 5 => $_lang["The document is locked!"], |
|
19 | + 6 => $_lang["Too many results returned from database!"], |
|
20 | + 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | + 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | + 9 => $_lang["Logging error!"], |
|
23 | + 10 => $_lang["Table to optimise not found in request!"], |
|
24 | + 11 => $_lang["No settings found in request!"], |
|
25 | + 12 => $_lang["The document must have a title!"], |
|
26 | + 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | + 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | + 15 => $_lang["The document was not found!"], |
|
29 | 29 | |
30 | - 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | - 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | - 601 => $_lang["Document's ID not passed in request!"], |
|
33 | - 602 => $_lang["New parent not set in request!"], |
|
34 | - 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | - 901 => $_lang["wrong password!"], // wrong password! |
|
36 | - 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | - 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | - 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | - 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | - ); |
|
41 | - } |
|
30 | + 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | + 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | + 601 => $_lang["Document's ID not passed in request!"], |
|
33 | + 602 => $_lang["New parent not set in request!"], |
|
34 | + 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | + 901 => $_lang["wrong password!"], // wrong password! |
|
36 | + 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | + 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | + 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | + 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - function include_lang($context='common') { |
|
44 | - global $modx; |
|
45 | - $_lang = array(); |
|
43 | + function include_lang($context='common') { |
|
44 | + global $modx; |
|
45 | + $_lang = array(); |
|
46 | 46 | |
47 | - $context = trim($context,'/'); |
|
48 | - if(strpos($context,'..')!==false) return; |
|
47 | + $context = trim($context,'/'); |
|
48 | + if(strpos($context,'..')!==false) return; |
|
49 | 49 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | - else |
|
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | - include_once($lang_path . 'english.inc.php'); |
|
55 | - $manager_language = $modx->config['manager_language']; |
|
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | - return $_lang; |
|
59 | - } |
|
50 | + if($context === 'common') |
|
51 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | + else |
|
53 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | + include_once($lang_path . 'english.inc.php'); |
|
55 | + $manager_language = $modx->config['manager_language']; |
|
56 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | + return $_lang; |
|
59 | + } |
|
60 | 60 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
62 | - $this->errorcode=$errorcode; |
|
63 | - $this->errormessage=$this->errors[$errorcode]; |
|
64 | - if($custommessage!="") { |
|
65 | - $this->errormessage=$custommessage; |
|
66 | - } |
|
67 | - } |
|
61 | + function setError($errorcode, $custommessage=""){ |
|
62 | + $this->errorcode=$errorcode; |
|
63 | + $this->errormessage=$this->errors[$errorcode]; |
|
64 | + if($custommessage!="") { |
|
65 | + $this->errormessage=$custommessage; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - function getError() { |
|
70 | - return $this->errorcode; |
|
71 | - } |
|
69 | + function getError() { |
|
70 | + return $this->errorcode; |
|
71 | + } |
|
72 | 72 | |
73 | - function dumpError(){ |
|
73 | + function dumpError(){ |
|
74 | 74 | ?> |
75 | 75 | <html> |
76 | 76 | <head> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | </body> |
89 | 89 | </html> |
90 | 90 | <?php |
91 | - exit; |
|
92 | - } |
|
91 | + exit; |
|
92 | + } |
|
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | \ No newline at end of file |
@@ -3,24 +3,24 @@ |
||
3 | 3 | |
4 | 4 | // START HACK |
5 | 5 | if (isset ($modx)) { |
6 | - $user_id = $modx->getLoginUserID(); |
|
6 | + $user_id = $modx->getLoginUserID(); |
|
7 | 7 | } else { |
8 | - $user_id = $_SESSION['mgrInternalKey']; |
|
8 | + $user_id = $_SESSION['mgrInternalKey']; |
|
9 | 9 | } |
10 | 10 | // END HACK |
11 | 11 | |
12 | 12 | if (!empty($user_id)) { |
13 | - // Raymond: grab the user settings from the database. |
|
14 | - $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), "user=".$modx->getLoginUserID()); |
|
13 | + // Raymond: grab the user settings from the database. |
|
14 | + $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), "user=".$modx->getLoginUserID()); |
|
15 | 15 | |
16 | - $which_browser_default = $which_browser; |
|
17 | - while ($row = $modx->db->getRow($rs)) { |
|
18 | - if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
19 | - $settings[$row['setting_name']] = $row['setting_value']; |
|
20 | - if (isset($modx->config)) { |
|
21 | - $modx->config[$row['setting_name']] = $row['setting_value']; |
|
22 | - } |
|
23 | - } |
|
24 | - extract($settings, EXTR_OVERWRITE); |
|
16 | + $which_browser_default = $which_browser; |
|
17 | + while ($row = $modx->db->getRow($rs)) { |
|
18 | + if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
19 | + $settings[$row['setting_name']] = $row['setting_value']; |
|
20 | + if (isset($modx->config)) { |
|
21 | + $modx->config[$row['setting_name']] = $row['setting_value']; |
|
22 | + } |
|
23 | + } |
|
24 | + extract($settings, EXTR_OVERWRITE); |
|
25 | 25 | } |
26 | 26 | ?> |
27 | 27 | \ No newline at end of file |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | function ProcessFile($file) { |
121 | 121 | // get the file |
122 | - $buffer = @file_get_contents($file); |
|
123 | - if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
122 | + $buffer = @file_get_contents($file); |
|
123 | + if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
124 | 124 | return $buffer; |
125 | 125 | } |
126 | 126 | |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | // Parse MODX Template-Variables |
145 | 145 | function parseTvValues($param, $tvsArray) |
146 | 146 | { |
147 | - global $modx; |
|
148 | - $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
149 | - if (strpos($param, '[*') !== false) { |
|
150 | - $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
151 | - foreach ($matches[0] as $i=>$match) { |
|
152 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
153 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
154 | - $value = $tvsArray[$matches[1][$i]]['value']; |
|
155 | - $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
156 | - } else { |
|
157 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
158 | - } |
|
159 | - $param = str_replace($match, $value, $param); |
|
160 | - } |
|
161 | - } |
|
162 | - } |
|
163 | - return $param; |
|
147 | + global $modx; |
|
148 | + $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
149 | + if (strpos($param, '[*') !== false) { |
|
150 | + $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
151 | + foreach ($matches[0] as $i=>$match) { |
|
152 | + if(isset($tvsArray[ $matches[1][$i] ])) { |
|
153 | + if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
154 | + $value = $tvsArray[$matches[1][$i]]['value']; |
|
155 | + $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
156 | + } else { |
|
157 | + $value = $tvsArray[ $matches[1][$i] ]; |
|
158 | + } |
|
159 | + $param = str_replace($match, $value, $param); |
|
160 | + } |
|
161 | + } |
|
162 | + } |
|
163 | + return $param; |
|
164 | 164 | } |
165 | 165 | \ No newline at end of file |
@@ -11,19 +11,19 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | function secureMgrDocument($docid='') { |
14 | - global $modx; |
|
14 | + global $modx; |
|
15 | 15 | |
16 | - $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
|
17 | - $rs = $modx->db->select( |
|
18 | - 'DISTINCT sc.id', |
|
19 | - $modx->getFullTableName("site_content")." sc |
|
16 | + $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
|
17 | + $rs = $modx->db->select( |
|
18 | + 'DISTINCT sc.id', |
|
19 | + $modx->getFullTableName("site_content")." sc |
|
20 | 20 | LEFT JOIN ".$modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
21 | 21 | LEFT JOIN ".$modx->getFullTableName("membergroup_access")." mga ON mga.documentgroup = dg.document_group", |
22 | - ($docid>0 ? " sc.id='{$docid}' AND ":"")."mga.id>0" |
|
23 | - ); |
|
24 | - $ids = $modx->db->getColumn("id",$rs); |
|
25 | - if(count($ids)>0) { |
|
26 | - $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
27 | - } |
|
22 | + ($docid>0 ? " sc.id='{$docid}' AND ":"")."mga.id>0" |
|
23 | + ); |
|
24 | + $ids = $modx->db->getColumn("id",$rs); |
|
25 | + if(count($ids)>0) { |
|
26 | + $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | \ No newline at end of file |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - /** |
|
4 | - * System Alert Message Queue Display file |
|
5 | - * Written By Raymond Irving, April, 2005 |
|
6 | - * |
|
7 | - * Used to display system alert messages inside the browser |
|
8 | - * |
|
9 | - */ |
|
3 | + /** |
|
4 | + * System Alert Message Queue Display file |
|
5 | + * Written By Raymond Irving, April, 2005 |
|
6 | + * |
|
7 | + * Used to display system alert messages inside the browser |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | |
11 | - require_once(dirname(__FILE__).'/protect.inc.php'); |
|
11 | + require_once(dirname(__FILE__).'/protect.inc.php'); |
|
12 | 12 | |
13 | - $sysMsgs = ""; |
|
14 | - $limit = count($SystemAlertMsgQueque); |
|
15 | - for($i=0;$i<$limit;$i++) { |
|
16 | - $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | - } |
|
18 | - // reset message queque |
|
19 | - unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | - $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
13 | + $sysMsgs = ""; |
|
14 | + $limit = count($SystemAlertMsgQueque); |
|
15 | + for($i=0;$i<$limit;$i++) { |
|
16 | + $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | + } |
|
18 | + // reset message queque |
|
19 | + unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | + $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if($sysMsgs!="") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
27 | - echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
27 | + echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
28 | 28 | ?> |
29 | 29 | <script type="text/javascript"> |
30 | 30 | // <![CDATA[ |
@@ -42,5 +42,5 @@ discard block |
||
42 | 42 | // ]]> |
43 | 43 | </script> |
44 | 44 | <?php |
45 | - } |
|
45 | + } |
|
46 | 46 | ?> |
47 | 47 | \ No newline at end of file |
@@ -21,5 +21,5 @@ |
||
21 | 21 | if($ok) { |
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | - echo '{status:"null"}'; |
|
24 | + echo '{status:"null"}'; |
|
25 | 25 | } |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | |
4 | 4 | // PROCESSOR FIRST |
5 | 5 | if($_SESSION['mgrRole'] == 1) { |
6 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | - $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
8 | - if(!empty($current)) { |
|
9 | - $modx->manager->setSystemChecksum($current); |
|
10 | - $modx->clearCache('full'); |
|
11 | - $modx->config['sys_files_checksum'] = $current; |
|
12 | - }; |
|
13 | - } |
|
6 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | + $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
8 | + if(!empty($current)) { |
|
9 | + $modx->manager->setSystemChecksum($current); |
|
10 | + $modx->clearCache('full'); |
|
11 | + $modx->config['sys_files_checksum'] = $current; |
|
12 | + }; |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | // NOW CHECK CONFIG |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | |
19 | 19 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
20 | 20 | if ($sysfiles_check!=='0'){ |
21 | - $warningspresent = 1; |
|
22 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
21 | + $warningspresent = 1; |
|
22 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | if (is_writable("includes/config.inc.php")){ |
26 | 26 | // Warn if world writable |
27 | 27 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
28 | - $warningspresent = 1; |
|
29 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
28 | + $warningspresent = 1; |
|
29 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | break; |
178 | 178 | case $_lang['configcheck_sysfiles_mod']: |
179 | 179 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
180 | - $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
181 | - if($modx->hasPermission('settings')) { |
|
182 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
183 | - } |
|
180 | + $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
181 | + if($modx->hasPermission('settings')) { |
|
182 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
183 | + } |
|
184 | 184 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
185 | 185 | break; |
186 | 186 | case $_lang['configcheck_lang_difference'] : |
@@ -9,178 +9,178 @@ |
||
9 | 9 | |
10 | 10 | Class TemplateParser { |
11 | 11 | |
12 | - function __construct() { |
|
13 | - } |
|
14 | - |
|
15 | - /** |
|
16 | - * @param array $config [action, tabs, toArray] |
|
17 | - * @param array $data |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public function output($config = array(), $data = array()) { |
|
21 | - global $modx; |
|
22 | - |
|
23 | - $output = ''; |
|
24 | - $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
26 | - |
|
27 | - if($action) { |
|
28 | - $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
12 | + function __construct() { |
|
13 | + } |
|
14 | + |
|
15 | + /** |
|
16 | + * @param array $config [action, tabs, toArray] |
|
17 | + * @param array $data |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public function output($config = array(), $data = array()) { |
|
21 | + global $modx; |
|
22 | + |
|
23 | + $output = ''; |
|
24 | + $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
26 | + |
|
27 | + if($action) { |
|
28 | + $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
29 | 29 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
30 | 30 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
31 | 31 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 33 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
35 | - $tabs = array(); |
|
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | - $row['value'] = $data[$row['name']]; |
|
39 | - } |
|
40 | - $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
41 | - $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
42 | - } |
|
43 | - |
|
44 | - if(!empty($config['toArray'])) { |
|
45 | - $output = $tabs; |
|
46 | - } else { |
|
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
48 | - $output .= ' |
|
34 | + if($modx->db->getRecordCount($sql)) { |
|
35 | + $tabs = array(); |
|
36 | + while($row = $modx->db->getRow($sql)) { |
|
37 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | + $row['value'] = $data[$row['name']]; |
|
39 | + } |
|
40 | + $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
41 | + $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
42 | + } |
|
43 | + |
|
44 | + if(!empty($config['toArray'])) { |
|
45 | + $output = $tabs; |
|
46 | + } else { |
|
47 | + $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
48 | + $output .= ' |
|
49 | 49 | <script type="text/javascript"> |
50 | 50 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
51 | 51 | </script>'; |
52 | 52 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
55 | - $output .= ' |
|
53 | + foreach($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
55 | + $output .= ' |
|
56 | 56 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
57 | 57 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
58 | - unset($tab['category_name']); |
|
59 | - foreach($tab as $item) { |
|
60 | - $output .= $item; |
|
61 | - } |
|
62 | - $output .= '</div>'; |
|
63 | - } |
|
64 | - $output .= '</div>'; |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - return $output; |
|
70 | - } |
|
71 | - |
|
72 | - private function render($data) { |
|
73 | - global $modx, $_lang, $_country_lang; |
|
74 | - |
|
75 | - $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
76 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
77 | - $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
78 | - |
|
79 | - $output = ''; |
|
80 | - $output .= '<div class="form-group row">'; |
|
81 | - |
|
82 | - switch($data['type']) { |
|
83 | - |
|
84 | - case 'text': |
|
85 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
58 | + unset($tab['category_name']); |
|
59 | + foreach($tab as $item) { |
|
60 | + $output .= $item; |
|
61 | + } |
|
62 | + $output .= '</div>'; |
|
63 | + } |
|
64 | + $output .= '</div>'; |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + return $output; |
|
70 | + } |
|
71 | + |
|
72 | + private function render($data) { |
|
73 | + global $modx, $_lang, $_country_lang; |
|
74 | + |
|
75 | + $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
76 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
77 | + $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
78 | + |
|
79 | + $output = ''; |
|
80 | + $output .= '<div class="form-group row">'; |
|
81 | + |
|
82 | + switch($data['type']) { |
|
83 | + |
|
84 | + case 'text': |
|
85 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
86 | 86 | <div class="col-sm-7"> |
87 | 87 | <input type="text" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
88 | - $output .= $data['content']; |
|
89 | - $output .= '</div>'; |
|
88 | + $output .= $data['content']; |
|
89 | + $output .= '</div>'; |
|
90 | 90 | |
91 | - break; |
|
91 | + break; |
|
92 | 92 | |
93 | - case 'textarea': |
|
94 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
93 | + case 'textarea': |
|
94 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
95 | 95 | <div class="col-sm-7"> |
96 | 96 | <textarea name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;"[+readonly+]>[+value+]</textarea>'; |
97 | - $output .= $data['content']; |
|
98 | - $output .= '</div>'; |
|
97 | + $output .= $data['content']; |
|
98 | + $output .= '</div>'; |
|
99 | 99 | |
100 | - break; |
|
100 | + break; |
|
101 | 101 | |
102 | - case 'date': |
|
103 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
104 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
102 | + case 'date': |
|
103 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
104 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
105 | 105 | <div class="col-sm-7"> |
106 | 106 | <input type="text" name="[+name+]" class="form-control DatePicker" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
107 | - $output .= $data['content']; |
|
108 | - $output .= '</div>'; |
|
109 | - |
|
110 | - break; |
|
111 | - |
|
112 | - case 'select': |
|
113 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
114 | - $output .= '<div class="col-sm-7">'; |
|
115 | - $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | - $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | - foreach($_country_lang as $key => $value) { |
|
120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
121 | - } |
|
122 | - } else { |
|
123 | - if($data['elements']) { |
|
124 | - $elements = explode('||', $data['elements']); |
|
125 | - foreach($elements as $key => $value) { |
|
126 | - $value = explode('==', $value); |
|
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | - } |
|
129 | - } |
|
130 | - } |
|
131 | - $output .= '</select>'; |
|
132 | - $output .= $data['content']; |
|
133 | - $output .= '</div>'; |
|
134 | - |
|
135 | - break; |
|
136 | - |
|
137 | - case 'checkbox': |
|
138 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
139 | - $output .= '<div class="col-sm-7">'; |
|
140 | - $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
141 | - if($data['elements']) { |
|
142 | - $elements = explode('||', $data['elements']); |
|
143 | - foreach($elements as $key => $value) { |
|
144 | - $value = explode('==', $value); |
|
145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | - } |
|
147 | - } |
|
148 | - $output .= $data['content']; |
|
149 | - $output .= '</div>'; |
|
150 | - |
|
151 | - break; |
|
152 | - |
|
153 | - case 'radio': |
|
154 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
155 | - $output .= '<div class="col-sm-7">'; |
|
156 | - $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
157 | - if($data['elements']) { |
|
158 | - $elements = explode('||', $data['elements']); |
|
159 | - foreach($elements as $key => $value) { |
|
160 | - $value = explode('==', $value); |
|
161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | - } |
|
163 | - } |
|
164 | - $output .= $data['content']; |
|
165 | - $output .= '</div>'; |
|
166 | - |
|
167 | - break; |
|
168 | - |
|
169 | - case 'custom': |
|
170 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
171 | - $output .= '<div class="col-sm-7">'; |
|
172 | - $output .= $data['content']; |
|
173 | - $output .= '</div>'; |
|
174 | - |
|
175 | - break; |
|
176 | - } |
|
177 | - |
|
178 | - $output .= '</div>'; |
|
179 | - |
|
180 | - $output = $modx->parseText($output, $data); |
|
181 | - |
|
182 | - return $output; |
|
183 | - } |
|
107 | + $output .= $data['content']; |
|
108 | + $output .= '</div>'; |
|
109 | + |
|
110 | + break; |
|
111 | + |
|
112 | + case 'select': |
|
113 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
114 | + $output .= '<div class="col-sm-7">'; |
|
115 | + $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
116 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | + $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
118 | + $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | + foreach($_country_lang as $key => $value) { |
|
120 | + $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
121 | + } |
|
122 | + } else { |
|
123 | + if($data['elements']) { |
|
124 | + $elements = explode('||', $data['elements']); |
|
125 | + foreach($elements as $key => $value) { |
|
126 | + $value = explode('==', $value); |
|
127 | + $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | + } |
|
129 | + } |
|
130 | + } |
|
131 | + $output .= '</select>'; |
|
132 | + $output .= $data['content']; |
|
133 | + $output .= '</div>'; |
|
134 | + |
|
135 | + break; |
|
136 | + |
|
137 | + case 'checkbox': |
|
138 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
139 | + $output .= '<div class="col-sm-7">'; |
|
140 | + $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
141 | + if($data['elements']) { |
|
142 | + $elements = explode('||', $data['elements']); |
|
143 | + foreach($elements as $key => $value) { |
|
144 | + $value = explode('==', $value); |
|
145 | + $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | + } |
|
147 | + } |
|
148 | + $output .= $data['content']; |
|
149 | + $output .= '</div>'; |
|
150 | + |
|
151 | + break; |
|
152 | + |
|
153 | + case 'radio': |
|
154 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
155 | + $output .= '<div class="col-sm-7">'; |
|
156 | + $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
157 | + if($data['elements']) { |
|
158 | + $elements = explode('||', $data['elements']); |
|
159 | + foreach($elements as $key => $value) { |
|
160 | + $value = explode('==', $value); |
|
161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | + } |
|
163 | + } |
|
164 | + $output .= $data['content']; |
|
165 | + $output .= '</div>'; |
|
166 | + |
|
167 | + break; |
|
168 | + |
|
169 | + case 'custom': |
|
170 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
171 | + $output .= '<div class="col-sm-7">'; |
|
172 | + $output .= $data['content']; |
|
173 | + $output .= '</div>'; |
|
174 | + |
|
175 | + break; |
|
176 | + } |
|
177 | + |
|
178 | + $output .= '</div>'; |
|
179 | + |
|
180 | + $output = $modx->parseText($output, $data); |
|
181 | + |
|
182 | + return $output; |
|
183 | + } |
|
184 | 184 | |
185 | 185 | } |
186 | 186 |