function setloginstatus($member, $cookietime) { global $_G; $_G['uid'] = intval($member['uid']); $_G['username'] = $member['username']; $_G['adminid'] = $member['adminid']; $_G['groupid'] = $member['groupid']; $_G['formhash'] = formhash(); $_G['session']['invisible'] = getuserprofile('invisible'); $_G['member'] = $member; loadcache('usergroup_' . $_G['groupid']); C::app()->session->isnew = true; C::app()->session->updatesession(); dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true); dsetcookie('loginuser'); dsetcookie('activationauth'); dsetcookie('pmnum'); include_once libfile('function/stat'); updatestat('login', 1); if (defined('IN_MOBILE')) { updatestat('mobilelogin', 1); } if ($_G['setting']['connect']['allow'] && $_G['member']['conisbind']) { updatestat('connectlogin', 1); } $rule = updatecreditbyaction('daylogin', $_G['uid']); if (!$rule['updatecredit']) { checkusergroup($_G['uid']); } }
function usesubmit() { global $_G; if (empty($_GET['username'])) { showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence')); } $member = getuserinfo($_GET['username']); $this->_check($member['groupid']); $online = C::app()->session->fetch_by_uid($member['uid']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']); if ($member['uid'] != $_G['uid']) { notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1); } if ($online) { $time = dgmdate($online['lastactivity'], 'u'); if ($online['invisible']) { showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1)); } else { showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1)); } } else { showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => $_GET['username']), array('alert' => 'info', 'showdialog' => 1)); } }
public function __construct() { $this->app = C::app(); $this->setting =& $this->app->var['setting']; $this->group =& $this->app->var['group']; $this->member =& $this->app->var['member']; parent::__construct(); }
function loadcore() { global $_G; require_once './source/class/class_core.php'; $discuz = C::app(); $discuz->init_cron = false; $discuz->init_session = false; $discuz->init(); }
function __construct() { parent::__construct(); define('UC_CLIENT_VERSION', '1.6.0'); define('UC_CLIENT_RELEASE', '20110501'); define('API_DELETEUSER', 1); define('API_RENAMEUSER', 1); define('API_GETTAG', 1); define('API_SYNLOGIN', 1); define('API_SYNLOGOUT', 1); define('API_UPDATEPW', 1); define('API_UPDATEBADWORDS', 1); define('API_UPDATEHOSTS', 1); define('API_UPDATEAPPS', 1); define('API_UPDATECLIENT', 1); define('API_UPDATECREDIT', 1); define('API_GETCREDIT', 1); define('API_GETCREDITSETTINGS', 1); define('API_UPDATECREDITSETTINGS', 1); define('API_ADDFEED', 1); define('API_RETURN_SUCCEED', '1'); define('API_RETURN_FAILED', '-1'); define('API_RETURN_FORBIDDEN', '1'); define('IN_API', true); define('CURSCRIPT', 'api'); if (!defined('IN_UC')) { // require_once '../source/class/class_core.php'; Vendor("source.class.class_core"); $discuz = C::app(); $discuz->init(); require DISCUZ_ROOT . './config/config_ucenter.php'; $get = $post = array(); $code = @$_GET['code']; parse_str(authcode($code, 'DECODE', UC_KEY), $get); if (time() - $get['time'] > 3600) { exit('Authracation has expiried'); } if (empty($get)) { exit('Invalid Request'); } include_once DISCUZ_ROOT . './uc_client/lib/xml.class.php'; $post = xml_unserialize(file_get_contents('php://input')); if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcredit', 'getcreditsettings', 'updatecreditsettings', 'addfeed'))) { $uc_note = new uc_note(); echo $uc_note->{$get}['action']($get, $post); exit; } else { exit(API_RETURN_FAILED); } } else { exit; } }
/** * checkBbsAdmin() * 验证是否已经登录BBS,并且是允许的用户 * */ function checkBbsAdmin() { require '../source/class/class_core.php'; require '../source/function/function_forum.php'; C::app()->init(); $user = $GLOBALS['_G']['username']; $allow = C('ALLOW_USER'); if (!in_array($user, $allow)) { echo 'Permission Denied!'; exit; } }
function run() { if (!$this->config['cron']) { $this->error(100, 'cron service is off. Please check "config.global.php" on your webserver folder.'); } $discuz = C::app(); $discuz->initated = false; $discuz->init_db = false; $discuz->init_setting = true; $discuz->init_user = false; $discuz->init_session = false; $discuz->init_misc = false; $discuz->init_mobile = false; $discuz->init_cron = true; $discuz->init(); $this->success('Cron work is done'); }
/** * @return \discuz_application */ public static function getDiscuzApplication() { /** * @var $discuz \discuz_application */ static $discuz; if (null === $discuz) { if (!self::isBooted()) { throw new \Exception(); } if (self::$_in_symfony_firewall) { include __DIR__ . '/../www/source/class/class_core.php'; } $discuz = \C::app(); $discuz->init(); } return $discuz; }
function init() { require_once '../../source/class/class_core.php'; $cachelist = array(); $this->core = C::app(); $this->core->cachelist = $cachelist; $this->core->init_setting = true; $this->core->init_cron = false; $this->core->init_user = false; $this->core->init_session = false; $this->core->init_misc = false; $this->core->init_mobile = false; $this->core->init(); define('SERVICE_DIR', getglobal('config/remote/dir') ? getglobal('config/remote/dir') : 'remote'); $this->core->reject_robot(); if (empty($_GET['mod']) || preg_match('/[^0-9a-z]/i', $_GET['mod'])) { $this->mod = 'index'; } else { $this->mod = $_GET['mod']; } }
if (!trim($banipaddr)) { continue; } $ipnew = explode('.', $banipaddr); for ($i = 0; $i < 4; $i++) { if (strpos($ipnew[$i], '*') !== false) { $ipnew[$i] = -1; } else { $ipnew[$i] = intval($ipnew[$i]); } } $checkexists = C::t('common_banned')->fetch_by_ip($ipnew[0], $ipnew[1], $ipnew[2], $ipnew[3]); if ($checkexists) { continue; } C::app()->session->update_by_ipban($ipnew[0], $ipnew[1], $ipnew[2], $ipnew[3]); $data = array('ip1' => $ipnew[0], 'ip2' => $ipnew[1], 'ip3' => $ipnew[2], 'ip4' => $ipnew[3], 'admin' => $_G['username'], 'dateline' => $_G['timestamp'], 'expiration' => $expiration); C::t('common_banned')->insert($data, false, true); } updatecache('ipbanned'); cpmsg('members_ipban_succeed', 'action=members&operation=ipban&ipact=input', 'succeed'); } } elseif ($_GET['ipact'] == 'output') { ob_end_clean(); dheader('Cache-control: max-age=0'); dheader('Expires: ' . gmdate('D, d M Y H:i:s', TIMESTAMP - 31536000) . ' GMT'); dheader('Content-Encoding: none'); dheader('Content-Disposition: attachment; filename=IPBan.csv'); dheader('Content-Type: text/plain'); foreach (C::t('common_banned')->fetch_all_order_dateline() as $banned) { for ($i = 1; $i <= 4; $i++) {
$visitorlist[$value['vuid']] = $value; $oluids[] = $value['vuid']; } if ($oluids) { foreach (C::app()->session->fetch_all_by_uid($oluids) as $value) { if (!$value['invisible']) { $ols[$value['uid']] = 1; } elseif ($visitorlist[$value['uid']]) { unset($visitorlist[$value['uid']]); } } } $oluids = array(); $olfcount = 0; if ($space['feedfriend']) { foreach (C::app()->session->fetch_all_by_uid(explode(',', $space['feedfriend']), 15) as $value) { if ($olfcount < 15 && !$value['invisible']) { $olfriendlist[$value['uid']] = $value; $ols[$value['uid']] = 1; $oluids[$value['uid']] = $value['uid']; $olfcount++; } } } if ($olfcount < 15) { $query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 32, true); foreach ($query as $value) { $value['uid'] = $value['fuid']; $value['username'] = $value['fusername']; if (empty($oluids[$value['uid']])) { $olfriendlist[$value['uid']] = $value;
<?php /* * @copyright Leyun internet Technology(Shanghai)Co.,Ltd * @license http://www.dzzoffice.com/licenses/license.txt * @package DzzOffice * @link http://www.dzzoffice.com * @author zyx(zyx@dzz.cc) */ define('APPTYPEID', 0); define('CURSCRIPT', 'user'); require './core/class/class_core.php'; require libfile('class/user'); require libfile('function/user'); require libfile('function/mail'); require libfile('function/profile'); $dzz = C::app(); $modarray = array('activate', 'clearcookies', 'getpasswd', 'logging', 'lostpasswd', 'seccode', 'secqaa', 'register', 'ajax', 'regverify', 'switchstatus', 'profile', 'password', 'avatar'); $mod = !in_array($dzz->var['mod'], $modarray) && (!preg_match('/^\\w+$/', $dzz->var['mod']) || !file_exists(DZZ_ROOT . './member/member_' . $dzz->var['mod'] . '.php')) ? 'space' : $dzz->var['mod']; define('CURMODULE', $mod); $cachelist = array('usergroup', 'fields_register'); $dzz->cachelist = $cachelist; $dzz->init(); include_once libfile('function/cache'); updatecache('fields_register'); if (@(!file_exists(DZZ_ROOT . './user/user_' . $mod . '.php'))) { system_error(lang('message', 'undefined_action')); } require DZZ_ROOT . './user/user_' . $mod . '.php';
} foreach (C::t('common_banned')->fetch_all_order_dateline() as $banned) { $exists = 0; for ($i = 1; $i <= 4; $i++) { if ($banned["ip{$i}"] == -1) { $exists++; } elseif ($banned["ip{$i}"] == ${"ip" . $i . "new"}) { $exists++; } } if ($exists == 4) { cpmsg('members_ipban_invalid', '', 'error'); } } $expiration = TIMESTAMP + $_GET['validitynew'] * 86400; C::app()->session->update_by_ipban($_GET['ip1new'], $_GET['ip2new'], $_GET['ip3new'], $_GET['ip4new']); $data = array('ip1' => $_GET['ip1new'], 'ip2' => $_GET['ip2new'], 'ip3' => $_GET['ip3new'], 'ip4' => $_GET['ip4new'], 'admin' => $_G['username'], 'dateline' => $_G['timestamp'], 'expiration' => $expiration); C::t('common_banned')->insert($data); } if (is_array($_GET['expirationnew'])) { foreach ($_GET['expirationnew'] as $id => $expiration) { C::t('common_banned')->update_expiration_by_id($id, strtotime($expiration), $_G['adminid'], $_G['username']); } } updatecache('ipbanned'); cpmsg('members_ipban_succeed', 'action=members&operation=ipban', 'succeed'); } } elseif ($operation == 'profile') { $fieldid = $_GET['fieldid'] ? $_GET['fieldid'] : ''; shownav('user', 'nav_members_profile'); if ($fieldid) {
$diymode = 0; } if ($diymode) { $theurl .= "&from=space"; } $multi = multi($count, $perpage, $page, $theurl); if ($space['self']) { $groupselect = array($group => ' class="a"'); $maxfriendnum = checkperm('maxfriendnum'); if ($maxfriendnum) { $maxfriendnum = checkperm('maxfriendnum') + $space['addfriend']; } } } if ($fuids) { foreach (C::app()->session->fetch_all_by_uid($fuids) as $value) { if (!$value['invisible']) { $ols[$value['uid']] = $value['lastactivity']; } elseif ($list[$value['uid']] && !in_array($_GET['view'], array('me', 'trace', 'blacklist'))) { unset($list[$value['uid']]); $count = $count - 1; } } if ($_GET['view'] != 'me') { require_once libfile('function/friend'); friend_check($fuids); } if ($list) { $fieldhome = C::t('common_member_field_home')->fetch_all($fuids); foreach (C::t('common_member')->fetch_all($fuids) as $uid => $value) { $value = array_merge($value, $fieldhome[$uid]);
} if (isset($_G['cache']['onlinelist'][7]) && $_G['setting']['maxonlinelist'] > $membercount) { foreach (C::app()->session->fetch_member(2, 0, $_G['setting']['maxonlinelist'] - $membercount) as $online) { $online['icon'] = $_G['cache']['onlinelist'][7]; $online['username'] = $_G['cache']['onlinelist']['guest']; $online['lastactivity'] = dgmdate($online['lastactivity'], 't'); $whosonline[] = $online; } } unset($actioncode, $online); if ($onlinenum > $_G['setting']['maxonlinelist']) { $membercount = C::app()->session->count(1); $invisiblecount = C::app()->session->count_invisible(); } if ($onlinenum < $membercount) { $onlinenum = C::app()->session->count(); dsetcookie('onlineusernum', intval($onlinenum), 300); } $invisiblecount = intval($invisiblecount); $guestcount = $onlinenum - $membercount; unset($online); } } else { $_G['setting']['whosonlinestatus'] = 0; } if (defined('FORUM_INDEX_PAGE_MEMORY') && !FORUM_INDEX_PAGE_MEMORY) { $key = !IS_ROBOT ? $_G['member']['groupid'] : 'for_robot'; memory('set', 'forum_index_page_' . $key, array('catlist' => $catlist, 'forumlist' => $forumlist, 'sublist' => $sublist, 'whosonline' => $whosonline, 'onlinenum' => $onlinenum, 'membercount' => $membercount, 'guestcount' => $guestcount, 'grids' => $grids, 'announcements' => $announcements, 'threads' => $threads, 'posts' => $posts, 'todayposts' => $todayposts, 'onlineinfo' => $onlineinfo, 'announcepm' => $announcepm), getglobal('setting/memory/forumindex')); } } else { require_once DISCUZ_ROOT . './source/include/misc/misc_category.php';
} eval("\$_G['setting']['initcredits'] = round({$initformula});"); $settingnew['extcredits'] = $extcreditsarray; $settingnew['initcredits'] = $_G['setting']['initcredits'] . ',' . implode(',', $settingnew['initcredits']); if ($settingnew['creditstax'] < 0 || $settingnew['creditstax'] >= 1) { $settingnew['creditstax'] = 0; } $settingnew['creditstrans'] = implode(',', $settingnew['creditstrans']); } if (isset($settingnew['maxonlines'])) { if ($settingnew['maxonlines'] > 65535 || !is_numeric($settingnew['maxonlines'])) { cpmsg('setting_maxonlines_invalid', '', 'error'); } C::app()->session->update_max_rows($settingnew['maxonlines']); if ($settingnew['maxonlines'] < $setting['maxonlines']) { C::app()->session->clear(); } } if (isset($settingnew['seccodedata'])) { $settingnew['seccodedata']['width'] = intval($settingnew['seccodedata']['width']); $settingnew['seccodedata']['height'] = intval($settingnew['seccodedata']['height']); if ($settingnew['seccodedata']['type'] != 3) { $settingnew['seccodedata']['width'] = $settingnew['seccodedata']['width'] < 100 ? 100 : ($settingnew['seccodedata']['width'] > 200 ? 200 : $settingnew['seccodedata']['width']); $settingnew['seccodedata']['height'] = $settingnew['seccodedata']['height'] < 30 ? 30 : ($settingnew['seccodedata']['height'] > 80 ? 80 : $settingnew['seccodedata']['height']); } else { $settingnew['seccodedata']['width'] = 85; $settingnew['seccodedata']['height'] = 25; } $seccoderoot = ''; if ($settingnew['seccodedata']['type'] == 0 || $settingnew['seccodedata']['type'] == 2) { $seccoderoot = 'static/image/seccode/font/en/';
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: member_switchstatus.php 27203 2012-01-11 03:14:19Z zhangguosheng $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } define('NOROBOT', TRUE); if ($_G['uid']) { if (!$_G['group']['allowinvisible']) { showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1)); } $_G['session']['invisible'] = $_G['session']['invisible'] ? 0 : 1; C::app()->session->update_by_uid($_G['uid'], array('invisible' => $_G['session']['invisible'])); C::t('common_member_status')->update($_G['uid'], array('invisible' => $_G['session']['invisible']), 'UNBUFFERED'); if (!empty($_G['setting']['sessionclose'])) { dsetcookie('ulastactivity', TIMESTAMP . '|' . getuserprofile('invisible'), 31536000); } $language = lang('forum/misc'); $msg = $_G['session']['invisible'] ? $language['login_invisible_mode'] : $language['login_normal_mode']; showmessage('<a href="member.php?mod=switchstatus" title="' . $language['login_switch_invisible_mode'] . '" onclick="ajaxget(this.href, \'loginstatus\');return false;" class="xi2">' . $msg . '</a>', dreferer(), array(), array('msgtype' => 3, 'showmsg' => 1)); }
function ipbanadd($ip1new, $ip2new, $ip3new, $ip4new, $validitynew, &$error) { global $_G; if ($ip1new != '' && $ip2new != '' && $ip3new != '' && $ip4new != '') { $own = 0; $ip = explode('.', $_G['clientip']); for ($i = 1; $i <= 4; $i++) { if (!is_numeric(${'ip' . $i . 'new'}) || ${'ip' . $i . 'new'} < 0) { if ($_G['adminid'] != 1) { $error = 1; return FALSE; } ${'ip' . $i . 'new'} = -1; $own++; } elseif (${'ip' . $i . 'new'} == $ip[$i - 1]) { $own++; } ${'ip' . $i . 'new'} = intval(${'ip' . $i . 'new'}) > 255 ? 255 : intval(${'ip' . $i . 'new'}); } if ($own == 4) { $error = 2; return FALSE; } $query = DB::query("SELECT * FROM " . DB::table('common_banned') . " WHERE (ip1='{$ip1new}' OR ip1='-1') AND (ip2='{$ip2new}' OR ip2='-1') AND (ip3='{$ip3new}' OR ip3='-1') AND (ip4='{$ip4new}' OR ip4='-1')"); if ($banned = C::t('common_banned')->fetch_by_ip($ip1new, $ip2new, $ip3new, $ip4new)) { $error = 3; return FALSE; } $expiration = $validitynew > 1 ? TIMESTAMP + $validitynew * 86400 : TIMESTAMP + 86400; C::app()->session->update_by_ipban($ip1new, $ip2new, $ip3new, $ip4new); $data = array('ip1' => $ip1new, 'ip2' => $ip2new, 'ip3' => $ip3new, 'ip4' => $ip4new, 'admin' => $_G['username'], 'dateline' => $_G['timestamp'], 'expiration' => $expiration); C::t('common_banned')->insert($data); return TRUE; } return FALSE; }
function getonlinemember($uids) { global $_G; if ($uids && is_array($uids) && empty($_G['ols'])) { $_G['ols'] = array(); foreach (C::app()->session->fetch_all_by_uid($uids) as $value) { if (!$value['invisible']) { $_G['ols'][$value['uid']] = $value['lastactivity']; } } } }
<?php //用于方便的在插件中初始化应用,用于admin.php和search.php这种 //直接由插件调用不经过discuz路由的页面 $source_dir = dirname(dirname(dirname($_SERVER['PHP_SELF']))); $source_dir = $_SERVER['DOCUMENT_ROOT'] . $source_dir; require_once $source_dir . '/class/class_core.php'; C::app()->cachelist = []; C::app()->init(); //showmessage函数用到这个 $_G['siteurl'] = str_replace('source/plugin/ngpt/', '', $_G['siteurl']); $_G['siteroot'] = str_replace('source/plugin/ngpt/', '', $_G['siteroot']); if ($_G['uid'] <= 0) { showmessage('请先登录'); }
$msglist = array(); $msguser = $messageappend = ''; $online = 0; foreach ($result as $key => $value) { if ($value['authorid'] != $_G['uid']) { $msguser = $value['author']; } $daykey = dgmdate($value['dateline'], 'Y-m-d'); $msglist[$daykey][$key] = $value; } if ($touid && empty($msguser)) { $member = getuserbyuid($touid); $msguser = $member['username']; } if (!$msgonly) { $online = C::app()->session->fetch_by_uid($touid) ? 1 : 0; if ($_G['member']['newpm']) { $newpm = setstatus(1, 0, $_G['member']['newpm']); C::t('common_member')->update($_G['uid'], array('newpm' => $newpm)); uc_pm_ignore($_G['uid']); } } if (!empty($_GET['tradeid'])) { $trade = C::t('forum_trade')->fetch_goods(0, $_GET['tradeid']); if ($trade) { $messageappend = dhtmlspecialchars('[url=' . $_G['siteurl'] . 'forum.php?mod=viewthread&tid=' . $trade['tid'] . '&do=tradeinfo&pid=' . $trade['pid'] . '][b]' . $trade['subject'] . '[/b][/url]'); } } elseif (!empty($_GET['commentid'])) { $comment = C::t('forum_postcomment')->fetch($_GET['commentid']); if ($comment) { $comment['comment'] = str_replace(array('[b]', '[/b]', '[/color]'), array(''), preg_replace("/\\[color=([#\\w]+?)\\]/i", '', strip_tags($comment['comment'])));
showmessage('space_does_not_exist'); } if ($tospace['uid'] == $space['uid']) { showmessage('unable_to_manage_self'); } friend_delete($tospace['uid']); C::t('home_blacklist')->insert(array('uid' => $space['uid'], 'buid' => $tospace['uid'], 'dateline' => $_G['timestamp']), false, false, true); $count = C::t('home_blacklist')->count_by_uid_buid($space['uid']); C::t('common_member_count')->update($_G['uid'], array('blacklist' => $count)); showmessage('do_success', "home.php?mod=space&uid={$_G['uid']}&do=friend&view=blacklist&quickforward=1&start={$_GET['start']}"); } } elseif ($op == 'rand') { $userlist = $randuids = array(); space_merge($space, 'count'); if ($space['friends'] < 5) { $userlist = C::app()->session->fetch_member(1, 2, 100); } else { $query = C::t('home_friend')->fetch($_G['uid']); foreach ($query as $value) { $userlist[$value['uid']] = $value['fuid']; } } unset($userlist[$space['uid']]); $randuids = sarray_rand($userlist, 1); showmessage('do_success', "home.php?mod=space&quickforward=1&uid=" . array_pop($randuids)); } elseif ($op == 'getcfriend') { $fuid = empty($_GET['fuid']) ? 0 : intval($_GET['fuid']); $list = array(); if ($fuid) { $friend = $friendlist = array(); $query = C::t('home_friend')->fetch_all_by_uid_common($space['uid'], $fuid);
$replies = C::t('forum_post')->count_visiblepost_by_tid($_G['tid']); $replies = intval($replies) - 1; if ($_G['forum_thread']['replies'] != $replies && $replies > 0) { C::t('forum_thread')->update($_G['tid'], array('replies' => $replies), false, false, $archiveid); dheader("Location: forum.php?mod=redirect&tid={$_G['tid']}&goto=lastpost"); } } } if ($_G['forum_pagebydesc'] && (!$savepostposition || $_GET['ordertype'] == 1)) { $postlist = array_reverse($postlist, TRUE); } if (!empty($_G['setting']['sessionclose'])) { $_G['setting']['vtonlinestatus'] = 1; } if ($_G['setting']['vtonlinestatus'] == 2 && $_G['forum_onlineauthors']) { foreach (C::app()->session->fetch_all_by_uid(array_keys($_G['forum_onlineauthors'])) as $author) { if (!$author['invisible']) { $_G['forum_onlineauthors'][$author['uid']] = 1; } } } else { $_G['forum_onlineauthors'] = array(); } $ratelogs = $comments = $commentcount = $totalcomment = array(); if ($_G['forum_cachepid']) { foreach (C::t('forum_postcache')->fetch_all($_G['forum_cachepid']) as $postcache) { if ($postcache['rate']) { $postcache['rate'] = dunserialize($postcache['rate']); $postlist[$postcache['pid']]['ratelog'] = $postcache['rate']['ratelogs']; $postlist[$postcache['pid']]['ratelogextcredits'] = $postcache['rate']['extcredits']; $postlist[$postcache['pid']]['totalrate'] = $postcache['rate']['totalrate'];
function template($file, $templateid = 0, $tpldir = '', $gettplfile = 0, $primaltpl = '') { global $_G; static $_init_style = false; if ($_init_style === false) { C::app()->_init_style(); $_init_style = true; } $oldfile = $file; if (strpos($file, ':') !== false) { $clonefile = ''; list($templateid, $file, $clonefile) = explode(':', $file); $oldfile = $file; $file = empty($clonefile) ? $file : $file . '_' . $clonefile; if ($templateid == 'diy') { $indiy = false; $_G['style']['tpldirectory'] = $tpldir ? $tpldir : (defined('TPLDIR') ? TPLDIR : ''); $_G['style']['prefile'] = ''; $diypath = DISCUZ_ROOT . './data/diy/' . $_G['style']['tpldirectory'] . '/'; //DIY模板文件目录 $preend = '_diy_preview'; $_GET['preview'] = !empty($_GET['preview']) ? $_GET['preview'] : ''; $curtplname = $oldfile; $basescript = $_G['mod'] == 'viewthread' && !empty($_G['thread']) ? 'forum' : $_G['basescript']; if (isset($_G['cache']['diytemplatename' . $basescript])) { $diytemplatename =& $_G['cache']['diytemplatename' . $basescript]; } else { if (!isset($_G['cache']['diytemplatename'])) { loadcache('diytemplatename'); } $diytemplatename =& $_G['cache']['diytemplatename']; } $tplsavemod = 0; if (isset($diytemplatename[$file]) && file_exists($diypath . $file . '.htm') && ($tplsavemod = 1) || empty($_G['forum']['styleid']) && ($file = $primaltpl ? $primaltpl : $oldfile) && isset($diytemplatename[$file]) && file_exists($diypath . $file . '.htm')) { $tpldir = 'data/diy/' . $_G['style']['tpldirectory'] . '/'; !$gettplfile && ($_G['style']['tplsavemod'] = $tplsavemod); $curtplname = $file; if (isset($_GET['diy']) && $_GET['diy'] == 'yes' || isset($_GET['diy']) && $_GET['preview'] == 'yes') { //DIY模式或预览模式下做以下判断 $flag = file_exists($diypath . $file . $preend . '.htm'); if ($_GET['preview'] == 'yes') { $file .= $flag ? $preend : ''; } else { $_G['style']['prefile'] = $flag ? 1 : ''; } } $indiy = true; } else { $file = $primaltpl ? $primaltpl : $oldfile; } $tplrefresh = $_G['config']['output']['tplrefresh']; if ($indiy && ($tplrefresh == 1 || $tplrefresh > 1 && !($_G['timestamp'] % $tplrefresh)) && filemtime($diypath . $file . '.htm') < filemtime(DISCUZ_ROOT . $_G['style']['tpldirectory'] . '/' . ($primaltpl ? $primaltpl : $oldfile) . '.htm')) { if (!updatediytemplate($file, $_G['style']['tpldirectory'])) { unlink($diypath . $file . '.htm'); $tpldir = ''; } } if (!$gettplfile && empty($_G['style']['tplfile'])) { $_G['style']['tplfile'] = empty($clonefile) ? $curtplname : $oldfile . ':' . $clonefile; } $_G['style']['prefile'] = !empty($_GET['preview']) && $_GET['preview'] == 'yes' ? '' : $_G['style']['prefile']; } else { $tpldir = './source/plugin/' . $templateid . '/template'; } } $file .= !empty($_G['inajax']) && ($file == 'common/header' || $file == 'common/footer') ? '_ajax' : ''; $tpldir = $tpldir ? $tpldir : (defined('TPLDIR') ? TPLDIR : ''); $templateid = $templateid ? $templateid : (defined('TEMPLATEID') ? TEMPLATEID : ''); $filebak = $file; if (defined('IN_MOBILE') && !defined('TPL_DEFAULT') && strpos($file, 'mobile/') === false || isset($_G['forcemobilemessage']) && $_G['forcemobilemessage']) { $file = 'mobile/' . $oldfile; } if (!$tpldir) { $tpldir = './template/default'; } $tplfile = $tpldir . '/' . $file . '.htm'; $file == 'common/header' && defined('CURMODULE') && CURMODULE && ($file = 'common/header_' . $_G['basescript'] . '_' . CURMODULE); if (defined('IN_MOBILE') && !defined('TPL_DEFAULT')) { if (strpos($tpldir, 'plugin')) { if (!file_exists(DISCUZ_ROOT . $tpldir . '/' . $file . '.htm') && !file_exists(DISCUZ_ROOT . $tpldir . '/' . $file . '.php')) { discuz_error::template_error('template_notfound', $tpldir . '/' . $file . '.htm'); } else { $mobiletplfile = $tpldir . '/' . $file . '.htm'; } } !$mobiletplfile && ($mobiletplfile = $file . '.htm'); if (strpos($tpldir, 'plugin') && (file_exists(DISCUZ_ROOT . $mobiletplfile) || file_exists(substr(DISCUZ_ROOT . $mobiletplfile, 0, -4) . '.php'))) { $tplfile = $mobiletplfile; } elseif (!file_exists(DISCUZ_ROOT . TPLDIR . '/' . $mobiletplfile) && !file_exists(substr(DISCUZ_ROOT . TPLDIR . '/' . $mobiletplfile, 0, -4) . '.php')) { $mobiletplfile = './template/default/' . $mobiletplfile; if (!file_exists(DISCUZ_ROOT . $mobiletplfile) && !$_G['forcemobilemessage']) { $tplfile = str_replace('mobile/', '', $tplfile); $file = str_replace('mobile/', '', $file); define('TPL_DEFAULT', true); } else { $tplfile = $mobiletplfile; } } else { $tplfile = TPLDIR . '/' . $mobiletplfile; } } $cachefile = './data/template/' . (defined('STYLEID') ? STYLEID . '_' : '_') . $templateid . '_' . str_replace('/', '_', $file) . '.tpl.php'; if ($templateid != 1 && !file_exists(DISCUZ_ROOT . $tplfile) && !file_exists(substr(DISCUZ_ROOT . $tplfile, 0, -4) . '.php') && !file_exists(DISCUZ_ROOT . ($tplfile = $tpldir . $filebak . '.htm'))) { $tplfile = './template/default/' . $filebak . '.htm'; } if ($gettplfile) { return $tplfile; } checktplrefresh($tplfile, $tplfile, @filemtime(DISCUZ_ROOT . $cachefile), $templateid, $cachefile, $tpldir, $file); return DISCUZ_ROOT . $cachefile; }
public static function updatesession() { static $updated = false; if (!$updated) { global $_G; if ($_G['uid']) { if ($_G['cookie']['ulastactivity']) { $ulastactivity = authcode($_G['cookie']['ulastactivity'], 'DECODE'); } else { $ulastactivity = getuserprofile('lastactivity'); dsetcookie('ulastactivity', authcode($ulastactivity, 'ENCODE'), 31536000); } } $oltimespan = $_G['setting']['oltimespan']; $lastolupdate = C::app()->session->var['lastolupdate']; if ($_G['uid'] && $oltimespan && TIMESTAMP - ($lastolupdate ? $lastolupdate : $ulastactivity) > $oltimespan * 60) { $isinsert = false; if (C::app()->session->isnew) { $oldata = C::t('common_onlinetime')->fetch($_G['uid']); if (empty($oldata)) { $isinsert = true; } else { if (TIMESTAMP - $oldata['lastupdate'] > $oltimespan * 60) { C::t('common_onlinetime')->update_onlinetime($_G['uid'], $oltimespan, $oltimespan, TIMESTAMP); } } } else { $isinsert = !C::t('common_onlinetime')->update_onlinetime($_G['uid'], $oltimespan, $oltimespan, TIMESTAMP); } if ($isinsert) { C::t('common_onlinetime')->insert(array('uid' => $_G['uid'], 'thismonth' => $oltimespan, 'total' => $oltimespan, 'lastupdate' => TIMESTAMP)); } C::app()->session->set('lastolupdate', TIMESTAMP); } foreach (C::app()->session->var as $k => $v) { if (isset($_G['member'][$k]) && $k != 'lastactivity') { C::app()->session->set($k, $_G['member'][$k]); } } foreach ($_G['action'] as $k => $v) { C::app()->session->set($k, $v); } C::app()->session->update(); if ($_G['uid'] && TIMESTAMP - $ulastactivity > 21600) { if ($oltimespan && TIMESTAMP - $ulastactivity > 43200) { $onlinetime = C::t('common_onlinetime')->fetch($_G['uid']); C::t('common_member_count')->update($_G['uid'], array('oltime' => round(intval($onlinetime['total']) / 60))); } dsetcookie('ulastactivity', authcode(TIMESTAMP, 'ENCODE'), 31536000); C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'port' => $_G['remoteport'], 'lastactivity' => TIMESTAMP, 'lastvisit' => TIMESTAMP)); } $updated = true; } return $updated; }
if (!$daterange) { $count = uc_pm_view_num($_G['uid'], $plid, 1); if (!$page) { $page = ceil($count / $perpage); } $list = uc_pm_view($_G['uid'], 0, $plid, 5, ceil($count / $perpage) - $page + 1, $perpage, $type, 1); } else { $list = uc_pm_view($_G['uid'], 0, $plid, 5, ceil($count / $perpage) - $page + 1, $perpage, $type, 1); $chatpmmember = uc_pm_chatpmmemberlist($_G['uid'], $plid); if (!empty($chatpmmember)) { $authorid = $founderuid = $chatpmmember['author']; $chatpmmemberlist = C::t('common_member')->fetch_all($chatpmmember['member']); foreach (C::t('common_member_field_home')->fetch_all($chatpmmember['member']) as $uid => $member) { $chatpmmemberlist[$uid] = array_merge($member, $chatpmmemberlist[$uid]); } foreach (C::app()->session->fetch_all_by_uid($chatpmmember['member']) as $value) { if (!$value['invisible']) { $ols[$value['uid']] = $value['lastactivity']; } } } $membernum = count($chatpmmemberlist); $subject = $list[0]['subject']; $refreshtime = $_G['setting']['chatpmrefreshtime']; $multi = pmmulti($count, $perpage, $page, "home.php?mod=space&do=pm&subop=view&plid={$plid}&type={$type}"); } } $founderuid = empty($list) ? 0 : $list[0]['founderuid']; $pmid = empty($list) ? 0 : $list[0]['pmid']; } $actives['privatepm'] = ' class="a"';
$loglist = array(); $logs = C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid(0, 'BAC', $aid); $luids = array(); foreach ($logs as $log) { $luids[$log['uid']] = $log['uid']; } $members = C::t('common_member')->fetch_all($luids); foreach ($logs as $log) { $log['username'] = $members[$log['uid']]['username']; $log['dateline'] = dgmdate($log['dateline'], 'u'); $log[$extcreditname] = abs($log[$extcreditname]); $loglist[] = $log; } include template('forum/attachpay_view'); } elseif ($_GET['action'] == 'getonlines') { $num = C::app()->session->count(); showmessage($num); } elseif ($_GET['action'] == 'upload') { $type = !empty($_GET['type']) && in_array($_GET['type'], array('image', 'file')) ? $_GET['type'] : 'image'; $attachexts = $imgexts = ''; $_G['group']['allowpostattach'] = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || !$_G['forum']['postattachperm'] && $_G['group']['allowpostattach'] || $_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])); $_G['group']['allowpostimage'] = $_G['forum']['allowpostimage'] != -1 && ($_G['forum']['allowpostimage'] == 1 || !$_G['forum']['postimageperm'] && $_G['group']['allowpostimage'] || $_G['forum']['postimageperm'] && forumperm($_G['forum']['postimageperm'])); $_G['group']['attachextensions'] = $_G['forum']['attachextensions'] ? $_G['forum']['attachextensions'] : $_G['group']['attachextensions']; if ($_G['group']['attachextensions']) { $imgexts = explode(',', str_replace(' ', '', $_G['group']['attachextensions'])); $imgexts = array_intersect(array('jpg', 'jpeg', 'gif', 'png', 'bmp'), $imgexts); $imgexts = implode(', ', $imgexts); } else { $imgexts = 'jpg, jpeg, gif, png, bmp'; } if ($type == 'image' && (!$_G['group']['allowpostimage'] || !$imgexts)) {
function grouponline($fid, $getlist = '') { $fid = intval($fid); if (empty($getlist)) { $onlinemember = C::app()->session->count_by_fid($fid); $onlinemember['count'] = $onlinemember ? intval($onlinemember) : 0; } else { $onlinemember = array('count' => 0, 'list' => array()); $onlinemember['list'] = C::app()->session->fetch_all_by_fid($_G['fid']); $onlinemember['count'] = count($onlinemember['list']); } return $onlinemember; }
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: group.php 31307 2012-08-10 02:10:56Z zhengqingpeng $ * Modified by Valery Votintsev, codersclub.org */ define('APPTYPEID', 3); define('CURSCRIPT', 'group'); require './source/class/class_core.php'; $discuz = C::app(); $cachelist = array('grouptype', 'groupindex', 'diytemplatenamegroup'); $discuz->cachelist = $cachelist; $discuz->init(); /*vot*/ settings_localize(); // Localize Navigation & Settings $_G['disabledwidthauto'] = 0; $modarray = array('index', 'my', 'attentiongroup'); $mod = !in_array($_G['mod'], $modarray) ? 'index' : $_G['mod']; define('CURMODULE', $mod); runhooks();
$_GET['orderby'] = isset($_G['cache']['forums'][$_G['fid']]['orderby']) ? $_G['cache']['forums'][$_G['fid']]['orderby'] : 'lastpost'; } $_GET['ascdesc'] = isset($_G['cache']['forums'][$_G['fid']]['ascdesc']) ? $_G['cache']['forums'][$_G['fid']]['ascdesc'] : 'DESC'; $check = array(); $check[$filter] = $check[$_GET['orderby']] = $check[$_GET['ascdesc']] = 'selected="selected"'; if ($_G['forum']['status'] != 3 && $_G['forum']['allowside'] || !empty($_G['forum']['threadsorts']['templatelist'])) { updatesession(); $onlinenum = C::app()->session->count_by_fid($_G['fid']); if (!IS_ROBOT && ($_G['setting']['whosonlinestatus'] == 2 || $_G['setting']['whosonlinestatus'] == 3)) { $_G['setting']['whosonlinestatus'] = 1; $detailstatus = $showoldetails == 'yes' || (!isset($_G['cookie']['onlineforum']) && !$_G['setting']['whosonline_contract'] || $_G['cookie']['onlineforum']) && !$showoldetails; if ($detailstatus) { $actioncode = lang('forum/action'); $whosonline = array(); $forumname = strip_tags($_G['forum']['name']); $whosonline = C::app()->session->fetch_all_by_fid($_G['fid'], 12); $_G['setting']['whosonlinestatus'] = 1; } } else { $_G['setting']['whosonlinestatus'] = 0; } } if ($_G['forum']['threadsorts']['types'] && $sortoptionarray && ($_GET['searchoption'] || $_GET['searchsort'])) { $sortid = intval($_GET['sortid']); if ($_GET['searchoption']) { $forumdisplayadd['page'] = '&sortid=' . $sortid; foreach ($_GET['searchoption'] as $optionid => $option) { $optionid = intval($optionid); $searchoption = ''; if (is_array($option['value'])) { foreach ($option['value'] as $v) {