cbTabHandler(); } /** * Private method of CB: don't expect it to work after CB 1.1...couldn't do it in the constructor, since params are loaded after... */ function _loadParams( $pluginid, &$extraParams ) { global $mainframe; parent::_loadParams( $pluginid, $extraParams ); $params = $this->params; $forumType = $params->get( 'forumType', 0 ); if ( in_array( $forumType, array( 0, 2 ) ) && file_exists( $mainframe->getCfg('absolute_path').'/administrator/components/com_joomlaboard/joomlaboard_config.php' )) { $this->com_name = 'com_joomlaboard'; $this->sql_prefix = 'sb'; $this->config_filename = $mainframe->getCfg('absolute_path') . '/administrator/components/com_joomlaboard/joomlaboard_config.php'; } else if ( in_array( $forumType, array( 0, 3 ) ) && file_exists( $mainframe->getCfg('absolute_path') . '/administrator/components/com_simpleboard/simpleboard_config.php' )) { $this->com_name = 'com_simpleboard'; $this->sql_prefix = 'sb'; $this->config_filename = $mainframe->getCfg('absolute_path') . '/administrator/components/com_simpleboard/simpleboard_config.php'; } elseif ( in_array( $forumType, array( 0, 1 ) ) && file_exists( $mainframe->getCfg('absolute_path').'/administrator/components/com_fireboard/fireboard_config.php' )) { $this->com_name = 'com_fireboard'; $this->sql_prefix = 'fb'; $this->config_filename = $mainframe->getCfg('absolute_path') . '/administrator/components/com_fireboard/fireboard_config.php'; } } /** * ForumTab Internal method: returns an unescaped string if magic_quotes_gpc is on, correcting a SB 1.1.0 double-escaping bug! * @access private * @param string to unescape * @return string unescaped if needed */ function _sbUnEscape($string) { return ((get_magic_quotes_gpc()==1) ? stripslashes($string) : $string); // correcting a SB 1.1.0 double-escaping bug! } /** * ForumTab Internal method: returns an escaped string if magic_quotes_gpc is on, correcting a SB 1.1.0 double-escaping bug! * @access private * @param string to escape * @return string escaped if needed */ function _sbEscape($string) { return ((get_magic_quotes_gpc()==1) ? addslashes($string) : $string); // correcting a SB 1.1.0 double-escaping bug! } /** * ForumTab Internal method: returns $sbUserDetails for the $user * @access private * @param array sbConfig * @param object user being displayed * @return object sbUserDetails */ function _getSBstats($sbConfig, $user) { global $_CB_database,$mosConfig_live_site,$acl,$my; if($sbConfig['showstats'] || (!$sbConfig['showranking'] && !$sbConfig['showkarma'] && !$sbConfig['postStats'])) { $_CB_database->setQuery("SELECT posts,karma,moderator,gid FROM #__" . $this->sql_prefix . "_users sb, #__users u where sb.userid=u.id AND sb.userid=" . (int) $user->id); $sbUserDetails=$_CB_database->loadObjectList(); if(count($sbUserDetails)>0) $sbUserDetails=$sbUserDetails[0]; if( (isset($sbUserDetails->posts)) and $sbUserDetails->posts != 0) { if($sbConfig['showranking']) { $uIsAdm=""; $uIsMod=""; if ( $sbUserDetails->gid > 0 ) { //only get the groupname from the ACL if we're sure there is one $agrp=strtolower( $acl->get_group_name( $sbUserDetails->gid, 'ARO' ) ); if(strtolower($agrp)=="administrator" || strtolower($agrp)=="superadministrator"|| strtolower($agrp)=="super administrator") $uIsAdm=1; } $uIsMod=$sbUserDetails->moderator; if ( $this->com_name == 'com_fireboard' ) { $params = $this->params; $pathTemplate = $params->get('TemplateRank', '/template/default/images/english'); $sbs = $mosConfig_live_site.'/components/'.$this->com_name.$pathTemplate; $query = "SELECT * FROM #__fb_ranks WHERE rank_special=0 ORDER BY rank_min"; $_CB_database->setQuery($query); $rankitems=$_CB_database->loadObjectList(); $rankitemscount=count($rankitems); $i = 1; foreach ($rankitems as $rankitem) { $sbConfig['rank'.$i] = $rankitem->rank_min; $sbConfig['rank'.$i.'txt'] = $rankitem->rank_title; $sbConfig['rank'.$i.'image'] = '/ranks/'.$rankitem->rank_image; $i++; } } else { $sbs = $mosConfig_live_site.'/components/'.$this->com_name; $rankitemscount = 6; for ($i=1;$i<=$rankitemscount;$i++) { $sbConfig['rank'.$i.'image'] = '/ranks/rank'.$i.'.gif'; } } $numPosts=$sbUserDetails->posts; $rText=""; $rImg=""; for ($i=1;$i<=$rankitemscount;$i++) { if ($numPosts<(int)$sbConfig['rank'.$i]) break; } $i--; // if ($numPosts>=0 && $numPosts<(int)$sbConfig['rank1']) { $rText=$sbConfig['rank1txt']; $rImg=$sbs.$sbConfig['rank1image']; } // if ($numPosts>=(int)$sbConfig['rank1'] && $numPosts<(int)$sbConfig['rank2']){$rText=$sbConfig['rank2txt']; $rImg=$sbs.$sbConfig['rank2image'];} // if ($numPosts>=(int)$sbConfig['rank2'] && $numPosts<(int)$sbConfig['rank3']){$rText=$sbConfig['rank3txt']; $rImg=$sbs.$sbConfig['rank3image'];} // if ($numPosts>=(int)$sbConfig['rank3'] && $numPosts<(int)$sbConfig['rank4']){$rText=$sbConfig['rank4txt']; $rImg=$sbs.$sbConfig['rank4image'];} // if ($numPosts>=(int)$sbConfig['rank4'] && $numPosts<(int)$sbConfig['rank5']){$rText=$sbConfig['rank5txt']; $rImg=$sbs.$sbConfig['rank5image'];} // if ($numPosts>=(int)$sbConfig['rank5']){$rText=$sbConfig['rank6txt']; $rImg=$sbs.$sbConfig['rank6image'];} $rText = $sbConfig['rank'.$i.'txt']; $rImg = $sbs.$sbConfig['rank'.$i.'image']; if ($uIsMod){$rText=_RANK_MODERATOR; $rImg=$sbs.'/ranks/rankmod.gif';} if ($uIsAdm){$rText=_RANK_ADMINISTRATOR; $rImg=$sbs.'/ranks/rankadmin.gif';} if($sbConfig['rankimages']){$sbUserDetails->msg_userrankimg = '
';} $sbUserDetails->msg_userrank = $rText; } } else $sbUserDetails = false; } else $sbUserDetails = false; return $sbUserDetails; } /** * ForumTab Internal method: returns html output of $sbUserDetails for the $user * @access private * @param array sbConfig * @param object user being displayed * @param object sbUserDetails * @return html code for tab */ function _getDisplaySBstats($sbConfig, $user, $params, $sbUserDetails) { $return=""; $return .= "
"._UE_FORUM_STATS."
"; if ($sbUserDetails !== false) { $return .= ""; if($sbConfig['showranking'] && ($params->get('statRanking', '1') == 1)) $return .= ""; if ($sbConfig['postStats'] && (($params->get('statPosts', '1')==2) || (($params->get('statPosts', '1')==1)&&($sbUserDetails !== false)))) { $return .= ""; } if ($sbConfig['showkarma'] && ($sbUserDetails !== false) && (($params->get('statKarma', '1')==2)||(($params->get('statKarma', '1')==1)&&($sbUserDetails->karma!=0)))) { $return .= ""; } $return .= "
".getLangDefinition($params->get('statRankingText', "_UE_FORUM_FORUMRANKING"))."".$sbUserDetails->msg_userrank.($params->get('statRankingImg', '1')==1 ? $sbUserDetails->msg_userrankimg : "")."
" .getLangDefinition($params->get('statPostsText', "_UE_FORUM_TOTALPOSTS"))."".$sbUserDetails->posts."
" .getLangDefinition($params->get('statKarmaText', "_UE_FORUM_KARMA"))."".$sbUserDetails->karma."
"; } else { $return = ""; } return $return; } /** * ForumTab Internal method: sets User Status display according to $sbUserDetails for the $user * @access private * @param array sbConfig * @param object user being displayed * @param object sbUserDetails */ function _setStatusMenuSBstats($sbConfig, $user, &$params, $sbUserDetails) { if ($sbConfig['showranking'] && ($params->get('statRanking', '1') == 1) && ($sbUserDetails !== false)) { $mi = array(); $mi["_UE_MENU_STATUS"][$params->get('statRankingText', "_UE_FORUM_FORUMRANKING")]["_UE_FORUM_FORUMRANKING"]=null; $this->addMenu( array( "position" => "menuList" , // "menuBar", "menuList" "arrayPos" => $mi , "caption" => $sbUserDetails->msg_userrank.($params->get('statRankingImg', '1')==1 ? $sbUserDetails->msg_userrankimg : "") , "url" => "" , // can also be "" or "javascript:void(0)" or "" "target" => "" , // e.g. "_blank" "img" => null , // e.g. "" "alt" => null , // e.g. "text" "tooltip" => "") ); } if ($sbConfig['postStats'] && (($params->get('statPosts', '1')==2) || (($params->get('statPosts', '1')==1)&&($sbUserDetails !== false)))) { $mi = array(); $mi["_UE_MENU_STATUS"][$params->get('statPostsText', "_UE_FORUM_TOTALPOSTS")]["_UE_FORUM_TOTALPOSTS"]=null; $this->addMenu( array( "position" => "menuList" , "arrayPos" => $mi , "caption" => (($sbUserDetails !== false) ? $sbUserDetails->posts : "0") , "url" => "" , "target" => "" , "img" => null , "alt" => null , "tooltip" => "") ); } if ($sbConfig['showkarma'] && ($sbUserDetails !== false) && (($params->get('statKarma', '1')==2)||(($params->get('statKarma', '1')==1)&&($sbUserDetails->karma!=0)))) { $mi = array(); $mi["_UE_MENU_STATUS"][$params->get('statKarmaText', "_UE_FORUM_KARMA")]["_UE_FORUM_KARMA"]=null; $this->addMenu( array( "position" => "menuList" , "arrayPos" => $mi , "caption" => $sbUserDetails->karma , "url" => "" , "target" => "" , "img" => null , "alt" => null , "tooltip" => "") ); } } /** * Generates the menu and user status to display on the user profile by calling back $this->addMenu * @param object tab reflecting the tab database entry * @param object mosUser reflecting the user being displayed * @param int 1 for front-end, 2 for back-end * @returns boolean : either true, or false if ErrorMSG generated */ function getMenuAndStatus($tab,$user,$ui) { if ( $this->com_name == 'com_fireboard' ) { global $fbConfig; } else { global $sbConfig; $fbConfig =& $sbConfig; } $params=$this->params; $newslettersRegList=$params->get('statDisplay', '1'); if ($newslettersRegList==1) { if($this->config_filename) { include_once ( $this->config_filename ); } else { $this->_setErrorMSG(_UE_SBNOTINSTALLED); return false; } $sbUserDetails = $this->_getSBstats($fbConfig, $user); $this->_setStatusMenuSBstats($fbConfig, $user, $params, $sbUserDetails); } return true; } /** * Generates the HTML to display the user profile tab * @param object tab reflecting the tab database entry * @param object mosUser reflecting the user being displayed * @param int 1 for front-end, 2 for back-end * @returns mixed : either string HTML for tab content, or false if ErrorMSG generated */ function getDisplayTab($tab,$user,$ui) { global $_CB_database,$mosConfig_live_site,$acl,$my; if ( $this->com_name == 'com_fireboard' ) { global $fbConfig; $base_url = $this->_getAbsURLwithParam(array()); if ( isset($_GET['fbunsubthread']) ) { $fbunsub = $_GET['fbunsubthread']; // Expected values image or audio } else { $fbunsub = 'none'; } switch ( $fbunsub ) { case 'none': break; case 'all': $this->_fbunsuball($user); break; default: $this->_fbunsubthread($user,$fbunsub); break; } if ( isset($_GET['fbunsubcat']) ) { $fbunsubcat = $_GET['fbunsubcat']; // Expected values image or audio } else { $fbunsubcat = 'none'; } switch ( $fbunsubcat ) { case 'none': break; case 'all': $this->_fbunsuball($user); break; default: $this->_fbunsubcat($user,$fbunsubcat); break; } if ( isset($_GET['fbunfavthread']) ) { $fbunfav = $_GET['fbunfavthread']; // Expected values image or audio } else { $fbunfav = 'none'; } switch ( $fbunfav ) { case 'none': break; case 'all': $this->_fbunfavall($user); break; default: $this->_fbunfavthread($user,$fbunfav); break; } } else { global $sbConfig; $fbConfig =& $sbConfig; } $return=""; $searchForm=""; if ($this->config_filename) { include_once ( $this->config_filename ); } else { $return = _UE_SBNOTINSTALLED; return $return; } $_CB_database->setQuery("SELECT id FROM #__menu WHERE link='index.php?option=".$this->com_name."' AND published=1"); $Itemid=$_CB_database->loadResult(); $return .= $this->_writeTabDescription( $tab, $user ); $params=$this->params; $newslettersRegList=$params->get('statDisplay', '1'); $sbUserDetails = $this->_getSBstats($fbConfig, $user); if ($newslettersRegList==2) $return .= $this->_getDisplaySBstats($fbConfig, $user, $params, $sbUserDetails); if($my->id == $user->id && $fbConfig['allowsubscriptions']) { $_CB_database->setQuery("SELECT thread FROM #__" . $this->sql_prefix . "_subscriptions WHERE userid=" . (int) $my->id); $subslist=$_CB_database->loadObjectList(); $csubslist=count($subslist); $return .= "\n"; $return .= ""; $enum=1;//reset value $tabclass = array("sectiontableentry1", "sectiontableentry2");//alternating row CSS classes $k=1; //value for alternating rows if($csubslist >0){ if ( $this->com_name == 'com_fireboard' ) { //$unsuburl = '&func=myprofile&do=unsubscribeitem&thread='; //$unsuballurl = '&func=myprofile&do=unsubscribe'; $unsuburl = '&fbunsubthread='; $unsuballurl = '&fbunsubthread=all'; } else { // JB or SB $unsuburl = '&func=userprofile&do=unsubscribe&thread='; $unsuballurl = '&func=userprofile&do=update'; } switch( $this->com_name ) { case 'com_fireboard': foreach($subslist as $subs) { //get all message details for each subscription $_CB_database->setQuery("SELECT * FROM #__" . $this->sql_prefix . "_messages WHERE id=$subs->thread"); $subdet=$_CB_database->loadObjectList(); foreach($subdet as $sub){ $k=1-$k; $return .= "\n\t"; $return .= "\n\t\t"; $return .= "\n\t\t"; $return .= "\n\t"; $enum++; } } // $return .= "\n\t\n\t\t\n\t"; break; default: foreach($subslist as $subs) { //get all message details for each subscription $_CB_database->setQuery("SELECT * FROM #__" . $this->sql_prefix . "_messages WHERE id=$subs->thread"); $subdet=$_CB_database->loadObjectList(); foreach($subdet as $sub){ $k=1-$k; $return .= "\n\t"; $return .= "\n\t\t"; $return .= "\n\t\t"; $return .= "\n\t"; $enum++; } } // $return .= "\n\t\n\t\t\n\t"; break; } } else{ $return .= "\n\t\n\t"; } $return .= "\n
" . ( defined('_UE_USER_SUBSCRIPTIONS') ? getLangDefinition( "_UE_USER_SUBSCRIPTIONS" ) : ( ( defined('_UE_FB_CONFIRMUNSUBSCRIBEALL') ) ? getLangDefinition( "_UE_FB_CONFIRMUNSUBSCRIBEALL" ) : "" ) ) . "
".$enum.": catid.'&id='.$sub->id) .'">'.$this->_sbUnescape($sub->subject).' - ' ._UE_GEN_BY. ' ' .$sub->name."thread) .'">' ._UE_THREAD_UNSUBSCRIBE. "
' // .'' // .'' // .''._UE_USER_UNSUBSCRIBE_ALL."
".$enum.": catid.'&id='.$sub->id) .'">'.$this->_sbUnescape($sub->subject).' - ' ._UE_GEN_BY. ' ' .$sub->name."thread) .'">' ._UE_THREAD_UNSUBSCRIBE. "
' // .'' // .'' // .''._UE_USER_UNSUBSCRIBE_ALL."
"._UE_USER_NOSUBSCRIPTIONS."

