本文整理汇总了PHP中notification_add函数的典型用法代码示例。如果您正苦于以下问题:PHP notification_add函数的具体用法?PHP notification_add怎么用?PHP notification_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notification_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_pid'])) {
showmessage(lang('magic/namepost', 'namepost_info_nonexistence'));
}
$_G['tid'] = $_G['gp_ptid'];
$post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous'));
$this->_check($post);
$query = DB::query("SELECT username FROM " . DB::table('common_member') . " WHERE uid='{$post['authorid']}'");
$author = daddslashes(DB::result($query, 0), 1);
$thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter'));
$posttable = getposttablebytid($post['tid']);
if ($post['first']) {
$lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : $author;
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE tid='{$post['tid']}' AND first='1'");
} else {
$lastposter = $author;
$author = $thread['author'];
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE pid='{$_G['gp_pid']}'");
}
$forum['lastpost'] = explode("\t", DB::result_first("SELECT lastpost FROM " . DB::table('forum_forum') . " WHERE fid='{$post['fid']}'"));
if ($thread['subject'] == $forum['lastpost'][1] && ($forum['lastpost'][3] == '' && $post['anonymous'])) {
$lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}";
DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='{$post['fid']}'", 'UNBUFFERED');
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET author='{$author}', lastposter='{$lastposter}' WHERE tid='{$post['tid']}'");
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']);
if ($post['authorid'] != $_G['uid']) {
notification_add($post['authorid'], 'magic', lang('magic/namepost', 'namepost_notification'), array('pid' => $_G['gp_pid'], 'tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/namepost', 'namepost_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
示例2: send
function send($uId, $recipientIds, $appId, $notification) {
global $_SGLOBAL;
//过滤黑名单中的用户
$blacklist = $result = array();
// 允许匿名发送
if ($uId) {
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('blacklist')." WHERE uid IN ('".implode("','", $recipientIds)."') AND buid='$uId'");
while($value = $_SGLOBAL['db']->fetch_array($query)) {
$blacklist[$value['uid']] = $value['uid'];
}
}
include_once(S_ROOT.'./source/function_cp.php');
foreach($recipientIds as $recipientId) {
$val = intval($recipientId);
if($val && empty($blacklist[$val])) {
$result[$val] = notification_add($val, $appId, $notification, 1);
} else {
$result[$recipientId] = null;
}
}
return new APIResponse($result);
}
示例3: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_username'])) {
showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence'));
}
$member = getuserinfo($_G['gp_username'], array('uid', 'groupid'));
$this->_check($member['groupid']);
$online = DB::fetch_first("SELECT action, lastactivity, invisible FROM " . DB::table('common_session') . " WHERE uid='{$member['uid']}'");
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']);
if ($member['uid'] != $_G['uid']) {
notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1);
}
if ($online) {
$time = dgmdate($online['lastactivity'], 'u');
if ($online['invisible']) {
showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => stripslashes($_G['gp_username']), 'time' => $time), array('showdialog' => 1));
} else {
showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => stripslashes($_G['gp_username']), 'time' => $time), array('showdialog' => 1));
}
} else {
showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => stripslashes($_G['gp_username'])), array('showdialog' => 1));
}
}
示例4: updategroupcreditlog
function updategroupcreditlog($fid, $uid)
{
global $_G;
if (empty($fid) || empty($uid)) {
return false;
}
$today = date('Ymd', TIMESTAMP);
$updategroupcredit = getcookie('groupcredit_' . $fid);
if ($updategroupcredit < $today) {
$status = DB::result_first("SELECT logdate FROM " . DB::table('forum_groupcreditslog') . " WHERE fid='{$fid}' AND uid='{$uid}' AND logdate='{$today}'");
if (empty($status)) {
DB::query("UPDATE " . DB::table('forum_forum') . " SET commoncredits=commoncredits+1 WHERE fid='{$fid}'");
DB::query("REPLACE INTO " . DB::table('forum_groupcreditslog') . " (fid, uid, logdate) VALUES ('{$fid}', '{$uid}', '{$today}')");
if (empty($_G['forum']) || empty($_G['forum']['level'])) {
$forum = DB::fetch_first("SELECT name, level, commoncredits FROM " . DB::table('forum_forum') . " WHERE fid='{$fid}'");
} else {
$_G['forum']['commoncredits']++;
$forum =& $_G['forum'];
}
if (empty($_G['grouplevels'])) {
loadcache('grouplevels');
}
$grouplevel = $_G['grouplevels'][$forum['level']];
if ($grouplevel['type'] == 'default' && !($forum['commoncredits'] >= $grouplevel['creditshigher'] && $forum['commoncredits'] < $grouplevel['creditslower'])) {
$levelid = DB::result_first("SELECT levelid FROM " . DB::table('forum_grouplevel') . " WHERE type='default' AND creditshigher<='{$forum['commoncredits']}' AND creditslower>'{$forum['commoncredits']}' LIMIT 1");
if (!empty($levelid)) {
DB::query("UPDATE " . DB::table('forum_forum') . " SET level='{$levelid}' WHERE fid='{$fid}'");
$groupfounderuid = DB::result_first("SELECT founderuid FROM " . DB::table('forum_forumfield') . " WHERE fid='{$fid}' LIMIT 1");
notification_add($groupfounderuid, 'system', 'grouplevel_update', array('groupname' => '<a href="forum.php?mod=group&fid=' . $fid . '">' . $forum['name'] . '</a>', 'newlevel' => $_G['grouplevels'][$levelid]['leveltitle']));
}
}
}
dsetcookie('groupcredit_' . $fid, $today, 86400);
}
}
示例5: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_tid'])) {
showmessage(lang('magic/sofa', 'sofa_info_nonexistence'));
}
$thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'dateline', 'subject'));
$this->_check($thread);
$firstsofa = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_threadmod') . " WHERE magicid='" . $this->magic['magicid'] . "' AND tid='{$_G['gp_tid']}'");
if ($firstsofa >= 1) {
showmessage(lang('magic/sofa', 'sofa_info_sofaexistence'), '', array(), array('login' => 1));
}
$sofamessage = lang('magic/sofa', 'sofa_text', array('actor' => $_G['member']['username'], 'time' => dgmdate(TIMESTAMP), 'magicname' => $this->magic['name']));
$dateline = $thread['dateline'] + 1;
insertpost(array('fid' => $thread['fid'], 'tid' => $_G['gp_tid'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => $dateline, 'message' => $sofamessage, 'useip' => $_G['clientip'], 'usesig' => '1'));
DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies+1, moderated='1' WHERE tid='{$_G['tid']}'", 'UNBUFFERED');
DB::query("UPDATE " . DB::table('forum_forum') . " SET posts=posts+1, todayposts=todayposts+1 WHERE fid='{$post['fid']}'", 'UNBUFFERED');
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']);
updatemagicthreadlog($_G['gp_tid'], $this->magic['magicid']);
if ($thread['authorid'] != $_G['uid']) {
notification_add($thread['authorid'], 'magic', lang('magic/sofa', 'sofa_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/sofa', 'sofa_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => 1));
}
示例6: usesubmit
function usesubmit()
{
global $_G;
if (empty($_GET['username'])) {
showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence'));
}
$member = getuserinfo($_GET['username']);
$this->_check($member['groupid']);
$online = C::app()->session->fetch_by_uid($member['uid']);
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']);
if ($member['uid'] != $_G['uid']) {
notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1);
}
if ($online) {
$time = dgmdate($online['lastactivity'], 'u');
if ($online['invisible']) {
showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1));
} else {
showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1));
}
} else {
showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => $_GET['username']), array('alert' => 'info', 'showdialog' => 1));
}
}
示例7: usesubmit
function usesubmit()
{
global $_G;
$idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : '';
if (!in_array($idtype, $this->idtypearray)) {
showmessage(lang('magic/highlight', 'highlight_info_notype'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
if (empty($_GET['id'])) {
showmessage(lang('magic/highlight', 'highlight_info_nonexistence_' . $idtype));
}
if ($idtype == 'tid') {
$info = getpostinfo($_GET['id'], $idtype, array('fid', 'authorid', 'subject'));
$this->_check($info['fid']);
magicthreadmod($_GET['id']);
C::t('forum_thread')->update($_GET['id'], array('highlight' => $_GET['highlight_color'], 'moderated' => 1));
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
$expiration = TIMESTAMP + $this->parameters['expiration'] * 3600;
updatemagicthreadlog($_GET['id'], $this->magic['magicid'], $expiration > 0 ? 'EHL' : 'HLT', $expiration);
if ($info['authorid'] != $_G['uid']) {
notification_add($info['authorid'], 'magic', lang('magic/highlight', 'highlight_notification'), array('tid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name']));
}
} elseif ($idtype == 'blogid') {
$info = getpostinfo($_GET['id'], $idtype, array('uid', 'subject'));
C::t('home_blogfield')->update($_GET['id'], array('magiccolor' => $_GET['highlight_color']));
if ($info['uid'] != $_G['uid']) {
notification_add($info['uid'], 'magic', lang('magic/highlight', 'highlight_notification_blogid'), array('blogid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name']));
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $_GET['id']);
showmessage(lang('magic/highlight', 'highlight_succeed_' . $idtype), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
示例8: _userReportType
private function _userReportType($res, $rtype, $rid, $message)
{
global $_G;
if ($rtype == 'post') {
$tid = UserReport::getTidByPid($rid);
}
$fid = intval($_GET['fid']);
$uid = intval($_GET['uid']);
$message = WebUtils::t(rawurldecode($message));
$default_url = array('user' => 'home.php?mod=space&uid=', 'post' => 'forum.php?mod=redirect&goto=findpost&ptid=' . $tid . '&pid=', 'thread' => 'forum.php?mod=viewthread&tid=', 'group' => 'forum.php?mod=group&fid=', 'album' => 'home.php?mod=space&do=album&uid=' . $uid . '&id=', 'blog' => 'home.php?mod=space&do=blog&uid=' . $uid . '&id=', 'pic' => 'home.php?mod=space&do=album&uid=' . $uid . '&picid=');
$url = '';
if ($rid && !empty($default_url[$rtype])) {
$url = $default_url[$rtype] . intval($rid);
} else {
$url = addslashes(dhtmlspecialchars(base64_decode($_GET['url'])));
$url = preg_match("/^http[s]?:\\/\\/[^\\[\"']+\$/i", trim($url)) ? trim($url) : '';
}
if (empty($url)) {
$res = $this->makeErrorInfo($res, 'report_parameters_invalid');
} else {
$urlkey = md5($url);
$message = censor(cutstr(dhtmlspecialchars(trim($message)), 200, ''));
$message = $_G['username'] . ' : ' . rtrim($message, "\\");
if ($reportid = C::t('common_report')->fetch_by_urlkey($urlkey)) {
C::t('common_report')->update_num($reportid, $message);
} else {
$data = array('url' => $url, 'urlkey' => $urlkey, 'uid' => $_G['uid'], 'username' => $_G['username'], 'message' => $message, 'dateline' => TIMESTAMP);
if ($fid) {
$data['fid'] = $fid;
}
C::t('common_report')->insert($data);
$report_receive = unserialize($_G['setting']['report_receive']);
$moderators = array();
if ($report_receive['adminuser']) {
foreach ($report_receive['adminuser'] as $touid) {
notification_add($touid, 'report', 'new_report', array('from_id' => 1, 'from_idtype' => 'newreport'), 1);
}
}
if ($fid && $rtype == 'post') {
foreach (C::t('forum_moderator')->fetch_all_by_fid($fid, false) as $row) {
$moderators[] = $row['uid'];
}
if ($report_receive['supmoderator']) {
$moderators = array_unique(array_merge($moderators, $report_receive['supmoderator']));
}
foreach ($moderators as $touid) {
$touid != $_G['uid'] && !in_array($touid, $report_receive) && notification_add($touid, 'report', 'new_post_report', array('fid' => $fid, 'from_id' => 1, 'from_idtype' => 'newreport'), 1);
}
}
}
$params['noError'] = 1;
$res = $this->makeErrorInfo($res, 'report_succeed', $params);
}
return $res;
}
示例9: send
function send($uId, $recipientIds, $appId, $notification) {
$result = array();
foreach($recipientIds as $recipientId) {
$val = intval($recipientId);
$result[$val] = notification_add($val, $appId, $notification, 1);
$number = $GLOBALS['db']->result_first('SELECT count(*) FROM '.$GLOBALS['tablepre'].'mynotice WHERE uid=\''.$val.'\' AND new=\'1\'');
updateprompt('mynotice', $val, $number);
}
return new APIResponse($result);
}
示例10: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_username'])) {
showmessage(lang('magic/showip', 'showip_info_nonexistence'));
}
$member = getuserinfo($_G['gp_username'], array('uid', 'groupid'));
$this->_check($member['groupid']);
$ip = DB::result_first("SELECT lastip FROM " . DB::table('common_member_status') . " WHERE uid='{$member['uid']}'");
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']);
if ($member['uid'] != $_G['uid']) {
notification_add($member['uid'], 'magic', lang('magic/showip', 'showip_notification'), array('magicname' => $this->magic['name']), 1);
}
showmessage(lang('magic/showip', 'showip_ip_message'), '', array('username' => stripslashes($_G['gp_username']), 'ip' => $ip), array('showdialog' => 1));
}
示例11: dsu_amucallme_output
function dsu_amucallme_output($a)
{
global $_G;
if ($_G['uid'] && in_array($_G['fid'], $this->fids)) {
$turl = "forum.php?mod=redirect&goto=findpost&ptid={$a['values']['tid']}&pid={$a['values']['pid']}";
$url = $_G["siteurl"] . $turl;
$msg = $this->message;
$reply = $_G["siteurl"] . "forum.php?mod=post&action=reply&tid={$a['values']['tid']}&repquote={$a['values']['pid']}";
if (!$msg) {
if (!function_exists('discuzcode')) {
include libfile('function/discuzcode');
}
$msg = ' ' . cutstr(strip_tags(discuzcode($_G['gp_message'], 1, 0)), 40, '...');
}
$sendmsg = lang('plugin/dsu_amucallme', 'sendmsg', array('username' => $_G['username'], 'url' => $url, 'reply' => $reply, 'message' => $msg));
$cmcost = array();
if (file_exists('./data/plugindata/dsu_amucallme.data.php')) {
require_once DISCUZ_ROOT . './data/plugindata/dsu_amucallme.data.php';
$data_f2a = dstripslashes($data_f2a);
$cmcost = $data_f2a[$_G['groupid']];
$cmcost['cost'] = $cmcost['cost'] * '-1';
}
$max = 0;
if ($cmcost['extcredits'] && $cmcost['cost']) {
$max = intval($_G['member']["extcredits{$cmcost['extcredits']}"] / $cmcost['cost']);
} else {
$max = 100;
}
if ($a['values']['tid'] && $a['values']['pid'] && $max) {
foreach ($this->usernames as $key => $val) {
if ($val && $_G['uid'] != $val && $max) {
updatemembercount($_G['uid'], array("extcredits{$cmcost['extcredits']}" => $cmcost['cost']), true, '', 0);
notification_add($val, $_G['uid'], $sendmsg, '', 0);
$max--;
}
}
foreach ($this->gusernames as $key => $val) {
if ($val && $_G['uid'] != $val && $max) {
updatemembercount($_G['uid'], array("extcredits{$cmcost['extcredits']}" => $cmcost['cost']), true, '', 0);
notification_add($val, $_G['uid'], $sendmsg, '', 0);
$max--;
}
}
}
}
}
示例12: usesubmit
function usesubmit()
{
global $_G;
if (empty($_GET['tid'])) {
showmessage(lang('magic/bump', 'bump_info_nonexistence'));
}
$thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject'));
$this->_check($thread['fid']);
C::t('forum_thread')->update($_GET['tid'], array('moderated' => 1, 'lastpost' => TIMESTAMP));
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_GET['tid']);
updatemagicthreadlog($_GET['tid'], $this->magic['magicid'], 'BMP');
if ($thread['authorid'] != $_G['uid']) {
notification_add($thread['authorid'], 'magic', lang('magic/bump', 'bump_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/bump', 'bump_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
示例13: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_tid'])) {
showmessage(lang('magic/bump', 'bump_info_nonexistence'));
}
$thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'subject'));
$this->_check($thread['fid']);
DB::query("UPDATE " . DB::table('forum_thread') . " SET lastpost='" . TIMESTAMP . "', moderated='1' WHERE tid='{$_G['gp_tid']}'");
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']);
updatemagicthreadlog($_G['gp_tid'], $this->magic['magicid'], 'BMP');
if ($thread['authorid'] != $_G['uid']) {
notification_add($thread['authorid'], 'magic', lang('magic/bump', 'bump_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/bump', 'bump_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
示例14: post_bene_invite_message
function post_bene_invite_message($params) {
global $_G;
if(!self::$isopen) return false;
list($message, $forwordURL, $threadValue) = $params['param'];
$_setting = $_G['cache']['plugin']['bene_invite'];
if(!empty($_POST['username'])) {
$_POST['users'][] = $_POST['username'];
}
$users = empty($_POST['users']) ? array() : $_POST['users'];
$coef = 1;
if(!empty($users)) {
$coef = count($users);
}
include_once libfile('function/friend');
$return = 0;
if($users) {
$newusers = $uidsarr = $membersarr = array();
if($users) {
$membersarr = C::t('common_member')->fetch_all_by_username($users);
foreach($membersarr as $aUsername=>$aUser) {
$uidsarr[] = $aUser['uid'];
}
}
if(empty($membersarr)) {
showmessage('message_bad_touser', '', array(), array('return' => true));
}
if(isset($membersarr[$_G['uid']])) {
showmessage('message_can_not_send_to_self', '', array(), array('return' => true));
}
friend_check($uidsarr);
foreach($membersarr as $key => $value) {
$thread = C::t('forum_thread')->fetch($threadValue['tid']);
notification_add($value['uid'], 'friend', lang('plugin/bene_invite', 'm1') . ' '.$_G['username'].lang('plugin/bene_invite', 'm2').$thread['subject'].lang('plugin/bene_invite', 'm3').'<span class="a"><a href="forum.php?mod=viewthread&tid='.$threadValue['tid'].'">'.lang('plugin/bene_invite', 'm4').'</a></span>');
}
}
return true;
}
示例15: onNotificationsSend
public function onNotificationsSend($uId, $recipientIds, $appId, $notification)
{
$this->getUserSpace($uId);
$result = array();
foreach ($recipientIds as $recipientId) {
$val = intval($recipientId);
if ($val) {
if ($uId) {
$result[$val] = notification_add($val, $appId, $notification) === null;
} else {
$result[$val] = notification_add($val, $appId, $notification, array(), 1) === null;
}
} else {
$result[$recipientId] = null;
}
}
return $result;
}