each(explode("\t", $extgroupids) as $extgroupid) { if($extgroupid = intval(trim($extgroupid))) { $groupidarray[] = $extgroupid; } } return preg_match("/(^|\t)(".implode('|', $groupidarray).")(\t|$)/", $permstr); } function forumformulaperm($formula, $return = 0) { global $_DSESSION, $extcredits, $formulamessage, $usermsg, $forum; if(!$formula || $_DSESSION['adminid'] == 1 || $forum['ismoderator']) { return; } $formula = unserialize($formula);$formula = $formula[1]; if(!$formula) { return; } @eval("\$formulaperm = ($formula) ? TRUE : FALSE;"); if(!$formulaperm) { if($return) { return FALSE; } include_once language('misc'); $search = array('$_DSESSION[\'digestposts\']', '$_DSESSION[\'posts\']', '$_DSESSION[\'oltime\']', '$_DSESSION[\'pageviews\']'); $replace = array($language['formulaperm_digestposts'], $language['formulaperm_posts'], $language['formulaperm_oltime'], $language['formulaperm_pageviews']); for($i = 1; $i <= 8; $i++) { $search[] = '$_DSESSION[\'extcredits'.$i.'\']'; $replace[] = $extcredits[$i]['title'] ? $extcredits[$i]['title'] : $language['formulaperm_extcredits'].$i; } $i = 0;$usermsg = ''; foreach($search as $s) { $usermsg .= strexists($formula, $s) ? $replace[$i].' = '.(@eval('return intval('.$s.');')).'   ' : ''; $i++; } $search = array_merge($search, array('and', 'or', '>=', '<=')); $replace = array_merge($replace, array('  '.$language['formulaperm_and'].'  ', '  '.$language['formulaperm_or'].'  ', '≥', '≤')); $formulamessage = str_replace($search, $replace, $formula); showmessage('forum_permforum_nopermission', NULL, 'NOPERM'); } return TRUE; } function getgroupid($uid, $group, &$member) { global $creditsformula, $db, $tablepre; if(!empty($creditsformula)) { $updatearray = array(); eval("\$credits = round($creditsformula);"); if($credits != $member['credits']) { $updatearray[] = "credits='$credits'"; $member['credits'] = $credits; } if($group['type'] == 'member' && !($member['credits'] >= $group['creditshigher'] && $member['credits'] < $group['creditslower'])) { $query = $db->query("SELECT groupid FROM {$tablepre}usergroups WHERE type='member' AND $member[credits]>=creditshigher AND $member[credits]num_rows($query)) { $member['groupid'] = $db->result($query, 0); $updatearray[] = "groupid='$member[groupid]'"; } } if($updatearray) { $db->query("UPDATE {$tablepre}members SET ".implode(', ', $updatearray)." WHERE uid='$uid'"); } } return $member['groupid']; } function groupexpiry($terms) { $terms = is_array($terms) ? $terms : unserialize($terms); $groupexpiry = isset($terms['main']['time']) ? intval($terms['main']['time']) : 0; if(is_array($terms['ext'])) { foreach($terms['ext'] as $expiry) { if((!$groupexpiry && $expiry) || $expiry < $groupexpiry) { $groupexpiry = $expiry; } } } return $groupexpiry; } function ipaccess($ip, $accesslist) { return preg_match("/^(".str_replace(array("\r\n", ' '), array('|', ''), preg_quote($accesslist, '/')).")/", $ip); } function ipbanned($onlineip) { global $ipaccess, $timestamp, $cachelost; if($ipaccess && !ipaccess($onlineip, $ipaccess)) { return TRUE; } $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/cache_ipbanned.php') ? '' : ' ipbanned'; if(empty($_DCACHE['ipbanned'])) { return FALSE; } else { if($_DCACHE['ipbanned']['expiration'] < $timestamp) { @unlink(DISCUZ_ROOT.'./forumdata/cache/cache_ipbanned.php'); } return preg_match("/^(".$_DCACHE['ipbanned']['regexp'].")$/", $onlineip); } } function isemail($email) { return strlen($email) > 6 && preg_match("/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/", $email); } function language($file, $templateid = 0, $tpldir = '') { $tpldir = $tpldir ? $tpldir : TPLDIR; $templateid = $templateid ? $templateid : TEMPLATEID; $languagepack = DISCUZ_ROOT.'./'.$tpldir.'/'.$file.'.lang.php'; if(file_exists($languagepack)) { return $languagepack; } elseif($templateid != 1 && $tpldir != './templates/default') { return language($file, 1, './templates/default'); } else { return FALSE; } } function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = TRUE, $simple = FALSE) { global $maxpage; $ajaxtarget = !empty($_GET['ajaxtarget']) ? " ajaxtarget=\"".dhtmlspecialchars($_GET['ajaxtarget'])."\" " : ''; $multipage = ''; $mpurl .= strpos($mpurl, '?') ? '&' : '?'; $realpages = 1; if($num > $perpage) { $offset = 2; $realpages = @ceil($num / $perpage); $pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages; if($page > $pages) { $from = 1; $to = $pages; } else { $from = $curpage - $offset; $to = $from + $page - 1; if($from < 1) { $to = $curpage + 1 - $from; $from = 1; if($to - $from < $page) { $to = $page; } } elseif($to > $pages) { $from = $pages - $page + 1; $to = $pages; } } $multipage = ($curpage - $offset > 1 && $pages > $page ? '1 ...' : ''). ($curpage > 1 && !$simple ? '' : ''); for($i = $from; $i <= $to; $i++) { $multipage .= $i == $curpage ? ''.$i.'' : ''.$i.''; } $multipage .= ($curpage < $pages && !$simple ? '' : ''). ($to < $pages ? '... '.$realpages.'' : ''). (!$simple && $pages > $page && !$ajaxtarget ? '' : ''); $multipage = $multipage ? '
'.(!$simple ? ' '.$num.' ' : '').$multipage.'
' : ''; } $maxpage = $realpages; return $multipage; } function output() { if(defined('DISCUZ_OUTPUTED')) { return; } define('DISCUZ_OUTPUTED', 1); global $sid, $transsidstatus, $rewritestatus, $ftp, $advlist, $insenz, $queryfloat, $thread, $inajax; if(($advlist || !empty($insenz['hardadstatus']) || $queryfloat) && !defined('IN_ADMINCP') && !(CURSCRIPT == 'viewthread' && $thread['digest'] == '-1') && !$inajax) { include template('adv'); } if(($transsidstatus = empty($GLOBALS['_DCOOKIE']['sid']) && $transsidstatus) || $rewritestatus) { if($transsidstatus) { $searcharray = array ( "/\]+\s*)href\=([\"|\']?)([^\"\'\s]+)/ies", "/(\)/is" ); $replacearray = array ( "transsid('\\3','" ); } else { $searcharray = $replacearray = array(); if($rewritestatus & 1) { $searcharray[] = "/\]*)\>/e"; $replacearray[] = "rewrite_forum('\\1', '\\3', '\\4')"; } if($rewritestatus & 2) { $searcharray[] = "/\]*)\>/e"; $replacearray[] = "rewrite_thread('\\1', '\\5', '\\3', '\\6')"; } if($rewritestatus & 4) { $searcharray[] = "/\]*)\>/e"; $replacearray[] = "rewrite_space('\\2', '\\3', '\\4')"; } if($rewritestatus & 8) { $searcharray[] = "/\]*)\>/e"; $replacearray[] = "rewrite_tag('\\1', '\\2')"; } } $content = preg_replace($searcharray, $replacearray, ob_get_contents()); ob_end_clean(); $GLOBALS['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start(); echo $content; } if($ftp['connid']) { @ftp_close($ftp['connid']); } $ftp = array(); if(defined('CACHE_FILE') && CACHE_FILE && !defined('CACHE_FORBIDDEN')) { global $cachethreaddir; if(diskfreespace(DISCUZ_ROOT.'./'.$cachethreaddir) > 100