+ if( isDebugMode() ) echo 'Item with RID [<b>'.$ResourceId.'</b>] has <b>invalid relation</b> to items with RIDS: <b>'.print_r($idlist, true).'</b><br>';
+ @description: Displays a prompt for a form field
+ @attrib: _Form:: Form name for the field
+ @attrib: _Field:: Field Name
+ @attrib: _LangText:lang: Language var to use for field label
+ @attrib: _plaintext:: Plain text to use for field label (langtext is used by default if both are set)
+ @attrib: _Template:tpl: template used to display the field label (if not set "<inp:form_prompt />" is used
+ @attrib: _ErrorTemplate:tpl: If the field is in an error state (ie missing input) this template is used. Will default to the normal template if not set
+ @description: Generates the ACTTION property for a FORM tag used by In-Portal
+ @attrib: _Template:tpl: If set, this is the template the form submits to (default is the current template)
+ @attrib: _Form:: The form name<br>Possible Values:
+ <UL>
+ <LI>login: user login
+ <LI>logout: user logout
+ <LI>forgotpw: Form to prompt the user for forgotten password information
+ <LI>forgotpw_confirm: confirmation form for forgotpw
+ <LI>suggest: form to suggest the site to a friend
+ <LI>suggest_confirm: form to confirm suggestion of the site to a friend
+ <LI>m_subscribe: form to subscribe to the mailing list
+ <LI>subscribe_confirm: form to confirm subscription to the mailing list
+ <LI>m_unsubscribe: form to unsubscribe from the mailing list
+ <LI>unsubscribe_confirm: form to confirm un-subscription from the mailing list
+ <LI>m_acctinfo: user account information
+ <LI>m_profile: system-level profile information
+ <LI>m_register: New User registration form
+ <LI>m_addcat: Suggest Category form
+ <LI>m_addcat_confirm: Confirmation for add category
+ <LI>m_simplesearch: Perform a simple search
+ <LI>m_simple_subsearch: Search within results
+ <LI>m_adv_searchtype: Form to select type of advanced search
+ <LI>m_adv_subsearch: Advanced Search
+ <LI>m_sort_cats: Sort categories
+ <LI>error_access: form displayed on the access denied template
+ <LI>error_template: Form displayed on the template error page
+ <LI>m_set_theme: Form displayed for theme selection
+ </UL>
+ @attrib: _SubscribeTemplate:tpl: The destination template with "m_subscribe", "subscribe_confirm", "unsubscribe_confirm" _Form actions. Can be reused in other scenarios as programmed.
+ @attrib: _UnSubscribeTemplate:tpl: The destination template for "m_subscribe" _Form action. Can be reused in other scenarios as programmed.
+ @attrib: _ConfirmTemplate:tpl: The destination template for "m_unsubscribe", "suggest" _Form actions. Can be reused in other scenarios as programmed.
+ @attrib: _DestTemplate:tpl: The destination template for "suggest_confirm", "suggest" _Form actions. Can be reused in other scenarios as programmed.
+ @attrib: _ErrorTemplate:tpl: The destination template extensively used in most of _Form actions in case of error.
+ @attrib: _Referer:bool: The destination template will be taken from referer page we can from.
+ @description: List all subcategories a user is allowed to view
+ @attrib: _columns:int: Numver of columns to display the categories in (defaults to 1)
+ @attrib: _maxlistcount:int: Maximum number of categories to list
+ @attrib: _FirstItemTemplate:tpl: Template used for the first category listed
+ @attrib: _LastItemTemplate:tpl: Template used for the last category listed
+ @attrib: _EdItemTemplate:tpl: Editors Pick template used for category list items
+ @attrib: _ItemTemplate:tpl: default template used for category list items
+ @attrib: _NoTable:bool: If set to 1, the categories will not be listed in a table. If a table is used, all HTML attributes are passed to the TABLE tag
+ @description: Used in conjuction with l_list_cats. 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<br>
+ Possible values:<UL>
+ <LI>Category: List links from the current category (default)
+ @description: List all categories matched in a search
+ @attrib: _columns:int: Numver of columns to display the categories in (defaults to 1)
+ @attrib: _maxlistcount:int: Maximum number of categories to list
+ @attrib: _ShortList:bool: If set, the Perpage_Category_Short setting is used instead of Perpage_Category
+ @attrib: _FirstItemTemplate:tpl: Template used for the first category listed
+ @attrib: _LastItemTemplate:tpl: Template used for the last category listed
+ @attrib: _ItemTemplate:tpl: default template used for category list items
+ @attrib: _NoTable:bool: If set to 1, the categories will not be listed in a table. If a table is used, all HTML attributes are passed to the TABLE tag
+ @description: Lists advanced search fields for the selected item type
+ @attrib: _FirstItemTemplate:tpl: Template used for the first field listed
+ @attrib: _LastItemTemplate:tpl: Template used for the last field listed
+ @attrib: _AltLastItemTemplate:tpl: Altername Template used for the last field listed
+ @attrib: _ItemTemplate:tpl: default template used for field list items
+ @attrib: _AltTemplate:tpl: Alternate template used for field list items
+*/
+function m_advsearch_fields($attribs)
+{
+ global $objItemTypes, $objTemplate, $objSearchConfig;
+
+ if(!is_object($objSearchConfig))
+ $objSearchConfig = new clsSearchConfigList();
+
+ if($_GET["Action"]=="m_advsearch_type")
+ {
+ $ItemType = $_POST["itemtype"];
+ }
+ elseif($_GET["Action"]=="m_adv_search")
+ $ItemType = $_GET["type"];
+
+ $o = "";
+ if((int)$ItemType>0)
+ {
+ $Item = $objItemTypes->GetItem($ItemType);
+ if(is_object($Item))
+ {
+ $name = strtolower($Item->Get("ItemName"));
+
+ $table = $Item->Get("SourceTable");
+ //$sql = "SELECT * FROM ".$objSearchConfig->SourceTable." WHERE TableName='$table' AND AdvancedSearch=1 ORDER BY DisplayOrder";
+ $sql = "SELECT sc.* FROM ".$objSearchConfig->SourceTable." AS sc LEFT JOIN ".GetTablePrefix()."CustomField AS cf ON sc.CustomFieldId = cf.CustomFieldId WHERE (TableName='$table' OR ((TableName='".GetTablePrefix()."CustomField' OR TableName='CustomField') AND cf.Type = $ItemType)) AND AdvancedSearch=1 ORDER BY sc.DisplayOrder";
+ @description: returns a text based on user permissions. Text from inside of the tag will be returned if text attributes are not specified and user has permissions to category, or if _NoPerm attribute set to 1 and user doesn't have permissions. Otherwise entire section will be excluded.
+ @attrib: _Text:lang: Template to link to if the user has access
+ @attrib: _PlainText:: This template is used if the user does not have a permission listed in the _perm attribute. If this attirbute is not included and the user does not have access, the "login" template is used.
+ @attrib: _DenyText:lang: Template to link to if the user has access
+ @attrib: _PlainDenyText:: This exact text is used if the user does not have a permission listed in the _perm attribute and _DenyText attribute is not set.
+ @attrib: _perm:: A list of permissions to check. If the user has any of the the permissions in the list, the link will be generated.
+ @attrib: _System:bool: Set this attribute if one of the permissions in the list is a system permission (ie: LOGIN)
+ @attrib: _Category:int: Set the current category to this ID. If not set, the current category is unchanged
+ @attrib: _MatchAllPerms:int: Checks for all listed Permissions to be TRUE. Note: this attribute is rarely used.
+ @attrib: _NoPerm:int: The whole tag will return inner text if user has no permissions and attribute set to 1. Default value is 0.
+ @example: <inp:m_perm_text _Text="!lu_allow_language_tag!" _PlainText="Just a text" _DenyText="!lu_deny_language_tag!" _PlainDenyText="Just a plain text" _Perm="login" _MatchAllPerms="1" _NoPerm="0">Some HTML here!</inp>
+*/
+function m_perm_text($attribs = array())
+{
+ global $var_list, $var_list_update, $m_var_list_update, $objCatList, $objSession;
+ @attrib:CatId:int: Category ID of category, or current category if not set
+ @attrib:_ListItem: Comma-separated list of item types (ie: Link, Topic, Category, News) The items are listed in the order this list provides, then by priority.
+ Each item should have its own template passed in as an attribute (_{ItemType}Template)
+*/
+function m_related_items($attribs)
+{
+ global $objItemTypes, $objCatList, $content_set, $CatRelations;
+ @description: Returns the MetaDescription field for a category, or the system MetaDescription value if the category doesn't have a value for MetaDescription
+ @attrib: _CatId:int: Category to use (The current category is used by default)
+ $sessql = "SELECT DISTINCT(PortalUserId) FROM $stable";
+ if(count($online_friends)>0)
+ {
+ $sql = "SELECT $ftable.ResourceId,$ftable.ItemTypeId, $ptable.PortalUserId FROM $ftable ";
+ $sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND ";
+ $sql .= " $ptable.PortalUserId NOT IN (".implode(",",$online_friends).") AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
+ }
+ else
+ {
+ $sql = "SELECT $ftable.ResourceId,$ftable.ItemTypeId, $ptable.PortalUserId FROM $ftable ";
+ $sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
+ $sessql = "SELECT DISTINCT(PortalUserId) FROM $stable";
+
+ if(count($online_friends)>0)
+ {
+ $sql = "SELECT count($ftable.ResourceId) as ItemCount FROM $ftable ";
+ $sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND ";
+ $sql .= " $ptable.PortalUserId NOT IN (".implode(",",$online_friends).") AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
+ }
+ else
+ {
+ $sql = "SELECT count($ftable.ResourceId) as ItemCount FROM $ftable ";
+ $sql .="INNER JOIN $ptable ON ($ftable.ResourceId=$ptable.ResourceId) WHERE ItemTypeId=6 AND $ftable.PortalUserId = ".$logedin_user; //$u->Data['ResourceId'];
+ }
+ $rs = $ado->Execute($sql);
+ return $rs->fields["ItemCount"];
+ }
+}
+
+/*
+ @description: Returns the number of users the current user has marked as 'friend' today
+ $sql = "SELECT count(*) as c FROM ".GetTablePrefix()."Favorites WHERE ItemTypeId=6 and PortalUserId=".$objSession->Get("PortalUserId")." AND Modified>$today";
+ $rs = $ado->Execute($sql);
+ if($rs && !$rs->EOF)
+ $ret = $rs->fields["c"];
+ return $ret;
+}
+
+/*
+ @description: Returns the number of items in a search result