mirror of https://github.com/itflow-org/itflow
56 lines
2.0 KiB
PHP
56 lines
2.0 KiB
PHP
<?php
|
|
|
|
if (isset($_POST['edit_theme_settings'])) {
|
|
|
|
validateCSRFToken($_POST['csrf_token']);
|
|
|
|
$theme = preg_replace("/[^0-9a-zA-Z-]/", "", sanitizeInput($_POST['theme']));
|
|
|
|
mysqli_query($mysqli,"UPDATE settings SET config_theme = '$theme' WHERE company_id = 1");
|
|
|
|
//Logging
|
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified theme settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
|
|
|
$_SESSION['alert_message'] = "Changed theme to <strong>$theme</strong>";
|
|
|
|
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
|
}
|
|
|
|
if (isset($_POST['edit_favicon_settings'])) {
|
|
|
|
validateCSRFToken($_POST['csrf_token']);
|
|
|
|
// Check to see if a file is attached
|
|
if ($_FILES['file']['tmp_name'] != '') {
|
|
if ($new_file_name = checkFileUpload($_FILES['file'], array('ico'))) {
|
|
$file_tmp_path = $_FILES['file']['tmp_name'];
|
|
|
|
// Delete old file
|
|
if(file_exists("uploads/favicon.ico")) {
|
|
unlink("uploads/favicon.ico");
|
|
}
|
|
|
|
// directory in which the uploaded file will be moved
|
|
$upload_file_dir = "uploads/";
|
|
//Force File Name
|
|
$new_file_name = "favicon.ico";
|
|
$dest_path = $upload_file_dir . $new_file_name;
|
|
|
|
move_uploaded_file($file_tmp_path, $dest_path);
|
|
|
|
$_SESSION['alert_message'] = 'File successfully uploaded.';
|
|
}else{
|
|
|
|
$_SESSION['alert_message'] = 'There was an error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
|
|
}
|
|
}
|
|
|
|
//Logging
|
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name updated the favicon', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
|
|
|
$_SESSION['alert_message'] = "You updated the favicon";
|
|
|
|
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
|
|
|
}
|