Completed
Push — develop ( d271f8...cb7ecf )
by Serg
08:17 queued 57s
created
manager/actions/files.dynamic.php 1 patch
Spacing   +59 added lines, -59 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,ini' . $alias_suffix);
20
-$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $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,ini'.$alias_suffix);
20
+$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$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
 }
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 $rw = realpath('../');
97 97
 $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf));
98 98
 if (substr($webstart_path, 0, 1) == '/') {
99
-    $webstart_path = '..' . $webstart_path;
99
+    $webstart_path = '..'.$webstart_path;
100 100
 } else {
101
-    $webstart_path = '../' . $webstart_path;
101
+    $webstart_path = '../'.$webstart_path;
102 102
 }
103 103
 
104 104
 ?>
105 105
     <script type="text/javascript">
106 106
 
107
-        var current_path = '<?= $startpath;?>';
107
+        var current_path = '<?= $startpath; ?>';
108 108
 
109 109
         function viewfile (url)
110 110
         {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         function unzipFile (file)
141 141
         {
142 142
             if (confirmUnzip()) {
143
-                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>";
143
+                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>";
144 144
                 return false;
145 145
             }
146 146
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         function deleteFolder (folder, status)
163 163
         {
164 164
             if (confirmDeleteFolder(status)) {
165
-                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>";
165
+                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>";
166 166
                 return false;
167 167
             }
168 168
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         function deleteFile (file)
171 171
         {
172 172
             if (confirmDelete()) {
173
-                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>";
173
+                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>";
174 174
                 return false;
175 175
             }
176 176
         }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         {
180 180
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
181 181
             if (newFilename !== null && newFilename !== file) {
182
-                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
182
+                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
183 183
             }
184 184
         }
185 185
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         {
188 188
             var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir);
189 189
             if (newDirname !== null && newDirname !== dir) {
190
-                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>";
190
+                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>";
191 191
             }
192 192
         }
193 193
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         {
196 196
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
197 197
             if (newFilename !== null && newFilename !== file) {
198
-                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
198
+                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
199 199
             }
200 200
         }
201 201
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             <?php endif ?>
215 215
             <?php
216 216
             if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') {
217
-                $href = 'a=31&path=' . urlencode($_REQUEST['path']);
217
+                $href = 'a=31&path='.urlencode($_REQUEST['path']);
218 218
             } else {
219 219
                 $href = 'a=2';
220 220
             }
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
                 $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>';
225 225
                 $ph['image'] = $_style['files_folder-open'];
226 226
                 $ph['subject'] = $_lang['add_folder'];
227
-                $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name=';
227
+                $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name=';
228 228
                 $_ = parsePlaceholder($tpl, $ph);
229 229
 
230
-                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>';
230
+                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>';
231 231
                 $ph['image'] = $_style['files_page_html'];
232
-                $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name=';
232
+                $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name=';
233 233
                 $_ .= parsePlaceholder($tpl, $ph);
234 234
                 echo $_;
235 235
             }
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
             $ph = array();
260 260
             $ph['style_path'] = $theme_image_path;
261 261
             // To Top Level with folder icon to the left
262
-            if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) {
263
-                $ph['image'] = '' . $_style['files_top'] . '';
262
+            if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) {
263
+                $ph['image'] = ''.$_style['files_top'].'';
264 264
                 $ph['subject'] = '<span>Top</span>';
265 265
             } else {
266
-                $ph['image'] = '' . $_style['files_top'] . '';
267
-                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/';
266
+                $ph['image'] = ''.$_style['files_top'].'';
267
+                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/';
268 268
             }
269 269
 
270 270
             echo parsePlaceholder($tpl, $ph);
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
                     if (empty($v)) {
282 282
                         continue;
283 283
                     }
284
-                    $path .= rtrim($v, '/') . '/';
284
+                    $path .= rtrim($v, '/').'/';
285 285
                     if (1 < $count) {
286
-                        $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path);
287
-                        $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>';
286
+                        $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path);
287
+                        $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>';
288 288
                     } else {
289
-                        $pieces[$i] = '<span>' . trim($v, '/') . '</span>';
289
+                        $pieces[$i] = '<span>'.trim($v, '/').'</span>';
290 290
                     }
291 291
                     $count--;
292 292
                 }
@@ -299,16 +299,16 @@  discard block
 block discarded – undo
299 299
         </div>
300 300
         <?php
301 301
         // check to see user isn't trying to move below the document_root
