Completed
Pull Request — develop (#716)
by Agel_Nash
06:21
created
manager/includes/functions/actions/help.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('createList')) {
2
+if (!function_exists('createList')) {
3 3
     /**
4 4
      * @param string $sectionHeader
5 5
      * @param array $linkArr
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
      */
8 8
     function createList($sectionHeader, $linkArr)
9 9
     {
10
-        $output = '<div class="sectionHeader">' . $sectionHeader . '</div><div class="sectionBody">' . "\n";
11
-        $output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">' . "\n";
10
+        $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
11
+        $output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
12 12
         $links = '';
13 13
         foreach ($linkArr as $row) {
14 14
             if (!is_array($row['link'])) {
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
             }
17 17
             foreach ($row['link'] as $link) {
18 18
                 $links .= $links != '' ? '<br/>' : '';
19
-                $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
19
+                $links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>';
20 20
             }
21 21
             $output .= '
22 22
 		<tr>
23
-			<td align="left"><strong>' . $row["title"] . '</strong></td>
24
-			<td align="left">' . $links . '</td>
23
+			<td align="left"><strong>' . $row["title"].'</strong></td>
24
+			<td align="left">' . $links.'</td>
25 25
 		</tr>';
26 26
             $links = '';
27 27
         }
28
-        $output .= '</table></div>' . "\n";
28
+        $output .= '</table></div>'."\n";
29 29
 
30 30
         return $output;
31 31
     }
Please login to merge, or discard this patch.
manager/includes/functions/actions/mutate_plugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     {
17 17
         echo '<div class="row form-row">
18 18
                 <div class="col-sm-6 col-md-4 col-lg-3">' .
19
-                    implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) .
20
-                '</div>' .
19
+                    implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).
20
+                '</div>'.
21 21
         '</div>';
22 22
 
23 23
         $evtnames = array();
Please login to merge, or discard this patch.
manager/includes/functions/actions/mutate_content.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('getDefaultTemplate')) {
3
+if (!function_exists('getDefaultTemplate')) {
4 4
     /**
5 5
      * @return string
6 6
      */
Please login to merge, or discard this patch.
manager/includes/functions/actions/settings.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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
      *
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
      */
9 9
     function get_lang_keys($filename)
10 10
     {
11
-        $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename;
11
+        $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename;
12 12
         if (is_file($file) && is_readable($file)) {
13 13
             include($file);
14 14
             $out = isset($_lang) ? array_keys($_lang) : array();
@@ -20,7 +20,7 @@  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
      *
@@ -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
      *
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
         if (!empty($key)) {
59 59
             $languages = get_langs_by_key($key);
60 60
             sort($languages);
61
-            $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>';
61
+            $lang_options .= '<option value="">'.$_lang['language_title'].'</option>';
62 62
 
63 63
             foreach ($languages as $language_name) {
64 64
                 $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
65
-                $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>';
65
+                $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>';
66 66
             }
67 67
 
68 68
             return $lang_options;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 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
-                $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>';
75
+                $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>';
76 76
             }
77 77
 
78 78
             return $lang_options;
@@ -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
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             $disabled = '';
100 100
         }
101 101
         if ($add) {
102
-            $add = ' ' . $add;
102
+            $add = ' '.$add;
103 103
         }
104 104
 
105 105
         return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name,
@@ -108,7 +108,7 @@  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
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 }
123 123
 
124
-if(!function_exists('parseText')) {
124
+if (!function_exists('parseText')) {
125 125
     /**
126 126
      * @param string $tpl
127 127
      * @param array $ph
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     }
143 143
 }
144 144
 
145
-if(!function_exists('showHide')) {
145
+if (!function_exists('showHide')) {
146 146
     /**
147 147
      * @param bool $cond
148 148
      * @return string
Please login to merge, or discard this patch.
manager/includes/functions/actions/search.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('highlightingCoincidence')) {
3
+if (!function_exists('highlightingCoincidence')) {
4 4
     /**
5 5
      * @param string $text
6 6
      * @param string $search
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
      */
9 9
     function highlightingCoincidence($text, $search)
10 10
     {
11
-        $regexp = '!(' . str_replace(array(
11
+        $regexp = '!('.str_replace(array(
12 12
                 '(',
13 13
                 ')'
14 14
             ), array(
15 15
                 '\(',
16 16
                 '\)'
17
-            ), trim($search)) . ')!isu';
17
+            ), trim($search)).')!isu';
18 18
 
19 19
         return preg_replace($regexp, '<span class="text-danger">$1</span>', $text);
20 20
     }
21 21
 }
22 22
 
23
-if(!function_exists('addClassForItemList')) {
23
+if (!function_exists('addClassForItemList')) {
24 24
     /**
25 25
      * @param string $locked
26 26
      * @param string $disabled
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $class .= ' deleted';
41 41
         }
42 42
         if ($class) {
43
-            $class = ' class="' . trim($class) . '"';
43
+            $class = ' class="'.trim($class).'"';
44 44
         }
45 45
 
46 46
         return $class;
Please login to merge, or discard this patch.
manager/includes/functions/actions/logging.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('array_unique_multi')) {
2
+if (!function_exists('array_unique_multi')) {
3 3
     /**
4 4
      * @param array $array
5 5
      * @param string $checkKey
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     }
28 28
 }
29 29
 
30
-if(!function_exists('record_sort')) {
30
+if (!function_exists('record_sort')) {
31 31
     /**
32 32
      * @param array $array
33 33
      * @param string $key
Please login to merge, or discard this patch.
manager/includes/functions/actions/bkmanager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('import_sql')) {
2
+if (!function_exists('import_sql')) {
3 3
     /**
4 4
      * @param string $source
5 5
      * @param string $result_code
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     }
41 41
 }
42 42
 
43
-if(!function_exists('dumpSql')) {
43
+if (!function_exists('dumpSql')) {
44 44
     /**
45 45
      * @param string $dumpstring
46 46
      * @return bool
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     }
67 67
 }
68 68
 
69
-if(!function_exists('snapshot')) {
69
+if (!function_exists('snapshot')) {
70 70
     /**
71 71
      * @param string $dumpstring
72 72
      * @return bool
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     }
81 81
 }
82 82
 
83
-if(!function_exists('getSettings')) {
83
+if (!function_exists('getSettings')) {
84 84
     /**
85 85
      * @return array
86 86
      */
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     }
108 108
 }
109 109
 
110
-if(!function_exists('restoreSettings')) {
110
+if (!function_exists('restoreSettings')) {
111 111
     /**
112 112
      * @param array $settings
113 113
      */
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     }
123 123
 }
124 124
 
125
-if(!function_exists('parsePlaceholder')) {
125
+if (!function_exists('parsePlaceholder')) {
126 126
     /**
127 127
      * @param string $tpl
128 128
      * @param array $ph
Please login to merge, or discard this patch.
manager/includes/functions/actions/mutate_role.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('render_form')) {
3
+if (!function_exists('render_form')) {
4 4
     /**
5 5
      * @param string $name
6 6
      * @param string $label
Please login to merge, or discard this patch.
manager/includes/functions/processors.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
 }
38 38
 
39
-if(!function_exists('duplicateDocument')) {
39
+if (!function_exists('duplicateDocument')) {
40 40
     /**
41 41
      * @param int $docid
42 42
      * @param null|int $parent
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
             $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'),
91 91
                 "pagetitle LIKE '{$pagetitle} Duplicate%'"));
92 92
             if ($count >= 1) {
93
-                $count = ' ' . ($count + 1);
93
+                $count = ' '.($count + 1);
94 94
             } else {
95 95
                 $count = '';
96 96
             }
97 97
 
98
-            $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle'];
98
+            $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
99 99
             $content['alias'] = null;
100 100
         } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
101 101
             $content['alias'] = null;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     }
154 154
 }
155 155
 
156
-if(!function_exists('duplicateTVs')) {
156
+if (!function_exists('duplicateTVs')) {
157 157
     /**
158 158
      * Duplicate Document TVs
159 159
      *
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
         $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
168 168
 
169
-        $newid = (int)$newid;
170
-        $oldid = (int)$oldid;
169
+        $newid = (int) $newid;
170
+        $oldid = (int) $oldid;
171 171
 
172 172
         $modx->db->insert(
173 173
             array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-if(!function_exists('duplicateAccess')) {
179
+if (!function_exists('duplicateAccess')) {
180 180
     /**
181 181
      * Duplicate Document Access Permissions
182 182
      *
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
         $tbldg = $modx->getFullTableName('document_groups');
191 191
 
192
-        $newid = (int)$newid;
193
-        $oldid = (int)$oldid;
192
+        $newid = (int) $newid;
193
+        $oldid = (int) $oldid;
194 194
 
195 195
         $modx->db->insert(
196 196
             array('document' => '', 'document_group' => ''), $tbldg, // Insert into
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     }
200 200
 }
201 201
 
202
-if(!function_exists('evalModule')) {
202
+if (!function_exists('evalModule')) {
203 203
     /**
204 204
      * evalModule
205 205
      *
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
             }
236 236
             if ($modx->config['error_reporting'] === '99' || 2 < $error_level) {
237 237
                 $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'],
238
-                    $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
238
+                    $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg);
239 239
                 $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
240 240
             }
241 241
         }
242 242
         unset($modx->event->params);
243 243
 
244
-        return $mod . $msg;
244
+        return $mod.$msg;
245 245
     }
246 246
 }
247 247
 
248
-if(!function_exists('allChildren')) {
248
+if (!function_exists('allChildren')) {
249 249
     /**
250 250
      * @param int $currDocID
251 251
      * @return array
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     }
266 266
 }
267 267
 
268
-if(!function_exists('jsAlert')) {
268
+if (!function_exists('jsAlert')) {
269 269
     /**
270 270
      * show javascript alert
271 271
      *
@@ -275,14 +275,14 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $modx = evolutionCMS();
277 277
         if ($_POST['ajax'] != 1) {
278
-            echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>";
278
+            echo "<script>window.setTimeout(\"alert('".addslashes($modx->db->escape($msg))."')\",10);history.go(-1)</script>";
279 279
         } else {
280
-            echo $msg . "\n";
280
+            echo $msg."\n";
281 281
         }
282 282
     }
283 283
 }
284 284
 
285
-if(!function_exists('login')) {
285
+if (!function_exists('login')) {
286 286
     /**
287 287
      * @param string $username
288 288
      * @param string $givenPassword
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     }
298 298
 }
299 299
 
300
-if(!function_exists('loginV1')) {
300
+if (!function_exists('loginV1')) {
301 301
     /**
302 302
      * @param int $internalKey
303 303
      * @param string $givenPassword
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     }
331 331
 }
332 332
 
333
-if(!function_exists('loginMD5')) {
333
+if (!function_exists('loginMD5')) {
334 334
     /**
335 335
      * @param int $internalKey
336 336
      * @param string $givenPassword
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     }
352 352
 }
353 353
 
354
-if(!function_exists('updateNewHash')) {
354
+if (!function_exists('updateNewHash')) {
355 355
     /**
356 356
      * @param string $username
357 357
      * @param string $password
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     }
367 367
 }
368 368
 
369
-if(!function_exists('incrementFailedLoginCount')) {
369
+if (!function_exists('incrementFailedLoginCount')) {
370 370
     /**
371 371
      * @param int $internalKey
372 372
      * @param int $failedlogins
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
         if ($failedlogins < $failed_allowed) {
391 391
             //sleep to help prevent brute force attacks
392
-            $sleep = (int)$failedlogins / 2;
392
+            $sleep = (int) $failedlogins / 2;
393 393
             if ($sleep > 5) {
394 394
                 $sleep = 5;
395 395
             }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     }
403 403
 }
404 404
 
405
-if (! function_exists('rmdirRecursive')) {
405
+if (!function_exists('rmdirRecursive')) {
406 406
     /**
407 407
      * rmdirRecursive - detects symbollic links on unix
408 408
      *
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
     }
427 427
 }
428 428
 
429
-if(!function_exists('saveUserGroupAccessPermissons')) {
429
+if (!function_exists('saveUserGroupAccessPermissons')) {
430 430
     /**
431 431
      * saves module user group access
432 432
      */
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
     }
458 458
 }
459 459
 
460
-if(!function_exists('saveEventListeners')) {
460
+if (!function_exists('saveEventListeners')) {
461 461
 # Save Plugin Event Listeners
462 462
     function saveEventListeners($id, $sysevents, $mode)
463 463
     {
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
     }
511 511
 }
512 512
 
513
-if(!function_exists('getEventIdByName')) {
513
+if (!function_exists('getEventIdByName')) {
514 514
     /**
515 515
      * @param string $name
516 516
      * @return string|int
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     }
534 534
 }
535 535
 
536
-if(!function_exists('saveTemplateAccess')) {
536
+if (!function_exists('saveTemplateAccess')) {
537 537
     /**
538 538
      * @param int $id
539 539
      */
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
     }
573 573
 }
574 574
 
575
-if(!function_exists('saveTemplateVarAccess')) {
575
+if (!function_exists('saveTemplateVarAccess')) {
576 576
     /**
577 577
      * @return void
578 578
      */
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     }
612 612
 }
613 613
 
614
-if(!function_exists('saveDocumentAccessPermissons')) {
614
+if (!function_exists('saveDocumentAccessPermissons')) {
615 615
     function saveDocumentAccessPermissons()
616 616
     {
617 617
         global $id, $newid;
@@ -780,10 +780,10 @@  discard block
 block discarded – undo
780 780
         }
781 781
 
782 782
         foreach ($defaults as $k) {
783
-            if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') {
783
+            if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') {
784 784
                 unset($settings[$k]);
785 785
             }
786
-            unset($settings['default_' . $k]);
786
+            unset($settings['default_'.$k]);
787 787
         }
788 788
 
789 789
         $modx->db->delete($tbl_user_settings, "user='{$id}'");
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
         global $id, $modx;
816 816
         $mode = $_POST['mode'];
817 817
         $modx->manager->saveFormValues($mode);
818
-        $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode === $action ? "&id={$id}" : ''));
818
+        $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode === $action ? "&id={$id}" : ''));
819 819
     }
820 820
 }
821 821
 
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
         global $deltime;
832 832
 
833 833
         $rs = $modx->db->select('id', $modx->getFullTableName('site_content'),
834
-            "parent='" . (int)$parent . "' AND deleted=1 AND deletedon='" . (int)$deltime . "'");
834
+            "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'");
835 835
         // the document has children documents, we'll need to delete those too
836 836
         while ($row = $modx->db->getRow($rs)) {
837 837
             $children[] = $row['id'];
Please login to merge, or discard this 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.