コード例 #1
0
ファイル: Adduser.php プロジェクト: zhendeguoke1008/fm
 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));
         }
     }
 }
コード例 #2
0
ファイル: Adduser.php プロジェクト: rosko/workapp
 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));
         }
     }
 }
コード例 #3
0
ファイル: Profile.php プロジェクト: kingsoftdng/mailer
 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));
     }
 }
コード例 #4
0
ファイル: Edituser.php プロジェクト: norayrx/otms
 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();
 }
コード例 #5
0
ファイル: Sort.php プロジェクト: kingsoftdng/mailer
 function index()
 {
     $mailClass = new Model_Mail();
     $this->view->setTitle("Правила обработки для почты");
     if (isset($_POST["submit"])) {
         $validate = new Model_Validate();
         $err = array();
         if (isset($_POST["checkbox_from"])) {
             if ($txt = $validate->email($_POST["from"])) {
                 $err[] = $txt;
             }
         } else {
             $_POST["from"] = null;
         }
         if (isset($_POST["checkbox_to"])) {
             if ($txt = $validate->email($_POST["to"])) {
                 $err[] = $txt;
             }
         } else {
             $_POST["to"] = null;
         }
         if (isset($_POST["checkbox_subject"])) {
             if ($_POST["subject"] == "") {
                 $err[] = 'Поле "Тема" не может быть пустой';
             }
         } else {
             $_POST["subject"] = null;
         }
         if (!isset($_POST["checkbox_from"]) and !isset($_POST["checkbox_to"]) and !isset($_POST["checkbox_subject"])) {
             $err[] = 'Не указано ни одного критерия для сортировки';
         }
         if (count($err) == 0) {
             $mailClass->addSort($_POST);
             $this->view->refresh(array("timer" => "1", "url" => "sort/"));
         } else {
             if (isset($_GET["mid"])) {
                 $mail = $mailClass->getMailFromId($_GET["mid"]);
             }
             $this->view->mail_addsort(array("err" => $err, "mail" => $mail, "folders" => $this->folders));
         }
     } elseif (isset($_POST["edit_sort"])) {
         if (isset($_GET["id"]) and is_numeric($_GET["id"])) {
             $param = $mailClass->getSort($_GET["id"]);
             $validate = new Model_Validate();
             $err = array();
             if (isset($_POST["from"]) and $_POST["from"] != null) {
                 if ($txt = $validate->email($_POST["from"])) {
                     $err[] = $txt;
                 } else {
                     $sort["type"] = "from";
                     $sort["val"] = $_POST["from"];
                     $sort["folder_id"] = $_POST["folder"];
                 }
             }
             if (isset($_POST["to"]) and $_POST["to"] != null) {
                 if ($txt = $validate->email($_POST["to"])) {
                     $err[] = $txt;
                 } else {
                     $sort["type"] = "to";
                     $sort["val"] = $_POST["to"];
                     $sort["folder_id"] = $_POST["folder"];
                 }
             }
             if (isset($_POST["subject"]) and $_POST["subject"] != null) {
                 if ($_POST["subject"] == "") {
                     $err[] = 'Поле "Тема" не может быть пустой';
                 } else {
                     $sort["type"] = "subject";
                     $sort["val"] = $_POST["subject"];
                     $sort["folder_id"] = $_POST["folder"];
                 }
             }
             if (!isset($_POST["from"]) and !isset($_POST["to"]) and !isset($_POST["subject"])) {
                 $err[] = 'Не указано ни одного критерия для сортировки';
             }
             if (count($err) == 0) {
                 $mailClass->delSort($_GET["id"]);
                 $mailClass->addSort($_POST);
                 $this->view->refresh(array("timer" => "1", "url" => "sort/"));
             } else {
                 $this->view->mail_editsort(array("err" => $err, "sort" => $param, "folders" => $this->folders));
             }
         }
     } elseif (isset($_GET["mid"]) or isset($_GET["add"])) {
         $mail = array();
         if (isset($_GET["mid"]) and is_numeric($_GET["mid"])) {
             $mail = $mailClass->getMailFromId($_GET["mid"]);
         }
         if (isset($_GET["id"]) and is_numeric($_GET["id"])) {
             $mail = $mailClass->getSort($_GET["id"]);
         }
         $this->view->mail_addsort(array("mail" => $mail, "folders" => $this->folders));
     } elseif (isset($_GET["id"])) {
         if (isset($_GET["id"]) and is_numeric($_GET["id"])) {
             $sort = $mailClass->getSort($_GET["id"]);
             $this->view->mail_editsort(array("sort" => $sort, "folders" => $this->folders));
         }
     } else {
         $list = $mailClass->getSorts();
         $this->view->mail_sorts(array("list" => $list));
     }
 }
コード例 #6
0
ファイル: Edituser.php プロジェクト: zhendeguoke1008/fm
 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));
         }
     }
 }
コード例 #7
0
ファイル: Profile.php プロジェクト: norayrx/otms
 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));
     }
 }
