Completed
Pull Request — develop (#534)
by Agel_Nash
06:46 queued 01:24
created
manager/actions/files.dynamic.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -565,6 +565,9 @@  discard block
 block discarded – undo
565 565
 
566 566
 }
567 567
 
568
+/**
569
+ * @param string $file
570
+ */
568 571
 function determineIcon($file, $selFile, $mode)
569 572
 {
570 573
     $icons = array(
@@ -709,6 +712,9 @@  discard block
 block discarded – undo
709 712
     return $path;
710 713
 }
711 714
 
715
+/**
716
+ * @param string $string
717
+ */
712 718
 function getExtension($string)
713 719
 {
714 720
     $pos = strrpos($string, '.');
@@ -744,6 +750,9 @@  discard block
 block discarded – undo
744 750
     return @mkdir($strPath);
745 751
 }
746 752
 
753
+/**
754
+ * @param string $type
755
+ */
747 756
 function logFileChange($type, $filename)
748 757
 {
749 758
     //global $_lang;
Please login to merge, or discard this patch.
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 if (!$modx->hasPermission('file_manager')) {
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 $newToken = makeToken();
10 10
 
11 11
 // settings
12
-$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/';
12
+$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/';
13 13
 $excludes = array(
14 14
     '.',
15 15
     '..',
16 16
     '.svn'
17 17
 );
18
-$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : '';
19
-$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix);
20
-$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix);
18
+$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : '';
19
+$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix);
20
+$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix);
21 21
 $viewablefiles = explode(',', 'jpg,gif,png,ico');
22 22
 
23 23
 $editablefiles = add_dot($editablefiles);
@@ -30,31 +30,31 @@  discard block
 block discarded – undo
30 30
 {
31 31
 */
32 32
 $protected_path[] = $modx->config['site_manager_path'];
33
-$protected_path[] = $modx->config['base_path'] . 'temp/backup';
34
-$protected_path[] = $modx->config['base_path'] . 'assets/backup';
33
+$protected_path[] = $modx->config['base_path'].'temp/backup';
34
+$protected_path[] = $modx->config['base_path'].'assets/backup';
35 35
 
36 36
 if (!$modx->hasPermission('save_plugin')) {
37
-    $protected_path[] = $modx->config['base_path'] . 'assets/plugins';
37
+    $protected_path[] = $modx->config['base_path'].'assets/plugins';
38 38
 }
39 39
 if (!$modx->hasPermission('save_snippet')) {
40
-    $protected_path[] = $modx->config['base_path'] . 'assets/snippets';
40
+    $protected_path[] = $modx->config['base_path'].'assets/snippets';
41 41
 }
42 42
 if (!$modx->hasPermission('save_template')) {
43
-    $protected_path[] = $modx->config['base_path'] . 'assets/templates';
43
+    $protected_path[] = $modx->config['base_path'].'assets/templates';
44 44
 }
45 45
 if (!$modx->hasPermission('save_module')) {
46
-    $protected_path[] = $modx->config['base_path'] . 'assets/modules';
46
+    $protected_path[] = $modx->config['base_path'].'assets/modules';
47 47
 }
48 48
 if (!$modx->hasPermission('empty_cache')) {
49
-    $protected_path[] = $modx->config['base_path'] . 'assets/cache';
49
+    $protected_path[] = $modx->config['base_path'].'assets/cache';
50 50
 }
51 51
 if (!$modx->hasPermission('import_static')) {
52
-    $protected_path[] = $modx->config['base_path'] . 'temp/import';
53
-    $protected_path[] = $modx->config['base_path'] . 'assets/import';
52
+    $protected_path[] = $modx->config['base_path'].'temp/import';
53
+    $protected_path[] = $modx->config['base_path'].'assets/import';
54 54
 }
55 55
 if (!$modx->hasPermission('export_static')) {
56
-    $protected_path[] = $modx->config['base_path'] . 'temp/export';
57
-    $protected_path[] = $modx->config['base_path'] . 'assets/export';
56
+    $protected_path[] = $modx->config['base_path'].'temp/export';
57
+    $protected_path[] = $modx->config['base_path'].'assets/export';
58 58
 }
59 59
 /*
60 60
 }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 {
80 80
     $count = count($array);
81 81
     for ($i = 0; $i < $count; $i++) {
82
-        $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :)
82
+        $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :)
83 83
     }
84 84
     return $array;
85 85
 }
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 $rw = realpath('../');
105 105
 $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf));
106 106
 if (substr($webstart_path, 0, 1) == '/') {
107
-    $webstart_path = '..' . $webstart_path;
107
+    $webstart_path = '..'.$webstart_path;
108 108
 } else {
109
-    $webstart_path = '../' . $webstart_path;
109
+    $webstart_path = '../'.$webstart_path;
110 110
 }
111 111
 
112 112
 ?>
113 113
     <script type="text/javascript">
114 114
 
115
-        var current_path = '<?= $startpath;?>';
115
+        var current_path = '<?= $startpath; ?>';
116 116
 
117 117
         function viewfile (url)
118 118
         {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         function unzipFile (file)
149 149
         {
150 150
             if (confirmUnzip()) {
151
-                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>";
151
+                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>";
152 152
                 return false;
153 153
             }
154 154
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         function deleteFolder (folder, status)
171 171
         {
172 172
             if (confirmDeleteFolder(status)) {
173
-                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>";
173
+                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>";
174 174
                 return false;
175 175
             }
176 176
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         function deleteFile (file)
179 179
         {
180 180
             if (confirmDelete()) {
181
-                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>";
181
+                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>";
182 182
                 return false;
183 183
             }
184 184
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         {
188 188
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
189 189
             if (newFilename !== null && newFilename !== file) {
190
-                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
190
+                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
191 191
             }
192 192
         }
193 193
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         {
196 196
             var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir);
197 197
             if (newDirname !== null && newDirname !== dir) {
198
-                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>";
198
+                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>";
199 199
             }
200 200
         }
201 201
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         {
204 204
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
205 205
             if (newFilename !== null && newFilename !== file) {
206
-                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
206
+                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
207 207
             }
208 208
         }
209 209
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             <?php endif ?>
223 223
             <?php
224 224
             if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') {
225
-                $href = 'a=31&path=' . urlencode($_REQUEST['path']);
225
+                $href = 'a=31&path='.urlencode($_REQUEST['path']);
226 226
             } else {
227 227
                 $href = 'a=2';
228 228
             }
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
                 $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>';
233 233
                 $ph['image'] = $_style['files_folder-open'];
234 234
                 $ph['subject'] = $_lang['add_folder'];
235
-                $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name=';
235
+                $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name=';
236 236
                 $_ = parsePlaceholder($tpl, $ph);
237 237
 
238
-                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>';
238
+                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>';
239 239
                 $ph['image'] = $_style['files_page_html'];
240
-                $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name=';
240
+                $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name=';
241 241
                 $_ .= parsePlaceholder($tpl, $ph);
242 242
                 echo $_;
243 243
             }
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
             $ph = array();
268 268
             $ph['style_path'] = $theme_image_path;
269 269
             // To Top Level with folder icon to the left
270
-            if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) {
271
-                $ph['image'] = '' . $_style['files_top'] . '';
270
+            if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) {
271
+                $ph['image'] = ''.$_style['files_top'].'';
272 272
                 $ph['subject'] = '<span>Top</span>';
273 273
             } else {
274
-                $ph['image'] = '' . $_style['files_top'] . '';
275
-                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/';
274
+                $ph['image'] = ''.$_style['files_top'].'';
275
+                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/';
276 276
             }
277 277
 
278 278
             echo parsePlaceholder($tpl, $ph);
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
                     if (empty($v)) {
290 290
                         continue;
291 291
                     }
292
-                    $path .= rtrim($v, '/') . '/';
292
+                    $path .= rtrim($v, '/').'/';
293 293
                     if (1 < $count) {
294
-                        $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path);
295
-                        $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>';
294
+                        $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path);
295
+                        $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>';
296 296
                     } else {
297
-                        $pieces[$i] = '<span>' . trim($v, '/') . '</span>';
297
+                        $pieces[$i] = '<span>'.trim($v, '/').'</span>';
298 298
                     }
299 299
                     $count--;
300 300
                 }
@@ -307,16 +307,16 @@  discard block
 block discarded – undo
307 307
         </div>
308 308
         <?php
309 309
         // check to see user isn't trying to move below the document_root
310
-        if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) {
310
+        if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) {
311 311
             $modx->webAlertAndQuit($_lang["files_access_denied"]);
312 312
         }
313 313
 
314 314
         // Unzip .zip files - by Raymond
315 315
         if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) {
316
-            if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) {
317
-                echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />';
316
+            if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) {
317
+                echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />';
318 318
             } else {
319
-                echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />';
319
+                echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />';
320 320
             }
321 321
         }
322 322
         // End Unzip - Raymond
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
             if ($_REQUEST['mode'] == 'deletefolder') {
329 329
                 $folder = $_REQUEST['folderpath'];
330 330
                 if (!$token_check || !@rrmdir($folder)) {
331
-                    echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />';
331
+                    echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />';
332 332
                 } else {
333
-                    echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />';
333
+                    echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />';
334 334
                 }
335 335
             }
336 336
 
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
                 if (!mkdirs("{$startpath}/{$foldername}", 0777)) {
342 342
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
343 343
                 } else {
344
-                    if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) {
345
-                        echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />';
344
+                    if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) {
345
+                        echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />';
346 346
                     } else {
347
-                        echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />';
347
+                        echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />';
348 348
                     }
349 349
                 }
350 350
                 umask($old_umask);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                 $filename = $modx->db->escape($filename);
357 357
 
358 358
                 if (!checkExtension($filename)) {
359
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
359
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
360 360
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) {
361 361
                     echo $_lang['files.dynamic.php3'];
362 362
                 } else {
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
                 $newFilename = $modx->db->escape($newFilename);
379 379
 
380 380
                 if (!checkExtension($newFilename)) {
381
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
381
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
382 382
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
383 383
                     echo $_lang['files.dynamic.php3'];
384 384
                 } else {
385
-                    if (!copy($filename, MODX_BASE_PATH . $newFilename)) {
385
+                    if (!copy($filename, MODX_BASE_PATH.$newFilename)) {
386 386
                         echo $_lang['files.dynamic.php5'];
387 387
                     }
388 388
                     umask($old_umask);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             // Rename folder here
392 392
             if ($_REQUEST['mode'] == 'renameFolder') {
393 393
                 $old_umask = umask(0);
394
-                $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname'];
394
+                $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname'];
395 395
                 $dirname = $modx->db->escape($dirname);
396 396
                 $newDirname = str_replace(array(
397 397
                     '..\\',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
                 if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) {
405 405
                     echo $_lang['files.dynamic.php3'];
406
-                } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) {
406
+                } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) {
407 407
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
408 408
                 }
409 409
                 umask($old_umask);
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
                 $newFilename = $modx->db->escape($newFilename);
424 424
 
425 425
                 if (!checkExtension($newFilename)) {
426
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
426
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
427 427
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
428 428
                     echo $_lang['files.dynamic.php3'];
429 429
                 } else {
430
-                    if (!rename($filename, $path . '/' . $newFilename)) {
430
+                    if (!rename($filename, $path.'/'.$newFilename)) {
431 431
                         echo $_lang['files.dynamic.php5'];
432 432
                     }
433 433
                     umask($old_umask);
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                 ls($startpath);
461 461
                 echo "\n\n\n";
462 462
                 if ($folders == 0 && $files == 0) {
463
-                    echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>';
463
+                    echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>';
464 464
                 }
465 465
                 ?>
466 466
             </table>
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
         <div class="container">
470 470
             <p>
471 471
                 <?php
472
-                echo $_lang['files_directories'] . ': <b>' . $folders . '</b> ';
473
-                echo $_lang['files_files'] . ': <b>' . $files . '</b> ';
474
-                echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> ';
475
-                echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>'
472
+                echo $_lang['files_directories'].': <b>'.$folders.'</b> ';
473
+                echo $_lang['files_files'].': <b>'.$files.'</b> ';
474
+                echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> ';
475
+                echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>'
476 476
                 ?>
477 477
             </p>
478 478
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                 </form>
498 498
                 <?php
499 499
             } else {
500
-                echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>";
500
+                echo "<p>".$_lang['files_upload_inhibited_msg']."</p>";
501 501
             }
502 502
             ?>
503 503
             <div id="imageviewer"></div>
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
     if ($file == $selFile) {
577 577
         $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default'];
578 578
     }
579
-    return '<i class="' . $icon . ' FilesPage"></i>';
579
+    return '<i class="'.$icon.' FilesPage"></i>';
580 580
 }
581 581
 
582 582
 function markRow($file, $selFile, $mode)
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
     );
589 589
     if ($file == $selFile) {
590 590
         $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default'];
591
-        return ' class="' . $class . '"';
591
+        return ' class="'.$class.'"';
592 592
     }
593 593
     return '';
594 594
 }
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
     global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx;
600 600
     $dircounter = 0;
601 601
     $filecounter = 0;
602
-    $curpath = str_replace('//', '/', $curpath . '/');
602
+    $curpath = str_replace('//', '/', $curpath.'/');
603 603
 
604 604
     if (!is_dir($curpath)) {
605 605
         echo 'Invalid path "', $curpath, '"<br />';
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 
610 610
     // first, get info
611 611
     foreach ($dir as $file) {
612
-        $newpath = $curpath . $file;
612
+        $newpath = $curpath.$file;
613 613
         if ($file === '..' || $file === '.') {
614 614
             continue;
615 615
         }
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
             if ($file === '..' || $file === '.') {
620 620
                 continue;
621 621
             } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) {
622
-                $dirs_array[$dircounter]['text'] = '<i class="' . $_style['files_folder'] . ' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path=' . urlencode($newpath) . '"><b>' . $file . '</b></a>';
622
+                $dirs_array[$dircounter]['text'] = '<i class="'.$_style['files_folder'].' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path='.urlencode($newpath).'"><b>'.$file.'</b></a>';
623 623
 
624 624
                 $dfiles = scandir($newpath);
625 625
                 foreach ($dfiles as $i => $infile) {
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
                 }
633 633
                 $file_exists = (0 < count($dfiles)) ? 'file_exists' : '';
634 634
 
635
-                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\'' . urlencode($file) . '\',\'' . $file_exists . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></a>' : '';
635
+                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\''.urlencode($file).'\',\''.$file_exists.'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></a>' : '';
636 636
             } else {
637
-                $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>';
638
-                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : '';
637
+                $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>';
638
+                $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : '';
639 639
             }
640 640
 
641
-            $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : '';
641
+            $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : '';
642 642
 
643 643
             // increment the counter
644 644
             $dircounter++;
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
             $type = getExtension($newpath);
647 647
             $files_array[$filecounter]['file'] = $newpath;
648 648
             $files_array[$filecounter]['stats'] = lstat($newpath);
649
-            $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file;
650
-            $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath, $len, strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))) . '" style="cursor:pointer;"><i class="' . $_style['files_download'] . '" title="' . $_lang['file_download_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></span>');
651
-            $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path=' . urlencode($newpath) . '"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : $files_array[$filecounter]['view'];
652
-            $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_unzip'] . '" title="' . $_lang['file_download_unzip'] . '"></i></a>' : '';
653
-            $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path=' . urlencode($newpath) . '#file_editfile"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></span>';
654
-            $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_duplicate'] . '" title="' . $_lang['duplicate'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_duplicate'] . '" align="absmiddle" title="' . $_lang['duplicate'] . '"></i></span>';
655
-            $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></span>';
656
-            $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></span>';
649
+            $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file;
650
+            $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath, $len, strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))).'" style="cursor:pointer;"><i class="'.$_style['files_download'].'" title="'.$_lang['file_download_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></span>');
651
+            $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path='.urlencode($newpath).'"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : $files_array[$filecounter]['view'];
652
+            $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\''.urlencode($file).'\');"><i class="'.$_style['files_unzip'].'" title="'.$_lang['file_download_unzip'].'"></i></a>' : '';
653
+            $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path='.urlencode($newpath).'#file_editfile"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></span>';
654
+            $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\''.urlencode($file).'\');"><i class="'.$_style['files_duplicate'].'" title="'.$_lang['duplicate'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_duplicate'].'" align="absmiddle" title="'.$_lang['duplicate'].'"></i></span>';
655
+            $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></span>';
656
+            $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\''.urlencode($file).'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></span>';
657 657
 
658 658
             // increment the counter
659 659
             $filecounter++;
@@ -666,9 +666,9 @@  discard block
 block discarded – undo
666 666
     for ($i = 0; $i < $folders; $i++) {
667 667
         $filesizes += $dirs_array[$i]['stats']['7'];
668 668
         echo '<tr>';
669
-        echo '<td>' . $dirs_array[$i]['text'] . '</td>';
670
-        echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>';
671
-        echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>';
669
+        echo '<td>'.$dirs_array[$i]['text'].'</td>';
670
+        echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>';
671
+        echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>';
672 672
         echo '<td class="actions text-right">';
673 673
         echo $dirs_array[$i]['rename'];
674 674
         echo $dirs_array[$i]['delete'];
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
     sort($files_array); // sorting the array alphabetically (Thanks pxl8r!)
682 682
     for ($i = 0; $i < $files; $i++) {
683 683
         $filesizes += $files_array[$i]['stats']['7'];
684
-        echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>';
685
-        echo '<td>' . $files_array[$i]['text'] . '</td>';
686
-        echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>';
687
-        echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>';
684
+        echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>';
685
+        echo '<td>'.$files_array[$i]['text'].'</td>';
686
+        echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>';
687
+        echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>';
688 688
         echo '<td class="actions text-right">';
689 689
         echo $files_array[$i]['unzip'];
690 690
         echo $files_array[$i]['view'];
@@ -792,17 +792,17 @@  discard block
 block discarded – undo
792 792
     $zip = zip_open($file);
793 793
     if ($zip) {
794 794
         $old_umask = umask(0);
795
-        $path = rtrim($path, '/') . '/';
795
+        $path = rtrim($path, '/').'/';
796 796
         while ($zip_entry = zip_read($zip)) {
797 797
             if (zip_entry_filesize($zip_entry) > 0) {
798 798
                 // str_replace must be used under windows to convert "/" into "\"
799 799
                 $zip_entry_name = zip_entry_name($zip_entry);
800
-                $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name));
801
-                $complete_name = $path . str_replace('\\', '/', $zip_entry_name);
800
+                $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name));
801
+                $complete_name = $path.str_replace('\\', '/', $zip_entry_name);
802 802
                 if (!file_exists($complete_path)) {
803 803
                     $tmp = '';
804 804
                     foreach (explode('/', $complete_path) AS $k) {
805
-                        $tmp .= $k . '/';
805
+                        $tmp .= $k.'/';
806 806
                         if (!is_dir($tmp)) {
807 807
                             mkdir($tmp, 0777);
808 808
                         }
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
 function rrmdir($dir)
825 825
 {
826
-    foreach (glob($dir . '/*') as $file) {
826
+    foreach (glob($dir.'/*') as $file) {
827 827
         if (is_dir($file)) {
828 828
             rrmdir($file);
829 829
         } else {
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
     $msg = '';
840 840
     foreach ($_FILES['userfile']['name'] as $i => $name) {
841 841
         if (empty($_FILES['userfile']['tmp_name'][$i])) continue;
842
-        $userfile= array();
842
+        $userfile = array();
843 843
 
844 844
         $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i];
845 845
         $userfile['error'] = $_FILES['userfile']['error'][$i];
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
         $userfile['type'] = $_FILES['userfile']['type'][$i];
857 857
 
858 858
         // this seems to be an upload action.
859
-        $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath));
860
-        $path = rtrim($path, '/') . '/' . $userfile['name'];
859
+        $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath));
860
+        $path = rtrim($path, '/').'/'.$userfile['name'];
861 861
         $msg .= $path;
862 862
         if ($userfile['error'] == 0) {
863
-            $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : '';
864
-            $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>';
863
+            $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : '';
864
+            $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>';
865 865
         }
866 866
 
867 867
         $userfilename = $userfile['tmp_name'];
@@ -869,15 +869,15 @@  discard block
 block discarded – undo
869 869
         if (is_uploaded_file($userfilename)) {
870 870
             // file is uploaded file, process it!
871 871
             if (!checkExtension($userfile['name'])) {
872
-                $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>';
872
+                $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>';
873 873
             } else {
874
-                if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) {
874
+                if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) {
875 875
                     // Ryan: Repair broken permissions issue with file manager
876 876
                     if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
877
-                        @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions);
877
+                        @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions);
878 878
                     }
879 879
                     // Ryan: End
880
-                    $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>';
880
+                    $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>';
881 881
 
882 882
                     // invoke OnFileManagerUpload event
883 883
                     $modx->invokeEvent('OnFileManagerUpload', array(
@@ -885,13 +885,13 @@  discard block
 block discarded – undo
885 885
                         'filename' => $userfile['name']
886 886
                     ));
887 887
                     // Log the change
888
-                    logFileChange('upload', $_POST['path'] . '/' . $userfile['name']);
888
+                    logFileChange('upload', $_POST['path'].'/'.$userfile['name']);
889 889
                 } else {
890
-                    $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>';
890
+                    $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>';
891 891
                 }
892 892
             }
893 893
         } else {
894
-            $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>';
894
+            $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>';
895 895
             switch ($userfile['error']) {
896 896
                 case 0: //no error; possible file attack!
897 897
                     $msg .= $_lang['files_upload_error0'];
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
             $msg .= '</span><br />';
916 916
         }
917 917
     }
918
-    return $msg . '<br/>';
918
+    return $msg.'<br/>';
919 919
 }
920 920
 
921 921
 function textsave()
@@ -928,9 +928,9 @@  discard block
 block discarded – undo
928 928
 
929 929
     // Write $content to our opened file.
930 930
     if (file_put_contents($filename, $content) === false) {
931
-        $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />';
931
+        $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />';
932 932
     } else {
933
-        $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />';
933
+        $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />';
934 934
         $_REQUEST['mode'] = 'edit';
935 935
     }
936 936
     // Log the change
@@ -946,9 +946,9 @@  discard block
 block discarded – undo
946 946
 
947 947
     $file = $_REQUEST['path'];
948 948
     if (!$token_check || !@unlink($file)) {
949
-        $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />';
949
+        $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />';
950 950
     } else {
951
-        $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />';
951
+        $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />';
952 952
     }
953 953
 
954 954
     // Log the change
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 2 patches
Doc Comments   +14 added lines patch added patch discarded remove patch
@@ -160,6 +160,11 @@  discard block
 block discarded – undo
160 160
 	return $output;
161 161
 }
162 162
 
163
+/**
164
+ * @param integer $parent
165
+ * @param string $filedir
166
+ * @param string $mode
167
+ */
163 168
 function importFiles($parent, $filedir, $files, $mode) {
164 169
 	global $modx;
165 170
 	global $_lang, $allowedfiles;
@@ -302,6 +307,9 @@  discard block
 block discarded – undo
302 307
 	}
303 308
 }
