break; case 'message_send': if (!$_userid) { wap_msg($L['please_login'], 'index.php?moduleid=' . $moduleid . '&action=login'); } if ($submit) { require DT_ROOT . '/include/post.func.php'; require DT_ROOT . '/module/member/message.class.php'; $do = new message(); $message = array(); $message['typeid'] = 0; $message['touser'] = $touser; $message['title'] = $title; $message['content'] = $content; $message = convert($message, 'utf-8', DT_CHARSET); if ($do->send($message)) { wap_msg($L['send_success'], 'index.php?moduleid=' . $moduleid . '&action=message'); } else { wap_msg($do->errmsg); } } else { $head_title = $L['send_message'] . $DT['seo_delimiter'] . $head_title; $touser = isset($touser) ? trim($touser) : ''; $title = isset($title) ? trim($title) : ''; $content = isset($content) ? trim($content) : ''; if ($TP == 'touch') { $head_link = 'index.php?moduleid=' . $moduleid . '&action=message'; $back_link = 'javascript:Dback(\'' . $head_link . '\');'; } include template('message_send', $TP); }
public function send() { global $USER, $DB; $context = $this->dialogue->context; $conversationid = $this->conversation->conversationid; // check permission if ($USER->id != $this->_authorid or !has_capability('mod/dialogue:reply', $context)) { throw new \moodle_exception("This doesn't belong to you!"); } $sql = "SELECT MAX(dm.conversationindex)\n FROM {dialogue_messages} dm\n WHERE dm.conversationid = :conversationid"; $params = array('conversationid' => $conversationid); // get last conversation index $index = $DB->get_field_sql($sql, $params); // increment index $index++; // set the conversation index, important for order of display $DB->set_field('dialogue_messages', 'conversationindex', $index, array('id' => $this->_messageid)); parent::send(); }
if (IsInjected($visitor_email)) { echo "Bad email value!"; exit(1); } $email_from = '*****@*****.**'; //<== update the email address $email_subject = "New Form submission"; $email_body = "You have received a new message from the user {$name} with email id {$visitor_email} \n" . "Here is the message:\n {$message} \n\n\n" . ($to = "*****@*****.**"); //<== update the email address try { $message = new message(); $message->setSender($email_from); $message->addTo($to); $message->setSubject($email_subject); $message->setTextBody($email_body); $message->send(); } catch (InvalidArgumentException $e) { // To add } //mail() not supported on GAE //mail($to,$email_subject,$email_body,$headers); //done. redirect to main page. header('Location: index.php'); exit(0); // Function to validate against any email injection attempts function IsInjected($str) { $injections = array('(\\n+)', '(\\r+)', '(\\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)'); $inject = join('|', $injections); $inject = "/{$inject}/i"; if (preg_match($inject, $str)) {
public function notifyOutbid() { require_once 'message_class.php'; $notifymessage = new message(); $messageinfo = array(); $messageinfo['content'] = "Alert! You have been outbid on the task <a href='/ViewTask.php?id=" . $this->taskid . "'>" . $this->title . "</a>!"; $messageinfo['taskID'] = $this->taskid; $messageinfo['receiverID'] = $this->getBidLeaderID(); $messageinfo['isSystem'] = true; $notifymessage->send($messageinfo); return 1; }
<?php require_once 'php/message_class.php'; if (session_status() == PHP_SESSION_NONE) { session_start(); } if (!isset($_SESSION['userid'])) { die; } //requires POST['receiverID'] and POST['content'] //This is called from AJAX so we don't need to bother with the rest of the page if (isset($_GET['submit'])) { $outmessage = new message(); $outmessage->send($_GET); $outmessages = array(); array_push($outmessages, $outmessage); printMessages($outmessages); die; } require_once 'php/user_class.php'; require_once 'php/message_lister.php'; //AJAX call to get new message content if (isset($_GET['getConvos'])) { $convoUsers = array(); $convoUsers = getConversationList(); foreach ($convoUsers as $user) { ?> <tr onclick="window.document.location='Messaging.php?UserID=<?php echo $user->userid; ?> ';">
<?php require "classes/message.php"; try { $email = new message(); //$email = new message("*****@*****.**","Новая заявка с сайта 'TopSnab'", trim($_POST["fullName"]), trim($_POST["phone"]),trim($_POST['view'])); $email->to = "*****@*****.**"; $email->from = "Новая заявка с сайта 'TopSnab'"; $email->name = trim($_POST["fullName"]); $email->phone = trim($_POST["phone"]); $email->description = trim($_POST['view']); $email->theme = "Content-type: text/plain; charset=\"utf-8\"\n From: {$email->from}"; if ($email->send() > 0) { echo "Сообщение отправилось успешно"; } } catch (Exception $e) { echo "Exception=" . $e; }
public function send() { global $USER, $DB; $cm = $this->dialogue->cm; $course = $this->dialogue->course; $incomplete = (empty($this->_bulkopenrule) and empty($this->_participants) or empty($this->_subject) or empty($this->_body)); if ($incomplete) { throw new \moodle_exception("Incomplete conversation cannot send!"); } if (!empty($this->_bulkopenrule)) { // clearout participants as this is now a template which will be copied $this->_state = dialogue::STATE_BULK_AUTOMATED; // update state to bulk automated $DB->set_field('dialogue_messages', 'state', $this->_state, array('id' => $this->_messageid)); return true; } parent::send(); }
<?php require_once 'message_class.php'; $message = new message(); $error = $message->send($_POST); if ($error == null) { $error['Success'] = true; } echo json_encode($error);