summaryrefslogtreecommitdiff
path: root/modules/system/system.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system/system.module')
-rw-r--r--modules/system/system.module32
1 files changed, 31 insertions, 1 deletions
diff --git a/modules/system/system.module b/modules/system/system.module
index bbe918570..e5dbb0554 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -588,6 +588,7 @@ function system_site_settings($module = NULL) {
*/
function system_theme_settings() {
system_settings_save();
+
// Default settings are defined in _theme_settings() in includes/theme.inc
$key = str_replace('.', '/', arg(3));
if ($key) {
@@ -601,13 +602,39 @@ function system_theme_settings() {
$var = 'theme_settings';
}
+ // Check for a new uploaded logo, and use that instead.
+ if ($file = file_check_upload('logo_upload')) {
+ if (in_array($file->filemime, array('image/jpeg', 'image/gif', 'image/png'))) {
+ $parts = pathinfo($file->filename);
+ $filename = ($key) ? str_replace('/', '_', $key) . '_logo.' . $parts['extension'] : 'logo.' . $parts['extension'];
+
+ if ($file = file_save_upload('logo_upload', $filename, 1)) {
+ $settings['default_logo'] = 0;
+ $settings['logo_path'] = $file->filepath;
+
+ // Update the variable table with the new settings so that they take effect immediately.
+ variable_set($var, $settings);
+ }
+ }
+ else {
+ form_set_error('file_upload', t('Only JPEG, PNG and GIF images are allowed to be used as logos.'));
+ }
+ }
+
+
$form = '';
// Logo settings
if ((!$key) || in_array('logo', $features)) {
$group = form_checkbox(t('Use the default logo'), "$var][default_logo", 1, $settings['default_logo'], t('Check here if you want the theme to use the logo supplied with it.'));
$group .= form_textfield(t('Path to custom logo'), "$var][logo_path", $settings['logo_path'], 50, 60, t('The path to the file you would like to use as your logo file instead of the default logo.'));
+
+ file_check_directory(variable_get('file_directory_path', 'files'), FILE_CREATE_DIRECTORY, 'file_directory_path');
+ $group .= form_file(t('Upload logo image'), 'logo_upload', 40, t("If you don't have direct file access to the server, use this field to upload your logo."));
+ $group .= form_button(t('Upload'), 'fileop');
+
$form = form_group(t('Logo image settings'), $group);
+
}
// System wide only settings.
@@ -659,8 +686,11 @@ function system_theme_settings() {
}
}
}
+ $form .= form_submit(t('Save configuration'));
+ $form .= form_submit(t('Reset to defaults'));
+
+ print theme('page', form($form, 'post', null, array('enctype' => 'multipart/form-data')));
- print theme('page', system_settings_form($form));
}
?>