@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('import_static')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // Files to upload |
10 | 10 | $allowedfiles = array( |
11 | - 'html', |
|
12 | - 'htm', |
|
13 | - 'shtml', |
|
14 | - 'xml' |
|
11 | + 'html', |
|
12 | + 'htm', |
|
13 | + 'shtml', |
|
14 | + 'xml' |
|
15 | 15 | ); |
16 | 16 | ?> |
17 | 17 | <script language="javascript"> |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | <div class="tab-page"> |
44 | 44 | <div class="container container-body"> |
45 | 45 | <?php |
46 | - if(!isset($_POST['import'])) { |
|
47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
48 | - ?> |
|
46 | + if(!isset($_POST['import'])) { |
|
47 | + echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
48 | + ?> |
|
49 | 49 | <form action="index.php" method="post" name="importFrm"> |
50 | 50 | <input type="hidden" name="import" value="import" /> |
51 | 51 | <input type="hidden" name="a" value="95" /> |
@@ -85,375 +85,375 @@ discard block |
||
85 | 85 | <a href="javascript:;" class="btn btn-primary" onclick="window.importFrm.submit();"><i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang["import_site_start"] ?></a> |
86 | 86 | </form> |
87 | 87 | <?php |
88 | - } else { |
|
89 | - run(); |
|
90 | - $modx->clearCache('full'); |
|
91 | - ?> |
|
88 | + } else { |
|
89 | + run(); |
|
90 | + $modx->clearCache('full'); |
|
91 | + ?> |
|
92 | 92 | <a href="javascript:;" class="btn btn-primary" onclick="window.location.href='index.php?a=2';"><i class="<?= $_style["actions_close"] ?>"></i> <?= $_lang["close"] ?></a> |
93 | 93 | <script type="text/javascript"> |
94 | 94 | top.mainMenu.reloadtree(); |
95 | 95 | parent.tree.ca = 'open'; |
96 | 96 | </script> |
97 | 97 | <?php |
98 | - } |
|
99 | - ?> |
|
98 | + } |
|
99 | + ?> |
|
100 | 100 | </div> |
101 | 101 | </div> |
102 | 102 | |
103 | 103 | <?php |
104 | 104 | function run() { |
105 | - global $modx, $_lang; |
|
105 | + global $modx, $_lang; |
|
106 | 106 | |
107 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
108 | - $output = ''; |
|
109 | - $maxtime = $_POST['maxtime']; |
|
107 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
108 | + $output = ''; |
|
109 | + $maxtime = $_POST['maxtime']; |
|
110 | 110 | |
111 | - if(!is_numeric($maxtime)) { |
|
112 | - $maxtime = 30; |
|
113 | - } |
|
111 | + if(!is_numeric($maxtime)) { |
|
112 | + $maxtime = 30; |
|
113 | + } |
|
114 | 114 | |
115 | - @set_time_limit($maxtime); |
|
115 | + @set_time_limit($maxtime); |
|
116 | 116 | |
117 | - $mtime = microtime(); |
|
118 | - $mtime = explode(' ', $mtime); |
|
119 | - $mtime = $mtime[1] + $mtime[0]; |
|
120 | - $importstart = $mtime; |
|
117 | + $mtime = microtime(); |
|
118 | + $mtime = explode(' ', $mtime); |
|
119 | + $mtime = $mtime[1] + $mtime[0]; |
|
120 | + $importstart = $mtime; |
|
121 | 121 | |
122 | - if($_POST['reset'] == 'on') { |
|
123 | - $modx->db->truncate($tbl_site_content); |
|
124 | - $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
125 | - } |
|
122 | + if($_POST['reset'] == 'on') { |
|
123 | + $modx->db->truncate($tbl_site_content); |
|
124 | + $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
125 | + } |
|
126 | 126 | |
127 | - $parent = (int)$_POST['parent']; |
|
127 | + $parent = (int)$_POST['parent']; |
|
128 | 128 | |
129 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
130 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
131 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
132 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
133 | - } else { |
|
129 | + if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
130 | + $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
131 | + } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
132 | + $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
133 | + } else { |
|
134 | 134 | $filedir = ''; |
135 | 135 | } |
136 | 136 | |
137 | - $filesfound = 0; |
|
137 | + $filesfound = 0; |
|
138 | 138 | |
139 | - $files = getFiles($filedir); |
|
140 | - $files = pop_index($files); |
|
139 | + $files = getFiles($filedir); |
|
140 | + $files = pop_index($files); |
|
141 | 141 | |
142 | - // no. of files to import |
|
143 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
142 | + // no. of files to import |
|
143 | + $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
144 | 144 | |
145 | - // import files |
|
146 | - if(0 < count($files)) { |
|
147 | - $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
148 | - importFiles($parent, $filedir, $files, 'root'); |
|
149 | - } |
|
145 | + // import files |
|
146 | + if(0 < count($files)) { |
|
147 | + $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
148 | + importFiles($parent, $filedir, $files, 'root'); |
|
149 | + } |
|
150 | 150 | |
151 | - $mtime = microtime(); |
|
152 | - $mtime = explode(' ', $mtime); |
|
153 | - $mtime = $mtime[1] + $mtime[0]; |
|
154 | - $importend = $mtime; |
|
155 | - $totaltime = ($importend - $importstart); |
|
156 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
151 | + $mtime = microtime(); |
|
152 | + $mtime = explode(' ', $mtime); |
|
153 | + $mtime = $mtime[1] + $mtime[0]; |
|
154 | + $importend = $mtime; |
|
155 | + $totaltime = ($importend - $importstart); |
|
156 | + $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
157 | 157 | |
158 | - if($_POST['convert_link'] == 'on') { |
|
159 | - convertLink(); |
|
160 | - } |
|
158 | + if($_POST['convert_link'] == 'on') { |
|
159 | + convertLink(); |
|
160 | + } |
|
161 | 161 | |
162 | - return $output; |
|
162 | + return $output; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | function importFiles($parent, $filedir, $files, $mode) { |
166 | - global $modx; |
|
167 | - global $_lang, $allowedfiles; |
|
168 | - global $search_default, $cache_default, $publish_default; |
|
169 | - |
|
170 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
171 | - $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
172 | - |
|
173 | - $createdby = $modx->getLoginUserID(); |
|
174 | - if(!is_array($files)) { |
|
175 | - return; |
|
176 | - } |
|
177 | - if($_POST['object'] == 'all') { |
|
178 | - $modx->config['default_template'] = '0'; |
|
179 | - $richtext = '0'; |
|
180 | - } else { |
|
181 | - $richtext = '1'; |
|
182 | - } |
|
183 | - |
|
184 | - foreach($files as $id => $value) { |
|
185 | - if(is_array($value)) { |
|
186 | - // create folder |
|
187 | - $alias = $id; |
|
188 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
189 | - $field = array(); |
|
190 | - $field['type'] = 'document'; |
|
191 | - $field['contentType'] = 'text/html'; |
|
192 | - $field['published'] = $publish_default; |
|
193 | - $field['parent'] = $parent; |
|
194 | - $field['alias'] = $modx->stripAlias($alias); |
|
195 | - $field['richtext'] = $richtext; |
|
196 | - $field['template'] = $modx->config['default_template']; |
|
197 | - $field['searchable'] = $search_default; |
|
198 | - $field['cacheable'] = $cache_default; |
|
199 | - $field['createdby'] = $createdby; |
|
200 | - $field['isfolder'] = 1; |
|
201 | - $field['menuindex'] = 1; |
|
202 | - $find = false; |
|
203 | - foreach(array( |
|
204 | - 'index.html', |
|
205 | - 'index.htm' |
|
206 | - ) as $filename) { |
|
207 | - $filepath = $filedir . $alias . '/' . $filename; |
|
208 | - if($find === false && file_exists($filepath)) { |
|
209 | - $file = getFileContent($filepath); |
|
210 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
211 | - |
|
212 | - $date = filemtime($filepath); |
|
213 | - $field['pagetitle'] = $pagetitle; |
|
214 | - $field['longtitle'] = $pagetitle; |
|
215 | - $field['description'] = $description; |
|
216 | - $field['content'] = $modx->db->escape($content); |
|
217 | - $field['createdon'] = $date; |
|
218 | - $field['editedon'] = $date; |
|
219 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
220 | - if($newid) { |
|
221 | - $find = true; |
|
222 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
223 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
224 | - } else { |
|
225 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
226 | - exit; |
|
227 | - } |
|
228 | - } |
|
229 | - } |
|
230 | - if($find === false) { |
|
231 | - $date = time(); |
|
232 | - $field['pagetitle'] = '---'; |
|
233 | - $field['content'] = ''; |
|
234 | - $field['createdon'] = $date; |
|
235 | - $field['editedon'] = $date; |
|
236 | - $field['hidemenu'] = '1'; |
|
237 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
238 | - if($newid) { |
|
239 | - $find = true; |
|
240 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
241 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
242 | - } else { |
|
243 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
244 | - exit; |
|
245 | - } |
|
246 | - } |
|
247 | - } else { |
|
248 | - // create document |
|
249 | - if($mode == 'sub' && $value == 'index.html') { |
|
250 | - continue; |
|
251 | - } |
|
252 | - $filename = $value; |
|
253 | - $fparts = explode('.', $value); |
|
254 | - $alias = $fparts[0]; |
|
255 | - $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
256 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
257 | - |
|
258 | - if(!in_array($ext, $allowedfiles)) { |
|
259 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
260 | - } else { |
|
261 | - $filepath = $filedir . $filename; |
|
262 | - $file = getFileContent($filepath); |
|
263 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
264 | - |
|
265 | - $date = filemtime($filepath); |
|
266 | - $field = array(); |
|
267 | - $field['type'] = 'document'; |
|
268 | - $field['contentType'] = 'text/html'; |
|
269 | - $field['pagetitle'] = $pagetitle; |
|
270 | - $field['longtitle'] = $pagetitle; |
|
271 | - $field['description'] = $description; |
|
272 | - $field['alias'] = $modx->stripAlias($alias); |
|
273 | - $field['published'] = $publish_default; |
|
274 | - $field['parent'] = $parent; |
|
275 | - $field['content'] = $modx->db->escape($content); |
|
276 | - $field['richtext'] = $richtext; |
|
277 | - $field['template'] = $modx->config['default_template']; |
|
278 | - $field['searchable'] = $search_default; |
|
279 | - $field['cacheable'] = $cache_default; |
|
280 | - $field['createdby'] = $createdby; |
|
281 | - $field['createdon'] = $date; |
|
282 | - $field['editedon'] = $date; |
|
283 | - $field['isfolder'] = 0; |
|
284 | - $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
285 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
286 | - if($newid) { |
|
287 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
288 | - } else { |
|
289 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
290 | - exit; |
|
291 | - } |
|
292 | - |
|
293 | - $is_site_start = false; |
|
294 | - if($filename == 'index.html') { |
|
295 | - $is_site_start = true; |
|
296 | - } |
|
297 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
298 | - $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
299 | - $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
300 | - } |
|
301 | - } |
|
302 | - } |
|
303 | - } |
|
166 | + global $modx; |
|
167 | + global $_lang, $allowedfiles; |
|
168 | + global $search_default, $cache_default, $publish_default; |
|
169 | + |
|
170 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
171 | + $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
172 | + |
|
173 | + $createdby = $modx->getLoginUserID(); |
|
174 | + if(!is_array($files)) { |
|
175 | + return; |
|
176 | + } |
|
177 | + if($_POST['object'] == 'all') { |
|
178 | + $modx->config['default_template'] = '0'; |
|
179 | + $richtext = '0'; |
|
180 | + } else { |
|
181 | + $richtext = '1'; |
|
182 | + } |
|
183 | + |
|
184 | + foreach($files as $id => $value) { |
|
185 | + if(is_array($value)) { |
|
186 | + // create folder |
|
187 | + $alias = $id; |
|
188 | + printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
189 | + $field = array(); |
|
190 | + $field['type'] = 'document'; |
|
191 | + $field['contentType'] = 'text/html'; |
|
192 | + $field['published'] = $publish_default; |
|
193 | + $field['parent'] = $parent; |
|
194 | + $field['alias'] = $modx->stripAlias($alias); |
|
195 | + $field['richtext'] = $richtext; |
|
196 | + $field['template'] = $modx->config['default_template']; |
|
197 | + $field['searchable'] = $search_default; |
|
198 | + $field['cacheable'] = $cache_default; |
|
199 | + $field['createdby'] = $createdby; |
|
200 | + $field['isfolder'] = 1; |
|
201 | + $field['menuindex'] = 1; |
|
202 | + $find = false; |
|
203 | + foreach(array( |
|
204 | + 'index.html', |
|
205 | + 'index.htm' |
|
206 | + ) as $filename) { |
|
207 | + $filepath = $filedir . $alias . '/' . $filename; |
|
208 | + if($find === false && file_exists($filepath)) { |
|
209 | + $file = getFileContent($filepath); |
|
210 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
211 | + |
|
212 | + $date = filemtime($filepath); |
|
213 | + $field['pagetitle'] = $pagetitle; |
|
214 | + $field['longtitle'] = $pagetitle; |
|
215 | + $field['description'] = $description; |
|
216 | + $field['content'] = $modx->db->escape($content); |
|
217 | + $field['createdon'] = $date; |
|
218 | + $field['editedon'] = $date; |
|
219 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
220 | + if($newid) { |
|
221 | + $find = true; |
|
222 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
223 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
224 | + } else { |
|
225 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
226 | + exit; |
|
227 | + } |
|
228 | + } |
|
229 | + } |
|
230 | + if($find === false) { |
|
231 | + $date = time(); |
|
232 | + $field['pagetitle'] = '---'; |
|
233 | + $field['content'] = ''; |
|
234 | + $field['createdon'] = $date; |
|
235 | + $field['editedon'] = $date; |
|
236 | + $field['hidemenu'] = '1'; |
|
237 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
238 | + if($newid) { |
|
239 | + $find = true; |
|
240 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
241 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
242 | + } else { |
|
243 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
244 | + exit; |
|
245 | + } |
|
246 | + } |
|
247 | + } else { |
|
248 | + // create document |
|
249 | + if($mode == 'sub' && $value == 'index.html') { |
|
250 | + continue; |
|
251 | + } |
|
252 | + $filename = $value; |
|
253 | + $fparts = explode('.', $value); |
|
254 | + $alias = $fparts[0]; |
|
255 | + $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
256 | + printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
257 | + |
|
258 | + if(!in_array($ext, $allowedfiles)) { |
|
259 | + echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
260 | + } else { |
|
261 | + $filepath = $filedir . $filename; |
|
262 | + $file = getFileContent($filepath); |
|
263 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
264 | + |
|
265 | + $date = filemtime($filepath); |
|
266 | + $field = array(); |
|
267 | + $field['type'] = 'document'; |
|
268 | + $field['contentType'] = 'text/html'; |
|
269 | + $field['pagetitle'] = $pagetitle; |
|
270 | + $field['longtitle'] = $pagetitle; |
|
271 | + $field['description'] = $description; |
|
272 | + $field['alias'] = $modx->stripAlias($alias); |
|
273 | + $field['published'] = $publish_default; |
|
274 | + $field['parent'] = $parent; |
|
275 | + $field['content'] = $modx->db->escape($content); |
|
276 | + $field['richtext'] = $richtext; |
|
277 | + $field['template'] = $modx->config['default_template']; |
|
278 | + $field['searchable'] = $search_default; |
|
279 | + $field['cacheable'] = $cache_default; |
|
280 | + $field['createdby'] = $createdby; |
|
281 | + $field['createdon'] = $date; |
|
282 | + $field['editedon'] = $date; |
|
283 | + $field['isfolder'] = 0; |
|
284 | + $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
285 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
286 | + if($newid) { |
|
287 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
288 | + } else { |
|
289 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
290 | + exit; |
|
291 | + } |
|
292 | + |
|
293 | + $is_site_start = false; |
|
294 | + if($filename == 'index.html') { |
|
295 | + $is_site_start = true; |
|
296 | + } |
|
297 | + if($is_site_start == true && $_POST['reset'] == 'on') { |
|
298 | + $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
299 | + $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
300 | + } |
|
301 | + } |
|
302 | + } |
|
303 | + } |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | function getFiles($directory, $listing = array(), $count = 0) { |
307 | - global $_lang; |
|
308 | - global $filesfound; |
|
309 | - $dummy = $count; |
|
310 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
311 | - foreach($files as $file) { |
|
312 | - if($file == '.' || $file == '..') { |
|
313 | - continue; |
|
314 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
315 | - closedir($h); |
|
316 | - $count = -1; |
|
317 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
318 | - } elseif(strpos($file, '.htm') !== false) { |
|
319 | - $listing[$dummy] = $file; |
|
320 | - $dummy = $dummy + 1; |
|
321 | - $filesfound++; |
|
322 | - } |
|
323 | - } |
|
324 | - } else { |
|
325 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
326 | - } |
|
327 | - return ($listing); |
|
307 | + global $_lang; |
|
308 | + global $filesfound; |
|
309 | + $dummy = $count; |
|
310 | + if( ! empty($directory) && $files = scandir($directory)) { |
|
311 | + foreach($files as $file) { |
|
312 | + if($file == '.' || $file == '..') { |
|
313 | + continue; |
|
314 | + } elseif($h = @opendir($directory . $file . "/")) { |
|
315 | + closedir($h); |
|
316 | + $count = -1; |
|
317 | + $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
318 | + } elseif(strpos($file, '.htm') !== false) { |
|
319 | + $listing[$dummy] = $file; |
|
320 | + $dummy = $dummy + 1; |
|
321 | + $filesfound++; |
|
322 | + } |
|
323 | + } |
|
324 | + } else { |
|
325 | + echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
326 | + } |
|
327 | + return ($listing); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | function getFileContent($filepath) { |
331 | - global $_lang; |
|
332 | - // get the file |
|
333 | - if(!$buffer = file_get_contents($filepath)) { |
|
334 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
335 | - } else { |
|
336 | - return $buffer; |
|
337 | - } |
|
331 | + global $_lang; |
|
332 | + // get the file |
|
333 | + if(!$buffer = file_get_contents($filepath)) { |
|
334 | + echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
335 | + } else { |
|
336 | + return $buffer; |
|
337 | + } |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | function pop_index($array) { |
341 | - $new_array = array(); |
|
342 | - foreach($array as $k => $v) { |
|
343 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
344 | - $new_array[$k] = $v; |
|
345 | - } else { |
|
346 | - array_unshift($new_array, $v); |
|
347 | - } |
|
348 | - } |
|
349 | - foreach($array as $k => $v) { |
|
350 | - if(is_array($v)) { |
|
351 | - $new_array[$k] = $v; |
|
352 | - } |
|
353 | - } |
|
354 | - return $new_array; |
|
341 | + $new_array = array(); |
|
342 | + foreach($array as $k => $v) { |
|
343 | + if($v !== 'index.html' && $v !== 'index.htm') { |
|
344 | + $new_array[$k] = $v; |
|
345 | + } else { |
|
346 | + array_unshift($new_array, $v); |
|
347 | + } |
|
348 | + } |
|
349 | + foreach($array as $k => $v) { |
|
350 | + if(is_array($v)) { |
|
351 | + $new_array[$k] = $v; |
|
352 | + } |
|
353 | + } |
|
354 | + return $new_array; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | function treatContent($src, $filename, $alias) { |
358 | - global $modx; |
|
359 | - |
|
360 | - $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
361 | - |
|
362 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
363 | - $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
364 | - $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
365 | - } else { |
|
366 | - $pagetitle = $alias; |
|
367 | - } |
|
368 | - if(!$pagetitle) { |
|
369 | - $pagetitle = $alias; |
|
370 | - } |
|
371 | - |
|
372 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
373 | - $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
374 | - $description = str_replace('[*description*]', '', $description); |
|
375 | - } else { |
|
376 | - $description = ''; |
|
377 | - } |
|
378 | - |
|
379 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
380 | - $content = $matches[1]; |
|
381 | - } else { |
|
382 | - $content = $src; |
|
383 | - $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
384 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
385 | - $content = preg_replace($s, $r, $content); |
|
386 | - $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
387 | - } |
|
388 | - $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
389 | - $content = trim($content); |
|
390 | - $pagetitle = $modx->db->escape($pagetitle); |
|
391 | - return array( |
|
392 | - $pagetitle, |
|
393 | - $content, |
|
394 | - $description |
|
395 | - ); |
|
358 | + global $modx; |
|
359 | + |
|
360 | + $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
361 | + |
|
362 | + if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
363 | + $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
364 | + $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
365 | + } else { |
|
366 | + $pagetitle = $alias; |
|
367 | + } |
|
368 | + if(!$pagetitle) { |
|
369 | + $pagetitle = $alias; |
|
370 | + } |
|
371 | + |
|
372 | + if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
373 | + $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
374 | + $description = str_replace('[*description*]', '', $description); |
|
375 | + } else { |
|
376 | + $description = ''; |
|
377 | + } |
|
378 | + |
|
379 | + if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
380 | + $content = $matches[1]; |
|
381 | + } else { |
|
382 | + $content = $src; |
|
383 | + $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
384 | + $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
385 | + $content = preg_replace($s, $r, $content); |
|
386 | + $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
387 | + } |
|
388 | + $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
389 | + $content = trim($content); |
|
390 | + $pagetitle = $modx->db->escape($pagetitle); |
|
391 | + return array( |
|
392 | + $pagetitle, |
|
393 | + $content, |
|
394 | + $description |
|
395 | + ); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | function convertLink() { |
399 | - global $modx; |
|
400 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
399 | + global $modx; |
|
400 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
401 | 401 | |
402 | - $rs = $modx->db->select('id,content', $tbl_site_content); |
|
403 | - $p = array(); |
|
402 | + $rs = $modx->db->select('id,content', $tbl_site_content); |
|
403 | + $p = array(); |
|
404 | 404 | $target = array(); |
405 | - $dir = ''; |
|
406 | - while($row = $modx->db->getRow($rs)) { |
|
407 | - $id = $row['id']; |
|
408 | - $array = explode('<a href=', $row['content']); |
|
409 | - $c = 0; |
|
410 | - foreach($array as $v) { |
|
411 | - if($v[0] === '"') { |
|
412 | - $v = substr($v, 1); |
|
413 | - list($href, $v) = explode('"', $v, 2); |
|
414 | - $_ = $href; |
|
415 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
416 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
417 | - } |
|
418 | - if($_[0] === '/') { |
|
419 | - $_ = substr($_, 1); |
|
420 | - } |
|
421 | - $_ = str_replace('/index.html', '.html', $_); |
|
422 | - $level = substr_count($_, '../'); |
|
423 | - if(1 < $level) { |
|
424 | - if(!isset($p[$id])) { |
|
425 | - $p[$id] = $modx->getParentIds($id); |
|
426 | - } |
|
427 | - $k = array_keys($p[$id]); |
|
428 | - while(0 < $level) { |
|
429 | - $dir = array_shift($k); |
|
430 | - $level--; |
|
431 | - } |
|
432 | - if($dir != '') { |
|
433 | - $dir .= '/'; |
|
434 | - } |
|
435 | - } else { |
|
436 | - $dir = ''; |
|
437 | - } |
|
438 | - |
|
439 | - $_ = trim($_, './'); |
|
440 | - if(strpos($_, '/') !== false) { |
|
441 | - $_ = substr($_, strrpos($_, '/')); |
|
442 | - } |
|
443 | - $_ = $dir . str_replace('.html', '', $_); |
|
444 | - if(!isset($target[$_])) { |
|
445 | - $target[$_] = $modx->getIdFromAlias($_); |
|
446 | - } |
|
447 | - $target[$_] = trim($target[$_]); |
|
448 | - if(!empty($target[$_])) { |
|
449 | - $href = '[~' . $target[$_] . '~]'; |
|
450 | - } |
|
451 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
452 | - } |
|
453 | - $c++; |
|
454 | - } |
|
455 | - $content = implode('', $array); |
|
456 | - $f['content'] = $modx->db->escape($content); |
|
457 | - $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
458 | - } |
|
405 | + $dir = ''; |
|
406 | + while($row = $modx->db->getRow($rs)) { |
|
407 | + $id = $row['id']; |
|
408 | + $array = explode('<a href=', $row['content']); |
|
409 | + $c = 0; |
|
410 | + foreach($array as $v) { |
|
411 | + if($v[0] === '"') { |
|
412 | + $v = substr($v, 1); |
|
413 | + list($href, $v) = explode('"', $v, 2); |
|
414 | + $_ = $href; |
|
415 | + if(strpos($_, $modx->config['site_url']) !== false) { |
|
416 | + $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
417 | + } |
|
418 | + if($_[0] === '/') { |
|
419 | + $_ = substr($_, 1); |
|
420 | + } |
|
421 | + $_ = str_replace('/index.html', '.html', $_); |
|
422 | + $level = substr_count($_, '../'); |
|
423 | + if(1 < $level) { |
|
424 | + if(!isset($p[$id])) { |
|
425 | + $p[$id] = $modx->getParentIds($id); |
|
426 | + } |
|
427 | + $k = array_keys($p[$id]); |
|
428 | + while(0 < $level) { |
|
429 | + $dir = array_shift($k); |
|
430 | + $level--; |
|
431 | + } |
|
432 | + if($dir != '') { |
|
433 | + $dir .= '/'; |
|
434 | + } |
|
435 | + } else { |
|
436 | + $dir = ''; |
|
437 | + } |
|
438 | + |
|
439 | + $_ = trim($_, './'); |
|
440 | + if(strpos($_, '/') !== false) { |
|
441 | + $_ = substr($_, strrpos($_, '/')); |
|
442 | + } |
|
443 | + $_ = $dir . str_replace('.html', '', $_); |
|
444 | + if(!isset($target[$_])) { |
|
445 | + $target[$_] = $modx->getIdFromAlias($_); |
|
446 | + } |
|
447 | + $target[$_] = trim($target[$_]); |
|
448 | + if(!empty($target[$_])) { |
|
449 | + $href = '[~' . $target[$_] . '~]'; |
|
450 | + } |
|
451 | + $array[$c] = '<a href="' . $href . '"' . $v; |
|
452 | + } |
|
453 | + $c++; |
|
454 | + } |
|
455 | + $content = implode('', $array); |
|
456 | + $f['content'] = $modx->db->escape($content); |
|
457 | + $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
458 | + } |
|
459 | 459 | } |
@@ -1,8 +1,8 @@ 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 | -if(!$modx->hasPermission('import_static')) { |
|
5 | +if (!$modx->hasPermission('import_static')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | <div class="tab-page"> |
44 | 44 | <div class="container container-body"> |
45 | 45 | <?php |
46 | - if(!isset($_POST['import'])) { |
|
47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
46 | + if (!isset($_POST['import'])) { |
|
47 | + echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>"; |
|
48 | 48 | ?> |
49 | 49 | <form action="index.php" method="post" name="importFrm"> |
50 | 50 | <input type="hidden" name="import" value="import" /> |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | </div> |
102 | 102 | |
103 | 103 | <?php |
104 | -function run() { |
|
104 | +function run(){ |
|
105 | 105 | global $modx, $_lang; |
106 | 106 | |
107 | 107 | $tbl_site_content = $modx->getFullTableName('site_content'); |
108 | 108 | $output = ''; |
109 | 109 | $maxtime = $_POST['maxtime']; |
110 | 110 | |
111 | - if(!is_numeric($maxtime)) { |
|
111 | + if (!is_numeric($maxtime)) { |
|
112 | 112 | $maxtime = 30; |
113 | 113 | } |
114 | 114 | |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | $mtime = $mtime[1] + $mtime[0]; |
120 | 120 | $importstart = $mtime; |
121 | 121 | |
122 | - if($_POST['reset'] == 'on') { |
|
122 | + if ($_POST['reset'] == 'on') { |
|
123 | 123 | $modx->db->truncate($tbl_site_content); |
124 | 124 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
125 | 125 | } |
126 | 126 | |
127 | - $parent = (int)$_POST['parent']; |
|
127 | + $parent = (int) $_POST['parent']; |
|
128 | 128 | |
129 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
130 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
131 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
132 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
129 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
130 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
131 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
132 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
133 | 133 | } else { |
134 | 134 | $filedir = ''; |
135 | 135 | } |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $files = pop_index($files); |
141 | 141 | |
142 | 142 | // no. of files to import |
143 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
143 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
144 | 144 | |
145 | 145 | // import files |
146 | - if(0 < count($files)) { |
|
146 | + if (0 < count($files)) { |
|
147 | 147 | $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
148 | 148 | importFiles($parent, $filedir, $files, 'root'); |
149 | 149 | } |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | $mtime = $mtime[1] + $mtime[0]; |
154 | 154 | $importend = $mtime; |
155 | 155 | $totaltime = ($importend - $importstart); |
156 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
156 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
157 | 157 | |
158 | - if($_POST['convert_link'] == 'on') { |
|
158 | + if ($_POST['convert_link'] == 'on') { |
|
159 | 159 | convertLink(); |
160 | 160 | } |
161 | 161 | |
162 | 162 | return $output; |
163 | 163 | } |
164 | 164 | |
165 | -function importFiles($parent, $filedir, $files, $mode) { |
|
165 | +function importFiles($parent, $filedir, $files, $mode){ |
|
166 | 166 | global $modx; |
167 | 167 | global $_lang, $allowedfiles; |
168 | 168 | global $search_default, $cache_default, $publish_default; |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
172 | 172 | |
173 | 173 | $createdby = $modx->getLoginUserID(); |
174 | - if(!is_array($files)) { |
|
174 | + if (!is_array($files)) { |
|
175 | 175 | return; |
176 | 176 | } |
177 | - if($_POST['object'] == 'all') { |
|
177 | + if ($_POST['object'] == 'all') { |
|
178 | 178 | $modx->config['default_template'] = '0'; |
179 | 179 | $richtext = '0'; |
180 | 180 | } else { |
181 | 181 | $richtext = '1'; |
182 | 182 | } |
183 | 183 | |
184 | - foreach($files as $id => $value) { |
|
185 | - if(is_array($value)) { |
|
184 | + foreach ($files as $id => $value) { |
|
185 | + if (is_array($value)) { |
|
186 | 186 | // create folder |
187 | 187 | $alias = $id; |
188 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
188 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
189 | 189 | $field = array(); |
190 | 190 | $field['type'] = 'document'; |
191 | 191 | $field['contentType'] = 'text/html'; |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | $field['isfolder'] = 1; |
201 | 201 | $field['menuindex'] = 1; |
202 | 202 | $find = false; |
203 | - foreach(array( |
|
203 | + foreach (array( |
|
204 | 204 | 'index.html', |
205 | 205 | 'index.htm' |
206 | 206 | ) as $filename) { |
207 | - $filepath = $filedir . $alias . '/' . $filename; |
|
208 | - if($find === false && file_exists($filepath)) { |
|
207 | + $filepath = $filedir.$alias.'/'.$filename; |
|
208 | + if ($find === false && file_exists($filepath)) { |
|
209 | 209 | $file = getFileContent($filepath); |
210 | 210 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
211 | 211 | |
@@ -217,17 +217,17 @@ discard block |
||
217 | 217 | $field['createdon'] = $date; |
218 | 218 | $field['editedon'] = $date; |
219 | 219 | $newid = $modx->db->insert($field, $tbl_site_content); |
220 | - if($newid) { |
|
220 | + if ($newid) { |
|
221 | 221 | $find = true; |
222 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
223 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
222 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
223 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
224 | 224 | } else { |
225 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
225 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
226 | 226 | exit; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | - if($find === false) { |
|
230 | + if ($find === false) { |
|
231 | 231 | $date = time(); |
232 | 232 | $field['pagetitle'] = '---'; |
233 | 233 | $field['content'] = ''; |
@@ -235,30 +235,30 @@ discard block |
||
235 | 235 | $field['editedon'] = $date; |
236 | 236 | $field['hidemenu'] = '1'; |
237 | 237 | $newid = $modx->db->insert($field, $tbl_site_content); |
238 | - if($newid) { |
|
238 | + if ($newid) { |
|
239 | 239 | $find = true; |
240 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
241 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
240 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
241 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
242 | 242 | } else { |
243 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
243 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
244 | 244 | exit; |
245 | 245 | } |
246 | 246 | } |
247 | 247 | } else { |
248 | 248 | // create document |
249 | - if($mode == 'sub' && $value == 'index.html') { |
|
249 | + if ($mode == 'sub' && $value == 'index.html') { |
|
250 | 250 | continue; |
251 | 251 | } |
252 | 252 | $filename = $value; |
253 | 253 | $fparts = explode('.', $value); |
254 | 254 | $alias = $fparts[0]; |
255 | 255 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
256 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
256 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
257 | 257 | |
258 | - if(!in_array($ext, $allowedfiles)) { |
|
259 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
258 | + if (!in_array($ext, $allowedfiles)) { |
|
259 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
260 | 260 | } else { |
261 | - $filepath = $filedir . $filename; |
|
261 | + $filepath = $filedir.$filename; |
|
262 | 262 | $file = getFileContent($filepath); |
263 | 263 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
264 | 264 | |
@@ -283,18 +283,18 @@ discard block |
||
283 | 283 | $field['isfolder'] = 0; |
284 | 284 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
285 | 285 | $newid = $modx->db->insert($field, $tbl_site_content); |
286 | - if($newid) { |
|
287 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
286 | + if ($newid) { |
|
287 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
288 | 288 | } else { |
289 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
289 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
290 | 290 | exit; |
291 | 291 | } |
292 | 292 | |
293 | 293 | $is_site_start = false; |
294 | - if($filename == 'index.html') { |
|
294 | + if ($filename == 'index.html') { |
|
295 | 295 | $is_site_start = true; |
296 | 296 | } |
297 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
297 | + if ($is_site_start == true && $_POST['reset'] == 'on') { |
|
298 | 298 | $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
299 | 299 | $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
300 | 300 | } |
@@ -303,85 +303,85 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
306 | +function getFiles($directory, $listing = array(), $count = 0){ |
|
307 | 307 | global $_lang; |
308 | 308 | global $filesfound; |
309 | 309 | $dummy = $count; |
310 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
311 | - foreach($files as $file) { |
|
312 | - if($file == '.' || $file == '..') { |
|
310 | + if (!empty($directory) && $files = scandir($directory)) { |
|
311 | + foreach ($files as $file) { |
|
312 | + if ($file == '.' || $file == '..') { |
|
313 | 313 | continue; |
314 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
314 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
315 | 315 | closedir($h); |
316 | 316 | $count = -1; |
317 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
318 | - } elseif(strpos($file, '.htm') !== false) { |
|
317 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
318 | + } elseif (strpos($file, '.htm') !== false) { |
|
319 | 319 | $listing[$dummy] = $file; |
320 | 320 | $dummy = $dummy + 1; |
321 | 321 | $filesfound++; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | } else { |
325 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
325 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
326 | 326 | } |
327 | 327 | return ($listing); |
328 | 328 | } |
329 | 329 | |
330 | -function getFileContent($filepath) { |
|
330 | +function getFileContent($filepath){ |
|
331 | 331 | global $_lang; |
332 | 332 | // get the file |
333 | - if(!$buffer = file_get_contents($filepath)) { |
|
334 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
333 | + if (!$buffer = file_get_contents($filepath)) { |
|
334 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
335 | 335 | } else { |
336 | 336 | return $buffer; |
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | -function pop_index($array) { |
|
340 | +function pop_index($array){ |
|
341 | 341 | $new_array = array(); |
342 | - foreach($array as $k => $v) { |
|
343 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
342 | + foreach ($array as $k => $v) { |
|
343 | + if ($v !== 'index.html' && $v !== 'index.htm') { |
|
344 | 344 | $new_array[$k] = $v; |
345 | 345 | } else { |
346 | 346 | array_unshift($new_array, $v); |
347 | 347 | } |
348 | 348 | } |
349 | - foreach($array as $k => $v) { |
|
350 | - if(is_array($v)) { |
|
349 | + foreach ($array as $k => $v) { |
|
350 | + if (is_array($v)) { |
|
351 | 351 | $new_array[$k] = $v; |
352 | 352 | } |
353 | 353 | } |
354 | 354 | return $new_array; |
355 | 355 | } |
356 | 356 | |
357 | -function treatContent($src, $filename, $alias) { |
|
357 | +function treatContent($src, $filename, $alias){ |
|
358 | 358 | global $modx; |
359 | 359 | |
360 | 360 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
361 | 361 | |
362 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
362 | + if (preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
363 | 363 | $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
364 | 364 | $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
365 | 365 | } else { |
366 | 366 | $pagetitle = $alias; |
367 | 367 | } |
368 | - if(!$pagetitle) { |
|
368 | + if (!$pagetitle) { |
|
369 | 369 | $pagetitle = $alias; |
370 | 370 | } |
371 | 371 | |
372 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
372 | + if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
373 | 373 | $description = ($matches[1] !== '') ? $matches[1] : $filename; |
374 | 374 | $description = str_replace('[*description*]', '', $description); |
375 | 375 | } else { |
376 | 376 | $description = ''; |
377 | 377 | } |
378 | 378 | |
379 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
379 | + if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
380 | 380 | $content = $matches[1]; |
381 | 381 | } else { |
382 | 382 | $content = $src; |
383 | 383 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
384 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
384 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
385 | 385 | $content = preg_replace($s, $r, $content); |
386 | 386 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
387 | 387 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | ); |
396 | 396 | } |
397 | 397 | |
398 | -function convertLink() { |
|
398 | +function convertLink(){ |
|
399 | 399 | global $modx; |
400 | 400 | $tbl_site_content = $modx->getFullTableName('site_content'); |
401 | 401 | |
@@ -403,33 +403,33 @@ discard block |
||
403 | 403 | $p = array(); |
404 | 404 | $target = array(); |
405 | 405 | $dir = ''; |
406 | - while($row = $modx->db->getRow($rs)) { |
|
406 | + while ($row = $modx->db->getRow($rs)) { |
|
407 | 407 | $id = $row['id']; |
408 | 408 | $array = explode('<a href=', $row['content']); |
409 | 409 | $c = 0; |
410 | - foreach($array as $v) { |
|
411 | - if($v[0] === '"') { |
|
410 | + foreach ($array as $v) { |
|
411 | + if ($v[0] === '"') { |
|
412 | 412 | $v = substr($v, 1); |
413 | 413 | list($href, $v) = explode('"', $v, 2); |
414 | 414 | $_ = $href; |
415 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
416 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
415 | + if (strpos($_, $modx->config['site_url']) !== false) { |
|
416 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
417 | 417 | } |
418 | - if($_[0] === '/') { |
|
418 | + if ($_[0] === '/') { |
|
419 | 419 | $_ = substr($_, 1); |
420 | 420 | } |
421 | 421 | $_ = str_replace('/index.html', '.html', $_); |
422 | 422 | $level = substr_count($_, '../'); |
423 | - if(1 < $level) { |
|
424 | - if(!isset($p[$id])) { |
|
423 | + if (1 < $level) { |
|
424 | + if (!isset($p[$id])) { |
|
425 | 425 | $p[$id] = $modx->getParentIds($id); |
426 | 426 | } |
427 | 427 | $k = array_keys($p[$id]); |
428 | - while(0 < $level) { |
|
428 | + while (0 < $level) { |
|
429 | 429 | $dir = array_shift($k); |
430 | 430 | $level--; |
431 | 431 | } |
432 | - if($dir != '') { |
|
432 | + if ($dir != '') { |
|
433 | 433 | $dir .= '/'; |
434 | 434 | } |
435 | 435 | } else { |
@@ -437,18 +437,18 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | $_ = trim($_, './'); |
440 | - if(strpos($_, '/') !== false) { |
|
440 | + if (strpos($_, '/') !== false) { |
|
441 | 441 | $_ = substr($_, strrpos($_, '/')); |
442 | 442 | } |
443 | - $_ = $dir . str_replace('.html', '', $_); |
|
444 | - if(!isset($target[$_])) { |
|
443 | + $_ = $dir.str_replace('.html', '', $_); |
|
444 | + if (!isset($target[$_])) { |
|
445 | 445 | $target[$_] = $modx->getIdFromAlias($_); |
446 | 446 | } |
447 | 447 | $target[$_] = trim($target[$_]); |
448 | - if(!empty($target[$_])) { |
|
449 | - $href = '[~' . $target[$_] . '~]'; |
|
448 | + if (!empty($target[$_])) { |
|
449 | + $href = '[~'.$target[$_].'~]'; |
|
450 | 450 | } |
451 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
451 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
452 | 452 | } |
453 | 453 | $c++; |
454 | 454 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /********************/ |
@@ -12,30 +12,30 @@ discard block |
||
12 | 12 | |
13 | 13 | // check permissions |
14 | 14 | switch($modx->manager->action) { |
15 | - case 27: |
|
16 | - if(!$modx->hasPermission('edit_document')) { |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | - } |
|
19 | - break; |
|
20 | - case 85: |
|
21 | - case 72: |
|
22 | - case 4: |
|
23 | - if(!$modx->hasPermission('new_document')) { |
|
24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | - // check user has permissions for parent |
|
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | - $udperms = new udperms(); |
|
29 | - $udperms->user = $modx->getLoginUserID(); |
|
30 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | - $udperms->role = $_SESSION['mgrRole']; |
|
32 | - if(!$udperms->checkPermissions()) { |
|
33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | - } |
|
35 | - } |
|
36 | - break; |
|
37 | - default: |
|
38 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + case 27: |
|
16 | + if(!$modx->hasPermission('edit_document')) { |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | + } |
|
19 | + break; |
|
20 | + case 85: |
|
21 | + case 72: |
|
22 | + case 4: |
|
23 | + if(!$modx->hasPermission('new_document')) { |
|
24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | + // check user has permissions for parent |
|
27 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | + $udperms = new udperms(); |
|
29 | + $udperms->user = $modx->getLoginUserID(); |
|
30 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | + $udperms->role = $_SESSION['mgrRole']; |
|
32 | + if(!$udperms->checkPermissions()) { |
|
33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | + } |
|
35 | + } |
|
36 | + break; |
|
37 | + default: |
|
38 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | 56 | if($modx->manager->action == 27) { |
57 | - //editing an existing document |
|
58 | - // check permissions on the document |
|
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | - $udperms = new udperms(); |
|
61 | - $udperms->user = $modx->getLoginUserID(); |
|
62 | - $udperms->document = $id; |
|
63 | - $udperms->role = $_SESSION['mgrRole']; |
|
64 | - |
|
65 | - if(!$udperms->checkPermissions()) { |
|
66 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | - } |
|
57 | + //editing an existing document |
|
58 | + // check permissions on the document |
|
59 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | + $udperms = new udperms(); |
|
61 | + $udperms->user = $modx->getLoginUserID(); |
|
62 | + $udperms->document = $id; |
|
63 | + $udperms->role = $_SESSION['mgrRole']; |
|
64 | + |
|
65 | + if(!$udperms->checkPermissions()) { |
|
66 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | 71 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
72 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
72 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
73 | 73 | } |
74 | 74 | // end check for lock |
75 | 75 | |
@@ -78,74 +78,74 @@ discard block |
||
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | 80 | if($_SESSION['mgrDocgroups']) { |
81 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
81 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if(!empty ($id)) { |
85 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | - if($docgrp) { |
|
87 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | - } |
|
89 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | - $content = array(); |
|
91 | - $content = $modx->db->getRow($rs); |
|
92 | - $modx->documentObject = &$content; |
|
93 | - if(!$content) { |
|
94 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | - } |
|
96 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
85 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | + if($docgrp) { |
|
87 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | + } |
|
89 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | + $content = array(); |
|
91 | + $content = $modx->db->getRow($rs); |
|
92 | + $modx->documentObject = &$content; |
|
93 | + if(!$content) { |
|
94 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | + } |
|
96 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
97 | 97 | } else { |
98 | - $content = array(); |
|
98 | + $content = array(); |
|
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
101 | - $content['template'] = $_REQUEST['newtemplate']; |
|
102 | - } else { |
|
103 | - $content['template'] = getDefaultTemplate(); |
|
104 | - } |
|
100 | + if(isset($_REQUEST['newtemplate'])) { |
|
101 | + $content['template'] = $_REQUEST['newtemplate']; |
|
102 | + } else { |
|
103 | + $content['template'] = getDefaultTemplate(); |
|
104 | + } |
|
105 | 105 | |
106 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
106 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | 111 | if(isset($_REQUEST['newtemplate'])) { |
112 | - $formRestored = true; |
|
112 | + $formRestored = true; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | 118 | if($formRestored == true) { |
119 | - $content = array_merge($content, $_POST); |
|
120 | - $content['content'] = $_POST['ta']; |
|
121 | - if(empty ($content['pub_date'])) { |
|
122 | - unset ($content['pub_date']); |
|
123 | - } else { |
|
124 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | - } |
|
126 | - if(empty ($content['unpub_date'])) { |
|
127 | - unset ($content['unpub_date']); |
|
128 | - } else { |
|
129 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | - } |
|
119 | + $content = array_merge($content, $_POST); |
|
120 | + $content['content'] = $_POST['ta']; |
|
121 | + if(empty ($content['pub_date'])) { |
|
122 | + unset ($content['pub_date']); |
|
123 | + } else { |
|
124 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | + } |
|
126 | + if(empty ($content['unpub_date'])) { |
|
127 | + unset ($content['unpub_date']); |
|
128 | + } else { |
|
129 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | + } |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | 134 | if(!isset ($_REQUEST['id'])) { |
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | - $modx->config['auto_menuindex'] = 1; |
|
137 | - } |
|
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
140 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | - } else { |
|
143 | - $content['menuindex'] = 0; |
|
144 | - } |
|
135 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | + $modx->config['auto_menuindex'] = 1; |
|
137 | + } |
|
138 | + if($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int)$_REQUEST['pid']; |
|
140 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | + } else { |
|
143 | + $content['menuindex'] = 0; |
|
144 | + } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | if(isset ($_POST['which_editor'])) { |
148 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
148 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
@@ -545,23 +545,23 @@ discard block |
||
545 | 545 | |
546 | 546 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
547 | 547 | <?php |
548 | - // invoke OnDocFormPrerender event |
|
549 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | - 'id' => $id, |
|
551 | - 'template' => $content['template'] |
|
552 | - )); |
|
553 | - |
|
554 | - if(is_array($evtOut)) { |
|
555 | - echo implode('', $evtOut); |
|
556 | - } |
|
557 | - |
|
558 | - /*************************/ |
|
559 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | - /*************************/ |
|
563 | - |
|
564 | - ?> |
|
548 | + // invoke OnDocFormPrerender event |
|
549 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | + 'id' => $id, |
|
551 | + 'template' => $content['template'] |
|
552 | + )); |
|
553 | + |
|
554 | + if(is_array($evtOut)) { |
|
555 | + echo implode('', $evtOut); |
|
556 | + } |
|
557 | + |
|
558 | + /*************************/ |
|
559 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | + /*************************/ |
|
563 | + |
|
564 | + ?> |
|
565 | 565 | <input type="hidden" name="a" value="5" /> |
566 | 566 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
567 | 567 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -576,54 +576,54 @@ discard block |
||
576 | 576 | |
577 | 577 | <h1> |
578 | 578 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | - } else { |
|
581 | - if ($modx->manager->action == '4') { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | + } else { |
|
581 | + if ($modx->manager->action == '4') { |
|
582 | 582 | echo $_lang['add_resource']; |
583 | 583 | } else if ($modx->manager->action == '72') { |
584 | 584 | echo $_lang['add_weblink']; |
585 | 585 | } else { |
586 | 586 | echo $_lang['create_resource_title']; |
587 | 587 | } |
588 | - } ?> |
|
588 | + } ?> |
|
589 | 589 | </h1> |
590 | 590 | |
591 | 591 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
592 | 592 | |
593 | 593 | <?php |
594 | - // breadcrumbs |
|
595 | - if($modx->config['use_breadcrumbs']) { |
|
596 | - $temp = array(); |
|
597 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | - |
|
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | - $bID = (int) $_REQUEST['id']; |
|
601 | - $temp = $modx->getParentIds($bID); |
|
602 | - } else if(isset($_REQUEST['pid'])) { |
|
603 | - $bID = (int) $_REQUEST['pid']; |
|
604 | - $temp = $modx->getParentIds($bID); |
|
605 | - array_unshift($temp, $bID); |
|
606 | - } |
|
607 | - |
|
608 | - if($temp) { |
|
609 | - $parents = implode(',', $temp); |
|
610 | - |
|
611 | - if(!empty($parents)) { |
|
612 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | - while($row = $modx->db->getRow($rs)) { |
|
615 | - $out .= '<li class="breadcrumbs__li"> |
|
594 | + // breadcrumbs |
|
595 | + if($modx->config['use_breadcrumbs']) { |
|
596 | + $temp = array(); |
|
597 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | + |
|
599 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | + $bID = (int) $_REQUEST['id']; |
|
601 | + $temp = $modx->getParentIds($bID); |
|
602 | + } else if(isset($_REQUEST['pid'])) { |
|
603 | + $bID = (int) $_REQUEST['pid']; |
|
604 | + $temp = $modx->getParentIds($bID); |
|
605 | + array_unshift($temp, $bID); |
|
606 | + } |
|
607 | + |
|
608 | + if($temp) { |
|
609 | + $parents = implode(',', $temp); |
|
610 | + |
|
611 | + if(!empty($parents)) { |
|
612 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | + while($row = $modx->db->getRow($rs)) { |
|
615 | + $out .= '<li class="breadcrumbs__li"> |
|
616 | 616 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | - } |
|
620 | - } |
|
621 | - } |
|
619 | + } |
|
620 | + } |
|
621 | + } |
|
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | - } |
|
626 | - ?> |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | + } |
|
626 | + ?> |
|
627 | 627 | |
628 | 628 | <!-- start main wrapper --> |
629 | 629 | <div class="sectionBody"> |
@@ -635,13 +635,13 @@ discard block |
||
635 | 635 | |
636 | 636 | <!-- General --> |
637 | 637 | <?php |
638 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | - 'id' => $id |
|
640 | - )); |
|
641 | - if(is_array($evtOut)) { |
|
642 | - echo implode('', $evtOut); |
|
643 | - } else { |
|
644 | - ?> |
|
638 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | + 'id' => $id |
|
640 | + )); |
|
641 | + if(is_array($evtOut)) { |
|
642 | + echo implode('', $evtOut); |
|
643 | + } else { |
|
644 | + ?> |
|
645 | 645 | <div class="tab-page" id="tabGeneral"> |
646 | 646 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
647 | 647 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -726,36 +726,36 @@ discard block |
||
726 | 726 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
727 | 727 | <option value="0">(blank)</option> |
728 | 728 | <?php |
729 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | - $currentCategory = ''; |
|
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | - continue; |
|
736 | - }; |
|
737 | - // Skip if not selectable but show if selected! |
|
738 | - $thisCategory = $row['category']; |
|
739 | - if($thisCategory == null) { |
|
740 | - $thisCategory = $_lang["no_category"]; |
|
741 | - } |
|
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
744 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | - } |
|
746 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | - $closeOptGroup = true; |
|
748 | - } |
|
729 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | + $currentCategory = ''; |
|
733 | + while($row = $modx->db->getRow($rs)) { |
|
734 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | + continue; |
|
736 | + }; |
|
737 | + // Skip if not selectable but show if selected! |
|
738 | + $thisCategory = $row['category']; |
|
739 | + if($thisCategory == null) { |
|
740 | + $thisCategory = $_lang["no_category"]; |
|
741 | + } |
|
742 | + if($thisCategory != $currentCategory) { |
|
743 | + if($closeOptGroup) { |
|
744 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | + } |
|
746 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | + $closeOptGroup = true; |
|
748 | + } |
|
749 | 749 | |
750 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
750 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | - $currentCategory = $thisCategory; |
|
754 | - } |
|
755 | - if($thisCategory != '') { |
|
756 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | - } |
|
758 | - ?> |
|
752 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | + $currentCategory = $thisCategory; |
|
754 | + } |
|
755 | + if($thisCategory != '') { |
|
756 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | + } |
|
758 | + ?> |
|
759 | 759 | </select> |
760 | 760 | </td> |
761 | 761 | </tr> |
@@ -795,37 +795,37 @@ discard block |
||
795 | 795 | </td> |
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | - $parentlookup = false; |
|
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
801 | - $parentname = $site_name; |
|
802 | - } else { |
|
803 | - $parentlookup = $content['parent']; |
|
804 | - } |
|
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
807 | - $parentname = $site_name; |
|
808 | - } else { |
|
809 | - $parentlookup = $_REQUEST['pid']; |
|
810 | - } |
|
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
813 | - $parentname = $site_name; |
|
814 | - } else { |
|
815 | - $parentlookup = $_POST['parent']; |
|
816 | - } |
|
817 | - } else { |
|
818 | - $parentname = $site_name; |
|
819 | - $content['parent'] = 0; |
|
820 | - } |
|
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | - $parentname = $modx->db->getValue($rs); |
|
824 | - if(!$parentname) { |
|
825 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | - } |
|
827 | - } |
|
828 | - ?> |
|
798 | + $parentlookup = false; |
|
799 | + if(isset ($_REQUEST['id'])) { |
|
800 | + if($content['parent'] == 0) { |
|
801 | + $parentname = $site_name; |
|
802 | + } else { |
|
803 | + $parentlookup = $content['parent']; |
|
804 | + } |
|
805 | + } elseif(isset ($_REQUEST['pid'])) { |
|
806 | + if($_REQUEST['pid'] == 0) { |
|
807 | + $parentname = $site_name; |
|
808 | + } else { |
|
809 | + $parentlookup = $_REQUEST['pid']; |
|
810 | + } |
|
811 | + } elseif(isset($_POST['parent'])) { |
|
812 | + if($_POST['parent'] == 0) { |
|
813 | + $parentname = $site_name; |
|
814 | + } else { |
|
815 | + $parentlookup = $_POST['parent']; |
|
816 | + } |
|
817 | + } else { |
|
818 | + $parentname = $site_name; |
|
819 | + $content['parent'] = 0; |
|
820 | + } |
|
821 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | + $parentname = $modx->db->getValue($rs); |
|
824 | + if(!$parentname) { |
|
825 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | + } |
|
827 | + } |
|
828 | + ?> |
|
829 | 829 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
830 | 830 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
831 | 831 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | </tr> |
834 | 834 | <tr></tr> |
835 | 835 | <?php |
836 | - /* |
|
836 | + /* |
|
837 | 837 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
838 | 838 | ?> |
839 | 839 | <tr> |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | </tr> |
862 | 862 | <?php |
863 | 863 | }*/ |
864 | - ?> |
|
864 | + ?> |
|
865 | 865 | |
866 | 866 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
867 | 867 | <tr> |
@@ -874,36 +874,36 @@ discard block |
||
874 | 874 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
875 | 875 | <option value="none"><?= $_lang['none'] ?></option> |
876 | 876 | <?php |
877 | - // invoke OnRichTextEditorRegister event |
|
878 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
881 | - $editor = $evtOut[$i]; |
|
882 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | - } |
|
884 | - } |
|
885 | - ?> |
|
877 | + // invoke OnRichTextEditorRegister event |
|
878 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | + if(is_array($evtOut)) { |
|
880 | + for($i = 0; $i < count($evtOut); $i++) { |
|
881 | + $editor = $evtOut[$i]; |
|
882 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | + } |
|
884 | + } |
|
885 | + ?> |
|
886 | 886 | </select> |
887 | 887 | </label> |
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | - $htmlContent = $content['content']; |
|
893 | - ?> |
|
891 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | + $htmlContent = $content['content']; |
|
893 | + ?> |
|
894 | 894 | <div class="section-editor clearfix"> |
895 | 895 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
896 | 896 | </div> |
897 | 897 | <?php |
898 | - // Richtext-[*content*] |
|
899 | - $richtexteditorIds = array(); |
|
900 | - $richtexteditorOptions = array(); |
|
901 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | - } else { |
|
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | - } |
|
906 | - ?> |
|
898 | + // Richtext-[*content*] |
|
899 | + $richtexteditorIds = array(); |
|
900 | + $richtexteditorOptions = array(); |
|
901 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | + } else { |
|
904 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | + } |
|
906 | + ?> |
|
907 | 907 | </div> |
908 | 908 | </td> |
909 | 909 | </tr> |
@@ -1190,8 +1190,8 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | <?php |
1192 | 1192 | |
1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | - ?> |
|
1193 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | + ?> |
|
1195 | 1195 | <tr> |
1196 | 1196 | <td> |
1197 | 1197 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1213,15 +1213,15 @@ discard block |
||
1213 | 1213 | <td> |
1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1215 | 1215 | <?php |
1216 | - if(!$content['contentType']) { |
|
1217 | - $content['contentType'] = 'text/html'; |
|
1218 | - } |
|
1219 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1220 | - $ct = explode(",", $custom_contenttype); |
|
1221 | - for($i = 0; $i < count($ct); $i++) { |
|
1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1223 | - } |
|
1224 | - ?> |
|
1216 | + if(!$content['contentType']) { |
|
1217 | + $content['contentType'] = 'text/html'; |
|
1218 | + } |
|
1219 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1220 | + $ct = explode(",", $custom_contenttype); |
|
1221 | + for($i = 0; $i < count($ct); $i++) { |
|
1222 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1223 | + } |
|
1224 | + ?> |
|
1225 | 1225 | </select> |
1226 | 1226 | </td> |
1227 | 1227 | </tr> |
@@ -1244,23 +1244,23 @@ discard block |
||
1244 | 1244 | </td> |
1245 | 1245 | </tr> |
1246 | 1246 | <?php |
1247 | - } else { |
|
1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | - // non-admin managers creating or editing a document resource |
|
1250 | - ?> |
|
1247 | + } else { |
|
1248 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | + // non-admin managers creating or editing a document resource |
|
1250 | + ?> |
|
1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
1252 | 1252 | <input type="hidden" name="type" value="document" /> |
1253 | 1253 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
1254 | 1254 | <?php |
1255 | - } else { |
|
1256 | - // non-admin managers creating or editing a reference (weblink) resource |
|
1257 | - ?> |
|
1255 | + } else { |
|
1256 | + // non-admin managers creating or editing a reference (weblink) resource |
|
1257 | + ?> |
|
1258 | 1258 | <input type="hidden" name="type" value="reference" /> |
1259 | 1259 | <input type="hidden" name="contentType" value="text/html" /> |
1260 | 1260 | <?php |
1261 | - } |
|
1262 | - }//if mgrRole |
|
1263 | - ?> |
|
1261 | + } |
|
1262 | + }//if mgrRole |
|
1263 | + ?> |
|
1264 | 1264 | |
1265 | 1265 | <tr> |
1266 | 1266 | <td> |
@@ -1343,112 +1343,112 @@ discard block |
||
1343 | 1343 | ?> |
1344 | 1344 | |
1345 | 1345 | <?php |
1346 | - /******************************* |
|
1346 | + /******************************* |
|
1347 | 1347 | * Document Access Permissions */ |
1348 | - if($use_udperms == 1) { |
|
1349 | - $groupsarray = array(); |
|
1350 | - $sql = ''; |
|
1351 | - |
|
1352 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1353 | - if($documentId > 0) { |
|
1354 | - // Load up, the permissions from the parent (if new document) or existing document |
|
1355 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1357 | - |
|
1358 | - // Load up the current permissions and names |
|
1359 | - $vs = array( |
|
1360 | - $tbl_document_group_names, |
|
1361 | - $tbl_document_groups, |
|
1362 | - $documentId |
|
1363 | - ); |
|
1364 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1365 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1366 | - } else { |
|
1367 | - // Just load up the names, we're starting clean |
|
1368 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1369 | - } |
|
1370 | - |
|
1371 | - // retain selected doc groups between post |
|
1372 | - if(isset($_POST['docgroups'])) { |
|
1373 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1374 | - } |
|
1348 | + if($use_udperms == 1) { |
|
1349 | + $groupsarray = array(); |
|
1350 | + $sql = ''; |
|
1351 | + |
|
1352 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1353 | + if($documentId > 0) { |
|
1354 | + // Load up, the permissions from the parent (if new document) or existing document |
|
1355 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1356 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1357 | + |
|
1358 | + // Load up the current permissions and names |
|
1359 | + $vs = array( |
|
1360 | + $tbl_document_group_names, |
|
1361 | + $tbl_document_groups, |
|
1362 | + $documentId |
|
1363 | + ); |
|
1364 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1365 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1366 | + } else { |
|
1367 | + // Just load up the names, we're starting clean |
|
1368 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1369 | + } |
|
1370 | + |
|
1371 | + // retain selected doc groups between post |
|
1372 | + if(isset($_POST['docgroups'])) { |
|
1373 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1374 | + } |
|
1375 | + |
|
1376 | + $isManager = $modx->hasPermission('access_permissions'); |
|
1377 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1378 | + |
|
1379 | + // Setup Basic attributes for each Input box |
|
1380 | + $inputAttributes = array( |
|
1381 | + 'type' => 'checkbox', |
|
1382 | + 'class' => 'checkbox', |
|
1383 | + 'name' => 'docgroups[]', |
|
1384 | + 'onclick' => 'makePublic(false);', |
|
1385 | + ); |
|
1386 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1387 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
1388 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1389 | + |
|
1390 | + // Loop through the permissions list |
|
1391 | + while($row = $modx->db->getRow($rs)) { |
|
1392 | + |
|
1393 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
1394 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | + $inputId = 'group-' . $row['id']; |
|
1396 | + |
|
1397 | + $checked = in_array($inputValue, $groupsarray); |
|
1398 | + if($checked) { |
|
1399 | + $notPublic = true; |
|
1400 | + } // Mark as private access (either web or manager) |
|
1401 | + |
|
1402 | + // Skip the access permission if the user doesn't have access... |
|
1403 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | + continue; |
|
1405 | + } |
|
1375 | 1406 | |
1376 | - $isManager = $modx->hasPermission('access_permissions'); |
|
1377 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1378 | - |
|
1379 | - // Setup Basic attributes for each Input box |
|
1380 | - $inputAttributes = array( |
|
1381 | - 'type' => 'checkbox', |
|
1382 | - 'class' => 'checkbox', |
|
1383 | - 'name' => 'docgroups[]', |
|
1384 | - 'onclick' => 'makePublic(false);', |
|
1385 | - ); |
|
1386 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1387 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
1388 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1389 | - |
|
1390 | - // Loop through the permissions list |
|
1391 | - while($row = $modx->db->getRow($rs)) { |
|
1392 | - |
|
1393 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | - $inputId = 'group-' . $row['id']; |
|
1396 | - |
|
1397 | - $checked = in_array($inputValue, $groupsarray); |
|
1398 | - if($checked) { |
|
1399 | - $notPublic = true; |
|
1400 | - } // Mark as private access (either web or manager) |
|
1401 | - |
|
1402 | - // Skip the access permission if the user doesn't have access... |
|
1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | - continue; |
|
1405 | - } |
|
1406 | - |
|
1407 | - // Setup attributes for this Input box |
|
1408 | - $inputAttributes['id'] = $inputId; |
|
1409 | - $inputAttributes['value'] = $inputValue; |
|
1410 | - if($checked) { |
|
1411 | - $inputAttributes['checked'] = 'checked'; |
|
1412 | - } else { |
|
1413 | - unset($inputAttributes['checked']); |
|
1414 | - } |
|
1415 | - |
|
1416 | - // Create attribute string list |
|
1417 | - $inputString = array(); |
|
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1419 | - |
|
1420 | - // Make the <input> HTML |
|
1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1422 | - |
|
1423 | - // does user have this permission? |
|
1424 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1425 | - $vs = array( |
|
1426 | - $row['id'], |
|
1427 | - $_SESSION['mgrInternalKey'] |
|
1428 | - ); |
|
1429 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1430 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1431 | - $count = $modx->db->getValue($rsp); |
|
1432 | - if($count > 0) { |
|
1433 | - ++$permissions_yes; |
|
1434 | - } else { |
|
1435 | - ++$permissions_no; |
|
1436 | - } |
|
1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1438 | - } |
|
1439 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | - $permissions = array(); |
|
1442 | - } |
|
1407 | + // Setup attributes for this Input box |
|
1408 | + $inputAttributes['id'] = $inputId; |
|
1409 | + $inputAttributes['value'] = $inputValue; |
|
1410 | + if($checked) { |
|
1411 | + $inputAttributes['checked'] = 'checked'; |
|
1412 | + } else { |
|
1413 | + unset($inputAttributes['checked']); |
|
1414 | + } |
|
1443 | 1415 | |
1444 | - // See if the Access Permissions section is worth displaying... |
|
1445 | - if(!empty($permissions)) { |
|
1446 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
1447 | - if($isManager && $isWeb) { |
|
1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1449 | - } |
|
1450 | - // Output the permissions list... |
|
1451 | - ?> |
|
1416 | + // Create attribute string list |
|
1417 | + $inputString = array(); |
|
1418 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1419 | + |
|
1420 | + // Make the <input> HTML |
|
1421 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1422 | + |
|
1423 | + // does user have this permission? |
|
1424 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1425 | + $vs = array( |
|
1426 | + $row['id'], |
|
1427 | + $_SESSION['mgrInternalKey'] |
|
1428 | + ); |
|
1429 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1430 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1431 | + $count = $modx->db->getValue($rsp); |
|
1432 | + if($count > 0) { |
|
1433 | + ++$permissions_yes; |
|
1434 | + } else { |
|
1435 | + ++$permissions_no; |
|
1436 | + } |
|
1437 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1438 | + } |
|
1439 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1440 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | + $permissions = array(); |
|
1442 | + } |
|
1443 | + |
|
1444 | + // See if the Access Permissions section is worth displaying... |
|
1445 | + if(!empty($permissions)) { |
|
1446 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
1447 | + if($isManager && $isWeb) { |
|
1448 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1449 | + } |
|
1450 | + // Output the permissions list... |
|
1451 | + ?> |
|
1452 | 1452 | <!-- Access Permissions --> |
1453 | 1453 | <div class="tab-page" id="tabAccess"> |
1454 | 1454 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1482,31 +1482,31 @@ discard block |
||
1482 | 1482 | </ul> |
1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
1484 | 1484 | <?php |
1485 | - } // !empty($permissions) |
|
1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | - ?> |
|
1485 | + } // !empty($permissions) |
|
1486 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | + ?> |
|
1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1489 | 1489 | <?php |
1490 | 1490 | |
1491 | - } |
|
1492 | - } |
|
1493 | - /* End Document Access Permissions * |
|
1491 | + } |
|
1492 | + } |
|
1493 | + /* End Document Access Permissions * |
|
1494 | 1494 | ***********************************/ |
1495 | - ?> |
|
1495 | + ?> |
|
1496 | 1496 | |
1497 | 1497 | <input type="submit" name="save" style="display:none" /> |
1498 | 1498 | <?php |
1499 | 1499 | |
1500 | - // invoke OnDocFormRender event |
|
1501 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1502 | - 'id' => $id, |
|
1503 | - 'template' => $content['template'] |
|
1504 | - )); |
|
1500 | + // invoke OnDocFormRender event |
|
1501 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1502 | + 'id' => $id, |
|
1503 | + 'template' => $content['template'] |
|
1504 | + )); |
|
1505 | 1505 | |
1506 | - if(is_array($evtOut)) { |
|
1507 | - echo implode('', $evtOut); |
|
1508 | - } |
|
1509 | - ?> |
|
1506 | + if(is_array($evtOut)) { |
|
1507 | + echo implode('', $evtOut); |
|
1508 | + } |
|
1509 | + ?> |
|
1510 | 1510 | </div><!--div class="tab-pane" id="documentPane"--> |
1511 | 1511 | </div><!--div class="sectionBody"--> |
1512 | 1512 | </fieldset> |
@@ -1517,62 +1517,62 @@ discard block |
||
1517 | 1517 | </script> |
1518 | 1518 | <?php |
1519 | 1519 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
1520 | - if(is_array($richtexteditorIds)) { |
|
1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1522 | - // invoke OnRichTextEditorInit event |
|
1523 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1524 | - 'editor' => $editor, |
|
1525 | - 'elements' => $elements, |
|
1526 | - 'options' => $richtexteditorOptions[$editor] |
|
1527 | - )); |
|
1528 | - if(is_array($evtOut)) { |
|
1529 | - echo implode('', $evtOut); |
|
1530 | - } |
|
1531 | - } |
|
1532 | - } |
|
1520 | + if(is_array($richtexteditorIds)) { |
|
1521 | + foreach($richtexteditorIds as $editor => $elements) { |
|
1522 | + // invoke OnRichTextEditorInit event |
|
1523 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1524 | + 'editor' => $editor, |
|
1525 | + 'elements' => $elements, |
|
1526 | + 'options' => $richtexteditorOptions[$editor] |
|
1527 | + )); |
|
1528 | + if(is_array($evtOut)) { |
|
1529 | + echo implode('', $evtOut); |
|
1530 | + } |
|
1531 | + } |
|
1532 | + } |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | function getDefaultTemplate() { |
1536 | - global $modx; |
|
1537 | - |
|
1538 | - switch($modx->config['auto_template_logic']) { |
|
1539 | - case 'sibling': |
|
1540 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1541 | - $site_start = $modx->config['site_start']; |
|
1542 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1543 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1544 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1545 | - $default_template = $sibl[0]['template']; |
|
1546 | - } |
|
1547 | - } else { |
|
1548 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1549 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1550 | - $default_template = $sibl[0]['template']; |
|
1551 | - } else { |
|
1552 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | - $default_template = $sibl[0]['template']; |
|
1555 | - } |
|
1556 | - } |
|
1557 | - } |
|
1558 | - if(isset($default_template)) { |
|
1559 | - break; |
|
1560 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1561 | - case 'parent': |
|
1562 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1563 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1564 | - if(isset($parent['template'])) { |
|
1565 | - $default_template = $parent['template']; |
|
1566 | - } |
|
1567 | - } |
|
1568 | - break; |
|
1569 | - case 'system': |
|
1570 | - default: // default_template is already set |
|
1571 | - $default_template = $modx->config['default_template']; |
|
1572 | - } |
|
1573 | - if(!isset($default_template)) { |
|
1574 | - $default_template = $modx->config['default_template']; |
|
1575 | - } // default_template is already set |
|
1576 | - |
|
1577 | - return $default_template; |
|
1536 | + global $modx; |
|
1537 | + |
|
1538 | + switch($modx->config['auto_template_logic']) { |
|
1539 | + case 'sibling': |
|
1540 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1541 | + $site_start = $modx->config['site_start']; |
|
1542 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1543 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1544 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1545 | + $default_template = $sibl[0]['template']; |
|
1546 | + } |
|
1547 | + } else { |
|
1548 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1549 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1550 | + $default_template = $sibl[0]['template']; |
|
1551 | + } else { |
|
1552 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1553 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | + $default_template = $sibl[0]['template']; |
|
1555 | + } |
|
1556 | + } |
|
1557 | + } |
|
1558 | + if(isset($default_template)) { |
|
1559 | + break; |
|
1560 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1561 | + case 'parent': |
|
1562 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1563 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1564 | + if(isset($parent['template'])) { |
|
1565 | + $default_template = $parent['template']; |
|
1566 | + } |
|
1567 | + } |
|
1568 | + break; |
|
1569 | + case 'system': |
|
1570 | + default: // default_template is already set |
|
1571 | + $default_template = $modx->config['default_template']; |
|
1572 | + } |
|
1573 | + if(!isset($default_template)) { |
|
1574 | + $default_template = $modx->config['default_template']; |
|
1575 | + } // default_template is already set |
|
1576 | + |
|
1577 | + return $default_template; |
|
1578 | 1578 | } |
@@ -1,35 +1,35 @@ 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 | |
6 | 6 | /********************/ |
7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
10 | -$add_path = $sd . $sb . $pg; |
|
7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
10 | +$add_path = $sd.$sb.$pg; |
|
11 | 11 | /*******************/ |
12 | 12 | |
13 | 13 | // check permissions |
14 | -switch($modx->manager->action) { |
|
14 | +switch ($modx->manager->action) { |
|
15 | 15 | case 27: |
16 | - if(!$modx->hasPermission('edit_document')) { |
|
16 | + if (!$modx->hasPermission('edit_document')) { |
|
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | 19 | break; |
20 | 20 | case 85: |
21 | 21 | case 72: |
22 | 22 | case 4: |
23 | - if(!$modx->hasPermission('new_document')) { |
|
23 | + if (!$modx->hasPermission('new_document')) { |
|
24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | 26 | // check user has permissions for parent |
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
28 | 28 | $udperms = new udperms(); |
29 | 29 | $udperms->user = $modx->getLoginUserID(); |
30 | 30 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | - if(!$udperms->checkPermissions()) { |
|
32 | + if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
39 | 39 | } |
40 | 40 | |
41 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
41 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
42 | 42 | |
43 | 43 | // Get table names (alphabetical) |
44 | 44 | $tbl_categories = $modx->getFullTableName('categories'); |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | -if($modx->manager->action == 27) { |
|
56 | +if ($modx->manager->action == 27) { |
|
57 | 57 | //editing an existing document |
58 | 58 | // check permissions on the document |
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
59 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
60 | 60 | $udperms = new udperms(); |
61 | 61 | $udperms->user = $modx->getLoginUserID(); |
62 | 62 | $udperms->document = $id; |
63 | 63 | $udperms->role = $_SESSION['mgrRole']; |
64 | 64 | |
65 | - if(!$udperms->checkPermissions()) { |
|
65 | + if (!$udperms->checkPermissions()) { |
|
66 | 66 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
71 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
72 | 72 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
73 | 73 | } |
74 | 74 | // end check for lock |
@@ -77,27 +77,27 @@ discard block |
||
77 | 77 | $modx->lockElement(7, $id); |
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | -if($_SESSION['mgrDocgroups']) { |
|
80 | +if ($_SESSION['mgrDocgroups']) { |
|
81 | 81 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
82 | 82 | } |
83 | 83 | |
84 | -if(!empty ($id)) { |
|
84 | +if (!empty ($id)) { |
|
85 | 85 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
86 | - if($docgrp) { |
|
86 | + if ($docgrp) { |
|
87 | 87 | $access .= " OR dg.document_group IN ({$docgrp})"; |
88 | 88 | } |
89 | 89 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
90 | 90 | $content = array(); |
91 | 91 | $content = $modx->db->getRow($rs); |
92 | 92 | $modx->documentObject = &$content; |
93 | - if(!$content) { |
|
93 | + if (!$content) { |
|
94 | 94 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
95 | 95 | } |
96 | 96 | $_SESSION['itemname'] = $content['pagetitle']; |
97 | 97 | } else { |
98 | 98 | $content = array(); |
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
100 | + if (isset($_REQUEST['newtemplate'])) { |
|
101 | 101 | $content['template'] = $_REQUEST['newtemplate']; |
102 | 102 | } else { |
103 | 103 | $content['template'] = getDefaultTemplate(); |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | -if(isset($_REQUEST['newtemplate'])) { |
|
111 | +if (isset($_REQUEST['newtemplate'])) { |
|
112 | 112 | $formRestored = true; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | -if($formRestored == true) { |
|
118 | +if ($formRestored == true) { |
|
119 | 119 | $content = array_merge($content, $_POST); |
120 | 120 | $content['content'] = $_POST['ta']; |
121 | - if(empty ($content['pub_date'])) { |
|
121 | + if (empty ($content['pub_date'])) { |
|
122 | 122 | unset ($content['pub_date']); |
123 | 123 | } else { |
124 | 124 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
125 | 125 | } |
126 | - if(empty ($content['unpub_date'])) { |
|
126 | + if (empty ($content['unpub_date'])) { |
|
127 | 127 | unset ($content['unpub_date']); |
128 | 128 | } else { |
129 | 129 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | -if(!isset ($_REQUEST['id'])) { |
|
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | +if (!isset ($_REQUEST['id'])) { |
|
135 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
136 | 136 | $modx->config['auto_menuindex'] = 1; |
137 | 137 | } |
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
138 | + if ($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int) $_REQUEST['pid']; |
|
140 | 140 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
141 | 141 | $content['menuindex'] = $modx->db->getValue($rs); |
142 | 142 | } else { |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -if(isset ($_POST['which_editor'])) { |
|
147 | +if (isset ($_POST['which_editor'])) { |
|
148 | 148 | $modx->config['which_editor'] = $_POST['which_editor']; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
152 | 152 | $lockElementId = $id; |
153 | 153 | $lockElementType = 7; |
154 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
154 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
155 | 155 | ?> |
156 | 156 | <script type="text/javascript"> |
157 | 157 | /* <![CDATA[ */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | }, |
182 | 182 | cancel: function() { |
183 | 183 | documentDirty = false; |
184 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
184 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
185 | 185 | }, |
186 | 186 | duplicate: function() { |
187 | 187 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | }, |
191 | 191 | view: function() { |
192 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
192 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
193 | 193 | } |
194 | 194 | }; |
195 | 195 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | 'template' => $content['template'] |
552 | 552 | )); |
553 | 553 | |
554 | - if(is_array($evtOut)) { |
|
554 | + if (is_array($evtOut)) { |
|
555 | 555 | echo implode('', $evtOut); |
556 | 556 | } |
557 | 557 | |
@@ -575,8 +575,8 @@ discard block |
||
575 | 575 | <fieldset id="create_edit"> |
576 | 576 | |
577 | 577 | <h1> |
578 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
580 | 580 | } else { |
581 | 581 | if ($modx->manager->action == '4') { |
582 | 582 | echo $_lang['add_resource']; |
@@ -592,36 +592,36 @@ discard block |
||
592 | 592 | |
593 | 593 | <?php |
594 | 594 | // breadcrumbs |
595 | - if($modx->config['use_breadcrumbs']) { |
|
595 | + if ($modx->config['use_breadcrumbs']) { |
|
596 | 596 | $temp = array(); |
597 | 597 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
598 | 598 | |
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
599 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | 600 | $bID = (int) $_REQUEST['id']; |
601 | 601 | $temp = $modx->getParentIds($bID); |
602 | - } else if(isset($_REQUEST['pid'])) { |
|
602 | + } else if (isset($_REQUEST['pid'])) { |
|
603 | 603 | $bID = (int) $_REQUEST['pid']; |
604 | 604 | $temp = $modx->getParentIds($bID); |
605 | 605 | array_unshift($temp, $bID); |
606 | 606 | } |
607 | 607 | |
608 | - if($temp) { |
|
608 | + if ($temp) { |
|
609 | 609 | $parents = implode(',', $temp); |
610 | 610 | |
611 | - if(!empty($parents)) { |
|
611 | + if (!empty($parents)) { |
|
612 | 612 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
613 | 613 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
614 | - while($row = $modx->db->getRow($rs)) { |
|
614 | + while ($row = $modx->db->getRow($rs)) { |
|
615 | 615 | $out .= '<li class="breadcrumbs__li"> |
616 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
616 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | 619 | } |
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
624 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
625 | 625 | } |
626 | 626 | ?> |
627 | 627 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
639 | 639 | 'id' => $id |
640 | 640 | )); |
641 | - if(is_array($evtOut)) { |
|
641 | + if (is_array($evtOut)) { |
|
642 | 642 | echo implode('', $evtOut); |
643 | 643 | } else { |
644 | 644 | ?> |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | </td> |
695 | 695 | </tr> |
696 | 696 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
697 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | 698 | |
699 | 699 | <tr> |
700 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -730,17 +730,17 @@ discard block |
||
730 | 730 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
731 | 731 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
732 | 732 | $currentCategory = ''; |
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + while ($row = $modx->db->getRow($rs)) { |
|
734 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | 735 | continue; |
736 | 736 | }; |
737 | 737 | // Skip if not selectable but show if selected! |
738 | 738 | $thisCategory = $row['category']; |
739 | - if($thisCategory == null) { |
|
739 | + if ($thisCategory == null) { |
|
740 | 740 | $thisCategory = $_lang["no_category"]; |
741 | 741 | } |
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
742 | + if ($thisCategory != $currentCategory) { |
|
743 | + if ($closeOptGroup) { |
|
744 | 744 | echo "\t\t\t\t\t</optgroup>\n"; |
745 | 745 | } |
746 | 746 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -749,10 +749,10 @@ discard block |
||
749 | 749 | |
750 | 750 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
752 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
753 | 753 | $currentCategory = $thisCategory; |
754 | 754 | } |
755 | - if($thisCategory != '') { |
|
755 | + if ($thisCategory != '') { |
|
756 | 756 | echo "\t\t\t\t\t</optgroup>\n"; |
757 | 757 | } |
758 | 758 | ?> |
@@ -796,20 +796,20 @@ discard block |
||
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | 798 | $parentlookup = false; |
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
799 | + if (isset ($_REQUEST['id'])) { |
|
800 | + if ($content['parent'] == 0) { |
|
801 | 801 | $parentname = $site_name; |
802 | 802 | } else { |
803 | 803 | $parentlookup = $content['parent']; |
804 | 804 | } |
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
805 | + } elseif (isset ($_REQUEST['pid'])) { |
|
806 | + if ($_REQUEST['pid'] == 0) { |
|
807 | 807 | $parentname = $site_name; |
808 | 808 | } else { |
809 | 809 | $parentlookup = $_REQUEST['pid']; |
810 | 810 | } |
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
811 | + } elseif (isset($_POST['parent'])) { |
|
812 | + if ($_POST['parent'] == 0) { |
|
813 | 813 | $parentname = $site_name; |
814 | 814 | } else { |
815 | 815 | $parentlookup = $_POST['parent']; |
@@ -818,10 +818,10 @@ discard block |
||
818 | 818 | $parentname = $site_name; |
819 | 819 | $content['parent'] = 0; |
820 | 820 | } |
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
821 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | 822 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
823 | 823 | $parentname = $modx->db->getValue($rs); |
824 | - if(!$parentname) { |
|
824 | + if (!$parentname) { |
|
825 | 825 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
826 | 826 | } |
827 | 827 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | }*/ |
864 | 864 | ?> |
865 | 865 | |
866 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
866 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
867 | 867 | <tr> |
868 | 868 | <td colspan="2"> |
869 | 869 | <hr> |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | <?php |
877 | 877 | // invoke OnRichTextEditorRegister event |
878 | 878 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + if (is_array($evtOut)) { |
|
880 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
881 | 881 | $editor = $evtOut[$i]; |
882 | 882 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
883 | 883 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
891 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | 892 | $htmlContent = $content['content']; |
893 | 893 | ?> |
894 | 894 | <div class="section-editor clearfix"> |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
902 | 902 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
903 | 903 | } else { |
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
904 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
905 | 905 | } |
906 | 906 | ?> |
907 | 907 | </div> |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | |
918 | 918 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
919 | 919 | $template = $default_template; |
920 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
920 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
921 | 921 | if (isset ($_REQUEST['newtemplate'])) { |
922 | 922 | $template = $_REQUEST['newtemplate']; |
923 | 923 | } else { |
@@ -945,10 +945,10 @@ discard block |
||
945 | 945 | ); |
946 | 946 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
947 | 947 | if ($group_tvs) { |
948 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
948 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
949 | 949 | $from .= ' |
950 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
951 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
950 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
951 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
952 | 952 | } |
953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
954 | 954 | $rs = $modx->db->select($field, $from, $where, $sort); |
@@ -957,37 +957,37 @@ discard block |
||
957 | 957 | <!-- Template Variables -->' . "\n"; |
958 | 958 | if (!$group_tvs) { |
959 | 959 | $templateVariables .= ' |
960 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
960 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
961 | 961 | <div class="sectionBody tmplvars"> |
962 | 962 | <table>'; |
963 | 963 | } else if ($group_tvs == 2) { |
964 | 964 | $templateVariables .= ' |
965 | 965 | <div class="tab-section"> |
966 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
966 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
967 | 967 | <div class="tab-pane" id="paneTemplateVariables"> |
968 | 968 | <script type="text/javascript"> |
969 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
969 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
970 | 970 | </script>'; |
971 | 971 | } else if ($group_tvs == 3) { |
972 | 972 | $templateVariables .= ' |
973 | 973 | <div id="templateVariables" class="tab-page tmplvars"> |
974 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
974 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
975 | 975 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
976 | 976 | } else if ($group_tvs == 4) { |
977 | 977 | $templateVariables .= ' |
978 | 978 | <div id="templateVariables" class="tab-page tmplvars"> |
979 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
979 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
980 | 980 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
981 | 981 | |
982 | 982 | <div class="tab-pane" id="paneTemplateVariables"> |
983 | 983 | <script type="text/javascript"> |
984 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
984 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
985 | 985 | </script>'; |
986 | 986 | } |
987 | 987 | |
988 | 988 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
989 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
990 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
989 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
990 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
991 | 991 | $i = 0; |
992 | 992 | $tab = ''; |
993 | 993 | foreach ($tvsArray as $row) { |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | if ($group_tvs == 1 || $group_tvs == 3) { |
996 | 996 | if ($i === 0) { |
997 | 997 | $templateVariables .= ' |
998 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
999 | - <div class="tab-header">' . $row['category'] . '</div> |
|
998 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
999 | + <div class="tab-header">' . $row['category'].'</div> |
|
1000 | 1000 | <div class="tab-body tmplvars"> |
1001 | 1001 | <table>' . "\n"; |
1002 | 1002 | } else { |
@@ -1005,17 +1005,17 @@ discard block |
||
1005 | 1005 | </div> |
1006 | 1006 | </div> |
1007 | 1007 | |
1008 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
1009 | - <div class="tab-header">' . $row['category'] . '</div> |
|
1008 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
1009 | + <div class="tab-header">' . $row['category'].'</div> |
|
1010 | 1010 | <div class="tab-body tmplvars"> |
1011 | 1011 | <table>'; |
1012 | 1012 | } |
1013 | 1013 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
1014 | 1014 | if ($i === 0) { |
1015 | 1015 | $templateVariables .= ' |
1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1018 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1018 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1019 | 1019 | |
1020 | 1020 | <div class="tab-body tmplvars"> |
1021 | 1021 | <table>'; |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | </div> |
1026 | 1026 | </div> |
1027 | 1027 | |
1028 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1029 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1030 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1028 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1029 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1030 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1031 | 1031 | |
1032 | 1032 | <div class="tab-body tmplvars"> |
1033 | 1033 | <table>'; |
@@ -1035,18 +1035,18 @@ discard block |
||
1035 | 1035 | } else if ($group_tvs == 5) { |
1036 | 1036 | if ($i === 0) { |
1037 | 1037 | $templateVariables .= ' |
1038 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1039 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1040 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1038 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1039 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1040 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1041 | 1041 | <table>'; |
1042 | 1042 | } else { |
1043 | 1043 | $templateVariables .= ' |
1044 | 1044 | </table> |
1045 | 1045 | </div> |
1046 | 1046 | |
1047 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1048 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1049 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1047 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1048 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1049 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1050 | 1050 | |
1051 | 1051 | <table>'; |
1052 | 1052 | } |
@@ -1064,8 +1064,8 @@ discard block |
||
1064 | 1064 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
1065 | 1065 | }; |
1066 | 1066 | // Add richtext editor to the list |
1067 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
1068 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
1067 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
1068 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
1069 | 1069 | } |
1070 | 1070 | // splitter |
1071 | 1071 | if ($group_tvs) { |
@@ -1079,24 +1079,24 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | // post back value |
1082 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
1083 | - if (is_array($_POST['tv' . $row['id']])) { |
|
1084 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
1082 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
1083 | + if (is_array($_POST['tv'.$row['id']])) { |
|
1084 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
1085 | 1085 | } else { |
1086 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
1086 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
1087 | 1087 | } |
1088 | 1088 | } else { |
1089 | 1089 | $tvPBV = $row['value']; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
1093 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
1094 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
1092 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
1093 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
1094 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
1095 | 1095 | |
1096 | 1096 | $templateVariables .= ' |
1097 | 1097 | <tr> |
1098 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
1099 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
1098 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
1099 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
1100 | 1100 | </tr>'; |
1101 | 1101 | |
1102 | 1102 | $tab = $row['category_id']; |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | <?php |
1192 | 1192 | |
1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1193 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | 1194 | ?> |
1195 | 1195 | <tr> |
1196 | 1196 | <td> |
@@ -1213,13 +1213,13 @@ discard block |
||
1213 | 1213 | <td> |
1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1215 | 1215 | <?php |
1216 | - if(!$content['contentType']) { |
|
1216 | + if (!$content['contentType']) { |
|
1217 | 1217 | $content['contentType'] = 'text/html'; |
1218 | 1218 | } |
1219 | 1219 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
1220 | 1220 | $ct = explode(",", $custom_contenttype); |
1221 | - for($i = 0; $i < count($ct); $i++) { |
|
1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1221 | + for ($i = 0; $i < count($ct); $i++) { |
|
1222 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
1223 | 1223 | } |
1224 | 1224 | ?> |
1225 | 1225 | </select> |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | </tr> |
1246 | 1246 | <?php |
1247 | 1247 | } else { |
1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1248 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | 1249 | // non-admin managers creating or editing a document resource |
1250 | 1250 | ?> |
1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1345,15 +1345,15 @@ discard block |
||
1345 | 1345 | <?php |
1346 | 1346 | /******************************* |
1347 | 1347 | * Document Access Permissions */ |
1348 | - if($use_udperms == 1) { |
|
1348 | + if ($use_udperms == 1) { |
|
1349 | 1349 | $groupsarray = array(); |
1350 | 1350 | $sql = ''; |
1351 | 1351 | |
1352 | 1352 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
1353 | - if($documentId > 0) { |
|
1353 | + if ($documentId > 0) { |
|
1354 | 1354 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1355 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1356 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
1357 | 1357 | |
1358 | 1358 | // Load up the current permissions and names |
1359 | 1359 | $vs = array( |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | // retain selected doc groups between post |
1372 | - if(isset($_POST['docgroups'])) { |
|
1372 | + if (isset($_POST['docgroups'])) { |
|
1373 | 1373 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1388,26 +1388,26 @@ discard block |
||
1388 | 1388 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
1389 | 1389 | |
1390 | 1390 | // Loop through the permissions list |
1391 | - while($row = $modx->db->getRow($rs)) { |
|
1391 | + while ($row = $modx->db->getRow($rs)) { |
|
1392 | 1392 | |
1393 | 1393 | // Create an inputValue pair (group ID and group link (if it exists)) |
1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | - $inputId = 'group-' . $row['id']; |
|
1394 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | + $inputId = 'group-'.$row['id']; |
|
1396 | 1396 | |
1397 | 1397 | $checked = in_array($inputValue, $groupsarray); |
1398 | - if($checked) { |
|
1398 | + if ($checked) { |
|
1399 | 1399 | $notPublic = true; |
1400 | 1400 | } // Mark as private access (either web or manager) |
1401 | 1401 | |
1402 | 1402 | // Skip the access permission if the user doesn't have access... |
1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1403 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | 1404 | continue; |
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // Setup attributes for this Input box |
1408 | 1408 | $inputAttributes['id'] = $inputId; |
1409 | 1409 | $inputAttributes['value'] = $inputValue; |
1410 | - if($checked) { |
|
1410 | + if ($checked) { |
|
1411 | 1411 | $inputAttributes['checked'] = 'checked'; |
1412 | 1412 | } else { |
1413 | 1413 | unset($inputAttributes['checked']); |
@@ -1415,10 +1415,10 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | // Create attribute string list |
1417 | 1417 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1418 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
1419 | 1419 | |
1420 | 1420 | // Make the <input> HTML |
1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1421 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
1422 | 1422 | |
1423 | 1423 | // does user have this permission? |
1424 | 1424 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1429,23 +1429,23 @@ discard block |
||
1429 | 1429 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
1430 | 1430 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
1431 | 1431 | $count = $modx->db->getValue($rsp); |
1432 | - if($count > 0) { |
|
1432 | + if ($count > 0) { |
|
1433 | 1433 | ++$permissions_yes; |
1434 | 1434 | } else { |
1435 | 1435 | ++$permissions_no; |
1436 | 1436 | } |
1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1437 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
1438 | 1438 | } |
1439 | 1439 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1440 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | 1441 | $permissions = array(); |
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | // See if the Access Permissions section is worth displaying... |
1445 | - if(!empty($permissions)) { |
|
1445 | + if (!empty($permissions)) { |
|
1446 | 1446 | // Add the "All Document Groups" item if we have rights in both contexts |
1447 | - if($isManager && $isWeb) { |
|
1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1447 | + if ($isManager && $isWeb) { |
|
1448 | + array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>'); |
|
1449 | 1449 | } |
1450 | 1450 | // Output the permissions list... |
1451 | 1451 | ?> |
@@ -1478,12 +1478,12 @@ discard block |
||
1478 | 1478 | </script> |
1479 | 1479 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
1480 | 1480 | <ul> |
1481 | - <?= implode("\n", $permissions) . "\n" ?> |
|
1481 | + <?= implode("\n", $permissions)."\n" ?> |
|
1482 | 1482 | </ul> |
1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
1484 | 1484 | <?php |
1485 | 1485 | } // !empty($permissions) |
1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1486 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | 1487 | ?> |
1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1489 | 1489 | <?php |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | 'template' => $content['template'] |
1504 | 1504 | )); |
1505 | 1505 | |
1506 | - if(is_array($evtOut)) { |
|
1506 | + if (is_array($evtOut)) { |
|
1507 | 1507 | echo implode('', $evtOut); |
1508 | 1508 | } |
1509 | 1509 | ?> |
@@ -1516,52 +1516,52 @@ discard block |
||
1516 | 1516 | storeCurTemplate(); |
1517 | 1517 | </script> |
1518 | 1518 | <?php |
1519 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | - if(is_array($richtexteditorIds)) { |
|
1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1519 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | + if (is_array($richtexteditorIds)) { |
|
1521 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
1522 | 1522 | // invoke OnRichTextEditorInit event |
1523 | 1523 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
1524 | 1524 | 'editor' => $editor, |
1525 | 1525 | 'elements' => $elements, |
1526 | 1526 | 'options' => $richtexteditorOptions[$editor] |
1527 | 1527 | )); |
1528 | - if(is_array($evtOut)) { |
|
1528 | + if (is_array($evtOut)) { |
|
1529 | 1529 | echo implode('', $evtOut); |
1530 | 1530 | } |
1531 | 1531 | } |
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | |
1535 | -function getDefaultTemplate() { |
|
1535 | +function getDefaultTemplate(){ |
|
1536 | 1536 | global $modx; |
1537 | 1537 | |
1538 | - switch($modx->config['auto_template_logic']) { |
|
1538 | + switch ($modx->config['auto_template_logic']) { |
|
1539 | 1539 | case 'sibling': |
1540 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1540 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1541 | 1541 | $site_start = $modx->config['site_start']; |
1542 | 1542 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
1543 | 1543 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
1544 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1544 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1545 | 1545 | $default_template = $sibl[0]['template']; |
1546 | 1546 | } |
1547 | 1547 | } else { |
1548 | 1548 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1549 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1549 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1550 | 1550 | $default_template = $sibl[0]['template']; |
1551 | 1551 | } else { |
1552 | 1552 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1553 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | 1554 | $default_template = $sibl[0]['template']; |
1555 | 1555 | } |
1556 | 1556 | } |
1557 | 1557 | } |
1558 | - if(isset($default_template)) { |
|
1558 | + if (isset($default_template)) { |
|
1559 | 1559 | break; |
1560 | 1560 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
1561 | 1561 | case 'parent': |
1562 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1562 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1563 | 1563 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
1564 | - if(isset($parent['template'])) { |
|
1564 | + if (isset($parent['template'])) { |
|
1565 | 1565 | $default_template = $parent['template']; |
1566 | 1566 | } |
1567 | 1567 | } |
@@ -1570,7 +1570,7 @@ discard block |
||
1570 | 1570 | default: // default_template is already set |
1571 | 1571 | $default_template = $modx->config['default_template']; |
1572 | 1572 | } |
1573 | - if(!isset($default_template)) { |
|
1573 | + if (!isset($default_template)) { |
|
1574 | 1574 | $default_template = $modx->config['default_template']; |
1575 | 1575 | } // default_template is already set |
1576 | 1576 |
@@ -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 | if (!$modx->hasPermission('logs')) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
66 | 66 | foreach ($logs_user as $row) { |
67 | 67 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
68 | - echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
|
68 | + echo "\t\t".'<option value="'.$row['internalKey'].'"'.$selectedtext.'>'.$row['username']."</option>\n"; |
|
69 | 69 | } |
70 | 70 | ?> |
71 | 71 | </select> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
89 | - echo "\t\t" . '<option value="' . $row['action'] . '"' . $selectedtext . '>' . $row['action'] . ' - ' . $action . "</option>\n"; |
|
89 | + echo "\t\t".'<option value="'.$row['action'].'"'.$selectedtext.'>'.$row['action'].' - '.$action."</option>\n"; |
|
90 | 90 | } |
91 | 91 | ?> |
92 | 92 | </select> |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
103 | 103 | foreach ($logs_items as $row) { |
104 | 104 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
105 | - echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
|
105 | + echo "\t\t".'<option value="'.$row['itemid'].'"'.$selectedtext.'>'.$row['itemid']."</option>\n"; |
|
106 | 106 | } |
107 | 107 | ?> |
108 | 108 | </select> |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
119 | 119 | foreach ($logs_names as $row) { |
120 | 120 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
121 | - echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
|
121 | + echo "\t\t".'<option value="'.$row['itemname'].'"'.$selectedtext.'>'.$row['itemname']."</option>\n"; |
|
122 | 122 | } |
123 | 123 | ?> |
124 | 124 | </select> |
@@ -176,26 +176,26 @@ discard block |
||
176 | 176 | // get the selections the user made. |
177 | 177 | $sqladd = array(); |
178 | 178 | if ($_REQUEST['searchuser'] != 0) { |
179 | - $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
|
179 | + $sqladd[] = "internalKey='".(int) $_REQUEST['searchuser']."'"; |
|
180 | 180 | } |
181 | 181 | if ($_REQUEST['action'] != 0) { |
182 | - $sqladd[] = "action=" . (int)$_REQUEST['action']; |
|
182 | + $sqladd[] = "action=".(int) $_REQUEST['action']; |
|
183 | 183 | } |
184 | 184 | if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
185 | - $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
|
185 | + $sqladd[] = "itemid='".$_REQUEST['itemid']."'"; |
|
186 | 186 | } |
187 | 187 | if ($_REQUEST['itemname'] != '0') { |
188 | - $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
|
188 | + $sqladd[] = "itemname='".$modx->db->escape($_REQUEST['itemname'])."'"; |
|
189 | 189 | } |
190 | 190 | if ($_REQUEST['message'] != "") { |
191 | - $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
|
191 | + $sqladd[] = "message LIKE '%".$modx->db->escape($_REQUEST['message'])."%'"; |
|
192 | 192 | } |
193 | 193 | // date stuff |
194 | 194 | if ($_REQUEST['datefrom'] != "") { |
195 | - $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
|
195 | + $sqladd[] = "timestamp>".$modx->toTimeStamp($_REQUEST['datefrom']); |
|
196 | 196 | } |
197 | 197 | if ($_REQUEST['dateto'] != "") { |
198 | - $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
|
198 | + $sqladd[] = "timestamp<".$modx->toTimeStamp($_REQUEST['dateto']); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | // If current position is not set, set it to zero |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | // Number of result to display on the page, will be in the LIMIT of the sql query also |
209 | 209 | $int_num_result = is_numeric($_REQUEST['nrresults']) ? $_REQUEST['nrresults'] : $number_of_logs; |
210 | 210 | |
211 | - $extargv = "&a=13&searchuser=" . $_REQUEST['searchuser'] . "&action=" . $_REQUEST['action'] . "&itemid=" . $_REQUEST['itemid'] . "&itemname=" . $_REQUEST['itemname'] . "&message=" . $_REQUEST['message'] . "&dateto=" . $_REQUEST['dateto'] . "&datefrom=" . $_REQUEST['datefrom'] . "&nrresults=" . $int_num_result . "&log_submit=" . $_REQUEST['log_submit']; // extra argv here (could be anything depending on your page) |
|
211 | + $extargv = "&a=13&searchuser=".$_REQUEST['searchuser']."&action=".$_REQUEST['action']."&itemid=".$_REQUEST['itemid']."&itemname=".$_REQUEST['itemname']."&message=".$_REQUEST['message']."&dateto=".$_REQUEST['dateto']."&datefrom=".$_REQUEST['datefrom']."&nrresults=".$int_num_result."&log_submit=".$_REQUEST['log_submit']; // extra argv here (could be anything depending on your page) |
|
212 | 212 | |
213 | 213 | // build the sql |
214 | 214 | $limit = $num_rows = $modx->db->getValue($modx->db->select('COUNT(*)', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''))); |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}"); |
217 | 217 | |
218 | 218 | if ($limit < 1) { |
219 | - echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
|
219 | + echo '<p>'.$_lang["mgrlog_emptysrch"].'</p>'; |
|
220 | 220 | } else { |
221 | - echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
|
221 | + echo '<p>'.$_lang["mgrlog_sortinst"].'</p>'; |
|
222 | 222 | |
223 | 223 | include_once "paginate.inc.php"; |
224 | 224 | // New instance of the Paging class, you can modify the color and the width of the html table |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | $current_row = $int_cur_position / $int_num_result; |
231 | 231 | |
232 | 232 | // Display the result as you like... |
233 | - print "<p>" . $_lang["paging_showing"] . " " . $array_paging['lower']; |
|
234 | - print " " . $_lang["paging_to"] . " " . $array_paging['upper']; |
|
235 | - print " (" . $array_paging['total'] . " " . $_lang["paging_total"] . ")<br />"; |
|
236 | - $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
|
237 | - $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
|
233 | + print "<p>".$_lang["paging_showing"]." ".$array_paging['lower']; |
|
234 | + print " ".$_lang["paging_to"]." ".$array_paging['upper']; |
|
235 | + print " (".$array_paging['total']." ".$_lang["paging_total"].")<br />"; |
|
236 | + $paging = $array_paging['first_link'].$_lang["paging_first"].(isset($array_paging['first_link']) ? "</a> " : " "); |
|
237 | + $paging .= $array_paging['previous_link'].$_lang["paging_prev"].(isset($array_paging['previous_link']) ? "</a> " : " "); |
|
238 | 238 | $pagesfound = sizeof($array_row_paging); |
239 | 239 | if ($pagesfound > 6) { |
240 | 240 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
245 | 245 | } else { |
246 | 246 | for ($i = 0; $i < $pagesfound; $i++) { |
247 | - $paging .= $array_row_paging[$i] . " "; |
|
247 | + $paging .= $array_row_paging[$i]." "; |
|
248 | 248 | } |
249 | 249 | } |
250 | - $paging .= $array_paging['next_link'] . $_lang["paging_next"] . (isset($array_paging['next_link']) ? "</a> " : " ") . " "; |
|
251 | - $paging .= $array_paging['last_link'] . $_lang["paging_last"] . (isset($array_paging['last_link']) ? "</a> " : " ") . " "; |
|
250 | + $paging .= $array_paging['next_link'].$_lang["paging_next"].(isset($array_paging['next_link']) ? "</a> " : " ")." "; |
|
251 | + $paging .= $array_paging['last_link'].$_lang["paging_last"].(isset($array_paging['last_link']) ? "</a> " : " ")." "; |
|
252 | 252 | // The above exemple print somethings like: |
253 | 253 | // Results 1 to 20 of 597 <<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 >>> |
254 | 254 | // Of course you can now play with array_row_paging in order to print |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
283 | 283 | $item = '<div style="text-align:center;">-</div>'; |
284 | 284 | } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
285 | - $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
|
285 | + $item = '<a href="index.php?a=3&id='.$logentry['itemid'].'">'.$logentry['itemname'].'</a>'; |
|
286 | 286 | } else { |
287 | 287 | $item = $logentry['itemname']; |
288 | 288 | } |
289 | 289 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
290 | - $user_drill = 'index.php?a=13&searchuser=' . $logentry['internalKey'] . '&itemname=0&log_submit=true'; |
|
290 | + $user_drill = 'index.php?a=13&searchuser='.$logentry['internalKey'].'&itemname=0&log_submit=true'; |
|
291 | 291 | ?> |
292 | 292 | <tr> |
293 | - <td><?= '<a href="' . $user_drill . '">' . $logentry['username'] . '</a>' ?></td> |
|
294 | - <td class="text-nowrap"><?= '[' . $logentry['action'] . '] ' . $logentry['message'] ?></td> |
|
293 | + <td><?= '<a href="'.$user_drill.'">'.$logentry['username'].'</a>' ?></td> |
|
294 | + <td class="text-nowrap"><?= '['.$logentry['action'].'] '.$logentry['message'] ?></td> |
|
295 | 295 | <td class="text-xs-right"><?= $logentry['itemid'] ?></td> |
296 | 296 | <td><?= $item ?></td> |
297 | 297 | <td class="text-nowrap"><?= $modx->toDateFormat($logentry['timestamp'] + $server_offset_time) ?></td> |
@@ -1,22 +1,22 @@ 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 | -if (!$modx->hasPermission('logs')) { |
|
5 | +if (!$modx->hasPermission('logs')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -function array_unique_multi($array, $checkKey) |
|
10 | -{ |
|
9 | +function array_unique_multi($array, $checkKey) |
|
10 | +{ |
|
11 | 11 | // Use the builtin if we're not a multi-dimensional array |
12 | - if (!is_array(current($array)) || empty($checkKey)) { |
|
12 | + if (!is_array(current($array)) || empty($checkKey)) { |
|
13 | 13 | return array_unique($array); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $ret = array(); |
17 | 17 | $checkValues = array(); // contains the unique key Values |
18 | - foreach ($array as $key => $current) { |
|
19 | - if (in_array($current[$checkKey], $checkValues)) { |
|
18 | + foreach ($array as $key => $current) { |
|
19 | + if (in_array($current[$checkKey], $checkValues)) { |
|
20 | 20 | continue; |
21 | 21 | } // duplicate |
22 | 22 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | return $ret; |
27 | 27 | } |
28 | 28 | |
29 | -function record_sort($array, $key) |
|
30 | -{ |
|
29 | +function record_sort($array, $key) |
|
30 | +{ |
|
31 | 31 | $hash = array(); |
32 | - foreach ($array as $k => $v) { |
|
32 | + foreach ($array as $k => $v) { |
|
33 | 33 | $hash[$k] = $v[$key]; |
34 | 34 | } |
35 | 35 | |
36 | 36 | natsort($hash); |
37 | 37 | |
38 | 38 | $records = array(); |
39 | - foreach ($hash as $k => $row) { |
|
39 | + foreach ($hash as $k => $row) { |
|
40 | 40 | $records[$k] = $array[$k]; |
41 | 41 | } |
42 | 42 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | <?php |
64 | 64 | // get all users currently in the log |
65 | 65 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
66 | - foreach ($logs_user as $row) { |
|
66 | + foreach ($logs_user as $row) { |
|
67 | 67 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
68 | 68 | echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
69 | 69 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | // get all available actions in the log |
81 | 81 | include_once "actionlist.inc.php"; |
82 | 82 | $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action'); |
83 | - foreach ($logs_actions as $row) { |
|
83 | + foreach ($logs_actions as $row) { |
|
84 | 84 | $action = getAction($row['action']); |
85 | - if ($action == 'Idle') { |
|
85 | + if ($action == 'Idle') { |
|
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | <?php |
101 | 101 | // get all itemid currently in logging |
102 | 102 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
103 | - foreach ($logs_items as $row) { |
|
103 | + foreach ($logs_items as $row) { |
|
104 | 104 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
105 | 105 | echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
106 | 106 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <?php |
117 | 117 | // get all itemname currently in logging |
118 | 118 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
119 | - foreach ($logs_names as $row) { |
|
119 | + foreach ($logs_names as $row) { |
|
120 | 120 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
121 | 121 | echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
122 | 122 | } |
@@ -172,36 +172,36 @@ discard block |
||
172 | 172 | <div class="container container-body"> |
173 | 173 | |
174 | 174 | <?php |
175 | -if (isset($_REQUEST['log_submit'])) { |
|
175 | +if (isset($_REQUEST['log_submit'])) { |
|
176 | 176 | // get the selections the user made. |
177 | 177 | $sqladd = array(); |
178 | - if ($_REQUEST['searchuser'] != 0) { |
|
178 | + if ($_REQUEST['searchuser'] != 0) { |
|
179 | 179 | $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
180 | 180 | } |
181 | - if ($_REQUEST['action'] != 0) { |
|
181 | + if ($_REQUEST['action'] != 0) { |
|
182 | 182 | $sqladd[] = "action=" . (int)$_REQUEST['action']; |
183 | 183 | } |
184 | - if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
184 | + if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
185 | 185 | $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
186 | 186 | } |
187 | - if ($_REQUEST['itemname'] != '0') { |
|
187 | + if ($_REQUEST['itemname'] != '0') { |
|
188 | 188 | $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
189 | 189 | } |
190 | - if ($_REQUEST['message'] != "") { |
|
190 | + if ($_REQUEST['message'] != "") { |
|
191 | 191 | $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
192 | 192 | } |
193 | 193 | // date stuff |
194 | - if ($_REQUEST['datefrom'] != "") { |
|
194 | + if ($_REQUEST['datefrom'] != "") { |
|
195 | 195 | $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
196 | 196 | } |
197 | - if ($_REQUEST['dateto'] != "") { |
|
197 | + if ($_REQUEST['dateto'] != "") { |
|
198 | 198 | $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
199 | 199 | } |
200 | 200 | |
201 | 201 | // If current position is not set, set it to zero |
202 | - if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
202 | + if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
203 | 203 | $int_cur_position = 0; |
204 | - } else { |
|
204 | + } else { |
|
205 | 205 | $int_cur_position = $_REQUEST['int_cur_position']; |
206 | 206 | } |
207 | 207 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | |
216 | 216 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}"); |
217 | 217 | |
218 | -if ($limit < 1) { |
|
218 | +if ($limit < 1) { |
|
219 | 219 | echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
220 | -} else { |
|
220 | +} else { |
|
221 | 221 | echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
222 | 222 | |
223 | 223 | include_once "paginate.inc.php"; |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
237 | 237 | $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
238 | 238 | $pagesfound = sizeof($array_row_paging); |
239 | - if ($pagesfound > 6) { |
|
239 | + if ($pagesfound > 6) { |
|
240 | 240 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
241 | 241 | $paging .= $array_row_paging[$current_row - 1]; // ." "; |
242 | 242 | $paging .= $array_row_paging[$current_row]; // ." "; |
243 | 243 | $paging .= $array_row_paging[$current_row + 1]; // ." "; |
244 | 244 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
245 | - } else { |
|
246 | - for ($i = 0; $i < $pagesfound; $i++) { |
|
245 | + } else { |
|
246 | + for ($i = 0; $i < $pagesfound; $i++) { |
|
247 | 247 | $paging .= $array_row_paging[$i] . " "; |
248 | 248 | } |
249 | 249 | } |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | // grab the entire log file... |
279 | 279 | $logentries = array(); |
280 | 280 | $i = 0; |
281 | - while ($logentry = $modx->db->getRow($rs)) { |
|
282 | - if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
281 | + while ($logentry = $modx->db->getRow($rs)) { |
|
282 | + if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
283 | 283 | $item = '<div style="text-align:center;">-</div>'; |
284 | - } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
284 | + } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
285 | 285 | $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
286 | - } else { |
|
286 | + } else { |
|
287 | 287 | $item = $logentry['itemname']; |
288 | 288 | } |
289 | 289 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
@@ -318,6 +318,6 @@ discard block |
||
318 | 318 | // @see index.php @ 915 |
319 | 319 | global $action; |
320 | 320 | $action = 1; |
321 | -} else { |
|
321 | +} else { |
|
322 | 322 | echo $_lang["mgrlog_noquery"]; |
323 | 323 | } |
@@ -1,17 +1,17 @@ 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 | -if(!$modx->hasPermission('view_eventlog')) { |
|
5 | +if (!$modx->hasPermission('view_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | 9 | // get id |
10 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
10 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
11 | 11 | |
12 | -$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log") . " el |
|
13 | - LEFT JOIN " . $modx->getFullTableName("manager_users") . " mu ON mu.id=el.user AND el.usertype=0 |
|
14 | - LEFT JOIN " . $modx->getFullTableName("web_users") . " wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
12 | +$ds = $modx->db->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getFullTableName("event_log")." el |
|
13 | + LEFT JOIN " . $modx->getFullTableName("manager_users")." mu ON mu.id=el.user AND el.usertype=0 |
|
14 | + LEFT JOIN " . $modx->getFullTableName("web_users")." wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'"); |
|
15 | 15 | $content = $modx->db->getRow($ds); |
16 | 16 | |
17 | 17 | ?> |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | <div class="container container-body"> |
43 | 43 | <?php |
44 | 44 | $date = $modx->toDateFormat($content["createdon"]); |
45 | - if($content["type"] == 1) { |
|
46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
45 | + if ($content["type"] == 1) { |
|
46 | + $icon = $_style['actions_info'].' text-info'; |
|
47 | 47 | $msgtype = $_lang["information"]; |
48 | - } else if($content["type"] == 2) { |
|
49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
48 | + } else if ($content["type"] == 2) { |
|
49 | + $icon = $_style['actions_triangle'].' text-warning'; |
|
50 | 50 | $msgtype = $_lang["warning"]; |
51 | - } else if($content["type"] == 3) { |
|
52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
51 | + } else if ($content["type"] == 3) { |
|
52 | + $icon = $_style['actions_error'].' text-danger'; |
|
53 | 53 | $msgtype = $_lang["error"]; |
54 | 54 | } |
55 | 55 | ?> |
56 | - <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
|
56 | + <p><b><?= $content['source']." - ".$_lang['eventlog_viewer'] ?></b></p> |
|
57 | 57 | <p> |
58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |
59 | 59 | </p> |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ($modx->manager->action) { |
7 | - case 78: |
|
8 | - if (!$modx->hasPermission('edit_chunk')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 77: |
|
13 | - if (!$modx->hasPermission('new_chunk')) { |
|
7 | + case 78: |
|
8 | + if (!$modx->hasPermission('edit_chunk')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 77: |
|
13 | + if (!$modx->hasPermission('new_chunk')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -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 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | // Get table names (alphabetical) |
24 | 24 | $tbl_site_htmlsnippets = $modx->getFullTableName('site_htmlsnippets'); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $content['name'] = $_REQUEST['itemname']; |
48 | 48 | } else { |
49 | 49 | $_SESSION['itemname'] = $_lang["new_htmlsnippet"]; |
50 | - $content['category'] = (int)$_REQUEST['catid']; |
|
50 | + $content['category'] = (int) $_REQUEST['catid']; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if ($modx->manager->hasFormValues()) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | // Add lock-element JS-Script |
66 | 66 | $lockElementId = $id; |
67 | 67 | $lockElementType = 3; |
68 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
68 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
69 | 69 | |
70 | 70 | // Print RTE Javascript function |
71 | 71 | ?> |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
137 | 137 | |
138 | 138 | <h1> |
139 | - <i class="fa fa-th-large"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_htmlsnippet']) ?><i class="fa fa-question-circle help"></i> |
|
139 | + <i class="fa fa-th-large"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_htmlsnippet']) ?><i class="fa fa-question-circle help"></i> |
|
140 | 140 | </h1> |
141 | 141 | |
142 | 142 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | <div class="form-control-name clearfix"> |
161 | 161 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
162 | 162 | <?php if ($modx->hasPermission('save_role')): ?> |
163 | - <label class="custom-control" title="<?= $_lang['lock_htmlsnippet'] . "\n" . $_lang['lock_htmlsnippet_msg'] ?>" tooltip> |
|
163 | + <label class="custom-control" title="<?= $_lang['lock_htmlsnippet']."\n".$_lang['lock_htmlsnippet_msg'] ?>" tooltip> |
|
164 | 164 | <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 || $content['locked'] == 'on' ? ' checked="checked"' : '') ?> /> |
165 | 165 | <i class="fa fa-lock"></i> |
166 | 166 | </label> |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
185 | 185 | <option> </option> |
186 | 186 | <?php |
187 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
187 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
188 | 188 | foreach (getCategories() as $n => $v) { |
189 | - echo "\t\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] || (empty($content['category']) && $_POST['categoryid'] == $v['id']) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
189 | + echo "\t\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] || (empty($content['category']) && $_POST['categoryid'] == $v['id']) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category'])."</option>\n"; |
|
190 | 190 | } |
191 | 191 | ?> |
192 | 192 | </select> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | </div> |
201 | 201 | <?php if ($_SESSION['mgrRole'] == 1): ?> |
202 | 202 | <div class="form-row"> |
203 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label> |
|
203 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label> |
|
204 | 204 | </div> |
205 | 205 | <?php endif; ?> |
206 | 206 | </div> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister'); |
217 | 217 | if (is_array($evtOut)) { |
218 | 218 | foreach ($evtOut as $i => $editor) { |
219 | - echo "\t" . '<option value="' . $editor . '"' . ($which_editor == $editor ? ' selected="selected"' : '') . '>' . $editor . "</option>\n"; |
|
219 | + echo "\t".'<option value="'.$editor.'"'.($which_editor == $editor ? ' selected="selected"' : '').'>'.$editor."</option>\n"; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | ?> |
@@ -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 | if (!$modx->hasPermission('save_document')) { |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | } |
8 | 8 | |
9 | 9 | if (isset($_REQUEST['id'])) { |
10 | - $id = (int)$_REQUEST['id']; |
|
10 | + $id = (int) $_REQUEST['id']; |
|
11 | 11 | } else { |
12 | 12 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
13 | 13 | } |
14 | 14 | |
15 | 15 | // check permissions on the document |
16 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
16 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
17 | 17 | $udperms = new udperms(); |
18 | 18 | $udperms->user = $modx->getLoginUserID(); |
19 | 19 | $udperms->document = $id; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | }, |
40 | 40 | cancel: function() { |
41 | 41 | documentDirty = false; |
42 | - <?= ($id == 0 ? 'document.location.href="index.php?a=2";' : 'document.location.href="index.php?a=3&id=' . $id . '";') ?> |
|
42 | + <?= ($id == 0 ? 'document.location.href="index.php?a=2";' : 'document.location.href="index.php?a=3&id='.$id.'";') ?> |
|
43 | 43 | } |
44 | 44 | }; |
45 | 45 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | </script> |
81 | 81 | |
82 | 82 | <h1> |
83 | - <i class="fa fa-arrows"></i><?= ($pagetitle ? $pagetitle . '<small>(' . $id . ')</small>' : $_lang['move_resource_title']) ?> |
|
83 | + <i class="fa fa-arrows"></i><?= ($pagetitle ? $pagetitle.'<small>('.$id.')</small>' : $_lang['move_resource_title']) ?> |
|
84 | 84 | </h1> |
85 | 85 | |
86 | 86 | <?= $_style['actionbuttons']['dynamic']['save'] ?> |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 12: |
|
8 | - if(!$modx->hasPermission('edit_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 11: |
|
13 | - if(!$modx->hasPermission('new_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 12: |
|
8 | + if(!$modx->hasPermission('edit_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 11: |
|
13 | + if(!$modx->hasPermission('new_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -23,75 +23,75 @@ discard block |
||
23 | 23 | // check to see the snippet editor isn't locked |
24 | 24 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
25 | 25 | if($username = $modx->db->getValue($rs)) { |
26 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
26 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
|
27 | 27 | } |
28 | 28 | // end check for lock |
29 | 29 | |
30 | 30 | if($modx->manager->action == '12') { |
31 | - // get user attribute |
|
32 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
33 | - $userdata = $modx->db->getRow($rs); |
|
34 | - if(!$userdata) { |
|
35 | - $modx->webAlertAndQuit("No user returned!"); |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - // get user settings |
|
40 | - $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'"); |
|
41 | - $usersettings = array(); |
|
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | - // manually extract so that user display settings are not overwritten |
|
44 | - foreach($usersettings as $k => $v) { |
|
45 | - if($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | - ${$k} = $v; |
|
47 | - } |
|
48 | - } |
|
49 | - |
|
50 | - // get user name |
|
51 | - $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'"); |
|
52 | - $usernamedata = $modx->db->getRow($rs); |
|
53 | - if(!$usernamedata) { |
|
54 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
55 | - } |
|
56 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
31 | + // get user attribute |
|
32 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
|
33 | + $userdata = $modx->db->getRow($rs); |
|
34 | + if(!$userdata) { |
|
35 | + $modx->webAlertAndQuit("No user returned!"); |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + // get user settings |
|
40 | + $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'"); |
|
41 | + $usersettings = array(); |
|
42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | + // manually extract so that user display settings are not overwritten |
|
44 | + foreach($usersettings as $k => $v) { |
|
45 | + if($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | + ${$k} = $v; |
|
47 | + } |
|
48 | + } |
|
49 | + |
|
50 | + // get user name |
|
51 | + $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'"); |
|
52 | + $usernamedata = $modx->db->getRow($rs); |
|
53 | + if(!$usernamedata) { |
|
54 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
55 | + } |
|
56 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
57 | 57 | } else { |
58 | - $userdata = array(); |
|
59 | - $usersettings = array(); |
|
60 | - $usernamedata = array(); |
|
61 | - $_SESSION['itemname'] = $_lang["new_user"]; |
|
58 | + $userdata = array(); |
|
59 | + $usersettings = array(); |
|
60 | + $usernamedata = array(); |
|
61 | + $_SESSION['itemname'] = $_lang["new_user"]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
65 | 65 | foreach($userdata as $key => $val) { |
66 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
66 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
67 | 67 | }; |
68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
69 | 69 | |
70 | 70 | // restore saved form |
71 | 71 | $formRestored = false; |
72 | 72 | if($modx->manager->hasFormValues()) { |
73 | - $modx->manager->loadFormValues(); |
|
74 | - // restore post values |
|
75 | - $userdata = array_merge($userdata, $_POST); |
|
76 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
77 | - $usernamedata['username'] = $userdata['newusername']; |
|
78 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
79 | - $usersettings = array_merge($usersettings, $userdata); |
|
80 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
81 | - extract($usersettings, EXTR_OVERWRITE); |
|
73 | + $modx->manager->loadFormValues(); |
|
74 | + // restore post values |
|
75 | + $userdata = array_merge($userdata, $_POST); |
|
76 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
77 | + $usernamedata['username'] = $userdata['newusername']; |
|
78 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
79 | + $usersettings = array_merge($usersettings, $userdata); |
|
80 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
81 | + extract($usersettings, EXTR_OVERWRITE); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // include the country list language file |
85 | 85 | $_country_lang = array(); |
86 | 86 | include_once "lang/country/english_country.inc.php"; |
87 | 87 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
88 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
89 | 89 | } |
90 | 90 | asort($_country_lang); |
91 | 91 | |
92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
93 | 93 | if($which_browser == 'default') { |
94 | - $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
94 | + $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
|
95 | 95 | } |
96 | 96 | ?> |
97 | 97 | <script type="text/javascript"> |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | <form action="index.php?a=32" method="post" name="userform"> |
202 | 202 | <?php |
203 | 203 | |
204 | - // invoke OnUserFormPrerender event |
|
205 | - $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
206 | - "id" => $user |
|
207 | - )); |
|
208 | - if(is_array($evtOut)) { |
|
209 | - echo implode("", $evtOut); |
|
210 | - } |
|
211 | - ?> |
|
204 | + // invoke OnUserFormPrerender event |
|
205 | + $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
|
206 | + "id" => $user |
|
207 | + )); |
|
208 | + if(is_array($evtOut)) { |
|
209 | + echo implode("", $evtOut); |
|
210 | + } |
|
211 | + ?> |
|
212 | 212 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>"> |
213 | 213 | <input type="hidden" name="id" value="<?php echo $user ?>"> |
214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -301,21 +301,21 @@ discard block |
||
301 | 301 | <td> </td> |
302 | 302 | <td><?php |
303 | 303 | |
304 | - $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1'); |
|
305 | - ?> |
|
304 | + $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1'); |
|
305 | + ?> |
|
306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
307 | 307 | <?php |
308 | - while($row = $modx->db->getRow($rs)) { |
|
309 | - if($modx->manager->action == '11') { |
|
310 | - $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
311 | - } else { |
|
312 | - $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
313 | - } |
|
314 | - ?> |
|
308 | + while($row = $modx->db->getRow($rs)) { |
|
309 | + if($modx->manager->action == '11') { |
|
310 | + $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
|
311 | + } else { |
|
312 | + $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
|
313 | + } |
|
314 | + ?> |
|
315 | 315 | <option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option> |
316 | 316 | <?php |
317 | - } |
|
318 | - ?> |
|
317 | + } |
|
318 | + ?> |
|
319 | 319 | </select></td> |
320 | 320 | </tr> |
321 | 321 | <tr> |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
362 | 362 | <?php |
363 | - foreach($_country_lang as $key => $country) { |
|
364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
365 | - } |
|
366 | - ?> |
|
363 | + foreach($_country_lang as $key => $country) { |
|
364 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
365 | + } |
|
366 | + ?> |
|
367 | 367 | </select></td> |
368 | 368 | </tr> |
369 | 369 | <tr> |
@@ -439,21 +439,21 @@ discard block |
||
439 | 439 | <td><select name="manager_language" class="inputBox" onChange="documentDirty=true"> |
440 | 440 | <option value=""></option> |
441 | 441 | <?php |
442 | - $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
443 | - $dir = dir("includes/lang"); |
|
444 | - while($file = $dir->read()) { |
|
445 | - if(strpos($file, ".inc.php") > 0) { |
|
446 | - $endpos = strpos($file, "."); |
|
447 | - $languagename = substr($file, 0, $endpos); |
|
448 | - $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
449 | - ?> |
|
442 | + $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
|
443 | + $dir = dir("includes/lang"); |
|
444 | + while($file = $dir->read()) { |
|
445 | + if(strpos($file, ".inc.php") > 0) { |
|
446 | + $endpos = strpos($file, "."); |
|
447 | + $languagename = substr($file, 0, $endpos); |
|
448 | + $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
|
449 | + ?> |
|
450 | 450 | <option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option> |
451 | 451 | <?php |
452 | 452 | |
453 | - } |
|
454 | - } |
|
455 | - $dir->close(); |
|
456 | - ?> |
|
453 | + } |
|
454 | + } |
|
455 | + $dir->close(); |
|
456 | + ?> |
|
457 | 457 | </select></td> |
458 | 458 | </tr> |
459 | 459 | <tr> |
@@ -528,22 +528,22 @@ discard block |
||
528 | 528 | <td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());"> |
529 | 529 | <option value=""></option> |
530 | 530 | <?php |
531 | - $dir = dir("media/style/"); |
|
532 | - while($file = $dir->read()) { |
|
533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | - $themename = $file; |
|
535 | - if($themename === 'common') { |
|
536 | - continue; |
|
537 | - } |
|
538 | - $attr = 'value="' . $themename . '" '; |
|
539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
540 | - $attr .= 'selected="selected" '; |
|
541 | - } |
|
542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
543 | - } |
|
544 | - } |
|
545 | - $dir->close(); |
|
546 | - ?> |
|
531 | + $dir = dir("media/style/"); |
|
532 | + while($file = $dir->read()) { |
|
533 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | + $themename = $file; |
|
535 | + if($themename === 'common') { |
|
536 | + continue; |
|
537 | + } |
|
538 | + $attr = 'value="' . $themename . '" '; |
|
539 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
540 | + $attr .= 'selected="selected" '; |
|
541 | + } |
|
542 | + echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
543 | + } |
|
544 | + } |
|
545 | + $dir->close(); |
|
546 | + ?> |
|
547 | 547 | </select> |
548 | 548 | <input type="hidden" name="theme_refresher" value=""></td> |
549 | 549 | </tr> |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | <th><?php echo $_lang["which_browser_title"] ?></th> |
556 | 556 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
557 | 557 | <?php |
558 | - $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
559 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
561 | - $dir = str_replace('\\', '/', $dir); |
|
562 | - $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
563 | - $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
564 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
565 | - } |
|
566 | - ?> |
|
558 | + $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
559 | + echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
560 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
561 | + $dir = str_replace('\\', '/', $dir); |
|
562 | + $browser_name = substr($dir, strrpos($dir, '/') + 1); |
|
563 | + $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
|
564 | + echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
565 | + } |
|
566 | + ?> |
|
567 | 567 | </select></td> |
568 | 568 | </tr> |
569 | 569 | <tr> |
@@ -640,17 +640,17 @@ discard block |
||
640 | 640 | <option value=""></option> |
641 | 641 | <?php |
642 | 642 | |
643 | - $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
644 | - // invoke OnRichTextEditorRegister event |
|
645 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
646 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
647 | - if(is_array($evtOut)) { |
|
648 | - for($i = 0; $i < count($evtOut); $i++) { |
|
649 | - $editor = $evtOut[$i]; |
|
650 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
651 | - } |
|
652 | - } |
|
653 | - ?> |
|
643 | + $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
|
644 | + // invoke OnRichTextEditorRegister event |
|
645 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
646 | + echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
647 | + if(is_array($evtOut)) { |
|
648 | + for($i = 0; $i < count($evtOut); $i++) { |
|
649 | + $editor = $evtOut[$i]; |
|
650 | + echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
651 | + } |
|
652 | + } |
|
653 | + ?> |
|
654 | 654 | </select></td> |
655 | 655 | </tr> |
656 | 656 | <tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>"> |
@@ -683,12 +683,12 @@ discard block |
||
683 | 683 | </tr> |
684 | 684 | </table> |
685 | 685 | <?php |
686 | - // invoke OnInterfaceSettingsRender event |
|
687 | - $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
688 | - if(is_array($evtOut)) { |
|
689 | - echo implode("", $evtOut); |
|
690 | - } |
|
691 | - ?> |
|
686 | + // invoke OnInterfaceSettingsRender event |
|
687 | + $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
|
688 | + if(is_array($evtOut)) { |
|
689 | + echo implode("", $evtOut); |
|
690 | + } |
|
691 | + ?> |
|
692 | 692 | </div> |
693 | 693 | |
694 | 694 | <!-- Photo --> |
@@ -737,39 +737,39 @@ discard block |
||
737 | 737 | </div> |
738 | 738 | <?php if($use_udperms == 1) { |
739 | 739 | |
740 | - $groupsarray = array(); |
|
741 | - |
|
742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
743 | - $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
|
744 | - $groupsarray = $modx->db->getColumn('user_group', $rs); |
|
745 | - } |
|
746 | - // retain selected doc groups between post |
|
747 | - if(is_array($_POST['user_groups'])) { |
|
748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
749 | - } |
|
750 | - ?> |
|
740 | + $groupsarray = array(); |
|
741 | + |
|
742 | + if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
743 | + $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
|
744 | + $groupsarray = $modx->db->getColumn('user_group', $rs); |
|
745 | + } |
|
746 | + // retain selected doc groups between post |
|
747 | + if(is_array($_POST['user_groups'])) { |
|
748 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
749 | + } |
|
750 | + ?> |
|
751 | 751 | <div class="tab-page" id="tabAccess"> |
752 | 752 | <h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2> |
753 | 753 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script> |
754 | 754 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
755 | 755 | <?php |
756 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name'); |
|
757 | - while($row = $modx->db->getRow($rs)) { |
|
758 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
759 | - } |
|
760 | - } |
|
761 | - ?> |
|
756 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name'); |
|
757 | + while($row = $modx->db->getRow($rs)) { |
|
758 | + echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
759 | + } |
|
760 | + } |
|
761 | + ?> |
|
762 | 762 | </div> |
763 | 763 | </div> |
764 | 764 | </div> |
765 | 765 | <input type="submit" name="save" style="display:none"> |
766 | 766 | <?php |
767 | - // invoke OnUserFormRender event |
|
768 | - $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
769 | - "id" => $user |
|
770 | - )); |
|
771 | - if(is_array($evtOut)) { |
|
772 | - echo implode("", $evtOut); |
|
773 | - } |
|
774 | - ?> |
|
767 | + // invoke OnUserFormRender event |
|
768 | + $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
|
769 | + "id" => $user |
|
770 | + )); |
|
771 | + if(is_array($evtOut)) { |
|
772 | + echo implode("", $evtOut); |
|
773 | + } |
|
774 | + ?> |
|
775 | 775 | </form> |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 12: |
|
8 | - if(!$modx->hasPermission('edit_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 11: |
|
13 | - if(!$modx->hasPermission('new_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 12: |
|
8 | + if(!$modx->hasPermission('edit_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 11: |
|
13 | + if(!$modx->hasPermission('new_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -1,16 +1,16 @@ 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 | |
6 | -switch($modx->manager->action) { |
|
6 | +switch ($modx->manager->action) { |
|
7 | 7 | case 12: |
8 | - if(!$modx->hasPermission('edit_user')) { |
|
8 | + if (!$modx->hasPermission('edit_user')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 11: |
13 | - if(!$modx->hasPermission('new_user')) { |
|
13 | + if (!$modx->hasPermission('new_user')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,20 +18,20 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | // check to see the snippet editor isn't locked |
24 | -$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
|
25 | -if($username = $modx->db->getValue($rs)) { |
|
24 | +$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
25 | +if ($username = $modx->db->getValue($rs)) { |
|
26 | 26 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
27 | 27 | } |
28 | 28 | // end check for lock |
29 | 29 | |
30 | -if($modx->manager->action == '12') { |
|
30 | +if ($modx->manager->action == '12') { |
|
31 | 31 | // get user attribute |
32 | 32 | $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
33 | 33 | $userdata = $modx->db->getRow($rs); |
34 | - if(!$userdata) { |
|
34 | + if (!$userdata) { |
|
35 | 35 | $modx->webAlertAndQuit("No user returned!"); |
36 | 36 | } |
37 | 37 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | // get user settings |
40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'"); |
41 | 41 | $usersettings = array(); |
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
42 | + while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | 43 | // manually extract so that user display settings are not overwritten |
44 | - foreach($usersettings as $k => $v) { |
|
45 | - if($k != 'manager_language' && $k != 'manager_theme') { |
|
44 | + foreach ($usersettings as $k => $v) { |
|
45 | + if ($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | 46 | ${$k} = $v; |
47 | 47 | } |
48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | // get user name |
51 | 51 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'"); |
52 | 52 | $usernamedata = $modx->db->getRow($rs); |
53 | - if(!$usernamedata) { |
|
53 | + if (!$usernamedata) { |
|
54 | 54 | $modx->webAlertAndQuit("No user returned while getting username!"); |
55 | 55 | } |
56 | 56 | $_SESSION['itemname'] = $usernamedata['username']; |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // avoid doubling htmlspecialchars (already encoded in DB) |
65 | -foreach($userdata as $key => $val) { |
|
65 | +foreach ($userdata as $key => $val) { |
|
66 | 66 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
67 | 67 | }; |
68 | 68 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
69 | 69 | |
70 | 70 | // restore saved form |
71 | 71 | $formRestored = false; |
72 | -if($modx->manager->hasFormValues()) { |
|
72 | +if ($modx->manager->hasFormValues()) { |
|
73 | 73 | $modx->manager->loadFormValues(); |
74 | 74 | // restore post values |
75 | 75 | $userdata = array_merge($userdata, $_POST); |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | // include the country list language file |
85 | 85 | $_country_lang = array(); |
86 | 86 | include_once "lang/country/english_country.inc.php"; |
87 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
88 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
87 | +if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) { |
|
88 | + include_once "lang/country/".$manager_language."_country.inc.php"; |
|
89 | 89 | } |
90 | 90 | asort($_country_lang); |
91 | 91 | |
92 | 92 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
93 | -if($which_browser == 'default') { |
|
93 | +if ($which_browser == 'default') { |
|
94 | 94 | $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
95 | 95 | } |
96 | 96 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | document.userform.save.click(); |
183 | 183 | }, |
184 | 184 | delete: function() { |
185 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
185 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
186 | 186 | alert("<?php echo $_lang['alert_delete_self']; ?>"); |
187 | 187 | <?php } else { ?> |
188 | 188 | if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
206 | 206 | "id" => $user |
207 | 207 | )); |
208 | - if(is_array($evtOut)) { |
|
208 | + if (is_array($evtOut)) { |
|
209 | 209 | echo implode("", $evtOut); |
210 | 210 | } |
211 | 211 | ?> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
215 | 215 | |
216 | 216 | <h1> |
217 | - <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?> |
|
217 | + <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?> |
|
218 | 218 | </h1> |
219 | 219 | |
220 | 220 | <?php echo $_style['actionbuttons']['dynamic']['user'] ?> |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | <table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser"> |
233 | 233 | <tr> |
234 | 234 | <td colspan="3"><span id="blocked" class="warning"> |
235 | - <?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
235 | + <?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
236 | 236 | <?php echo $_lang['user_is_blocked']; ?> |
237 | 237 | <?php } ?> |
238 | 238 | </span> |
239 | 239 | <br /></td> |
240 | 240 | </tr> |
241 | - <?php if(!empty($userdata['id'])) { ?> |
|
241 | + <?php if (!empty($userdata['id'])) { ?> |
|
242 | 242 | <tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> "> |
243 | 243 | <td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i> <b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span> |
244 | 244 | <input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" /> |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | <td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td> |
252 | 252 | </tr> |
253 | 253 | <tr> |
254 | - <th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th> |
|
254 | + <th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th> |
|
255 | 255 | <td> </td> |
256 | 256 | <td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>> |
257 | 257 | <input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" /> |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | ?> |
306 | 306 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
307 | 307 | <?php |
308 | - while($row = $modx->db->getRow($rs)) { |
|
309 | - if($modx->manager->action == '11') { |
|
308 | + while ($row = $modx->db->getRow($rs)) { |
|
309 | + if ($modx->manager->action == '11') { |
|
310 | 310 | $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
311 | 311 | } else { |
312 | 312 | $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
361 | 361 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
362 | 362 | <?php |
363 | - foreach($_country_lang as $key => $country) { |
|
364 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
363 | + foreach ($_country_lang as $key => $country) { |
|
364 | + echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>"; |
|
365 | 365 | } |
366 | 366 | ?> |
367 | 367 | </select></td> |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | <td> </td> |
388 | 388 | <td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td> |
389 | 389 | </tr> |
390 | - <?php if($modx->manager->action == '12') { ?> |
|
390 | + <?php if ($modx->manager->action == '12') { ?> |
|
391 | 391 | <tr> |
392 | 392 | <th><?php echo $_lang['user_logincount']; ?>:</th> |
393 | 393 | <td> </td> |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | </tr> |
425 | 425 | <?php } ?> |
426 | 426 | </table> |
427 | - <?php if($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
427 | + <?php if ($_GET['id'] == $modx->getLoginUserID()) { ?> |
|
428 | 428 | <p><?php echo $_lang['user_edit_self_msg']; ?></p> |
429 | 429 | <?php } ?> |
430 | 430 | </div> |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | <?php |
442 | 442 | $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
443 | 443 | $dir = dir("includes/lang"); |
444 | - while($file = $dir->read()) { |
|
445 | - if(strpos($file, ".inc.php") > 0) { |
|
444 | + while ($file = $dir->read()) { |
|
445 | + if (strpos($file, ".inc.php") > 0) { |
|
446 | 446 | $endpos = strpos($file, "."); |
447 | 447 | $languagename = substr($file, 0, $endpos); |
448 | 448 | $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
@@ -529,17 +529,17 @@ discard block |
||
529 | 529 | <option value=""></option> |
530 | 530 | <?php |
531 | 531 | $dir = dir("media/style/"); |
532 | - while($file = $dir->read()) { |
|
533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
532 | + while ($file = $dir->read()) { |
|
533 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | 534 | $themename = $file; |
535 | - if($themename === 'common') { |
|
535 | + if ($themename === 'common') { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | - $attr = 'value="' . $themename . '" '; |
|
539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
538 | + $attr = 'value="'.$themename.'" '; |
|
539 | + if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
540 | 540 | $attr .= 'selected="selected" '; |
541 | 541 | } |
542 | - echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
|
542 | + echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n"; |
|
543 | 543 | } |
544 | 544 | } |
545 | 545 | $dir->close(); |
@@ -556,12 +556,12 @@ discard block |
||
556 | 556 | <td><select name="which_browser" class="inputBox" onChange="documentDirty=true;"> |
557 | 557 | <?php |
558 | 558 | $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
559 | - echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
|
560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
559 | + echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n"; |
|
560 | + foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
561 | 561 | $dir = str_replace('\\', '/', $dir); |
562 | 562 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
563 | 563 | $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
564 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
564 | + echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n"; |
|
565 | 565 | } |
566 | 566 | ?> |
567 | 567 | </select></td> |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | </tr> |
589 | 589 | <tr> |
590 | 590 | <td> </td> |
591 | - <td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td> |
|
591 | + <td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td> |
|
592 | 592 | </tr> |
593 | 593 | <tr> |
594 | 594 | <th><?php echo $_lang["uploadable_media_title"] ?></th> |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | </tr> |
601 | 601 | <tr> |
602 | 602 | <td> </td> |
603 | - <td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td> |
|
603 | + <td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td> |
|
604 | 604 | </tr> |
605 | 605 | <tr> |
606 | 606 | <th><?php echo $_lang["uploadable_flash_title"] ?></th> |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | </tr> |
613 | 613 | <tr> |
614 | 614 | <td> </td> |
615 | - <td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td> |
|
615 | + <td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td> |
|
616 | 616 | </tr> |
617 | 617 | <tr> |
618 | 618 | <th><?php echo $_lang["uploadable_files_title"] ?></th> |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | </tr> |
625 | 625 | <tr> |
626 | 626 | <td> </td> |
627 | - <td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td> |
|
627 | + <td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td> |
|
628 | 628 | </tr> |
629 | 629 | <tr class='row2'> |
630 | 630 | <th><?php echo $_lang["upload_maxsize_title"] ?></th> |
@@ -643,11 +643,11 @@ discard block |
||
643 | 643 | $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : ''; |
644 | 644 | // invoke OnRichTextEditorRegister event |
645 | 645 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
646 | - echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
|
647 | - if(is_array($evtOut)) { |
|
648 | - for($i = 0; $i < count($evtOut); $i++) { |
|
646 | + echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n"; |
|
647 | + if (is_array($evtOut)) { |
|
648 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
649 | 649 | $editor = $evtOut[$i]; |
650 | - echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
|
650 | + echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n"; |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 | ?> |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | <?php |
686 | 686 | // invoke OnInterfaceSettingsRender event |
687 | 687 | $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
688 | - if(is_array($evtOut)) { |
|
688 | + if (is_array($evtOut)) { |
|
689 | 689 | echo implode("", $evtOut); |
690 | 690 | } |
691 | 691 | ?> |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | function BrowseServer() { |
713 | 713 | var w = screen.width * 0.7; |
714 | 714 | var h = screen.height * 0.7; |
715 | - OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h); |
|
715 | + OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | function SetUrl(url, width, height, alt) { |
@@ -735,17 +735,17 @@ discard block |
||
735 | 735 | </tr> |
736 | 736 | </table> |
737 | 737 | </div> |
738 | - <?php if($use_udperms == 1) { |
|
738 | + <?php if ($use_udperms == 1) { |
|
739 | 739 | |
740 | 740 | $groupsarray = array(); |
741 | 741 | |
742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
742 | + if ($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
743 | 743 | $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
744 | 744 | $groupsarray = $modx->db->getColumn('user_group', $rs); |
745 | 745 | } |
746 | 746 | // retain selected doc groups between post |
747 | - if(is_array($_POST['user_groups'])) { |
|
748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
747 | + if (is_array($_POST['user_groups'])) { |
|
748 | + foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
749 | 749 | } |
750 | 750 | ?> |
751 | 751 | <div class="tab-page" id="tabAccess"> |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
755 | 755 | <?php |
756 | 756 | $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name'); |
757 | - while($row = $modx->db->getRow($rs)) { |
|
758 | - echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
|
757 | + while ($row = $modx->db->getRow($rs)) { |
|
758 | + echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />"; |
|
759 | 759 | } |
760 | 760 | } |
761 | 761 | ?> |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
769 | 769 | "id" => $user |
770 | 770 | )); |
771 | - if(is_array($evtOut)) { |
|
771 | + if (is_array($evtOut)) { |
|
772 | 772 | echo implode("", $evtOut); |
773 | 773 | } |
774 | 774 | ?> |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 88: |
|
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 87: |
|
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 88: |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 87: |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,64 +24,64 @@ discard block |
||
24 | 24 | // check to see the snippet editor isn't locked |
25 | 25 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
26 | 26 | if($username = $modx->db->getValue($rs)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | 31 | if($modx->manager->action == '88') { |
32 | - // get user attributes |
|
33 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | - $userdata = $modx->db->getRow($rs); |
|
35 | - if(!$userdata) { |
|
36 | - $modx->webAlertAndQuit("No user returned!"); |
|
37 | - } |
|
38 | - |
|
39 | - // get user settings |
|
40 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | - $usersettings = array(); |
|
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | - extract($usersettings, EXTR_OVERWRITE); |
|
44 | - |
|
45 | - // get user name |
|
46 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | - $usernamedata = $modx->db->getRow($rs); |
|
48 | - if(!$usernamedata) { |
|
49 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | - } |
|
51 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
32 | + // get user attributes |
|
33 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | + $userdata = $modx->db->getRow($rs); |
|
35 | + if(!$userdata) { |
|
36 | + $modx->webAlertAndQuit("No user returned!"); |
|
37 | + } |
|
38 | + |
|
39 | + // get user settings |
|
40 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | + $usersettings = array(); |
|
42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | + extract($usersettings, EXTR_OVERWRITE); |
|
44 | + |
|
45 | + // get user name |
|
46 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | + $usernamedata = $modx->db->getRow($rs); |
|
48 | + if(!$usernamedata) { |
|
49 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | + } |
|
51 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
52 | 52 | } else { |
53 | - $userdata = array(); |
|
54 | - $usersettings = array(); |
|
55 | - $usernamedata = array(); |
|
56 | - $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
53 | + $userdata = array(); |
|
54 | + $usersettings = array(); |
|
55 | + $usernamedata = array(); |
|
56 | + $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | 60 | foreach($userdata as $key => $val) { |
61 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
61 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
62 | 62 | }; |
63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 64 | |
65 | 65 | // restore saved form |
66 | 66 | $formRestored = false; |
67 | 67 | if($modx->manager->hasFormValues()) { |
68 | - $modx->manager->loadFormValues(); |
|
69 | - // restore post values |
|
70 | - $userdata = array_merge($userdata, $_POST); |
|
71 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | - $usernamedata['username'] = $userdata['newusername']; |
|
73 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | - $usersettings = array_merge($usersettings, $userdata); |
|
75 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | - extract($usersettings, EXTR_OVERWRITE); |
|
68 | + $modx->manager->loadFormValues(); |
|
69 | + // restore post values |
|
70 | + $userdata = array_merge($userdata, $_POST); |
|
71 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | + $usernamedata['username'] = $userdata['newusername']; |
|
73 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | + $usersettings = array_merge($usersettings, $userdata); |
|
75 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | + extract($usersettings, EXTR_OVERWRITE); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // include the country list language file |
80 | 80 | $_country_lang = array(); |
81 | 81 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
82 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
82 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
83 | 83 | } else { |
84 | - include_once "lang/country/english_country.inc.php"; |
|
84 | + include_once "lang/country/english_country.inc.php"; |
|
85 | 85 | } |
86 | 86 | asort($_country_lang); |
87 | 87 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | |
190 | 190 | <form action="index.php?a=89" method="post" name="userform"> |
191 | 191 | <?php |
192 | - // invoke OnWUsrFormPrerender event |
|
193 | - $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | - if(is_array($evtOut)) { |
|
195 | - echo implode("", $evtOut); |
|
196 | - } |
|
197 | - ?> |
|
192 | + // invoke OnWUsrFormPrerender event |
|
193 | + $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | + if(is_array($evtOut)) { |
|
195 | + echo implode("", $evtOut); |
|
196 | + } |
|
197 | + ?> |
|
198 | 198 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>" /> |
199 | 199 | <input type="hidden" name="id" value="<?php echo $user ?>" /> |
200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
325 | 325 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
326 | 326 | <?php |
327 | - foreach($_country_lang as $key => $country) { |
|
328 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
329 | - } |
|
330 | - ?> |
|
327 | + foreach($_country_lang as $key => $country) { |
|
328 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
329 | + } |
|
330 | + ?> |
|
331 | 331 | </select></td> |
332 | 332 | </tr> |
333 | 333 | <tr> |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | <i onClick="document.userform.blockedafter.value=''; return true;" class="clearDate <?php echo $_style["actions_calendar_delete"] ?>" data-tooltip="<?php echo $_lang['remove_date']; ?>"></i></td> |
388 | 388 | </tr> |
389 | 389 | <?php |
390 | - } |
|
391 | - ?> |
|
390 | + } |
|
391 | + ?> |
|
392 | 392 | </table> |
393 | 393 | </div> |
394 | 394 | |
@@ -496,40 +496,40 @@ discard block |
||
496 | 496 | </table> |
497 | 497 | </div> |
498 | 498 | <?php |
499 | - if($use_udperms == 1) { |
|
500 | - |
|
501 | - $groupsarray = array(); |
|
502 | - |
|
503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
504 | - $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
505 | - $groupsarray = $modx->db->getColumn('webgroup', $rs); |
|
506 | - } |
|
507 | - // retain selected user groups between post |
|
508 | - if(is_array($_POST['user_groups'])) { |
|
509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | - } |
|
511 | - ?> |
|
499 | + if($use_udperms == 1) { |
|
500 | + |
|
501 | + $groupsarray = array(); |
|
502 | + |
|
503 | + if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
504 | + $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
505 | + $groupsarray = $modx->db->getColumn('webgroup', $rs); |
|
506 | + } |
|
507 | + // retain selected user groups between post |
|
508 | + if(is_array($_POST['user_groups'])) { |
|
509 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | + } |
|
511 | + ?> |
|
512 | 512 | <div class="tab-page" id="tabPermissions"> |
513 | 513 | <h2 class="tab"><?php echo $_lang['web_access_permissions'] ?></h2> |
514 | 514 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabPermissions"));</script> |
515 | 515 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
516 | 516 | <?php |
517 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
|
518 | - while($row = $modx->db->getRow($rs)) { |
|
519 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
520 | - } |
|
521 | - } |
|
522 | - ?> |
|
517 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
|
518 | + while($row = $modx->db->getRow($rs)) { |
|
519 | + echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
520 | + } |
|
521 | + } |
|
522 | + ?> |
|
523 | 523 | </div> |
524 | 524 | <?php |
525 | - // invoke OnWUsrFormRender event |
|
526 | - $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
527 | - "id" => $user |
|
528 | - )); |
|
529 | - if(is_array($evtOut)) { |
|
530 | - echo implode("", $evtOut); |
|
531 | - } |
|
532 | - ?> |
|
525 | + // invoke OnWUsrFormRender event |
|
526 | + $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
527 | + "id" => $user |
|
528 | + )); |
|
529 | + if(is_array($evtOut)) { |
|
530 | + echo implode("", $evtOut); |
|
531 | + } |
|
532 | + ?> |
|
533 | 533 | </div> |
534 | 534 | </div> |
535 | 535 | <input type="submit" name="save" style="display:none"> |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 88: |
|
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 87: |
|
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 88: |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 87: |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -1,16 +1,16 @@ 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 | |
6 | -switch($modx->manager->action) { |
|
6 | +switch ($modx->manager->action) { |
|
7 | 7 | case 88: |
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
8 | + if (!$modx->hasPermission('edit_web_user')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 87: |
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
13 | + if (!$modx->hasPermission('new_web_user')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,34 +18,34 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | |
24 | 24 | // check to see the snippet editor isn't locked |
25 | -$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
|
26 | -if($username = $modx->db->getValue($rs)) { |
|
25 | +$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
26 | +if ($username = $modx->db->getValue($rs)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | -if($modx->manager->action == '88') { |
|
31 | +if ($modx->manager->action == '88') { |
|
32 | 32 | // get user attributes |
33 | 33 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
34 | 34 | $userdata = $modx->db->getRow($rs); |
35 | - if(!$userdata) { |
|
35 | + if (!$userdata) { |
|
36 | 36 | $modx->webAlertAndQuit("No user returned!"); |
37 | 37 | } |
38 | 38 | |
39 | 39 | // get user settings |
40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
41 | 41 | $usersettings = array(); |
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
42 | + while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | 43 | extract($usersettings, EXTR_OVERWRITE); |
44 | 44 | |
45 | 45 | // get user name |
46 | 46 | $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
47 | 47 | $usernamedata = $modx->db->getRow($rs); |
48 | - if(!$usernamedata) { |
|
48 | + if (!$usernamedata) { |
|
49 | 49 | $modx->webAlertAndQuit("No user returned while getting username!"); |
50 | 50 | } |
51 | 51 | $_SESSION['itemname'] = $usernamedata['username']; |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | -foreach($userdata as $key => $val) { |
|
60 | +foreach ($userdata as $key => $val) { |
|
61 | 61 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
62 | 62 | }; |
63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 64 | |
65 | 65 | // restore saved form |
66 | 66 | $formRestored = false; |
67 | -if($modx->manager->hasFormValues()) { |
|
67 | +if ($modx->manager->hasFormValues()) { |
|
68 | 68 | $modx->manager->loadFormValues(); |
69 | 69 | // restore post values |
70 | 70 | $userdata = array_merge($userdata, $_POST); |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | |
79 | 79 | // include the country list language file |
80 | 80 | $_country_lang = array(); |
81 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
82 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
81 | +if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) { |
|
82 | + include_once "lang/country/".$manager_language."_country.inc.php"; |
|
83 | 83 | } else { |
84 | 84 | include_once "lang/country/english_country.inc.php"; |
85 | 85 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | <?php |
192 | 192 | // invoke OnWUsrFormPrerender event |
193 | 193 | $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
194 | - if(is_array($evtOut)) { |
|
194 | + if (is_array($evtOut)) { |
|
195 | 195 | echo implode("", $evtOut); |
196 | 196 | } |
197 | 197 | ?> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
201 | 201 | |
202 | 202 | <h1> |
203 | - <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['web_user_title']) ?> |
|
203 | + <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['web_user_title']) ?> |
|
204 | 204 | </h1> |
205 | 205 | |
206 | 206 | <?php echo $_style['actionbuttons']['dynamic']['user'] ?> |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | <table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser"> |
219 | 219 | <tr> |
220 | 220 | <td colspan="3"><span id="blocked" class="warning"> |
221 | - <?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
221 | + <?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
222 | 222 | <b><?php echo $_lang['user_is_blocked']; ?></b> |
223 | 223 | <?php } ?> |
224 | 224 | </span> |
225 | 225 | <br /></td> |
226 | 226 | </tr> |
227 | - <?php if(!empty($userdata['id'])) { ?> |
|
227 | + <?php if (!empty($userdata['id'])) { ?> |
|
228 | 228 | <tr id="showname" style="display: <?php echo ($modx->manager->action == '88' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> "> |
229 | 229 | <td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i> <b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span> |
230 | 230 | <input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" /> |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | <td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars(isset($_POST['newusername']) ? $_POST['newusername'] : $usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td> |
238 | 238 | </tr> |
239 | 239 | <tr> |
240 | - <th><?php echo $modx->manager->action == '87' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th> |
|
240 | + <th><?php echo $modx->manager->action == '87' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th> |
|
241 | 241 | <td> </td> |
242 | 242 | <td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "87" ? " checked disabled" : ""; ?>> |
243 | 243 | <input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "87" ? 1 : 0; ?>" onChange="documentDirty=true;" /> |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
325 | 325 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
326 | 326 | <?php |
327 | - foreach($_country_lang as $key => $country) { |
|
328 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
327 | + foreach ($_country_lang as $key => $country) { |
|
328 | + echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>"; |
|
329 | 329 | } |
330 | 330 | ?> |
331 | 331 | </select></td> |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | <td> </td> |
352 | 352 | <td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars(isset($_POST['comment']) ? $_POST['comment'] : $userdata['comment']); ?></textarea></td> |
353 | 353 | </tr> |
354 | - <?php if($modx->manager->action == '88') { ?> |
|
354 | + <?php if ($modx->manager->action == '88') { ?> |
|
355 | 355 | <tr> |
356 | 356 | <th><?php echo $_lang['user_logincount']; ?>:</th> |
357 | 357 | <td> </td> |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | function BrowseServer() { |
473 | 473 | var w = screen.width * 0.7; |
474 | 474 | var h = screen.height * 0.7; |
475 | - OpenServerBrowser("<?php echo MODX_MANAGER_URL;?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h); |
|
475 | + OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | function SetUrl(url, width, height, alt) { |
@@ -491,22 +491,22 @@ discard block |
||
491 | 491 | <td class='comment'><?php echo $_lang["user_photo_message"] ?></td> |
492 | 492 | </tr> |
493 | 493 | <tr> |
494 | - <td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "") . $_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "") . $userdata['photo'] : $_style["tx"]; ?>" /></td> |
|
494 | + <td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "").$_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "").$userdata['photo'] : $_style["tx"]; ?>" /></td> |
|
495 | 495 | </tr> |
496 | 496 | </table> |
497 | 497 | </div> |
498 | 498 | <?php |
499 | - if($use_udperms == 1) { |
|
499 | + if ($use_udperms == 1) { |
|
500 | 500 | |
501 | 501 | $groupsarray = array(); |
502 | 502 | |
503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
503 | + if ($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
504 | 504 | $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
505 | 505 | $groupsarray = $modx->db->getColumn('webgroup', $rs); |
506 | 506 | } |
507 | 507 | // retain selected user groups between post |
508 | - if(is_array($_POST['user_groups'])) { |
|
509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
508 | + if (is_array($_POST['user_groups'])) { |
|
509 | + foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | 510 | } |
511 | 511 | ?> |
512 | 512 | <div class="tab-page" id="tabPermissions"> |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
516 | 516 | <?php |
517 | 517 | $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
518 | - while($row = $modx->db->getRow($rs)) { |
|
519 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
518 | + while ($row = $modx->db->getRow($rs)) { |
|
519 | + echo '<label><input type="checkbox" name="user_groups[]" value="'.$row['id'].'"'.(in_array($row['id'], $groupsarray) ? ' checked="checked"' : '').' />'.$row['name'].'</label><br />'; |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | ?> |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
527 | 527 | "id" => $user |
528 | 528 | )); |
529 | - if(is_array($evtOut)) { |
|
529 | + if (is_array($evtOut)) { |
|
530 | 530 | echo implode("", $evtOut); |
531 | 531 | } |
532 | 532 | ?> |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | switch((int) $modx->manager->action) { |
7 | - case 35: |
|
8 | - if(!$modx->hasPermission('edit_role')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 38: |
|
13 | - if(!$modx->hasPermission('new_role')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 35: |
|
8 | + if(!$modx->hasPermission('edit_role')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 38: |
|
13 | + if(!$modx->hasPermission('new_role')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | 26 | if($lockedEl = $modx->elementIsLocked(8, $role)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
@@ -32,15 +32,15 @@ discard block |
||
32 | 32 | $modx->lockElement(8, $role); |
33 | 33 | |
34 | 34 | if($modx->manager->action == '35') { |
35 | - $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
36 | - $roledata = $modx->db->getRow($rs); |
|
37 | - if(!$roledata) { |
|
38 | - $modx->webAlertAndQuit("No role returned!"); |
|
39 | - } |
|
40 | - $_SESSION['itemname'] = $roledata['name']; |
|
35 | + $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
36 | + $roledata = $modx->db->getRow($rs); |
|
37 | + if(!$roledata) { |
|
38 | + $modx->webAlertAndQuit("No role returned!"); |
|
39 | + } |
|
40 | + $_SESSION['itemname'] = $roledata['name']; |
|
41 | 41 | } else { |
42 | - $roledata = 0; |
|
43 | - $_SESSION['itemname'] = $_lang["new_role"]; |
|
42 | + $roledata = 0; |
|
43 | + $_SESSION['itemname'] = $_lang["new_role"]; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Add lock-element JS-Script |
@@ -107,63 +107,63 @@ discard block |
||
107 | 107 | <div class="form-group"> |
108 | 108 | <h3><?= $_lang['page_data_general'] ?></h3> |
109 | 109 | <?php |
110 | - echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
111 | - echo render_form('home', $_lang['role_home'], 'disabled'); |
|
112 | - echo render_form('messages', $_lang['role_messages']); |
|
113 | - echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
114 | - echo render_form('help', $_lang['role_help']); |
|
115 | - echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
116 | - echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
117 | - echo render_form('about', $_lang['role_about'], 'disabled'); |
|
118 | - echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
119 | - echo render_form('change_password', $_lang['role_change_password']); |
|
120 | - echo render_form('save_password', $_lang['role_save_password']); |
|
121 | - ?> |
|
110 | + echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
111 | + echo render_form('home', $_lang['role_home'], 'disabled'); |
|
112 | + echo render_form('messages', $_lang['role_messages']); |
|
113 | + echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
114 | + echo render_form('help', $_lang['role_help']); |
|
115 | + echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
116 | + echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
117 | + echo render_form('about', $_lang['role_about'], 'disabled'); |
|
118 | + echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
119 | + echo render_form('change_password', $_lang['role_change_password']); |
|
120 | + echo render_form('save_password', $_lang['role_save_password']); |
|
121 | + ?> |
|
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | <div class="col-sm-6 col-lg-3"> |
125 | 125 | <div class="form-group"> |
126 | 126 | <h3><?= $_lang['role_content_management'] ?></h3> |
127 | 127 | <?php |
128 | - echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
129 | - echo render_form('new_document', $_lang['role_create_doc']); |
|
130 | - echo render_form('edit_document', $_lang['role_edit_doc']); |
|
131 | - echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
132 | - echo render_form('save_document', $_lang['role_save_doc']); |
|
133 | - echo render_form('publish_document', $_lang['role_publish_doc']); |
|
134 | - echo render_form('delete_document', $_lang['role_delete_doc']); |
|
135 | - echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
136 | - echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
137 | - echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
138 | - ?> |
|
128 | + echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
129 | + echo render_form('new_document', $_lang['role_create_doc']); |
|
130 | + echo render_form('edit_document', $_lang['role_edit_doc']); |
|
131 | + echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
132 | + echo render_form('save_document', $_lang['role_save_doc']); |
|
133 | + echo render_form('publish_document', $_lang['role_publish_doc']); |
|
134 | + echo render_form('delete_document', $_lang['role_delete_doc']); |
|
135 | + echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
136 | + echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
137 | + echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
138 | + ?> |
|
139 | 139 | </div> |
140 | 140 | </div> |
141 | 141 | <div class="col-sm-6 col-lg-3 form-group"> |
142 | 142 | <div class="form-group"> |
143 | 143 | <h3><?= $_lang['role_file_management'] ?></h3> |
144 | 144 | <?php |
145 | - echo render_form('file_manager', $_lang['role_file_manager']); |
|
146 | - echo render_form('assets_files', $_lang['role_assets_files']); |
|
147 | - echo render_form('assets_images', $_lang['role_assets_images']); |
|
148 | - ?> |
|
145 | + echo render_form('file_manager', $_lang['role_file_manager']); |
|
146 | + echo render_form('assets_files', $_lang['role_assets_files']); |
|
147 | + echo render_form('assets_images', $_lang['role_assets_images']); |
|
148 | + ?> |
|
149 | 149 | </div> |
150 | 150 | <div class="form-group"> |
151 | 151 | <h3><?= $_lang['category_management'] ?></h3> |
152 | 152 | <?php |
153 | - echo render_form('category_manager', $_lang['role_category_manager']); |
|
154 | - ?> |
|
153 | + echo render_form('category_manager', $_lang['role_category_manager']); |
|
154 | + ?> |
|
155 | 155 | </div> |
156 | 156 | </div> |
157 | 157 | <div class="col-sm-6 col-lg-3"> |
158 | 158 | <div class="form-group"> |
159 | 159 | <h3><?= $_lang['role_module_management'] ?></h3> |
160 | 160 | <?php |
161 | - echo render_form('new_module', $_lang['role_new_module']); |
|
162 | - echo render_form('edit_module', $_lang['role_edit_module']); |
|
163 | - echo render_form('save_module', $_lang['role_save_module']); |
|
164 | - echo render_form('delete_module', $_lang['role_delete_module']); |
|
165 | - echo render_form('exec_module', $_lang['role_run_module']); |
|
166 | - ?> |
|
161 | + echo render_form('new_module', $_lang['role_new_module']); |
|
162 | + echo render_form('edit_module', $_lang['role_edit_module']); |
|
163 | + echo render_form('save_module', $_lang['role_save_module']); |
|
164 | + echo render_form('delete_module', $_lang['role_delete_module']); |
|
165 | + echo render_form('exec_module', $_lang['role_run_module']); |
|
166 | + ?> |
|
167 | 167 | </div> |
168 | 168 | </div> |
169 | 169 | </div> |
@@ -173,44 +173,44 @@ discard block |
||
173 | 173 | <div class="form-group"> |
174 | 174 | <h3><?= $_lang['role_template_management'] ?></h3> |
175 | 175 | <?php |
176 | - echo render_form('new_template', $_lang['role_create_template']); |
|
177 | - echo render_form('edit_template', $_lang['role_edit_template']); |
|
178 | - echo render_form('save_template', $_lang['role_save_template']); |
|
179 | - echo render_form('delete_template', $_lang['role_delete_template']); |
|
180 | - ?> |
|
176 | + echo render_form('new_template', $_lang['role_create_template']); |
|
177 | + echo render_form('edit_template', $_lang['role_edit_template']); |
|
178 | + echo render_form('save_template', $_lang['role_save_template']); |
|
179 | + echo render_form('delete_template', $_lang['role_delete_template']); |
|
180 | + ?> |
|
181 | 181 | </div> |
182 | 182 | </div> |
183 | 183 | <div class="col-sm-6 col-lg-3"> |
184 | 184 | <div class="form-group"> |
185 | 185 | <h3><?= $_lang['role_snippet_management'] ?></h3> |
186 | 186 | <?php |
187 | - echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
188 | - echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
189 | - echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
190 | - echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
191 | - ?> |
|
187 | + echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
188 | + echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
189 | + echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
190 | + echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
191 | + ?> |
|
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | <div class="col-sm-6 col-lg-3"> |
195 | 195 | <div class="form-group"> |
196 | 196 | <h3><?= $_lang['role_chunk_management'] ?></h3> |
197 | 197 | <?php |
198 | - echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
199 | - echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
200 | - echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
201 | - echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
202 | - ?> |
|
198 | + echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
199 | + echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
200 | + echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
201 | + echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
202 | + ?> |
|
203 | 203 | </div> |
204 | 204 | </div> |
205 | 205 | <div class="col-sm-6 col-lg-3"> |
206 | 206 | <div class="form-group"> |
207 | 207 | <h3><?= $_lang['role_plugin_management'] ?></h3> |
208 | 208 | <?php |
209 | - echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
210 | - echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
211 | - echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
212 | - echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
213 | - ?> |
|
209 | + echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
210 | + echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
211 | + echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
212 | + echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
213 | + ?> |
|
214 | 214 | </div> |
215 | 215 | </div> |
216 | 216 | </div> |
@@ -220,42 +220,42 @@ discard block |
||
220 | 220 | <div class="form-group"> |
221 | 221 | <h3><?= $_lang['role_user_management'] ?></h3> |
222 | 222 | <?php |
223 | - echo render_form('new_user', $_lang['role_new_user']); |
|
224 | - echo render_form('edit_user', $_lang['role_edit_user']); |
|
225 | - echo render_form('save_user', $_lang['role_save_user']); |
|
226 | - echo render_form('delete_user', $_lang['role_delete_user']); |
|
227 | - ?> |
|
223 | + echo render_form('new_user', $_lang['role_new_user']); |
|
224 | + echo render_form('edit_user', $_lang['role_edit_user']); |
|
225 | + echo render_form('save_user', $_lang['role_save_user']); |
|
226 | + echo render_form('delete_user', $_lang['role_delete_user']); |
|
227 | + ?> |
|
228 | 228 | </div> |
229 | 229 | </div> |
230 | 230 | <div class="col-sm-6 col-lg-3"> |
231 | 231 | <div class="form-group"> |
232 | 232 | <h3><?= $_lang['role_web_user_management'] ?></h3> |
233 | 233 | <?php |
234 | - echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
235 | - echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
236 | - echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
237 | - echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
238 | - ?> |
|
234 | + echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
235 | + echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
236 | + echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
237 | + echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
238 | + ?> |
|
239 | 239 | </div> |
240 | 240 | </div> |
241 | 241 | <div class="col-sm-6 col-lg-3"> |
242 | 242 | <div class="form-group"> |
243 | 243 | <h3><?= $_lang['role_udperms'] ?></h3> |
244 | 244 | <?php |
245 | - echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
246 | - echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
247 | - ?> |
|
245 | + echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
246 | + echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
247 | + ?> |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <div class="col-sm-6 col-lg-3"> |
251 | 251 | <div class="form-group"> |
252 | 252 | <h3><?= $_lang['role_role_management'] ?></h3> |
253 | 253 | <?php |
254 | - echo render_form('new_role', $_lang['role_new_role']); |
|
255 | - echo render_form('edit_role', $_lang['role_edit_role']); |
|
256 | - echo render_form('save_role', $_lang['role_save_role']); |
|
257 | - echo render_form('delete_role', $_lang['role_delete_role']); |
|
258 | - ?> |
|
254 | + echo render_form('new_role', $_lang['role_new_role']); |
|
255 | + echo render_form('edit_role', $_lang['role_edit_role']); |
|
256 | + echo render_form('save_role', $_lang['role_save_role']); |
|
257 | + echo render_form('delete_role', $_lang['role_delete_role']); |
|
258 | + ?> |
|
259 | 259 | </div> |
260 | 260 | </div> |
261 | 261 | </div> |
@@ -265,23 +265,23 @@ discard block |
||
265 | 265 | <div class="form-group"> |
266 | 266 | <h3><?= $_lang['role_eventlog_management'] ?></h3> |
267 | 267 | <?php |
268 | - echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
269 | - echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
270 | - ?> |
|
268 | + echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
269 | + echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
270 | + ?> |
|
271 | 271 | </div> |
272 | 272 | </div> |
273 | 273 | <div class="col-sm-6 col-lg-3"> |
274 | 274 | <div class="form-group"> |
275 | 275 | <h3><?= $_lang['role_config_management'] ?></h3> |
276 | 276 | <?php |
277 | - echo render_form('logs', $_lang['role_view_logs']); |
|
278 | - echo render_form('settings', $_lang['role_edit_settings']); |
|
279 | - echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
280 | - echo render_form('import_static', $_lang['role_import_static']); |
|
281 | - echo render_form('export_static', $_lang['role_export_static']); |
|
282 | - echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
283 | - echo render_form('display_locks', $_lang['role_display_locks']); |
|
284 | - ?> |
|
277 | + echo render_form('logs', $_lang['role_view_logs']); |
|
278 | + echo render_form('settings', $_lang['role_edit_settings']); |
|
279 | + echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
280 | + echo render_form('import_static', $_lang['role_import_static']); |
|
281 | + echo render_form('export_static', $_lang['role_export_static']); |
|
282 | + echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
283 | + echo render_form('display_locks', $_lang['role_display_locks']); |
|
284 | + ?> |
|
285 | 285 | </div> |
286 | 286 | </div> |
287 | 287 | </div> |
@@ -294,32 +294,32 @@ discard block |
||
294 | 294 | |
295 | 295 | <?php |
296 | 296 | function render_form($name, $label, $status = '') { |
297 | - global $modx, $roledata; |
|
297 | + global $modx, $roledata; |
|
298 | 298 | |
299 | - $tpl = '<label class="d-block" for="[+name+]check"> |
|
299 | + $tpl = '<label class="d-block" for="[+name+]check"> |
|
300 | 300 | <input name="[+name+]check" id="[+name+]check" class="click" type="checkbox" onchange="changestate(document.userform.[+name+])" [+checked+] [+status+]> |
301 | 301 | <input type="hidden" class="[+set+]" name="[+name+]" value="[+value+]"> |
302 | 302 | [+label+] |
303 | 303 | </label>'; |
304 | 304 | |
305 | - $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
306 | - $value = ($roledata[$name] == 1) ? 1 : 0; |
|
307 | - if($status == 'disabled') { |
|
308 | - $checked = 'checked'; |
|
309 | - $value = 1; |
|
310 | - $set = 'fix'; |
|
311 | - } else { |
|
312 | - $set = 'set'; |
|
313 | - } |
|
305 | + $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
306 | + $value = ($roledata[$name] == 1) ? 1 : 0; |
|
307 | + if($status == 'disabled') { |
|
308 | + $checked = 'checked'; |
|
309 | + $value = 1; |
|
310 | + $set = 'fix'; |
|
311 | + } else { |
|
312 | + $set = 'set'; |
|
313 | + } |
|
314 | 314 | |
315 | - $ph = array( |
|
316 | - 'name' => $name, |
|
317 | - 'checked' => $checked, |
|
318 | - 'status' => $status, |
|
319 | - 'value' => $value, |
|
320 | - 'label' => $label, |
|
321 | - 'set' => $set |
|
322 | - ); |
|
315 | + $ph = array( |
|
316 | + 'name' => $name, |
|
317 | + 'checked' => $checked, |
|
318 | + 'status' => $status, |
|
319 | + 'value' => $value, |
|
320 | + 'label' => $label, |
|
321 | + 'set' => $set |
|
322 | + ); |
|
323 | 323 | |
324 | - return $modx->parseText($tpl, $ph); |
|
324 | + return $modx->parseText($tpl, $ph); |
|
325 | 325 | } |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch((int) $modx->manager->action) { |
7 | - case 35: |
|
8 | - if(!$modx->hasPermission('edit_role')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 38: |
|
13 | - if(!$modx->hasPermission('new_role')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 35: |
|
8 | + if(!$modx->hasPermission('edit_role')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 38: |
|
13 | + if(!$modx->hasPermission('new_role')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -1,16 +1,16 @@ 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 | |
6 | -switch((int) $modx->manager->action) { |
|
6 | +switch ((int) $modx->manager->action) { |
|
7 | 7 | case 35: |
8 | - if(!$modx->hasPermission('edit_role')) { |
|
8 | + if (!$modx->hasPermission('edit_role')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 38: |
13 | - if(!$modx->hasPermission('new_role')) { |
|
13 | + if (!$modx->hasPermission('new_role')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_user_roles = $modx->getFullTableName('user_roles'); |
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | -if($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
26 | +if ($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
28 | 28 | } |
29 | 29 | // end check for lock |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | // Lock snippet for other users to edit |
32 | 32 | $modx->lockElement(8, $role); |
33 | 33 | |
34 | -if($modx->manager->action == '35') { |
|
34 | +if ($modx->manager->action == '35') { |
|
35 | 35 | $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
36 | 36 | $roledata = $modx->db->getRow($rs); |
37 | - if(!$roledata) { |
|
37 | + if (!$roledata) { |
|
38 | 38 | $modx->webAlertAndQuit("No role returned!"); |
39 | 39 | } |
40 | 40 | $_SESSION['itemname'] = $roledata['name']; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Add lock-element JS-Script |
47 | 47 | $lockElementId = $role; |
48 | 48 | $lockElementType = 8; |
49 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
49 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
50 | 50 | ?> |
51 | 51 | <script type="text/javascript"> |
52 | 52 | function changestate(element) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <input type="hidden" name="id" value="<?= $_GET['id'] ?>"> |
83 | 83 | |
84 | 84 | <h1> |
85 | - <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?> |
|
85 | + <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?> |
|
86 | 86 | </h1> |
87 | 87 | |
88 | 88 | <?= $_style['actionbuttons']['dynamic']['savedelete'] ?> |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | </form> |
294 | 294 | |
295 | 295 | <?php |
296 | -function render_form($name, $label, $status = '') { |
|
296 | +function render_form($name, $label, $status = ''){ |
|
297 | 297 | global $modx, $roledata; |
298 | 298 | |
299 | 299 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
306 | 306 | $value = ($roledata[$name] == 1) ? 1 : 0; |
307 | - if($status == 'disabled') { |
|
307 | + if ($status == 'disabled') { |
|
308 | 308 | $checked = 'checked'; |
309 | 309 | $value = 1; |
310 | 310 | $set = 'fix'; |