// Copyright (c) 2022 High5! // License Info: LICENSE.TXT // // File: vacation.php // // Template File: users_vacation.tpl // // Template Variables: // // tMessage // tSubject // tBody // // Form POST \ GET Variables: // // fSubject // fBody // require("../session.inc.php"); require("../variables.inc.php"); require("../config.inc.php"); require("../functions.inc.php"); include("../languages/" . check_language() . ".lang"); $USERID_USERNAME = check_user_session(); $USERID_DOMAIN = substr(strrchr($USERID_USERNAME, "@"), 1); if ($_SERVER['REQUEST_METHOD'] == "GET") { $result = db_query("SELECT * FROM vacation WHERE email='$USERID_USERNAME'"); if ($result['rows'] == 1) { $row = db_array($result['result']); $tMessage = $PALANG['pUsersVacation_welcome_text']; $template = "users_vacation-get.tpl"; } else { $template = "users_vacation.tpl"; } include("../templates/header.tpl"); include("../templates/users_menu.tpl"); include("../templates/$template"); include("../templates/footer.tpl"); } if ($_SERVER['REQUEST_METHOD'] == "POST") { if (isset($_POST['fSubject'])) $fSubject = escape_string($_POST['fSubject']); if (isset($_POST['fBody'])) $fBody = escape_string($_POST['fBody']); if (!empty($_POST['fBack'])) { $result = db_query("DELETE FROM vacation WHERE email='$USERID_USERNAME'"); if ($result['rows'] != 1) { $error = 1; $tMessage = $PALANG['pUsersVacation_result_error']; } else { $tMessage = $PALANG['pUsersVacation_result_succes']; } } if (!empty($_POST['fAway'])) { $result = db_query("INSERT INTO vacation (email,subject,body,cache,domain,created,active) VALUES ('$USERID_USERNAME','$fSubject','$fBody','','$USERID_DOMAIN',NOW(),'1')"); if ($result['rows'] != 1) { $error = 1; $tMessage = $PALANG['pUsersVacation_result_error']; } else { header("Location: main.php"); exit; } } include("../templates/header.tpl"); include("../templates/users_menu.tpl"); include("../templates/users_vacation.tpl"); include("../templates/footer.tpl"); } ?>