@@ -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}'"; |
@@ -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 ) |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | |
288 | 288 | if( empty( $cm->new_translations ) ) |
289 | 289 | { |
290 | - //$_REQUEST['webfxtab_manage-categories-pane'] = 0; |
|
291 | - // unset( $_COOKIE['webfxtab_manage-categories-pane'] ); |
|
292 | - // setcookie('webfxtab_manage-categories-pane', 0); |
|
290 | + //$_REQUEST['webfxtab_manage-categories-pane'] = 0; |
|
291 | + // unset( $_COOKIE['webfxtab_manage-categories-pane'] ); |
|
292 | + // setcookie('webfxtab_manage-categories-pane', 0); |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | \ No newline at end of file |
@@ -1,32 +1,32 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE != "true") { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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('web_access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // find all document groups, for the select :) |
10 | 10 | $rs = $modx->db->select('*', $modx->getFullTableName('documentgroup_names'), '', 'name'); |
11 | 11 | if($modx->db->getRecordCount($rs) < 1) { |
12 | - $docgroupselector = "[no groups to add]"; |
|
12 | + $docgroupselector = "[no groups to add]"; |
|
13 | 13 | } else { |
14 | - $docgroupselector = '<select name="docgroup">' . "\n"; |
|
15 | - while($row = $modx->db->getRow($rs)) { |
|
16 | - $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
17 | - } |
|
18 | - $docgroupselector .= "</select>\n"; |
|
14 | + $docgroupselector = '<select name="docgroup">' . "\n"; |
|
15 | + while($row = $modx->db->getRow($rs)) { |
|
16 | + $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
17 | + } |
|
18 | + $docgroupselector .= "</select>\n"; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $rs = $modx->db->select('*', $modx->getFullTableName('webgroup_names'), '', 'name'); |
22 | 22 | if($modx->db->getRecordCount($rs) < 1) { |
23 | - $usrgroupselector = '[no user groups]'; |
|
23 | + $usrgroupselector = '[no user groups]'; |
|
24 | 24 | } else { |
25 | - $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
26 | - while($row = $modx->db->getRow($rs)) { |
|
27 | - $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
28 | - } |
|
29 | - $usrgroupselector .= "</select>\n"; |
|
25 | + $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
26 | + while($row = $modx->db->getRow($rs)) { |
|
27 | + $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
28 | + } |
|
29 | + $usrgroupselector .= "</select>\n"; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | ?> |
@@ -88,24 +88,24 @@ discard block |
||
88 | 88 | </form> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
91 | + $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
92 | 92 | LEFT JOIN " . $modx->getFullTableName('web_groups') . " AS groups ON groups.webgroup = groupnames.id |
93 | 93 | LEFT JOIN " . $modx->getFullTableName('web_users') . " AS users ON users.id = groups.webuser", '', 'groupnames.name, user_name'); |
94 | - if($modx->db->getRecordCount($rs) < 1) { |
|
95 | - ?> |
|
94 | + if($modx->db->getRecordCount($rs) < 1) { |
|
95 | + ?> |
|
96 | 96 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
97 | 97 | <?php |
98 | - } else { |
|
99 | - ?> |
|
98 | + } else { |
|
99 | + ?> |
|
100 | 100 | <div class="form-group"> |
101 | 101 | <?php |
102 | - $pid = ''; |
|
103 | - while($row = $modx->db->getRow($rs)) { |
|
104 | - if($pid != $row['id']) { |
|
105 | - if($pid != '') { |
|
106 | - echo '</div><div class="form-group">'; |
|
107 | - } |
|
108 | - ?> |
|
102 | + $pid = ''; |
|
103 | + while($row = $modx->db->getRow($rs)) { |
|
104 | + if($pid != $row['id']) { |
|
105 | + if($pid != '') { |
|
106 | + echo '</div><div class="form-group">'; |
|
107 | + } |
|
108 | + ?> |
|
109 | 109 | <form method="post" action="index.php" name="accesspermissions"> |
110 | 110 | <input type="hidden" name="a" value="92" /> |
111 | 111 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | </form> |
121 | 121 | <?= $_lang['web_access_permissions_users_in_group'] ?> |
122 | 122 | <?php |
123 | - } |
|
124 | - if(!$row['user_id']) { |
|
125 | - ?> |
|
123 | + } |
|
124 | + if(!$row['user_id']) { |
|
125 | + ?> |
|
126 | 126 | <i><?= $_lang['access_permissions_no_users_in_group'] ?></i> |
127 | 127 | <?php |
128 | - $pid = $row['id']; |
|
129 | - continue; |
|
130 | - } |
|
131 | - ?> |
|
128 | + $pid = $row['id']; |
|
129 | + continue; |
|
130 | + } |
|
131 | + ?> |
|
132 | 132 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=88&id=<?= $row['user_id'] ?>"><?= $row['user_name'] ?></a> |
133 | 133 | <?php |
134 | - $pid = $row['id']; |
|
135 | - } |
|
136 | - } |
|
137 | - ?> |
|
134 | + $pid = $row['id']; |
|
135 | + } |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </div> |
139 | 139 | </div> |
140 | 140 | </div> |
@@ -159,24 +159,24 @@ discard block |
||
159 | 159 | </form> |
160 | 160 | </div> |
161 | 161 | <?php |
162 | - $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names') . " AS dgnames |
|
162 | + $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names') . " AS dgnames |
|
163 | 163 | LEFT JOIN " . $modx->getFullTableName('document_groups') . " AS dg ON dg.document_group = dgnames.id |
164 | 164 | LEFT JOIN " . $modx->getFullTableName('site_content') . " AS sc ON sc.id = dg.document", '', 'dgnames.name, sc.id'); |
165 | - if($modx->db->getRecordCount($rs) < 1) { |
|
166 | - ?> |
|
165 | + if($modx->db->getRecordCount($rs) < 1) { |
|
166 | + ?> |
|
167 | 167 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
168 | 168 | <?php |
169 | - } else { |
|
170 | - ?> |
|
169 | + } else { |
|
170 | + ?> |
|
171 | 171 | <div class="form-group"> |
172 | 172 | <?php |
173 | - $pid = ''; |
|
174 | - while($row = $modx->db->getRow($rs)) { |
|
175 | - if($pid != $row['id']) { |
|
176 | - if($pid != '') { |
|
177 | - echo '</div><div class="form-group">'; |
|
178 | - } |
|
179 | - ?> |
|
173 | + $pid = ''; |
|
174 | + while($row = $modx->db->getRow($rs)) { |
|
175 | + if($pid != $row['id']) { |
|
176 | + if($pid != '') { |
|
177 | + echo '</div><div class="form-group">'; |
|
178 | + } |
|
179 | + ?> |
|
180 | 180 | <form method="post" action="index.php" name="accesspermissions"> |
181 | 181 | <input type="hidden" name="a" value="92" /> |
182 | 182 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -191,21 +191,21 @@ discard block |
||
191 | 191 | </form> |
192 | 192 | <?= $_lang['access_permissions_resources_in_group'] ?> |
193 | 193 | <?php |
194 | - } |
|
195 | - if(!$row['doc_id']) { |
|
196 | - ?> |
|
194 | + } |
|
195 | + if(!$row['doc_id']) { |
|
196 | + ?> |
|
197 | 197 | <i><?= $_lang['access_permissions_no_resources_in_group'] ?></i> |
198 | 198 | <?php |
199 | - $pid = $row['id']; |
|
200 | - continue; |
|
201 | - } |
|
202 | - ?> |
|
199 | + $pid = $row['id']; |
|
200 | + continue; |
|
201 | + } |
|
202 | + ?> |
|
203 | 203 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=3&id=<?= $row['doc_id'] ?>" title="<?= $modx->htmlspecialchars($row['doc_title']) ?>"><?= $row['doc_id'] ?></a> |
204 | 204 | <?php |
205 | - $pid = $row['id']; |
|
206 | - } |
|
207 | - } |
|
208 | - ?> |
|
205 | + $pid = $row['id']; |
|
206 | + } |
|
207 | + } |
|
208 | + ?> |
|
209 | 209 | </div> |
210 | 210 | </div> |
211 | 211 | </div> |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | <div class="container container-body"> |
218 | 218 | <p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p> |
219 | 219 | <?php |
220 | - $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
220 | + $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
221 | 221 | LEFT JOIN " . $modx->getFullTableName('webgroup_access') . " AS groupacc ON groupacc.webgroup = groupnames.id |
222 | 222 | LEFT JOIN " . $modx->getFullTableName('documentgroup_names') . " AS dgnames ON dgnames.id = groupacc.documentgroup", '', 'name, dg_name'); |
223 | - if($modx->db->getRecordCount($rs) < 1) { |
|
224 | - ?> |
|
223 | + if($modx->db->getRecordCount($rs) < 1) { |
|
224 | + ?> |
|
225 | 225 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
226 | 226 | <?php |
227 | - } else { |
|
228 | - ?> |
|
227 | + } else { |
|
228 | + ?> |
|
229 | 229 | <div class="form-group"> |
230 | 230 | <b><?= $_lang["access_permissions_group_link"] ?></b> |
231 | 231 | <form method="post" action="index.php" name="accesspermissions"> |
@@ -241,38 +241,38 @@ discard block |
||
241 | 241 | <hr> |
242 | 242 | <ul> |
243 | 243 | <?php |
244 | - $pid = ''; |
|
245 | - while($row = $modx->db->getRow($rs)) { |
|
246 | - if($row['id'] != $pid) { |
|
247 | - if($pid != '') { |
|
248 | - echo '</ul></li>'; |
|
249 | - } // close previous one |
|
250 | - ?> |
|
244 | + $pid = ''; |
|
245 | + while($row = $modx->db->getRow($rs)) { |
|
246 | + if($row['id'] != $pid) { |
|
247 | + if($pid != '') { |
|
248 | + echo '</ul></li>'; |
|
249 | + } // close previous one |
|
250 | + ?> |
|
251 | 251 | <li><b><?= $row['name'] ?></b></li> |
252 | 252 | <?php |
253 | - if(!$row['dg_id']) { |
|
254 | - echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
255 | - $pid = ''; |
|
256 | - continue; |
|
257 | - } else { |
|
258 | - echo '<ul>'; |
|
259 | - } |
|
260 | - } |
|
261 | - if(!$row['dg_id']) { |
|
262 | - continue; |
|
263 | - } |
|
264 | - ?> |
|
253 | + if(!$row['dg_id']) { |
|
254 | + echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
255 | + $pid = ''; |
|
256 | + continue; |
|
257 | + } else { |
|
258 | + echo '<ul>'; |
|
259 | + } |
|
260 | + } |
|
261 | + if(!$row['dg_id']) { |
|
262 | + continue; |
|
263 | + } |
|
264 | + ?> |
|
265 | 265 | <li><?= $row['dg_name'] ?> |
266 | 266 | <small><i>(<a class="text-danger" href="index.php?a=92&coupling=<?= $row['link_id'] ?>&operation=remove_document_group_from_user_group"><?= $_lang['remove'] ?></a>)</i></small> |
267 | 267 | </li> |
268 | 268 | <?php |
269 | - $pid = $row['id']; |
|
270 | - } |
|
271 | - ?> |
|
269 | + $pid = $row['id']; |
|
270 | + } |
|
271 | + ?> |
|
272 | 272 | </ul> |
273 | 273 | <?php |
274 | - } |
|
275 | - ?> |
|
274 | + } |
|
275 | + ?> |
|
276 | 276 | </div> |
277 | 277 | </div> |
278 | 278 |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE != "true") { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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(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,371 +85,371 @@ 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 | - $rs = $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 | + $rs = $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 | - $createdon = time(); |
|
172 | - $createdby = $modx->getLoginUserID(); |
|
173 | - if(!is_array($files)) { |
|
174 | - return; |
|
175 | - } |
|
176 | - if($_POST['object'] == 'all') { |
|
177 | - $modx->config['default_template'] = '0'; |
|
178 | - $richtext = '0'; |
|
179 | - } else { |
|
180 | - $richtext = '1'; |
|
181 | - } |
|
182 | - |
|
183 | - foreach($files as $id => $value) { |
|
184 | - if(is_array($value)) { |
|
185 | - // create folder |
|
186 | - $alias = $id; |
|
187 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
188 | - $field = array(); |
|
189 | - $field['type'] = 'document'; |
|
190 | - $field['contentType'] = 'text/html'; |
|
191 | - $field['published'] = $publish_default; |
|
192 | - $field['parent'] = $parent; |
|
193 | - $field['alias'] = $modx->stripAlias($alias); |
|
194 | - $field['richtext'] = $richtext; |
|
195 | - $field['template'] = $modx->config['default_template']; |
|
196 | - $field['searchable'] = $search_default; |
|
197 | - $field['cacheable'] = $cache_default; |
|
198 | - $field['createdby'] = $createdby; |
|
199 | - $field['isfolder'] = 1; |
|
200 | - $field['menuindex'] = 1; |
|
201 | - $find = false; |
|
202 | - foreach(array( |
|
203 | - 'index.html', |
|
204 | - 'index.htm' |
|
205 | - ) as $filename) { |
|
206 | - $filepath = $filedir . $alias . '/' . $filename; |
|
207 | - if($find === false && file_exists($filepath)) { |
|
208 | - $file = getFileContent($filepath); |
|
209 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
210 | - |
|
211 | - $date = filemtime($filepath); |
|
212 | - $field['pagetitle'] = $pagetitle; |
|
213 | - $field['longtitle'] = $pagetitle; |
|
214 | - $field['description'] = $description; |
|
215 | - $field['content'] = $modx->db->escape($content); |
|
216 | - $field['createdon'] = $date; |
|
217 | - $field['editedon'] = $date; |
|
218 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
219 | - if($newid) { |
|
220 | - $find = true; |
|
221 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
222 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
223 | - } else { |
|
224 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
225 | - exit; |
|
226 | - } |
|
227 | - } |
|
228 | - } |
|
229 | - if($find === false) { |
|
230 | - $date = time(); |
|
231 | - $field['pagetitle'] = '---'; |
|
232 | - $field['content'] = ''; |
|
233 | - $field['createdon'] = $date; |
|
234 | - $field['editedon'] = $date; |
|
235 | - $field['hidemenu'] = '1'; |
|
236 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
237 | - if($newid) { |
|
238 | - $find = true; |
|
239 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
240 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
241 | - } else { |
|
242 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
243 | - exit; |
|
244 | - } |
|
245 | - } |
|
246 | - } else { |
|
247 | - // create document |
|
248 | - if($mode == 'sub' && $value == 'index.html') { |
|
249 | - continue; |
|
250 | - } |
|
251 | - $filename = $value; |
|
252 | - $fparts = explode('.', $value); |
|
253 | - $alias = $fparts[0]; |
|
254 | - $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
255 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
256 | - |
|
257 | - if(!in_array($ext, $allowedfiles)) { |
|
258 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
259 | - } else { |
|
260 | - $filepath = $filedir . $filename; |
|
261 | - $file = getFileContent($filepath); |
|
262 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
263 | - |
|
264 | - $date = filemtime($filepath); |
|
265 | - $field = array(); |
|
266 | - $field['type'] = 'document'; |
|
267 | - $field['contentType'] = 'text/html'; |
|
268 | - $field['pagetitle'] = $pagetitle; |
|
269 | - $field['longtitle'] = $pagetitle; |
|
270 | - $field['description'] = $description; |
|
271 | - $field['alias'] = $modx->stripAlias($alias); |
|
272 | - $field['published'] = $publish_default; |
|
273 | - $field['parent'] = $parent; |
|
274 | - $field['content'] = $modx->db->escape($content); |
|
275 | - $field['richtext'] = $richtext; |
|
276 | - $field['template'] = $modx->config['default_template']; |
|
277 | - $field['searchable'] = $search_default; |
|
278 | - $field['cacheable'] = $cache_default; |
|
279 | - $field['createdby'] = $createdby; |
|
280 | - $field['createdon'] = $date; |
|
281 | - $field['editedon'] = $date; |
|
282 | - $field['isfolder'] = 0; |
|
283 | - $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
284 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
285 | - if($newid) { |
|
286 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
287 | - } else { |
|
288 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
289 | - exit; |
|
290 | - } |
|
291 | - |
|
292 | - $is_site_start = false; |
|
293 | - if($filename == 'index.html') { |
|
294 | - $is_site_start = true; |
|
295 | - } |
|
296 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
297 | - $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
298 | - $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
299 | - } |
|
300 | - } |
|
301 | - } |
|
302 | - } |
|
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 | + $createdon = time(); |
|
172 | + $createdby = $modx->getLoginUserID(); |
|
173 | + if(!is_array($files)) { |
|
174 | + return; |
|
175 | + } |
|
176 | + if($_POST['object'] == 'all') { |
|
177 | + $modx->config['default_template'] = '0'; |
|
178 | + $richtext = '0'; |
|
179 | + } else { |
|
180 | + $richtext = '1'; |
|
181 | + } |
|
182 | + |
|
183 | + foreach($files as $id => $value) { |
|
184 | + if(is_array($value)) { |
|
185 | + // create folder |
|
186 | + $alias = $id; |
|
187 | + printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
188 | + $field = array(); |
|
189 | + $field['type'] = 'document'; |
|
190 | + $field['contentType'] = 'text/html'; |
|
191 | + $field['published'] = $publish_default; |
|
192 | + $field['parent'] = $parent; |
|
193 | + $field['alias'] = $modx->stripAlias($alias); |
|
194 | + $field['richtext'] = $richtext; |
|
195 | + $field['template'] = $modx->config['default_template']; |
|
196 | + $field['searchable'] = $search_default; |
|
197 | + $field['cacheable'] = $cache_default; |
|
198 | + $field['createdby'] = $createdby; |
|
199 | + $field['isfolder'] = 1; |
|
200 | + $field['menuindex'] = 1; |
|
201 | + $find = false; |
|
202 | + foreach(array( |
|
203 | + 'index.html', |
|
204 | + 'index.htm' |
|
205 | + ) as $filename) { |
|
206 | + $filepath = $filedir . $alias . '/' . $filename; |
|
207 | + if($find === false && file_exists($filepath)) { |
|
208 | + $file = getFileContent($filepath); |
|
209 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
210 | + |
|
211 | + $date = filemtime($filepath); |
|
212 | + $field['pagetitle'] = $pagetitle; |
|
213 | + $field['longtitle'] = $pagetitle; |
|
214 | + $field['description'] = $description; |
|
215 | + $field['content'] = $modx->db->escape($content); |
|
216 | + $field['createdon'] = $date; |
|
217 | + $field['editedon'] = $date; |
|
218 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
219 | + if($newid) { |
|
220 | + $find = true; |
|
221 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
222 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
223 | + } else { |
|
224 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
225 | + exit; |
|
226 | + } |
|
227 | + } |
|
228 | + } |
|
229 | + if($find === false) { |
|
230 | + $date = time(); |
|
231 | + $field['pagetitle'] = '---'; |
|
232 | + $field['content'] = ''; |
|
233 | + $field['createdon'] = $date; |
|
234 | + $field['editedon'] = $date; |
|
235 | + $field['hidemenu'] = '1'; |
|
236 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
237 | + if($newid) { |
|
238 | + $find = true; |
|
239 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
240 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
241 | + } else { |
|
242 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
243 | + exit; |
|
244 | + } |
|
245 | + } |
|
246 | + } else { |
|
247 | + // create document |
|
248 | + if($mode == 'sub' && $value == 'index.html') { |
|
249 | + continue; |
|
250 | + } |
|
251 | + $filename = $value; |
|
252 | + $fparts = explode('.', $value); |
|
253 | + $alias = $fparts[0]; |
|
254 | + $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
255 | + printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
256 | + |
|
257 | + if(!in_array($ext, $allowedfiles)) { |
|
258 | + echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
259 | + } else { |
|
260 | + $filepath = $filedir . $filename; |
|
261 | + $file = getFileContent($filepath); |
|
262 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
263 | + |
|
264 | + $date = filemtime($filepath); |
|
265 | + $field = array(); |
|
266 | + $field['type'] = 'document'; |
|
267 | + $field['contentType'] = 'text/html'; |
|
268 | + $field['pagetitle'] = $pagetitle; |
|
269 | + $field['longtitle'] = $pagetitle; |
|
270 | + $field['description'] = $description; |
|
271 | + $field['alias'] = $modx->stripAlias($alias); |
|
272 | + $field['published'] = $publish_default; |
|
273 | + $field['parent'] = $parent; |
|
274 | + $field['content'] = $modx->db->escape($content); |
|
275 | + $field['richtext'] = $richtext; |
|
276 | + $field['template'] = $modx->config['default_template']; |
|
277 | + $field['searchable'] = $search_default; |
|
278 | + $field['cacheable'] = $cache_default; |
|
279 | + $field['createdby'] = $createdby; |
|
280 | + $field['createdon'] = $date; |
|
281 | + $field['editedon'] = $date; |
|
282 | + $field['isfolder'] = 0; |
|
283 | + $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
284 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
285 | + if($newid) { |
|
286 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
287 | + } else { |
|
288 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
289 | + exit; |
|
290 | + } |
|
291 | + |
|
292 | + $is_site_start = false; |
|
293 | + if($filename == 'index.html') { |
|
294 | + $is_site_start = true; |
|
295 | + } |
|
296 | + if($is_site_start == true && $_POST['reset'] == 'on') { |
|
297 | + $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
298 | + $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
299 | + } |
|
300 | + } |
|
301 | + } |
|
302 | + } |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | function getFiles($directory, $listing = array(), $count = 0) { |
306 | - global $_lang; |
|
307 | - global $filesfound; |
|
308 | - $dummy = $count; |
|
309 | - if($files = scandir($directory)) { |
|
310 | - foreach($files as $file) { |
|
311 | - if($file == '.' || $file == '..') { |
|
312 | - continue; |
|
313 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
314 | - closedir($h); |
|
315 | - $count = -1; |
|
316 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
317 | - } elseif(strpos($file, '.htm') !== false) { |
|
318 | - $listing[$dummy] = $file; |
|
319 | - $dummy = $dummy + 1; |
|
320 | - $filesfound++; |
|
321 | - } |
|
322 | - } |
|
323 | - } else { |
|
324 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
325 | - } |
|
326 | - return ($listing); |
|
306 | + global $_lang; |
|
307 | + global $filesfound; |
|
308 | + $dummy = $count; |
|
309 | + if($files = scandir($directory)) { |
|
310 | + foreach($files as $file) { |
|
311 | + if($file == '.' || $file == '..') { |
|
312 | + continue; |
|
313 | + } elseif($h = @opendir($directory . $file . "/")) { |
|
314 | + closedir($h); |
|
315 | + $count = -1; |
|
316 | + $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
317 | + } elseif(strpos($file, '.htm') !== false) { |
|
318 | + $listing[$dummy] = $file; |
|
319 | + $dummy = $dummy + 1; |
|
320 | + $filesfound++; |
|
321 | + } |
|
322 | + } |
|
323 | + } else { |
|
324 | + echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
325 | + } |
|
326 | + return ($listing); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | function getFileContent($filepath) { |
330 | - global $_lang; |
|
331 | - // get the file |
|
332 | - if(!$buffer = file_get_contents($filepath)) { |
|
333 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
334 | - } else { |
|
335 | - return $buffer; |
|
336 | - } |
|
330 | + global $_lang; |
|
331 | + // get the file |
|
332 | + if(!$buffer = file_get_contents($filepath)) { |
|
333 | + echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
334 | + } else { |
|
335 | + return $buffer; |
|
336 | + } |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | function pop_index($array) { |
340 | - $new_array = array(); |
|
341 | - foreach($array as $k => $v) { |
|
342 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
343 | - $new_array[$k] = $v; |
|
344 | - } else { |
|
345 | - array_unshift($new_array, $v); |
|
346 | - } |
|
347 | - } |
|
348 | - foreach($array as $k => $v) { |
|
349 | - if(is_array($v)) { |
|
350 | - $new_array[$k] = $v; |
|
351 | - } |
|
352 | - } |
|
353 | - return $new_array; |
|
340 | + $new_array = array(); |
|
341 | + foreach($array as $k => $v) { |
|
342 | + if($v !== 'index.html' && $v !== 'index.htm') { |
|
343 | + $new_array[$k] = $v; |
|
344 | + } else { |
|
345 | + array_unshift($new_array, $v); |
|
346 | + } |
|
347 | + } |
|
348 | + foreach($array as $k => $v) { |
|
349 | + if(is_array($v)) { |
|
350 | + $new_array[$k] = $v; |
|
351 | + } |
|
352 | + } |
|
353 | + return $new_array; |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | function treatContent($src, $filename, $alias) { |
357 | - global $modx; |
|
358 | - |
|
359 | - $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
360 | - |
|
361 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
362 | - $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
363 | - $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
364 | - } else { |
|
365 | - $pagetitle = $alias; |
|
366 | - } |
|
367 | - if(!$pagetitle) { |
|
368 | - $pagetitle = $alias; |
|
369 | - } |
|
370 | - |
|
371 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
372 | - $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
373 | - $description = str_replace('[*description*]', '', $description); |
|
374 | - } else { |
|
375 | - $description = ''; |
|
376 | - } |
|
377 | - |
|
378 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
379 | - $content = $matches[1]; |
|
380 | - } else { |
|
381 | - $content = $src; |
|
382 | - $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
383 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
384 | - $content = preg_replace($s, $r, $content); |
|
385 | - $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
386 | - } |
|
387 | - $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
388 | - $content = trim($content); |
|
389 | - $pagetitle = $modx->db->escape($pagetitle); |
|
390 | - return array( |
|
391 | - $pagetitle, |
|
392 | - $content, |
|
393 | - $description |
|
394 | - ); |
|
357 | + global $modx; |
|
358 | + |
|
359 | + $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
360 | + |
|
361 | + if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
362 | + $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
363 | + $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
364 | + } else { |
|
365 | + $pagetitle = $alias; |
|
366 | + } |
|
367 | + if(!$pagetitle) { |
|
368 | + $pagetitle = $alias; |
|
369 | + } |
|
370 | + |
|
371 | + if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
372 | + $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
373 | + $description = str_replace('[*description*]', '', $description); |
|
374 | + } else { |
|
375 | + $description = ''; |
|
376 | + } |
|
377 | + |
|
378 | + if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
379 | + $content = $matches[1]; |
|
380 | + } else { |
|
381 | + $content = $src; |
|
382 | + $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
383 | + $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
384 | + $content = preg_replace($s, $r, $content); |
|
385 | + $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
386 | + } |
|
387 | + $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
388 | + $content = trim($content); |
|
389 | + $pagetitle = $modx->db->escape($pagetitle); |
|
390 | + return array( |
|
391 | + $pagetitle, |
|
392 | + $content, |
|
393 | + $description |
|
394 | + ); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | function convertLink() { |
398 | - global $modx; |
|
399 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
400 | - |
|
401 | - $rs = $modx->db->select('id,content', $tbl_site_content); |
|
402 | - while($row = $modx->db->getRow($rs)) { |
|
403 | - $id = $row['id']; |
|
404 | - $array = explode('<a href=', $row['content']); |
|
405 | - $c = 0; |
|
406 | - foreach($array as $v) { |
|
407 | - if($v[0] === '"') { |
|
408 | - $v = substr($v, 1); |
|
409 | - list($href, $v) = explode('"', $v, 2); |
|
410 | - $_ = $href; |
|
411 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
412 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
413 | - } |
|
414 | - if($_[0] === '/') { |
|
415 | - $_ = substr($_, 1); |
|
416 | - } |
|
417 | - $_ = str_replace('/index.html', '.html', $_); |
|
418 | - $level = substr_count($_, '../'); |
|
419 | - if(1 < $level) { |
|
420 | - if(!isset($p[$id])) { |
|
421 | - $p[$id] = $modx->getParentIds($id); |
|
422 | - } |
|
423 | - $k = array_keys($p[$id]); |
|
424 | - while(0 < $level) { |
|
425 | - $dir = array_shift($k); |
|
426 | - $level--; |
|
427 | - } |
|
428 | - if($dir != '') { |
|
429 | - $dir .= '/'; |
|
430 | - } |
|
431 | - } else { |
|
432 | - $dir = ''; |
|
433 | - } |
|
434 | - |
|
435 | - $_ = trim($_, './'); |
|
436 | - if(strpos($_, '/') !== false) { |
|
437 | - $_ = substr($_, strrpos($_, '/')); |
|
438 | - } |
|
439 | - $_ = $dir . str_replace('.html', '', $_); |
|
440 | - if(!isset($target[$_])) { |
|
441 | - $target[$_] = $modx->getIdFromAlias($_); |
|
442 | - } |
|
443 | - $target[$_] = trim($target[$_]); |
|
444 | - if(!empty($target[$_])) { |
|
445 | - $href = '[~' . $target[$_] . '~]'; |
|
446 | - } |
|
447 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
448 | - } |
|
449 | - $c++; |
|
450 | - } |
|
451 | - $content = implode('', $array); |
|
452 | - $f['content'] = $modx->db->escape($content); |
|
453 | - $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
454 | - } |
|
398 | + global $modx; |
|
399 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
400 | + |
|
401 | + $rs = $modx->db->select('id,content', $tbl_site_content); |
|
402 | + while($row = $modx->db->getRow($rs)) { |
|
403 | + $id = $row['id']; |
|
404 | + $array = explode('<a href=', $row['content']); |
|
405 | + $c = 0; |
|
406 | + foreach($array as $v) { |
|
407 | + if($v[0] === '"') { |
|
408 | + $v = substr($v, 1); |
|
409 | + list($href, $v) = explode('"', $v, 2); |
|
410 | + $_ = $href; |
|
411 | + if(strpos($_, $modx->config['site_url']) !== false) { |
|
412 | + $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
413 | + } |
|
414 | + if($_[0] === '/') { |
|
415 | + $_ = substr($_, 1); |
|
416 | + } |
|
417 | + $_ = str_replace('/index.html', '.html', $_); |
|
418 | + $level = substr_count($_, '../'); |
|
419 | + if(1 < $level) { |
|
420 | + if(!isset($p[$id])) { |
|
421 | + $p[$id] = $modx->getParentIds($id); |
|
422 | + } |
|
423 | + $k = array_keys($p[$id]); |
|
424 | + while(0 < $level) { |
|
425 | + $dir = array_shift($k); |
|
426 | + $level--; |
|
427 | + } |
|
428 | + if($dir != '') { |
|
429 | + $dir .= '/'; |
|
430 | + } |
|
431 | + } else { |
|
432 | + $dir = ''; |
|
433 | + } |
|
434 | + |
|
435 | + $_ = trim($_, './'); |
|
436 | + if(strpos($_, '/') !== false) { |
|
437 | + $_ = substr($_, strrpos($_, '/')); |
|
438 | + } |
|
439 | + $_ = $dir . str_replace('.html', '', $_); |
|
440 | + if(!isset($target[$_])) { |
|
441 | + $target[$_] = $modx->getIdFromAlias($_); |
|
442 | + } |
|
443 | + $target[$_] = trim($target[$_]); |
|
444 | + if(!empty($target[$_])) { |
|
445 | + $href = '[~' . $target[$_] . '~]'; |
|
446 | + } |
|
447 | + $array[$c] = '<a href="' . $href . '"' . $v; |
|
448 | + } |
|
449 | + $c++; |
|
450 | + } |
|
451 | + $content = implode('', $array); |
|
452 | + $f['content'] = $modx->db->escape($content); |
|
453 | + $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
454 | + } |
|
455 | 455 | } |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE != "true") { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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 16: |
|
8 | - if(!$modx->hasPermission('edit_template')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 19: |
|
13 | - if(!$modx->hasPermission('new_template')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 16: |
|
8 | + if(!$modx->hasPermission('edit_template')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 19: |
|
13 | + if(!$modx->hasPermission('new_template')) { |
|
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 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | 26 | if($lockedEl = $modx->elementIsLocked(1, $id)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
@@ -33,23 +33,23 @@ discard block |
||
33 | 33 | |
34 | 34 | $content = array(); |
35 | 35 | if(!empty($id)) { |
36 | - $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | - $content = $modx->db->getRow($rs); |
|
38 | - if(!$content) { |
|
39 | - $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | - } |
|
41 | - |
|
42 | - $_SESSION['itemname'] = $content['templatename']; |
|
43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | - } |
|
36 | + $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | + $content = $modx->db->getRow($rs); |
|
38 | + if(!$content) { |
|
39 | + $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | + } |
|
41 | + |
|
42 | + $_SESSION['itemname'] = $content['templatename']; |
|
43 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | + } |
|
46 | 46 | } else { |
47 | - $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | - $content['category'] = intval($_REQUEST['catid']); |
|
47 | + $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | + $content['category'] = intval($_REQUEST['catid']); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if($modx->manager->hasFormValues()) { |
52 | - $modx->manager->loadFormValues(); |
|
52 | + $modx->manager->loadFormValues(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $content = array_merge($content, $_POST); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | |
99 | 99 | <form name="mutate" method="post" action="index.php"> |
100 | 100 | <?php |
101 | - // invoke OnTempFormPrerender event |
|
102 | - $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | - if(is_array($evtOut)) { |
|
104 | - echo implode("", $evtOut); |
|
105 | - } |
|
106 | - ?> |
|
101 | + // invoke OnTempFormPrerender event |
|
102 | + $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | + if(is_array($evtOut)) { |
|
104 | + echo implode("", $evtOut); |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | <input type="hidden" name="a" value="20"> |
108 | 108 | <input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>"> |
109 | 109 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | <label class="col-md-3 col-lg-2"> |
134 | 134 | <?= $_lang['template_name'] ?> |
135 | 135 | <?php if($id == $modx->config['default_template']) { |
136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | - } ?> |
|
136 | + echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | + } ?> |
|
138 | 138 | </label> |
139 | 139 | <div class="col-md-9 col-lg-10"> |
140 | 140 | <div class="form-control-name clearfix"> |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
163 | 163 | <option> </option> |
164 | 164 | <?php |
165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | - foreach(getCategories() as $n => $v) { |
|
167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | - } |
|
169 | - ?> |
|
165 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | + foreach(getCategories() as $n => $v) { |
|
167 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | </select> |
171 | 171 | </div> |
172 | 172 | </div> |
@@ -197,38 +197,38 @@ discard block |
||
197 | 197 | <input type="submit" name="save" style="display:none"> |
198 | 198 | |
199 | 199 | <?php |
200 | - $selectedTvs = array(); |
|
201 | - if(!isset($_POST['assignedTv'])) { |
|
202 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
200 | + $selectedTvs = array(); |
|
201 | + if(!isset($_POST['assignedTv'])) { |
|
202 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
205 | - ); |
|
206 | - while($row = $modx->db->getRow($rs)) { |
|
207 | - $selectedTvs[$row['tvid']] = $row; |
|
208 | - } |
|
209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | - } |
|
211 | - |
|
212 | - $unselectedTvs = array(); |
|
213 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
205 | + ); |
|
206 | + while($row = $modx->db->getRow($rs)) { |
|
207 | + $selectedTvs[$row['tvid']] = $row; |
|
208 | + } |
|
209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | + } |
|
211 | + |
|
212 | + $unselectedTvs = array(); |
|
213 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "", "category, tvcaption"); |
216 | - while($row = $modx->db->getRow($rs)) { |
|
217 | - $unselectedTvs[$row['tvid']] = $row; |
|
218 | - } |
|
219 | - |
|
220 | - // Catch checkboxes if form not validated |
|
221 | - if(isset($_POST['assignedTv'])) { |
|
222 | - $selectedTvs = array(); |
|
223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
224 | - if(isset($unselectedTvs[$tvid])) { |
|
225 | - $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | - } |
|
227 | - }; |
|
228 | - } |
|
229 | - |
|
230 | - $total = count($selectedTvs); |
|
231 | - ?> |
|
216 | + while($row = $modx->db->getRow($rs)) { |
|
217 | + $unselectedTvs[$row['tvid']] = $row; |
|
218 | + } |
|
219 | + |
|
220 | + // Catch checkboxes if form not validated |
|
221 | + if(isset($_POST['assignedTv'])) { |
|
222 | + $selectedTvs = array(); |
|
223 | + foreach($_POST['assignedTv'] as $tvid) { |
|
224 | + if(isset($unselectedTvs[$tvid])) { |
|
225 | + $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | + } |
|
227 | + }; |
|
228 | + } |
|
229 | + |
|
230 | + $total = count($selectedTvs); |
|
231 | + ?> |
|
232 | 232 | </div> |
233 | 233 | |
234 | 234 | <div class="tab-page" id="tabAssignedTVs"> |
@@ -238,65 +238,65 @@ discard block |
||
238 | 238 | |
239 | 239 | <div class="container container-body"> |
240 | 240 | <?php |
241 | - if($total > 0) { |
|
242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | - } |
|
244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | - echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | - } |
|
247 | - |
|
248 | - // Selected TVs |
|
249 | - $tvList = ''; |
|
250 | - if($total > 0) { |
|
251 | - $tvList .= '<ul>'; |
|
252 | - foreach($selectedTvs as $row) { |
|
253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
256 | - } |
|
257 | - $tvList .= '</ul>'; |
|
258 | - |
|
259 | - } else { |
|
260 | - echo $_lang['template_no_tv']; |
|
261 | - } |
|
262 | - echo $tvList; |
|
263 | - |
|
264 | - // Unselected TVs |
|
265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | - $preCat = ''; |
|
267 | - $insideUl = 0; |
|
268 | - while($row = array_shift($unselectedTvs)) { |
|
269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
270 | - continue; |
|
271 | - } // Skip selected |
|
272 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | - if($preCat !== $row['category']) { |
|
274 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | - $insideUl = 1; |
|
277 | - } |
|
278 | - |
|
279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
282 | - $tvList .= '</li>'; |
|
283 | - |
|
284 | - $preCat = $row['category']; |
|
285 | - } |
|
286 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | - $tvList .= '</ul>'; |
|
288 | - echo $tvList; |
|
289 | - |
|
290 | - ?> |
|
241 | + if($total > 0) { |
|
242 | + echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | + } |
|
244 | + if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | + echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | + } |
|
247 | + |
|
248 | + // Selected TVs |
|
249 | + $tvList = ''; |
|
250 | + if($total > 0) { |
|
251 | + $tvList .= '<ul>'; |
|
252 | + foreach($selectedTvs as $row) { |
|
253 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
256 | + } |
|
257 | + $tvList .= '</ul>'; |
|
258 | + |
|
259 | + } else { |
|
260 | + echo $_lang['template_no_tv']; |
|
261 | + } |
|
262 | + echo $tvList; |
|
263 | + |
|
264 | + // Unselected TVs |
|
265 | + $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | + $preCat = ''; |
|
267 | + $insideUl = 0; |
|
268 | + while($row = array_shift($unselectedTvs)) { |
|
269 | + if(isset($selectedTvs[$row['tvid']])) { |
|
270 | + continue; |
|
271 | + } // Skip selected |
|
272 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | + if($preCat !== $row['category']) { |
|
274 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | + $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | + $insideUl = 1; |
|
277 | + } |
|
278 | + |
|
279 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
282 | + $tvList .= '</li>'; |
|
283 | + |
|
284 | + $preCat = $row['category']; |
|
285 | + } |
|
286 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | + $tvList .= '</ul>'; |
|
288 | + echo $tvList; |
|
289 | + |
|
290 | + ?> |
|
291 | 291 | </div> |
292 | 292 | </div> |
293 | 293 | |
294 | 294 | <?php |
295 | - // invoke OnTempFormRender event |
|
296 | - $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | - if(is_array($evtOut)) { |
|
298 | - echo implode("", $evtOut); |
|
299 | - } |
|
300 | - ?> |
|
295 | + // invoke OnTempFormRender event |
|
296 | + $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | + if(is_array($evtOut)) { |
|
298 | + echo implode("", $evtOut); |
|
299 | + } |
|
300 | + ?> |
|
301 | 301 | </div> |
302 | 302 | </form> |
@@ -177,9 +177,9 @@ |
||
177 | 177 | <td colspan="2"><div class="split"></div></td> |
178 | 178 | </tr> |
179 | 179 | <?php |
180 | - // Check for GD before allowing captcha to be enabled |
|
181 | - $gdAvailable = extension_loaded('gd'); |
|
182 | - ?> |
|
180 | + // Check for GD before allowing captcha to be enabled |
|
181 | + $gdAvailable = extension_loaded('gd'); |
|
182 | + ?> |
|
183 | 183 | <?php |
184 | 184 | $gdAvailable = extension_loaded('gd'); |
185 | 185 | if(!$gdAvailable) $use_captcha = 0; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - $site_unavailable_message_view = isset($site_unavailable_message) ? $site_unavailable_message : $_lang['siteunavailable_message_default']; |
|
2 | + $site_unavailable_message_view = isset($site_unavailable_message) ? $site_unavailable_message : $_lang['siteunavailable_message_default']; |
|
3 | 3 | ?> |
4 | 4 | <style> |
5 | 5 | table.sysSettings > tbody td, table.sysSettings > tbody th {border-bottom:1px dotted #ccc;padding:10px;} |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | <?php |
136 | 136 | // Check if PHX is enabled |
137 | 137 | $count = $modx->db->getRecordCount( |
138 | - $modx->db->select('id', '[+prefix+]site_plugins', |
|
139 | - "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
|
138 | + $modx->db->select('id', '[+prefix+]site_plugins', |
|
139 | + "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
|
140 | 140 | ); |
141 | 141 | if($count) { |
142 | 142 | $disabledFilters = 1; |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | <th><?php echo $_lang['serveroffset_title'] ?><br><small>[(server_offset_time)]</small></th> |
260 | 260 | <td> <select name="server_offset_time" size="1" class="inputBox"> |
261 | 261 | <?php |
262 | - for($i=-24; $i<25; $i++) { |
|
263 | - $seconds = $i*60*60; |
|
264 | - $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
|
265 | - ?> |
|
262 | + for($i=-24; $i<25; $i++) { |
|
263 | + $seconds = $i*60*60; |
|
264 | + $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
|
265 | + ?> |
|
266 | 266 | <option value="<?php echo $seconds; ?>" <?php echo $selectedtext; ?>><?php echo $i; ?></option> |
267 | 267 | <?php |
268 | - } |
|
269 | - ?> |
|
268 | + } |
|
269 | + ?> |
|
270 | 270 | </select> |
271 | 271 | <div class="comment"><?php printf($_lang['serveroffset_message'], strftime('%H:%M:%S', time()), strftime('%H:%M:%S', time()+$server_offset_time)); ?></div> |
272 | 272 | </td> |
@@ -68,12 +68,12 @@ |
||
68 | 68 | $var = ${$name}; |
69 | 69 | $checked = ($var==$value) ? ' checked="checked"' : ''; |
70 | 70 | if($disabled) $disabled = ' disabled'; else $disabled = ''; |
71 | - if($add) $add = ' ' . $add; |
|
72 | - return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add); |
|
71 | + if($add) $add = ' ' . $add; |
|
72 | + return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | function wrap_label($str='',$object) { |
76 | - return "<label>{$object}\n{$str}</label>"; |
|
76 | + return "<label>{$object}\n{$str}</label>"; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | function parseText($tpl='', $ph=array()) { |