function viewthread_updateviews($tableid) { global $_G; if (!$_G['setting']['preventrefresh'] || $_G['cookie']['viewid'] != 'tid_' . $_G['tid']) { if (!$tableid && $_G['setting']['optimizeviews']) { if ($_G['forum_thread']['addviews']) { if ($_G['forum_thread']['addviews'] < 100) { C::t('forum_threadaddviews')->update_by_tid($_G['tid']); } else { if (!discuz_process::islocked('update_thread_view')) { $row = C::t('forum_threadaddviews')->fetch($_G['tid']); C::t('forum_threadaddviews')->update($_G['tid'], array('addviews' => 0)); C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews'] + 1), true); discuz_process::unlock('update_thread_view'); } } } else { C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => 1), false, true); } } else { C::t('forum_thread')->increase($_G['tid'], array('views' => 1), true, $tableid); } } dsetcookie('viewid', 'tid_' . $_G['tid']); }
function build_cache_heats() { global $_G; $addsql = ''; $data = array(); if (discuz_process::islocked('update_heats_list')) { return false; } if ($_G['setting']['indexhot']['status']) { require_once libfile('function/post'); $_G['setting']['indexhot'] = array('status' => 1, 'limit' => intval($_G['setting']['indexhot']['limit'] ? $_G['setting']['indexhot']['limit'] : 10), 'days' => intval($_G['setting']['indexhot']['days'] ? $_G['setting']['indexhot']['days'] : 7), 'expiration' => intval($_G['setting']['indexhot']['expiration'] ? $_G['setting']['indexhot']['expiration'] : 900), 'messagecut' => intval($_G['setting']['indexhot']['messagecut'] ? $_G['setting']['indexhot']['messagecut'] : 200)); $messageitems = 2; $limit = $_G['setting']['indexhot']['limit']; foreach (C::t('forum_thread')->fetch_all_heats() as $heat) { $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($heat['tid']); $heat = array_merge($heat, (array) $post); if ($limit == 0) { break; } if ($messageitems > 0) { $heat['message'] = !$heat['price'] ? messagecutstr($heat['message'], $_G['setting']['indexhot']['messagecut']) : ''; $data['message'][$heat['tid']] = $heat; } else { unset($heat['message']); $data['subject'][$heat['tid']] = $heat; } $messageitems--; $limit--; } $data['expiration'] = TIMESTAMP + $_G['setting']['indexhot']['expiration']; } savecache('heats', $data); discuz_process::unlock('update_heats_list'); }
public function global_footer() { global $_G, $_GET; if (self::$securityStatus != TRUE) { return false; } $formhash = formhash(); if ($_G['adminid']) { $processName = 'securityOperate'; if (self::$isAdminGroup && !discuz_process::islocked($processName, 30)) { $ajaxReportScript = <<<EOF \t\t\t\t\t<script type='text/javascript'> \t\t\t\t\tvar url = SITEURL + '/plugin.php?id=security:sitemaster'; \t\t\t\t\tvar x = new Ajax(); \t\t\t\t\tx.post(url, 'formhash={$formhash}', function(s){}); \t\t\t\t\t</script> EOF; } } $processName = 'securityRetry'; $time = 10; if (!discuz_process::islocked($processName, $time)) { if (C::t('#security#security_failedlog')->count()) { $ajaxRetryScript = <<<EOF \t\t\t\t\t<script type='text/javascript'> \t\t\t\t\tvar urlRetry = SITEURL + '/plugin.php?id=security:job'; \t\t\t\t\tvar ajaxRetry = new Ajax(); \t\t\t\t\tajaxRetry.post(urlRetry, 'formhash={$formhash}', function(s){}); \t\t\t\t\t</script> EOF; } } return $ajaxReportScript . $ajaxRetryScript; }
function updatersscache($num) { global $_G; $processname = 'portal_rss_cache'; if (discuz_process::islocked($processname, 600)) { return false; } C::t('portal_rsscache')->truncate(); require_once libfile('function/post'); foreach ($_G['cache']['portalcategory'] as $catid => $catarray) { $query = C::t('portal_article_title')->fetch_all_for_cat($catid, 0, 1, 0, $num); $catarray['catname'] = addslashes($catarray['catname']); foreach ($query as $article) { $article['author'] = $article['author'] != '' ? addslashes($article['author']) : ($article['username'] ? addslashes($article['username']) : 'Anonymous'); $article['title'] = addslashes($article['title']); $articleattach = C::t('portal_attachment')->fetch_by_aid_image($article['aid']); $attachdata = ''; if (!empty($articleattach)) { $attachdata = "\t" . $articleattach['remote'] . "\t" . $articleattach['attachment'] . "\t" . $articleattach['filesize']; } $article['description'] = addslashes(messagecutstr($article['summary'], 250 - strlen($attachdata)) . $attachdata); C::t('portal_rsscache')->insert(array('lastupdate' => $_G['timestamp'], 'catid' => $catid, 'aid' => $article['aid'], 'dateline' => $article['dateline'], 'catname' => $catarray['catname'], 'author' => $article['author'], 'subject' => $article['title'], 'description' => $article['description'])); } } discuz_process::unlock($processname); return true; }
function updatersscache($num) { global $_G; $processname = 'portal_rss_cache'; if (discuz_process::islocked($processname, 600)) { return false; } DB::query("DELETE FROM " . DB::table('portal_rsscache') . ""); require_once libfile('function/post'); foreach ($_G['cache']['portalcategory'] as $catid => $catarray) { $query = DB::query("SELECT aid, username, author, dateline, title, summary\r\n\t\t\tFROM " . DB::table('portal_article_title') . "\r\n\t\t\tWHERE catid='{$catid}' AND status=0\r\n\t\t\tORDER BY aid DESC LIMIT {$num}"); $catarray['catname'] = addslashes($catarray['catname']); while ($article = DB::fetch($query)) { $article['author'] = $article['author'] != '' ? addslashes($article['author']) : ($article['username'] ? addslashes($article['username']) : 'Anonymous'); $article['title'] = addslashes($article['title']); $articleattach = DB::fetch_first("SELECT * FROM " . DB::table('portal_attachment') . " WHERE aid='" . $article['aid'] . "' AND isimage=1"); $attachdata = ''; if (!empty($articleattach)) { $attachdata = "\t" . $articleattach['remote'] . "\t" . $articleattach['attachment'] . "\t" . $articleattach['filesize']; } $article['description'] = addslashes(messagecutstr($article['summary'], 250 - strlen($attachdata)) . $attachdata); DB::query("REPLACE INTO " . DB::table('portal_rsscache') . " (lastupdate, catid, aid, dateline, catname, author, subject, description)\r\n\t\t\t\tVALUES ('{$_G['timestamp']}', '{$catid}', '{$article['aid']}', '{$article['dateline']}', '{$catarray['catname']}', '{$article['author']}', '{$article['title']}', '{$article['description']}')"); } } discuz_process::unlock($processname); return true; }
function global_footer() { global $_G; if (!$this->_secStatus) { return false; } $formhash = formhash(); $ajaxReportScript = ''; $processName = 'securitOperate'; if ($this->isAdminGroup && !discuz_process::islocked($processName, 10)) { $ajaxReportScript = <<<EOF \t\t\t<script type='text/javascript'> \t\t\tvar url = SITEURL + '/plugin.php?id=security:sitemaster'; \t\t\tvar x = new Ajax(); \t\t\tx.post(url, 'formhash={$formhash}', function(s){}); \t\t\t</script> EOF; } $processName = 'securitRetry'; $time = 5; if ($_G['gp_d']) { $time = 1; } if (!discuz_process::islocked($processName, $time)) { $ajaxRetryScript = <<<EOF \t\t\t<script type='text/javascript'> \t\t\tvar urlRetry = SITEURL + '/plugin.php?id=security:job'; \t\t\tvar ajaxRetry = new Ajax(); \t\t\tajaxRetry.post(urlRetry, 'formhash={$formhash}', function(s){}); \t\t\t</script> EOF; } return $ajaxReportScript . $ajaxRetryScript; }
public static function run($cronid = 0) { global $_G; $cron = $cronid ? C::t('common_cron')->fetch($cronid) : C::t('common_cron')->fetch_nextrun(TIMESTAMP); $processname = 'DZ_CRON_' . (empty($cron) ? 'CHECKER' : $cron['cronid']); if ($cronid && !empty($cron)) { discuz_process::unlock($processname); } if (discuz_process::islocked($processname, 600)) { return false; } if ($cron) { $cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']); $cronfile = DISCUZ_ROOT . './source/include/cron/' . $cron['filename']; $cron['minute'] = explode("\t", $cron['minute']); self::setnextime($cron); @set_time_limit(1000); @ignore_user_abort(TRUE); if (!@(include $cronfile)) { return false; } } self::nextcron(); discuz_process::unlock($processname); return true; }
function updatersscache($num) { global $_G; $processname = 'forum_rss_cache'; if (discuz_process::islocked($processname, 600)) { return false; } DB::query("DELETE FROM " . DB::table('forum_rsscache') . ""); require_once libfile('function/post'); foreach ($_G['cache']['forums'] as $fid => $forum) { if ($forum['type'] != 'group') { $query = DB::query("SELECT tid, readperm, author, dateline, subject\n\t\t\t\tFROM " . DB::table('forum_thread') . "\n\t\t\t\tWHERE fid='{$fid}' AND displayorder>='0'\n\t\t\t\tORDER BY tid DESC LIMIT {$num}"); $forum['name'] = addslashes($forum['name']); while ($thread = DB::fetch($query)) { $thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous'; $thread['subject'] = addslashes($thread['subject']); $posttable = getposttablebytid($thread['tid']); $post = DB::fetch_first("SELECT pid, attachment, message, status FROM " . DB::table($posttable) . " WHERE tid='{$thread['tid']}' AND first='1'"); $attachdata = ''; if ($post['attachment'] == 2) { $attach = DB::fetch_first("SELECT remote, attachment, filesize FROM " . DB::table(getattachtablebytid($thread['tid'])) . " WHERE pid='{$post['pid']}' AND isimage='1' ORDER BY dateline LIMIT 1"); $attachdata = "\t" . $attach['remote'] . "\t" . $attach['attachment'] . "\t" . $attach['filesize']; } $thread['message'] = $post['message']; $thread['status'] = $post['status']; $thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(messagecutstr($thread['message'], 250 - strlen($attachdata)) . $attachdata); DB::query("REPLACE INTO " . DB::table('forum_rsscache') . " (lastupdate, fid, tid, dateline, forum, author, subject, description)\n\t\t\t\t\tVALUES ('{$_G['timestamp']}', '{$fid}', '{$thread['tid']}', '{$thread['dateline']}', '{$forum['name']}', '{$thread['author']}', '{$thread['subject']}', '{$thread['description']}')"); } } } discuz_process::unlock($processname); return true; }
function run($cronid = 0) { global $_G; $timestamp = TIMESTAMP; $cron = DB::fetch_first("SELECT * FROM " . DB::table('common_cron') . "\n\t\t\t\tWHERE " . ($cronid ? "cronid='{$cronid}'" : "available>'0' AND nextrun<='{$timestamp}'") . "\n\t\t\t\tORDER BY nextrun LIMIT 1"); $processname = 'DZ_CRON_' . (empty($cron) ? 'CHECKER' : $cron['cronid']); if ($cronid && !empty($cron)) { discuz_process::unlock($processname); } if (discuz_process::islocked($processname, 600)) { return false; } if ($cron) { $cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']); $cronfile = DISCUZ_ROOT . './source/include/cron/' . $cron['filename']; $cron['minute'] = explode("\t", $cron['minute']); discuz_cron::setnextime($cron); @set_time_limit(1000); @ignore_user_abort(TRUE); if (!@(include $cronfile)) { return false; } } discuz_cron::nextcron(); discuz_process::unlock($processname); return true; }
function run_timing($a) { global $_G; $timestamp = TIMESTAMP; $processname = 'TIMING_CRON_CHECK'; $check = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_timing') . " WHERE public_dateline<='{$timestamp}' "), 0); if ($check) { discuz_process::unlock($processname); } if (discuz_process::islocked($processname, 600)) { return false; } if (!$check) { return FALSE; } @set_time_limit(1000); @ignore_user_abort(TRUE); //防止发生异常,先预订一个1小时的总时间,假如发布文章需要2小时才完成。还未到2小时,又被触发了,这样会造成文章的重复发布 save_syscache('pick_timing', TIMESTAMP + 60 * 60 * 1); $optype_arr = array(1 => 'move_portal', 2 => 'move_forums', 3 => 'move_blog'); $query = DB::query("SELECT * FROM " . DB::table('strayer_timing') . " WHERE public_dateline<='{$timestamp}' ORDER by public_dateline"); $timing_aid_arr = $tid_arr = $args = array(); while ($rs = DB::fetch($query)) { $timing_aid_arr[] = dstripslashes($rs); $tid_arr[] = $rs['id']; } if (!$timing_aid_arr) { return; } pload('F:article,F:pick'); article_timing_delete($tid_arr); //不管有没有发布成功,先清理掉定时发布表里面的数据,防止文章又被重复检测到 foreach ($timing_aid_arr as $k => $rs) { $args = unserialize($rs['public_info']); $args['aid'] = array($rs['data_id']); $args['pid'] = $rs['pid']; $args['timing'] = 1; $args['cron_run'] = 1; $args['public_time'][$rs['data_id']] = $rs['public_dateline']; article_import($optype_arr[$rs['public_type']], $args); } save_syscache('pick_timing', TIMESTAMP + 600); //成功运行,时间按正常设置 discuz_process::unlock($processname); return true; }
/** * 运行cron * * @param int $cronid 执行某个cron,如果不指定则运行当前需要运行的 * @return true */ public static function run($cronid = 0) { global $_G; $cron = $cronid ? C::t('common_cron')->fetch($cronid) : C::t('common_cron')->fetch_nextrun(TIMESTAMP); //取出一条符合执行条件的计划任务 $processname = 'DZ_CRON_' . (empty($cron) ? 'CHECKER' : $cron['cronid']); if ($cronid && !empty($cron)) { discuz_process::unlock($processname); //为手动执行计划任务解锁 } if (discuz_process::islocked($processname, 600)) { //检查计划任务进程是否上锁 return false; } if ($cron) { //计划任务执行 $cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']); $efile = explode(':', $cron['filename']); if (count($efile) > 1) { $cronfile = in_array($efile[0], $_G['setting']['plugins']['available']) ? DISCUZ_ROOT . './source/plugin/' . $efile[0] . '/cron/' . $efile[1] : ''; } else { $cronfile = DISCUZ_ROOT . './source/include/cron/' . $cron['filename']; } if ($cronfile) { $cron['minute'] = explode("\t", $cron['minute']); self::setnextime($cron); //根据后台设置,更新该计划任务执行的时间 @set_time_limit(1000); @ignore_user_abort(TRUE); //设置与客户机断开不会终止脚本的执行 if (!@(include $cronfile)) { //执行具体计划任务程序 return false; } } } self::nextcron(); //设置最近一次计划任务执行的时间 discuz_process::unlock($processname); //解锁 return true; }
/** * [Discuz!] (C)2001-2009 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: connect_check.php 27643 2012-02-08 11:20:46Z zhouxiaobo $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } require_once libfile('function/connect'); require_once libfile('function/cloud'); $op = !empty($_G['gp_op']) ? $_G['gp_op'] : ''; if (!in_array($op, array('cookie'))) { connect_ajax_ouput_message('0', '1'); } if ($op == 'cookie') { $settings = array(); $query = DB::query("SELECT skey, svalue FROM " . DB::table('common_setting') . " WHERE skey IN ('connect_login_times', 'connect_login_report_date')"); while ($setting = DB::fetch($query)) { $settings[$setting['skey']] = $setting['svalue']; } if ($settings['connect_login_times'] && (empty($settings['connect_login_report_date']) || dgmdate(TIMESTAMP, 'Y-m-d') != $settings['connect_login_report_date'])) { if (!discuz_process::islocked('connect_login_report', 600)) { $result = connect_cookie_login_report($settings['connect_login_times']); if (isset($result['status']) && $result['status'] == 0) { DB::query("REPLACE INTO " . DB::table('common_setting') . " (`skey`, `svalue`)\n\t\t\t\tVALUES ('connect_login_times', '0'), ('connect_login_report_date', '" . dgmdate(TIMESTAMP, 'Y-m-d') . "')"); } } discuz_process::unlock('connect_login_report'); } }
$status = 2; } else { $payrequired = $_G['uid'] ? !C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BAC', $attach['aid']) : 1; $status = $payrequired ? $status : 2; } $balance = $status != 2 ? $balance - $attach['price'] : $balance; $sidauth = rawurlencode(authcode($_G['sid'], 'ENCODE', $_G['authkey'])); $aidencode = aidencode($aid, 0, $attach['tid']); if (C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BAC', $aid)) { showmessage('attachment_yetpay', "forum.php?mod=attachment&aid={$aidencode}", array(), array('redirectmsg' => 1)); } $attach['netprice'] = $status != 2 ? round($attach['price'] * (1 - $_G['setting']['creditstax'])) : 0; $lockid = 'attachpay_' . $_G['uid']; if (!submitcheck('paysubmit')) { include template('forum/attachpay'); } elseif (!discuz_process::islocked($lockid)) { if (!empty($_GET['buyall'])) { $aids = $prices = array(); $tprice = 0; foreach (C::t('forum_attachment_n')->fetch_all_by_id('aid:' . $aid, 'pid', $attach['pid'], '', false, true) as $tmp) { $aids[$tmp['aid']] = $tmp['aid']; $prices[$tmp['aid']] = $status != 2 ? array($tmp['price'], round($tmp['price'] * (1 - $_G['setting']['creditstax']))) : array(0, 0); } if ($aids) { foreach (C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', $aids) as $tmp) { unset($aids[$tmp['relatedid']]); } } foreach ($aids as $aid) { $tprice += $prices[$aid][0]; }
function updatersscache($num) { global $_G; $processname = 'forum_rss_cache'; if (discuz_process::islocked($processname, 600)) { return false; } C::t('forum_rsscache')->truncate(); require_once libfile('function/post'); foreach ($_G['cache']['forums'] as $fid => $forum) { if ($forum['type'] != 'group') { $forum['name'] = addslashes($forum['name']); foreach (C::t('forum_thread')->fetch_all_by_fid_displayorder($fid, 0, null, null, 0, $num, 'tid') as $thread) { $thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous'; $thread['subject'] = addslashes($thread['subject']); $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']); $attachdata = ''; if ($post['attachment'] == 2) { $attach = C::t('forum_attachment_n')->fetch_max_image('tid:' . $thread['tid'], 'pid', $post['pid']); $attachdata = "\t" . $attach['remote'] . "\t" . $attach['attachment'] . "\t" . $attach['filesize']; } $thread['message'] = $post['message']; $thread['status'] = $post['status']; $thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(messagecutstr($thread['message'], 250 - strlen($attachdata)) . $attachdata); C::t('forum_rsscache')->insert(array('lastupdate' => $_G['timestamp'], 'fid' => $fid, 'tid' => $thread['tid'], 'dateline' => $thread['dateline'], 'forum' => $forum['name'], 'author' => $thread['author'], 'subject' => $thread['subject'], 'description' => $thread['description']), false, true); } } } discuz_process::unlock($processname); return true; }
public static function getqrcode() { global $_G; if (!$_G['wechat']['setting']) { $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']); } require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php'; $wechat_client = new WeChatClient($_G['wechat']['setting']['wechat_appId'], $_G['wechat']['setting']['wechat_appsecret']); $ticket = ''; if (!$_G['cookie']['wechat_ticket'] || $_G['wechat']['setting']['wechat_mtype'] == 1) { $code = 0; $i = 0; do { $code = rand(100000, 999999); $codeexists = C::t('#wechat#mobile_wechat_authcode')->fetch_by_code($code); $i++; } while ($codeexists && $i < 10); if ($_G['wechat']['setting']['wechat_mtype'] == 2) { $option = array('scene_id' => $code, 'expire' => self::$QRCODE_EXPIRE, 'ticketOnly' => '1'); $ticket = $wechat_client->getQrcodeTicket($option); if (!$ticket) { showmessage('wechat:wechat_message_codefull'); } dsetcookie('wechat_ticket', authcode($ticket . "\t" . $code, 'ENCODE'), self::$QRCODE_EXPIRE); } } else { list($ticket, $code) = explode("\t", authcode($_G['cookie']['wechat_ticket'], 'DECODE')); } $isqrapi = $ticket ? $ticket : ''; if ($codeexists) { showmessage('wechat:wechat_message_codefull'); } $qrcodeurl = !$isqrapi ? $_G['setting']['attachurl'] . 'common/' . $_G['wechat']['setting']['wechat_qrcode'] : $_G['siteurl'] . 'plugin.php?id=wechat:qrcode&rand=' . random(5); $codeenc = urlencode(base64_encode(authcode($code, 'ENCODE', $_G['config']['security']['authkey']))); C::t('#wechat#mobile_wechat_authcode')->insert(array('sid' => $_G['cookie']['saltkey'], 'uid' => $_G['uid'], 'code' => $code, 'createtime' => TIMESTAMP), 0, 1); if (!discuz_process::islocked('clear_wechat_authcode')) { C::t('#wechat#mobile_wechat_authcode')->delete_history(); discuz_process::unlock('clear_wechat_authcode'); } return array($isqrapi, $qrcodeurl, $codeenc, $code); }
$todaysay = "{$var['fastreply7']}"; break; case 8: $todaysay = "{$var['fastreply8']}"; break; default: $todaysay = "{$var['fastreply1']}"; } } elseif ($_G['gp_qdmode'] == '3') { $todaysay = "{$lang['wttodaysay']}"; } } else { $todaysay = "{$lang['wttodaysay']}"; } if ($var['lockopen']) { while (discuz_process::islocked('dsu_paulsign', 5)) { usleep(100000); } } if (in_array($_G['groupid'], $jlxgroups) && $var['jlx'] != '0') { $credit = $credit * $var['jlx']; } $num = DB::result_first("SELECT COUNT(*) FROM " . DB::table('dsu_paulsign') . " WHERE time >= {$tdtime} "); if (!$qiandaodb['uid']) { DB::query("INSERT INTO " . DB::table('dsu_paulsign') . " (uid,time) VALUES ('{$_G['uid']}',{$_G['timestamp']})"); } DB::query("UPDATE " . DB::table('dsu_paulsign') . " SET days=days+1,mdays=mdays+1,time='{$_G['timestamp']}',qdxq='{$_G['gp_qdxq']}',todaysay='{$todaysay}',reward=reward+{$credit},lastreward='{$credit}' WHERE uid='{$_G['uid']}'"); updatemembercount($_G['uid'], array($var['nrcredit'] => $credit)); $another_vip = ''; if (@(include_once DISCUZ_ROOT . './source/plugin/dsu_kkvip/extend/sign.api.php')) { $rewarddays = intval($rewarddays);
function checkflood() { global $_G; if (!$_G['group']['disablepostctrl'] && $_G['uid']) { if ($_G['setting']['floodctrl'] && discuz_process::islocked("post_lock_" . $_G['uid'], $_G['setting']['floodctrl'])) { return true; } return false; } return FALSE; }
public function global_footer() { global $_G, $_GET; if (self::$securityStatus != TRUE) { return false; } $formhash = formhash(); if ($_G['adminid']) { $processName = 'securityOperate'; if (self::$isAdminGroup && !discuz_process::islocked($processName, 30)) { $ajaxReportScript = <<<EOF \t\t\t\t\t<script type='text/javascript'> \t\t\t\t\tvar url = SITEURL + '/plugin.php?id=security:sitemaster'; \t\t\t\t\tvar x = new Ajax(); \t\t\t\t\tx.post(url, 'formhash={$formhash}', function(s){}); \t\t\t\t\t</script> EOF; } } $processName = 'securityRetry'; $time = 10; if (!discuz_process::islocked($processName, $time)) { if (C::t('#security#security_failedlog')->count()) { $ajaxRetryScript = <<<EOF \t\t\t\t\t<script type='text/javascript'> \t\t\t\t\tvar urlRetry = SITEURL + '/plugin.php?id=security:job'; \t\t\t\t\tvar ajaxRetry = new Ajax(); \t\t\t\t\tajaxRetry.post(urlRetry, 'formhash={$formhash}', function(s){}); \t\t\t\t\t</script> EOF; } } if ($_G['setting']['connect']['allow'] && !$_G['uid'] && $_G['setting']['security_qqlogin_alone']) { $loginboxdisappear = <<<EOF \t\t\t\t<script type="text/javascript"> \t\t\t\tif(\$('lsform')) { \t\t\t\t\tvar divs = \$('lsform').getElementsByTagName('div'); \t\t\t\t\tfor(i in divs) { \t\t\t\t\t\tif(divs[i] && divs[i].className == 'y pns') { \t\t\t\t\t\t\tdivs[i].style.display = 'none'; \t\t\t\t\t\t} \t\t\t\t\t\tif(divs[i] && divs[i].className == 'fastlg_fm y') { \t\t\t\t\t\t\tdivs[i].style.borderWidth = '0px'; \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t} \t\t\t\t</script> EOF; if (!(CURMODULE == 'connect' && $_G['connectguest'])) { $_G['connect']['referer'] = !$_G['inajax'] && CURSCRIPT != 'member' ? $_G['basefilename'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '') : dreferer(); $_G['connect']['login_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=init&referer=' . urlencode($_G['connect']['referer'] ? $_G['connect']['referer'] : 'index.php'); $loginstr = '<div class="rfm bw0"><table><tr><th>' . lang('plugin/security', 'quicklogin') . ': </th><td><a href="' . $_G['connect']['login_url'] . '&statfrom=login" target="_top" rel="nofollow"><img src="' . IMGDIR . '/qq_login.gif" class="vm" /></a></td></tr></table></div>'; $loginboxdisappear .= <<<EOF \t\t\t\t<script type="text/javascript"> \t\t\t\tvar loginform = document.getElementsByTagName('form'); \t\t\t\tif(loginform) { \t\t\t\t\tfor(i in loginform) { \t\t\t\t\t\tif(loginform[i].id && loginform[i].id.substr(0, 11) == 'loginform_L') { \t\t\t\t\t\t\tloginform[i].innerHTML = '{$loginstr}'; \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t} \t\t\t\t</script> EOF; } } if ($_G['setting']['connect']['allow'] && $_G['uid'] && $_G['setting']['security_safelogin'] && !$_G['member']['conisbind'] && CURMODULE != 'post' && getcookie('safelogintips')) { $msg = '<p>' . lang('plugin/security', 'safelogintips') . '</p><p class="mtm"><a href="connect.php?mod=config" target="_blank"><img src="' . IMGDIR . '/qq_bind_small.gif" class="qq_bind" align="absmiddle" /></a></p>'; $safelogintips = <<<EOF \t\t\t\t<script type="text/javascript"> \t\t\t\thideWindow('safelogintips'); \t\t\t\tshowDialog('{$msg}', 'notice', null, '(function() { window.location.href="connect.php?mod=config"; })();', 0, null, null, null, null, null, null); \t\t\t\t</script> EOF; dsetcookie('safelogintips'); } return $ajaxReportScript . $ajaxRetryScript . $loginboxdisappear . $safelogintips; }
function getranklistdata($type, $view = '', $orderby = 'all') { global $_G; $cache_time = $_G['setting']['ranklist'][$type]['cache_time']; $cache_num = $_G['setting']['ranklist'][$type]['show_num']; if ($cache_time <= 0) { $cache_time = 5; } $cache_time = $cache_time * 3600; if ($cache_num <= 0) { $cache_num = 20; } $ranklistvars = array(); loadcache('ranklist_' . $type); $ranklistvars =& $_G['cache']['ranklist_' . $type][$view][$orderby]; if (empty($ranklistvars['lastupdated']) || TIMESTAMP - $ranklistvars['lastupdated'] > $cache_time) { $functionname = 'getranklist_' . $type; if (!discuz_process::islocked('ranklist_update', 600)) { $ranklistvars = $functionname($cache_num, $view, $orderby); $ranklistvars['lastupdated'] = TIMESTAMP; $ranklistvars['lastupdate'] = dgmdate(TIMESTAMP); $ranklistvars['nextupdate'] = dgmdate(TIMESTAMP + $cache_time); $_G['cache']['ranklist_' . $type][$view][$orderby] = $ranklistvars; save_syscache('ranklist_' . $type, $_G['cache']['ranklist_' . $type]); } discuz_process::unlock('ranklist_update'); } $_G['lastupdate'] = $ranklistvars['lastupdate']; $_G['nextupdate'] = $ranklistvars['nextupdate']; unset($ranklistvars['lastupdated'], $ranklistvars['lastupdate'], $ranklistvars['nextupdate']); return $ranklistvars; }
$code = $response['ret']; $message = lang('plugin/qqconnect', 'connect_broadcast_success'); } } } elseif ($pluginop == 'sync_tthread') { // hash 验证 if (trim($_GET['formhash']) != formhash()) { showmessage('submit_invalid'); } if (!$_G['setting']['connect']['t']['reply']) { exit; //note 未开启 } $tid = $_GET['tid']; $processname = 'connect_tthread_' . $tid . '_cache'; if (discuz_process::islocked($processname, 600)) { //note 防止并发 exit; } $thread = C::t('forum_thread')->fetch($tid); if (!$thread || $thread['closed'] == 1 || getstatus($thread['status'], 3) || $thread['displayorder'] < 0 || !empty($_G['forum']['replyperm'])) { discuz_process::unlock($processname); exit; //note 主题不存在、主题关闭、主题未显示出来或者为抢楼贴时,不处理回流信息 } //$updatetime = DB::result_first("SELECT updatetime FROM ".DB::table('connect_tthreadlog')." WHERE tid='$tid' ORDER BY updatetime DESC LIMIT 1"); $updatetime = C::t('#qqconnect#connect_tthreadlog')->fetch_max_updatetime_by_tid($tid); if ($_G['timestamp'] < $updatetime + 10 * 60) { discuz_process::unlock($processname); exit; //note 10分钟更新一次, 如果可以thread里面加一个字段weiboupdatetime更好了
function block_updatecache($bid, $forceupdate = false) { global $_G; if (isset($_G['block'][$bid]['cachetime']) && $_G['block'][$bid]['cachetime'] < 0 || !$forceupdate && discuz_process::islocked('block_update_cache', 5)) { return false; } C::t('common_block')->clear_cache($bid); $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid]; if (!$block) { return false; } $obj = block_script($block['blockclass'], $block['script']); if (is_object($obj)) { C::t('common_block')->update($bid, array('dateline' => TIMESTAMP)); $_G['block'][$bid]['dateline'] = TIMESTAMP; $theclass = block_getclass($block['blockclass']); $thestyle = !empty($block['styleid']) ? block_getstyle($block['styleid']) : dunserialize($block['blockstyle']); if (in_array($block['blockclass'], array('forum_thread', 'group_thread', 'space_blog', 'space_pic', 'portal_article'))) { $datalist = array(); $mapping = array('forum_thread' => 'tid', 'group_thread' => 'tid', 'space_blog' => 'blogid', 'space_blog' => 'picid', 'portal_article' => 'aid'); $idtype = $mapping[$block['blockclass']]; $bannedids = !empty($block['param']['bannedids']) ? explode(',', $block['param']['bannedids']) : array(); $bannedsql = $bannedids ? ' AND id NOT IN (' . dimplode($bannedids) . ')' : ''; $shownum = intval($block['shownum']); $titlelength = !empty($block['param']['titlelength']) ? intval($block['param']['titlelength']) : 40; $summarylength = !empty($block['param']['summarylength']) ? intval($block['param']['summarylength']) : 80; foreach (C::t('common_block_item_data')->fetch_all_by_bid($bid, 1, 0, $shownum * 2, $bannedids, false) as $value) { $value['title'] = cutstr($value['title'], $titlelength, ''); $value['summary'] = cutstr($value['summary'], $summarylength, ''); $value['itemtype'] = '3'; $datalist[] = $value; $bannedids[] = intval($value['id']); } $leftnum = $block['shownum'] - count($datalist); if ($leftnum > 0 && empty($block['isblank'])) { if ($leftnum != $block['param']['items']) { $block['param']['items'] = $leftnum; $block['param']['bannedids'] = implode(',', $bannedids); } $return = $obj->getdata($thestyle, $block['param']); $return['data'] = array_merge($datalist, (array) $return['data']); } else { $return['data'] = $datalist; } } else { $return = $obj->getdata($thestyle, $block['param']); } if ($return['data'] === null) { $_G['block'][$block['bid']]['summary'] = $return['html']; C::t('common_block')->update($bid, array('summary' => $return['html'])); } else { $_G['block'][$block['bid']]['itemlist'] = block_updateitem($bid, $return['data']); } } else { C::t('common_block')->update($bid, array('dateline' => TIMESTAMP + 999999, 'cachetime' => 0)); $_G['block'][$bid]['dateline'] = TIMESTAMP + 999999; } if (C::t('common_block')->allowmem) { memory('set', 'blockcache_' . $bid, $_G['block'][$bid], C::t('common_block')->cache_ttl); $styleid = $_G['block'][$bid]['styleid']; if ($styleid && $_G['blockstyle_' . $styleid]) { memory('set', 'blockstylecache_' . $styleid, $_G['blockstyle_' . $styleid], C::t('common_block')->cache_ttl); } } discuz_process::unlock('block_update_cache'); }
private function _startSign($res) { global $_G; loadcache('pluginlanguage_script'); $lang = $_G['cache']['pluginlanguage_script']['dsu_paulsign']; //获取语言包 $var = $_G['cache']['plugin']['dsu_paulsign']; // 获取插件的配置信息 if (!$var['ifopen']) { if ($var['plug_clsmsg'] == '') { $var['plug_clsmsg'] = WebUtils::t('签到插件没有开启'); } return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$var['plug_clsmsg']}"); } $htime = dgmdate($_G['timestamp'], 'H', $var['tos']); // 获取当前的时间,小时 $groups = unserialize($var['groups']); // 获取允许签到的用户组 // 本月签到的处理 $qddb = DB::fetch_first("SELECT time FROM " . DB::table('dsu_paulsign') . " ORDER BY time DESC limit 0,1"); $lastmonth = dgmdate($qddb['time'], 'm', $var['tos']); $nowmonth = dgmdate($_G['timestamp'], 'm', $var['tos']); if ($nowmonth != $lastmonth) { DB::query("UPDATE " . DB::table('dsu_paulsign') . " SET mdays=0 WHERE uid"); } // 获取当前用户发贴总数 $post = DB::fetch_first("SELECT posts FROM " . DB::table('common_member_count') . " WHERE uid='{$_G['uid']}'"); $read_ban = explode(",", $var['ban']); //查看黑名单用户 // 用户签到的信息 $qiandaodb = DB::fetch_first("SELECT * FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'"); $tdtime = gmmktime(0, 0, 0, dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos'])) - $var['tos'] * 3600; // 心情初始化 // $emots = unserialize($_G['setting']['paulsign_emot']); $_GET['qdxq'] = 'kx'; $credit = mt_rand($var['mincredit'], $var['maxcredit']); // 奖励积分值的设置 // 客户端奖励倍数 $appbymePlug = WebUtils::getDzPluginAppbymeAppConfig('dzsyscache_sign_extcredit_base'); $appbymePlug = $appbymePlug !== false ? $appbymePlug : 100; $credit = $appbymePlug * 0.01 * $credit; $jlxgroups = unserialize($var['jlxgroups']); //奖励增倍的指定用户组选择 //前N额外奖励项自定义 $njlmain = str_replace(array("\r\n", "\n", "\r"), '/hhf/', $var['jlmain']); $extreward = explode("/hhf/", $njlmain); $extreward_num = count($extreward); $stats = DB::fetch_first("SELECT * FROM " . DB::table('dsu_paulsignset') . " WHERE id='1'"); // 判断是否开启时间段限制 if ($var['timeopen']) { if ($htime < $var['stime']) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_timeearly1']}{$var[stime]}{$lang['ts_timeearly2']}"); } elseif ($htime > $var['ftime']) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_timeov']}"); } } // 判断允许签到的用户组 if (!in_array($_G['groupid'], $groups)) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_notallow']}"); } // 判断当前用户的发帖总数是否允许签到 if ($var['mintdpost'] > $post['posts']) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_minpost1']}{$var[mintdpost]}{$lang['ts_minpost2']}"); } //判断当前用户是否在黑名单中 if (in_array($_G['uid'], $read_ban)) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_black']}"); } // 当前用户是否签到的判断 if ($qiandaodb['time'] > $tdtime) { return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT . ":{$lang['ts_yq']}"); } // 心情的处理 // if (!array_key_exists($_GET['qdxq'], $emots)) { // return WebUtils::makeErrorInfo_oldVersion($res, MOBCENT_ERROR_DEFAULT.":{$lang['ts_xqnr']}"); // } // 今日想说的话 $todaysay = WebUtils::getDzPluginAppbymeAppConfig('mobile_sign_text'); empty($todaysay) && ($todaysay = $lang['wttodaysay']); //判断签到进程锁 if ($var['lockopen']) { while (discuz_process::islocked('dsu_paulsign', 5)) { usleep(100000); } } // jlx : 指定用户组获取奖励是一般的几倍 if (in_array($_G['groupid'], $jlxgroups) && $var['jlx'] !== '0') { $credit = $credit * $var['jlx']; } // 连续签到指数开关 if ($tdtime - $qiandaodb['time'] < 86400 && $var['lastedop'] && $qiandaodb['lasted'] !== '0') { $randlastednum = mt_rand($var['lastednuml'], $var['lastednumh']); $randlastednum = sprintf("%03d", $randlastednum); $randlastednum = '0.' . $randlastednum; $randlastednum = $randlastednum * $qiandaodb['lasted']; $credit = round($credit * (1 + $randlastednum)); } $num = DB::result_first("SELECT COUNT(*) FROM " . DB::table('dsu_paulsign') . " WHERE time >= {$tdtime} "); if (!$qiandaodb['uid']) { DB::query("INSERT INTO " . DB::table('dsu_paulsign') . " (uid,time) VALUES ('{$_G['uid']}',{$_G['timestamp']})"); } // 连续签到指数 if ($tdtime - $qiandaodb['time'] < 86400 && $var['lastedop']) { DB::query("UPDATE " . DB::table('dsu_paulsign') . " SET days=days+1,mdays=mdays+1,time='{$_G['timestamp']}',qdxq='{$_GET['qdxq']}',todaysay='{$todaysay}',reward=reward+{$credit},lastreward='{$credit}',lasted=lasted+1 WHERE uid='{$_G['uid']}'"); } else { DB::query("UPDATE " . DB::table('dsu_paulsign') . " SET days=days+1,mdays=mdays+1,time='{$_G['timestamp']}',qdxq='{$_GET['qdxq']}',todaysay='{$todaysay}',reward=reward+{$credit},lastreward='{$credit}',lasted='1' WHERE uid='{$_G['uid']}'"); } // 添加积分操作 updatemembercount($_G['uid'], array($var['nrcredit'] => $credit)); require_once libfile('function/post'); require_once libfile('function/forum'); // 是否同步到记录 if ($var['sync_say'] && $_GET['qdmode'] == '1') { } // 是否同步到广播大厅 if ($var['sync_follow'] && $_GET['qdmode'] == '1' && $_G['setting']['followforumid']) { } // 每日最想说是否同步到签名 if ($var['sync_sign'] && $_G['group']['maxsigsize']) { $signhtml = cutstr(strip_tags($todaysay . $lang['fromsign']), $_G['group']['maxsigsize']); DB::update('common_member_field_forum', array('sightml' => $signhtml), "uid='{$_G['uid']}'"); } // 对前N额外奖励项 if ($num <= $extreward_num - 1) { list($exacr, $exacz) = explode("|", $extreward[$num]); $psc = $num + 1; if ($exacr && $exacz) { updatemembercount($_G['uid'], array($exacr => $exacz)); } } // 获取主题和帖子要插入的状态信息 $topicStatus = $this->getClientApp('topic', $_GET['platType']); $postStatus = $this->getClientApp('post', $_GET['platType']); // 对签到自动回复的类型进行处理 // 2:指定贴自动回复 if ($var['qdtype'] == '2') { $thread = DB::fetch_first("SELECT * FROM " . DB::table('forum_thread') . " WHERE tid='{$var['tidnumber']}'"); $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']); if ($num >= 0 && $num <= $extreward_num - 1 && $exacr && $exacz) { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$psc}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}.{$another_vip}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_09]}{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}.{$another_vip}[/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } $pid = insertpost(array('fid' => $thread['fid'], 'tid' => $var['tidnumber'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => '', 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => '0', 'anonymous' => '0', 'usesig' => '0', 'htmlon' => '0', 'bbcodeoff' => '0', 'smileyoff' => '0', 'parseurloff' => '0', 'attachment' => '0', 'status' => $postStatus)); DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$_G['username']}', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$var['tidnumber']}' AND fid='{$thread['fid']}'", 'UNBUFFERED'); updatepostcredits('+', $_G['uid'], 'reply', $thread['fid']); $lastpost = "{$thread['tid']}\t" . addslashes($thread['subject']) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$thread['fid']}'", 'UNBUFFERED'); $tidnumber = $var['tidnumber']; // 指定板块每天一主题 } elseif ($var['qdtype'] == '3') { if ($num == '0' || $stats['qdtidnumber'] == '0') { $subject = str_replace(array('{m}', '{d}', '{y}', '{bbname}', '{author}'), array(dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos']), $_G['setting']['bbname'], $_G['username']), $var['title_thread']); $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']); if ($exacr && $exacz) { $message = "[quote][size=2][color=dimgray]{$lang[tsn_10]}[/color][url={$_G[siteurl]}plugin.php?id=dsu_paulsign:sign][color=darkorange]{$lang[tsn_11]}[/color][/url][color=dimgray]{$lang[tsn_12]}[/color][/size][/quote][quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$lang[tsn_13]}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}.{$another_vip}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=dimgray]{$lang[tsn_10]}[/color][url={$_G[siteurl]}plugin.php?id=dsu_paulsign:sign][color=darkorange]{$lang[tsn_11]}[/color][/url][color=dimgray]{$lang[tsn_12]}[/color][/size][/quote][quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$lang[tsn_13]}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}.{$another_vip}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } DB::query("INSERT INTO " . DB::table('forum_thread') . " (fid, posttableid, readperm, price, typeid, sortid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, moderated, highlight, closed, status, isgroup) VALUES ('{$var['fidnumber']}', '0', '0', '0', '{$var['qdtypeid']}', '0', '{$_G['username']}', '{$_G['uid']}', '{$subject}', '{$_G['timestamp']}', '{$_G['timestamp']}', '{$_G['username']}', '0', '0', '0', '0', '1', '1', '1', '{$topicStatus}', '0')"); $tid = DB::insert_id(); DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET qdtidnumber = '{$tid}' WHERE id='1'"); $pid = insertpost(array('fid' => $var['fidnumber'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => '0', 'anonymous' => '0', 'usesig' => '0', 'htmlon' => '0', 'bbcodeoff' => '0', 'smileyoff' => '0', 'parseurloff' => '0', 'attachment' => '0', 'status' => $postStatus)); $expiration = $_G['timestamp'] + 86400; DB::query("INSERT INTO " . DB::table('forum_thread') . "mod (tid, uid, username, dateline, action, expiration, status) VALUES ('{$tid}', '{$_G['uid']}', '{$_G['username']}', '{$_G['timestamp']}', 'EHL', '{$expiration}', '1')"); DB::query("INSERT INTO " . DB::table('forum_thread') . "mod (tid, uid, username, dateline, action, expiration, status) VALUES ('{$tid}', '{$_G['uid']}', '{$_G['username']}', '{$_G['timestamp']}', 'CLS', '0', '1')"); updatepostcredits('+', $_G['uid'], 'post', $var['fidnumber']); $lastpost = "{$tid}\t" . addslashes($subject) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$var['fidnumber']}'", 'UNBUFFERED'); $tidnumber = $tid; } else { $tidnumber = $stats['qdtidnumber']; $thread = DB::fetch_first("SELECT subject FROM " . DB::table('forum_thread') . " WHERE tid='{$tidnumber}'"); $hft = dgmdate($_G['timestamp'], 'Y-m-d H:i', $var['tos']); if ($num >= 1 && $num <= $extreward_num - 1 && $exacr && $exacz) { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_02]}[color=red]{$lang[tsn_03]}[/color][color=darkorange]{$lang[tsn_04]}{$psc}{$lang[tsn_05]}[/color]{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit}[/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][color=gray]{$lang[tsn_17]}[/color] [color=gray]{$_G[setting][extcredits][$exacr][title]} [/color][color=darkorange]{$exacz}[/color][color=gray]{$_G[setting][extcredits][$exacr][unit]}[/color][/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } else { $message = "[quote][size=2][color=gray][color=teal] [/color][color=gray]{$lang[tsn_01]}[/color] [color=darkorange]{$hft}[/color] {$lang[tsn_09]}{$lang[tsn_06]} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][title]} [/color][color=darkorange]{$credit} [/color][color=gray]{$_G[setting][extcredits][$var[nrcredit]][unit]}[/color][/size][/quote][size=3][color=dimgray]{$lang[tsn_07]}[color=red]{$todaysay}[/color]{$lang[tsn_08]}[/color][/size]"; } // $message = $this->getClientApp($message, $_GET['platType']); $pid = insertpost(array('fid' => $var['fidnumber'], 'tid' => $tidnumber, 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => '', 'dateline' => $_G['timestamp'], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => '0', 'anonymous' => '0', 'usesig' => '0', 'htmlon' => '0', 'bbcodeoff' => '0', 'smileyoff' => '0', 'parseurloff' => '0', 'attachment' => '0', 'status' => $postStatus)); DB::query("UPDATE " . DB::table('forum_thread') . " SET lastposter='{$_G['username']}', lastpost='{$_G['timestamp']}', replies=replies+1 WHERE tid='{$tidnumber}' AND fid='{$var['fidnumber']}'", 'UNBUFFERED'); updatepostcredits('+', $_G['uid'], 'reply', $var['fidnumber']); $lastpost = "{$tidnumber}\t" . addslashes($thread['subject']) . "\t{$_G['timestamp']}\t{$_G['username']}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}', posts=posts+1, todayposts=todayposts+1 WHERE fid='{$var['fidnumber']}'", 'UNBUFFERED'); } } if (memory('check')) { memory('set', 'dsu_pualsign_' . $_G['uid'], $_G['timestamp'], 86400); } if ($num == 0) { if ($stats['todayq'] > $stats['highestq']) { DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET highestq='{$stats['todayq']}' WHERE id='1'"); } DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET yesterdayq='{$stats['todayq']}',todayq=1 WHERE id='1'"); DB::query("UPDATE " . DB::table('dsu_paulsignemot') . " SET count=0"); } else { DB::query("UPDATE " . DB::table('dsu_paulsignset') . " SET todayq=todayq+1 WHERE id='1'"); } DB::query("UPDATE " . DB::table('dsu_paulsignemot') . " SET count=count+1 WHERE qdxq='{$_GET['qdxq']}'"); $lasted = DB::result_first("SELECT lasted FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'"); if ($exacr && $exacz) { $message = "{$lang[tsn_14]}{$lang[tsn_03]}{$lang[tsn_04]}{$psc}{$lang[tsn_15]}{$lang[classn_12]}{$lasted}{$lang[classn_02]}{$lang[tsn_06]}{$_G[setting][extcredits][$var[nrcredit]][title]}{$credit}{$_G[setting][extcredits][$var[nrcredit]][unit]}{$lang[tsn_16]}{$_G[setting][extcredits][$exacr][title]}{$exacz}{$_G[setting][extcredits][$exacr][unit]}"; return WebUtils::makeErrorInfo_oldVersion($res, $message, $params = array('noError' => 1)); } else { $psc = $num + 1; $message = "{$lang[tsn_14]}{$lang[tsn_03]}{$lang[tsn_04]} {$psc} {$lang[tsn_15]}{$lang[classn_12]} {$lasted} {$lang[classn_02]}{$lang[tsn_06]}{$_G[setting][extcredits][$var[nrcredit]][title]} {$credit} {$_G[setting][extcredits][$var[nrcredit]][unit]}"; return WebUtils::makeErrorInfo_oldVersion($res, $message, $params = array('noError' => 1)); } }
<?php if (!defined('IN_DISCUZ')) { exit('Access Denied'); } $processname = 'dsu_amu_call,e'; $ywzx = discuz_process::islocked($processname, 500); if (!$ywzx) { $adds = strip_tags($_G['gp_adds']); $_G['gp_keywords'] = str_replace("'", "", $_G['gp_keywords']); $_G['gp_keywords'] = str_replace('"', "", $_G['gp_keywords']); $key = strip_tags($_G['gp_keywords']) ? strip_tags($_G['gp_keywords']) : mt_rand(1, 9); $lists = array(); if ($key && submitcheck('callmesubmit') && $_G['uid']) { $len = strlen($key); $sql1 = "SELECT fusername FROM " . DB::table('home_friend') . " WHERE uid = '" . $_G['uid'] . "' AND fusername LIKE '" . $key . "%' LIMIT 0 ,8"; $query = DB::query($sql1); while ($value = DB::fetch($query)) { $value = $value['fusername']; $lists[] = $value; $listnames[] = $value['fusername']; } $i = 8 - count($listnames); if ($i > 0) { $sql2 = "SELECT username FROM " . DB::table('common_member') . " WHERE username LIKE '" . $key . "%' LIMIT 0 ," . $i; } $query = DB::query($sql2); while ($value = DB::fetch($query)) { if (!in_array($value['username'], $listnames)) { $value = $value['username']; $lists[] = $value;
function block_updatecache($bid, $forceupdate = false) { global $_G; if (isset($_G['block'][$bid]['cachetime']) && $_G['block'][$bid]['cachetime'] < 0 || !$forceupdate && discuz_process::islocked('block_update_cache', 5)) { return false; } block_memory_clear($bid); $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid]; if (!$block) { return; } $obj = block_script($block['blockclass'], $block['script']); if (is_object($obj)) { DB::update('common_block', array('dateline' => TIMESTAMP), array('bid' => $bid)); $_G['block'][$bid]['dateline'] = TIMESTAMP; $block['param'] = empty($block['param']) ? array() : unserialize($block['param']); $theclass = block_getclass($block['blockclass']); $thestyle = !empty($block['styleid']) ? block_getstyle($block['styleid']) : unserialize($block['blockstyle']); if (in_array($block['blockclass'], array('forum_thread', 'group_thread', 'space_blog', 'space_pic', 'portal_article'))) { $datalist = array(); $mapping = array('forum_thread' => 'tid', 'group_thread' => 'tid', 'space_blog' => 'blogid', 'space_blog' => 'picid', 'portal_article' => 'aid'); $idtype = $mapping[$block['blockclass']]; $bannedids = !empty($block['param']['bannedids']) ? explode(',', $block['param']['bannedids']) : array(); $bannedsql = $bannedids ? ' AND id NOT IN (' . dimplode($bannedids) . ')' : ''; $shownum = intval($block['shownum']); $titlelength = !empty($block['param']['titlelength']) ? intval($block['param']['titlelength']) : 40; $summarylength = !empty($block['param']['summarylength']) ? intval($block['param']['summarylength']) : 80; $query = DB::query('SELECT * FROM ' . DB::table('common_block_item_data') . " WHERE bid='{$bid}' AND isverified='1' {$bannedsql} ORDER BY stickgrade DESC, verifiedtime DESC LIMIT {$shownum}"); while ($value = DB::fetch($query)) { $value['title'] = cutstr($value['title'], $titlelength, ''); $value['summary'] = cutstr($value['summary'], $summarylength, ''); $value['itemtype'] = '3'; $datalist[] = $value; $bannedids[] = intval($value['id']); } $leftnum = $block['shownum'] - count($datalist); if ($leftnum > 0 && empty($block['isblank'])) { $block['param']['items'] = $leftnum; $block['param']['bannedids'] = implode(',', $bannedids); $return = $obj->getdata($thestyle, $block['param']); $return['data'] = array_merge($datalist, (array) $return['data']); } else { $return['data'] = $datalist; } } else { $return = $obj->getdata($thestyle, $block['param']); } if ($return['data'] === null) { $_G['block'][$block['bid']]['summary'] = $return['html']; DB::update('common_block', array('summary' => daddslashes($return['html'])), array('bid' => $bid)); } else { $_G['block'][$block['bid']]['itemlist'] = block_updateitem($bid, $return['data']); } } else { DB::update('common_block', array('dateline' => TIMESTAMP + 999999, 'cachetime' => 0), array('bid' => $bid)); $_G['block'][$bid]['dateline'] = TIMESTAMP + 999999; } if (getglobal('setting/memory/diyblock/enable') && memory('check')) { memory('set', 'blockcache_' . $bid, $_G['block'][$bid], getglobal('setting/memory/diyblock/ttl')); $styleid = $_G['block'][$bid]['styleid']; if ($styleid && $_G['blockstyle_' . $styleid]) { memory('set', 'blockstylecache_' . $styleid, $_G['blockstyle_' . $styleid], getglobal('setting/memory/diyblock/ttl')); } } discuz_process::unlock('block_update_cache'); }
function block_updatecache($bid, $forceupdate = false) { global $_G; if (!$forceupdate && discuz_process::islocked('block_update_cache', 5)) { return false; } block_memory_clear($bid); $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid]; if (!$block) { return; } $obj = block_script($block['script']); if ($obj) { DB::update('common_block', array('dateline' => TIMESTAMP), array('bid' => $bid)); $block['param'] = empty($block['param']) ? array() : unserialize($block['param']); $theclass = block_getclass($block['blockclass']); if ($block['blockclass'] == 'portal_article') { $parameter = array('aids' => array()); $query = DB::query('SELECT aid FROM ' . DB::table('portal_article_title') . " WHERE bid='{$bid}'"); while ($value = DB::fetch($query)) { $parameter['aids'][] = intval($value['aid']); } $datalist = array(); if (!empty($parameter['aids'])) { $bannedids = !empty($block['param']['bannedids']) ? explode(',', $block['param']['bannedids']) : array(); if (!empty($bannedids)) { $parameter['aids'] = array_diff($parameter['aids'], $bannedids); } $bannedids = array_merge($bannedids, $parameter['aids']); $block['param']['bannedids'] = implode(',', $bannedids); $parameter['aids'] = implode(',', $parameter['aids']); $return = $obj->getdata($theclass['style'][$block['styleid']], $parameter); $datalist = $return['data']; } $return = $obj->getdata($theclass['style'][$block['styleid']], $block['param']); if ($datalist) { $return['data'] = array_merge($datalist, $return['data']); } } else { $return = $obj->getdata($theclass['style'][$block['styleid']], $block['param']); } if ($return['data'] === null) { $_G['block'][$block['bid']]['summary'] = $return['html']; DB::update('common_block', array('summary' => daddslashes($return['html'])), array('bid' => $bid)); } else { $_G['block'][$block['bid']]['itemlist'] = block_updateitem($bid, $return['data']); } } else { DB::update('common_block', array('dateline' => TIMESTAMP + 999999, 'cachetime' => 0), array('bid' => $bid)); } discuz_process::unlock('block_update_cache'); }
function update_guide_rsscache($type, $perpage) { global $_G; $processname = 'guide_rss_cache'; if (discuz_process::islocked($processname, 600)) { return false; } C::t('forum_rsscache')->delete_by_guidetype($type); require_once libfile('function/post'); $data = get_guide_list($type, 0, $perpage); foreach ($data['threadlist'] as $thread) { $thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous'; $thread['subject'] = addslashes($thread['subject']); $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']); $attachdata = ''; if ($post['attachment'] == 2) { $attach = C::t('forum_attachment_n')->fetch_max_image('tid:' . $thread['tid'], 'pid', $post['pid']); $attachdata = "\t" . $attach['remote'] . "\t" . $attach['attachment'] . "\t" . $attach['filesize']; } $thread['message'] = $post['message']; $thread['status'] = $post['status']; $thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(messagecutstr($thread['message'], 250 - strlen($attachdata)) . $attachdata); C::t('forum_rsscache')->insert(array('lastupdate' => $_G['timestamp'], 'fid' => $thread['fid'], 'tid' => $thread['tid'], 'dateline' => $thread['dbdateline'], 'forum' => strip_tags($data['forumnames'][$thread[fid]]['name']), 'author' => $thread['author'], 'subject' => $thread['subject'], 'description' => $thread['description'], 'guidetype' => $type), false, true); } discuz_process::unlock($processname); return true; }