Exemple #1
0
 function index()
 {
     $this->view->setTitle("Входящая почта");
     $mailClass = new Model_Mail();
     $mails = $mailClass->getMails();
     $this->view->mail_index(array("mails" => $mails, "mailbox" => "Входящая почта"));
 }
Exemple #2
0
 function index()
 {
     $mailClass = new Model_Mail();
     if (isset($_GET["filename"])) {
         $filename = $_GET["filename"];
         if (!strpos($filename, "/")) {
             $mid = $_GET["mid"];
             if (isset($_GET["type"]) and $_GET["type"] == "out") {
                 $fn = $mailClass->getFileOut($mid, $filename);
                 $file = $this->registry["rootPublic"] . $this->registry["path"]["upload"] . $fn;
             } else {
                 $fn = $mailClass->getFile($mid, $filename);
                 $file = $this->registry["rootPublic"] . $this->registry["path"]["attaches"] . $fn;
             }
             if (file_exists($file)) {
                 $filename = str_replace(" ", "_", $filename);
                 header("Content-Type: application/octet-stream");
                 header("Accept-Ranges: bytes");
                 header("Content-Length: " . filesize($file));
                 header("Content-Disposition: attachment; filename=" . $filename);
                 readfile($file);
             } else {
                 $this->view->setTitle("Файл не найден");
                 $this->view->setMainContent("<p style='text-align: center'>Файл не найден</p>");
                 $this->view->refresh(array("timer" => "1", "url" => ""));
             }
         }
     }
 }
Exemple #3
0
 public function newAction()
 {
     $this->_form = new Mybase_Form_People();
     $this->view->form = $this->_form;
     $formData = $this->getRequest()->getPost();
     if ($this->_request->isPost()) {
         if ($this->_form->isValid($formData)) {
             $company = new Model_Company();
             empty($formData['idcompany']) ? $formData['idcompany'] = $company->save($formData) : $formData['idcompany'];
             $unodorId = new Model_Login();
             $idlogin = $unodorId->save($formData);
             $formData['idlogin'] = $idlogin;
             $this->_modelUser->save($formData);
             $mail = new Model_Mail();
             $mail->prepare($formData)->generate(Model_Mail::INVITE)->send($formData['email']);
             $salt = 'ofsdmší&;516#@ešěýp-§)údjs861fds';
             $hash = md5($this->{$formData}['idcompany'] . $this->{$formData}['name'] . $this->{$formData}['surname'] . $this->{$formData}['email'] . $salt);
             $this->_flash('New User has been successfully created and E-mailed ***TODO*** - ' . $hash, 'done', true);
             return $this->_redirect('/people');
         } else {
             //$this->_flash('There is an errors in the form', 'error', false);
             $this->_form->populate($formData);
         }
     }
 }
Exemple #4
0
 function index()
 {
     $mid = $_GET["mid"];
     $part = $_GET["part"] - 1;
     $mail = array();
     $content = null;
     $mailClass = new Model_Mail();
     if (isset($_GET["out"]) and $_GET["out"]) {
         $mail = $mailClass->getMailOutFromId($mid);
         $out = 1;
     } else {
         $mail = $mailClass->getMailFromId($mid);
         $out = 0;
     }
     if (count($mail) > 0) {
         if (isset($mail[$part]["type"]) and $mail[$part]["type"] == "text") {
             $content = "<pre>" . $mail[$part]["text"] . "</pre>";
         }
         if (isset($mail[$part]["type"]) and $mail[$part]["type"] == "html") {
             $content = $mail[$part]["text"];
         }
         if ($content != null) {
             echo $this->view->render("mail_mailbody", array("content" => $content, "mid" => $mid, "part" => $part + 1, "out" => $out));
         }
         exit;
     }
 }
Exemple #5
0
 function index()
 {
     $mailClass = new Model_Mail();
     $this->view->setTitle("Отправленная почта");
     $mails = $mailClass->getOutMails();
     $this->view->mail_indexout(array("mails" => $mails, "mailbox" => "Отправленная почта"));
 }
Exemple #6
0
 function index()
 {
     $mailClass = new Model_Mail();
     $mailbox = $mailClass->getMailboxFromId($_GET["folder"]);
     $this->view->setTitle("Почта: " . $mailbox);
     if (isset($_GET["folder"])) {
         $mailClass->getSortsByFolderId($_GET["folder"]);
         $mails = $mailClass->getMailsSort();
     }
     $this->view->mail_index(array("mails" => $mails, "mailbox" => $mailbox));
 }
Exemple #7
0
 function postInit()
 {
     $mailClass = new Model_Mail();
     $mails = $mailClass->getUserInMailboxes($this->registry["ui"]["id"]);
     if (count($mails) > 0) {
         $enableCheck = true;
         $this->registry["enableCheck"] = true;
     } else {
         $enableCheck = false;
         $this->registry["enableCheck"] = false;
     }
 }
 public function test_メールを送信するとmail関数が呼ばれる()
 {
     // mail()関数からのデータをリセットしておく
     Config::set('_tests.mail.data', array());
     $mail = new Model_Mail();
     $mail->send($this->post);
     // mail()関数からのデータを代入
     $mail_data = Config::get('_tests.mail.data');
     //		var_dump($mail_data);
     //		exit;
     $this->assertNotEquals(array(), $mail_data);
 }
