@@ -113,31 +113,31 @@ discard block |
||
113 | 113 | // Handle Input "Search in main fields" |
114 | 114 | if ($searchfields != '') { |
115 | 115 | |
116 | - /*start search by TV. Added Rising13*/ |
|
117 | - $tbl_site_tmplvar_contentvalues = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | - $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | - $articul_result = $modx->db->query($articul_query); |
|
120 | - $articul_id_array = $modx->db->makeArray($articul_result); |
|
121 | - if(count($articul_id_array)>0){ |
|
122 | - $articul_id = ''; |
|
123 | - $i = 1; |
|
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
128 | - } |
|
129 | - $i++; |
|
130 | - } |
|
131 | - $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | - }else{ |
|
133 | - $articul_id_query = ''; |
|
134 | - } |
|
135 | - /*end search by TV*/ |
|
116 | + /*start search by TV. Added Rising13*/ |
|
117 | + $tbl_site_tmplvar_contentvalues = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | + $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | + $articul_result = $modx->db->query($articul_query); |
|
120 | + $articul_id_array = $modx->db->makeArray($articul_result); |
|
121 | + if(count($articul_id_array)>0){ |
|
122 | + $articul_id = ''; |
|
123 | + $i = 1; |
|
124 | + foreach( $articul_id_array as $articul ) { |
|
125 | + $articul_id.=$articul['contentid']; |
|
126 | + if($i !== count($articul_id_array)){ |
|
127 | + $articul_id.=','; |
|
128 | + } |
|
129 | + $i++; |
|
130 | + } |
|
131 | + $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | + }else{ |
|
133 | + $articul_id_query = ''; |
|
134 | + } |
|
135 | + /*end search by TV*/ |
|
136 | 136 | |
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query;//search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query;//search by TV |
|
161 | 161 | } |
162 | 162 | } else if ($idFromAlias) { |
163 | 163 | $sqladd .= " sc.id='{$idFromAlias}'"; |
@@ -1,9 +1,9 @@ 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('view_eventlog')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // Get table Names (alphabetical) |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | |
17 | 17 | // get and save search string |
18 | 18 | if($_REQUEST['op'] == 'reset') { |
19 | - $sqlQuery = $query = ''; |
|
20 | - $_PAGE['vs']['search'] = ''; |
|
19 | + $sqlQuery = $query = ''; |
|
20 | + $_PAGE['vs']['search'] = ''; |
|
21 | 21 | } else { |
22 | - $sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
23 | - if(!is_numeric($sqlQuery)) { |
|
24 | - $sqlQuery = $modx->db->escape($query); |
|
25 | - } |
|
26 | - $_PAGE['vs']['search'] = $query; |
|
22 | + $sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
23 | + if(!is_numeric($sqlQuery)) { |
|
24 | + $sqlQuery = $modx->db->escape($query); |
|
25 | + } |
|
26 | + $_PAGE['vs']['search'] = $query; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // get & save listmode |
@@ -125,33 +125,33 @@ discard block |
||
125 | 125 | <div class="row"> |
126 | 126 | <div class="table-responsive"> |
127 | 127 | <?php |
128 | - $ds = $modx->db->select("el.id, ELT(el.type , 'text-info {$_style['actions_info']}' , 'text-warning {$_style['actions_triangle']}' , 'text-danger {$_style['actions_error']}' ) as icon, el.createdon, el.source, el.eventid,IFNULL(wu.username,mu.username) as username", "{$tbl_event_log} AS el |
|
128 | + $ds = $modx->db->select("el.id, ELT(el.type , 'text-info {$_style['actions_info']}' , 'text-warning {$_style['actions_triangle']}' , 'text-danger {$_style['actions_error']}' ) as icon, el.createdon, el.source, el.eventid,IFNULL(wu.username,mu.username) as username", "{$tbl_event_log} AS el |
|
129 | 129 | LEFT JOIN {$tbl_manager_users} AS mu ON mu.id=el.user AND el.usertype=0 |
130 | 130 | LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "" . (is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '') . "(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC"); |
131 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
132 | - $grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
|
133 | - $grd->pagerClass = ''; |
|
134 | - $grd->pageClass = 'page-item'; |
|
135 | - $grd->selPageClass = 'page-item active'; |
|
136 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
137 | - $grd->cssClass = "table data nowrap"; |
|
138 | - $grd->columnHeaderClass = "tableHeader"; |
|
139 | - $grd->itemClass = "tableItem"; |
|
140 | - $grd->altItemClass = "tableAltItem"; |
|
141 | - $grd->fields = "type,source,createdon,eventid,username"; |
|
142 | - $grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid']; |
|
143 | - $grd->colWidths = "1%,,1%,1%,1%"; |
|
144 | - $grd->colAligns = "center,,,center,center"; |
|
145 | - $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p'; |
|
146 | - if($listmode == '1') { |
|
147 | - $grd->pageSize = 0; |
|
148 | - } |
|
149 | - if($_REQUEST['op'] == 'reset') { |
|
150 | - $grd->pageNumber = 1; |
|
151 | - } |
|
152 | - // render grid |
|
153 | - echo $grd->render(); |
|
154 | - ?> |
|
131 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
132 | + $grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items |
|
133 | + $grd->pagerClass = ''; |
|
134 | + $grd->pageClass = 'page-item'; |
|
135 | + $grd->selPageClass = 'page-item active'; |
|
136 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
137 | + $grd->cssClass = "table data nowrap"; |
|
138 | + $grd->columnHeaderClass = "tableHeader"; |
|
139 | + $grd->itemClass = "tableItem"; |
|
140 | + $grd->altItemClass = "tableAltItem"; |
|
141 | + $grd->fields = "type,source,createdon,eventid,username"; |
|
142 | + $grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid']; |
|
143 | + $grd->colWidths = "1%,,1%,1%,1%"; |
|
144 | + $grd->colAligns = "center,,,center,center"; |
|
145 | + $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p'; |
|
146 | + if($listmode == '1') { |
|
147 | + $grd->pageSize = 0; |
|
148 | + } |
|
149 | + if($_REQUEST['op'] == 'reset') { |
|
150 | + $grd->pageNumber = 1; |
|
151 | + } |
|
152 | + // render grid |
|
153 | + echo $grd->render(); |
|
154 | + ?> |
|
155 | 155 | </div> |
156 | 156 | </div> |
157 | 157 | </div> |
@@ -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,370 +85,370 @@ 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; |
|
105 | + global $modx; |
|
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 = intval($_POST['parent']); |
|
127 | + $parent = intval($_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 | - } |
|
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 | + } |
|
134 | 134 | |
135 | - $filesfound = 0; |
|
135 | + $filesfound = 0; |
|
136 | 136 | |
137 | - $files = getFiles($filedir); |
|
138 | - $files = pop_index($files); |
|
137 | + $files = getFiles($filedir); |
|
138 | + $files = pop_index($files); |
|
139 | 139 | |
140 | - // no. of files to import |
|
141 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
140 | + // no. of files to import |
|
141 | + $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
142 | 142 | |
143 | - // import files |
|
144 | - if(0 < count($files)) { |
|
145 | - $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
146 | - importFiles($parent, $filedir, $files, 'root'); |
|
147 | - } |
|
143 | + // import files |
|
144 | + if(0 < count($files)) { |
|
145 | + $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
146 | + importFiles($parent, $filedir, $files, 'root'); |
|
147 | + } |
|
148 | 148 | |
149 | - $mtime = microtime(); |
|
150 | - $mtime = explode(' ', $mtime); |
|
151 | - $mtime = $mtime[1] + $mtime[0]; |
|
152 | - $importend = $mtime; |
|
153 | - $totaltime = ($importend - $importstart); |
|
154 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
149 | + $mtime = microtime(); |
|
150 | + $mtime = explode(' ', $mtime); |
|
151 | + $mtime = $mtime[1] + $mtime[0]; |
|
152 | + $importend = $mtime; |
|
153 | + $totaltime = ($importend - $importstart); |
|
154 | + $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
155 | 155 | |
156 | - if($_POST['convert_link'] == 'on') { |
|
157 | - convertLink(); |
|
158 | - } |
|
156 | + if($_POST['convert_link'] == 'on') { |
|
157 | + convertLink(); |
|
158 | + } |
|
159 | 159 | |
160 | - return $output; |
|
160 | + return $output; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | function importFiles($parent, $filedir, $files, $mode) { |
164 | - global $modx; |
|
165 | - global $_lang, $allowedfiles; |
|
166 | - global $search_default, $cache_default, $publish_default; |
|
167 | - |
|
168 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
169 | - $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
170 | - |
|
171 | - $createdby = $modx->getLoginUserID(); |
|
172 | - if(!is_array($files)) { |
|
173 | - return; |
|
174 | - } |
|
175 | - if($_POST['object'] == 'all') { |
|
176 | - $modx->config['default_template'] = '0'; |
|
177 | - $richtext = '0'; |
|
178 | - } else { |
|
179 | - $richtext = '1'; |
|
180 | - } |
|
181 | - |
|
182 | - foreach($files as $id => $value) { |
|
183 | - if(is_array($value)) { |
|
184 | - // create folder |
|
185 | - $alias = $id; |
|
186 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
187 | - $field = array(); |
|
188 | - $field['type'] = 'document'; |
|
189 | - $field['contentType'] = 'text/html'; |
|
190 | - $field['published'] = $publish_default; |
|
191 | - $field['parent'] = $parent; |
|
192 | - $field['alias'] = $modx->stripAlias($alias); |
|
193 | - $field['richtext'] = $richtext; |
|
194 | - $field['template'] = $modx->config['default_template']; |
|
195 | - $field['searchable'] = $search_default; |
|
196 | - $field['cacheable'] = $cache_default; |
|
197 | - $field['createdby'] = $createdby; |
|
198 | - $field['isfolder'] = 1; |
|
199 | - $field['menuindex'] = 1; |
|
200 | - $find = false; |
|
201 | - foreach(array( |
|
202 | - 'index.html', |
|
203 | - 'index.htm' |
|
204 | - ) as $filename) { |
|
205 | - $filepath = $filedir . $alias . '/' . $filename; |
|
206 | - if($find === false && file_exists($filepath)) { |
|
207 | - $file = getFileContent($filepath); |
|
208 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
209 | - |
|
210 | - $date = filemtime($filepath); |
|
211 | - $field['pagetitle'] = $pagetitle; |
|
212 | - $field['longtitle'] = $pagetitle; |
|
213 | - $field['description'] = $description; |
|
214 | - $field['content'] = $modx->db->escape($content); |
|
215 | - $field['createdon'] = $date; |
|
216 | - $field['editedon'] = $date; |
|
217 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
218 | - if($newid) { |
|
219 | - $find = true; |
|
220 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
221 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
222 | - } else { |
|
223 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
224 | - exit; |
|
225 | - } |
|
226 | - } |
|
227 | - } |
|
228 | - if($find === false) { |
|
229 | - $date = time(); |
|
230 | - $field['pagetitle'] = '---'; |
|
231 | - $field['content'] = ''; |
|
232 | - $field['createdon'] = $date; |
|
233 | - $field['editedon'] = $date; |
|
234 | - $field['hidemenu'] = '1'; |
|
235 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
236 | - if($newid) { |
|
237 | - $find = true; |
|
238 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
239 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
240 | - } else { |
|
241 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
242 | - exit; |
|
243 | - } |
|
244 | - } |
|
245 | - } else { |
|
246 | - // create document |
|
247 | - if($mode == 'sub' && $value == 'index.html') { |
|
248 | - continue; |
|
249 | - } |
|
250 | - $filename = $value; |
|
251 | - $fparts = explode('.', $value); |
|
252 | - $alias = $fparts[0]; |
|
253 | - $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
254 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
255 | - |
|
256 | - if(!in_array($ext, $allowedfiles)) { |
|
257 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
258 | - } else { |
|
259 | - $filepath = $filedir . $filename; |
|
260 | - $file = getFileContent($filepath); |
|
261 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
262 | - |
|
263 | - $date = filemtime($filepath); |
|
264 | - $field = array(); |
|
265 | - $field['type'] = 'document'; |
|
266 | - $field['contentType'] = 'text/html'; |
|
267 | - $field['pagetitle'] = $pagetitle; |
|
268 | - $field['longtitle'] = $pagetitle; |
|
269 | - $field['description'] = $description; |
|
270 | - $field['alias'] = $modx->stripAlias($alias); |
|
271 | - $field['published'] = $publish_default; |
|
272 | - $field['parent'] = $parent; |
|
273 | - $field['content'] = $modx->db->escape($content); |
|
274 | - $field['richtext'] = $richtext; |
|
275 | - $field['template'] = $modx->config['default_template']; |
|
276 | - $field['searchable'] = $search_default; |
|
277 | - $field['cacheable'] = $cache_default; |
|
278 | - $field['createdby'] = $createdby; |
|
279 | - $field['createdon'] = $date; |
|
280 | - $field['editedon'] = $date; |
|
281 | - $field['isfolder'] = 0; |
|
282 | - $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
283 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
284 | - if($newid) { |
|
285 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
286 | - } else { |
|
287 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
288 | - exit; |
|
289 | - } |
|
290 | - |
|
291 | - $is_site_start = false; |
|
292 | - if($filename == 'index.html') { |
|
293 | - $is_site_start = true; |
|
294 | - } |
|
295 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
296 | - $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
297 | - $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
298 | - } |
|
299 | - } |
|
300 | - } |
|
301 | - } |
|
164 | + global $modx; |
|
165 | + global $_lang, $allowedfiles; |
|
166 | + global $search_default, $cache_default, $publish_default; |
|
167 | + |
|
168 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
169 | + $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
170 | + |
|
171 | + $createdby = $modx->getLoginUserID(); |
|
172 | + if(!is_array($files)) { |
|
173 | + return; |
|
174 | + } |
|
175 | + if($_POST['object'] == 'all') { |
|
176 | + $modx->config['default_template'] = '0'; |
|
177 | + $richtext = '0'; |
|
178 | + } else { |
|
179 | + $richtext = '1'; |
|
180 | + } |
|
181 | + |
|
182 | + foreach($files as $id => $value) { |
|
183 | + if(is_array($value)) { |
|
184 | + // create folder |
|
185 | + $alias = $id; |
|
186 | + printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
187 | + $field = array(); |
|
188 | + $field['type'] = 'document'; |
|
189 | + $field['contentType'] = 'text/html'; |
|
190 | + $field['published'] = $publish_default; |
|
191 | + $field['parent'] = $parent; |
|
192 | + $field['alias'] = $modx->stripAlias($alias); |
|
193 | + $field['richtext'] = $richtext; |
|
194 | + $field['template'] = $modx->config['default_template']; |
|
195 | + $field['searchable'] = $search_default; |
|
196 | + $field['cacheable'] = $cache_default; |
|
197 | + $field['createdby'] = $createdby; |
|
198 | + $field['isfolder'] = 1; |
|
199 | + $field['menuindex'] = 1; |
|
200 | + $find = false; |
|
201 | + foreach(array( |
|
202 | + 'index.html', |
|
203 | + 'index.htm' |
|
204 | + ) as $filename) { |
|
205 | + $filepath = $filedir . $alias . '/' . $filename; |
|
206 | + if($find === false && file_exists($filepath)) { |
|
207 | + $file = getFileContent($filepath); |
|
208 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
209 | + |
|
210 | + $date = filemtime($filepath); |
|
211 | + $field['pagetitle'] = $pagetitle; |
|
212 | + $field['longtitle'] = $pagetitle; |
|
213 | + $field['description'] = $description; |
|
214 | + $field['content'] = $modx->db->escape($content); |
|
215 | + $field['createdon'] = $date; |
|
216 | + $field['editedon'] = $date; |
|
217 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
218 | + if($newid) { |
|
219 | + $find = true; |
|
220 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
221 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
222 | + } else { |
|
223 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
224 | + exit; |
|
225 | + } |
|
226 | + } |
|
227 | + } |
|
228 | + if($find === false) { |
|
229 | + $date = time(); |
|
230 | + $field['pagetitle'] = '---'; |
|
231 | + $field['content'] = ''; |
|
232 | + $field['createdon'] = $date; |
|
233 | + $field['editedon'] = $date; |
|
234 | + $field['hidemenu'] = '1'; |
|
235 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
236 | + if($newid) { |
|
237 | + $find = true; |
|
238 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
239 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
240 | + } else { |
|
241 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
242 | + exit; |
|
243 | + } |
|
244 | + } |
|
245 | + } else { |
|
246 | + // create document |
|
247 | + if($mode == 'sub' && $value == 'index.html') { |
|
248 | + continue; |
|
249 | + } |
|
250 | + $filename = $value; |
|
251 | + $fparts = explode('.', $value); |
|
252 | + $alias = $fparts[0]; |
|
253 | + $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
254 | + printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
255 | + |
|
256 | + if(!in_array($ext, $allowedfiles)) { |
|
257 | + echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
258 | + } else { |
|
259 | + $filepath = $filedir . $filename; |
|
260 | + $file = getFileContent($filepath); |
|
261 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
262 | + |
|
263 | + $date = filemtime($filepath); |
|
264 | + $field = array(); |
|
265 | + $field['type'] = 'document'; |
|
266 | + $field['contentType'] = 'text/html'; |
|
267 | + $field['pagetitle'] = $pagetitle; |
|
268 | + $field['longtitle'] = $pagetitle; |
|
269 | + $field['description'] = $description; |
|
270 | + $field['alias'] = $modx->stripAlias($alias); |
|
271 | + $field['published'] = $publish_default; |
|
272 | + $field['parent'] = $parent; |
|
273 | + $field['content'] = $modx->db->escape($content); |
|
274 | + $field['richtext'] = $richtext; |
|
275 | + $field['template'] = $modx->config['default_template']; |
|
276 | + $field['searchable'] = $search_default; |
|
277 | + $field['cacheable'] = $cache_default; |
|
278 | + $field['createdby'] = $createdby; |
|
279 | + $field['createdon'] = $date; |
|
280 | + $field['editedon'] = $date; |
|
281 | + $field['isfolder'] = 0; |
|
282 | + $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
283 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
284 | + if($newid) { |
|
285 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
286 | + } else { |
|
287 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
288 | + exit; |
|
289 | + } |
|
290 | + |
|
291 | + $is_site_start = false; |
|
292 | + if($filename == 'index.html') { |
|
293 | + $is_site_start = true; |
|
294 | + } |
|
295 | + if($is_site_start == true && $_POST['reset'] == 'on') { |
|
296 | + $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
297 | + $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
298 | + } |
|
299 | + } |
|
300 | + } |
|
301 | + } |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | function getFiles($directory, $listing = array(), $count = 0) { |
305 | - global $_lang; |
|
306 | - global $filesfound; |
|
307 | - $dummy = $count; |
|
308 | - if($files = scandir($directory)) { |
|
309 | - foreach($files as $file) { |
|
310 | - if($file == '.' || $file == '..') { |
|
311 | - continue; |
|
312 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
313 | - closedir($h); |
|
314 | - $count = -1; |
|
315 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
316 | - } elseif(strpos($file, '.htm') !== false) { |
|
317 | - $listing[$dummy] = $file; |
|
318 | - $dummy = $dummy + 1; |
|
319 | - $filesfound++; |
|
320 | - } |
|
321 | - } |
|
322 | - } else { |
|
323 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
324 | - } |
|
325 | - return ($listing); |
|
305 | + global $_lang; |
|
306 | + global $filesfound; |
|
307 | + $dummy = $count; |
|
308 | + if($files = scandir($directory)) { |
|
309 | + foreach($files as $file) { |
|
310 | + if($file == '.' || $file == '..') { |
|
311 | + continue; |
|
312 | + } elseif($h = @opendir($directory . $file . "/")) { |
|
313 | + closedir($h); |
|
314 | + $count = -1; |
|
315 | + $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
316 | + } elseif(strpos($file, '.htm') !== false) { |
|
317 | + $listing[$dummy] = $file; |
|
318 | + $dummy = $dummy + 1; |
|
319 | + $filesfound++; |
|
320 | + } |
|
321 | + } |
|
322 | + } else { |
|
323 | + echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
324 | + } |
|
325 | + return ($listing); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | function getFileContent($filepath) { |
329 | - global $_lang; |
|
330 | - // get the file |
|
331 | - if(!$buffer = file_get_contents($filepath)) { |
|
332 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
333 | - } else { |
|
334 | - return $buffer; |
|
335 | - } |
|
329 | + global $_lang; |
|
330 | + // get the file |
|
331 | + if(!$buffer = file_get_contents($filepath)) { |
|
332 | + echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
333 | + } else { |
|
334 | + return $buffer; |
|
335 | + } |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | function pop_index($array) { |
339 | - $new_array = array(); |
|
340 | - foreach($array as $k => $v) { |
|
341 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
342 | - $new_array[$k] = $v; |
|
343 | - } else { |
|
344 | - array_unshift($new_array, $v); |
|
345 | - } |
|
346 | - } |
|
347 | - foreach($array as $k => $v) { |
|
348 | - if(is_array($v)) { |
|
349 | - $new_array[$k] = $v; |
|
350 | - } |
|
351 | - } |
|
352 | - return $new_array; |
|
339 | + $new_array = array(); |
|
340 | + foreach($array as $k => $v) { |
|
341 | + if($v !== 'index.html' && $v !== 'index.htm') { |
|
342 | + $new_array[$k] = $v; |
|
343 | + } else { |
|
344 | + array_unshift($new_array, $v); |
|
345 | + } |
|
346 | + } |
|
347 | + foreach($array as $k => $v) { |
|
348 | + if(is_array($v)) { |
|
349 | + $new_array[$k] = $v; |
|
350 | + } |
|
351 | + } |
|
352 | + return $new_array; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | function treatContent($src, $filename, $alias) { |
356 | - global $modx; |
|
357 | - |
|
358 | - $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
359 | - |
|
360 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
361 | - $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
362 | - $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
363 | - } else { |
|
364 | - $pagetitle = $alias; |
|
365 | - } |
|
366 | - if(!$pagetitle) { |
|
367 | - $pagetitle = $alias; |
|
368 | - } |
|
369 | - |
|
370 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
371 | - $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
372 | - $description = str_replace('[*description*]', '', $description); |
|
373 | - } else { |
|
374 | - $description = ''; |
|
375 | - } |
|
376 | - |
|
377 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
378 | - $content = $matches[1]; |
|
379 | - } else { |
|
380 | - $content = $src; |
|
381 | - $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
382 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
383 | - $content = preg_replace($s, $r, $content); |
|
384 | - $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
385 | - } |
|
386 | - $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
387 | - $content = trim($content); |
|
388 | - $pagetitle = $modx->db->escape($pagetitle); |
|
389 | - return array( |
|
390 | - $pagetitle, |
|
391 | - $content, |
|
392 | - $description |
|
393 | - ); |
|
356 | + global $modx; |
|
357 | + |
|
358 | + $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
359 | + |
|
360 | + if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
361 | + $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
362 | + $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
363 | + } else { |
|
364 | + $pagetitle = $alias; |
|
365 | + } |
|
366 | + if(!$pagetitle) { |
|
367 | + $pagetitle = $alias; |
|
368 | + } |
|
369 | + |
|
370 | + if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
371 | + $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
372 | + $description = str_replace('[*description*]', '', $description); |
|
373 | + } else { |
|
374 | + $description = ''; |
|
375 | + } |
|
376 | + |
|
377 | + if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
378 | + $content = $matches[1]; |
|
379 | + } else { |
|
380 | + $content = $src; |
|
381 | + $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
382 | + $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
383 | + $content = preg_replace($s, $r, $content); |
|
384 | + $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
385 | + } |
|
386 | + $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
387 | + $content = trim($content); |
|
388 | + $pagetitle = $modx->db->escape($pagetitle); |
|
389 | + return array( |
|
390 | + $pagetitle, |
|
391 | + $content, |
|
392 | + $description |
|
393 | + ); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | function convertLink() { |
397 | - global $modx; |
|
398 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
399 | - |
|
400 | - $rs = $modx->db->select('id,content', $tbl_site_content); |
|
401 | - while($row = $modx->db->getRow($rs)) { |
|
402 | - $id = $row['id']; |
|
403 | - $array = explode('<a href=', $row['content']); |
|
404 | - $c = 0; |
|
405 | - foreach($array as $v) { |
|
406 | - if($v[0] === '"') { |
|
407 | - $v = substr($v, 1); |
|
408 | - list($href, $v) = explode('"', $v, 2); |
|
409 | - $_ = $href; |
|
410 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
411 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
412 | - } |
|
413 | - if($_[0] === '/') { |
|
414 | - $_ = substr($_, 1); |
|
415 | - } |
|
416 | - $_ = str_replace('/index.html', '.html', $_); |
|
417 | - $level = substr_count($_, '../'); |
|
418 | - if(1 < $level) { |
|
419 | - if(!isset($p[$id])) { |
|
420 | - $p[$id] = $modx->getParentIds($id); |
|
421 | - } |
|
422 | - $k = array_keys($p[$id]); |
|
423 | - while(0 < $level) { |
|
424 | - $dir = array_shift($k); |
|
425 | - $level--; |
|
426 | - } |
|
427 | - if($dir != '') { |
|
428 | - $dir .= '/'; |
|
429 | - } |
|
430 | - } else { |
|
431 | - $dir = ''; |
|
432 | - } |
|
433 | - |
|
434 | - $_ = trim($_, './'); |
|
435 | - if(strpos($_, '/') !== false) { |
|
436 | - $_ = substr($_, strrpos($_, '/')); |
|
437 | - } |
|
438 | - $_ = $dir . str_replace('.html', '', $_); |
|
439 | - if(!isset($target[$_])) { |
|
440 | - $target[$_] = $modx->getIdFromAlias($_); |
|
441 | - } |
|
442 | - $target[$_] = trim($target[$_]); |
|
443 | - if(!empty($target[$_])) { |
|
444 | - $href = '[~' . $target[$_] . '~]'; |
|
445 | - } |
|
446 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
447 | - } |
|
448 | - $c++; |
|
449 | - } |
|
450 | - $content = implode('', $array); |
|
451 | - $f['content'] = $modx->db->escape($content); |
|
452 | - $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
453 | - } |
|
397 | + global $modx; |
|
398 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
399 | + |
|
400 | + $rs = $modx->db->select('id,content', $tbl_site_content); |
|
401 | + while($row = $modx->db->getRow($rs)) { |
|
402 | + $id = $row['id']; |
|
403 | + $array = explode('<a href=', $row['content']); |
|
404 | + $c = 0; |
|
405 | + foreach($array as $v) { |
|
406 | + if($v[0] === '"') { |
|
407 | + $v = substr($v, 1); |
|
408 | + list($href, $v) = explode('"', $v, 2); |
|
409 | + $_ = $href; |
|
410 | + if(strpos($_, $modx->config['site_url']) !== false) { |
|
411 | + $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
412 | + } |
|
413 | + if($_[0] === '/') { |
|
414 | + $_ = substr($_, 1); |
|
415 | + } |
|
416 | + $_ = str_replace('/index.html', '.html', $_); |
|
417 | + $level = substr_count($_, '../'); |
|
418 | + if(1 < $level) { |
|
419 | + if(!isset($p[$id])) { |
|
420 | + $p[$id] = $modx->getParentIds($id); |
|
421 | + } |
|
422 | + $k = array_keys($p[$id]); |
|
423 | + while(0 < $level) { |
|
424 | + $dir = array_shift($k); |
|
425 | + $level--; |
|
426 | + } |
|
427 | + if($dir != '') { |
|
428 | + $dir .= '/'; |
|
429 | + } |
|
430 | + } else { |
|
431 | + $dir = ''; |
|
432 | + } |
|
433 | + |
|
434 | + $_ = trim($_, './'); |
|
435 | + if(strpos($_, '/') !== false) { |
|
436 | + $_ = substr($_, strrpos($_, '/')); |
|
437 | + } |
|
438 | + $_ = $dir . str_replace('.html', '', $_); |
|
439 | + if(!isset($target[$_])) { |
|
440 | + $target[$_] = $modx->getIdFromAlias($_); |
|
441 | + } |
|
442 | + $target[$_] = trim($target[$_]); |
|
443 | + if(!empty($target[$_])) { |
|
444 | + $href = '[~' . $target[$_] . '~]'; |
|
445 | + } |
|
446 | + $array[$c] = '<a href="' . $href . '"' . $v; |
|
447 | + } |
|
448 | + $c++; |
|
449 | + } |
|
450 | + $content = implode('', $array); |
|
451 | + $f['content'] = $modx->db->escape($content); |
|
452 | + $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
453 | + } |
|
454 | 454 | } |
@@ -1,13 +1,13 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
9 | - // seems to be a new install - send the user to the configuration page |
|
10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
9 | + // seems to be a new install - send the user to the configuration page |
|
10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // set placeholders |
@@ -17,70 +17,70 @@ discard block |
||
17 | 17 | |
18 | 18 | // setup message info |
19 | 19 | if($modx->hasPermission('messages')) { |
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | - |
|
24 | - $msg = array(); |
|
25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | - $ph['MessageInfo'] = join("\n", $msg); |
|
20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | + |
|
24 | + $msg = array(); |
|
25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | + $ph['MessageInfo'] = join("\n", $msg); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
38 | 38 | } |
39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
42 | 42 | } |
43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
46 | 46 | } |
47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
50 | 50 | } |
51 | 51 | if($modx->hasPermission('bk_manager')) { |
52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
54 | 54 | } |
55 | 55 | if($modx->hasPermission('help')) { |
56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
58 | 58 | } |
59 | 59 | // do some config checks |
60 | 60 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | - $ph['config_check_results'] = $config_check_results; |
|
64 | - $ph['config_display'] = 'block'; |
|
65 | - } else { |
|
66 | - $ph['config_display'] = 'none'; |
|
67 | - } |
|
61 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | + $ph['config_check_results'] = $config_check_results; |
|
64 | + $ph['config_display'] = 'block'; |
|
65 | + } else { |
|
66 | + $ph['config_display'] = 'none'; |
|
67 | + } |
|
68 | 68 | } else { |
69 | - $ph['config_display'] = 'none'; |
|
69 | + $ph['config_display'] = 'none'; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | 73 | if(isset($_SESSION['show_logout_reminder'])) { |
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | - case 'logout_reminder': |
|
76 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | - break; |
|
79 | - } |
|
80 | - $ph['show_logout_reminder'] = 'block'; |
|
81 | - unset($_SESSION['show_logout_reminder']); |
|
74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | + case 'logout_reminder': |
|
76 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | + break; |
|
79 | + } |
|
80 | + $ph['show_logout_reminder'] = 'block'; |
|
81 | + unset($_SESSION['show_logout_reminder']); |
|
82 | 82 | } else { |
83 | - $ph['show_logout_reminder'] = 'none'; |
|
83 | + $ph['show_logout_reminder'] = 'none'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Check multiple sessions |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
129 | 129 | |
130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
131 | - 'username' => $modx->getLoginUserName(), |
|
132 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
131 | + 'username' => $modx->getLoginUserName(), |
|
132 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
136 | 136 | )); |
137 | 137 | |
138 | 138 | $from = array(); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | 143 | if($modx->db->getRecordCount($rs) < 1) { |
144 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
144 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
145 | 145 | } else { |
146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | - $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | - $html = ' |
|
146 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | + $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | + $html = ' |
|
151 | 151 | <div class="card-body"> |
152 | 152 | [%onlineusers_message%] |
153 | 153 | <b>[+now+]</b>): |
@@ -165,33 +165,33 @@ discard block |
||
165 | 165 | </thead> |
166 | 166 | <tbody>'; |
167 | 167 | |
168 | - $userList = array(); |
|
169 | - $userCount = array(); |
|
170 | - // Create userlist with session-count first before output |
|
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
172 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | - |
|
174 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | - $userList[] = array( |
|
179 | - $idle, |
|
180 | - '', |
|
181 | - $activeusers['username'], |
|
182 | - $webicon, |
|
183 | - abs($activeusers['internalKey']), |
|
184 | - $ip, |
|
185 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | - $currentaction |
|
187 | - ); |
|
188 | - } |
|
189 | - foreach($userList as $params) { |
|
190 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | - } |
|
193 | - |
|
194 | - $html .= ' |
|
168 | + $userList = array(); |
|
169 | + $userCount = array(); |
|
170 | + // Create userlist with session-count first before output |
|
171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
172 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | + |
|
174 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | + $userList[] = array( |
|
179 | + $idle, |
|
180 | + '', |
|
181 | + $activeusers['username'], |
|
182 | + $webicon, |
|
183 | + abs($activeusers['internalKey']), |
|
184 | + $ip, |
|
185 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | + $currentaction |
|
187 | + ); |
|
188 | + } |
|
189 | + foreach($userList as $params) { |
|
190 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | + } |
|
193 | + |
|
194 | + $html .= ' |
|
195 | 195 | </tbody> |
196 | 196 | </table> |
197 | 197 | </div> |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | 234 | if(is_array($evtOut)) { |
235 | - $output = implode('', $evtOut); |
|
236 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
235 | + $output = implode('', $evtOut); |
|
236 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $widgets['welcome'] = array( |
240 | - 'menuindex' => '10', |
|
241 | - 'id' => 'welcome', |
|
242 | - 'cols' => 'col-sm-6', |
|
243 | - 'icon' => 'fa-home', |
|
244 | - 'title' => '[%welcome_title%]', |
|
245 | - 'body' => ' |
|
240 | + 'menuindex' => '10', |
|
241 | + 'id' => 'welcome', |
|
242 | + 'cols' => 'col-sm-6', |
|
243 | + 'icon' => 'fa-home', |
|
244 | + 'title' => '[%welcome_title%]', |
|
245 | + 'body' => ' |
|
246 | 246 | <div class="wm_buttons card-body"> |
247 | 247 | <!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> |
248 | 248 | <span class="wm_button"> |
@@ -320,25 +320,25 @@ discard block |
||
320 | 320 | </table> |
321 | 321 | </div> |
322 | 322 | ', |
323 | - 'hide'=>'0' |
|
323 | + 'hide'=>'0' |
|
324 | 324 | ); |
325 | 325 | $widgets['onlineinfo'] = array( |
326 | - 'menuindex' => '20', |
|
327 | - 'id' => 'onlineinfo', |
|
328 | - 'cols' => 'col-sm-6', |
|
329 | - 'icon' => 'fa-user', |
|
330 | - 'title' => '[%onlineusers_title%]', |
|
331 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | - 'hide'=>'0' |
|
326 | + 'menuindex' => '20', |
|
327 | + 'id' => 'onlineinfo', |
|
328 | + 'cols' => 'col-sm-6', |
|
329 | + 'icon' => 'fa-user', |
|
330 | + 'title' => '[%onlineusers_title%]', |
|
331 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | + 'hide'=>'0' |
|
333 | 333 | ); |
334 | 334 | $widgets['recentinfo'] = array( |
335 | - 'menuindex' => '30', |
|
336 | - 'id' => 'modxrecent_widget', |
|
337 | - 'cols' => 'col-sm-12', |
|
338 | - 'icon' => 'fa-pencil-square-o', |
|
339 | - 'title' => '[%activity_title%]', |
|
340 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | - 'hide'=>'0' |
|
335 | + 'menuindex' => '30', |
|
336 | + 'id' => 'modxrecent_widget', |
|
337 | + 'cols' => 'col-sm-12', |
|
338 | + 'icon' => 'fa-pencil-square-o', |
|
339 | + 'title' => '[%activity_title%]', |
|
340 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | + 'hide'=>'0' |
|
342 | 342 | ); |
343 | 343 | if ($modx->config['rss_url_news']) { |
344 | 344 | $widgets['news'] = array( |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | 368 | if(is_array($sitewidgets)) { |
369 | - $newwidgets = array(); |
|
369 | + $newwidgets = array(); |
|
370 | 370 | foreach($sitewidgets as $widget){ |
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
@@ -374,21 +374,21 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | usort($widgets, function ($a, $b) { |
377 | - return $a['menuindex'] - $b['menuindex']; |
|
377 | + return $a['menuindex'] - $b['menuindex']; |
|
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | 382 | foreach($widgets as $widget) { |
383 | - if ($widget['hide'] != '1'){ |
|
384 | - $output .= $modx->parseText($tpl, $widget); |
|
385 | - } |
|
383 | + if ($widget['hide'] != '1'){ |
|
384 | + $output .= $modx->parseText($tpl, $widget); |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | 390 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
@@ -396,27 +396,27 @@ discard block |
||
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | 398 | if(substr($target, 0, 1) === '@') { |
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | - $content = file_get_contents(trim(substr($target, 6))); |
|
403 | - } else { |
|
404 | - $content = ''; |
|
405 | - } |
|
399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | + $content = file_get_contents(trim(substr($target, 6))); |
|
403 | + } else { |
|
404 | + $content = ''; |
|
405 | + } |
|
406 | 406 | } else { |
407 | - $chunk = $modx->getChunk($target); |
|
408 | - if($chunk !== false && !empty($chunk)) { |
|
409 | - $content = $chunk; |
|
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | - { |
|
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | - } else { |
|
418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | - } |
|
407 | + $chunk = $modx->getChunk($target); |
|
408 | + if($chunk !== false && !empty($chunk)) { |
|
409 | + $content = $chunk; |
|
410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | + { |
|
416 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | + } else { |
|
418 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | + } |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // merge placeholders |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | $content = $modx->mergeSettingsContent($content); |
425 | 425 | $content = $modx->parseText($content, $ph); |
426 | 426 | if(strpos($content, '[+') !== false) { |
427 | - $modx->toPlaceholders($ph); |
|
428 | - $content = $modx->mergePlaceholderContent($content); |
|
427 | + $modx->toPlaceholders($ph); |
|
428 | + $content = $modx->mergePlaceholderContent($content); |
|
429 | 429 | } |
430 | 430 | $content = $modx->parseDocumentSource($content); |
431 | 431 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 434 | |
435 | 435 | if($js = $modx->getRegisteredClientScripts()) { |
436 | - $content .= $js; |
|
436 | + $content .= $js; |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | echo $content; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 444 | //</span> |
445 | 445 | function getTplWidget() { // recent document info |
446 | - return ' |
|
446 | + return ' |
|
447 | 447 | <div class="[+cols+]" id="[+id+]"> |
448 | 448 | <div class="card"[+cardAttr+]> |
449 | 449 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | } |
455 | 455 | |
456 | 456 | function getRecentInfo() { // recent document info |
457 | - global $modx; |
|
457 | + global $modx; |
|
458 | 458 | |
459 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
459 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
460 | 460 | |
461 | - $html = ' |
|
461 | + $html = ' |
|
462 | 462 | <div class="table-responsive"> |
463 | 463 | <table class="table data"> |
464 | 464 | <thead> |
@@ -476,96 +476,96 @@ discard block |
||
476 | 476 | </table> |
477 | 477 | </div> |
478 | 478 | '; |
479 | - return $html; |
|
479 | + return $html; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | function getRecentInfoList() { |
483 | - global $modx; |
|
484 | - |
|
485 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | - |
|
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
488 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | - } |
|
490 | - |
|
491 | - $tpl = getRecentInfoRowTpl(); |
|
492 | - |
|
493 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | - |
|
496 | - $output = array(); |
|
497 | - while($ph = $modx->db->getRow($rs)) { |
|
498 | - $docid = $ph['id']; |
|
499 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | - $ph['username'] = $_['username']; |
|
501 | - |
|
502 | - if($ph['deleted'] == 1) { |
|
503 | - $ph['status'] = 'deleted text-danger'; |
|
504 | - } elseif($ph['published'] == 0) { |
|
505 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | - } else { |
|
507 | - $ph['status'] = 'published'; |
|
508 | - } |
|
509 | - |
|
510 | - if($modx->hasPermission('edit_document')) { |
|
511 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | - } else { |
|
513 | - $ph['edit_btn'] = ''; |
|
514 | - } |
|
515 | - |
|
516 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | - $ph['preview_btn'] = str_replace(array( |
|
518 | - '[+id+]', |
|
519 | - '[+preview_disabled+]' |
|
520 | - ), array( |
|
521 | - $docid, |
|
522 | - $preview_disabled |
|
523 | - ), $btntpl['preview_btn']); |
|
524 | - |
|
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
527 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | - } else { |
|
529 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | - } |
|
531 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | - } else { |
|
533 | - $ph['delete_btn'] = ''; |
|
534 | - } |
|
535 | - |
|
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | - } else { |
|
543 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | - } |
|
545 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | - |
|
547 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | - |
|
549 | - if($ph['longtitle'] == '') { |
|
550 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | - } |
|
552 | - if($ph['description'] == '') { |
|
553 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | - } |
|
555 | - if($ph['introtext'] == '') { |
|
556 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | - } |
|
558 | - if($ph['alias'] == '') { |
|
559 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | - } |
|
561 | - |
|
562 | - $output[] = $modx->parseText($tpl, $ph); |
|
563 | - } |
|
564 | - return join("\n", $output); |
|
483 | + global $modx; |
|
484 | + |
|
485 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | + |
|
487 | + if($modx->db->getRecordCount($rs) < 1) { |
|
488 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | + } |
|
490 | + |
|
491 | + $tpl = getRecentInfoRowTpl(); |
|
492 | + |
|
493 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | + |
|
496 | + $output = array(); |
|
497 | + while($ph = $modx->db->getRow($rs)) { |
|
498 | + $docid = $ph['id']; |
|
499 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | + $ph['username'] = $_['username']; |
|
501 | + |
|
502 | + if($ph['deleted'] == 1) { |
|
503 | + $ph['status'] = 'deleted text-danger'; |
|
504 | + } elseif($ph['published'] == 0) { |
|
505 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | + } else { |
|
507 | + $ph['status'] = 'published'; |
|
508 | + } |
|
509 | + |
|
510 | + if($modx->hasPermission('edit_document')) { |
|
511 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | + } else { |
|
513 | + $ph['edit_btn'] = ''; |
|
514 | + } |
|
515 | + |
|
516 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | + $ph['preview_btn'] = str_replace(array( |
|
518 | + '[+id+]', |
|
519 | + '[+preview_disabled+]' |
|
520 | + ), array( |
|
521 | + $docid, |
|
522 | + $preview_disabled |
|
523 | + ), $btntpl['preview_btn']); |
|
524 | + |
|
525 | + if($modx->hasPermission('delete_document')) { |
|
526 | + if($ph['deleted'] == 0) { |
|
527 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | + } else { |
|
529 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | + } |
|
531 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | + } else { |
|
533 | + $ph['delete_btn'] = ''; |
|
534 | + } |
|
535 | + |
|
536 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | + } else { |
|
543 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | + } |
|
545 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | + |
|
547 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | + |
|
549 | + if($ph['longtitle'] == '') { |
|
550 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | + } |
|
552 | + if($ph['description'] == '') { |
|
553 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | + } |
|
555 | + if($ph['introtext'] == '') { |
|
556 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | + } |
|
558 | + if($ph['alias'] == '') { |
|
559 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | + } |
|
561 | + |
|
562 | + $output[] = $modx->parseText($tpl, $ph); |
|
563 | + } |
|
564 | + return join("\n", $output); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | function getRecentInfoRowTpl() { |
568 | - $tpl = ' |
|
568 | + $tpl = ' |
|
569 | 569 | <tr> |
570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
571 | 571 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | </div> |
590 | 590 | </td> |
591 | 591 | </tr>'; |
592 | - return $tpl; |
|
592 | + return $tpl; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // setup icons |
596 | 596 | function wrapIcon($i, $action) { |
597 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
597 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | function getStartUpScript() { |
601 | - $script = ' |
|
601 | + $script = ' |
|
602 | 602 | <script type="text/javascript"> |
603 | 603 | function hideConfigCheckWarning(key) { |
604 | 604 | var xhr = new XMLHttpRequest(); |
@@ -622,5 +622,5 @@ discard block |
||
622 | 622 | })(jQuery); |
623 | 623 | </script> |
624 | 624 | '; |
625 | - return $script; |
|
625 | + return $script; |
|
626 | 626 | } |
@@ -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']) ? intval($_REQUEST['id']) : 0; |
@@ -24,64 +24,64 @@ discard block |
||
24 | 24 | // check to see the snippet editor isn't locked |
25 | 25 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
26 | 26 | if($username = $modx->db->getValue($rs)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | 31 | if($modx->manager->action == '88') { |
32 | - // get user attributes |
|
33 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | - $userdata = $modx->db->getRow($rs); |
|
35 | - if(!$userdata) { |
|
36 | - $modx->webAlertAndQuit("No user returned!"); |
|
37 | - } |
|
38 | - |
|
39 | - // get user settings |
|
40 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | - $usersettings = array(); |
|
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | - extract($usersettings, EXTR_OVERWRITE); |
|
44 | - |
|
45 | - // get user name |
|
46 | - $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | - $usernamedata = $modx->db->getRow($rs); |
|
48 | - if(!$usernamedata) { |
|
49 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | - } |
|
51 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
32 | + // get user attributes |
|
33 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | + $userdata = $modx->db->getRow($rs); |
|
35 | + if(!$userdata) { |
|
36 | + $modx->webAlertAndQuit("No user returned!"); |
|
37 | + } |
|
38 | + |
|
39 | + // get user settings |
|
40 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | + $usersettings = array(); |
|
42 | + while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | + extract($usersettings, EXTR_OVERWRITE); |
|
44 | + |
|
45 | + // get user name |
|
46 | + $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | + $usernamedata = $modx->db->getRow($rs); |
|
48 | + if(!$usernamedata) { |
|
49 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | + } |
|
51 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
52 | 52 | } else { |
53 | - $userdata = array(); |
|
54 | - $usersettings = array(); |
|
55 | - $usernamedata = array(); |
|
56 | - $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
53 | + $userdata = array(); |
|
54 | + $usersettings = array(); |
|
55 | + $usernamedata = array(); |
|
56 | + $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | 60 | foreach($userdata as $key => $val) { |
61 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
61 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
62 | 62 | }; |
63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 64 | |
65 | 65 | // restore saved form |
66 | 66 | $formRestored = false; |
67 | 67 | if($modx->manager->hasFormValues()) { |
68 | - $modx->manager->loadFormValues(); |
|
69 | - // restore post values |
|
70 | - $userdata = array_merge($userdata, $_POST); |
|
71 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | - $usernamedata['username'] = $userdata['newusername']; |
|
73 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | - $usersettings = array_merge($usersettings, $userdata); |
|
75 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | - extract($usersettings, EXTR_OVERWRITE); |
|
68 | + $modx->manager->loadFormValues(); |
|
69 | + // restore post values |
|
70 | + $userdata = array_merge($userdata, $_POST); |
|
71 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | + $usernamedata['username'] = $userdata['newusername']; |
|
73 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | + $usersettings = array_merge($usersettings, $userdata); |
|
75 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | + extract($usersettings, EXTR_OVERWRITE); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // include the country list language file |
80 | 80 | $_country_lang = array(); |
81 | 81 | if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
82 | - include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
82 | + include_once "lang/country/" . $manager_language . "_country.inc.php"; |
|
83 | 83 | } else { |
84 | - include_once "lang/country/english_country.inc.php"; |
|
84 | + include_once "lang/country/english_country.inc.php"; |
|
85 | 85 | } |
86 | 86 | asort($_country_lang); |
87 | 87 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | |
190 | 190 | <form action="index.php?a=89" method="post" name="userform"> |
191 | 191 | <?php |
192 | - // invoke OnWUsrFormPrerender event |
|
193 | - $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | - if(is_array($evtOut)) { |
|
195 | - echo implode("", $evtOut); |
|
196 | - } |
|
197 | - ?> |
|
192 | + // invoke OnWUsrFormPrerender event |
|
193 | + $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | + if(is_array($evtOut)) { |
|
195 | + echo implode("", $evtOut); |
|
196 | + } |
|
197 | + ?> |
|
198 | 198 | <input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>" /> |
199 | 199 | <input type="hidden" name="id" value="<?php echo $user ?>" /> |
200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
325 | 325 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
326 | 326 | <?php |
327 | - foreach($_country_lang as $key => $country) { |
|
328 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
329 | - } |
|
330 | - ?> |
|
327 | + foreach($_country_lang as $key => $country) { |
|
328 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
329 | + } |
|
330 | + ?> |
|
331 | 331 | </select></td> |
332 | 332 | </tr> |
333 | 333 | <tr> |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | <i onClick="document.userform.blockedafter.value=''; return true;" class="clearDate <?php echo $_style["actions_calendar_delete"] ?>" data-tooltip="<?php echo $_lang['remove_date']; ?>"></i></td> |
388 | 388 | </tr> |
389 | 389 | <?php |
390 | - } |
|
391 | - ?> |
|
390 | + } |
|
391 | + ?> |
|
392 | 392 | </table> |
393 | 393 | </div> |
394 | 394 | |
@@ -496,40 +496,40 @@ discard block |
||
496 | 496 | </table> |
497 | 497 | </div> |
498 | 498 | <?php |
499 | - if($use_udperms == 1) { |
|
500 | - |
|
501 | - $groupsarray = array(); |
|
502 | - |
|
503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
504 | - $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
505 | - $groupsarray = $modx->db->getColumn('webgroup', $rs); |
|
506 | - } |
|
507 | - // retain selected user groups between post |
|
508 | - if(is_array($_POST['user_groups'])) { |
|
509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | - } |
|
511 | - ?> |
|
499 | + if($use_udperms == 1) { |
|
500 | + |
|
501 | + $groupsarray = array(); |
|
502 | + |
|
503 | + if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
504 | + $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
505 | + $groupsarray = $modx->db->getColumn('webgroup', $rs); |
|
506 | + } |
|
507 | + // retain selected user groups between post |
|
508 | + if(is_array($_POST['user_groups'])) { |
|
509 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | + } |
|
511 | + ?> |
|
512 | 512 | <div class="tab-page" id="tabPermissions"> |
513 | 513 | <h2 class="tab"><?php echo $_lang['web_access_permissions'] ?></h2> |
514 | 514 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabPermissions"));</script> |
515 | 515 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
516 | 516 | <?php |
517 | - $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
|
518 | - while($row = $modx->db->getRow($rs)) { |
|
519 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
520 | - } |
|
521 | - } |
|
522 | - ?> |
|
517 | + $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
|
518 | + while($row = $modx->db->getRow($rs)) { |
|
519 | + echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
520 | + } |
|
521 | + } |
|
522 | + ?> |
|
523 | 523 | </div> |
524 | 524 | <?php |
525 | - // invoke OnWUsrFormRender event |
|
526 | - $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
527 | - "id" => $user |
|
528 | - )); |
|
529 | - if(is_array($evtOut)) { |
|
530 | - echo implode("", $evtOut); |
|
531 | - } |
|
532 | - ?> |
|
525 | + // invoke OnWUsrFormRender event |
|
526 | + $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
527 | + "id" => $user |
|
528 | + )); |
|
529 | + if(is_array($evtOut)) { |
|
530 | + echo implode("", $evtOut); |
|
531 | + } |
|
532 | + ?> |
|
533 | 533 | </div> |
534 | 534 | </div> |
535 | 535 | <input type="submit" name="save" style="display:none"> |
@@ -1,10 +1,10 @@ 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 | if(!$modx->hasPermission('edit_module')) { |
7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -26,91 +26,91 @@ discard block |
||
26 | 26 | // check to see the editor isn't locked |
27 | 27 | $rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
28 | 28 | if($username = $modx->db->getValue($rs)) { |
29 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
29 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module')); |
|
30 | 30 | } |
31 | 31 | // end check for lock |
32 | 32 | |
33 | 33 | // take action |
34 | 34 | switch($_REQUEST['op']) { |
35 | - case 'add': |
|
36 | - // convert ids to numbers |
|
37 | - $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
38 | - |
|
39 | - if(count($opids) > 0) { |
|
40 | - // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
41 | - $rt = strtolower($_REQUEST["rt"]); |
|
42 | - if($rt == 'chunk') { |
|
43 | - $type = 10; |
|
44 | - } |
|
45 | - if($rt == 'doc') { |
|
46 | - $type = 20; |
|
47 | - } |
|
48 | - if($rt == 'plug') { |
|
49 | - $type = 30; |
|
50 | - } |
|
51 | - if($rt == 'snip') { |
|
52 | - $type = 40; |
|
53 | - } |
|
54 | - if($rt == 'tpl') { |
|
55 | - $type = 50; |
|
56 | - } |
|
57 | - if($rt == 'tv') { |
|
58 | - $type = 60; |
|
59 | - } |
|
60 | - $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
61 | - foreach($opids as $opid) { |
|
62 | - $modx->db->insert(array( |
|
63 | - 'module' => $id, |
|
64 | - 'resource' => $opid, |
|
65 | - 'type' => $type, |
|
66 | - ), $tbl_site_module_depobj); |
|
67 | - } |
|
68 | - } |
|
69 | - break; |
|
70 | - case 'del': |
|
71 | - // convert ids to numbers |
|
72 | - $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
73 | - |
|
74 | - // get resources that needs to be removed |
|
75 | - $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
76 | - // loop through resources and look for plugins and snippets |
|
77 | - $plids = array(); |
|
78 | - $snid = array(); |
|
79 | - while($row = $modx->db->getRow($ds)) { |
|
80 | - if($row['type'] == '30') { |
|
81 | - $plids[$i] = $row['resource']; |
|
82 | - } |
|
83 | - if($row['type'] == '40') { |
|
84 | - $snids[$i] = $row['resource']; |
|
85 | - } |
|
86 | - } |
|
87 | - // get guid |
|
88 | - $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
89 | - $guid = $modx->db->getValue($ds); |
|
90 | - // reset moduleguid for deleted resources |
|
91 | - if(($cp = count($plids)) || ($cs = count($snids))) { |
|
92 | - if($cp) { |
|
93 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
94 | - } |
|
95 | - if($cs) { |
|
96 | - $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
97 | - } |
|
98 | - // reset cache |
|
99 | - $modx->clearCache('full'); |
|
100 | - } |
|
101 | - $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
102 | - break; |
|
35 | + case 'add': |
|
36 | + // convert ids to numbers |
|
37 | + $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids']))); |
|
38 | + |
|
39 | + if(count($opids) > 0) { |
|
40 | + // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs |
|
41 | + $rt = strtolower($_REQUEST["rt"]); |
|
42 | + if($rt == 'chunk') { |
|
43 | + $type = 10; |
|
44 | + } |
|
45 | + if($rt == 'doc') { |
|
46 | + $type = 20; |
|
47 | + } |
|
48 | + if($rt == 'plug') { |
|
49 | + $type = 30; |
|
50 | + } |
|
51 | + if($rt == 'snip') { |
|
52 | + $type = 40; |
|
53 | + } |
|
54 | + if($rt == 'tpl') { |
|
55 | + $type = 50; |
|
56 | + } |
|
57 | + if($rt == 'tv') { |
|
58 | + $type = 60; |
|
59 | + } |
|
60 | + $modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'"); |
|
61 | + foreach($opids as $opid) { |
|
62 | + $modx->db->insert(array( |
|
63 | + 'module' => $id, |
|
64 | + 'resource' => $opid, |
|
65 | + 'type' => $type, |
|
66 | + ), $tbl_site_module_depobj); |
|
67 | + } |
|
68 | + } |
|
69 | + break; |
|
70 | + case 'del': |
|
71 | + // convert ids to numbers |
|
72 | + $opids = array_filter(array_map('intval', $_REQUEST['depid'])); |
|
73 | + |
|
74 | + // get resources that needs to be removed |
|
75 | + $ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")"); |
|
76 | + // loop through resources and look for plugins and snippets |
|
77 | + $plids = array(); |
|
78 | + $snid = array(); |
|
79 | + while($row = $modx->db->getRow($ds)) { |
|
80 | + if($row['type'] == '30') { |
|
81 | + $plids[$i] = $row['resource']; |
|
82 | + } |
|
83 | + if($row['type'] == '40') { |
|
84 | + $snids[$i] = $row['resource']; |
|
85 | + } |
|
86 | + } |
|
87 | + // get guid |
|
88 | + $ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'"); |
|
89 | + $guid = $modx->db->getValue($ds); |
|
90 | + // reset moduleguid for deleted resources |
|
91 | + if(($cp = count($plids)) || ($cs = count($snids))) { |
|
92 | + if($cp) { |
|
93 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'"); |
|
94 | + } |
|
95 | + if($cs) { |
|
96 | + $modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'"); |
|
97 | + } |
|
98 | + // reset cache |
|
99 | + $modx->clearCache('full'); |
|
100 | + } |
|
101 | + $modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")"); |
|
102 | + break; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // load record |
106 | 106 | $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'"); |
107 | 107 | $content = $modx->db->getRow($rs); |
108 | 108 | if(!$content) { |
109 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
109 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
110 | 110 | } |
111 | 111 | $_SESSION['itemname'] = $content['name']; |
112 | 112 | if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
113 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
113 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | ?> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | <tr> |
204 | 204 | <td valign="top" align="left"> |
205 | 205 | <?php |
206 | - $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
206 | + $ds = $modx->db->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name, |
|
207 | 207 | CASE smd.type |
208 | 208 | WHEN 10 THEN 'Chunk' |
209 | 209 | WHEN 20 THEN 'Document' |
@@ -218,18 +218,18 @@ discard block |
||
218 | 218 | LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40' |
219 | 219 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50' |
220 | 220 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name"); |
221 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
222 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
223 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
224 | - $grd->cssClass = "grid"; |
|
225 | - $grd->columnHeaderClass = "gridHeader"; |
|
226 | - $grd->itemClass = "gridItem"; |
|
227 | - $grd->altItemClass = "gridAltItem"; |
|
228 | - $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
229 | - $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
230 | - $grd->fields = "name,type"; |
|
231 | - echo $grd->render(); |
|
232 | - ?> |
|
221 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
222 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
223 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
224 | + $grd->cssClass = "grid"; |
|
225 | + $grd->columnHeaderClass = "gridHeader"; |
|
226 | + $grd->itemClass = "gridItem"; |
|
227 | + $grd->altItemClass = "gridAltItem"; |
|
228 | + $grd->columns = $_lang["element_name"] . " ," . $_lang["type"]; |
|
229 | + $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]"; |
|
230 | + $grd->fields = "name,type"; |
|
231 | + echo $grd->render(); |
|
232 | + ?> |
|
233 | 233 | </td> |
234 | 234 | <td valign="top" style="width: 150px;"> |
235 | 235 | <a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a> |
@@ -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']) ? intval($_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> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
23 | 23 | { |
24 | - $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
24 | + $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | foreach( $cm->getCategories() as $category ) |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | |
107 | 107 | if( empty( $category ) ) |
108 | 108 | { |
109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
110 | - return; |
|
109 | + $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
110 | + return; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if( $cm->isCategoryExists( $category ) ) |
114 | 114 | { |
115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
116 | - return; |
|
115 | + $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
116 | + return; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | if( $cm->addCategory( $category, $rank ) !== 0 ) |
@@ -1,9 +1,9 @@ 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('view_eventlog')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // get id |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | <div class="tab-page"> |
42 | 42 | <div class="container container-body"> |
43 | 43 | <?php |
44 | - $date = $modx->toDateFormat($content["createdon"]); |
|
45 | - if($content["type"] == 1) { |
|
46 | - $icon = $_style['actions_info'] . ' text-info'; |
|
47 | - $msgtype = $_lang["information"]; |
|
48 | - } else if($content["type"] == 2) { |
|
49 | - $icon = $_style['actions_triangle'] . ' text-warning'; |
|
50 | - $msgtype = $_lang["warning"]; |
|
51 | - } else if($content["type"] == 3) { |
|
52 | - $icon = $_style['actions_error'] . ' text-danger'; |
|
53 | - $msgtype = $_lang["error"]; |
|
54 | - } |
|
55 | - ?> |
|
44 | + $date = $modx->toDateFormat($content["createdon"]); |
|
45 | + if($content["type"] == 1) { |
|
46 | + $icon = $_style['actions_info'] . ' text-info'; |
|
47 | + $msgtype = $_lang["information"]; |
|
48 | + } else if($content["type"] == 2) { |
|
49 | + $icon = $_style['actions_triangle'] . ' text-warning'; |
|
50 | + $msgtype = $_lang["warning"]; |
|
51 | + } else if($content["type"] == 3) { |
|
52 | + $icon = $_style['actions_error'] . ' text-danger'; |
|
53 | + $msgtype = $_lang["error"]; |
|
54 | + } |
|
55 | + ?> |
|
56 | 56 | <p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p> |
57 | 57 | <p> |
58 | 58 | <i class="<?= $icon ?>"></i> <?= $msgtype ?> |