"; // begin categories $_CB_database->setQuery("SELECT category FROM #__" . $this->sql_prefix . "_subscriptions WHERE userid=" . (int) $my->id); $subcatslist=$_CB_database->loadObjectList(); $csubcatslist=count($subcatslist); $return .= "\n"; $return .= ""; $enum=1;//reset value $tabclass = array("sectiontableentry1", "sectiontableentry2");//alternating row CSS classes $k=1; //value for alternating rows if($csubcatslist >0){ if ( $this->com_name == 'com_fireboard' ) { //$unsuburl = '&func=myprofile&do=unsubscribeitem&thread='; //$unsuballurl = '&func=myprofile&do=unsubscribe'; $unsuburl = '&fbunsubcat='; $unsuballurl = '&fbunsubthread=all'; } else { // JB or SB $unsuburl = '&func=userprofile&do=unsubscribe&cat='; $unsuballurl = '&func=userprofile&do=update'; } switch( $this->com_name ) { case 'com_fireboard': foreach($subcatslist as $subcats) { //get all category details for each subscription $_CB_database->setQuery("SELECT * FROM #__" . $this->sql_prefix . "_categories WHERE id=$subcats->category"); $subcatdet=$_CB_database->loadObjectList(); foreach($subcatdet as $subcat){ $k=1-$k; $return .= "\n\t"; $return .= "\n\t\t"; $return .= "\n\t\t"; $return .= "\n\t"; $enum++; } } // $return .= "\n\t\n\t\t\n\t"; break; default: foreach($subcatslist as $subcats) { //get all category details for each subscription $_CB_database->setQuery("SELECT * FROM #__" . $this->sql_prefix . "_categories WHERE id=$subcats->category"); $subcatdet=$_CB_database->loadObjectList(); foreach($subcatdet as $subcat){ $k=1-$k; $return .= "\n\t"; $return .= "\n\t\t"; $return .= "\n\t\t"; $return .= "\n\t"; $enum++; } } // $return .= "\n\t\n\t\t\n\t"; break; } } else{ $return .= "\n\t\n\t"; } $return .= "\n
" . ( defined('_UE_USER_CAT_SUBSCRIPTIONS') ? getLangDefinition( "_UE_USER_CAT_SUBSCRIPTIONS" ) : ( ( defined('_UE_FB_CONFIRMUNSUBSCRIBEALL') ) ? getLangDefinition( "_UE_FB_CONFIRMUNSUBSCRIBEALL" ) : "" ) ) . "
".$enum.": id) .'">'.$this->_sbUnescape($subcat->name)."category) .'">' ._UE_THREAD_UNSUBSCRIBE. "
' // .'' // .'' // .''._UE_USER_UNSUBSCRIBE_ALL."
".$enum.": id) .'">'.$this->_sbUnescape($subcat->name)."category) .'">' ._UE_THREAD_UNSUBSCRIBE. "
' // .'' // .'' // .''._UE_USER_UNSUBSCRIBE_ALL."
"._UE_USER_NOSUBSCRIPTIONS."

