Browse Source

more work on login background

tags/3.1.0
Mike Koch 2 years ago
parent
commit
65c7c15c74
1 changed files with 15 additions and 4 deletions
  1. 15
    4
      admin/admin_settings_save.php

+ 15
- 4
admin/admin_settings_save.php View File

@@ -502,19 +502,30 @@ if ($set['login_background_type'] == 'color') {
unlink($hesk_settings['cache_dir'] . '/' . $set['login_background']);
$set['login_background'] = hesk_input(hesk_POST('login-background-color'));
} else {
$file_name = $_FILES['login-attachment-image']['name'];
$file_name = hesk_cleanFileName($_FILES['login-attachment-image']['name']);

if (!empty($file_name)) {
unlink($hesk_settings['cache_dir'] . '/' . $set['login_background']);

$file_size = $_FILES['login-attachment-image']['size'];
if ($file_size > $hesk_settings['attachments']['max_size']) {
return hesk_fileError(sprintf($hesklang['file_too_large'], $file_name));
}

unlink($hesk_settings['cache_dir'] . '/login-background/' . $set['login_background']);

$useChars = 'AEUYBDGHJLMNPQRSTVWXZ123456789';
$tmp = uniqid();
for ($j = 1; $j < 10; $j++) {
$tmp .= $useChars{mt_rand(0, 29)};
}

$file_to_move = $_FILES['login-attachment-image']['tmp_name'];
if (!move_uploaded_file($file_to_move, __DIR__ . '/../' . $hesk_settings['cache_dir'] . '/login-background/' . $file_name)) {
hesk_error($hesklang['cannot_move_tmp']);
}

$set['login_background'] = $file_name;
}
}
$set['login_background'] = hesk_input(hesk_POST('login-background'));
mfh_updateSetting('rtl', $set['rtl']);
mfh_updateSetting('show_icons', $set['show-icons']);
mfh_updateSetting('custom_field_setting', $set['custom-field-setting']);

Loading…
Cancel
Save