@@ -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 | global $modx; |
| 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 | global $modx; |
| 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 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | if (!empty($user_id)) { |
| 15 | 15 | // Raymond: grab the user settings from the database. |
| 16 | 16 | $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), |
| 17 | - "user=" . $modx->getLoginUserID()); |
|
| 17 | + "user=".$modx->getLoginUserID()); |
|
| 18 | 18 | |
| 19 | 19 | $which_browser_default = $which_browser; |
| 20 | 20 | while ($row = $modx->db->getRow($rs)) { |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | $array_paging['total'] = $this->int_nbr_row; |
| 102 | 102 | |
| 103 | 103 | if ($this->int_cur_position != 0) { |
| 104 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
| 105 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
| 104 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
| 105 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
| 109 | 109 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
| 110 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
| 111 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
| 110 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
| 111 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | return $array_paging; |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
| 127 | 127 | // if current page, do not make a link |
| 128 | 128 | if ($i == $this->getCurrentPage()) { |
| 129 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
| 129 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
| 130 | 130 | } else { |
| 131 | 131 | $int_new_position = ($i * $this->int_num_result); |
| 132 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
| 132 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -20,14 +20,14 @@ |
||
| 20 | 20 | ($docid > 0 ? "id='$docid'" : "privateweb = 1")); |
| 21 | 21 | $rs = $modx->db->select( |
| 22 | 22 | 'DISTINCT sc.id', |
| 23 | - $modx->getFullTableName("site_content") . " sc |
|
| 24 | - LEFT JOIN " . $modx->getFullTableName("document_groups") . " dg ON dg.document = sc.id |
|
| 25 | - LEFT JOIN " . $modx->getFullTableName("webgroup_access") . " wga ON wga.documentgroup = dg.document_group", |
|
| 26 | - ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "wga.id>0" |
|
| 23 | + $modx->getFullTableName("site_content")." sc |
|
| 24 | + LEFT JOIN " . $modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
|
| 25 | + LEFT JOIN " . $modx->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group", |
|
| 26 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."wga.id>0" |
|
| 27 | 27 | ); |
| 28 | 28 | $ids = $modx->db->getColumn("id", $rs); |
| 29 | 29 | if (count($ids) > 0) { |
| 30 | 30 | $modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), |
| 31 | - "id IN (" . implode(", ", $ids) . ")"); |
|
| 31 | + "id IN (".implode(", ", $ids).")"); |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -4,15 +4,15 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), |
| 7 | - "recipient=" . $modx->getLoginUserID() . " AND messageread=0"); |
|
| 7 | + "recipient=".$modx->getLoginUserID()." AND messageread=0"); |
|
| 8 | 8 | $nrnewmessages = $modx->db->getValue($rs); |
| 9 | -$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID()); |
|
| 9 | +$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()); |
|
| 10 | 10 | $nrtotalmessages = $modx->db->getValue($rs); |
| 11 | 11 | $messagesallowed = $modx->hasPermission('messages'); |
| 12 | 12 | |
| 13 | 13 | // ajax response |
| 14 | 14 | if (isset($_POST['updateMsgCount'])) { |
| 15 | 15 | header("Content-Type: application/json; charset=utf-8"); |
| 16 | - print $nrnewmessages . ',' . $nrtotalmessages; |
|
| 16 | + print $nrnewmessages.','.$nrtotalmessages; |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
@@ -7,53 +7,53 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -Class TemplateParser {
|
|
| 10 | +Class TemplateParser{
|
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @param array $config [action, tabs, toArray] |
| 14 | 14 | * @param array $data |
| 15 | 15 | * @return string |
| 16 | 16 | */ |
| 17 | - public function output($config = array(), $data = array()) {
|
|
| 17 | + public function output($config = array(), $data = array()){
|
|
| 18 | 18 | global $modx; |
| 19 | 19 | |
| 20 | 20 | $output = ''; |
| 21 | 21 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
| 22 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
|
|
| 22 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : '';
|
|
| 23 | 23 | |
| 24 | - if($action) {
|
|
| 24 | + if ($action) {
|
|
| 25 | 25 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
|
| 26 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
|
|
| 27 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
|
|
| 28 | - WHERE t1.action IN(' . $action . ') ' . $tab . '
|
|
| 26 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1
|
|
| 27 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category
|
|
| 28 | + WHERE t1.action IN(' . $action.') '.$tab.'
|
|
| 29 | 29 | ORDER BY t1.tab ASC, t1.rank ASC'); |
| 30 | 30 | |
| 31 | - if($modx->db->getRecordCount($sql)) {
|
|
| 31 | + if ($modx->db->getRecordCount($sql)) {
|
|
| 32 | 32 | $tabs = array(); |
| 33 | - while($row = $modx->db->getRow($sql)) {
|
|
| 34 | - if(!$row['value'] && !empty($data[$row['name']])) {
|
|
| 33 | + while ($row = $modx->db->getRow($sql)) {
|
|
| 34 | + if (!$row['value'] && !empty($data[$row['name']])) {
|
|
| 35 | 35 | $row['value'] = $data[$row['name']]; |
| 36 | 36 | } |
| 37 | 37 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
| 38 | 38 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if(!empty($config['toArray'])) {
|
|
| 41 | + if (!empty($config['toArray'])) {
|
|
| 42 | 42 | $output = $tabs; |
| 43 | 43 | } else {
|
| 44 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
| 44 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
| 45 | 45 | $output .= ' |
| 46 | 46 | <script type="text/javascript"> |
| 47 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
|
|
| 47 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
|
|
| 48 | 48 | </script>'; |
| 49 | 49 | |
| 50 | - foreach($tabs as $idTab => $tab) {
|
|
| 51 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
| 50 | + foreach ($tabs as $idTab => $tab) {
|
|
| 51 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
| 52 | 52 | $output .= ' |
| 53 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
| 54 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
|
|
| 53 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
| 54 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>';
|
|
| 55 | 55 | unset($tab['category_name']); |
| 56 | - foreach($tab as $item) {
|
|
| 56 | + foreach ($tab as $item) {
|
|
| 57 | 57 | $output .= $item; |
| 58 | 58 | } |
| 59 | 59 | $output .= '</div>'; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param array $data |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | - private function render($data) {
|
|
| 73 | + private function render($data){
|
|
| 74 | 74 | global $modx, $_lang, $_country_lang; |
| 75 | 75 | |
| 76 | 76 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $output = ''; |
| 81 | 81 | $output .= '<div class="form-group row">'; |
| 82 | 82 | |
| 83 | - switch($data['type']) {
|
|
| 83 | + switch ($data['type']) {
|
|
| 84 | 84 | |
| 85 | 85 | case 'text': |
| 86 | 86 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -114,18 +114,18 @@ discard block |
||
| 114 | 114 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 115 | 115 | $output .= '<div class="col-sm-7">'; |
| 116 | 116 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
| 117 | - if($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 117 | + if ($data['name'] == 'country' && isset($_country_lang)) {
|
|
| 118 | 118 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
| 119 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
| 120 | - foreach($_country_lang as $key => $value) {
|
|
| 121 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
| 119 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
| 120 | + foreach ($_country_lang as $key => $value) {
|
|
| 121 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
| 122 | 122 | } |
| 123 | 123 | } else {
|
| 124 | - if($data['elements']) {
|
|
| 124 | + if ($data['elements']) {
|
|
| 125 | 125 | $elements = explode('||', $data['elements']);
|
| 126 | - foreach($elements as $key => $value) {
|
|
| 126 | + foreach ($elements as $key => $value) {
|
|
| 127 | 127 | $value = explode('==', $value);
|
| 128 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
| 128 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 140 | 140 | $output .= '<div class="col-sm-7">'; |
| 141 | 141 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 142 | - if($data['elements']) {
|
|
| 142 | + if ($data['elements']) {
|
|
| 143 | 143 | $elements = explode('||', $data['elements']);
|
| 144 | - foreach($elements as $key => $value) {
|
|
| 144 | + foreach ($elements as $key => $value) {
|
|
| 145 | 145 | $value = explode('==', $value);
|
| 146 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 146 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | $output .= $data['content']; |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
| 156 | 156 | $output .= '<div class="col-sm-7">'; |
| 157 | 157 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
| 158 | - if($data['elements']) {
|
|
| 158 | + if ($data['elements']) {
|
|
| 159 | 159 | $elements = explode('||', $data['elements']);
|
| 160 | - foreach($elements as $key => $value) {
|
|
| 160 | + foreach ($elements as $key => $value) {
|
|
| 161 | 161 | $value = explode('==', $value);
|
| 162 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 162 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | $output .= $data['content']; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param string $itemid |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | -function getAction($actionId, $itemid='') { |
|
| 142 | +function getAction($actionId, $itemid = ''){ |
|
| 143 | 143 | global $action_list; |
| 144 | 144 | |
| 145 | 145 | $ret = sprintf($action_list[$actionId], $itemid); |
@@ -71,11 +71,11 @@ |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if ($context === 'common') { |
| 74 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
| 74 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
| 75 | 75 | } else { |
| 76 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
| 76 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
| 77 | 77 | } |
| 78 | - include_once($lang_path . 'english.inc.php'); |
|
| 78 | + include_once($lang_path.'english.inc.php'); |
|
| 79 | 79 | $manager_language = $modx->config['manager_language']; |
| 80 | 80 | if (is_file("{$lang_path}{$manager_language}.inc.php")) { |
| 81 | 81 | include_once("{$lang_path}{$manager_language}.inc.php"); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | global $sanitize_seed; |
| 14 | -$sanitize_seed = 'sanitize_seed_' . base_convert(md5(__FILE__), 16, 36); |
|
| 14 | +$sanitize_seed = 'sanitize_seed_'.base_convert(md5(__FILE__), 16, 36); |
|
| 15 | 15 | |
| 16 | 16 | // sanitize array |
| 17 | 17 | if (!function_exists('modx_sanitize_gpc')) { |