Exemple #9
0
 public function action_send()
 {
     // CSRF対策
     if (!Security::check_token()) {
         throw new HttpInvalidInputException('ページ遷移が正しくありません');
     }
     $form = $this->forge_form();
     $val = $form->validation()->add_callable('MyValidationRules');
     if (!$val->run()) {
         $form->repopulate();
         $this->template->title = 'コンタクトフォーム: エラー';
         $this->template->content = View::forge('form/index');
         $this->template->content->set_safe('html_error', $val->show_errors());
         $this->template->content->set_safe('html_form', $form->build('form/confirm'));
         return;
     }
     $post = $val->validated();
     $post['ip_address'] = Input::ip();
     $post['user_agent'] = Input::user_agent();
     unset($post['submit']);
     // データベースへ保存
     $model_form = Model_Form::forge($post);
     $ret = $model_form->save();
     if (!$ret) {
         Log::error('データベース保存エラー', __METHOD__);
         $form->repopulate();
         $this->template->title = 'コンタクトフォーム: サーバエラー';
         $this->template->content = View::forge('form/index');
         $html_error = '<p>サーバでエラーが発生しました。</p>';
         $this->template->content->set_safe('html_error', $html_error);
         $this->template->content->set_safe('html_form', $form->build('form/confirm'));
         return;
     }
     // メールの送信
     try {
         $mail = new Model_Mail();
         $mail->send($post);
         $this->template->title = 'コンタクトフォーム: 送信完了';
         $this->template->content = View::forge('form/send');
         return;
     } catch (EmailValidationFailedException $e) {
         Log::error('メール検証エラー: ' . $e->getMessage(), __METHOD__);
         $html_error = '<p>メールアドレスに誤りがあります。</p>';
     } catch (EmailSendingFailedException $e) {
         Log::error('メール送信エラー: ' . $e->getMessage(), __METHOD__);
         $html_error = '<p>メールを送信できませんでした。</p>';
     }
     $form->repopulate();
     $this->template->title = 'コンタクトフォーム: 送信エラー';
     $this->template->content = View::forge('form/index');
     $this->template->content->set_safe('html_error', $html_error);
     $this->template->content->set_safe('html_form', $form->build('form/confirm'));
 }
Exemple #10
0
 function checkMail()
 {
     $mailClass = new Model_Mail();
     $users = $this->registry["user"]->getUsersList();
     foreach ($users as $user) {
         $mailboxes = $mailClass->getUserInMailboxes($user["id"]);
         foreach ($mailboxes as $mailbox) {
             $mbox = $mailbox["email"];
             $mailClass->uid = $user["id"];
             $mailClass->checkMail($mbox);
         }
     }
 }
Exemple #11
0
 function index()
 {
     $mailClass = new Model_Mail();
     $this->view->setTitle("Новое сообщение");
     $this->view->setLeftContent($this->view->render("left_attach", array()));
     $mailboxes = $mailClass->getUserOutMailboxes();
     if (isset($_POST["submit"])) {
         $helpers = new Helpers_Helpers();
         $smtp = $mailClass->getOutMailbox($_POST["mailbox"]);
         $fromName = $this->registry["ui"]["name"] . " " . $this->registry["ui"]["soname"];
         if (!($err = $helpers->phpmailer($_POST, $smtp, $fromName))) {
             $mailClass->saveOutMail($_POST, $smtp);
             $this->view->refresh(array("timer" => "1", "url" => "mail/"));
         } else {
             $this->view->mail_compose(array("err" => $err, "mailboxes" => $mailboxes, "post" => $_POST));
         }
     } else {
         $post = array();
         if (isset($_GET["action"]) and $_GET["action"] == "reply") {
             if (isset($_GET["mid"]) and is_numeric($_GET["mid"])) {
                 $mail = $mailClass->getMailFromId($_GET["mid"]);
                 $post["subject"] = "RE: " . $mail[0]["subject"];
                 $post["to"] = $mail[0]["email"];
                 $text = null;
                 $html = null;
                 for ($i = 0; $i < count($mail); $i++) {
                     if ($mail[0]["type"] == "text") {
                         $text = "<pre>> " . trim($mail[$i]["text"]) . "</pre>";
                     }
                     if ($mail[0]["type"] == "html") {
                         $html = "> " . trim($mail[$i]["text"]);
                     }
                 }
                 if ($html == null) {
                     $post["textfield"] = $text;
                 } else {
                     $post["textfield"] = $html;
                 }
                 $post["textfield"] = str_replace("\r\n", "\r\n> ", $post["textfield"]);
                 $post["textfield"] = $this->view->render("mail_reply", array("date" => $mail[0]["date"], "text" => $post["textfield"]));
                 $post["email"] = $mail[0]["to"];
             }
         } elseif (isset($_GET["obj"])) {
             $mail =& $_SESSION["mail"];
             $post["to"] = implode(", ", json_decode($mail["json"], true));
         }
         $this->view->mail_compose(array("mailboxes" => $mailboxes, "post" => $post));
     }
     $this->view->showPage();
 }
