Completed
Push — 1.10.x ( 61bd88...f2aaaf )
by Yannick
198:27 queued 157:50
created
main/admin/settings.lib.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @package chamilo.admin
12 12
  */
13 13
 
14
-define('CSS_UPLOAD_PATH', api_get_path(SYS_APP_PATH) . 'Resources/public/css/themes/');
14
+define('CSS_UPLOAD_PATH', api_get_path(SYS_APP_PATH).'Resources/public/css/themes/');
15 15
 
16 16
 use Symfony\Component\Filesystem\Filesystem;
17 17
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     $possible_plugins = $plugin_obj->read_plugins_from_path();
41 41
     $installed_plugins = $plugin_obj->get_installed_plugins();
42 42
 
43
-    echo '<form name="plugins" method="post" action="' . api_get_self() . '?category=' . Security::remove_XSS($_GET['category']) . '">';
43
+    echo '<form name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'">';
44 44
     echo '<table class="data_table">';
45 45
     echo '<tr>';
46 46
     echo '<th width="400px">';
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     unset($plugin_region_list['course_tool_plugin']);
64 64
 
65 65
     foreach ($installed_plugins as $plugin) {
66
-        $plugin_info_file = api_get_path(SYS_PLUGIN_PATH) . $plugin . '/plugin.php';
66
+        $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$plugin.'/plugin.php';
67 67
 
68 68
         if (file_exists($plugin_info_file)) {
69 69
             $plugin_info = array();
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
                 echo '<tr>';
75 75
             }
76 76
             echo '<td>';
77
-            echo '<h4>' . $plugin_info['title'] . ' <small>v' . $plugin_info['version'] . '</small></h4>';
78
-            echo '<p>' . $plugin_info['comment'] . '</p>';
77
+            echo '<h4>'.$plugin_info['title'].' <small>v'.$plugin_info['version'].'</small></h4>';
78
+            echo '<p>'.$plugin_info['comment'].'</p>';
79 79
             echo '</td><td>';
80 80
             $selected_plugins = $plugin_obj->get_areas_by_plugin($plugin);
81 81
 
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
             } else {
85 85
                 $region_list = $plugin_region_list;
86 86
             }
87
-            echo Display::select('plugin_' . $plugin . '[]', $region_list, $selected_plugins,
87
+            echo Display::select('plugin_'.$plugin.'[]', $region_list, $selected_plugins,
88 88
                 array('multiple' => 'multiple', 'style' => 'width:500px'), true, get_lang('None'));
89 89
             echo '</td></tr>';
90 90
         }
91 91
     }
92 92
     echo '</table>';
93 93
     echo '<br />';
94
-    echo '<button class="btn btn-success" type="submit" name="submit_plugins">' . get_lang('EnablePlugins') . '</button></form>';
94
+    echo '<button class="btn btn-success" type="submit" name="submit_plugins">'.get_lang('EnablePlugins').'</button></form>';
95 95
 }
96 96
 
97 97
 function handle_extensions()
98 98
 {
99 99
     echo Display::page_subheader(get_lang('ConfigureExtensions'));
100
-    echo '<a class="btn btn-success" href="configure_extensions.php?display=ppt2lp" role="button">' . get_lang('Ppt2lp') . '</a>';
100
+    echo '<a class="btn btn-success" href="configure_extensions.php?display=ppt2lp" role="button">'.get_lang('Ppt2lp').'</a>';
101 101
 
102 102
 }
103 103
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     //Plugins NOT installed
133 133
     echo Display::page_subheader(get_lang('Plugins'));
134
-    echo '<form class="form-horizontal" name="plugins" method="post" action="' . api_get_self() . '?category=' . Security::remove_XSS($_GET['category']) . '&sec_token=' . $token . '">';
134
+    echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token='.$token.'">';
135 135
     echo '<table class="data_table">';
136 136
     echo '<tr>';
137 137
     echo '<th width="20px">';
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     }
149 149
 
