public function index() { if ($this->registry["ui"]["admin"]) { $this->view->setTitle("Пользователи"); $this->view->setLeftContent($this->view->render("left_users", array())); if (isset($_POST['adduser'])) { $validate = new Model_Validate(); $err = array(); if ($txt = $validate->login($_POST["login"])) { $err[] = $txt; } if ($txt = $validate->email($_POST["email"])) { $err[] = $txt; } if ($txt = $validate->name($_POST["name"])) { $err[] = $txt; } if ($txt = $validate->soname($_POST["soname"])) { $err[] = $txt; } if ($txt = $validate->password($_POST["pass"])) { $err[] = $txt; } if (!is_numeric($_POST["quota_val"])) { $res_val = 100; } else { $val = $_POST["quota_val"]; } if ($_POST["quota_unit"] == "mb") { $res_val = $val * 1024 * 1024; } if ($_POST["quota_unit"] == "gb") { $res_val = $val * 1024 * 1024 * 1024; } if (count($err) == 0) { if (!isset($_POST["notify"])) { $notify = 0; } else { $notify = 1; } if (isset($_POST["email_for_task"])) { $email_for_task = 1; } else { $email_for_task = 0; } $uid = $this->registry["user"]->addUser($_POST["login"], $_POST["pass"], $res_val, $_POST["name"], $_POST["soname"], $_POST["signature"], $_POST["email"], $notify, $_POST["time_notify"], $email_for_task); $this->registry["user"]->addUserPriv($uid, $_POST["priv"], $_POST["gid"]); $this->view->refresh(array("timer" => "1", "url" => "users/")); } else { $group = $this->registry["user"]->getGroups(); $this->view->users_adduser(array("group" => $group, "err" => $err, "post" => $_POST)); } } else { $group = $this->registry["user"]->getGroups(); $post["time_notify"] = "08:00:00"; $this->view->users_adduser(array("group" => $group, "post" => $post)); } } }
public function index() { if ($this->registry["ui"]["admin"]) { $this->view->setTitle("Пользователи"); if (isset($_POST['edituser'])) { $group = $this->registry["user"]->getGroups(); $data = $this->registry["user"]->getUserInfo($this->args[1]); $validate = new Model_Validate(); $err = array(); if ($_POST["login"] != $data["login"]) { if ($txt = $validate->login($_POST["login"])) { $err[] = $txt; } } if ($txt = $validate->email($_POST["email"])) { $err[] = $txt; } if ($txt = $validate->name($_POST["name"])) { $err[] = $txt; } if ($txt = $validate->soname($_POST["soname"])) { $err[] = $txt; } if ($data["pass"] != $_POST["pass"]) { if ($txt = $validate->password($_POST["pass"])) { $err[] = $txt; } } if (count($err) == 0) { if (!isset($_POST["notify"])) { $notify = 0; } else { $notify = 1; } $uid = $this->registry["user"]->editUser($this->args[1], $_POST["login"], $_POST["name"], $_POST["soname"], $_POST["signature"], $_POST["email"], $notify, $_POST["time_notify"]); if ($data["pass"] != $_POST["pass"]) { $this->registry["user"]->editUserPass($this->args[1], $_POST["pass"]); } $this->registry["user"]->editUserPriv($this->args[1], $_POST["priv"], $_POST["gid"]); $this->view->refresh(array("timer" => "1", "url" => "users/")); } else { $_POST["uid"] = $data["uid"]; $this->view->users_edituser(array("group" => $group, "err" => $err, "post" => $_POST)); } } else { $data = $this->registry["user"]->getUserInfo($this->args[1]); $group = $this->registry["user"]->getGroups(); if ($data["admin"]) { $data["priv"] = "admin"; } $this->view->users_edituser(array("post" => $data, "group" => $group)); } } $this->view->showPage(); }
public function index() { if ($this->registry["ui"]["admin"]) { $this->view->setTitle("New user"); if (isset($_POST['adduser'])) { $validate = new Model_Validate(); if (!is_numeric($_POST["quota_val"])) { $res_val = 100; } else { $val = $_POST["quota_val"]; } if ($_POST["quota_unit"] == "mb") { $res_val = $val * 1024 * 1024; } if ($_POST["quota_unit"] == "gb") { $res_val = $val * 1024 * 1024 * 1024; } $err = array(); if ($txt = $validate->login($_POST["login"])) { $err[] = $txt; } if ($txt = $validate->password($_POST["pass"])) { $err[] = $txt; } if (count($err) == 0) { if (!isset($_POST["notify"])) { $notify = 0; } else { $notify = 1; } $uid = $this->muser->addUser($_POST["login"], $_POST["pass"], $res_val); $this->muser->addUserPriv($uid, $_POST["priv"], $_POST["gid"]); $this->view->refresh(array("timer" => "1", "url" => "users/")); } else { $group = $this->muser->getGroups(); $this->view->users_adduser(array("group" => $group, "err" => $err, "post" => $_POST)); } } else { $group = $this->muser->getGroups(); $post["time_notify"] = "08:00:00"; $this->view->users_adduser(array("group" => $group, "post" => $post)); } } }
public function index() { $this->view->setTitle("Профиль"); if (isset($_POST['editprofile'])) { $data = $this->registry["ui"]; $validate = new Model_Validate(); $ui = new Model_Ui(); $err = array(); if ($_POST["login"] != $this->registry["ui"]["login"]) { if ($txt = $validate->login($_POST["login"])) { $err[] = $txt; } } if ($txt = $validate->name($_POST["name"])) { $err[] = $txt; } if ($txt = $validate->soname($_POST["soname"])) { $err[] = $txt; } if ($data["pass"] != $_POST["pass"]) { if ($txt = $validate->password($_POST["pass"])) { $err[] = $txt; } } if (count($err) == 0) { $uid = $ui->editUser($this->registry["ui"]["id"], $_POST["login"], $_POST["name"], $_POST["soname"]); if ($data["pass"] != $_POST["pass"]) { $ui->editUserPass($this->registry["ui"]["id"], $_POST["pass"]); } $this->view->refresh(array("timer" => "1", "url" => "profile/profile/")); } else { $this->view->profile(array("err" => $err, "post" => $_POST)); } } else { $data = $this->registry["ui"]; $this->view->profile(array("post" => $data)); } }
public function index() { if ($this->registry["ui"]["admin"]) { $this->view->setTitle("Edit user"); if (isset($_POST['edituser'])) { $group = $this->muser->getGroups(); $data = $this->muser->getUserInfo($this->args[1]); $validate = new Model_Validate(); if (!is_numeric($_POST["quota_val"])) { $res_val = 100; } else { $val = $_POST["quota_val"]; } if ($_POST["quota_unit"] == "mb") { $res_val = $val * 1024 * 1024; } if ($_POST["quota_unit"] == "gb") { $res_val = $val * 1024 * 1024 * 1024; } $err = array(); if ($_POST["quota_val"] != $data["quota"]) { if ($txt = $validate->quota_val($_POST["quota_val"])) { $err[] = $txt; } } if ($_POST["login"] != $data["login"]) { if ($txt = $validate->login($_POST["login"])) { $err[] = $txt; } } if ($data["pass"] != $_POST["pass"]) { if ($txt = $validate->password($_POST["pass"])) { $err[] = $txt; } } if (count($err) == 0) { if (!isset($_POST["notify"])) { $notify = 0; } else { $notify = 1; } $uid = $this->muser->editUser($this->args[1], $_POST["login"], $res_val); if ($data["pass"] != $_POST["pass"]) { $this->muser->editUserPass($this->args[1], $_POST["pass"]); } $this->muser->editUserPriv($this->args[1], $_POST["priv"], $_POST["gid"]); $this->view->refresh(array("timer" => "1", "url" => "users/")); } else { $_POST["uid"] = $data["uid"]; $this->view->users_edituser(array("group" => $group, "err" => $err, "post" => $_POST)); } } else { $data = $this->muser->getUserInfo($this->args[1]); $group = $this->muser->getGroups(); if ($data["admin"]) { $data["priv"] = "admin"; } $quota = $data["quota"]; if ($quota / 1024 / 1024 > 1) { $data["quota_val"] = round($quota / 1024 / 1024, 2); $data["quota_unit"] = "mb"; } if ($quota / 1024 / 1024 / 1024 > 1) { $data["quota_val"] = round($quota / 1024 / 1024 / 1024, 2); $data["quota_unit"] = "gb"; } $this->view->users_edituser(array("post" => $data, "group" => $group)); } } }
public function index() { $this->view->setTitle("Учётная запись"); $ui = new Model_Ui(); if (isset($_POST["upload_avatar"])) { $err = $ui->saveAvatar($_FILES["filename"]); if ($err != null) { $this->view->setMainContent("<div style='border: 1px solid red; background-color: #faa; padding: 4px 10px; margin-bottom: 20px; width: 400px'>" . $err . "</div>"); } else { $this->registry->remove("auth"); $this->registry->remove("ui"); $this->registry->remove("getNumMeTasks"); $this->registry->remove("getNumTasks"); $loginSession =& $_SESSION["login"]; if (isset($loginSession["id"])) { $ui->getInfo($loginSession); } } } if (isset($_POST['editprofile'])) { $data = $this->registry["ui"]; $validate = new Model_Validate(); $err = array(); if ($_POST["login"] != $this->registry["ui"]["login"]) { if ($txt = $validate->login($_POST["login"])) { $err[] = $txt; } } if ($txt = $validate->email($_POST["email"])) { $err[] = $txt; } if ($txt = $validate->name($_POST["name"])) { $err[] = $txt; } if ($txt = $validate->soname($_POST["soname"])) { $err[] = $txt; } if ($data["pass"] != $_POST["pass"]) { if ($txt = $validate->password($_POST["pass"])) { $err[] = $txt; } } if (count($err) == 0) { if (!isset($_POST["notify"])) { $notify = 0; } else { $notify = 1; } if (isset($_POST["email_for_task"])) { $email_for_task = 1; } else { $email_for_task = 0; } $uid = $ui->editUser($this->registry["ui"]["id"], $_POST["login"], $_POST["name"], $_POST["soname"], $_POST["signature"], $_POST["email"], $notify, $_POST["time_notify"], $email_for_task); if ($data["pass"] != $_POST["pass"]) { $ui->editUserPass($this->registry["ui"]["id"], $_POST["pass"]); } $ui->editAdvUser($_POST["icq"], $_POST["skype"], $_POST["adres"], $_POST["phone"]); $this->view->refresh(array("timer" => "1", "url" => "profile/profile/")); } else { $this->view->profile(array("err" => $err, "post" => $_POST)); } } else { $data = $this->registry["ui"]; $this->view->profile(array("post" => $data)); } }