CurrentCategoryID(); $cat_count = (int)getArrayValue($attribs,'_maxlistcount'); /* validation */ if(strlen($attribs["_itemtemplate"])==0) { if($attribs["dataexists"]) $content_set = 0; return ""; } $GroupList = $objSession->Get("GroupList"); if(strlen($GroupList)) { $Groups = explode(",",$GroupList); } $acl_where = ""; if(@count($Groups)>0 && is_array($Groups)) { $acl_where = array(); for($i=0;$iClear(); $OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE); $objCatList->LoadCategories("ParentId=$CategoryId AND Status=1",$OrderBy); if ($objCatList->NumItems() == 0) { if($attribs["_dataexists"]) $content_set = 0; return ""; } $html_attr = ExtraAttributes($attribs); $o=""; $notable = $attribs["_notable"]; $count=0; $row=0; $var_list_update["t"] = $var_list["t"]; if(!$notable) { $per_row = ceil($objCatList->NumItems()/$cols); $o = ""; $o .= ""; $o .= "\n
"; $CatCount = $objCatList->NumItems(); foreach($objCatList->Items as $cat) { $parsed=0; if($count==$per_row) { $o .= ""; $count=0; } if($row==0 && strlen($attribs["_firstitemtemplate"])) { $o.= $cat->ParseTemplate($attribs["_firstitemtemplate"]); $parsed=1; } if($row==$CatCount-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0) { $o .= $cat->ParseTemplate($attribs["_lastitemtemplate"]); $parsed=1; } if(!$parsed) $o.= $cat->ParseTemplate($attribs["_itemtemplate"]); $count++; $row++; } if($count != $per_row) $o .= "
\n"; } else { $CatCount = $objCatList->NumItems(); foreach($objCatList->Items as $cat) { if($cat->Get("ParentId")==$CategoryId) { if($row==0 && strlen($attribs["_firstitemtemplate"])) { //echo 'Saving ID in m_sub_cats[ first ] '.$cat->UniqueId().'
'; //$GLOBALS['cat_ID'] = $cat->UniqueId(); $o.= $cat->ParseTemplate($attribs["_firstitemtemplate"]); $parsed=1; } if($row==$CatCount-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0) { //echo 'Saving ID in m_sub_cats[ last ] '.$cat->UniqueId().'
'; //$GLOBALS['cat_ID'] = $cat->UniqueId(); $o .= $cat->ParseTemplate($attribs["_lastitemtemplate"]); $parsed=1; } if(!$parsed) { //echo 'Saving ID in m_sub_cats[ each ] '.$cat->UniqueId().'
'; //$GLOBALS['cat_ID'] = $cat->UniqueId(); $o .= $cat->ParseTemplate($attribs["_itemtemplate"]); } $row++; $i++; $count++; if($count>=$cat_count && $cat_count>0) break; } } } unset($var_list_update["t"]); SaveTagCache("kernel","m_list_cats",$attribs,m_BuildEnv(),$o); return $o; } function bb_ParseEnv($str = "") { global $bb_var_list, $objTopicList, $objConfig, $objCatList, $objPostingList; if ($str != "") { if( substr($str,0,3) == 'bb-' ) { $str = preg_replace('/^([a-zA-Z]+)-([0-9]+)-(.*)/','\\1\\2-\\3', $str); } $str = substr($str,2); $pieces = explode("-", $str); $bb_var_list["top"] = $pieces[0]; // topic id $bb_var_list["post"] = $pieces[1]; // post id $bb_var_list["tp"] = $pieces[2]; // topic page $bb_var_list["pp"] = $pieces[3]; // posts page $bb_var_list["pmp"] = $pieces[4]; // private message page $bb_var_list["pm_id"] = $pieces[5]; // private message id $bb_var_list['rp'] = $pieces[6]; // reviews page ResetPage('bb','tp'); } else { $bb_var_list["top"] = 0; $bb_var_list["post"] = 0; $bb_var_list["tp"] = 1; $bb_var_list["pp"] = 1; $bb_var_list["pmp"] = 1; $bb_var_list["pm_id"] = 0; $bb_var_list['rp'] = 1; } //echo "
"; print_r($bb_var_list); echo "
"; if ($bb_var_list["tp"] == "") $bb_var_list["tp"] = 1; if ($bb_var_list["pp"] == "") $bb_var_list["pp"] = 1; if ($bb_var_list["pmp"] == "") $bb_var_list["pmp"] = 1; } function bb_LoadEnv() { global $objSession; $str = $objSession->GetVariable("Env_Bulletin"); bb_ParseEnv($str); } function bb_SaveEnv($str="") { global $objSession; $str = $objSession->SetVariable("Env_Bulletin",$str); } function bb_BuildEnv() { // rp - reviews page $module_vars = Array( 'top','post','tp','pp','pmp','pm_id','rp'); return GenerateModuleEnv('bb', $module_vars); } function bb_BuildEnv_NEW() { // rp - reviews page $module_vars = Array( 'top' => 'bb_id', 'post' => 'bb_post_id', 'tp' => 'bb_Page', 'pp' => 'bb_Post_Page', 'pmp' => 'bb_pm_Page', 'pm_id' => 'bb_pm_id', 'rp' => 'bb_Reviews_Page'); return GenerateModuleEnv_NEW('bb', $module_vars); } function LoadTopics($attribs = array()) { global $objTopicList, $objSession, $objCatList, $bb_var_list, $bb_var_list_update; static $PagingList; $ListType = strtolower(getArrayValue($attribs,'_listtype')); $force_paging = getArrayValue($attribs,'_forcepaging'); if( !$ListType ) $ListType = 'category'; $LastList = $objSession->GetVariable('TopicListType'); $LastShortType = $objSession->GetVariable('TopicShortList'); $LastCat = $objSession->GetVariable('TopicLastCategory'); $NoPaging = ( getArrayValue($attribs,'_paging')=='0' || getArrayValue($attribs,'_paging')=='false'); if(!$NoPaging && !strlen($PagingList)) { $PagingList=$ListType; } //echo "Last: $LastList, Short: $LastShortType Current: $ListType, Short:".$attribs["_shortlist"]." PageList: $PagingList
\n"; if($ListType == $PagingList) { $objTopicList->EnablePaging = TRUE; if($LastList != $ListType || $LastShortType != $attribs['_shortlist'] || $LastCat != $objCatList->CurrentCategoryID()) { //echo 'Resetting Page..
\n'; $bb_var_list_update['tp'] = 1; $bb_var_list_update['pp'] = 1; $bb_var_list['tp'] = 1; $bb_var_list['pp'] = 1; $objTopicList->Page=1; $objPostingList->Page=1; $objSession->SetVariable('TopicListType',$ListType); $objSession->SetVariable('TopicShortList',$attribs['_shortlist']); $objSession->SetVariable('TopicLastCategory',$objCatList->CurrentCategoryID()); } else { $objTopicList->Page = $bb_var_list['tp']; } } else { if(is_numeric( getArrayValue($attribs,'_maxcount') )) { $objTopicList->MaxListCount = $attribs['_maxcount']; } else $objTopicList->MaxListCount = 10; $objTopicList->EnablePaging = FALSE; } //echo "ForcePaging = $force_paging
"; if ($force_paging == 1) { $objTopicList->EnablePaging = TRUE; $objTopicList->Page = $bb_var_list["tp"]; $objSession->SetVariable('TopicListType',$ListType); $objSession->SetVariable('TopicShortList',$attribs['_shortlist']); } $objTopicList->ListType=$ListType; switch($ListType) { case 'category': $objTopicList->LoadTopicsCategory($attribs); break; case 'new': $objTopicList->LoadNewItems($attribs); break; case "my_new": $scope = $objSession->CurrentUser->Vars["LastLogin"]; $attribs["_scope"] = $scope; $attribs["_show_since_last"] = 1; //echo "Scope: $scope
"; //print_pre($objSession->CurrentUser); if (is_numeric($scope) && $scope > 0) { $objTopicList->LoadNewItems($attribs); } break; case 'hot': $objTopicList->LoadHotItems($attribs); break; case 'pick': $objTopicList->LoadPickItems($attribs); break; case 'myitems': $objTopicList->LoadMyItems($attribs); break; case 'favorites': $objTopicList->LoadFavorites($attribs); break; case 'search': $attribs['multiple'] = 'topics'; $objTopicList->LoadSearchItems($attribs); break; } } /* @description: Return post icon @attrib: _posts_icon:: icon source @attrib: _no_post_icon:: no post icon source @attrib: _locked_post_icon:: locked post icon */ function bb_post_icon($attribs) { global $objConfig, $objCatList, $objSession; $post_icon = $attribs['_posts_icon']; $no_post_icon = $attribs['_no_post_icon']; $locked_post_icon = $attribs['_locked_post_icon']; $ado = &GetADODBConnection(); //echo 'Retrieving CatID in bb_post_icon '.$GLOBALS['cat_ID'].'
'; $current_cat = $GLOBALS['cat_ID']; $prefix = GetTablePrefix(); /*if( !$objSession->HasCatPermission('TOPIC.ADD', $current_cat) || !$objSession->HasCatPermission('TOPIC.ADD.PENDING', $current_cat) ) { return ""; }*/ if($attribs["_local"] && $objCatList->CurrentCategoryID() != 0) { $c = $objCatList->GetItem($objCatList->CurrentCategoryID()); $catlist = $c->GetSubCatIds(); $catwhere = "CategoryId IN (".explode(",",$catlist).")"; $sql = "SELECT MAX(Modified) as ModDate, ".$prefix."Topic.Status AS tStatus FROM ".$prefix."Topic "; $sql .= "INNER JOIN ".$prefix."CategoryItems ON (".$prefix."Topic.ResourceId=".$prefix."CategoryItems.ItemResourceId) "; $sql .= "WHERE Status=1 AND $catwhere LIMIT 1"; } else { $sql = "SELECT MAX(Modified) as Modified FROM ".$prefix."Topic WHERE Status = 1 LIMIT 1"; } $rs = $ado->Execute($sql); $Last = $objSession->GetPersistantVariable('LastLogin'); if ($Last < $rs->fields['Modified']) { return "\"\""; } else { return "\"\""; } } /* @description: returns the date of the last modification to a topic @attrib: _Part:: part of the date to display @example: */ function bb_topic_modified($attribs) { global $objConfig, $objCatList; $ret=''; $CachedValue = GetTagCache("inbulletin","bb_topic_modified",$attribs,""); if(strlen($CachedValue)) return $CachedValue; $ado = &GetADODBConnection(); if( getArrayValue($attribs,'_local') && $objCatList->CurrentCategoryID() != 0) { $c = $objCatList->GetItem($objCatList->CurrentCategoryID()); $catlist = $c->GetSubCatIds(); $catwhere = "CategoryId IN (".explode(",",$catlist).")"; $sql = "SELECT MAX(Modified) as ModDate FROM ".GetTablePrefix()."Topic "; $sql .= "INNER JOIN ".GetTablePrefix()."CategoryItems ON (".GetTablePrefix()."Topic.ResourceId=".GetTablePrefix()."CategoryItems.ItemResourceId) "; $sql .= "WHERE Status=1 AND $catwhere LIMIT 1"; } else { $sql = "SELECT MAX(Modified) as ModDate FROM ".GetTablePrefix()."Topic WHERE Status=1 LIMIT 1"; } $rs = $ado->Execute($sql); if($rs && ! $rs->EOF) { $mod = $rs->fields["ModDate"]; if($mod) { $part = strtolower($attribs["_part"]); $ret = $part?ExtractDatePart($part,$mod):LangDate($mod); } } if($ret) SaveTagCache("inbulletin","bb_topic_modified",$attribs,"",$ret); return $ret; } /* @description: returns a link to the forum root category @attrib: _Category:int: Override the forum root category @attrib: _Template:tpl: The template to link to @example: */ function bb_root_link($attribs = array()) { global $objTopicList, $objConfig, $var_list_update, $bb_var_list_update, $var_list, $objModules; //$RootCat = (int)$objConfig->Get("Topic_Root"); $RootCat = $objModules->GetModuleRoot("In-Bulletin"); if($RootCat != -1) $attribs["_category"] = $RootCat; $bb_var_list_update["top"] = 0; $bb_var_list_update["post"] = 0; $bb_var_list_update["tp"] = 0; $bb_var_list_update["pp"] = 0; unset($bb_var_list_update["top"],$bb_var_list_update["post"],$bb_var_list_update["tp"],$bb_var_list_update["pp"]); $o =m_template_link($attribs); unset($bb_var_list_update["top"],$bb_var_list_update["post"],$bb_var_list_update["tp"],$bb_var_list_update["pp"]); return $o; } /* @description: returns a list of topics @attrib: _CatId:int: Override the current category @attrib: _useroot:bool: If set, the current category is changed to In-Bulletin's root category @attrib: _ShortList:bool: If set, the Perpage_Topics_Short setting is used instead of Perpage_topics @attrib: _Paging:bool: If set to 0 or false, paging will not be allowed for this list (only one paging list is allowed per item type per page load) @attrib: _maxcount:int: If paging is not used on this list, this value determines how many items to load @attrib: _ListType::Determines the type of list to generate
Possible values:
  • Category: List topics from the current category
  • New: List new topics
  • Hot: List topics with the most replies
  • myitems: List topics created by the current user
  • favorites: List topics marked as favorites by the current user
  • search: List search results
@attrib: _FirstItemTemplate:tpl: Template used for the first topic listed @attrib: _LastItemTemplate:tpl: Template used for the last topic listed @attrib: _EdItemTemplate:tpl: Editors Pick template used for topic list items @attrib: _ItemTemplate:tpl: default template used for topic list items @example: */ function bb_topic_list($attribs = array()) { global $objSession, $objConfig, $objCatList, $bb_var_list, $CatId, $objTopicList, $content_set; $CatId = getArrayValue($attribs,'_catid'); if(!is_numeric($CatId)) $CatId = $objCatList->CurrentCategoryID(); if((int)getArrayValue($attribs,'_useroot')) $CatId = (int)$objConfig->Get("Topic_Root"); $attribs["_catid"] = $CatId; $t = getArrayValue($attribs,'_itemtemplate'); if(!strlen($t)) { $content_set=0; return ""; } $ListType=getArrayValue($attribs,'_listtype'); if(!strlen($ListType)) $ListType="category"; if ( getArrayValue($attribs,'_shortlist') && $objConfig->Get('Perpage_Topics_Short') ) { $objTopicList->PerPageVar = 'Perpage_Topics_Short'; } else { $objTopicList->PerPageVar = 'Perpage_Topics'; } if($objTopicList->ListType != $ListType) LoadTopics($attribs); //if($objTopicList->NumItems()==0) //{ // LoadTopics($attribs); //} if ($objTopicList->NumItems()==0) { $content_set=0; return ""; //language("la_no_topics"); } $total_topics = min($objTopicList->NumItems(), $objConfig->Get($objTopicList->PerPageVar)); $html_attribs = ExtraAttributes($attribs); $row=0; for($x=0; $x<$total_topics; $x++) { $topic =& $objTopicList->Items[$x]; $parsed=0; if($row==0 && strlen($attribs["_firstitemtemplate"])) { $o .= $topic->ParseTemplate($attribs["_firstitemtemplate"]); $parsed=1; } if($row==$objTopicList->NumItems()-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0) { $o .= $topic->ParseTemplate($attribs["_lastitemtemplate"]); $parsed=1; } if(!$parsed) { if (getArrayValue($attribs, '_editemtemplate') && (int)$topic->Get('EditorsPick')) { $o .= $topic->ParseTemplate($attribs["_editemtemplate"]); } else { $o .= $topic->ParseTemplate($attribs['_itemtemplate']); } } $row++; } return $o; } /* @description: returns a counter of topics @attrib: _CatId:int: Override the current category @attrib: _useroot:bool: If set, the current category is changed to In-Bulletin's root category @attrib: _ShortList:bool: If set, the Perpage_Topics_Short setting is used instead of Perpage_topics @attrib: _ListType::Determines the type of list to generate
Possible values:
  • Category: List topics from the current category
  • New: List new topics
  • Hot: List topics with the most replies
  • myitems: List topics created by the current user
  • favorites: List topics marked as favorites by the current user
  • search: List search results
@example: */ function bb_list_count($attribs = array()) { global $objConfig, $objCatList, $CatId, $objTopicList; $CatId = getArrayValue($attribs,'_catid'); if(!is_numeric($CatId)) $CatId = $objCatList->CurrentCategoryID(); if((int)getArrayValue($attribs,'_useroot')) $CatId = (int)$objConfig->Get("Topic_Root"); $attribs["_catid"] = $CatId; $ListType=getArrayValue($attribs,'_listtype'); if(!strlen($ListType)) $ListType="category"; if ( getArrayValue($attribs,'_shortlist') && $objConfig->Get('Perpage_Topics_Short') ) { $objTopicList->PerPageVar = 'Perpage_Topics_Short'; } else { $objTopicList->PerPageVar = 'Perpage_Topics'; } if(!getArrayValue($attribs,'_today')) { if($objTopicList->ListType != $ListType) LoadTopics($attribs); $o = $objTopicList->QueryItemCount; } else { $o = $objTopicList->PerformItemCount($attribs); } if ($o == '') { $o = 0; } return $o; } /* @description: Used in conjuction with bb_topic_list. This function generates the page navigation for the list. If this tag is called before the list tag, this function will load the topic list. For that reason, the _ListType attribute is required if the pagnav tag preceeds the bb_topic_list tag in the template. Generally, it is good practice to duplicate all attributes set for bb_topic_list. @attrib: _PagesToList:int: Number of pages to list (default is 10) @attrib: _label:lang: language tag to include in the output if there are pages to list. If there are no pages listed, this text will not be included (resulting in an empty output) */ function bb_topic_pagenav($attribs = array()) { global $objTopicList, $objCatList, $objSession, $objConfig; $DestTemplate = getArrayValue($attribs,'_template'); $PagesToList = getArrayValue($attribs,'_pagestolist'); $image = getArrayValue($attribs,'_PageIcon'); if(!is_numeric($PagesToList)) $PagesToList = 10; $CatId = getArrayValue($attribs,'_catid'); if(!is_numeric($CatId)) $CatId = $objCatList->CurrentCategoryID(); if ( getArrayValue($attribs,'_shortlist') && $objConfig->Get('Perpage_Topics_Short') ) { $objTopicList->PerPageVar = 'Perpage_Topics_Short'; } else { $objTopicList->PerPageVar = 'Perpage_Topics'; } $ListType=getArrayValue($attribs,'_listtype'); if(!strlen($ListType)) $ListType="category"; if($objTopicList->ListType != $ListType) LoadTopics($attribs); $o = $objTopicList->GetPageLinkList($DestTemplate, '', 10, true, '', ExtraAttributes($attribs)); if (strlen($image)) { $o_i = ' '; } if(strlen($o) && strlen($attribs["_label"])) $o = $o_i.language($attribs["_label"]).' '.$o; return $o; } /* @description: Used in conjuction with bb_topic_list. This function generates a navigation link which is used to switch from a short list to a longer list. The page number is not changed. If this tag is called before the list tag, this function will load the topic list. For that reason, the _ListType attribute is required if the pagnav tag preceeds the bb_topic_list tag in the template. Generally, it is good practice to duplicate all attributes set for bb_topic_list. @attrib: _root:bool: If set, the current category is set to In-Bulletin's root category @attrib: _text:lang: language tag to include as text for the anchor tag @attrib: _plaintext:: plain text to include as text for the anchor tag. The _text attribute takes presedence if both are included. @attrib: _image:: URL to an image to include inside the anchor tag. */ function bb_topic_more($attribs = array()) { global $objTopicList, $objConfig, $bb_var_list_update; $bb_var_list_update['top_id'] = 0; $html_attribs = ExtraAttributes($attribs); $DestTemplate = $attribs["_template"]; if ( getArrayValue($attribs,'_shortlist') && $objConfig->Get('Perpage_Topics_Short') ) { $objTopicList->PerPageVar = 'Perpage_Topics_Short'; } else { $objTopicList->PerPageVar = 'Perpage_Topics'; } $ListType=$attribs["_listtype"]; if(!strlen($ListType)) $ListType="category"; if($objTopicList->ListType != $ListType) LoadTopics($attribs); if($objTopicList->QueryItemCount > $objConfig->Get($objTopicList->PerPageVar)) { if($attribs["_root"]) { $url = bb_root_link($attribs); } else { $bb_var_list_update["tp"]=1; $bb_var_list_update["pp"]=1; $url = m_template_link($attribs); unset($bb_var_list_update["tp"],$bb_var_list_update["pp"]); } $o = ""; $text = $attribs["_text"]; if(!strlen($text)) { $text = $attribs["_plaintext"]; if(!strlen($text)) { } $o .= $text.""; } else $o .= language($text); if(strlen($attribs["_image"])) { $o .= "\"\"/"; } $o .= ""; } return $o; } /* @description: Generates a link to set a topic column to the sort column for the user @attrib: _column:: column name to set @example: "> */ function bb_topic_list_sortlink($attribs) { return HREF_Wrapper('', Array('Action' => 'bb_sort', 'col' => $attribs['_column']) ); } /* @description: Creates a URL to an image used to indicate the sorting status of a topic column. Extra HTML attributes are passed to the image tag. @attrib: _column:: column name to check @attrib: _selected_asc:: if the column is the current sort column, and the order is ascending, this url is used @attrib: _selected_desc:: if the column is the current sort column, and the order is descending, this url is used @attrib: _selected:: if the column is the current sort column, and no other _selected URL is set, this URL is used @attrib: _unselected:: if the column is not the current sort column, this URL is used @attrib: _default:: if no other URL is returned, this URL is used @example: " width="7" height="7" title="" border="0" /> */ function bb_topic_list_sorticon($attribs) { global $objSession, $objConfig; $fields[] = $objSession->GetPersistantVariable('Topic_SortField'); $orders[] = $objSession->GetPersistantVariable('Topic_SortOrder'); if( !$orders[0] ) $orders[0] = 'asc'; // if user haven't specified sorting /*// first sorting $fields[] = $objConfig->Get('Topic_SortField'); $orders[] = $objConfig->Get('Topic_SortOrder'); // second sorting $fields[] = $objConfig->Get('Topic_SortField2'); $orders[] = $objConfig->Get('Topic_SortOrder2');*/ $url = ''; $i = 0; $f_count = count($fields); $match_index = -1; while($i < $f_count) { if($fields[$i] == $attribs['_column']) { $match_index = $i; break; } $i++; } if($match_index > -1) { $key = '_selected'.strtolower($orders[$match_index]); $url = $attribs[$key]; if( !strlen($url) ) $url = $attribs['_selected']; } else { $url = $attribs['_unselected']; } if(!strlen($url)) { $url = $attribs['_default']; } return $url; } /* @description: Generates a url containing the action to delete a user's avatar image @example: */ function bb_delete_avatar($attribs = array()) { return HREF_Wrapper('', Array('Action' => 'bb_delete_avatar') ); } function bb_form_load_values($FormName,$IdValue) { global $FormValues, $objTopicList, $objPostingList, $objUsers, $objSession; switch($FormName) { case 'post_edit': $p =& $objPostingList->GetItem($IdValue); $body = _unhtmlentities( $p->Get('PostingText') ); $body = str_replace('
','',$body); $FormValues[$FormName]["bb_post_reply_body"] = $body; $FormValues[$FormName]["subject"] = $p->Get("Subject"); $FormValues[$FormName]["topic_bbcode"] = (int)$p->PostOption("disable_bbcode"); // (int)$objSession->GetPersistantVariable("bbcode"); $FormValues[$FormName]["topic_smile"] = (int)$p->PostOption("disable_smileys"); $FormValues[$FormName]["topic_sig"] = (int)$p->PostOption("show_sig"); $p->LoadCustomFields(); if(is_array($p->CustomFields)) { foreach($p->CustomFields as $f=>$v) { $FormValues[$FormName][$f] = $v; } } break; case "topic_reply": $FormValues[$FormName]["owner_notify"] = (int)$objSession->GetPersistantVariable("owner_notify"); $FormValues[$FormName]["topic_bbcode"] = !(int)$objSession->GetPersistantVariable("bbcode"); $FormValues[$FormName]["topic_smile"] = !(int)$objSession->GetPersistantVariable("smileys"); $FormValues[$FormName]["topic_sig"] = (int)$objSession->GetPersistantVariable("show_sig"); if($FormName=="topic_reply") $FormValues[$FormName]["replyto"] = $objPostingList->CurrentPostID(); $p = $objPostingList->GetItem($objPostingList->CurrentPostID()); if(strlen($p->Get("Subject"))) { $FormValues[$FormName]["subject"] = "Re: ".$p->Get("Subject"); } break; case "new_topic": $FormValues[$FormName]["owner_notify"] = (int)$objSession->GetPersistantVariable("owner_notify"); $FormValues[$FormName]["topic_bbcode"] = !(int)$objSession->GetPersistantVariable("bbcode"); $FormValues[$FormName]["topic_smile"] = !(int)$objSession->GetPersistantVariable("smileys"); $FormValues[$FormName]["topic_sig"] = (int)$objSession->GetPersistantVariable("show_sig"); if($FormName=="topic_reply") $FormValues[$FormName]["replyto"] = $objPostingList->CurrentPostID(); break; case "new_pm": $FormValues[$FormName]["pm_to"] = GetVar('ToUser'); $FormValues[$FormName]["pm_bbcode"] = !(int)$objSession->GetPersistantVariable("bbcode"); $FormValues[$FormName]["pm_smile"] = !(int)$objSession->GetPersistantVariable("smileys"); $FormValues[$FormName]["pm_sig"] = (int)$objSession->GetPersistantVariable("show_sig"); if( GetVar('IsReply') == 1 ) { global $objPMList; $pm = $objPMList->GetCurrentItem(); if( is_object($pm) ) { $FormValues[$FormName]['pm_subject'] = 'Re: '.$pm->Get('Subject'); } } break; case "edit_topic": $t =& $objTopicList->GetItem($IdValue); if(is_object($t)) { $FormValues[$FormName]["topic_subject"] = $t->Get("TopicText"); $FormValues[$FormName]["owner_notify"] = $t->Get("NotifyOwnerOnChanges"); $t->LoadCustomFields(); if(is_array($t->CustomFields)) { foreach($t->CustomFields as $f=>$v) { $FormValues[$FormName][$f] = $v; } } } break; case "bb_profile": $u = $objUsers->GetItem($IdValue); if(is_object($u)) { $FormValues[$FormName]["perpage_topics"] = $objSession->GetPersistantVariable("Perpage_Topics"); $FormValues[$FormName]["perpage_posts"] = $objSession->GetPersistantVariable("Perpage_Postings"); $FormValues[$FormName]["owner_notify"] = (int)$objSession->GetPersistantVariable("owner_notify"); $FormValues[$FormName]["bbcode"] = (int)$objSession->GetPersistantVariable("bbcode"); $FormValues[$FormName]["show_sig"] = (int)$objSession->GetPersistantVariable("show_sig"); $FormValues[$FormName]["smileys"] = $objSession->GetPersistantVariable("smileys"); $FormValues[$FormName]["user_signatures"] = $objSession->GetPersistantVariable("bb_signatures"); $FormValues[$FormName]["my_signature"] = $objSession->GetPersistantVariable("my_signature"); $FormValues[$FormName]["pm_notify"] = $objSession->GetPersistantVariable("bb_pm_notify"); $u->LoadCustomFields(); if(is_array($u->CustomFields)) { foreach($u->CustomFields as $f=>$v) { $FormValues[$FormName][$f] = $v; } } } break; } } /* @description: Generates the ACTTION property for a FORM tag used by In-Bulletin @attrib: _Template:tpl: If set, this is the template the form submits to (default is the current template) @attrib: _Form:: The form name
Possible Values:
  • bb_profile: In-Bulletin section of User Profile Edit
  • new_topic: Add a topic to a category
  • new_topic_confirm: Simple form displayed when a new_topic confirmation page is displayed
  • topic_reply: Add a post to a topic
  • post_edit: Modify an existing post
  • edit_topic: Modify an existing topic
  • edit_topic_confirm: Simple form displayed when a topic modification confirmation is shown
  • getting_rated: Form for remote rating
@example:
"> */ function bb_form_action($attribs = array()) { global $var_list_update, $var_list, $objSession, $objTopicList, $objPostingList, $bb_var_list, $bb_var_list_update; $var_list_update['t'] = getArrayValue($attribs, '_template') ? $attribs['_template'] : $var_list['t']; if( is_object($objTopicList) && $bb_var_list['top'] ) $bb_var_list_update['top'] = $bb_var_list['top']; $ret = ''; $form = strtolower( $attribs['_form'] ); $url_params = Array(); switch($form) { case 'bb_rate': if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { $url_params = Array( 'Action' => 'bb_rate_topic', 'DestTemplate' => $attribs['_finishtemplate'] ); if ( $objSession->HasCatPermission('TOPIC.RATE') && getArrayValue($attribs, '_confirm') ) $url_params['Confirm'] = $attribs['_confirm']; // $bb_var_list_update['top'] = $objTopicList->CurrentItem; if( getArrayValue($attribs, '_duplicate') ) $url_params['Duplicate'] = $attribs['_duplicate']; } break; case 'bb_getting_rated': if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { $var_list_update['t'] = 'inbulletin/rate'; $url_params = Array( 'Action' => 'bb_rate_topic', 'DestTemplate' => $attribs['_finishtemplate'] ); if ( $objSession->HasCatPermission('TOPIC.RATE') && getArrayValue($attribs, '_confirm') ) $url_params['Confirm'] = $attribs['_confirm']; // $bb_var_list_update['top'] = $objTopicList->CurrentItem; if( getArrayValue($attribs, '_duplicate') ) $url_params['Duplicate'] = $attribs['_duplicate']; } break; case 'bb_rate_confirm': $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; // $bb_var_list_update['top'] = $objTopicList->CurrentItem; break; /*case 'addreview': break;*/ case 'bb_profile': $url_params = Array('Action' => 'bb_pref'); bb_form_load_values('bb_profile', $objSession->Get('PortalUserId') ); break; case 'new_topic': $url_params = Array( 'Action' => 'bb_new_topic', 'DestTemplate' => $attribs['_finishtemplate'] ); if ( $objSession->HasCatPermission('TOPIC.ADD.PENDING') ) { $url_params['Confirm'] = $attribs[ getArrayValue($attribs, '_confirmpending') ? '_confirmpending' : '_confirm' ]; } if ($objSession->HasCatPermission('TOPIC.ADD')) { $url_params['Confirm'] = $attribs['_confirm']; } if( !$url_params['Confirm'] ) unset($url_params['Confirm']); bb_form_load_values('new_topic', $objSession->Get('PortalUserId') ); break; case 'new_pm': $url_params = Array( 'Action' => 'bb_new_pm', 'DestTemplate' => $attribs['_finishtemplate'] ); if( getArrayValue($attribs, '_confirm') ) $url_params['Confirm'] = $attribs['_confirm']; bb_form_load_values('new_pm', $objSession->Get('PortalUserId') ); break; case 'new_pm_confirm': $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; $url_params = Array('ResetPage' => '1'); break; case 'new_topic_confirm': $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; break; case 'topic_reply': $url_params = Array('Action' => 'bb_topic_reply', 'next_template' => $attribs['_template']); bb_form_load_values('topic_reply', $objSession->Get('PortalUserId') ); break; case 'post_edit': $url_params = Array('Action' => 'bb_post_edit'); bb_form_load_values('post_edit', $objPostingList->CurrentPostID() ); break; case 'edit_topic': $url_params = Array( 'Action' => 'bb_edit_topic', 'DestTemplate' => $attribs['_finishtemplate'] ); $t =& $objTopicList->GetCurrentTopic(); $IsOwner = ( $t->Get('OwnerId') == $objSession->Get('PortalUserId') ); if ( $objSession->HasCatPermission('TOPIC.MODIFY.PENDING') || ($IsOwner && $objSession->HasCatPermission('TOPIC.OWNER.MODIFY.PENDING')) ) { $url_params['Confirm'] = $attribs[ getArrayValue($attribs, '_confirmpending') ? '_confirmpending' : '_confirm' ]; } if ( $objSession->HasCatPermission('TOPIC.MODIFY') || ($IsOwner && $objSession->HasCatPermission('TOPIC.OWNER.MODIFY')) ) { $url_params['Confirm'] = $attribs['_confirm']; } if( !$url_params['Confirm'] ) unset($url_params['Confirm']); bb_form_load_values('edit_topic', $t->Get('TopicId') ); break; case 'edit_topic_confirm': $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; break; } return HREF_Wrapper('', $url_params); } /* @description: Parse a topic item template @attrib: _ItemTemplate:tpl: Topic template to parse @attrib: _TopicId:int: Topic ID to parse (uses current topic if not set) */ function bb_topic_detail($attribs = array()) { global $objTopicList; $t = $attribs["_itemtemplate"]; if(strlen($t)) { $TopicId = (int)$attribs["_topicid"]; if($TopicId) { $topic = $objTopicList->GetItem($TopicId); } else $topic =& $objTopicList->GetCurrentTopic(); if(is_object($topic)) { $o = $topic->ParseTemplate($t); } } return $o; } /* @description: Parse a topic field and return the value @attrib: _Field:: Topic field to parse @attrib: _TopicId:int: Topic ID to parse (uses current topic if not set) */ function bb_topic_field($attribs = array()) { global $objTopicList, $bb_var_list; $TopicId = $attribs["_topicid"]; if ( is_numeric($TopicId) ) { $topic =& $objTopicList->GetItem($TopicId); } else { if(!$objTopicList->CurrentItem && $bb_var_list['id'] > 0) { $objTopicList->SetCurrentItem($bb_var_list['id']); } $topic =& $objTopicList->GetCurrentTopic(); } if(is_object($topic)) { $element = new clsHtmlTag(); $element->name = $topic->TagPrefix; $element->attributes = $attribs; $o = $topic->ParseObject($element); } else $o = ""; return $o; } /* @description: Returns the number of items related to the current topic @attrib: _ItemId:int: the article to use (If not set, the current topic is used) @attrib: _ItemType:: Name of item to count (ie: _ItemType="Category,Topic") @example: */ function bb_related_count($attribs) { global $objItemTypes, $objTopicList, $content_set; global $TopicRelations; $id = $attribs["_itemid"]; $item_type = strtolower($attribs["_itemtype"]); $count = 0; if(!is_numeric($id)) { $c =& $objTopicList->GetCurrentItem(); } else $c =& $objTopicList->GetItem($id); if(is_object($c)) { $ResourceId = $c->Get("ResourceId"); if(!is_object($TopicRelations)) { $TopicRelations = new clsMultiTypeList(); LoadRelatedItems($Related, $TopicRelations,$c->Get("ResourceId")); } if(strlen($attribs["_itemtype"])) { $objType = $objItemTypes->GetTypeByName($item_type); if(is_object($objType)) { $TargetType = $objType->Get("ItemType"); } else $TargetType=""; } if($TopicRelations->NumItems()>0) { for($x=0;$x<$TopicRelations->NumItems();$x++) { $a = $TopicRelations->GetItemByIndex($x); if($a->type == $TargetType || !strlen($TargetType)) { $count++; } } } } return $count; } /* @description: List items related to the current topic @attrib: _ItemId:int: the topic to use (If not set, the current topic is used) @attrib: _ListItems:: List of item types to include (ie: _ListItems="Category,Link") @attrib: _*Template:none: For each item type lsted in _ListItems, an item type template must be included (ie: _CategoryTemplate=".." _LinkTemplate="..") @example: */ function bb_related_items($attribs) { global $objItemTypes, $objTopicList, $objCatList, $content_set; $id = $attribs["_itemid"]; if(!is_numeric($id)) { $c =& $objTopicList->GetCurrentTopic(); } else $c =& $objTopicList->GetItem($id); $data_sent=0; $tpath = GetModuleArray("template"); if(is_object($c)) { $ResourceId = $c->Get("ResourceId"); $IncludeList = explode(",",trim(strtolower($attribs["_listitems"]))); $o = ""; if(!is_object($TopicRelations)) { $TopicRelations = new clsMultiTypeList(); LoadRelatedItems($Related, $TopicRelations,$c->Get("ResourceId")); } if($TopicRelations->NumItems()>0) { for($inc=0;$incGetTypeByName($item_type); if(is_object($objType)) { foreach($TopicRelations->Items as $item) { if(is_object($item)) { if(strtolower($objType->Get("ItemName")) == strtolower($item_type) && $item->type==$objType->Get("ItemType")) { if(strlen($item->BasePermissionName)) { $perm = $item->BasePermissionName.".VIEW"; $haspem = $objSession->HasCatPermission($perm,$item->Get("CategoryId")); } else $hasperm = 1; if($hasperm) { $data_sent =1; $classname = $objType->Get("ClassName"); if(strlen($classname)) { $l = new $classname; $l->Data = $item->Data; $o .= $l->ParseTemplate($t); } } } } $item = NULL; } } else echo $item_type." not found
\n"; } } if($data_sent) { return $o; } else { $content_set=0; return ""; } } else { $content_set = 0; return ""; } } else { $content_set = 0; return ""; } } /* loads post lists */ function LoadPosts($attribs=array()) { global $objTopicList, $objPostingList, $objSession, $objCatList; $ListType = strtolower($attribs["_listtype"]); if(!strlen($ListType)) $ListType="category"; $objPostingList->ListType=$ListType; switch($ListType) { case "category": $objPostingList->LoadTopicPosts($attribs); break; } } /* @description: Outputs a list of topic posts @attrib: _TopicId:int: Override the current topic @attrib: _ListType::Determines the type of list to generate
Possible values:
  • Category: List topics from the current category (default)
@attrib: _ItemTemplate:tpl: default template used for topic list items @attrib: _AltItemTemplate:tpl: used on every other post in the list (optional) @attrib: _FirstItemTemplate:tpl: Template used for the first topic listed (optional) @attrib: _LastItemTemplate:tpl: Template used for the last topic listed (optional) @attrib: _AltLastItemTemplate:tpl: Template used for the last topic listed if it ends on an alternate row (optional) @example: */ function bb_list_posts($attribs=array()) { global $var_list, $bb_var_list,$objCatList, $objTopicList, $objPostingList, $objSession; $o=""; //prepare output if($objSession->HasCatPermission("TOPIC.REPLY.VIEW")) { $objSession->SetVariable("topic_viewmode","0"); $objSession->SetVariable("topic_list",$var_list["t"]); $TopicId=$attribs["_topicid"]; if(is_numeric($TopicId)) { $topic =& $objTopicList->GetItem($TopicId); } else $topic =& $objTopicList->GetCurrentTopic(); $t = $attribs["_itemtemplate"]; if(is_object($topic) && strlen($t)) { $topic->Increment("Views", true); if($objPostingList->TopicID != $topic->Get("TopicId") || $objPostingList->NumItems()==0) { LoadPosts($attribs); //$objPostingList->Clear(); //$objPostingList->TopicID=$topic->Get("TopicId"); //$objPostingList->LoadTopicPosts(); } $application =& kApplication::Instance(); if($objPostingList->NumItems()>0) { $row = 0; for($x=0;$x<$objPostingList->NumItems();$x++) { $post =& $objPostingList->Items[$x]; $application->SetVar('bb_post_id', $post->UniqueId()); $even = (($row+1) % 2 == 0); $parsed=0; if($row==0 && strlen($attribs["_firstitemtemplate"])) { $o .= $post->ParseTemplate($attribs["_firstitemtemplate"]); $parsed=1; } if($row==$objPostingList->NumItems()-1 && $even && !$parsed && strlen($attribs["_altlastitemtemplate"])>0) { $o .= $post->ParseTemplate($attribs["_altlastitemtemplate"]); $parsed=1; } if($row==$objPostingList->NumItems()-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0) { $o .= $post->ParseTemplate($attribs["_lastitemtemplate"]); $parsed=1; } if(!$parsed) { if($even && strlen($attribs["_altitemtemplate"])>0) { $o .= $post->ParseTemplate($attribs["_altitemtemplate"]); } else $o .= $post->ParseTemplate($attribs["_itemtemplate"]); } $row++; } $o.="\n"; } else { $content_set = 0; $o = "no posts"; } } else { $content_set = 0; $o = "bot a topic"; } } return $o; } /* @description: Outputs a list of topic posts in a threaded (tree) format @attrib: _TopicId:int: Override the current topic @attrib: _ListType::Determines the type of list to generate
Possible values:
  • Category: List topics from the current category (default)
@attrib: _ItemTemplate:tpl: default template used for topic list items @attrib: _AltItemTemplate:tpl: used on every other post in the list (optional) @attrib: _FirstItemTemplate:tpl: Template used for the first topic listed (optional) @attrib: _LastItemTemplate:tpl: Template used for the last topic listed (optional) @attrib: _AltLastItemTemplate:tpl: Template used for the last topic listed if it ends on an alternate row (optional) @example: */ function bb_list_posts_threaded($attribs = array(), $parent=0, $depth=0) { global $objSession,$bb_var_list, $objPostingList,$ThreadRow; $o=""; //prepare output if($objSession->HasCatPermission("TOPIC.REPLY.VIEW")) { $objSession->SetVariable("topic_viewmode","1"); $objSession->SetVariable("topic_list",$var_list["t"]); $plist = new clsPostingList(); $TopicId=$attribs["_topicid"]; if(!is_numeric($TopicId)) { $TopicId = $bb_var_list["top"]; } $depth++; $t = $attribs["_itemtemplate"]; $CurrentPost = $objPostingList->CurrentPostID(); if(!is_numeric($ThreadRow)) $ThreadRow=0; if(strlen($t)) { $plist->TopicID = $TopicId; $sql = "SELECT * FROM ".GetTablePrefix()."Posting WHERE TopicId=".$TopicId." AND ReplyTo=$parent ORDER BY CreatedOn ASC"; //echo $sql."
\n"; $plist->Query_Item($sql); for($x=0;$x<$plist->NumItems();$x++) { $plist->Items[$x]->Set("Depth",$depth); $post =& $plist->Items[$x]; $even = (($ThreadRow+1) % 2 == 0); $parsed=0; if($post->Get("PostingId")==$CurrentPost && strlen($attribs["_currentitemtemplate"])) { $o .= $post->ParseTemplate($attribs["_currentitemtemplate"]); $parsed=1; } if($ThreadRow==0 && strlen($attribs["_firstitemtemplate"])) { $o .= $post->ParseTemplate($attribs["_firstitemtemplate"]); $parsed=1; } if($ThreadRow==$plist->NumItems()-1 && $even && !$parsed && strlen($attribs["_altlastitemtemplate"])>0) { $o .= $post->ParseTemplate($attribs["_altlastitemtemplate"]); $parsed=1; } if($ThreadRow==$plist->NumItems()-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0) { $o .= $post->ParseTemplate($attribs["_lastitemtemplate"]); $parsed=1; } if(!$parsed) { if($even && strlen($attribs["_altitemtemplate"])>0) { $o .= $post->ParseTemplate($attribs["_altitemtemplate"]); } else $o .= $post->ParseTemplate($attribs["_itemtemplate"]); } $ThreadRow++; $o .= bb_list_posts_threaded($attribs, $plist->Items[$x]->Get("PostingId"),$depth); } } unset($plist); } return $o; } /* @description: Used in conjuction with bb_list_posts. This function generates the page navigation for the list. If this tag is called before the list tag, this function will load the post list. For that reason, the _ListType attribute is required if the pagnav tag preceeds the bb_topic_list tag in the template. Generally, it is good practice to duplicate all attributes set for bb_post_list (other than templates). @attrib: _PagesToList:int: Number of pages to list (default is 10) @attrib: _Tempalte:tpl: Template to be used in the page links. Defaults to current template if not set @attrib: _label:lang: language tag to include in the output if there are pages to list. If there are no pages listed, this text will not be included (resulting in an empty output) */ function bb_post_pagenav($attribs = array()) { global $objPostingList, $objTopicList, $objSession, $content_set; $DestTemplate = $attribs["_template"]; $PagesToList = $attribs["_pagestolist"]; $image = $attribs["_PageIcon"]; if(!is_numeric($PagesToList)) $PagesToList = 10; $TopicId = $attribs["_topicid"]; if(!is_numeric($TopicId)) $TopicId = $objTopicList->CurrentTopicID(); if($objPostingList->TopicID != $TopicId || ($objPostingList->NumItems()==0)) { LoadPosts($attribs); } $extra = ExtraAttributes($attribs); if($objPostingList->NumItems()>0) { $o = $objPostingList->GetPageLinkList($DestTemplate,'',$PagesToList, true, $extra); } // echo "
TEST: "; print_r($o); echo "
"; if (strlen($image)) { $o_i = ' '; } if(strlen($o) && strlen($attribs["_label"])) $o = $o_i.language($attribs["_label"]).' '.$o; elseif (!strlen($o)) { $content_set = 0; return ""; } return $o; } /* @description: Parse a post field and return the value. @attrib: _Field:: Post Field to parse @attrib: _TopicId:int: Topic ID (if not set, the current topic is used) @attrib: _PostId:int: Post ID to parse (uses current topic if not set) */ function bb_post_field($attribs = array()) { global $objPostingList; $PostId=$attribs["_postid"]; $TopicId=$attribs["_topicid"]; if(!is_numeric($TopicId)) { $TopicId=$bb_var_list["top"]; } $objPostingList->TopicId = $TopicId; if(!is_numeric($PostId)) { $PostId = $objPostingList->CurrentPostID(); } $p = $objPostingList->GetItem($PostId); if(is_object($p)) { $element = new clsHtmlTag(); $element->name = $p->TagPrefix; $element->attributes = $attribs; $o = $p->ParseObject($element); } else $o = ""; unset($PostList); return $o; } /* @description: Parse a post item template @attrib: _ItemTemplate:tpl: Post template to parse @attrib: _TopicId:int: Topic ID (if not set, the current topic is used) @attrib: _PostId:int: Post ID to parse (uses current topic if not set) */ function bb_post_detail($attribs = array()) { global $objTopicList, $objPostingList; $o = ""; $t = $attribs["_itemtemplate"]; if(strlen($t)) { $PostId=$attribs["_postid"]; $TopicId=$attribs["_topicid"]; if(!is_numeric($TopicId)) { $TopicId=$bb_var_list["top"]; } $objPostingList->TopicId = $TopicId; if(!is_numeric($PostId)) { $PostId = $objPostingList->CurrentPostID(); } $p =& $objPostingList->GetItem($PostId); if(is_object($p)) { $o = $p->ParseTemplate($t); } } return $o; } /* @description: List all active smileys @attrib: _ItemTemplate: Smiley template to parse */ function bb_list_emoticons($attribs=array()) { global $objSmileys, $content_set; if($objSmileys->NumItems()==0) { $objSmileys->LoadActiveEmoticons(); } if($objSmileys->NumItems()==0) { $content_set=0; return ""; } $t = $attribs["_itemtemplate"]; if(!strlen($t)) { $content_set=0; return ""; } foreach($objSmileys->Items as $s) { $o .= $s->ParseTemplate($t); } return $o; } function bb_pm_list($attribs = array()) { global $content_set, $objPMList; $t = $attribs['_itemtemplate']; if(!strlen($t)) { $content_set = 0; return ''; } LoadPMs($attribs); if ($objPMList->NumItems()==0) { $content_set=0; return ''; //language("la_no_topics"); } $html_attribs = ExtraAttributes($attribs); $row=0; for($x=0;$x<$objPMList->NumItems();$x++) { $pm =& $objPMList->Items[$x]; $parsed=0; if($row==0 && strlen($attribs["_firstitemtemplate"])) { $o .= $pm->ParseTemplate($attribs["_firstitemtemplate"]); $parsed=1; } if($row==$objPMList->NumItems()-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0) { $o .= $pm->ParseTemplate($attribs["_lastitemtemplate"]); $parsed=1; } if(!$parsed) $o .= $pm->ParseTemplate($attribs["_itemtemplate"]); $row++; } return $o; } function bb_pm_pagenav($attribs = array()) { global $objPMList; $DestTemplate = $attribs["_template"]; $PagesToList = $attribs["_pagestolist"]; $image = $attribs["_PageIcon"]; if(!is_numeric($PagesToList)) $PagesToList = 10; LoadPMs($attribs); $o = $objPMList->GetPageLinkList($DestTemplate,'',10,true,'&FolderId='.$objPMList->FolderId); if (strlen($image)) { $o_i = ' '; } if(strlen($o) && strlen($attribs["_label"])) $o = $o_i.language($attribs["_label"]).$o; return $o; } function LoadPMs($attribs = array()) { global $objPMList, $bb_var_list; $objPMList->Page = GetVar('ResetPage') == 1 ? 1 : $bb_var_list['pmp']; $objPMList->LoadUserPMs($attribs); } function bb_pm_list_count($attribs = array()) { global $objPMList; LoadPMs($attribs); $o = $objPMList->QueryItemCount; if($o == '') $o = 0; return $o; } function bb_pm_list_sortlink($attribs = array()) { return HREF_Wrapper('', Array('Action' => 'bb_pm_sort', 'col' => $attribs['_column'], 'FolderId' => (int)GetVar('FolderId')) ); } function bb_pm_list_sorticon($attribs = array()) { global $objSession; $field = $objSession->GetPersistantVariable("PMs_Sortfield"); $order = $objSession->GetPersistantVariable("PMs_SortOrder"); if(!strlen($order)) $order = "asc"; $url=""; if($field==$attribs["_column"]) { $key ="_selected".strtolower($order); $url = $attribs[$key]; if(!strlen($url)) $url = $attribs["_selected"]; } else $url = $attribs["_unselected"]; if(!strlen($url)) $url = $attribs["_default"]; return $url; } function bb_show_folder($attribs = array()) { return $attribs['_folderid'] == (int)GetVar('FolderId') ? 'yes' : ''; } function bb_not_sent() { global $objPMList, $objSession; $pm =& $objPMList->GetCurrentItem(); if( is_object($pm) ) { return $objSession->Get('PortalUserId') == $pm->Get('FromId') ? '' : 'yes'; } } function bb_phrase_by_folder($attribs = array()) { return language( GetVar('FolderId') == -1 ? 'lu_to' : 'lu_from' ); } function bb_phrase_by_pm($attribs = array()) { global $objPMList; $pm =& $objPMList->GetCurrentItem(); return language( $pm->Get('FolderId') == -1 ? 'lu_to' : 'lu_from' ); } function bb_pm_field($attribs = array()) { global $objPMList; $pm =& $objPMList->GetCurrentItem(); if( is_object($pm) ) { $element = new clsHtmlTag(); $element->name = $pm->TagPrefix; $element->attributes = $attribs; $o = $pm->ParseObject($element); $o = get_magic_quotes_gpc() ? $o : stripslashes($o); } else { $o = ''; } return $o; } function bb_pm_setmark($attribs = array()) { global $objPMList; $pm =& $objPMList->GetCurrentItem(); if( is_object($pm) ) { // set read mark if( $pm->Get('Status') < 2 ) { $pm->Set('Status', 2); $pm->Update(); } } } function bb_new_pm_count() { global $objSession; $db =& GetADODBConnection(); $sql = 'SELECT COUNT(*) FROM '.GetTablePrefix().'PrivateMessages WHERE ToId = '.$objSession->Get('PortalUserId').' AND Status < 2'; return $db->GetOne($sql); } function bb_popup_notify($attribs = array()) { } ?>