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


PHP send_message函数代码示例

本文整理汇总了PHP中send_message函数的典型用法代码示例。如果您正苦于以下问题:PHP send_message函数的具体用法?PHP send_message怎么用?PHP send_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: message_post

function message_post(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $replyto = x($_POST, 'replyto') ? notags(trim($_POST['replyto'])) : '';
    $subject = x($_POST, 'subject') ? notags(trim($_POST['subject'])) : '';
    $body = x($_POST, 'body') ? escape_tags(trim($_POST['body'])) : '';
    $recipient = x($_POST, 'messageto') ? intval($_POST['messageto']) : 0;
    $ret = send_message($recipient, $body, $subject, $replyto);
    switch ($ret) {
        case -1:
            notice(t('No recipient selected.') . EOL);
            break;
        case -2:
            notice(t('Unable to locate contact information.') . EOL);
            break;
        case -3:
            notice(t('Message could not be sent.') . EOL);
            break;
        case -4:
            notice(t('Message collection failure.') . EOL);
            break;
        default:
            info(t('Message sent.') . EOL);
    }
}
开发者ID:nextgensh,项目名称:friendica,代码行数:28,代码来源:message.php

示例2: dosendMessage

 function dosendMessage()
 {
     $myenid = session('user_en_id');
     $itenid = I('post.en_id');
     $this->itenid = $itenid;
     send_message($myenid, $itenid, I('post.content'), 0);
     //发送消息
 }
开发者ID:ph1074384349,项目名称:chat,代码行数:8,代码来源:MessageController.class.php

示例3: addPost

 public function addPost()
 {
     if (!isset($_SESSION['user_id'])) {
         redirect(U('Login/index'));
         die;
     }
     if (!$this->isPost()) {
         $category = M('category')->select();
         $this->category = $category;
         $this->display();
         die;
     }
     $category_id = $this->_post('category_id');
     $parent_id = $this->_post('parent_id');
     //p($_POST);die;
     $post = array('category_id' => $category_id, 'parent_id' => $parent_id, 'title' => $this->_post('title'), 'body' => $this->_post('body'), 'time' => time(), 'update_time' => time(), 'user_id' => session('user_id'));
     //检测category_id是否存在
     if (!M('category')->where(array('category_id' => $category_id))->find()) {
         $this->error('请选择分类失败');
     }
     //p($post);die;
     $db = M('post');
     $post_id = $db->add($post);
     if ($post_id) {
         //消息发送处理
         if ($parent_id != 0) {
             //不等于0说明是跟帖,发送消息
             $user_id = M('post')->where(array('post_id' => $parent_id))->getField('user_id');
             //获取楼主的ID
             if ($user_id != session('user_id')) {
                 //不是自己跟帖
                 $text = $this->_post('body');
                 send_message($user_id, $post_id, $text);
             }
             //更新楼主帖子的更新时间
             $update_time = array('post_id' => $parent_id, 'update_time' => time());
             M('post')->save($update_time);
         }
         //保存图片路径
         if (isset($_POST['picture'])) {
             $db = M('picture');
             $picture = array();
             foreach ($_POST['picture'] as $key => $value) {
                 $picture = array('post_id' => $post_id, 'picture' => $value);
                 $db->add($picture);
             }
         }
         if ($parent_id == 0) {
             $this->success('发表成功', U('Post/index', array('post_id' => $post_id)));
         } else {
             $this->success('发表成功', U('Post/index', array('post_id' => $parent_id)));
         }
     } else {
         $this->error('发表失败' . $db->getDbError());
     }
 }
开发者ID:luojiangtao,项目名称:putishui,代码行数:56,代码来源:PostAction.class.php

