Passed
Push — 1.10.x ( 9f6bf5...aae6b1 )
by Yannick
258:39 queued 206:40
created
main/admin/settings.lib.php 1 patch
Spacing   +37 added lines, -37 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'));
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             if (!empty($areas_to_installed)) {
544 544
                 $plugin_obj->remove_all_regions($plugin);
545 545
                 foreach ($areas_to_installed as $region) {
546
-                    if (!empty($region) && $region != '-1' ) {
546
+                    if (!empty($region) && $region != '-1') {
547 547
                         $plugin_obj->add_to_region($plugin, $region);
548 548
                     }
549 549
                 }
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
     $values = api_get_settings_options('search_enabled');
636 636
     $form->addElement('header', null, get_lang('SearchEnabledTitle'));
637 637
 
638
-    $group = array ();
638
+    $group = array();
639 639
     if (is_array($values)) {
640 640
         foreach ($values as $key => $value) {
641 641
             $element = & $form->createElement('radio', 'search_enabled', '', get_lang($value['display_text']), $value['value']);
@@ -661,12 +661,12 @@  discard block
 block discarded – undo
661 661
 
662 662
     if ($search_enabled == 'true') {
663 663
         $values = api_get_settings_options('search_show_unlinked_results');
664
-        $group = array ();
664
+        $group = array();
665 665
         foreach ($values as $key => $value) {
666 666
             $element = & $form->createElement('radio', 'search_show_unlinked_results', '', get_lang($value['display_text']), $value['value']);
667 667
             $group[] = $element;
668 668
         }
669
-        $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'),get_lang('SearchShowUnlinkedResultsComment')), '', false);
669
+        $form->addGroup($group, 'search_show_unlinked_results', array(get_lang('SearchShowUnlinkedResultsTitle'), get_lang('SearchShowUnlinkedResultsComment')), '', false);
670 670
         $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results');
671 671
 
672 672
         $sf_values = array();
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
             $sf_values[$sf['code']] = $sf['name'];
675 675
         }
676 676
         $group = array();
677
-        $url =  Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment'));
677
+        $url = Display::div(Display::url(get_lang('AddSpecificSearchField'), 'specific_fields.php'), array('class'=>'sectioncomment'));
678 678
         if (empty($sf_values)) {
679 679
             $form->addElement('html', get_lang('SearchPrefilterPrefix').$url);
680 680
         } else {
@@ -741,10 +741,10 @@  discard block
 block discarded – undo
741 741
             $dir_is_writable = Display::return_icon('bullet_red.png', get_lang('Error'));
742 742
         }
743 743
 
744
-        $data[] = array(get_lang('XapianModuleInstalled'),$xapian_loaded);
745
-        $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path,$dir_exists);
746
-        $data[] = array(get_lang('IsWritable').' - '.$xapian_path,$dir_is_writable);
747
-        $data[] = array(get_lang('SpecificSearchFieldsAvailable') ,$specific_fields_exists);
744
+        $data[] = array(get_lang('XapianModuleInstalled'), $xapian_loaded);
745
+        $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path, $dir_exists);
746
+        $data[] = array(get_lang('IsWritable').' - '.$xapian_path, $dir_is_writable);
747
+        $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists);
748 748
 
749 749
         echo Display::tag('h3', get_lang('Settings'));
750 750
         $table = new SortableTableFromArray($data);
@@ -754,16 +754,16 @@  discard block
 block discarded – undo
754 754
 
755 755
         //@todo windows support
756 756
         if (api_is_windows_os() == false) {
757
-            $list_of_programs = array('pdftotext','ps2pdf', 'catdoc','html2text','unrtf', 'catppt', 'xls2csv');
757
+            $list_of_programs = array('pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv');
758 758
 
759
-            foreach($list_of_programs as $program) {
759
+            foreach ($list_of_programs as $program) {
760 760
                 $output = $ret_val = null;
761 761
                 exec("which $program", $output, $ret_val);
762 762
                 $icon = Display::return_icon('bullet_red.png', get_lang('NotInstalled'));
763 763
                 if (!empty($output[0])) {
764 764
                     $icon = Display::return_icon('bullet_green.png', get_lang('Installed'));
765 765
                 }
766
-                $data2[]= array($program, $output[0], $icon);
766
+                $data2[] = array($program, $output[0], $icon);
767 767
             }
768 768
             echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles'));
769 769
             $table = new SortableTableFromArray($data2);
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
     if ($action != 'add') {
796 796
         echo '<div class="actions" style="margin-left: 1px;">';
797 797
         echo '<a href="settings.php?category=Templates&action=add">'.
798
-                Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>';
798
+                Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
799 799
         echo '</div>';
800 800
     }
801 801
 
@@ -914,8 +914,8 @@  discard block
 block discarded – undo
914 914
  * @since Dokeos 1.8.6
915 915
  */
916 916
 function actions_filter($id) {
917
-    $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>';
918
-    $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>';
917
+    $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>';
918
+    $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>';
919 919
     return $return;
920 920
 }
921 921
 
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
     $form->addElement('html_editor', 'template_text', get_lang('Text'), null, array('ToolbarSet' => 'AdminTemplates', 'Width' => '100%', 'Height' => '400'));
966 966
 
967 967
     // Setting the form elements: the form to upload an image to be used with the template.
968
-    $form->addElement('file','template_image',get_lang('Image'),'');
968
+    $form->addElement('file', 'template_image', get_lang('Image'), '');
969 969
 
970 970
     // Setting the form elements: a little bit information about the template image.
971 971
     $form->addElement('static', 'file_comment', '', get_lang('TemplateImageComment100x70'));
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
             // Store the information in the database (as insert or as update).
1044 1044
             $table_system_template = Database :: get_main_table('system_template');
1045 1045
             if ($_GET['action'] == 'add') {
1046
-                $content_template =  Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY);
1046
+                $content_template = Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY);
1047 1047
                 $params = [
1048 1048
                     'title' =>  $values['title'],
1049 1049
                     'content' => $content_template,
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 
1054 1054
                 // Display a feedback message.
1055 1055
                 Display::display_confirmation_message(get_lang('TemplateAdded'));
1056
-                echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'),'',ICON_SIZE_MEDIUM).'</a>';
1056
+                echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>';
1057 1057
             } else {
1058 1058
                 $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>';
1059 1059
                 $sql = "UPDATE $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'";
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
         display_templates();
1072 1072
     } else {
1073 1073
         $token = Security::get_token();
1074
-        $form->addElement('hidden','sec_token');
1074
+        $form->addElement('hidden', 'sec_token');
1075 1075
         $form->setConstants(array('sec_token' => $token));
1076 1076
         // Display the form.
1077 1077
         $form->display();
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 
1172 1172
     $form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category']));
1173 1173
 
1174
-    $form->addElement('hidden', 'search_field', (!empty($_GET['search_field'])?Security::remove_XSS($_GET['search_field']):null));
1174
+    $form->addElement('hidden', 'search_field', (!empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null));
1175 1175
 
1176 1176
     $url_id = api_get_current_access_url_id();
1177 1177
 
@@ -1238,9 +1238,9 @@  discard block
 block discarded – undo
1238 1238
                 if (empty($row['category']))
1239 1239
                     $row['category'] = 0;
1240 1240
 
1241
-                if (is_array($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ])) {
1241
+                if (is_array($settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']])) {
1242 1242
                     // We are sure that the other site have a selected value.
1243
-                    if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '')
1243
+                    if ($settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value'] != '')
1244 1244
                         $row['selected_value'] = $settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value'];
1245 1245
                 }
1246 1246
                 // There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site.
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
                         array('maxlength' => '8')
1262 1262
                     );
1263 1263
                     $form->applyFilter($row['variable'], 'html_filter');
1264
-                    $default_values[$row['variable']] = round($row['selected_value']/1024/1024, 1);
1264
+                    $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
1265 1265
                 } elseif ($row['variable'] == 'account_valid_duration') {
1266 1266
                     $form->addElement(
1267 1267
                         'text',
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
                         ),
1290 1290
                         $hideme
1291 1291
                     );
1292
-                    $form->applyFilter($row['variable'],'html_filter');
1292
+                    $form->applyFilter($row['variable'], 'html_filter');
1293 1293
                     $default_values[$row['variable']] = $row['selected_value'];
1294 1294
                 }
1295 1295
                 break;
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
                     if (file_exists($file)) {
1301 1301
                         $value = file_get_contents($file);
1302 1302
                     }
1303
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1303
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1304 1304
                     $default_values[$row['variable']] = $value;
1305 1305
                 } elseif ($row['variable'] == 'footer_extra_content') {
1306 1306
                     $file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
@@ -1308,16 +1308,16 @@  discard block
 block discarded – undo
1308 1308
                     if (file_exists($file)) {
1309 1309
                         $value = file_get_contents($file);
1310 1310
                     }
1311
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1311
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1312 1312
                     $default_values[$row['variable']] = $value;
1313 1313
                 } else {
1314
-                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])) , array('rows'=>'10'), $hideme);
1314
+                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows'=>'10'), $hideme);
1315 1315
                     $default_values[$row['variable']] = $row['selected_value'];
