Passed
Pull Request — 1.10.x (#1054)
by
unknown
574:36 queued 520:16
created
main/admin/settings.lib.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
     //Plugins NOT installed
131 131
     echo Display::page_subheader(get_lang('Plugins'));
132
-    echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token=' . $token . '">';
132
+    echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token='.$token.'">';
133 133
     echo '<table class="data_table">';
134 134
     echo '<tr>';
135 135
     echo '<th width="20px">';
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
     $plugin_list = array();
143 143
     $my_plugin_list = $plugin_obj->get_plugin_regions();
144
-    foreach($my_plugin_list as $plugin_item) {
144
+    foreach ($my_plugin_list as $plugin_item) {
145 145
         $plugin_list[$plugin_item] = $plugin_item;
146 146
     }
147 147
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             if (file_exists(api_get_path(SYS_PLUGIN_PATH).$plugin.'/readme.txt')) {
181 181
                 echo Display::url(
182 182
                     "<em class='fa fa-file-text-o'></em> readme.txt",
183
-                    api_get_path(WEB_PLUGIN_PATH) . $plugin . "/readme.txt",
183
+                    api_get_path(WEB_PLUGIN_PATH).$plugin."/readme.txt",
184 184
                     [
185 185
                         'class' => 'btn btn-default ajax',
186 186
                         'data-title' => $plugin_info['title'],
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                     $show_name = ucwords(str_replace('_', ' ', $style_dir));
323 323
 
324 324
                     if ($is_style_changeable) {
325
-                        $list_of_names[$style_dir]  = $show_name;
325
+                        $list_of_names[$style_dir] = $show_name;
326 326
                     }
327 327
                     $counter++;
328 328
                 }
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
             if (is_dir($dir)) {
354 354
                 $zip = new PclZip($arch);
355 355
                 // Remove path prefix except the style name and put file on disk
356
-                $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir,0,-strlen($safe_style_dir)));
356
+                $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($safe_style_dir)));
357 357
                 //@TODO: use more generic script to download.
358
-                $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), '', $arch) . '">'.get_lang('ClickHereToDownloadTheFile').'</a>';
358
+                $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), '', $arch).'">'.get_lang('ClickHereToDownloadTheFile').'</a>';
359 359
                 Display::display_normal_message($str, false);
360 360
             } else {
361 361
                 Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning'));
@@ -369,11 +369,11 @@  discard block
 block discarded – undo
369 369
         'settings.php?category=Stylesheets#tabs-2'
370 370
     );
371 371
     
372
-    $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/' . $selected . '/images/';
373
-    $url = api_get_path(WEB_CSS_PATH).'themes/' . $selected . '/images/';
372
+    $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/'.$selected.'/images/';
373
+    $url = api_get_path(WEB_CSS_PATH).'themes/'.$selected.'/images/';
374 374
     $newLogoFileName = 'header-logo.png';
375 375
     
376
-    $logoForm->addLabel(get_lang('CurrentLogo'), '<img src="'. $url . 'header-logo.png?' . time() . '">');
376
+    $logoForm->addLabel(get_lang('CurrentLogo'), '<img src="'.$url.'header-logo.png?'.time().'">');
377 377
     $logoForm->addFile('new_logo', get_lang('UpdateLogo'));
378 378
     $allowedFileTypes = ['png'];
379 379
     
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             $imageInfo = getimagesize($_FILES['new_logo']['tmp_name']);
394 394
             $width = $imageInfo[0];
395 395
             $height = $imageInfo[1];
396
-            if ($width <= 250 && $height <= 70 ) {
396
+            if ($width <= 250 && $height <= 70) {
397 397
                 if (!is_file($dir.'header-logo-org.png')) {
398 398
                     rename($dir.$newLogoFileName, $dir.'header-logo-org.png');
399 399
                 }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
             });
435 435
             </script>';