"; // end categories } if ( ($this->com_name == 'com_fireboard' ) && ($my->id == $user->id) && $fbConfig['allowfavorites']) { $_CB_database->setQuery("SELECT thread FROM #__" . $this->sql_prefix . "_favorites WHERE userid=" . (int) $my->id); $favslist=$_CB_database->loadObjectList(); $cfavslist=count($favslist); $enum=1;//reset value $tabclass = array("sectiontableentry1", "sectiontableentry2");//alternating row CSS classes $k=1; //value for alternating rows if($cfavslist >0){ if ( $this->com_name == 'com_fireboard' ) { $unfavurl = '&fbunfavthread='; $unfavallurl = '&fbunfavthread=all'; } switch( $this->com_name ) { case 'com_fireboard': $return .= "\n"; $return .= ""; foreach($favslist as $favs) { //get all message details for each subscription $_CB_database->setQuery("SELECT * FROM #__" . $this->sql_prefix . "_messages WHERE id=$favs->thread"); $subdet=$_CB_database->loadObjectList(); foreach($subdet as $sub){ $k=1-$k; $return .= "\n\t"; $return .= "\n\t\t"; $return .= "\n\t\t"; $return .= "\n\t"; $enum++; } } $return .= "\n\t\n\t\t\n\t"; break; } } $return .= "\n
" . ( defined('_UE_FB_FAVORITES') ? getLangDefinition( "_UE_FB_FAVORITES" ) : ( ( defined('_UE_FB_CONFIRMUNFAVORITEALL') ) ? getLangDefinition( "_UE_FB_CONFIRMUNFAVORITEALL" ) : "" ) ) . "
".$enum.": catid.'&id='.$sub->id) .'">'.$this->_sbUnescape($sub->subject).' - ' ._UE_GEN_BY. ' ' .$sub->name."thread) .'">' ._UE_FB_REMOVE_FAVORITE_THREAD. "
' .'' .'' .''._UE_FB_REMOVE_FAVORITES_ALL."