コード例 #8
0
ファイル: Sort.php プロジェクト: rosko/workapp
 function index()
 {
     $mailClass = new Model_Mail();
     $this->view->setTitle("Правила обработки для почты");
     $this->view->setLeftContent($this->view->render("left_mail", array("folders" => $this->folders, "enableCheck" => $this->enableCheck)));
     if (isset($_POST["submit"])) {
         $validate = new Model_Validate();
         $err = array();
         if (isset($_POST["checkbox_from"])) {
             if ($txt = $validate->email($_POST["from"])) {
                 $err[] = $txt;
             }
         } else {
             $_POST["from"] = null;
         }
         if (isset($_POST["checkbox_to"])) {
             if ($txt = $validate->email($_POST["to"])) {
                 $err[] = $txt;
             }
         } else {
             $_POST["to"] = null;
         }
         if (isset($_POST["checkbox_subject"])) {
             if ($_POST["subject"] == "") {
                 $err[] = 'Поле "Тема" не может быть пустой';
             }
         } else {
             $_POST["subject"] = null;
         }
         if (!isset($_POST["checkbox_from"]) and !isset($_POST["checkbox_to"]) and !isset($_POST["checkbox_subject"])) {
             $err[] = 'Не указано ни одного критерия для сортировки';
         }
         if (count($err) == 0) {
             $mailClass->addSort($_POST);
             $this->view->refresh(array("timer" => "1", "url" => "mail/sort/"));
         } else {
             if (isset($_GET["mid"])) {
                 $mail = $mailClass->getMailFromId($_GET["mid"]);
             }
             $rusers = $this->registry["user"]->getUsers();
             $formtask = $this->registry["module_tt"]->formtask();
             $this->view->mail_addsort(array("formtask" => $formtask, "err" => $err, "mail" => $mail, "folders" => $this->folders, "rusers" => $rusers));
         }
     } elseif (isset($_POST["edit_sort"])) {
         if (isset($_GET["id"]) and is_numeric($_GET["id"])) {
             $param = $mailClass->getSort($_GET["id"]);
             $validate = new Model_Validate();
             $err = array();
             if (isset($_POST["from"]) and $_POST["from"] != null) {
                 if ($txt = $validate->email($_POST["from"])) {
                     $err[] = $txt;
                 } else {
                     $sort["type"] = "from";
                     $sort["val"] = $_POST["from"];
                     $sort["folder_id"] = $_POST["folder"];
                 }
             }
             if (isset($_POST["to"]) and $_POST["to"] != null) {
                 if ($txt = $validate->email($_POST["to"])) {
                     $err[] = $txt;
                 } else {
                     $sort["type"] = "to";
                     $sort["val"] = $_POST["to"];
                     $sort["folder_id"] = $_POST["folder"];
                 }
             }
             if (isset($_POST["subject"]) and $_POST["subject"] != null) {
                 if ($_POST["subject"] == "") {
                     $err[] = 'Поле "Тема" не может быть пустой';
                 } else {
                     $sort["type"] = "subject";
                     $sort["val"] = $_POST["subject"];
                     $sort["folder_id"] = $_POST["folder"];
                 }
             }
             if (!isset($_POST["from"]) and !isset($_POST["to"]) and !isset($_POST["subject"])) {
                 $err[] = 'Не указано ни одного критерия для сортировки';
             }
             if (count($err) == 0) {
                 $mailClass->delSort($_GET["id"]);
                 $mailClass->addSort($_POST);
                 $this->view->refresh(array("timer" => "1", "url" => "mail/sort/"));
             } else {
                 $task[0] = $param[0]["task"];
                 $formtask = $this->registry["module_tt"]->formtask($task);
                 $this->view->mail_editsort(array("formtask" => $formtask, "err" => $err, "sort" => $param, "folders" => $this->folders));
             }
         }
     } elseif (isset($_GET["mid"]) or isset($_GET["add"])) {
         $mail = array();
         if (isset($_GET["mid"]) and is_numeric($_GET["mid"])) {
             $mail = $mailClass->getMailFromId($_GET["mid"]);
         }
         if (isset($_GET["id"]) and is_numeric($_GET["id"])) {
             $mail = $mailClass->getSort($_GET["id"]);
         }
         $rusers = $this->registry["user"]->getUsers();
         $formtask = $this->registry["module_tt"]->formtask();
         $this->view->mail_addsort(array("formtask" => $formtask, "mail" => $mail, "folders" => $this->folders, "rusers" => $rusers));
     } elseif (isset($_GET["id"])) {
         if (isset($_GET["id"]) and is_numeric($_GET["id"])) {
             $sort = $mailClass->getSort($_GET["id"]);
             $rusers = $this->registry["user"]->getUsers();
             $issRusers = array();
             $k = 0;
             if (isset($sort[0]["task"]["ruser"])) {
                 foreach ($sort[0]["task"]["ruser"] as $part) {
                     $row = $this->registry["user"]->getUserInfo($part);
                     $k++;
                     $issRusers[$k]["desc"] = '<p><span style="font-size: 11px; margin-right: 10px;" id="udesc[' . $row["uid"] . ']">' . $row["name"] . ' ' . $row["soname"] . '</span>';
                     $issRusers[$k]["desc"] .= '<input id="uhid[' . $row["uid"] . ']" type="hidden" name="ruser[]" value="' . $row["uid"] . '" /></p>';
                 }
             }
             if (isset($sort[0]["task"]["gruser"])) {
                 foreach ($sort[0]["task"]["gruser"] as $part) {
                     $gname = $this->registry["user"]->getGroupName($part);
                     $k++;
                     $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">' . $gname . '<input type="hidden" name="gruser[]" value="' . $part["rgid"] . '" /></p>';
                 }
             }
             if (isset($sort[0]["rall"])) {
                 $k++;
                 $issRusers[$k]["desc"] = '<p style="font-size: 11px; margin-right: 10px">Все<input type="hidden" name="rall" value="1" /></p>';
             }
             $task[0] = $sort[0]["task"];
             $formtask = $this->registry["module_tt"]->formtask($task);
             $this->view->mail_editsort(array("formtask" => $formtask, "sort" => $sort, "folders" => $this->folders, "rusers" => $rusers, "issRusers" => $issRusers));
         }
     } else {
         $list = $mailClass->getSorts();
         $formtask = $this->registry["module_tt"]->formtask();
         $this->view->mail_sorts(array("list" => $list, "formtask" => $formtask));
     }
     $this->view->showPage();
 }