@@ -4,12 +4,13 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | * @return array of keys from a language file |
| 6 | 6 | */ |
| 7 | -function get_lang_keys($filename) {
|
|
| 7 | +function get_lang_keys($filename) |
|
| 8 | +{ |
|
| 8 | 9 | $file = MODX_MANAGER_PATH.'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
| 9 | - if(is_file($file) && is_readable($file)) {
|
|
| 10 | + if(is_file($file) && is_readable($file)) { |
|
| 10 | 11 | include($file); |
| 11 | 12 | return array_keys($_lang); |
| 12 | - } else {
|
|
| 13 | + } else { |
|
| 13 | 14 | return array(); |
| 14 | 15 | } |
| 15 | 16 | } |
@@ -18,11 +19,12 @@ discard block |
||
| 18 | 19 | * |
| 19 | 20 | * @return array of languages that define the key in their file |
| 20 | 21 | */ |
| 21 | -function get_langs_by_key($key) {
|
|
| 22 | +function get_langs_by_key($key) |
|
| 23 | +{ |
|
| 22 | 24 | global $lang_keys; |
| 23 | 25 | $lang_return = array(); |
| 24 | - foreach($lang_keys as $lang=>$keys) {
|
|
| 25 | - if(in_array($key, $keys)) {
|
|
| 26 | + foreach($lang_keys as $lang=>$keys) { |
|
| 27 | + if(in_array($key, $keys)) { |
|
| 26 | 28 | $lang_return[] = $lang; |
| 27 | 29 | } |
| 28 | 30 | } |
@@ -38,23 +40,24 @@ discard block |
||
| 38 | 40 | * @param string $selected_lang specify language to select in option list, default none |
| 39 | 41 | * @return html option list |
| 40 | 42 | */ |
| 41 | -function get_lang_options($key=null, $selected_lang=null) {
|
|
| 43 | +function get_lang_options($key=null, $selected_lang=null) |
|
| 44 | +{ |
|
| 42 | 45 | global $lang_keys, $_lang; |
| 43 | 46 | $lang_options = ''; |
| 44 | - if($key) {
|
|
| 47 | + if($key) { |
|
| 45 | 48 | $languages = get_langs_by_key($key); |
| 46 | 49 | sort($languages); |
| 47 | 50 | $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
| 48 | 51 | |
| 49 | - foreach($languages as $language_name) {
|
|
| 52 | + foreach($languages as $language_name) { |
|
| 50 | 53 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 51 | 54 | $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
| 52 | 55 | } |
| 53 | 56 | return $lang_options; |
| 54 | - } else {
|
|
| 57 | + } else { |
|
| 55 | 58 | $languages = array_keys($lang_keys); |
| 56 | 59 | sort($languages); |
| 57 | - foreach($languages as $language_name) {
|
|
| 60 | + foreach($languages as $language_name) { |
|
| 58 | 61 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
|
| 59 | 62 | $sel = $language_name == $selected_lang ? ' selected="selected"' : ''; |
| 60 | 63 | $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
@@ -63,31 +66,42 @@ discard block |
||
| 63 | 66 | } |
| 64 | 67 | } |
| 65 | 68 | |
| 66 | -function form_radio($name,$value,$add='',$disabled=false) {
|
|
| 69 | +function form_radio($name,$value,$add='',$disabled=false) |
|
| 70 | +{ |
|
| 67 | 71 | global ${$name};
|
| 68 | 72 | $var = ${$name};
|
| 69 | 73 | $checked = ($var==$value) ? ' checked="checked"' : ''; |
| 70 | - if($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
| 71 | - if($add) $add = ' ' . $add; |
|
| 74 | + if($disabled) { |
|
| 75 | + $disabled = ' disabled'; |
|
| 76 | + } else { |
|
| 77 | + $disabled = ''; |
|
| 78 | + } |
|
| 79 | + if($add) { |
|
| 80 | + $add = ' ' . $add; |
|
| 81 | + } |
|
| 72 | 82 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add);
|
| 73 | 83 | } |
| 74 | 84 | |
| 75 | -function wrap_label($str='',$object) {
|
|
| 85 | +function wrap_label($str='',$object) |
|
| 86 | +{ |
|
| 76 | 87 | return "<label>{$object}\n{$str}</label>";
|
| 77 | 88 | } |
| 78 | 89 | |
| 79 | -function parseText($tpl='', $ph=array()) {
|
|
| 80 | - if(empty($ph) || empty($tpl)) return $tpl; |
|
| 90 | +function parseText($tpl='', $ph=array()) |
|
| 91 | +{ |
|
| 92 | + if(empty($ph) || empty($tpl)) { |
|
| 93 | + return $tpl; |
|
| 94 | + } |
|
| 81 | 95 | |
| 82 | - foreach($ph as $k=>$v) |
|
| 83 | - {
|
|
| 96 | + foreach($ph as $k=>$v) { |
|
| 84 | 97 | $k = "[+{$k}+]";
|
| 85 | 98 | $tpl = str_replace($k, $v, $tpl); |
| 86 | 99 | } |
| 87 | 100 | return $tpl; |
| 88 | 101 | } |
| 89 | 102 | |
| 90 | -function showHide($cond=true) {
|
|
| 103 | +function showHide($cond=true) |
|
| 104 | +{ |
|
| 91 | 105 | global $displayStyle; |
| 92 | 106 | $showHide = $cond ? $displayStyle : 'none'; |
| 93 | 107 | return sprintf('style="display:%s"', $showHide);
|
@@ -15,8 +15,14 @@ |
||
| 15 | 15 | <td > |
| 16 | 16 | <select name="smtp_secure" size="1" class="inputBox"> |
| 17 | 17 | <option value="none" ><?php echo $_lang['no'] ?></option> |
| 18 | - <option value="ssl" <?php if($smtp_secure == 'ssl') echo "selected='selected'"; ?> >SSL</option> |
|
| 19 | - <option value="tls" <?php if($smtp_secure == 'tls') echo "selected='selected'"; ?> >TLS</option> |
|
| 18 | + <option value="ssl" <?php if($smtp_secure == 'ssl') { |
|
| 19 | + echo "selected='selected'"; |
|
| 20 | +} |
|
| 21 | +?> >SSL</option> |
|
| 22 | + <option value="tls" <?php if($smtp_secure == 'tls') { |
|
| 23 | + echo "selected='selected'"; |
|
| 24 | +} |
|
| 25 | +?> >TLS</option> |
|
| 20 | 26 | </select> |
| 21 | 27 | <br /> |
| 22 | 28 | </td> |
@@ -159,7 +159,9 @@ |
||
| 159 | 159 | <?php |
| 160 | 160 | // invoke OnFriendlyURLSettingsRender event |
| 161 | 161 | $evtOut = $modx->invokeEvent('OnFriendlyURLSettingsRender');
|
| 162 | - if(is_array($evtOut)) echo implode("",$evtOut);
|
|
| 162 | + if(is_array($evtOut)) { |
|
| 163 | + echo implode("",$evtOut); |
|
| 164 | + } |
|
| 163 | 165 | ?> |
| 164 | 166 | </td> |
| 165 | 167 | </tr> |
@@ -733,7 +733,8 @@ |
||
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | function mkdirs($strPath, $mode) |
| 736 | -{ // recursive mkdir function |
|
| 736 | +{ |
|
| 737 | +// recursive mkdir function |
|
| 737 | 738 | if (is_dir($strPath)) { |
| 738 | 739 | return true; |
| 739 | 740 | } |
@@ -293,7 +293,8 @@ |
||
| 293 | 293 | </form> |
| 294 | 294 | |
| 295 | 295 | <?php |
| 296 | -function render_form($name, $label, $status = '') { |
|
| 296 | +function render_form($name, $label, $status = '') |
|
| 297 | +{ |
|
| 297 | 298 | global $modx, $roledata; |
| 298 | 299 | |
| 299 | 300 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -29,10 +29,12 @@ |
||
| 29 | 29 | |
| 30 | 30 | <div class="tab-page"> |
| 31 | 31 | <div class="container container-body"> |
| 32 | - <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 32 | + <?php if($num_rows_pub) { |
|
| 33 | + printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
| 33 | 34 | <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
| 34 | 35 | <?php |
| 35 | 36 | $modx->clearCache('full', true); |
| 37 | +} |
|
| 36 | 38 | // invoke OnSiteRefresh event |
| 37 | 39 | $modx->invokeEvent("OnSiteRefresh"); |
| 38 | 40 | ?> |
@@ -177,7 +177,9 @@ discard block |
||
| 177 | 177 | // save selected system events |
| 178 | 178 | $formEventList = array(); |
| 179 | 179 | foreach ($sysevents as $evtId) { |
| 180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
| 180 | + if(!preg_match('@^[1-9][0-9]*$@',$evtId)) { |
|
| 181 | + $evtId = getEventIdByName($evtId); |
|
| 182 | + } |
|
| 181 | 183 | if ($mode == '101') { |
| 182 | 184 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
| 183 | 185 | } else { |
@@ -203,10 +205,14 @@ discard block |
||
| 203 | 205 | $dbEventList = array(); |
| 204 | 206 | $del = array(); |
| 205 | 207 | while($row = $modx->db->getRow($rs)) { |
| 206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
| 208 | + if(!in_array($row['evtid'], $evtids)) { |
|
| 209 | + $del[] = $row['evtid']; |
|
| 210 | + } |
|
| 207 | 211 | } |
| 208 | 212 | |
| 209 | - if(!$del) return; |
|
| 213 | + if(!$del) { |
|
| 214 | + return; |
|
| 215 | + } |
|
| 210 | 216 | |
| 211 | 217 | foreach($del as $delid) { |
| 212 | 218 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
@@ -218,7 +224,9 @@ discard block |
||
| 218 | 224 | global $modx; |
| 219 | 225 | static $eventIds=array(); |
| 220 | 226 | |
| 221 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
| 227 | + if(isset($eventIds[$name])) { |
|
| 228 | + return $eventIds[$name]; |
|
| 229 | + } |
|
| 222 | 230 | |
| 223 | 231 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
| 224 | 232 | while ($row = $modx->db->getRow($rs)) { |
@@ -1,13 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class udperms{ |
|
| 3 | +class udperms |
|
| 4 | +{ |
|
| 4 | 5 | |
| 5 | 6 | var $user; |
| 6 | 7 | var $document; |
| 7 | 8 | var $role; |
| 8 | 9 | var $duplicateDoc = false; |
| 9 | 10 | |
| 10 | - function checkPermissions() { |
|
| 11 | + function checkPermissions() |
|
| 12 | + { |
|
| 11 | 13 | |
| 12 | 14 | global $udperms_allowroot; |
| 13 | 15 | global $modx; |
@@ -28,7 +30,10 @@ discard block |
||
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | $parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'")); |
| 31 | - if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root |
|
| 33 | + if($document == 0 && $parent == NULL && $udperms_allowroot == 1) { |
|
| 34 | + return true; |
|
| 35 | + } |
|
| 36 | + // User is allowed to create new document in root |
|
| 32 | 37 | if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) { |
| 33 | 38 | return false; // deny duplicate || create new document at root if Allow Root is No |
| 34 | 39 | } |
@@ -56,7 +61,9 @@ discard block |
||
| 56 | 61 | "sc.id='{$this->document}' AND (". ( (!$docgrp) ? null : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)" |
| 57 | 62 | ); |
| 58 | 63 | $limit = $modx->db->getValue($rs); |
| 59 | - if($limit==1) $permissionsok = true; |
|
| 64 | + if($limit==1) { |
|
| 65 | + $permissionsok = true; |
|
| 66 | + } |
|
| 60 | 67 | |
| 61 | 68 | return $permissionsok; |
| 62 | 69 | } |
@@ -46,7 +46,8 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | function getParents($id, $path = '') |
| 49 | - { // modx:returns child's parent |
|
| 49 | + { |
|
| 50 | +// modx:returns child's parent |
|
| 50 | 51 | global $modx; |
| 51 | 52 | if (empty($this->aliases)) { |
| 52 | 53 | $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible"; |
@@ -403,7 +404,8 @@ discard block |
||
| 403 | 404 | $_ = trim($_); |
| 404 | 405 | } |
| 405 | 406 | $lastChar = substr($_, -1); |
| 406 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
| 407 | + if (!in_array($lastChar, $chars)) { |
|
| 408 | +// ,320,327,288,284,289 |
|
| 407 | 409 | if (!in_array($prev_token, array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
| 408 | 410 | $_ .= ' '; |
| 409 | 411 | } |