示例#1
0
 public function send_password_link($user, $key)
 {
     $message = file_get_contents("../extra/reset_password.txt");
     $replace = array("FULLNAME" => $user["fullname"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "KEY" => $key);
     $email = new email("Reset password at " . $_SERVER["SERVER_NAME"], $this->settings->webmaster_email);
     $email->set_message_fields($replace);
     $email->message($message);
     $email->send($user["email"], $user["fullname"]);
 }
示例#2
0
 public function message($content)
 {
     $content = utf8_decode($content);
     $content = str_replace("\n\n", "</p>\n<p>", $content);
     $content = str_replace("\n", "<br>\n", $content);
     $footer = implode("<span style=\"margin:0 10px\">|</span>", $this->footers);
     $message = file_get_contents("../extra/newsletter.txt");
     $this->set_message_fields(array("TITLE" => $this->subject, "CONTENT" => $content, "FOOTER" => $footer));
     parent::message($message);
 }
示例#3
0
 private function send_notification($message)
 {
     if ($this->settings->guestbook_maintainers == "") {
         return;
     }
     $maintainers = users_with_role($this->db, $this->settings->guestbook_maintainers);
     $guestbook_url = "http://" . $_SERVER["SERVER_NAME"] . "/" . $this->page->module;
     $email = new email("Guestbook message posted", $this->settings->webmaster_email);
     foreach ($maintainers as $maintainer) {
         $cms_url = "http://" . $_SERVER["SERVER_NAME"] . "/cms/guestbook";
         if (($key = one_time_key($this->db, $maintainer["id"])) !== false) {
             $cms_url .= "?login="******"<body>" . "<p>The following message has been added to the guestbook on the '" . $this->settings->head_title . "' website.</p>" . "<p>\"<i>" . $message . "</i>\"</p>" . "<p>Click <a href=\"" . $guestbook_url . "\">here</a> to visit the guestbook page or <a href=\"" . $cms_url . "\">here</a> to visit the guestbook CMS page.</p>" . "</body>";
         $email->message($message);
         $email->send($maintainer["email"], $maintainer["fullname"]);
     }
 }
示例#4
0
 private function send_via_email($errors)
 {
     $message = "Date, time: " . date("j F Y, H:i:s") . "\n" . "Used URL  : " . $_SERVER["REQUEST_URI"] . "\n" . "IP address: " . $_SERVER["REMOTE_ADDR"] . "\n" . "Username  : "******"\n" : "-\n") . "User-Agent: " . $_SERVER["HTTP_USER_AGENT"] . "\n" . "\n" . $errors;
     $email = new email("Internal error at " . $_SERVER["SERVER_NAME"], "no-reply@" . $_SERVER["SERVER_NAME"]);
     $email->message($message);
     $email->send($this->settings->webmaster_email);
     unset($email);
 }
示例#5
0
 private function send_notifications($message, $topic_id, $message_id = null)
 {
     if ($this->user->logged_in) {
         return;
     } else {
         if ($this->settings->forum_maintainers == null) {
             return;
         }
     }
     $maintainers = users_with_role($this->db, $this->settings->forum_maintainers);
     $topic_url = "http://" . $_SERVER["SERVER_NAME"] . "/" . $this->page->module . "/topic/" . $topic_id;
     if ($message_id !== null) {
         $topic_url .= "#" . $message_id;
     }
     $email = new email("Forum message posted", $this->settings->webmaster_email);
     foreach ($maintainers as $maintainer) {
         $cms_url = "http://" . $_SERVER["SERVER_NAME"] . "/cms/forum";
         if (($key = one_time_key($this->db, $maintainer["id"])) !== false) {
             $cms_url .= "?login="******"<body>" . "<p>The following message has been added to the forum on the '" . $this->settings->head_title . "' website.</p>" . "<p>\"<i>" . $message . "</i>\"</p>" . "<p>Click <a href=\"" . $topic_url . "\">here</a> to visit the forum topic page or <a href=\"" . $cms_url . "\">here</a> to visit the forum CMS page.</p>" . "</body>";
         $email->message($message);
         $email->send($maintainer["email"], $maintainer["fullname"]);
     }
 }
示例#6
0
文件: user.php 项目: shannara/banshee
 public function send_notification($user)
 {
     if (isset($user["id"]) == false) {
         $type = "created";
     } else {
         $type = "updated";
     }
     if (($message = file_get_contents("../extra/account_" . $type . ".txt")) === false) {
         return;
     }
     $replace = array("USERNAME" => $user["username"], "PASSWORD" => $user["password"], "FULLNAME" => $user["fullname"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "PROTOCOL" => $_SERVER["HTTP_SCHEME"], "TITLE" => $this->settings->head_title);
     $email = new email("Account " . $type . " at " . $_SERVER["SERVER_NAME"], $this->settings->webmaster_email);
     $email->set_message_fields($replace);
     $email->message($message);
     return $email->send($user["email"], $user["fullname"]);
 }
示例#7
0
 public function sign_up($data)
 {
     $data = strtr($data, "_-:", "/+=");
     if (($data = base64_decode($data)) === false) {
         return false;
     }
     $aes = new AES256($this->settings->secret_website_code);
     if (($data = $aes->decrypt($data)) === false) {
         return false;
     }
     if (($data = json_decode($data, true)) === false) {
         return false;
     }
     if ($data["timestamp"] + HOUR < time()) {
         return false;
     }
     $signature = $data["signature"];
     unset($data["signature"]);
     if ($this->get_signature($data) != $signature) {
         return false;
     }
     if ($this->valid_signup($data) == false) {
         return false;
     }
     $user = array("id" => null, "organisation_id" => 1, "username" => $data["username"], "password" => hash_password($data["password"], $data["username"]), "one_time_key" => null, "status" => USER_STATUS_ACTIVE, "fullname" => $data["fullname"], "email" => $data["email"]);
     if ($this->db->query("begin") == false) {
         return false;
     }
     if ($this->db->insert("users", $user) == false) {
         $this->db->query("rollback");
         return false;
     }
     $user_id = $this->db->last_insert_id;
     if ($this->db->query("insert into user_role values (%d, %d)", $user_id, USER_ROLE_ID) == false) {
         $this->db->query("rollback");
         return false;
     }
     $email = new email("New account registered at " . $_SERVER["SERVER_NAME"], $this->setttings->webmaster_email);
     $email->set_message_fields(array("FULLNAME" => $data["fullname"], "EMAIL" => $data["email"], "USERNAME" => $data["username"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "IP_ADDR" => $_SERVER["REMOTE_ADDR"]));
     $email->message(file_get_contents("../extra/account_registered.txt"));
     $email->send($this->settings->webmaster_email);
     return $this->db->query("commit") !== false;
 }
示例#8
0
 private function send_notification($weblog_id, $comment)
 {
     if (($weblog = $this->db->entry("weblogs", $weblog_id)) === false) {
         return false;
     } else {
         if (($author = $this->db->entry("users", $weblog["user_id"])) === false) {
             return false;
         }
     }
     $weblog_url = "http://" . $_SERVER["SERVER_NAME"] . "/" . $this->page->module . "/" . $weblog_id;
     $cms_url = "http://" . $_SERVER["SERVER_NAME"] . "/cms/weblog/" . $weblog_id;
     if (($key = one_time_key($this->db, $author["id"])) !== false) {
         $cms_url .= "?login="******"<body>" . "<p>The following comment has been added to your weblog post on the '" . $this->settings->head_title . "' website.</p>" . "<p>\"<i>" . $comment . "</i>\"</p>" . "<p>Click <a href=\"" . $weblog_url . "\">here</a> to visit the weblog page or <a href=\"" . $cms_url . "\">here</a> to visit the weblog CMS page.</p>" . "</body>";
     $email = new email("Weblog comment posted", $this->settings->webmaster_email);
     $email->message($message);
     $email->send($author["email"], $author["fullname"]);
 }
示例#9
0
 public function send_contact($contact)
 {
     $email = new email("Contact information - " . $_SERVER["SERVER_NAME"], $contact["email"], $contact["name"]);
     $email->message("The following contact information has been sent via the " . $_SERVER["SERVER_NAME"] . " website:\n\n" . "Name:      " . $contact["name"] . "\n" . "E-mail:    " . $contact["email"] . "\n" . "Telephone: " . $contact["telephone"] . "\n" . "Comment:   " . $contact["comment"] . "\n");
     return $email->send($this->settings->contact_email);
 }