当前位置: 首页>>代码示例>>PHP>>正文


PHP Message::add_message方法代码示例

本文整理汇总了PHP中Message::add_message方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::add_message方法的具体用法?PHP Message::add_message怎么用?PHP Message::add_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message::add_message方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: internalMessage

 private function internalMessage($recipient, $requester)
 {
     $subject = $this->message_obj->message['subject'];
     $message = $this->message_obj->message['message'];
     $container_html = $this->message_obj->message['template'];
     if ($container_html != 'text_only') {
         // patching up message and subject in the email container
         $message = nl2br($message);
         $email_container = new Template(PA::$config_path . "/email_containers/{$container_html}");
         $email_container->set('subject', $subject);
         $email_container->set('message', $message);
         // actual message to be sent through the mail
         $body = $email_container->fetch();
     } else {
         $body = $message;
     }
     Message::add_message($requester, null, $recipient, $subject, $body);
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:18,代码来源:MessageDispatcher.class.php

示例2: foreach

 foreach ($login_names as $login_name) {
     try {
         $User = new User();
         $User->load($login_name);
         $valid_recipients['id'][] = $User->user_id;
         $valid_recipients['name'][] = $User->login_name;
         $valid_recipients['fname'][] = $User->first_name;
         $valid_recipients['email'][] = $User->email;
     } catch (PAException $e) {
         $invalid_recipients[] = $login_name;
     }
 }
 $message = null;
 if (count($valid_recipients)) {
     $is_draft = FALSE;
     Message::add_message($login_uid, $valid_recipients['id'], $valid_recipients['name'], $subject, $body, $is_draft, $in_reply_to);
     for ($counter = 0; $counter < count($valid_recipients['id']); $counter++) {
         $params = array('first_name_sender' => $_SESSION['user']['first_name'], 'first_name_recipient' => $valid_recipients['fname'][$counter], 'sender_id' => $login_uid, 'recipient_id' => $valid_recipients['id'][$counter], 'recipient_email' => $valid_recipients['email'][$counter], 'sender_url' => url_for('user_blog', array('login' => $_SESSION['user']['name'])), 'my_messages_url' => PA::$url . '/' . FILE_MYMESSAGE);
         auto_email_notification('msg_waiting', $params);
     }
     $message = 'Message sent successfully to ' . implode(",", $valid_recipients['name']) . '<br />';
 }
 if (count($invalid_recipients)) {
     //some of the recipients are invalid. So displaying the error message for them.
     $message .= 'Message sending failed for ' . implode(",", $invalid_recipients) . ' as user(s) doesn\'t exist';
     $error = true;
 } else {
     // message sent successfully to all the recipients. Redirecting user to inbox.
     header("Location: {$base_url}/mymessage.php?msg=message_sent");
     exit;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:addmessage.php

示例3: switch_destination

 function switch_destination($destination)
 {
     $this->no_id = "";
     if (empty($this->mail_type)) {
         $this->mail_type = '';
         //none
     }
     if (empty($this->network_owner)) {
         // sometime group_owner param passed as recepient in this var - VERY BAD!
         $net_owner = new User();
         $net_owner->load((int) PA::$network_info->owner_id);
         $this->network_owner = $net_owner->login_name;
     }
     // checking whether subject or message is set or not
     $msg_data = EmailMessages::get($this->mail_type, $this->mail_sub_msg_array);
     $this->subject = @$msg_data['subject'];
     $this->message = @$msg_data['message'];
     if (empty($this->subject)) {
         $this->subject = 'none';
     }
     if (empty($this->message)) {
         $this->message = 'Message for internal mail is under construction. <br /><br /> We\'ll back with appropriate message soon!!!';
     }
     if ($this->mail_type == 'friend_request') {
         $mail_from = $_SESSION['user']['email'];
     }
     switch ($destination) {
         case NET_EMAIL:
             //external mail
             $check = pa_mail($this->to, $this->mail_type, $this->mail_sub_msg_array, @$mail_from);
             break;
         case NET_MSG:
             //internal messageing
             Message::add_message($this->from, $this->no_id, $this->network_owner, $this->subject, $this->message);
             $sender = new User();
             $sender->load((int) $this->from);
             $sender_id = $sender->user_id;
             $sender_name = $sender->login_name;
             $recipient_id = User::map_logins_to_ids($this->network_owner);
             $_sender_url = url_for('user_blog', array('login' => $sender->login_name));
             $sender_url = "<a href=\"{$_sender_url}\">{$_sender_url}</a>";
             $my_messages_url = '<a href="' . PA::$url . '/' . FILE_MYMESSAGE . '">' . PA::$url . '/' . FILE_MYMESSAGE . '</a>';
             $recipient_obj = new User();
             foreach ($recipient_id as $key => $value) {
                 $recipient_obj->load((int) $value);
             }
             // send msg waiting blink message
             $params = array('first_name_sender' => $sender_name, 'first_name_recipient' => $recipient_obj->first_name, 'sender_id' => $sender_id, 'recipient_id' => $recipient_obj->user_id, 'recipient_email' => $recipient_obj->email, 'sender_url' => $sender_url, 'my_messages_url' => $my_messages_url, 'config_site_name' => PA::$site_name);
             auto_email_notification('msg_waiting', $params);
             break;
         case NET_BOTH:
             // via both option
             // FIXME: $mail_from seems not be set on peepagg
             try {
                 $check = pa_mail($this->to, $this->mail_type, $this->mail_sub_msg_array, @$mail_from);
             } catch (PAEXception $e) {
                 Logger::log(__FILE__ . ": pa_mail: " . $e->getMessage());
             }
             Message::add_message($this->from, $this->no_id, $this->network_owner, $this->subject, $this->message);
             $sender = new User();
             $sender->load((int) $this->from);
             $sender_id = $sender->user_id;
             $sender_name = $sender->login_name;
             $recipient_id = User::map_logins_to_ids($this->network_owner);
             $_sender_url = url_for('user_blog', array('login' => $sender->login_name));
             $sender_url = "<a href=\"{$_sender_url}\">{$_sender_url}</a>";
             $my_messages_url = '<a href="' . PA::$url . '/' . FILE_MYMESSAGE . '">' . PA::$url . '/' . FILE_MYMESSAGE . '</a>';
             $recipient_obj = new User();
             foreach ($recipient_id as $key => $value) {
                 $recipient_obj->load((int) $value);
             }
             // send msg waiting blink message
             $params = array('first_name_sender' => $sender_name, 'first_name_recipient' => $recipient_obj->first_name, 'sender_id' => $sender_id, 'recipient_id' => $recipient_obj->user_id, 'recipient_email' => $recipient_obj->email, 'sender_url' => $sender_url, 'my_messages_url' => $my_messages_url, 'config_site_name' => PA::$site_name);
             // chnaged by Martin: this is NET_BOTH, the user is already recieving it as email
             // so why do we also trigger the ms_waiting here?
             // auto_email_notification('msg_waiting', $params);
             break;
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:79,代码来源:auto_email_notify.php

示例4: add_message

 public function add_message()
 {
     $content = trim($this->input['content']);
     if (!$content) {
         $this->errorOutput(NOCONTENT);
     }
     if (!get_magic_quotes_gpc()) {
         $content = addslashes($content);
     }
     //根据发布id查询信息
     $cmid = intval($this->input['cmid']);
     if (!$cmid) {
         //非发布库内容评论要传入应用标识和模块标识
         if (!$this->input['app_uniqueid'] || !$this->input['mod_uniqueid']) {
             $this->errorOutput(NOUNIQUEID);
         }
     }
     //评论设置
     $set = $this->comment_set();
     $contentid = intval($this->input['contentid']);
     if (!$contentid) {
         $this->errorOutput(NOCONTENTID);
     }
     $display = $set['display'];
     //是否审核显示
     $max_word = $set['max_word'];
     //评论最大字数
     $login = $set['is_login'];
     //是否登录评论
     $colation = $set['colation'];
     //是否过滤
     $is_open = $set['state'];
     //评论开启关闭
     $rate = $set['rate'];
     //评论频率限制
     $allow_reply = $set['allow_reply'];
     //回复设置
     $verify_mode = $set['verify_mode'];
     //验证码
     $is_credits = $set['is_credits'];
     //未审核获取积分
     $is_credits_extra = $set['is_credits_extra'];
     //审核获取积分
     $is_diy_credits = $set['is_diy_credits'];
     //自定义积分规则
     $same_user_same_record = $set['same_user_same_record'];
     //评论功能开启/关闭
     if (!$is_open) {
         $this->errorOutput(MESSAGECLOSED);
     }
     $fid = intval($this->input['fid']);
     if ($fid && !$allow_reply) {
         $this->errorOutput(REPLYCLOSED);
     }
     //登陆评论
     if ($login) {
         if ($this->user['user_id'] < 1) {
             $this->errorOutput(NOTLOGIN);
         }
     }
     if ($max_word) {
         //评论长度判断
         $len = '';
         $len = strlen($content);
         if ($len > $max_word * 3) {
             $this->errorOutput(MAXNUM);
         }
     }
     //审核显示
     $state = $display ? 0 : 1;
     if ($app_id = $this->input['app_id']) {
         $appconfig = $this->appconfig->detail($app_id);
         if ($appconfig['comment_audit'] == 0) {
             $state = 1;
         } else {
             $state = 0;
         }
     }
     //过滤敏感词
     if ($colation && $this->settings['App_banword']) {
         include_once ROOT_PATH . 'lib/class/banword.class.php';
         $this->banword = new banword();
         $banword = $this->banword->exists($content);
         if ($banword) {
             $colation_state = '';
             if ($colation == 1) {
                 $this->errorOutput(BANWORD);
             } elseif ($colation == 2) {
                 $colation_state = 3;
             } elseif ($colation == 3) {
                 $content = $this->banword->replace($content, '*');
                 $colation_state = 0;
                 //替换后状态为未审核
             }
             //如果存在敏感词,敏感词的设置高于普通设置
             if ($colation_state) {
                 $state = $colation_state;
             }
             //记录敏感词
             $banwords = array();
//.........这里部分代码省略.........
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:comment.php

示例5: render_for_ajax

 function render_for_ajax()
 {
     $op = $this->params["op"];
     if ($op != 'paging' && empty(PA::$login_user)) {
         return __("Login required");
     }
     switch ($op) {
         case "send_message":
             // actual message sending
             do {
                 require_once PA::$path . "/web/includes/videoplay/common.php";
                 // videoplay-specific stuff
                 // TODO find a more compatoble way to generalize this from videoplay!
                 $subject = trim(strip_tags($this->params["subject"]));
                 if (empty($subject)) {
                     $this->err = "Please give your message a subject.";
                     break;
                 }
                 $body = trim($this->params["body"]);
                 if (empty($body)) {
                     $this->err = "Please enter a message!";
                     break;
                 }
                 $all_recipients = $this->params["recipients"];
                 if (empty($all_recipients)) {
                     $this->err = "The message has no recipiets!";
                     break;
                 }
                 $login_names = preg_split("/,\\s*/", $all_recipients);
                 $found = array();
                 // user id of all the valid login names
                 $valid_recipients = array();
                 // login name of all the valid login names.
                 $invalid_recipients = array();
                 // names of all the invalid recipients.
                 foreach ($login_names as $login_name) {
                     try {
                         $u = new User();
                         $u->load($login_name);
                         $valid_recipients[$u->user_id] = $u;
                         $valid_recipients['login_names'] = $u->login_name;
                         $valid_recipients['fnames'][] = $u->first_name;
                         $valid_recipients['emails'][] = $u->email;
                     } catch (PAException $e) {
                         $invalid_recipients[] = $login_name;
                     }
                 }
                 $in_reply_to = (int) $this->params['reply_to'] ? (int) $this->params['reply_to'] : 0;
                 $is_draft = FALSE;
                 // validation done - now save the comment
                 $sender_id = PA::$login_user->user_id;
                 if (count($valid_recipients)) {
                     $is_draft = FALSE;
                     // TODO: ensure that we can handle multiple recipients!
                     Message::add_message($sender_id, $valid_recipients['ids'], $valid_recipients['login_names'], $subject, $body, $is_draft, $in_reply_to);
                     // this is to ALSO send out emails
                     for ($counter = 0; $counter < count($valid_recipients['ids']); $counter++) {
                         $params = array('first_name_sender' => PA::$login_user->first_name, 'first_name_recipient' => $valid_recipients['fname'][$counter], 'sender_id' => $sender_id, 'recipient_id' => $valid_recipients['ids'][$counter], 'recipient_email' => $valid_recipients['emails'][$counter], 'sender_url' => url_for('user_blog', array('login' => PA::$login_user->login_name)), 'my_messages_url' => PA::$url . '/' . FILE_MYMESSAGE);
                         auto_email_notification('msg_waiting', $params);
                     }
                     $this->mode = "view_conversations";
                     unset($this->params['view']);
                     $this->note = __("Message sent - thank you for participating!");
                 }
                 $this->send_success = $valid_recipients;
                 $this->send_fail = $invalid_recipients;
                 if (count($invalid_recipients)) {
                     $this->err = __("Couldn't send message, some recipients are not valid.") . implode(', ', $invalid_recipients);
                     break;
                 }
             } while (0);
             break;
         default:
             // just ignore any others
             break;
     }
     return $this->render();
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:78,代码来源:ConversationModule.php

示例6: switch_destination

function switch_destination($destination)
{
    global $to, $mail_type, $mail_sub_msg_array, $from, $no_id, $network_owner, $subject, $message, $config_site_name;
    // these should be instance vars, not globals!
    $no_id = "";
    if (empty($mail_type)) {
        $mail_type = '';
        //none
    }
    // checking whether subject or message is set or not
    $msg_data = EmailMessages::get($mail_type, $mail_sub_msg_array);
    $subject = $msg_data['subject'];
    $message = $msg_data['message'];
    if (empty($subject)) {
        $subject = 'none';
    }
    if (empty($message)) {
        $message = 'Message for internal mail is under construction. <br /><br /> We\'ll back with appropriate message soon!!!';
    }
    if ($mail_type == 'friend_request') {
        $mail_from = $_SESSION['user']['email'];
    }
    switch ($destination) {
        case NET_EMAIL:
            //external mail
            $check = pa_mail($to, $mail_type, $mail_sub_msg_array, @$mail_from);
            break;
        case NET_MSG:
            //internal messageing
            Message::add_message($from, $no_id, $network_owner, $subject, $message);
            $sender = new User();
            $sender->load((int) $from);
            $sender_id = $sender->user_id;
            $sender_name = $sender->login_name;
            $recipient_id = User::map_logins_to_ids($network_owner);
            $sender_url = url_for('user_blog', array('login' => $sender->login_name));
            $my_messages_url = PA::$url . '/' . FILE_MYMESSAGE;
            $recipient_obj = new User();
            foreach ($recipient_id as $key => $value) {
                $recipient_obj->load((int) $value);
            }
            // send msg waiting blink message
            $params = array('first_name_sender' => $sender_name, 'first_name_recipient' => $recipient_obj->first_name, 'sender_id' => $sender_id, 'recipient_id' => $recipient_obj->user_id, 'recipient_email' => $recipient_obj->email, 'sender_url' => $sender_url, 'my_messages_url' => $my_messages_url, 'config_site_name' => $config_site_name);
            auto_email_notification('msg_waiting', $params);
            break;
        case NET_BOTH:
            // via both option
            // FIXME: $mail_from seems not be set on peepagg
            $check = pa_mail($to, $mail_type, $mail_sub_msg_array, @$mail_from);
            Message::add_message($from, $no_id, $network_owner, $subject, $message);
            $sender = new User();
            $sender->load((int) $from);
            $sender_id = $sender->user_id;
            $sender_name = $sender->login_name;
            $recipient_id = User::map_logins_to_ids($network_owner);
            $sender_url = url_for('user_blog', array('login' => $sender->login_name));
            $my_messages_url = PA::$url . '/' . FILE_MYMESSAGE;
            $recipient_obj = new User();
            foreach ($recipient_id as $key => $value) {
                $recipient_obj->load((int) $value);
            }
            // send msg waiting blink message
            $params = array('first_name_sender' => $sender_name, 'first_name_recipient' => $recipient_obj->first_name, 'sender_id' => $sender_id, 'recipient_id' => $recipient_obj->user_id, 'recipient_email' => $recipient_obj->email, 'sender_url' => $sender_url, 'my_messages_url' => $my_messages_url, 'config_site_name' => $config_site_name);
            auto_email_notification('msg_waiting', $params);
            break;
    }
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:67,代码来源:auto_email_notify.php

示例7: array

 $mail_message = $subject . '<br /><br />' . $message;
 $array_of_data = array('user_id' => $user->user_id, 'subject' => $mail_subject, 'message' => $mail_message, 'owner_image' => $owner_image, 'user_name' => $user->first_name, 'config_site_name' => $config_site_name);
 if (!empty($_POST['inbox'])) {
     // posting the bulletin to Inbox
     $count_user = $to_member['total_users'];
     $multiple_recipient = "";
     for ($counter = 0; $counter < $count_user; $counter++) {
         $to_uid = $to_member['users_data'][$counter]['user_id'];
         $to_name = $to_member['users_data'][$counter]['login_name'];
         $user_profile = User::load_user_profile($to_uid, $to_uid, 'notifications');
         if (!empty($user_profile)) {
             $notify = unserialize($user_profile[0]['value']);
             $destination = $notify['bulletin_sent']['value'];
             if ($destination == NET_MSG || $destination == NET_BOTH) {
                 try {
                     Message::add_message($from, $multiple_recipient, $to_name, $subject, $message);
                 } catch (PAException $e) {
                     // catch Nothing
                     // This block of code is added, so that if folder isn't exist for
                     // a user, then it skipped that user
                     // and continue to send bulletin to other users.
                 }
                 $my_messages_url = PA::$url . '/' . FILE_MYMESSAGE;
                 $sender_url = url_for('user_blog', array('login' => $user->login_name));
                 $params = array('first_name_sender' => $user->first_name, 'first_name_recipient' => $to_member['users_data'][$counter]['first_name'], 'sender_id' => $user->user_id, 'recipient_id' => $to_uid, 'recipient_email' => $to_member['users_data'][$counter]['email'], 'my_messages_url' => $my_messages_url, 'sender_url' => $sender_url, 'config_site_name' => $config_site_name);
                 auto_email_notification('msg_waiting', $params);
             }
         }
     }
 }
 if (!empty($_POST['mail'])) {
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:network_bulletins.php

示例8: send_approval_message_to_user

 private function send_approval_message_to_user($uid, $gid, $approved)
 {
     $site_name = PA::$site_name;
     $user = new User();
     $user->load((int) $uid);
     $group = Group::load_group_by_id((int) $gid);
     $group_owner_id = Group::get_owner_id((int) $gid);
     $group_owner = new User();
     $group_owner->load((int) $group_owner_id['user_id']);
     $group_name = $group->title;
     $network_name = PA::$network_info->name;
     $group_member_count = Group::get_member_count((int) $gid);
     $group_owner_name = $group_owner->login_name;
     $group_joinee = $user->login_name;
     $group_url = '<a href="' . PA::$url . PA_ROUTE_GROUP . '/gid=' . $gid . '">' . $group->title . '</a>';
     $approved_msg = $approved ? 'has approved' : 'has not approved';
     $subject = "{$group_owner_name} {$approved_msg} your request to join the \"{$group_name}\" Group";
     $msg = "\n          <br />Dear {$group_joinee},\n          <br />\n          <br />\n          <b>{$group_owner_name}</b> {$approved_msg} your request to join the \"{$group_name}\" Group on the \"{$network_name}\" network.\n          <br />\n          To view the \"{$group_name}\" Group, click on the following link: {$group_url}\n          <br />\n          There are now {$group_member_count} members in the \"{$group_name}\" Group.\n          <br />\n          Thanks,\n          The {$site_name} Team\n          <br />\n          <p>\n          Everyone at {$site_name} respects your privacy. Your information will\n          never be shared with third parties unless specifically requested by you.\n          <p/>";
     Message::add_message((int) $group_owner_id['user_id'], null, $group_joinee, $subject, $msg);
     simple_pa_mail($user->email, $subject, $msg);
     return;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:22,代码来源:GroupModerateUserModule.php

示例9: peopleaggregator_sendMessage

function peopleaggregator_sendMessage($args)
{
    $user = User::from_auth_token($args['authToken']);
    $recipients = $args['recipients'];
    $subject = $args['title'];
    $body = $args['content'];
    // actually send the message
    Message::add_message($user->user_id, NULL, $recipients, $subject, $body);
    return array('success' => TRUE);
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:10,代码来源:api_impl.php

示例10: send_message_to_user

/**
   function is added for sending the mail of Abuse report 
   parameter required - sender name, subject of mail, message ..
*/
function send_message_to_user($user_name, $suject = null, $mail_sub_msg_array)
{
    // Adding the message for newtork owner
    global $network_info, $login_uid;
    $network_name = $network_info->name;
    $report_name = $_SESSION['user']['name'];
    $config_site_name = PA::$site_name;
    $message = $mail_sub_msg_array['message'];
    $content_url = '<a href="' . $mail_sub_msg_array['content_url'] . '">' . $mail_sub_msg_array['content_url'] . '</a>';
    $delete_url = '<a href="' . $mail_sub_msg_array['delete_url'] . '">' . $mail_sub_msg_array['delete_url'] . '</a>';
    if (empty($suject)) {
        $subject = " {$config_site_name} {$report_name} has reported an abuse about some content in your network {$network_name}";
    }
    $msg = "<br>\n      {$report_name} has reported an abuse about some comment in your network {$network_name}.<br>\n      <br>\n      {$report_name} reported:<br> {$message}\n      <br>\n      Click Here {$content_url} to view that comment as well as content.\n      <br>\n      <br>\n      Click here {$delete_url} to delete that comment.\n      <br>\n      <br>\n      Thanks<br>";
    Message::add_message((int) $login_uid, null, $user_name, $subject, $msg);
    return;
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:21,代码来源:submit_abuse.php

示例11: handlePOSTPageSubmit

 /** !!
  * Takes the data submitted in the form and gets all of the useful data
  * necessary to send a message.  It takes the name that is being sent to and 
  * gets the id, email, and other assorted data.  It then sends the message and
  * tells the user what the outcome of that process is. It also makes sure the
  *  message is within the correct length.
  *
  *  @param array $request_data  The data to be operated on.
  */
 public function handlePOSTPageSubmit($request_data)
 {
     $error = false;
     if (!empty($request_data)) {
         if (isset($request_data['send'])) {
             $message = NULL;
             filter_all_post($request_data, TRUE);
             // applying input filter to the post data, this function is define in function.php
             $subject = $request_data['subject'];
             $body = $request_data['body'];
             $in_reply_to = $request_data['in_reply_to'];
             if (empty($request_data['to'])) {
                 $message = 8003;
                 $error = true;
             }
             if (strlen($body) > MAX_MESSAGE_LENGTH) {
                 $message = 8002;
                 $error = true;
             }
             if (!$error) {
                 if (empty($subject)) {
                     $subject = '[none]';
                 }
                 $login_names = preg_split("/,\\s*/", $request_data['to']);
                 $valid_recipients = array();
                 //login name of all the valid login names.
                 $invalid_recipients = array();
                 // names of all the invalid recipients.
                 foreach ($login_names as $login_name) {
                     try {
                         $User = new User();
                         $User->load($login_name);
                         $valid_recipients['id'][] = $User->user_id;
                         $valid_recipients['name'][] = $User->login_name;
                         $valid_recipients['display_name'][] = $User->display_name;
                         $valid_recipients['fname'][] = $User->first_name;
                         $valid_recipients['email'][] = $User->email;
                         $valid_recipients['user'][] = $User;
                         $notif_settings = null;
                         $recipient_profile = User::load_user_profile($User->user_id, $User->user_id, 'notifications');
                         if (!empty($recipient_profile)) {
                             $notif_settings = unserialize($recipient_profile[0]['value']);
                         }
                         $valid_recipients['notifications'][] = $notif_settings;
                     } catch (PAException $e) {
                         $invalid_recipients[] = $login_name;
                     }
                 }
                 $message = null;
                 if (count($valid_recipients)) {
                     $is_draft = FALSE;
                     // actually 'send' the message
                     Message::add_message(PA::$login_uid, $valid_recipients['id'], $valid_recipients['name'], $subject, $body, $is_draft, $in_reply_to);
                     // handle 'also send to email' and 'message_waiting_blink'
                     $valid_recipients_count = count($valid_recipients['id']);
                     for ($counter = 0; $counter < $valid_recipients_count; $counter++) {
                         if (!empty($valid_recipients['notifications'][$counter])) {
                             $rec_notif_settings = $valid_recipients['notifications'][$counter];
                             $as_email = false;
                             if (!empty($rec_notif_settings['user_send_message']['value'])) {
                                 switch ($rec_notif_settings['user_send_message']['value']) {
                                     case NET_EMAIL:
                                     case NET_BOTH:
                                         $as_email = true;
                                         PAMail::send("user_send_message", $valid_recipients['user'][$counter], PA::$login_user, array('subject' => $subject, 'message' => $body));
                                         break;
                                     default:
                                         break;
                                 }
                             }
                             // if they are not getting it in email already
                             if (empty($as_email) && !empty($rec_notif_settings['msg_waiting_blink']) && $rec_notif_settings['msg_waiting_blink'] == NET_EMAIL) {
                                 PAMail::send("msg_waiting_blink", $valid_recipients['email'][$counter], PA::$login_user, array());
                             }
                         }
                     }
                     $message = sprintf(__("Message sent successfully to %s"), implode(", ", $valid_recipients['display_name']));
                 }
                 if (count($invalid_recipients)) {
                     //some of the recipients are invalid. So displaying the error message for them.
                     $message .= sprintf(__("Message sending failed for %s  as user(s) doesn't exist"), implode(", ", $invalid_recipients));
                     $error = true;
                 } else {
                     // message sent successfully to all the recipients. Redirecting user to inbox
                     header('Location: ' . PA::$url . PA_ROUTE_MYMESSAGE . "/msg={$message}");
                     exit;
                 }
             }
             if (!empty($message)) {
                 $msg_array = array();
                 $msg_array['failure_msg'] = $message;
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:AddMessageModule.php

示例12: create

 function create()
 {
     //评论内容
     if (!$this->input['content']) {
         $this->errorOutput('请输入内容');
     }
     //评论类型  0是对发布库内容评论 1是对栏目评论
     $com_type = intval($this->input['com_type']);
     $cmid = intval($this->input['cmid']);
     if (!$cmid) {
         $this->errorOutput('请输入内容id');
     }
     $mes = new Message();
     //针对发布库内容评论
     if (!$com_type) {
         //被评论内容发布库中的id
         $mes->get_publish_content($cmid);
     } else {
         if ($com_type == 1) {
             $this->input['content_id'] = $cmid;
             $cmid = 0;
             $this->input['app_uniqueid'] = 'column';
             $this->input['mod_uniqueid'] = 'column';
         }
     }
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     /*if($this->input['groupid'] && $this->user['group_type'] >= MAX_ADMIN_TYPE)
     	 {
     		$sql = 'SELECT id, parents FROM '.DB_PREFIX.'message_node WHERE id IN('.$this->input['groupid'].')';
     		$query = $this->db->query($sql);
     		while($row = $this->db->fetch_array($query))
     		{
     		$nodes['nodes']['message_sort'][$row['id']] = $row['parents'];
     		}
     		}
     		else
     		{
     		$nodes = array('nodes'=>array('message_sort'=>array(0=>0)));
     		}
     		$this->verify_content_prms($nodes);*/
     #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点
     /********创建数据上限判断**********/
     $create_data_limit = $this->user['prms']['default_setting']['create_data_limit'];
     if ($create_data_limit) {
         $sql = "SELECT count(*) FROM " . DB_PREFIX . "message WHERE userid = " . $this->user['user_id'];
         $count = $this->db->query_first($sql);
         if ($count['count'] > $create_data_limit) {
             $this->errorOutput('您只能添加' . $create_data_limit . '条数据');
         }
     }
     $data = array('title' => $this->input['title'], 'author' => $this->input['username'], 'username' => $this->user['user_name'], 'userid' => $this->user['user_id'], 'member_id' => $this->input['member_id'], 'org_id' => $this->user['org_id'], 'content' => trim($this->input['content']), 'pub_time' => TIMENOW, 'ip' => hg_getip(), 'groupid' => $this->input['groupid'], 'site_id' => $this->input['site_id'], 'column_id' => $this->input['column_id'], 'contentid' => $this->input['content_id'], 'cmid' => $cmid, 'app_uniqueid' => $this->input['app_uniqueid'], 'mod_uniqueid' => $this->input['mod_uniqueid'], 'state' => $this->get_status_setting('create'), 'content_title' => $this->input['content_title'], 'content_url' => $this->input['content_url']);
     $res = $mes->add_message($data);
     if ($res) {
         //更新内容评论计数,除了栏目评论
         if ($res['app_uniqueid'] && $res['app_uniqueid'] != 'column' && $res['state'] == 1) {
             $this->update_comment_count($res['id'], 'audit', $res['tableame']);
         }
         $this->addLogs('添加评论', '', $res, '添加评论' . $res['id']);
         $this->addItem($res);
     }
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:62,代码来源:message_update.php


注:本文中的Message::add_message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。