public static function getLoginUser() { if (SessionHandlers::isSetSession(User::SESSION_USER)) { return SessionHandlers::getObjSession(User::SESSION_USER); } else { Tool::pageError(User::LOGIN_FAIL); die; } }
public static function Edit() { $log_user = Tool::getLoginUser(); try { $user = new User(); if (isset($_POST["id"]) && !empty($_POST["id"])) { $user->setId($_POST["id"]); } if (isset($_POST["cache"]) && !empty($_POST["cache"])) { $user->setCache($_POST["cache"]); } if (isset($_POST["username"]) && !empty($_POST["username"])) { $user->setUsername($_POST["username"]); } else { Tool::pageError(); } if (isset($_POST["password"]) && !empty($_POST["password"])) { $user->setPassword($_POST["password"]); } else { Tool::pageError(); } if (isset($_POST["name"]) && !empty($_POST["name"])) { $user->setName($_POST["name"]); } if (isset($_POST["status"]) && !empty($_POST["status"])) { $user->setStatus($_POST["status"]); } if (isset($_POST["address"]) && !empty($_POST["address"])) { $user->setAddress($_POST["address"]); } if (isset($_POST["phone"]) && !empty($_POST["phone"])) { $user->setPhone($_POST["phone"]); } if (isset($_POST["cache"]) && !empty($_POST["cache"])) { if ($_POST["cache"] == User::CACHE_HIDE) { $user->setCache(User::CACHE_HIDE); } else { $user->setCache(User::CACHE_SHOW); } } $user->UpdateDatabase($log_user); header("Location:../?menu=" . PAGE_MANAGE_USER); exit; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; // header("Location:../404.html"); } }