302
-        if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) {
302
+        if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) {
303 303
             $modx->webAlertAndQuit($_lang["files_access_denied"]);
304 304
         }
305 305
 
306 306
         // Unzip .zip files - by Raymond
307 307
         if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) {
308
-            if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) {
309
-                echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />';
308
+            if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) {
309
+                echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />';
310 310
             } else {
311
-                echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />';
311
+                echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />';
312 312
             }
313 313
         }
314 314
         // End Unzip - Raymond
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
             if ($_REQUEST['mode'] == 'deletefolder') {
321 321
                 $folder = $_REQUEST['folderpath'];
322 322
                 if (!$token_check || !@rrmdir($folder)) {
323
-                    echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />';
323
+                    echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />';
324 324
                 } else {
325
-                    echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />';
325
+                    echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />';
326 326
                 }
327 327
             }
328 328
 
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
                 if (!mkdirs("{$startpath}/{$foldername}", 0777)) {
334 334
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
335 335
                 } else {
336
-                    if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) {
337
-                        echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />';
336
+                    if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) {
337
+                        echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />';
338 338
                     } else {
339
-                        echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />';
339
+                        echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />';
340 340
                     }
341 341
                 }
342 342
                 umask($old_umask);
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                 $filename = $modx->db->escape($filename);
349 349
 