"; } $postsNumber = $params->get('postsNumber', '10'); $pagingEnabled = $params->get('pagingEnabled', 0); $searchEnabled = $params->get('searchEnabled', 0); $pagingParams = $this->_getPaging(array(),array("fposts_")); if ($my->id != $user->id) { //determine visitors allowable threads based on session $sql = "SELECT allowed FROM #__" . $this->sql_prefix . "_sessions WHERE userid=" . (int) $my->id . " LIMIT 1"; $_CB_database->setQuery($sql); //print $database->getQuery(); $allowedCats=$_CB_database->loadResult(); if($allowedCats==null) { //get only the publicly accessible forums.. $_CB_database->setQuery( "SELECT id FROM #__" . $this->sql_prefix . "_categories WHERE published=1 AND pub_access=0"); $allowed_forums=$_CB_database->loadObjectList(); $i=0; $allow_forum = array(); foreach ($allowed_forums as $af){ if (count ($allow_forum) == 0 ){ $allow_forum[0]=$af->id; } else { $allow_forum[$i]=$af->id; $i++; } } $allowedCats=implode(",",$allow_forum); } if(strtolower($allowedCats)=='na') $allowedCats=null; } else { $allowedCats=null; } if ($pagingEnabled) { if (!$searchEnabled) $pagingParams["fposts_search"]=null; //Count for paging // $query = "SELECT count(*) FROM #__" . $this->sql_prefix . "_messages WHERE userid=".$user->id // .($pagingParams["fposts_search"] ? " AND subject LIKE '%".cbEscapeSQLsearch($this->_sbEscape($pagingParams["fposts_search"]))."%'" // : ""); $query="SELECT COUNT(*)" . "\n FROM #__" . $this->sql_prefix . "_messages AS a, " . "\n #__" . $this->sql_prefix . "_categories AS b, #__" . $this->sql_prefix . "_messages AS c, #__" . $this->sql_prefix . "_messages_text AS d" . "\n WHERE a.catid = b.id" . "\n AND a.thread = c.id" . "\n AND a.id = d.mesid" . "\n AND a.hold = 0 AND b.published = 1" . "\n AND a.userid=" . (int) $user->id . ($allowedCats!=null ? "\n AND b.id IN ($allowedCats)" :"") . ($pagingParams["fposts_search"] ? "\n AND (a.subject LIKE '%".cbEscapeSQLsearch($this->_sbEscape($pagingParams["fposts_search"]))."%'" ." OR d.message LIKE '%".cbEscapeSQLsearch($pagingParams["fposts_search"])."%')" : ""); $_CB_database->setQuery($query); $total = $_CB_database->loadResult(); if (!is_numeric($total)) $total = 0; $userHasPosts = ($total>0 || ($pagingParams["fposts_search"] && ($sbUserDetails !== false) && $sbUserDetails->posts>0)); if ($pagingParams["fposts_limitstart"] === null) $pagingParams["fposts_limitstart"] = "0"; if ($postsNumber > $total) $pagingParams["fposts_limitstart"] = "0"; if ($searchEnabled) { $searchForm = $this->_writeSearchBox($pagingParams,"fposts_",$divClass="style=\"float:right;\"",$inputClass="class=\"inputbox\""); } else { $pagingParams["fposts_search"] = "0"; } } else { $pagingParams["fposts_limitstart"] = "0"; $pagingParams["fposts_search"] = "0"; } switch ($pagingParams["fposts_sortby"]) { case "subject": $order = "a.subject ASC, a.time DESC"; break; case "category": $order = "b.id ASC, a.time DESC"; break; case "hits": $order = "c.hits DESC, a.time DESC"; break; case "date": default: $order = "a.time DESC"; break; } $query="SELECT a.* , b.id as category, b.name as catname, c.hits AS 'threadhits'" . "\n FROM #__" . $this->sql_prefix . "_messages AS a, " . "\n #__" . $this->sql_prefix . "_categories AS b, #__" . $this->sql_prefix . "_messages AS c, #__" . $this->sql_prefix . "_messages_text AS d" . "\n WHERE a.catid = b.id" . "\n AND a.thread = c.id" . "\n AND a.id = d.mesid" . "\n AND a.hold = 0 AND b.published = 1" . "\n AND a.userid=" . (int) $user->id . ($allowedCats!=null ? "\n AND b.id IN ($allowedCats)" :"") . ($pagingParams["fposts_search"] ? "\n AND (a.subject LIKE '%".cbEscapeSQLsearch($this->_sbEscape($pagingParams["fposts_search"]))."%'" ." OR d.message LIKE '%".cbEscapeSQLsearch($pagingParams["fposts_search"])."%')" : "") . "\n ORDER BY ".$order . "\n LIMIT ".($pagingParams["fposts_limitstart"]?$pagingParams["fposts_limitstart"]:"0").",".$postsNumber; $_CB_database->setQuery( $query ); //print $database->getQuery(); $items = $_CB_database->loadObjectList(); if(count($items) >0) { if ($pagingParams["fposts_search"]) $title = sprintf(_UE_FORUM_FOUNDPOSTS,$total); elseif ($pagingEnabled) $title = sprintf(_UE_FORUM_POSTS,$postsNumber); else $title = sprintf(_UE_FORUM_LASTPOSTS,$postsNumber); $return .= "\n"; $return .= ""; if ($pagingEnabled && $searchEnabled) $return .= ""; $return .= "\n\t"; $return .= ""; $return .= ""; $return .= ""; $return .= ""; $return .= ""; $i=2; foreach($items AS $item) { $i= ($i==1) ? 2 : 1; if(!ISSET($item->created)) $item->created=""; $sbURL=sefRelToAbs("index.php?option=".$this->com_name.($Itemid ? '&Itemid='.$Itemid : '')."&func=view&catid=".$item->catid."&id=".$item->id."#".$item->id); $return .= "\n\t\n"; } $return .= "\n
"; $return .= $title; $return .= "
" . $searchForm . "
 