Exemple #12
0
 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($_GET["oid"])) {
         $obj = true;
         $mails = $mailClass->getObjOutMails($_GET["oid"]);
         $this->view->setMainContent("<p class='title'>Просмотр отправленных писем: " . $mailClass->getContact() . "</p>");
     } else {
         $mails = $mailClass->getOutMails();
     }
     $this->view->mail_indexout(array("mails" => $mails));
     $this->view->showPage();
 }
Exemple #13
0
 function index()
 {
     $mailClass = new Model_Mail();
     $this->view->setLeftContent($this->view->render("left_mail", array("folders" => $this->folders, "enableCheck" => $this->enableCheck)));
     if (isset($_POST["edit_submit"])) {
         $this->view->setTitle("Правка");
         $err = array();
         $str = htmlspecialchars($_POST["folder"]);
         $strlen = mb_strlen($_POST["folder"]);
         if ($strlen < 1 or $strlen > 64) {
             $err[] = "Название папки должно быть от 1 до 64 символов";
         }
         if (count($err) == 0) {
             $mailClass->editFolder($_GET["id"], $str);
             $this->view->refresh(array("timer" => "1", "url" => "mail/folder/"));
         } else {
             $this->view->mail_folder(array("err" => $err, "folders" => $this->folders));
         }
     } elseif (isset($_POST["submit"])) {
         $this->view->setTitle("Новая папка");
         $err = array();
         $str = htmlspecialchars($_POST["folder"]);
         $strlen = mb_strlen($_POST["folder"]);
         if ($strlen < 1 or $strlen > 64) {
             $err[] = "Название папки должно быть от 1 до 64 символов";
         }
         if (count($err) == 0) {
             $mailClass->addFolder($str);
             $this->view->refresh(array("timer" => "1", "url" => "mail/folder/"));
         } else {
             $this->view->mail_folder(array("err" => $err, "folders" => $this->folders));
         }
     } else {
         if (isset($_GET["id"])) {
             $this->view->setTitle("Правка");
             foreach ($this->folders as $part) {
                 if ($part["id"] == $_GET["id"]) {
                     $folder = $part;
                 }
             }
             $this->view->mail_editfolder(array("folder" => $folder));
         } else {
             $this->view->setTitle("Новая папка");
             $this->view->mail_folder(array("folders" => $this->folders));
         }
     }
     $this->view->showPage();
 }
Exemple #14
0
 function run()
 {
     $view = new View_Index();
     $this->registry->set('view', $view);
     $ui = new Model_Ui();
     $loginSession =& $_SESSION["login"];
     if (isset($loginSession["id"])) {
         $ui->getInfo($loginSession);
         $mailClass = new Model_Mail();
         $folders = $mailClass->getFolders();
         $this->registry["view"]->setFolders($folders);
     } else {
         $login = new Controller_Login();
         $login->index();
         exit;
     }
 }
Exemple #15
0
 public function action_view()
 {
     $mail_id = $this->request->param('id');
     $mail = Model_Mail::find_by_id($mail_id);
     if (!$mail) {
         throw new Exception_Page(__('common.mail_not_found'));
     }
     // 检查权限
     if ($mail->is_owner($this->current_user) or $this->current_user->is_admin()) {
         if ($mail->is_receiver($this->current_user)) {
             $mail->mark_as_read();
         }
         $this->template_data['title'] = $mail->title;
         $this->template_data['mail'] = $mail;
     } else {
         $this->redirect('/mail');
     }
 }
Exemple #16
0
 public function post_delmail()
 {
     $code = 0;
     $message = "ok";
     if ($this->auth_status) {
         $mail = Model_Mail::find(Input::post("id", 0));
         if ($mail != null) {
             $mail->deleted_at = time();
             $mail->save();
         } else {
             $code = 404;
             $message = "Content not found.";
         }
     } else {
         $code = 500;
         $message = "Auth error.";
     }
     $this->response(array('code' => $code, 'message' => $message));
 }
Exemple #17
0
 public function index()
 {
     $this->view->setTitle("Почта");
     $this->view->setLeftContent($this->view->render("left_mail", array("folders" => $this->folders, "enableCheck" => $this->enableCheck)));
     $mailClass = new Model_Mail();
     $obj = false;
     if (isset($_GET["folder"])) {
         $mailClass->getSortsByFolderId($_GET["folder"]);
         $mails = $mailClass->getMailsSort();
     } else {
         if (isset($_GET["oid"])) {
             $obj = true;
             $mails = $mailClass->getObjMails($_GET["oid"]);
             $this->view->setMainContent("<p class='title'>Просмотр почтовой переписки: " . $mailClass->getContact() . "</p>");
         } else {
             $mails = $mailClass->getMails();
         }
     }
     $this->view->mail_index(array("mails" => $mails, "obj" => $obj));
     $this->view->showPage();
 }
