public function login() { $username = jget('username', 'txt'); $password = jget('password'); $openid = jget('openid'); if ($username == "" || $password == "") { json_error("无法登录,用户名或密码不能为空"); } if ($this->Config['login_by_uid']) { is_numeric($username) && json_error("禁止使用UID登录"); } if ($GLOBALS['_J']['plugins']['func']['login']) { hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login'); } $rets = jsg_member_login($username, $password); $uid = (int) $rets['uid']; if ($uid < 1) { json_error(array_iconv($this->Config['charset'], 'utf-8', $rets['error'])); } $r = false; if ($openid && $uid) { $r = jlogic('wechat')->do_bind($openid, $uid); } if ($r) { json_result("绑定成功!"); } else { json_error("绑定失败!"); } }
function build_cache_userstats() { global $_G; $totalmembers = C::t('common_member')->count(); $member = C::t('common_member')->range(0, 1, 'DESC'); $member = current($member); $newsetuser = $member['username']; $data = array('totalmembers' => $totalmembers, 'newsetuser' => $newsetuser); if ($_G['setting']['plugins']['func'][HOOKTYPE]['cacheuserstats']) { $_G['userstatdata'] =& $data; hookscript('cacheuserstats', 'global', 'funcs', array(), 'cacheuserstats'); } savecache('userstats', $data); }
function deletethread($tids, $membercount = false, $credit = false, $ponly = false) { global $_G; if ($_G['setting']['plugins'][HOOKTYPE . '_deletethread']) { $_G['deletethreadtids'] =& $tids; $hookparam = func_get_args(); hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'check'), 'deletethread'); } if (!$tids) { return 0; } require_once libfile('function/forum'); foreach ($tids as $tid) { my_post_log('delete', array('tid' => $tid)); } $count = count($tids); $tids = dimplode($tids); loadcache(array('threadtableids', 'posttableids')); $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array(); $posttableids = !empty($_G['cache']['posttableids']) ? $_G['cache']['posttableids'] : array('0'); if (!in_array(0, $threadtableids)) { $threadtableids = array_merge(array(0), $threadtableids); } DB::delete('common_moderate', "id IN ({$tids}) AND idtype='tid'"); $atids = $fids = $postids = $threadtables = array(); foreach ($threadtableids as $tableid) { $threadtable = !$tableid ? "forum_thread" : "forum_thread_{$tableid}"; $query = DB::query("SELECT cover, tid, fid, posttableid FROM " . DB::table($threadtable) . " WHERE tid IN ({$tids})"); while ($row = DB::fetch($query)) { $atids[] = $row['tid']; $row['posttableid'] = !empty($row['posttableid']) && in_array($row['posttableid'], $posttableids) ? $row['posttableid'] : '0'; $postids[$row['posttableid']][$row['tid']] = $row['tid']; if ($tableid) { $fids[$row['fid']][] = $tableid; } } if (!$tableid && !$ponly) { $threadtables[] = $threadtable; } } if ($credit || $membercount) { $losslessdel = $_G['setting']['losslessdel'] > 0 ? TIMESTAMP - $_G['setting']['losslessdel'] * 86400 : 0; $postlist = $uidarray = $tuidarray = $ruidarray = array(); foreach ($postids as $posttableid => $posttabletids) { $query = DB::query('SELECT tid, first, authorid, dateline, replycredit, invisible FROM ' . DB::table(getposttable($posttableid)) . ' WHERE tid IN (' . dimplode($posttabletids) . ')'); while ($post = DB::fetch($query)) { if ($post['invisible'] != -1 && $post['invisible'] != -5) { $postlist[] = $post; } } } $query = DB::query("SELECT tid, extcreditstype FROM " . DB::table('forum_replycredit') . " WHERE tid IN ({$tids})"); while ($rule = DB::fetch($query)) { $rule['extcreditstype'] = $rule['extcreditstype'] ? $rule['extcreditstype'] : $_G['setting']['creditstransextra'][10]; $replycredit_rule[$rule['tid']] = $rule; } foreach ($postlist as $post) { if ($post['dateline'] < $losslessdel) { if ($membercount) { if ($post['first']) { updatemembercount($post['authorid'], array('threads' => -1, 'post' => -1), false); } else { updatemembercount($post['authorid'], array('posts' => -1), false); } } } else { if ($credit) { if ($post['first']) { $tuidarray[] = $post['authorid']; } else { $ruidarray[] = $post['authorid']; } } } if ($credit || $membercount) { if ($post['authorid'] > 0 && $post['replycredit'] > 0) { if ($replycredit_rule[$post['tid']]['extcreditstype']) { updatemembercount($post['authorid'], array($replycredit_rule[$post['tid']]['extcreditstype'] => (int) ('-' . $post['replycredit']))); } } } } if ($credit) { if ($tuidarray || $ruidarray) { require_once libfile('function/post'); } if ($tuidarray) { updatepostcredits('-', $tuidarray, 'post', $_G['forum']['fid']); } if ($ruidarray) { updatepostcredits('-', $ruidarray, 'reply', $_G['forum']['fid']); } $auidarray = $attachtables = array(); foreach ($atids as $tid) { $attachtables[getattachtablebytid($tid)][] = $tid; } foreach ($attachtables as $attachtable => $attachtids) { $query = DB::query("SELECT uid, dateline FROM " . DB::table($attachtable) . " WHERE tid IN (" . dimplode($attachtids) . ")"); while ($attach = DB::fetch($query)) { if ($attach['dateline'] > $losslessdel) { $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1; } } } if ($auidarray) { $postattachcredits = !empty($_G['forum']['postattachcredits']) ? $_G['forum']['postattachcredits'] : $_G['setting']['creditspolicy']['postattach']; updateattachcredits('-', $auidarray, $postattachcredits); } } } if ($ponly) { if ($_G['setting']['plugins'][HOOKTYPE . '_deletethread']) { hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'delete'), 'deletethread'); } return $count; } DB::delete('forum_replycredit', "tid IN ({$tids})"); DB::delete('common_credit_log', "operation IN ('RCT', 'RCA', 'RCB') AND relatedid IN ({$tids})"); deletethreadcover($tids); foreach ($threadtables as $threadtable) { DB::delete($threadtable, "tid IN ({$tids})"); } if ($atids) { foreach ($postids as $posttableid => $oneposttids) { deletepost($oneposttids, 'tid', false, $posttableid); } deleteattach($atids, 'tid'); } if ($fids) { foreach ($fids as $fid => $tableids) { $tableids = array_unique($tableids); foreach ($tableids as $tableid) { $query = DB::query("SELECT COUNT(*) AS threads, SUM(replies)+COUNT(*) AS posts FROM " . DB::table("forum_thread_{$tableid}") . " WHERE fid='{$fid}'"); while ($row = DB::fetch($query)) { DB::insert('forum_forum_threadtable', array('fid' => $fid, 'threadtableid' => $tableid, 'threads' => intval($row['threads']), 'posts' => intval($row['posts'])), false, true); } } } } foreach (array('forum_forumrecommend', 'forum_polloption', 'forum_poll', 'forum_activity', 'forum_activityapply', 'forum_debate', 'forum_debatepost', 'forum_threadmod', 'forum_relatedthread', 'forum_typeoptionvar', 'forum_postposition', 'forum_poststick', 'forum_pollvoter', 'forum_threadimage') as $table) { DB::delete($table, "tid IN ({$tids})"); } DB::query("DELETE FROM " . DB::table('home_feed') . " WHERE id IN ({$tids}) AND idtype='tid'", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_tagitem') . " WHERE idtype='tid' AND itemid IN ({$tids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('forum_threadrush') . " WHERE tid IN ({$tids})", 'UNBUFFERED'); if ($_G['setting']['plugins'][HOOKTYPE . '_deletethread']) { hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'delete'), 'deletethread'); } return $count; }
function getmenu($brandresult, $active) { global $_G, $template, $bodycss, $ishideheader, $allurl; $group = C::t('#sanree_brand#sanree_brand_group')->get_by_groupid($brandresult['groupid']); global $myhomeurl, $referer, $addgroup; $tmpconfig = $_G['cache']['plugin']['sanree_brand']; $allowsyngroup = intval($tmpconfig['allowsyngroup']); $isshowordinary = intval($tmpconfig['isshowordinary']); !defined('sr_brand_JS') && define('sr_brand_JS', sr_brand_TPL . '/' . $tmpconfig['template'] . '/js'); !defined('SANREE_BRAND_TEMPLATE') && define('SANREE_BRAND_TEMPLATE', sr_brand_TPL . '/' . $tmpconfig['template']); $allurl = gethomeurl(); $myhomeurl = !empty($brandresult['brandno']) ? getbrandnourl($brandresult['brandno']) : getmyburl_by_bid($brandresult['bid']); $referer = urlencode($myhomeurl); if (!isset($_G['cache']['sanree_brand_topmenu']) || !is_array($_G['cache']['sanree_brand_topmenu'])) { sanreeupdatecache('menu'); } $menu = sanreeloadcache('topmenu'); $headermenulist = array(); $headermenulist['index'] = array('url' => getburl($brandresult), 'title' => srlang('brandindex'), 'class' => ' class="normal"'); $brandresult['allowalbum'] == 1 && ($headermenulist['myalbum'] = array('url' => getalbumurl($brandresult['bid']), 'title' => srlang('myalbum'), 'class' => ' class="normal"')); $allowsyngroup == 1 && intval($group['allowsyngroup']) == 1 && $brandresult['syngrouptid'] && ($headermenulist['dzgroup'] = array('url' => 'forum.php?mod=group&fid=' . $brandresult['syngrouptid'], 'title' => srlang('dzgroup'), 'class' => ' class="normal"')); hookscript('sanreebrandusermenu', 'global', 'funcs', array('bid' => $brandresult['bid']), 'sanreebrandusermenu'); if ($_G['sanree_brand_menus']) { foreach ($_G['sanree_brand_menus'] as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $headermenulist[$row['name']] = $row; } } $isshowordinary == 1 && ($headermenulist['ordinary'] = array('url' => 'forum.php?mod=viewthread&tid=' . $brandresult['tid'], 'title' => srlang('ordinary'), 'class' => ' class="normal"')); foreach ($menu as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $headermenulist['menu' . $row[id]] = $row; } $headermenulist[$active] && ($headermenulist[$active]['class'] = ' class="active"'); $headermenulists = $headermenulist; $headermenulist = array(); $menuorder = C::t('#sanree_brand#sanree_brand_menu_order')->fetch_all(); asort($menuorder); foreach ($menuorder as $key => $row) { if ($headermenulists[$key]) { $headermenulist[$key] = $headermenulists[$key]; } } if (intval($_G['uid']) === intval($brandresult['uid'])) { define('IN_BRAND_USER', TRUE); hookscript('sanreebrandmanagemenu', 'global', 'funcs', array('bid' => $brandresult['bid']), 'sanreebrandmanagemenu'); $managemenulist = array(); $_G['sanree_brand_managemenus'][] = array('displayorder' => 9999, 'window' => 0, 'name' => '', 'title' => '', 'url' => '', 'class' => '', 'image' => 'source/plugin/sanree_brand/tpl/good/images/add.png'); if ($_G['sanree_brand_managemenus']) { foreach ($_G['sanree_brand_managemenus'] as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $managemenulist[] = $row; } $ncount = count($managemenulist); $mod = $ncount % 10; $mt = intval($ncount / 10); $oneh = 100; if ($mt == 0) { $ih = $oneh; } else { if ($mod == 0) { $ih = $mt * $oneh; } else { $ih = ($mt + 1) * $oneh; } } $ih += 10; $managemenulist = $this->array_sort($managemenulist, 'displayorder'); } } $allowtemplate = intval($group['allowtemplate']); if ($allowtemplate == 1) { $templateconfig = unserialize($brandresult['templateconfig']); $bodystyle = $templateconfig['bodystyle']; $bodycss = ''; if ($bodystyle) { if (intval($bodystyle['isuse']) == 1) { $bodycss = "body {\r\n"; if ($bodystyle['notbackimg'] == 1) { if (!empty($bodystyle['backgroundimage'])) { $bodycss .= "background-image:url('" . $_G['setting']['attachurl'] . 'category/' . "{$bodystyle['backgroundimage']}');\r\n"; } } else { $bodycss .= "background:none;\r\n"; } if (!empty($bodystyle['backgroundrepeat'])) { $bodycss .= "background-repeat:{$bodystyle['backgroundrepeat']};\r\n"; } if (!empty($bodystyle['backgroundcolor'])) { $bodycss .= "background-color:{$bodystyle['backgroundcolor']};\r\n"; } if (!empty($bodystyle['backgroundattachment'])) { $bodycss .= "background-attachment:{$bodystyle['backgroundattachment']};\r\n"; } if (!empty($bodystyle['backgroundpositionx']) && !empty($bodystyle['backgroundpositiony'])) { $bodycss .= "background-position:{$bodystyle['backgroundpositionx']} {$bodystyle['backgroundpositiony']};\r\n"; } $bodycss .= "}"; $ishideheader = intval($bodystyle['ishideheader']); } } if ($ishideheader == 1) { $appVer = $_G['setting']['version']; include templateEx($this->_identifier . ':' . $template . '/header_one_' . $appVer); } } else { $ishideheader = 0; } include templateEx($this->_identifier . ':' . $template . '/header'); $this->_brand_header = $brand_header; $this->_brand_header_one = $brand_header_one; }
function delete($ids) { $ids = (array) $ids; $admin_list = array(); $member_ids = array(); $query = DB::query("select * from " . DB::table('members') . " where `uid` in ('" . implode("','", $ids) . "')"); while (false != ($row = DB::fetch($query))) { $uid = $row['uid']; if (jsg_member_is_founder($uid) || 'admin' == $row['role_type']) { $admin_list[$uid] = $row['nickname']; } else { $member_ids[$uid] = $uid; if (true === UCENTER && $row['ucuid'] > 0) { uc_user_delete($row['ucuid']); } } #if NEDU if (defined('NEDU_MOYO')) { ndata('sync')->member()->delete($uid); } #endif if ($GLOBALS['_J']['config']['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $row['companyid'] > 0) { $CpLogic = jlogic('cp'); $CpLogic->update('company', $row['companyid'], -1, -$row['topic_count']); if ($GLOBALS['_J']['config']['department_enable'] && $row['departmentid'] > 0) { $CpLogic->update('department', $row['departmentid'], -1, -$row['topic_count']); } $cp_companys = $CpLogic->get_cp_users($row['uid']); if ($cp_companys) { foreach ($cp_companys as $val) { $CpLogic->update('company', $val['companyid'], -1, 0); if ($GLOBALS['_J']['config']['department_enable'] && $val['departmentid'] > 0) { $CpLogic->update('department', $val['departmentid'], -1, 0); } } } } } $member_ids_count = count($member_ids); if ($member_ids_count > 0) { $member_ids_in = jimplode($member_ids); jlogic('buddy')->del_user($member_ids); jlogic('topic')->DeleteToBox(" where `uid` in ({$member_ids_in}) limit 999999999 "); jlogic('topic')->Delete(" where `uid` in ({$member_ids_in}) limit 999999999 "); $tbs = array('blacklist' => array('uid', 'touid'), 'credits_log' => 'uid', 'credits_rule_log' => 'uid', 'cron' => 'touid', 'event' => 'postman', 'event_favorite' => 'uid', 'event_member' => 'fid', 'group' => 'uid', 'groupfields' => 'uid', 'imjiqiren_client_user' => 'uid', 'invite' => array('uid', 'fuid'), 'ios' => 'uid', 'item_sms' => 'uid', 'item_user' => 'uid', 'kaixin_bind_info' => 'uid', 'log' => 'uid', 'mailqueue' => 'uid', 'mall_order' => 'uid', 'mall_order_action' => 'uid', 'medal_apply' => 'uid', 'member_notice' => 'uid', 'member_relation' => 'touid', 'member_topic' => 'uid', 'member_validate' => 'uid', 'members_profile' => 'uid', 'members_verify' => 'uid', 'members_vest' => array('uid', 'useruid'), 'my_tag' => 'user_id', 'my_topic_tag' => 'user_id', 'pms' => array('msgfromid', 'msgtoid'), 'qqwb_bind_info' => 'uid', 'qun' => 'founderuid', 'qun_apply' => 'uid', 'qun_user' => 'uid', 'renren_bind_info' => 'uid', 'report' => 'uid', 'reward' => 'uid', 'reward_image' => 'uid', 'reward_user' => 'uid', 'reward_win_user' => 'uid', 'schedule' => 'uid', 'sessions' => 'uid', 'sms_client_user' => 'uid', 'sms_receive_log' => 'uid', 'sms_send_log' => 'uid', 'tag_favorite' => 'uid', 'task_log' => 'uid', 'topic' => 'uid', 'topic_favorite' => 'uid', 'topic_image' => 'uid', 'topic_attach' => 'uid', 'topic_longtext' => 'uid', 'topic_mention' => 'uid', 'topic_music' => 'uid', 'topic_show' => 'uid', 'topic_video' => 'uid', 'user_medal' => 'uid', 'user_tag_fields' => 'uid', 'validate_category_fields' => 'uid', 'vote' => 'uid', 'vote_user' => 'uid', 'wall' => 'uid', 'xwb_bind_info' => 'uid', 'yy_bind_info' => 'uid', 'topic_dig' => array('uid', 'touid'), 'buddy_channel' => 'uid', 'buddy_department' => 'uid', 'bulletin' => 'uid', 'topic_live' => 'uid', 'topic_talk' => array('uid', 'touid'), 'topic_channel' => 'uid', 'memberfields' => 'uid', 'members' => 'uid'); foreach ($tbs as $k => $vs) { $vs = (array) $vs; foreach ($vs as $v) { DB::query("delete from `" . TABLE_PREFIX . "{$k}` where `{$v}` in ({$member_ids_in})", "SKIP_ERROR"); } } } $rets = array('admin_list' => $admin_list, 'member_ids' => $member_ids, 'member_ids_count' => $member_ids_count); if ($GLOBALS['_J']['plugins']['func']['deletemember']) { hookscript('deletemember', 'funcs', is_array($member_ids) ? $member_ids : array($member_ids), 'deletemember'); } return $rets; }
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; }
function deletethread($tids, $membercount = false, $credit = false, $ponly = false) { global $_G; if ($_G['setting']['plugins']['func'][HOOKTYPE]['deletethread']) { $_G['deletethreadtids'] =& $tids; $hookparam = func_get_args(); hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'check'), 'deletethread'); } if (!$tids) { return 0; } $count = count($tids); $arrtids = $tids; $tids = dimplode($tids); loadcache(array('threadtableids', 'posttableids')); $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array(); $posttableids = !empty($_G['cache']['posttableids']) ? $_G['cache']['posttableids'] : array('0'); if (!in_array(0, $threadtableids)) { $threadtableids = array_merge(array(0), $threadtableids); } C::t('common_moderate')->delete($arrtids, 'tid'); C::t('forum_threadclosed')->delete($arrtids); $cachefids = $atids = $fids = $postids = $threadtables = array(); foreach ($threadtableids as $tableid) { foreach (C::t('forum_thread')->fetch_all_by_tid($arrtids, 0, 0, $tableid) as $row) { $atids[] = $row['tid']; $row['posttableid'] = !empty($row['posttableid']) && in_array($row['posttableid'], $posttableids) ? $row['posttableid'] : '0'; $postids[$row['posttableid']][$row['tid']] = $row['tid']; if ($tableid) { $fids[$row['fid']][] = $tableid; } $cachefids[$row['fid']] = $row['fid']; } if (!$tableid && !$ponly) { $threadtables[] = $tableid; } } if ($credit || $membercount) { $losslessdel = $_G['setting']['losslessdel'] > 0 ? TIMESTAMP - $_G['setting']['losslessdel'] * 86400 : 0; $postlist = $uidarray = $tuidarray = $ruidarray = array(); foreach ($postids as $posttableid => $posttabletids) { foreach (C::t('forum_post')->fetch_all_by_tid($posttableid, $posttabletids, false) as $post) { if ($post['invisible'] != -1 && $post['invisible'] != -5) { $postlist[] = $post; } } } foreach (C::t('forum_replycredit')->fetch_all($arrtids) as $rule) { $rule['extcreditstype'] = $rule['extcreditstype'] ? $rule['extcreditstype'] : $_G['setting']['creditstransextra'][10]; $replycredit_rule[$rule['tid']] = $rule; } foreach ($postlist as $post) { if ($post['dateline'] < $losslessdel) { if ($membercount) { if ($post['first']) { updatemembercount($post['authorid'], array('threads' => -1, 'post' => -1), false); } else { updatemembercount($post['authorid'], array('posts' => -1), false); } } } else { if ($credit) { if ($post['first']) { $tuidarray[$post['fid']][] = $post['authorid']; } else { $ruidarray[$post['fid']][] = $post['authorid']; } } } if ($credit || $membercount) { if ($post['authorid'] > 0 && $post['replycredit'] > 0) { if ($replycredit_rule[$post['tid']]['extcreditstype']) { updatemembercount($post['authorid'], array($replycredit_rule[$post['tid']]['extcreditstype'] => (int) ('-' . $post['replycredit']))); } } } } if ($credit) { if ($tuidarray || $ruidarray) { require_once libfile('function/post'); } if ($tuidarray) { foreach ($tuidarray as $fid => $tuids) { updatepostcredits('-', $tuids, 'post', $fid); } } if ($ruidarray) { foreach ($ruidarray as $fid => $ruids) { updatepostcredits('-', $ruids, 'reply', $fid); } } $auidarray = $attachtables = array(); foreach ($atids as $tid) { $attachtables[getattachtableid($tid)][] = $tid; } foreach ($attachtables as $attachtable => $attachtids) { foreach (C::t('forum_attachment_n')->fetch_all_by_id($attachtable, 'tid', $attachtids) as $attach) { if ($attach['dateline'] > $losslessdel) { $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1; } } } if ($auidarray) { $postattachcredits = !empty($_G['forum']['postattachcredits']) ? $_G['forum']['postattachcredits'] : $_G['setting']['creditspolicy']['postattach']; updateattachcredits('-', $auidarray, $postattachcredits); } } } $relatecollection = C::t('forum_collectionthread')->fetch_all_by_tids($arrtids); if (count($relatecollection) > 0) { $collectionids = array(); foreach ($relatecollection as $collection) { $collectionids[] = $collection['ctid']; } $collectioninfo = C::t('forum_collection')->fetch_all($collectionids); foreach ($relatecollection as $collection) { $decthread = C::t('forum_collectionthread')->delete_by_ctid_tid($collection['ctid'], $arrtids); $lastpost = null; if (in_array($collectioninfo[$collection['ctid']]['lastpost'], $arrtids) && $collectioninfo[$collection['ctid']]['threadnum'] - $decthread > 0) { $collection_thread = C::t('forum_collectionthread')->fetch_by_ctid_dateline($collection['ctid']); if ($collection_thread) { $thread = C::t('forum_thread')->fetch($collection_thread['tid']); $lastpost = array('lastpost' => $thread['tid'], 'lastsubject' => $thread['subject'], 'lastposttime' => $thread['dateline'], 'lastposter' => $thread['authorid']); } } C::t('forum_collection')->update_by_ctid($collection['ctid'], -$decthread, 0, 0, 0, 0, 0, $lastpost); } C::t('forum_collectionrelated')->delete($arrtids); } if ($cachefids) { C::t('forum_thread')->clear_cache($cachefids, 'forumdisplay_'); } if ($ponly) { if ($_G['setting']['plugins']['func'][HOOKTYPE]['deletethread']) { hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'delete'), 'deletethread'); } C::t('forum_thread')->update($arrtids, array('displayorder' => -1, 'digest' => 0, 'moderated' => 1)); foreach ($postids as $posttableid => $oneposttids) { C::t('forum_post')->update_by_tid($posttableid, $oneposttids, array('invisible' => '-1')); } return $count; } C::t('forum_replycredit')->delete($arrtids); C::t('forum_post_location')->delete_by_tid($arrtids); C::t('common_credit_log')->delete_by_operation_relatedid(array('RCT', 'RCA', 'RCB'), $arrtids); deletethreadcover($arrtids); foreach ($threadtables as $tableid) { C::t('forum_thread')->delete_by_tid($arrtids, false, $tableid); } if ($atids) { foreach ($postids as $posttableid => $oneposttids) { deletepost($oneposttids, 'tid', false, $posttableid); } deleteattach($atids, 'tid'); } if ($fids) { loadcache('forums'); foreach ($fids as $fid => $tableids) { if (empty($_G['cache']['forums'][$fid]['archive'])) { continue; } foreach (C::t('forum_thread')->count_posts_by_fid($fid) as $row) { C::t('forum_forum_threadtable')->insert(array('fid' => $fid, 'threadtableid' => $tableid, 'threads' => $row['threads'], 'posts' => $row['posts']), false, true); } } } foreach (array('forum_forumrecommend', 'forum_polloption', 'forum_poll', 'forum_activity', 'forum_activityapply', 'forum_debate', 'forum_debatepost', 'forum_threadmod', 'forum_relatedthread', 'forum_pollvoter', 'forum_threadimage', 'forum_threadpreview') as $table) { C::t($table)->delete_by_tid($arrtids); } C::t('forum_typeoptionvar')->delete_by_tid($arrtids); C::t('forum_poststick')->delete_by_tid($arrtids); C::t('home_feed')->delete_by_id_idtype($arrtids, 'tid'); C::t('common_tagitem')->delete(0, $tids, 'tid'); C::t('forum_threadrush')->delete($arrtids); if ($_G['setting']['plugins']['func'][HOOKTYPE]['deletethread']) { hookscript('deletethread', 'global', 'funcs', array('param' => $hookparam, 'step' => 'delete'), 'deletethread'); } return $count; }
$closedreason = $db->result_first("SELECT value FROM {$tablepre}settings WHERE variable='closedreason'"); showmessage($closedreason ? $closedreason : 'board_closed', NULL, 'NOPERM'); } periodscheck('visitbanperiods'); } if((!empty($fromuid) || !empty($fromuser)) && ($creditspolicy['promotion_visit'] || $creditspolicy['promotion_register'])) { require_once DISCUZ_ROOT.'/include/promotion.inc.php'; } if($uchome['addfeed']) { $customaddfeed = $customaddfeed == '-1' ? 0 : ($customaddfeed == 0 ? $uchome['addfeed'] : intval($customaddfeed)); } else { $customaddfeed = 0; } $rssauth = $rssstatus && $discuz_uid ? rawurlencode(authcode("$discuz_uid\t".($fid ? $fid : '')."\t".substr(md5($discuz_pw.$discuz_secques), 0, 8), 'ENCODE', md5($_DCACHE['settings']['authkey']))) : '0'; $transferstatus = $transferstatus && $allowtransfer; $feedpostnum = $feedpostnum && $uchomeurl ? intval($feedpostnum) : 0; $pluginhooks = array(); if(isset($hookscript[CURSCRIPT]['module'])) { hookscript(CURSCRIPT); } if($discuz_uid && $newbietaskupdate && $lastactivity < $newbietaskupdate) { require_once DISCUZ_ROOT.'./include/task.func.php'; task_newfunction_autoapply(); } ?>
function hookscriptoutput($tplfile) { global $_G; if (isset($_G['setting']['hookscript']['global']['global']['module'])) { hookscript('global'); } if (isset($_G['setting']['hookscript'][$_G['basescript']][CURMODULE]['outputfuncs'])) { hookscript(CURMODULE, 'outputfuncs', array('template' => $tplfile, 'message' => $_G['hookscriptmessage'], 'values' => $_G['hookscriptvalues'])); } }
function savebanlog($username, $origgroupid, $newgroupid, $expiration, $reason) { global $_G; if ($_G['setting']['plugins']['func'][HOOKTYPE]['savebanlog']) { $param = func_get_args(); hookscript('savebanlog', 'global', 'funcs', array('param' => $param), 'savebanlog'); } writelog('banlog', dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['groupid']}\t{$_G['clientip']}\t{$username}\t{$origgroupid}\t{$newgroupid}\t{$expiration}\t{$reason}")); }
function DoAdd() { if (MEMBER_ID < 1) { response_text("请先登录或者注册一个帐号"); } $content = trim($this->Post['content']); if (!$content) { response_text("请输入内容"); } $topic_type = $this->Post['topictype']; if ('both' == $topic_type) { $type = 'both'; } elseif ('reply' == $topic_type) { $type = 'reply'; } elseif ('company' == $topic_type) { $type = 'company'; } elseif ('qun' == $topic_type) { $type = 'qun'; } elseif ('live' == $topic_type) { $type = 'live'; } elseif ('talk' == $topic_type) { $type = 'talk'; } elseif ('personal' == $topic_type) { $type = 'personal'; } elseif (in_array($topic_type, array('answer', 'event', 'vote', 'fenlei', 'reward'))) { $type = 'reply'; } elseif (is_numeric($topic_type)) { $type = 'first'; } else { $type = 'first'; } #if NEDU defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->topic_detect_type($type, $topic_type); #endif if (!in_array($type, array('both', 'reply', 'forward'))) { if (!$this->MemberHandler->HasPermission('topic', 'add')) { response_text("您的角色没有发布的权限"); } } else { if (('reply' == $type || 'both' == $type) && !$this->MemberHandler->HasPermission('topic', 'reply')) { response_text("您的角色没有评论的权限"); } elseif (('forward' == $type || 'both' == $type) && !$this->MemberHandler->HasPermission('topic', 'forward')) { response_text("您的角色没有转发的权限"); } } if ($this->Config['seccode_enable'] > 1) { $YXM_check = jlogic('seccode')->topiccheckYXM($type); if ($YXM_check && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) { $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['YinXiangMa_challenge'], @$_POST['YXM_level'][0], @$_POST['YXM_input_result']); if ($YinXiangMa_response != "true") { response_text("验证码输入错误"); } } } $roottid = max(0, (int) $this->Post['roottid']); $totid = max(0, (int) $this->Post['totid']); $touid = max(0, (int) $this->Post['touid']); $imageid = trim($this->Post['imageid']); $attachid = trim($this->Post['attachid']); $relateid = trim($this->Post['relateid']); $featureid = trim($this->Post['featureid']); $videoid = max(0, (int) $this->Post['videoid']); $anonymous = (int) $this->Post['anonymous']; $longtextid = max(0, (int) $this->Post['longtextid']); $design = trim($this->Post['r']); $xiami_id = trim($this->Post['xiami_id']) ? trim($this->Post['xiami_id']) : 0; $from = trim($this->Post['from']); $verify = $this->Post['verify'] ? 1 : 0; $is_reward = jget('is_reward', 'int'); $item = trim($this->Post['item']); $item_id = intval(trim($this->Post['item_id'])); if ('company' == $item) { $item_id = $GLOBALS['_J']['member']['companyid']; } if (!empty($item_id)) { if (!($item == 'company' || $item == 'topic_image')) { jfunc('app'); $ret = app_check($item, $item_id); if (!$ret) { $item = ''; $item_id = 0; } } if ($item == 'channel') { $can_pub_topic = jlogic('channel')->can_pub_topic($item_id); if (!$can_pub_topic) { $item = ''; $item_id = 0; } } } else { $item = ''; $item_id = 0; } $data = array('content' => $content, 'totid' => $totid, 'imageid' => $imageid, 'attachid' => $attachid, 'videoid' => $videoid, 'from' => empty($from) ? 'web' : $from, 'type' => $type, 'design' => $design, 'item' => $item, 'item_id' => $item_id, 'touid' => $touid, 'longtextid' => $longtextid, 'xiami_id' => $xiami_id, 'pverify' => $verify, 'is_reward' => $is_reward, 'relateid' => $relateid, 'featureid' => $featureid, 'anonymous' => $anonymous); if ($GLOBALS['_J']['plugins']['func']['posttopic']) { hookscript('posttopic', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'posttopic'); } $return = $this->TopicLogic->Add($data); if (is_array($return) && $return['tid'] > 0) { $r = $this->Post['r']; $is_huifu = $this->Post['is_huifu']; $return_reply = $this->Post['return_reply']; if ($totid > 0 && $r) { if ('vc' == $r) { if ($is_huifu == 'is_huifu') { $return_reply = 'is_huifu'; } $this->ViewComment($return['totid'], $return['tid'], $return_reply, $roottid); } elseif ('rl' == substr($r, 0, 2)) { $_GET['page'] = 999999999; $this->ListReply(is_numeric($tti = substr($r, 3)) && $tti > 0 ? $tti : $return['totid'], $return['tid']); } elseif (in_array($r, array('tohome', 'lt', 'myblog', 'myhome', 'tagview', 'view'))) { exit; } } } else { if (is_string($return)) { $return = '[发布失败]' . $return; } elseif (is_array($return)) { $return = '[发布成功]' . implode(",", $return); } else { $return = '未知错误'; } response_text("{$return}"); } }
function hookscriptoutput($tplfile) { global $hookscript, $hookscriptmessage; if (isset($hookscript['global']['module'])) { hookscript('global'); } if (isset($hookscript[CURSCRIPT]['outputfuncs'])) { hookscript(CURSCRIPT, 'outputfuncs', array('template' => $tplfile, 'message' => $hookscriptmessage)); } }
function srhooks() { global $_G; $hscript = 'plugin'; $script = 'sanree'; $type = 'funcs'; hookscript($script, $hscript, $type); }
function Login2() { $username = trim(jget('username')); $password = jget('password'); if ($username == "" || $password == "") { json_error("无法登录,用户名或密码不能为空"); } if ($GLOBALS['_J']['plugins']['func']['login']) { hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login'); } $referer = jget('referer'); if (!$referer) { $referer = jsg_getcookie('referer'); } $rets = jsg_member_login($username, $password); $uid = (int) $rets['uid']; if ($uid < 1) { json_error($rets['error']); } $member = jsg_member_info($uid); $this->Config['email_must_be_true'] == 2 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid); if ($this->Config['extcredits_enable'] && $uid > 0) { update_credits_by_action('login', $uid); } Load::logic('other'); $otherLogic = new OtherLogic(); $sql = "SELECT m.id as medal_id,m.medal_img,m.medal_name,m.medal_depict,m.conditions,u.dateline,y.apply_id\r\n\t\t\t\tFROM " . TABLE_PREFIX . "medal m\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user_medal u ON (u.medalid = m.id AND u.uid = '{$uid}')\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "medal_apply y ON (y.medal_id = m.id AND y.uid = '{$uid}')\r\n\t\t\t\tWHERE m.is_open = 1\r\n\t\t\t\tORDER BY u.dateline DESC,m.id"; $query = $this->DatabaseHandler->Query($sql); while (false != ($rs = $query->GetRow())) { $rs['conditions'] = unserialize($rs['conditions']); if (in_array($rs['conditions']['type'], array('topic', 'reply', 'tag', 'invite', 'fans')) && !$rs['dateline']) { $result .= $otherLogic->autoCheckMedal($rs['medal_id'], $uid); } } header("location:mobile/index.php"); }
function dshowmessage($message, $url_forward = '', $values = array(), $extraparam = array(), $custom = 0) { global $_G, $show_message; $_G['messageparam'] = func_get_args(); if (empty($_G['inhookscript']) && defined('CURMODULE')) { hookscript(CURMODULE, $_G['basescript'], 'messagefuncs', array('param' => $_G['messageparam'])); } if ($extraparam['break']) { return; } $_G['inshowmessage'] = true; $param = array('header' => false, 'timeout' => null, 'refreshtime' => null, 'closetime' => null, 'locationtime' => null, 'alert' => null, 'return' => false, 'redirectmsg' => 0, 'msgtype' => 1, 'showmsg' => true, 'showdialog' => false, 'login' => false, 'handle' => false, 'extrajs' => '', 'striptags' => true); $navtitle = lang('core', 'title_board_message'); if ($custom) { $alerttype = 'alert_info'; $show_message = $message; include template('common/showmessage'); dexit(); } define('CACHE_FORBIDDEN', TRUE); $_G['setting']['msgforward'] = @dunserialize($_G['setting']['msgforward']); $handlekey = $leftmsg = ''; if (defined('IN_MOBILE')) { unset($extraparam['showdialog']); unset($extraparam['closetime']); unset($extraparam['extrajs']); if (!$url_forward && dreferer() && IN_MOBILE == 1) { $url_forward = $referer = dreferer(); } if (!empty($url_forward) && strpos($url_forward, 'mobile') === false) { $url_forward_arr = explode("#", $url_forward); if (strpos($url_forward_arr[0], '?') !== false) { $url_forward_arr[0] = $url_forward_arr[0] . '&mobile=' . IN_MOBILE; } else { $url_forward_arr[0] = $url_forward_arr[0] . '?mobile=' . IN_MOBILE; } $url_forward = implode("#", $url_forward_arr); } } if (empty($_G['inajax']) && (!empty($_GET['quickforward']) || $_G['setting']['msgforward']['quick'] && empty($extraparam['clean_msgforward']) && $_G['setting']['msgforward']['messages'] && @in_array($message, $_G['setting']['msgforward']['messages']))) { $param['header'] = true; } $_GET['handlekey'] = !empty($_GET['handlekey']) && preg_match('/^\\w+$/', $_GET['handlekey']) ? $_GET['handlekey'] : ''; if (!empty($_G['inajax'])) { $handlekey = $_GET['handlekey'] = !empty($_GET['handlekey']) ? dhtmlspecialchars($_GET['handlekey']) : ''; $param['handle'] = true; } if (!empty($_G['inajax'])) { $param['msgtype'] = empty($_GET['ajaxmenu']) && (empty($_POST) || !empty($_GET['nopost'])) ? 2 : 3; } if ($url_forward) { $param['timeout'] = true; if ($param['handle'] && !empty($_G['inajax'])) { $param['showmsg'] = false; } } foreach ($extraparam as $k => $v) { $param[$k] = $v; } if (array_key_exists('set', $extraparam)) { $setdata = array('1' => array('msgtype' => 3)); if ($setdata[$extraparam['set']]) { foreach ($setdata[$extraparam['set']] as $k => $v) { $param[$k] = $v; } } } $timedefault = intval($param['refreshtime'] === null ? $_G['setting']['msgforward']['refreshtime'] : $param['refreshtime']); if ($param['timeout'] !== null) { $refreshsecond = !empty($timedefault) ? $timedefault : 3; $refreshtime = $refreshsecond * 1000; } else { $refreshtime = $refreshsecond = 0; } if ($param['login'] && $_G['uid'] || $url_forward) { $param['login'] = false; } $param['header'] = $url_forward && $param['header'] ? true : false; if ($_GET['ajaxdata'] === 'json') { $param['header'] = ''; } if ($param['header']) { header("HTTP/1.1 301 Moved Permanently"); dheader("location: " . str_replace('&', '&', $url_forward)); } $url_forward_js = addslashes(str_replace('\\', '%27', $url_forward)); if ($param['location'] && !empty($_G['inajax'])) { include template('common/header_ajax'); echo '<script type="text/javascript" reload="1">window.location.href=\'' . $url_forward_js . '\';</script>'; include template('common/footer_ajax'); dexit(); } $_G['hookscriptmessage'] = $message; $_G['hookscriptvalues'] = $values; $vars = explode(':', $message); if (count($vars) == 2) { $show_message = lang('plugin/' . $vars[0], $vars[1], $values); } else { $show_message = lang('message', $message, $values); } if (isset($_GET['ajaxdata'])) { if ($_GET['ajaxdata'] === 'json') { helper_output::json(array('message' => $show_message, 'data' => $values)); } else { if ($_GET['ajaxdata'] === 'html') { helper_output::html($show_message); } } } if ($_G['connectguest']) { $param['login'] = false; $param['alert'] = 'info'; if (defined('IN_MOBILE')) { if ($message == 'postperm_login_nopermission_mobile') { $show_message = lang('plugin/qqconnect', 'connect_register_mobile_bind_error'); } $show_message = str_replace(lang('forum/misc', 'connectguest_message_mobile_search'), lang('forum/misc', 'connectguest_message_mobile_replace'), $show_message); } else { $show_message = str_replace(lang('forum/misc', 'connectguest_message_search'), lang('forum/misc', 'connectguest_message_replace'), $show_message); } if ($message == 'group_nopermission') { $show_message = lang('plugin/qqconnect', 'connectguest_message_complete_or_bind'); } } if ($param['msgtype'] == 2 && $param['login']) { dheader('location: member.php?mod=logging&action=login&handlekey=' . $handlekey . '&infloat=yes&inajax=yes&guestmessage=yes'); } $show_jsmessage = str_replace("'", "\\'", $param['striptags'] ? strip_tags($show_message) : $show_message); if ((!$param['showmsg'] || $param['showid']) && !defined('IN_MOBILE')) { $show_message = ''; } $allowreturn = !$param['timeout'] && !$url_forward && !$param['login'] || $param['return'] ? true : false; if ($param['alert'] === null) { $alerttype = $url_forward ? preg_match('/\\_(succeed|success)$/', $message) ? 'alert_right' : 'alert_info' : ($allowreturn ? 'alert_error' : 'alert_info'); } else { $alerttype = 'alert_' . $param['alert']; } $extra = ''; if ($param['showid']) { $extra .= 'if($(\'' . $param['showid'] . '\')) {$(\'' . $param['showid'] . '\').innerHTML = \'' . $show_jsmessage . '\';}'; } if ($param['handle']) { $valuesjs = $comma = $subjs = ''; foreach ($values as $k => $v) { $v = daddslashes($v); if (is_array($v)) { $subcomma = ''; foreach ($v as $subk => $subv) { $subjs .= $subcomma . '\'' . $subk . '\':\'' . $subv . '\''; $subcomma = ','; } $valuesjs .= $comma . '\'' . $k . '\':{' . $subjs . '}'; } else { $valuesjs .= $comma . '\'' . $k . '\':\'' . $v . '\''; } $comma = ','; } $valuesjs = '{' . $valuesjs . '}'; if ($url_forward) { $extra .= 'if(typeof succeedhandle_' . $handlekey . '==\'function\') {succeedhandle_' . $handlekey . '(\'' . $url_forward_js . '\', \'' . $show_jsmessage . '\', ' . $valuesjs . ');}'; } else { $extra .= 'if(typeof errorhandle_' . $handlekey . '==\'function\') {errorhandle_' . $handlekey . '(\'' . $show_jsmessage . '\', ' . $valuesjs . ');}'; } } if ($param['closetime'] !== null) { $param['closetime'] = $param['closetime'] === true ? $timedefault : $param['closetime']; } if ($param['locationtime'] !== null) { $param['locationtime'] = $param['locationtime'] === true ? $timedefault : $param['locationtime']; } if ($handlekey) { if ($param['showdialog']) { $modes = array('alert_error' => 'alert', 'alert_right' => 'right', 'alert_info' => 'notice'); $extra .= 'hideWindow(\'' . $handlekey . '\');showDialog(\'' . $show_jsmessage . '\', \'' . $modes[$alerttype] . '\', null, ' . ($param['locationtime'] !== null ? 'function () { window.location.href =\'' . $url_forward_js . '\'; }' : 'null') . ', 0, null, null, null, null, ' . ($param['closetime'] ? $param['closetime'] : 'null') . ', ' . ($param['locationtime'] ? $param['locationtime'] : 'null') . ');'; $param['closetime'] = null; $st = ''; if ($param['showmsg']) { $show_message = ''; } } if ($param['closetime'] !== null) { $extra .= 'setTimeout("hideWindow(\'' . $handlekey . '\')", ' . $param['closetime'] * 1000 . ');'; } } else { $st = $param['locationtime'] !== null ? 'setTimeout("window.location.href =\'' . $url_forward_js . '\';", ' . $param['locationtime'] * 1000 . ');' : ''; } if (!$extra && $param['timeout'] && !defined('IN_MOBILE')) { $extra .= 'setTimeout("window.location.href =\'' . $url_forward_js . '\';", ' . $refreshtime . ');'; } $show_message .= $extra ? '<script type="text/javascript" reload="1">' . $extra . $st . '</script>' : ''; $show_message .= $param['extrajs'] ? $param['extrajs'] : ''; include template('common/showmessage'); dexit(); }
} else { $backgroundimage = dhtmlspecialchars(trim($_G['sr_backgroundimage'])); } $bodyarr['bodystyle']['backgroundimage'] = $backgroundimage; $setarr['templateconfig'] = serialize($bodyarr); } C::t('#sanree_brand#sanree_brand_businesses')->update($bid, $setarr); if (C::t('#sanree_brand#sanree_brand_businesses_module')->count_by_where(' AND bid=' . $bid) > 0) { C::t('#sanree_brand#sanree_brand_businesses_module')->update_by_bid($bid, $_G['sr_module']); } else { $addarray = array(); $addarray = $_G['sr_module']; $addarray[bid] = $bid; C::t('#sanree_brand#sanree_brand_businesses_module')->insert($addarray); } hookscript('sanreemoduleupdate', 'global', 'funcs', array('bid' => $bid, 'data' => $_G['sr_module']), 'sanreemoduleupdate'); fixthread($bid); syngroup($bid); deletecachebrandpic($bid); sanreeupdatecache('hotbrandlist'); sanreeupdatecache('recommendlist'); sanreeupdatecache('newbrandlist'); cpmsg($langs['succeed'], 'action=plugins&operation=config&act=businesseslist&identifier=sanree_brand&pmod=admincp&page=' . $page, 'succeed'); } else { showsubmenu($menustr); if ($bid > 0) { $menustr = $langs['editbusi']; $result = C::t('#sanree_brand#sanree_brand_businesses')->getusername_by_bid($bid); $result['owner'] = C::t('#sanree_brand#xcommon_member')->fetch_all_username_by_uid($result['ownerid']); $result['startdate'] = empty($result['startdate']) ? '' : dgmdate($result['startdate']); $result['enddate'] = empty($result['enddate']) ? '' : dgmdate($result['enddate']);
function recyclebinpostundelete($undeletepids, $posttableid = false) { global $_G; if ($_G['setting']['plugins']['func'][HOOKTYPE]['recyclebinpostundelete']) { $param = func_get_args(); hookscript('recyclebinpostundelete', 'global', 'funcs', array('param' => $param), 'recyclebinpostundelete'); } $postsundel = 0; if (empty($undeletepids)) { return $postsundel; } loadcache('posttableids'); $posttableids = !empty($_G['cache']['posttableids']) ? $posttableid !== false && in_array($posttableid, $_G['cache']['posttableids']) ? array($posttableid) : $_G['cache']['posttableids'] : array('0'); $postarray = $ruidarray = $fidarray = $tidarray = array(); foreach ($posttableids as $ptid) { foreach (C::t('forum_post')->fetch_all($ptid, $undeletepids, false) as $post) { if (!$post['first']) { $ruidarray[$post['fid']][] = $post['authorid']; } $fidarray[$post['fid']] = $post['fid']; $tidarray[$post['tid']] = $post['tid']; } } if (empty($fidarray)) { return $postsundel; } C::t('forum_post')->update($posttableid, $undeletepids, array('invisible' => '0'), true); include_once libfile('function/post'); if ($ruidarray) { foreach ($ruidarray as $fid => $ruids) { updatepostcredits('+', $ruids, 'reply', $fid); } } foreach ($tidarray as $tid) { updatethreadcount($tid, 1); } foreach ($fidarray as $fid) { updateforumcount($fid); } return count($undeletepids); }
function DoRegister() { if (MEMBER_ID != 0 and false == $this->IsAdmin) { $this->Messager('您已经是注册用户,无需再注册!', -1); } $regstatus = jsg_member_register_check_status(); if ($regstatus['error']) { $this->Messager($regstatus['error'], null); } $message = array(); $timestamp = time(); $noemail = 0; $sms_ckret = 0; if ($this->_sms_register()) { $sms_bind_num = $this->Post['sms_bind_num']; $sms_bind_key = $this->Post['sms_bind_key']; $sms_ckret = sms_check_bind_key($sms_bind_num, $sms_bind_key); if ($sms_ckret) { $this->Messager($sms_ckret, -1); } $noemail = jconf::get('sms', 'register_verify', 'noemail'); if ($noemail) { $this->Post['email'] = $sms_bind_num . '@139.com'; } } if ($this->Config['seccode_enable'] == 1 && $this->Config['seccode_register']) { if (!ckseccode(@$_POST['seccode'])) { $this->Messager("验证码输入错误", -1); } } elseif ($this->Config['seccode_enable'] > 1 && $this->Config['seccode_register'] && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) { $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['add_YinXiangMa_challenge'], @$_POST['add_YXM_level'][0], @$_POST['add_YXM_input_result']); if ($YinXiangMa_response != "true") { $this->Messager("验证码输入错误", -1); } } $inviter_member = array(); $invite_code = $this->Post['invite_code'] ? $this->Post['invite_code'] : $this->Get['invite_code']; $check_result = jsg_member_register_check_invite($invite_code); if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) { if (!$invite_code) { $this->Messager("本站目前需要有好友邀请链接才能注册。<br><br>看看<a href=\"?mod=topic&code=top\">达人榜</a>中有没有你认识的人,让他给你发一个好友邀请。", null); } if (!$check_result) { $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null); } } if ($check_result['uid'] > 0) { $inviter_member = jsg_member_info($check_result['uid']); } if (!$inviter_member && $this->Config['register_invite_input']) { $inviter_member = jsg_member_info($this->Post['inviter_nickname'], 'nickname'); } $password = $this->Post['password']; $email = $this->Post['email']; $username = $nickname = $this->Post['nickname']; if (strlen($password) < 5) { $this->Messager("密码过短,请设置至少5位", -1); } if ($password != $this->Post['password2']) { $this->Messager("两次输入的密码不相同", -1); } if ($GLOBALS['_J']['plugins']['func']['reg']) { hookscript('reg', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'reg'); } $uid = jsg_member_register($nickname, $password, $email); if ($uid < 1) { $regconf = jconf::get('register'); $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。', '-7' => '您的IP地址 ' . $GLOBALS['_J']['client_ip'] . ' 已经被限制注册了(一个IP地址 ' . $regconf['time_html'] . ' 之内,最多只能注册 ' . $regconf['limit'] . ' 个用户),请稍后再试或联系管理员'); $this->Messager($rets[$uid], null); } $datas = array(); $datas['uid'] = $uid; if ($this->_sms_register()) { $datas['phone'] = $sms_bind_num; } jtable('members')->update($datas); if ($this->_sms_register()) { $_sms_info = _sms_client_user($sms_bind_num); $_sms_sets = array('uid' => $uid, 'username' => $username, 'bind_key' => 0, 'bind_key_time' => 0, 'try_bind_times' => '+1', 'last_try_bind_time' => $timestamp); sms_client_user_update($_sms_sets, $_sms_info); } if ($inviter_member) { jsg_member_register_by_invite($inviter_member['uid'], $uid, $check_result); } $rets = jsg_member_login($uid, $password, 'uid'); $redirect_to = jget('referer'); if (!$redirect_to || $redirect_to == $this->Config['site_url']) { if ($this->Config['reg_email_verify']) { $redirect_to = jurl('index.php?mod=member&code=setverify&ids=' . $uid . '&from=reg'); } elseif ($this->Config['reg_step3_radio']) { $redirect_to = jurl('index.php?mod=member&code=follow_channel'); } elseif ($this->Config['reg_step4_radio']) { $redirect_to = jurl('index.php?mod=member&code=follow_member'); } elseif ($this->Config['reg_step5_radio']) { $redirect_to = jurl('index.php?mod=member&code=add_face'); } elseif ($this->Config['reg_step6_radio']) { $redirect_to = jurl('index.php?mod=member&code=member_profile'); } elseif ($this->Config['reg_step7_radio']) { $redirect_to = jurl('index.php?mod=member&code=do_first_topic'); } else { $redirect_to = jurl('index.php?mod=topic'); } } $this->Messager(NULL, $redirect_to, 0); }
function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0, $parsetype = '0', $authorid = '0', $allowmediacode = '0', $pid = 0, $lazyload = 0, $pdateline = 0, $first = 0) { global $_G; static $authorreplyexist; if ($pid && strpos($message, '[/password]') !== FALSE) { if ($authorid != $_G['uid'] && !$_G['forum']['ismoderator']) { $message = preg_replace("/\\s?\\[password\\](.+?)\\[\\/password\\]\\s?/ie", "parsepassword('\\1', \$pid)", $message); if ($_G['forum_discuzcode']['passwordlock'][$pid]) { return ''; } } else { $message = preg_replace("/\\s?\\[password\\](.+?)\\[\\/password\\]\\s?/ie", "", $message); $_G['forum_discuzcode']['passwordauthor'][$pid] = 1; } } if ($parsetype != 1 && !$bbcodeoff && $allowbbcode && (strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) { $message = preg_replace("/\\s?\\[code\\](.+?)\\[\\/code\\]\\s?/ies", "codedisp('\\1')", $message); } $msglower = strtolower($message); $htmlon = $htmlon && $allowhtml ? 1 : 0; if (!$htmlon) { $message = dhtmlspecialchars($message); } else { $message = preg_replace("/<script[^\\>]*?>(.*?)<\\/script>/i", '', $message); } if ($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) { $_G['discuzcodemessage'] =& $message; $param = func_get_args(); hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'discuzcode'), 'discuzcode'); } if (!$smileyoff && $allowsmilies) { $message = parsesmiles($message); } if ($_G['setting']['allowattachurl'] && strpos($msglower, 'attach://') !== FALSE) { $message = preg_replace("/attach:\\/\\/(\\d+)\\.?(\\w*)/ie", "parseattachurl('\\1', '\\2', 1)", $message); } if ($allowbbcode) { if (strpos($msglower, 'ed2k://') !== FALSE) { $message = preg_replace("/ed2k:\\/\\/(.+?)\\//e", "parseed2k('\\1')", $message); } } if (!$bbcodeoff && $allowbbcode) { if (strpos($msglower, '[/url]') !== FALSE) { $message = preg_replace("/\\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\\/\\/|www\\.|mailto:)?([^\r\n\\[\"']+?))?\\](.+?)\\[\\/url\\]/ies", "parseurl('\\1', '\\5', '\\2')", $message); } if (strpos($msglower, '[/email]') !== FALSE) { $message = preg_replace("/\\[email(=([a-z0-9\\-_.+]+)@([a-z0-9\\-_]+[.][a-z0-9\\-_.]+))?\\](.+?)\\[\\/email\\]/ies", "parseemail('\\1', '\\4')", $message); } $nest = 0; while (strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE) { $message = preg_replace("/\\[table(?:=(\\d{1,4}%?)(?:,([\\(\\)%,#\\w ]+))?)?\\]\\s*(.+?)\\s*\\[\\/table\\]/ies", "parsetable('\\1', '\\2', '\\3')", $message); if (++$nest > 4) { break; } } $message = str_replace(array('[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[/p]', '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]', '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'), array('</font>', '</font>', '</font>', '</font>', '</div>', '<strong>', '</strong>', '<strike>', '</strike>', '<hr class="l" />', '</p>', '<i class="pstatus">', '<i>', '</i>', '<u>', '</u>', '<ul>', '<ul type="1" class="litype_1">', '<ul type="a" class="litype_2">', '<ul type="A" class="litype_3">', '<li>', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>'), preg_replace(array("/\\[color=([#\\w]+?)\\]/i", "/\\[color=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[backcolor=([#\\w]+?)\\]/i", "/\\[backcolor=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[size=(\\d{1,2}?)\\]/i", "/\\[size=(\\d{1,2}(\\.\\d{1,2}+)?(px|pt)+?)\\]/i", "/\\[font=([^\\[\\<]+?)\\]/i", "/\\[align=(left|center|right)\\]/i", "/\\[p=(\\d{1,2}|null), (\\d{1,2}|null), (left|center|right)\\]/i", "/\\[float=left\\]/i", "/\\[float=right\\]/i"), array("<font color=\"\\1\">", "<font style=\"color:\\1\">", "<font style=\"background-color:\\1\">", "<font style=\"background-color:\\1\">", "<font size=\"\\1\">", "<font style=\"font-size:\\1\">", "<font face=\"\\1\">", "<div align=\"\\1\">", "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:\\3\">", "<span style=\"float:left;margin-right:5px\">", "<span style=\"float:right;margin-left:5px\">"), $message)); if ($pid && !defined('IN_MOBILE')) { $message = preg_replace("/\\s?\\[postbg\\]\\s*([^\\[\\<\r\n;'\"\\?\\(\\)]+?)\\s*\\[\\/postbg\\]\\s?/ies", "parsepostbg('\\1', '{$pid}')", $message); } else { $message = preg_replace("/\\s?\\[postbg\\]\\s*([^\\[\\<\r\n;'\"\\?\\(\\)]+?)\\s*\\[\\/postbg\\]\\s?/is", "", $message); } if ($parsetype != 1) { if (strpos($msglower, '[/quote]') !== FALSE) { $message = preg_replace("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", tpl_quote(), $message); } if (strpos($msglower, '[/free]') !== FALSE) { $message = preg_replace("/\\s*\\[free\\][\n\r]*(.+?)[\n\r]*\\[\\/free\\]\\s*/is", tpl_free(), $message); } } if (!defined('IN_MOBILE')) { if (strpos($msglower, '[/media]') !== FALSE) { $message = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", $allowmediacode ? "parsemedia('\\1', '\\2')" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message); } if (strpos($msglower, '[/audio]') !== FALSE) { $message = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", $allowmediacode ? "parseaudio('\\2', 400)" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message); } if (strpos($msglower, '[/flash]') !== FALSE) { $message = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", $allowmediacode ? "parseflash('\\2', '\\3', '\\4');" : "bbcodeurl('\\4', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message); } } else { if (strpos($msglower, '[/media]') !== FALSE) { $message = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/is", "[media]\\2[/media]", $message); } if (strpos($msglower, '[/audio]') !== FALSE) { $message = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/is", "[media]\\2[/media]", $message); } if (strpos($msglower, '[/flash]') !== FALSE) { $message = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/is", "[media]\\4[/media]", $message); } } if ($parsetype != 1 && $allowbbcode < 0 && isset($_G['cache']['bbcodes'][-$allowbbcode])) { $message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], $_G['cache']['bbcodes'][-$allowbbcode]['replacearray'], $message); } if ($parsetype != 1 && strpos($msglower, '[/hide]') !== FALSE && $pid) { if ($_G['setting']['hideexpiration'] && $pdateline && (TIMESTAMP - $pdateline) / 86400 > $_G['setting']['hideexpiration']) { $message = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", "\\3", $message); $msglower = strtolower($message); } if (strpos($msglower, '[hide=d') !== FALSE) { $message = preg_replace("/\\[hide=(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/ies", "expirehide('\\1','\\2','\\3', {$pdateline})", $message); $msglower = strtolower($message); } if (strpos($msglower, '[hide]') !== FALSE) { if ($authorreplyexist === null) { if (!$_G['forum']['ismoderator']) { if ($_G['uid']) { $authorreplyexist = C::t('forum_post')->fetch_pid_by_tid_authorid($_G['tid'], $_G['uid']); } } else { $authorreplyexist = TRUE; } } if ($authorreplyexist) { $message = preg_replace("/\\[hide\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", tpl_hide_reply(), $message); } else { $message = preg_replace("/\\[hide\\](.*?)\\[\\/hide\\]/is", tpl_hide_reply_hidden(), $message); $message = '<script type="text/javascript">replyreload += \',\' + ' . $pid . ';</script>' . $message; } } if (strpos($msglower, '[hide=') !== FALSE) { $message = preg_replace("/\\[hide=(\\d+)\\]\\s*(.*?)\\s*\\[\\/hide\\]/ies", "creditshide(\\1,'\\2', {$pid}, {$authorid})", $message); } } } if (!$bbcodeoff) { if ($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) { $message = preg_replace("/\\[swf\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/swf\\]/ies", "bbcodeurl('\\1', ' <img src=\"'.STATICURL.'image/filetype/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"{url}\" target=\"_blank\">Flash: {url}</a> ')", $message); } if (defined('IN_MOBILE') && !defined('TPL_DEFAULT') && !defined('IN_MOBILE_API')) { $allowimgcode = false; } $attrsrc = !IS_ROBOT && $lazyload ? 'file' : 'src'; if (strpos($msglower, '[/img]') !== FALSE) { $message = preg_replace(array("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies", "/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies"), $allowimgcode ? array("parseimg(0, 0, '\\1', " . intval($lazyload) . ", " . intval($pid) . ", 'onmouseover=\"img_onmouseoverfunc(this)\" " . ($lazyload ? "lazyloadthumb=\"1\"" : "onload=\"thumbImg(this)\"") . "')", "parseimg('\\1', '\\2', '\\3', " . intval($lazyload) . ", " . intval($pid) . ")") : ($allowbbcode ? array(!defined('IN_MOBILE') ? "bbcodeurl('\\1', '<a href=\"{url}\" target=\"_blank\">{url}</a>')" : "bbcodeurl('\\1', '')", !defined('IN_MOBILE') ? "bbcodeurl('\\3', '<a href=\"{url}\" target=\"_blank\">{url}</a>')" : "bbcodeurl('\\3', '')") : array("bbcodeurl('\\1', '{url}')", "bbcodeurl('\\3', '{url}')")), $message); } } for ($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) { $message = str_replace("[\tDISCUZ_CODE_{$i}\t]", $_G['forum_discuzcode']['codehtml'][$i], $message); } unset($msglower); if ($jammer) { $message = preg_replace("/\r\n|\n|\r/e", "jammer()", $message); } if ($first) { if (helper_access::check_module('group')) { $message = preg_replace("/\\[groupid=(\\d+)\\](.*)\\[\\/groupid\\]/i", lang('forum/template', 'fromgroup') . ': <a href="forum.php?mod=forumdisplay&fid=\\1" target="_blank">\\2</a>', $message); } else { $message = preg_replace("/(\\[groupid=\\d+\\].*\\[\\/groupid\\])/i", '', $message); } } return $htmlon ? $message : nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message)); }
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: mobile_extends.php 31281 2012-08-03 02:29:27Z zhangjie $ */ if (!defined('IN_MOBILE_API')) { exit('Access Denied'); } $_GET['identifier'] = !empty($_GET['identifier']) ? $_GET['identifier'] : ''; $_GET['check'] = !empty($_GET['check']) ? $_GET['check'] : ''; require_once './source/class/class_core.php'; if (empty($_GET['identifier']) && !empty($_GET['check'])) { require_once 'extends/mobile_extends_check.php'; } else { require_once 'extends/mobile_extends_list.php'; } C::app()->init(); define('HOOKTYPE', 'hookscript'); hookscript('common', 'global'); hookscript('global', 'global');
function followcode($message, $tid = 0, $pid = 0, $length = 0, $allowimg = true) { global $_G; include_once libfile('function/post'); $message = strip_tags($message); $message = messagesafeclear($message); if ((strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) { $message = preg_replace("/\\s?\\[code\\](.+?)\\[\\/code\\]\\s?/ies", "", $message); } $msglower = strtolower($message); $htmlon = 0; $message = dhtmlspecialchars($message); if ($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) { $_G['discuzcodemessage'] =& $message; $param = func_get_args(); hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'discuzcode'), 'discuzcode'); } $_G['delattach'] = array(); $message = fparsesmiles($message); if (strpos($msglower, 'attach://') !== FALSE) { $message = preg_replace("/attach:\\/\\/(\\d+)\\.?(\\w*)/ie", '', $message); } if (strpos($msglower, 'ed2k://') !== FALSE) { $message = preg_replace("/ed2k:\\/\\/(.+?)\\//e", '', $message); } if (strpos($msglower, '[/i]') !== FALSE) { $message = preg_replace("/\\s*\\[i=s\\][\n\r]*(.+?)[\n\r]*\\[\\/i\\]\\s*/is", '', $message); } $message = str_replace('[/p]', "\n", $message); $message = str_replace(array('[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]', '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'), '', preg_replace(array("/\\[color=([#\\w]+?)\\]/i", "/\\[color=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[backcolor=([#\\w]+?)\\]/i", "/\\[backcolor=((rgb|rgba)\\([\\d\\s,]+?\\))\\]/i", "/\\[size=(\\d{1,2}?)\\]/i", "/\\[size=(\\d{1,2}(\\.\\d{1,2}+)?(px|pt)+?)\\]/i", "/\\[font=([^\\[\\<]+?)\\]/i", "/\\[align=(left|center|right)\\]/i", "/\\[float=left\\]/i", "/\\[float=right\\]/i"), '', $message)); if (strpos($msglower, '[/p]') !== FALSE) { $message = preg_replace("/\\[p=(\\d{1,2}|null), (\\d{1,2}|null), (left|center|right)\\]/i", "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:left;\">", $message); $message = str_replace('[/p]', '</p>', $message); } if (strpos($msglower, '[/quote]') !== FALSE) { $message = preg_replace("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", '', $message); } if (strpos($msglower, '[/free]') !== FALSE) { $message = preg_replace("/\\s*\\[free\\][\n\r]*(.+?)[\n\r]*\\[\\/free\\]\\s*/is", '', $message); } if (isset($_G['cache']['bbcodes'][-$allowbbcode])) { $message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], '', $message); } if (strpos($msglower, '[/hide]') !== FALSE) { preg_replace("/\\[hide.*?\\]\\s*(.*?)\\s*\\[\\/hide\\]/ies", "hideattach('\\1')", $message); if (strpos($msglower, '[hide]') !== FALSE) { $message = preg_replace("/\\[hide\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $message); } if (strpos($msglower, '[hide=') !== FALSE) { $message = preg_replace("/\\[hide=(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/ies", '', $message); } } if (strpos($msglower, '[/url]') !== FALSE) { $message = preg_replace("/\\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\\/\\/|www\\.|mailto:)?([^\r\n\\[\"']+?))?\\](.+?)\\[\\/url\\]/ies", "fparseurl('\\1', '\\5', '\\2')", $message); } if (strpos($msglower, '[/email]') !== FALSE) { $message = preg_replace("/\\[email(=([a-z0-9\\-_.+]+)@([a-z0-9\\-_]+[.][a-z0-9\\-_.]+))?\\](.+?)\\[\\/email\\]/ies", "fparseemail('\\1', '\\4')", $message); } $nest = 0; while (strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE) { $message = preg_replace("/\\[table(?:=(\\d{1,4}%?)(?:,([\\(\\)%,#\\w ]+))?)?\\]\\s*(.+?)\\s*\\[\\/table\\]/ies", "fparsetable('\\1', '\\2', '\\3')", $message); if (++$nest > 4) { break; } } if (strpos($msglower, '[/media]') !== FALSE) { $message = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", "fparsemedia('\\1', '\\2')", $message); } if (strpos($msglower, '[/audio]') !== FALSE) { $message = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", "fparseaudio('\\2')", $message); } if (strpos($msglower, '[/flash]') !== FALSE) { $message = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", "fparseflash('\\4');", $message); } if ($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) { $message = preg_replace("/\\[swf\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/swf\\]/ies", "bbcodeurl('\\1', ' <img src=\"'.STATICURL.'image/filetype/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"{url}\" target=\"_blank\">Flash: {url}</a> ')", $message); } $flag = $length ? 1 : 0; if ($tid) { $extra = "onclick=\"changefeed({$tid}, {$pid}, {$flag}, this)\""; } if (strpos($msglower, '[/img]') !== FALSE) { $message = preg_replace(array("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies", "/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies"), $allowimg ? array("fparseimg('\\1', '{$extra}')", "fparseimg('\\3', '{$extra}')") : '', $message); } if ($tid && $pid) { $_G['post_attach'] = C::t('forum_attachment_n')->fetch_all_by_id(getattachtableid($tid), 'pid', $pid); foreach ($_G['post_attach'] as $aid => $attach) { if (!empty($_G['delattach']) && in_array($aid, $_G['delattach'])) { continue; } $message .= "[attach]{$attach['aid']}[/attach]"; $message = preg_replace("/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i", fparseattach($attach['aid'], $length, $extra), $message, 1); } } if (strpos($msglower, '[/attach]') !== FALSE) { $message = preg_replace("/\\[attach\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/attach\\]/ies", '', $message); } $message = clearnl($message); if ($length) { $sppos = strpos($message, chr(0) . chr(0) . chr(0)); if ($sppos !== false) { $message = substr($message, 0, $sppos); } $checkstr = cutstr($message, $length, ''); if (strpos($checkstr, '[') && strpos(strrchr($checkstr, "["), ']') === FALSE) { $length = strpos($message, ']', strrpos($checkstr, strrchr($checkstr, "["))); } $message = cutstr($message, $length + 1, ' <a href="javascript:;" class="flw_readfull xi2 xs1"' . $extra . '>' . lang('space', 'follow_view_fulltext') . '</a>'); } elseif ($allowimg && !empty($extra)) { $message .= '<div class="ptm cl"><a href="javascript:;" class="flw_readfull y xi2 xs1"' . $extra . '>' . lang('space', 'follow_retract') . '</a></div>'; } for ($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) { $code = ''; if (isset($_G['forum_discuzcode']['codehtml'][$i]) && !empty($_G['forum_discuzcode']['codehtml'][$i])) { $code = $_G['forum_discuzcode']['codehtml'][$i]; } elseif (!$length) { if (isset($_G['forum_discuzcode']['audio'][$i]) && !empty($_G['forum_discuzcode']['audio'][$i])) { $code = $_G['forum_discuzcode']['audio'][$i]; } elseif (isset($_G['forum_discuzcode']['video'][$i]) && !empty($_G['forum_discuzcode']['video'][$i])) { $code = $_G['forum_discuzcode']['video'][$i]; } elseif (isset($_G['forum_discuzcode']['media'][$i]) && !empty($_G['forum_discuzcode']['media'][$i])) { $code = $_G['forum_discuzcode']['media'][$i]; } elseif (isset($_G['forum_discuzcode']['image'][$i]) && !empty($_G['forum_discuzcode']['image'][$i])) { $code = $_G['forum_discuzcode']['image'][$i]; } elseif (isset($_G['forum_discuzcode']['attach'][$i]) && !empty($_G['forum_discuzcode']['attach'][$i])) { $code = $_G['forum_discuzcode']['attach'][$i]; } } $message = str_replace("[\tD_{$i}\t]", $code, $message); } $message = clearnl($message); if (!empty($_GET['highlight'])) { $highlightarray = explode('+', $_GET['highlight']); $sppos = strrpos($message, chr(0) . chr(0) . chr(0)); if ($sppos !== FALSE) { $specialextra = substr($message, $sppos + 3); $message = substr($message, 0, $sppos); } $message = preg_replace(array("/(^|>)([^<]+)(?=<|\$)/sUe", "/<highlight>(.*)<\\/highlight>/siU"), array("highlightword('\\2', \$highlightarray, '\\1')", "<strong><font color=\"#FF0000\">\\1</font></strong>"), $message); if ($sppos !== FALSE) { $message = $message . chr(0) . chr(0) . chr(0) . $specialextra; } } unset($msglower); if ($length) { $count = 0; $imagecode = $mediacode = $videocode = $audiocode = $mediahtml = ''; for ($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) { if (isset($_G['forum_discuzcode']['audio'][$i]) && !empty($_G['forum_discuzcode']['audio'][$i])) { $audiocode .= '<li>' . $_G['forum_discuzcode']['audio'][$attachcodei] . '</li>'; } elseif (isset($_G['forum_discuzcode']['video'][$i]) && !empty($_G['forum_discuzcode']['video'][$i])) { $videocode .= '<li>' . $_G['forum_discuzcode']['video'][$i] . '</li>'; } elseif (isset($_G['forum_discuzcode']['media'][$i]) && !empty($_G['forum_discuzcode']['media'][$i])) { $mediacode .= '<li>' . $_G['forum_discuzcode']['media'][$i] . '</li>'; } elseif (isset($_G['forum_discuzcode']['image'][$i]) && !empty($_G['forum_discuzcode']['image'][$i]) && $count < 4) { $imagecode .= '<li>' . $_G['forum_discuzcode']['image'][$i] . '</li>'; $count++; } elseif (isset($_G['forum_discuzcode']['attach'][$i]) && !empty($_G['forum_discuzcode']['attach'][$i])) { $attachcode .= '<li>' . $_G['forum_discuzcode']['attach'][$i] . '</li>'; } } if (!empty($audiocode)) { $message .= '<div class="flw_music"><ul>' . $audiocode . '</ul></div>'; } if (!empty($videocode)) { $message .= '<div class="flw_video"><ul>' . $videocode . '</ul></div>'; } if (!empty($mediacode)) { $message .= '<div class="flw_video"><ul>' . $mediacode . '</ul></div>'; } if (!empty($imagecode)) { $message = '<div class="flw_image' . ($count < 2 ? ' flw_image_1' : '') . '"><ul>' . $imagecode . '</ul></div>' . $message; } if (!empty($attachcode)) { $message .= '<div class="flw_attach"><ul>' . $attachcode . '</ul></div>'; } } return $htmlon ? $message : nl2br(str_replace(array("\t", ' ', ' '), ' ', $message)); }
function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0, $parsetype = '0', $authorid = '0', $allowmediacode = '0', $pid = 0, $lazyload = 0) { global $_G; static $authorreplyexist; if ($parsetype != 1 && !$bbcodeoff && $allowbbcode && (strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) { $message = preg_replace("/\\s?\\[code\\](.+?)\\[\\/code\\]\\s?/ies", "codedisp('\\1')", $message); } $msglower = strtolower($message); $htmlon = $htmlon && $allowhtml ? 1 : 0; if (!$htmlon) { $message = dhtmlspecialchars($message); } if ($_G['setting']['plugins'][HOOKTYPE . '_discuzcode']) { $_G['discuzcodemessage'] =& $message; $param = func_get_args(); hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'discuzcode'), 'discuzcode'); } if (!$smileyoff && $allowsmilies) { $message = parsesmiles($message); } if ($_G['setting']['allowattachurl'] && strpos($msglower, 'attach://') !== FALSE) { $message = preg_replace("/attach:\\/\\/(\\d+)\\.?(\\w*)/ie", "parseattachurl('\\1', '\\2')", $message); } if ($allowbbcode) { if (strpos($msglower, 'ed2k://') !== FALSE) { $message = preg_replace("/ed2k:\\/\\/(.+?)\\//e", "parseed2k('\\1')", $message); } } if (!$bbcodeoff && $allowbbcode) { if (strpos($msglower, '[/url]') !== FALSE) { $message = preg_replace("/\\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|qqdl|synacast){1}:\\/\\/|www\\.|mailto:)?([^\r\n\\[\"']+?))?\\](.+?)\\[\\/url\\]/ies", "parseurl('\\1', '\\5', '\\2')", $message); } if (strpos($msglower, '[/email]') !== FALSE) { $message = preg_replace("/\\[email(=([a-z0-9\\-_.+]+)@([a-z0-9\\-_]+[.][a-z0-9\\-_.]+))?\\](.+?)\\[\\/email\\]/ies", "parseemail('\\1', '\\4')", $message); } $nest = 0; while (strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE) { $message = preg_replace("/\\[table(?:=(\\d{1,4}%?)(?:,([\\(\\)%,#\\w ]+))?)?\\]\\s*(.+?)\\s*\\[\\/table\\]/ies", "parsetable('\\1', '\\2', '\\3')", $message); if (++$nest > 4) { break; } } $message = str_replace(array('[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[/p]', '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]', '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'), array('</font>', '</font>', '</font>', '</font>', '</p>', '<strong>', '</strong>', '<strike>', '</strike>', '<hr class="l" />', '</p>', '<i class="pstatus">', '<i>', '</i>', '<u>', '</u>', '<ul>', '<ul type="1" class="litype_1">', '<ul type="a" class="litype_2">', '<ul type="A" class="litype_3">', '<li>', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>'), preg_replace(array("/\\[color=([#\\w]+?)\\]/i", "/\\[color=(rgb\\([\\d\\s,]+?\\))\\]/i", "/\\[backcolor=([#\\w]+?)\\]/i", "/\\[backcolor=(rgb\\([\\d\\s,]+?\\))\\]/i", "/\\[size=(\\d{1,2}?)\\]/i", "/\\[size=(\\d{1,2}(\\.\\d{1,2}+)?(px|pt)+?)\\]/i", "/\\[font=([^\\[\\<]+?)\\]/i", "/\\[align=(left|center|right)\\]/i", "/\\[p=(\\d{1,2}|null), (\\d{1,2}|null), (left|center|right)\\]/i", "/\\[float=left\\]/i", "/\\[float=right\\]/i"), array("<font color=\"\\1\">", "<font style=\"color:\\1\">", "<font style=\"background-color:\\1\">", "<font style=\"background-color:\\1\">", "<font size=\"\\1\">", "<font style=\"font-size:\\1\">", "<font face=\"\\1\">", "<p align=\"\\1\">", "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:\\3\">", "<span style=\"float:left;margin-right:5px\">", "<span style=\"float:right;margin-left:5px\">"), $message)); if ($parsetype != 1) { if (strpos($msglower, '[/quote]') !== FALSE) { $message = preg_replace("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", tpl_quote(), $message); } if (strpos($msglower, '[/free]') !== FALSE) { $message = preg_replace("/\\s*\\[free\\][\n\r]*(.+?)[\n\r]*\\[\\/free\\]\\s*/is", tpl_free(), $message); } } if (strpos($msglower, '[/media]') !== FALSE) { $message = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", $allowmediacode ? "parsemedia('\\1', '\\2')" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message); } if (strpos($msglower, '[/audio]') !== FALSE) { $message = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", $allowmediacode ? "parseaudio('\\2', 400)" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message); } if (strpos($msglower, '[/flash]') !== FALSE) { $message = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", $allowmediacode ? "parseflash('\\2', '\\3', '\\4');" : "bbcodeurl('\\4', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message); } if ($parsetype != 1 && $allowbbcode < 0 && isset($_G['cache']['bbcodes'][-$allowbbcode])) { $message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], $_G['cache']['bbcodes'][-$allowbbcode]['replacearray'], $message); } if ($parsetype != 1 && strpos($msglower, '[/hide]') !== FALSE && $pid) { if (strpos($msglower, '[hide]') !== FALSE) { if ($authorreplyexist === null) { $posttable = getposttablebytid($_G['tid']); $authorreplyexist = !$_G['forum']['ismoderator'] ? DB::result_first("SELECT pid FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND " . ($_G['uid'] ? "authorid='{$_G['uid']}'" : "authorid=0 AND useip='{$_G['clientip']}'") . " LIMIT 1") : TRUE; } if ($authorreplyexist) { $message = preg_replace("/\\[hide\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", tpl_hide_reply(), $message); } else { $message = preg_replace("/\\[hide\\](.*?)\\[\\/hide\\]/is", tpl_hide_reply_hidden(), $message); $message .= '<script type="text/javascript">replyreload += \',\' + ' . $pid . ';</script>'; } } if (strpos($msglower, '[hide=') !== FALSE) { $message = preg_replace("/\\[hide=(\\d+)\\]\\s*(.*?)\\s*\\[\\/hide\\]/ies", "creditshide(\\1,'\\2', {$pid})", $message); } } } if (!$bbcodeoff) { if ($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) { $message = preg_replace("/\\[swf\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/swf\\]/ies", "bbcodeurl('\\1', ' <img src=\"'.STATICURL.'image/filetype/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"{url}\" target=\"_blank\">Flash: {url}</a> ')", $message); } if (defined('IN_MOBILE') && !defined('TPL_DEFAULT')) { $allowimgcode = false; $viewimg = lang('template', 'viewimg'); } $attrsrc = !IS_ROBOT && $lazyload ? 'file' : 'src'; if (strpos($msglower, '[/img]') !== FALSE) { $message = preg_replace(array("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies", "/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies"), $allowimgcode ? array("bbcodeurl('\\1', '<img {$attrsrc}=\"{url}\" onload=\"thumbImg(this)\" alt=\"\" />')", "parseimg('\\1', '\\2', '\\3', " . intval($lazyload) . ")") : array(!defined('IN_MOBILE') ? "bbcodeurl('\\1', '<a href=\"{url}\" target=\"_blank\">{url}</a>')" : "bbcodeurl('\\1', '<a href=\"{url}\" target=\"_blank\">[{$viewimg}]</a>')", !defined('IN_MOBILE') ? "bbcodeurl('\\3', '<a href=\"{url}\" target=\"_blank\">{url}</a>')" : "bbcodeurl('\\3', '<a href=\"{url}\" target=\"_blank\">[{$viewimg}]</a>')"), $message); } } for ($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) { $message = str_replace("[\tDISCUZ_CODE_{$i}\t]", $_G['forum_discuzcode']['codehtml'][$i], $message); } if (!empty($_G['gp_highlight'])) { $highlightarray = explode('+', $_G['gp_highlight']); $sppos = strrpos($message, chr(0) . chr(0) . chr(0)); if ($sppos !== FALSE) { $specialextra = substr($message, $sppos + 3); $message = substr($message, 0, $sppos); } $message = preg_replace(array("/(^|>)([^<]+)(?=<|\$)/sUe", "/<highlight>(.*)<\\/highlight>/siU"), array("highlightword('\\2', \$highlightarray, '\\1')", "<strong><font color=\"#FF0000\">\\1</font></strong>"), $message); if ($sppos !== FALSE) { $message = $message . chr(0) . chr(0) . chr(0) . $specialextra; } } unset($msglower); if ($jammer) { $message = preg_replace("/\r\n|\n|\r/e", "jammer()", $message); } return $htmlon ? $message : nl2br(str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message)); }
function adshow($parameter) { global $_G; if ($_G['inajax']) { return; } if (isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] == 2) { return '<hook>[ad ' . $parameter . ']</hook>'; } $params = explode('/', $parameter); $customid = 0; $customc = explode('_', $params[0]); if ($customc[0] == 'custom') { $params[0] = $customc[0]; $customid = $customc[1]; } $adcontent = null; if (empty($_G['setting']['advtype']) || !in_array($params[0], $_G['setting']['advtype'])) { $adcontent = ''; } if ($adcontent === null) { loadcache('advs'); $adids = array(); $evalcode =& $_G['cache']['advs']['evalcode'][$params[0]]; $parameters =& $_G['cache']['advs']['parameters'][$params[0]]; $codes =& $_G['cache']['advs']['code'][$_G['basescript']][$params[0]]; if (!empty($codes)) { foreach ($codes as $adid => $code) { $parameter =& $parameters[$adid]; $checked = true; @eval($evalcode['check']); if ($checked) { $adids[] = $adid; } } if (!empty($adids)) { $adcode = $extra = ''; @eval($evalcode['create']); if (empty($notag)) { $adcontent = '<div' . ($params[1] != '' ? ' class="' . $params[1] . '"' : '') . $extra . '>' . $adcode . '</div>'; } else { $adcontent = $adcode; } } } } $adfunc = 'ad_' . $params[0]; $_G['setting']['pluginhooks'][$adfunc] = null; hookscript('ad', 'global', 'funcs', array('params' => $params, 'content' => $adcontent), $adfunc); if (!$_G['setting']['hookscript']['global']['ad']['funcs'][$adfunc]) { hookscript('ad', $_G['basescript'], 'funcs', array('params' => $params, 'content' => $adcontent), $adfunc); } return $_G['setting']['pluginhooks'][$adfunc] === null ? $adcontent : $_G['setting']['pluginhooks'][$adfunc]; }
function Delete($ids) { if (MEMBER_ID < 1) { return '游客不能执行此操作'; } if (is_numeric($ids)) { $where = " where `id` = '{$ids}' "; } else { if (is_string($ids)) { $where = $ids; } else { if (is_array($ids)) { $where = " where `id` in ('" . implode("','", $ids) . "') "; } else { return '所指定的微博有误。'; } } } if (!$ids) { return '微博已经不存在了'; } $query = DB::query("select * from " . TABLE_PREFIX . "topic_verify {$where} "); $topics = array(); while ($rs = DB::fetch($query)) { if (jdisallow($rs['uid'])) { return '您没有权限执行此操作'; } $topics[] = $rs; } if (count($topics) < 1) { return '微博已经不存在了'; } $tbs = array('report' => 'tid', 'sms_receive_log' => 'tid', 'topic_favorite' => 'tid', 'topic_longtext' => 'tid', 'topic_mention' => 'tid', 'topic_more' => 'tid', 'topic_qun' => 'tid', 'topic_reply' => array('tid', 'replyid'), 'topic_tag' => 'item_id', 'topic_url' => 'tid', 'topic_vote' => 'tid', 'wall_draft' => 'tid', 'wall_playlist' => 'tid', 'topic_recommend' => 'tid', 'topic_live' => 'tid', 'topic_talk' => 'tid', 'topic_channel' => 'tid', 'topic_dig' => 'tid', 'topic_topic_image' => 'tid'); $topictids = array(); foreach ($topics as $topic) { $topictids[] = $topic['tid']; if (false !== strpos($topic['content'], '#')) { preg_match_all('~<T>#(.+?)#</T>~', $topic['content'], $subpatterns); if ($subpatterns && is_array($subpatterns[1])) { Load::logic('tag'); $TagLogic = new TagLogic('topic'); $TagLogic->Delete(array('item_id' => $topic['tid'], 'tag' => $subpatterns['1'])); } } if ($topic['imageid']) { } if ($topic['attachid']) { jlogic('attach')->delete($topic['attachid']); } if ($topic['videoid']) { $sql = "select `id`,`video_img` from `" . TABLE_PREFIX . "topic_video` where `id`='" . $topic['videoid'] . "' "; $topic_video = DB::fetch_first($sql); jio()->DeleteFile($topic_video['video_img']); DB::query("delete from `" . TABLE_PREFIX . "topic_video` where `id` = '{$topic['videoid']}'"); } #音乐 if ($topic['musicid']) { DB::query("delete from `" . TABLE_PREFIX . "topic_music` where `id` = '{$topic['musicid']}'"); } $tid = $topic['tid']; if ($tid > 0) { if (!empty($topic['item']) && $topic['item_id'] > 0) { jfunc('app'); app_delete_relation($topic['item'], $topic['item_id'], $topic['tid']); } foreach ($tbs as $k => $vs) { $vs = (array) $vs; foreach ($vs as $v) { DB::query("delete from `" . TABLE_PREFIX . "{$k}` where `{$v}`='{$tid}'", "SKIP_ERROR"); } } } #删除审核表里的数据 DB::query(" delete from `" . TABLE_PREFIX . "topic_verify` where `id` = {$topic['id']}"); if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $GLOBALS['_J']['config']['company_enable']) { $cpstring = DB::fetch_first("SELECT companyid,departmentid FROM " . DB::table('members') . " WHERE uid = '" . $topic['uid'] . "'"); if ($cpstring['companyid'] > 0 || $cpstring['departmentid'] > 0) { $CpLogic = jlogic('cp'); if ($cpstring['companyid'] > 0) { $CpLogic->update('company', $cpstring['companyid'], 0, -1); } if ($cpstring['departmentid'] > 0) { $CpLogic->update('department', $cpstring['departmentid'], 0, -1); } } } } if ($GLOBALS['_J']['plugins']['func']['deletetopic']) { hookscript('deletetopic', 'funcs', is_array($topictids) ? $topictids : array($topictids), 'deletetopic'); } return ''; }
function messagecutstr($str, $length = 0, $dot = ' ...') { global $_G; $sppos = strpos($str, chr(0) . chr(0) . chr(0)); if ($sppos !== false) { $str = substr($str, 0, $sppos); } $language = lang('forum/misc'); loadcache(array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist')); $bbcodes = 'b|i|u|p|color|size|font|align|list|indent|float'; $bbcodesclear = 'email|code|free|table|tr|td|img|swf|flash|attach|media|audio|payto' . ($_G['cache']['bbcodes_display'][$_G['groupid']] ? '|' . implode('|', array_keys($_G['cache']['bbcodes_display'][$_G['groupid']])) : ''); $str = strip_tags(preg_replace(array("/\\[hide=?\\d*\\](.*?)\\[\\/hide\\]/is", "/\\[quote](.*?)\\[\\/quote]/si", $language['post_edit_regexp'], "/\\[url=?.*?\\](.+?)\\[\\/url\\]/si", "/\\[({$bbcodesclear})=?.*?\\].+?\\[\\/\\1\\]/si", "/\\[({$bbcodes})=?.*?\\]/i", "/\\[\\/({$bbcodes})\\]/i"), array("[b]{$language['post_hidden']}[/b]", '', '', '\\1', '', '', ''), $str)); if ($length) { $str = cutstr($str, $length, $dot); } $str = preg_replace($_G['cache']['smilies']['searcharray'], '', $str); if ($_G['setting']['plugins'][HOOKTYPE . '_discuzcode']) { $_G['discuzcodemessage'] =& $str; $param = func_get_args(); hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'messagecutstr'), 'discuzcode'); } return trim($str); }
function get_menu_head($brandresult, $active) { global $_G, $template, $bodycss, $ishideheader, $allurl, $myhomeurl, $referer, $addgroup, $ismultiple; $bid = $brandresult['bid']; $tid = $brandresult['tid']; $group = C::t('#sanree_brand#sanree_brand_group')->get_by_groupid($brandresult['groupid']); $tmpconfig = $_G['cache']['plugin']['sanree_brand']; $allowsyngroup = intval($tmpconfig['allowsyngroup']); $isshowordinary = intval($tmpconfig['isshowordinary']); !defined('sr_brand_JS') && define('sr_brand_JS', sr_brand_TPL . '/' . $tmpconfig['template'] . '/js'); !defined('SANREE_BRAND_TEMPLATE') && define('SANREE_BRAND_TEMPLATE', sr_brand_TPL . '/' . $tmpconfig['template']); $allurl = gethomeurl(); $myhomeurl = !empty($brandresult['brandno']) ? getbrandnourl($brandresult['brandno']) : getmyburl_by_bid($brandresult['bid']); $referer = urlencode($myhomeurl); if (!isset($_G['cache']['sanree_brand_topmenu']) || !is_array($_G['cache']['sanree_brand_topmenu'])) { sanreeupdatecache('menu'); } $menu = sanreeloadcache('topmenu'); $headermenulist = array(); $headermenulist['index'] = array('url' => getburl($brandresult), 'title' => srlang('frontpage'), 'class' => ' class="normal"'); $headermenulist['detail'] = array('url' => getdetailurl($brandresult), 'title' => srlang('bird_item_detail'), 'class' => ' class="normal"'); $brandresult['allowalbum'] == 1 && ($headermenulist['myalbum'] = array('url' => getalbumurl($brandresult['bid']), 'title' => srlang('myalbum'), 'class' => ' class="normal"')); $allowsyngroup == 1 && intval($group['allowsyngroup']) == 1 && $brandresult['syngrouptid'] && ($headermenulist['dzgroup'] = array('url' => 'forum.php?mod=group&fid=' . $brandresult['syngrouptid'], 'title' => srlang('dzgroup'), 'class' => ' class="normal"')); hookscript('sanreebrandusermenu', 'global', 'funcs', array('bid' => $brandresult['bid']), 'sanreebrandusermenu'); if ($_G['sanree_brand_menus']) { foreach ($_G['sanree_brand_menus'] as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $headermenulist[$row['name']] = $row; } } $isshowordinary == 1 && ($headermenulist['ordinary'] = array('url' => 'forum.php?mod=viewthread&tid=' . $brandresult['tid'], 'title' => srlang('ordinary'), 'class' => ' class="normal"')); foreach ($menu as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $headermenulist['menu' . $row[id]] = $row; } $headermenulist[$active] && ($headermenulist[$active]['class'] = ' class="current"'); $headermenulists = $headermenulist; $headermenulist = array(); $menuorder = C::t('#sanree_brand#sanree_brand_menu_order')->fetch_all(); asort($menuorder); foreach ($menuorder as $key => $row) { if ($headermenulists[$key]) { $headermenulist[$key] = $headermenulists[$key]; } if (!$row) { $headermenulist['detail'] = $headermenulists['detail']; } } if (intval($_G['uid']) === intval($brandresult['uid'])) { define('IN_BRAND_USER', TRUE); hookscript('sanreebrandmanagemenu', 'global', 'funcs', array('bid' => $brandresult['bid']), 'sanreebrandmanagemenu'); $managemenulist = array(); $_G['sanree_brand_managemenus'][] = array('displayorder' => 9999, 'window' => 0, 'name' => '', 'title' => '', 'url' => '', 'class' => '', 'image' => 'source/plugin/sanree_brand/tpl/good/images/add.png'); if ($_G['sanree_brand_managemenus']) { foreach ($_G['sanree_brand_managemenus'] as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $managemenulist[] = $row; } $ncount = count($managemenulist); $mod = $ncount % 10; $mt = intval($ncount / 10); $oneh = 100; if ($mt == 0) { $ih = $oneh; } else { if ($mod == 0) { $ih = $mt * $oneh; } else { $ih = ($mt + 1) * $oneh; } } $ih += 10; } } $allowtemplate = intval($group['allowtemplate']); if ($allowtemplate == 1) { $templateconfig = unserialize($brandresult['templateconfig']); $bodystyle = $templateconfig['bodystyle']; $bodycss = ''; if ($bodystyle) { if (intval($bodystyle['isuse']) == 1) { $bodycss = "body {\r\n"; if ($bodystyle['notbackimg'] == 1) { if (!empty($bodystyle['backgroundimage'])) { $bodycss .= "background-image:url('" . $_G['setting']['attachurl'] . 'category/' . "{$bodystyle['backgroundimage']}');\r\n"; } } else { $bodycss .= "background:none;\r\n"; } if (!empty($bodystyle['backgroundrepeat'])) { $bodycss .= "background-repeat:{$bodystyle['backgroundrepeat']};\r\n"; } if (!empty($bodystyle['backgroundcolor'])) { $bodycss .= "background-color:{$bodystyle['backgroundcolor']};\r\n"; } if (!empty($bodystyle['backgroundattachment'])) { $bodycss .= "background-attachment:{$bodystyle['backgroundattachment']};\r\n"; } if (!empty($bodystyle['backgroundpositionx']) && !empty($bodystyle['backgroundpositiony'])) { $bodycss .= "background-position:{$bodystyle['backgroundpositionx']} {$bodystyle['backgroundpositiony']};\r\n"; } $bodycss .= "}"; $ishideheader = intval($bodystyle['ishideheader']); } } if ($ishideheader == 1) { $appVer = $_G['setting']['version']; include templateEx($this->_identifier . ':' . $template . '/header_one_' . $appVer); $GLOBALS['brand_header_one'] = $brand_header_one; } } else { $ishideheader = 0; } $slideid = 3; $slidelistarr = sanreeloadcache('slidelist'); if (!$brandresult['newbanner']) { $slidelistarr[3] = array(array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_01.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_02.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_05.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_06.jpg', 'url' => 'http://dx.sanree.com/')); } else { $brandresult['newbanner'] = explode(',', $brandresult['newbanner']); $slidelistarr[3] = $brandresult['newbanner']; } $slidelist = $slidelistarr[$slideid]; $slide_prefix = $_G['setting']['attachurl'] . 'category/'; $mtfopen = $_G['cache']['plugin']['sanree_mcertification']['isopen']; if ($mtfopen) { $mcertification = C::t('#sanree_mcertification#sanree_mcertification')->gettype_by_bid(intval($bid)); $mtf = 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/bignone.png'; if ($mcertification) { $mtf = $mcertification['type'] ? 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/bigpersonal.png' : 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/bigcompany.png'; } } $attention = $_G['cache']['plugin']['sanree_attention']['isopen']; if ($attention) { $addbtn = 'source/plugin/sanree_attention/tpl/default/img/addbtn.png'; $delbtn = 'source/plugin/sanree_attention/tpl/default/img/delbtn.png'; $uids = C::t('#sanree_attention#sanree_attention')->getuid_by_bid(intval($bid)); $atnbtn = $addbtn; $flag = 0; $atnurl = 'plugin.php?id=sanree_attention&mod=addattention&bid=' . intval($bid); if ($uids) { foreach ($uids as $uid) { if ($uid['uid'] == $_G['uid']) { $atnbtn = $delbtn; $flag = 1; $atnurl = 'plugin.php?id=sanree_attention&mod=delattention&bid=' . intval($bid); $deltip = attention_modlang('confirmationdel'); break; } } } } $assistcount = C::t('#sanree_brand#sanree_brand_assist')->count_by_where(' && bid =' . intval($bid)); $assistuids = C::t('#sanree_brand#sanree_brand_assist')->getuid_by_bid(intval($bid)); if ($assistuids) { foreach ($assistuids as $uid) { if ($uid['uid'] == $_G['uid']) { $assistflag = 1; break; } } } if (!$brandresult['satisfaction']) { $voter = C::t('#sanree_brand#sanree_brand_voter')->getvotetotal_by_tid($tid); $brandresult['satisfaction'] = intval($voter[3]); } if ($ismultiple == 1 && $brandresult['allowmultiple'] == 1) { $tempresult = C::t('#sanree_brand#sanree_brand_businesses')->getbusinesses_by_bid($bid); $tellist = explode(',', $tempresult['tel']); } else { $brandresult['tel'] = getfirsticq($brandresult['tel']); } include templateEx($this->_identifier . ':' . $this->_template . '/srhead'); $GLOBALS['srhead'] = $srhead; }