diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index 3f151df14e..7b3b7b2785 100644 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -1056,9 +1056,9 @@ function update_gradebook_score_display_custom_values($values) { $scoredisplay->update_custom_score_display_settings($final); } -function generate_settings_form($settings, $settings_by_access_list) { - $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); +function generate_settings_form($settings, $settings_by_access_list) { global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list; + $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); $form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category'])); @@ -1076,7 +1076,7 @@ function generate_settings_form($settings, $settings_by_access_list) { $default_values = array(); $i = 0; - foreach ($settings as $row) { + foreach ($settings as $row) { if (in_array($row['variable'], array_keys($settings_to_avoid))) { continue; } if ( $_configuration['multiple_access_urls']) { @@ -1265,15 +1265,18 @@ function generate_settings_form($settings, $settings_by_access_list) { } switch ($row['variable']) { - case 'pdf_export_watermark_enable': - $url = PDF::get_watermark($course_code); + case 'pdf_export_watermark_enable': + $url = PDF::get_watermark(null); $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark')); + if ($url != false) { $delete_url = ''.Display::return_icon('delete.png',get_lang('DelImage')).''; $form->addElement('html', ''.$url.' '.$delete_url.''); } + $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); - $form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); + $form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); + break; case 'timezone_value': $timezone = $row['selected_value']; diff --git a/main/admin/settings.php b/main/admin/settings.php index 5c5187c808..3a69931250 100644 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -58,7 +58,6 @@ if (isset($_POST['style'])) { Display::$preview_style = $_POST['style']; } - // Database table definitions. $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); @@ -131,6 +130,7 @@ function get_settings($category = null) { return $settings; } + // Build the form. if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))) { $my_category = isset($_GET['category']) ? $_GET['category'] : null; @@ -507,4 +507,4 @@ if (!empty($_GET['category'])) { } /* FOOTER */ -Display :: display_footer(); +Display :: display_footer(); \ No newline at end of file diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index d4ad8a276c..05f464e3b2 100644 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -1464,6 +1464,7 @@ class Display { } public static function actions($items) { + $html = null; if (!empty($items)) { $html = '