350 350
                 if (!checkExtension($filename)) {
351
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
351
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
352 352
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) {
353 353
                     echo $_lang['files.dynamic.php3'];
354 354
                 } else {
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
                 $newFilename = $modx->db->escape($newFilename);
371 371
 
372 372
                 if (!checkExtension($newFilename)) {
373
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
373
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
374 374
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
375 375
                     echo $_lang['files.dynamic.php3'];
376 376
                 } else {
377
-                    if (!copy($filename, MODX_BASE_PATH . $newFilename)) {
377
+                    if (!copy($filename, MODX_BASE_PATH.$newFilename)) {
378 378
                         echo $_lang['files.dynamic.php5'];
379 379
                     }
380 380
                     umask($old_umask);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             // Rename folder here
384 384
             if ($_REQUEST['mode'] == 'renameFolder') {
385 385
                 $old_umask = umask(0);
386
-                $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname'];
386
+                $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname'];
387 387
                 $dirname = $modx->db->escape($dirname);
388 388
                 $newDirname = str_replace(array(
389 389
                     '..\\',
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
                 if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) {
397 397
                     echo $_lang['files.dynamic.php3'];
398
-                } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) {
398
+                } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) {
399 399
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
400 400
                 }
401 401
                 umask($old_umask);
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
                 $newFilename = $modx->db->escape($newFilename);
416 416
 
417 417
                 if (!checkExtension($newFilename)) {
418
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
418
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
419 419
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
420 420
                     echo $_lang['files.dynamic.php3'];
421 421
                 } else {
422
-                    if (!rename($filename, $path . '/' . $newFilename)) {
422
+                    if (!rename($filename, $path.'/'.$newFilename)) {
423 423
                         echo $_lang['files.dynamic.php5'];
424 424
                     }
425 425
                     umask($old_umask);
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
                 ls($startpath);
453 453
                 echo "\n\n\n";
454 454
                 if ($folders == 0 && $files == 0) {
455
-                    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>';
455
+                    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>';
456 456
                 }
457 457
                 ?>
458 458
             </table>
@@ -461,10 +461,10 @@  discard block
 block discarded – undo
461 461
         <div class="container">
462 462
             <p>
463 463
                 <?php
464
-                echo $_lang['files_directories'] . ': <b>' . $folders . '</b> ';
465
-                echo $_lang['files_files'] . ': <b>' . $files . '</b> ';
466
-                echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> ';
467
-                echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>'
464
+                echo $_lang['files_directories'].': <b>'.$folders.'</b> ';
465
+                echo $_lang['files_files'].': <b>'.$files.'</b> ';
466
+                echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> ';
467
+                echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>'
468 468
                 ?>
469 469
             </p>
470 470
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 </form>
490 490
                 <?php
491 491
             } else {
492
-                echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>";
492
+                echo "<p>".$_lang['files_upload_inhibited_msg']."</p>";
493 493
             }
494 494
             ?>
495 495
             <div id="imageviewer"></div>
Please login to merge, or discard this patch.
manager/includes/functions/actions/help.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('createList')) {
2
+if (!function_exists('createList')) {
3 3
     /**
4 4
      * @param string $sectionHeader
5 5
      * @param array $linkArr
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
      */
8 8
     function createList($sectionHeader, $linkArr)
9 9
     {
10
-        $output = '<div class="sectionHeader">' . $sectionHeader . '</div><div class="sectionBody">' . "\n";
11
-        $output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">' . "\n";
10
+        $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
11
+        $output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
12 12
         $links = '';
13 13
         foreach ($linkArr as $row) {
14 14
             if (!is_array($row['link'])) {
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
             }
17 17
             foreach ($row['link'] as $link) {
18 18
                 $links .= $links != '' ? '<br/>' : '';
19
-                $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
19
+                $links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>';
20 20
             }
21 21
             $output .= '
22 22
 		<tr>
23
-			<td align="left"><strong>' . $row["title"] . '</strong></td>
24
-			<td align="left">' . $links . '</td>
23
+			<td align="left"><strong>' . $row["title"].'</strong></td>
24
+			<td align="left">' . $links.'</td>
25 25
 		</tr>';
26 26
             $links = '';
27 27
         }
28
-        $output .= '</table></div>' . "\n";
28
+        $output .= '</table></div>'."\n";
29 29
 
30 30
         return $output;
31 31
     }
Please login to merge, or discard this patch.
manager/includes/functions/actions/mutate_plugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     {
17 17
         echo '<div class="row form-row">
18 18
                 <div class="col-sm-6 col-md-4 col-lg-3">' .
19
-                    implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) .
20
-                '</div>' .
19
+                    implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).
20
+                '</div>'.
21 21
         '</div>';
22 22
 
23 23
         $evtnames = array();
Please login to merge, or discard this patch.
manager/includes/functions/actions/mutate_content.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('getDefaultTemplate')) {
3
+if (!function_exists('getDefaultTemplate')) {
4 4
     /**
5 5
      * @return string
6 6
      */
Please login to merge, or discard this patch.
manager/includes/functions/actions/settings.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('get_lang_keys')) {
2
+if (!function_exists('get_lang_keys')) {
3 3
     /**
4 4
      * get_lang_keys
5 5
      *
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
      */
9 9
     function get_lang_keys($filename)
10 10
     {
11
-        $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename;
11
+        $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename;
12 12
         if (is_file($file) && is_readable($file)) {
13 13
             include($file);
14 14
             $out = isset($_lang) ? array_keys($_lang) : array();
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     }
21 21
 }
22 22
 
23
-if(!function_exists('get_langs_by_key')) {
23
+if (!function_exists('get_langs_by_key')) {
24 24
     /**
25 25
      * get_langs_by_key
26 26
      *
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-if(!function_exists('get_lang_options')) {
44
+if (!function_exists('get_lang_options')) {
45 45
     /**
46 46
      * get_lang_options
47 47
      *
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
         if (!empty($key)) {
59 59
             $languages = get_langs_by_key($key);
60 60
             sort($languages);
61
-            $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>';
61
+            $lang_options .= '<option value="">'.$_lang['language_title'].'</option>';
62 62
 
63 63
             foreach ($languages as $language_name) {
64 64
                 $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
65
-                $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>';
65
+                $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>';
66 66
             }
67 67
 
68 68
             return $lang_options;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             foreach ($languages as $language_name) {
73 73
                 $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
74 74
                 $sel = $language_name === $selected_lang ? ' selected="selected"' : '';
75
-                $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>';
75
+                $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>';
76 76
             }
77 77
 
78 78
             return $lang_options;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     }
81 81
 }
82 82
 
83
-if(!function_exists('form_radio')) {
83
+if (!function_exists('form_radio')) {
84 84
     /**
85 85
      * @param string $name
86 86
      * @param string $value
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             $disabled = '';
100 100
         }
101 101
         if ($add) {
102
-            $add = ' ' . $add;
102
+            $add = ' '.$add;
103 103
         }
104 104
 
105 105
         return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name,
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     }
109 109
 }
110 110
 
111
-if(!function_exists('wrap_label')) {
111
+if (!function_exists('wrap_label')) {
112 112
     /**
113 113
      * @param string $str
114 114
      * @param string $object
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 }
123 123
 
124
-if(!function_exists('parseText')) {
124
+if (!function_exists('parseText')) {
125 125
     /**
126 126
      * @param string $tpl
127 127
      * @param array $ph
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     }
143 143
 }
144 144
 
145
-if(!function_exists('showHide')) {
145
+if (!function_exists('showHide')) {
146 146
     /**
147 147
      * @param bool $cond
148 148
      * @return string
Please login to merge, or discard this patch.
manager/includes/functions/actions/search.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('highlightingCoincidence')) {
3
+if (!function_exists('highlightingCoincidence')) {
4 4
     /**
5 5
      * @param string $text
6 6
      * @param string $search
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
      */
9 9
     function highlightingCoincidence($text, $search)
10 10
     {
11
-        $regexp = '!(' . str_replace(array(
11
+        $regexp = '!('.str_replace(array(
12 12
                 '(',
13 13
                 ')'
14 14
             ), array(
15 15
                 '\(',
16 16
                 '\)'
17
-            ), trim($search)) . ')!isu';
17
+            ), trim($search)).')!isu';
18 18
 
19 19
         return preg_replace($regexp, '<span class="text-danger">$1</span>', $text);
20 20
     }
21 21
 }
22 22
 
23
-if(!function_exists('addClassForItemList')) {
23
+if (!function_exists('addClassForItemList')) {
24 24
     /**
25 25
      * @param string $locked
26 26
      * @param string $disabled
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $class .= ' deleted';
41 41
         }
42 42
         if ($class) {
43
-            $class = ' class="' . trim($class) . '"';
43
+            $class = ' class="'.trim($class).'"';
44 44
         }
45 45
 
46 46
         return $class;
Please login to merge, or discard this patch.
manager/includes/functions/actions/logging.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('array_unique_multi')) {
2
+if (!function_exists('array_unique_multi')) {
3 3
     /**
4 4
      * @param array $array
5 5
      * @param string $checkKey
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     }
28 28
 }
29 29
 
30
-if(!function_exists('record_sort')) {
30
+if (!function_exists('record_sort')) {
31 31
     /**
32 32
      * @param array $array
33 33
      * @param string $key
Please login to merge, or discard this patch.
manager/includes/functions/actions/files.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('add_dot')) {
2
+if (!function_exists('add_dot')) {
3 3
     /**
4 4
      * @param array $array
5 5
      * @return array
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
     {
9 9
         $count = count($array);
10 10
         for ($i = 0; $i < $count; $i++) {
11
-            $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :)
11
+            $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :)
12 12
         }
13 13
 
14 14
         return $array;
15 15
     }
16 16
 }
17 17
 
18
-if(!function_exists('determineIcon')) {
18
+if (!function_exists('determineIcon')) {
19 19
     /**
20 20
      * @param string $file
21 21
      * @param string $selFile
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
             $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default'];
35 35
         }
36 36
 
37
-        return '<i class="' . $icon . ' FilesPage"></i>';
37
+        return '<i class="'.$icon.' FilesPage"></i>';
38 38
     }
39 39
 }
40 40
 
41
-if(!function_exists('markRow')) {
41
+if (!function_exists('markRow')) {
42 42
     /**
43 43
      * @param string $file
44 44
      * @param string $selFile
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
         if ($file == $selFile) {
56 56
             $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default'];
57 57
 
58
-            return ' class="' . $class . '"';
58
+            return ' class="'.$class.'"';
59 59
         }
60 60
 
61 61
         return '';
62 62
     }
63 63
 }
64 64
 
65
-if(!function_exists('ls')) {
65
+if (!function_exists('ls')) {
66 66
     /**
67 67
      * @param string $curpath
68 68
      */
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx;
73 73
         $dircounter = 0;
74 74
         $filecounter = 0;
75
-        $curpath = str_replace('//', '/', $curpath . '/');
75
+        $curpath = str_replace('//', '/', $curpath.'/');
76 76
 
77 77
         if (!is_dir($curpath)) {
78 78
             echo 'Invalid path "', $curpath, '"<br />';
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         // first, get info
85 85
         foreach ($dir as $file) {
86
-            $newpath = $curpath . $file;
86
+            $newpath = $curpath.$file;
87 87
             if ($file === '..' || $file === '.') {
88 88
                 continue;
89 89
             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 if ($file === '..' || $file === '.') {
94 94
                     continue;
95 95
                 } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) {
96
-                    $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>';
96
+                    $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>';
97 97
 
98 98
                     $dfiles = scandir($newpath);
99 99
                     foreach ($dfiles as $i => $infile) {
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
                     }
107 107
                     $file_exists = (0 < count($dfiles)) ? 'file_exists' : '';
108 108
 
109
-                    $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>' : '';
109
+                    $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>' : '';
110 110
                 } else {
111
-                    $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>';
112
-                    $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : '';
111
+                    $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>';
112
+                    $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : '';
113 113
                 }
114 114
 
115
-                $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : '';
115
+                $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : '';
116 116
 
117 117
                 // increment the counter
118 118
                 $dircounter++;
@@ -121,24 +121,24 @@  discard block
 block discarded – undo
121 121
                 $files_array[$filecounter]['file'] = $newpath;
122 122
                 $files_array[$filecounter]['stats'] = lstat($newpath);
123 123
                 $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'],
124
-                        $_REQUEST['mode']) . ' ' . $file;
124
+                        $_REQUEST['mode']).' '.$file;
125 125
                 $files_array[$filecounter]['view'] = (in_array($type,
126
-                    $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath,
126
+                    $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath,
127 127
                         $len,
128
-                        strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type,
129
-                        $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode',
128
+                        strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type,
129
+                        $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode',
130 130
                         explode('/', substr($newpath, $len,
131
-                            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>');
131
+                            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>');
132 132
                 $files_array[$filecounter]['view'] = (in_array($type,
133
-                    $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'];
134
-                $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>' : '';
133
+                    $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'];
134
+                $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>' : '';
135 135
                 $files_array[$filecounter]['edit'] = (in_array($type,
136
-                        $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>';
136
+                        $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>';
137 137
                 $files_array[$filecounter]['duplicate'] = (in_array($type,
138
-                        $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>';
138
+                        $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>';
139 139
                 $files_array[$filecounter]['rename'] = (in_array($type,
140
-                        $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>';
141
-                $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>';
140
+                        $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>';
141
+                $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>';
142 142
 
143 143
                 // increment the counter
144 144
                 $filecounter++;
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         for ($i = 0; $i < $folders; $i++) {
152 152
             $filesizes += $dirs_array[$i]['stats']['7'];
153 153
             echo '<tr>';
154
-            echo '<td>' . $dirs_array[$i]['text'] . '</td>';
155
-            echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>';
156
-            echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>';
154
+            echo '<td>'.$dirs_array[$i]['text'].'</td>';
155
+            echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>';
156
+            echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>';
157 157
             echo '<td class="actions text-right">';
158 158
             echo $dirs_array[$i]['rename'];
159 159
             echo $dirs_array[$i]['delete'];
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
         sort($files_array); // sorting the array alphabetically (Thanks pxl8r!)
167 167
         for ($i = 0; $i < $files; $i++) {
168 168
             $filesizes += $files_array[$i]['stats']['7'];
169
-            echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>';
170
-            echo '<td>' . $files_array[$i]['text'] . '</td>';
171
-            echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>';
172
-            echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>';
169
+            echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>';
170
+            echo '<td>'.$files_array[$i]['text'].'</td>';
171
+            echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>';
172
+            echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>';
173 173
             echo '<td class="actions text-right">';
174 174
             echo $files_array[$i]['unzip'];
175 175
             echo $files_array[$i]['view'];
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     }
186 186
 }
187 187
 
188
-if(!function_exists('removeLastPath')) {
188
+if (!function_exists('removeLastPath')) {
189 189
     /**
190 190
      * @param string $string
191 191
      * @return bool|string
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     }
204 204
 }
205 205
 
206
-if(!function_exists('getExtension')) {
206
+if (!function_exists('getExtension')) {
207 207
     /**
208 208
      * @param string $string
209 209
      * @return bool|string
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     }
223 223
 }
224 224
 
225
-if(!function_exists('checkExtension')) {
225
+if (!function_exists('checkExtension')) {
226 226
     /**
227 227
      * @param string $path
228 228
      * @return bool
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     }
240 240
 }
241 241
 
242
-if(!function_exists('mkdirs')) {
242
+if (!function_exists('mkdirs')) {
243 243
     /**
244 244
      * recursive mkdir function
245 245
      *
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     }
262 262
 }
263 263
 
264
-if(!function_exists('logFileChange')) {
264
+if (!function_exists('logFileChange')) {
265 265
     /**
266 266
      * @param string $type
267 267
      * @param string $filename
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     }
298 298
 }
299 299
 
300
-if(!function_exists('unzip')) {
300
+if (!function_exists('unzip')) {
301 301
     /**
302 302
      * by patrick_allaert - php user notes
303 303
      *
@@ -321,17 +321,17 @@  discard block
 block discarded – undo
321 321
         $zip = zip_open($file);
322 322
         if ($zip) {
323 323
             $old_umask = umask(0);
324
-            $path = rtrim($path, '/') . '/';
324
+            $path = rtrim($path, '/').'/';
325 325
             while ($zip_entry = zip_read($zip)) {
326 326
                 if (zip_entry_filesize($zip_entry) > 0) {
327 327
                     // str_replace must be used under windows to convert "/" into "\"
328 328
                     $zip_entry_name = zip_entry_name($zip_entry);
329
-                    $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name));
330
-                    $complete_name = $path . str_replace('\\', '/', $zip_entry_name);
329
+                    $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name));
330
+                    $complete_name = $path.str_replace('\\', '/', $zip_entry_name);
331 331
                     if (!file_exists($complete_path)) {
332 332
                         $tmp = '';
333 333
                         foreach (explode('/', $complete_path) AS $k) {
334
-                            $tmp .= $k . '/';
334
+                            $tmp .= $k.'/';
335 335
                             if (!is_dir($tmp)) {
336 336
                                 mkdir($tmp, 0777);
337 337
                             }
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
     }
353 353
 }
354 354
 
355
-if(!function_exists('rrmdir')) {
355
+if (!function_exists('rrmdir')) {
356 356
     /**
357 357
      * @param string $dir
358 358
      * @return bool
359 359
      */
360 360
     function rrmdir($dir)
361 361
     {
362
-        foreach (glob($dir . '/*') as $file) {
362
+        foreach (glob($dir.'/*') as $file) {
363 363
             if (is_dir($file)) {
364 364
                 rrmdir($file);
365 365
             } else {
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
     }
372 372
 }
373 373
 
374
-if(!function_exists('fileupload')) {
374
+if (!function_exists('fileupload')) {
375 375
     /**
376 376
      * @return string
377 377
      */
@@ -401,13 +401,13 @@  discard block
 block discarded – undo
401 401
             $userfile['type'] = $_FILES['userfile']['type'][$i];
402 402
 
403 403
             // this seems to be an upload action.
404
-            $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath));
405
-            $path = rtrim($path, '/') . '/' . $userfile['name'];
404
+            $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath));
405
+            $path = rtrim($path, '/').'/'.$userfile['name'];
406 406
             $msg .= $path;
407 407
             if ($userfile['error'] == 0) {
408 408
                 $img = (strpos($userfile['type'],
409
-                        'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : '';
410
-                $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>';
409
+                        'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : '';
410
+                $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>';
411 411
             }
412 412
 
413 413
             $userfilename = $userfile['tmp_name'];
@@ -415,15 +415,15 @@  discard block
 block discarded – undo
415 415
             if (is_uploaded_file($userfilename)) {
416 416
                 // file is uploaded file, process it!
417 417
                 if (!checkExtension($userfile['name'])) {
418
-                    $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>';
418
+                    $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>';
419 419
                 } else {
420
-                    if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) {
420
+                    if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) {
421 421
                         // Ryan: Repair broken permissions issue with file manager
422 422
                         if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
423
-                            @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions);
423
+                            @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions);
424 424
                         }
425 425
                         // Ryan: End
426
-                        $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>';
426
+                        $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>';
427 427
 
428 428
                         // invoke OnFileManagerUpload event
429 429
                         $modx->invokeEvent('OnFileManagerUpload', array(
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
                             'filename' => $userfile['name']
432 432
                         ));
433 433
                         // Log the change
434
-                        logFileChange('upload', $_POST['path'] . '/' . $userfile['name']);
434
+                        logFileChange('upload', $_POST['path'].'/'.$userfile['name']);
435 435
                     } else {
436
-                        $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>';
436
+                        $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>';
437 437
                     }
438 438
                 }
439 439
             } else {
440
-                $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>';
440
+                $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>';
441 441
                 switch ($userfile['error']) {
442 442
                     case 0: //no error; possible file attack!
443 443
                         $msg .= $_lang['files_upload_error0'];
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
             }
463 463
         }
464 464
 
465
-        return $msg . '<br/>';
465
+        return $msg.'<br/>';
466 466
     }
467 467
 }
468 468
 
469
-if(!function_exists('textsave')) {
469
+if (!function_exists('textsave')) {
470 470
     /**
471 471
      * @return string
472 472
      */
@@ -480,9 +480,9 @@  discard block
 block discarded – undo
480 480
 
481 481
         // Write $content to our opened file.
482 482
         if (file_put_contents($filename, $content) === false) {
483
-            $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />';
483
+            $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />';
484 484
         } else {
485
-            $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />';
485
+            $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />';
486 486
             $_REQUEST['mode'] = 'edit';
487 487
         }
488 488
         // Log the change
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
     }
493 493
 }
494 494
 
495
-if(!function_exists('delete_file')) {
495
+if (!function_exists('delete_file')) {
496 496
     /**
497 497
      * @return string
498 498
      */
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 
505 505
         $file = $_REQUEST['path'];
506 506
         if (!$token_check || !@unlink($file)) {
507
-            $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />';
507
+            $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />';
508 508
         } else {
509
-            $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />';
509
+            $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />';
510 510
         }
511 511
 
512 512
         // Log the change
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
     }
517 517
 }
518 518
 
519
-if(!function_exists('parsePlaceholder')) {
519
+if (!function_exists('parsePlaceholder')) {
520 520
     /**
521 521
      * @param string $tpl
522 522
      * @param array $ph
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     }
534 534
 }
535 535
 
536
-if(!function_exists('checkToken')) {
536
+if (!function_exists('checkToken')) {
537 537
     /**
538 538
      * @return bool
539 539
      */
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
     }
559 559
 }
560 560
 
561
-if(!function_exists('makeToken')) {
561
+if (!function_exists('makeToken')) {
562 562
     /**
563 563
      * @return string
564 564
      */
Please login to merge, or discard this patch.
manager/includes/functions/actions/import.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('run')) {
2
+if (!function_exists('run')) {
3 3
     /**
4 4
      * @return string
5 5
      */
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
             $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
29 29
         }
30 30
 
31
-        $parent = (int)$_POST['parent'];
31
+        $parent = (int) $_POST['parent'];
32 32
 
33
-        if (is_dir(MODX_BASE_PATH . 'temp/import')) {
34
-            $filedir = MODX_BASE_PATH . 'temp/import/';
35
-        } elseif (is_dir(MODX_BASE_PATH . 'assets/import')) {
36
-            $filedir = MODX_BASE_PATH . 'assets/import/';
33
+        if (is_dir(MODX_BASE_PATH.'temp/import')) {
34
+            $filedir = MODX_BASE_PATH.'temp/import/';
35
+        } elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
36
+            $filedir = MODX_BASE_PATH.'assets/import/';
37 37
         } else {
38 38
             $filedir = '';
39 39
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $files = pop_index($files);
45 45
 
46 46
         // no. of files to import
47
-        $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
47
+        $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
48 48
 
49 49
         // import files
50 50
         if (0 < count($files)) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $mtime = $mtime[1] + $mtime[0];
58 58
         $importend = $mtime;
59 59
         $totaltime = ($importend - $importstart);
60
-        $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
60
+        $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
61 61
 
62 62
         if ($_POST['convert_link'] == 'on') {
63 63
             convertLink();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 }
69 69
 
70
-if(!function_exists('importFiles')) {
70
+if (!function_exists('importFiles')) {
71 71
     /**
72 72
      * @param int $parent
73 73
      * @param string $filedir
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if (is_array($value)) {
99 99
                 // create folder
100 100
                 $alias = $id;
101
-                printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
101
+                printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
102 102
                 $field = array();
103 103
                 $field['type'] = 'document';
104 104
                 $field['contentType'] = 'text/html';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                              'index.html',
118 118
                              'index.htm'
119 119
                          ) as $filename) {
120
-                    $filepath = $filedir . $alias . '/' . $filename;
120
+                    $filepath = $filedir.$alias.'/'.$filename;
121 121
                     if ($find === false && file_exists($filepath)) {
122 122
                         $file = getFileContent($filepath);
123 123
                         list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
                         $newid = $modx->db->insert($field, $tbl_site_content);
133 133
                         if ($newid) {
134 134
                             $find = true;
135
-                            echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
136
-                            importFiles($newid, $filedir . $alias . '/', $value, 'sub');
135
+                            echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
136
+                            importFiles($newid, $filedir.$alias.'/', $value, 'sub');
137 137
                         } else {
138
-                            echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
138
+                            echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
139 139
                             exit;
140 140
                         }
141 141
                     }
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
                     $newid = $modx->db->insert($field, $tbl_site_content);
151 151
                     if ($newid) {
152 152
                         $find = true;
153
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
154
-                        importFiles($newid, $filedir . $alias . '/', $value, 'sub');
153
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
154
+                        importFiles($newid, $filedir.$alias.'/', $value, 'sub');
155 155
                     } else {
156
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
156
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
157 157
                         exit;
158 158
                     }
159 159
                 }
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
                 $fparts = explode('.', $value);
167 167
                 $alias = $fparts[0];
168 168
                 $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
169
-                printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
169
+                printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
170 170
 
171 171
                 if (!in_array($ext, $allowedfiles)) {
172
-                    echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
172
+                    echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
173 173
                 } else {
174
-                    $filepath = $filedir . $filename;
174
+                    $filepath = $filedir.$filename;
175 175
                     $file = getFileContent($filepath);
176 176
                     list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
177 177
 
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
                     $field['menuindex'] = ($alias == 'index') ? 0 : 2;
198 198
                     $newid = $modx->db->insert($field, $tbl_site_content);
199 199
                     if ($newid) {
200
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
200
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
201 201
                     } else {
202
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
202
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
203 203
                         exit;
204 204
                     }
205 205
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     }
219 219
 }
220 220
 
221
-if(!function_exists('getFiles')) {
221
+if (!function_exists('getFiles')) {
222 222
     /**
223 223
      * @param string $directory
224 224
      * @param array $listing
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
             foreach ($files as $file) {
235 235
                 if ($file == '.' || $file == '..') {
236 236
                     continue;
237
-                } elseif ($h = @opendir($directory . $file . "/")) {
237
+                } elseif ($h = @opendir($directory.$file."/")) {
238 238
                     closedir($h);
239 239
                     $count = -1;
240
-                    $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
240
+                    $listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
241 241
                 } elseif (strpos($file, '.htm') !== false) {
242 242
                     $listing[$dummy] = $file;
243 243
                     $dummy = $dummy + 1;
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
                 }
246 246
             }
247 247
         } else {
248
-            echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
248
+            echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
249 249
         }
250 250
 
251 251
         return ($listing);
252 252
     }
253 253
 }
254 254
 
255
-if(!function_exists('getFileContent')) {
255
+if (!function_exists('getFileContent')) {
256 256
     /**
257 257
      * @param string $filepath
258 258
      * @return bool|string
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
         global $_lang;
263 263
         // get the file
264 264
         if (!$buffer = file_get_contents($filepath)) {
265
-            echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
265
+            echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
266 266
         } else {
267 267
             return $buffer;
268 268
         }
269 269
     }
270 270
 }
271 271
 
272
-if(!function_exists('pop_index')) {
272
+if (!function_exists('pop_index')) {
273 273
     /**
274 274
      * @param array $array
275 275
      * @return array
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     }
295 295
 }
296 296
 
297
-if(!function_exists('treatContent')) {
297
+if (!function_exists('treatContent')) {
298 298
     /**
299 299
      * @param string $src
300 300
      * @param string $filename
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         } else {
330 330
             $content = $src;
331 331
             $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
332
-            $r = '$1' . $modx->config['modx_charset'] . '$2';
332
+            $r = '$1'.$modx->config['modx_charset'].'$2';
333 333
             $content = preg_replace($s, $r, $content);
334 334
             $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
335 335
         }
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     }
346 346
 }
347 347
 
348
-if(!function_exists('convertLink')) {
348
+if (!function_exists('convertLink')) {
349 349
     /**
350 350
      * @return void
351 351
      */
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                     list($href, $v) = explode('"', $v, 2);
369 369
                     $_ = $href;
370 370
                     if (strpos($_, $modx->config['site_url']) !== false) {
371
-                        $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
371
+                        $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
372 372
                     }
373 373
                     if ($_[0] === '/') {
374 374
                         $_ = substr($_, 1);
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
                     if (strpos($_, '/') !== false) {
396 396
                         $_ = substr($_, strrpos($_, '/'));
397 397
                     }
398
-                    $_ = $dir . str_replace('.html', '', $_);
398
+                    $_ = $dir.str_replace('.html', '', $_);
399 399
                     if (!isset($target[$_])) {
400 400
                         $target[$_] = $modx->getIdFromAlias($_);
401 401
                     }
402 402
                     $target[$_] = trim($target[$_]);
403 403
                     if (!empty($target[$_])) {
404
-                        $href = '[~' . $target[$_] . '~]';
404
+                        $href = '[~'.$target[$_].'~]';
405 405
                     }
406
-                    $array[$c] = '<a href="' . $href . '"' . $v;
406
+                    $array[$c] = '<a href="'.$href.'"'.$v;
407 407
                 }
408 408
                 $c++;
409 409
             }
Please login to merge, or discard this patch.