@@ -14,7 +14,7 @@ |
||
14 | 14 | if (!empty($user_id)) { |
15 | 15 | // Raymond: grab the user settings from the database. |
16 | 16 | $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), |
17 | - "user=" . $modx->getLoginUserID()); |
|
17 | + "user=".$modx->getLoginUserID()); |
|
18 | 18 | |
19 | 19 | $which_browser_default = $which_browser; |
20 | 20 | while ($row = $modx->db->getRow($rs)) { |
@@ -20,14 +20,14 @@ |
||
20 | 20 | ($docid > 0 ? "id='$docid'" : "privateweb = 1")); |
21 | 21 | $rs = $modx->db->select( |
22 | 22 | 'DISTINCT sc.id', |
23 | - $modx->getFullTableName("site_content") . " sc |
|
24 | - LEFT JOIN " . $modx->getFullTableName("document_groups") . " dg ON dg.document = sc.id |
|
25 | - LEFT JOIN " . $modx->getFullTableName("webgroup_access") . " wga ON wga.documentgroup = dg.document_group", |
|
26 | - ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "wga.id>0" |
|
23 | + $modx->getFullTableName("site_content")." sc |
|
24 | + LEFT JOIN " . $modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
|
25 | + LEFT JOIN " . $modx->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group", |
|
26 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."wga.id>0" |
|
27 | 27 | ); |
28 | 28 | $ids = $modx->db->getColumn("id", $rs); |
29 | 29 | if (count($ids) > 0) { |
30 | 30 | $modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), |
31 | - "id IN (" . implode(", ", $ids) . ")"); |
|
31 | + "id IN (".implode(", ", $ids).")"); |
|
32 | 32 | } |
33 | 33 | } |
@@ -4,15 +4,15 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), |
7 | - "recipient=" . $modx->getLoginUserID() . " AND messageread=0"); |
|
7 | + "recipient=".$modx->getLoginUserID()." AND messageread=0"); |
|
8 | 8 | $nrnewmessages = $modx->db->getValue($rs); |
9 | -$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID()); |
|
9 | +$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()); |
|
10 | 10 | $nrtotalmessages = $modx->db->getValue($rs); |
11 | 11 | $messagesallowed = $modx->hasPermission('messages'); |
12 | 12 | |
13 | 13 | // ajax response |
14 | 14 | if (isset($_POST['updateMsgCount'])) { |
15 | 15 | header("Content-Type: application/json; charset=utf-8"); |
16 | - print $nrnewmessages . ',' . $nrtotalmessages; |
|
16 | + print $nrnewmessages.','.$nrtotalmessages; |
|
17 | 17 | exit; |
18 | 18 | } |
@@ -10,178 +10,178 @@ |
||
10 | 10 | Class TemplateParser { |
11 | 11 | |
12 | 12 | /** |
13 | - * @param array $config [action, tabs, toArray] |
|
14 | - * @param array $data |
|
15 | - * @return string |
|
16 | - */ |
|
17 | - public function output($config = array(), $data = array()) { |
|
18 | - global $modx; |
|
19 | - |
|
20 | - $output = ''; |
|
21 | - $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
22 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
23 | - |
|
24 | - if($action) { |
|
25 | - $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
13 | + * @param array $config [action, tabs, toArray] |
|
14 | + * @param array $data |
|
15 | + * @return string |
|
16 | + */ |
|
17 | + public function output($config = array(), $data = array()) { |
|
18 | + global $modx; |
|
19 | + |
|
20 | + $output = ''; |
|
21 | + $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
22 | + $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
23 | + |
|
24 | + if($action) { |
|
25 | + $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
26 | 26 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
27 | 27 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
28 | 28 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
29 | 29 | ORDER BY t1.tab ASC, t1.rank ASC'); |
30 | 30 | |
31 | - if($modx->db->getRecordCount($sql)) { |
|
32 | - $tabs = array(); |
|
33 | - while($row = $modx->db->getRow($sql)) { |
|
34 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | - $row['value'] = $data[$row['name']]; |
|
36 | - } |
|
37 | - $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
38 | - $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
39 | - } |
|
40 | - |
|
41 | - if(!empty($config['toArray'])) { |
|
42 | - $output = $tabs; |
|
43 | - } else { |
|
44 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
45 | - $output .= ' |
|
31 | + if($modx->db->getRecordCount($sql)) { |
|
32 | + $tabs = array(); |
|
33 | + while($row = $modx->db->getRow($sql)) { |
|
34 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | + $row['value'] = $data[$row['name']]; |
|
36 | + } |
|
37 | + $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
38 | + $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
39 | + } |
|
40 | + |
|
41 | + if(!empty($config['toArray'])) { |
|
42 | + $output = $tabs; |
|
43 | + } else { |
|
44 | + $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
45 | + $output .= ' |
|
46 | 46 | <script type="text/javascript"> |
47 | 47 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
48 | 48 | </script>'; |
49 | 49 | |
50 | - foreach($tabs as $idTab => $tab) { |
|
51 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
52 | - $output .= ' |
|
50 | + foreach($tabs as $idTab => $tab) { |
|
51 | + $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
52 | + $output .= ' |
|
53 | 53 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
54 | 54 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
55 | - unset($tab['category_name']); |
|
56 | - foreach($tab as $item) { |
|
57 | - $output .= $item; |
|
58 | - } |
|
59 | - $output .= '</div>'; |
|
60 | - } |
|
61 | - $output .= '</div>'; |
|
62 | - } |
|
63 | - } |
|
64 | - } |
|
65 | - |
|
66 | - return $output; |
|
67 | - } |
|
55 | + unset($tab['category_name']); |
|
56 | + foreach($tab as $item) { |
|
57 | + $output .= $item; |
|
58 | + } |
|
59 | + $output .= '</div>'; |
|
60 | + } |
|
61 | + $output .= '</div>'; |
|
62 | + } |
|
63 | + } |
|
64 | + } |
|
65 | + |
|
66 | + return $output; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @param array $data |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - private function render($data) { |
|
74 | - global $modx, $_lang, $_country_lang; |
|
73 | + private function render($data) { |
|
74 | + global $modx, $_lang, $_country_lang; |
|
75 | 75 | |
76 | - $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
77 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
78 | - $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
76 | + $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
77 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
78 | + $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
79 | 79 | |
80 | - $output = ''; |
|
81 | - $output .= '<div class="form-group row">'; |
|
80 | + $output = ''; |
|
81 | + $output .= '<div class="form-group row">'; |
|
82 | 82 | |
83 | - switch($data['type']) { |
|
83 | + switch($data['type']) { |
|
84 | 84 | |
85 | - case 'text': |
|
86 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
85 | + case 'text': |
|
86 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
87 | 87 | <div class="col-sm-7"> |
88 | 88 | <input type="text" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
89 | - $output .= $data['content']; |
|
90 | - $output .= '</div>'; |
|
89 | + $output .= $data['content']; |
|
90 | + $output .= '</div>'; |
|
91 | 91 | |
92 | - break; |
|
92 | + break; |
|
93 | 93 | |
94 | - case 'textarea': |
|
95 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
94 | + case 'textarea': |
|
95 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
96 | 96 | <div class="col-sm-7"> |
97 | 97 | <textarea name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;"[+readonly+]>[+value+]</textarea>'; |
98 | - $output .= $data['content']; |
|
99 | - $output .= '</div>'; |
|
98 | + $output .= $data['content']; |
|
99 | + $output .= '</div>'; |
|
100 | 100 | |
101 | - break; |
|
101 | + break; |
|
102 | 102 | |
103 | - case 'date': |
|
104 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
105 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
103 | + case 'date': |
|
104 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
105 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
106 | 106 | <div class="col-sm-7"> |
107 | 107 | <input type="text" name="[+name+]" class="form-control DatePicker" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
108 | - $output .= $data['content']; |
|
109 | - $output .= '</div>'; |
|
110 | - |
|
111 | - break; |
|
112 | - |
|
113 | - case 'select': |
|
114 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
115 | - $output .= '<div class="col-sm-7">'; |
|
116 | - $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
117 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | - $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
119 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
120 | - foreach($_country_lang as $key => $value) { |
|
121 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
122 | - } |
|
123 | - } else { |
|
124 | - if($data['elements']) { |
|
125 | - $elements = explode('||', $data['elements']); |
|
126 | - foreach($elements as $key => $value) { |
|
127 | - $value = explode('==', $value); |
|
128 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
129 | - } |
|
130 | - } |
|
131 | - } |
|
132 | - $output .= '</select>'; |
|
133 | - $output .= $data['content']; |
|
134 | - $output .= '</div>'; |
|
135 | - |
|
136 | - break; |
|
137 | - |
|
138 | - case 'checkbox': |
|
139 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
140 | - $output .= '<div class="col-sm-7">'; |
|
141 | - $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
142 | - if($data['elements']) { |
|
143 | - $elements = explode('||', $data['elements']); |
|
144 | - foreach($elements as $key => $value) { |
|
145 | - $value = explode('==', $value); |
|
146 | - $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]); |
|
147 | - } |
|
148 | - } |
|
149 | - $output .= $data['content']; |
|
150 | - $output .= '</div>'; |
|
151 | - |
|
152 | - break; |
|
153 | - |
|
154 | - case 'radio': |
|
155 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
156 | - $output .= '<div class="col-sm-7">'; |
|
157 | - $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
158 | - if($data['elements']) { |
|
159 | - $elements = explode('||', $data['elements']); |
|
160 | - foreach($elements as $key => $value) { |
|
161 | - $value = explode('==', $value); |
|
162 | - $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]); |
|
163 | - } |
|
164 | - } |
|
165 | - $output .= $data['content']; |
|
166 | - $output .= '</div>'; |
|
167 | - |
|
168 | - break; |
|
169 | - |
|
170 | - case 'custom': |
|
171 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
172 | - $output .= '<div class="col-sm-7">'; |
|
173 | - $output .= $data['content']; |
|
174 | - $output .= '</div>'; |
|
175 | - |
|
176 | - break; |
|
177 | - } |
|
178 | - |
|
179 | - $output .= '</div>'; |
|
180 | - |
|
181 | - $output = $modx->parseText($output, $data); |
|
182 | - |
|
183 | - return $output; |
|
184 | - } |
|
108 | + $output .= $data['content']; |
|
109 | + $output .= '</div>'; |
|
110 | + |
|
111 | + break; |
|
112 | + |
|
113 | + case 'select': |
|
114 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
115 | + $output .= '<div class="col-sm-7">'; |
|
116 | + $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
117 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | + $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
119 | + $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
120 | + foreach($_country_lang as $key => $value) { |
|
121 | + $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
122 | + } |
|
123 | + } else { |
|
124 | + if($data['elements']) { |
|
125 | + $elements = explode('||', $data['elements']); |
|
126 | + foreach($elements as $key => $value) { |
|
127 | + $value = explode('==', $value); |
|
128 | + $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
129 | + } |
|
130 | + } |
|
131 | + } |
|
132 | + $output .= '</select>'; |
|
133 | + $output .= $data['content']; |
|
134 | + $output .= '</div>'; |
|
135 | + |
|
136 | + break; |
|
137 | + |
|
138 | + case 'checkbox': |
|
139 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
140 | + $output .= '<div class="col-sm-7">'; |
|
141 | + $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
142 | + if($data['elements']) { |
|
143 | + $elements = explode('||', $data['elements']); |
|
144 | + foreach($elements as $key => $value) { |
|
145 | + $value = explode('==', $value); |
|
146 | + $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]); |
|
147 | + } |
|
148 | + } |
|
149 | + $output .= $data['content']; |
|
150 | + $output .= '</div>'; |
|
151 | + |
|
152 | + break; |
|
153 | + |
|
154 | + case 'radio': |
|
155 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
156 | + $output .= '<div class="col-sm-7">'; |
|
157 | + $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
158 | + if($data['elements']) { |
|
159 | + $elements = explode('||', $data['elements']); |
|
160 | + foreach($elements as $key => $value) { |
|
161 | + $value = explode('==', $value); |
|
162 | + $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]); |
|
163 | + } |
|
164 | + } |
|
165 | + $output .= $data['content']; |
|
166 | + $output .= '</div>'; |
|
167 | + |
|
168 | + break; |
|
169 | + |
|
170 | + case 'custom': |
|
171 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
172 | + $output .= '<div class="col-sm-7">'; |
|
173 | + $output .= $data['content']; |
|
174 | + $output .= '</div>'; |
|
175 | + |
|
176 | + break; |
|
177 | + } |
|
178 | + |
|
179 | + $output .= '</div>'; |
|
180 | + |
|
181 | + $output = $modx->parseText($output, $data); |
|
182 | + |
|
183 | + return $output; |
|
184 | + } |
|
185 | 185 | |
186 | 186 | } |
187 | 187 |
@@ -7,53 +7,53 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @param array $config [action, tabs, toArray] |
14 | 14 | * @param array $data |
15 | 15 | * @return string |
16 | 16 | */ |
17 | - public function output($config = array(), $data = array()) { |
|
17 | + public function output($config = array(), $data = array()){ |
|
18 | 18 | global $modx; |
19 | 19 | |
20 | 20 | $output = ''; |
21 | 21 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
22 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
22 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
23 | 23 | |
24 | - if($action) { |
|
24 | + if ($action) { |
|
25 | 25 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
26 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
27 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
28 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
26 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
27 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
28 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
29 | 29 | ORDER BY t1.tab ASC, t1.rank ASC'); |
30 | 30 | |
31 | - if($modx->db->getRecordCount($sql)) { |
|
31 | + if ($modx->db->getRecordCount($sql)) { |
|
32 | 32 | $tabs = array(); |
33 | - while($row = $modx->db->getRow($sql)) { |
|
34 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
33 | + while ($row = $modx->db->getRow($sql)) { |
|
34 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
35 | 35 | $row['value'] = $data[$row['name']]; |
36 | 36 | } |
37 | 37 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
38 | 38 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
39 | 39 | } |
40 | 40 | |
41 | - if(!empty($config['toArray'])) { |
|
41 | + if (!empty($config['toArray'])) { |
|
42 | 42 | $output = $tabs; |
43 | 43 | } else { |
44 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
44 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
45 | 45 | $output .= ' |
46 | 46 | <script type="text/javascript"> |
47 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
47 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
48 | 48 | </script>'; |
49 | 49 | |
50 | - foreach($tabs as $idTab => $tab) { |
|
51 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
50 | + foreach ($tabs as $idTab => $tab) { |
|
51 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
52 | 52 | $output .= ' |
53 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
54 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
53 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
54 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
55 | 55 | unset($tab['category_name']); |
56 | - foreach($tab as $item) { |
|
56 | + foreach ($tab as $item) { |
|
57 | 57 | $output .= $item; |
58 | 58 | } |
59 | 59 | $output .= '</div>'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array $data |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - private function render($data) { |
|
73 | + private function render($data){ |
|
74 | 74 | global $modx, $_lang, $_country_lang; |
75 | 75 | |
76 | 76 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $output = ''; |
81 | 81 | $output .= '<div class="form-group row">'; |
82 | 82 | |
83 | - switch($data['type']) { |
|
83 | + switch ($data['type']) { |
|
84 | 84 | |
85 | 85 | case 'text': |
86 | 86 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
115 | 115 | $output .= '<div class="col-sm-7">'; |
116 | 116 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
117 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | 118 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
119 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
120 | - foreach($_country_lang as $key => $value) { |
|
121 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
119 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
120 | + foreach ($_country_lang as $key => $value) { |
|
121 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
122 | 122 | } |
123 | 123 | } else { |
124 | - if($data['elements']) { |
|
124 | + if ($data['elements']) { |
|
125 | 125 | $elements = explode('||', $data['elements']); |
126 | - foreach($elements as $key => $value) { |
|
126 | + foreach ($elements as $key => $value) { |
|
127 | 127 | $value = explode('==', $value); |
128 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
140 | 140 | $output .= '<div class="col-sm-7">'; |
141 | 141 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
142 | - if($data['elements']) { |
|
142 | + if ($data['elements']) { |
|
143 | 143 | $elements = explode('||', $data['elements']); |
144 | - foreach($elements as $key => $value) { |
|
144 | + foreach ($elements as $key => $value) { |
|
145 | 145 | $value = explode('==', $value); |
146 | - $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 | + $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]); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | $output .= $data['content']; |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
156 | 156 | $output .= '<div class="col-sm-7">'; |
157 | 157 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
158 | - if($data['elements']) { |
|
158 | + if ($data['elements']) { |
|
159 | 159 | $elements = explode('||', $data['elements']); |
160 | - foreach($elements as $key => $value) { |
|
160 | + foreach ($elements as $key => $value) { |
|
161 | 161 | $value = explode('==', $value); |
162 | - $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 | + $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]); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | $output .= $data['content']; |
@@ -7,53 +7,55 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser |
|
11 | +{ |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * @param array $config [action, tabs, toArray] |
14 | 15 | * @param array $data |
15 | 16 | * @return string |
16 | 17 | */ |
17 | - public function output($config = array(), $data = array()) { |
|
18 | + public function output($config = array(), $data = array()) |
|
19 | + { |
|
18 | 20 | global $modx; |
19 | 21 | |
20 | 22 | $output = ''; |
21 | 23 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
22 | 24 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
23 | 25 | |
24 | - if($action) { |
|
26 | + if($action) { |
|
25 | 27 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
26 | 28 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
27 | 29 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
28 | 30 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
29 | 31 | ORDER BY t1.tab ASC, t1.rank ASC'); |
30 | 32 | |
31 | - if($modx->db->getRecordCount($sql)) { |
|
33 | + if($modx->db->getRecordCount($sql)) { |
|
32 | 34 | $tabs = array(); |
33 | - while($row = $modx->db->getRow($sql)) { |
|
34 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | + while($row = $modx->db->getRow($sql)) { |
|
36 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | 37 | $row['value'] = $data[$row['name']]; |
36 | 38 | } |
37 | 39 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
38 | 40 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
39 | 41 | } |
40 | 42 | |
41 | - if(!empty($config['toArray'])) { |
|
43 | + if(!empty($config['toArray'])) { |
|
42 | 44 | $output = $tabs; |
43 | - } else { |
|
45 | + } else { |
|
44 | 46 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
45 | 47 | $output .= ' |
46 | 48 | <script type="text/javascript"> |
47 | 49 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
48 | 50 | </script>'; |
49 | 51 | |
50 | - foreach($tabs as $idTab => $tab) { |
|
52 | + foreach($tabs as $idTab => $tab) { |
|
51 | 53 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
52 | 54 | $output .= ' |
53 | 55 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
54 | 56 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
55 | 57 | unset($tab['category_name']); |
56 | - foreach($tab as $item) { |
|
58 | + foreach($tab as $item) { |
|
57 | 59 | $output .= $item; |
58 | 60 | } |
59 | 61 | $output .= '</div>'; |
@@ -70,7 +72,8 @@ discard block |
||
70 | 72 | * @param array $data |
71 | 73 | * @return string |
72 | 74 | */ |
73 | - private function render($data) { |
|
75 | + private function render($data) |
|
76 | + { |
|
74 | 77 | global $modx, $_lang, $_country_lang; |
75 | 78 | |
76 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -80,7 +83,7 @@ discard block |
||
80 | 83 | $output = ''; |
81 | 84 | $output .= '<div class="form-group row">'; |
82 | 85 | |
83 | - switch($data['type']) { |
|
86 | + switch($data['type']) { |
|
84 | 87 | |
85 | 88 | case 'text': |
86 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -114,16 +117,16 @@ discard block |
||
114 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
115 | 118 | $output .= '<div class="col-sm-7">'; |
116 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
117 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
119 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
120 | - foreach($_country_lang as $key => $value) { |
|
123 | + foreach($_country_lang as $key => $value) { |
|
121 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
122 | 125 | } |
123 | - } else { |
|
124 | - if($data['elements']) { |
|
126 | + } else { |
|
127 | + if($data['elements']) { |
|
125 | 128 | $elements = explode('||', $data['elements']); |
126 | - foreach($elements as $key => $value) { |
|
129 | + foreach($elements as $key => $value) { |
|
127 | 130 | $value = explode('==', $value); |
128 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
129 | 132 | } |
@@ -139,9 +142,9 @@ discard block |
||
139 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
140 | 143 | $output .= '<div class="col-sm-7">'; |
141 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
142 | - if($data['elements']) { |
|
145 | + if($data['elements']) { |
|
143 | 146 | $elements = explode('||', $data['elements']); |
144 | - foreach($elements as $key => $value) { |
|
147 | + foreach($elements as $key => $value) { |
|
145 | 148 | $value = explode('==', $value); |
146 | 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]); |
147 | 150 | } |
@@ -155,9 +158,9 @@ discard block |
||
155 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
156 | 159 | $output .= '<div class="col-sm-7">'; |
157 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
158 | - if($data['elements']) { |
|
161 | + if($data['elements']) { |
|
159 | 162 | $elements = explode('||', $data['elements']); |
160 | - foreach($elements as $key => $value) { |
|
163 | + foreach($elements as $key => $value) { |
|
161 | 164 | $value = explode('==', $value); |
162 | 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]); |
163 | 166 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +class TemplateParser { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @param array $config [action, tabs, toArray] |
@@ -5,133 +5,133 @@ discard block |
||
5 | 5 | |
6 | 6 | // action list |
7 | 7 | $GLOBALS['action_list'] = array( |
8 | - '1' => 'Loading a frame(set)', |
|
9 | - '2' => 'Viewing home page/ online users', |
|
10 | - '3' => 'Viewing data for resource', |
|
11 | - '4' => 'Creating a resource', |
|
12 | - '5' => 'Saving resource', |
|
13 | - '6' => 'Deleting resource', |
|
14 | - '7' => 'Waiting while MODX cleans up', |
|
15 | - '8' => 'Logged out', |
|
16 | - '9' => 'Viewing help', |
|
17 | - '10' => 'Viewing/ composing messages', |
|
18 | - '11' => 'Creating a user', |
|
19 | - '12' => 'Editing user', |
|
20 | - '13' => 'Viewing logging', |
|
21 | - '14' => 'Editing a parser', |
|
22 | - '15' => 'Saving a parser', |
|
23 | - '16' => 'Editing template', |
|
24 | - '17' => 'Editing settings', |
|
25 | - '18' => 'Viewing Credits :)', |
|
26 | - '19' => 'Creating a new template', |
|
27 | - '20' => 'Saving template', |
|
28 | - '21' => 'Deleting template', |
|
29 | - '22' => 'Editing Snippet', |
|
30 | - '23' => 'Creating a new Snippet', |
|
31 | - '24' => 'Saving Snippet', |
|
32 | - '25' => 'Deleting Snippet', |
|
33 | - '26' => 'Refreshing site', |
|
34 | - '27' => 'Editing resource', |
|
35 | - '28' => 'Changing password', |
|
36 | - '29' => 'Error', |
|
37 | - '30' => 'Saving settings', |
|
38 | - '31' => 'Using file manager', |
|
39 | - '32' => 'Saving user', |
|
40 | - '33' => 'Deleting user', |
|
41 | - '34' => 'Saving new password', |
|
42 | - '35' => 'Editing role', |
|
43 | - '36' => 'Saving role', |
|
44 | - '37' => 'Deleting role', |
|
45 | - '38' => 'Creating new role', |
|
46 | - '40' => 'Editing Access Permissions', |
|
47 | - '41' => 'Editing Access Permissions', |
|
48 | - '42' => 'Editing Access Permissions', |
|
49 | - '43' => 'Editing Access Permissions', |
|
50 | - '44' => 'Editing Access Permissions', |
|
51 | - '45' => 'Idle', |
|
52 | - '46' => 'Editing Access Permissions', |
|
53 | - '47' => 'Editing Access Permissions', |
|
54 | - '48' => 'Editing Access Permissions', |
|
55 | - '49' => 'Editing Access Permissions', |
|
56 | - '50' => 'Editing Access Permissions', |
|
57 | - '51' => 'Moving resource', |
|
58 | - '52' => 'Moved resource', |
|
59 | - '53' => 'Viewing system info', |
|
60 | - '54' => 'Optimizing a table', |
|
61 | - '55' => 'Empty logs', |
|
62 | - '56' => 'Refresh resource tree', |
|
63 | - '57' => 'Refresh menu', |
|
64 | - '58' => 'Logged in', |
|
65 | - '59' => 'About MODX', |
|
66 | - '60' => 'Emptying Recycle Bin', |
|
67 | - '61' => 'Publishing a resource', |
|
68 | - '62' => 'Un-publishing a resource', |
|
69 | - '63' => 'Un-deleting a resource', |
|
70 | - '64' => 'Removing deleted content', |
|
71 | - '65' => 'Deleting a message', |
|
72 | - '66' => 'Sending a message', |
|
73 | - '67' => 'Removing locks', |
|
74 | - '68' => 'Viewing site logging', |
|
75 | - '69' => 'Viewing online visitors', |
|
76 | - '70' => 'Viewing site schedule', |
|
77 | - '71' => 'Searching', |
|
78 | - '72' => 'Adding a weblink', |
|
79 | - '73' => 'Editing a weblink', |
|
80 | - //case "74" : return "Changing personal preferences"; break; |
|
81 | - '75' => 'User/ role management', |
|
82 | - '76' => 'Element management', |
|
83 | - '77' => 'Creating a new Chunk (HTML Snippet)', |
|
84 | - '78' => 'Editing Chunk (HTML Snippet)', |
|
85 | - '79' => 'Saving Chunk (HTML Snippet)', |
|
86 | - '80' => 'Deleting Chunk (HTML Snippet)', |
|
87 | - '83' => 'Exporting a resource to HTML', |
|
88 | - '84' => 'Load Element Selector', |
|
89 | - '85' => 'Create Folder', |
|
90 | - '86' => 'Role management', |
|
91 | - '87' => 'Create new web user', |
|
92 | - '88' => 'Editing web user', |
|
93 | - '89' => 'Saving web user', |
|
94 | - '90' => 'Deleting web user', |
|
95 | - '91' => 'Editing Web Access Permissions', |
|
96 | - '92' => 'Editing Access Permissions', |
|
97 | - '93' => 'Backup Manager', |
|
98 | - '94' => 'Duplicate resource', |
|
99 | - '95' => 'Importing resources from HTML', |
|
100 | - '96' => 'Duplicate Template', |
|
101 | - '97' => 'Duplicate Chunk (HTML Snippet)', |
|
102 | - '98' => 'Duplicate Snippet', |
|
103 | - '99' => 'Manage Web Users', |
|
104 | - '100' => 'Previewing resource', |
|
105 | - '101' => 'Create new plugin', |
|
106 | - '102' => 'Edit plugin', |
|
107 | - '103' => 'Saving plugin', |
|
108 | - '104' => 'Delete plugin', |
|
109 | - '105' => 'Duplicate plugin', |
|
110 | - '106' => 'Viewing Modules', |
|
111 | - '107' => 'Create new module', |
|
112 | - '108' => 'Edit module', |
|
113 | - '109' => 'Saving module', |
|
114 | - '110' => 'Delete module', |
|
115 | - '111' => 'Duplicate module', |
|
116 | - '112' => 'Execute module', |
|
117 | - '113' => 'Manage module dependencies', |
|
118 | - '114' => 'View event log', |
|
119 | - '115' => 'View event log details', |
|
120 | - '116' => 'Delete event log', |
|
121 | - '117' => 'Editing tv rank', |
|
122 | - '118' => 'Call settings ajax include', |
|
123 | - '119' => 'Login Fail (Temporary Block)', |
|
8 | + '1' => 'Loading a frame(set)', |
|
9 | + '2' => 'Viewing home page/ online users', |
|
10 | + '3' => 'Viewing data for resource', |
|
11 | + '4' => 'Creating a resource', |
|
12 | + '5' => 'Saving resource', |
|
13 | + '6' => 'Deleting resource', |
|
14 | + '7' => 'Waiting while MODX cleans up', |
|
15 | + '8' => 'Logged out', |
|
16 | + '9' => 'Viewing help', |
|
17 | + '10' => 'Viewing/ composing messages', |
|
18 | + '11' => 'Creating a user', |
|
19 | + '12' => 'Editing user', |
|
20 | + '13' => 'Viewing logging', |
|
21 | + '14' => 'Editing a parser', |
|
22 | + '15' => 'Saving a parser', |
|
23 | + '16' => 'Editing template', |
|
24 | + '17' => 'Editing settings', |
|
25 | + '18' => 'Viewing Credits :)', |
|
26 | + '19' => 'Creating a new template', |
|
27 | + '20' => 'Saving template', |
|
28 | + '21' => 'Deleting template', |
|
29 | + '22' => 'Editing Snippet', |
|
30 | + '23' => 'Creating a new Snippet', |
|
31 | + '24' => 'Saving Snippet', |
|
32 | + '25' => 'Deleting Snippet', |
|
33 | + '26' => 'Refreshing site', |
|
34 | + '27' => 'Editing resource', |
|
35 | + '28' => 'Changing password', |
|
36 | + '29' => 'Error', |
|
37 | + '30' => 'Saving settings', |
|
38 | + '31' => 'Using file manager', |
|
39 | + '32' => 'Saving user', |
|
40 | + '33' => 'Deleting user', |
|
41 | + '34' => 'Saving new password', |
|
42 | + '35' => 'Editing role', |
|
43 | + '36' => 'Saving role', |
|
44 | + '37' => 'Deleting role', |
|
45 | + '38' => 'Creating new role', |
|
46 | + '40' => 'Editing Access Permissions', |
|
47 | + '41' => 'Editing Access Permissions', |
|
48 | + '42' => 'Editing Access Permissions', |
|
49 | + '43' => 'Editing Access Permissions', |
|
50 | + '44' => 'Editing Access Permissions', |
|
51 | + '45' => 'Idle', |
|
52 | + '46' => 'Editing Access Permissions', |
|
53 | + '47' => 'Editing Access Permissions', |
|
54 | + '48' => 'Editing Access Permissions', |
|
55 | + '49' => 'Editing Access Permissions', |
|
56 | + '50' => 'Editing Access Permissions', |
|
57 | + '51' => 'Moving resource', |
|
58 | + '52' => 'Moved resource', |
|
59 | + '53' => 'Viewing system info', |
|
60 | + '54' => 'Optimizing a table', |
|
61 | + '55' => 'Empty logs', |
|
62 | + '56' => 'Refresh resource tree', |
|
63 | + '57' => 'Refresh menu', |
|
64 | + '58' => 'Logged in', |
|
65 | + '59' => 'About MODX', |
|
66 | + '60' => 'Emptying Recycle Bin', |
|
67 | + '61' => 'Publishing a resource', |
|
68 | + '62' => 'Un-publishing a resource', |
|
69 | + '63' => 'Un-deleting a resource', |
|
70 | + '64' => 'Removing deleted content', |
|
71 | + '65' => 'Deleting a message', |
|
72 | + '66' => 'Sending a message', |
|
73 | + '67' => 'Removing locks', |
|
74 | + '68' => 'Viewing site logging', |
|
75 | + '69' => 'Viewing online visitors', |
|
76 | + '70' => 'Viewing site schedule', |
|
77 | + '71' => 'Searching', |
|
78 | + '72' => 'Adding a weblink', |
|
79 | + '73' => 'Editing a weblink', |
|
80 | + //case "74" : return "Changing personal preferences"; break; |
|
81 | + '75' => 'User/ role management', |
|
82 | + '76' => 'Element management', |
|
83 | + '77' => 'Creating a new Chunk (HTML Snippet)', |
|
84 | + '78' => 'Editing Chunk (HTML Snippet)', |
|
85 | + '79' => 'Saving Chunk (HTML Snippet)', |
|
86 | + '80' => 'Deleting Chunk (HTML Snippet)', |
|
87 | + '83' => 'Exporting a resource to HTML', |
|
88 | + '84' => 'Load Element Selector', |
|
89 | + '85' => 'Create Folder', |
|
90 | + '86' => 'Role management', |
|
91 | + '87' => 'Create new web user', |
|
92 | + '88' => 'Editing web user', |
|
93 | + '89' => 'Saving web user', |
|
94 | + '90' => 'Deleting web user', |
|
95 | + '91' => 'Editing Web Access Permissions', |
|
96 | + '92' => 'Editing Access Permissions', |
|
97 | + '93' => 'Backup Manager', |
|
98 | + '94' => 'Duplicate resource', |
|
99 | + '95' => 'Importing resources from HTML', |
|
100 | + '96' => 'Duplicate Template', |
|
101 | + '97' => 'Duplicate Chunk (HTML Snippet)', |
|
102 | + '98' => 'Duplicate Snippet', |
|
103 | + '99' => 'Manage Web Users', |
|
104 | + '100' => 'Previewing resource', |
|
105 | + '101' => 'Create new plugin', |
|
106 | + '102' => 'Edit plugin', |
|
107 | + '103' => 'Saving plugin', |
|
108 | + '104' => 'Delete plugin', |
|
109 | + '105' => 'Duplicate plugin', |
|
110 | + '106' => 'Viewing Modules', |
|
111 | + '107' => 'Create new module', |
|
112 | + '108' => 'Edit module', |
|
113 | + '109' => 'Saving module', |
|
114 | + '110' => 'Delete module', |
|
115 | + '111' => 'Duplicate module', |
|
116 | + '112' => 'Execute module', |
|
117 | + '113' => 'Manage module dependencies', |
|
118 | + '114' => 'View event log', |
|
119 | + '115' => 'View event log details', |
|
120 | + '116' => 'Delete event log', |
|
121 | + '117' => 'Editing tv rank', |
|
122 | + '118' => 'Call settings ajax include', |
|
123 | + '119' => 'Login Fail (Temporary Block)', |
|
124 | 124 | |
125 | - '300' => 'Create Template Variable', |
|
126 | - '301' => 'Edit Template Variable', |
|
127 | - '302' => 'Save Template Variable', |
|
128 | - '303' => 'Delete Template Variable', |
|
129 | - '304' => 'Duplicate Template Variable', |
|
125 | + '300' => 'Create Template Variable', |
|
126 | + '301' => 'Edit Template Variable', |
|
127 | + '302' => 'Save Template Variable', |
|
128 | + '303' => 'Delete Template Variable', |
|
129 | + '304' => 'Duplicate Template Variable', |
|
130 | 130 | |
131 | - '200' => 'Viewing phpInfo()', |
|
132 | - '501' => 'Delete category', |
|
133 | - '998' => 'Viewing web page', |
|
134 | - '999' => 'Viewing test page', |
|
131 | + '200' => 'Viewing phpInfo()', |
|
132 | + '501' => 'Delete category', |
|
133 | + '998' => 'Viewing web page', |
|
134 | + '999' => 'Viewing test page', |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | /** |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function getAction($actionId, $itemid='') { |
143 | - global $action_list; |
|
143 | + global $action_list; |
|
144 | 144 | |
145 | - $ret = sprintf($action_list[$actionId], $itemid); |
|
146 | - if (!$ret) $ret = "Idle (unknown)"; |
|
145 | + $ret = sprintf($action_list[$actionId], $itemid); |
|
146 | + if (!$ret) $ret = "Idle (unknown)"; |
|
147 | 147 | |
148 | - return $ret; |
|
148 | + return $ret; |
|
149 | 149 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param string $itemid |
140 | 140 | * @return string |
141 | 141 | */ |
142 | -function getAction($actionId, $itemid='') { |
|
142 | +function getAction($actionId, $itemid = ''){ |
|
143 | 143 | global $action_list; |
144 | 144 | |
145 | 145 | $ret = sprintf($action_list[$actionId], $itemid); |
@@ -139,11 +139,14 @@ |
||
139 | 139 | * @param string $itemid |
140 | 140 | * @return string |
141 | 141 | */ |
142 | -function getAction($actionId, $itemid='') { |
|
142 | +function getAction($actionId, $itemid='') |
|
143 | +{ |
|
143 | 144 | global $action_list; |
144 | 145 | |
145 | 146 | $ret = sprintf($action_list[$actionId], $itemid); |
146 | - if (!$ret) $ret = "Idle (unknown)"; |
|
147 | + if (!$ret) { |
|
148 | + $ret = "Idle (unknown)"; |
|
149 | + } |
|
147 | 150 | |
148 | 151 | return $ret; |
149 | 152 | } |
@@ -71,11 +71,11 @@ |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($context === 'common') { |
74 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
74 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
75 | 75 | } else { |
76 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
76 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
77 | 77 | } |
78 | - include_once($lang_path . 'english.inc.php'); |
|
78 | + include_once($lang_path.'english.inc.php'); |
|
79 | 79 | $manager_language = $modx->config['manager_language']; |
80 | 80 | if (is_file("{$lang_path}{$manager_language}.inc.php")) { |
81 | 81 | include_once("{$lang_path}{$manager_language}.inc.php"); |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $action = "", |
37 | 37 | $itemid = "", |
38 | 38 | $itemname = "" |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | global $modx; |
41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
42 | - $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
43 | 43 | |
44 | 44 | // User Credentials |
45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
47 | 47 | |
48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
49 | 49 | if ($this->entry['itemId'] == 0) { |
50 | 50 | $this->entry['itemId'] = "-"; |
51 | 51 | } // to stop items having id 0 |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
94 | 94 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
95 | 95 | if (!$insert_id) { |
96 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
96 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
|
97 | 97 | } else { |
98 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
99 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
98 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
99 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
100 | 100 | if (($insert_id % $trim) === 0) { |
101 | 101 | $modx->rotate_log('manager_log', $limit, $trim); |
102 | 102 | } |
@@ -11,12 +11,12 @@ |
||
11 | 11 | |
12 | 12 | $out = false; |
13 | 13 | $class = 'DBAPI'; |
14 | -if( ! class_exists($class)){ |
|
15 | - include_once MODX_MANAGER_PATH . 'includes/extenders/dbapi.' . $database_type . '.class.inc.php'; |
|
14 | +if (!class_exists($class)) { |
|
15 | + include_once MODX_MANAGER_PATH.'includes/extenders/dbapi.'.$database_type.'.class.inc.php'; |
|
16 | 16 | } |
17 | 17 | |
18 | -if(class_exists($class)){ |
|
19 | - $this->db= new $class; |
|
18 | +if (class_exists($class)) { |
|
19 | + $this->db = new $class; |
|
20 | 20 | $out = true; |
21 | 21 | } |
22 | 22 |
@@ -7,15 +7,17 @@ |
||
7 | 7 | |
8 | 8 | global $database_type; |
9 | 9 | |
10 | -if (empty($database_type)) $database_type = 'mysql'; |
|
10 | +if (empty($database_type)) { |
|
11 | + $database_type = 'mysql'; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | $out = false; |
13 | 15 | $class = 'DBAPI'; |
14 | -if( ! class_exists($class)){ |
|
16 | +if( ! class_exists($class)) { |
|
15 | 17 | include_once MODX_MANAGER_PATH . 'includes/extenders/dbapi.' . $database_type . '.class.inc.php'; |
16 | 18 | } |
17 | 19 | |
18 | -if(class_exists($class)){ |
|
20 | +if(class_exists($class)) { |
|
19 | 21 | $this->db= new $class; |
20 | 22 | $out = true; |
21 | 23 | } |
@@ -144,33 +144,33 @@ discard block |
||
144 | 144 | $algorithm = 'UNCRYPT'; |
145 | 145 | } |
146 | 146 | |
147 | - $salt = md5($password . $seed); |
|
147 | + $salt = md5($password.$seed); |
|
148 | 148 | |
149 | 149 | switch ($algorithm) { |
150 | 150 | case 'BLOWFISH_Y': |
151 | - $salt = '$2y$07$' . substr($salt, 0, 22); |
|
151 | + $salt = '$2y$07$'.substr($salt, 0, 22); |
|
152 | 152 | break; |
153 | 153 | case 'BLOWFISH_A': |
154 | - $salt = '$2a$07$' . substr($salt, 0, 22); |
|
154 | + $salt = '$2a$07$'.substr($salt, 0, 22); |
|
155 | 155 | break; |
156 | 156 | case 'SHA512': |
157 | - $salt = '$6$' . substr($salt, 0, 16); |
|
157 | + $salt = '$6$'.substr($salt, 0, 16); |
|
158 | 158 | break; |
159 | 159 | case 'SHA256': |
160 | - $salt = '$5$' . substr($salt, 0, 16); |
|
160 | + $salt = '$5$'.substr($salt, 0, 16); |
|
161 | 161 | break; |
162 | 162 | case 'MD5': |
163 | - $salt = '$1$' . substr($salt, 0, 8); |
|
163 | + $salt = '$1$'.substr($salt, 0, 8); |
|
164 | 164 | break; |
165 | 165 | } |
166 | 166 | |
167 | 167 | if ($algorithm !== 'UNCRYPT') { |
168 | - $password = sha1($password) . crypt($password, $salt); |
|
168 | + $password = sha1($password).crypt($password, $salt); |
|
169 | 169 | } else { |
170 | - $password = sha1($salt . $password); |
|
170 | + $password = sha1($salt.$password); |
|
171 | 171 | } |
172 | 172 | |
173 | - $result = strtolower($algorithm) . '>' . md5($salt . $password) . substr(md5($salt), 0, 8); |
|
173 | + $result = strtolower($algorithm).'>'.md5($salt.$password).substr(md5($salt), 0, 8); |
|
174 | 174 | |
175 | 175 | return $result; |
176 | 176 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $check_files = explode("\n", $check_files); |
253 | 253 | foreach ($check_files as $file) { |
254 | 254 | $file = trim($file); |
255 | - $file = MODX_BASE_PATH . $file; |
|
255 | + $file = MODX_BASE_PATH.$file; |
|
256 | 256 | if (!is_file($file)) { |
257 | 257 | continue; |
258 | 258 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $checksum = unserialize($checksum); |
276 | 276 | foreach ($check_files as $file) { |
277 | 277 | $file = trim($file); |
278 | - $filePath = MODX_BASE_PATH . $file; |
|
278 | + $filePath = MODX_BASE_PATH.$file; |
|
279 | 279 | if (!is_file($filePath)) { |
280 | 280 | continue; |
281 | 281 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | global $modx; |
296 | 296 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
297 | - $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->db->escape($checksum) . "')"; |
|
297 | + $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','".$modx->db->escape($checksum)."')"; |
|
298 | 298 | $modx->db->query($sql); |
299 | 299 | } |
300 | 300 | |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | foreach ($settings as $key => $val) { |
372 | 372 | $f = array(); |
373 | 373 | $f['user'] = $_SESSION['mgrInternalKey']; |
374 | - $f['setting_name'] = '_LAST_' . $key; |
|
374 | + $f['setting_name'] = '_LAST_'.$key; |
|
375 | 375 | $f['setting_value'] = $val; |
376 | 376 | $f = $modx->db->escape($f); |
377 | - $f = "(`" . implode("`, `", array_keys($f)) . "`) VALUES('" . implode("', '", array_values($f)) . "')"; |
|
377 | + $f = "(`".implode("`, `", array_keys($f))."`) VALUES('".implode("', '", array_values($f))."')"; |
|
378 | 378 | $f .= " ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)"; |
379 | 379 | $modx->db->insert($f, $modx->getFullTableName('user_settings')); |
380 | 380 | } |
@@ -116,7 +116,8 @@ discard block |
||
116 | 116 | * @return string |
117 | 117 | */ |
118 | 118 | public function getHashType($db_value = '') |
119 | - { // md5 | v1 | phpass |
|
119 | + { |
|
120 | +// md5 | v1 | phpass |
|
120 | 121 | $c = substr($db_value, 0, 1); |
121 | 122 | if ($c === '$') { |
122 | 123 | return 'phpass'; |
@@ -135,7 +136,8 @@ discard block |
||
135 | 136 | * @return string |
136 | 137 | */ |
137 | 138 | public function genV1Hash($password, $seed = '1') |
138 | - { // $seed is user_id basically |
|
139 | + { |
|
140 | +// $seed is user_id basically |
|
139 | 141 | global $modx; |
140 | 142 | |
141 | 143 | if (isset($modx->config['pwd_hash_algo']) && !empty($modx->config['pwd_hash_algo'])) { |