public function onCreditSign($uId) { global $_G; if ($uId) { return updatecreditbyaction('mobileoemdaylogin', $uId) ? 1 : 0; } return 0; }
public function onUserApplicationRemove($uId, $appIds) { $result = C::t('home_userapp')->delete_by_uid_appid($uId, $appIds); C::t('home_userappfield')->delete_by_uid_appid($uId, $appIds); updatecreditbyaction('installapp', $uId, array(), $appId, -1); require_once libfile('function/cache'); updatecache('userapp'); return $result; }
function common() { global $_G; if (submitcheck('hash', true) && $_G['uid']) { $r = updatecreditbyaction('mobilesign', $_G['uid']); if ($r['updatecredit']) { $_G['messageparam'][0] = 'mobilesign_success'; } else { $_G['messageparam'][0] = 'mobilesign_failed'; } } else { $_G['messageparam'][0] = 'mobilesign_formhash_failed'; } mobile_core::result(mobile_core::variable(array())); }
function xwb_setSiteUserLogin($uid) { global $_G; if (empty($uid)) { return false; } //登录 $member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='" . $uid . "'"); if (!$member) { return false; } setloginstatus($member, time() + 60 * 60 * 24 ? 2592000 : 0); DB::query("UPDATE " . DB::table('common_member_status') . " SET lastip='" . $_G['clientip'] . "', lastvisit='" . time() . "' WHERE uid='{$uid}'"); include_once libfile('function/stat'); updatestat('login'); updatecreditbyaction('daylogin', $uid); checkusergroup($uid); return true; }
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: spacecp_avatar.php 18515 2010-11-25 07:35:31Z zhengqingpeng $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } if (submitcheck('avatarsubmit')) { showmessage('do_success', 'cp.php?ac=avatar&quickforward=1'); } loaducenter(); $uc_avatarflash = uc_avatar($_G['uid'], 'virtual', 0); if (empty($space['avatarstatus']) && uc_check_avatar($_G['uid'], 'middle')) { DB::update('common_member', array('avatarstatus' => '1'), array('uid' => $_G['uid'])); updatecreditbyaction('setavatar'); manyoulog('user', $_G['uid'], 'update'); } $actives = array('avatar' => ' class="a"'); include template("home/spacecp_avatar");
function onVideoAuthAuth($uId, $picData, $picExt = 'jpg', $isReward = false) { global $_G; $res = $this->getUserSpace($uId); if (!$res) { return new ErrorResponse('1', "User({$uId}) Not Exists"); } $pic = base64_decode($picData); if (!$pic || strlen($pic) == strlen($picData)) { $errCode = '200'; $errMessage = 'Error argument'; return new ErrorResponse($errCode, $errMessage); } $secret = md5($_G['timestamp'] . "\t" . $_G['uid']); $picDir = DISCUZ_ROOT . './data/avatar/' . substr($secret, 0, 1); if (!is_dir($picDir)) { if (!mkdir($picDir, 0777)) { $errCode = '300'; $errMessage = 'Cannot create directory'; return new ErrorResponse($errCode, $errMessage); } } $picDir .= '/' . substr($secret, 1, 1); if (!is_dir($picDir)) { if (!@mkdir($picDir, 0777)) { $errCode = '300'; $errMessage = 'Cannot create directory'; return new ErrorResponse($errCode, $errMessage); } } $picPath = $picDir . '/' . $secret . '.' . $picExt; $fp = @fopen($picPath, 'wb'); if ($fp) { if (fwrite($fp, $pic) !== FALSE) { fclose($fp); DB::update('common_member', array('videophotostatus' => 1), array('uid' => $uId)); $fields = array('videophoto' => $secret); DB::update('common_member_field_home', $fields, array('uid' => $uId)); $result = DB::affected_rows(); if ($isReward) { updatecreditbyaction('videophoto', $uId); } return $result; } fclose($fp); } $errCode = '300'; $errMessage = 'Video Auth Error'; return new ErrorResponse($errCode, $errMessage); }
function hot_update($idtype, $id, $hotuser) { global $_G; $hotusers = empty($hotuser) ? array() : explode(',', $hotuser); if ($hotusers && in_array($_G['uid'], $hotusers)) { return false; } else { $hotusers[] = $_G['uid']; $hotuser = implode(',', $hotusers); } $newhot = count($hotusers) + 1; if ($newhot == $_G['setting']['feedhotmin']) { $tablename = gettablebyidtype($idtype); $query = DB::query("SELECT uid FROM " . DB::table($tablename) . " WHERE {$idtype}='{$id}'"); $item = DB::fetch($query); updatecreditbyaction('hotinfo', $item['uid']); } switch ($idtype) { case 'blogid': DB::query("UPDATE " . DB::table('home_blogfield') . " SET hotuser='******' WHERE blogid='{$id}'"); DB::query("UPDATE " . DB::table('home_blog') . " SET hot=hot+1 WHERE blogid='{$id}'"); break; case 'picid': DB::query("REPLACE INTO " . DB::table('home_picfield') . " (picid, hotuser) VALUES ('{$id}', '{$hotuser}')"); DB::query("UPDATE " . DB::table('home_pic') . " SET hot=hot+1 WHERE picid='{$id}'"); break; case 'sid': DB::query("UPDATE " . DB::table('home_share') . " SET hot=hot+1, hotuser='******' WHERE sid='{$id}'"); break; default: return false; } $query = DB::query("SELECT feedid, friend FROM " . DB::table('home_feed') . " WHERE id='{$id}' AND idtype='{$idtype}'"); if ($feed = DB::fetch($query)) { if (empty($feed['friend'])) { DB::query("UPDATE " . DB::table('home_feed') . " SET hot=hot+1 WHERE feedid='{$feed['feedid']}'"); } } elseif ($idtype == 'picid') { require_once libfile('function/feed'); feed_publish($id, $idtype); } return true; }
$rushresult['starttimeto'] = $rushresult['starttimeto'] ? dgmdate($rushresult['starttimeto']) : ''; $rushresult['creditlimit_title'] = $_G['setting']['creditstransextra'][11] ? $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][11]]['title'] : lang('forum/misc', 'credit_total'); } if ($_G['forum_thread']['replycredit'] > 0) { $_G['forum_thread']['replycredit_rule'] = C::t('forum_replycredit')->fetch($thread['tid']); $_G['forum_thread']['replycredit_rule']['remaining'] = $_G['forum_thread']['replycredit'] / $_G['forum_thread']['replycredit_rule']['extcredits']; $_G['forum_thread']['replycredit_rule']['extcreditstype'] = $_G['forum_thread']['replycredit_rule']['extcreditstype'] ? $_G['forum_thread']['replycredit_rule']['extcreditstype'] : $_G['setting']['creditstransextra'][10]; } $_G['group']['raterange'] = $_G['setting']['modratelimit'] && $adminid == 3 && !$_G['forum']['ismoderator'] ? array() : $_G['group']['raterange']; $_G['group']['allowgetattach'] = !empty($_G['forum']['allowgetattach']) || $_G['group']['allowgetattach'] && !$_G['forum']['getattachperm'] || forumperm($_G['forum']['getattachperm']); $_G['group']['allowgetimage'] = !empty($_G['forum']['allowgetimage']) || $_G['group']['allowgetimage'] && !$_G['forum']['getattachperm'] || forumperm($_G['forum']['getattachperm']); $_G['getattachcredits'] = ''; if ($_G['forum_thread']['attachment']) { $exemptvalue = $_G['forum']['ismoderator'] ? 32 : 4; if (!($_G['group']['exempt'] & $exemptvalue)) { $creditlog = updatecreditbyaction('getattach', $_G['uid'], array(), '', 1, 0, $_G['forum_thread']['fid']); $p = ''; if ($creditlog['updatecredit']) { for ($i = 1; $i <= 8; $i++) { if ($policy = $creditlog['extcredits' . $i]) { $_G['getattachcredits'] .= $p . $_G['setting']['extcredits'][$i]['title'] . ' ' . $policy . ' ' . $_G['setting']['extcredits'][$i]['unit']; $p = ', '; } } } } } $exemptvalue = $_G['forum']['ismoderator'] ? 64 : 8; $_G['forum_attachmentdown'] = $_G['group']['exempt'] & $exemptvalue; list($seccodecheck, $secqaacheck) = seccheck('post', 'reply'); $usesigcheck = $_G['uid'] && $_G['group']['maxsigsize'];
function updateattachcredits($operator, $uidarray) { global $_G; foreach ($uidarray as $uid => $attachs) { updatecreditbyaction('postattach', $uid, array(), '', $operator == '-' ? -$attachs : $attachs, 1, $_G['fid']); } }
$thread_attachment = $post_attachment = 0; $query = DB::query("SELECT pid, attachment, thumb, remote, aid FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE tid='{$_G['tid']}'"); while ($attach = DB::fetch($query)) { if ($attach['pid'] == $pid) { if ($thread['displayorder'] >= 0) { $post_attachment++; } dunlink($attach); } else { $thread_attachment = 1; } } if ($post_attachment) { DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE pid='{$pid}'", 'UNBUFFEREED'); DB::query("DELETE FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE pid='{$pid}'", 'UNBUFFEREED'); updatecreditbyaction('postattach', $orig['authorid'], array(), '', -$post_attachment); } DB::query("DELETE FROM " . DB::table($posttable) . " WHERE pid='{$pid}'"); DB::delete('forum_postcomment', "rpid='{$pid}'"); if ($thread['special'] == 2) { DB::query("DELETE FROM " . DB::table('forum_trade') . " WHERE pid='{$pid}'"); } if ($isfirstpost) { $forumadd = 'threads=threads-\'1\', posts=posts-\'1\''; $tablearray = array('forum_threadmod', 'forum_relatedthread', 'forum_thread', 'forum_debate', 'forum_debatepost', 'forum_polloption', 'forum_poll', 'forum_typeoptionvar'); foreach ($tablearray as $table) { DB::query("DELETE FROM " . DB::table($table) . " WHERE tid='{$_G['tid']}'", 'UNBUFFERED'); } if ($_G['setting']['globalstick'] && in_array($thread['displayorder'], array(2, 3))) { require_once libfile('function/cache'); updatecache('globalstick');
updatemodlog($recyclebintids, 'DEL'); } require_once libfile('function/delete'); deletethread($deletetids); updatemoderate('tid', $moderation['delete'], 2); } if ($validatetids = dimplode($moderation['validate'])) { $tids = $moderatedthread = array(); foreach (C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['validate'], $pstat, '=', $modfids ? explode(',', $modfids) : null) as $thread) { $tids[] = $thread['tid']; $poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']); $poststatus = $poststatus['status']; if (getstatus($poststatus, 3) == 0) { updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']); $attachcount = C::t('forum_attachment_n')->count_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']); updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']); } $validatedthreads[] = $thread; if ($thread['authorid'] && $thread['authorid'] != $_G['uid']) { $pmlist[] = array('act' => 'modthreads_validate', 'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'from_id' => 0, 'from_idtype' => 'modthreads'), 'authorid' => $thread['authorid']); } } if ($tids) { $tidstr = dimplode($tids); C::t('forum_post')->update_by_tid(0, $tids, array('invisible' => 0), true, false, 1); C::t('forum_thread')->update($tids, array('displayorder' => 0, 'moderated' => 1)); $threadsmod = DB::affected_rows(); if ($_G['fid']) { updateforumcount($_G['fid']); } else { $fids = array_keys($modforums['list']);
} else { if (isblacklist($updo['uid'])) { showmessage('is_blacklist'); } } $updo['id'] = intval($updo['id']); $updo['grade'] = intval($updo['grade']); $setarr = array('doid' => $updo['doid'], 'upid' => $updo['id'], 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => $_G['timestamp'], 'message' => $message, 'ip' => $_G['clientip'], 'grade' => $updo['grade'] + 1); if ($updo['grade'] >= 3) { $setarr['upid'] = $updo['upid']; } $newid = C::t('home_docomment')->insert($setarr, true); C::t('home_doing')->update_replynum_by_doid(1, $updo['doid']); if ($updo['uid'] != $_G['uid']) { notification_add($updo['uid'], 'comment', 'doing_reply', array('url' => "home.php?mod=space&uid={$updo['uid']}&do=doing&view=me&doid={$updo['doid']}&highlight={$newid}", 'from_id' => $updo['doid'], 'from_idtype' => 'doid')); updatecreditbyaction('comment', 0, array(), 'doing' . $updo['doid']); } include_once libfile('function/stat'); updatestat('docomment'); C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED'); showmessage('do_success', dreferer(), array('doid' => $updo['doid'])); } } if ($_GET['op'] == 'delete') { if (submitcheck('deletesubmit')) { if ($id) { $allowmanage = checkperm('managedoing'); if ($value = C::t('home_docomment')->fetch($id)) { $home_doing = C::t('home_doing')->fetch($value['doid']); $value['duid'] = $home_doing['uid']; if ($allowmanage || $value['uid'] == $_G['uid'] || $value['duid'] == $_G['uid']) {
function _init_misc() { if (!$this->init_misc) { return false; } lang('core'); if ($this->init_setting && $this->init_user) { if (!isset($this->var['member']['timeoffset']) || $this->var['member']['timeoffset'] == 9999 || $this->var['member']['timeoffset'] === '') { $this->var['member']['timeoffset'] = $this->var['setting']['timeoffset']; } } $timeoffset = $this->init_setting ? $this->var['member']['timeoffset'] : $this->var['setting']['timeoffset']; $this->var['timenow'] = array('time' => dgmdate(TIMESTAMP), 'offset' => $timeoffset >= 0 ? $timeoffset == 0 ? '' : '+' . $timeoffset : $timeoffset); $this->timezone_set($timeoffset); $this->var['formhash'] = formhash(); define('FORMHASH', $this->var['formhash']); if ($this->init_user) { if ($this->var['group'] && isset($this->var['group']['allowvisit']) && !$this->var['group']['allowvisit']) { if ($this->var['uid']) { sysmessage('user_banned', null); } elseif ((!defined('ALLOWGUEST') || !ALLOWGUEST) && !in_array(CURSCRIPT, array('member', 'api')) && !$this->var['inajax']) { dheader('location: member.php?mod=logging&action=login&referer=' . rawurlencode($_SERVER['REQUEST_URI'])); } } if ($this->var['member']['status'] == -1) { sysmessage('user_banned', null); } } if ($this->var['setting']['ipaccess'] && !ipaccess($this->var['clientip'], $this->var['setting']['ipaccess'])) { sysmessage('user_banned', null); } if ($this->var['setting']['bbclosed']) { if ($this->var['uid'] && ($this->var['group']['allowvisit'] == 2 || $this->var['groupid'] == 1)) { } elseif (in_array(CURSCRIPT, array('admin', 'member', 'api')) || defined('ALLOWGUEST') && ALLOWGUEST) { } else { $closedreason = DB::result_first("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='closedreason'"); $closedreason = str_replace(':', ':', $closedreason); showmessage($closedreason ? $closedreason : 'board_closed', NULL, array('adminemail' => $this->var['setting']['adminemail']), array('login' => 1)); } } if (CURSCRIPT != 'admin' && !in_array($this->var['mod'], array('logging', 'seccode'))) { periodscheck('visitbanperiods'); } if (defined('IN_MOBILE')) { $this->var['tpp'] = $this->var['setting']['mobile']['mobiletopicperpage'] ? intval($this->var['setting']['mobile']['mobiletopicperpage']) : 20; $this->var['ppp'] = $this->var['setting']['mobile']['mobilepostperpage'] ? intval($this->var['setting']['mobile']['mobilepostperpage']) : 5; } else { $this->var['tpp'] = $this->var['setting']['topicperpage'] ? intval($this->var['setting']['topicperpage']) : 20; $this->var['ppp'] = $this->var['setting']['postperpage'] ? intval($this->var['setting']['postperpage']) : 10; } if ($this->var['setting']['nocacheheaders']) { @header("Expires: -1"); @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Pragma: no-cache"); } if ($this->session->isnew && $this->var['uid']) { updatecreditbyaction('daylogin', $this->var['uid']); include_once libfile('function/stat'); updatestat('login', 1); if (defined('IN_MOBILE')) { updatestat('mobilelogin', 1); } if ($this->var['setting']['connect']['allow'] && $this->var['member']['conisbind']) { updatestat('connectlogin', 1); } } if ($this->var['member']['conisbind'] && $this->var['setting']['connect']['newbiespan'] !== '') { $this->var['setting']['newbiespan'] = $this->var['setting']['connect']['newbiespan']; } $lastact = TIMESTAMP . "\t" . htmlspecialchars(basename($this->var['PHP_SELF'])) . "\t" . htmlspecialchars($this->var['mod']); dsetcookie('lastact', $lastact, 86400); setglobal('currenturl_encode', base64_encode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])); if ((!empty($this->var['gp_fromuid']) || !empty($this->var['gp_fromuser'])) && ($this->var['setting']['creditspolicy']['promotion_visit'] || $this->var['setting']['creditspolicy']['promotion_register'])) { require_once libfile('misc/promotion', 'include'); } $this->var['seokeywords'] = !empty($this->var['setting']['seokeywords'][CURSCRIPT]) ? $this->var['setting']['seokeywords'][CURSCRIPT] : ''; $this->var['seodescription'] = !empty($this->var['setting']['seodescription'][CURSCRIPT]) ? $this->var['setting']['seodescription'][CURSCRIPT] : ''; }
if ($status != $tradelog['status']) { if ($status == STATUS_SELLER_SEND) { notification_add($tradelog['sellerid'], 'goods', 'trade_seller_send', array('buyerid' => $tradelog['buyerid'], 'buyer' => $tradelog['buyer'], 'orderid' => $orderid, 'subject' => $tradelog['subject'])); } elseif ($status == STATUS_WAIT_BUYER) { notification_add($tradelog['buyerid'], 'goods', 'trade_buyer_confirm', array('sellerid' => $tradelog['sellerid'], 'seller' => $tradelog['seller'], 'orderid' => $orderid, 'subject' => $tradelog['subject'])); } elseif ($status == STATUS_TRADE_SUCCESS) { if ($_G['setting']['creditstransextra'][5] != -1 && $tradelog['basecredit']) { $netcredit = round($tradelog['number'] * $tradelog['basecredit'] * (1 - $_G['setting']['creditstax'])); updatemembercount($tradelog['sellerid'], array($_G['setting']['creditstransextra'][5] => $netcredit)); } else { $netcredit = 0; } C::t('forum_trade')->update($tradelog['tid'], $tradelog['pid'], array('lastbuyer' => $tradelog['buyer'], 'lastupdate' => $_G['timestamp'])); C::t('forum_trade')->update_counter($tradelog['tid'], $tradelog['pid'], $tradelog['number'], $tradelog['price'], $netcredit); updatecreditbyaction('tradefinished', $tradelog['sellerid']); updatecreditbyaction('tradefinished', $tradelog['buyerid']); notification_add($tradelog['sellerid'], 'goods', 'trade_success', array('orderid' => $orderid, 'subject' => $tradelog['subject'])); notification_add($tradelog['buyerid'], 'goods', 'trade_success', array('orderid' => $orderid, 'subject' => $tradelog['subject'])); } elseif ($status == STATUS_REFUND_CLOSE) { C::t('forum_trade')->update_counter($tradelog['tid'], $tradelog['pid'], 0, 0, 0, $tradelog['number']); notification_add($tradelog['sellerid'], 'goods', 'trade_fefund_success', array('orderid' => $orderid, 'subject' => $tradelog['subject'])); notification_add($tradelog['buyerid'], 'goods', 'trade_fefund_success', array('orderid' => $orderid, 'subject' => $tradelog['subject'])); if ($_G['setting']['creditstrans'] && $tradelog['buyerid']) { updatemembercount($tradelog['buyerid'], array($_G['setting']['creditstrans'] => $tradelog['buyercredits'])); } if ($_G['setting']['creditstransextra'][5] != -1 && $tradelog['basecredit'] && $tradelog['buyerid']) { $credit = $tradelog['number'] * $tradelog['basecredit']; updatemembercount($tradelog['buyerid'], array($_G['setting']['creditstransextra'][5] => $credit)); } } }
DB::query("UPDATE " . DB::table('portal_article_count') . " SET sharetimes=sharetimes+1 WHERE aid='{$id}'"); break; } if ($arr['status'] == 1) { updatemoderate('sid', $sid); manage_addnotify('verifyshare'); } if ($type == 'link' || !DB::result_first("SELECT COUNT(*) FROM " . DB::table('home_share') . " WHERE uid='{$_G['uid']}' AND itemid='{$id}' AND type='{$type}'")) { include_once libfile('function/stat'); updatestat('share'); } if ($note_uid && $note_uid != $_G['uid']) { notification_add($note_uid, 'sharenotice', $note_message, $note_values); } $needle = $id ? $type . $id : ''; updatecreditbyaction('createshare', $_G['uid'], array('sharings' => 1), $needle); $referer = "home.php?mod=space&uid={$_G['uid']}&do=share&view={$_GET['view']}&from={$_GET['from']}"; $magvalues['sid'] = $sid; if (!$redirecturl) { $redirecturl = dreferer(); } if (!$showmessagecontent) { $showmessagecontent = 'do_success'; } showmessage($showmessagecontent, $redirecturl, $magvalues, $_G['inajax'] && $_GET['view'] != 'me' ? array('showdialog' => 1, 'showmsg' => true, 'closetime' => true) : array()); } $arr['body_data'] = serialize($arr['body_data']); require_once libfile('function/share'); $arr = mkshare($arr); $arr['dateline'] = $_G['timestamp']; }
function blog_post($POST, $olds=array()) { global $_G, $space; $isself = 1; if(!empty($olds['uid']) && $olds['uid'] != $_G['uid']) { $isself = 0; $__G = $_G; $_G['uid'] = $olds['uid']; $_G['username'] = addslashes($olds['username']); } $POST['subject'] = getstr(trim($POST['subject']), 80); $POST['subject'] = censor($POST['subject']); if(strlen($POST['subject'])<1) $POST['subject'] = dgmdate($_G['timestamp'], 'Y-m-d'); $POST['friend'] = intval($POST['friend']); $POST['target_ids'] = ''; if($POST['friend'] == 2) { $uids = array(); $names = empty($_POST['target_names'])?array():explode(',', preg_replace("/(\s+)/s", ',', $_POST['target_names'])); if($names) { $uids = C::t('common_member')->fetch_all_uid_by_username($names); } if(empty($uids)) { $POST['friend'] = 3; } else { $POST['target_ids'] = implode(',', $uids); } } elseif($POST['friend'] == 4) { $POST['password'] = trim($POST['password']); if($POST['password'] == '') $POST['friend'] = 0; } if($POST['friend'] !== 2) { $POST['target_ids'] = ''; } if($POST['friend'] !== 4) { $POST['password'] == ''; } $POST['tag'] = dhtmlspecialchars(trim($POST['tag'])); $POST['tag'] = getstr($POST['tag'], 500); $POST['tag'] = censor($POST['tag']); $POST['message'] = checkhtml($POST['message']); if($_G['mobile']) { $POST['message'] = getstr($POST['message'], 0, 0, 0, 1); $POST['message'] = censor($POST['message']); } else { $POST['message'] = getstr($POST['message'], 0, 0, 0, 0, 1); $POST['message'] = censor($POST['message']); $POST['message'] = preg_replace(array( "/\<div\>\<\/div\>/i", "/\<a\s+href\=\"([^\>]+?)\"\>/i" ), array( '', '<a href="\\1" target="_blank">' ), $POST['message']); } $message = $POST['message']; if(censormod($message) || censormod($POST['subject']) || $_G['group']['allowblogmod']) { $blog_status = 1; } else { $blog_status = 0; } if(empty($olds['classid']) || $POST['classid'] != $olds['classid']) { if(!empty($POST['classid']) && substr($POST['classid'], 0, 4) == 'new:') { $classname = dhtmlspecialchars(trim(substr($POST['classid'], 4))); $classname = getstr($classname); $classname = censor($classname); if(empty($classname)) { $classid = 0; } else { $classid = C::t('home_class')->fetch_classid_by_uid_classname($_G['uid'], $classname); if(empty($classid)) { $setarr = array( 'classname' => $classname, 'uid' => $_G['uid'], 'dateline' => $_G['timestamp'] ); $classid = C::t('home_class')->insert($setarr, true); } } } else { $classid = intval($POST['classid']); } } else { $classid = $olds['classid']; } if($classid && empty($classname)) { $query = C::t('home_class')->fetch($classid); $classname = ($query['uid'] == $_G['uid']) ? $query['classname'] : ''; if(empty($classname)) $classid = 0; } $blogarr = array( 'subject' => $POST['subject'], 'classid' => $classid, 'friend' => $POST['friend'], 'password' => $POST['password'], 'noreply' => empty($POST['noreply'])?0:1, 'catid' => intval($POST['catid']), 'status' => $blog_status, ); $titlepic = ''; $uploads = array(); if(!empty($POST['picids'])) { $picids = array_keys($POST['picids']); $query = C::t('home_pic')->fetch_all_by_uid($_G['uid'], 0, 0, $picids); foreach($query as $value) { if(empty($titlepic) && $value['thumb']) { $titlepic = getimgthumbname($value['filepath']); $blogarr['picflag'] = $value['remote']?2:1; } $picurl = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0); $uploads[md5($picurl)] = $value; } if(empty($titlepic) && $value) { $titlepic = $value['filepath']; $blogarr['picflag'] = $value['remote']?2:1; } } if($uploads) { $albumid = 0; if($POST['savealbumid'] < 0 && !empty($POST['newalbum'])) { $albumname = addslashes(dhtmlspecialchars(trim($POST['newalbum']))); if(empty($albumname)) $albumname = dgmdate($_G['timestamp'],'Ymd'); $albumarr = array('albumname' => $albumname); $albumid = album_creat($albumarr); } else { $albumid = $POST['savealbumid'] < 0 ? 0 : intval($POST['savealbumid']); } if($albumid) { C::t('home_pic')->update_for_uid($_G['uid'], $picids, array('albumid' => $albumid)); album_update_pic($albumid); } preg_match_all("/\s*\<img src=\"(.+?)\".*?\>\s*/is", $message, $mathes); if(!empty($mathes[1])) { foreach ($mathes[1] as $key => $value) { $urlmd5 = md5($value); if(!empty($uploads[$urlmd5])) { unset($uploads[$urlmd5]); } } } foreach ($uploads as $value) { $picurl = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0); $message .= "<div class=\"uchome-message-pic\"><img src=\"$picurl\"><p>$value[title]</p></div>"; } } $ckmessage = preg_replace("/(\<div\>|\<\/div\>|\s|\ \;|\<br\>|\<p\>|\<\/p\>)+/is", '', $message); if(empty($ckmessage)) { return false; } if(checkperm('manageblog')) { $blogarr['hot'] = intval($POST['hot']); } if($olds['blogid']) { if($blogarr['catid'] != $olds['catid']) { if($olds['catid']) { C::t('home_blog_category')->update_num_by_catid(-1, $olds['catid'], true, true); } if($blogarr['catid']) { C::t('home_blog_category')->update_num_by_catid(1, $blogarr['catid']); } } $blogid = $olds['blogid']; C::t('home_blog')->update($blogid, $blogarr); $fuids = array(); $blogarr['uid'] = $olds['uid']; $blogarr['username'] = $olds['username']; } else { if($blogarr['catid']) { C::t('home_blog_category')->update_num_by_catid(1, $blogarr['catid']); } $blogarr['uid'] = $_G['uid']; $blogarr['username'] = $_G['username']; $blogarr['dateline'] = empty($POST['dateline'])?$_G['timestamp']:$POST['dateline']; $blogid = C::t('home_blog')->insert($blogarr, true); C::t('common_member_status')->update($_G['uid'], array('lastpost' => $_G['timestamp'])); C::t('common_member_field_home')->update($_G['uid'], array('recentnote'=>$POST['subject'])); } $blogarr['blogid'] = $blogid; $class_tag = new tag(); $POST['tag'] = $olds ? $class_tag->update_field($POST['tag'], $blogid, 'blogid') : $class_tag->add_tag($POST['tag'], $blogid, 'blogid'); $fieldarr = array( 'message' => $message, 'postip' => $_G['clientip'], 'target_ids' => $POST['target_ids'], 'tag' => $POST['tag'] ); if(!empty($titlepic)) { $fieldarr['pic'] = $titlepic; } if($olds) { C::t('home_blogfield')->update($blogid, $fieldarr); } else { $fieldarr['blogid'] = $blogid; $fieldarr['uid'] = $blogarr['uid']; C::t('home_blogfield')->insert($fieldarr); } if($isself && !$olds && $blog_status == 0) { updatecreditbyaction('publishblog', 0, array('blogs' => 1)); include_once libfile('function/stat'); updatestat('blog'); } if($olds['blogid'] && $blog_status == 1) { updatecreditbyaction('publishblog', 0, array('blogs' => -1), '', -1); include_once libfile('function/stat'); updatestat('blog'); } if($POST['makefeed'] && $blog_status == 0) { include_once libfile('function/feed'); feed_publish($blogid, 'blogid', $olds?0:1); } if(!empty($__G)) $_G = $__G; if($blog_status == 1) { updatemoderate('blogid', $blogid); manage_addnotify('verifyblog'); } return $blogarr; }
include template('common/footer_ajax'); dexit(); } elseif ($_GET['action'] == 'get_rushreply_membernum') { $tid = intval($_GET['tid']); if ($tid) { $membernum = C::t('forum_post')->count_author_by_tid($tid); showmessage('thread_reshreply_membernum', '', array('membernum' => intval($membernum - 1)), array('alert' => 'info')); } dexit(); } elseif ($_GET['action'] == 'deleteattach') { $count = 0; if ($_GET['aids']) { foreach ($_GET['aids'] as $aid) { $attach = C::t('forum_attachment_n')->fetch('aid:' . $aid, $aid); if ($attach && ($attach['pid'] && $attach['pid'] == $_GET['pid'] && $_G['uid'] == $attach['uid'])) { updatecreditbyaction('postattach', $attach['uid'], array(), '', -1, 1, $_G['fid']); } if ($attach && ($attach['pid'] && $attach['pid'] == $_GET['pid'] && $_G['uid'] == $attach['uid'] || $_G['forum']['ismoderator'] || !$attach['pid'] && $_G['uid'] == $attach['uid'])) { C::t('forum_attachment_n')->delete('aid:' . $aid, $aid); C::t('forum_attachment')->delete($aid); dunlink($attach); $count++; } } } include template('common/header_ajax'); echo $count; include template('common/footer_ajax'); dexit(); } elseif ($_GET['action'] == 'secondgroup') { require_once libfile('function/group');
$query = DB::query("SELECT dateline FROM " . DB::table('home_visitor') . " WHERE uid='{$space['uid']}' AND vuid='{$_G['uid']}'"); $visitor = DB::fetch($query); $is_anonymous = empty($_G['cookie']['anonymous_visit_' . $_G['uid'] . '_' . $space['uid']]) ? 0 : 1; if (empty($visitor['dateline'])) { $setarr = array('uid' => $space['uid'], 'vuid' => $_G['uid'], 'vusername' => $is_anonymous ? '' : $_G['username'], 'dateline' => $_G['timestamp']); DB::insert('home_visitor', $setarr, 0, true); show_credit(); } else { if ($_G['timestamp'] - $visitor['dateline'] >= 300) { DB::update('home_visitor', array('dateline' => $_G['timestamp'], 'vusername' => $is_anonymous ? '' : $_G['username']), array('uid' => $space['uid'], 'vuid' => $_G['uid'])); } if ($_G['timestamp'] - $visitor['dateline'] >= 3600) { show_credit(); } } updatecreditbyaction('visit', 0, array(), $space['uid']); } if ($do != 'profile' && !ckprivacy($do, 'view')) { $_G['privacy'] = 1; require_once libfile('space/profile', 'include'); include template('home/space_privacy'); exit; } $widths = getlayout($userdiy['currentlayout']); $leftlist = formatdata($userdiy, 'left', $space); $centerlist = formatdata($userdiy, 'center', $space); $rightlist = formatdata($userdiy, 'right', $space); dsetcookie('home_diymode', 1); } $navtitle = !empty($space['spacename']) ? $space['spacename'] : lang('space', 'sb_space', array('who' => $space['username'])); $metakeywords = lang('space', 'sb_space', array('who' => $space['username']));
$discuz->init(); $apitype = empty($_GET['attach']) || !preg_match('/^[a-z0-9]+$/i', $_GET['attach']) ? 'alipay' : $_GET['attach']; require_once DISCUZ_ROOT . './api/trade/api_' . $apitype . '.php'; $PHP_SELF = $_SERVER['PHP_SELF']; $_G['siteurl'] = dhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api\\/trade)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/'); $notifydata = trade_notifycheck('credit'); if ($notifydata['validator']) { $orderid = $notifydata['order_no']; $postprice = $notifydata['price']; $order = C::t('forum_order')->fetch($orderid); $order = array_merge($order, C::t('common_member')->fetch_by_username($order['uid'])); if ($order && floatval($postprice) == floatval($order['price']) && ($apitype == 'tenpay' || strtolower($_G['setting']['ec_account']) == strtolower($_REQUEST['seller_email']))) { if ($order['status'] == 1) { C::t('forum_order')->update($orderid, array('status' => '2', 'buyer' => "{$notifydata['trade_no']}\t{$apitype}", 'confirmdate' => $_G['timestamp'])); updatemembercount($order['uid'], array($_G['setting']['creditstrans'] => $order['amount']), 1, 'AFD', $order['uid']); updatecreditbyaction($action, $uid = 0, $extrasql = array(), $needle = '', $coef = 1, $update = 1, $fid = 0); C::t('forum_order')->delete_by_submitdate($_G['timestamp'] - 60 * 86400); $submitdate = dgmdate($order['submitdate']); $confirmdate = dgmdate(TIMESTAMP); notification_add($order['uid'], 'credit', 'addfunds', array('orderid' => $order['orderid'], 'price' => $order['price'], 'value' => $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title'] . ' ' . $order['amount'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['unit']), 1); } } } if ($notifydata['location']) { $url = rawurlencode('home.php?mod=spacecp&ac=credit'); if ($apitype == 'tenpay') { echo <<<EOS <meta name="TENCENT_ONLINE_PAYMENT" content="China TENCENT"> <html> <body> <script language="javascript" type="text/javascript">
$domain = strtolower(trim($_G['gp_domain'])); if ($_G['setting']['allowgroupdomain'] && !empty($_G['setting']['domain']['root']['group']) && $domainlength) { checklowerlimit('modifydomain'); } if (empty($domainlength) || empty($domain)) { $domain = ''; } else { require_once libfile('function/domain'); if (domaincheck($domain, $_G['setting']['domain']['root']['group'], $domainlength)) { require_once libfile('function/delete'); deletedomain($_G['fid'], 'group'); DB::insert('common_domain', array('domain' => $domain, 'domainroot' => addslashes($_G['setting']['domain']['root']['group']), 'id' => $_G['fid'], 'idtype' => 'group')); } } $forumarr['domain'] = $domain; updatecreditbyaction('modifydomain'); } if ($_G['gp_name'] && !empty($specialswitch['allowchangename']) || $_G['gp_fup'] && !empty($specialswitch['allowchangetype'])) { if ($_G['uid'] != $_G['forum']['founderuid'] && $_G['adminid'] != 1) { showmessage('group_edit_only_founder'); } if (isset($_G['gp_name'])) { $_G['gp_name'] = censor(addslashes(dhtmlspecialchars(cutstr(stripslashes(trim($_G['gp_name'])), 20, '')))); if (empty($_G['gp_name'])) { showmessage('group_name_empty'); } } elseif (isset($_G['gp_fup']) && empty($_G['gp_fup'])) { showmessage('group_category_empty'); } if (!empty($_G['gp_name']) && $_G['gp_name'] != addslashes($_G['forum']['name'])) { if (DB::result(DB::query("SELECT fid FROM " . DB::table('forum_forum') . " WHERE name='{$_G['gp_name']}'"), 0)) {
} $touid =& $_G['collection']['uid']; $coef = 1; if ($touid) { $subject = $message = lang('message', 'collection_recommend_message', array('fromuser' => $_G['username'], 'collectioname' => $_G['collection']['name'], 'url' => $_GET['threadurl'])); if (C::t('home_blacklist')->count_by_uid_buid($touid, $_G['uid'])) { showmessage('is_blacklist', '', array(), array('return' => true)); } if ($value = getuserbyuid($touid)) { require_once libfile('function/friend'); $value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2); if ($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || $value['onlyacceptfriendpm'] == 1 && friend_check($touid)) { $return = sendpm($touid, $subject, $message, '', 0, 0); } else { showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true)); } } else { showmessage('message_bad_touid', '', array(), array('return' => true)); } } else { $return = sendpm(0, $subject, $message, '', $pmid, 0); } if ($return > 0) { include_once libfile('function/stat'); updatestat('sendpm', 0, $coef); C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED'); !($_G['group']['exempt'] & 1) && updatecreditbyaction('sendpm', 0, array(), '', $coef); showmessage('collection_recommend_succ', '', array(), array('alert' => 'right', 'closetime' => true, 'showdialog' => 1)); } } }
} } if ($searchindex['id']) { $searchid = $searchindex['id']; } else { !($_G['group']['exempt'] & 2) && checklowerlimit('search'); if (!$srchtxt && !$srchuid && !$srchuname) { dheader('Location: search.php?mod=collection'); } if ($_G['adminid'] != '1' && $_G['setting']['search']['collection']['maxspm']) { if (C::t('common_searchindex')->count_by_dateline($_G['timestamp'], $srchmod) >= $_G['setting']['search']['collection']['maxspm']) { showmessage('search_toomany', 'search.php?mod=collection', array('maxspm' => $_G['setting']['search']['collection']['maxspm'])); } } $num = $ids = 0; $_G['setting']['search']['collection']['maxsearchresults'] = $_G['setting']['search']['collection']['maxsearchresults'] ? intval($_G['setting']['search']['collection']['maxsearchresults']) : 500; list($srchtxt, $srchtxtsql) = searchkey($keyword, "name LIKE '%{text}%' OR keyword LIKE '%{text}%'", true); $query = C::t('forum_collection')->fetch_ctid_by_searchkey($srchtxtsql, $_G['setting']['search']['collection']['maxsearchresults']); foreach ($query as $collection) { $ids .= ',' . $collection['ctid']; $num++; } unset($query); $keywords = str_replace('%', '+', $srchtxt); $expiration = TIMESTAMP + $cachelife_text; $searchid = C::t('common_searchindex')->insert(array('srchmod' => $srchmod, 'keywords' => $keywords, 'searchstring' => $searchstring, 'useip' => $_G['clientip'], 'uid' => $_G['uid'], 'dateline' => $_G['timestamp'], 'expiration' => $expiration, 'num' => $num, 'ids' => $ids), true); !($_G['group']['exempt'] & 2) && updatecreditbyaction('search'); } dheader("location: search.php?mod=collection&searchid={$searchid}&searchsubmit=yes&kw=" . urlencode($keyword)); } }
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) { sendpm($uid, $welcomtitle, $welcomemsgtxt, 0); } elseif ($welcomemsg == 2) { sendmail_cron($email, $welcomtitle, $welcomemsgtxt); } } if ($fromuid) { updatecreditbyaction('promotion_register', $fromuid); dsetcookie('promotion', ''); } dsetcookie('loginuser', ''); dsetcookie('activationauth', ''); dsetcookie('invite_auth', ''); $regverify = $_G['setting']['regverify']; loadcache('setting', true); $_G['setting']['lastmember'] = $username; save_syscache('setting', $_G['setting']); $_G['setting']['regverify'] = $regverify; if (!empty($_G['inajax'])) { $_G['setting']['msgforward'] = unserialize($_G['setting']['msgforward']); $mrefreshtime = intval($_G['setting']['msgforward']['refreshtime']) * 1000; $message = 1; if ($_G['setting']['regverify'] != 1) {
function addportalarticlecomment($id, $message, $idtype = 'aid') { global $_G; $id = intval($id); if (empty($id)) { return 'comment_comment_noexist'; } $message = getstr($message, $_G['group']['allowcommentarticle'], 1, 1, 1, 0); if (strlen($message) < 2) { return 'content_is_too_short'; } $idtype = in_array($idtype, array('aid', 'topicid')) ? $idtype : 'aid'; $tablename = $idtype == 'aid' ? 'portal_article_title' : 'portal_topic'; $data = DB::fetch_first("SELECT uid,allowcomment FROM " . DB::table($tablename) . " WHERE {$idtype}='{$id}'"); if (empty($data)) { return 'comment_comment_noexist'; } if ($data['allowcomment'] != 1) { return 'comment_comment_notallowed'; } $message = censor($message); if (censormod($message)) { $comment_status = 1; } else { $comment_status = 0; } $setarr = array('uid' => $_G['uid'], 'username' => $_G['username'], 'id' => $id, 'idtype' => $idtype, 'postip' => $_G['onlineip'], 'dateline' => $_G['timestamp'], 'status' => $comment_status, 'message' => $message); $pcid = DB::insert('portal_comment', $setarr, true); if ($comment_status == 1) { updatemoderate($idtype . '_cid', $pcid); $notifykey = $idtype == 'aid' ? 'verifyacommont' : 'verifytopiccommont'; manage_addnotify($notifykey); } $tablename = $idtype == 'aid' ? 'portal_article_count' : 'portal_topic'; DB::query("UPDATE " . DB::table($tablename) . " SET commentnum=commentnum+1 WHERE {$idtype}='{$id}'"); DB::update('common_member_status', array('lastpost' => $_G['timestamp']), array('uid' => $_G['uid'])); if ($data['uid'] != $_G['uid']) { updatecreditbyaction('portalcomment', 0, array(), $idtype . $id); } return 'do_success'; }
} } if ($searchindex['id']) { $searchid = $searchindex['id']; } else { if (!$srchtxt) { dheader('Location: search.php?mod=portal'); } if ($_G['adminid'] != '1' && $_G['setting']['search']['portal']['maxspm']) { if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_searchindex') . " WHERE srchmod='{$srchmod}' AND dateline>'{$_G['timestamp']}'-60") >= $_G['setting']['search']['portal']['maxspm']) { showmessage('search_toomany', 'search.php?mod=portal', array('maxspm' => $_G['setting']['search']['portal']['maxspm'])); } } $num = $ids = 0; $_G['setting']['search']['portal']['maxsearchresults'] = $_G['setting']['search']['portal']['maxsearchresults'] ? intval($_G['setting']['search']['portal']['maxsearchresults']) : 500; $srchtxtsql = addcslashes($srchtxt, '%_'); $query = DB::query("SELECT aid FROM " . DB::table('portal_article_title') . " WHERE title LIKE '%{$srchtxtsql}%' ORDER BY aid DESC LIMIT " . $_G['setting']['search']['portal']['maxsearchresults']); while ($article = DB::fetch($query)) { $ids .= ',' . $article['aid']; $num++; } DB::free_result($query); $keywords = str_replace('%', '+', $srchtxt); $expiration = TIMESTAMP + $cachelife_text; DB::query("INSERT INTO " . DB::table('common_searchindex') . " (srchmod, keywords, searchstring, useip, uid, dateline, expiration, num, ids)\r\n\t\t\t\t\tVALUES ('{$srchmod}', '{$keywords}', '{$searchstring}', '{$_G['clientip']}', '{$_G['uid']}', '{$_G['timestamp']}', '{$expiration}', '{$num}', '{$ids}')"); $searchid = DB::insert_id(); !($_G['portal']['exempt'] & 2) && updatecreditbyaction('search'); } dheader("location: search.php?mod=portal&searchid={$searchid}&searchsubmit=yes"); } }
function addportalarticlecomment($id, $message, $idtype = 'aid') { global $_G; $id = intval($id); if (empty($id)) { return 'comment_comment_noexist'; } $message = getstr($message, $_G['group']['allowcommentarticle'], 0, 0, 1, 0); if (strlen($message) < 2) { return 'content_is_too_short'; } $idtype = in_array($idtype, array('aid', 'topicid')) ? $idtype : 'aid'; $tablename = $idtype == 'aid' ? 'portal_article_title' : 'portal_topic'; $data = C::t($tablename)->fetch($id); if (empty($data)) { return 'comment_comment_noexist'; } if ($data['allowcomment'] != 1) { return 'comment_comment_notallowed'; } $message = censor($message); if (censormod($message)) { $comment_status = 1; } else { $comment_status = 0; } $setarr = array('uid' => $_G['uid'], 'username' => $_G['username'], 'id' => $id, 'idtype' => $idtype, 'postip' => $_G['clientip'], 'dateline' => $_G['timestamp'], 'status' => $comment_status, 'message' => $message); $pcid = C::t('portal_comment')->insert($setarr, true); if ($comment_status == 1) { updatemoderate($idtype . '_cid', $pcid); $notifykey = $idtype == 'aid' ? 'verifyacommont' : 'verifytopiccommont'; manage_addnotify($notifykey); } $tablename = $idtype == 'aid' ? 'portal_article_count' : 'portal_topic'; C::t($tablename)->increase($id, array('commentnum' => 1)); C::t('common_member_status')->update($_G['uid'], array('lastpost' => $_G['timestamp']), 'UNBUFFERED'); if ($data['uid'] != $_G['uid']) { updatecreditbyaction('portalcomment', 0, array(), $idtype . $id); } return 'do_success'; }
} $polloptionid[] = $pollarray['polloptionid']; } $polloptionids = ''; foreach ($_GET['pollanswers'] as $key => $id) { if (!in_array($id, $polloptionid)) { showmessage('parameters_error'); } unset($polloptionid[$key]); $polloptionids[] = $id; } C::t('forum_polloption')->update_vote($polloptionids, $voterids . "\t", 1); C::t('forum_thread')->update($_G['tid'], array('lastpost' => $_G['timestamp']), true); C::t('forum_poll')->update_vote($_G['tid']); C::t('forum_pollvoter')->insert(array('tid' => $_G['tid'], 'uid' => $_G['uid'], 'username' => $_G['username'], 'options' => implode("\t", $_GET['pollanswers']), 'dateline' => $_G['timestamp'])); updatecreditbyaction('joinpoll'); $space = array(); space_merge($space, 'field_home'); if ($overt && !empty($space['privacy']['feed']['newreply'])) { $feed['icon'] = 'poll'; $feed['title_template'] = 'feed_thread_votepoll_title'; $feed['title_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$_G['tid']}\">{$thread['subject']}</a>", 'author' => "<a href=\"home.php?mod=space&uid={$thread['authorid']}\">{$thread['author']}</a>", 'hash_data' => "tid{$_G[tid]}"); $feed['id'] = $_G['tid']; $feed['idtype'] = 'tid'; postfeed($feed); } if (!empty($_G['inajax'])) { showmessage('thread_poll_succeed', "forum.php?mod=viewthread&tid={$_G['tid']}" . ($_GET['from'] ? '&from=' . $_GET['from'] : ''), array(), array('location' => true)); } else { showmessage('thread_poll_succeed', "forum.php?mod=viewthread&tid={$_G['tid']}" . ($_GET['from'] ? '&from=' . $_GET['from'] : '')); }
function setloginstatus($member, $cookietime) { global $_G; $_G['uid'] = intval($member['uid']); $_G['username'] = $member['username']; $_G['adminid'] = $member['adminid']; $_G['groupid'] = $member['groupid']; $_G['formhash'] = formhash(); $_G['session']['invisible'] = getuserprofile('invisible'); $_G['member'] = $member; loadcache('usergroup_' . $_G['groupid']); C::app()->session->isnew = true; C::app()->session->updatesession(); dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true); dsetcookie('loginuser'); dsetcookie('activationauth'); dsetcookie('pmnum'); include_once libfile('function/stat'); updatestat('login', 1); if (defined('IN_MOBILE')) { updatestat('mobilelogin', 1); } if ($_G['setting']['connect']['allow'] && $_G['member']['conisbind']) { updatestat('connectlogin', 1); } $rule = updatecreditbyaction('daylogin', $_G['uid']); if (!$rule['updatecredit']) { checkusergroup($_G['uid']); } }
if (empty($newusers)) { showmessage('message_bad_touser', dreferer()); } if (isset($newusers[$_G['uid']])) { showmessage('message_can_not_send_to_self', dreferer()); } foreach ($newusers as $key => $value) { if (isblacklist($key)) { showmessage('is_blacklist', dreferer()); } } $return = uc_pm_send($_G['uid'], implode(',', $newusers), $subject, $message, 1, $pmid, 1); } if ($return > 0) { DB::query("UPDATE " . DB::table('common_member_status') . " SET lastpost='{$_G['timestamp']}' WHERE uid='{$_G['uid']}'"); updatecreditbyaction('sendpm'); showmessage('do_success', "home.php?mod=space&do=pm&filter=privatepm", array(), array('msgtype' => $_G['gp_inajax'] ? 3 : 1, 'showmsg' => true)); } else { if (in_array($return, array(-1, -2, -3, -4))) { showmessage('message_can_not_send' . abs($return)); } else { showmessage('message_can_not_send'); } } } } elseif ($_GET['op'] == 'ignore') { if (submitcheck('ignoresubmit')) { $single = intval($_G['gp_single']); if ($single) { uc_pm_blackls_add($_G['uid'], $_POST['ignoreuser']); showmessage('do_success', dreferer(), array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => 1));
function threadpubsave($tid, $passapproval = false) { global $_G; if ($_G['setting']['plugins']['func'][HOOKTYPE]['threadpubsave']) { $hookparam = func_get_args(); hookscript('threadpubsave', 'global', 'funcs', array('param' => $hookparam, 'step' => 'check'), 'threadpubsave'); } $thread = C::t('forum_thread')->fetch_by_tid_displayorder($tid, -4, '=', !$passapproval ? $_G['uid'] : null); if (!$thread) { return 0; } $threadpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($tid); $thread['message'] = $threadpost['message']; $modworksql = 0; $displayorder = 0; $dateline = $_G['timestamp']; $moderatepids = $saveposts = array(); $return = 1; list($modnewthreads) = threadmodstatus($thread['subject'] . "\t" . $thread['message']); if ($modnewthreads && $passapproval === false) { updatemoderate('tid', $tid); manage_addnotify('verifythread'); $displayorder = -2; $modworksql = 1; $return = -1; } else { C::t('forum_post')->update_by_tid('tid:' . $tid, $tid, array('dateline' => $dateline, 'invisible' => '0'), false, false, 1); } C::t('forum_thread')->update($tid, array('displayorder' => $displayorder, 'dateline' => $_G['timestamp'], 'lastpost' => $_G['timestamp'])); $posts = $thread['replies'] + 1; if ($thread['replies']) { $saveposts = C::t('forum_post')->fetch_all_by_tid('tid:' . $tid, $tid, true, '', 0, 0, 0); foreach ($saveposts as $post) { $dateline++; $invisible = 0; list(, $modnewreplies) = threadmodstatus($post['subject'] . "\t" . $post['message']); if ($modnewreplies) { $moderatepids[] = $post['pid']; $verifypost = true; $invisible = -2; $modworksql = 1; $return = -2; } C::t('forum_post')->update('tid:' . $tid, $post['pid'], array('dateline' => $dateline, 'invisible' => $invisible)); updatepostcredits('+', $thread['authorid'], 'reply', $thread['fid']); } } if ($moderatepids) { updatemoderate('pid', $moderatepids); manage_addnotify('verifypost'); } updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']); $attachcount = C::t('forum_attachment_n')->count_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']); updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']); if ($_G['forum']['status'] == 3) { C::t('forum_groupuser')->update_counter_for_user($thread['authorid'], $thread['fid'], 1); } $subject = str_replace("\t", ' ', $thread['subject']); $lastpost = $thread['tid'] . "\t" . $subject . "\t" . $thread['lastpost'] . "\t" . $thread['lastposter']; C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($thread['fid'], 1, $posts, $posts, $modworksql); if ($_G['forum']['type'] == 'sub') { C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost)); } if ($_G['setting']['plugins']['func'][HOOKTYPE]['threadpubsave']) { hookscript('threadpubsave', 'global', 'funcs', array('param' => $hookparam, 'step' => 'save', 'posts' => $saveposts), 'threadpubsave'); } return $return; }