Completed
Pull Request — develop (#716)
by Agel_Nash
09:56
created
manager/actions/mutate_settings/functions.inc.php 1 patch
Braces   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('get_lang_keys')) {
2
+if(!function_exists('get_lang_keys')) {
3 3
     /**
4 4
      * get_lang_keys
5 5
      *
6 6
      * @param string $filename
7 7
      * @return array of keys from a language file
8 8
      */
9
-    function get_lang_keys($filename)
10
-    {
9
+    function get_lang_keys($filename)
10
+    {
11 11
         $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename;
12
-        if (is_file($file) && is_readable($file)) {
12
+        if (is_file($file) && is_readable($file)) {
13 13
             include($file);
14 14
             $out = isset($_lang) ? array_keys($_lang) : array();
15
-        } else {
15
+        } else {
16 16
             $out = array();
17 17
         }
18 18
 
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
     }
21 21
 }
22 22
 
23
-if(!function_exists('get_langs_by_key')) {
23
+if(!function_exists('get_langs_by_key')) {
24 24
     /**
25 25
      * get_langs_by_key
26 26
      *
27 27
      * @param string $key
28 28
      * @return array of languages that define the key in their file
29 29
      */
30
-    function get_langs_by_key($key)
31
-    {
30
+    function get_langs_by_key($key)
31
+    {
32 32
         global $lang_keys;
33 33
         $lang_return = array();
34
-        foreach ($lang_keys as $lang => $keys) {
35
-            if (in_array($key, $keys)) {
34
+        foreach ($lang_keys as $lang => $keys) {
35
+            if (in_array($key, $keys)) {
36 36
                 $lang_return[] = $lang;
37 37
             }
38 38
         }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-if(!function_exists('get_lang_options')) {
44
+if(!function_exists('get_lang_options')) {
45 45
     /**
46 46
      * get_lang_options
47 47
      *
@@ -51,25 +51,25 @@  discard block
 block discarded – undo
51 51
      * @param string $selected_lang specify language to select in option list, default none
52 52
      * @return string html option list
53 53
      */
54
-    function get_lang_options($key = '', $selected_lang = '')
55
-    {
54
+    function get_lang_options($key = '', $selected_lang = '')
55
+    {
56 56
         global $lang_keys, $_lang;
57 57
         $lang_options = '';
58
-        if (!empty($key)) {
58
+        if (!empty($key)) {
59 59
             $languages = get_langs_by_key($key);
60 60
             sort($languages);
61 61
             $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>';
62 62
 
63
-            foreach ($languages as $language_name) {
63
+            foreach ($languages as $language_name) {
64 64
                 $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
65 65
                 $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>';
66 66
             }
67 67
 
68 68
             return $lang_options;
69
-        } else {
69
+        } else {
70 70
             $languages = array_keys($lang_keys);
71 71
             sort($languages);
72
-            foreach ($languages as $language_name) {
72
+            foreach ($languages as $language_name) {
73 73
                 $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
74 74
                 $sel = $language_name === $selected_lang ? ' selected="selected"' : '';
75 75
                 $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>';
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     }
81 81
 }
82 82
 
83
-if(!function_exists('form_radio')) {
83
+if(!function_exists('form_radio')) {
84 84
     /**
85 85
      * @param string $name
86 86
      * @param string $value
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
      * @param bool $disabled
89 89
      * @return string
90 90
      */
91
-    function form_radio($name, $value, $add = '', $disabled = false)
92
-    {
91
+    function form_radio($name, $value, $add = '', $disabled = false)
92
+    {
93 93
         global ${$name};
94 94
         $var = ${$name};
95 95
         $checked = ($var == $value) ? ' checked="checked"' : '';
96
-        if ($disabled) {
96
+        if ($disabled) {
97 97
             $disabled = ' disabled';
98
-        } else {
98
+        } else {
99 99
             $disabled = '';
100 100
         }
101
-        if ($add) {
101
+        if ($add) {
102 102
             $add = ' ' . $add;
103 103
         }
104 104
 
@@ -108,31 +108,31 @@  discard block
 block discarded – undo
108 108
     }
109 109
 }
110 110
 
111
-if(!function_exists('wrap_label')) {
111
+if(!function_exists('wrap_label')) {
112 112
     /**
113 113
      * @param string $str
114 114
      * @param string $object
115 115
      * @return string
116 116
      */
117
-    function wrap_label($str = '', $object)
118
-    {
117
+    function wrap_label($str = '', $object)
118
+    {
119 119
         return "<label>{$object}\n{$str}</label>";
120 120
     }
121 121
 }
122 122
 
123
-if(!function_exists('parseText')) {
123
+if(!function_exists('parseText')) {
124 124
     /**
125 125
      * @param string $tpl
126 126
      * @param array $ph
127 127
      * @return string
128 128
      */
129
-    function parseText($tpl = '', $ph = array())
130
-    {
131
-        if (empty($ph) || empty($tpl)) {
129
+    function parseText($tpl = '', $ph = array())
130
+    {
131
+        if (empty($ph) || empty($tpl)) {
132 132
             return $tpl;
133 133
         }
134 134
 
135
-        foreach ($ph as $k => $v) {
135
+        foreach ($ph as $k => $v) {
136 136
             $k = "[+{$k}+]";
137 137
             $tpl = str_replace($k, $v, $tpl);
138 138
         }
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
     }
142 142
 }
143 143
 
144
-if(!function_exists('showHide')) {
144
+if(!function_exists('showHide')) {
145 145
     /**
146 146
      * @param bool $cond
147 147
      * @return string
148 148
      */
149
-    function showHide($cond = true)
150
-    {
149
+    function showHide($cond = true)
150
+    {
151 151
         global $displayStyle;
152 152
         $showHide = $cond ? $displayStyle : 'none';
153 153
 
Please login to merge, or discard this patch.
manager/processors/execute_module.processor.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 }
13 13
 
14 14
 // check if user has access permission, except admins
15
-if($_SESSION['mgrRole']!=1){
15
+if($_SESSION['mgrRole']!=1) {
16 16
 	$rs = $modx->db->select(
17 17
 		'sma.usergroup,mg.member',
18 18
 		$modx->getFullTableName("site_module_access")." sma
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,11 @@
 block discarded – undo
31 31
 // count duplicates
32 32
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'"));
33 33
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
34
-if($count>=1) $count = ' '.($count+1);
35
-else $count = '';
34
+if($count>=1) {
35
+    $count = ' '.($count+1);
36
+} else {
37
+    $count = '';
38
+}
36 39
 
37 40
 // duplicate module
38 41
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
manager/processors/move_document.processor.php 1 patch
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,12 +12,20 @@  discard block
 block discarded – undo
12 12
 // ok, two things to check.
13 13
 // first, document cannot be moved to itself
14 14
 // second, new parent must be a folder. If not, set it to folder.
15
-if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]);
16
-if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
17
-if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
15
+if($documentID==$newParentID) {
16
+    $modx->webAlertAndQuit($_lang["error_movedocument1"]);
17
+}
18
+if($documentID <= 0) {
19
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
20
+}
21
+if($newParentID < 0) {
22
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
23
+}
18 24
 
19 25
 $parents = $modx->getParentIds($newParentID);
20
-if (in_array($documentID, $parents))  $modx->webAlertAndQuit($_lang["error_movedocument2"]);
26
+if (in_array($documentID, $parents)) {
27
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
28
+}
21 29
 
22 30
 $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'");
23 31
 $oldparent = $modx->db->getValue($rs);
@@ -62,11 +70,11 @@  discard block
 block discarded – undo
62 70
 	"old_parent" => $oldparent,
63 71
 	"new_parent" => $newParentID
64 72
 ));
65
-if (is_array($evtOut) && count($evtOut) > 0){
73
+if (is_array($evtOut) && count($evtOut) > 0) {
66 74
 	$newParent = array_pop($evtOut);
67 75
 	if($newParent == $oldparent) {
68 76
 		$modx->webAlertAndQuit($_lang["error_movedocument2"]);
69
-	}else{
77
+	} else {
70 78
 		$newParentID = $newParent;
71 79
 	}
72 80
 }
Please login to merge, or discard this patch.
manager/processors/login.processor.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -403,10 +403,12 @@
 block discarded – undo
403 403
         $failedlogins += 1;
404 404
 
405 405
         $fields = array('failedlogincount' => $failedlogins);
406
-        if ($failedlogins >= $failed_allowed) //block user for too many fail attempts
406
+        if ($failedlogins >= $failed_allowed) {
407
+            //block user for too many fail attempts
407 408
         {
408 409
             $fields['blockeduntil'] = time() + ($blocked_minutes * 60);
409 410
         }
411
+        }
410 412
 
411 413
         $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
412 414
 
Please login to merge, or discard this patch.