Exemple #18
0
 public function action_edit($id = 0)
 {
     //saving draft
     if (Input::post('action') == 'draft') {
         foreach ($this->fields as $field) {
             Session::set_flash($field, Input::post($field));
         }
         $data = array();
         foreach ($this->fields as $field) {
             $data[$field] = Session::get_flash($field);
             Session::keep_flash($field);
         }
         $data["mail"] = Model_Mail::find($id);
         if ($data["mail"] == null) {
             $data["mail"] = Model_mail::forge();
         }
         // add
         if (Session::get_flash('title') != null and Security::check_token()) {
             // save
             $mail = $data["mail"];
             $mail->for_all = Session::get_flash("for_all", 0);
             $mail->for_teachers = Session::get_flash("for_teachers", 0);
             $mail->for_students = Session::get_flash("for_students", 0);
             $mail->title = Session::get_flash("title");
             $mail->body = Session::get_flash("body");
             $mail->status = Session::get_flash("status");
             if ($mail->for_all == null) {
                 $mail->for_all = 0;
             }
             if ($mail->for_students == null) {
                 $mail->for_students = 0;
             }
             if ($mail->for_teachers == null) {
                 $mail->for_teachers = 0;
             }
             $mail->save();
             $body = View::forge("email/mail");
             $body->set("title", $mail->title);
             $body->set("body", $mail->body);
             //saving draft all start
             if ($mail->for_all == 1) {
                 $teachers = Model_User::find("all", ["where" => [["group_id", 10], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]);
                 $students = Model_User::find("all", ["where" => [["group_id", 1], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]);
                 Response::redirect("/admin/mail");
             }
             //saving draft all end
             //saving draft to enabled teachers start
             if ($mail->for_teachers == 1) {
                 $teachers = Model_User::find("all", ["where" => [["group_id", 10], ["deleted_at", 0], ["need_news_email", 1]], "order_by" => [["id", "desc"]]]);
             }
             //saving draft to enabled teachers end
             //saving draft to enabled students start
             if ($mail->for_students == 1) {
                 $students = Model_User::find("all", ["where" => [["group_id", 1], ["deleted_at", 0], ["need_news_email", 1]], "order_by" => [["id", "desc"]]]);
             }
             //saving draft to enabled students end
             Response::redirect("/admin/mail");
         }
         $view = View::forge("admin/mail/edit", $data);
         $this->template->content = $view;
     }
     //sending email
     if (Input::post('action') == 'confirm') {
         foreach ($this->fields as $field) {
             Session::set_flash($field, Input::post($field));
         }
         $data = array();
         foreach ($this->fields as $field) {
             $data[$field] = Session::get_flash($field);
             Session::keep_flash($field);
         }
         $this->template->content = View::forge('admin/mail/confirm', $data);
     } else {
         $data["mail"] = Model_Mail::find($id);
         if ($data["mail"] == null) {
             $data["mail"] = Model_mail::forge();
         }
         // add
         if (Session::get_flash('title') != null and Security::check_token()) {
             // save
             $mail = $data["mail"];
             $mail->for_all = Session::get_flash("for_all", 0);
             $mail->for_teachers = Session::get_flash("for_teachers", 0);
             $mail->for_students = Session::get_flash("for_students", 0);
             $mail->title = Session::get_flash("title");
             $mail->body = Session::get_flash("body");
             $mail->status = Session::get_flash("status");
             if ($mail->for_all == null) {
                 $mail->for_all = 0;
             }
             if ($mail->for_students == null) {
                 $mail->for_students = 0;
             }
             if ($mail->for_teachers == null) {
                 $mail->for_teachers = 0;
             }
             $mail->save();
             $body = View::forge("email/mail");
             $body->set("title", $mail->title);
             $body->set("body", $mail->body);
             //sending all start
             if ($mail->for_all == 1) {
                 $teachers = Model_User::find("all", ["where" => [["group_id", 10], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]);
                 foreach ($teachers as $teacher) {
                     $sendmail = Email::forge("JIS");
                     $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
                     $sendmail->to($teacher->email);
                     $sendmail->subject("{$mail->title} / Game-bootcamp");
                     $sendmail->html_body("Dear {$teacher->firstname},<br><br>" . htmlspecialchars_decode($body) . "If you are no longer interested, you can " . "<a href=" . Uri::base() . "?" . md5('id') . "={$teacher->id}/unsubscribe=" . md5($teacher->email) . ">Unsubscribe.</a>");
                     $sendmail->send();
                 }
                 $students = Model_User::find("all", ["where" => [["group_id", 1], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]);
                 foreach ($students as $student) {
                     $sendmail = Email::forge("JIS");
                     $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
                     $sendmail->to($student->email);
                     $sendmail->subject("{$mail->title} / Game-bootcamp");
                     $sendmail->html_body("Dear {$student->firstname},<br><br>" . htmlspecialchars_decode($body) . "If you are no longer interested, you can " . "<a href=" . Uri::base() . "?" . md5('id') . "={$student->id}/unsubscribe=" . md5($student->email) . ">Unsubscribe.</a>");
                     $sendmail->send();
                 }
                 Response::redirect("/admin/mail/sent");
             }
             //sending all end
             //sending to enabled teachers start
             if ($mail->for_teachers == 1) {
                 $teachers = Model_User::find("all", ["where" => [["group_id", 10], ["deleted_at", 0], ["need_news_email", 1]], "order_by" => [["id", "desc"]]]);
                 foreach ($teachers as $teacher) {
                     $sendmail = Email::forge("JIS");
                     $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
                     $sendmail->to($teacher->email);
                     $sendmail->subject("{$mail->title} / Game-bootcamp");
                     $sendmail->html_body("Dear {$teacher->firstname},<br><br>" . htmlspecialchars_decode($body) . "If you are no longer interested, you can " . "<a href=" . Uri::base() . "?" . md5('id') . "={$teacher->id}/unsubscribe=" . md5($teacher->email) . ">Unsubscribe.</a>");
                     $sendmail->send();
                 }
             }
             //sending to enabled teachers end
             //sending to enabled students start
             if ($mail->for_students == 1) {
                 $students = Model_User::find("all", ["where" => [["group_id", 1], ["deleted_at", 0], ["need_news_email", 1]], "order_by" => [["id", "desc"]]]);
                 foreach ($students as $student) {
                     $sendmail = Email::forge("JIS");
                     $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
                     $sendmail->to($student->email);
                     $sendmail->subject("{$mail->title} / Game-bootcamp");
                     $sendmail->html_body("Dear {$student->firstname},<br><br>" . htmlspecialchars_decode($body) . "If you are no longer interested, you can " . "<a href=" . Uri::base() . "?" . md5('id') . "={$student->id}/unsubscribe=" . md5($student->email) . ">Unsubscribe.</a>");
                     $sendmail->send();
                 }
             }
             //sending to enabled students end
             Response::redirect("/admin/mail/sent");
         }
         $view = View::forge("admin/mail/edit", $data);
         $this->template->content = $view;
     }
 }
Exemple #19
0
 public function spamUsers($theme, $tid)
 {
     $user = new Model_User();
     $helpers = new Helpers_Helpers();
     $mailClass = new Model_Mail();
     $data1 = array();
     $data = array();
     $i = 0;
     $flag = TRUE;
     $sql = "SELECT tr.uid AS `uid`, users.email, users.notify, tr.gid AS `gid`, tr.all AS `all`\r\n        FROM troubles_responsible AS tr\r\n        LEFT JOIN users ON (users.id = tr.uid)\r\n        WHERE tr.tid = :tid";
     $res = $this->registry['db']->prepare($sql);
     $param = array("tid" => $tid);
     $res->execute($param);
     $resp = $res->fetchAll(PDO::FETCH_ASSOC);
     if (count($resp) > 0) {
         foreach ($resp as $part) {
             if ($part["all"]) {
                 $flag = FALSE;
                 $rusers = array();
                 $allusers = $user->getUsersList();
                 foreach ($allusers as $uid) {
                     $data1[$i]["uid"] = $uid["id"];
                     $data1[$i]["email"] = $uid["email"];
                     $data1[$i]["notify"] = $uid["notify"];
                     $i++;
                 }
             }
             if ($part["gid"] != 0 and $flag) {
                 $gusers = $user->getUserInfoFromGroup($part["gid"]);
                 foreach ($gusers as $uid) {
                     $data1[$i]["uid"] = $uid["uid"];
                     $data1[$i]["email"] = $uid["email"];
                     $data1[$i]["notify"] = $uid["notify"];
                     $i++;
                 }
             }
             if ($part["uid"] != 0 and $flag) {
                 $data1[$i]["uid"] = $part["uid"];
                 $data1[$i]["email"] = $part["email"];
                 $data1[$i]["notify"] = $part["notify"];
                 $i++;
             }
         }
     }
     $sql = "SELECT DISTINCT(ts.uid) AS uid, users.email, ts.id AS `spam`\r\n        FROM troubles_spam AS ts\r\n        LEFT JOIN users ON (users.id = ts.uid)\r\n        WHERE ts.tid = :tid\r\n        ORDER BY ts.uid DESC";
     $res = $this->registry['db']->prepare($sql);
     $param = array("tid" => $tid);
     $res->execute($param);
     $data2 = $res->fetchAll(PDO::FETCH_ASSOC);
     $data = array_merge($data1, $data2);
     $i = 0;
     $users = array();
     foreach ($data as $part) {
         $flag = true;
         for ($k = 0; $k < count($users); $k++) {
             if ($users[$k]["uid"] == $part["uid"]) {
                 $flag = false;
             }
         }
         if ($flag) {
             if (isset($part["notify"]) and $part["notify"] or isset($part["spam"])) {
                 $users[$i]["uid"] = $part["uid"];
                 $users[$i]["email"] = $part["email"];
             }
             $i++;
         }
     }
     $task = $this->getTask($tid);
     if ($task[0]["mail_id"] != 0) {
         $task[0]["text"] = $mailClass->getMailText($task[0]["mail_id"]);
     }
     $comments = $this->getComments($tid);
     foreach ($users as $part) {
         $helpers->sendMail($part["email"], $theme, $task, $comments);
     }
 }
Exemple #20
0
 function index()
 {
     $this->view->setTitle("Настройки почты");
     $mailClass = new Model_Mail();
     $mailClass->uid = $this->registry["ui"]["id"];
     if (isset($this->args[0]) and $this->args[0] == "add") {
         if (isset($_POST["submit"])) {
             $flag = true;
             if ($_POST["email"] == "") {
                 $flag = false;
             }
             if ($_POST["in_server"] == "") {
                 $flag = false;
             }
             if ($_POST["in_login"] == "") {
                 $flag = false;
             }
             if ($_POST["in_password"] == "") {
                 $flag = false;
             }
             if ($_POST["in_protocol"] == "") {
                 $flag = false;
             }
             if ($_POST["in_port"] == "") {
                 $flag = false;
             }
             if ($_POST["in_ssl"] == "") {
                 $flag = false;
             }
             if ($_POST["out_server"] == "") {
                 $flag = false;
             }
             if ($_POST["out_auth"] == 0) {
                 $_POST["out_login"] = "";
                 $_POST["out_password"] = "";
             }
             if ($_POST["out_auth"] == 1) {
                 $_POST["out_login"] = $_POST["in_login"];
                 $_POST["out_password"] = $_POST["in_password"];
             }
             if ($_POST["out_auth"] == 2) {
                 if ($_POST["out_login"] == "") {
                     $flag = false;
                 }
                 if ($_POST["out_password"] == "") {
                     $flag = false;
                 }
             }
             if ($_POST["out_port"] == "") {
                 $flag = false;
             }
             if ($_POST["out_ssl"] == "") {
                 $flag = false;
             }
             if ($flag) {
                 $bid = $mailClass->addMailbox($_POST);
                 $mailClass->addSignature($bid, $_POST["textfield"]);
                 $this->view->refresh(array("timer" => "1", "url" => "boxes/"));
             } else {
                 $this->view->profile_addmailbox(array("err" => true, "post" => $_POST));
             }
         } else {
             $post["clear"] = true;
             $this->view->profile_addmailbox(array("err" => false, "post" => $post));
         }
     } elseif (isset($_GET["email"])) {
         if (isset($_POST["submit"])) {
             $flag = true;
             if ($_POST["email"] == "") {
                 $flag = false;
             }
             if ($_POST["in_server"] == "") {
                 $flag = false;
             }
             if ($_POST["in_login"] == "") {
                 $flag = false;
             }
             if ($_POST["in_password"] == "") {
                 $flag = false;
             }
             if ($_POST["in_protocol"] == "") {
                 $flag = false;
             }
             if ($_POST["in_port"] == "") {
                 $flag = false;
             }
             if ($_POST["in_ssl"] == "") {
                 $flag = false;
             }
             if ($_POST["out_server"] == "") {
                 $flag = false;
             }
             if ($_POST["out_auth"] == 0) {
                 $_POST["out_login"] = "";
                 $_POST["out_password"] = "";
             }
             if ($_POST["out_auth"] == 1) {
                 $_POST["out_login"] = $_POST["in_login"];
                 $_POST["out_password"] = $_POST["in_password"];
             }
             if ($_POST["out_auth"] == 2) {
                 if ($_POST["out_login"] == "") {
                     $flag = false;
                 }
                 if ($_POST["out_password"] == "") {
                     $flag = false;
                 }
             }
             if ($_POST["out_port"] == "") {
                 $flag = false;
             }
             if ($_POST["out_ssl"] == "") {
                 $flag = false;
             }
             if ($flag) {
                 $mailClass->editMailbox($_GET["email"], $_POST);
                 $mailClass->editSignature($_GET["email"], $_POST["textfield"]);
                 $this->view->refresh(array("timer" => "1", "url" => "boxes/"));
             } else {
                 $this->view->profile_editmailbox(array("err" => true, "post" => $_POST));
             }
         } else {
             $mailbox = $mailClass->getMailbox($_GET["email"]);
             $signature = $mailClass->getSignature($_GET["email"]);
             $this->view->profile_editmailbox(array("post" => $mailbox, "signature" => $signature));
         }
     } else {
         $mailboxes = $mailClass->getUserMailboxes();
         $this->view->profile_listmailboxes(array("mailboxes" => $mailboxes));
     }
 }
Exemple #21
0
 public function mail_delete($id)
 {
     $dao = Model_Mail::data_access();
     $mail = $dao->filter(Model_Mail::ID, $id);
     return $mail->delete();
 }
Exemple #22
0
 public function number_of_new_mail()
 {
     if (is_null($this->_number_of_new_mail)) {
         $this->_number_of_new_mail = Model_Mail::number_of_unread_mail_for_user($this->user_id);
     }
     return $this->_number_of_new_mail;
 }
Exemple #23
0
 function action($mail)
 {
     $startdate["startdate_global"] = date("Y-m-d");
     $startdate["starttime_global"] = date("H:i:s");
     $startdate["startdate_noiter"] = date("Y-m-d");
     $startdate["starttime_noiter"] = date("H:i:s");
     $startdate["startdate_iter"] = date("Y-m-d");
     $startdate["starttime_iter"] = date("H:i:s");
     $mailClass = new Model_Mail();
     $sorts = $mailClass->getSorts();
     foreach ($sorts as $part) {
         $k = 0;
         foreach ($part as $parted) {
             if ($parted["type"] == "to") {
                 if ($parted["val"] == $mail["to"]) {
                     if ($parted["action"] == "remove") {
                         $this->emailTask = true;
                     } else {
                         if ($parted["action"] == "task") {
                             $sort = $mailClass->getSortByTo($parted["val"]);
                             $sort += $startdate;
                             $sort["task"] = "1";
                             $k++;
                         }
                     }
                 }
             }
             if ($parted["type"] == "from") {
                 if ($parted["val"] == $mail["mailbox"] . "@" . $mail["host"]) {
                     if ($parted["action"] == "remove") {
                         $this->emailTask = true;
                     } else {
                         if ($parted["action"] == "task") {
                             $sort = $mailClass->getSortByFrom($parted["val"]);
                             $sort += $startdate;
                             $sort["task"] = "1";
                             $k++;
                         }
                     }
                 }
             }
             if ($parted["type"] == "subject") {
                 if (mb_strpos($mail["subject"], $parted["val"]) !== false) {
                     if ($parted["action"] == "remove") {
                         $this->emailTask = true;
                     } else {
                         if ($parted["action"] == "task") {
                             $sort = $mailClass->getSortBySubject($parted["val"]);
                             $sort += $startdate;
                             $sort["task"] = "1";
                             $k++;
                         }
                     }
                 }
             }
         }
         if ($k == count($part)) {
             $this->mailInTask = true;
             $this->task = $sort;
         }
     }
 }
Exemple #24
0
 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();
 }
Exemple #25
0
 function getAttachFileMD5($params)
 {
     $mailClass = new Model_Mail();
     return $mailClass->getAttachFileMD5($params[0]);
 }
Exemple #26
0
 function phpmailer($post, $smtp = null, $fromName = null)
 {
     $settings = new Model_Settings($this->registry);
     $mailClass = new Model_Mail();
     if ($smtp == null) {
         $smtp = $settings->getMailbox();
     }
     if ($fromName == null) {
         $fromName = $this->registry["mailSenderName"];
     }
     $mailer = new Phpmailer_Phpmailer();
     $err = array();
     $mailer->SMTPDebug = 0;
     $mailer->CharSet = "utf-8";
     $mailer->IsSMTP();
     $mailer->Host = $smtp["server"];
     $mailer->Port = $smtp["port"];
     if ($smtp["ssl"] == "ssl") {
         $mailer->SMTPSecure = "ssl";
     }
     if ($smtp["login"] and $smtp["password"]) {
         $mailer->SMTPAuth = true;
         $mailer->Username = $smtp["login"];
         $mailer->Password = $smtp["password"];
     } else {
         $mailer->SMTPAuth = false;
     }
     $mailer->From = $smtp["email"];
     $mailer->FromName = $fromName;
     if ($post["to"] == null) {
         $err[] = "Не заданы адресаты";
     } else {
         $to = explode(",", $post["to"]);
         for ($i = 0; $i < count($to); $i++) {
             $mailer->AddAddress($to[$i]);
         }
     }
     if (isset($post["attaches"])) {
         foreach ($post["attaches"] as $part) {
             $filename = mb_substr($part, mb_strrpos($part, DIRECTORY_SEPARATOR) + 1, mb_strlen($part) - mb_strrpos($part, DIRECTORY_SEPARATOR));
             if (substr($part, 0, 1) != "/") {
                 $dir = $this->registry["path"]["upload"];
                 $md5 = $mailClass->getAttachFileMD5($part);
             } else {
                 if (isset($post["mail"]) and $post["mail"]) {
                     $dir = $this->registry["path"]["attaches"];
                     $md5 = $mailClass->getFile($post["mail_id"], $filename);
                 } else {
                     $dir = $this->registry["path"]["upload"];
                     $md5 = $mailClass->getFileMD5($part);
                 }
             }
             $mailer->AddAttachment($this->registry["rootPublic"] . $dir . $md5, $filename);
         }
     }
     if (!$this->text) {
         $mailer->IsHTML(true);
         $mailer->Subject = $post["subject"];
         $mailer->Body = $post["textfield"];
         $mailer->AltBody = strip_tags($post["textfield"]);
     } else {
         $mailer->IsHTML(false);
         $mailer->Subject = base64_encode($post["subject"]);
         $mailer->Body = base64_encode($post["textfield"]);
     }
     if ($post["textfield"] == null) {
         $err[] = "Пустое письмо";
     }
     if (count($err) == 0) {
         if (!$mailer->Send()) {
             return $mailer->ErrorInfo;
         } else {
             return false;
         }
     } else {
         return $err;
     }
 }
Exemple #27
0
 public function addComment($tid, $text, $status, $attaches = false, $mid = false)
 {
     $helpers = new Helpers_Helpers();
     if (is_numeric($mid)) {
         $sql = "INSERT INTO troubles_discussion (tid, uid, mail_id, text, status) VALUES (:tid, :uid, :mail_id, :text, :status)";
         $res = $this->registry['db']->prepare($sql);
         $res->execute(array(":tid" => $tid, ":uid" => $this->uid, ":mail_id" => $mid, ":text" => "", ":status" => $status));
     } else {
         $sql = "INSERT INTO troubles_discussion (tid, uid, text, status) VALUES (:tid, :uid, :text, :status)";
         $res = $this->registry['db']->prepare($sql);
         $res->execute(array(":tid" => $tid, ":uid" => $this->uid, ":text" => $text, ":status" => $status));
     }
     $tdid = $this->registry['db']->lastInsertId();
     if (isset($attaches["attaches"])) {
         foreach ($attaches["attaches"] as $part) {
             $md5 = $this->getMD5($part);
             $sql = "INSERT INTO troubles_discussion_attach (`tdid`, `md5`) VALUES (:tdid, :md5)";
             $res = $this->registry['db']->prepare($sql);
             $param = array(":tdid" => $tdid, ":md5" => $md5);
             $res->execute($param);
         }
     }
     // email move task
     $post = $this->getTask($tid);
     if ($post[0]["remote_id"] != 0) {
         $subject = array();
         $body = array();
         $user = $this->registry["tt_user"]->getRemoteUserInfo($post[0]["who"]);
         $subject["method"] = "comment";
         $subject["name"] = "OTMS";
         $subject["tid"] = $post[0]["remote_id"];
         $subject["rc"] = true;
         $body["uemail"] = $this->registry["ui"]["email"];
         $body["uname"] = $this->registry["ui"]["name"];
         $body["usoname"] = $this->registry["ui"]["soname"];
         $body["ugname"] = $this->registry["ui"]["gname"];
         $body["uavatar"] = base64_encode(file_get_contents($this->registry["ui"]["avatarpath"]));
         $body["attaches"] = $attaches["attaches"];
         $body["text"] = $text;
         $body["status"] = $status;
         $helpers->sendTask($user["email"], $subject, $body);
     } else {
         $data["rall"] = 0;
         $data["gruser"] = array();
         $data["ruser"] = array();
         foreach ($post as $part) {
             if ($part["all"] == 1) {
                 $data["rall"] = 1;
             }
             if ($part["rgid"] != 0) {
                 $data["gruser"][] = $part["rgid"];
             }
             if ($part["uid"] != 0) {
                 $data["ruser"][] = $part["uid"];
             }
         }
         $users = $this->registry["user"]->getUniqUsers($data);
         foreach ($users as $part) {
             $subject = array();
             $body = array();
             $user = $this->registry["user"]->getUserInfo($part);
             if ($user["email_for_task"]) {
                 if (is_numeric($mid)) {
                     $mailClass = new Model_Mail();
                     $text = $mailClass->getMailText($mid);
                     $mail = $mailClass->getMailFromId($mid);
                     foreach ($mail[0]["attach"] as $part) {
                         $attaches["attaches"][] = $this->registry["rootPublic"] . "system/settings/../../" . $part["filename"];
                     }
                     $body["mail"] = true;
                     $body["mail_id"] = $mid;
                 } else {
                     $body["mail"] = false;
                 }
                 $subject["method"] = "comment";
                 $subject["name"] = "OTMS";
                 $subject["tid"] = $tid;
                 $subject["rc"] = false;
                 $body["uemail"] = $this->registry["ui"]["email"];
                 $body["uname"] = $this->registry["ui"]["name"];
                 $body["usoname"] = $this->registry["ui"]["soname"];
                 $body["ugname"] = $this->registry["ui"]["gname"];
                 $body["uavatar"] = base64_encode(file_get_contents($this->registry["ui"]["avatarpath"]));
                 $body["attaches"] = $attaches["attaches"];
                 $body["text"] = $text;
                 $body["status"] = $status;
                 $helpers->sendTask($user["email"], $subject, $body);
             }
         }
     }
     // END email move task
     $string = "Новый комментарий к задаче <a href='" . $this->registry["uri"] . "tt/" . $tid . "/'>" . $tid . "</a>";
     if ($status != 0) {
         $status_text = $this->getCommentStatusText($status);
         $tinfo["Статус"] = "<span style='padding: 2px 4px' class='info'>" . $status_text . "</span>";
     }
     if ($mid) {
         $tinfo["Текст"] = '<iframe class="mailtext" src="' . $this->registry["siteName"] . $this->registry["uri"] . 'mail/load/?mid=' . $mid . '&part=1" frameborder="0" width="100%" height="90%"></iframe>';
     } else {
         $tinfo["Текст"] = $text;
     }
     $this->registry["logs"]->uid = $this->uid;
     $this->registry["logs"]->set("com", $string, $tid, $tinfo);
 }
Exemple #28
0
 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));
     }
 }
Exemple #29
0
 function getSign($params)
 {
     $bid = $params["bid"];
     $mailClass = new Model_Mail();
     $email = $mailClass->getEmailFromId($bid);
     $signature = $mailClass->getSignature($email);
     echo $signature;
 }