示例4: edit

 function edit($post)
 {
     global $DT_PRE, $_username, $DT_TIME, $GROUP, $L;
     $item = $this->get_one();
     $user = $item['username'] ? userinfo($item['username']) : array();
     $gsql = $msql = $csql = '';
     $gsql = "edittime={$DT_TIME},editor='{$_username}',status={$post['status']},note='{$post['note']}'";
     if ($post['status'] == 1) {
         //reject
         if ($user) {
             if ($post['message'] && $post['content']) {
                 send_message($user['username'], lang($L['grade_fail'], array($GROUP[$item['groupid']]['groupname'])), nl2br($post['content']));
                 $gsql .= ",message=1";
             }
             if ($item['amount']) {
                 money_add($item['username'], $item['amount']);
                 money_record($item['username'], $item['amount'], $L['in_site'], 'system', $L['grade_title'], $L['grade_return']);
             }
         }
     } else {
         if ($post['status'] == 2) {
             //
         } else {
             if ($post['status'] == 3) {
                 if ($user) {
                     if (isset($post['pay']) && $post['pay']) {
                         if ($user['money'] < $post['pay']) {
                             return $this->_($L['grade_pass_balance']);
                         } else {
                             money_add($item['username'], -$post['pay']);
                             money_record($item['username'], -$post['pay'], $L['in_site'], 'system', $L['grade_title'], $L['grade_upto'] . $GROUP[$item['groupid']]['groupname']);
                         }
                     }
                     $msql = $csql = "groupid={$item['groupid']},company='{$item['company']}'";
                     $vip = $GROUP[$item['groupid']]['vip'];
                     $csql .= ",vip={$vip},vipt={$vip}";
                     if (isset($post['pay'])) {
                         $csql .= ",fromtime=" . strtotime($post['fromtime']) . ",totime=" . strtotime($post['totime']) . ",validtime=" . strtotime($post['validtime']) . ",validator='{$post['validator']}',validated={$post['validated']}";
                     }
                     if ($post['message'] && $post['content']) {
                         send_message($user['username'], lang($L['grade_success'], array($GROUP[$item['groupid']]['groupname'])), nl2br($post['content']));
                         $gsql .= ",message=1";
                     }
                 }
             }
         }
     }
     $this->db->query("UPDATE {$this->table} SET {$gsql} WHERE itemid={$this->itemid}");
     if ($msql) {
         $this->db->query("UPDATE {$DT_PRE}member SET {$msql} WHERE userid={$item['userid']}");
     }
     if ($csql) {
         $this->db->query("UPDATE {$DT_PRE}company SET {$csql} WHERE userid={$item['userid']}");
     }
     return true;
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:56,代码来源:grade.class.php

示例5: message_to_clan

function message_to_clan($p_message)
{
    $error = null;
    $user_id = self_char_id();
    $clan_id = get_clan_by_player_id($user_id)->getID();
    $clan_members = query_resultset("SELECT player_id, uname\n\t    FROM clan JOIN clan_player ON _clan_id = clan_id JOIN players ON player_id = _player_id\n\t    WHERE clan_id = :clan", array(':clan' => $clan_id));
    $messaged_to = array();
    foreach ($clan_members as $loop_member) {
        send_message($user_id, $loop_member['player_id'], $p_message, $type = 1);
        $messaged_to[] = $loop_member['uname'];
    }
    return implode(', ', $messaged_to);
}
开发者ID:reillo,项目名称:ninjawars,代码行数:13,代码来源:lib_message.php

示例6: broadcast

function broadcast()
{
    $num_sent = 0;
    for ($n = 0; $n < 20;) {
        $regIDs = '';
        foreach (get_regIDs() as $k => $v) {
            $regIDs .= ',"' . $k . '"';
        }
        $regIDs = substr($regIDs, 1);
        if (send_message(API_KEY, $regIDs)) {
            $n++;
        }
        sleep(15);
    }
}
开发者ID:ghosta3,项目名称:programming_chrome_apps,代码行数:15,代码来源:gcmv2-bus.php

示例7: message_post

function message_post(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $replyto = x($_REQUEST, 'replyto') ? notags(trim($_REQUEST['replyto'])) : '';
    $subject = x($_REQUEST, 'subject') ? notags(trim($_REQUEST['subject'])) : '';
    $body = x($_REQUEST, 'body') ? escape_tags(trim($_REQUEST['body'])) : '';
    $recipient = x($_REQUEST, 'messageto') ? intval($_REQUEST['messageto']) : 0;
    // Work around doubled linefeeds in Tinymce 3.5b2
    /*	$plaintext = intval(get_pconfig(local_user(),'system','plaintext') && !feature_enabled(local_user(),'richtext'));
    	if(! $plaintext) {
    		$body = fix_mce_lf($body);
    	}*/
    $plaintext = intval(!feature_enabled(local_user(), 'richtext'));
    if (!$plaintext) {
        $body = fix_mce_lf($body);
    }
    $ret = send_message($recipient, $body, $subject, $replyto);
    $norecip = false;
    switch ($ret) {
        case -1:
            notice(t('No recipient selected.') . EOL);
            $norecip = true;
            break;
        case -2:
            notice(t('Unable to locate contact information.') . EOL);
            break;
        case -3:
            notice(t('Message could not be sent.') . EOL);
            break;
        case -4:
            notice(t('Message collection failure.') . EOL);
            break;
        default:
            info(t('Message sent.') . EOL);
    }
    // fake it to go back to the input form if no recipient listed
    if ($norecip) {
        $a->argc = 2;
        $a->argv[1] = 'new';
    } else {
        goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
    }
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:46,代码来源:message.php

示例8: addComment

 public function addComment()
 {
     if (!$this->isPost()) {
         $this->error('不给你看');
     }
     $body = $this->_post('body');
     $post_id = $this->_post('post_id');
     $comment = array('post_id' => $post_id, 'body' => $body, 'time' => time(), 'user_id' => session('user_id'));
     //p($comment);die;
     if (M('comment')->add($comment)) {
         //消息发送处理
         $user_id = M('post')->where(array('post_id' => $post_id))->getField('user_id');
         //获帖子主人的ID
         if (isset($_POST['get_message_user_id']) && $_POST['get_message_user_id'] != $user_id && $_POST['get_message_user_id'] && $_POST['get_message_user_id'] != session('user_id')) {
             //点击了回复某人,并且不是层主
             if ($user_id != $_SESSION['user_id'] && $_POST['get_message_user_id'] != session('user_id')) {
                 send_message($user_id, $post_id, $body);
             }
             send_message($_POST['get_message_user_id'], $post_id, $body);
         } else {
             if ($user_id != $_SESSION['user_id'] && $_POST['get_message_user_id'] != session('user_id')) {
                 send_message($user_id, $post_id, $body);
             }
         }
         //更新楼主帖子的更新时间
         $post = M('post')->where(array('post_id' => $post_id))->find();
         $parent_post_id = M('post')->where(array('post_id' => $post['parent_id']))->getField('post_id');
         $update_time = array('post_id' => $parent_post_id, 'update_time' => time());
         M('post')->save($update_time);
         $user = M('user')->where(array('user_id' => session('user_id')))->find();
         $html = '';
         $html .= "<div class='row'>\n                            <br><div class='col-xs-1'></div>\n                            <div class='col-xs-1 qianhui'>";
         if ($user['face']) {
             $html .= "<a target='_blank' href='" . U('User/index', array('user_id' => $user['user_id'])) . "'>\n                                        <img src='" . __ROOT__ . "/Uploads/face/" . $user['face'] . "' width='50px' height='50px' alt=''></a>";
         } else {
             $html .= "<a target='_blank' href='" . U('User/index', array('user_id' => $user['user_id'])) . "'>\n                \t<img src='" . __ROOT__ . "/Public/Index/images/no_face.jpg' width='50px' height='50px' alt=''>\n                \t</a>";
         }
         $time = time_format(time());
         $html .= " </div>\n                            <div class='col-xs-10 qianhui'>\n                                <p>\n                                <a target='_blank' href='" . U('User/index', array('user_id' => $user['user_id'])) . "'>" . $user['username'] . "</a>:" . $body . "</p>\n                                <p class='text-muted text-right'>\n                                    " . $time . " \n                                    <span class='glyphicon glyphicon glyphicon-comment'></span>\n                                </p>\n                            </div>\n                            <hr>\n                        </div>";
         echo $html;
         die;
     } else {
         echo 0;
     }
 }
开发者ID:luojiangtao,项目名称:putishui,代码行数:45,代码来源:CommentAction.class.php

示例9: message_to_clan

function message_to_clan($message)
{
    global $sql;
    $error = null;
    $user_id = get_user_id();
    $username = get_username();
    $clan = getClan($username);
    $sql->Query("SELECT player_id, uname from players where clan = '" . sql($clan) . "'");
    $clan_members = $sql->fetchAll();
    $messaged_to = '';
    $comma = '';
    foreach ($clan_members as $loop_member) {
        send_message($user_id, $loop_member['player_id'], "CLAN: " . $message);
        $messaged_to .= $comma . $loop_member['uname'];
        $comma = ', ';
    }
    return $messaged_to;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:18,代码来源:lib_message.php

示例10: render_clan_join

function render_clan_join($process = null, $username, $clan_name)
{
    $sql = new DBAccess();
    if ($process == 1) {
        $confirm = $sql->QueryItem("SELECT confirm FROM players WHERE uname = '{$username}'");
        $url = message_url("clan_confirm.php?clan_joiner=" . rawurlencode($username) . "&confirm={$confirm}&clan_name=" . rawurlencode($clan_name), 'Confirm Request');
        $join_request_message = "CLAN JOIN REQUEST: {$username} has sent you a clan request.\n            If you wish to allow this ninja into your clan click the following link:\n            {$url}";
        send_message(get_user_id($username), get_user_id($clan_name), $join_request_message);
        echo "<div>***Your request to join this clan has been sent to {$clan_name}***</div>\n";
    } else {
        //Clan Join list of available Clans
        $clan_leaders = $sql->FetchAll("SELECT uname,level,clan,clan_long_name FROM players\n            WHERE lower(uname) = lower(clan) AND clan_long_name != '' AND confirmed = 1");
        echo "<p>Clans Available to Join</p>\n        <p>To send a clan request click on that clan leader's name.</p>\n        <ul>";
        foreach ($clan_leaders as $leader) {
            echo "<li><a href=\"clan.php?command=join&clan_name={$leader['clan']}&process=1\">\n                    Join {$leader['clan_long_name']}</a>.\n                    Its leader is <a href=\"player.php?player=" . rawurlencode($leader['uname']) . "\">\n                    {$leader['uname']}</a>, level {$leader['level']}.\n                    <a href=\"clan.php?command=view&clan_name={$leader['clan']}\">View This Clan</a>\n                </li>\n";
        }
        echo "</ul>";
    }
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:19,代码来源:lib_clan.php

示例11: send_message

 public function send_message()
 {
     $recipient = 1;
     if (isset($_POST['recipient'])) {
         $recipient = $_POST['recipient'];
     }
     if (isset($_POST['author'])) {
         $author = $_POST['author'];
     } else {
         //if sent username instead
         if (isset($_POST['username'])) {
             $author_data = get_user_by('login', $_POST['username']);
             $author = $author_data->ID;
         } else {
             return array("result" => "NOK", "message" => "Missing parameters");
         }
     }
     send_message($author, $_POST['message_string'], $recipient);
     return array("result" => "OK", "message" => "Message sent!");
 }
开发者ID:nickhargreaves,项目名称:WP_GCM_Chat,代码行数:20,代码来源:json-api-gcm-controller.php

示例12: send_to_recipients

function send_to_recipients($recipients, $message, $sch_id)
{
    global $scheduler_id;
    global $complete;
    $results = array();
    $scheduler_id = $sch_id;
    //die( json_encode($recipients) );
    if (isset($recipients->values)) {
        foreach ($recipients->values as $recipient) {
            $result = send_message($recipient, $message);
            array_push($results, $result);
        }
        if ($complete) {
            complete_schedule($sch_id, "CMP");
        } else {
            complete_schedule($sch_id, "FLD");
        }
        //If all number(s) fail, scheduler status is failed
        return $results;
    }
}
开发者ID:phanihinuku,项目名称:SCS,代码行数:21,代码来源:scheduler_functions.php

示例13: send_notice

function send_notice($username, $subject, $body)
{
    global $DT, $msg, $eml, $sms, $wec;
    if (!$username || !$subject || !$body) {
        return;
    }
    if (isset($msg)) {
        send_message($username, $subject, $body);
    }
    if (isset($wec)) {
        send_weixin($username, $subject);
    }
    if (isset($eml) || isset($sms)) {
        $user = userinfo($username);
        if (isset($eml)) {
            send_mail($user['email'], $subject, $body);
        }
        if (isset($sms)) {
            send_sms($user['mobile'], $subject . $DT['sms_sign']);
        }
    }
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:22,代码来源:index.inc.php

示例14: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     User::unguard();
     $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'phone' => $data['phone'], 'password' => bcrypt($data['password'])]);
     User::reguard();
     $role = new UserRole();
     $role->user_id = $user->id;
     $role->role_id = 2;
     $role->save();
     /**
      * Send a welcome message
      */
     $message = "Hi " . $data['name'] . ". Your account has been activated. Have a good day";
     send_message($data['phone'], $message);
     /**
      * Send email for account creation
      */
     Mail::send('emails.register', compact('user'), function ($message) use($user) {
         $message->from(get_option('sent_from'), get_option('app'));
         $message->to($user->email, $user->name)->subject(get_option('app') . ' Registration Successful');
     });
     return $user;
 }
开发者ID:soarmorrow,项目名称:grabage-collector,代码行数:29,代码来源:Registrar.php

示例15: sprintf

                //ensure don't go over the limit
                if ($this_ship['is_warship'] == 1) {
                    $target_ship_count['warships']++;
                } else {
                    $target_ship_count['other_ships']++;
                }
                $transfer_counter++;
            }
        }
        $text .= sprintf($st[747], $transfer_counter, $num_ships) . "<p />" . $loop_txt;
        if ($transfer_counter > 0) {
            $total_cost = $cost_per_transfer * $transfer_counter;
            $text .= "<p />{$st['7480']} {$total_cost} " . $cw['credits'];
            take_cash($total_cost);
            post_news("<b class='b1'>" . sprintf($st[748], $user[login_name], $transfer_counter, $target[login_name]), "ship");
            send_message($target['login_id'], sprintf($st[749], $transfer_counter, $user[login_name]));
            insert_history($user['login_id'], sprintf($st[750], $transfer_counter, $target[login_name]));
        }
    }
    print_page($cw['transfer_ship'], $text);
}
$text .= sprintf($st[751], $target[login_name]) . "<br /><br />";
$text .= "<b class='b1'>" . $st[752] . "<br />";
$text .= "<form action=send_ship.php method=POST name=transfer_ships><table>";
db("select ship_name, class_name, location, fighters, max_fighters, shields, max_shields, armour, max_armour, config, ship_id from {$db_name}_ships where login_id = '{$user['login_id']}' && ship_id != '{$user['ship_id']}' order by class_name");
$ships = dbr(1);
if (!isset($ships)) {
    #ensure there are some ships to display
    $text .= $st[753];
} else {
    $text .= make_table(array("Nom du vaisseau", "Type de vaisseau", "Emplacement", "Chasseurs", "Boucliers", "Coques", "Configuration"));
开发者ID:nilsine,项目名称:Astra-Vires,代码行数:31,代码来源:send_ship.php


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