$user_handler->setUsers($users); $user_handler->setGroups($groups_disp); $user_handler->setStatus($online); foreach($userid_array as $userid){ $viewtopic_users[$userid] =& $user_handler->get($userid); if (!$viewtopic_forum->getVar('allow_sig')) { $viewtopic_users[$userid]["signature"] = ""; } } } unset($users); unset($groups_disp); if($xoopsModuleConfig['allow_require_reply'] && $require_reply){ if(!empty($xoopsModuleConfig['cache_enabled'])){ $viewtopic_posters = forum_getsession("t".$topic_id, true); if(!is_array($viewtopic_posters) || count($viewtopic_posters)==0){ $viewtopic_posters =& $topic_handler->getAllPosters($xforumtopic); forum_setsession("t".$topic_id, $viewtopic_posters); } }else{ $viewtopic_posters =& $topic_handler->getAllPosters($xforumtopic); } }else{ $viewtopic_posters =array(); } if ($viewmode == "thread") { if(!empty($post_id)){ $post_handler =& xoops_getmodulehandler('post', 'xforum'); $currentPost = $post_handler -> get($post_id);
$forumCookie['path'] = "/"; $forumCookie['secure'] = false; $forumCookie['expire'] = time() + 3600 * 24 * 30; // one month $forumCookie['prefix'] = ''; // set cookie name to avoid subsites confusion such as: domain.com, sub1.domain.com, sub2.domain.com, domain.com/xoopss, domain.com/xoops2 if(empty($forumCookie['prefix'])){ $cookie_prefix = preg_replace("/[^a-z_0-9]+/i", "_", preg_replace("/(http(s)?:\/\/)?(www.)?/i","",XOOPS_URL)); $cookie_userid = (is_object($xoopsUser))?$xoopsUser->getVar('uid'):0; $forumCookie['prefix'] = $cookie_prefix."_".$xoopsModule->dirname().'_'.$cookie_userid."_"; } // set LastVisitTemp cookie, which only gets the time from the LastVisit cookie if it does not exist yet // otherwise, it gets the time from the LastVisitTemp cookie //$last_visit = forum_getcookie("LVT"); $last_visit = forum_getsession("LV"); $last_visit = ($last_visit)?$last_visit:forum_getcookie("LV"); $last_visit = ($last_visit)?$last_visit:time(); // update LastVisit cookie. forum_setcookie("LV", time(), $forumCookie['expire']); // set cookie life time to one month //forum_setcookie("LVT", $last_visit); forum_setsession("LV", $last_visit); /* xforum cookie storage Long term cookie: (configurable, generally one month) LV - Last Visit M - Menu mode V - View mode G - Toggle
setcookie($xoopsConfig['session_name'], session_id(), time()+(60 * $xoopsConfig['session_expire']), '/', '', 0); } $user_theme = $user->getVar('theme'); if (in_array($user_theme, $xoopsConfig['theme_set_allowed'])) { $_SESSION['xoopsUserTheme'] = $user_theme; } } $xoopsUser =& $user; } } $isadmin = forum_isAdmin($forum_obj); $time_valid = true; if( !$isadmin && !empty($xoopsModuleConfig['post_timelimit']) ){ $last_post = forum_getsession('LP'); // using session might be more secure ... if(time()-$last_post < $xoopsModuleConfig['post_timelimit']){ $time_valid = false; } } if(!$token_valid || !$time_valid){ $_POST['contents_preview'] = 1; $_POST['contents_submit'] = null; $_POST['contents_upload'] = null; if(!$token_valid) echo "<div class=\"errorMsg\">"._MD_INVALID_SUBMIT."</div>"; if(!$time_valid) echo "<div class=\"errorMsg\">".sprintf(_MD_POSTING_LIMITED,$xoopsModuleConfig['post_timelimit'])."</div>"; echo "<br clear=\"both\" />"; } }
/** * Get a forum list that a user is suspended, according to his uid and ip * Store the list into session if module cache is enabled * * * @param int $uid user id * @param string $ip user ip */ function forumList($uid=-1, $ip=""){ static $xforums = array(); $uid = ($uid<0)?(is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uid"):0):$uid; $ip = empty($ip)?forum_getIP(true):$ip; if(isset($xforums[$uid][$ip])){ return $xforums[$uid][$ip]; } if(!empty($GLOBALS["xoopsModuleConfig"]['cache_enabled'])){ $xforums[$uid][$ip] = forum_getsession("sf".$uid."_".ip2long($ip), true); if(is_array($xforums[$uid][$ip]) && count($xforums[$uid][$ip])){ return $xforums[$uid][$ip]; } } $uid_criteria = empty($uid)?"1=1":"uid=".intval($uid); if(!empty($ip)){ $ip_segs = explode(".", $ip); for($i=1; $i<=4; $i++){ $ips[] = $this->db->quoteString(implode(".", array_slice($ip_segs, 0, $i))); } $ip_criteria = "ip IN(".implode(",", $ips).")"; }else{ $ip_criteria = "1=1"; } $expire_criteria = "mod_end > ".time(); $sql = sprintf("SELECT forum_id, COUNT(*) AS count FROM %s WHERE (%s OR %s) AND (%s) GROUP BY forum_id", $this->db->prefix('xf_moderates'), $uid_criteria, $ip_criteria, $expire_criteria); if (!$result = $this->db->query($sql)) { return $xforums[$uid][$ip] = array(); } $_forums = array(); while($row = $this->db->fetchArray($result)){ if($row["count"]>0){ $_forums[$row["forum_id"]] = 1; } } $xforums[$uid][$ip] = count($_forums)?array_keys($_forums):array(-1); if(!empty($GLOBALS["xoopsModuleConfig"]['cache_enabled'])){ forum_setsession("sf".$uid."_".ip2long($ip), $xforums[$uid][$ip]); } return $xforums[$uid][$ip]; }