diff --git a/src/www/system_general.php b/src/www/system_general.php index b9031f483..66f7558f4 100644 --- a/src/www/system_general.php +++ b/src/www/system_general.php @@ -87,7 +87,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $reqdfields = explode(" ", "hostname domain"); $reqdfieldsn = array(gettext("Hostname"),gettext("Domain")); - if (is_uploaded_file($_FILES['pictfile']['tmp_name'])) { + if (!empty($_FILES['pictfile']) && is_uploaded_file($_FILES['pictfile']['tmp_name'])) { if ($_FILES['pictfile']['size'] > (10 * 1024 * 1024)) { $input_errors[] = gettext("The image file is too large. Please upload something smaller than 10MB."); } else { @@ -105,6 +105,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } } + if (!empty($pconfig['picture']) && !empty($pconfig['picture_filename'])) { + $config['system']['picture'] = $pconfig['picture']; + $config['system']['picture_filename'] = $pconfig['picture_filename']; + } elseif (isset($pconfig['del_picture']) && $pconfig['del_picture'] == 'true') { + unset($config['system']['picture']); + unset($config['system']['picture_filename']); + } + if (empty($pconfig['dnsallowoverride_exclude'])) { $pconfig['dnsallowoverride_exclude'] = []; } @@ -182,14 +190,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $config['system']['timezone'] = $pconfig['timezone']; $config['theme'] = $pconfig['theme']; - if (!empty($pconfig['picture']) && !empty($pconfig['picture_filename'])) { - $config['system']['picture'] = $pconfig['picture']; - $config['system']['picture_filename'] = $pconfig['picture_filename']; - } elseif (isset($config['system']['picture'])) { - unset($config['system']['picture']); - unset($config['system']['picture_filename']); - } - if (!empty($pconfig['prefer_ipv4'])) { $config['system']['prefer_ipv4'] = true; } elseif (isset($config['system']['prefer_ipv4'])) { @@ -298,6 +298,7 @@ $( document ).ready(function() { $("#remove_picture").click(function(event){ $("#picture").remove(); + $("#del_picture").val("true"); $('#save').click(); }); }); @@ -410,6 +411,7 @@ $( document ).ready(function() { picture +