1316 1316
                 }
1317 1317
                 break;
1318 1318
             case 'radio':
1319 1319
                 $values = api_get_settings_options($row['variable']);
1320
-                $group = array ();
1320
+                $group = array();
1321 1321
                 if (is_array($values)) {
1322 1322
                     foreach ($values as $key => $value) {
1323 1323
                         $element = &$form->createElement(
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
                         WHERE variable='".$row['variable']."' AND access_url =  1";
1349 1349
 
1350 1350
                 $result = Database::query($sql);
1351
-                $group = array ();
1351
+                $group = array();
1352 1352
                 while ($rowkeys = Database::fetch_array($result)) {
1353 1353
                     // Profile tab option should be hidden when the social tool is enabled.
1354 1354
                     if (api_get_setting('allow_social_tool') == 'true') {
@@ -1420,10 +1420,10 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
         switch ($row['variable']) {
1422 1422
             case 'pdf_export_watermark_enable':
1423
-                $url =  PDF::get_watermark(null);
1423
+                $url = PDF::get_watermark(null);
1424 1424
 
1425 1425
                 if ($url != false) {
1426
-                    $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png',get_lang('DelImage')).'</a>';
1426
+                    $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png', get_lang('DelImage')).'</a>';
1427 1427
                     $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>');
1428 1428
                 }
1429 1429
 
Please login to merge, or discard this patch.