436 436
             echo Display::tabs(
437
-                array(get_lang('Update'),get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')),
437
+                array(get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')),
438 438
                 array($form_change->return_form(), $logoForm->return_form(), $form->return_form())
439 439
             );
440 440
         } else {
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
             if (!empty($areas_to_installed)) {
599 599
                 $plugin_obj->remove_all_regions($plugin);
600 600
                 foreach ($areas_to_installed as $region) {
601
-                    if (!empty($region) && $region != '-1' ) {
601
+                    if (!empty($region) && $region != '-1') {
602 602
                         $plugin_obj->add_to_region($plugin, $region);
603 603
                     }
604 604
                 }
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
     $values = api_get_settings_options('search_enabled');
691 691
     $form->addElement('header', null, get_lang('SearchEnabledTitle'));
692 692
 
693
-    $group = array ();
693
+    $group = array();
694 694
     if (is_array($values)) {
695 695
         foreach ($values as $key => $value) {
696 696
             $element = & $form->createElement('radio', 'search_enabled', '', get_lang($value['display_text']), $value['value']);
@@ -716,12 +716,12 @@  discard block
 block discarded – undo
716 716
 
717 717
     if ($search_enabled == 'true') {
718 718
         $values = api_get_settings_options('search_show_unlinked_results');
719
-        $group = array ();
719
+        $group = array();
720 720
         foreach ($values as $key => $value) {
721 721
             $element = & $form->createElement('radio', 'search_show_unlinked_results', '', get_lang($value['display_text']), $value['value']);
722 722
             $group[] = $element;
723 723
         }
724
-        $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'),get_lang('SearchShowUnlinkedResultsComment')), '', false);
724
+        $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'), get_lang('SearchShowUnlinkedResultsComment')), '', false);
725 725
         $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results');
726 726
 
727 727
         $sf_values = array();
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
             $sf_values[$sf['code']] = $sf['name'];
730 730
         }
731 731
         $group = array();
732
-        $url =  Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment'));
732
+        $url = Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment'));
733 733
         if (empty($sf_values)) {
734 734
             $form->addElement('html', get_lang('SearchPrefilterPrefix').$url);
735 735
         } else {
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
             $dir_is_writable = Display::return_icon('bullet_red.png', get_lang('Error'));
797 797
         }
798 798
 
799
-        $data[] = array(get_lang('XapianModuleInstalled'),$xapian_loaded);
800
-        $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path,$dir_exists);
801
-        $data[] = array(get_lang('IsWritable').' - '.$xapian_path,$dir_is_writable);
802
-        $data[] = array(get_lang('SpecificSearchFieldsAvailable') ,$specific_fields_exists);
799
+        $data[] = array(get_lang('XapianModuleInstalled'), $xapian_loaded);
800
+        $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path, $dir_exists);
801
+        $data[] = array(get_lang('IsWritable').' - '.$xapian_path, $dir_is_writable);
802
+        $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists);
803 803
 
804 804
         echo Display::tag('h3', get_lang('Settings'));
805 805
         $table = new SortableTableFromArray($data);
@@ -809,16 +809,16 @@  discard block
 block discarded – undo
809 809
 
810 810
         //@todo windows support
811 811
         if (api_is_windows_os() == false) {
812
-            $list_of_programs = array('pdftotext','ps2pdf', 'catdoc','html2text','unrtf', 'catppt', 'xls2csv');
812
+            $list_of_programs = array('pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv');
813 813
 
814
-            foreach($list_of_programs as $program) {
814
+            foreach ($list_of_programs as $program) {
815 815
                 $output = $ret_val = null;
816 816
                 exec("which $program", $output, $ret_val);
817 817
                 $icon = Display::return_icon('bullet_red.png', get_lang('NotInstalled'));
818 818
                 if (!empty($output[0])) {
819 819
                     $icon = Display::return_icon('bullet_green.png', get_lang('Installed'));
820 820
                 }
821
-                $data2[]= array($program, $output[0], $icon);
821
+                $data2[] = array($program, $output[0], $icon);
822 822
             }
823 823
             echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles'));
824 824
             $table = new SortableTableFromArray($data2);
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
     if ($action != 'add') {
851 851
         echo '<div class="actions" style="margin-left: 1px;">';
852 852
         echo '<a href="settings.php?category=Templates&action=add">'.
853
-                Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>';
853
+                Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
854 854
         echo '</div>';
855 855
     }
856 856
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
  * @since Dokeos 1.8.6
970 970
  */
971 971
 function actions_filter($id) {
972
-    $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
973
-    $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', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
972
+    $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
973
+    $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', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
974 974
     return $return;
975 975
 }
976 976
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
     $form->addElement('html_editor', 'template_text', get_lang('Text'), null, array('ToolbarSet' => 'AdminTemplates', 'Width' => '100%', 'Height' => '400'));
1021 1021
 
1022 1022
     // Setting the form elements: the form to upload an image to be used with the template.
1023
-    $form->addElement('file','template_image',get_lang('Image'),'');
1023
+    $form->addElement('file', 'template_image', get_lang('Image'), '');
1024 1024
 
1025 1025
     // Setting the form elements: a little bit information about the template image.
1026 1026
     $form->addElement('static', 'file_comment', '', get_lang('TemplateImageComment100x70'));
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
             // Store the information in the database (as insert or as update).
1099 1099
             $table_system_template = Database :: get_main_table('system_template');
1100 1100
             if ($_GET['action'] == 'add') {
1101
-                $content_template =  Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY);
1101
+                $content_template = Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY);
1102 1102
                 $params = [
1103 1103
                     'title' =>  $values['title'],
1104 1104
                     'content' => $content_template,
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
                 // Display a feedback message.
1110 1110
                 Display::display_confirmation_message(get_lang('TemplateAdded'));
1111
-                echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>';
1111
+                echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
1112 1112
             } else {
1113 1113
                 $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>';
1114 1114
                 $sql = "UPDATE $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'";
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
         display_templates();
1127 1127
     } else {
1128 1128
         $token = Security::get_token();
1129
-        $form->addElement('hidden','sec_token');
1129
+        $form->addElement('hidden', 'sec_token');
1130 1130
         $form->setConstants(array('sec_token' => $token));
1131 1131
         // Display the form.
1132 1132
         $form->display();
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 
1227 1227
     $form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category']));
1228 1228
 
1229
-    $form->addElement('hidden', 'search_field', (!empty($_GET['search_field'])?Security::remove_XSS($_GET['search_field']):null));
1229
+    $form->addElement('hidden', 'search_field', (!empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null));
1230 1230
 
1231 1231
     $url_id = api_get_current_access_url_id();
1232 1232
 
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
                 if (empty($row['category']))
1294 1294
                     $row['category'] = 0;
1295 1295
 
1296
-                if (is_array($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ])) {
1296
+                if (is_array($settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']])) {
1297 1297
                     // We are sure that the other site have a selected value.
1298
-                    if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '')
1298
+                    if ($settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value'] != '')
1299 1299
                         $row['selected_value'] = $settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value'];
1300 1300
                 }
1301 1301
                 // There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site.
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
                         array('maxlength' => '8')
1317 1317
                     );
1318 1318
                     $form->applyFilter($row['variable'], 'html_filter');
1319
-                    $default_values[$row['variable']] = round($row['selected_value']/1024/1024, 1);
1319
+                    $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
1320 1320
                 } elseif ($row['variable'] == 'account_valid_duration') {
1321 1321
                     $form->addElement(
1322 1322
                         'text',
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
                         ),
1345 1345
                         $hideme
1346 1346
                     );
1347
-                    $form->applyFilter($row['variable'],'html_filter');
1347
+                    $form->applyFilter($row['variable'], 'html_filter');
1348 1348
                     $default_values[$row['variable']] = $row['selected_value'];
1349 1349
                 }
1350 1350
                 break;
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
                     if (file_exists($file)) {
1356 1356
                         $value = file_get_contents($file);
1357 1357
                     }
1358
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1358
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1359 1359
                     $default_values[$row['variable']] = $value;
1360 1360
                 } elseif ($row['variable'] == 'footer_extra_content') {
1361 1361
                     $file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
@@ -1363,16 +1363,16 @@  discard block
 block discarded – undo
1363 1363
                     if (file_exists($file)) {
1364 1364
                         $value = file_get_contents($file);
1365 1365
                     }
1366
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1366
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1367 1367
                     $default_values[$row['variable']] = $value;
1368 1368
                 } else {
1369
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1369
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1370 1370
                     $default_values[$row['variable']] = $row['selected_value'];
1371 1371
                 }
1372 1372
                 break;
1373 1373
             case 'radio':
1374 1374
                 $values = api_get_settings_options($row['variable']);
1375
-                $group = array ();
1375
+                $group = array();
1376 1376
                 if (is_array($values)) {
1377 1377
                     foreach ($values as $key => $value) {
1378 1378
                         $element = &$form->createElement(
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
                         WHERE variable='".$row['variable']."' AND access_url =  1";
1404 1404
 
1405 1405
                 $result = Database::query($sql);
1406
-                $group = array ();
1406
+                $group = array();
1407 1407
                 while ($rowkeys = Database::fetch_array($result)) {
1408 1408
                     // Profile tab option should be hidden when the social tool is enabled.
1409 1409
                     if (api_get_setting('allow_social_tool') == 'true') {
@@ -1475,10 +1475,10 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
         switch ($row['variable']) {
1477 1477
             case 'pdf_export_watermark_enable':
1478
-                $url =  PDF::get_watermark(null);
1478
+                $url = PDF::get_watermark(null);
1479 1479
 
1480 1480
                 if ($url != false) {
1481
-                    $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png',get_lang('DelImage')).'</a>';
1481
+                    $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png', get_lang('DelImage')).'</a>';
1482 1482
                     $form->addElement('html', '<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>');
1483 1483
                 }
1484 1484
 
Please login to merge, or discard this patch.