GetVariable("LinkListType"); $LastShortType = $objSession->GetVariable("LinkShortList"); $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) { $objLinkList->EnablePaging = TRUE; //echo "Last: $LastList, Short: $LastShortType Current: $ListType, Short:".$attribs["_shortlist"]."
\n"; if($LastList != $ListType || $LastShortType != $attribs["_shortlist"]) { //echo "Resetting Page..
\n"; $l_var_list_update["p"] = 1; $l_var_list["p"] = 1; $objSession->SetVariable("LinkListType",$ListType); $objSession->SetVariable("LinkShortList",$attribs["_shortlist"]); $objLinkList->Page = 1; } else $objLinkList->Page=$l_var_list["p"]; } else { if(is_numeric(getArrayValue($attribs,'_maxcount'))) { $objLinkList->MaxListCount = $attribs["_maxcount"]; } else { $objLinkList->MaxListCount = 10; } $objLinkList->EnablePaging = FALSE; } $objLinkList->ListType=$ListType; switch($ListType) { case "category": $objLinkList->LoadListCategory($attribs); break; case "myitems": $objLinkList->LoadMyItems($attribs); break; case "hot": $objLinkList->LoadHotItems($attribs); break; case "pop": $objLinkList->LoadPopItems($attribs); break; case "pick": $objLinkList->LoadPickItems($attribs); break; case "favorites": $objLinkList->LoadFavorites($attribs); break; case "search": $attribs['multiple'] = 'links'; $objLinkList->LoadSearchItems($attribs); break; case "new": $objLinkList->LoadNewItems($attribs); break; case "my_new": $scope = $objSession->CurrentUser->Vars["LastLogin"]; $attribs["_scope"] = $scope; $attribs["_show_since_last"] = 1; //print_pre($objSession->CurrentUser); if (is_numeric($scope) && $scope > 0) { $objLinkList->LoadNewItems($attribs); } break; default: $objLinkList->Clear(); break; } /* end of switch */ } function l_ParseEnv($str = NULL) { global $l_var_list, $objSession, $orderByClause, $objConfig; if ($str != NULL) { if( substr($str,0,2) == 'l-' ) { $str = preg_replace('/^([a-zA-Z]+)-([0-9]+)-(.*)/','\\1\\2-\\3', $str); } $str = substr($str,1); $pieces = explode("-", $str); $l_var_list["id"] = $pieces[0]; $l_var_list["p"] = $pieces[1]; $l_var_list["rp"] = $pieces[2]; // $l_var_list['event'] = $pieces[3]; ResetPage('l'); } else { $l_var_list["id"] = 0; $l_var_list["p"] = 1; $l_var_list["rp"] = 1; // $l_var_list['event'] = ''; } } function l_LoadEnv() { global $objSession, $l_var_list; $str = $objSession->GetVariable("Env_Link"); l_ParseEnv($str); } function l_SaveEnv($str="") { global $objSession; $str = $objSession->SetVariable("Env_Link",$str); } function l_BuildEnv() { $module_vars = Array('id','p','rp','event'); return GenerateModuleEnv('l', $module_vars); } function l_BuildEnv_NEW() { $module_vars = Array('id' => 'l_id', 'p' => 'l_Page', 'rp' => 'l_Reviews_Page', 'event' => 'l_event'); return GenerateModuleEnv_NEW('l', $module_vars); } /* @description: returns the date of the last modification to the link table @attrib: _Part:: part of the date to display @attrib: _local:bool: If set, returns the modified date for the current category (and subcats) @example: */ function l_link_modified($attribs) { global $objConfig, $objCatList; $ret=''; $CachedValue = GetTagCache("inlink","l_link_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,MAX(CreatedOn) as NewDate FROM ".GetTablePrefix()."Link "; $sql .= "INNER JOIN ".GetTablePrefix()."CategoryItems ON (".GetTablePrefix()."Link.ResourceId=".GetTablePrefix()."CategoryItems.ItemResourceId) "; $sql .= "WHERE $catwhere LIMIT 1"; } else { $sql = "SELECT MAX(Modified) as ModDate, MAX(CreatedOn) As NewDate FROM ".GetTablePrefix()."Link LIMIT 1"; } $rs = $ado->Execute($sql); if($rs && ! $rs->EOF) { $new = $rs->fields["NewDate"]; $mod = $rs->fields["ModDate"]; if($new>$mod) $mod = $new; if($mod) { $part = strtolower(getArrayValue($attribs,'_part')); $ret = $part?ExtractDatePart($part,$mod):LangDate($mod); } } if($ret) SaveTagCache("inlink","l_link_modified",$attribs,"",$ret); return $ret; } /* @description: returns the date of the last review for a link @attrib: _Part:: part of the date to display @attrib: _LinkId:int: if set, the link to display the review modified date @example: */ function l_review_modified($attribs) { global $objConfig, $objLinkList; $LinkId = (int)$attribs["_linkid"]; if($LinkId) { $link = $objLinkList->GetItem($LinkId); } else $link = $objLinkList->GetCurrentItem(); if(is_object($link)) { $ado = &GetADODBConnection(); $ResId = $link->Get("ResourceId"); $sql = "SELECT MAX(CreatedOn) as ModDate FROM ".GetTablePrefix()."ItemReview WHERE ItemId=$ResId AND Status=1 LIMIT 1"; $rs = $ado->Execute($sql); if($rs && ! $rs->EOF) { $mod = $rs->fields["ModDate"]; if($mod) { $part = strtolower($attribs["_part"]); if(strlen($part)) { $ret = ExtractDatePart($part,$mod); } else { $ret = LangDate($mod); } } } } return $ret; } /* @description: returns a link to the link (directory) root category @attrib: _Category:int: Override the In-Link root category @attrib: _Template:tpl: The template to link to @example: */ function l_root_link($attribs = array()) { global $objConfig, $l_var_list_update, $objModules; //$RootCat = (int)$objConfig->Get("Link_Root"); $RootCat = $objModules->GetModuleRoot("In-Link"); if($RootCat != -1) $attribs["_category"] = $RootCat; $l_var_list_update["p"] = ""; $l_var_list_update["id"] = ""; $l_var_list_update["cat"] = ""; $l_var_list_update["rp"] = ""; unset($l_var_list_update["p"],$l_var_list_update["id"],$l_var_list_update["cat"],$l_var_list_update["rp"]); $o = m_template_link($attribs); unset($l_var_list_update["p"],$l_var_list_update["id"],$l_var_list_update["cat"],$l_var_list_update["rp"]); return $o; } function l_form_load_values($FormName,$IdValue) { global $FormValues, $objLinkList; switch ($FormName) { case 'editlink': $l =& $objLinkList->GetItem($IdValue); $FormValues[$FormName]['name'] = stripslashes($l->Get('Name')); $FormValues[$FormName]['url'] = stripslashes($l->Get('Url')); $FormValues[$FormName]['description'] = stripslashes($l->Get('Description')); $l->LoadCustomFields(); if (is_array($l->CustomFields)) { foreach ($l->CustomFields as $f => $v) { if (is_array($v)) { $FormValues[$FormName][$f] = $v; $FormValues[$FormName][strtolower($f)] = $v; } } } break; } } /* @description: Generates the ACTION property for a FORM tag used by In-Link @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:
  • addlink: add a link to the database
  • addlink_confirm: Confirm for addlink
  • editlink: Modify an existing link
  • editlink_confifirm: Confirmation for link modify
  • l_rate: Form used to rate a link
  • l_rate_confirm: Confirm for rate link
  • l_addreview: add a review for a link
  • l_review_confirm: Review confirmation
  • l_delete_confirm: Form to confirm link delete (prior to delete)
  • l_sort_links: Form to sort links and set number of results
  • l_getting_rated: Form for external rating
@example:
"> */ function l_form_action($attribs = array()) { global $var_list_update, $var_list, $l_var_list, $l_var_list_update, $objSession, $objLinkList; $var_list_update['t'] = getArrayValue($attribs, '_template') ? $attribs['_template'] : $var_list['t']; if( is_object($objLinkList) && $objLinkList->CurrentItem ) $l_var_list_update['id'] = $objLinkList->CurrentItem; $ret = ''; $form = strtolower( $attribs['_form'] ); $url_params = Array(); switch($form) { case 'addlink': /* add link needs to be passed in: _CompleteTemplate=... _PendingTemplate=... _DestinationTemplate=... */ if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { $url_params = Array( 'Action' => 'l_add_link', 'DestTemplate' => $attribs['_finishtemplate'] ); if ( $objSession->HasCatPermission('LINK.ADD.PENDING') ) { $url_params['Confirm'] = $attribs[ getArrayValue($attribs, '_confirmpending') ? '_confirmpending' : '_confirm' ]; $url_params['Action'] = 'l_add_link_confirm'; } if ( $objSession->HasCatPermission('LINK.ADD') ) { $url_params['Confirm'] = $attribs['_confirm']; $url_params['Action'] = 'l_add_link_confirm'; } if( !$url_params['Confirm'] ) unset($url_params['Confirm']); } break; case 'addlink_confirm': $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; break; case 'editlink': if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { $url_params = Array( 'Action' => 'l_edit_link', 'DestTemplate' => $attribs['_finishtemplate'] ); if ( $objSession->HasCatPermission('LINK.MODIFY.PENDING') ) { $url_params['Confirm'] = $attribs[ getArrayValue($attribs, '_confirmpending') ? '_confirmpending' : '_confirm' ]; } if ( $objSession->HasCatPermission('LINK.MODIFY') ) { $url_params['Confirm'] = $attribs['_confirm']; } if( !$url_params['Confirm'] ) unset($url_params['Confirm']); l_form_load_values( $form, $l_var_list['id'] ); } break; case 'editlink_confirm': $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; break; case 'l_rate': if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { $url_params = Array( 'Action' => 'l_rate_link', 'DestTemplate' => $attribs['_finishtemplate'] ); if ( $objSession->HasCatPermission('LINK.RATE') && getArrayValue($attribs, '_confirm') ) $url_params['Confirm'] = $attribs['_confirm']; $l_var_list_update['id'] = $objLinkList->CurrentItem; if( getArrayValue($attribs, '_duplicate') ) $url_params['Duplicate'] = $attribs['_duplicate']; } break; case 'l_getting_rated': if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { $url_params = Array( 'Action' => 'l_rate_link', 'DestTemplate' => $attribs['_finishtemplate'] ); if ($objSession->HasCatPermission("LINK.RATE") && getArrayValue($attribs, '_confirm') ) $url_params['Confirm'] = $attribs['_confirm']; $var_list_update['t'] = 'inlink/rate'; $l_var_list_update['id'] = $objLinkList->CurrentItem; if( getArrayValue($attribs, '_duplicate') ) $url_params['Duplicate'] = $attribs['_duplicate']; } break; case 'l_sort_links': $url_params = Array('Action' => 'l_sort_links'); break; case 'l_rate_confirm': $l_var_list_update['id'] = $objLinkList->CurrentItem; $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; break; case 'l_addreview': if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { $url_params = Array( 'Action' => 'l_add_review', 'DestTemplate' => $attribs['_finishtemplate'] ); $l_var_list_update['id'] = $objLinkList->CurrentItem; if ( $objSession->HasCatPermission('LINK.REVIEW.PENDING') ) { $url_params['Confirm'] = $attribs[ getArrayValue($attribs, '_confirmpending') ? '_confirmpending' : '_confirm' ]; } if ( $objSession->HasCatPermission('LINK.REVIEW') ) $url_params['Confirm'] = $attribs['_confirm']; if( !$url_params['Confirm'] ) unset($url_params['Confirm']); } break; case 'l_review_confirm': $l_var_list_update["id"] = $objLinkList->CurrentItem; $var_list_update['t'] = getArrayValue($_GET, 'DestTemplate') ? $_GET['DestTemplate'] : $var_list['t']; break; case 'l_delete_confirm': if( !$objSession->SessionEnabled() ) { $var_list_update['t'] = 'error_session'; } else { if( getArrayValue($attribs, '_accept_template') ) $url_params['DestYes'] = $attribs['_accepttemplate']; if( getArrayValue($attribs, '_declinetemplate') ) $url_params['DestNo'] = $attribs['_declinetemplate']; } break; } $ret = HREF_Wrapper('', $url_params); unset($var_list_update['t']); return $ret; } /* @description: returns a list of links @attrib: _CatId:int: Override the current category @attrib: _useroot:bool: If set, the current category is changed to In-Link's root category @attrib: _ShortList:bool: If set, the Perpage_Links_Short setting is used instead of Perpage_links @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 links from the current category (default)
  • Top: Most Popular & highest rated links
  • Pop: Most Popular links
  • New: List new links
  • Hot: List links with the most click-throughs
  • Pick: List editor's picks
  • 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 link listed @attrib: _LastItemTemplate:tpl: Template used for the last link listed @attrib: _EdItemTemplate:tpl: Editors Pick template used for link list items @attrib: _ItemTemplate:tpl: default template used for link list items @attrib: _notable:bool: if not 0, a table is used to contain the link list (any extra HTML attributes are used for the table tag) @attrib: _Columns:int: the number of columns to use for table (defaults to 1) @example: */ function l_list_links($attribs = array()) { global $objConfig, $objSession, $var_list, $l_var_list, $objLinkList, $objCatList, $content_set; if(strlen($attribs["_itemtemplate"])==0) { $content_set = 0; return "ERROR -1"; } $CatId = getArrayValue($attribs,'_catid'); if (!is_numeric($CatId)) { $CatId = $objCatList->CurrentCategoryID(); } if ((int)getArrayValue($attribs,'_useroot')) { $CatId = (int)$objConfig->Get("Link_Root"); } $ListType = getArrayValue($attribs,'_listtype'); if (!$ListType) $ListType = 'category'; if ($ListType != "search") { $evar = $evar = $_GET["env"]; //m_BuildEnv().$objSession->GetVariable("Env_Link"); $tagname = "l_list_links-".$ListType."-".(int)$attribs["_shortlist"]; $CachedList = GetTagCache("inlink",$tagname,$attribs,$evar); if($CachedList) return $CachedList; } if ( ($attribs['_shortlist'] == 1) && $objConfig->Get('Perpage_Links_Short') ) { $objLinkList->PerPageVar = 'Perpage_Links_Short'; } else { $objLinkList->PerPageVar = 'Perpage_Links'; } //echo "PerPage ".$objLinkList->PerPageVar."
"; //echo "ListType: ".$objLinkList->ListType." Passed: $ListType
"; if($objLinkList->ListType != $ListType) { LoadLinkList($attribs); } $cols = (int)getArrayValue($attribs,'_columns'); if (!$cols) $cols = 1; //echo "Items: ".$objLinkList->NumItems()."
"; if ($objLinkList->NumItems() == 0) { $content_set = 0; return language('lu_no_links'); } $html_attribs = ExtraAttributes($attribs); $o=""; $notable = (getArrayValue($attribs,'_notable')!="0"); if(!$notable) { $max_links = $objConfig->Get($objLinkList->PerPageVar); $items_to_print = $objLinkList->NumItems()>$max_links ? $max_links : $objLinkList->NumItems(); if($cols==0) $cols = 1; $per_row = ceil($items_to_print/$cols); $count = 0; $row = 0; $total = 1; $o=""; $o .= ""; } $o .= "\n
"; foreach($objLinkList->Items as $index => $link) { $parsed = 0; $objLinkList->CurrentItem = $index; if($count==$per_row) { $o .= ""; $count=0; } if($row==0 && getArrayValue($attribs,'_firstitemtemplate') ) { $o .= $link->ParseTemplate($attribs['_firstitemtemplate']); $parsed = 1; } if($row==$objLinkList->NumItems()-1 && !$parsed && getArrayValue($attribs,'_lastitemtemplate') ) { $o .= $link->ParseTemplate($attribs['_lastitemtemplate']); $parsed = 1; } if(!$parsed) { if (getArrayValue($attribs, '_editemtemplate') && (int)$link->Get('EditorsPick')) { $o .= $link->ParseTemplate($attribs["_editemtemplate"]); } else { $o .= $link->ParseTemplate($attribs['_itemtemplate']); } } $row++; $count++; $total++; if ($total>$max_links) break; } $objLinkList->SetCurrentItem(); if($count != $per_row) { $o .= "
\n"; } else { $keywords = $objSession->GetVariable("Search_Keywords"); $links_showed = 0; //nl $max_links = $objConfig->Get($objLinkList->PerPageVar); //nl //echo "MaxLinks: $max_links
"; foreach($objLinkList->Items as $index => $link) { //echo "
"; print_r($link); echo "
"; $show = 1; /* if ($keywords) { if (strstr(strip_tags(strtolower($link->Data['Name'])), strtolower($keywords)) || strstr(strip_tags(strtolower($link->Data['Description'])), strtolower($keywords))) { $show = 1; } } else { $show = 1; }*/ if ($show == 1) { $parsed = 0; $objLinkList->CurrentItem = $index; if($row==0 && strlen($attribs["_firstitemtemplate"])) { $o .= $link->ParseTemplate($attribs["_firstitemtemplate"]); $parsed = 1; } if($row==$objLinkList->NumItems()-1 && !$parsed && strlen($attribs["_lastitemtemplate"])>0) { $o .= $link->ParseTemplate($attribs["_lastitemtemplate"]); $parsed = 1; } if(!$parsed) { if (getArrayValue($attribs, '_editemtemplate') && (int)$link->Get('EditorsPick')) { $o .= $link->ParseTemplate($attribs["_editemtemplate"]); } else { $o .= $link->ParseTemplate($attribs['_itemtemplate']); } } $links_showed++; // nl if($links_showed == $max_links) break; //nl } } $objLinkList->SetCurrentItem(); } $o.="\n"; if(strlen($o)) SaveTagCache("inlink",$tagname,$attribs,$evar,$o); global $l_var_list_update; $l_var_list_update = array(); return $o; } /* @description: Used in conjuction with l_list_links. Returns the number if links in the list @attrib: _CatId:int: Override the current category @attrib: _useroot:bool: If set, the current category is changed to In-Link's root category @attrib: _ListType::Determines the type of list to generate
Possible values:
  • Category: List links from the current category (default)
  • Hot: Hot Links (Most Popular & highest rated links)
  • Pop: Most Popular links
  • New: List new links
  • Hot: List links with the most click-throughs
  • Pick: List editor's picks
  • myitems: List topics created by the current user
  • favorites: List topics marked as favorites by the current user
  • search: List search results
@example: */ function l_list_count($attribs = array()) { global $objConfig, $objLinkList, $objCatList, $objSession; $CatId = getArrayValue($attribs,'_catid'); if(!is_numeric($CatId)) $CatId = $objCatList->CurrentCategoryID(); if((int)getArrayValue($attribs,'_useroot')) $CatId = (int)$objConfig->Get("Link_Root"); $ListType = getArrayValue($attribs,'_listtype'); if(!strlen($ListType)) $ListType="category"; if ( ($attribs['_shortlist']) && $objConfig->Get('Perpage_Links_Short') ) { $objLinkList->PerPageVar = 'Perpage_Links_Short'; } else { $objLinkList->PerPageVar = 'Perpage_Links'; } if(!getArrayValue($attribs,'_today')) { if($objLinkList->ListType != $ListType) { LoadLinkList($attribs); } $o = 0; $keywords = $objSession->GetVariable("Search_Keywords"); if ($keywords) { // foreach ($objLinkList->Items as $cat) { // if (strstr(strip_tags(strtolower($cat->Data['Name'])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($keywords))) { // $o++; // } // } // echo "Counted: $o


"; // echo "Reasly: ".$objLinkList->QueryItemCount."


"; // } // else { $o = $objLinkList->QueryItemCount; } $o = $objLinkList->QueryItemCount; // only use when no highlighting issued } else { $o = $objLinkList->PerformItemCount($attribs); } if ($o == '') { $o = 0; } return $o; } /* @description: Used in conjuction with l_list_links. This function generates the page navigation for the list. If this tag is called before the list tag, this function will load the links. For that reason, the _ListType attribute is required if the pagnav tag preceeds the l_list_links tag in the template. Generally, it is good practice to duplicate all attributes set for l_list_links. @attrib: _PagesToList:int: Number of pages to list (default is 10) @attrib: _ShortList:bool: If set, uses the shortlist configuration value for links @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) @attrib: _ListType::Determines the type of list to generate
Possible values:
  • Category: List links from the current category (default)
  • Hot: Hot Links (Most Popular & highest rated links)
  • Pop: Most Popular links
  • New: List new links
  • Hot: List links with the most click-throughs
  • Pick: List editor's picks
  • myitems: List topics created by the current user
  • favorites: List topics marked as favorites by the current user
  • search: List search results
*/ function l_link_pagenav($attribs = array()) { global $objLinkList, $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 ( ($attribs['_shortlist'] == 1) && $objConfig->Get('Perpage_Links_Short') ) { $objLinkList->PerPageVar = 'Perpage_Links_Short'; } else { $objLinkList->PerPageVar = 'Perpage_Links'; } $ListType = getArrayValue($attribs,'_listtype'); if(!strlen($ListType)) $ListType="category"; if($objLinkList->ListType != $ListType) { LoadLinkList($attribs); } $o = $objLinkList->GetPageLinkList($DestTemplate, '', 10, true, '', ExtraAttributes($attribs) ); if (strlen($image)) { $o_i = ' '; } else { $o_i=''; } if(strlen($o) && strlen($attribs["_label"])) $o = $o_i.language($attribs["_label"]).' '.$o; return $o; } /* @description: Used in conjuction with l_list_links. 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 link list. For that reason, the _ListType attribute is required if the pagnav tag preceeds the l_list_links tag in the template. Generally, it is good practice to duplicate all attributes set for l_list_links. @attrib: _root:bool: If set, the current category is set to In-Link's root category @attrib: _text:lang: language tag to include as text for the anchor tag @attrib: _ShortList:bool: If set, uses the shortlist configuration value for links @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 l_link_more($attribs = array()) { global $objLinkList, $objConfig, $l_var_list_update, $objSession, $l_CachedList; $l_var_list_update['id'] = 0; $html_attribs = ExtraAttributes($attribs); $DestTemplate = $attribs["_template"]; if ( ($attribs['_shortlist'] == 1) && $objConfig->Get('Perpage_Links_Short') ) { $objLinkList->PerPageVar = 'Perpage_Links_Short'; } else { $objLinkList->PerPageVar = 'Perpage_Links'; } $ListType = $attribs["_listtype"]; if(!strlen($ListType)) $ListType="category"; if($ListType != "search") { $evar = $_GET["env"]; //m_BuildEnv().$objSession->GetVariable("Env_Link"); $tagname = "l_list_links-".$ListType."-".(int)$attribs["_ShortList"]; $CachedList = GetTagCache("inlink",$tagname,FALSE,$evar); if(strlen($CachedList)) { $moretag = "l_link_more-".$ListType."-".(int)$attribs["_ShortList"]; $CachedPageNav = GetTagCache("inlink",$moretag,FALSE,$evar); if(strlen($CachedPageNav)) return $CachedPageNav; } } if($objLinkList->ListType != $ListType) LoadLinkList($attribs); if($objLinkList->QueryItemCount > $objConfig->Get($objLinkList->PerPageVar)) { if($attribs["_root"]) { $url = l_root_link($attribs); } else { $l_var_list_update["p"]=1; $url = m_template_link($attribs); unset($l_var_list_update["p"]); } $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 .= ""; } if(strlen($o) && strlen($CachedList)>0 && strlen($moretag)>0) SaveTagCache("inlink",$moretag,FALSE,$evar,$o); return $o; } /* @description: List items related to the current link @attrib: _ItemId:int: the link to use (If not set, the current link is used) @attrib: _ListItems:: List of item types to include (ie: _ListItems="Category,Topic") @attrib: _*Template:none: For each item type lsted in _ListItems, an item type template must be included (ie: _CategoryTemplate=".." _TopicTemplate="..") @example: */ function l_related_items($attribs) { global $objItemTypes, $objLinkList, $objCatList, $content_set; static $Related; global $LinkRelations; $id = getArrayValue($attribs,'_itemid'); if(!is_numeric($id)) { $c =& $objLinkList->GetCurrentItem(); } else $c =& $objLinkList->GetItem($id); $data_sent=0; if(is_object($c)) { $ResourceId = $c->Get("ResourceId"); $IncludeList = explode(",",trim(strtolower($attribs["_listitems"]))); $o = ""; if(!is_object($LinkRelations)) { //echo "
"; print_r($c); echo "
"; $LinkRelations = new clsMultiTypeList(); LoadRelatedItems($Related, $LinkRelations,$c->Get("ResourceId")); } if($LinkRelations->NumItems()>0) { for($inc=0;$incGetTypeByName($item_type); if(is_object($objType)) { foreach($LinkRelations->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 ""; } } /* @description: Returns the number of items related to the current link @attrib: _ItemId:int: the link to use (If not set, the current link is used) @attrib: _ItemType:: Name of item to count (ie: _ItemType="Category") @example: */ function l_related_count($attribs) { global $objItemTypes, $objLinkList, $content_set; global $LinkRelations; $count = 0; $id = getArrayValue($attribs,'_itemid'); if( !is_numeric($id) ) { $c =& $objLinkList->GetCurrentItem(); } else { $c =& $objLinkList->GetItem($id); } if( is_object($c) ) { $ResourceId = $c->Get('ResourceId'); if( !is_object($LinkRelations) ) { $LinkRelations = new clsMultiTypeList(); LoadRelatedItems($Related, $LinkRelations,$c->Get('ResourceId')); } if(strlen($attribs['_itemtype'])) { $objType = $objItemTypes->GetTypeByName($item_type); $TargetType = is_object($objType) ? $objType->Get('ItemType') : ''; } if( $LinkRelations->NumItems() > 0 ) { for($x=0;$x<$LinkRelations->NumItems();$x++) { $a = $LinkRelations->GetItemByIndex($x); if($a->type == $TargetType || !strlen($TargetType)) $count++; } } } return $count; } /* @description: Returns a list of reviews for a link @attrib: _LinkId:int: the link to use (If not set, the current link is used) @attrib: _maxcount:int: Maximum number of reviews to list (defaults to all) @attrib: _ShortList:bool: If set, uses the shortlist configuration value for link reviews @attrib: _ReviewTemplate:tpl: template used to display the reviews */ function l_list_reviews($attribs = array()) { global $objLinkList,$content_set, $l_var_list; $max = (int)$attribs["_maxcount"]; $LinkId = (int)$attribs["_linkid"]; if($LinkId) { $link =& $objLinkList->GetItem($LinkId); } else $link =& $objLinkList->GetCurrentItem(); if(is_object($link)) { if($link->ReviewsLoaded()==0) { if($attribs["_shortlist"]) { $link->ReviewPerPageVar = "Perpage_LinkReviews_Short"; } else { $link->ReviewPerPageVar = "Perpage_LinkReviews"; } $ReviewList =& $link->GetItemReviews($l_var_list["rp"]); } else $ReviewList =& $link->Reviews; $o = ""; $t = $attribs["_reviewtemplate"]; if($ReviewList->NumItems()>0 && strlen($t)) { foreach($ReviewList->Items as $r) { if($i >= $max && $max>0) break; $o .= $r->ParseTemplate($t); $i++; } } } if(!strlen($o)) $content_set =0; return $o; } /* @description: Used in conjuction with l_list_reviews. 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 review list. Any extra HTML attributes are passed to the anchor tag used to create the link. @attrib: _LinkId:int: If set, the this value is used for a link ID (default to the current link) @attrib: _root:bool: If set, the current category is set to In-Link's root category @attrib: _text:lang: language tag to include as text for the anchor tag @attrib: _Template:tpl: Destination template of More link @attrib: _plaintext:: plain text to include as text for the anchor tag. The _text attribute takes presedence if both are included. @attrib: _ShortList:bool: If set, uses the shortlist configuration value for link reviews @attrib: _image:: URL to an image to include inside the anchor tag. */ function l_review_more($attribs) { global $objLinkList, $objConfig, $l_var_list_update, $l_var_list; $html_attribs = ExtraAttributes($attribs); $DestTemplate = $attribs["_template"]; $LinkId = (int)$attribs["_linkid"]; if($LinkId) { $link =& $objLinkList->GetItem($LinkId); } else $link =& $objLinkList->GetCurrentItem(); if(is_object($link)) { if($link->ReviewsLoaded()==0) { if($attribs["_shortlist"]) { $link->ReviewPerPageVar = "Perpage_LinkReviews_Short"; } else { $link->ReviewPerPageVar = "Perpage_LinkReviews"; } $ReviewList =& $link->GetItemReviews($l_var_list["rp"]); } else $ReviewList =& $link->Reviews; if($ReviewList->ItemCount() < $ReviewList->QueryItemCount) { if($attribs["_root"]) { $url = l_root_link($attribs); } else { $l_var_list_update['id'] = $l_var_list['id']; $url = m_template_link($attribs); } $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: Used in conjuction with l_list_reviews. This function generates the page navigation for the list of reviews. If this tag is called before the list tag, this function will load the reviews. For that reason, the _ListType attribute is required if the pagnav tag preceeds the l_list_reviews tag in the template. Generally, it is good practice to duplicate all attributes set for l_list_reviews. @attrib: _PagesToList:int: Number of pages to list (default is 10) @attrib: _Template:tpl: destination template for page links (defaults to current template) @attrib: _ShortList:bool: If set, uses the shortlist configuration value for link reviews @attrib: _LinkId:int: If set, the this value is used for a link ID (default to the current link) @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 l_review_pagenav($attribs) { global $l_var_list, $l_var_list_update, $objLinkList; $DestTemplate = $attribs["_template"]; $PagesToList = $attribs["_pagestolist"]; if(!is_numeric($PagesToList)) $PagesToList = 10; $LinkId = (int)$attribs["_linkid"]; if($LinkId) { $link =& $objLinkList->GetItem($LinkId); } else $link =& $objLinkList->GetCurrentItem(); if(is_object($link)) { if($link->ReviewsLoaded()==0) { if($attribs["_shortlist"]) { $link->ReviewPerPageVar = "Perpage_LinkReviews_Short"; } else { $link->ReviewPerPageVar = "Perpage_LinkReviews"; } $ReviewList =& $link->GetItemReviews($l_var_list["rp"]); } else $ReviewList =& $link->Reviews; $o = $ReviewList->GetPageLinkList($l_var_list_update,$DestTemplate); } if(strlen($o) && strlen($attribs["_label"])) $o = language($attribs["_label"]).$o; return $o; } /* @description: Parse a link item template @attrib: _ItemTemplate:tpl: Link template to parse @attrib: _LinkId:int: Link ID to parse (uses current link if not set) */ function l_link_detail($attribs = array()) { global $objLinkList; $t = $attribs["_itemtemplate"]; if(strlen($t)) { $LinkId = (int)$attribs["_linkid"]; if($LinkId) { $link = $objLinkList->GetItem($LinkId); } else $link = $objLinkList->GetCurrentItem(); if(is_object($link)) { $o = $link->ParseTemplate($t); } } return $o; } /* @description: Parse a link field and return the value @attrib: _Field:: Link field to parse @attrib: _LinkId:int: Link ID to parse (uses current link if not set) */ function l_link_field($attribs = array()) { global $objLinkList; $o = ""; $field = $attribs["_field"]; $LinkId = isset($attribs['_linkid']) ? (int)$attribs['_linkid'] : false; if($LinkId) { $link = $objLinkList->GetItem($LinkId); } else { $link = $objLinkList->GetCurrentItem(); } if(strlen($field)) { if(is_object($link)) { $element = new clsHtmlTag(); $element->name = $link->TagPrefix; $element->attributes = $attribs; $o = $link->ParseObject($element); } else $o = ""; } if (substr($o, 0, 9) == "Undefined") { $attrib = Array(); $attrib['_template'] = "error_template"; $attrib['_unsecure'] = 1; $location = m_template_link($attrib); Header("Location: $location"); } return $o; } function l_multiple_submit($params=Array()) { global $objCatList,$objConfig,$objModules; $ret=''; $root_cat_name=language($objConfig->Get('Root_Name')); $selected_tpl=''.$root_cat_name.'>'."%2\$s".''; if(getArrayValue($_POST,'cat_ids')) { foreach ($_POST['cat_ids'] as $cat_id) { $that_cat =& $objCatList->GetItem($cat_id); $ret.=sprintf($selected_tpl,$cat_id,$that_cat->GetNavbar()); } } $ret .= ''; $suggest_cat_id=isset($_POST['suggest_cat_id'])?$_POST['suggest_cat_id']:$objCatList->CurrentCategoryID(); $suggest_cat=$objCatList->GetItem($suggest_cat_id); $ret.=$root_cat_name.' > '.$suggest_cat->GetNavbar().'  '; return $ret; } function l_home_cat() { global $objConfig; return language($objConfig->Get('Root_Name')); } function l_show_listings($params) { global $FormValues, $objConfig; $html_attribs = ExtraAttributes($params); $form = $params['_form']; $field = strtolower($params['_field']); if (isset($_POST[$field])) { $value = $_POST[$field]; } elseif ( getArrayValue($FormValues, $form, $field) ) { $value = $FormValues[$form][$field]; } $sql = 'SELECT Name, ListingTypeId FROM '.TABLE_PREFIX.'ListingTypes ORDER BY Name'; $application =& kApplication::Instance(); $db =& $application->GetADODBConnection(); $options = $db->GetCol($sql, 'ListingTypeId'); if ($objConfig->Get('Link_AllowFreeListings')) { $options = array_merge_recursive2(Array('' => language('lu_free_listing') ), $options); } if (!isset($value)) { list($option_key, $option_title) = each($options); $value = $option_key; } $ret = ''; $tag_params = Array('name' => $params['_render_as']); foreach ($options as $option_key => $option_title) { $tag_params['IsSelected'] = $option_key == $value; $tag_params['ListingTypeId'] = $option_key; $tag_params['ListingTypeName'] = $option_title; $tag_params['IsFree'] = $option_key ? 0 : 1; $tag_params['DetailsLink'] = $application->HREF($params['_moreinfotemplate'], '', Array('listing_type' => $option_key, 'pass' => 'm') ); $ret .= $application->ParseBlock($tag_params); } return $ret; } ?>