@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | class Paging |
32 | 32 | { |
33 | 33 | |
34 | - var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | - var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | - var $int_cur_position;// Current position in recordset |
|
37 | - var $str_ext_argv; // Extra argv of query string |
|
34 | + var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | + var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | + var $int_cur_position; // Current position in recordset |
|
37 | + var $str_ext_argv; // Extra argv of query string |
|
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ Constructor |
40 | 40 | // |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $array_paging['total'] = $this->int_nbr_row; |
65 | 65 | |
66 | 66 | if ($this->int_cur_position != 0) { |
67 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
68 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
67 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
68 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
72 | 72 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
73 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
74 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
73 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
74 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
75 | 75 | } |
76 | 76 | return $array_paging; |
77 | 77 | } // end function |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
87 | 87 | // if current page, do not make a link |
88 | 88 | if ($i == $this->getCurrentPage()) { |
89 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
89 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
90 | 90 | } else { |
91 | 91 | $int_new_position = ($i * $this->int_num_result); |
92 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
92 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | return $array_all_page; |
@@ -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 | } |
@@ -12,13 +12,13 @@ |
||
12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
13 | 13 | $ok = false; |
14 | 14 | |
15 | -if($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
15 | +if ($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
16 | 16 | $modx->lockElement($_GET['type'], $_GET['id'], true); |
17 | 17 | $ok = true; |
18 | 18 | } |
19 | 19 | |
20 | 20 | header('Content-type: application/json'); |
21 | -if($ok) { |
|
21 | +if ($ok) { |
|
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | 24 | echo '{status:"null"}'; |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler{ |
|
16 | 16 | // Single variable for a log entry |
17 | 17 | var $entry = array(); |
18 | 18 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
19 | + function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){ |
|
20 | 20 | global $modx; |
21 | 21 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | - $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
|
22 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
23 | 23 | |
24 | 24 | // User Credentials |
25 | 25 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
26 | 26 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 27 | |
28 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
28 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | + if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
30 | 30 | |
31 | - $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
31 | + $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | + if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
33 | 33 | |
34 | 34 | $this->writeToLog(); |
35 | 35 | return; |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | // function to write to the log |
39 | 39 | // collects all required info, and |
40 | 40 | // writes it to the logging table |
41 | - function writeToLog() { |
|
41 | + function writeToLog(){ |
|
42 | 42 | global $modx; |
43 | 43 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 44 | |
45 | - if($this->entry['internalKey'] == "") { |
|
45 | + if ($this->entry['internalKey'] == "") { |
|
46 | 46 | $modx->webAlertAndQuit("Logging error: internalKey not set."); |
47 | 47 | } |
48 | - if(empty($this->entry['action'])) { |
|
48 | + if (empty($this->entry['action'])) { |
|
49 | 49 | $modx->webAlertAndQuit("Logging error: action not set."); |
50 | 50 | } |
51 | - if($this->entry['msg'] == "") { |
|
51 | + if ($this->entry['msg'] == "") { |
|
52 | 52 | include_once "actionlist.inc.php"; |
53 | 53 | $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']); |
54 | - if($this->entry['msg'] == "") { |
|
54 | + if ($this->entry['msg'] == "") { |
|
55 | 55 | $modx->webAlertAndQuit("Logging error: couldn't find message to write to log."); |
56 | 56 | } |
57 | 57 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $fields['itemid'] = $this->entry['itemId']; |
64 | 64 | $fields['itemname'] = $modx->db->escape($this->entry['itemName']); |
65 | 65 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
66 | - $insert_id = $modx->db->insert($fields,$tbl_manager_log); |
|
67 | - if(!$insert_id) { |
|
66 | + $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
|
67 | + if (!$insert_id) { |
|
68 | 68 | $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
69 | 69 | } else { |
70 | 70 | $limit = (isset($modx->config['manager_log_limit'])) ? intval($modx->config['manager_log_limit']) : 3000; |
71 | - $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | - if(($insert_id % $trim) === 0) { |
|
73 | - $modx->rotate_log('manager_log',$limit,$trim); |
|
71 | + $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | + if (($insert_id % $trim) === 0) { |
|
73 | + $modx->rotate_log('manager_log', $limit, $trim); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -12,11 +12,13 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler |
|
16 | +{ |
|
16 | 17 | // Single variable for a log entry |
17 | 18 | var $entry = array(); |
18 | 19 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
20 | + function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") |
|
21 | + { |
|
20 | 22 | global $modx; |
21 | 23 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | 24 | $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
@@ -26,10 +28,16 @@ discard block |
||
26 | 28 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 29 | |
28 | 30 | $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
31 | + if($this->entry['itemId'] == 0) { |
|
32 | + $this->entry['itemId'] = "-"; |
|
33 | + } |
|
34 | + // to stop items having id 0 |
|
30 | 35 | |
31 | 36 | $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
37 | + if($this->entry['itemName'] == "") { |
|
38 | + $this->entry['itemName'] = "-"; |
|
39 | + } |
|
40 | + // to stop item name being empty |
|
33 | 41 | |
34 | 42 | $this->writeToLog(); |
35 | 43 | return; |
@@ -38,7 +46,8 @@ discard block |
||
38 | 46 | // function to write to the log |
39 | 47 | // collects all required info, and |
40 | 48 | // writes it to the logging table |
41 | - function writeToLog() { |
|
49 | + function writeToLog() |
|
50 | + { |
|
42 | 51 | global $modx; |
43 | 52 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 53 |
@@ -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'] : |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | 3 | |
4 | 4 | // PROCESSOR FIRST |
5 | -if($_SESSION['mgrRole'] == 1) { |
|
6 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
5 | +if ($_SESSION['mgrRole'] == 1) { |
|
6 | + if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | 7 | $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
8 | - if(!empty($current)) { |
|
8 | + if (!empty($current)) { |
|
9 | 9 | $modx->manager->setSystemChecksum($current); |
10 | 10 | $modx->clearCache('full'); |
11 | 11 | $modx->config['sys_files_checksum'] = $current; |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $warningspresent = 0; |
18 | 18 | |
19 | 19 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
20 | -if ($sysfiles_check!=='0'){ |
|
20 | +if ($sysfiles_check !== '0') { |
|
21 | 21 | $warningspresent = 1; |
22 | 22 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
23 | 23 | } |
24 | 24 | |
25 | -if (is_writable("includes/config.inc.php")){ |
|
25 | +if (is_writable("includes/config.inc.php")) { |
|
26 | 26 | // Warn if world writable |
27 | - if(@fileperms('includes/config.inc.php') & 0x0002) { |
|
27 | + if (@fileperms('includes/config.inc.php') & 0x0002) { |
|
28 | 28 | $warningspresent = 1; |
29 | 29 | $warnings[] = array($_lang['configcheck_configinc']); |
30 | 30 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | $warnings[] = array($_lang['configcheck_php_gdzip']); |
41 | 41 | } |
42 | 42 | |
43 | -if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
44 | - if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
43 | +if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
44 | + if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
45 | 45 | if ($modx->db->getValue($modx->db->select('COUNT(setting_value)', $modx->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) { |
46 | 46 | $warningspresent = 1; |
47 | 47 | $warnings[] = array($_lang['configcheck_validate_referer']); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | // check for Template Switcher plugin |
53 | -if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
54 | - if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
53 | +if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
54 | + if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
55 | 55 | $rs = $modx->db->select('name, disabled', $modx->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'"); |
56 | 56 | $row = $modx->db->getRow($rs); |
57 | - if($row && $row['disabled'] == 0) { |
|
57 | + if ($row && $row['disabled'] == 0) { |
|
58 | 58 | $warningspresent = 1; |
59 | 59 | $warnings[] = array($_lang['configcheck_templateswitcher_present']); |
60 | 60 | $tplName = $row['name']; |
@@ -115,36 +115,36 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!function_exists('checkSiteCache')) { |
118 | - function checkSiteCache() { |
|
118 | + function checkSiteCache(){ |
|
119 | 119 | global $modx; |
120 | - $checked= true; |
|
121 | - if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
|
122 | - $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php'); |
|
120 | + $checked = true; |
|
121 | + if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) { |
|
122 | + $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php'); |
|
123 | 123 | } |
124 | 124 | return $checked; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | -if (!is_writable(MODX_BASE_PATH . "assets/cache/")) { |
|
128 | +if (!is_writable(MODX_BASE_PATH."assets/cache/")) { |
|
129 | 129 | $warningspresent = 1; |
130 | 130 | $warnings[] = array($_lang['configcheck_cache']); |
131 | 131 | } |
132 | 132 | |
133 | 133 | if (!checkSiteCache()) { |
134 | 134 | $warningspresent = 1; |
135 | - $warnings[]= array($lang['configcheck_sitecache_integrity']); |
|
135 | + $warnings[] = array($lang['configcheck_sitecache_integrity']); |
|
136 | 136 | } |
137 | 137 | |
138 | -if (!is_writable(MODX_BASE_PATH . "assets/images/")) { |
|
138 | +if (!is_writable(MODX_BASE_PATH."assets/images/")) { |
|
139 | 139 | $warningspresent = 1; |
140 | 140 | $warnings[] = array($_lang['configcheck_images']); |
141 | 141 | } |
142 | 142 | |
143 | -if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) { |
|
143 | +if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) { |
|
144 | 144 | $warningspresent = 1; |
145 | 145 | $warnings[] = array($_lang['configcheck_rb_base_dir']); |
146 | 146 | } |
147 | -if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) { |
|
147 | +if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) { |
|
148 | 148 | $warningspresent = 1; |
149 | 149 | $warnings[] = array($_lang['configcheck_filemanager_path']); |
150 | 150 | } |
@@ -152,36 +152,36 @@ discard block |
||
152 | 152 | // clear file info cache |
153 | 153 | clearstatcache(); |
154 | 154 | |
155 | -if ($warningspresent==1) { |
|
155 | +if ($warningspresent == 1) { |
|
156 | 156 | |
157 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
157 | +if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3'; |
|
158 | 158 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
159 | 159 | |
160 | -for ($i=0;$i<count($warnings);$i++) { |
|
160 | +for ($i = 0; $i < count($warnings); $i++) { |
|
161 | 161 | switch ($warnings[$i][0]) { |
162 | 162 | case $_lang['configcheck_configinc']; |
163 | 163 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
164 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
164 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
165 | 165 | break; |
166 | 166 | case $_lang['configcheck_installer'] : |
167 | 167 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
168 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
168 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
169 | 169 | break; |
170 | 170 | case $_lang['configcheck_cache'] : |
171 | 171 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
172 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
172 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
173 | 173 | break; |
174 | 174 | case $_lang['configcheck_images'] : |
175 | 175 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
176 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
176 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
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>'; |
|
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 | 183 | } |
184 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
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'] : |
187 | 187 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -203,18 +203,18 @@ discard block |
||
203 | 203 | break; |
204 | 204 | case $_lang['configcheck_validate_referer'] : |
205 | 205 | $msg = $_lang['configcheck_validate_referer_msg']; |
206 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
206 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
207 | 207 | $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
208 | 208 | break; |
209 | 209 | case $_lang['configcheck_templateswitcher_present'] : |
210 | 210 | $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
211 | - if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
212 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
211 | + if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
212 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"]; |
|
213 | 213 | } |
214 | - if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
215 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
214 | + if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
215 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"]; |
|
216 | 216 | } |
217 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
217 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
218 | 218 | $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
219 | 219 | break; |
220 | 220 | case $_lang['configcheck_rb_base_dir'] : |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $warnings[$i][1] = $_lang['configcheck_default_msg']; |
228 | 228 | } |
229 | 229 | |
230 | - $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |
|
230 | + $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : ""; |
|
231 | 231 | $config_check_results .= " |
232 | 232 | <fieldset> |
233 | 233 | <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p> |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')." |
237 | 237 | </fieldset> |
238 | 238 | "; |
239 | - if ($i!=count($warnings)-1) { |
|
239 | + if ($i != count($warnings) - 1) { |
|
240 | 240 | $config_check_results .= "<br />"; |
241 | 241 | } |
242 | 242 | } |
243 | - $_SESSION["mgrConfigCheck"]=true; |
|
243 | + $_SESSION["mgrConfigCheck"] = true; |
|
244 | 244 | } else { |
245 | 245 | $config_check_results = $_lang['configcheck_ok']; |
246 | 246 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | // PROCESSOR FIRST |
5 | 7 | if($_SESSION['mgrRole'] == 1) { |
@@ -17,12 +19,12 @@ discard block |
||
17 | 19 | $warningspresent = 0; |
18 | 20 | |
19 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
20 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check!=='0') { |
|
21 | 23 | $warningspresent = 1; |
22 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
23 | 25 | } |
24 | 26 | |
25 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
26 | 28 | // Warn if world writable |
27 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
28 | 30 | $warningspresent = 1; |
@@ -115,7 +117,8 @@ discard block |
||
115 | 117 | } |
116 | 118 | |
117 | 119 | if (!function_exists('checkSiteCache')) { |
118 | - function checkSiteCache() { |
|
120 | + function checkSiteCache() |
|
121 | + { |
|
119 | 122 | global $modx; |
120 | 123 | $checked= true; |
121 | 124 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -154,26 +157,36 @@ discard block |
||
154 | 157 | |
155 | 158 | if ($warningspresent==1) { |
156 | 159 | |
157 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
160 | +if(!isset($modx->config['send_errormail'])) { |
|
161 | + $modx->config['send_errormail']='3'; |
|
162 | +} |
|
158 | 163 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
159 | 164 | |
160 | 165 | for ($i=0;$i<count($warnings);$i++) { |
161 | 166 | switch ($warnings[$i][0]) { |
162 | 167 | case $_lang['configcheck_configinc']; |
163 | 168 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
164 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
169 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
170 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
171 | + } |
|
165 | 172 | break; |
166 | 173 | case $_lang['configcheck_installer'] : |
167 | 174 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
168 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
175 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
176 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
177 | + } |
|
169 | 178 | break; |
170 | 179 | case $_lang['configcheck_cache'] : |
171 | 180 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
172 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
181 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
182 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
183 | + } |
|
173 | 184 | break; |
174 | 185 | case $_lang['configcheck_images'] : |
175 | 186 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
176 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
187 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
188 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
189 | + } |
|
177 | 190 | break; |
178 | 191 | case $_lang['configcheck_sysfiles_mod']: |
179 | 192 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -181,7 +194,9 @@ discard block |
||
181 | 194 | if($modx->hasPermission('settings')) { |
182 | 195 | $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 | 196 | } |
184 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
197 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
198 | + $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
199 | + } |
|
185 | 200 | break; |
186 | 201 | case $_lang['configcheck_lang_difference'] : |
187 | 202 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | </script> |
90 | 90 | |
91 | -JS; |
|
91 | +js; |
|
92 | 92 | $modx->regClientScript($script); |
93 | 93 | } |
94 | 94 | } |
@@ -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 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | - function __construct() { |
|
12 | + function __construct(){ |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -17,46 +17,46 @@ discard block |
||
17 | 17 | * @param array $data |
18 | 18 | * @return string |
19 | 19 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
20 | + public function output($config = array(), $data = array()){ |
|
21 | 21 | global $modx; |
22 | 22 | |
23 | 23 | $output = ''; |
24 | 24 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
26 | 26 | |
27 | - if($action) { |
|
27 | + if ($action) { |
|
28 | 28 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
30 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
31 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
29 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
30 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
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)) { |
|
34 | + if ($modx->db->getRecordCount($sql)) { |
|
35 | 35 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
36 | + while ($row = $modx->db->getRow($sql)) { |
|
37 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 38 | $row['value'] = $data[$row['name']]; |
39 | 39 | } |
40 | 40 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 41 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 42 | } |
43 | 43 | |
44 | - if(!empty($config['toArray'])) { |
|
44 | + if (!empty($config['toArray'])) { |
|
45 | 45 | $output = $tabs; |
46 | 46 | } else { |
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
47 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
48 | 48 | $output .= ' |
49 | 49 | <script type="text/javascript"> |
50 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
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 . '">'; |
|
53 | + foreach ($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
55 | 55 | $output .= ' |
56 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
57 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
56 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
57 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
58 | 58 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
59 | + foreach ($tab as $item) { |
|
60 | 60 | $output .= $item; |
61 | 61 | } |
62 | 62 | $output .= '</div>'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return $output; |
70 | 70 | } |
71 | 71 | |
72 | - private function render($data) { |
|
72 | + private function render($data){ |
|
73 | 73 | global $modx, $_lang, $_country_lang; |
74 | 74 | |
75 | 75 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $output = ''; |
80 | 80 | $output .= '<div class="form-group row">'; |
81 | 81 | |
82 | - switch($data['type']) { |
|
82 | + switch ($data['type']) { |
|
83 | 83 | |
84 | 84 | case 'text': |
85 | 85 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 114 | $output .= '<div class="col-sm-7">'; |
115 | 115 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
116 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 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>'; |
|
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 | 121 | } |
122 | 122 | } else { |
123 | - if($data['elements']) { |
|
123 | + if ($data['elements']) { |
|
124 | 124 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
125 | + foreach ($elements as $key => $value) { |
|
126 | 126 | $value = explode('==', $value); |
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
127 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 139 | $output .= '<div class="col-sm-7">'; |
140 | 140 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
141 | + if ($data['elements']) { |
|
142 | 142 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
143 | + foreach ($elements as $key => $value) { |
|
144 | 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]); |
|
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 | 146 | } |
147 | 147 | } |
148 | 148 | $output .= $data['content']; |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 155 | $output .= '<div class="col-sm-7">'; |
156 | 156 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
157 | + if ($data['elements']) { |
|
158 | 158 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
159 | + foreach ($elements as $key => $value) { |
|
160 | 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]); |
|
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 | 162 | } |
163 | 163 | } |
164 | 164 | $output .= $data['content']; |
@@ -7,9 +7,11 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser |
|
11 | +{ |
|
11 | 12 | |
12 | - function __construct() { |
|
13 | + function __construct() |
|
14 | + { |
|
13 | 15 | } |
14 | 16 | |
15 | 17 | /** |
@@ -17,46 +19,47 @@ discard block |
||
17 | 19 | * @param array $data |
18 | 20 | * @return string |
19 | 21 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
22 | + public function output($config = array(), $data = array()) |
|
23 | + { |
|
21 | 24 | global $modx; |
22 | 25 | |
23 | 26 | $output = ''; |
24 | 27 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | 28 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
26 | 29 | |
27 | - if($action) { |
|
30 | + if($action) { |
|
28 | 31 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | 32 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
30 | 33 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
31 | 34 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
32 | 35 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 36 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
37 | + if($modx->db->getRecordCount($sql)) { |
|
35 | 38 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
39 | + while($row = $modx->db->getRow($sql)) { |
|
40 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 41 | $row['value'] = $data[$row['name']]; |
39 | 42 | } |
40 | 43 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 44 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 45 | } |
43 | 46 | |
44 | - if(!empty($config['toArray'])) { |
|
47 | + if(!empty($config['toArray'])) { |
|
45 | 48 | $output = $tabs; |
46 | - } else { |
|
49 | + } else { |
|
47 | 50 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
48 | 51 | $output .= ' |
49 | 52 | <script type="text/javascript"> |
50 | 53 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
51 | 54 | </script>'; |
52 | 55 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
56 | + foreach($tabs as $idTab => $tab) { |
|
54 | 57 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
55 | 58 | $output .= ' |
56 | 59 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
57 | 60 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
58 | 61 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
62 | + foreach($tab as $item) { |
|
60 | 63 | $output .= $item; |
61 | 64 | } |
62 | 65 | $output .= '</div>'; |
@@ -69,7 +72,8 @@ discard block |
||
69 | 72 | return $output; |
70 | 73 | } |
71 | 74 | |
72 | - private function render($data) { |
|
75 | + private function render($data) |
|
76 | + { |
|
73 | 77 | global $modx, $_lang, $_country_lang; |
74 | 78 | |
75 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +83,7 @@ discard block |
||
79 | 83 | $output = ''; |
80 | 84 | $output .= '<div class="form-group row">'; |
81 | 85 | |
82 | - switch($data['type']) { |
|
86 | + switch($data['type']) { |
|
83 | 87 | |
84 | 88 | case 'text': |
85 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,16 +117,16 @@ discard block |
||
113 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 118 | $output .= '<div class="col-sm-7">'; |
115 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
118 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
119 | - foreach($_country_lang as $key => $value) { |
|
123 | + foreach($_country_lang as $key => $value) { |
|
120 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
121 | 125 | } |
122 | - } else { |
|
123 | - if($data['elements']) { |
|
126 | + } else { |
|
127 | + if($data['elements']) { |
|
124 | 128 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
129 | + foreach($elements as $key => $value) { |
|
126 | 130 | $value = explode('==', $value); |
127 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
128 | 132 | } |
@@ -138,9 +142,9 @@ discard block |
||
138 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 143 | $output .= '<div class="col-sm-7">'; |
140 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
145 | + if($data['elements']) { |
|
142 | 146 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
147 | + foreach($elements as $key => $value) { |
|
144 | 148 | $value = explode('==', $value); |
145 | 149 | $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 | 150 | } |
@@ -154,9 +158,9 @@ discard block |
||
154 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 159 | $output .= '<div class="col-sm-7">'; |
156 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
161 | + if($data['elements']) { |
|
158 | 162 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
163 | + foreach($elements as $key => $value) { |
|
160 | 164 | $value = explode('==', $value); |
161 | 165 | $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 | 166 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +class TemplateParser { |
|
11 | 11 | |
12 | 12 | function __construct() { |
13 | 13 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | // show debug information |
5 | 5 | if(isset($enable_debug) && $enable_debug==true) { |
6 | - ?> |
|
6 | + ?> |
|
7 | 7 | <script language="javascript"> |
8 | 8 | //document.onload = removeDebug(); |
9 | 9 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | </style> |
35 | 35 | <?php |
36 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | - ?> |
|
36 | + $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | + ?> |
|
38 | 38 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
39 | 39 | <table border="0" cellspacing="0" cellpadding="0"> |
40 | 40 | <tr> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | 3 | |
4 | 4 | // show debug information |
5 | -if(isset($enable_debug) && $enable_debug==true) { |
|
5 | +if (isset($enable_debug) && $enable_debug == true) { |
|
6 | 6 | ?> |
7 | 7 | <script language="javascript"> |
8 | 8 | //document.onload = removeDebug(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | </style> |
35 | 35 | <?php |
36 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
36 | + $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | 37 | ?> |
38 | 38 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
39 | 39 | <table border="0" cellspacing="0" cellpadding="0"> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | </tr> |
43 | 43 | <tr> |
44 | 44 | <td width="70">Time taken</td> |
45 | - <td width="80"><?php echo printf ("%6.5f s", $totaltime); ?></td> |
|
45 | + <td width="80"><?php echo printf("%6.5f s", $totaltime); ?></td> |
|
46 | 46 | </tr> |
47 | 47 | </table> |
48 | 48 | </div> |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | // show debug information |
5 | 7 | if(isset($enable_debug) && $enable_debug==true) { |
@@ -4,59 +4,59 @@ |
||
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | 6 | class ContextMenu { |
7 | - var $id; |
|
7 | + var $id; |
|
8 | 8 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
10 | - global $ContextMenuCnt; |
|
11 | - $ContextMenuCnt++; |
|
12 | - $this->html = ""; |
|
13 | - $this->visible = $visible ? $visible : false; |
|
14 | - $this->width = is_numeric($width) ? intval($width) : 120; |
|
15 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
16 | - } |
|
9 | + function __construct($id = '', $width = 120, $visible = false) { |
|
10 | + global $ContextMenuCnt; |
|
11 | + $ContextMenuCnt++; |
|
12 | + $this->html = ""; |
|
13 | + $this->visible = $visible ? $visible : false; |
|
14 | + $this->width = is_numeric($width) ? intval($width) : 120; |
|
15 | + $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
16 | + } |
|
17 | 17 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
19 | - global $base_url, $_style; |
|
18 | + function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
19 | + global $base_url, $_style; |
|
20 | 20 | if($disabled) { |
21 | 21 | return; |
22 | 22 | } |
23 | - if(!$img) { |
|
24 | - $img = $base_url . $_style['tx']; |
|
25 | - } |
|
26 | - if(substr($action, 0, 3) == "js:") { |
|
27 | - $action = substr($action, 3); |
|
28 | - } else if(substr($action, 0, 3) == "hl:") { |
|
29 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
30 | - } else { |
|
31 | - $action = "window.location.href='" . $action . "'"; |
|
32 | - } |
|
33 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
23 | + if(!$img) { |
|
24 | + $img = $base_url . $_style['tx']; |
|
25 | + } |
|
26 | + if(substr($action, 0, 3) == "js:") { |
|
27 | + $action = substr($action, 3); |
|
28 | + } else if(substr($action, 0, 3) == "hl:") { |
|
29 | + $action = "window.location.href='" . substr($action, 3) . "'"; |
|
30 | + } else { |
|
31 | + $action = "window.location.href='" . $action . "'"; |
|
32 | + } |
|
33 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | + $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
35 | 35 | if(substr($img, 0, 5) == 'fa fa') { |
36 | 36 | $img = '<i class="' . $img . '"></i>'; |
37 | 37 | } else if(substr($img, 0, 1) != '<') { |
38 | 38 | $img = '<img src="' . $img . '" />'; |
39 | 39 | } |
40 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
41 | - } |
|
40 | + $this->html .= $img . ' ' . $text . '</div>'; |
|
41 | + } |
|
42 | 42 | |
43 | - function addSeparator() { |
|
44 | - $this->html .= " |
|
43 | + function addSeparator() { |
|
44 | + $this->html .= " |
|
45 | 45 | <div class='cntxMnuSeparator'></div> |
46 | 46 | "; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - function render() { |
|
50 | - global $ContextMenuScript; |
|
49 | + function render() { |
|
50 | + global $ContextMenuScript; |
|
51 | 51 | |
52 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
53 | - $ContextMenuScript = ""; // reset css |
|
54 | - return $html; |
|
55 | - } |
|
52 | + $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
53 | + $ContextMenuScript = ""; // reset css |
|
54 | + return $html; |
|
55 | + } |
|
56 | 56 | |
57 | - function getClientScriptObject() { |
|
58 | - return "getCntxMenu('" . $this->id . "')"; |
|
59 | - } |
|
57 | + function getClientScriptObject() { |
|
58 | + return "getCntxMenu('" . $this->id . "')"; |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $ContextMenuScript = <<<BLOCK |
@@ -3,59 +3,59 @@ |
||
3 | 3 | global $ContextMenuCnt; |
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | -class ContextMenu { |
|
6 | +class ContextMenu{ |
|
7 | 7 | var $id; |
8 | 8 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
9 | + function __construct($id = '', $width = 120, $visible = false){ |
|
10 | 10 | global $ContextMenuCnt; |
11 | 11 | $ContextMenuCnt++; |
12 | 12 | $this->html = ""; |
13 | 13 | $this->visible = $visible ? $visible : false; |
14 | 14 | $this->width = is_numeric($width) ? intval($width) : 120; |
15 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
15 | + $this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id |
|
16 | 16 | } |
17 | 17 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
18 | + function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
19 | 19 | global $base_url, $_style; |
20 | - if($disabled) { |
|
20 | + if ($disabled) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | - if(!$img) { |
|
24 | - $img = $base_url . $_style['tx']; |
|
23 | + if (!$img) { |
|
24 | + $img = $base_url.$_style['tx']; |
|
25 | 25 | } |
26 | - if(substr($action, 0, 3) == "js:") { |
|
26 | + if (substr($action, 0, 3) == "js:") { |
|
27 | 27 | $action = substr($action, 3); |
28 | - } else if(substr($action, 0, 3) == "hl:") { |
|
29 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
28 | + } else if (substr($action, 0, 3) == "hl:") { |
|
29 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
30 | 30 | } else { |
31 | - $action = "window.location.href='" . $action . "'"; |
|
31 | + $action = "window.location.href='".$action."'"; |
|
32 | 32 | } |
33 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
35 | - if(substr($img, 0, 5) == 'fa fa') { |
|
36 | - $img = '<i class="' . $img . '"></i>'; |
|
37 | - } else if(substr($img, 0, 1) != '<') { |
|
38 | - $img = '<img src="' . $img . '" />'; |
|
33 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
34 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
35 | + if (substr($img, 0, 5) == 'fa fa') { |
|
36 | + $img = '<i class="'.$img.'"></i>'; |
|
37 | + } else if (substr($img, 0, 1) != '<') { |
|
38 | + $img = '<img src="'.$img.'" />'; |
|
39 | 39 | } |
40 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
40 | + $this->html .= $img.' '.$text.'</div>'; |
|
41 | 41 | } |
42 | 42 | |
43 | - function addSeparator() { |
|
43 | + function addSeparator(){ |
|
44 | 44 | $this->html .= " |
45 | 45 | <div class='cntxMnuSeparator'></div> |
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | - function render() { |
|
49 | + function render(){ |
|
50 | 50 | global $ContextMenuScript; |
51 | 51 | |
52 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
52 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
53 | 53 | $ContextMenuScript = ""; // reset css |
54 | 54 | return $html; |
55 | 55 | } |
56 | 56 | |
57 | - function getClientScriptObject() { |
|
58 | - return "getCntxMenu('" . $this->id . "')"; |
|
57 | + function getClientScriptObject(){ |
|
58 | + return "getCntxMenu('".$this->id."')"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -3,10 +3,12 @@ discard block |
||
3 | 3 | global $ContextMenuCnt; |
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | -class ContextMenu { |
|
6 | +class ContextMenu |
|
7 | +{ |
|
7 | 8 | var $id; |
8 | 9 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
10 | + function __construct($id = '', $width = 120, $visible = false) |
|
11 | + { |
|
10 | 12 | global $ContextMenuCnt; |
11 | 13 | $ContextMenuCnt++; |
12 | 14 | $this->html = ""; |
@@ -15,7 +17,8 @@ discard block |
||
15 | 17 | $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
16 | 18 | } |
17 | 19 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
20 | + function addItem($text, $action = "", $img = "", $disabled = 0) |
|
21 | + { |
|
19 | 22 | global $base_url, $_style; |
20 | 23 | if($disabled) { |
21 | 24 | return; |
@@ -40,13 +43,15 @@ discard block |
||
40 | 43 | $this->html .= $img . ' ' . $text . '</div>'; |
41 | 44 | } |
42 | 45 | |
43 | - function addSeparator() { |
|
46 | + function addSeparator() |
|
47 | + { |
|
44 | 48 | $this->html .= " |
45 | 49 | <div class='cntxMnuSeparator'></div> |
46 | 50 | "; |
47 | 51 | } |
48 | 52 | |
49 | - function render() { |
|
53 | + function render() |
|
54 | + { |
|
50 | 55 | global $ContextMenuScript; |
51 | 56 | |
52 | 57 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
@@ -54,7 +59,8 @@ discard block |
||
54 | 59 | return $html; |
55 | 60 | } |
56 | 61 | |
57 | - function getClientScriptObject() { |
|
62 | + function getClientScriptObject() |
|
63 | + { |
|
58 | 64 | return "getCntxMenu('" . $this->id . "')"; |
59 | 65 | } |
60 | 66 | } |
@@ -69,4 +69,4 @@ |
||
69 | 69 | cm.style.visibility = 'hidden'; |
70 | 70 | } |
71 | 71 | </script> |
72 | -BLOCK; |
|
72 | +block; |
@@ -128,10 +128,10 @@ |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | return base64_encode( |
131 | - 'user=' . |
|
132 | - $this->oauthUserEmail . |
|
133 | - "\001auth=Bearer " . |
|
134 | - $this->oauthToken . |
|
131 | + 'user='. |
|
132 | + $this->oauthUserEmail. |
|
133 | + "\001auth=Bearer ". |
|
134 | + $this->oauthToken. |
|
135 | 135 | "\001\001" |
136 | 136 | ); |
137 | 137 | } |
@@ -34,6 +34,6 @@ |
||
34 | 34 | */ |
35 | 35 | public function errorMessage() |
36 | 36 | { |
37 | - return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n"; |
|
37 | + return '<strong>'.htmlspecialchars($this->getMessage())."</strong><br />\n"; |
|
38 | 38 | } |
39 | 39 | } |