function getdata($style, $parameter) { $array = array(); foreach ($parameter as $key => $value) { if (is_array($value)) { $parameter[$key] = implode(',', $value); } } $parameter['clientid'] = $this->blockdata['clientid']; $parameter['op'] = 'getdata'; $parameter['charset'] = CHARSET; $parameter['version'] = $this->blockdata['version']; $xmlurl = $this->blockdata['url']; $parse = parse_url($xmlurl); if (!empty($parse['host'])) { define('IN_ADMINCP', true); require_once libfile('function/importdata'); $importtxt = @dfsockopen($xmlurl, 0, create_sign_url($parameter, $this->blockdata['key'], $this->blockdata['signtype'])); } else { $importtxt = @file_get_contents($xmlurl); } if ($importtxt) { require libfile('class/xml'); $array = xml2array($importtxt); } $idtype = 'xml_' . $this->blockdata['id']; foreach ($array['data'] as $key => $value) { $value['idtype'] = $idtype; $array['data'][$key] = $value; } if (empty($array['data'])) { $array['data'] = null; } return $array; }
function user_login($uid) { $member = getuserbyuid($uid); $cookietime = 1296000; require_once libfile('function/member'); setloginstatus($member, $cookietime); }
function common() { global $_G; $seccodecheck = $secqaacheck = false; if ($_GET['type'] == 'register') { $seccodecheck = $_G['setting']['seccodestatus'] & 1; $secqaacheck = $_G['setting']['secqaa']['status'] & 1; } elseif ($_GET['type'] == 'login') { $seccodecheck = $_G['setting']['seccodestatus'] & 2; } elseif ($_GET['type'] == 'post') { $seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']); $secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']); } $sechash = random(8); if ($seccodecheck || $secqaacheck) { $variable = array('sechash' => $sechash); if ($seccodecheck) { $variable['seccode'] = $_G['siteurl'] . 'api/mobile/index.php?module=seccode&sechash=' . $sechash . '&version=' . (empty($_GET['secversion']) ? '1' : $_GET['secversion']); } if ($secqaacheck) { require_once libfile('function/seccode'); $variable['secqaa'] = make_secqaa($sechash); } } mobile_core::result(mobile_core::variable($variable)); }
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'); }
function updatersscache($num) { global $_G; 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 t.tid, t.readperm, t.author, t.dateline, t.subject\n\t\t\t\tFROM " . DB::table('forum_thread') . " t\n\t\t\t\tWHERE t.fid='{$fid}' AND t.displayorder>='0' AND t.price='0'\n\t\t\t\tORDER BY t.dateline 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('forum_attachment') . " 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(nl2br(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']}')"); } } } }
public function onMobileModule() { global $_G; if (!$_G['setting']['plugins']['available']) { return ''; } require_once libfile('function/admincp'); loadcache('pluginlanguage_script', 1); $return = array(); foreach ($_G['setting']['plugins']['available'] as $pluginid) { $row = array(); $modulefile = DISCUZ_ROOT . './source/plugin/' . $pluginid . '/discuz_mobile_' . $pluginid . '.xml'; if (file_exists($modulefile)) { $_GET['importtxt'] = @implode('', file($modulefile)); $pluginarray = getimportdata('Discuz! Mobile', 0, 1); if ($pluginarray) { foreach ($pluginarray as $name => $value) { $row[] = array('name' => isset($_G['cache']['pluginlanguage_script'][$pluginid][$name]) ? $_G['cache']['pluginlanguage_script'][$pluginid][$name] : $name, 'logo' => $value['logo'], 'url' => preg_match('/^http:\\/\\//', $value['url']) ? $value['url'] : $_G['siteurl'] . $value['url']); } } } $return[$pluginid] = $row; } return $return; }
function build_cache_diytemplatename() { $data = array(); $apps = array('portal', 'forum', 'group', 'home'); $nullname = lang('portalcp', 'diytemplate_name_null'); $scriptarr = $lostname = array(); foreach (C::t('common_diy_data')->range() as $datarow) { $datarow['name'] = $datarow['name'] ? $datarow['name'] : lang('portalcp', $datarow['targettplname'], '', ''); if (empty($datarow['name'])) { $lostname[$datarow['targettplname']] = $datarow['targettplname']; $datarow['name'] = $nullname; } $data[$datarow['targettplname']] = dhtmlspecialchars($datarow['name']); $curscript = substr($datarow['targettplname'], 0, strpos($datarow['targettplname'], '/')); if (in_array($curscript, $apps)) { $scriptarr[$curscript][$datarow['targettplname']] = true; } } if ($lostname) { require_once libfile('function/portalcp'); foreach (getdiytplnames($lostname) as $pre => $datas) { foreach ($datas as $id => $name) { $data[$pre . $id] = $name; } } } savecache('diytemplatename', $data); foreach ($scriptarr as $curscript => $value) { savecache('diytemplatename' . $curscript, $value); } }
function build_cache_forumrecommend() { $data = array(); $fids = C::t('forum_forum')->fetch_all_fids(); foreach ($fids as $row) { require_once libfile('function/group'); $recommendlist = C::t('forum_forum')->fetch_all_recommend_by_fid($row['fid']); foreach ($recommendlist as $info) { $group = array('fid' => $info['fid'], 'name' => $info['name'], 'threads' => $info['threads'], 'lastpost' => $info['lastpost'], 'icon' => $info['icon'], 'membernum' => $info['membernum'], 'description' => $info['description']); $group['icon'] = get_groupimg($group['icon'], 'icon'); $lastpost = array(0, 0, '', ''); $group['lastpost'] = is_string($group['lastpost']) ? explode("\t", $group['lastpost']) : $group['lastpost']; $group['lastpost'] = count($group['lastpost']) != 4 ? $lastpost : $group['lastpost']; list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $group['lastpost']; if ($lastpost['tid']) { $lastpost['dateline'] = dgmdate($lastpost['dateline'], 'Y-m-d H:i:s'); if ($lastpost['author']) { $lastpost['encode_author'] = rawurlencode($lastpost['author']); } $group['lastpost'] = $lastpost; } else { $group['lastpost'] = ''; } $data[$row['fid']][] = $group; } } savecache('forumrecommend', $data); }
function output() { global $_G; //帖子列表增加图片 -start require_once libfile('function/discuzcode'); foreach ($GLOBALS['data']['my']['threadlist'] as $k => $thread) { $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($GLOBALS['data']['my']['threadlist'][$k]['tid'], 0); $attachment[$post['pid']] = array(); $GLOBALS['data']['my']['threadlist'][$k]['pid'] = $post['pid']; //TODO:下面的代码直接调用discuzcode时,会报错 //./source/plugin/mobile/template/discuzcode.htm 文件不存在 //cp ./source/plugin/mobile/template/mobile/discuzcode.htm ./source/plugin/mobile/template/ //拷贝一份就可以了,原因未查明 $GLOBALS['data']['my']['threadlist'][$k]['message'] = discuzcode($post['message']); //附件,0无附件 1普通附件 2有图片附件 if (!empty($post['attachment']) && intval($post['attachment']) == 2) { $GLOBALS['data']['my']['threadlist'][$k]['attachments'] = array(); $GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = array(); require_once libfile('function/attachment'); $_G['tid'] = $post['tid']; parseattach(array_keys($attachment), array(), $attachment); $GLOBALS['data']['my']['threadlist'][$k]['attachments'] = $attachment[$post['pid']]['attachments']; $GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = $attachment[$post['pid']]['imagelist']; unset($_G['tid']); } } //帖子列表增加图片 -end $data['forumnames'] = $GLOBALS['data']['my']['forumnames']; $data['threadcount'] = $GLOBALS['data']['my']['threadcount']; $data['threadlist'] = array_values($GLOBALS['data']['my']['threadlist']); $variable = array('data' => $data, 'perpage' => $GLOBALS['perpage']); mobile_core::result(mobile_core::variable($variable)); }
function censormod($message) { require_once libfile('class/censor'); $censor = discuz_censor::instance(); $censor->check($message); return $censor->modmoderated(); }
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 make_secqaa($idhash) { global $_G; loadcache('secqaa'); $secqaakey = max(1, random(1, 1)); if ($_G['cache']['secqaa'][$secqaakey]['type']) { $etype = explode(':', $_G['cache']['secqaa'][$secqaakey]['question']); if (count($etype) > 1 && preg_match('/^[\\w\\_]+$/', $etype[0]) && preg_match('/^[\\w\\_]+$/', $etype[1])) { $qaafile = DISCUZ_ROOT . './source/plugin/' . $etype[0] . '/secqaa/secqaa_' . $etype[1] . '.php'; $class = $etype[1]; } else { $qaafile = libfile('secqaa/' . $_G['cache']['secqaa'][$secqaakey]['question'], 'class'); $class = $_G['cache']['secqaa'][$secqaakey]['question']; } if (file_exists($qaafile)) { @(include_once $qaafile); $class = 'secqaa_' . $class; if (class_exists($class)) { $qaa = new $class(); if (method_exists($qaa, 'make')) { $_G['cache']['secqaa'][$secqaakey]['answer'] = md5($qaa->make($_G['cache']['secqaa'][$secqaakey]['question'])); } } } } dsetcookie('secqaa' . $idhash, authcode($_G['cache']['secqaa'][$secqaakey]['answer'] . "\t" . (TIMESTAMP - 180) . "\t" . $idhash . "\t" . FORMHASH, 'ENCODE', $_G['config']['security']['authkey']), 0, 1, true); return $_G['cache']['secqaa'][$secqaakey]['question']; }
function usesubmit() { global $_G; if (empty($_GET['pid'])) { showmessage(lang('magic/repent', 'repent_info_nonexistence')); } $_G['tid'] = $_GET['ptid']; $post = getpostinfo($_GET['pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status')); $this->_check($post); require_once libfile('function/post'); require_once libfile('function/delete'); if ($post['first']) { if ($have_replycredit = C::t('forum_replycredit')->fetch($post['tid'])) { $thread = C::t('forum_thread')->fetch($post['tid']); if ($thread['replycredit']) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit)); } C::t('forum_replycredit')->delete($post['tid']); C::t('common_credit_log')->delete_by_operation_relatedid(array('RCT', 'RCA', 'RCB'), $post['tid']); } deletethread(array($post['tid'])); updateforumcount($post['fid']); } else { if ($post['replycredit'] > 0) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit'])); C::t('common_credit_log')->delete_by_uid_operation_relatedid($post['authorid'], 'RCA', $post['tid']); } deletepost(array($_GET['pid'])); updatethreadcount($post['tid']); } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']); showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); }
public static function check_seccode($value, $idhash) { global $_G; if (!$_G['setting']['seccodestatus']) { return true; } if (!is_numeric($_G['setting']['seccodedata']['type'])) { $codefile = libfile('seccode/' . $_G['setting']['seccodedata']['type'], 'class'); $class = $_G['setting']['seccodedata']['type']; if (file_exists($codefile)) { @(include_once $codefile); $class = 'seccode_' . $class; if (class_exists($class)) { $code = new $class(); if (method_exists($code, 'check')) { return $code->check($value, $idhash); } } } return false; } if (!isset($_G['cookie']['seccode' . $idhash])) { return false; } list($checkvalue, $checktime, $checkidhash, $checkformhash) = explode("\t", authcode($_G['cookie']['seccode' . $idhash], 'DECODE', $_G['config']['security']['authkey'])); return $checkvalue == strtoupper($value) && TIMESTAMP - 180 > $checktime && $checkidhash == $idhash && FORMHASH == $checkformhash; }
function fetch_by_jobid($jobid) { include_once libfile('function/organization'); $data = parent::fetch($jobid); $data['orgtree'] = getTreeByOrgid($data['orgid']); return $data; }
function outputvariables() { global $_G; $variables = array(); foreach ($this->params as $param) { if (substr($param, 0, 1) == '$') { if ($param == '$_G') { continue; } $var = substr($param, 1); if (preg_match("/^[a-zA-Z_][a-zA-Z0-9_]*\$/", $var)) { $variables[$param] = $GLOBALS[$var]; } } else { if (preg_replace($this->safevariables, '', $param) !== $param) { continue; } $variables[$param] = getglobal($param); } } $xml = array('Version' => $this->version, 'Charset' => strtoupper($_G['charset']), 'Variables' => $variables); if (!empty($_G['messageparam'])) { $xml['Message'] = $_G['messageparam']; } require_once libfile('class/xml'); echo array2xml($xml); exit; }
private function _updateUser($res, $gender, $avatar) { global $_G; include_once libfile('function/profile'); $setarr['gender'] = intval($gender); if ($setarr) { C::t('common_member_profile')->update($_G['uid'], $setarr); } manyoulog('user', $uid, 'update'); $operation = 'gender'; include_once libfile('function/feed'); feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile')); countprofileprogress(); // ob_start(); // $this->getController()->forward('user/uploadavatar', false); // $result = ob_get_clean(); // $picInfo = WebUtils::jsonDecode($result, true); // $avatar = $picInfo['pic_path']; // $avatar = !empty($_GET['avatar']) ? $_GET['avatar'] : ''; if (!empty($avatar)) { $_GET = array_merge($_GET, array('avatar' => $avatar)); ob_start(); $this->getController()->forward('user/saveavatar', false); $result = ob_get_clean(); $result = WebUtils::jsonDecode($result); if (WebUtils::checkError($result)) { return $this->makeErrorInfo($res, 'user_info_avatar_error'); } } return $this->makeErrorInfo($res, lang('message', 'profile_succeed'), array('noError' => 1)); }
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; }
private function _getAnnouncementInfo($res, $id) { global $_G; require_once libfile('function/discuzcode'); $announce = DzForumAnnouncement::getAnnouncementByUid($id); if (!count($announce)) { $res = $this->makeErrorInfo($res, 'announcement_nonexistence'); } else { $tempAnnounce = array(); $tempAnnounce['author'] = $announce['author']; $tmp = explode('.', dgmdate($announce['starttime'], 'Y.m')); $months[$tmp[0] . $tmp[1]] = $tmp; if (!empty($_GET['m']) && $_GET['m'] != dgmdate($announce['starttime'], 'Ym')) { continue; } $tempAnnounce['starttime'] = dgmdate($announce['starttime'], 'd'); $tempAnnounce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : ''; $tempAnnounce['title'] = WebUtils::emptyHtml($announce['subject']); $uid = DzCommonMember::getUidByUsername($announce['author']); $tempAnnounce['icon'] = UserUtils::getUserAvatar($uid); $announceMessage = $announce['type'] == 1 ? "{$announce[message]}" : $announceMessage; $announceMessage = nl2br(discuzcode($announce['message'], 0, 0, 1, 1, 1, 1, 1)); $announceType = array(); $announceType['infor'] = WebUtils::emptyHtml($announceMessage); $announce['type'] == 1 ? $announceType['type'] = 'url' : ($announceType['type'] = 'text'); $tempAnnounce['content'] = $announceType; $res['body']['list'] = $tempAnnounce; } return $res; }
public function check() { require_once libfile('function/admincp'); require_once libfile('function/plugin'); require_once libfile('function/cloudaddons'); $pluginarray = C::t('common_plugin')->fetch_all_data(); $addonids = array(); foreach ($pluginarray as $row) { if (ispluginkey($row['identifier'])) { $addonids[] = $row['identifier'] . '.plugin'; } } $checkresult = dunserialize(cloudaddons_upgradecheck($addonids)); savecache('addoncheck_plugin', $checkresult); $newversion = 0; foreach ($checkresult as $value) { list(, $newver) = explode(':', $value); if ($newver) { $newversion++; } } if ($newversion) { $return = array('status' => 1, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_plugin_new_plugin', array('newversion' => $newversion))); } else { $return = array('status' => 0, 'type' => 'none', 'lang' => lang('optimizer', 'optimizer_plugin_no_upgrade')); } return $return; }
function common() { global $_G; require_once libfile('function/seccode'); $seccode = make_seccode($_GET['sechash']); if (!$_G['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"); } require_once libfile('class/seccode'); $type = in_array($_G['setting']['seccodedata']['type'], array(2, 3)) ? 0 : $_G['setting']['seccodedata']['type']; $code = new seccode(); $code->code = $seccode; $code->type = $type; $code->width = $_G['setting']['seccodedata']['width']; $code->height = $_G['setting']['seccodedata']['height']; $code->background = $_G['setting']['seccodedata']['background']; $code->adulterate = $_G['setting']['seccodedata']['adulterate']; $code->ttf = $_G['setting']['seccodedata']['ttf']; $code->angle = $_G['setting']['seccodedata']['angle']; $code->warping = $_G['setting']['seccodedata']['warping']; $code->scatter = $_G['setting']['seccodedata']['scatter']; $code->color = $_G['setting']['seccodedata']['color']; $code->size = $_G['setting']['seccodedata']['size']; $code->shadow = $_G['setting']['seccodedata']['shadow']; $code->animator = 0; $code->fontpath = DISCUZ_ROOT . './static/image/seccode/font/'; $code->datapath = DISCUZ_ROOT . './static/image/seccode/'; $code->includepath = DISCUZ_ROOT . './source/class/'; $code->display(); }
function build_cache_heats() { global $_G; $data = array(); 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)); $heatdateline = TIMESTAMP - 86400 * $_G['setting']['indexhot']['days']; $query = DB::query("SELECT t.tid,t.posttableid,t.views,t.dateline,t.replies,t.author,t.authorid,t.subject,t.price\r\n\t\t\tFROM " . DB::table('forum_thread') . " t\r\n\t\t\tWHERE t.dateline>'{$heatdateline}' AND t.heats>'0' AND t.displayorder>='0' ORDER BY t.heats DESC LIMIT " . $_G['setting']['indexhot']['limit'] * 2); $messageitems = 2; $limit = $_G['setting']['indexhot']['limit']; while ($heat = DB::fetch($query)) { $posttable = $heat['posttableid'] ? "forum_post_{$heat['posttableid']}" : 'forum_post'; $post = DB::fetch_first("SELECT p.pid, p.message FROM " . DB::table($posttable) . " p WHERE p.tid='{$heat['tid']}' AND p.first='1'"); $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']; } save_syscache('heats', $data); }
function usesubmit() { global $_G; if (empty($_G['gp_tid'])) { showmessage(lang('magic/sofa', 'sofa_info_nonexistence')); } $thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'dateline', 'subject')); $this->_check($thread); $firstsofa = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_threadmod') . " WHERE magicid='" . $this->magic['magicid'] . "' AND tid='{$_G['gp_tid']}'"); if ($firstsofa >= 1) { showmessage(lang('magic/sofa', 'sofa_info_sofaexistence'), '', array(), array('login' => 1)); } $sofamessage = lang('magic/sofa', 'sofa_text', array('actor' => $_G['member']['username'], 'time' => dgmdate(TIMESTAMP), 'magicname' => $this->magic['name'])); $dateline = $thread['dateline'] + 1; require_once libfile('function/forum'); insertpost(array('fid' => $thread['fid'], 'tid' => $_G['gp_tid'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => $dateline, 'message' => $sofamessage, 'useip' => $_G['clientip'], 'usesig' => '1')); DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies+1, moderated='1' WHERE tid='{$_G['gp_tid']}'", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_forum') . " SET posts=posts+1, todayposts=todayposts+1 WHERE fid='{$post['fid']}'", 'UNBUFFERED'); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']); updatemagicthreadlog($_G['gp_tid'], $this->magic['magicid']); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/sofa', 'sofa_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/sofa', 'sofa_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; if (empty($_G['gp_pid'])) { showmessage(lang('magic/repent', 'repent_info_nonexistence')); } $_G['tid'] = $_G['gp_ptid']; $post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status')); $this->_check($post); require_once libfile('function/post'); require_once libfile('function/delete'); if ($post['first']) { if ($have_replycredit = DB::fetch_first("SELECT * FROM " . DB::table('forum_replycredit') . " WHERE tid ='{$post['tid']}' LIMIT 1")) { if ($replycredit = DB::result_first("SELECT replycredit FROM " . DB::table('forum_thread') . " WHERE tid = '{$post['tid']}'")) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit)); } DB::delete('forum_replycredit', "tid = '{$post['tid']}'"); DB::delete('common_credit_log', "operation IN ('RCT', 'RCA', 'RCB') AND relatedid IN({$post['tid']})"); } deletethread(array($post['tid'])); updateforumcount($post['fid']); } else { if ($post['replycredit'] > 0) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit'])); DB::delete('common_credit_log', "uid = '{$post['authorid']}' AND operation = 'RCA' AND relatedid IN({$post['tid']})"); } deletepost(array($_G['gp_pid'])); updatethreadcount($post['tid']); } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']); showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
function build_cache_forumrecommend() { $data = array(); $query = DB::query("SELECT fid FROM " . DB::table('forum_forum') . " WHERE type<>'group' AND status<>3"); while ($row = DB::fetch($query)) { require_once libfile('function/group'); $squery = DB::query("SELECT f.fid, f.name, f.threads, f.lastpost, ff.icon, ff.membernum, ff.description FROM " . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff ON ff.fid=f.fid WHERE recommend='{$row['fid']}'"); while ($group = DB::fetch($squery)) { $group['icon'] = get_groupimg($group['icon'], 'icon'); $lastpost = array(0, 0, '', ''); $group['lastpost'] = is_string($group['lastpost']) ? explode("\t", $group['lastpost']) : $group['lastpost']; $group['lastpost'] = count($group['lastpost']) != 4 ? $lastpost : $group['lastpost']; list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $group['lastpost']; if ($lastpost['tid']) { $lastpost['dateline'] = dgmdate($lastpost['dateline'], 'Y-m-d H:i:s'); if ($lastpost['author']) { $lastpost['encode_author'] = rawurlencode($lastpost['author']); } $group['lastpost'] = $lastpost; } else { $group['lastpost'] = ''; } $data[$row['fid']][] = $group; } } save_syscache('forumrecommend', $data); }
function all() { global $_G; include_once libfile('action/index'); $index = new index(); $index->all('index/all'); }
function processCollectionData($collection, $tf = array(), $orderby = '') { if (count($collection) <= 0) { return array(); } require_once libfile('function/discuzcode'); foreach ($collection as $ctid => &$curvalue) { $curvalue['updated'] = $curvalue['lastupdate'] > $tf[$ctid]['lastvisit'] ? 1 : 0; $curvalue['tflastvisit'] = $tf[$ctid]['lastvisit']; $curvalue['lastupdate'] = dgmdate($curvalue['lastupdate']); $curvalue['dateline'] = dgmdate($curvalue['dateline']); $curvalue['lastposttime'] = dgmdate($curvalue['lastposttime']); $curvalue['avgrate'] = number_format($curvalue['rate'], 1); $curvalue['star'] = imgdisplayrate($curvalue['rate']); $curvalue['lastposterhtml'] = rawurlencode($curvalue['lastposter']); $curvalue['shortdesc'] = cutstr(strip_tags(discuzcode($curvalue['desc'])), 50); $curvalue['arraykeyword'] = parse_keyword($curvalue['keyword'], false, false); if ($curvalue['arraykeyword']) { foreach ($curvalue['arraykeyword'] as $kid => $s_keyword) { $curvalue['urlkeyword'][$kid] = rawurlencode($s_keyword); } } if ($orderby == 'commentnum') { $curvalue['displaynum'] = $curvalue['commentnum']; } elseif ($orderby == 'follownum') { $curvalue['displaynum'] = $curvalue['follownum']; } else { $curvalue['displaynum'] = $curvalue['threadnum']; } } return $collection; }
function build_cache_advs() { $data = array(); $query = DB::query("SELECT * FROM " . DB::table('common_advertisement') . " WHERE available>'0' AND starttime<='" . TIMESTAMP . "' ORDER BY displayorder"); $data['code'] = $data['parameters'] = $data['evalcode'] = array(); $advlist = array(); while ($adv = DB::fetch($query)) { foreach (explode("\t", $adv['targets']) as $target) { $data['code'][$target][$adv['type']][$adv['advid']] = $adv['code']; } $advtype_class = libfile('adv/' . $adv['type'], 'class'); if (!file_exists($advtype_class)) { continue; } require_once $advtype_class; $advclass = 'adv_' . $adv['type']; $advclass = new $advclass(); $adv['parameters'] = unserialize($adv['parameters']); unset($adv['parameters']['style'], $adv['parameters']['html'], $adv['parameters']['displayorder']); $data['parameters'][$adv['type']][$adv['advid']] = $adv['parameters']; if ($adv['parameters']['extra']) { $data['parameters'][$adv['type']][$adv['advid']] = array_merge($data['parameters'][$adv['type']][$adv['advid']], $adv['parameters']['extra']); unset($data['parameters'][$adv['type']][$adv['advid']]['extra']); } $advlist[] = $adv; $data['evalcode'][$adv['type']] = $advclass->evalcode($adv); } updateadvtype(); save_syscache('advs', $data); }
public function viewthread_modoption() { global $_G; if (!$_G['adminid']) { return false; } $usergroupsfeedlist = unserialize($_G['setting']['qqgroup_usergroup_feed_list']); if (empty($usergroupsfeedlist) || !in_array($_G['groupid'], $usergroupsfeedlist)) { if (self::$util->isfounder($_G['member']) == false) { return false; } } $tid = $_G['tid']; $title = urlencode(trim($_G['forum_thread']['subject'])); $post = C::t('forum_post')->fetch_all_by_tid_position($_G['fotum_thread']['posttableid'], $_G['tid'], 1); include_once libfile('function/discuzcode'); $content = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", '', trim($post[0]['message'])); $content = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", '', $content); $content = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", '', $content); $content = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $content); $content = strip_tags(discuzcode($content, 0, 0, 0)); $content = preg_replace('%\\[attach\\].*\\[/attach\\]%im', '', $content); $content = str_replace(' ', ' ', $content); $content = urlencode(cutstr($content, 50, '')); include template('qqgroup:push'); return trim($return); }
function build_cache_advs() { $advlist = $data = array(); $data['code'] = $data['parameters'] = $data['evalcode'] = array(); foreach (C::t('common_advertisement')->fetch_all_old() as $adv) { foreach (explode("\t", $adv['targets']) as $target) { $data['code'][$target][$adv['type']][$adv['advid']] = $adv['code']; } $advtype_class = libfile('adv/' . $adv['type'], 'class'); if (!file_exists($advtype_class)) { continue; } require_once $advtype_class; $advclass = 'adv_' . $adv['type']; $advclass = new $advclass(); $adv['parameters'] = unserialize($adv['parameters']); unset($adv['parameters']['style'], $adv['parameters']['html'], $adv['parameters']['displayorder']); $data['parameters'][$adv['type']][$adv['advid']] = $adv['parameters']; if ($adv['parameters']['extra']) { $data['parameters'][$adv['type']][$adv['advid']] = array_merge($data['parameters'][$adv['type']][$adv['advid']], $adv['parameters']['extra']); unset($data['parameters'][$adv['type']][$adv['advid']]['extra']); } $advlist[] = $adv; $data['evalcode'][$adv['type']] = $advclass->evalcode($adv); } updateadvtype(); savecache('advs', $data); }