@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | case 'publishedon': |
39 | 39 | case 'pub_date': |
40 | 40 | case 'unpub_date': |
41 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']); |
|
41 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], 'sc.'.$_SESSION['tree_sortby']); |
|
42 | 42 | break; |
43 | 43 | default: |
44 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
44 | + $sortby = 'sc.'.$_SESSION['tree_sortby']; |
|
45 | 45 | }; |
46 | 46 | |
47 | - $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
47 | + $orderby = $modx->db->escape($sortby.' '.$_SESSION['tree_sortdir']); |
|
48 | 48 | |
49 | 49 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
50 | 50 | if ($_SESSION['tree_sortby'] == 'isfolder') { |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
59 | 59 | $showProtected = false; |
60 | 60 | if (isset ($modx->config['tree_show_protected'])) { |
61 | - $showProtected = (boolean)$modx->config['tree_show_protected']; |
|
61 | + $showProtected = (boolean) $modx->config['tree_show_protected']; |
|
62 | 62 | } |
63 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
63 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
64 | 64 | if ($showProtected == false) { |
65 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
65 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
66 | 66 | } else { |
67 | 67 | $access = ''; |
68 | 68 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
101 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
101 | + $pageIdDisplay = '<small>('.($modx_textdir ? '‏' : '').$row['id'].')</small>'; |
|
102 | 102 | |
103 | 103 | // Prepare displaying user-locks |
104 | 104 | $lockedByUser = ''; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'element_type' => $_lang["lock_element_type_7"], |
110 | 110 | 'lasthit_df' => $rowLock['lasthit_df'] |
111 | 111 | )); |
112 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
112 | + $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>'; |
|
113 | 113 | } else { |
114 | 114 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
115 | 115 | 'element_type' => $_lang["lock_element_type_7"], |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | 'lasthit_df' => $rowLock['lasthit_df'] |
118 | 118 | )); |
119 | 119 | if ($modx->hasPermission('remove_locks')) { |
120 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
120 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
121 | 121 | } else { |
122 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
122 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -128,22 +128,22 @@ discard block |
||
128 | 128 | |
129 | 129 | $title = ''; |
130 | 130 | if (isDateNode($nodeNameSource)) { |
131 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
131 | + $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]'; |
|
132 | 132 | } |
133 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
134 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
135 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
136 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
137 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
138 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
139 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
140 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
141 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
142 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
143 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
144 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
133 | + $title .= $_lang['id'].': '.$row['id']; |
|
134 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle']; |
|
135 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex']; |
|
136 | + $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-'); |
|
137 | + $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename']; |
|
138 | + $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']); |
|
139 | + $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']); |
|
140 | + $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
141 | + $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
142 | + $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
143 | + $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
144 | + $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
145 | 145 | $title = $modx->htmlspecialchars($title); |
146 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
146 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
147 | 147 | |
148 | 148 | $data = array( |
149 | 149 | 'id' => $row['id'], |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | if ($ph['contextmenu']) { |
230 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
230 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | if ($_SESSION['tree_show_only_folders']) { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | if ($ph['contextmenu']) { |
288 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
288 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | $node .= $modx->parseText($tpl, $ph); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | } |
324 | 324 | |
325 | 325 | if ($ph['contextmenu']) { |
326 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
326 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | $node .= $modx->parseText($tpl, $ph); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | if ($ph['contextmenu']) { |
377 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
377 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | $node .= $modx->parseText($tpl, $ph); |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | if ($ph['contextmenu']) { |
419 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
419 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | $node .= $modx->parseText($tpl, $ph); |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $nodetitle .= $modx->config['friendly_url_suffix']; |
494 | 494 | } |
495 | 495 | } |
496 | - $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
496 | + $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle; |
|
497 | 497 | break; |
498 | 498 | case 'pagetitle': |
499 | 499 | $nodetitle = $row['pagetitle']; |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | { |
554 | 554 | $modx = evolutionCMS(); |
555 | 555 | |
556 | - return (int)$modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
556 | + return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' ')); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
4 | 4 | } |
5 | 5 | |
6 | 6 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
9 | 9 | // seems to be a new install - send the user to the configuration page |
10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
11 | 11 | } |
@@ -16,50 +16,50 @@ discard block |
||
16 | 16 | $_SESSION['nrnewmessages'] = 0; |
17 | 17 | |
18 | 18 | // setup message info |
19 | -if($modx->hasPermission('messages')) { |
|
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
19 | +if ($modx->hasPermission('messages')) { |
|
20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
23 | 23 | |
24 | 24 | $msg = array(); |
25 | 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>)' : ''; |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
27 | 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'; |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
31 | 31 | $ph['MessageInfo'] = implode("\n", $msg); |
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
38 | 38 | } |
39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
42 | 42 | } |
43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
46 | 46 | } |
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')) { |
|
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 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
50 | 50 | } |
51 | -if($modx->hasPermission('bk_manager')) { |
|
51 | +if ($modx->hasPermission('bk_manager')) { |
|
52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
54 | 54 | } |
55 | -if($modx->hasPermission('help')) { |
|
55 | +if ($modx->hasPermission('help')) { |
|
56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
58 | 58 | } |
59 | 59 | // do some config checks |
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']) { |
|
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 | 63 | $ph['config_check_results'] = $config_check_results; |
64 | 64 | $ph['config_display'] = 'block'; |
65 | 65 | } else { |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | -if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
73 | +if (isset($_SESSION['show_logout_reminder'])) { |
|
74 | + switch ($_SESSION['show_logout_reminder']['type']) { |
|
75 | 75 | case 'logout_reminder': |
76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | </tr> |
126 | 126 | </table>'; |
127 | 127 | |
128 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
128 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
129 | 129 | |
130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
131 | 131 | 'username' => $modx->getLoginUserName(), |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | -if($modx->db->getRecordCount($rs) < 1) { |
|
143 | +if ($modx->db->getRecordCount($rs) < 1) { |
|
144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
145 | 145 | } else { |
146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
146 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now); |
149 | 149 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $userList = array(); |
169 | 169 | $userCount = array(); |
170 | 170 | // Create userlist with session-count first before output |
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
171 | + while ($activeusers = $modx->db->getRow($rs)) { |
|
172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
173 | 173 | |
174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | $currentaction |
187 | 187 | ); |
188 | 188 | } |
189 | - foreach($userList as $params) { |
|
189 | + foreach ($userList as $params) { |
|
190 | 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); |
|
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 | 192 | } |
193 | 193 | |
194 | 194 | $html .= ' |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $ph['OnlineInfo'] = $html; |
201 | 201 | |
202 | 202 | // include rss feeds for important forum topics |
203 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
203 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
204 | 204 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
205 | 205 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
206 | 206 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | -if(is_array($evtOut)) { |
|
234 | +if (is_array($evtOut)) { |
|
235 | 235 | $output = implode('', $evtOut); |
236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
237 | 237 | } |
@@ -365,57 +365,57 @@ discard block |
||
365 | 365 | |
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | -if(is_array($sitewidgets)) { |
|
368 | +if (is_array($sitewidgets)) { |
|
369 | 369 | $newwidgets = array(); |
370 | - foreach($sitewidgets as $widget){ |
|
370 | + foreach ($sitewidgets as $widget) { |
|
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
374 | 374 | } |
375 | 375 | |
376 | -usort($widgets, function ($a, $b) { |
|
376 | +usort($widgets, function($a, $b){ |
|
377 | 377 | return $a['menuindex'] - $b['menuindex']; |
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | -foreach($widgets as $widget) { |
|
383 | - if ($widget['hide'] != '1'){ |
|
382 | +foreach ($widgets as $widget) { |
|
383 | + if ($widget['hide'] != '1') { |
|
384 | 384 | $output .= $modx->parseText($tpl, $widget); |
385 | 385 | } |
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
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'; |
|
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'; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | -if(substr($target, 0, 1) === '@') { |
|
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
398 | +if (substr($target, 0, 1) === '@') { |
|
399 | + if (substr($target, 0, 6) === '@CHUNK') { |
|
400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
401 | + } elseif (substr($target, 0, 5) === '@FILE') { |
|
402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
403 | 403 | } else { |
404 | 404 | $content = ''; |
405 | 405 | } |
406 | 406 | } else { |
407 | 407 | $chunk = $modx->getChunk($target); |
408 | - if($chunk !== false && !empty($chunk)) { |
|
408 | + if ($chunk !== false && !empty($chunk)) { |
|
409 | 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 |
|
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 | 415 | { |
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
416 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
417 | 417 | } else { |
418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
418 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $content = $modx->mergeConditionalTagsContent($content); |
424 | 424 | $content = $modx->mergeSettingsContent($content); |
425 | 425 | $content = $modx->parseText($content, $ph); |
426 | -if(strpos($content, '[+') !== false) { |
|
426 | +if (strpos($content, '[+') !== false) { |
|
427 | 427 | $modx->toPlaceholders($ph); |
428 | 428 | $content = $modx->mergePlaceholderContent($content); |
429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 434 | |
435 | -if($js = $modx->getRegisteredClientScripts()) { |
|
435 | +if ($js = $modx->getRegisteredClientScripts()) { |
|
436 | 436 | $content .= $js; |
437 | 437 | } |
438 | 438 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 444 | //</span> |
445 | -function getTplWidget() { // recent document info |
|
445 | +function getTplWidget(){ // recent document info |
|
446 | 446 | return ' |
447 | 447 | <div class="[+cols+]" id="[+id+]"> |
448 | 448 | <div class="card"[+cardAttr+]> |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | '; |
454 | 454 | } |
455 | 455 | |
456 | -function getRecentInfo() { // recent document info |
|
456 | +function getRecentInfo(){ // recent document info |
|
457 | 457 | $modx = evolutionCMS(); |
458 | 458 | |
459 | 459 | $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | return $html; |
480 | 480 | } |
481 | 481 | |
482 | -function getRecentInfoList() { |
|
482 | +function getRecentInfoList(){ |
|
483 | 483 | $modx = evolutionCMS(); |
484 | 484 | |
485 | 485 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
486 | 486 | |
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
487 | + if ($modx->db->getRecordCount($rs) < 1) { |
|
488 | 488 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
489 | 489 | } |
490 | 490 | |
@@ -494,20 +494,20 @@ discard block |
||
494 | 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 | 495 | |
496 | 496 | $output = array(); |
497 | - while($ph = $modx->db->getRow($rs)) { |
|
497 | + while ($ph = $modx->db->getRow($rs)) { |
|
498 | 498 | $docid = $ph['id']; |
499 | 499 | $_ = $modx->getUserInfo($ph['editedby']); |
500 | 500 | $ph['username'] = $_['username']; |
501 | 501 | |
502 | - if($ph['deleted'] == 1) { |
|
502 | + if ($ph['deleted'] == 1) { |
|
503 | 503 | $ph['status'] = 'deleted text-danger'; |
504 | - } elseif($ph['published'] == 0) { |
|
504 | + } elseif ($ph['published'] == 0) { |
|
505 | 505 | $ph['status'] = 'unpublished font-italic text-muted'; |
506 | 506 | } else { |
507 | 507 | $ph['status'] = 'published'; |
508 | 508 | } |
509 | 509 | |
510 | - if($modx->hasPermission('edit_document')) { |
|
510 | + if ($modx->hasPermission('edit_document')) { |
|
511 | 511 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
512 | 512 | } else { |
513 | 513 | $ph['edit_btn'] = ''; |
@@ -522,8 +522,8 @@ discard block |
||
522 | 522 | $preview_disabled |
523 | 523 | ), $btntpl['preview_btn']); |
524 | 524 | |
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
525 | + if ($modx->hasPermission('delete_document')) { |
|
526 | + if ($ph['deleted'] == 0) { |
|
527 | 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 | 528 | } else { |
529 | 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> '; |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | $ph['delete_btn'] = ''; |
534 | 534 | } |
535 | 535 | |
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
536 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | 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) { |
|
538 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | 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) { |
|
540 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | 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 | 542 | } else { |
543 | 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> '; |
@@ -546,16 +546,16 @@ discard block |
||
546 | 546 | |
547 | 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 | 548 | |
549 | - if($ph['longtitle'] == '') { |
|
549 | + if ($ph['longtitle'] == '') { |
|
550 | 550 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
551 | 551 | } |
552 | - if($ph['description'] == '') { |
|
552 | + if ($ph['description'] == '') { |
|
553 | 553 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
554 | 554 | } |
555 | - if($ph['introtext'] == '') { |
|
555 | + if ($ph['introtext'] == '') { |
|
556 | 556 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
557 | 557 | } |
558 | - if($ph['alias'] == '') { |
|
558 | + if ($ph['alias'] == '') { |
|
559 | 559 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
560 | 560 | } |
561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | return implode("\n", $output); |
565 | 565 | } |
566 | 566 | |
567 | -function getRecentInfoRowTpl() { |
|
567 | +function getRecentInfoRowTpl(){ |
|
568 | 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> |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | } |
594 | 594 | |
595 | 595 | // setup icons |
596 | -function wrapIcon($i, $action) { |
|
596 | +function wrapIcon($i, $action){ |
|
597 | 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 | -function getStartUpScript() { |
|
600 | +function getStartUpScript(){ |
|
601 | 601 | $script = ' |
602 | 602 | <script type="text/javascript"> |
603 | 603 | function hideConfigCheckWarning(key) { |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('import_static')) { |
|
5 | +if (!$modx->hasPermission('import_static')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | <div class="tab-page"> |
44 | 44 | <div class="container container-body"> |
45 | 45 | <?php |
46 | - if(!isset($_POST['import'])) { |
|
47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
46 | + if (!isset($_POST['import'])) { |
|
47 | + echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>"; |
|
48 | 48 | ?> |
49 | 49 | <form action="index.php" method="post" name="importFrm"> |
50 | 50 | <input type="hidden" name="import" value="import" /> |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function run() { |
|
107 | +function run(){ |
|
108 | 108 | $modx = evolutionCMS(); global $_lang; |
109 | 109 | |
110 | 110 | $tbl_site_content = $modx->getFullTableName('site_content'); |
111 | 111 | $output = ''; |
112 | 112 | $maxtime = $_POST['maxtime']; |
113 | 113 | |
114 | - if(!is_numeric($maxtime)) { |
|
114 | + if (!is_numeric($maxtime)) { |
|
115 | 115 | $maxtime = 30; |
116 | 116 | } |
117 | 117 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | $mtime = $mtime[1] + $mtime[0]; |
123 | 123 | $importstart = $mtime; |
124 | 124 | |
125 | - if($_POST['reset'] == 'on') { |
|
125 | + if ($_POST['reset'] == 'on') { |
|
126 | 126 | $modx->db->truncate($tbl_site_content); |
127 | 127 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
128 | 128 | } |
129 | 129 | |
130 | - $parent = (int)$_POST['parent']; |
|
130 | + $parent = (int) $_POST['parent']; |
|
131 | 131 | |
132 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
133 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
134 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
135 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
132 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
133 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
134 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
135 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
136 | 136 | } else { |
137 | 137 | $filedir = ''; |
138 | 138 | } |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $files = pop_index($files); |
144 | 144 | |
145 | 145 | // no. of files to import |
146 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
146 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
147 | 147 | |
148 | 148 | // import files |
149 | - if(0 < count($files)) { |
|
149 | + if (0 < count($files)) { |
|
150 | 150 | $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
151 | 151 | importFiles($parent, $filedir, $files, 'root'); |
152 | 152 | } |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $mtime = $mtime[1] + $mtime[0]; |
157 | 157 | $importend = $mtime; |
158 | 158 | $totaltime = ($importend - $importstart); |
159 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
159 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
160 | 160 | |
161 | - if($_POST['convert_link'] == 'on') { |
|
161 | + if ($_POST['convert_link'] == 'on') { |
|
162 | 162 | convertLink(); |
163 | 163 | } |
164 | 164 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param array $files |
172 | 172 | * @param string $mode |
173 | 173 | */ |
174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
174 | +function importFiles($parent, $filedir, $files, $mode){ |
|
175 | 175 | $modx = evolutionCMS(); |
176 | 176 | global $_lang, $allowedfiles; |
177 | 177 | global $search_default, $cache_default, $publish_default; |
@@ -180,21 +180,21 @@ discard block |
||
180 | 180 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
181 | 181 | |
182 | 182 | $createdby = $modx->getLoginUserID(); |
183 | - if(!is_array($files)) { |
|
183 | + if (!is_array($files)) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | - if($_POST['object'] === 'all') { |
|
186 | + if ($_POST['object'] === 'all') { |
|
187 | 187 | $modx->config['default_template'] = '0'; |
188 | 188 | $richtext = '0'; |
189 | 189 | } else { |
190 | 190 | $richtext = '1'; |
191 | 191 | } |
192 | 192 | |
193 | - foreach($files as $id => $value) { |
|
194 | - if(is_array($value)) { |
|
193 | + foreach ($files as $id => $value) { |
|
194 | + if (is_array($value)) { |
|
195 | 195 | // create folder |
196 | 196 | $alias = $id; |
197 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
197 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
198 | 198 | $field = array(); |
199 | 199 | $field['type'] = 'document'; |
200 | 200 | $field['contentType'] = 'text/html'; |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | $field['isfolder'] = 1; |
210 | 210 | $field['menuindex'] = 1; |
211 | 211 | $find = false; |
212 | - foreach(array( |
|
212 | + foreach (array( |
|
213 | 213 | 'index.html', |
214 | 214 | 'index.htm' |
215 | 215 | ) as $filename) { |
216 | - $filepath = $filedir . $alias . '/' . $filename; |
|
217 | - if($find === false && file_exists($filepath)) { |
|
216 | + $filepath = $filedir.$alias.'/'.$filename; |
|
217 | + if ($find === false && file_exists($filepath)) { |
|
218 | 218 | $file = getFileContent($filepath); |
219 | 219 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
220 | 220 | |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | $field['createdon'] = $date; |
227 | 227 | $field['editedon'] = $date; |
228 | 228 | $newid = $modx->db->insert($field, $tbl_site_content); |
229 | - if($newid) { |
|
229 | + if ($newid) { |
|
230 | 230 | $find = true; |
231 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
232 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
231 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
232 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
233 | 233 | } else { |
234 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
234 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
235 | 235 | exit; |
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
239 | - if($find === false) { |
|
239 | + if ($find === false) { |
|
240 | 240 | $date = time(); |
241 | 241 | $field['pagetitle'] = '---'; |
242 | 242 | $field['content'] = ''; |
@@ -244,30 +244,30 @@ discard block |
||
244 | 244 | $field['editedon'] = $date; |
245 | 245 | $field['hidemenu'] = '1'; |
246 | 246 | $newid = $modx->db->insert($field, $tbl_site_content); |
247 | - if($newid) { |
|
247 | + if ($newid) { |
|
248 | 248 | $find = true; |
249 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
250 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
249 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
250 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
251 | 251 | } else { |
252 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
252 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
253 | 253 | exit; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } else { |
257 | 257 | // create document |
258 | - if($mode == 'sub' && $value == 'index.html') { |
|
258 | + if ($mode == 'sub' && $value == 'index.html') { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | $filename = $value; |
262 | 262 | $fparts = explode('.', $value); |
263 | 263 | $alias = $fparts[0]; |
264 | 264 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
265 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
265 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
266 | 266 | |
267 | - if(!in_array($ext, $allowedfiles)) { |
|
268 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
267 | + if (!in_array($ext, $allowedfiles)) { |
|
268 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
269 | 269 | } else { |
270 | - $filepath = $filedir . $filename; |
|
270 | + $filepath = $filedir.$filename; |
|
271 | 271 | $file = getFileContent($filepath); |
272 | 272 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
273 | 273 | |
@@ -292,18 +292,18 @@ discard block |
||
292 | 292 | $field['isfolder'] = 0; |
293 | 293 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
294 | 294 | $newid = $modx->db->insert($field, $tbl_site_content); |
295 | - if($newid) { |
|
296 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
295 | + if ($newid) { |
|
296 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
297 | 297 | } else { |
298 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
298 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
299 | 299 | exit; |
300 | 300 | } |
301 | 301 | |
302 | 302 | $is_site_start = false; |
303 | - if($filename == 'index.html') { |
|
303 | + if ($filename == 'index.html') { |
|
304 | 304 | $is_site_start = true; |
305 | 305 | } |
306 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
306 | + if ($is_site_start == true && $_POST['reset'] == 'on') { |
|
307 | 307 | $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
308 | 308 | $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
309 | 309 | } |
@@ -318,26 +318,26 @@ discard block |
||
318 | 318 | * @param int $count |
319 | 319 | * @return array |
320 | 320 | */ |
321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
321 | +function getFiles($directory, $listing = array(), $count = 0){ |
|
322 | 322 | global $_lang; |
323 | 323 | global $filesfound; |
324 | 324 | $dummy = $count; |
325 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
326 | - foreach($files as $file) { |
|
327 | - if($file == '.' || $file == '..') { |
|
325 | + if (!empty($directory) && $files = scandir($directory)) { |
|
326 | + foreach ($files as $file) { |
|
327 | + if ($file == '.' || $file == '..') { |
|
328 | 328 | continue; |
329 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
329 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
330 | 330 | closedir($h); |
331 | 331 | $count = -1; |
332 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
333 | - } elseif(strpos($file, '.htm') !== false) { |
|
332 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
333 | + } elseif (strpos($file, '.htm') !== false) { |
|
334 | 334 | $listing[$dummy] = $file; |
335 | 335 | $dummy = $dummy + 1; |
336 | 336 | $filesfound++; |
337 | 337 | } |
338 | 338 | } |
339 | 339 | } else { |
340 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
340 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
341 | 341 | } |
342 | 342 | return ($listing); |
343 | 343 | } |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | * @param string $filepath |
347 | 347 | * @return bool|string |
348 | 348 | */ |
349 | -function getFileContent($filepath) { |
|
349 | +function getFileContent($filepath){ |
|
350 | 350 | global $_lang; |
351 | 351 | // get the file |
352 | - if(!$buffer = file_get_contents($filepath)) { |
|
353 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
352 | + if (!$buffer = file_get_contents($filepath)) { |
|
353 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
354 | 354 | } else { |
355 | 355 | return $buffer; |
356 | 356 | } |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | * @param array $array |
361 | 361 | * @return array |
362 | 362 | */ |
363 | -function pop_index($array) { |
|
363 | +function pop_index($array){ |
|
364 | 364 | $new_array = array(); |
365 | - foreach($array as $k => $v) { |
|
366 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
365 | + foreach ($array as $k => $v) { |
|
366 | + if ($v !== 'index.html' && $v !== 'index.htm') { |
|
367 | 367 | $new_array[$k] = $v; |
368 | 368 | } else { |
369 | 369 | array_unshift($new_array, $v); |
370 | 370 | } |
371 | 371 | } |
372 | - foreach($array as $k => $v) { |
|
373 | - if(is_array($v)) { |
|
372 | + foreach ($array as $k => $v) { |
|
373 | + if (is_array($v)) { |
|
374 | 374 | $new_array[$k] = $v; |
375 | 375 | } |
376 | 376 | } |
@@ -383,34 +383,34 @@ discard block |
||
383 | 383 | * @param string $alias |
384 | 384 | * @return array |
385 | 385 | */ |
386 | -function treatContent($src, $filename, $alias) { |
|
386 | +function treatContent($src, $filename, $alias){ |
|
387 | 387 | $modx = evolutionCMS(); |
388 | 388 | |
389 | 389 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
390 | 390 | |
391 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
391 | + if (preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
392 | 392 | $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
393 | 393 | $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
394 | 394 | } else { |
395 | 395 | $pagetitle = $alias; |
396 | 396 | } |
397 | - if(!$pagetitle) { |
|
397 | + if (!$pagetitle) { |
|
398 | 398 | $pagetitle = $alias; |
399 | 399 | } |
400 | 400 | |
401 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
401 | + if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
402 | 402 | $description = ($matches[1] !== '') ? $matches[1] : $filename; |
403 | 403 | $description = str_replace('[*description*]', '', $description); |
404 | 404 | } else { |
405 | 405 | $description = ''; |
406 | 406 | } |
407 | 407 | |
408 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
408 | + if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
409 | 409 | $content = $matches[1]; |
410 | 410 | } else { |
411 | 411 | $content = $src; |
412 | 412 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
413 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
413 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
414 | 414 | $content = preg_replace($s, $r, $content); |
415 | 415 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
416 | 416 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | /** |
428 | 428 | * @return void |
429 | 429 | */ |
430 | -function convertLink() { |
|
430 | +function convertLink(){ |
|
431 | 431 | $modx = evolutionCMS(); |
432 | 432 | $tbl_site_content = $modx->getFullTableName('site_content'); |
433 | 433 | |
@@ -435,33 +435,33 @@ discard block |
||
435 | 435 | $p = array(); |
436 | 436 | $target = array(); |
437 | 437 | $dir = ''; |
438 | - while($row = $modx->db->getRow($rs)) { |
|
438 | + while ($row = $modx->db->getRow($rs)) { |
|
439 | 439 | $id = $row['id']; |
440 | 440 | $array = explode('<a href=', $row['content']); |
441 | 441 | $c = 0; |
442 | - foreach($array as $v) { |
|
443 | - if($v[0] === '"') { |
|
442 | + foreach ($array as $v) { |
|
443 | + if ($v[0] === '"') { |
|
444 | 444 | $v = substr($v, 1); |
445 | 445 | list($href, $v) = explode('"', $v, 2); |
446 | 446 | $_ = $href; |
447 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
448 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
447 | + if (strpos($_, $modx->config['site_url']) !== false) { |
|
448 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
449 | 449 | } |
450 | - if($_[0] === '/') { |
|
450 | + if ($_[0] === '/') { |
|
451 | 451 | $_ = substr($_, 1); |
452 | 452 | } |
453 | 453 | $_ = str_replace('/index.html', '.html', $_); |
454 | 454 | $level = substr_count($_, '../'); |
455 | - if(1 < $level) { |
|
456 | - if(!isset($p[$id])) { |
|
455 | + if (1 < $level) { |
|
456 | + if (!isset($p[$id])) { |
|
457 | 457 | $p[$id] = $modx->getParentIds($id); |
458 | 458 | } |
459 | 459 | $k = array_keys($p[$id]); |
460 | - while(0 < $level) { |
|
460 | + while (0 < $level) { |
|
461 | 461 | $dir = array_shift($k); |
462 | 462 | $level--; |
463 | 463 | } |
464 | - if($dir != '') { |
|
464 | + if ($dir != '') { |
|
465 | 465 | $dir .= '/'; |
466 | 466 | } |
467 | 467 | } else { |
@@ -469,18 +469,18 @@ discard block |
||
469 | 469 | } |
470 | 470 | |
471 | 471 | $_ = trim($_, './'); |
472 | - if(strpos($_, '/') !== false) { |
|
472 | + if (strpos($_, '/') !== false) { |
|
473 | 473 | $_ = substr($_, strrpos($_, '/')); |
474 | 474 | } |
475 | - $_ = $dir . str_replace('.html', '', $_); |
|
476 | - if(!isset($target[$_])) { |
|
475 | + $_ = $dir.str_replace('.html', '', $_); |
|
476 | + if (!isset($target[$_])) { |
|
477 | 477 | $target[$_] = $modx->getIdFromAlias($_); |
478 | 478 | } |
479 | 479 | $target[$_] = trim($target[$_]); |
480 | - if(!empty($target[$_])) { |
|
481 | - $href = '[~' . $target[$_] . '~]'; |
|
480 | + if (!empty($target[$_])) { |
|
481 | + $href = '[~'.$target[$_].'~]'; |
|
482 | 482 | } |
483 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
483 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
484 | 484 | } |
485 | 485 | $c++; |
486 | 486 | } |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | /********************/ |
7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
10 | -$add_path = $sd . $sb . $pg; |
|
7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
10 | +$add_path = $sd.$sb.$pg; |
|
11 | 11 | /*******************/ |
12 | 12 | |
13 | 13 | // check permissions |
14 | -switch($modx->manager->action) { |
|
14 | +switch ($modx->manager->action) { |
|
15 | 15 | case 27: |
16 | - if(!$modx->hasPermission('edit_document')) { |
|
16 | + if (!$modx->hasPermission('edit_document')) { |
|
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | 19 | break; |
20 | 20 | case 85: |
21 | 21 | case 72: |
22 | 22 | case 4: |
23 | - if(!$modx->hasPermission('new_document')) { |
|
23 | + if (!$modx->hasPermission('new_document')) { |
|
24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | 26 | // check user has permissions for parent |
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
28 | 28 | $udperms = new udperms(); |
29 | 29 | $udperms->user = $modx->getLoginUserID(); |
30 | 30 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | - if(!$udperms->checkPermissions()) { |
|
32 | + if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
39 | 39 | } |
40 | 40 | |
41 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
41 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
42 | 42 | |
43 | 43 | // Get table names (alphabetical) |
44 | 44 | $tbl_categories = $modx->getFullTableName('categories'); |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | -if($modx->manager->action == 27) { |
|
56 | +if ($modx->manager->action == 27) { |
|
57 | 57 | //editing an existing document |
58 | 58 | // check permissions on the document |
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
59 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
60 | 60 | $udperms = new udperms(); |
61 | 61 | $udperms->user = $modx->getLoginUserID(); |
62 | 62 | $udperms->document = $id; |
63 | 63 | $udperms->role = $_SESSION['mgrRole']; |
64 | 64 | |
65 | - if(!$udperms->checkPermissions()) { |
|
65 | + if (!$udperms->checkPermissions()) { |
|
66 | 66 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
71 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
72 | 72 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
73 | 73 | } |
74 | 74 | // end check for lock |
@@ -77,27 +77,27 @@ discard block |
||
77 | 77 | $modx->lockElement(7, $id); |
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | -if($_SESSION['mgrDocgroups']) { |
|
80 | +if ($_SESSION['mgrDocgroups']) { |
|
81 | 81 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
82 | 82 | } |
83 | 83 | |
84 | -if(!empty ($id)) { |
|
84 | +if (!empty ($id)) { |
|
85 | 85 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
86 | - if($docgrp) { |
|
86 | + if ($docgrp) { |
|
87 | 87 | $access .= " OR dg.document_group IN ({$docgrp})"; |
88 | 88 | } |
89 | 89 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
90 | 90 | $content = array(); |
91 | 91 | $content = $modx->db->getRow($rs); |
92 | 92 | $modx->documentObject = &$content; |
93 | - if(!$content) { |
|
93 | + if (!$content) { |
|
94 | 94 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
95 | 95 | } |
96 | 96 | $_SESSION['itemname'] = $content['pagetitle']; |
97 | 97 | } else { |
98 | 98 | $content = array(); |
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
100 | + if (isset($_REQUEST['newtemplate'])) { |
|
101 | 101 | $content['template'] = $_REQUEST['newtemplate']; |
102 | 102 | } else { |
103 | 103 | $content['template'] = getDefaultTemplate(); |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | -if(isset($_REQUEST['newtemplate'])) { |
|
111 | +if (isset($_REQUEST['newtemplate'])) { |
|
112 | 112 | $formRestored = true; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | -if($formRestored == true) { |
|
118 | +if ($formRestored == true) { |
|
119 | 119 | $content = array_merge($content, $_POST); |
120 | 120 | $content['content'] = $_POST['ta']; |
121 | - if(empty ($content['pub_date'])) { |
|
121 | + if (empty ($content['pub_date'])) { |
|
122 | 122 | unset ($content['pub_date']); |
123 | 123 | } else { |
124 | 124 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
125 | 125 | } |
126 | - if(empty ($content['unpub_date'])) { |
|
126 | + if (empty ($content['unpub_date'])) { |
|
127 | 127 | unset ($content['unpub_date']); |
128 | 128 | } else { |
129 | 129 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | -if(!isset ($_REQUEST['id'])) { |
|
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | +if (!isset ($_REQUEST['id'])) { |
|
135 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
136 | 136 | $modx->config['auto_menuindex'] = 1; |
137 | 137 | } |
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
138 | + if ($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int) $_REQUEST['pid']; |
|
140 | 140 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
141 | 141 | $content['menuindex'] = $modx->db->getValue($rs); |
142 | 142 | } else { |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -if(isset ($_POST['which_editor'])) { |
|
147 | +if (isset ($_POST['which_editor'])) { |
|
148 | 148 | $modx->config['which_editor'] = $_POST['which_editor']; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
152 | 152 | $lockElementId = $id; |
153 | 153 | $lockElementType = 7; |
154 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
154 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
155 | 155 | ?> |
156 | 156 | <script type="text/javascript"> |
157 | 157 | /* <![CDATA[ */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | }, |
182 | 182 | cancel: function() { |
183 | 183 | documentDirty = false; |
184 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
184 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
185 | 185 | }, |
186 | 186 | duplicate: function() { |
187 | 187 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | }, |
191 | 191 | view: function() { |
192 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
192 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
193 | 193 | } |
194 | 194 | }; |
195 | 195 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | 'template' => $content['template'] |
552 | 552 | )); |
553 | 553 | |
554 | - if(is_array($evtOut)) { |
|
554 | + if (is_array($evtOut)) { |
|
555 | 555 | echo implode('', $evtOut); |
556 | 556 | } |
557 | 557 | |
@@ -575,8 +575,8 @@ discard block |
||
575 | 575 | <fieldset id="create_edit"> |
576 | 576 | |
577 | 577 | <h1> |
578 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
580 | 580 | } else { |
581 | 581 | if ($modx->manager->action == '4') { |
582 | 582 | echo $_lang['add_resource']; |
@@ -592,36 +592,36 @@ discard block |
||
592 | 592 | |
593 | 593 | <?php |
594 | 594 | // breadcrumbs |
595 | - if($modx->config['use_breadcrumbs']) { |
|
595 | + if ($modx->config['use_breadcrumbs']) { |
|
596 | 596 | $temp = array(); |
597 | 597 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
598 | 598 | |
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
599 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | 600 | $bID = (int) $_REQUEST['id']; |
601 | 601 | $temp = $modx->getParentIds($bID); |
602 | - } else if(isset($_REQUEST['pid'])) { |
|
602 | + } else if (isset($_REQUEST['pid'])) { |
|
603 | 603 | $bID = (int) $_REQUEST['pid']; |
604 | 604 | $temp = $modx->getParentIds($bID); |
605 | 605 | array_unshift($temp, $bID); |
606 | 606 | } |
607 | 607 | |
608 | - if($temp) { |
|
608 | + if ($temp) { |
|
609 | 609 | $parents = implode(',', $temp); |
610 | 610 | |
611 | - if(!empty($parents)) { |
|
611 | + if (!empty($parents)) { |
|
612 | 612 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
613 | 613 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
614 | - while($row = $modx->db->getRow($rs)) { |
|
614 | + while ($row = $modx->db->getRow($rs)) { |
|
615 | 615 | $out .= '<li class="breadcrumbs__li"> |
616 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
616 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | 619 | } |
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
624 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
625 | 625 | } |
626 | 626 | ?> |
627 | 627 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
639 | 639 | 'id' => $id |
640 | 640 | )); |
641 | - if(is_array($evtOut)) { |
|
641 | + if (is_array($evtOut)) { |
|
642 | 642 | echo implode('', $evtOut); |
643 | 643 | } else { |
644 | 644 | ?> |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | </td> |
695 | 695 | </tr> |
696 | 696 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
697 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | 698 | |
699 | 699 | <tr> |
700 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -730,17 +730,17 @@ discard block |
||
730 | 730 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
731 | 731 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
732 | 732 | $currentCategory = ''; |
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + while ($row = $modx->db->getRow($rs)) { |
|
734 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | 735 | continue; |
736 | 736 | }; |
737 | 737 | // Skip if not selectable but show if selected! |
738 | 738 | $thisCategory = $row['category']; |
739 | - if($thisCategory == null) { |
|
739 | + if ($thisCategory == null) { |
|
740 | 740 | $thisCategory = $_lang["no_category"]; |
741 | 741 | } |
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
742 | + if ($thisCategory != $currentCategory) { |
|
743 | + if ($closeOptGroup) { |
|
744 | 744 | echo "\t\t\t\t\t</optgroup>\n"; |
745 | 745 | } |
746 | 746 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -749,10 +749,10 @@ discard block |
||
749 | 749 | |
750 | 750 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
752 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
753 | 753 | $currentCategory = $thisCategory; |
754 | 754 | } |
755 | - if($thisCategory != '') { |
|
755 | + if ($thisCategory != '') { |
|
756 | 756 | echo "\t\t\t\t\t</optgroup>\n"; |
757 | 757 | } |
758 | 758 | ?> |
@@ -796,20 +796,20 @@ discard block |
||
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | 798 | $parentlookup = false; |
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
799 | + if (isset ($_REQUEST['id'])) { |
|
800 | + if ($content['parent'] == 0) { |
|
801 | 801 | $parentname = $site_name; |
802 | 802 | } else { |
803 | 803 | $parentlookup = $content['parent']; |
804 | 804 | } |
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
805 | + } elseif (isset ($_REQUEST['pid'])) { |
|
806 | + if ($_REQUEST['pid'] == 0) { |
|
807 | 807 | $parentname = $site_name; |
808 | 808 | } else { |
809 | 809 | $parentlookup = $_REQUEST['pid']; |
810 | 810 | } |
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
811 | + } elseif (isset($_POST['parent'])) { |
|
812 | + if ($_POST['parent'] == 0) { |
|
813 | 813 | $parentname = $site_name; |
814 | 814 | } else { |
815 | 815 | $parentlookup = $_POST['parent']; |
@@ -818,10 +818,10 @@ discard block |
||
818 | 818 | $parentname = $site_name; |
819 | 819 | $content['parent'] = 0; |
820 | 820 | } |
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
821 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | 822 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
823 | 823 | $parentname = $modx->db->getValue($rs); |
824 | - if(!$parentname) { |
|
824 | + if (!$parentname) { |
|
825 | 825 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
826 | 826 | } |
827 | 827 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | }*/ |
864 | 864 | ?> |
865 | 865 | |
866 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
866 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
867 | 867 | <tr> |
868 | 868 | <td colspan="2"> |
869 | 869 | <hr> |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | <?php |
877 | 877 | // invoke OnRichTextEditorRegister event |
878 | 878 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + if (is_array($evtOut)) { |
|
880 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
881 | 881 | $editor = $evtOut[$i]; |
882 | 882 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
883 | 883 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
891 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | 892 | $htmlContent = $content['content']; |
893 | 893 | ?> |
894 | 894 | <div class="section-editor clearfix"> |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
902 | 902 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
903 | 903 | } else { |
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
904 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
905 | 905 | } |
906 | 906 | ?> |
907 | 907 | </div> |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | |
918 | 918 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
919 | 919 | $template = $default_template; |
920 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
920 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
921 | 921 | if (isset ($_REQUEST['newtemplate'])) { |
922 | 922 | $template = $_REQUEST['newtemplate']; |
923 | 923 | } else { |
@@ -945,10 +945,10 @@ discard block |
||
945 | 945 | ); |
946 | 946 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
947 | 947 | if ($group_tvs) { |
948 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
948 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
949 | 949 | $from .= ' |
950 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
951 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
950 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
951 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
952 | 952 | } |
953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
954 | 954 | $rs = $modx->db->select($field, $from, $where, $sort); |
@@ -957,37 +957,37 @@ discard block |
||
957 | 957 | <!-- Template Variables -->' . "\n"; |
958 | 958 | if (!$group_tvs) { |
959 | 959 | $templateVariables .= ' |
960 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
960 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
961 | 961 | <div class="sectionBody tmplvars"> |
962 | 962 | <table>'; |
963 | 963 | } else if ($group_tvs == 2) { |
964 | 964 | $templateVariables .= ' |
965 | 965 | <div class="tab-section"> |
966 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
966 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
967 | 967 | <div class="tab-pane" id="paneTemplateVariables"> |
968 | 968 | <script type="text/javascript"> |
969 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
969 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
970 | 970 | </script>'; |
971 | 971 | } else if ($group_tvs == 3) { |
972 | 972 | $templateVariables .= ' |
973 | 973 | <div id="templateVariables" class="tab-page tmplvars"> |
974 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
974 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
975 | 975 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
976 | 976 | } else if ($group_tvs == 4) { |
977 | 977 | $templateVariables .= ' |
978 | 978 | <div id="templateVariables" class="tab-page tmplvars"> |
979 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
979 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
980 | 980 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
981 | 981 | |
982 | 982 | <div class="tab-pane" id="paneTemplateVariables"> |
983 | 983 | <script type="text/javascript"> |
984 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
984 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
985 | 985 | </script>'; |
986 | 986 | } |
987 | 987 | |
988 | 988 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
989 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
990 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
989 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
990 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
991 | 991 | $i = 0; |
992 | 992 | $tab = ''; |
993 | 993 | foreach ($tvsArray as $row) { |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | if ($group_tvs == 1 || $group_tvs == 3) { |
996 | 996 | if ($i === 0) { |
997 | 997 | $templateVariables .= ' |
998 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
999 | - <div class="tab-header">' . $row['category'] . '</div> |
|
998 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
999 | + <div class="tab-header">' . $row['category'].'</div> |
|
1000 | 1000 | <div class="tab-body tmplvars"> |
1001 | 1001 | <table>' . "\n"; |
1002 | 1002 | } else { |
@@ -1005,17 +1005,17 @@ discard block |
||
1005 | 1005 | </div> |
1006 | 1006 | </div> |
1007 | 1007 | |
1008 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
1009 | - <div class="tab-header">' . $row['category'] . '</div> |
|
1008 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
1009 | + <div class="tab-header">' . $row['category'].'</div> |
|
1010 | 1010 | <div class="tab-body tmplvars"> |
1011 | 1011 | <table>'; |
1012 | 1012 | } |
1013 | 1013 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
1014 | 1014 | if ($i === 0) { |
1015 | 1015 | $templateVariables .= ' |
1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1018 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1018 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1019 | 1019 | |
1020 | 1020 | <div class="tab-body tmplvars"> |
1021 | 1021 | <table>'; |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | </div> |
1026 | 1026 | </div> |
1027 | 1027 | |
1028 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1029 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1030 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1028 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1029 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1030 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1031 | 1031 | |
1032 | 1032 | <div class="tab-body tmplvars"> |
1033 | 1033 | <table>'; |
@@ -1035,18 +1035,18 @@ discard block |
||
1035 | 1035 | } else if ($group_tvs == 5) { |
1036 | 1036 | if ($i === 0) { |
1037 | 1037 | $templateVariables .= ' |
1038 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1039 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1040 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1038 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1039 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1040 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1041 | 1041 | <table>'; |
1042 | 1042 | } else { |
1043 | 1043 | $templateVariables .= ' |
1044 | 1044 | </table> |
1045 | 1045 | </div> |
1046 | 1046 | |
1047 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1048 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1049 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1047 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1048 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1049 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1050 | 1050 | |
1051 | 1051 | <table>'; |
1052 | 1052 | } |
@@ -1064,8 +1064,8 @@ discard block |
||
1064 | 1064 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
1065 | 1065 | }; |
1066 | 1066 | // Add richtext editor to the list |
1067 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
1068 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
1067 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
1068 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
1069 | 1069 | } |
1070 | 1070 | // splitter |
1071 | 1071 | if ($group_tvs) { |
@@ -1079,24 +1079,24 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | // post back value |
1082 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
1083 | - if (is_array($_POST['tv' . $row['id']])) { |
|
1084 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
1082 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
1083 | + if (is_array($_POST['tv'.$row['id']])) { |
|
1084 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
1085 | 1085 | } else { |
1086 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
1086 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
1087 | 1087 | } |
1088 | 1088 | } else { |
1089 | 1089 | $tvPBV = $row['value']; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
1093 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
1094 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
1092 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
1093 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
1094 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
1095 | 1095 | |
1096 | 1096 | $templateVariables .= ' |
1097 | 1097 | <tr> |
1098 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
1099 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
1098 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
1099 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
1100 | 1100 | </tr>'; |
1101 | 1101 | |
1102 | 1102 | $tab = $row['category_id']; |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | <?php |
1192 | 1192 | |
1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1193 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | 1194 | ?> |
1195 | 1195 | <tr> |
1196 | 1196 | <td> |
@@ -1213,13 +1213,13 @@ discard block |
||
1213 | 1213 | <td> |
1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1215 | 1215 | <?php |
1216 | - if(!$content['contentType']) { |
|
1216 | + if (!$content['contentType']) { |
|
1217 | 1217 | $content['contentType'] = 'text/html'; |
1218 | 1218 | } |
1219 | 1219 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
1220 | 1220 | $ct = explode(",", $custom_contenttype); |
1221 | - for($i = 0; $i < count($ct); $i++) { |
|
1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1221 | + for ($i = 0; $i < count($ct); $i++) { |
|
1222 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
1223 | 1223 | } |
1224 | 1224 | ?> |
1225 | 1225 | </select> |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | </tr> |
1246 | 1246 | <?php |
1247 | 1247 | } else { |
1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1248 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | 1249 | // non-admin managers creating or editing a document resource |
1250 | 1250 | ?> |
1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1345,15 +1345,15 @@ discard block |
||
1345 | 1345 | <?php |
1346 | 1346 | /******************************* |
1347 | 1347 | * Document Access Permissions */ |
1348 | - if($use_udperms == 1) { |
|
1348 | + if ($use_udperms == 1) { |
|
1349 | 1349 | $groupsarray = array(); |
1350 | 1350 | $sql = ''; |
1351 | 1351 | |
1352 | 1352 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
1353 | - if($documentId > 0) { |
|
1353 | + if ($documentId > 0) { |
|
1354 | 1354 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1355 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1356 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
1357 | 1357 | |
1358 | 1358 | // Load up the current permissions and names |
1359 | 1359 | $vs = array( |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | // retain selected doc groups between post |
1372 | - if(isset($_POST['docgroups'])) { |
|
1372 | + if (isset($_POST['docgroups'])) { |
|
1373 | 1373 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1388,26 +1388,26 @@ discard block |
||
1388 | 1388 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
1389 | 1389 | |
1390 | 1390 | // Loop through the permissions list |
1391 | - while($row = $modx->db->getRow($rs)) { |
|
1391 | + while ($row = $modx->db->getRow($rs)) { |
|
1392 | 1392 | |
1393 | 1393 | // Create an inputValue pair (group ID and group link (if it exists)) |
1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | - $inputId = 'group-' . $row['id']; |
|
1394 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | + $inputId = 'group-'.$row['id']; |
|
1396 | 1396 | |
1397 | 1397 | $checked = in_array($inputValue, $groupsarray); |
1398 | - if($checked) { |
|
1398 | + if ($checked) { |
|
1399 | 1399 | $notPublic = true; |
1400 | 1400 | } // Mark as private access (either web or manager) |
1401 | 1401 | |
1402 | 1402 | // Skip the access permission if the user doesn't have access... |
1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1403 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | 1404 | continue; |
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // Setup attributes for this Input box |
1408 | 1408 | $inputAttributes['id'] = $inputId; |
1409 | 1409 | $inputAttributes['value'] = $inputValue; |
1410 | - if($checked) { |
|
1410 | + if ($checked) { |
|
1411 | 1411 | $inputAttributes['checked'] = 'checked'; |
1412 | 1412 | } else { |
1413 | 1413 | unset($inputAttributes['checked']); |
@@ -1415,10 +1415,10 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | // Create attribute string list |
1417 | 1417 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1418 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
1419 | 1419 | |
1420 | 1420 | // Make the <input> HTML |
1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1421 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
1422 | 1422 | |
1423 | 1423 | // does user have this permission? |
1424 | 1424 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1429,23 +1429,23 @@ discard block |
||
1429 | 1429 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
1430 | 1430 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
1431 | 1431 | $count = $modx->db->getValue($rsp); |
1432 | - if($count > 0) { |
|
1432 | + if ($count > 0) { |
|
1433 | 1433 | ++$permissions_yes; |
1434 | 1434 | } else { |
1435 | 1435 | ++$permissions_no; |
1436 | 1436 | } |
1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1437 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
1438 | 1438 | } |
1439 | 1439 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1440 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | 1441 | $permissions = array(); |
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | // See if the Access Permissions section is worth displaying... |
1445 | - if(!empty($permissions)) { |
|
1445 | + if (!empty($permissions)) { |
|
1446 | 1446 | // Add the "All Document Groups" item if we have rights in both contexts |
1447 | - if($isManager && $isWeb) { |
|
1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1447 | + if ($isManager && $isWeb) { |
|
1448 | + array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>'); |
|
1449 | 1449 | } |
1450 | 1450 | // Output the permissions list... |
1451 | 1451 | ?> |
@@ -1478,12 +1478,12 @@ discard block |
||
1478 | 1478 | </script> |
1479 | 1479 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
1480 | 1480 | <ul> |
1481 | - <?= implode("\n", $permissions) . "\n" ?> |
|
1481 | + <?= implode("\n", $permissions)."\n" ?> |
|
1482 | 1482 | </ul> |
1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
1484 | 1484 | <?php |
1485 | 1485 | } // !empty($permissions) |
1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1486 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | 1487 | ?> |
1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1489 | 1489 | <?php |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | 'template' => $content['template'] |
1504 | 1504 | )); |
1505 | 1505 | |
1506 | - if(is_array($evtOut)) { |
|
1506 | + if (is_array($evtOut)) { |
|
1507 | 1507 | echo implode('', $evtOut); |
1508 | 1508 | } |
1509 | 1509 | ?> |
@@ -1516,16 +1516,16 @@ discard block |
||
1516 | 1516 | storeCurTemplate(); |
1517 | 1517 | </script> |
1518 | 1518 | <?php |
1519 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | - if(is_array($richtexteditorIds)) { |
|
1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1519 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | + if (is_array($richtexteditorIds)) { |
|
1521 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
1522 | 1522 | // invoke OnRichTextEditorInit event |
1523 | 1523 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
1524 | 1524 | 'editor' => $editor, |
1525 | 1525 | 'elements' => $elements, |
1526 | 1526 | 'options' => $richtexteditorOptions[$editor] |
1527 | 1527 | )); |
1528 | - if(is_array($evtOut)) { |
|
1528 | + if (is_array($evtOut)) { |
|
1529 | 1529 | echo implode('', $evtOut); |
1530 | 1530 | } |
1531 | 1531 | } |
@@ -1535,37 +1535,37 @@ discard block |
||
1535 | 1535 | /** |
1536 | 1536 | * @return string |
1537 | 1537 | */ |
1538 | -function getDefaultTemplate() { |
|
1538 | +function getDefaultTemplate(){ |
|
1539 | 1539 | $modx = evolutionCMS(); |
1540 | 1540 | |
1541 | 1541 | $default_template = ''; |
1542 | - switch($modx->config['auto_template_logic']) { |
|
1542 | + switch ($modx->config['auto_template_logic']) { |
|
1543 | 1543 | case 'sibling': |
1544 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1544 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1545 | 1545 | $site_start = $modx->config['site_start']; |
1546 | 1546 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
1547 | 1547 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
1548 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1548 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1549 | 1549 | $default_template = $sibl[0]['template']; |
1550 | 1550 | } |
1551 | 1551 | } else { |
1552 | 1552 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1553 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | 1554 | $default_template = $sibl[0]['template']; |
1555 | 1555 | } else { |
1556 | 1556 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1557 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | 1558 | $default_template = $sibl[0]['template']; |
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | } |
1562 | - if(isset($default_template)) { |
|
1562 | + if (isset($default_template)) { |
|
1563 | 1563 | break; |
1564 | 1564 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
1565 | 1565 | case 'parent': |
1566 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1566 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1567 | 1567 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
1568 | - if(isset($parent['template'])) { |
|
1568 | + if (isset($parent['template'])) { |
|
1569 | 1569 | $default_template = $parent['template']; |
1570 | 1570 | } |
1571 | 1571 | } |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | $tpl = array( |
7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'), |
|
8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl') |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param array $ph |
17 | 17 | * @return string |
18 | 18 | */ |
19 | -function parsePh($tpl, $ph) { |
|
19 | +function parsePh($tpl, $ph){ |
|
20 | 20 | $modx = evolutionCMS(); global $_lang; |
21 | 21 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
22 | 22 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string|int $cssId |
27 | 27 | * @return string |
28 | 28 | */ |
29 | -function renderViewSwitchButtons($cssId) { |
|
29 | +function renderViewSwitchButtons($cssId){ |
|
30 | 30 | $modx = evolutionCMS(); global $_lang, $tpl; |
31 | 31 | |
32 | 32 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | * @param mgrResources $resources |
40 | 40 | * @return string |
41 | 41 | */ |
42 | -function createResourceList($resourceTable, $resources) { |
|
42 | +function createResourceList($resourceTable, $resources){ |
|
43 | 43 | $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir, $tpl; |
44 | 44 | |
45 | 45 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
46 | 46 | |
47 | - if( ! is_array($items) || empty($items)) { |
|
47 | + if (!is_array($items) || empty($items)) { |
|
48 | 48 | return $_lang['no_results']; |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Prepare elements- and categories-list |
52 | 52 | $elements = array(); |
53 | 53 | $categories = array(); |
54 | - foreach($items as $row) { |
|
54 | + foreach ($items as $row) { |
|
55 | 55 | $catid = $row['catid'] ? $row['catid'] : 0; |
56 | 56 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
57 | 57 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | |
60 | 60 | // Now render categories / panel-collapse |
61 | 61 | $panelGroup = ''; |
62 | - foreach($elements as $catid => $elList) { |
|
62 | + foreach ($elements as $catid => $elList) { |
|
63 | 63 | // Add panel-heading / category-collapse to output |
64 | 64 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
65 | 65 | 'tab' => $resourceTable, |
66 | 66 | 'category' => $categories[$catid]['name'], |
67 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
67 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
68 | 68 | 'catid' => $catid, |
69 | 69 | )); |
70 | 70 | |
71 | 71 | // Prepare content for panel-collapse |
72 | 72 | $panelCollapse = ''; |
73 | - foreach($elList as $el) { |
|
73 | + foreach ($elList as $el) { |
|
74 | 74 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
75 | 75 | } |
76 | 76 | |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | * @param mgrResources $resources |
93 | 93 | * @return string |
94 | 94 | */ |
95 | -function createCombinedView($resources) { |
|
95 | +function createCombinedView($resources){ |
|
96 | 96 | $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir; |
97 | 97 | |
98 | 98 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
99 | 99 | $types = isset($resources->types) ? $resources->types : false; |
100 | 100 | $categories = isset($resources->categories) ? $resources->categories : false; |
101 | 101 | |
102 | - if(!$itemsPerCategory) { |
|
102 | + if (!$itemsPerCategory) { |
|
103 | 103 | return $_lang['no_results']; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $tpl = array( |
107 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
108 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
109 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
107 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
108 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
109 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
111 | 111 | ); |
112 | 112 | |
113 | 113 | // Easily loop through $itemsPerCategory-Array |
114 | 114 | $panelGroup = ''; |
115 | - foreach($categories as $catid => $category) { |
|
115 | + foreach ($categories as $catid => $category) { |
|
116 | 116 | // Prepare collapse content / elements-list |
117 | 117 | $panelCollapse = ''; |
118 | - foreach($itemsPerCategory[$catid] as $el) { |
|
118 | + foreach ($itemsPerCategory[$catid] as $el) { |
|
119 | 119 | $resourceTable = $el['type']; |
120 | 120 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
121 | 121 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
126 | 126 | 'tab' => 'categories_list', |
127 | 127 | 'category' => $categories[$catid], |
128 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
128 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
129 | 129 | 'catid' => $catid, |
130 | 130 | )); |
131 | 131 | |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | * @param mgrResources $resources |
150 | 150 | * @return array |
151 | 151 | */ |
152 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
152 | +function prepareElementRowPh($row, $resourceTable, $resources){ |
|
153 | 153 | $modx = evolutionCMS(); global $modx_textdir, $_style, $_lang; |
154 | 154 | |
155 | 155 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
156 | 156 | |
157 | 157 | $_lang["confirm_delete"] = $_lang["delete"]; |
158 | 158 | |
159 | - switch($resourceTable){ |
|
159 | + switch ($resourceTable) { |
|
160 | 160 | case 'site_templates': |
161 | 161 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
162 | 162 | $lockElementType = 1; |
@@ -193,65 +193,65 @@ discard block |
||
193 | 193 | // Prepare displaying user-locks |
194 | 194 | $lockedByUser = ''; |
195 | 195 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
196 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | - if($rowLock['sid'] == $modx->sid) { |
|
196 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | + if ($rowLock['sid'] == $modx->sid) { |
|
198 | 198 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
199 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
199 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
200 | 200 | 'lasthit_df' => $rowLock['lasthit_df'] |
201 | 201 | )); |
202 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
202 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
203 | 203 | } else { |
204 | 204 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
205 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
205 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
206 | 206 | 'username' => $rowLock['username'], |
207 | 207 | 'lasthit_df' => $rowLock['lasthit_df'] |
208 | 208 | )); |
209 | - if($modx->hasPermission('remove_locks')) { |
|
210 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
209 | + if ($modx->hasPermission('remove_locks')) { |
|
210 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>'; |
|
211 | 211 | } else { |
212 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
212 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - if($lockedByUser) { |
|
217 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
216 | + if ($lockedByUser) { |
|
217 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // Caption |
221 | - if($resourceTable == 'site_tmplvars') { |
|
222 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
221 | + if ($resourceTable == 'site_tmplvars') { |
|
222 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption']; |
|
223 | 223 | } else { |
224 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
224 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Special marks |
228 | 228 | $tplInfo = array(); |
229 | - if($row['locked']) { |
|
229 | + if ($row['locked']) { |
|
230 | 230 | $tplInfo[] = $_lang['locked']; |
231 | 231 | } |
232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
232 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | 233 | $tplInfo[] = $_lang['defaulttemplate_title']; |
234 | 234 | } |
235 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
235 | + $marks = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : ''; |
|
236 | 236 | |
237 | 237 | /* row buttons */ |
238 | 238 | $buttons = ''; |
239 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
239 | + if ($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | + $buttons .= '<li><a title="'.$_lang["edit_resource"].'" href="index.php?a='.$types['actions']['edit'][0].'&id='.$row['id'].'"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
241 | 241 | } |
242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
242 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_duplicate_record"].'\')" title="'.$_lang["resource_duplicate"].'" href="index.php?a='.$types['actions']['duplicate'][0].'&id='.$row['id'].'"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
244 | 244 | } |
245 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
245 | + if ($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_delete"].'\')" title="'.$_lang["delete"].'" href="index.php?a='.$types['actions']['remove'][0].'&id='.$row['id'].'"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
247 | 247 | } |
248 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
248 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
249 | 249 | |
250 | 250 | $catid = $row['catid'] ? $row['catid'] : 0; |
251 | 251 | |
252 | 252 | // Placeholders for elements-row |
253 | 253 | return array( |
254 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
254 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
255 | 255 | 'lockedByUser' => $lockedByUser, |
256 | 256 | 'name' => $row['name'], |
257 | 257 | 'caption' => $caption, |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -class mgrResources { |
|
6 | +class mgrResources{ |
|
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * mgrResources constructor. |
26 | 26 | */ |
27 | - public function __construct() { |
|
27 | + public function __construct(){ |
|
28 | 28 | $this->setTypes(); |
29 | 29 | $this->queryItemsFromDB(); |
30 | 30 | $this->prepareCategoryArrays(); |
@@ -33,47 +33,47 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function setTypes() { |
|
36 | + public function setTypes(){ |
|
37 | 37 | global $_lang; |
38 | - $this->types['site_templates'] = array( |
|
38 | + $this->types['site_templates'] = array( |
|
39 | 39 | 'title'=>$_lang["manage_templates"], |
40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | - 'permissions'=>array('new_template','edit_template'), |
|
40 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
41 | + 'permissions'=>array('new_template', 'edit_template'), |
|
42 | 42 | 'name'=>'templatename' |
43 | 43 | ); |
44 | - $this->types['site_tmplvars'] = array( |
|
44 | + $this->types['site_tmplvars'] = array( |
|
45 | 45 | 'title'=>$_lang["tmplvars"], |
46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | - 'permissions'=>array('new_template','edit_template'), |
|
46 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
47 | + 'permissions'=>array('new_template', 'edit_template'), |
|
48 | 48 | ); |
49 | 49 | $this->types['site_htmlsnippets'] = array( |
50 | 50 | 'title'=>$_lang["manage_htmlsnippets"], |
51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
51 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
52 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
53 | 53 | ); |
54 | - $this->types['site_snippets'] = array( |
|
54 | + $this->types['site_snippets'] = array( |
|
55 | 55 | 'title'=>$_lang["manage_snippets"], |
56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
56 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
57 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
58 | 58 | ); |
59 | - $this->types['site_plugins'] = array( |
|
59 | + $this->types['site_plugins'] = array( |
|
60 | 60 | 'title'=>$_lang["manage_plugins"], |
61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
61 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
62 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
63 | 63 | ); |
64 | - $this->types['site_modules'] = array( |
|
64 | + $this->types['site_modules'] = array( |
|
65 | 65 | 'title'=>$_lang["manage_modules"], |
66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | - 'permissions'=>array('new_module','edit_module'), |
|
66 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
67 | + 'permissions'=>array('new_module', 'edit_module'), |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return void |
73 | 73 | */ |
74 | - public function queryItemsFromDB() { |
|
75 | - foreach($this->types as $resourceTable=>$type) { |
|
76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
74 | + public function queryItemsFromDB(){ |
|
75 | + foreach ($this->types as $resourceTable=>$type) { |
|
76 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
77 | 77 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
78 | 78 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @param array $permissions |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - public function hasAnyPermissions($permissions) { |
|
87 | + public function hasAnyPermissions($permissions){ |
|
88 | 88 | $modx = evolutionCMS(); |
89 | 89 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
90 | + foreach ($permissions as $p) |
|
91 | + if ($modx->hasPermission($p)) return true; |
|
92 | 92 | |
93 | 93 | return false; |
94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $nameField |
99 | 99 | * @return array|bool |
100 | 100 | */ |
101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
101 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
102 | 102 | $modx = evolutionCMS(); global $_lang; |
103 | 103 | |
104 | 104 | $allowed = array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'site_plugins', |
108 | 108 | 'site_modules' |
109 | 109 | ); |
110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
111 | 111 | |
112 | 112 | $tvsql = ''; |
113 | 113 | $tvjoin = ''; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | |
123 | 123 | $rs = $modx->db->select( |
124 | 124 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
126 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
125 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
126 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
127 | 127 | "", |
128 | 128 | "category,name" |
129 | 129 | ); |
130 | 130 | $limit = $modx->db->getRecordCount($rs); |
131 | 131 | |
132 | - if($limit < 1) return false; |
|
132 | + if ($limit < 1) return false; |
|
133 | 133 | |
134 | 134 | $result = array(); |
135 | 135 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - public function prepareCategoryArrays() { |
|
145 | - foreach($this->items as $type=>$items) { |
|
146 | - foreach((array)$items as $item) { |
|
144 | + public function prepareCategoryArrays(){ |
|
145 | + foreach ($this->items as $type=>$items) { |
|
146 | + foreach ((array) $items as $item) { |
|
147 | 147 | $catid = $item['catid'] ? $item['catid'] : 0; |
148 | 148 | $this->categories[$catid] = $item['category']; |
149 | 149 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | natcasesort($this->categories); |
157 | 157 | |
158 | 158 | // Now sort by name |
159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
159 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
160 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
161 | 161 | return strcasecmp($a['name'], $b['name']); |
162 | 162 | }); |
163 | 163 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -switch((int) $modx->manager->action) { |
|
6 | +switch ((int) $modx->manager->action) { |
|
7 | 7 | case 35: |
8 | - if(!$modx->hasPermission('edit_role')) { |
|
8 | + if (!$modx->hasPermission('edit_role')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 38: |
13 | - if(!$modx->hasPermission('new_role')) { |
|
13 | + if (!$modx->hasPermission('new_role')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_user_roles = $modx->getFullTableName('user_roles'); |
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | -if($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
26 | +if ($lockedEl = $modx->elementIsLocked(8, $role)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
28 | 28 | } |
29 | 29 | // end check for lock |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | // Lock snippet for other users to edit |
32 | 32 | $modx->lockElement(8, $role); |
33 | 33 | |
34 | -if($modx->manager->action == '35') { |
|
34 | +if ($modx->manager->action == '35') { |
|
35 | 35 | $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
36 | 36 | $roledata = $modx->db->getRow($rs); |
37 | - if(!$roledata) { |
|
37 | + if (!$roledata) { |
|
38 | 38 | $modx->webAlertAndQuit("No role returned!"); |
39 | 39 | } |
40 | 40 | $_SESSION['itemname'] = $roledata['name']; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Add lock-element JS-Script |
47 | 47 | $lockElementId = $role; |
48 | 48 | $lockElementType = 8; |
49 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
49 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
50 | 50 | ?> |
51 | 51 | <script type="text/javascript"> |
52 | 52 | function changestate(element) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <input type="hidden" name="id" value="<?= $_GET['id'] ?>"> |
83 | 83 | |
84 | 84 | <h1> |
85 | - <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?> |
|
85 | + <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?> |
|
86 | 86 | </h1> |
87 | 87 | |
88 | 88 | <?= $_style['actionbuttons']['dynamic']['savedelete'] ?> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param string $status |
300 | 300 | * @return string |
301 | 301 | */ |
302 | -function render_form($name, $label, $status = '') { |
|
302 | +function render_form($name, $label, $status = ''){ |
|
303 | 303 | $modx = evolutionCMS(); global $roledata; |
304 | 304 | |
305 | 305 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
312 | 312 | $value = ($roledata[$name] == 1) ? 1 : 0; |
313 | - if($status == 'disabled') { |
|
313 | + if ($status == 'disabled') { |
|
314 | 314 | $checked = 'checked'; |
315 | 315 | $value = 1; |
316 | 316 | $set = 'fix'; |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | * @param array $tvsArray |
13 | 13 | * @return string |
14 | 14 | */ |
15 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
15 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()){ |
|
16 | 16 | $modx = evolutionCMS(); |
17 | 17 | global $_style; |
18 | 18 | global $_lang; |
19 | 19 | global $content; |
20 | 20 | global $which_browser; |
21 | 21 | |
22 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
22 | + if (substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
23 | 23 | $eval_str = trim(substr($default_text, 7)); |
24 | 24 | $default_text = eval($eval_str); |
25 | 25 | $field_value = $default_text; |
@@ -27,74 +27,74 @@ discard block |
||
27 | 27 | |
28 | 28 | $field_html = ''; |
29 | 29 | $cimode = strpos($field_type, ':'); |
30 | - if($cimode === false) { |
|
31 | - switch($field_type) { |
|
30 | + if ($cimode === false) { |
|
31 | + switch ($field_type) { |
|
32 | 32 | |
33 | 33 | case "text": // handler for regular text boxes |
34 | 34 | case "rawtext"; // non-htmlentity converted text boxes |
35 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
35 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />'; |
|
36 | 36 | break; |
37 | 37 | case "email": // handles email input fields |
38 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
38 | + $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>'; |
|
39 | 39 | break; |
40 | 40 | case "number": // handles the input of numbers |
41 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
41 | + $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
42 | 42 | break; |
43 | 43 | case "textareamini": // handler for textarea mini boxes |
44 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
44 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
45 | 45 | break; |
46 | 46 | case "textarea": // handler for textarea boxes |
47 | 47 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
48 | 48 | case "htmlarea": // handler for textarea boxes (deprecated) |
49 | 49 | case "richtext": // handler for textarea boxes |
50 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
50 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
51 | 51 | break; |
52 | 52 | case "date": |
53 | 53 | $field_id = str_replace(array( |
54 | 54 | '-', |
55 | 55 | '.' |
56 | 56 | ), '_', urldecode($field_id)); |
57 | - if($field_value == '') { |
|
57 | + if ($field_value == '') { |
|
58 | 58 | $field_value = 0; |
59 | 59 | } |
60 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
61 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
60 | + $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />'; |
|
61 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>'; |
|
62 | 62 | |
63 | 63 | break; |
64 | 64 | case "dropdown": // handler for select boxes |
65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
65 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
66 | 66 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
67 | + while (list($item, $itemvalue) = each($index_list)) { |
|
68 | 68 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
69 | - if(strlen($itemvalue) == 0) { |
|
69 | + if (strlen($itemvalue) == 0) { |
|
70 | 70 | $itemvalue = $item; |
71 | 71 | } |
72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
72 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
73 | 73 | } |
74 | 74 | $field_html .= "</select>"; |
75 | 75 | break; |
76 | 76 | case "listbox": // handler for select boxes |
77 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
77 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
78 | 78 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
79 | - while(list($item, $itemvalue) = each($index_list)) { |
|
79 | + while (list($item, $itemvalue) = each($index_list)) { |
|
80 | 80 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
81 | - if(strlen($itemvalue) == 0) { |
|
81 | + if (strlen($itemvalue) == 0) { |
|
82 | 82 | $itemvalue = $item; |
83 | 83 | } |
84 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
84 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
85 | 85 | } |
86 | 86 | $field_html .= "</select>"; |
87 | 87 | break; |
88 | 88 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
89 | 89 | $field_value = explode("||", $field_value); |
90 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
90 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
91 | 91 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
92 | - while(list($item, $itemvalue) = each($index_list)) { |
|
92 | + while (list($item, $itemvalue) = each($index_list)) { |
|
93 | 93 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
94 | - if(strlen($itemvalue) == 0) { |
|
94 | + if (strlen($itemvalue) == 0) { |
|
95 | 95 | $itemvalue = $item; |
96 | 96 | } |
97 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
97 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
98 | 98 | } |
99 | 99 | $field_html .= "</select>"; |
100 | 100 | break; |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | 'ftp://' => 'ftp://', |
107 | 107 | 'mailto:' => 'mailto:' |
108 | 108 | ); |
109 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
110 | - foreach($urls as $k => $v) { |
|
111 | - if(strpos($field_value, $v) === false) { |
|
112 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
109 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">'; |
|
110 | + foreach ($urls as $k => $v) { |
|
111 | + if (strpos($field_value, $v) === false) { |
|
112 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
113 | 113 | } else { |
114 | 114 | $field_value = str_replace($v, '', $field_value); |
115 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
115 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | $field_html .= '</select></td><td>'; |
119 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
119 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>'; |
|
120 | 120 | break; |
121 | 121 | case 'checkbox': // handles check boxes |
122 | 122 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
125 | 125 | static $i = 0; |
126 | 126 | $_ = array(); |
127 | - foreach($index_list as $c => $item) { |
|
128 | - if(is_array($item)) { |
|
127 | + foreach ($index_list as $c => $item) { |
|
128 | + if (is_array($item)) { |
|
129 | 129 | $name = trim($item[0]); |
130 | 130 | $value = isset($item[1]) ? $item[1] : $name; |
131 | 131 | } else { |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | case "option": // handles radio buttons |
152 | 152 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
153 | 153 | static $i = 0; |
154 | - while(list($item, $itemvalue) = each($index_list)) { |
|
154 | + while (list($item, $itemvalue) = each($index_list)) { |
|
155 | 155 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
156 | - if(strlen($itemvalue) == 0) { |
|
156 | + if (strlen($itemvalue) == 0) { |
|
157 | 157 | $itemvalue = $item; |
158 | 158 | } |
159 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
159 | + $field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />'; |
|
160 | 160 | $i++; |
161 | 161 | } |
162 | 162 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | global $_lang; |
165 | 165 | global $ResourceManagerLoaded; |
166 | 166 | global $content, $use_editor, $which_editor; |
167 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
167 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
168 | 168 | $field_html .= " |
169 | 169 | <script type=\"text/javascript\"> |
170 | 170 | /* <![CDATA[ */ |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | lastImageCtrl = ctrl; |
187 | 187 | var w = screen.width * 0.5; |
188 | 188 | var h = screen.height * 0.5; |
189 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
189 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
190 | 190 | } |
191 | 191 | function BrowseFileServer(ctrl) { |
192 | 192 | lastFileCtrl = ctrl; |
193 | 193 | var w = screen.width * 0.5; |
194 | 194 | var h = screen.height * 0.5; |
195 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
195 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
196 | 196 | } |
197 | 197 | function SetUrlChange(el) { |
198 | 198 | if ('createEvent' in document) { |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | </script>"; |
227 | 227 | $ResourceManagerLoaded = true; |
228 | 228 | } |
229 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
229 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />'; |
|
230 | 230 | break; |
231 | 231 | case "file": // handles the input of file uploads |
232 | 232 | /* Modified by Timon for use with resource browser */ |
233 | 233 | global $_lang; |
234 | 234 | global $ResourceManagerLoaded; |
235 | 235 | global $content, $use_editor, $which_editor; |
236 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
236 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
237 | 237 | /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
238 | 238 | $field_html .= " |
239 | 239 | <script type=\"text/javascript\"> |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | lastImageCtrl = ctrl; |
257 | 257 | var w = screen.width * 0.5; |
258 | 258 | var h = screen.height * 0.5; |
259 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
259 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
260 | 260 | } |
261 | 261 | function BrowseFileServer(ctrl) { |
262 | 262 | lastFileCtrl = ctrl; |
263 | 263 | var w = screen.width * 0.5; |
264 | 264 | var h = screen.height * 0.5; |
265 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
265 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
266 | 266 | } |
267 | 267 | function SetUrlChange(el) { |
268 | 268 | if ('createEvent' in document) { |
@@ -296,39 +296,39 @@ discard block |
||
296 | 296 | </script>"; |
297 | 297 | $ResourceManagerLoaded = true; |
298 | 298 | } |
299 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
299 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />'; |
|
300 | 300 | |
301 | 301 | break; |
302 | 302 | |
303 | 303 | case 'custom_tv': |
304 | 304 | $custom_output = ''; |
305 | 305 | /* If we are loading a file */ |
306 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
307 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
308 | - if(!file_exists($file_name)) { |
|
309 | - $custom_output = $file_name . ' does not exist'; |
|
306 | + if (substr($field_elements, 0, 5) == "@FILE") { |
|
307 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
308 | + if (!file_exists($file_name)) { |
|
309 | + $custom_output = $file_name.' does not exist'; |
|
310 | 310 | } else { |
311 | 311 | $custom_output = file_get_contents($file_name); |
312 | 312 | } |
313 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
315 | - if(!file_exists($file_name)) { |
|
316 | - $custom_output = $file_name . ' does not exist'; |
|
313 | + } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
315 | + if (!file_exists($file_name)) { |
|
316 | + $custom_output = $file_name.' does not exist'; |
|
317 | 317 | } else { |
318 | 318 | ob_start(); |
319 | 319 | include $file_name; |
320 | 320 | $custom_output = ob_get_contents(); |
321 | 321 | ob_end_clean(); |
322 | 322 | } |
323 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
323 | + } elseif (substr($field_elements, 0, 6) == "@CHUNK") { |
|
324 | 324 | $chunk_name = trim(substr($field_elements, 7)); |
325 | 325 | $chunk_body = $modx->getChunk($chunk_name); |
326 | - if($chunk_body == false) { |
|
327 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
326 | + if ($chunk_body == false) { |
|
327 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
328 | 328 | } else { |
329 | 329 | $custom_output = $chunk_body; |
330 | 330 | } |
331 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
331 | + } elseif (substr($field_elements, 0, 5) == "@EVAL") { |
|
332 | 332 | $eval_str = trim(substr($field_elements, 6)); |
333 | 333 | $custom_output = eval($eval_str); |
334 | 334 | } else { |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | break; |
350 | 350 | |
351 | 351 | default: // the default handler -- for errors, mostly |
352 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
352 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
353 | 353 | |
354 | 354 | } // end switch statement |
355 | 355 | } else { |
356 | 356 | $custom = explode(":", $field_type); |
357 | 357 | $custom_output = ''; |
358 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
359 | - if(!file_exists($file_name)) { |
|
360 | - $custom_output = $file_name . ' does not exist'; |
|
358 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
359 | + if (!file_exists($file_name)) { |
|
360 | + $custom_output = $file_name.' does not exist'; |
|
361 | 361 | } else { |
362 | 362 | ob_start(); |
363 | 363 | include $file_name; |
@@ -384,13 +384,13 @@ discard block |
||
384 | 384 | * @param string|array|mysqli_result $v |
385 | 385 | * @return array |
386 | 386 | */ |
387 | -function ParseIntputOptions($v) { |
|
387 | +function ParseIntputOptions($v){ |
|
388 | 388 | $modx = evolutionCMS(); |
389 | 389 | $a = array(); |
390 | - if(is_array($v)) { |
|
390 | + if (is_array($v)) { |
|
391 | 391 | return $v; |
392 | - } else if($modx->db->isResult($v)) { |
|
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
392 | + } else if ($modx->db->isResult($v)) { |
|
393 | + while ($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
394 | 394 | } else { |
395 | 395 | $a = explode("||", $v); |
396 | 396 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $modx->getSettings(); |
6 | 6 | $modx->invokeEvent('OnWebPageInit'); |
7 | 7 | |
8 | -$vword = new VeriWord(148,60); |
|
8 | +$vword = new VeriWord(148, 60); |
|
9 | 9 | $vword->output_image(); |
10 | 10 | $vword->destroy_image(); |
11 | 11 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ## see sample.php for test and usage |
42 | 42 | ## sample URL: http://www.program-ruti.org/veriword/ |
43 | 43 | #### |
44 | -class VeriWord { |
|
44 | +class VeriWord{ |
|
45 | 45 | |
46 | 46 | /* path to font directory*/ |
47 | 47 | public $dir_font = "ttf/"; |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | public $im_height = 0; |
53 | 53 | public $im; |
54 | 54 | |
55 | - public function __construct($w=200, $h=80) { |
|
55 | + public function __construct($w = 200, $h = 80){ |
|
56 | 56 | /* create session to set word for verification */ |
57 | 57 | $this->set_veriword(); |
58 | - $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
|
58 | + $this->dir_font = dirname(__FILE__).'/'.$this->dir_font; |
|
59 | 59 | $this->im_width = $w; |
60 | 60 | $this->im_height = $h; |
61 | 61 | } |
62 | 62 | |
63 | - public function set_veriword() { |
|
63 | + public function set_veriword(){ |
|
64 | 64 | /* create session variable for verification, |
65 | 65 | you may change the session variable name */ |
66 | 66 | $this->word = $this->pick_word(); |
67 | 67 | $_SESSION['veriword'] = $this->word; |
68 | 68 | } |
69 | 69 | |
70 | - public function output_image() { |
|
70 | + public function output_image(){ |
|
71 | 71 | /* output the image as jpeg */ |
72 | 72 | $this->draw_image(); |
73 | 73 | header("Content-type: image/jpeg"); |
74 | 74 | imagejpeg($this->im); |
75 | 75 | } |
76 | 76 | |
77 | - public function pick_word() { |
|
77 | + public function pick_word(){ |
|
78 | 78 | $modx = evolutionCMS(); |
79 | 79 | // set default words |
80 | - $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
80 | + $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
81 | 81 | $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words; |
82 | 82 | $arr_words = array_filter(array_map('trim', explode(',', $words))); |
83 | 83 | |
84 | 84 | /* pick one randomly for text verification */ |
85 | - return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
|
85 | + return (string) $arr_words[array_rand($arr_words)].rand(10, 999); |
|
86 | 86 | } |
87 | 87 | |
88 | - public function draw_text() { |
|
88 | + public function draw_text(){ |
|
89 | 89 | $dir = dir($this->dir_font); |
90 | 90 | $fontstmp = array(); |
91 | 91 | while (false !== ($file = $dir->read())) { |
92 | - if(substr($file, -4) == '.ttf') { |
|
92 | + if (substr($file, -4) == '.ttf') { |
|
93 | 93 | $fontstmp[] = $this->dir_font.$file; |
94 | 94 | } |
95 | 95 | } |
@@ -97,35 +97,35 @@ discard block |
||
97 | 97 | $text_font = (string) $fontstmp[array_rand($fontstmp)]; |
98 | 98 | |
99 | 99 | /* angle for text inclination */ |
100 | - $text_angle = rand(-9,9); |
|
100 | + $text_angle = rand(-9, 9); |
|
101 | 101 | /* initial text size */ |
102 | 102 | $text_size = 30; |
103 | 103 | /* calculate text width and height */ |
104 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
105 | - $text_width = $box[2]-$box[0]; //text width |
|
106 | - $text_height= $box[5]-$box[3]; //text height |
|
104 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
105 | + $text_width = $box[2] - $box[0]; //text width |
|
106 | + $text_height = $box[5] - $box[3]; //text height |
|
107 | 107 | |
108 | 108 | /* adjust text size */ |
109 | - $text_size = round((20 * $this->im_width)/$text_width); |
|
109 | + $text_size = round((20 * $this->im_width) / $text_width); |
|
110 | 110 | |
111 | 111 | /* recalculate text width and height */ |
112 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
113 | - $text_width = $box[2]-$box[0]; //text width |
|
114 | - $text_height= $box[5]-$box[3]; //text height |
|
112 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
113 | + $text_width = $box[2] - $box[0]; //text width |
|
114 | + $text_height = $box[5] - $box[3]; //text height |
|
115 | 115 | |
116 | 116 | /* calculate center position of text */ |
117 | - $text_x = ($this->im_width - $text_width)/2; |
|
118 | - $text_y = ($this->im_height - $text_height)/2; |
|
117 | + $text_x = ($this->im_width - $text_width) / 2; |
|
118 | + $text_y = ($this->im_height - $text_height) / 2; |
|
119 | 119 | |
120 | 120 | /* create canvas for text drawing */ |
121 | - $im_text = imagecreate ($this->im_width, $this->im_height); |
|
122 | - $bg_color = imagecolorallocate ($im_text, 255, 255, 255); |
|
121 | + $im_text = imagecreate($this->im_width, $this->im_height); |
|
122 | + $bg_color = imagecolorallocate($im_text, 255, 255, 255); |
|
123 | 123 | |
124 | 124 | /* pick color for text */ |
125 | - $text_color = imagecolorallocate ($im_text, 0, 51, 153); |
|
125 | + $text_color = imagecolorallocate($im_text, 0, 51, 153); |
|
126 | 126 | |
127 | 127 | /* draw text into canvas */ |
128 | - imagettftext ( $im_text, |
|
128 | + imagettftext($im_text, |
|
129 | 129 | $text_size, |
130 | 130 | $text_angle, |
131 | 131 | $text_x, |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - public function draw_image() { |
|
143 | + public function draw_image(){ |
|
144 | 144 | |
145 | 145 | /* pick one background image randomly from image directory */ |
146 | - $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
|
146 | + $img_file = $this->dir_noise."noise".rand(1, 4).".jpg"; |
|
147 | 147 | |
148 | 148 | /* create "noise" background image from your image stock*/ |
149 | - $noise_img = @imagecreatefromjpeg ($img_file); |
|
149 | + $noise_img = @imagecreatefromjpeg($img_file); |
|
150 | 150 | $noise_width = imagesx($noise_img); |
151 | 151 | $noise_height = imagesy($noise_img); |
152 | 152 | |
153 | 153 | /* resize the background image to fit the size of image output */ |
154 | - $this->im = imagecreatetruecolor($this->im_width,$this->im_height); |
|
155 | - imagecopyresampled ($this->im, |
|
154 | + $this->im = imagecreatetruecolor($this->im_width, $this->im_height); |
|
155 | + imagecopyresampled($this->im, |
|
156 | 156 | $noise_img, |
157 | 157 | 0, 0, 0, 0, |
158 | 158 | $this->im_width, |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | $noise_height); |
162 | 162 | |
163 | 163 | /* put text image into background image */ |
164 | - imagecopymerge ( $this->im, |
|
164 | + imagecopymerge($this->im, |
|
165 | 165 | $this->draw_text(), |
166 | 166 | 0, 0, 0, 0, |
167 | 167 | $this->im_width, |
168 | 168 | $this->im_height, |
169 | - 70 ); |
|
169 | + 70); |
|
170 | 170 | |
171 | 171 | return $this->im; |
172 | 172 | } |
173 | 173 | |
174 | - public function destroy_image() { |
|
174 | + public function destroy_image(){ |
|
175 | 175 | |
176 | 176 | imagedestroy($this->im); |
177 | 177 |