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); if(!$isadmin && $currentPost->getVar('approved')<0 ){ redirect_header("viewtopic.php?topic_id=".$topic_id, 2, _MD_NORIGHTTOVIEW);
$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 Short term cookie: (same as session life time) ST - Stored Topic IDs for mark LP - Last Post LF - Forum Last view LT - Topic Last read LVT - Last Visit Temp */
// If user checked notification box, subscribe them to the // appropriate event; if unchecked, then unsubscribe if (!empty($xoopsUser) && !empty($xoopsModuleConfig['notification_enabled'])) { $notification_handler =& xoops_gethandler('notification'); if (empty($_POST['notify'])) { $notification_handler->unsubscribe('thread', $forumpost->getVar('topic_id'), 'new_post'); } elseif ($_POST['notify'] > 0) { $notification_handler->subscribe('thread', $forumpost->getVar('topic_id'), 'new_post'); } // elseif($_POST['notify']<0) keep it as it is } if($approved){ if(!empty($xoopsModuleConfig['cache_enabled'])){ forum_setsession("t".$forumpost->getVar("topic_id"), null); } $redirect = "viewtopic.php?topic_id=".$forumpost->getVar('topic_id')."&post_id=".$postid."#forumpost".$postid.""; $message = _MD_THANKSSUBMIT."<br />".$error_upload; }else{ $redirect = "viewforum.php?forum=".$forumpost->getVar('forum_id'); $message = _MD_THANKSSUBMIT."<br />"._MD_WAITFORAPPROVAL."<br />".$error_upload; } if ( $op == "add" ) { redirect_header("polls.php?op=add&forum=".$forumpost->getVar('forum_id')."&topic_id=".$forumpost->getVar('topic_id')."",1,_MD_ADDPOLL); exit(); }else{ redirect_header($redirect,2,$message); exit(); } }
/** * 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]; }