mirror of
https://github.com/ZeJMaN/LBCAlerte_ynh.git
synced 2025-06-07 21:15:29 +02:00
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
if (!$userAuthed->getApiKey()) {
|
|
$userAuthed->setApiKey(
|
|
sha1(
|
|
str_repeat(
|
|
uniqid($_SERVER["HTTP_HOST"], true),
|
|
rand(10, 100)
|
|
)
|
|
)
|
|
);
|
|
$userStorage->save($userAuthed);
|
|
}
|
|
|
|
$params = array(
|
|
"notification" => $userAuthed->getOption("notification"),
|
|
"unique_ads" => $userAuthed->getOption("unique_ads", false),
|
|
"api_key" => $userAuthed->getApiKey(),
|
|
"addresses_mails" => $userAuthed->getOption("addresses_mails"),
|
|
);
|
|
|
|
require DOCUMENT_ROOT."/app/data/notifications.php";
|
|
|
|
$form_values = array(
|
|
"api_key" => $params["api_key"],
|
|
"unique_ads" => $params["unique_ads"],
|
|
"addresses_mails" => $params["addresses_mails"],
|
|
);
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$form_values = array_intersect_key($_POST, $form_values);
|
|
|
|
if (!empty($_POST["regenerate-apikey"])) {
|
|
$userAuthed->setApiKey(
|
|
sha1(
|
|
str_repeat(
|
|
uniqid($_SERVER["HTTP_HOST"], true),
|
|
rand(10, 100)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
$userAuthed->mergeOptions($form_values);
|
|
$userStorage->save($userAuthed);
|
|
$_SESSION["userSettingsSaved"] = true;
|
|
header("LOCATION: ./?mod=user&a=settings"); exit;
|
|
}
|
|
|
|
$userSettingsSaved = isset($_SESSION["userSettingsSaved"]) && true === $_SESSION["userSettingsSaved"];
|
|
unset($_SESSION["userSettingsSaved"]);
|