".$this->_writeSortByLink($pagingParams,"fposts_","date",_UE_FORUMDATE,true)."".$this->_writeSortByLink($pagingParams,"fposts_","subject",_UE_FORUMSUBJECT)."".$this->_writeSortByLink($pagingParams,"fposts_","category",_UE_FORUMCATEGORY)."".$this->_writeSortByLink($pagingParams,"fposts_","hits",_UE_FORUMHITS)."
".getFieldValue("date",date("Y-m-d, H:i:s",$item->time))."".$this->_sbUnescape($item->subject)."".$item->catname."".$item->threadhits."
"; if ($pagingEnabled && ($postsNumber < $total)) { $return .= "
" .$this->_writePaging($pagingParams,"fposts_",$postsNumber,$total) ."
"; } $return .= ""; } else { if ($pagingEnabled && $userHasPosts && $searchEnabled && $pagingParams["fposts_search"]) { $return .= "
"; $return .= $searchForm; $return .= "
"._UE_NOFORUMPOSTSFOUND; $return .= "
"; } else { $return .= _UE_NOFORUMPOSTS; } } return $return; } /** * @desc */ function _fbunsubthread($user,$thread) { global $_CB_database; $_CB_database->setQuery("DELETE FROM #__fb_subscriptions WHERE userid=".(int)$user->user_id . " AND thread=".(int)$thread); $_CB_database->query(); } /** * @desc set to remove category subscriptions */ function _fbunsubcat($user,$cat) { global $_CB_database; $_CB_database->setQuery("DELETE FROM #__fb_subscriptions WHERE userid=".(int)$user->user_id . " AND category=".(int)$cat); $_CB_database->query(); } /** * @desc */ function _fbunsuball($user) { global $_CB_database; $_CB_database->setQuery("DELETE FROM #__fb_subscriptions WHERE userid=".(int)$user->user_id); $_CB_database->query(); } /** * @desc */ function _fbunfavthread($user,$thread) { global $_CB_database; $_CB_database->setQuery("DELETE FROM #__fb_favorites WHERE userid=".(int)$user->user_id . " AND thread=".(int)$thread); $_CB_database->query(); } /** * @desc */ function _fbunfavall($user) { global $_CB_database; $_CB_database->setQuery("DELETE FROM #__fb_favorites WHERE userid=".(int) $user->user_id); $_CB_database->query(); } } // end class getForumTab. ?>