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)); }
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); }
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)); } }
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); } }
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)); }
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)); } }
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)); }
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; }
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); }
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)); }
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--; } } } } }
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)); }
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)); }
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; }
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; }
public function onRequestSend($uId, $recipientIds, $appId, $requestName, $myml, $type) { $now = time(); $result = array(); $type = $type == 'request' ? 1 : 0; $fields = array('typename' => $requestName, 'appid' => $appId, 'type' => $type, 'fromuid' => $uId, 'dateline' => $now); foreach ($recipientIds as $key => $val) { $hash = crc32($appId . $val . $now . rand(0, 1000)); $hash = sprintf('%u', $hash); $fields['touid'] = intval($val); $fields['hash'] = $hash; $fields['myml'] = str_replace('{{MyReqHash}}', $hash, $myml); $result[] = C::t('common_myinvite')->insert($fields, true); $note = array('from_id' => $fields['touid'], 'from_idtype' => 'myappquery'); notification_add($fields['touid'], 'myapp', 'myinvite_request', $note); } return $result; }
function usesubmit() { global $_G; if (empty($_GET['username'])) { showmessage(lang('magic/showip', 'showip_info_nonexistence')); } $member = getuserinfo($_GET['username']); $this->_check($member['groupid']); $memberstatus = C::t('common_member_status')->fetch($member['uid']); $ip = $memberstatus['lastip']; unset($memberstatus); 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' => $_GET['username'], 'ip' => $ip), array('alert' => 'info', 'showdialog' => 1)); }
function usesubmit() { global $_G; if (empty($_G['gp_tid'])) { showmessage(lang('magic/highlight', 'highlight_info_nonexistence')); } $thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'subject')); $this->_check($thread['fid']); magicthreadmod($_G['gp_tid']); DB::query("UPDATE " . DB::table('forum_thread') . " SET highlight='{$_G['gp_highlight_color']}', moderated='1' WHERE tid='{$_G['gp_tid']}'"); $this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24; $expiration = TIMESTAMP + $this->parameters['expiration'] * 3600; 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'], 'HLT', $expiration); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/stick', 'highlight_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/highlight', 'highlight_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => 1)); }
function usesubmit() { global $_G; if (empty($_GET['tid'])) { showmessage(lang('magic/close', 'close_info_nonexistence')); } $thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject')); $this->_check($thread); magicthreadmod($_GET['tid']); C::t('forum_thread')->update($_GET['tid'], array('closed' => 1, 'moderated' => 1)); $this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24; $expiration = TIMESTAMP + $this->parameters['expiration'] * 3600; usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_GET['tid']); updatemagicthreadlog($_GET['tid'], $this->magic['magicid'], $expiration > 0 ? 'ECL' : 'CLS', $expiration); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/close', 'close_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/close', 'close_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); }
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 = C::t('forum_groupcreditslog')->check_logdate($fid, $uid, $today); if (empty($status)) { C::t('forum_forum')->update_commoncredits($fid); C::t('forum_groupcreditslog')->insert(array('fid' => $fid, 'uid' => $uid, 'logdate' => $today), false, true); if (empty($_G['forum']) || empty($_G['forum']['level'])) { $forum = C::t('forum_forum')->fetch($fid); $forum = array('name' => $forum['name'], 'level' => $forum['level'], 'commoncredits' => $forum['commoncredits']); } 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'])) { $levelinfo = C::t('forum_grouplevel')->fetch_by_credits($forum['commoncredits']); $levelid = $levelinfo['levelid']; if (!empty($levelid)) { C::t('forum_forum')->update_group_level($levelid, $fid); $query = C::t('forum_forumfield')->fetch($fid); $groupfounderuid = $query['founderuid']; notification_add($groupfounderuid, 'system', 'grouplevel_update', array('groupname' => '<a href="forum.php?mod=group&fid=' . $fid . '">' . $forum['name'] . '</a>', 'newlevel' => $_G['grouplevels'][$levelid]['leveltitle'], 'from_id' => 0, 'from_idtype' => 'changeusergroup')); } } } dsetcookie('groupcredit_' . $fid, $today, 86400); } }
function usesubmit() { global $_G; if (empty($_GET['tid'])) { showmessage(lang('magic/jack', 'jack_info_nonexistence')); } $thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject', 'lastpost')); $this->_check($thread['fid']); magicthreadmod($_GET['tid']); $this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 1; $magicnum = intval($_GET['magicnum']); if (empty($magicnum) || $magicnum > $this->magic['num']) { showmessage(lang('magic/jack', 'jack_num_not_enough')); } $expiration = ($thread['lastpost'] > TIMESTAMP ? $thread['lastpost'] : TIMESTAMP) + $this->parameters['expiration'] * $magicnum * 3600; C::t('forum_thread')->update($_GET['tid'], array('lastpost' => $expiration)); usemagic($this->magic['magicid'], $this->magic['num'], $magicnum); updatemagiclog($this->magic['magicid'], '2', $magicnum, '0', 0, 'tid', $_GET['tid']); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/jack', 'jack_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/jack', 'jack_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); }
//调用检查函数将@后的内容进行验证,为UID对应的姓名相同则返回@与姓名,不相同则继续判断下一个@,没有找到匹配的最终将返回false $ValidValue = getAtName($TmpString, $TmpName, $realname); $ValidValue = trim($ValidValue); $at_friend = "space.php?uid=" . $UserId; if ($ValidValue != false) { $Message = str_replace($ValidValue, "<a href={$at_friend}>@" . $realname . "</a> ", $Message); $UserIds[] = $UserId; } } } //Add by Add by am 2013-12-07 end $arr = array('tid' => intval($Commentid), "tagid" => intval($TagId), "uid" => intval($userid), "username" => getstr($username, 15, 1, 1, 1), "message" => getstr($Message, 5000, 1, 1, 1), "ip" => getonlineip(), 'dateline' => $_SGLOBAL['timestamp'], "isthread" => 0); $pid = inserttable('post', $arr, 1); //更新统计数据 $_SGLOBAL['db']->query("UPDATE " . tname('thread') . "\r\n\tSET replynum=replynum+1, lastpost='{$_SGLOBAL['timestamp']}', lastauthor='{$username}', lastauthorid='{$userid}'\r\n\tWHERE tid='{$Commentid}'"); //通知 $note = cplang('note_thread_reply') . " <a href=\"space.php?uid={$userid}&do=thread&id={$Commentid}&pid={$pid}\" target=\"_blank\">{$thread['subject']}</a>"; notification_add($userid, 'post', $note); //统计 updatestat('post'); if ($pid) { $arrs = array('flag' => 'success'); } else { $arrs = array('flag' => 'fail'); } } } $result = json_encode($arrs); $result = preg_replace("#\\\\u([0-9a-f]+)#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $result); echo $result; exit;
$curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans']; if (submitcheck('reportsubmit')) { if ($_G['gp_reportids']) { foreach ($_G['gp_reportids'] as $reportid) { if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_report') . " WHERE id='{$reportid}' AND opuid='0'")) { $creditchange = ''; $uid = $_G['gp_reportuids'][$reportid]; if ($uid != $_G['uid']) { $msg = !empty($_G['gp_msg'][$reportid]) ? '<br />' . htmlspecialchars($_G['gp_msg'][$reportid]) : ''; if (!empty($_G['gp_creditsvalue'][$reportid])) { $credittag = $_G['gp_creditsvalue'][$reportid] > 0 ? '+' : ''; $creditchange = '<br />' . lang('forum/misc', 'report_msg_your') . $_G['setting']['extcredits'][$curcredits]['title'] . ' ' . $credittag . $_G['gp_creditsvalue'][$reportid]; updatemembercount($uid, array($curcredits => intval($_G['gp_creditsvalue'][$reportid])), true, 'RPC', $reportid); } if ($creditchange || $msg) { notification_add($uid, 'report', 'report_change_credits', array('creditchange' => $creditchange, 'msg' => $msg), 1); } } $opresult = !empty($_G['gp_creditsvalue'][$reportid]) ? $curcredits . "\t" . intval($_G['gp_creditsvalue'][$reportid]) : 'ignore'; DB::query("UPDATE " . DB::table('common_report') . " SET opuid='{$_G['uid']}', opname='{$_G['username']}', optime='" . TIMESTAMP . "', opresult='{$opresult}' WHERE id='{$reportid}'"); } } showmessage('modcp_report_success', "{$cpscript}?mod=modcp&action=report&fid={$_G['fid']}&lpp={$lpp}"); } } $rewardlist = ''; $report_reward = unserialize($_G['setting']['report_reward']); $offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10)); if ($report_reward['max'] > $report_reward['min']) { for ($vote = $report_reward['max']; $vote >= $report_reward['min']; $vote -= $offset) { if ($vote != 0) {
function IHomeServiceCreateComplainReply($params = NULL) { global $_SGLOBAL; $cpid = 0; # complain 表中的 id $relay_times = 0; if ($params['uid']) { if ($params['uid'] <= 0) { $errorMsg = array("errorNo" => "4002", "content" => "the format of parameter is not correct.the parameter uid must be a positive integer."); return json_encode($errorMsg); } else { $query = $_SGLOBAL['db']->query("select name,username from " . tname('space') . " where uid = " . $params['uid']); if ($row = $_SGLOBAL['db']->fetch_array($query)) { if ($row['name']) { $params['uname'] = $row['name']; } else { $params['uname'] = $row['username']; } } else { $errorMsg = array("errorNo" => "500", "content" => "the uid is not exist"); return json_encode($errorMsg); } } } else { $errorMsg = array("errorNo" => "4001", "content" => "lack the neccessary parameter.the parameter uid is not exist or is not a positive integer."); return json_encode($errorMsg); } $complain = array(); if ($params['complainId']) { if ($params['complainId'] <= 0) { $errorMsg = array("errorNo" => "4002", "content" => "the format of parameter is not correct.the parameter complainId must be a positive integer."); return json_encode($errorMsg); } else { $query = $_SGLOBAL['db']->query("select * from " . tname('complain') . " where doid = " . $params['complainId']); if ($complain = $_SGLOBAL['db']->fetch_array($query)) { if (isblacklist($complain['uid'])) { $errorMsg = array("errorNo" => "500", "content" => "the user of complain is in blacklist."); return json_encode($errorMsg); } } else { $errorMsg = array("errorNo" => "500", "content" => "the complain id is not exist"); return json_encode($errorMsg); } } } else { $errorMsg = array("errorNo" => "4001", "content" => "lack the neccessary parameter.the parameter complainId is not exist or is not a positive integer."); return json_encode($errorMsg); } if (!$params['message']) { $errorMsg = array("errorNo" => "4001", "content" => "lack the neccessary parameter message."); return json_encode($errorMsg); } $params['timestamp'] = time(); $doid = $params['complainId']; $message = getstr($params['message'], 480, 1, 1, 1); preg_match_all("/[@](.*)[(]([\\d]+)[)]\\s*/U", $params['message'], $matches, PREG_SET_ORDER); preg_match_all("/回复[@](.*)[(]([\\d]+)[)]\\s*/U", $params['message'], $reply_matches, PREG_SET_ORDER); if ($reply_matches) { $exclude_relay = 1; } # 如果带有回复字眼,则默认不为relay $newid = 0; $addtype = 0; $query = $_SGLOBAL['db']->query("select * from " . tname('complain') . " where doid=" . $params['complainId'] . ' and atuid=' . $params['uid']); if ($row = $_SGLOBAL['db']->fetch_array($query)) { $complain = $row; $addtype = 2; $cpid = $complain['id']; $relay_times = $complain['relay_times']; } $isrelay = 0; if ($addtype && $matches && !$exclude_relay) { $isrelay = 1; } if ($isrelay && $relay_times >= 3) { $errorMsg = array("errorNo" => "500", "content" => "relay times reach the ceiling'."); return json_encode($errorMsg); } $UserIds = array(); $relay_depid = 0; foreach ($matches as $value) { $TmpString = $value[0]; $TmpName = $value[1]; $UserId = $value[2]; $result = $_SGLOBAL['db']->query("select uid,username,name from " . tname('space') . " where uid=" . $UserId); if ($rs = $_SGLOBAL['db']->fetch_array($result)) { $realname = $rs['name']; if (empty($realname)) { $realname = $rs['username']; } $ValidValue = getAtName($TmpString, $TmpName, $realname); $ValidValue = trim($ValidValue); $at_friend = "space.php?uid=" . $UserId; if ($ValidValue != false) { $message = str_replace($ValidValue, "<a href={$at_friend}>@" . $realname . "</a> ", $message); if (!in_array($UserId, $UserIds)) { $UserIds[] = $UserId; } } } if ($isrelay) { $q = $_SGLOBAL['db']->query("select * from " . tname('powerlevel') . " where dept_uid = " . $UserId); if ($r = $_SGLOBAL['db']->fetch_array($q)) { $relay_depid = $UserId; } } } $message = preg_replace("/\\[am:(\\d+):]/is", "<img src=\"image/face_new/face_1/\\1.gif\" class=\"face\">", $message); $message = preg_replace("/\\[em:(\\d+):]/is", "<img src=\"image/face/\\1.gif\" class=\"face\">", $message); $message = preg_replace("/\\[bm:(\\d+):]/is", "<img src=\"image/face_new/face_2/\\1.gif\" class=\"face\">", $message); $message = preg_replace("/\\<br.*?\\>/is", ' ', $message); $params['message'] = $message; if (strlen($message) < 1) { $errorMsg = array("errorNo" => "4002", "content" => "the parameter message is too short'."); return json_encode($errorMsg); } if (!$addtype) { if ($UserIds) { $temp = implode(',', $UserIds); $_SGLOBAL['db']->query("UPDATE " . tname('complain') . " SET locked=0 WHERE doid= " . $params['complainId'] . " AND uid=" . $params['uid'] . " AND locked AND atuid in ({$temp})"); } $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " WHERE doid=" . $params['complainId']); $updo = $_SGLOBAL['db']->fetch_array($query); $updo['id'] = intval($updo['id']); $updo['grade'] = intval($updo['grade']); $setarr = array('doid' => $updo['doid'], 'upid' => $updo['id'], 'uid' => $params['uid'], 'username' => $params['uname'], 'dateline' => $_SGLOBAL['timestamp'], 'message' => $message, 'ip' => getonlineip(), 'grade' => $updo['grade'] + 1); if ($params['ip']) { $setarr['ip'] = $params['ip']; } else { $params['ip'] = $setarr['ip']; } if ($updo['grade'] >= 3) { $setarr['upid'] = $updo['upid']; } $newid = inserttable('docomment', $setarr, 1); $params['id'] = $newid; $params['operation'] = 0; $_SGLOBAL['db']->query("UPDATE " . tname('doing') . " SET replynum=replynum+1 WHERE doid='{$updo['doid']}'"); $note = cplang('note_complain_reply', array("space.php?do=complain_item&doid={$setarr['doid']}")); notification_add($userId, 'complain', $note); if (empty($UserIds)) { // not @ $query = $_SGLOBAL['db']->query("SELECT * FROM ihome_complain where doid=" . $updo[doid]); $value = $_SGLOBAL['db']->fetch_array($query); if ($value['from'] == $params['uid']) { //发起方 notification_add($value['atuid'], 'complain', $note); } else { notification_add($value['from'], 'complain', $note); } } unset($params['complainId']); return json_encode($params); } $optype = 2; if ($isrelay) { $optype = 3; $addtype = 0; } $oparr = array('doid' => $params['complainId'], 'message' => $params['message'], 'uid' => $params['uid'], 'username' => $params['uname'], 'optype' => $optype, 'dateline' => time(), 'opvalue' => $relay_depid, 'finish' => $addtype == 2 ? 1 : 0); $params['operation'] = $opid = inserttable('complain_op', $oparr, true); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " WHERE doid=" . $params['complainId']); $updo = $_SGLOBAL['db']->fetch_array($query); $updo['id'] = intval($updo['id']); $updo['grade'] = intval($updo['grade']); $setarr = array('doid' => $updo['doid'], 'upid' => $updo['id'], 'uid' => $params['uid'], 'username' => $params['uname'], 'dateline' => $_SGLOBAL['timestamp'], 'message' => $message, 'ip' => getonlineip(), 'grade' => $updo['grade'] + 1, 'complainBorn' => 1, 'complainopid' => $opid); if ($params['ip']) { $setarr['ip'] = $params['ip']; } else { $params['ip'] = $setarr['ip']; } if ($updo['grade'] >= 3) { $setarr['upid'] = $updo['upid']; } $params['id'] = $newid = inserttable('docomment', $setarr, 1); $_SGLOBAL['db']->query("UPDATE " . tname('doing') . " SET replynum=replynum+1 WHERE doid='{$updo['doid']}'"); if ($optype == 3) { $query = $_SGLOBAL['db']->query("select * from " . tname("space") . " where uid = {$relay_depid}"); $relay_dep = $_SGLOBAL['db']->fetch_array($query); if (empty($relay_dep)) { $errorMsg = array("errorNo" => 500, "content" => "the at user is not exist "); return json_encode($errorMsg); } updatetable('complain', array("status" => 3, 'lastopid' => $opid), array('id' => $cpid)); #status = 3 relayed $query = $_SGLOBAL['db']->query("select * from " . tname("complain") . " where doid= " . $params['complainId'] . " and atuid={$relay_depid} and status != 3"); $already = $_SGLOBAL['db']->fetch_array($query); if (!$already) { if ($complain['relayed_by']) { $relayed_by = $complain['relayed_by'] . $params['uid'] . ','; } else { $relayed_by = ',' . $params['uid'] . ','; } $newComplain = $complain; unset($newComplain['id']); $newComplain['atdeptuid'] = $relay_depid; $newComplain['atuid'] = $relay_depid; $newComplain['atuname'] = $relay_dep['name']; $newComplain['atdepartment'] = $relay_dep['name']; $newComplain['dateline'] = $_SGLOBAL['timestamp']; $newComplain['times'] = 1; $newComplain['issendmsg'] = 0; $newComplain['relay_times'] = $complain['relay_times'] + 1; $newComplain['relayed_by'] = $relayed_by; $newComplainId = inserttable('complain', $newComplain, 1); if ($complain['lastopid'] == 0) { $result = $_SGLOBAL['db']->query("select * from " . tname('complain_dep') . " where uid = " . $params['uid']); $dep = $_SGLOBAL['db']->fetch_array($result); if (empty($dep)) { $arr = array(); $arr['uid'] = $params['uid']; $arr['username'] = $params['uname']; $arr['upnum'] = 0; $arr['downnum'] = 0; $arr['allreplynum'] = 1; $arr['allreplysecs'] = $_SGLOBAL['timestamp'] - $complain['dateline']; $arr['score'] = 0; $arr['aversecs'] = 0; $arr['lastupdate'] = 0; inserttable('complain_dep', $arr); } else { $arr['allreplynum'] = $dep['allreplynum'] + 1; $arr['allreplysecs'] = $dep['allreplysecs'] + $_SGLOBAL['timestamp'] - $complain['dateline']; updatetable("complain_dep", $arr, array('uid' => $params['uid'])); } } $note = cplang('complain_relay', array($complain['atuname'], "space.php?do=complain_item&doid={$complain['doid']}")); notification_complain_add($relay_depid, 'complain', $note); } inserttable('complain_resp', array('uid' => $params['uid'], 'doid' => $doid, 'opid' => $opid, 'replysecs' => $_SGLOBAL['timestamp'] - $complain['dateline'], 'dateline' => $_SGLOBAL['timestamp'])); } else { if ($optype == 2) { if ($addtype == 2) { updatetable('complain', array('status' => 1, 'lastopid' => $opid, 'replytime' => $_SGLOBAL['timestamp'], 'dateline' => $_SGLOBAL['timestamp']), array('id' => $cpid)); } else { updatetable('complain', array('locked' => 1, 'replytime' => $_SGLOBAL['timestamp'], 'dateline' => $_SGLOBAL['timestamp']), array('id' => $cpid)); } if ($complain['lastopid'] == 0) { $result = $_SGLOBAL['db']->query("select * from " . tname('complain_dep') . " where uid =" . $params['uid']); $dep = $_SGLOBAL['db']->fetch_array($result); if (empty($dep)) { $arr = array(); $arr['uid'] = $params['uid']; $arr['username'] = $params['uname']; $arr['upnum'] = 0; $arr['downnum'] = 0; $arr['allreplynum'] = 1; $arr['allreplysecs'] = $_SGLOBAL['timestamp'] - $complain['dateline']; $arr['score'] = 0; $arr['aversecs'] = 0; $arr['lastupdate'] = 0; inserttable('complain_dep', $arr); } else { $arr['allreplynum'] = $dep['allreplynum'] + 1; $arr['allreplysecs'] = $dep['allreplysecs'] + $_SGLOBAL['timestamp'] - $complain['dateline']; updatetable("complain_dep", $arr, array('uid' => $params['uid'])); } } inserttable('complain_resp', array('uid' => $params['uid'], 'doid' => $doid, 'opid' => $opid, 'replysecs' => $_SGLOBAL['timestamp'] - $complain['dateline'], 'dateline' => $_SGLOBAL['timestamp'])); $note = cplang('note_doingcomplain_reply', array("space.php?do=complain_item&doid={$complain['doid']}")); notification_complain_add($complain['uid'], 'complain', $note, $params['uid'], $params['uname']); } } unset($params['complainId']); return json_encode($params); }
if ($uidarray) { C::t('forum_activityapply')->delete_for_thread($_G['tid'], $_GET['applyidarray']); foreach ($uidarray as $uid) { notification_add($uid, 'activity', 'activity_delete', array('tid' => $_G['tid'], 'subject' => $activity_subject, 'reason' => $reason)); } } $applynumber = C::t('forum_activityapply')->fetch_count_for_thread($_G['tid']); C::t('forum_activity')->update($_G['tid'], array('applynumber' => $applynumber)); showmessage('activity_delete_completion', "forum.php?mod=viewthread&tid={$_G['tid']}&do=viewapplylist" . ($_GET['from'] ? '&from=' . $_GET['from'] : ''), array(), array('showdialog' => 1, 'closetime' => true)); } else { if ($unverified) { $verified = $_GET['operation'] == 'replenish' ? 2 : 1; C::t('forum_activityapply')->update_verified_for_thread($verified, $_G['tid'], $_GET['applyidarray']); $notification_lang = $verified == 1 ? 'activity_apply' : 'activity_replenish'; foreach ($unverified as $uid) { notification_add($uid, 'activity', $notification_lang, array('tid' => $_G['tid'], 'subject' => $activity_subject, 'reason' => $reason)); } } $applynumber = C::t('forum_activityapply')->fetch_count_for_thread($_G['tid']); C::t('forum_activity')->update($_G['tid'], array('applynumber' => $applynumber)); showmessage('activity_auditing_completion', "forum.php?mod=viewthread&tid={$_G['tid']}&do=viewapplylist" . ($_GET['from'] ? '&from=' . $_GET['from'] : ''), array(), array('showdialog' => 1, 'closetime' => true)); } } } } elseif ($_GET['action'] == 'activityexport') { $isactivitymaster = $thread['authorid'] == $_G['uid'] || (in_array($_G['group']['radminid'], array(1, 2)) || $_G['group']['radminid'] == 3 && $_G['forum']['ismoderator'] && $_G['group']['alloweditactivity']); if (!$isactivitymaster) { showmessage('activity_is_not_manager'); } $activity = C::t('forum_activity')->fetch($_G['tid']); $postinfo = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
function invite_update($inviteid, $uid, $username, $m_uid, $m_username, $appid=0) { global $_SGLOBAL, $_SN; if($uid && $uid != $m_uid) { $friendstatus = getfriendstatus($uid, $m_uid); if($friendstatus < 1) { friend_update($uid, $username, $m_uid, $m_username, 'invite'); //查找邀请记录 $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('invite')." WHERE uid='$m_uid' AND fuid='$uid'"); if($oldinvite = $_SGLOBAL['db']->fetch_array($query)) { //已经邀请过 return false; } //奖励积分 getreward('invitefriend', 1, $m_uid, '', 0); //feed $_SGLOBAL['supe_uid'] = $m_uid; $_SGLOBAL['supe_username'] = $m_username; //实名 realname_set($uid, $username); realname_get(); if(ckprivacy('invite', 1)) { $title_template = cplang('feed_invite'); $tite_data = array('username'=>'<a href="space.php?uid='.$uid.'">'.stripslashes($_SN[$uid]).'</a>'); feed_add('friend', $title_template, $tite_data); } //通知 $_SGLOBAL['supe_uid'] = $uid; $_SGLOBAL['supe_username'] = $username; notification_add($m_uid, 'friend', cplang('note_invite')); //更新邀请 $setarr = array('fuid'=>$uid, 'fusername'=>$username, 'appid'=>$appid); if($inviteid) { updatetable('invite', $setarr, array('id'=>$inviteid)); } else { $setarr['uid'] = $m_uid; inserttable('invite', $setarr, 0, true);//插入邀请记录 } } } }
function onNotificationsSend($uId, $recipientIds, $appId, $notification) { $this->getUserSpace($uId); $result = array(); $notification = $this->_myStripslashes($notification); require_once libfile('function/notification'); foreach ($recipientIds as $recipientId) { $val = intval($recipientId); if ($val) { $result[$val] = notification_add($val, $appId, $notification, array(), 1) === null; } else { $result[$recipientId] = null; } } return $result; }
$_CORE->session->set('username', $username); dsetcookie('auth', authcode("{$_G['member']['password']}\t{$_G['uid']}", 'ENCODE'), 2592000, 1, true); if ($invite['id']) { DB::update("common_invite", array('fuid' => $uid, 'fusername' => $username, 'regdateline' => $_G['timestamp'], 'status' => 2), array('id' => $invite['id'])); updatestat('invite'); } if ($invite['uid']) { if ($_G['setting']['inviteconfig']['inviteaddcredit']) { updatemembercount($uid, array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['inviteaddcredit'])); } if ($_G['setting']['inviteconfig']['invitedaddcredit']) { updatemembercount($invite['uid'], array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['invitedaddcredit'])); } require_once libfile('function/friend'); friend_make($invite['uid'], $invite['username'], false); notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid=' . $invite['uid'] . '" target="_blank">' . $invite['username'] . '</a>'), 1); space_merge($invite, 'field_home'); if (!empty($invite['privacy']['feed']['invite'])) { require_once libfile('function/feed'); $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>'); feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']); } if ($invite['appid']) { updatestat('appinvite'); } } if ($welcomemsg && !empty($welcomemsgtxt)) { $welcomtitle = !empty($_G['setting']['welcomemsgtitle']) ? $_G['setting']['welcomemsgtitle'] : "Welcome to " . $_G['setting']['bbname'] . "!"; $welcomtitle = addslashes(replacesitevar($welcomtitle)); $welcomemsgtxt = addslashes(replacesitevar($welcomemsgtxt)); if ($welcomemsg == 1) {
if (!$_G['uid']) { showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1)); } if (in_array($thread['fid'], $_G['setting']['security_forums_white_list']) || $thread['displayorder'] > 0 || $thread['highlight'] || $thread['digest'] || $thread['stamp'] > -1) { showmessage('thread_hidden_error', NULL); } $member = C::t('common_member')->fetch($thread['authorid']); if (in_array($member['groupid'], $_G['setting']['security_usergroups_white_list'])) { showmessage('thread_hidden_error', NULL); } if (C::t('forum_forumrecommend')->fetch($thread['tid'])) { showmessage('thread_hidden_error', NULL); } C::t('forum_threadhidelog')->insert($_GET['tid'], $_G['uid']); if ($thread['hidden'] + 1 == $_G['setting']['threadhidethreshold']) { notification_add($thread['authorid'], 'post', 'thread_hidden', array('tid' => $thread['tid'], 'subject' => $thread['subject']), 1); } $thide = explode('|', $_G['cookie']['thide']); $thide = array_slice($thide, -20); if (!in_array($_GET['tid'], $thide)) { $thide[] = $_GET['tid']; } dsetcookie('thide', implode('|', $thide), 2592000); showmessage('thread_hidden_success', dreferer(), array(), array('showdialog' => true, 'closetime' => true, 'extrajs' => '<script type="text/javascript" reload="1">$(\'normalthread_' . $_GET['tid'] . '\').style.display = \'none\'</script>')); } elseif ($_GET['action'] == 'hiderecover') { if ($_GET['formhash'] != FORMHASH) { showmessage('undefined_action', NULL); } $seccodecheck = true; if (submitcheck('hiderecoversubmit')) { C::t('forum_threadhidelog')->delete_by_tid($_GET['tid']);
if (!empty($blog)) { $notify = array('url' => "home.php?mod=space&uid={$blog['uid']}&do=blog&id={$id}", 'subject' => $blog['subject']); $touid = $blog['uid']; } break; case 'tid': $thread = C::t('forum_thread')->fetch($id); if (!empty($thread)) { $notify = array('url' => "forum.php?mod=viewthread&tid={$id}", 'subject' => $thread['subject']); $touid = $thread['authorid']; } break; } if (!empty($notify)) { $notify['newurl'] = 'portal.php?mod=view&aid=' . $aid; notification_add($touid, 'pusearticle', 'puse_article', $notify, 1); } } if (trim($_GET['from']) != '') { $from_cookie = ''; $from_cookie_array = array(); $from_cookie = getcookie('from_cookie'); $from_cookie_array = explode("\t", $from_cookie); $from_cookie_array[] = $_GET['from']; $from_cookie_array = array_unique($from_cookie_array); $from_cookie_array = array_filter($from_cookie_array); $from_cookie_num = count($from_cookie_array); $from_cookie_start = $from_cookie_num - 10; $from_cookie_start = $from_cookie_start > 0 ? $from_cookie_start : 0; $from_cookie_array = array_slice($from_cookie_array, $from_cookie_start, $from_cookie_num); $from_cookie = implode("\t", $from_cookie_array);