150 150
     foreach ($all_plugins as $plugin) {
151
-        $plugin_info_file = api_get_path(SYS_PLUGIN_PATH) . $plugin . '/plugin.php';
151
+        $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$plugin.'/plugin.php';
152 152
 
153 153
         if (file_exists($plugin_info_file)) {
154 154
             $plugin_info = array();
@@ -162,29 +162,29 @@  discard block
 block discarded – undo
162 162
             echo '<td>';
163 163
             //Checkbox
164 164
             if (in_array($plugin, $installed_plugins)) {
165
-                echo '<input type="checkbox" name="plugin_' . $plugin . '[]" checked="checked">';
165
+                echo '<input type="checkbox" name="plugin_'.$plugin.'[]" checked="checked">';
166 166
 
167 167
             } else {
168
-                echo '<input type="checkbox" name="plugin_' . $plugin . '[]">';
168
+                echo '<input type="checkbox" name="plugin_'.$plugin.'[]">';
169 169
             }
170 170
             echo '</td><td>';
171 171
 
172
-            echo '<h4>' . $plugin_info['title'] . ' <small>v ' . $plugin_info['version'] . '</small></h4>';
173
-            echo '<p>' . $plugin_info['comment'] . '</p>';
174
-            echo '<p>' . get_lang('Author') . ': ' . $plugin_info['author'] . '</p>';
172
+            echo '<h4>'.$plugin_info['title'].' <small>v '.$plugin_info['version'].'</small></h4>';
173
+            echo '<p>'.$plugin_info['comment'].'</p>';
174
+            echo '<p>'.get_lang('Author').': '.$plugin_info['author'].'</p>';
175 175
 
176 176
             echo '<div class="btn-group">';
177 177
             if (in_array($plugin, $installed_plugins)) {
178
-                echo Display::url('<em class="fa fa-cogs"></em> ' . get_lang('Configure'),
179
-                    'configure_plugin.php?name=' . $plugin, array('class' => 'btn btn-default'));
180
-                echo Display::url('<em class="fa fa-th-large"></em> ' . get_lang('Regions'),
181
-                    'settings.php?category=Regions&name=' . $plugin, array('class' => 'btn btn-default'));
178
+                echo Display::url('<em class="fa fa-cogs"></em> '.get_lang('Configure'),
179
+                    'configure_plugin.php?name='.$plugin, array('class' => 'btn btn-default'));
180
+                echo Display::url('<em class="fa fa-th-large"></em> '.get_lang('Regions'),
181
+                    'settings.php?category=Regions&name='.$plugin, array('class' => 'btn btn-default'));
182 182
             }
183 183
 
184
-            if (file_exists(api_get_path(SYS_PLUGIN_PATH) . $plugin . '/readme.txt')) {
184
+            if (file_exists(api_get_path(SYS_PLUGIN_PATH).$plugin.'/readme.txt')) {
185 185
                 echo Display::url(
186 186
                     "<em class='fa fa-file-text-o'></em> readme.txt",
187
-                    api_get_path(WEB_PLUGIN_PATH) . $plugin . "/readme.txt",
187
+                    api_get_path(WEB_PLUGIN_PATH).$plugin."/readme.txt",
188 188
                     [
189 189
                         'class' => 'btn btn-default ajax',
190 190
                         'data-title' => $plugin_info['title'],
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
     echo '</table>';
201 201
 
202 202
     echo '<div class="form-actions bottom_actions">';
203
-    echo '<button class="btn btn-success" type="submit" name="submit_plugins">' .
204
-        get_lang('EnablePlugins') . '</button>';
203
+    echo '<button class="btn btn-success" type="submit" name="submit_plugins">'.
204
+        get_lang('EnablePlugins').'</button>';
205 205
     echo '</div>';
206 206
     echo '</form>';
207 207
 }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         'woff2'
256 256
     );
257 257
 
258
-    $form->addRule('new_stylesheet', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')',
258
+    $form->addRule('new_stylesheet', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')',
259 259
         'filetype', $allowed_file_types);
260 260
     $form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
261 261
     $form->addButtonUpload(get_lang('Upload'), 'stylesheet_upload');
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     $show_upload_form = false;
264 264
 
265 265
     if (!is_writable(CSS_UPLOAD_PATH)) {
266
-        Display::display_error_message(CSS_UPLOAD_PATH . get_lang('IsNotWritable'));
266
+        Display::display_error_message(CSS_UPLOAD_PATH.get_lang('IsNotWritable'));
267 267
     } else {
268 268
         // Uploading a new stylesheet.
269 269
         if ($_configuration['access_url'] == 1) {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     $form_change = new FormValidator(
305 305
         'stylesheet_upload',
306 306
         'post',
307
-        api_get_self() . '?category=Stylesheets',
307
+        api_get_self().'?category=Stylesheets',
308 308
         null,
309 309
         array('id' => 'stylesheets_id')
310 310
     );
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                 // Skip directories starting with a '.'
322 322
                 continue;
323 323
             }
324
-            $dirpath = CSS_UPLOAD_PATH . $style_dir;
324
+            $dirpath = CSS_UPLOAD_PATH.$style_dir;
325 325
 
326 326
             if (is_dir($dirpath)) {
327 327
                 if ($style_dir != '.' && $style_dir != '..') {
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
             Display::display_normal_message(get_lang('Saved'));
369 369
         }
370 370
         if (isset($_POST['download'])) {
371
-            $arch = api_get_path(SYS_ARCHIVE_PATH) . $safe_style_dir . '.zip';
372
-            $dir = api_get_path(SYS_CSS_PATH) . 'themes/' . $safe_style_dir;
371
+            $arch = api_get_path(SYS_ARCHIVE_PATH).$safe_style_dir.'.zip';
372
+            $dir = api_get_path(SYS_CSS_PATH).'themes/'.$safe_style_dir;
373 373
             if (is_dir($dir)) {
374 374
                 $zip = new PclZip($arch);
375 375
                 // Remove path prefix except the style name and put file on disk
376 376
                 $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($safe_style_dir)));
377 377
                 //@TODO: use more generic script to download.
378
-                $str = '<a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . str_replace(api_get_path(SYS_ARCHIVE_PATH),
379
-                        '', $arch) . '">' . get_lang('ClickHereToDownloadTheFile') . '</a>';
378
+                $str = '<a class="btn btn-primary btn-large" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.str_replace(api_get_path(SYS_ARCHIVE_PATH),
379
+                        '', $arch).'">'.get_lang('ClickHereToDownloadTheFile').'</a>';
380 380
                 Display::display_normal_message($str, false);
381 381
             } else {
382 382
                 Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning'));
@@ -393,33 +393,33 @@  discard block
 block discarded – undo
393 393
     $logoForm->addHtml(Display::return_message(sprintf(get_lang('TheLogoMustBeSizeXAndFormatY'), '250 x 70', 'PNG'),
394 394
         'info'));
395 395
 
396
-    $dir = api_get_path(SYS_PUBLIC_PATH) . 'css/themes/' . $selected . '/images/';
397
-    $url = api_get_path(WEB_CSS_PATH) . 'themes/' . $selected . '/images/';
396
+    $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/'.$selected.'/images/';
397
+    $url = api_get_path(WEB_CSS_PATH).'themes/'.$selected.'/images/';
398 398
     $logoFileName = 'header-logo.png';
399 399
     $newLogoFileName = 'header-logo-custom.png';
400 400
 
401
-    if (is_file($dir . $newLogoFileName)) {
401
+    if (is_file($dir.$newLogoFileName)) {
402 402
         $logoForm->addLabel(get_lang('CurrentLogo'),
403
-            '<img id="header-logo-custom" src="' . $url . $newLogoFileName . '?' . time() . '">');
403
+            '<img id="header-logo-custom" src="'.$url.$newLogoFileName.'?'.time().'">');
404 404
     } else {
405 405
         $logoForm->addLabel(get_lang('CurrentLogo'),
406
-            '<img id="header-logo-custom" src="' . $url . $logoFileName . '?' . time() . '">');
406
+            '<img id="header-logo-custom" src="'.$url.$logoFileName.'?'.time().'">');
407 407
     }
408 408
 
409 409
     $logoForm->addFile('new_logo', get_lang('UpdateLogo'));
410 410
     $allowedFileTypes = ['png'];
411 411
 
412 412
     if (isset($_POST['logo_reset'])) {
413
-        if (is_file($dir . $newLogoFileName)) {
414
-            unlink($dir . $newLogoFileName);
413
+        if (is_file($dir.$newLogoFileName)) {
414
+            unlink($dir.$newLogoFileName);
415 415
             Display::display_normal_message(get_lang('ResetToTheOriginalLogo'));
416 416
             echo '<script>'
417
-                . '$("#header-logo").attr("src","' . $url . $logoFileName . '");'
417
+                . '$("#header-logo").attr("src","'.$url.$logoFileName.'");'
418 418
                 . '</script>';
419 419
         }
420 420
     } elseif (isset($_POST['logo_upload'])) {
421 421
 
422
-        $logoForm->addRule('new_logo', get_lang('InvalidExtension') . ' (' . implode(',', $allowedFileTypes) . ')',
422
+        $logoForm->addRule('new_logo', get_lang('InvalidExtension').' ('.implode(',', $allowedFileTypes).')',
423 423
             'filetype', $allowedFileTypes);
424 424
         $logoForm->addRule('new_logo', get_lang('ThisFieldIsRequired'), 'required');
425 425
 
@@ -429,22 +429,22 @@  discard block
 block discarded – undo
429 429
             $width = $imageInfo[0];
430 430
             $height = $imageInfo[1];
431 431
             if ($width <= 250 && $height <= 70) {
432
-                if (is_file($dir . $newLogoFileName)) {
433
-                    unlink($dir . $newLogoFileName);
432
+                if (is_file($dir.$newLogoFileName)) {
433
+                    unlink($dir.$newLogoFileName);
434 434
                 }
435 435
 
436
-                $status = move_uploaded_file($_FILES['new_logo']['tmp_name'], $dir . $newLogoFileName);
436
+                $status = move_uploaded_file($_FILES['new_logo']['tmp_name'], $dir.$newLogoFileName);
437 437
 
438 438
                 if ($status) {
439 439
                     Display::display_normal_message(get_lang('NewLogoUpdated'));
440 440
                     echo '<script>'
441
-                        . '$("#header-logo").attr("src","' . $url . $newLogoFileName . '");'
441
+                        . '$("#header-logo").attr("src","'.$url.$newLogoFileName.'");'
442 442
                         . '</script>';
443 443
                 } else {
444
-                    Display::display_error_message('Error - ' . get_lang('UplNoFileUploaded'));
444
+                    Display::display_error_message('Error - '.get_lang('UplNoFileUploaded'));
445 445
                 }
446 446
             } else {
447
-                Display::display_error_message('Error - ' . get_lang('InvalidImageDimensions'));
447
+                Display::display_error_message('Error - '.get_lang('InvalidImageDimensions'));
448 448
             }
449 449
         }
450 450
     }
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
         //Little hack to update the logo image in update form when submiting
483 483
         if (isset($_POST['logo_reset'])) {
484 484
             echo '<script>'
485
-                . '$("#header-logo-custom").attr("src","' . $url . $logoFileName . '");'
485
+                . '$("#header-logo-custom").attr("src","'.$url.$logoFileName.'");'
486 486
                 . '</script>';
487
-        } elseif (isset($_POST['logo_upload']) && is_file($dir . $newLogoFileName)) {
487
+        } elseif (isset($_POST['logo_upload']) && is_file($dir.$newLogoFileName)) {
488 488
             echo '<script>'
489
-                . '$("#header-logo-custom").attr("src","' . $url . $newLogoFileName . '");'
489
+                . '$("#header-logo-custom").attr("src","'.$url.$newLogoFileName.'");'
490 490
                 . '</script>';
491 491
         }
492 492
     } else {
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 
514 514
     // Create the folder if needed.
515 515
 
516
-    if (!is_dir($cssToUpload . $style_name . '/')) {
517
-        mkdir($cssToUpload . $style_name . '/', api_get_permissions_for_new_directories());
516
+    if (!is_dir($cssToUpload.$style_name.'/')) {
517
+        mkdir($cssToUpload.$style_name.'/', api_get_permissions_for_new_directories());
518 518
     }
519 519
 
520 520
     $info = pathinfo($picture['name']);
@@ -561,21 +561,21 @@  discard block
 block discarded – undo
561 561
             if (!$valid) {
562 562
                 $error_string = '<ul>';
563 563
                 foreach ($invalid_files as $invalid_file) {
564
-                    $error_string .= '<li>' . $invalid_file . '</li>';
564
+                    $error_string .= '<li>'.$invalid_file.'</li>';
565 565
                 }
566 566
                 $error_string .= '</ul>';
567 567
                 Display::display_error_message(
568
-                    get_lang('ErrorStylesheetFilesExtensionsInsideZip') . $error_string,
568
+                    get_lang('ErrorStylesheetFilesExtensionsInsideZip').$error_string,
569 569
                     false
570 570
                 );
571 571
             } else {
572 572
                 // If the zip does not contain a single directory, extract it.
573 573
                 if (!$single_directory) {
574 574
                     // Extract zip file.
575
-                    $zip->extractTo($cssToUpload . $style_name . '/');
575
+                    $zip->extractTo($cssToUpload.$style_name.'/');
576 576
                     $result = true;
577 577
                 } else {
578
-                    $extraction_path = $cssToUpload . $style_name . '/';
578
+                    $extraction_path = $cssToUpload.$style_name.'/';
579 579
                     for ($i = 0; $i < $num_files; $i++) {
580 580
                         $entry = $zip->getNameIndex($i);
581 581
                         if (substr($entry, -1) == '/') {
@@ -586,14 +586,14 @@  discard block
 block discarded – undo
586 586
                         $entry_without_first_dir = substr($entry, $pos_slash + 1);
587 587
                         // If there is still a slash, we need to make sure the directories are created.
588 588
                         if (strpos($entry_without_first_dir, '/') !== false) {
589
-                            if (!is_dir($extraction_path . dirname($entry_without_first_dir))) {
589
+                            if (!is_dir($extraction_path.dirname($entry_without_first_dir))) {
590 590
                                 // Create it.
591
-                                @mkdir($extraction_path . dirname($entry_without_first_dir), $mode = 0777, true);
591
+                                @mkdir($extraction_path.dirname($entry_without_first_dir), $mode = 0777, true);
592 592
                             }
593 593
                         }
594 594
 
595 595
                         $fp = $zip->getStream($entry);
596
-                        $ofp = fopen($extraction_path . dirname($entry_without_first_dir) . '/' . basename($entry),
596
+                        $ofp = fopen($extraction_path.dirname($entry_without_first_dir).'/'.basename($entry),
597 597
                             'w');
598 598
 
599 599
                         while (!feof($fp)) {
@@ -608,17 +608,17 @@  discard block
 block discarded – undo
608 608
             }
609 609
             $zip->close();
610 610
         } else {
611
-            Display::display_error_message(get_lang('ErrorReadingZip') . $info['extension'], false);
611
+            Display::display_error_message(get_lang('ErrorReadingZip').$info['extension'], false);
612 612
         }
613 613
     } else {
614 614
         // Simply move the file.
615
-        move_uploaded_file($picture['tmp_name'], $cssToUpload . $style_name . '/' . $picture['name']);
615
+        move_uploaded_file($picture['tmp_name'], $cssToUpload.$style_name.'/'.$picture['name']);
616 616
         $result = true;
617 617
     }
618 618
 
619 619
     if ($result) {
620 620
         $fs = new Filesystem();
621
-        $fs->mirror($cssToUpload, api_get_path(SYS_PATH) . 'web/css/themes/');
621
+        $fs->mirror($cssToUpload, api_get_path(SYS_PATH).'web/css/themes/');
622 622
     }
623 623
 
624 624
     return $result;
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
     $plugin_list = $plugin_obj->read_plugins_from_path();
648 648
 
649 649
     foreach ($plugin_list as $plugin) {
650
-        if (isset($_POST['plugin_' . $plugin])) {
651
-            $areas_to_installed = $_POST['plugin_' . $plugin];
650
+        if (isset($_POST['plugin_'.$plugin])) {
651
+            $areas_to_installed = $_POST['plugin_'.$plugin];
652 652
             if (!empty($areas_to_installed)) {
653 653
                 $plugin_obj->remove_all_regions($plugin);
654 654
                 foreach ($areas_to_installed as $region) {
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
     $installed_plugins = array();
676 676
 
677 677
     foreach ($plugin_list as $plugin) {
678
-        if (isset($_POST['plugin_' . $plugin])) {
678
+        if (isset($_POST['plugin_'.$plugin])) {
679 679
             $appPlugin->install($plugin);
680 680
             $installed_plugins[] = $plugin;
681 681
         }
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
     $dir = CSS_UPLOAD_PATH;
723 723
     $dirs = scandir($dir);
724 724
     $style = str_replace(array('/', '\\'), array('', ''), $style); // Avoid slashes or backslashes.
725
-    if (in_array($style, $dirs) && is_dir($dir . $style)) {
725
+    if (in_array($style, $dirs) && is_dir($dir.$style)) {
726 726
         return true;
727 727
     }
728 728
     return false;
@@ -737,10 +737,10 @@  discard block
 block discarded – undo
737 737
 {
738 738
     global $SettingsStored, $_configuration;
739 739
 
740
-    require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
740
+    require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
741 741
     $search_enabled = api_get_setting('search_enabled');
742 742
 
743
-    $form = new FormValidator('search-options', 'post', api_get_self() . '?category=Search');
743
+    $form = new FormValidator('search-options', 'post', api_get_self().'?category=Search');
744 744
     $values = api_get_settings_options('search_enabled');
745 745
     $form->addElement('header', null, get_lang('SearchEnabledTitle'));
746 746
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
     echo '</div>';
809 809
 
810 810
     if ($search_enabled == 'true') {
811
-        $xapian_path = api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb';
811
+        $xapian_path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb';
812 812
 
813 813
         /*
814 814
         @todo Test the Xapian connection
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
         }
858 858
 
859 859
         $data[] = array(get_lang('XapianModuleInstalled'), $xapian_loaded);
860
-        $data[] = array(get_lang('DirectoryExists') . ' - ' . $xapian_path, $dir_exists);
861
-        $data[] = array(get_lang('IsWritable') . ' - ' . $xapian_path, $dir_is_writable);
860
+        $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path, $dir_exists);
861
+        $data[] = array(get_lang('IsWritable').' - '.$xapian_path, $dir_is_writable);
862 862
         $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists);
863 863
 
864 864
         echo Display::tag('h3', get_lang('Settings'));
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 
917 917
     if ($action != 'add') {
918 918
         echo '<div class="actions" style="margin-left: 1px;">';
919
-        echo '<a href="settings.php?category=Templates&action=add">' .
920
-            Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM) . '</a>';
919
+        echo '<a href="settings.php?category=Templates&action=add">'.
920
+            Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
921 921
         echo '</div>';
922 922
     }
923 923
 
@@ -1039,10 +1039,10 @@  discard block
 block discarded – undo
1039 1039
  */
1040 1040
 function actions_filter($id)
1041 1041
 {
1042
-    $return = '<a href="settings.php?category=Templates&action=edit&id=' . Security::remove_XSS($id) . '">' . Display::return_icon('edit.png',
1043
-            get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
1044
-    $return .= '<a href="settings.php?category=Templates&action=delete&id=' . Security::remove_XSS($id) . '" onClick="javascript:if(!confirm(' . "'" . get_lang('ConfirmYourChoice') . "'" . ')) return false;">' . Display::return_icon('delete.png',
1045
-            get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
1042
+    $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png',
1043
+            get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
1044
+    $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png',
1045
+            get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
1046 1046
     return $return;
1047 1047
 }
1048 1048
 
@@ -1059,9 +1059,9 @@  discard block
 block discarded – undo
1059 1059
 function image_filter($image)
1060 1060
 {
1061 1061
     if (!empty($image)) {
1062
-        return '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $image . '" alt="' . get_lang('TemplatePreview') . '"/>';
1062
+        return '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$image.'" alt="'.get_lang('TemplatePreview').'"/>';
1063 1063
     } else {
1064
-        return '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/noimage.gif" alt="' . get_lang('NoTemplatePreview') . '"/>';
1064
+        return '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/noimage.gif" alt="'.get_lang('NoTemplatePreview').'"/>';
1065 1065
     }
1066 1066
 }
1067 1067
 
@@ -1076,9 +1076,9 @@  discard block
 block discarded – undo
1076 1076
 function add_edit_template()
1077 1077
 {
1078 1078
     // Initialize the object.
1079
-    $id = isset($_GET['id']) ? '&id=' . Security::remove_XSS($_GET['id']) : '';
1079
+    $id = isset($_GET['id']) ? '&id='.Security::remove_XSS($_GET['id']) : '';
1080 1080
     $form = new FormValidator('template', 'post',
1081
-        'settings.php?category=Templates&action=' . Security::remove_XSS($_GET['action']) . $id);
1081
+        'settings.php?category=Templates&action='.Security::remove_XSS($_GET['action']).$id);
1082 1082
 
1083 1083
     // Setting the form elements: the header.
1084 1084
     if ($_GET['action'] == 'add') {
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
     if ($_GET['action'] == 'edit') {
1106 1106
         // Database table definition.
1107 1107
         $table_system_template = Database:: get_main_table('system_template');
1108
-        $sql = "SELECT * FROM $table_system_template WHERE id = " . intval($_GET['id']) . "";
1108
+        $sql = "SELECT * FROM $table_system_template WHERE id = ".intval($_GET['id'])."";
1109 1109
         $result = Database::query($sql);
1110 1110
         $row = Database::fetch_array($result);
1111 1111
 
@@ -1120,10 +1120,10 @@  discard block
 block discarded – undo
1120 1120
         // Adding an extra field: a preview of the image that is currently used.
1121 1121
         if (!empty($row['image'])) {
1122 1122
             $form->addElement('static', 'template_image_preview', '',
1123
-                '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $row['image'] . '" alt="' . get_lang('TemplatePreview') . '"/>');
1123
+                '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$row['image'].'" alt="'.get_lang('TemplatePreview').'"/>');
1124 1124
         } else {
1125 1125
             $form->addElement('static', 'template_image_preview', '',
1126
-                '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/noimage.gif" alt="' . get_lang('NoTemplatePreview') . '"/>');
1126
+                '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/noimage.gif" alt="'.get_lang('NoTemplatePreview').'"/>');
1127 1127
         }
1128 1128
 
1129 1129
         // Setting the information of the template that we are editing.
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
                         $_FILES['template_image']['type']);
1155 1155
 
1156 1156
                     // The upload directory.
1157
-                    $upload_dir = api_get_path(SYS_APP_PATH) . 'home/default_platform_document/template_thumb/';
1157
+                    $upload_dir = api_get_path(SYS_APP_PATH).'home/default_platform_document/template_thumb/';
1158 1158
 
1159 1159
                     // Create the directory if it does not exist.
1160 1160
                     if (!is_dir($upload_dir)) {
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
                     if ($picture_info['width'] > $max_width_for_picture) {
1171 1171
                         $temp->resize($max_width_for_picture);
1172 1172
                     }
1173
-                    $temp->send_image($upload_dir . $new_file_name);
1173
+                    $temp->send_image($upload_dir.$new_file_name);
1174 1174
                 }
1175 1175
             }
1176 1176
 
@@ -1187,15 +1187,15 @@  discard block
 block discarded – undo
1187 1187
 
1188 1188
                 // Display a feedback message.
1189 1189
                 Display::display_confirmation_message(get_lang('TemplateAdded'));
1190
-                echo '<a href="settings.php?category=Templates&action=add">' . Display::return_icon('new_template.png',
1191
-                        get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM) . '</a>';
1190
+                echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png',
1191
+                        get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
1192 1192
             } else {
1193
-                $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>' . Database::escape_string($values['template_text']) . '</body>';
1194
-                $sql = "UPDATE $table_system_template set title = '" . Database::escape_string($values['title']) . "', content = '" . $content_template . "'";
1193
+                $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>';
1194
+                $sql = "UPDATE $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'";
1195 1195
                 if (!empty($new_file_name)) {
1196
-                    $sql .= ", image = '" . Database::escape_string($new_file_name) . "'";
1196
+                    $sql .= ", image = '".Database::escape_string($new_file_name)."'";
1197 1197
                 }
1198
-                $sql .= " WHERE id = " . intval($_GET['id']) . "";
1198
+                $sql .= " WHERE id = ".intval($_GET['id'])."";
1199 1199
                 Database::query($sql);
1200 1200
 
1201 1201
                 // Display a feedback message.
@@ -1226,15 +1226,15 @@  discard block
 block discarded – undo
1226 1226
 {
1227 1227
     // First we remove the image.
1228 1228
     $table_system_template = Database:: get_main_table('system_template');
1229
-    $sql = "SELECT * FROM $table_system_template WHERE id = " . intval($id) . "";
1229
+    $sql = "SELECT * FROM $table_system_template WHERE id = ".intval($id)."";
1230 1230
     $result = Database::query($sql);
1231 1231
     $row = Database::fetch_array($result);
1232 1232
     if (!empty($row['image'])) {
1233
-        @unlink(api_get_path(SYS_APP_PATH) . 'home/default_platform_document/template_thumb/' . $row['image']);
1233
+        @unlink(api_get_path(SYS_APP_PATH).'home/default_platform_document/template_thumb/'.$row['image']);
1234 1234
     }
1235 1235
 
1236 1236
     // Now we remove it from the database.
1237
-    $sql = "DELETE FROM $table_system_template WHERE id = " . intval($id) . "";
1237
+    $sql = "DELETE FROM $table_system_template WHERE id = ".intval($id)."";
1238 1238
     Database::query($sql);
1239 1239
 
1240 1240
     // Display a feedback message.
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
     global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list;
1310 1310
     $table_settings_current = Database:: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
1311 1311
 
1312
-    $form = new FormValidator('settings', 'post', 'settings.php?category=' . Security::remove_XSS($_GET['category']));
1312
+    $form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category']));
1313 1313
 
1314 1314
     $form->addElement('hidden', 'search_field',
1315 1315
         (!empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null));
@@ -1344,23 +1344,23 @@  discard block
 block discarded – undo
1344 1344
                     if ($url_id == 1) {
1345 1345
                         if ($row['access_url_changeable'] == '1') {
1346 1346
                             $form->addElement('html',
1347
-                                '<div style="float: right;"><a class="share_this_setting" data_status = "0"  data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' .
1347
+                                '<div style="float: right;"><a class="share_this_setting" data_status = "0"  data_to_send = "'.$row['variable'].'" href="javascript:void(0);">'.
1348 1348
                                 Display::return_icon('shared_setting.png',
1349
-                                    get_lang('ChangeSharedSetting')) . '</a></div>');
1349
+                                    get_lang('ChangeSharedSetting')).'</a></div>');
1350 1350
                         } else {
1351 1351
                             $form->addElement('html',
1352
-                                '<div style="float: right;"><a class="share_this_setting" data_status = "1" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' .
1352
+                                '<div style="float: right;"><a class="share_this_setting" data_status = "1" data_to_send = "'.$row['variable'].'" href="javascript:void(0);">'.
1353 1353
                                 Display::return_icon('shared_setting_na.png',
1354
-                                    get_lang('ChangeSharedSetting')) . '</a></div>');
1354
+                                    get_lang('ChangeSharedSetting')).'</a></div>');
1355 1355
                         }
1356 1356
                     } else {
1357 1357
                         if ($row['access_url_changeable'] == '1') {
1358
-                            $form->addElement('html', '<div style="float: right;">' .
1359
-                                Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</div>');
1358
+                            $form->addElement('html', '<div style="float: right;">'.
1359
+                                Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')).'</div>');
1360 1360
                         } else {
1361
-                            $form->addElement('html', '<div style="float: right;">' .
1361
+                            $form->addElement('html', '<div style="float: right;">'.
1362 1362
                                 Display::return_icon('shared_setting_na.png',
1363
-                                    get_lang('ChangeSharedSetting')) . '</div>');
1363
+                                    get_lang('ChangeSharedSetting')).'</div>');
1364 1364
                         }
1365 1365
                     }
1366 1366
                 }
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
                 break;
1446 1446
             case 'textarea':
1447 1447
                 if ($row['variable'] == 'header_extra_content') {
1448
-                    $file = api_get_path(SYS_PATH) . api_get_home_path() . 'header_extra_content.txt';
1448
+                    $file = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt';
1449 1449
                     $value = '';
1450 1450
                     if (file_exists($file)) {
1451 1451
                         $value = file_get_contents($file);
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
                         array(get_lang($row['title']), get_lang($row['comment'])), array('rows' => '10'), $hideme);
1455 1455
                     $default_values[$row['variable']] = $value;
1456 1456
                 } elseif ($row['variable'] == 'footer_extra_content') {
1457
-                    $file = api_get_path(SYS_PATH) . api_get_home_path() . 'footer_extra_content.txt';
1457
+                    $file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
1458 1458
                     $value = '';
1459 1459
                     if (file_exists($file)) {
1460 1460
                         $value = file_get_contents($file);
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
             case 'checkbox';
1499 1499
                 // 1. We collect all the options of this variable.
1500 1500
                 $sql = "SELECT * FROM $table_settings_current
1501
-                        WHERE variable='" . $row['variable'] . "' AND access_url =  1";
1501
+                        WHERE variable='".$row['variable']."' AND access_url =  1";
1502 1502
 
1503 1503
                 $result = Database::query($sql);
1504 1504
                 $group = array();
@@ -1530,9 +1530,9 @@  discard block
 block discarded – undo
1530 1530
                         }
1531 1531
                         $sql = "SELECT selected_value FROM $table_settings_current
1532 1532
                                 WHERE
1533
-                                    variable='" . $rowkeys['variable'] . "' AND
1534
-                                    subkey='" . $rowkeys['subkey'] . "' AND
1535
-                                    subkeytext='" . $rowkeys['subkeytext'] . "' AND
1533
+                                    variable='".$rowkeys['variable']."' AND
1534
+                                    subkey='" . $rowkeys['subkey']."' AND
1535
+                                    subkeytext='" . $rowkeys['subkeytext']."' AND
1536 1536
                                     access_url =  $access_url";
1537 1537
                         $result_access = Database::query($sql);
1538 1538
                         $row_access = Database::fetch_array($result_access);
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
                 break;
1559 1559
             case 'link':
1560 1560
                 $form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])),
1561
-                    get_lang('CurrentValue') . ' : ' . $row['selected_value'], $hideme);
1561
+                    get_lang('CurrentValue').' : '.$row['selected_value'], $hideme);
1562 1562
                 break;
1563 1563
             case 'select':
1564 1564
                 /*
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
                 * The functions being called must be added to the file settings.lib.php.
1567 1567
                 */
1568 1568
                 $form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])),
1569
-                    call_user_func('select_' . $row['variable']), $hideme);
1569
+                    call_user_func('select_'.$row['variable']), $hideme);
1570 1570
                 $default_values[$row['variable']] = $row['selected_value'];
1571 1571
                 break;
1572 1572
             case 'custom':
@@ -1578,16 +1578,16 @@  discard block
 block discarded – undo
1578 1578
                 $url = PDF::get_watermark(null);
1579 1579
 
1580 1580
                 if ($url != false) {
1581
-                    $delete_url = '<a href="?delete_watermark">' . get_lang('DelImage') . ' ' . Display::return_icon('delete.png',
1582
-                            get_lang('DelImage')) . '</a>';
1581
+                    $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png',
1582
+                            get_lang('DelImage')).'</a>';
1583 1583
                     $form->addElement('html',
1584
-                        '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="' . $url . '" style="margin-bottom:10px;" />' . $delete_url . '</div>');
1584
+                        '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="'.$url.'" style="margin-bottom:10px;" />'.$delete_url.'</div>');
1585 1585
                 }
1586 1586
 
1587 1587
                 $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
1588 1588
                 $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif');
1589 1589
                 $form->addRule('pdf_export_watermark_path',
1590
-                    get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype',
1590
+                    get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype',
1591 1591
                     $allowed_picture_types);
1592 1592
 
1593 1593
                 break;
Please login to merge, or discard this patch.