Login background can be uploaded
This commit is contained in:
parent
65c7c15c74
commit
e48022b533
@ -531,7 +531,7 @@ $modsForHesk_settings = mfh_getSettings();
|
||||
onclick="javascript:alert('<?php echo hesk_makeJsString($hesklang['settings_intro']) . '\n\n' . hesk_makeJsString($hesklang['all_req']); ?>')"><i
|
||||
class="fa fa-question-circle settingsquestionmark"></i></a>
|
||||
</h2>
|
||||
<form method="post" action="admin_settings_save.php" name="form1" onsubmit="return hesk_checkFields()"
|
||||
<form method="post" enctype="multipart/form-data" action="admin_settings_save.php" name="form1" onsubmit="return hesk_checkFields()"
|
||||
class="form-horizontal" role="form">
|
||||
|
||||
<!-- General Settings -->
|
||||
@ -3815,7 +3815,7 @@ $modsForHesk_settings = mfh_getSettings();
|
||||
<input title="LOGIN BACKGROUND COLOR" type="file" name="login-background-image" style="display: inline;vertical-align: bottom" <?php if ($modsForHesk_settings['login_background_type'] == 'color') { echo 'disabled'; } ?>>
|
||||
<?php if ($modsForHesk_settings['login_background_type'] == 'image'): ?>
|
||||
<br>
|
||||
<img src="<?php echo $modsForHesk_settings['login_background']; ?>" alt="Login Background" height="125" width="125" class="push-down-10">
|
||||
<img src="../<?php echo $hesk_settings['cache_dir']; ?>/login-background/<?php echo $modsForHesk_settings['login_background']; ?>" alt="Login Background" height="125" width="125" class="push-down-10">
|
||||
<?php endif; ?>
|
||||
<script type="text/javascript">
|
||||
$('input[name="login-background-color"]').colorpicker({
|
||||
|
@ -501,16 +501,25 @@ $set['login_background_type'] = hesk_input(hesk_POST('login-background'));
|
||||
if ($set['login_background_type'] == 'color') {
|
||||
unlink($hesk_settings['cache_dir'] . '/' . $set['login_background']);
|
||||
$set['login_background'] = hesk_input(hesk_POST('login-background-color'));
|
||||
if ($set['login_background'] == '') {
|
||||
$set['login_background'] = '#d2d6de';
|
||||
}
|
||||
} else {
|
||||
$file_name = hesk_cleanFileName($_FILES['login-attachment-image']['name']);
|
||||
include(HESK_PATH . 'inc/attachments.inc.php');
|
||||
include(HESK_PATH . 'inc/posting_functions.inc.php');
|
||||
|
||||
$file_name = hesk_cleanFileName($_FILES['login-background-image']['name']);
|
||||
|
||||
|
||||
if (!empty($file_name)) {
|
||||
$file_size = $_FILES['login-attachment-image']['size'];
|
||||
$file_size = $_FILES['login-background-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']);
|
||||
if (file_exists($hesk_settings['cache_dir'] . '/login-background/' . $set['login_background'])) {
|
||||
unlink($hesk_settings['cache_dir'] . '/login-background/' . $set['login_background']);
|
||||
}
|
||||
|
||||
$useChars = 'AEUYBDGHJLMNPQRSTVWXZ123456789';
|
||||
$tmp = uniqid();
|
||||
@ -518,8 +527,10 @@ if ($set['login_background_type'] == 'color') {
|
||||
$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)) {
|
||||
$file_to_move = $_FILES['login-background-image']['tmp_name'];
|
||||
|
||||
|
||||
if (!move_uploaded_file($file_to_move, dirname(dirname(__FILE__)) . '/' . $hesk_settings['cache_dir'] . '/login-background/' . $file_name)) {
|
||||
hesk_error($hesklang['cannot_move_tmp']);
|
||||
}
|
||||
|
||||
@ -564,6 +575,7 @@ mfh_updateSetting('first_day_of_week', $set['first_day_of_week'], false);
|
||||
mfh_updateSetting('default_calendar_view', $set['default_view'], true);
|
||||
mfh_updateSetting('admin_color_scheme', $set['admin_color_scheme'], true);
|
||||
mfh_updateSetting('login_background', $set['login_background'], true);
|
||||
mfh_updateSetting('login_background_type', $set['login_background_type'], true);
|
||||
|
||||
// Prepare settings file and save it
|
||||
$settings_file_content = '<?php
|
||||
|
Loading…
x
Reference in New Issue
Block a user