304 309
 
310
+/**
311
+ * @param string $directory
312
+ */
305 313
 function getFiles($directory, $listing = array(), $count = 0) {
306 314
 	global $_lang;
307 315
 	global $filesfound;
@@ -326,6 +334,9 @@  discard block
 block discarded – undo
326 334
 	return ($listing);
327 335
 }
328 336
 
337
+/**
338
+ * @param string $filepath
339
+ */
329 340
 function getFileContent($filepath) {
330 341
 	global $_lang;
331 342
 	// get the file
@@ -353,6 +364,9 @@  discard block
 block discarded – undo
353 364
 	return $new_array;
354 365
 }
355 366
 
367
+/**
368
+ * @param null|string $src
369
+ */
356 370
 function treatContent($src, $filename, $alias) {
357 371
 	global $modx;
358 372
 
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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" />
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 	</div>
102 102
 
103 103
 <?php
104
-function run() {
104
+function run(){
105 105
 	global $modx, $_lang;
106 106
 
107 107
 	$tbl_site_content = $modx->getFullTableName('site_content');
108 108
 	$output = '';
109 109
 	$maxtime = $_POST['maxtime'];
110 110
 
111
-	if(!is_numeric($maxtime)) {
111
+	if (!is_numeric($maxtime)) {
112 112
 		$maxtime = 30;
113 113
 	}
114 114
 
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 	$mtime = $mtime[1] + $mtime[0];
120 120
 	$importstart = $mtime;
121 121
 
122
-	if($_POST['reset'] == 'on') {
122
+	if ($_POST['reset'] == 'on') {
123 123
 		$modx->db->truncate($tbl_site_content);
124 124
 		$modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
125 125
 	}
126 126
 
127
-	$parent = (int)$_POST['parent'];
127
+	$parent = (int) $_POST['parent'];
128 128
 
129
-	if(is_dir(MODX_BASE_PATH . 'temp/import')) {
130
-		$filedir = MODX_BASE_PATH . 'temp/import/';
131
-	} elseif(is_dir(MODX_BASE_PATH . 'assets/import')) {
132
-		$filedir = MODX_BASE_PATH . 'assets/import/';
129
+	if (is_dir(MODX_BASE_PATH.'temp/import')) {
130
+		$filedir = MODX_BASE_PATH.'temp/import/';
131
+	} elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
132
+		$filedir = MODX_BASE_PATH.'assets/import/';
133 133
 	} else {
134 134
         $filedir = '';
135 135
     }
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	$files = pop_index($files);
141 141
 
142 142
 	// no. of files to import
143
-	$output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
143
+	$output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
144 144
 
145 145
 	// import files
146
-	if(0 < count($files)) {
146
+	if (0 < count($files)) {
147 147
 		$modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'");
148 148
 		importFiles($parent, $filedir, $files, 'root');
149 149
 	}
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 	$mtime = $mtime[1] + $mtime[0];
154 154
 	$importend = $mtime;
155 155
 	$totaltime = ($importend - $importstart);
156
-	$output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
156
+	$output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
157 157
 
158
-	if($_POST['convert_link'] == 'on') {
158
+	if ($_POST['convert_link'] == 'on') {
159 159
 		convertLink();
160 160
 	}
161 161
 
162 162
 	return $output;
163 163
 }
164 164
 
165
-function importFiles($parent, $filedir, $files, $mode) {
165
+function importFiles($parent, $filedir, $files, $mode){
166 166
 	global $modx;
167 167
 	global $_lang, $allowedfiles;
168 168
 	global $search_default, $cache_default, $publish_default;
@@ -171,21 +171,21 @@  discard block
 block discarded – undo
171 171
 	$tbl_system_settings = $modx->getFullTableName('system_settings');
172 172
 
173 173
 	$createdby = $modx->getLoginUserID();
174
-	if(!is_array($files)) {
174
+	if (!is_array($files)) {
175 175
 		return;
176 176
 	}
177
-	if($_POST['object'] == 'all') {
177
+	if ($_POST['object'] == 'all') {
178 178
 		$modx->config['default_template'] = '0';
179 179
 		$richtext = '0';
180 180
 	} else {
181 181
 		$richtext = '1';
182 182
 	}
183 183
 
184
-	foreach($files as $id => $value) {
185
-		if(is_array($value)) {
184
+	foreach ($files as $id => $value) {
185
+		if (is_array($value)) {
186 186
 			// create folder
187 187
 			$alias = $id;
188
-			printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
188
+			printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
189 189
 			$field = array();
190 190
 			$field['type'] = 'document';
191 191
 			$field['contentType'] = 'text/html';
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
 			$field['isfolder'] = 1;
201 201
 			$field['menuindex'] = 1;
202 202
 			$find = false;
203
-			foreach(array(
203
+			foreach (array(
204 204
 						'index.html',
205 205
 						'index.htm'
206 206
 					) as $filename) {
207
-				$filepath = $filedir . $alias . '/' . $filename;
208
-				if($find === false && file_exists($filepath)) {
207
+				$filepath = $filedir.$alias.'/'.$filename;
208
+				if ($find === false && file_exists($filepath)) {
209 209
 					$file = getFileContent($filepath);
210 210
 					list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
211 211
 
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
 					$field['createdon'] = $date;
218 218
 					$field['editedon'] = $date;
219 219
 					$newid = $modx->db->insert($field, $tbl_site_content);
220
-					if($newid) {
220
+					if ($newid) {
221 221
 						$find = true;
222
-						echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
223
-						importFiles($newid, $filedir . $alias . '/', $value, 'sub');
222
+						echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
223
+						importFiles($newid, $filedir.$alias.'/', $value, 'sub');
224 224
 					} else {
225
-						echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
225
+						echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
226 226
 						exit;
227 227
 					}
228 228
 				}
229 229
 			}
230
-			if($find === false) {
230
+			if ($find === false) {
231 231
 				$date = time();
232 232
 				$field['pagetitle'] = '---';
233 233
 				$field['content'] = '';
@@ -235,30 +235,30 @@  discard block
 block discarded – undo
235 235
 				$field['editedon'] = $date;
236 236
 				$field['hidemenu'] = '1';
237 237
 				$newid = $modx->db->insert($field, $tbl_site_content);
238
-				if($newid) {
238
+				if ($newid) {
239 239
 					$find = true;
240
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
241
-					importFiles($newid, $filedir . $alias . '/', $value, 'sub');
240
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
241
+					importFiles($newid, $filedir.$alias.'/', $value, 'sub');
242 242
 				} else {
243
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
243
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
244 244
 					exit;
245 245
 				}
246 246
 			}
247 247
 		} else {
248 248
 			// create document
249
-			if($mode == 'sub' && $value == 'index.html') {
249
+			if ($mode == 'sub' && $value == 'index.html') {
250 250
 				continue;
251 251
 			}
252 252
 			$filename = $value;
253 253
 			$fparts = explode('.', $value);
254 254
 			$alias = $fparts[0];
255 255
 			$ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
256
-			printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
256
+			printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
257 257
 
258
-			if(!in_array($ext, $allowedfiles)) {
259
-				echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
258
+			if (!in_array($ext, $allowedfiles)) {
259
+				echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
260 260
 			} else {
261
-				$filepath = $filedir . $filename;
261
+				$filepath = $filedir.$filename;
262 262
 				$file = getFileContent($filepath);
263 263
 				list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
264 264
 
@@ -283,18 +283,18 @@  discard block
 block discarded – undo
283 283
 				$field['isfolder'] = 0;
284 284
 				$field['menuindex'] = ($alias == 'index') ? 0 : 2;
285 285
 				$newid = $modx->db->insert($field, $tbl_site_content);
286
-				if($newid) {
287
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
286
+				if ($newid) {
287
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
288 288
 				} else {
289
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
289
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
290 290
 					exit;
291 291
 				}
292 292
 
293 293
 				$is_site_start = false;
294
-				if($filename == 'index.html') {
294
+				if ($filename == 'index.html') {
295 295
 					$is_site_start = true;
296 296
 				}
297
-				if($is_site_start == true && $_POST['reset'] == 'on') {
297
+				if ($is_site_start == true && $_POST['reset'] == 'on') {
298 298
 					$modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'");
299 299
 					$modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'");
300 300
 				}
@@ -303,85 +303,85 @@  discard block
 block discarded – undo
303 303
 	}
304 304
 }
305 305
 
306
-function getFiles($directory, $listing = array(), $count = 0) {
306
+function getFiles($directory, $listing = array(), $count = 0){
307 307
 	global $_lang;
308 308
 	global $filesfound;
309 309
 	$dummy = $count;
310
-	if( ! empty($directory) && $files = scandir($directory)) {
311
-		foreach($files as $file) {
312
-			if($file == '.' || $file == '..') {
310
+	if (!empty($directory) && $files = scandir($directory)) {
311
+		foreach ($files as $file) {
312
+			if ($file == '.' || $file == '..') {
313 313
 				continue;
314
-			} elseif($h = @opendir($directory . $file . "/")) {
314
+			} elseif ($h = @opendir($directory.$file."/")) {
315 315
 				closedir($h);
316 316
 				$count = -1;
317
-				$listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
318
-			} elseif(strpos($file, '.htm') !== false) {
317
+				$listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
318
+			} elseif (strpos($file, '.htm') !== false) {
319 319
 				$listing[$dummy] = $file;
320 320
 				$dummy = $dummy + 1;
321 321
 				$filesfound++;
322 322
 			}
323 323
 		}
324 324
 	} else {
325
-		echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
325
+		echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
326 326
 	}
327 327
 	return ($listing);
328 328
 }
329 329
 
330
-function getFileContent($filepath) {
330
+function getFileContent($filepath){
331 331
 	global $_lang;
332 332
 	// get the file
333
-	if(!$buffer = file_get_contents($filepath)) {
334
-		echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
333
+	if (!$buffer = file_get_contents($filepath)) {
334
+		echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
335 335
 	} else {
336 336
 		return $buffer;
337 337
 	}
338 338
 }
339 339
 
340
-function pop_index($array) {
340
+function pop_index($array){
341 341
 	$new_array = array();
342
-	foreach($array as $k => $v) {
343
-		if($v !== 'index.html' && $v !== 'index.htm') {
342
+	foreach ($array as $k => $v) {
343
+		if ($v !== 'index.html' && $v !== 'index.htm') {
344 344
 			$new_array[$k] = $v;
345 345
 		} else {
346 346
 			array_unshift($new_array, $v);
347 347
 		}
348 348
 	}
349
-	foreach($array as $k => $v) {
350
-		if(is_array($v)) {
349
+	foreach ($array as $k => $v) {
350
+		if (is_array($v)) {
351 351
 			$new_array[$k] = $v;
352 352
 		}
353 353
 	}
354 354
 	return $new_array;
355 355
 }
356 356
 
357
-function treatContent($src, $filename, $alias) {
357
+function treatContent($src, $filename, $alias){
358 358
 	global $modx;
359 359
 
360 360
 	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
361 361
 
362
-	if(preg_match("@<title>(.*)</title>@i", $src, $matches)) {
362
+	if (preg_match("@<title>(.*)</title>@i", $src, $matches)) {
363 363
 		$pagetitle = ($matches[1] !== '') ? $matches[1] : $filename;
364 364
 		$pagetitle = str_replace('[*pagetitle*]', '', $pagetitle);
365 365
 	} else {
366 366
 		$pagetitle = $alias;
367 367
 	}
368
-	if(!$pagetitle) {
368
+	if (!$pagetitle) {
369 369
 		$pagetitle = $alias;
370 370
 	}
371 371
 
372
-	if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
372
+	if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
373 373
 		$description = ($matches[1] !== '') ? $matches[1] : $filename;
374 374
 		$description = str_replace('[*description*]', '', $description);
375 375
 	} else {
376 376
 		$description = '';
377 377
 	}
378 378
 
379
-	if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
379
+	if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
380 380
 		$content = $matches[1];
381 381
 	} else {
382 382
 		$content = $src;
383 383
 		$s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
384
-		$r = '$1' . $modx->config['modx_charset'] . '$2';
384
+		$r = '$1'.$modx->config['modx_charset'].'$2';
385 385
 		$content = preg_replace($s, $r, $content);
386 386
 		$content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
387 387
 	}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	);
396 396
 }
397 397
 
398
-function convertLink() {
398
+function convertLink(){
399 399
 	global $modx;
400 400
 	$tbl_site_content = $modx->getFullTableName('site_content');
401 401
 
@@ -403,33 +403,33 @@  discard block
 block discarded – undo
403 403
 	$p = array();
404 404
     $target = array();
405 405
 	$dir = '';
406
-	while($row = $modx->db->getRow($rs)) {
406
+	while ($row = $modx->db->getRow($rs)) {
407 407
 		$id = $row['id'];
408 408
 		$array = explode('<a href=', $row['content']);
409 409
 		$c = 0;
410
-		foreach($array as $v) {
411
-			if($v[0] === '"') {
410
+		foreach ($array as $v) {
411
+			if ($v[0] === '"') {
412 412
 				$v = substr($v, 1);
413 413
 				list($href, $v) = explode('"', $v, 2);
414 414
 				$_ = $href;
415
-				if(strpos($_, $modx->config['site_url']) !== false) {
416
-					$_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
415
+				if (strpos($_, $modx->config['site_url']) !== false) {
416
+					$_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
417 417
 				}
418
-				if($_[0] === '/') {
418
+				if ($_[0] === '/') {
419 419
 					$_ = substr($_, 1);
420 420
 				}
421 421
 				$_ = str_replace('/index.html', '.html', $_);
422 422
 				$level = substr_count($_, '../');
423
-				if(1 < $level) {
424
-					if(!isset($p[$id])) {
423
+				if (1 < $level) {
424
+					if (!isset($p[$id])) {
425 425
 						$p[$id] = $modx->getParentIds($id);
426 426
 					}
427 427
 					$k = array_keys($p[$id]);
428
-					while(0 < $level) {
428
+					while (0 < $level) {
429 429
 						$dir = array_shift($k);
430 430
 						$level--;
431 431
 					}
432
-					if($dir != '') {
432
+					if ($dir != '') {
433 433
 						$dir .= '/';
434 434
 					}
435 435
 				} else {
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
 				}
438 438
 
439 439
 				$_ = trim($_, './');
440
-				if(strpos($_, '/') !== false) {
440
+				if (strpos($_, '/') !== false) {
441 441
 					$_ = substr($_, strrpos($_, '/'));
442 442
 				}
443
-				$_ = $dir . str_replace('.html', '', $_);
444
-				if(!isset($target[$_])) {
443
+				$_ = $dir.str_replace('.html', '', $_);
444
+				if (!isset($target[$_])) {
445 445
 					$target[$_] = $modx->getIdFromAlias($_);
446 446
 				}
447 447
 				$target[$_] = trim($target[$_]);
448
-				if(!empty($target[$_])) {
449
-					$href = '[~' . $target[$_] . '~]';
448
+				if (!empty($target[$_])) {
449
+					$href = '[~'.$target[$_].'~]';
450 450
 				}
451
-				$array[$c] = '<a href="' . $href . '"' . $v;
451
+				$array[$c] = '<a href="'.$href.'"'.$v;
452 452
 			}
453 453
 			$c++;
454 454
 		}
Please login to merge, or discard this patch.
manager/frames/nodes.functions.inc.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -504,6 +504,9 @@
 block discarded – undo
504 504
 	return $iconsPrivate;
505 505
 }
506 506
 
507
+/**
508
+ * @return string
509
+ */
507 510
 function getNodeTitle($nodeNameSource, $row) {
508 511
 	global $modx;
509 512
 
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @param $theme
11 11
  * @param string $hereid
12 12
  */
13
-function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') {
13
+function makeHTML($indent, $parent, $expandAll, $theme, $hereid = ''){
14 14
 	global $modx;
15 15
 	global $icons, $iconsPrivate, $_style;
16 16
 	global $_lang, $opened, $opened2, $closed2; //added global vars
@@ -21,35 +21,35 @@  discard block
 block discarded – undo
21 21
 	// setup spacer
22 22
 	$level = 0;
23 23
 	$spacer = '<span class="indent">';
24
-	for($i = 2; $i <= $indent; $i++) {
24
+	for ($i = 2; $i <= $indent; $i++) {
25 25
 		$spacer .= '<i></i>';
26 26
 		$level++;
27 27
 	}
28 28
 	$spacer .= '</span>';
29 29
 
30 30
 	// manage order-by
31
-	if(!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) {
31
+	if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) {
32 32
 		// This is the first startup, set default sort order
33 33
 		$_SESSION['tree_sortby'] = 'menuindex';
34 34
 		$_SESSION['tree_sortdir'] = 'ASC';
35 35
 	}
36 36
 
37
-	switch($_SESSION['tree_sortby']) {
37
+	switch ($_SESSION['tree_sortby']) {
38 38
 		case 'createdon':
39 39
 		case 'editedon':
40 40
 		case 'publishedon':
41 41
 		case 'pub_date':
42 42
 		case 'unpub_date':
43
-			$sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']);
43
+			$sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], 'sc.'.$_SESSION['tree_sortby']);
44 44
 			break;
45 45
 		default:
46
-			$sortby = 'sc.' . $_SESSION['tree_sortby'];
46
+			$sortby = 'sc.'.$_SESSION['tree_sortby'];
47 47
 	};
48 48
 
49
-	$orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']);
49
+	$orderby = $modx->db->escape($sortby.' '.$_SESSION['tree_sortdir']);
50 50
 
51 51
 	// Folder sorting gets special setup ;) Add menuindex and pagetitle
52
-	if($_SESSION['tree_sortby'] == 'isfolder') {
52
+	if ($_SESSION['tree_sortby'] == 'isfolder') {
53 53
 		$orderby .= ', menuindex ASC, pagetitle';
54 54
 	}
55 55
 
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	// get document groups for current user
60 60
 	$docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
61 61
 	$showProtected = false;
62
-	if(isset ($modx->config['tree_show_protected'])) {
62
+	if (isset ($modx->config['tree_show_protected'])) {
63 63
 		$showProtected = (boolean) $modx->config['tree_show_protected'];
64 64
 	}
65 65
 	$mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
66
-	if($showProtected == false) {
67
-		$access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
66
+	if ($showProtected == false) {
67
+		$access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
68 68
 	} else {
69 69
 		$access = '';
70 70
 	}
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 	$from = "{$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id LEFT JOIN {$tblst} st on st.id = sc.template";
75 75
 	$where = "(parent={$parent}) {$access} GROUP BY sc.id";
76 76
 	$result = $modx->db->select($field, $from, $where, $orderby);
77
-	if($modx->db->getRecordCount($result) == 0) {
77
+	if ($modx->db->getRecordCount($result) == 0) {
78 78
 		$output .= sprintf('<div><a class="empty">%s%s&nbsp;<span class="empty">%s</span></a></div>', $spacer, $_style['tree_deletedpage'], $_lang['empty_folder']);
79 79
 	}
80 80
 
81 81
 	$nodeNameSource = $_SESSION['tree_nodename'] == 'default' ? $modx->config['resource_tree_node_name'] : $_SESSION['tree_nodename'];
82 82
 
83
-	while($row = $modx->db->getRow($result)) {
83
+	while ($row = $modx->db->getRow($result)) {
84 84
 		$node = '';
85 85
 
86 86
 		$nodetitle = getNodeTitle($nodeNameSource, $row);
@@ -89,46 +89,46 @@  discard block
 block discarded – undo
89 89
 		$treeNodeClass = 'node';
90 90
 		$treeNodeClass .= $row['hasAccess'] == 0 ? ' protected' : '';
91 91
 
92
-		if($row['deleted'] == 1) {
92
+		if ($row['deleted'] == 1) {
93 93
 			$treeNodeClass .= ' deleted';
94 94
 			//$nodetitleDisplay = sprintf('<span class="deletedNode">%s</span>', $nodetitle);
95
-		} elseif($row['published'] == 0) {
95
+		} elseif ($row['published'] == 0) {
96 96
 			$treeNodeClass .= ' unpublished';
97 97
 			//$nodetitleDisplay = sprintf('<span class="unpublishedNode">%s</span>', $nodetitle);
98
-		} elseif($row['hidemenu'] == 1) {
98
+		} elseif ($row['hidemenu'] == 1) {
99 99
 			$treeNodeClass .= ' hidemenu';
100 100
 			//$nodetitleDisplay = sprintf('<span class="notInMenuNode%s">%s</span>', $protectedClass, $nodetitle);
101 101
 		} else {
102 102
 			//$nodetitleDisplay = sprintf('<span class="publishedNode%s">%s</span>', $protectedClass, $nodetitle);
103 103
 		}
104 104
 
105
-		if($row['id'] == $hereid) {
105
+		if ($row['id'] == $hereid) {
106 106
 			$treeNodeClass .= ' current';
107 107
 		}
108 108
 
109 109
 		$weblinkDisplay = $row['type'] == 'reference' ? sprintf('&nbsp;%s', $_style['tree_linkgo']) : '';
110
-		$pageIdDisplay = '<small>(' . ($modx_textdir ? '&rlm;' : '') . $row['id'] . ')</small>';
110
+		$pageIdDisplay = '<small>('.($modx_textdir ? '&rlm;' : '').$row['id'].')</small>';
111 111
 
112 112
 		// Prepare displaying user-locks
113 113
 		$lockedByUser = '';
114 114
 		$rowLock = $modx->elementIsLocked(7, $row['id'], true);
115
-		if($rowLock && $modx->hasPermission('display_locks')) {
116
-			if($rowLock['sid'] == $modx->sid) {
115
+		if ($rowLock && $modx->hasPermission('display_locks')) {
116
+			if ($rowLock['sid'] == $modx->sid) {
117 117
 				$title = $modx->parseText($_lang["lock_element_editing"], array(
118 118
 					'element_type' => $_lang["lock_element_type_7"],
119 119
 					'lasthit_df' => $rowLock['lasthit_df']
120 120
 				));
121
-				$lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>';
121
+				$lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>';
122 122
 			} else {
123 123
 				$title = $modx->parseText($_lang["lock_element_locked_by"], array(
124 124
 					'element_type' => $_lang["lock_element_type_7"],
125 125
 					'username' => $rowLock['username'],
126 126
 					'lasthit_df' => $rowLock['lasthit_df']
127 127
 				));
128
-				if($modx->hasPermission('remove_locks')) {
129
-					$lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
128
+				if ($modx->hasPermission('remove_locks')) {
129
+					$lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
130 130
 				} else {
131
-					$lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
131
+					$lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
132 132
 				}
133 133
 			}
134 134
 		}
@@ -136,23 +136,23 @@  discard block
 block discarded – undo
136 136
 		$url = $modx->makeUrl($row['id']);
137 137
 
138 138
 		$title = '';
139
-		if(isDateNode($nodeNameSource)) {
140
-			$title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]';
139
+		if (isDateNode($nodeNameSource)) {
140
+			$title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]';
141 141
 		}
142
-		$title .= $_lang['id'] . ': ' . $row['id'];
143
-		$title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle'];
144
-		$title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex'];
145
-		$title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-');
146
-		$title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename'];
147
-		$title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']);
148
-		$title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']);
149
-		$title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']);
150
-		$title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
151
-		$title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
152
-		$title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
153
-		$title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
142
+		$title .= $_lang['id'].': '.$row['id'];
143
+		$title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle'];
144
+		$title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex'];
145
+		$title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-');
146
+		$title .= '[+lf+]'.$_lang['template'].': '.$row['templatename'];
147
+		$title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']);
148
+		$title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']);
149
+		$title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']);
150
+		$title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
151
+		$title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
152
+		$title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
153
+		$title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
154 154
 		$title = $modx->htmlspecialchars($title);
155
-		$title = str_replace('[+lf+]', ' &#13;', $title);   // replace line-breaks with empty space as fall-back
155
+		$title = str_replace('[+lf+]', ' &#13;', $title); // replace line-breaks with empty space as fall-back
156 156
 
157 157
 		$data = array(
158 158
 			'id' => $row['id'],
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 		$ph['expandAll'] = $expandAll;
202 202
 		$ph['isPrivate'] = ($row['privateweb'] || $row['privatemgr']) ? 1 : 0;
203 203
 
204
-		if(!$row['isfolder']) {
204
+		if (!$row['isfolder']) {
205 205
 			$tpl = getTplSingleNode();
206
-			switch($row['id']) {
206
+			switch ($row['id']) {
207 207
 				case $modx->config['site_start']            :
208 208
 					$icon = $_style['tree_page_home'];
209 209
 					break;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 					$icon = $_style['tree_page_info'];
218 218
 					break;
219 219
 				default:
220
-					if(isset($icons[$row['contentType']])) {
220
+					if (isset($icons[$row['contentType']])) {
221 221
 						$icon = $icons[$row['contentType']];
222 222
 					} else {
223 223
 						$icon = $_style['tree_page'];
@@ -227,20 +227,20 @@  discard block
 block discarded – undo
227 227
 
228 228
 			// invoke OnManagerNodePrerender event
229 229
 			$prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph));
230
-			if(is_array($prenode)) {
230
+			if (is_array($prenode)) {
231 231
 				$phnew = array();
232
-				foreach($prenode as $pnode) {
232
+				foreach ($prenode as $pnode) {
233 233
 					$phnew = array_merge($phnew, unserialize($pnode));
234 234
 				}
235 235
 				$ph = (count($phnew) > 0) ? $phnew : $ph;
236 236
 			}
237 237
 
238
-			if($ph['contextmenu']) {
239
-				$ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
238
+			if ($ph['contextmenu']) {
239
+				$ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
240 240
 			}
241 241
 
242
-			if($_SESSION['tree_show_only_folders']) {
243
-				if($row['parent'] == 0) {
242
+			if ($_SESSION['tree_show_only_folders']) {
243
+				if ($row['parent'] == 0) {
244 244
 					$node .= $modx->parseText($tpl, $ph);
245 245
 				} else {
246 246
 					$node .= '';
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
 			$ph['icon_folder_open'] = $_style['tree_folderopen_new'];
254 254
 			$ph['icon_folder_close'] = $_style['tree_folder_new'];
255 255
 
256
-			if($_SESSION['tree_show_only_folders']) {
256
+			if ($_SESSION['tree_show_only_folders']) {
257 257
 				$tpl = getTplFolderNodeNotChildren();
258 258
 				$checkFolders = checkIsFolder($row['id'], 1) ? 1 : 0; // folders
259 259
 				$checkDocs = checkIsFolder($row['id'], 0) ? 1 : 0; // no folders
260 260
 				$ph['tree_page_click'] = 3;
261 261
 
262 262
 				// expandAll: two type for partial expansion
263
-				if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) {
264
-					if($expandAll == 1) {
263
+				if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) {
264
+					if ($expandAll == 1) {
265 265
 						$opened2[] = $row['id'];
266 266
 					}
267 267
 					$ph['icon'] = $ph['icon_folder_open'];
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 					$ph['node_toggle'] = 1;
270 270
 					$ph['subMenuState'] = ' open';
271 271
 
272
-					if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) {
272
+					if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) {
273 273
 						$ph['showChildren'] = 1;
274 274
 						$ph['icon_node_toggle'] = '';
275 275
 						$ph['icon'] = $ph['icon_folder_close'];
276
-					} elseif(!$checkDocs && $checkFolders) {
276
+					} elseif (!$checkDocs && $checkFolders) {
277 277
 						$ph['showChildren'] = 0;
278 278
 						$ph['openFolder'] = 2;
279 279
 					} else {
@@ -285,20 +285,20 @@  discard block
 block discarded – undo
285 285
 						'ph' => $ph,
286 286
 						'opened' => '1'
287 287
 					));
288
-					if(is_array($prenode)) {
288
+					if (is_array($prenode)) {
289 289
 						$phnew = array();
290
-						foreach($prenode as $pnode) {
290
+						foreach ($prenode as $pnode) {
291 291
 							$phnew = array_merge($phnew, unserialize($pnode));
292 292
 						}
293 293
 						$ph = (count($phnew) > 0) ? $phnew : $ph;
294 294
 					}
295 295
 
296
-					if($ph['contextmenu']) {
297
-						$ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
296
+					if ($ph['contextmenu']) {
297
+						$ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
298 298
 					}
299 299
 
300 300
 					$node .= $modx->parseText($tpl, $ph);
301
-					if($checkFolders) {
301
+					if ($checkFolders) {
302 302
 						$node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid);
303 303
 					}
304 304
 					$node .= '</div></div>';
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 					$ph['icon_node_toggle'] = $ph['tree_plusnode'];
309 309
 					$ph['node_toggle'] = 0;
310 310
 
311
-					if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) {
311
+					if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) {
312 312
 						$ph['showChildren'] = 1;
313 313
 						$ph['icon_node_toggle'] = '';
314
-					} elseif(!$checkDocs && $checkFolders) {
314
+					} elseif (!$checkDocs && $checkFolders) {
315 315
 						$ph['showChildren'] = 0;
316 316
 						$ph['openFolder'] = 2;
317 317
 					} else {
@@ -323,16 +323,16 @@  discard block
 block discarded – undo
323 323
 						'ph' => $ph,
324 324
 						'opened' => '0'
325 325
 					));
326
-					if(is_array($prenode)) {
326
+					if (is_array($prenode)) {
327 327
 						$phnew = array();
328
-						foreach($prenode as $pnode) {
328
+						foreach ($prenode as $pnode) {
329 329
 							$phnew = array_merge($phnew, unserialize($pnode));
330 330
 						}
331 331
 						$ph = (count($phnew) > 0) ? $phnew : $ph;
332 332
 					}
333 333
 
334
-					if($ph['contextmenu']) {
335
-						$ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
334
+					if ($ph['contextmenu']) {
335
+						$ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
336 336
 					}
337 337
 
338 338
 					$node .= $modx->parseText($tpl, $ph);
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 			} else {
342 342
 				$tpl = getTplFolderNode();
343 343
 				// expandAll: two type for partial expansion
344
-				if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) {
345
-					if($expandAll == 1) {
344
+				if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) {
345
+					if ($expandAll == 1) {
346 346
 						$opened2[] = $row['id'];
347 347
 					}
348 348
 					$ph['icon'] = $ph['icon_folder_open'];
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 					$ph['node_toggle'] = 1;
351 351
 					$ph['subMenuState'] = ' open';
352 352
 
353
-					if($ph['donthit'] == 1) {
353
+					if ($ph['donthit'] == 1) {
354 354
 						$ph['tree_page_click'] = 3;
355 355
 						$ph['icon_node_toggle'] = '';
356 356
 						$ph['icon'] = $ph['icon_folder_close'];
@@ -362,32 +362,32 @@  discard block
 block discarded – undo
362 362
 						'ph' => $ph,
363 363
 						'opened' => '1'
364 364
 					));
365
-					if(is_array($prenode)) {
365
+					if (is_array($prenode)) {
366 366
 						$phnew = array();
367
-						foreach($prenode as $pnode) {
367
+						foreach ($prenode as $pnode) {
368 368
 							$phnew = array_merge($phnew, unserialize($pnode));
369 369
 						}
370 370
 						$ph = (count($phnew) > 0) ? $phnew : $ph;
371
-						if($ph['showChildren'] == 0) {
371
+						if ($ph['showChildren'] == 0) {
372 372
 							unset($opened2[$row['id']]);
373 373
 							$ph['node_toggle'] = 0;
374 374
 							$ph['subMenuState'] = '';
375 375
 						}
376 376
 					}
377 377
 
378
-					if($ph['showChildren'] == 0) {
378
+					if ($ph['showChildren'] == 0) {
379 379
 						$ph['icon_node_toggle'] = '';
380 380
 						$ph['donthit'] = 1;
381 381
 						$ph['icon'] = $ph['icon_folder_close'];
382 382
 						$tpl = getTplFolderNodeNotChildren();
383 383
 					}
384 384
 
385
-					if($ph['contextmenu']) {
386
-						$ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
385
+					if ($ph['contextmenu']) {
386
+						$ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
387 387
 					}
388 388
 
389 389
 					$node .= $modx->parseText($tpl, $ph);
390
-					if($ph['donthit'] == 0) {
390
+					if ($ph['donthit'] == 0) {
391 391
 						$node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid);
392 392
 					}
393 393
 					$node .= '</div></div>';
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 					$ph['icon_node_toggle'] = $ph['tree_plusnode'];
398 398
 					$ph['node_toggle'] = 0;
399 399
 
400
-					if($ph['donthit'] == 1) {
400
+					if ($ph['donthit'] == 1) {
401 401
 						$ph['tree_page_click'] = 3;
402 402
 						$ph['icon_node_toggle'] = '';
403 403
 						$ph['icon'] = $ph['icon_folder_close'];
@@ -409,23 +409,23 @@  discard block
 block discarded – undo
409 409
 						'ph' => $ph,
410 410
 						'opened' => '0'
411 411
 					));
412
-					if(is_array($prenode)) {
412
+					if (is_array($prenode)) {
413 413
 						$phnew = array();
414
-						foreach($prenode as $pnode) {
414
+						foreach ($prenode as $pnode) {
415 415
 							$phnew = array_merge($phnew, unserialize($pnode));
416 416
 						}
417 417
 						$ph = (count($phnew) > 0) ? $phnew : $ph;
418 418
 					}
419 419
 
420
-					if($ph['showChildren'] == 0) {
420
+					if ($ph['showChildren'] == 0) {
421 421
 						$ph['icon_node_toggle'] = '';
422 422
 						$ph['donthit'] = 1;
423 423
 						$ph['icon'] = $ph['icon_folder_close'];
424 424
 						$tpl = getTplFolderNodeNotChildren();
425 425
 					}
426 426
 
427
-					if($ph['contextmenu']) {
428
-						$ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
427
+					if ($ph['contextmenu']) {
428
+						$ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
429 429
 					}
430 430
 
431 431
 					$node .= $modx->parseText($tpl, $ph);
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
 		// invoke OnManagerNodeRender event
438 438
 		$data['node'] = $node;
439 439
 		$evtOut = $modx->invokeEvent('OnManagerNodeRender', $data);
440
-		if(is_array($evtOut)) {
440
+		if (is_array($evtOut)) {
441 441
 			$evtOut = implode("\n", $evtOut);
442 442
 		}
443
-		if($evtOut != '') {
443
+		if ($evtOut != '') {
444 444
 			$node = trim($evtOut);
445 445
 		}
446 446
 
@@ -450,14 +450,14 @@  discard block
 block discarded – undo
450 450
 	return $output;
451 451
 }
452 452
 
453
-function getIconInfo($_style) {
454
-	if(!isset($_style['tree_page_gif'])) {
453
+function getIconInfo($_style){
454
+	if (!isset($_style['tree_page_gif'])) {
455 455
 		$_style['tree_page_gif'] = $_style['tree_page'];
456 456
 	}
457
-	if(!isset($_style['tree_page_jpg'])) {
457
+	if (!isset($_style['tree_page_jpg'])) {
458 458
 		$_style['tree_page_jpg'] = $_style['tree_page'];
459 459
 	}
460
-	if(!isset($_style['tree_page_png'])) {
460
+	if (!isset($_style['tree_page_png'])) {
461 461
 		$_style['tree_page_png'] = $_style['tree_page'];
462 462
 	}
463 463
 	$icons = array(
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
 	return $icons;
478 478
 }
479 479
 
480
-function getPrivateIconInfo($_style) {
481
-	if(!isset($_style['tree_page_gif_secure'])) {
480
+function getPrivateIconInfo($_style){
481
+	if (!isset($_style['tree_page_gif_secure'])) {
482 482
 		$_style['tree_page_gif_secure'] = $_style['tree_page_secure'];
483 483
 	}
484
-	if(!isset($_style['tree_page_jpg_secure'])) {
484
+	if (!isset($_style['tree_page_jpg_secure'])) {
485 485
 		$_style['tree_page_jpg_secure'] = $_style['tree_page_secure'];
486 486
 	}
487
-	if(!isset($_style['tree_page_png_secure'])) {
487
+	if (!isset($_style['tree_page_png_secure'])) {
488 488
 		$_style['tree_page_png_secure'] = $_style['tree_page_secure'];
489 489
 	}
490 490
 	$iconsPrivate = array(
@@ -504,21 +504,21 @@  discard block
 block discarded – undo
504 504
 	return $iconsPrivate;
505 505
 }
506 506
 
507
-function getNodeTitle($nodeNameSource, $row) {
507
+function getNodeTitle($nodeNameSource, $row){
508 508
 	global $modx;
509 509
 
510
-	switch($nodeNameSource) {
510
+	switch ($nodeNameSource) {
511 511
 		case 'menutitle':
512 512
 			$nodetitle = $row['menutitle'] ? $row['menutitle'] : $row['pagetitle'];
513 513
 			break;
514 514
 		case 'alias':
515 515
 			$nodetitle = $row['alias'] ? $row['alias'] : $row['id'];
516
-			if(strpos($row['alias'], '.') === false) {
517
-				if($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) {
516
+			if (strpos($row['alias'], '.') === false) {
517
+				if ($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) {
518 518
 					$nodetitle .= $modx->config['friendly_url_suffix'];
519 519
 				}
520 520
 			}
521
-			$nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle;
521
+			$nodetitle = $modx->config['friendly_url_prefix'].$nodetitle;
522 522
 			break;
523 523
 		case 'pagetitle':
524 524
 			$nodetitle = $row['pagetitle'];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 		case 'unpub_date':
534 534
 			$doc = $modx->getDocumentObject('id', $row['id']);
535 535
 			$date = $doc[$nodeNameSource];
536
-			if(!empty($date)) {
536
+			if (!empty($date)) {
537 537
 				$nodetitle = $modx->toDateFormat($date);
538 538
 			} else {
539 539
 				$nodetitle = '- - -';
@@ -550,8 +550,8 @@  discard block
 block discarded – undo
550 550
 	return $nodetitle;
551 551
 }
552 552
 
553
-function isDateNode($nodeNameSource) {
554
-	switch($nodeNameSource) {
553
+function isDateNode($nodeNameSource){
554
+	switch ($nodeNameSource) {
555 555
 		case 'createdon':
556 556
 		case 'editedon':
557 557
 		case 'publishedon':
@@ -563,13 +563,13 @@  discard block
 block discarded – undo
563 563
 	}
564 564
 }
565 565
 
566
-function checkIsFolder($parent = 0, $isfolder = 1) {
566
+function checkIsFolder($parent = 0, $isfolder = 1){
567 567
 	global $modx;
568 568
 
569
-	return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
569
+	return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' '));
570 570
 }
571 571
 
572
-function _htmlentities($array) {
572
+function _htmlentities($array){
573 573
 	global $modx;
574 574
 
575 575
 	$array = json_encode($array, JSON_UNESCAPED_UNICODE);
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	return $array;
579 579
 }
580 580
 
581
-function getTplSingleNode() {
581
+function getTplSingleNode(){
582 582
 	return '<div id="node[+id+]"><a class="[+treeNodeClass+]"
583 583
         onclick="modx.tree.treeAction(event,[+id+]);"
584 584
         oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');"
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a></div>';
603 603
 }
604 604
 
605
-function getTplFolderNode() {
605
+function getTplFolderNode(){
606 606
 	return '<div id="node[+id+]"><a class="[+treeNodeClass+]"
607 607
         onclick="modx.tree.treeAction(event,[+id+]);"
608 608
         oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');"
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
         title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>';
639 639
 }
640 640
 
641
-function getTplFolderNodeNotChildren() {
641
+function getTplFolderNodeNotChildren(){
642 642
 	return '<div id="node[+id+]"><a class="[+treeNodeClass+]"
643 643
         onclick="modx.tree.treeAction(event,[+id+]);"
644 644
         oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');"
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
         title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>';
671 671
 }
672 672
 
673
-function dbug($str, $flag = false) {
673
+function dbug($str, $flag = false){
674 674
 	print('<pre>');
675 675
 	print_r($str);
676 676
 	print('</pre>');
677
-	if($flag) {
677
+	if ($flag) {
678 678
 		exit;
679 679
 	}
680 680
 }
Please login to merge, or discard this patch.
manager/includes/categories.inc.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -3,6 +3,9 @@
 block discarded – undo
3 3
 //Kyle Jaebker - 08/07/06
4 4
 
5 5
 //Create a new category
6
+/**
7
+ * @param string $newCat
8
+ */
6 9
 function newCategory($newCat) {
7 10
     global $modx;
8 11
     $useTable = $modx->getFullTableName('categories');
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 //Kyle Jaebker - 08/07/06
4 4
 
5 5
 //Create a new category
6
-function newCategory($newCat) {
6
+function newCategory($newCat){
7 7
     global $modx;
8 8
     $useTable = $modx->getFullTableName('categories');
9 9
     $categoryId = $modx->db->insert(
@@ -14,36 +14,36 @@  discard block
 block discarded – undo
14 14
     return $categoryId;
15 15
 }
16 16
 //check if new category already exists
17
-function checkCategory($newCat = '') {
17
+function checkCategory($newCat = ''){
18 18
     global $modx;
19 19
     $useTable = $modx->getFullTableName('categories');
20 20
     $newCat = $modx->db->escape($newCat);
21 21
     $cats = $modx->db->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'");
22
-	if($cat = $modx->db->getValue($cats)) {
22
+	if ($cat = $modx->db->getValue($cats)) {
23 23
 		return $cat;
24 24
 	}
25 25
     return 0;
26 26
 }
27 27
 //Check for category, create new if not exists
28
-function getCategory($category='') {
28
+function getCategory($category = ''){
29 29
     $categoryId = checkCategory($category);
30
-    if(!$categoryId) $categoryId = newCategory($category);
30
+    if (!$categoryId) $categoryId = newCategory($category);
31 31
     return $categoryId;
32 32
 }
33 33
 //Get all categories
34
-function getCategories() {
34
+function getCategories(){
35 35
     global $modx;
36 36
     $useTable = $modx->getFullTableName('categories');
37 37
     $cats = $modx->db->select('id, category', $modx->getFullTableName('categories'), '', 'category');
38 38
 	$resourceArray = array();
39
-    while($row = $modx->db->getRow($cats)) {
39
+    while ($row = $modx->db->getRow($cats)) {
40 40
         $row['category'] = stripslashes($row['category']);
41 41
         $resourceArray[] = $row;
42 42
     }
43 43
     return $resourceArray;
44 44
 }
45 45
 //Delete category & associations
46
-function deleteCategory($catId=0) {
46
+function deleteCategory($catId = 0){
47 47
     global $modx;
48 48
     if ($catId) {
49 49
         $resetTables = array('site_plugins', 'site_snippets', 'site_htmlsnippets', 'site_templates', 'site_tmplvars', 'site_modules');
Please login to merge, or discard this patch.
manager/includes/controls/phpmailer/PHPMailer.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3968,7 +3968,7 @@
 block discarded – undo
3968 3968
      * @param int|string $options Either a PATHINFO_* constant,
3969 3969
      *                            or a string name to return only the specified piece
3970 3970
      *
3971
-     * @return string|array
3971
+     * @return string
3972 3972
      */
3973 3973
     public static function mb_pathinfo($path, $options = null)
3974 3974
     {
Please login to merge, or discard this patch.
Spacing   +135 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1076,10 +1076,10 @@  discard block
 block discarded – undo
1076 1076
             $list = imap_rfc822_parse_adrlist($addrstr, '');
1077 1077
             foreach ($list as $address) {
1078 1078
                 if ('.SYNTAX-ERROR.' != $address->host) {
1079
-                    if (static::validateAddress($address->mailbox . '@' . $address->host)) {
1079
+                    if (static::validateAddress($address->mailbox.'@'.$address->host)) {
1080 1080
                         $addresses[] = [
1081 1081
                             'name' => (property_exists($address, 'personal') ? $address->personal : ''),
1082
-                            'address' => $address->mailbox . '@' . $address->host,
1082
+                            'address' => $address->mailbox.'@'.$address->host,
1083 1083
                         ];
1084 1084
                     }
1085 1085
                 }
@@ -1225,14 +1225,14 @@  discard block
 block discarded – undo
1225 1225
                  * Feel free to use and redistribute this code. But please keep this copyright notice.
1226 1226
                  */
1227 1227
                 return (bool) preg_match(
1228
-                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
1229
-                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
1230
-                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
1231
-                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
1232
-                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
1233
-                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
1234
-                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
1235
-                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
1228
+                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)'.
1229
+                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)'.
1230
+                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)'.
1231
+                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*'.
1232
+                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)'.
1233
+                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}'.
1234
+                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:'.
1235
+                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}'.
1236 1236
                     '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
1237 1237
                     $address
1238 1238
                 );
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
                  * @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
1244 1244
                  */
1245 1245
                 return (bool) preg_match(
1246
-                    '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
1246
+                    '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}'.
1247 1247
                     '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
1248 1248
                     $address
1249 1249
                 );
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
                 $errorcode = 0;
1295 1295
                 $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46);
1296 1296
                 if (false !== $punycode) {
1297
-                    return substr($address, 0, $pos) . $punycode;
1297
+                    return substr($address, 0, $pos).$punycode;
1298 1298
                 }
1299 1299
             }
1300 1300
         }
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
                     and version_compare(PHP_VERSION, '7.1.3', '<')))
1359 1359
         ) {
1360 1360
             trigger_error(
1361
-                'Your version of PHP is affected by a bug that may result in corrupted messages.' .
1362
-                ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
1361
+                'Your version of PHP is affected by a bug that may result in corrupted messages.'.
1362
+                ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in'.
1363 1363
                 ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
1364 1364
                 E_USER_WARNING
1365 1365
             );
@@ -1443,12 +1443,12 @@  discard block
 block discarded – undo
1443 1443
                 )
1444 1444
             ) {
1445 1445
                 $header_dkim = $this->DKIM_Add(
1446
-                    $this->MIMEHeader . $this->mailHeader,
1446
+                    $this->MIMEHeader.$this->mailHeader,
1447 1447
                     $this->encodeHeader($this->secureHeader($this->Subject)),
1448 1448
                     $this->MIMEBody
1449 1449
                 );
1450
-                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . static::$LE .
1451
-                    static::normalizeBreaks($header_dkim) . static::$LE;
1450
+                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ").static::$LE.
1451
+                    static::normalizeBreaks($header_dkim).static::$LE;
1452 1452
             }
1453 1453
 
1454 1454
             return true;
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
                 case 'mail':
1483 1483
                     return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
1484 1484
                 default:
1485
-                    $sendMethod = $this->Mailer . 'Send';
1485
+                    $sendMethod = $this->Mailer.'Send';
1486 1486
                     if (method_exists($this, $sendMethod)) {
1487 1487
                         return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
1488 1488
                     }
@@ -1535,9 +1535,9 @@  discard block
 block discarded – undo
1535 1535
             foreach ($this->SingleToArray as $toAddr) {
1536 1536
                 $mail = @popen($sendmail, 'w');
1537 1537
                 if (!$mail) {
1538
-                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1538
+                    throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1539 1539
                 }
1540
-                fwrite($mail, 'To: ' . $toAddr . "\n");
1540
+                fwrite($mail, 'To: '.$toAddr."\n");
1541 1541
                 fwrite($mail, $header);
1542 1542
                 fwrite($mail, $body);
1543 1543
                 $result = pclose($mail);
@@ -1552,13 +1552,13 @@  discard block
 block discarded – undo
1552 1552
                     []
1553 1553
                 );
1554 1554
                 if (0 !== $result) {
1555
-                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1555
+                    throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1556 1556
                 }
1557 1557
             }
1558 1558
         } else {
1559 1559
             $mail = @popen($sendmail, 'w');
1560 1560
             if (!$mail) {
1561
-                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1561
+                throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1562 1562
             }
1563 1563
             fwrite($mail, $header);
1564 1564
             fwrite($mail, $body);
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
                 []
1575 1575
             );
1576 1576
             if (0 !== $result) {
1577
-                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1577
+                throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1578 1578
             }
1579 1579
         }
1580 1580
 
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
             $smtp_from = $this->Sender;
1733 1733
         }
1734 1734
         if (!$this->smtp->mail($smtp_from)) {
1735
-            $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
1735
+            $this->setError($this->lang('from_failed').$smtp_from.' : '.implode(',', $this->smtp->getError()));
1736 1736
             throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);
1737 1737
         }
1738 1738
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
         }
1754 1754
 
1755 1755
         // Only send the DATA command if we have viable recipients
1756
-        if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
1756
+        if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header.$body)) {
1757 1757
             throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL);
1758 1758
         }
1759 1759
 
@@ -1783,10 +1783,10 @@  discard block
 block discarded – undo
1783 1783
         if (count($bad_rcpt) > 0) {
1784 1784
             $errstr = '';
1785 1785
             foreach ($bad_rcpt as $bad) {
1786
-                $errstr .= $bad['to'] . ': ' . $bad['error'];
1786
+                $errstr .= $bad['to'].': '.$bad['error'];
1787 1787
             }
1788 1788
             throw new Exception(
1789
-                $this->lang('recipients_failed') . $errstr,
1789
+                $this->lang('recipients_failed').$errstr,
1790 1790
                 self::STOP_CONTINUE
1791 1791
             );
1792 1792
         }
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
                 trim($hostentry),
1837 1837
                 $hostinfo
1838 1838
             )) {
1839
-                static::edebug($this->lang('connect_host') . ' ' . $hostentry);
1839
+                static::edebug($this->lang('connect_host').' '.$hostentry);
1840 1840
                 // Not a valid host entry
1841 1841
                 continue;
1842 1842
             }
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
 
1849 1849
             //Check the host name is a valid name or IP address before trying to use it
1850 1850
             if (!static::isValidHost($hostinfo[3])) {
1851
-                static::edebug($this->lang('connect_host') . ' ' . $hostentry);
1851
+                static::edebug($this->lang('connect_host').' '.$hostentry);
1852 1852
                 continue;
1853 1853
             }
1854 1854
             $prefix = '';
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
             if ('tls' === $secure or 'ssl' === $secure) {
1869 1869
                 //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
1870 1870
                 if (!$sslext) {
1871
-                    throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL);
1871
+                    throw new Exception($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
1872 1872
                 }
1873 1873
             }
1874 1874
             $host = $hostinfo[3];
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
             if ($tport > 0 and $tport < 65536) {
1878 1878
                 $port = $tport;
1879 1879
             }
1880
-            if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
1880
+            if ($this->smtp->connect($prefix.$host, $port, $this->Timeout, $options)) {
1881 1881
                 try {
1882 1882
                     if ($this->Helo) {
1883 1883
                         $hello = $this->Helo;
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
         ];
1995 1995
         if (empty($lang_path)) {
1996 1996
             // Calculate an absolute path so it can work if CWD is not here
1997
-            $lang_path = __DIR__ . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
1997
+            $lang_path = __DIR__.DIRECTORY_SEPARATOR.'language'.DIRECTORY_SEPARATOR;
1998 1998
         }
1999 1999
         //Validate $langcode
2000 2000
         if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
2001 2001
             $langcode = 'en';
2002 2002
         }
2003 2003
         $foundlang = true;
2004
-        $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
2004
+        $lang_file = $lang_path.'phpmailer.lang-'.$langcode.'.php';
2005 2005
         // There is no English translation file
2006 2006
         if ('en' != $langcode) {
2007 2007
             // Make sure language file path is readable
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
             $addresses[] = $this->addrFormat($address);
2047 2047
         }
2048 2048
 
2049
-        return $type . ': ' . implode(', ', $addresses) . static::$LE;
2049
+        return $type.': '.implode(', ', $addresses).static::$LE;
2050 2050
     }
2051 2051
 
2052 2052
     /**
@@ -2063,9 +2063,9 @@  discard block
 block discarded – undo
2063 2063
             return $this->secureHeader($addr[0]);
2064 2064
         }
2065 2065
 
2066
-        return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
2066
+        return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase').' <'.$this->secureHeader(
2067 2067
                 $addr[0]
2068
-            ) . '>';
2068
+            ).'>';
2069 2069
     }
2070 2070
 
2071 2071
     /**
@@ -2122,10 +2122,10 @@  discard block
 block discarded – undo
2122 2122
                             }
2123 2123
                             $part = substr($word, 0, $len);
2124 2124
                             $word = substr($word, $len);
2125
-                            $buf .= ' ' . $part;
2126
-                            $message .= $buf . sprintf('=%s', static::$LE);
2125
+                            $buf .= ' '.$part;
2126
+                            $message .= $buf.sprintf('=%s', static::$LE);
2127 2127
                         } else {
2128
-                            $message .= $buf . $soft_break;
2128
+                            $message .= $buf.$soft_break;
2129 2129
                         }
2130 2130
                         $buf = '';
2131 2131
                     }
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
                         $word = substr($word, $len);
2146 2146
 
2147 2147
                         if (strlen($word) > 0) {
2148
-                            $message .= $part . sprintf('=%s', static::$LE);
2148
+                            $message .= $part.sprintf('=%s', static::$LE);
2149 2149
                         } else {
2150 2150
                             $buf = $part;
2151 2151
                         }
@@ -2158,13 +2158,13 @@  discard block
 block discarded – undo
2158 2158
                     $buf .= $word;
2159 2159
 
2160 2160
                     if (strlen($buf) > $length and '' != $buf_o) {
2161
-                        $message .= $buf_o . $soft_break;
2161
+                        $message .= $buf_o.$soft_break;
2162 2162
                         $buf = $word;
2163 2163
                     }
2164 2164
                 }
2165 2165
                 $firstword = false;
2166 2166
             }
2167
-            $message .= $buf . static::$LE;
2167
+            $message .= $buf.static::$LE;
2168 2168
         }
2169 2169
 
2170 2170
         return $message;
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
         if ('' == $this->XMailer) {
2311 2311
             $result .= $this->headerLine(
2312 2312
                 'X-Mailer',
2313
-                'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)'
2313
+                'PHPMailer '.self::VERSION.' (https://github.com/PHPMailer/PHPMailer)'
2314 2314
             );
2315 2315
         } else {
2316 2316
             $myXmailer = trim($this->XMailer);
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
         }
2321 2321
 
2322 2322
         if ('' != $this->ConfirmReadingTo) {
2323
-            $result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
2323
+            $result .= $this->headerLine('Disposition-Notification-To', '<'.$this->ConfirmReadingTo.'>');
2324 2324
         }
2325 2325
 
2326 2326
         // Add custom headers
@@ -2350,23 +2350,23 @@  discard block
 block discarded – undo
2350 2350
         switch ($this->message_type) {
2351 2351
             case 'inline':
2352 2352
                 $result .= $this->headerLine('Content-Type', 'multipart/related;');
2353
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2353
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2354 2354
                 break;
2355 2355
             case 'attach':
2356 2356
             case 'inline_attach':
2357 2357
             case 'alt_attach':
2358 2358
             case 'alt_inline_attach':
2359 2359
                 $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
2360
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2360
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2361 2361
                 break;
2362 2362
             case 'alt':
2363 2363
             case 'alt_inline':
2364 2364
                 $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
2365
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2365
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2366 2366
                 break;
2367 2367
             default:
2368 2368
                 // Catches case 'plain': and case '':
2369
-                $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
2369
+                $result .= $this->textLine('Content-Type: '.$this->ContentType.'; charset='.$this->CharSet);
2370 2370
                 $ismultipart = false;
2371 2371
                 break;
2372 2372
         }
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
      */
2402 2402
     public function getSentMIMEMessage()
2403 2403
     {
2404
-        return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . static::$LE . static::$LE . $this->MIMEBody;
2404
+        return rtrim($this->MIMEHeader.$this->mailHeader, "\n\r").static::$LE.static::$LE.$this->MIMEBody;
2405 2405
     }
2406 2406
 
2407 2407
     /**
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
         $body = '';
2439 2439
         //Create unique IDs and preset boundaries
2440 2440
         $this->uniqueid = $this->generateId();
2441
-        $this->boundary[1] = 'b1_' . $this->uniqueid;
2442
-        $this->boundary[2] = 'b2_' . $this->uniqueid;
2443
-        $this->boundary[3] = 'b3_' . $this->uniqueid;
2441
+        $this->boundary[1] = 'b1_'.$this->uniqueid;
2442
+        $this->boundary[2] = 'b2_'.$this->uniqueid;
2443
+        $this->boundary[3] = 'b3_'.$this->uniqueid;
2444 2444
 
2445 2445
         if ($this->sign_key_file) {
2446
-            $body .= $this->getMailMIME() . static::$LE;
2446
+            $body .= $this->getMailMIME().static::$LE;
2447 2447
         }
2448 2448
 
2449 2449
         $this->setWordWrap();
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
             $altBodyEncoding = 'quoted-printable';
2477 2477
         }
2478 2478
         //Use this as a preamble in all multipart message types
2479
-        $mimepre = 'This is a multi-part message in MIME format.' . static::$LE;
2479
+        $mimepre = 'This is a multi-part message in MIME format.'.static::$LE;
2480 2480
         switch ($this->message_type) {
2481 2481
             case 'inline':
2482 2482
                 $body .= $mimepre;
@@ -2494,9 +2494,9 @@  discard block
 block discarded – undo
2494 2494
                 break;
2495 2495
             case 'inline_attach':
2496 2496
                 $body .= $mimepre;
2497
-                $body .= $this->textLine('--' . $this->boundary[1]);
2497
+                $body .= $this->textLine('--'.$this->boundary[1]);
2498 2498
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2499
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2499
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2500 2500
                 $body .= static::$LE;
2501 2501
                 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
2502 2502
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2525,9 +2525,9 @@  discard block
 block discarded – undo
2525 2525
                 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2526 2526
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2527 2527
                 $body .= static::$LE;
2528
-                $body .= $this->textLine('--' . $this->boundary[1]);
2528
+                $body .= $this->textLine('--'.$this->boundary[1]);
2529 2529
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2530
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2530
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2531 2531
                 $body .= static::$LE;
2532 2532
                 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
2533 2533
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2538,9 +2538,9 @@  discard block
 block discarded – undo
2538 2538
                 break;
2539 2539
             case 'alt_attach':
2540 2540
                 $body .= $mimepre;
2541
-                $body .= $this->textLine('--' . $this->boundary[1]);
2541
+                $body .= $this->textLine('--'.$this->boundary[1]);
2542 2542
                 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2543
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2543
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2544 2544
                 $body .= static::$LE;
2545 2545
                 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2546 2546
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
@@ -2558,16 +2558,16 @@  discard block
 block discarded – undo
2558 2558
                 break;
2559 2559
             case 'alt_inline_attach':
2560 2560
                 $body .= $mimepre;
2561
-                $body .= $this->textLine('--' . $this->boundary[1]);
2561
+                $body .= $this->textLine('--'.$this->boundary[1]);
2562 2562
                 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2563
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2563
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2564 2564
                 $body .= static::$LE;
2565 2565
                 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2566 2566
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2567 2567
                 $body .= static::$LE;
2568
-                $body .= $this->textLine('--' . $this->boundary[2]);
2568
+                $body .= $this->textLine('--'.$this->boundary[2]);
2569 2569
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2570
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
2570
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[3].'"');
2571 2571
                 $body .= static::$LE;
2572 2572
                 $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
2573 2573
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2594,12 +2594,12 @@  discard block
 block discarded – undo
2594 2594
         } elseif ($this->sign_key_file) {
2595 2595
             try {
2596 2596
                 if (!defined('PKCS7_TEXT')) {
2597
-                    throw new Exception($this->lang('extension_missing') . 'openssl');
2597
+                    throw new Exception($this->lang('extension_missing').'openssl');
2598 2598
                 }
2599 2599
                 // @TODO would be nice to use php://temp streams here
2600 2600
                 $file = tempnam(sys_get_temp_dir(), 'mail');
2601 2601
                 if (false === file_put_contents($file, $body)) {
2602
-                    throw new Exception($this->lang('signing') . ' Could not write temp file');
2602
+                    throw new Exception($this->lang('signing').' Could not write temp file');
2603 2603
                 }
2604 2604
                 $signed = tempnam(sys_get_temp_dir(), 'signed');
2605 2605
                 //Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
@@ -2607,16 +2607,16 @@  discard block
 block discarded – undo
2607 2607
                     $sign = @openssl_pkcs7_sign(
2608 2608
                         $file,
2609 2609
                         $signed,
2610
-                        'file://' . realpath($this->sign_cert_file),
2611
-                        ['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
2610
+                        'file://'.realpath($this->sign_cert_file),
2611
+                        ['file://'.realpath($this->sign_key_file), $this->sign_key_pass],
2612 2612
                         []
2613 2613
                     );
2614 2614
                 } else {
2615 2615
                     $sign = @openssl_pkcs7_sign(
2616 2616
                         $file,
2617 2617
                         $signed,
2618
-                        'file://' . realpath($this->sign_cert_file),
2619
-                        ['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
2618
+                        'file://'.realpath($this->sign_cert_file),
2619
+                        ['file://'.realpath($this->sign_key_file), $this->sign_key_pass],
2620 2620
                         [],
2621 2621
                         PKCS7_DETACHED,
2622 2622
                         $this->sign_extracerts_file
@@ -2628,11 +2628,11 @@  discard block
 block discarded – undo
2628 2628
                     @unlink($signed);
2629 2629
                     //The message returned by openssl contains both headers and body, so need to split them up
2630 2630
                     $parts = explode("\n\n", $body, 2);
2631
-                    $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE;
2631
+                    $this->MIMEHeader .= $parts[0].static::$LE.static::$LE;
2632 2632
                     $body = $parts[1];
2633 2633
                 } else {
2634 2634
                     @unlink($signed);
2635
-                    throw new Exception($this->lang('signing') . openssl_error_string());
2635
+                    throw new Exception($this->lang('signing').openssl_error_string());
2636 2636
                 }
2637 2637
             } catch (Exception $exc) {
2638 2638
                 $body = '';
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
         if ('' == $encoding) {
2668 2668
             $encoding = $this->Encoding;
2669 2669
         }
2670
-        $result .= $this->textLine('--' . $boundary);
2670
+        $result .= $this->textLine('--'.$boundary);
2671 2671
         $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
2672 2672
         $result .= static::$LE;
2673 2673
         // RFC1341 part 5 says 7bit is assumed if not specified
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
      */
2689 2689
     protected function endBoundary($boundary)
2690 2690
     {
2691
-        return static::$LE . '--' . $boundary . '--' . static::$LE;
2691
+        return static::$LE.'--'.$boundary.'--'.static::$LE;
2692 2692
     }
2693 2693
 
2694 2694
     /**
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
      */
2725 2725
     public function headerLine($name, $value)
2726 2726
     {
2727
-        return $name . ': ' . $value . static::$LE;
2727
+        return $name.': '.$value.static::$LE;
2728 2728
     }
2729 2729
 
2730 2730
     /**
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
      */
2737 2737
     public function textLine($value)
2738 2738
     {
2739
-        return $value . static::$LE;
2739
+        return $value.static::$LE;
2740 2740
     }
2741 2741
 
2742 2742
     /**
@@ -2758,7 +2758,7 @@  discard block
 block discarded – undo
2758 2758
     {
2759 2759
         try {
2760 2760
             if (!@is_file($path)) {
2761
-                throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
2761
+                throw new Exception($this->lang('file_access').$path, self::STOP_CONTINUE);
2762 2762
             }
2763 2763
 
2764 2764
             // If a MIME type is not specified, try to work it out from the file name
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
                             'Content-Disposition: %s; filename="%s"%s',
2886 2886
                             $disposition,
2887 2887
                             $encoded_name,
2888
-                            static::$LE . static::$LE
2888
+                            static::$LE.static::$LE
2889 2889
                         );
2890 2890
                     } else {
2891 2891
                         if (!empty($encoded_name)) {
@@ -2893,13 +2893,13 @@  discard block
 block discarded – undo
2893 2893
                                 'Content-Disposition: %s; filename=%s%s',
2894 2894
                                 $disposition,
2895 2895
                                 $encoded_name,
2896
-                                static::$LE . static::$LE
2896
+                                static::$LE.static::$LE
2897 2897
                             );
2898 2898
                         } else {
2899 2899
                             $mime[] = sprintf(
2900 2900
                                 'Content-Disposition: %s%s',
2901 2901
                                 $disposition,
2902
-                                static::$LE . static::$LE
2902
+                                static::$LE.static::$LE
2903 2903
                             );
2904 2904
                         }
2905 2905
                     }
@@ -2940,11 +2940,11 @@  discard block
 block discarded – undo
2940 2940
     {
2941 2941
         try {
2942 2942
             if (!file_exists($path)) {
2943
-                throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
2943
+                throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE);
2944 2944
             }
2945 2945
             $file_buffer = file_get_contents($path);
2946 2946
             if (false === $file_buffer) {
2947
-                throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
2947
+                throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE);
2948 2948
             }
2949 2949
             $file_buffer = $this->encodeString($file_buffer, $encoding);
2950 2950
 
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
                 $encoded = $this->encodeQP($str);
2992 2992
                 break;
2993 2993
             default:
2994
-                $this->setError($this->lang('encoding') . $encoding);
2994
+                $this->setError($this->lang('encoding').$encoding);
2995 2995
                 break;
2996 2996
         }
2997 2997
 
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
                 $maxlen -= $maxlen % 4;
3058 3058
                 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
3059 3059
             }
3060
-            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
3060
+            $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded);
3061 3061
         } elseif ($matchcount > 0) {
3062 3062
             //1 or more chars need encoding, use Q-encode
3063 3063
             $encoding = 'Q';
@@ -3065,8 +3065,8 @@  discard block
 block discarded – undo
3065 3065
             $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
3066 3066
             $encoded = $this->encodeQ($str, $position);
3067 3067
             $encoded = $this->wrapText($encoded, $maxlen, true);
3068
-            $encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
3069
-            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
3068
+            $encoded = str_replace('='.static::$LE, "\n", trim($encoded));
3069
+            $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded);
3070 3070
         } elseif (strlen($str) > $maxlen) {
3071 3071
             //No chars need encoding, but line is too long, so fold it
3072 3072
             $encoded = trim($this->wrapText($str, $maxlen, false));
@@ -3127,7 +3127,7 @@  discard block
 block discarded – undo
3127 3127
      */
3128 3128
     public function base64EncodeWrapMB($str, $linebreak = null)
3129 3129
     {
3130
-        $start = '=?' . $this->CharSet . '?B?';
3130
+        $start = '=?'.$this->CharSet.'?B?';
3131 3131
         $end = '?=';
3132 3132
         $encoded = '';
3133 3133
         if (null === $linebreak) {
@@ -3150,7 +3150,7 @@  discard block
 block discarded – undo
3150 3150
                 $chunk = base64_encode($chunk);
3151 3151
                 ++$lookBack;
3152 3152
             } while (strlen($chunk) > $length);
3153
-            $encoded .= $chunk . $linebreak;
3153
+            $encoded .= $chunk.$linebreak;
3154 3154
         }
3155 3155
 
3156 3156
         // Chomp the last linefeed
@@ -3203,7 +3203,7 @@  discard block
 block discarded – undo
3203 3203
                 // RFC 2047 section 5.1
3204 3204
                 // Replace every high ascii, control, =, ? and _ characters
3205 3205
                 /** @noinspection SuspiciousAssignmentsInspection */
3206
-                $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
3206
+                $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377'.$pattern;
3207 3207
                 break;
3208 3208
         }
3209 3209
         $matches = [];
@@ -3216,7 +3216,7 @@  discard block
 block discarded – undo
3216 3216
                 array_unshift($matches[0], '=');
3217 3217
             }
3218 3218
             foreach (array_unique($matches[0]) as $char) {
3219
-                $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
3219
+                $encoded = str_replace($char, '='.sprintf('%02X', ord($char)), $encoded);
3220 3220
             }
3221 3221
         }
3222 3222
         // Replace spaces with _ (more readable than =20)
@@ -3241,7 +3241,7 @@  discard block
 block discarded – undo
3241 3241
         $encoding = 'base64',
3242 3242
         $type = '',
3243 3243
         $disposition = 'attachment'
3244
-    ) {
3244
+    ){
3245 3245
         // If a MIME type is not specified, try to work it out from the file name
3246 3246
         if ('' == $type) {
3247 3247
             $type = static::filenameToType($filename);
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
     public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
3282 3282
     {
3283 3283
         if (!@is_file($path)) {
3284
-            $this->setError($this->lang('file_access') . $path);
3284
+            $this->setError($this->lang('file_access').$path);
3285 3285
 
3286 3286
             return false;
3287 3287
         }
@@ -3335,7 +3335,7 @@  discard block
 block discarded – undo
3335 3335
         $encoding = 'base64',
3336 3336
         $type = '',
3337 3337
         $disposition = 'inline'
3338
-    ) {
3338
+    ){
3339 3339
         // If a MIME type is not specified, try to work it out from the name
3340 3340
         if ('' == $type and !empty($name)) {
3341 3341
             $type = static::filenameToType($name);
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
     {
3426 3426
         $this->RecipientsQueue = array_filter(
3427 3427
             $this->RecipientsQueue,
3428
-            function ($params) use ($kind) {
3428
+            function($params) use ($kind) {
3429 3429
                 return $params[0] != $kind;
3430 3430
             }
3431 3431
         );
@@ -3515,15 +3515,15 @@  discard block
 block discarded – undo
3515 3515
         if ('smtp' == $this->Mailer and null !== $this->smtp) {
3516 3516
             $lasterror = $this->smtp->getError();
3517 3517
             if (!empty($lasterror['error'])) {
3518
-                $msg .= $this->lang('smtp_error') . $lasterror['error'];
3518
+                $msg .= $this->lang('smtp_error').$lasterror['error'];
3519 3519
                 if (!empty($lasterror['detail'])) {
3520
-                    $msg .= ' Detail: ' . $lasterror['detail'];
3520
+                    $msg .= ' Detail: '.$lasterror['detail'];
3521 3521
                 }
3522 3522
                 if (!empty($lasterror['smtp_code'])) {
3523
-                    $msg .= ' SMTP code: ' . $lasterror['smtp_code'];
3523
+                    $msg .= ' SMTP code: '.$lasterror['smtp_code'];
3524 3524
                 }
3525 3525
                 if (!empty($lasterror['smtp_code_ex'])) {
3526
-                    $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
3526
+                    $msg .= ' Additional SMTP info: '.$lasterror['smtp_code_ex'];
3527 3527
                 }
3528 3528
             }
3529 3529
         }
@@ -3596,7 +3596,7 @@  discard block
 block discarded – undo
3596 3596
             //Is it a valid IPv4 address?
3597 3597
             return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
3598 3598
         }
3599
-        if (filter_var('http://' . $host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
3599
+        if (filter_var('http://'.$host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
3600 3600
             //Is it a syntactically valid hostname?
3601 3601
             return true;
3602 3602
         }
@@ -3622,7 +3622,7 @@  discard block
 block discarded – undo
3622 3622
                 //Include a link to troubleshooting docs on SMTP connection failure
3623 3623
                 //this is by far the biggest cause of support questions
3624 3624
                 //but it's usually not PHPMailer's fault.
3625
-                return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3625
+                return $this->language[$key].' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3626 3626
             }
3627 3627
 
3628 3628
             return $this->language[$key];
@@ -3710,14 +3710,14 @@  discard block
 block discarded – undo
3710 3710
                     }
3711 3711
                     //Hash the decoded data, not the URL so that the same data-URI image used in multiple places
3712 3712
                     //will only be embedded once, even if it used a different encoding
3713
-                    $cid = hash('sha256', $data) . '@phpmailer.0'; // RFC2392 S 2
3713
+                    $cid = hash('sha256', $data).'@phpmailer.0'; // RFC2392 S 2
3714 3714
 
3715 3715
                     if (!$this->cidExists($cid)) {
3716
-                        $this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1]);
3716
+                        $this->addStringEmbeddedImage($data, $cid, 'embed'.$imgindex, 'base64', $match[1]);
3717 3717
                     }
3718 3718
                     $message = str_replace(
3719 3719
                         $images[0][$imgindex],
3720
-                        $images[1][$imgindex] . '="cid:' . $cid . '"',
3720
+                        $images[1][$imgindex].'="cid:'.$cid.'"',
3721 3721
                         $message
3722 3722
                     );
3723 3723
                     continue;
@@ -3736,7 +3736,7 @@  discard block
 block discarded – undo
3736 3736
                     if ('.' == $directory) {
3737 3737
                         $directory = '';
3738 3738
                     }
3739
-                    $cid = hash('sha256', $url) . '@phpmailer.0'; // RFC2392 S 2
3739
+                    $cid = hash('sha256', $url).'@phpmailer.0'; // RFC2392 S 2
3740 3740
                     if (strlen($basedir) > 1 and '/' != substr($basedir, -1)) {
3741 3741
                         $basedir .= '/';
3742 3742
                     }
@@ -3744,7 +3744,7 @@  discard block
 block discarded – undo
3744 3744
                         $directory .= '/';
3745 3745
                     }
3746 3746
                     if ($this->addEmbeddedImage(
3747
-                        $basedir . $directory . $filename,
3747
+                        $basedir.$directory.$filename,
3748 3748
                         $cid,
3749 3749
                         $filename,
3750 3750
                         'base64',
@@ -3752,8 +3752,8 @@  discard block
 block discarded – undo
3752 3752
                     )
3753 3753
                     ) {
3754 3754
                         $message = preg_replace(
3755
-                            '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
3756
-                            $images[1][$imgindex] . '="cid:' . $cid . '"',
3755
+                            '/'.$images[1][$imgindex].'=["\']'.preg_quote($url, '/').'["\']/Ui',
3756
+                            $images[1][$imgindex].'="cid:'.$cid.'"',
3757 3757
                             $message
3758 3758
                         );
3759 3759
                     }
@@ -4027,7 +4027,7 @@  discard block
 block discarded – undo
4027 4027
 
4028 4028
             return true;
4029 4029
         }
4030
-        $this->setError($this->lang('variable_set') . $name);
4030
+        $this->setError($this->lang('variable_set').$name);
4031 4031
 
4032 4032
         return false;
4033 4033
     }
@@ -4121,7 +4121,7 @@  discard block
 block discarded – undo
4121 4121
             if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
4122 4122
                 $line .= $txt[$i];
4123 4123
             } else {
4124
-                $line .= '=' . sprintf('%02X', $ord);
4124
+                $line .= '='.sprintf('%02X', $ord);
4125 4125
             }
4126 4126
         }
4127 4127
 
@@ -4141,14 +4141,13 @@  discard block
 block discarded – undo
4141 4141
     {
4142 4142
         if (!defined('PKCS7_TEXT')) {
4143 4143
             if ($this->exceptions) {
4144
-                throw new Exception($this->lang('extension_missing') . 'openssl');
4144
+                throw new Exception($this->lang('extension_missing').'openssl');
4145 4145
             }
4146 4146
 
4147 4147
             return '';
4148 4148
         }
4149 4149
         $privKeyStr = !empty($this->DKIM_private_string) ?
4150
-            $this->DKIM_private_string :
4151
-            file_get_contents($this->DKIM_private);
4150
+            $this->DKIM_private_string : file_get_contents($this->DKIM_private);
4152 4151
         if ('' != $this->DKIM_passphrase) {
4153 4152
             $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
4154 4153
         } else {
@@ -4200,7 +4199,7 @@  discard block
 block discarded – undo
4200 4199
             //But then says to delete space before and after the colon.
4201 4200
             //Net result is the same as trimming both ends of the value.
4202 4201
             //by elimination, the same applies to the field name
4203
-            $lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
4202
+            $lines[$key] = trim($heading, " \t").':'.trim($value, " \t");
4204 4203
         }
4205 4204
 
4206 4205
         return implode("\r\n", $lines);
@@ -4226,7 +4225,7 @@  discard block
 block discarded – undo
4226 4225
         $body = static::normalizeBreaks($body, "\r\n");
4227 4226
 
4228 4227
         //Reduce multiple trailing line breaks to a single one
4229
-        return rtrim($body, "\r\n") . "\r\n";
4228
+        return rtrim($body, "\r\n")."\r\n";
4230 4229
     }
4231 4230
 
4232 4231
     /**
@@ -4282,33 +4281,33 @@  discard block
 block discarded – undo
4282 4281
         if ('' == $this->DKIM_identity) {
4283 4282
             $ident = '';
4284 4283
         } else {
4285
-            $ident = ' i=' . $this->DKIM_identity . ';';
4286
-        }
4287
-        $dkimhdrs = 'DKIM-Signature: v=1; a=' .
4288
-            $DKIMsignatureType . '; q=' .
4289
-            $DKIMquery . '; l=' .
4290
-            $DKIMlen . '; s=' .
4291
-            $this->DKIM_selector .
4292
-            ";\r\n" .
4293
-            "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
4294
-            "\th=From:To:Date:Subject;\r\n" .
4295
-            "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
4296
-            "\tz=$from\r\n" .
4297
-            "\t|$to\r\n" .
4298
-            "\t|$date\r\n" .
4299
-            "\t|$subject;\r\n" .
4300
-            "\tbh=" . $DKIMb64 . ";\r\n" .
4284
+            $ident = ' i='.$this->DKIM_identity.';';
4285
+        }
4286
+        $dkimhdrs = 'DKIM-Signature: v=1; a='.
4287
+            $DKIMsignatureType.'; q='.
4288
+            $DKIMquery.'; l='.
4289
+            $DKIMlen.'; s='.
4290
+            $this->DKIM_selector.
4291
+            ";\r\n".
4292
+            "\tt=".$DKIMtime.'; c='.$DKIMcanonicalization.";\r\n".
4293
+            "\th=From:To:Date:Subject;\r\n".
4294
+            "\td=".$this->DKIM_domain.';'.$ident."\r\n".
4295
+            "\tz=$from\r\n".
4296
+            "\t|$to\r\n".
4297
+            "\t|$date\r\n".
4298
+            "\t|$subject;\r\n".
4299
+            "\tbh=".$DKIMb64.";\r\n".
4301 4300
             "\tb=";
4302 4301
         $toSign = $this->DKIM_HeaderC(
4303
-            $from_header . "\r\n" .
4304
-            $to_header . "\r\n" .
4305
-            $date_header . "\r\n" .
4306
-            $subject_header . "\r\n" .
4302
+            $from_header."\r\n".
4303
+            $to_header."\r\n".
4304
+            $date_header."\r\n".
4305
+            $subject_header."\r\n".
4307 4306
             $dkimhdrs
4308 4307
         );
4309 4308
         $signed = $this->DKIM_Sign($toSign);
4310 4309
 
4311
-        return static::normalizeBreaks($dkimhdrs . $signed) . static::$LE;
4310
+        return static::normalizeBreaks($dkimhdrs.$signed).static::$LE;
4312 4311
     }
4313 4312
 
4314 4313
     /**
@@ -4321,7 +4320,7 @@  discard block
 block discarded – undo
4321 4320
      */
4322 4321
     public static function hasLineLongerThanMax($str)
4323 4322
     {
4324
-        return (bool) preg_match('/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) . ',})/m', $str);
4323
+        return (bool) preg_match('/^(.{'.(self::MAX_LINE_LENGTH + strlen(static::$LE)).',})/m', $str);
4325 4324
     }
4326 4325
 
4327 4326
     /**
Please login to merge, or discard this patch.
manager/includes/controls/phpmailer/POP3.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
      * Connect to a POP3 server.
210 210
      *
211 211
      * @param string   $host
212
-     * @param int|bool $port
212
+     * @param integer $port
213 213
      * @param int      $tval
214 214
      *
215 215
      * @return bool
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $username = '',
150 150
         $password = '',
151 151
         $debug_level = 0
152
-    ) {
152
+    ){
153 153
         $pop = new self();
154 154
 
155 155
         return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
         }
289 289
 
290 290
         // Send the Username
291
-        $this->sendString("USER $username" . static::LE);
291
+        $this->sendString("USER $username".static::LE);
292 292
         $pop3_response = $this->getResponse();
293 293
         if ($this->checkResponse($pop3_response)) {
294 294
             // Send the Password
295
-            $this->sendString("PASS $password" . static::LE);
295
+            $this->sendString("PASS $password".static::LE);
296 296
             $pop3_response = $this->getResponse();
297 297
             if ($this->checkResponse($pop3_response)) {
298 298
                 return true;
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     protected function catchWarning($errno, $errstr, $errfile, $errline)
413 413
     {
414 414
         $this->setError(
415
-            'Connecting to the POP3 server raised a PHP warning:' .
415
+            'Connecting to the POP3 server raised a PHP warning:'.
416 416
             "errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
417 417
         );
418 418
     }
Please login to merge, or discard this patch.
manager/includes/controls/phpmailer/SMTP.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1314,7 +1314,7 @@
 block discarded – undo
1314 1314
      * If no reply has been received yet, it will return null.
1315 1315
      * If no pattern was matched, it will return false.
1316 1316
      *
1317
-     * @return bool|null|string
1317
+     * @return string
1318 1318
      *
1319 1319
      * @see recordLastTransactionID()
1320 1320
      */
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         }
308 308
         // Connect to the SMTP server
309 309
         $this->edebug(
310
-            "Connection: opening to $host:$port, timeout=$timeout, options=" .
310
+            "Connection: opening to $host:$port, timeout=$timeout, options=".
311 311
             (count($options) > 0 ? var_export($options, true) : 'array()'),
312 312
             self::DEBUG_CONNECTION
313 313
         );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             $socket_context = stream_context_create($options);
318 318
             set_error_handler([$this, 'errorHandler']);
319 319
             $this->smtp_conn = stream_socket_client(
320
-                $host . ':' . $port,
320
+                $host.':'.$port,
321 321
                 $errno,
322 322
                 $errstr,
323 323
                 $timeout,
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                 (string) $errstr
351 351
             );
352 352
             $this->edebug(
353
-                'SMTP ERROR: ' . $this->error['error']
353
+                'SMTP ERROR: '.$this->error['error']
354 354
                 . ": $errstr ($errno)",
355 355
                 self::DEBUG_CLIENT
356 356
             );
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         }
371 371
         // Get any announcement
372 372
         $announce = $this->get_lines();
373
-        $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
373
+        $this->edebug('SERVER -> CLIENT: '.$announce, self::DEBUG_SERVER);
374 374
 
375 375
         return true;
376 376
     }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         $password,
427 427
         $authtype = null,
428 428
         $OAuth = null
429
-    ) {
429
+    ){
430 430
         if (!$this->server_caps) {
431 431
             $this->setError('Authentication is not allowed before HELO/EHLO');
432 432
 
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
                 return false;
444 444
             }
445 445
 
446
-            $this->edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
446
+            $this->edebug('Auth method requested: '.($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
447 447
             $this->edebug(
448
-                'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
448
+                'Auth methods available on the server: '.implode(',', $this->server_caps['AUTH']),
449 449
                 self::DEBUG_LOWLEVEL
450 450
             );
451 451
 
452 452
             //If we have requested a specific auth type, check the server supports it before trying others
453 453
             if (!in_array($authtype, $this->server_caps['AUTH'])) {
454
-                $this->edebug('Requested auth method not available: ' . $authtype, self::DEBUG_LOWLEVEL);
454
+                $this->edebug('Requested auth method not available: '.$authtype, self::DEBUG_LOWLEVEL);
455 455
                 $authtype = null;
456 456
             }
457 457
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
                     return false;
471 471
                 }
472
-                self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL);
472
+                self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
473 473
             }
474 474
 
475 475
             if (!in_array($authtype, $this->server_caps['AUTH'])) {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 // Send encoded username and password
490 490
                 if (!$this->sendCommand(
491 491
                     'User & Password',
492
-                    base64_encode("\0" . $username . "\0" . $password),
492
+                    base64_encode("\0".$username."\0".$password),
493 493
                     235
494 494
                 )
495 495
                 ) {
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 $challenge = base64_decode(substr($this->last_reply, 4));
518 518
 
519 519
                 // Build the response
520
-                $response = $username . ' ' . $this->hmac($challenge, $password);
520
+                $response = $username.' '.$this->hmac($challenge, $password);
521 521
 
522 522
                 // send encoded credentials
523 523
                 return $this->sendCommand('Username', base64_encode($response), 235);
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
                 $oauth = $OAuth->getOauth64();
530 530
 
531 531
                 // Start authentication
532
-                if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
532
+                if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 '.$oauth, 235)) {
533 533
                     return false;
534 534
                 }
535 535
                 break;
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
         $k_ipad = $key ^ $ipad;
577 577
         $k_opad = $key ^ $opad;
578 578
 
579
-        return md5($k_opad . pack('H*', md5($k_ipad . $data)));
579
+        return md5($k_opad.pack('H*', md5($k_ipad.$data)));
580 580
     }
581 581
 
582 582
     /**
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 }
692 692
                 //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
693 693
                 if ($in_headers) {
694
-                    $line = "\t" . $line;
694
+                    $line = "\t".$line;
695 695
                 }
696 696
             }
697 697
             $lines_out[] = $line;
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
             foreach ($lines_out as $line_out) {
701 701
                 //RFC2821 section 4.5.2
702 702
                 if (!empty($line_out) and $line_out[0] == '.') {
703
-                    $line_out = '.' . $line_out;
703
+                    $line_out = '.'.$line_out;
704 704
                 }
705
-                $this->client_send($line_out . static::LE, 'DATA');
705
+                $this->client_send($line_out.static::LE, 'DATA');
706 706
             }
707 707
         }
708 708
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
      */
749 749
     protected function sendHello($hello, $host)
750 750
     {
751
-        $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
751
+        $noerror = $this->sendCommand($hello, $hello.' '.$host, 250);
752 752
         $this->helo_rply = $this->last_reply;
753 753
         if ($noerror) {
754 754
             $this->parseHelloFields($hello);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
         return $this->sendCommand(
821 821
             'MAIL FROM',
822
-            'MAIL FROM:<' . $from . '>' . $useVerp,
822
+            'MAIL FROM:<'.$from.'>'.$useVerp,
823 823
             250
824 824
         );
825 825
     }
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
     {
860 860
         return $this->sendCommand(
861 861
             'RCPT TO',
862
-            'RCPT TO:<' . $address . '>',
862
+            'RCPT TO:<'.$address.'>',
863 863
             [250, 251]
864 864
         );
865 865
     }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 
899 899
             return false;
900 900
         }
901
-        $this->client_send($commandstring . static::LE, $command);
901
+        $this->client_send($commandstring.static::LE, $command);
902 902
 
903 903
         $this->last_reply = $this->get_lines();
904 904
         // Fetch SMTP code and possible error code explanation
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
             $code_ex = (count($matches) > 2 ? $matches[2] : null);
909 909
             // Cut off error code from each response line
910 910
             $detail = preg_replace(
911
-                "/{$code}[ -]" .
912
-                ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m',
911
+                "/{$code}[ -]".
912
+                ($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '').'/m',
913 913
                 '',
914 914
                 $this->last_reply
915 915
             );
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
             $detail = substr($this->last_reply, 4);
921 921
         }
922 922
 
923
-        $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
923
+        $this->edebug('SERVER -> CLIENT: '.$this->last_reply, self::DEBUG_SERVER);
924 924
 
925 925
         if (!in_array($code, (array) $expect)) {
926 926
             $this->setError(
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
                 $code_ex
931 931
             );
932 932
             $this->edebug(
933
-                'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
933
+                'SMTP ERROR: '.$this->error['error'].': '.$this->last_reply,
934 934
                 self::DEBUG_CLIENT
935 935
             );
936 936
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
     public function turn()
997 997
     {
998 998
         $this->setError('The SMTP TURN command is not implemented');
999
-        $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
999
+        $this->edebug('SMTP NOTICE: '.$this->error['error'], self::DEBUG_CLIENT);
1000 1000
 
1001 1001
         return false;
1002 1002
     }
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
             in_array($command, ['User & Password', 'Username', 'Password'], true)) {
1018 1018
             $this->edebug('CLIENT -> SERVER: <credentials hidden>', self::DEBUG_CLIENT);
1019 1019
         } else {
1020
-            $this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT);
1020
+            $this->edebug('CLIENT -> SERVER: '.$data, self::DEBUG_CLIENT);
1021 1021
         }
1022 1022
         set_error_handler([$this, 'errorHandler']);
1023 1023
         $result = fwrite($this->smtp_conn, $data);
@@ -1123,14 +1123,14 @@  discard block
 block discarded – undo
1123 1123
             //Must pass vars in here as params are by reference
1124 1124
             if (!stream_select($selR, $selW, $selW, $this->Timelimit)) {
1125 1125
                 $this->edebug(
1126
-                    'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
1126
+                    'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)',
1127 1127
                     self::DEBUG_LOWLEVEL
1128 1128
                 );
1129 1129
                 break;
1130 1130
             }
1131 1131
             //Deliberate noise suppression - errors are handled afterwards
1132 1132
             $str = @fgets($this->smtp_conn, 515);
1133
-            $this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL);
1133
+            $this->edebug('SMTP INBOUND: "'.trim($str).'"', self::DEBUG_LOWLEVEL);
1134 1134
             $data .= $str;
1135 1135
             // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
1136 1136
             // or 4th character is a space, we are done reading, break the loop,
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
             $info = stream_get_meta_data($this->smtp_conn);
1143 1143
             if ($info['timed_out']) {
1144 1144
                 $this->edebug(
1145
-                    'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
1145
+                    'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)',
1146 1146
                     self::DEBUG_LOWLEVEL
1147 1147
                 );
1148 1148
                 break;
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
             // Now check if reads took too long
1151 1151
             if ($endtime and time() > $endtime) {
1152 1152
                 $this->edebug(
1153
-                    'SMTP -> get_lines(): timelimit reached (' .
1154
-                    $this->Timelimit . ' sec)',
1153
+                    'SMTP -> get_lines(): timelimit reached ('.
1154
+                    $this->Timelimit.' sec)',
1155 1155
                     self::DEBUG_LOWLEVEL
1156 1156
                 );
1157 1157
                 break;
Please login to merge, or discard this patch.
manager/includes/extenders/manager.api.class.inc.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -192,6 +192,9 @@
 block discarded – undo
192 192
 		return $_;
193 193
 	}
194 194
 
195
+	/**
196
+	 * @param string $checksum
197
+	 */
195 198
 	function setSystemChecksum($checksum) {
196 199
 		global $modx;
197 200
 		$tbl_system_settings = $modx->getFullTableName('system_settings');
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 global $_PAGE; // page view state object. Usage $_PAGE['vs']['propertyname'] = $value;
9 9
 
10 10
 // Content manager wrapper class
11
-class ManagerAPI {
11
+class ManagerAPI{
12 12
 	
13 13
 	var $action; // action directive
14 14
 
@@ -17,27 +17,27 @@  discard block
 block discarded – undo
17 17
 		$this->action = $action; // set action directive
18 18
 	}
19 19
 	
20
-	function initPageViewState($id=0){
20
+	function initPageViewState($id = 0){
21 21
 		global $_PAGE;
22 22
 		$vsid = isset($_SESSION["mgrPageViewSID"]) ? $_SESSION["mgrPageViewSID"] : '';
23
-		if($vsid!=$this->action) {
23
+		if ($vsid != $this->action) {
24 24
 			$_SESSION["mgrPageViewSDATA"] = array(); // new view state
25
-			$_SESSION["mgrPageViewSID"] = $id>0 ? $id:$this->action; // set id
25
+			$_SESSION["mgrPageViewSID"] = $id > 0 ? $id : $this->action; // set id
26 26
 		}
27 27
 		$_PAGE['vs'] = &$_SESSION["mgrPageViewSDATA"]; // restore viewstate
28 28
 	}
29 29
 
30 30
 	// save page view state - not really necessary,
31
-	function savePageViewState($id=0){
31
+	function savePageViewState($id = 0){
32 32
 		global $_PAGE;
33 33
 		$_SESSION["mgrPageViewSDATA"] = $_PAGE['vs'];
34
-		$_SESSION["mgrPageViewSID"] = $id>0 ? $id:$this->action;
34
+		$_SESSION["mgrPageViewSID"] = $id > 0 ? $id : $this->action;
35 35
 	}
36 36
 	
37 37
 	// check for saved form
38
-	function hasFormValues() {
39
-		if(isset($_SESSION["mgrFormValueId"])) {		
40
-			if($this->action==$_SESSION["mgrFormValueId"]) {
38
+	function hasFormValues(){
39
+		if (isset($_SESSION["mgrFormValueId"])) {		
40
+			if ($this->action == $_SESSION["mgrFormValueId"]) {
41 41
 				return true;
42 42
 			}
43 43
 			else {
@@ -47,19 +47,19 @@  discard block
 block discarded – undo
47 47
 		return false;
48 48
 	}	
49 49
 	// saved form post from $_POST
50
-	function saveFormValues($id=0){
50
+	function saveFormValues($id = 0){
51 51
 		$_SESSION["mgrFormValues"] = $_POST;
52
-		$_SESSION["mgrFormValueId"] = $id>0 ? $id:$this->action;
52
+		$_SESSION["mgrFormValueId"] = $id > 0 ? $id : $this->action;
53 53
 	}		
54 54
 	// load saved form values into $_POST
55 55
 	function loadFormValues(){
56 56
 		
57
-		if(!$this->hasFormValues()) return false;
57
+		if (!$this->hasFormValues()) return false;
58 58
 		
59 59
 		$p = $_SESSION["mgrFormValues"];
60 60
 		$this->clearSavedFormValues();
61
-		foreach($p as $k=>$v) {
62
-			$_POST[$k]=$v;
61
+		foreach ($p as $k=>$v) {
62
+			$_POST[$k] = $v;
63 63
 		}
64 64
 		return true;
65 65
 	}
@@ -69,50 +69,50 @@  discard block
 block discarded – undo
69 69
 		unset($_SESSION["mgrFormValueId"]);	
70 70
 	}
71 71
 	
72
-	function getHashType($db_value='') { // md5 | v1 | phpass
73
-		$c = substr($db_value,0,1);
74
-		if($c==='$')                                      return 'phpass';
75
-		elseif(strlen($db_value)===32)                    return 'md5';
76
-		elseif($c!=='$' && strpos($db_value,'>')!==false) return 'v1';
72
+	function getHashType($db_value = ''){ // md5 | v1 | phpass
73
+		$c = substr($db_value, 0, 1);
74
+		if ($c === '$')                                      return 'phpass';
75
+		elseif (strlen($db_value) === 32)                    return 'md5';
76
+		elseif ($c !== '$' && strpos($db_value, '>') !== false) return 'v1';
77 77
 		else                                              return 'unknown';
78 78
 	}
79 79
 	
80
-	function genV1Hash($password, $seed='1')
80
+	function genV1Hash($password, $seed = '1')
81 81
 	{ // $seed is user_id basically
82 82
 		global $modx;
83 83
 		
84
-		if(isset($modx->config['pwd_hash_algo']) && !empty($modx->config['pwd_hash_algo']))
84
+		if (isset($modx->config['pwd_hash_algo']) && !empty($modx->config['pwd_hash_algo']))
85 85
 			$algorithm = $modx->config['pwd_hash_algo'];
86 86
 		else $algorithm = 'UNCRYPT';
87 87
 		
88
-		$salt = md5($password . $seed);
88
+		$salt = md5($password.$seed);
89 89
 		
90
-		switch($algorithm)
90
+		switch ($algorithm)
91 91
 		{
92 92
 			case 'BLOWFISH_Y':
93
-				$salt = '$2y$07$' . substr($salt,0,22);
93
+				$salt = '$2y$07$'.substr($salt, 0, 22);
94 94
 				break;
95 95
 			case 'BLOWFISH_A':
96
-				$salt = '$2a$07$' . substr($salt,0,22);
96
+				$salt = '$2a$07$'.substr($salt, 0, 22);
97 97
 				break;
98 98
 			case 'SHA512':
99
-				$salt = '$6$' . substr($salt,0,16);
99
+				$salt = '$6$'.substr($salt, 0, 16);
100 100
 				break;
101 101
 			case 'SHA256':
102
-				$salt = '$5$' . substr($salt,0,16);
102
+				$salt = '$5$'.substr($salt, 0, 16);
103 103
 				break;
104 104
 			case 'MD5':
105
-				$salt = '$1$' . substr($salt,0,8);
105
+				$salt = '$1$'.substr($salt, 0, 8);
106 106
 				break;
107 107
 		}
108 108
 		
109
-		if($algorithm!=='UNCRYPT')
109
+		if ($algorithm !== 'UNCRYPT')
110 110
 		{
111
-			$password = sha1($password) . crypt($password,$salt);
111
+			$password = sha1($password).crypt($password, $salt);
112 112
 		}
113 113
 		else $password = sha1($salt.$password);
114 114
 		
115
-		$result = strtolower($algorithm) . '>' . md5($salt.$password) . substr(md5($salt),0,8);
115
+		$result = strtolower($algorithm).'>'.md5($salt.$password).substr(md5($salt), 0, 8);
116 116
 		
117 117
 		return $result;
118 118
 	}
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	{
122 122
 		global $modx;
123 123
 		$tbl_manager_users = $modx->getFullTableName('manager_users');
124
-		$rs = $modx->db->select('password',$tbl_manager_users,"id='{$uid}'");
124
+		$rs = $modx->db->select('password', $tbl_manager_users, "id='{$uid}'");
125 125
 		$password = $modx->db->getValue($rs);
126 126
 		
127
-		if(strpos($password,'>')===false) $algo = 'NOSALT';
127
+		if (strpos($password, '>') === false) $algo = 'NOSALT';
128 128
 		else
129 129
 		{
130
-			$algo = substr($password,0,strpos($password,'>'));
130
+			$algo = substr($password, 0, strpos($password, '>'));
131 131
 		}
132 132
 		return strtoupper($algo);
133 133
 	}
134 134
 	
135
-	function checkHashAlgorithm($algorithm='')
135
+	function checkHashAlgorithm($algorithm = '')
136 136
 	{
137 137
 		$result = false;
138 138
 		if (!empty($algorithm))
@@ -165,54 +165,54 @@  discard block
 block discarded – undo
165 165
 		return $result;
166 166
 	}
167 167
 
168
-	function getSystemChecksum($check_files) {
168
+	function getSystemChecksum($check_files){
169 169
 		$_ = array();
170 170
 		$check_files = trim($check_files);
171 171
 		$check_files = explode("\n", $check_files);
172
-		foreach($check_files as $file) {
172
+		foreach ($check_files as $file) {
173 173
 			$file = trim($file);
174
-			$file = MODX_BASE_PATH . $file;
175
-			if(!is_file($file)) continue;
176
-			$_[$file]= md5_file($file);
174
+			$file = MODX_BASE_PATH.$file;
175
+			if (!is_file($file)) continue;
176
+			$_[$file] = md5_file($file);
177 177
 		}
178 178
 		return serialize($_);
179 179
 	}
180 180
 
181
-	function getModifiedSystemFilesList($check_files, $checksum) {
181
+	function getModifiedSystemFilesList($check_files, $checksum){
182 182
 		$_ = array();
183 183
 		$check_files = trim($check_files);
184 184
 		$check_files = explode("\n", $check_files);
185 185
 		$checksum = unserialize($checksum);
186
-		foreach($check_files as $file) {
186
+		foreach ($check_files as $file) {
187 187
 			$file = trim($file);
188
-			$filePath = MODX_BASE_PATH . $file;
189
-			if(!is_file($filePath)) continue;
190
-			if(md5_file($filePath) != $checksum[$filePath]) $_[] = $file;
188
+			$filePath = MODX_BASE_PATH.$file;
189
+			if (!is_file($filePath)) continue;
190
+			if (md5_file($filePath) != $checksum[$filePath]) $_[] = $file;
191 191
 		}
192 192
 		return $_;
193 193
 	}
194 194
 
195
-	function setSystemChecksum($checksum) {
195
+	function setSystemChecksum($checksum){
196 196
 		global $modx;
197 197
 		$tbl_system_settings = $modx->getFullTableName('system_settings');
198
-		$sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->db->escape($checksum) . "')";
198
+		$sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','".$modx->db->escape($checksum)."')";
199 199
         $modx->db->query($sql);
200 200
 	}
201 201
 	
202
-	function checkSystemChecksum() {
202
+	function checkSystemChecksum(){
203 203
 		global $modx;
204 204
 
205
-		if(!isset($modx->config['check_files_onlogin']) || empty($modx->config['check_files_onlogin'])) return '0';
205
+		if (!isset($modx->config['check_files_onlogin']) || empty($modx->config['check_files_onlogin'])) return '0';
206 206
 		
207 207
 		$current = $this->getSystemChecksum($modx->config['check_files_onlogin']);
208
-		if(empty($current)) return '0';
208
+		if (empty($current)) return '0';
209 209
 		
210
-		if(!isset($modx->config['sys_files_checksum']) || empty($modx->config['sys_files_checksum']))
210
+		if (!isset($modx->config['sys_files_checksum']) || empty($modx->config['sys_files_checksum']))
211 211
 		{
212 212
 			$this->setSystemChecksum($current);
213 213
 			return '0';
214 214
 		}
215
-		if($current===$modx->config['sys_files_checksum']) $result = '0';
215
+		if ($current === $modx->config['sys_files_checksum']) $result = '0';
216 216
 		else {
217 217
 			$result = $this->getModifiedSystemFilesList($modx->config['check_files_onlogin'], $modx->config['sys_files_checksum']);
218 218
 		} 
@@ -220,28 +220,28 @@  discard block
 block discarded – undo
220 220
 		return $result;
221 221
 	}
222 222
 
223
-    function getLastUserSetting($key=false) {
223
+    function getLastUserSetting($key = false){
224 224
         global $modx;
225 225
         
226 226
         $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$_SESSION['mgrInternalKey']}'");
227 227
         
228
-        $usersettings = array ();
228
+        $usersettings = array();
229 229
         while ($row = $modx->db->getRow($rs)) {
230
-            if(substr($row['setting_name'], 0, 6) == '_LAST_') {
230
+            if (substr($row['setting_name'], 0, 6) == '_LAST_') {
231 231
                 $name = substr($row['setting_name'], 6);
232 232
                 $usersettings[$name] = $row['setting_value'];
233 233
             }
234 234
         }
235 235
         
236
-        if(!$key) return $usersettings;
236
+        if (!$key) return $usersettings;
237 237
         else return isset($usersettings[$key]) ? $usersettings[$key] : NULL;
238 238
     }
239 239
     
240
-    function saveLastUserSetting($settings, $val='') {
240
+    function saveLastUserSetting($settings, $val = ''){
241 241
         global $modx;
242 242
         
243
-        if(!empty($settings)) {
244
-            if(!is_array($settings)) $settings = array($settings=>$val);
243
+        if (!empty($settings)) {
244
+            if (!is_array($settings)) $settings = array($settings=>$val);
245 245
             
246 246
             foreach ($settings as $key => $val) {
247 247
                 $f = array();
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         }
257 257
     }
258 258
     
259
-    function loadDatePicker($path) {
259
+    function loadDatePicker($path){
260 260
         global $modx;
261 261
         include_once($path);
262 262
         $dp = new DATEPICKER();
Please login to merge, or discard this patch.
manager/includes/extenders/phpass.class.inc.php 2 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@  discard block
 block discarded – undo
43 43
         $this->random_state = microtime() . uniqid(mt_rand(), TRUE);
44 44
     }
45 45
 
46
+    /**
47
+     * @param integer $count
48
+     */
46 49
     function get_random_bytes($count)
47 50
     {
48 51
         $output = '';
@@ -66,6 +69,9 @@  discard block
 block discarded – undo
66 69
         return $output;
67 70
     }
68 71
 
72
+    /**
73
+     * @param integer $count
74
+     */
69 75
     function encode64($input, $count)
70 76
     {
71 77
         $output = '';
@@ -89,6 +95,9 @@  discard block
 block discarded – undo
89 95
         return $output;
90 96
     }
91 97
 
98
+    /**
99
+     * @param string $input
100
+     */
92 101
     function gensalt_private($input)
93 102
     {
94 103
         $output = '$P$';
@@ -137,6 +146,9 @@  discard block
 block discarded – undo
137 146
         return $output;
138 147
     }
139 148
 
149
+    /**
150
+     * @param string $input
151
+     */
140 152
     function gensalt_extended($input)
141 153
     {
142 154
         $count_log2 = min($this->iteration_count_log2 + 8, 24);
@@ -155,6 +167,9 @@  discard block
 block discarded – undo
155 167
         return $output;
156 168
     }
157 169
 
170
+    /**
171
+     * @param string $input
172
+     */
158 173
     function gensalt_blowfish($input)
159 174
     {
160 175
         // This one needs to use a different order of characters and a
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 // Obviously, since this code is in the public domain, the above are not
25 25
 // requirements (there can be none), but merely suggestions.
26 26
 //
27
-class PasswordHash {
27
+class PasswordHash{
28 28
     var $itoa64;
29 29
     var $iteration_count_log2;
30 30
     var $portable_hashes;
31 31
     var $random_state;
32 32
 
33
-    function __construct($iteration_count_log2=8, $portable_hashes=true)
33
+    function __construct($iteration_count_log2 = 8, $portable_hashes = true)
34 34
     {
35 35
         $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
36 36
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         $this->portable_hashes = $portable_hashes;
42 42
 
43
-        $this->random_state = microtime() . uniqid(mt_rand(), TRUE);
43
+        $this->random_state = microtime().uniqid(mt_rand(), TRUE);
44 44
     }
45 45
 
46 46
     function get_random_bytes($count)
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $output = '';
57 57
             for ($i = 0; $i < $count; $i += 16) {
58 58
                 $this->random_state =
59
-                    md5(microtime() . $this->random_state);
59
+                    md5(microtime().$this->random_state);
60 60
                 $output .=
61 61
                     pack('H*', md5($this->random_state));
62 62
             }
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
         // consequently in lower iteration counts and hashes that are
127 127
         // quicker to crack (by non-PHP code).
128 128
         
129
-        $hash = md5($salt . $password, TRUE);
129
+        $hash = md5($salt.$password, TRUE);
130 130
         do {
131
-            $hash = md5($hash . $password, TRUE);
131
+            $hash = md5($hash.$password, TRUE);
132 132
         } while (--$count);
133 133
 
134 134
         $output = substr($setting, 0, 12);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
     function HashPassword($password)
200 200
     {
201
-        if ( strlen( $password ) > 4096 ) {
201
+        if (strlen($password) > 4096) {
202 202
             return '*';
203 203
         }
204 204
 
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 
238 238
     function CheckPassword($password, $stored_hash)
239 239
     {
240
-        if ( strlen( $password ) > 4096 ) {
240
+        if (strlen($password) > 4096) {
241 241
             return false;
242 242
         }
243 243
 
244 244
         $hash = $this->crypt_private($password, $stored_hash);
245
-        if (substr($hash,0,1) === '*')
245
+        if (substr($hash, 0, 1) === '*')
246 246
             $hash = crypt($password, $stored_hash);
247 247
 
248
-        return ($hash===$stored_hash) ? true : false;
248
+        return ($hash === $stored_hash) ? true : false;
249 249
     }
250 250
 }
Please login to merge, or discard this patch.