Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 12:51 AM

in-portal

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
Index: trunk/kernel/include/item.php
===================================================================
--- trunk/kernel/include/item.php (revision 439)
+++ trunk/kernel/include/item.php (revision 440)
@@ -1,980 +1,979 @@
<?php
require_once($pathtoroot."kernel/include/itemreview.php");
require_once($pathtoroot."kernel/include/itemrating.php");
class clsItem extends clsParsedItem
{
- var $type;
- var $Reviews;
- var $Related;
- var $Images;
- var $PrimaryCat;
- var $IsNew = FALSE;
- var $IsHot = FALSE;
- var $IsPop = FALSE;
- var $Keywords;
- var $OpenTagVar;
- var $CloseTagVar;
- var $AdminParser;
- var $CustomFields;
- var $FieldClass;
- var $CustomLoaded=0;
- var $ReviewSortOrder;
- var $ReviewPerPageVar;
-
- function clsItem($FullItem=FALSE)
- {
- $this->clsParsedItem();
- if($FullItem==TRUE)
- {
- $this->Reviews = new clsItemReviewList();
- $this->Related = new clsRelationshipList();
- }
- $this->Images = new clsImageList();
- $this->CustomFields = array();
- $this->FieldClass = new clsCustomFieldList();
- }
-
- function ClearCacheData()
- {
- }
-
- /* item reviews */
- function &GetItemReviews($Page=1)
- {
- $res_id = $this->Get("ResourceId");
- $this->Reviews->itemID=$res_id;
- $this->Reviews->PerPageVar = $this->ReviewPerPageVar;
- $this->Reviews->Page = $Page;
- $this->Reviews->GetReviewList("Status=1",$this->ReviewSortOrder);
- return $this->Reviews;
- }
-
- function ReviewCount($TodayOnly=FALSE)
- {
-
- if(is_numeric($this->Get("CachedReviewsQty")) && !$TodayOnly)
- return (int)$this->Get("CachedReviewsQty");
-
- $this->Reviews->itemID=$this->Get("ResourceId");
- return (int)$this->Reviews->GetItemReviewCount($TodayOnly);
- }
-
- function ReviewsLoaded()
- {
- if($this->Reviews->itemID==$this->Get("ResourceId"))
- {
- return $this->Reviews->ItemCount();
- }
- else
- return 0;
- }
-
- function &AddReview($createdBy,$reviewText,$isPending,$ip=NULL,$ForceIP=0, $Module="")
- {
- $this->Reviews->itemID=$this->Get("ResourceId");
- if($ip == NULL)
- $ip = $_SERVER["REMOTE_ADDR"];
-
- $CreatedOn = mktime(0,0,0,adodb_date("m"),adodb_date("d"),adodb_date("Y"));
- $Status=1;
- if($isPending)
- $Status=2;
-
- $AutoModule = GetModuleByAction(); // determine module name by action
- if( $Module && ($AutoModule != $Module) ) $AutoModule = $Module;
-
- $r = $this->Reviews->AddReview($CreatedOn,$reviewText,$Status,$ip,0,$this->Get("ResourceId"),$this->type,$createdBy,0,$AutoModule);
- $this->Increment("CachedReviewsQty");
- return $r;
- }
-
- function ReviewIPExists($ip)
- {
- return ip_exists($ip,$this->Get("ResourceId"),$this->Reviews->SourceTable);
- }
-
- function DeleteReview($reviewID)
- {
- $r = $this->Reviews->GetReview($reviewID);
- if(is_object($r))
- {
- $r->Delete();
- $this->Decrement("CachedReviewsQty");
- }
- }
-
- function DeleteReviews()
- {
- $res_id = $this->Get("ResourceId");
- if($res_id)
- {
- $sql = "DELETE FROM ".GetTablePrefix()."ItemReview WHERE ResourceId=$res_id";
- $this->adodbConnection->Execute($sql);
- unset($this->Reviews);
- $this->Reviews = new clsItemReviewList($res_id);
- }
- }
-
- /* item custom fields */
-
- function LoadCustomFields()
- {
- if(!$this->CustomLoaded && $this->Get("ResourceId")>0)
- {
- $this->FieldClass = new clsCustomFieldList();
- $this->FieldClass->Type = $this->type;
- $this->FieldClass->LoadFieldsAndValues($this->Get("ResourceId"));
- foreach($this->FieldClass->Items as $f)
- {
- $this->CustomFields[$f->Get("FieldName")] = $f->HasField('Value') ? $f->Get('Value') : '';
- }
- $this->CustomLoaded = 1;
- }
- }
-
- function SetCustomField($fieldname,$value)
- {
- // echo "Setting CF [<b>$fieldname</b>] = [$value]<br>";
- if(!$this->CustomLoaded)
- $this->LoadCustomFields();
- $this->CustomFields[$fieldname] = $value;
- }
-
- function SaveCustomFields()
- {
- //echo "Saving CFs<br>";
- if(!(int)$this->Get("ResourceId"))
- return TRUE;
-
- if(!$this->CustomLoaded)
- return TRUE;
-
- $data = new clsCustomDataList();
- $data->LoadResource($this->Get("ResourceId"));
- foreach($this->FieldClass->Items as $f)
- {
- $value = $this->CustomFields[$f->Get("FieldName")];
- $data->SetFieldValue($f->Get("CustomFieldId"),$this->Get("ResourceId"),$value);
- }
- $data->SaveData();
- unset($data);
- }
-
- function GetCustomFieldValue($fieldname,$default="")
- {
- if(!$this->CustomLoaded)
- $this->LoadCustomFields();
- if(isset($this->CustomFields[$fieldname]))
- {
- $ret = $this->CustomFields[$fieldname];
- }
- else
- $ret = $default;
- return $ret;
- }
-
-
- function DeleteCustomData()
- {
- $cdata = new clsCustomDataList();
- $cdata->DeleteResource($this->Get("ResourceId"));
- }
-
- function Delete($RecordOnly=FALSE)
- {
- global $objFavorites;
-
- if($RecordOnly==FALSE)
- {
- $this->DeleteReviews();
- $this->DeleteRelations();
- $this->DeleteCustomData();
- if($this->NoResourceId==0)
- {
- if($this->UsingTempTable()==FALSE)
- {
- if(is_object($this->Images))
- $this->Images->DeleteResource($this->Get("ResourceId"));
- $objFavorites->DeleteItem($this->Get("ResourceId"));
- }
- }
- }
- parent::Delete();
- }
-
- /* item relationships */
- function GetRelatedItems()
- {
- global $objConfig;
-
- $where = "SourceId = ".$this->Get("ResourceId");
- $where .= " OR (TargetId=".$this->Get("ResourceId")." AND Type=1)";
- $orderBy = $objConfig->Get("Relation_Sortfield")." ".$objConfig->Get("Relation_Sortorder");
- $orderBy = trim($orderBy);
- $this->Related->Clear();
- $res = $this->Related->LoadRelated($where,$orderBy);
- return $res;
- }
-
- function &RelationObject()
- {
- return $this->Related;
- }
-
- function DeleteRelations()
- {
- $res_id = $this->Get("ResourceId");
- if($res_id)
- {
- $sql = "DELETE FROM ".GetTablePrefix()."Relationship WHERE SourceId=$res_id OR TargetId=$res_id";
- $this->adodbConnection->Execute($sql);
- unset($this->Reviews);
- $this->Related = new clsRelationshipList($res_id);
- }
- }
-
-
- /* keyword highlighting for searches */
-
- function HighlightField($field)
- {
- global $objConfig;
-
- if(/*!strlen($OpenTag) || !strlen($CloseTag) ||*/ !is_array($this->Keywords))
- {
- //echo "Missing something<br>\n";
- return $this->Get($field);
- }
-
- if(strlen($this->OpenTagVar))
- $OpenTag = $objConfig->Get($this->OpenTagVar);
- if(strlen($this->CloseTagVar))
- $CloseTag = $objConfig->Get($this->CloseTagVar);
-
- $k = array_merge($this->Keywords["required"],$this->Keywords["normal"]);
- if(count($k))
- {
- $result = HighlightKeywords($k, $this->Get($field), $OpenTag, $CloseTag);
- }
- else
- {
- $result = $this->Get($field);
- //echo "No Keywords<br>\n";
- }
- return $result;
- }
-
- function HighlightText($text)
- {
- global $objConfig;
-
- if(strlen($this->OpenTagVar))
- $OpenTag = $objConfig->Get($this->OpenTagVar);
- if(strlen($this->CloseTagVar))
- $CloseTag = $objConfig->Get($this->CloseTagVar);
-
- if(!strlen($OpenTag) || !strlen($CloseTag) || !is_array($this->Keywords)) {
- return $text;
- }
- $k = array_merge($this->Keywords["required"],$this->Keywords["normal"]);
- if(count($k))
- {
- $result = HighlightKeywords($k,$text, $OpenTag, $CloseTag);
- }
- else
- $result = $text;
-
- return $result;
- }
-
- /* item status functions */
-
- function Is($name)
- {
- $var = "m_" . $name;
- return ( isset($this->$var) && $this->$var ) ? true : false;
- }
-
- function IsHotItem()
- {
- switch($this->Get("HotItem"))
- {
- case ALWAYS:
- return TRUE;
- break;
- case NEVER:
- return FALSE;
- break;
- case AUTO:
- return $this->IsHot;
- break;
- }
- }
-
- function SetHotItem()
- {
- $this->IsHot = FALSE;
- }
-
- function IsNewItem()
- {
- switch($this->Get("NewItem"))
- {
- case ALWAYS:
- return TRUE;
- break;
- case NEVER:
- return FALSE;
- break;
- case AUTO:
- return $this->IsNew;
- break;
- }
- }
-
- function SetNewItem()
- {
- $this->IsNew = FALSE;
- }
-
- function IsPopItem()
- {
- switch($this->Get("PopItem"))
- {
- case ALWAYS:
- return TRUE;
- break;
- case NEVER:
- return FALSE;
- break;
- case AUTO:
- return $this->IsPop;
- break;
- }
- }
-
- function SetPopItem()
- {
- $this->IsPop = FALSE;
- }
-
- function SetFromArray($data, $dirty = false)
- {
- parent::SetFromArray($data, $dirty);
- if(is_array($data))
- {
- if(array_key_exists("NewItem",$data))
- {
- $this->SetNewItem();
- }
- if(array_key_exists("HotItem",$data))
- {
- $this->SetHotItem();
- }
- if(array_key_exists("PopItem",$data))
- {
- $this->SetPopItem();
- }
- }
- }
-
- function Validate()
- {
- /* skeleton*/
- return true;
- }
-
- function LoadFromDatabase($Id, $IdField = null) // custom IdField by Alex)
- {
- /* skeleton */
- parent::LoadFromDatabase($Id, $IdField);
- }
-
-
-
- //Changes priority
- function MoveDown()
- {
- $this->Decrement("Priority");
- }
-
- function MoveUp()
- {
- $this->Increment("Priority");
- }
-
- function CheckPermission($permissionName)
- {
- //Check permission and if needs approval set approval
- global $objSession,$objCatList;
-
- $perm = $this->BasePermission;
- if(strlen($perm)>0)
- $perm .= ".";
- $perm .= $permissionName;
-
- //get an instance of the forum category
- $cat =& $objCatList->GetCategory($this->Get("CategoryId"));
- if(!is_object($cat))
- {
- return FALSE;
- }
- else
- {
- return ($cat->HasPermission($perm,$objSession->Get("GroupId")));
- }
- }
-
- function SubmitVote($voteRating, $voteNotes)
- {
- global $Errors;
- global $REMOTE_ADDR;
-
- if($this->rating_ip_exists($REMOTE_ADDR))
- {
-// $Errors->AddError("error.already_voted","","","",get_class($this),"SubmitVote");
- return false;
- }
- $vote = new clsItemRating(NULL);
- $vote->Set("ItemId",$this->UniqueId());
- $vote->Set("RatingValue",$voteRating);
- if(!$vote->Create())
- return false;
-
- $NumVotes = (int)$this->Get("CachedVotesQty");
- $CurrentRating = (int)$this->Get("CachedRating");
-
- $Rating = (($NumVotes * $CurrentRating) + $voteRating)/($NumVotes+1);
- $this->Set("CachedRating",$Rating);
- $this->Update();
- $this->Increment("CachedVotesQty");
- }
-
- function rating_ip_exists($ip)
- {
- $count = 0;
- $id = $this->Get("ResourceId");
- $sql = "SELECT count(*) as DupCount FROM ItemRating WHERE IPAddress='$ip' and ItemId=$id";
- $adodbConnection = GetADODBConnection();
- $rs = $adodbConnection->Execute($sql);
- if($rs)
- {
- $count = $rs->fields["DupCount"];
- }
- return ($count>0);
- //return FALSE;
- }
-
- function PurgeRatings()
- {
- global $objConfig;
-
- $expired=time()-86400*$objConfig->Get("Timeout_Rating");
- $query="DELETE FROM ItemRating WHERE CreatedOn<$expired";
- $this->adodbConnection->Execute($query);
- }
-
- function GetThumbnailImage()
- {
- if($this->Images->NumItems()==0)
- $this->Images->GetResourceImages($this->Get("ResourceId"));
- return $this->Images->GetResourceThumbnail($this->Get("ResourceId"));
- }
-
- function GetImage($number)
- {
- return $this->Images->GetImageByResource($this->Get("ResourceId"),$number);
- }
-
- function GetImageByName($name)
- {
- if(!is_object($this->Images))
- $this->Images = new clsImageList();
- return $this->Images->GetImageByName($this->Get("ResourceId"),$name);
- }
-
- function &GetDefaultImage()
- {
- return $this->Images->GetDefaultImage($this->Get("ResourceId"));
- }
-
- function CreatePendingCopy()
- {
- $OrgId = $this->IdField();
- $this->Dirty();
- $this->Set("OrgId",$OrgId);
- $this->UnsetIdField();
- $this->Set("ResourceId",0);
- $this->Set("Status",-2);
- $this->Create();
- }
-
- function AddFavorite($PortalUserId=NULL)
- {
- global $objSession, $objFavorites;
-
- $res = FALSE;
- if($objSession->HasCatPermission("FAVORITES"))
- {
- if(!$PortalUserId)
- $PortalUserId = $objSession->Get("PortalUserId");
- if($PortalUserId==$objSession->Get("PortalUserId") || $objSession->HasSystemPermission("ADMIN"))
- {
- $objFavorites->AddFavorite($PortalUserId,$this->Get("ResourceId"), $this->type);
- $res = TRUE;
- }
- }
- return $res;
- }
-
- function DeleteFavorite($PortalUserId=NULL)
- {
- global $objSession, $objFavorites;
-
- $res = FALSE;
-
- if($objSession->HasCatPermission("FAVORITES"))
- {
- if(!$PortalUserId)
- $PortalUserId = $objSession->Get("PortalUserId");
- //echo $PortalUserId." ".$objSession->Get("PortalUserId");
- if($PortalUserId==$objSession->Get("PortalUserId") || $objSession->HasSystemPermission("ADMIN"))
- {
- $objFavorites->DeleteFavorite($PortalUserId,$this->Get("ResourceId"));
- $res = TRUE;
- }
- }
- return $res;
- }
-
- function IsFavorite($PortalUserId=NULL)
- {
- global $objSession, $objFavorites;
-
- $res = FALSE;
-
-
- if($objSession->HasCatPermission("FAVORITES"))
- {
- if(!$PortalUserId)
- $PortalUserId = $objSession->Get("PortalUserId");
-
- if($PortalUserId==$objSession->Get("PortalUserId") || $objSession->HasSystemPermission("ADMIN"))
- {
- $i = $objFavorites->GetFavoriteObject($PortalUserId,$this->Get("ResourceId"));
-
- if(is_object($i))
- {
- $res = TRUE;
- }
- else
- $res = FALSE;
- }
- }
-
- return $res;
- }
+ var $type;
+ var $Reviews;
+ var $Related;
+ var $Images;
+ var $PrimaryCat;
+ var $IsNew = FALSE;
+ var $IsHot = FALSE;
+ var $IsPop = FALSE;
+ var $Keywords;
+ var $OpenTagVar;
+ var $CloseTagVar;
+ var $AdminParser;
+ var $CustomFields;
+ var $FieldClass;
+ var $CustomLoaded=0;
+ var $ReviewSortOrder;
+ var $ReviewPerPageVar;
+
+ function clsItem($FullItem=FALSE)
+ {
+ $this->clsParsedItem();
+ if($FullItem==TRUE)
+ {
+ $this->Reviews = new clsItemReviewList();
+ $this->Related = new clsRelationshipList();
+ }
+ $this->Images = new clsImageList();
+ $this->CustomFields = array();
+ $this->FieldClass = new clsCustomFieldList();
+ }
+
+ function ClearCacheData()
+ {
+ }
+
+ /* item reviews */
+ function &GetItemReviews($Page=1)
+ {
+ $res_id = $this->Get("ResourceId");
+ $this->Reviews->itemID=$res_id;
+ $this->Reviews->PerPageVar = $this->ReviewPerPageVar;
+ $this->Reviews->Page = $Page;
+ $this->Reviews->GetReviewList("Status=1",$this->ReviewSortOrder);
+ return $this->Reviews;
+ }
+
+ function ReviewCount($TodayOnly=FALSE)
+ {
+
+ if(is_numeric($this->Get("CachedReviewsQty")) && !$TodayOnly)
+ return (int)$this->Get("CachedReviewsQty");
+
+ $this->Reviews->itemID=$this->Get("ResourceId");
+ return (int)$this->Reviews->GetItemReviewCount($TodayOnly);
+ }
+
+ function ReviewsLoaded()
+ {
+ if($this->Reviews->itemID==$this->Get("ResourceId"))
+ {
+ return $this->Reviews->ItemCount();
+ }
+ else
+ return 0;
+ }
+
+ function &AddReview($createdBy,$reviewText,$isPending,$ip=NULL,$ForceIP=0, $Module="", $CreatedOn = 0)
+ {
+ $this->Reviews->itemID=$this->Get("ResourceId");
+ if($ip == NULL)
+ $ip = $_SERVER["REMOTE_ADDR"];
+
+ if(!$CreatedOn)
+ $CreatedOn = mktime(0,0,0,adodb_date("m"),adodb_date("d"),adodb_date("Y"));
+ $Status = 1;
+ if($isPending)
+ $Status = 2;
+
+ $AutoModule = GetModuleByAction(); // determine module name by action
+ if( $Module && ($AutoModule != $Module) ) $AutoModule = $Module;
+
+ $r = $this->Reviews->AddReview($CreatedOn,$reviewText,$Status,$ip,0,$this->Get("ResourceId"),$this->type,$createdBy,0,$AutoModule);
+ $this->Increment("CachedReviewsQty");
+ return $r;
+ }
+
+ function ReviewIPExists($ip)
+ {
+ return ip_exists($ip,$this->Get("ResourceId"),$this->Reviews->SourceTable);
+ }
+
+ function DeleteReview($reviewID)
+ {
+ $r = $this->Reviews->GetReview($reviewID);
+ if(is_object($r))
+ {
+ $r->Delete();
+ $this->Decrement("CachedReviewsQty");
+ }
+ }
+
+ function DeleteReviews()
+ {
+ $res_id = $this->Get("ResourceId");
+ if($res_id)
+ {
+ $sql = "DELETE FROM ".GetTablePrefix()."ItemReview WHERE ResourceId=$res_id";
+ $this->adodbConnection->Execute($sql);
+ unset($this->Reviews);
+ $this->Reviews = new clsItemReviewList($res_id);
+ }
+ }
+
+ /* item custom fields */
+
+ function LoadCustomFields()
+ {
+ if(!$this->CustomLoaded && $this->Get("ResourceId")>0)
+ {
+ $this->FieldClass = new clsCustomFieldList();
+ $this->FieldClass->Type = $this->type;
+ $this->FieldClass->LoadFieldsAndValues($this->Get("ResourceId"));
+ foreach($this->FieldClass->Items as $f)
+ {
+ $this->CustomFields[$f->Get("FieldName")] = $f->HasField('Value') ? $f->Get('Value') : '';
+ }
+ $this->CustomLoaded = 1;
+ }
+ }
+
+ function SetCustomField($fieldname,$value)
+ {
+ // echo "Setting CF [<b>$fieldname</b>] = [$value]<br>";
+ if(!$this->CustomLoaded)
+ $this->LoadCustomFields();
+ $this->CustomFields[$fieldname] = $value;
+ }
+
+ function SaveCustomFields()
+ {
+ //echo "Saving CFs<br>";
+ if(!(int)$this->Get("ResourceId"))
+ return TRUE;
+
+ if(!$this->CustomLoaded)
+ return TRUE;
+
+ $data = new clsCustomDataList();
+ $data->LoadResource($this->Get("ResourceId"));
+ foreach($this->FieldClass->Items as $f)
+ {
+ $value = $this->CustomFields[$f->Get("FieldName")];
+ $data->SetFieldValue($f->Get("CustomFieldId"),$this->Get("ResourceId"),$value);
+ }
+ $data->SaveData();
+ unset($data);
+ }
+
+ function GetCustomFieldValue($fieldname,$default="")
+ {
+ if(!$this->CustomLoaded)
+ $this->LoadCustomFields();
+ if(isset($this->CustomFields[$fieldname]))
+ {
+ $ret = $this->CustomFields[$fieldname];
+ }
+ else
+ $ret = $default;
+ return $ret;
+ }
+
+
+ function DeleteCustomData()
+ {
+ $cdata = new clsCustomDataList();
+ $cdata->DeleteResource($this->Get("ResourceId"));
+ }
+
+ function Delete($RecordOnly=FALSE)
+ {
+ global $objFavorites;
+
+ if($RecordOnly==FALSE)
+ {
+ $this->DeleteReviews();
+ $this->DeleteRelations();
+ $this->DeleteCustomData();
+ if($this->NoResourceId==0)
+ {
+ if($this->UsingTempTable()==FALSE)
+ {
+ if(is_object($this->Images))
+ $this->Images->DeleteResource($this->Get("ResourceId"));
+ $objFavorites->DeleteItem($this->Get("ResourceId"));
+ }
+ }
+ }
+ parent::Delete();
+ }
+
+ /* item relationships */
+ function GetRelatedItems()
+ {
+ global $objConfig;
+
+ $where = "SourceId = ".$this->Get("ResourceId");
+ $where .= " OR (TargetId=".$this->Get("ResourceId")." AND Type=1)";
+ $orderBy = $objConfig->Get("Relation_Sortfield")." ".$objConfig->Get("Relation_Sortorder");
+ $orderBy = trim($orderBy);
+ $this->Related->Clear();
+ $res = $this->Related->LoadRelated($where,$orderBy);
+ return $res;
+ }
+
+ function &RelationObject()
+ {
+ return $this->Related;
+ }
+
+ function DeleteRelations()
+ {
+ $res_id = $this->Get("ResourceId");
+ if($res_id)
+ {
+ $sql = "DELETE FROM ".GetTablePrefix()."Relationship WHERE SourceId=$res_id OR TargetId=$res_id";
+ $this->adodbConnection->Execute($sql);
+ unset($this->Reviews);
+ $this->Related = new clsRelationshipList($res_id);
+ }
+ }
+
+
+ /* keyword highlighting for searches */
+
+ function HighlightField($field)
+ {
+ global $objConfig;
+
+ if(/*!strlen($OpenTag) || !strlen($CloseTag) ||*/ !is_array($this->Keywords))
+ {
+ //echo "Missing something<br>\n";
+ return $this->Get($field);
+ }
+
+ if(strlen($this->OpenTagVar))
+ $OpenTag = $objConfig->Get($this->OpenTagVar);
+ if(strlen($this->CloseTagVar))
+ $CloseTag = $objConfig->Get($this->CloseTagVar);
+
+ $k = array_merge($this->Keywords["required"],$this->Keywords["normal"]);
+ if(count($k))
+ {
+ $result = HighlightKeywords($k, $this->Get($field), $OpenTag, $CloseTag);
+ }
+ else
+ {
+ $result = $this->Get($field);
+ //echo "No Keywords<br>\n";
+ }
+ return $result;
+ }
- function CheckBanned()
- {
- global $objBanList;
-
- $objBanList->LoadItemRules($this->type);
- $found = FALSE;
- $MatchedRule = 0;
- foreach($objBanList->Items as $b)
- {
- $field = $b->Get("ItemField");
- if($this->FieldExists($field))
- {
- $ThisValue = strtolower($this->Get($field));
- $TestValue = strtolower($b->Get("ItemValue"));
- switch($b->Get("ItemVerb"))
- {
- case 0: /* any */
- $found = TRUE;
- break;
- case 1: /* is */
- if($ThisValue==$TestValue)
- $found = TRUE;
- break;
- case 2: /* is not */
- if($ThisValue != $TestValue)
- $found = TRUE;
- break;
- case 3: /* contains */
- if(strstr($ThisValue,$TestValue))
- $found = TRUE;
- break;
- case 4: /* not contains */
- if(!strstr($ThisValue,$TestValue))
- $found = TRUE;
- break;
- case 5: /* Greater Than */
- if($TestValue > $ThisValue)
- $found = TRUE;
- break;
- case 6: /* Less Than */
- if($TestValue < $ThisValue)
- $found = TRUE;
- break;
- case 7: /* exists */
- if(strlen($ThisValue)>0)
- $found = TRUE;
- break;
- case 8: /* unique */
- if($this->ValueExists($field,$ThisValue))
- $found = TRUE;
- break;
- }
- }
- if($found)
- {
- if($b->Get("RuleType")==0)
- {
- $MatchedRule = $b->Get("RuleId");
- }
- else
- {
- $MatchedRule = 0;
- }
- break;
- }
- }
- return $MatchedRule;
- }
+ function HighlightText($text)
+ {
+ global $objConfig;
+
+ if(strlen($this->OpenTagVar))
+ $OpenTag = $objConfig->Get($this->OpenTagVar);
+ if(strlen($this->CloseTagVar))
+ $CloseTag = $objConfig->Get($this->CloseTagVar);
+
+ if(!strlen($OpenTag) || !strlen($CloseTag) || !is_array($this->Keywords)) {
+ return $text;
+ }
+ $k = array_merge($this->Keywords["required"],$this->Keywords["normal"]);
+ if(count($k))
+ {
+ $result = HighlightKeywords($k,$text, $OpenTag, $CloseTag);
+ }
+ else
+ $result = $text;
+
+ return $result;
+ }
+
+ /* item status functions */
+
+ function Is($name)
+ {
+ $var = "m_" . $name;
+ return ( isset($this->$var) && $this->$var ) ? true : false;
+ }
+
+ function IsHotItem()
+ {
+ switch($this->Get("HotItem"))
+ {
+ case ALWAYS:
+ return TRUE;
+ break;
+ case NEVER:
+ return FALSE;
+ break;
+ case AUTO:
+ return $this->IsHot;
+ break;
+ }
+ }
+
+ function SetHotItem()
+ {
+ $this->IsHot = FALSE;
+ }
+
+ function IsNewItem()
+ {
+ switch($this->Get("NewItem"))
+ {
+ case ALWAYS:
+ return TRUE;
+ break;
+ case NEVER:
+ return FALSE;
+ break;
+ case AUTO:
+ return $this->IsNew;
+ break;
+ }
+ }
+
+ function SetNewItem()
+ {
+ $this->IsNew = FALSE;
+ }
+
+ function IsPopItem()
+ {
+ switch($this->Get("PopItem"))
+ {
+ case ALWAYS:
+ return TRUE;
+ break;
+ case NEVER:
+ return FALSE;
+ break;
+ case AUTO:
+ return $this->IsPop;
+ break;
+ }
+ }
+
+ function SetPopItem()
+ {
+ $this->IsPop = FALSE;
+ }
+
+ function SetFromArray($data, $dirty = false)
+ {
+ parent::SetFromArray($data, $dirty);
+ if(is_array($data))
+ {
+ if(array_key_exists("NewItem",$data))
+ {
+ $this->SetNewItem();
+ }
+ if(array_key_exists("HotItem",$data))
+ {
+ $this->SetHotItem();
+ }
+ if(array_key_exists("PopItem",$data))
+ {
+ $this->SetPopItem();
+ }
+ }
+ }
+
+ function Validate()
+ {
+ /* skeleton*/
+ return true;
+ }
+
+ function LoadFromDatabase($Id, $IdField = null) // custom IdField by Alex)
+ {
+ /* skeleton */
+ parent::LoadFromDatabase($Id, $IdField);
+ }
+
+
+
+ //Changes priority
+ function MoveDown()
+ {
+ $this->Decrement("Priority");
+ }
+
+ function MoveUp()
+ {
+ $this->Increment("Priority");
+ }
+
+ function CheckPermission($permissionName)
+ {
+ //Check permission and if needs approval set approval
+ global $objSession,$objCatList;
+
+ $perm = $this->BasePermission;
+ if(strlen($perm)>0)
+ $perm .= ".";
+ $perm .= $permissionName;
+
+ //get an instance of the forum category
+ $cat =& $objCatList->GetCategory($this->Get("CategoryId"));
+ if(!is_object($cat))
+ {
+ return FALSE;
+ }
+ else
+ {
+ return ($cat->HasPermission($perm,$objSession->Get("GroupId")));
+ }
+ }
+
+ function SubmitVote($voteRating, $voteNotes)
+ {
+ global $Errors;
+ global $REMOTE_ADDR;
+
+ if($this->rating_ip_exists($REMOTE_ADDR))
+ {
+ // $Errors->AddError("error.already_voted","","","",get_class($this),"SubmitVote");
+ return false;
+ }
+ $vote = new clsItemRating(NULL);
+ $vote->Set("ItemId",$this->UniqueId());
+ $vote->Set("RatingValue",$voteRating);
+ if(!$vote->Create())
+ return false;
+
+ $NumVotes = (int)$this->Get("CachedVotesQty");
+ $CurrentRating = (int)$this->Get("CachedRating");
+
+ $Rating = (($NumVotes * $CurrentRating) + $voteRating)/($NumVotes+1);
+ $this->Set("CachedRating",$Rating);
+ $this->Update();
+ $this->Increment("CachedVotesQty");
+ }
+
+ function rating_ip_exists($ip)
+ {
+ $count = 0;
+ $id = $this->Get("ResourceId");
+ $sql = "SELECT count(*) as DupCount FROM ItemRating WHERE IPAddress='$ip' and ItemId=$id";
+ $adodbConnection = GetADODBConnection();
+ $rs = $adodbConnection->Execute($sql);
+ if($rs)
+ {
+ $count = $rs->fields["DupCount"];
+ }
+ return ($count>0);
+ //return FALSE;
+ }
+
+ function PurgeRatings()
+ {
+ global $objConfig;
+
+ $expired=time()-86400*$objConfig->Get("Timeout_Rating");
+ $query="DELETE FROM ItemRating WHERE CreatedOn<$expired";
+ $this->adodbConnection->Execute($query);
+ }
+
+ function GetThumbnailImage()
+ {
+ if($this->Images->NumItems()==0)
+ $this->Images->GetResourceImages($this->Get("ResourceId"));
+ return $this->Images->GetResourceThumbnail($this->Get("ResourceId"));
+ }
+
+ function GetImage($number)
+ {
+ return $this->Images->GetImageByResource($this->Get("ResourceId"),$number);
+ }
+
+ function GetImageByName($name)
+ {
+ if(!is_object($this->Images))
+ $this->Images = new clsImageList();
+ return $this->Images->GetImageByName($this->Get("ResourceId"),$name);
+ }
+
+ function &GetDefaultImage()
+ {
+ return $this->Images->GetDefaultImage($this->Get("ResourceId"));
+ }
+
+ function CreatePendingCopy()
+ {
+ $OrgId = $this->IdField();
+ $this->Dirty();
+ $this->Set("OrgId",$OrgId);
+ $this->UnsetIdField();
+ $this->Set("ResourceId",0);
+ $this->Set("Status",-2);
+ $this->Create();
+ }
+
+ function AddFavorite($PortalUserId=NULL)
+ {
+ global $objSession, $objFavorites;
+
+ $res = FALSE;
+ if($objSession->HasCatPermission("FAVORITES"))
+ {
+ if(!$PortalUserId)
+ $PortalUserId = $objSession->Get("PortalUserId");
+ if($PortalUserId==$objSession->Get("PortalUserId") || $objSession->HasSystemPermission("ADMIN"))
+ {
+ $objFavorites->AddFavorite($PortalUserId,$this->Get("ResourceId"), $this->type);
+ $res = TRUE;
+ }
+ }
+ return $res;
+ }
+
+ function DeleteFavorite($PortalUserId=NULL)
+ {
+ global $objSession, $objFavorites;
+
+ $res = FALSE;
+
+ if($objSession->HasCatPermission("FAVORITES"))
+ {
+ if(!$PortalUserId)
+ $PortalUserId = $objSession->Get("PortalUserId");
+ //echo $PortalUserId." ".$objSession->Get("PortalUserId");
+ if($PortalUserId==$objSession->Get("PortalUserId") || $objSession->HasSystemPermission("ADMIN"))
+ {
+ $objFavorites->DeleteFavorite($PortalUserId,$this->Get("ResourceId"));
+ $res = TRUE;
+ }
+ }
+ return $res;
+ }
+
+ function IsFavorite($PortalUserId=NULL)
+ {
+ global $objSession, $objFavorites;
+
+ $res = FALSE;
+
+
+ if($objSession->HasCatPermission("FAVORITES"))
+ {
+ if(!$PortalUserId)
+ $PortalUserId = $objSession->Get("PortalUserId");
+
+ if($PortalUserId==$objSession->Get("PortalUserId") || $objSession->HasSystemPermission("ADMIN"))
+ {
+ $i = $objFavorites->GetFavoriteObject($PortalUserId,$this->Get("ResourceId"));
+
+ if(is_object($i))
+ {
+ $res = TRUE;
+ }
+ else
+ $res = FALSE;
+ }
+ }
+
+ return $res;
+ }
+
+ function CheckBanned()
+ {
+ global $objBanList;
+
+ $objBanList->LoadItemRules($this->type);
+ $found = FALSE;
+ $MatchedRule = 0;
+ foreach($objBanList->Items as $b)
+ {
+ $field = $b->Get("ItemField");
+ if($this->FieldExists($field))
+ {
+ $ThisValue = strtolower($this->Get($field));
+ $TestValue = strtolower($b->Get("ItemValue"));
+ switch($b->Get("ItemVerb"))
+ {
+ case 0: /* any */
+ $found = TRUE;
+ break;
+ case 1: /* is */
+ if($ThisValue==$TestValue)
+ $found = TRUE;
+ break;
+ case 2: /* is not */
+ if($ThisValue != $TestValue)
+ $found = TRUE;
+ break;
+ case 3: /* contains */
+ if(strstr($ThisValue,$TestValue))
+ $found = TRUE;
+ break;
+ case 4: /* not contains */
+ if(!strstr($ThisValue,$TestValue))
+ $found = TRUE;
+ break;
+ case 5: /* Greater Than */
+ if($TestValue > $ThisValue)
+ $found = TRUE;
+ break;
+ case 6: /* Less Than */
+ if($TestValue < $ThisValue)
+ $found = TRUE;
+ break;
+ case 7: /* exists */
+ if(strlen($ThisValue)>0)
+ $found = TRUE;
+ break;
+ case 8: /* unique */
+ if($this->ValueExists($field,$ThisValue))
+ $found = TRUE;
+ break;
+ }
+ }
+ if($found)
+ {
+ if($b->Get("RuleType")==0)
+ {
+ $MatchedRule = $b->Get("RuleId");
+ }
+ else
+ {
+ $MatchedRule = 0;
+ }
+ break;
+ }
+ }
+ return $MatchedRule;
+ }
} /* clsItem */
-class clsCatItem extends clsItem
+class clsCatItem extends clsItem
{
function clsCatItem($FullItem=FALSE)
{
$this->clsItem($FullItem);
}
-
- function Delete($RecordOnly=FALSE)
- {
- global $objFavorites;
-
- parent::Delete($RecordOnly);
- if($RecordOnly==FALSE)
- {
- $this->RemoveFromAllCategories();
- }
- }
- /* category membership functions */
-
- function AssignPrimaryCategory($SourceTable)
- {
- $catid = 0;
- $sql = "SELECT * FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId")." LIMIT 1";
- $rs = $this->adodbConnection->Execute($sql);
- if($rs && !$rs->EOF)
- {
- $catid = $rs->fields["CategoryId"];
- $this->SetPrimaryCategory($catid,$SourceTable);
- }
- return $catid;
- }
-
- function GetPrimaryCategory($SourceTable = "")
- {
- if(is_numeric($this->PrimaryCat))
- return $this->PrimaryCat;
-
- $this->PrimaryCat="";
- if( strlen($SourceTable) == 0 ) $SourceTable = GetTablePrefix()."CategoryItems";
- $res_id = $this->HasField('ResourceId') ? $this->Get('ResourceId') : 0;
- $sql = "SELECT * FROM $SourceTable WHERE ItemResourceId=".$res_id." AND PrimaryCat=1";
- $rs = $this->adodbConnection->Execute($sql);
- if($rs && !$rs->EOF)
- {
- $this->PrimaryCat=$rs->fields["CategoryId"];
- return $this->PrimaryCat;
- }
- else
- {
- $this->AssignPrimaryCategory($SourceTable);
- return $this->PrimaryCat;
- }
- }
-
- function SetPrimaryCategory($CategoryId,$SourceTable = "")
- {
- if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- $rs = $this->adodbConnection->Execute('SELECT * FROM '.$SourceTable.' WHERE CategoryId='.$CategoryId.' AND ItemResourceId='.$this->Get("ResourceId"));
- $this->adodbConnection->Execute("UPDATE $SourceTable SET PrimaryCat=0 WHERE ItemResourceId=".$this->Get("ResourceId"));
- $this->adodbConnection->Execute("UPDATE $SourceTable SET PrimaryCat=1 WHERE CategoryId=$CategoryId AND ItemResourceId=".$this->Get("ResourceId"));
-
- $this->PrimaryCat=$CategoryId;
- }
-
- function CategoryMemberCount($SourceTable="")
- {
- if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- $sql = "SELECT count(*) as CatCount FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId");
- if($this->debuglevel)
- echo $sql."<br>\n";
-
- $rs = $this->adodbConnection->Execute($sql);
- $count = 0;
- if($rs && !$rs->EOF)
- $count = $rs->fields["CatCount"];
- return $count;
- }
-
- function CategoryMemberList($SourceTable="")
- {
- $cats = array();
- if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- $sql = "SELECT * FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId");
-
- if($this->debuglevel)
- echo $sql."<br>\n";
-
- $rs = $this->adodbConnection->Execute($sql);
- while($rs && !$rs->EOF)
- {
- $cats[] = $rs->fields["CategoryId"];
- $rs->MoveNext();
- }
- $catlist = implode(",",$cats);
- return $catlist;
- }
-
- function AddToCategory($CatId,$SourceTable="",$PrimaryValue=NULL)
- {
- global $objSession, $objCatList;
-
- if(!$SourceTable)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- if($this->type>0)
- {
- $Primary = 0;
- if(is_numeric($PrimaryValue))
- {
- $Primary = $PrimaryValue;
- if($Primary==1)
- $this->PrimaryCat = $CatId;
- }
- else
- {
- if(!is_numeric($this->GetPrimaryCategory()))
- {
- $Primary =1;
- $this->PrimaryCat = $CatId;
- }
- }
-
- // check if not exists
-
- $db =& $this->adodbConnection;
- $sql = sprintf('SELECT * FROM %s WHERE CategoryId = %s AND ItemResourceId = %s', $SourceTable, $CatId, $this->Get("ResourceId"));
- $rs = $db->Execute($sql);
-
- if (is_object($rs)) {
- if($rs->RecordCount() == 0 )
- {
- $sql = "INSERT INTO $SourceTable (CategoryId,ItemResourceId, PrimaryCat) VALUES ('$CatId','".$this->Get("ResourceId")."',$Primary)";
- if($this->debuglevel)
- echo $sql."<br>\n";
- $this->adodbConnection->Execute($sql);
- }
- }
-
- $c = $objCatList->GetCategory($CatId);
- }
- }
-
- function RemoveFromCategory($CatId,$SourceTable="",$Force=0)
- {
- global $objSession, $objCatList;
-
- if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- if($this->type>0)
- {
- $primary = $this->GetPrimaryCategory();
- if(($primary==$CatId && $this->CategoryMemberCount($SourceTable)>1) || ($primary != $CatId) || $Force)
- {
- $sql = "DELETE FROM $SourceTable WHERE CategoryId=$CatId AND ItemResourceId=".$this->Get("ResourceId");
- if($objSession->HasSystemPermission("DEBUG.LIST"))
- echo $sql."<br>\n";
-
- $this->adodbConnection->Execute($sql);
- $c = $objCatList->GetCategory($CatId);
- $c->ClearCacheData();
- }
- }
- }
-
- function MoveToCategory($OldCatId,$NewCatId,$SourceTable="")
- {
- if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- $sql = "UPDATE $SourceTable SET CategoryId=$NewCatId WHERE CategoryId=$OldCatId AND ItemResourceId=".$this->Get("ResourceId");
- if($this->debuglevel)
- echo $sql."<br>\n";
-
- $this->adodbConnection->Execute($sql);
- }
-
- function DeleteCategoryItems($CatId,$SourceTable = "")
- {
- if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- $CatCount = $this->CategoryMemberCount($SourceTable);
- if($CatCount>1)
- {
- $this->RemoveFromCategory($CatId,$SourceTable);
- $this->ClearCacheData();
- }
- else
- {
- $this->Delete();
- $sql = "DELETE FROM $SourceTable WHERE CategoryId=$CatId AND ItemResourceId=".$this->Get("ResourceId");
- if($this->debuglevel)
- echo $sql."<br>\n";
-
- $this->adodbConnection->Execute($sql);
- }
- }
- function RemoveFromAllCategories($SourceTable = "")
- {
- if(strlen($SourceTable)==0)
- $SourceTable = GetTablePrefix()."CategoryItems";
-
- if($this->type>0)
- {
- $sql = "SELECT * FROM $SourceTable WHERE ResourceId=".$this->Get("ResourceId");
- $rs = $this->adodbConnection->Execute($sql);
- while ($rs && !$rs->EOF)
- {
- $CategoryId = $rs->fields["CategoryId"];
- $rs->MoveNext();
- }
- $sql = "DELETE FROM $SourceTable WHERE ResourceId=".$this->Get("ResourceId");
- if($this->debuglevel)
- echo $sql."<br>\n";
-
- $this->adodbConnection->Execute($sql);
- }
- }
-
- function CopyToNewResource($TargetCat = NULL,$NameField="Name")
- {
- global $objSession;
-
- $CatList = $this->CategoryMemberList();
-
- $Cats = explode(",",$CatList);
- //echo "Target: $TargetCat<br>";
- $OldId = $this->Get("ResourceId");
- $this->UnsetIdField();
- $this->Dirty();
- if(!is_numeric($this->Get("OrgId")))
- $this->UnsetField("OrgId");
- $this->UnsetField("ResourceId");
- if(is_numeric($TargetCat) && strlen($NameField))
- {
- $OldName = $this->Get($NameField);
- if(substr($OldName,0,5)=="Copy ")
- {
- $parts = explode(" ",$OldName,4);
- if($parts[2]=="of" && is_numeric($parts[1]))
- {
- $Name = $parts[3];
- }
- else
- if($parts[1]=="of")
- {
- $Name = $parts[2]." ".$parts[3];
- }
- else
- $Name = $OldName;
- }
- else
- $Name = $OldName;
- $Names = CategoryItemNameCount($TargetCat,$this->tablename,$NameField,$Name);
- if(count($Names)>0)
- {
- $NameCount = count($Names);
- $found = FALSE;
- $NewName = "Copy of $Name";
-
- if(!in_array("Copy of $Name",$Names))
- {
- $found = TRUE;
- }
- else
- {
- for($x=2;$x<$NameCount+2;$x++)
- {
-
- $NewName = "Copy ".$x." of ".$Name;
- if(!in_array($NewName,$Names))
- {
- $found = TRUE;
- break;
- }
-
- }
- }
- if(!$found)
- {
- $NameCount++;
- $NewName = "Copy $NameCount of $Name";
- }
- $this->Set($NameField,$NewName);
- }
- }
- $this->Create();
- // copy relationships
- $NewId = $this->Get("ResourceId");
- $reldata = new clsRelationshipList($TargetCat,$this->IdField());
- $reldata->CopyToResource($OldId,$NewId);
-
- // copy reviews
- $rdata = new clsItemReviewList();
- $rdata->CopyToItemId($OldId,$NewId);
- unset($rdata);
-
- // copy custom fields
- $cdata = new clsCustomDataList();
- $cdata->CopyResource($OldId,$NewId);
- unset($cdata);
-
- // copy images
- if(is_object($this->Images))
- $this->Images->CopyResource($OldId,$NewId);
-
- $this->AddToCategory($TargetCat, '', 0); // insert (but with duplicate records check)
- //echo "ok";
- if(is_numeric($TargetCat))
- {
- if(is_array($Cats))
- {
- if(!in_array($TargetCat,$Cats))
- {
- $this->AddToCategory($TargetCat, 0); // insert
- }
- }
- $this->SetPrimaryCategory($TargetCat); // 2 updates
- }
- }
-
-
+ function Delete($RecordOnly=FALSE)
+ {
+ global $objFavorites;
+
+ parent::Delete($RecordOnly);
+ if($RecordOnly==FALSE)
+ {
+ $this->RemoveFromAllCategories();
+ }
+ }
+ /* category membership functions */
+
+ function AssignPrimaryCategory($SourceTable)
+ {
+ $catid = 0;
+ $sql = "SELECT * FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId")." LIMIT 1";
+ $rs = $this->adodbConnection->Execute($sql);
+ if($rs && !$rs->EOF)
+ {
+ $catid = $rs->fields["CategoryId"];
+ $this->SetPrimaryCategory($catid,$SourceTable);
+ }
+ return $catid;
+ }
+
+ function GetPrimaryCategory($SourceTable = "")
+ {
+ if(is_numeric($this->PrimaryCat))
+ return $this->PrimaryCat;
+
+ $this->PrimaryCat="";
+ if( strlen($SourceTable) == 0 ) $SourceTable = GetTablePrefix()."CategoryItems";
+ $res_id = $this->HasField('ResourceId') ? $this->Get('ResourceId') : 0;
+ $sql = "SELECT * FROM $SourceTable WHERE ItemResourceId=".$res_id." AND PrimaryCat=1";
+ $rs = $this->adodbConnection->Execute($sql);
+ if($rs && !$rs->EOF)
+ {
+ $this->PrimaryCat=$rs->fields["CategoryId"];
+ return $this->PrimaryCat;
+ }
+ else
+ {
+ $this->AssignPrimaryCategory($SourceTable);
+ return $this->PrimaryCat;
+ }
+ }
+
+ function SetPrimaryCategory($CategoryId,$SourceTable = "")
+ {
+ if(strlen($SourceTable)==0)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ $rs = $this->adodbConnection->Execute('SELECT * FROM '.$SourceTable.' WHERE CategoryId='.$CategoryId.' AND ItemResourceId='.$this->Get("ResourceId"));
+ $this->adodbConnection->Execute("UPDATE $SourceTable SET PrimaryCat=0 WHERE ItemResourceId=".$this->Get("ResourceId"));
+ $this->adodbConnection->Execute("UPDATE $SourceTable SET PrimaryCat=1 WHERE CategoryId=$CategoryId AND ItemResourceId=".$this->Get("ResourceId"));
+
+ $this->PrimaryCat=$CategoryId;
+ }
+
+ function CategoryMemberCount($SourceTable="")
+ {
+ if(strlen($SourceTable)==0)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ $sql = "SELECT count(*) as CatCount FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId");
+ if($this->debuglevel)
+ echo $sql."<br>\n";
+
+ $rs = $this->adodbConnection->Execute($sql);
+ $count = 0;
+ if($rs && !$rs->EOF)
+ $count = $rs->fields["CatCount"];
+ return $count;
+ }
+
+ function CategoryMemberList($SourceTable="")
+ {
+ $cats = array();
+ if(strlen($SourceTable)==0)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ $sql = "SELECT * FROM $SourceTable WHERE ItemResourceId=".$this->Get("ResourceId");
+
+ if($this->debuglevel)
+ echo $sql."<br>\n";
+
+ $rs = $this->adodbConnection->Execute($sql);
+ while($rs && !$rs->EOF)
+ {
+ $cats[] = $rs->fields["CategoryId"];
+ $rs->MoveNext();
+ }
+ $catlist = implode(",",$cats);
+ return $catlist;
+ }
+
+ function AddToCategory($CatId,$SourceTable="",$PrimaryValue=NULL)
+ {
+ global $objSession, $objCatList;
+
+ if(!$SourceTable)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ if($this->type>0)
+ {
+ $Primary = 0;
+ if(is_numeric($PrimaryValue))
+ {
+ $Primary = $PrimaryValue;
+ if($Primary==1)
+ $this->PrimaryCat = $CatId;
+ }
+ else
+ {
+ if(!is_numeric($this->GetPrimaryCategory()))
+ {
+ $Primary =1;
+ $this->PrimaryCat = $CatId;
+ }
+ }
+
+ // check if not exists
+
+ $db =& $this->adodbConnection;
+ $sql = sprintf('SELECT * FROM %s WHERE CategoryId = %s AND ItemResourceId = %s', $SourceTable, $CatId, $this->Get("ResourceId"));
+ $rs = $db->Execute($sql);
+
+ if (is_object($rs)) {
+ if($rs->RecordCount() == 0 )
+ {
+ $sql = "INSERT INTO $SourceTable (CategoryId,ItemResourceId, PrimaryCat) VALUES ('$CatId','".$this->Get("ResourceId")."',$Primary)";
+ if($this->debuglevel)
+ echo $sql."<br>\n";
+ $this->adodbConnection->Execute($sql);
+ }
+ }
+
+ $c = $objCatList->GetCategory($CatId);
+ }
+ }
+
+ function RemoveFromCategory($CatId,$SourceTable="",$Force=0)
+ {
+ global $objSession, $objCatList;
+
+ if(strlen($SourceTable)==0)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ if($this->type>0)
+ {
+ $primary = $this->GetPrimaryCategory();
+ if(($primary==$CatId && $this->CategoryMemberCount($SourceTable)>1) || ($primary != $CatId) || $Force)
+ {
+ $sql = "DELETE FROM $SourceTable WHERE CategoryId=$CatId AND ItemResourceId=".$this->Get("ResourceId");
+ if($objSession->HasSystemPermission("DEBUG.LIST"))
+ echo $sql."<br>\n";
+
+ $this->adodbConnection->Execute($sql);
+ $c = $objCatList->GetCategory($CatId);
+ $c->ClearCacheData();
+ }
+ }
+ }
+
+ function MoveToCategory($OldCatId,$NewCatId,$SourceTable="")
+ {
+ if(strlen($SourceTable)==0)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ $sql = "UPDATE $SourceTable SET CategoryId=$NewCatId WHERE CategoryId=$OldCatId AND ItemResourceId=".$this->Get("ResourceId");
+ if($this->debuglevel)
+ echo $sql."<br>\n";
+
+ $this->adodbConnection->Execute($sql);
+ }
+
+ function DeleteCategoryItems($CatId,$SourceTable = "")
+ {
+ if(strlen($SourceTable)==0)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ $CatCount = $this->CategoryMemberCount($SourceTable);
+ if($CatCount>1)
+ {
+ $this->RemoveFromCategory($CatId,$SourceTable);
+ $this->ClearCacheData();
+ }
+ else
+ {
+ $this->Delete();
+ $sql = "DELETE FROM $SourceTable WHERE CategoryId=$CatId AND ItemResourceId=".$this->Get("ResourceId");
+ if($this->debuglevel)
+ echo $sql."<br>\n";
+
+ $this->adodbConnection->Execute($sql);
+ }
+ }
+ function RemoveFromAllCategories($SourceTable = "")
+ {
+ if(strlen($SourceTable)==0)
+ $SourceTable = GetTablePrefix()."CategoryItems";
+
+ if($this->type>0)
+ {
+ $sql = "SELECT * FROM $SourceTable WHERE ResourceId=".$this->Get("ResourceId");
+ $rs = $this->adodbConnection->Execute($sql);
+ while ($rs && !$rs->EOF)
+ {
+ $CategoryId = $rs->fields["CategoryId"];
+ $rs->MoveNext();
+ }
+ $sql = "DELETE FROM $SourceTable WHERE ResourceId=".$this->Get("ResourceId");
+ if($this->debuglevel)
+ echo $sql."<br>\n";
+
+ $this->adodbConnection->Execute($sql);
+ }
+ }
+
+ function CopyToNewResource($TargetCat = NULL,$NameField="Name")
+ {
+ global $objSession;
+
+ $CatList = $this->CategoryMemberList();
+
+ $Cats = explode(",",$CatList);
+ //echo "Target: $TargetCat<br>";
+ $OldId = $this->Get("ResourceId");
+ $this->UnsetIdField();
+ $this->Dirty();
+ if(!is_numeric($this->Get("OrgId")))
+ $this->UnsetField("OrgId");
+ $this->UnsetField("ResourceId");
+ if(is_numeric($TargetCat) && strlen($NameField))
+ {
+ $OldName = $this->Get($NameField);
+ if(substr($OldName,0,5)=="Copy ")
+ {
+ $parts = explode(" ",$OldName,4);
+ if($parts[2]=="of" && is_numeric($parts[1]))
+ {
+ $Name = $parts[3];
+ }
+ else
+ if($parts[1]=="of")
+ {
+ $Name = $parts[2]." ".$parts[3];
+ }
+ else
+ $Name = $OldName;
+ }
+ else
+ $Name = $OldName;
+ $Names = CategoryItemNameCount($TargetCat,$this->tablename,$NameField,$Name);
+ if(count($Names)>0)
+ {
+ $NameCount = count($Names);
+ $found = FALSE;
+ $NewName = "Copy of $Name";
+
+ if(!in_array("Copy of $Name",$Names))
+ {
+ $found = TRUE;
+ }
+ else
+ {
+ for($x=2;$x<$NameCount+2;$x++)
+ {
+
+ $NewName = "Copy ".$x." of ".$Name;
+ if(!in_array($NewName,$Names))
+ {
+ $found = TRUE;
+ break;
+ }
+
+ }
+ }
+ if(!$found)
+ {
+ $NameCount++;
+ $NewName = "Copy $NameCount of $Name";
+ }
+ $this->Set($NameField,$NewName);
+ }
+ }
+ $this->Create();
+ // copy relationships
+ $NewId = $this->Get("ResourceId");
+ $reldata = new clsRelationshipList($TargetCat,$this->IdField());
+ $reldata->CopyToResource($OldId,$NewId);
+
+ // copy reviews
+ $rdata = new clsItemReviewList();
+ $rdata->CopyToItemId($OldId,$NewId);
+ unset($rdata);
+
+ // copy custom fields
+ $cdata = new clsCustomDataList();
+ $cdata->CopyResource($OldId,$NewId);
+ unset($cdata);
+
+ // copy images
+ if(is_object($this->Images))
+ $this->Images->CopyResource($OldId,$NewId);
+
+ $this->AddToCategory($TargetCat, '', 0); // insert (but with duplicate records check)
+ //echo "ok";
+ if(is_numeric($TargetCat))
+ {
+ if(is_array($Cats))
+ {
+ if(!in_array($TargetCat,$Cats))
+ {
+ $this->AddToCategory($TargetCat, 0); // insert
+ }
+ }
+ $this->SetPrimaryCategory($TargetCat); // 2 updates
+ }
+ }
+
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/include/item.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.9
\ No newline at end of property
Index: trunk/kernel/images/3493_1.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/kernel/images/3493_1.gif
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: trunk/kernel/admin/include/help/main_import.txt
===================================================================
--- trunk/kernel/admin/include/help/main_import.txt (revision 439)
+++ trunk/kernel/admin/include/help/main_import.txt (revision 440)
@@ -1,15 +1,13 @@
This section allows the administrator to import the data from other applications into your existing In-portal system.<br><br>
-<b>Step 1</b> of the import begins with a disclaimer that the data in your current system will be affected. Please ensure you understand the import process and the particular kind of import you are doing before proceeding.
+<b>Step 1</b> of the import begins with a disclaimer that the data in your current system will be affected. Please ensure you understand the import process and the particular kind of import you are doing before proceeding. In the current version, only the import from In-link2 and from phpBB 2.x is available
+
<br><br>
-<b>In-link 2 Import</b><br>
-In the current version, only the import from In-link2 is available. The import is designed for In-link version 2.3.4, however it will work, or partially work, for most of the older In-link2 versions up to 2.0.10. If you have one of the older In-link2 versions and are experiencing problems, please upgrade your In-link2 to the version 2.3.4, and then run this import. It is not possible to use In-link2 import if you do not have In-link3 installed on your In-portal platform. Some In-link2 license holders are entitled to a complimentary In-link3 license, please go to your account at <a href="http://www.intechnic.com/myaccount">http://www.intechnic.com/myaccount</a> for more information, or submit a support ticket.
+
+<b>Step 2</b><br>
+Import source selection.
<br><br>
+
<b>Step 3</b><br>
-In this step, the administrator will be asked to enter all database information for the In-link2 data. The current version of In-portal only supports import from the MySQL databases of In-link2.<br><br>
-<b>Step 4</b><br>
-In this step, the administrator will need to designate the options of the import – how the In-link2 data is supposed to be integrated into In-portal and In-link3.
-<li> Administrative Group – this field designates the In-portal administrative group (by default, ‘Admin'), into which the old In-link2 administrators should be imported. You can choose a different group for the import, and then designate the administrative users later. Clicking on the group button will pop up a list of In-portal groups.
-<li> Regular User Group - this field designates the In-portal group (by default, ‘Members'), into which the old In-link2 users (link owners) should be imported. It is recommended to import then into a group that will give them access to the front-end, and to modify their links. However, you can choose a different group for the import, and then manage the users later. Clicking on the group button will pop up a list of In-portal groups.
-<li> Initial Import Category – this field designates the In-portal category, which will serve as a root for the In-link2 import. This category will be the equivalent of the Home category in In-link2, and all of the sub-categories will be created underneath. Clicking on the category button (folder icon) will pop up a catalog navigator, where you can select the category.
-<li> Link Image Name – this field designates the link image field in the In-link2 database, which was used to store the link image name. By default, it is ‘link_image' , however many users have used a custom field for this purpose, in which case you should enter the custom field name here.
\ No newline at end of file
+In this step, the administrator will be asked to enter all database information for the import source data. The current version of In-portal only supports import from the MySQL databases.<br><br>
+
\ No newline at end of file
Property changes on: trunk/kernel/admin/include/help/main_import.txt
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/kernel/admin/include/help/server_info.txt
===================================================================
--- trunk/kernel/admin/include/help/server_info.txt (nonexistent)
+++ trunk/kernel/admin/include/help/server_info.txt (revision 440)
@@ -0,0 +1,3 @@
+
+<p>This section is for advanced administrators who need to reference the server information. It displays the common PHP Information page, as reported by the PHP engine. </p>
+It is useful mostly for debugging purposes.
Property changes on: trunk/kernel/admin/include/help/server_info.txt
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/kernel/admin/include/help/emaillog.txt
===================================================================
--- trunk/kernel/admin/include/help/emaillog.txt (nonexistent)
+++ trunk/kernel/admin/include/help/emaillog.txt (revision 440)
@@ -0,0 +1,2 @@
+This section displays a list of all emails generated and sent by the system. You can refresh this information by clicking the "Refresh" button, or delete one or more entries by clicking the ‘Reset' button (a recycling bin icon with a red x). </p>
+The email log is useful when addressing problems with users, who either received unwanted email communications, or visa versa – have not received a notification they were waiting for.
\ No newline at end of file
Property changes on: trunk/kernel/admin/include/help/emaillog.txt
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/admin/include/elements.php
===================================================================
--- trunk/admin/include/elements.php (revision 439)
+++ trunk/admin/include/elements.php (revision 440)
@@ -1,611 +1,609 @@
<?php
##############################################################
##In-portal :: Administration Interfaces :: Common Elements ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if( !isset($is_install) ) $is_install = false;
if(!$is_install)
{
if (!admin_login())
{
if(!headers_sent()) {
setcookie("sid"," ",time()-3600);
echo "Test";
}
$objSession->Logout();
header("Location: ".$adminURL."/login.php");
die();
//require_once($pathtoroot."admin/login.php");
}
}
global $admin,$pathtoroot, $objConfig;
if(!strlen($admin))
{
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
{
$admin = "admin";
}
}
require_once($pathtoroot.$admin."/include/sections.php");
$envar = "env=" . BuildEnv();
/* this function loads the javascript for each module's toolbar */
function load_module_javascript($sectionname, $skip_modules = Array() )
{
global $adminURL, $pathtoroot;
echo "<SCRIPT LANGUAGE=JavaScript1.2 src=\"".$adminURL."/browse/fw_menu.js\"></SCRIPT>\n";
echo "<SCRIPT LANGUAGE=JavaScript1.2 src=\"".$adminURL."/include/tabs.js\"></SCRIPT>\n";
echo "<script language=\"JavaScript1.2\" src=\"$adminURL/include/checkarray.js\"></script>\n";
global $objConfig, $ItemTabs;
$m = GetModuleArray("admin");
echo "<!-- ".count($m)."-->";
foreach($m as $key=>$value)
{
$path = $pathtoroot. $value."admin/include/toolbar/".$sectionname.".php";
if( !in_array($value, $skip_modules) && file_exists($path) )
{
echo "\n<!-- $path -->\n";
include_once($path);
}
else
echo "\n<!-- $path not found -->\n";
}
}
function load_module_styles()
{
global $objConfig, $ItemTabs,$rootURL,$pathtoroot;
$m = GetModuleArray("admin");
echo "<!-- module styles (".count($m).")-->";
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value."admin/include/style.css";
if(file_exists($path))
{
$inc = $rootURL.$value."admin/include/style.css";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$inc\">\n";
}
}
}
//***********************************
//Page Header
-function int_header($toolbar=NULL,$NavBarText=NULL,$ExtraTitle=NULL,$onLoad=NULL, $ExtraHead=NULL,$skip_modules=Array())
+function int_header($toolbar=NULL,$NavBarText=NULL,$ExtraTitle=NULL,$onLoad=NULL, $ExtraHead=NULL,$skip_modules=Array(),$OtherSection = '')
{
global $pathtoroot;
global $pathtolocal;
global $section;
global $objSections;
global $rootURL;
global $localURL;
global $adminURL;
global $envar;
global $admin;
global $metatag;
$style_sheet_global = $adminURL."/include/style.css";
$style_sheet_local = $localURL."admin/include/style.css";
$ExtraTitle = htmlentities($ExtraTitle);
if (is_object($toolbar))
{
if(file_exists($pathtolocal."admin/include/toolbar.php"))
require_once ($pathtolocal."admin/include/toolbar.php");
//Aray of the preloaded elems
//$int_toolbar_preload = array();
print "<html><head><title>In-portal</title>\n";
if(strlen($metatag))
{
print $metatag."\n";
}
else
{
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">\n";
print "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n";
}
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">\n";
load_module_styles();
require_once($pathtoroot.$admin."/include/mainscript.php");
//require_once($pathtolocal."admin/include/script.js");
print $ExtraHead;
$sectionname = explode(":", $section);
$sectionname = $sectionname[sizeof($sectionname)-1];
load_module_javascript($sectionname, $skip_modules);
if(is_object($toolbar))
print $toolbar->GetInitScript();
print '</head><body topmargin="0" leftmargin="8" marginheight="8" marginwidth="8" bgcolor="#FFFFFF"';
//*** Preload toolbar images
if(strlen($onLoad))
{
print $onLoad;
}
else
print " ONLOAD=\"clear_list_checkboxes();\"";
//*** Preload toolbar images
if(is_object($toolbar))
{
if (strlen($toolbar->Get("CheckClass")))
{
print $toolbar->onLoadString().">";
}
else
print " >";
$menufunc = $toolbar->Get("load_menu_func");
if (strlen($menufunc))
{
print "<script language=\"JavaScript1.2\">$menufunc</script>";
}
}
else
print " >";
}
else
{
print "<html><head><title>In-Portal </title>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">";
print "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">";
load_module_styles();
require_once ($pathtoroot.$admin."/include/mainscript.php");
//require_once ($pathtolocal."admin/include/script.js");
$sectionname = explode(":", $section);
$sectionname = $sectionname[sizeof($sectionname)-1];
load_module_javascript($sectionname);
print "</head><body topmargin=\"0\" leftmargin=\"8\" marginheight=\"8\" marginwidth=\"8\" bgcolor=\"#FFFFFF\">";
}
if(strlen($section)>0)
{
$objSections->SetCurrentSection($section);
$sec = $objSections->GetCurrentSection();
if ($sec->Get("notitle") != 1) print $objSections->page_title();
print $objSections->page_tabs($envar);
if ($sec->Get("nonavbar") != 1) //Section Navigatior
- print $objSections->section_header($envar,$NavBarText,$ExtraTitle);
+ print $objSections->section_header($envar,$NavBarText,$ExtraTitle,false,$OtherSection);
//Toolbar if appropriate
if ( isset($sections[$section]) && ($sections[$section]['toolbar']==1) || ( is_object($toolbar) ) )
print $toolbar->Build();
}
}//Page Header
// HELP Page Header
function int_help_header()
{
global $pathtoroot;
global $pathtolocal;
global $section;
global $objSections;
global $rootURL;
global $localURL;
global $adminURL;
global $envar;
global $admin;
global $metatag;
$style_sheet_global = $adminURL."/include/style.css";
$style_sheet_local = $localURL."admin/include/style.css";
-
- $ExtraTitle = htmlentities($ExtraTitle);
-
+
// TOOLBAR:
print "<html><head><title>In-Portal - Help</title>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">";
print "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$style_sheet_global\">";
load_module_styles();
require_once ($pathtoroot.$admin."/include/mainscript.php");
print "</head><body topmargin=\"0\" leftmargin=\"8\" marginheight=\"8\" marginwidth=\"8\" bgcolor=\"#FFFFFF\">";
if(strlen($section)>0)
{
$objSections->SetCurrentSection($section);
$sec = $objSections->GetCurrentSection();
if ($sec->Get("notitle") != 1) print $objSections->page_title();
if ($sec->Get("nonavbar") != 1) //Section Navigatior
- print $objSections->section_header($envar,$NavBarText,$ExtraTitle, true);
+ print $objSections->section_header($envar,'','', true);
}
}// HELP Page Header
function int_SectionHeader($toolbar=NULL,$onLoad=NULL,$NavBarText=NULL,$ExtraTitle=NULL)
{
global $pathtoroot;
global $pathtolocal;
global $section, $sections;
global $objSections;
global $rootURL;
global $adminURL,$admin;
global $localURL;
global $envar;
global $b_topmargin;
if (!isset($b_topmargin))
$b_topmargin = 8;
$sectionname = explode(":", $section);
$sectionname = $sectionname[sizeof($sectionname)-1];
load_module_javascript($sectionname);
if(is_object($toolbar))
print $toolbar->GetInitScript();
print "</head><body topmargin=\"$b_topmargin\" leftmargin=\"8\" marginheight=\"$b_topmargin\" marginwidth=\"8\" bgcolor=\"#FFFFFF\"";
//*** Preload toolbar images
if(strlen($onLoad))
{
print $onLoad;
}
else
print " onload=\"if (clear_checkboxes) clear_checkboxes();\"";
print ">";
global $b_header_addon;
if (isset($b_header_addon)) echo $b_header_addon;
if(strlen($section)>0)
{
$objSections->SetCurrentSection($section);
$sec = $objSections->GetCurrentSection();
if ($sec->Get("notitle")!=1)
print $objSections->page_title();
print $objSections->page_tabs($envar);
//Section Navigatior
if ($sec->Get("nonavbar")!=1)
{
if (is_null($ExtraTitle))
$ExtraTitle = "";
print $objSections->section_header($envar,$NavBarText,$ExtraTitle);
}
//Toolbar if appropriate
if( isset($sections[$section]) )
if($sections[$section]['toolbar'] == 1 || (is_object($toolbar)) )
print $toolbar->Build();
}
}//Section Page Header
//***********************************
//SubSection Title
function int_subsection_title($caption, $ColSpan = 5)
{
int_table_color(1);
print <<<END
<!-- Subsection Title -->
<tr class="subsectiontitle">
<td colspan="$ColSpan">$caption</td>
</tr>
END;
}
function int_subsection_title_install($caption)
{
int_table_color(1);
print <<<END
<!-- Subsection Title -->
<tr class="subsectiontitle">
<td colspan="3">$caption</td>
</tr>
END;
}
function int_subsection_title_ret($caption)
{
int_table_color_ret(1);
$o = "<!-- Subsection Title --><tr class=\"subsectiontitle\"><td colspan=\"5\">$caption</td></tr>";
return $o;
}
//SubSection Title
//***********************************
//Table Alternating colors
function int_table_color($reset_color=0, $return_result = false)
{
static $colorset;
if($reset_color)
{ $colorset="table_color2";
return;
}
if ($colorset == "table_color1")
$colorset = "table_color2";
else
$colorset = "table_color1";
$ret = "class=\"".$colorset."\"";
if($return_result)
return $ret;
else
print $ret;
}//Table Alternating colors
//Table Alternating colors with return
function int_table_color_ret($reset_color=0)
{
static $colorset;
if($reset_color)
{ $colorset="table_color2";
return;
}
if ($colorset == "table_color1")
$colorset = "table_color2";
else
$colorset = "table_color1";
return "class=\"".$colorset."\"";
}//Table Alternating colors
//***********************************
//Hint
function int_hint($caption)
{
global $imagesURL;
print <<<END
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<span class="hint"><img src="$imagesURL/smicon7.gif" width="14" height="14" align="absmiddle">$caption</span>
<td>
</tr>
</table>
END;
}//Hint
function int_hint_red($caption)
{
global $imagesURL;
print <<<END
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<span class="hint_red">$caption</span>
<td>
</tr>
</table>
END;
}//Hint
//***********************************
//Navigation String
function int_nav($caption)
{
global $pathtoroot;
global $imagespath;
print <<<END
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#f0f0f0">
<tr>
<td><b class="text"><span class="navbar"><a class="navbar" href="">$caption</a></span></b></td>
</tr>
</table>
END;
}//Navigation String
//***********************************
//Print Out Images
function int_img($img)
{
global $images;
global $pathtoroot;
global $imagesURL;
$src = $imagesURL."/".$images[$img]['file'];
$alt = $images[$img]['alt'];
$width = $images[$img]['width'];
$height = $images[$img]['height'];
$name = $img;
//Set ID if needed
if ($img == 'img:tool:view')
$id = "ID=\"viewbutton\"";
print "<img alt=\"$alt\" name=\"$name\" src=\"$src\" width=\"$width\" height=\"$height\" $id border=\"0\" align=\"absmiddle\">";
}//Print Out Images
//***********************************
//Page Footer
function int_footer()
{
global $objSession;
if($objSession->HasSystemPermission("DEBUG.INFO"))
{
//phpinfo();
}
print <<<END
</body>
</html>
END;
}//Page Footer
function HomeEnv()
{
global $m_var_list_update;
$m_var_list_update["cat"]=0;
return BuildEnv();
}
function UpEnv()
{
global $m_var_list_update,$objCatList;
$current = $objCatList->CurrentCat();
$parent = $current->Get("ParentId");
$m_var_list_update["cat"]=$parent;
return BuildEnv();
}
function ModuleInclude($file)
{
global $pathtoroot;
$m = GetModuleArray();
foreach($m as $key=>$value)
{
$path = $pathtoroot.$value.$file;
if(file_exists($path))
{
echo "<!-- $path -->";
@include_once($path);
}
}
}
function MultiEditButtons(&$ToolBar,$next,$prev,$Form,$StatusField, $url,$onClick, $ExtraVar="", $prev_phrase = 'Phrase Not Passed', $next_phrase = 'Phrase Not Passed')
{
global $adminURL;
$ToolBar->Add("divider");
if($prev>-1)
{
$MouseOver="swap('moveleft','toolbar/tool_prev_f2.gif');";
$MouseOut="swap('moveleft', 'toolbar/tool_prev.gif');";
$var="env=".BuildEnv()."&en=$prev&lpn=".GetVar('lpn');
if (strlen($ExtraVar))
$var.= $ExtraVar;
if ($onClick != 'LangSubmitMove') {
$link = "javascript:edit_submit('$Form','$StatusField','$url',0,'$var');";
}
else {
$link = "javascript:$onClick('$url', '$prev')";
}
$ToolBar->Add("moveleft",$prev_phrase,$link,$MouseOver,$MouseOut,"","toolbar/tool_prev.gif");
}
else
{
$MouseOver="";
$MouseOut="";
//$onClick="";
$link="#";
$ToolBar->Add("moveleft",$prev_phrase,"#","","","","toolbar/tool_prev_f3.gif");
}
if($next>-1)
{
$MouseOver="swap('moveright','toolbar/tool_next_f2.gif');";
$MouseOut="swap('moveright', 'toolbar/tool_next.gif');";
$var="env=".BuildEnv()."&en=$next".( isset($_REQUEST['lpn']) ? '&lpn='.$_REQUEST['lpn'] : '');
if (strlen($ExtraVar))
$var.= $ExtraVar;
if ($onClick != 'LangSubmitMove') {
$link = "javascript:edit_submit('$Form','$StatusField','$url',0,'$var');";
}
else {
$link = "javascript:$onClick('$url', '$next')";
}
$ToolBar->Add("moveright",$next_phrase,$link,$MouseOver,$MouseOut,"","toolbar/tool_next.gif");
}
else
{
$ToolBar->Add("moveright",$next_phrase,"#","","","","toolbar/tool_next_f3.gif");
}
}
function InsertButtons(&$ToolBar, $Buttons = Array(), $params = Array() )
{
foreach($Buttons as $button)
switch($button)
{
case 'save':
$ToolBar->Add( "img_save", "la_Save", "#",
"swap('img_save','toolbar/tool_select_f2.gif');",
"swap('img_save', 'toolbar/tool_select.gif');",
"edit_submit('".$params['form']."','".$params['status_field']."','".$params['url']."',1,'&lpn=".$_REQUEST['lpn']."');","tool_select.gif");
break;
case 'cancel':
$ToolBar->Add( "img_cancel", "la_Cancel", "#",
"swap('img_cancel','toolbar/tool_cancel_f2.gif');",
"swap('img_cancel', 'toolbar/tool_cancel.gif');",
"edit_submit('".$params['form']."','".$params['status_field']."','".$params['url']."',2,'&lpn=".$_REQUEST['lpn']."');","tool_cancel.gif");
break;
case 'edit':
break;
case 'delete':
break;
}
}
function GetTitle($item_phrase, $tab_phrase, $id)
{
// gets correct caption for editing windows with tabs
//echo "In: $item_phrase, $tab_phrase, $id";
$is_new = isset($_REQUEST['new']) && ($_REQUEST['new'] == 1) ? 1 : 0;
$text = $is_new ? 'la_Text_Adding' : 'la_Text_Editing';
$text = admin_language($text).' '.admin_language($item_phrase);
if($is_new == 0) $text .= ' #'.$id;
$text .= ' - '.admin_language($tab_phrase);
return $text;
}
function MarkFields($form_name)
{
// mark specified form fields as required
?> <script language="JavaScript">MarkAsRequired(document.getElementById("<?php echo $form_name; ?>"));</script> <?php
}
?>
Property changes on: trunk/admin/include/elements.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Index: trunk/admin/include/sections.php
===================================================================
--- trunk/admin/include/sections.php (revision 439)
+++ trunk/admin/include/sections.php (revision 440)
@@ -1,616 +1,617 @@
<?php
$sections = array();
class clsSection
{
var $m_sections;
var $m_name;
var $m_title;
var $m_path;
var $m_file;
var $m_icon;
var $m_icon_small;
var $m_icon_list;
var $m_child;
var $m_parent;
var $m_left;
var $m_right;
var $m_notree = 0;
var $m_notabs=0;
var $m_nonavbar=0;
var $m_notitle=0;
var $m_toolbar=0;
var $m_description = NULL;
var $m_onclick=NULL;
var $m_key;
var $m_bar_title;
var $m_bar_title_plain_text = "";
function clsSection()
{
/* constructor */
}
function Get($name)
{
$var = "m_" . $name;
return isset($this->$var) ? $this->$var : '';
}
function Set($name, $value)
{
if (is_array($name))
{
for ($i=0; $i<sizeof($name); $i++)
{
$var = "m_" . $name[$i];
$this->$var = $value[$i];
}
}
else
{
$var = "m_" . $name;
$this->$var = $value;
}
}
function IsJavaScriptLink()
{
$file = $this->Get('file');
if(!$file) return false;
return (substr($file, 0, 10) == 'javascript' || $file == '#') ? true : false;
}
function IconURL($large=1)
{
global $rootURL;
if($large==1)
{
$url = $rootURL.$this->Get("icon");
}
elseif($large==2)
{
$url = $rootURL.$this->Get("icon_list");
}
else
$url = $rootURL.$this->Get("icon_small");
return $url;
}
function URL()
{
global $rootURL;
$env = BuildEnv();
if(!$this->IsJavaScriptLink())
{
$url = $rootURL.$this->Get("path").$this->Get("file");
if(strstr($url,"?"))
{
$url .= "&env=".$env;
}
else
$url .= "?env=".$env;
}
else
$url = $this->Get("file");
return $url;
}
/* functions to display navigation elements */
function tab($envar)
{
global $imagesURL;
$link = $this->URL();
if(!$this->IsJavaScriptLink())
{
if(!strstr($link,'env='))
$link .= '?'. $envar;
}
$onclick = $this->Get('onclick');
$caption = language($this->Get('name'));
if(strlen($this->Get('name')))
{
$o ="<!-- Tab: $caption -->
<td><table bgcolor=\"#009FF0\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" onclick=\"\">
<tr onclick=\"$onclick\">
<td bgcolor=\"#009FF0\"><img alt=\"\" src=\"$imagesURL/tab_left.gif\" width=\"15\" height=\"23\"></td>
<td nowrap bgcolor=\"#009FF0\" background=\"$imagesURL/tab_back.gif\" align=\"center\">
<a href=\"$link\" class=\"tab2\" onClick=\"$onclick\">$caption</a><br>
</td>
<td bgcolor=\"#009FF0\"><img alt=\"\" src=\"$imagesURL/tab_right.gif\" width=\"15\" height=\"23\"></td>
</tr>
</table></td>";
}
else
$o = '';
return $o;
}//Individual Tab
function active_tab()
{
global $imagesURL, $envar;
$link = $this->URL();
$onclick = $this->Get("onclick");
if(!$this->IsJavaScriptLink())
{
if(!strstr($link,"env="))
$link .= "?". $envar;
}
$caption = language($this->Get("name"));
if (strlen($caption)<=8)
$backgr = "$imagesURL/tab_active_back3.jpg";
else if (strlen($caption)<=20)
$backgr = "$imagesURL/tab_active_back2.jpg";
else
$backgr = "$imagesURL/tab_active_back.jpg";
$o = "<!-- Tab: $caption -->
<td><table bgcolor=\"#FFFB32\" background=\"$backgr\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>
<td><img alt=\"\" src=\"$imagesURL/tab_active_left.gif\" width=\"15\" height=\"23\"></td>
<td nowrap align=\"center\" background=\"$imagesURL/tab_active_back.gif\">
<a href=\"$link\" class=\"tab\" onClick=\"$onclick\">$caption</a><br>
</td>
<td><img alt=\"\" src=\"$imagesURL/tab_active_right.gif\" width=\"15\" height=\"23\"></td></tr>
</table></td>";
return $o;
}//Active Tab
} /*clsSection*/
class clsSectionList
{
var $sections;
// var $section;
var $current;
function clsSectionList()
{
$this->sections = array();
$this->current = "default";
}
function GetSection($section)
{
if(is_array($this->sections) && strlen($section))
{
if(array_key_exists($section,$this->sections))
{
return $this->sections[$section];
}
else
return NULL;
}
else
return NULL;
}
function SetCurrentSection($section)
{
$this->current = $section;
}
function GetCurrentSection()
{
$ret = $this->GetSection($this->current);
if(!is_object($ret))
$ret = $this->GetSection("default");
return $ret;
}
function SimpleSection($module, $section_name, $tab_phrase, $title_phrase, $path, $script, $child,$parent,$left,$right)
{
// simplified method to add sections
global $pathtoroot;
$sn = explode(':', $section_name);
$img_path = $module.'/admin/images';
if( !isset($title_phrase) ) $title_phrase = $tab_phrase;
$this->AddSection( $section_name,$tab_phrase, $title_phrase,$path, $script,
$img_path.'/icon46_'.$sn[1].'.gif', $img_path.'/icon24_'.$sn[1].'.gif',
$child,$parent,$left,$right,0,'',1,null,null,null,$img_path.'/icon46_list_'.$sn[1].'.gif');
}
function AddSection($section,$name,$title,$path,$file,$icon,$icon_small, $child,$parent,$left,$right,
$notree=0,$onClick = "",$notabs=0,$nonavbar=0,$notitle=0,$toolbar=0,$icon_list="", $bar_title = "", $bar_title_plain_text = "")
{
if($file == "subitems.php")
$file .= "?section=$section";
$s = new clsSection();
$s->Set("name", $name);
$s->Set("title",$title);
$s->Set("path", $path);
$s->Set("file", $file);
$s->Set("icon", $icon);
$s->Set("icon_list", $icon_list);
$s->Set("icon_small", $icon_small);
$s->Set("child", $child);
$s->Set("parent", $parent);
$s->Set("left", $left);
$s->Set("right", $right);
$s->Set("notree", $notree);
$s->Set("notabs", $notabs);
$s->Set("nonavbar", $nonavbar);
$s->Set("notitle", $notitle);
$s->Set("toolbar", $toolbar);
$s->Set("description", NULL);
$s->Set("onclick", $onClick);
$s->Set("key",$section);
$s->Set("bar_title",$bar_title);
$s->Set("bar_title_plain_text", $bar_title_plain_text);
if($parent != NULL)
{
$p = $this->GetSection($parent);
if(is_object($p))
{
if(!strlen($p->Get("child")))
{
//echo "Setting child of $parent to $section<br>\n";
$p->Set("child", $section); //set the parent if none set!
$this->sections[$parent]=$p;
}
}
if(!strlen($left) && !strlen($right))
{
/* find first child w/ a null right value */
foreach($this->sections as $secname => $subsection)
{
if($subsection->Get("parent") == $parent)
{
if(!strlen($subsection->Get("right")))
{
$this->sections[$secname]->Set("right", $section);
$s->Set("left", $secname);
break;
}
}
}
}
}
$this->sections[$section]=$s;
}
function AddDescription($section,$desc)
{
$sec = $this->GetSection($section);
if(is_object($sec))
{
$sec->Set("description",$desc);
$this->sections[$section] = $sec;
}
}
function sectionURL($section)
{
return $this->sections[$section]->URL();
}
function SectionIconURL($section,$large=1)
{
return $this->sections[$section]->IconURL($large);
}
function BuildTree($element, $parent)
{
global $pathtoroot,$envar;
global $rootURL;
$org = $element;
$element = strtolower($element);
$j_el=str_replace("-","_",$element);
$j_el=str_replace(":","_",$j_el);
$j_par=str_replace("-","_",$parent);
$j_par=str_replace(":","_",$j_par);
$sec = $this->sections[$element];
if(is_object($sec))
{
$caption = $this->sections[$element]->Get("name");
if(strlen($caption)==0)
$caption = $this->sections[$element]->Get("title");
$caption = language($caption);
$child =$this->sections[$element]->Get("child");
$notree = "";
if( isset($this->sections[$child]) && is_object($this->sections[$child]) )
$notree = $this->sections[$child]->Get("notree");
if (($child == NULL) or ($notree==-1))
{
print "var item = insDoc($j_par, gLnk(0, \"".$caption."\", \"".$this->SectionURL($element)."\"));\n";
print "item.iconSrc = '".$this->SectionIconURL($element,0)."';\n";
if($this->sections[$element]->Get("right")!=NULL)
$this->BuildTree($this->sections[$element]->Get("right"), $parent);
return;
}
if ($child != NULL && $notree !=-1)
{ //print "$j_el = insFld($j_par, gFld(\"".$sections[$element]['name']."\"));\n";
print "var $j_el = insFld($j_par, gFld(\"".$caption."\",\"".$this->SectionURL($element)."\"));\n";
print $j_el . ".iconSrc='".$this->SectionIconURL($element,0)."';\n";
if($this->sections[$element]->Get("right")!=NULL)
$this->BuildTree($this->sections[$element]->Get("right"), $parent);
$parent = $element;
$this->BuildTree($this->sections[$element]->Get("child"), $parent);
}
}
}
function page_title()
{
global $imagesURL,$adminURL, $objConfig;
$o = "";
$sec = $this->GetCurrentSection();
if($sec->Get("notitle")!="1")
{
$caption = $sec->Get("title");
if(strlen($caption)==0)
{
if(strlen($sec->Get("parent")))
{
$p = $this->GetSection($sec->Get("parent"));
if(is_object($p))
{
$caption = $p->Get("title");
$icon = $p->IconURL(1);
}
}
}
else
$icon = $sec->IconURL(1);
$logout_link = $adminURL."/index.php";
if(strlen($caption))
{
if($sec->Get("key")=="in-portal:root")
{
$caption=stripslashes($objConfig->Get("Site_Name"));
}
else
{
$caption = admin_language($caption);
}
$bg_image = 'logo_bg.gif';
$replace_modules = Array('in-link','in-news','in-bulletin');
foreach($replace_modules as $r_module)
if( $this->IsModule($r_module) )
{
$bg_image = 'logo_bg_'.$r_module.'.gif';
break;
}
$o = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'>
<div style='position:absolute; width:100%;top:0px;' align='right'>
<img src='".$imagesURL.'/'.$bg_image."'></div><img src='".$imagesURL."/spacer.gif' width=1 height=7>
<br><div style='z-Index:1; position:relative'>";
$o .= "<!-- ADMIN TITLE --><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">
<tr><td valign=\"top\" class=\"admintitle\" align=\"left\">
<img alt=\"\" width=\"46\" height=\"46\" src=\"$icon\" align=\"absmiddle\">&nbsp;$caption<br>
<img src='".$imagesURL."/spacer.gif' width=1 height=4><br>
</td></tr></table>";
}
}
return $o;
}
function IsModule($module_name)
{
// checks if there is requested module used in right frame
// module folder match
$url_split = explode('/', $_SERVER['PHP_SELF']);
if( in_array($module_name, $url_split) ) return 1;
// module section match
- if( isset($_REQUEST['section']) )
+ $section = GetVar('section');
+ if($section)
{
- $section = explode(':', $_GET['section']);
+ $section = explode(':', $section);
if( $section[0] == $module_name ) return true;
}
return false;
}
function page_tabs($envar)
{
$showtabs=0;
$o = '';
$sec = $this->GetCurrentSection();
if ($sec->Get("notabs")!=1)
{
//get starting node
$node = $sec;
while (strlen($node->Get("left")))
{
$node = $this->GetSection($node->Get("left"));
}
if($node)
{
$o = "<!-- TABS --><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr>
<td align=\"right\" width=\"100%\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" height=\"23\">
<tr>";
$showtabs=1;
}
//traverse and print tabs
while ( isset($node) && is_object($node) )
{
if ($node->Get("key") == $this->current)
$o .= $node->active_tab();
else
$o .= $node->tab($envar);
$right = $node->Get("right");
unset($node);
if(strlen($right))
$node = $this->GetSection($right);
}
if($showtabs)
{
$o .= "</tr></table></td></tr></table>";
}
}
return $o;
}
- function section_header($envar,$navbar=NULL,$extra_title=NULL, $no_help = false)
+ function section_header($envar,$navbar=NULL,$extra_title=NULL, $no_help = false, $OtherSection = '')
{
global $pathtoroot;
global $pathtolocal;
global $imagesURL;
global $adminURL;
global $objConfig;
$output = '';
$HelpIcon = $imagesURL."/blue_bar_help.gif";
$node = $this->GetCurrentSection();
if(is_object($node))
{
$helpURL = $adminURL.'/help/help.php?'.( substr($envar,0,3) == 'env' ? '' : 'env=').$envar.'&destform=popup';
$node_key = $node->Get('key');
$o = "<!-- SECTION NAVIGATOR -->";
//background="'.$imagesURL.'/tabnav_left.jpg"
if($no_help == false) $o .= '<form name="help_form" id="help_form" action="'.$helpURL.'" method="post"><input type="hidden" id="section" name="section" value=""></form>';
$o .= '<table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30">';
$o .= '<tr><TD class="header_left_bg" width="100%">';
//get path up to the parent node
while ( isset($node) && is_object($node) )
{
if(!strlen($extra_title))
{
$bar_title = $node->Get("bar_title");
$bar_title_plain_text = $node->Get("bar_title_plain_text");
if(strlen($bar_title) && !is_null($bar_title))
$caption = language($bar_title);
elseif (is_null($bar_title))
$caption = "";
else
$caption = language($node->Get("name"));
if (strlen($bar_title_plain_text))
$caption.= $bar_title_plain_text;
}
else
$caption = $extra_title;
$output = "<span class=\"tablenav_link\">$caption</span>";
unset($node);
}
$o .= $output;
if(strlen($navbar))
$o .= "::<b>".$navbar."</b>";
-
+ if($OtherSection) $node_key = $OtherSection;
$o .= "</td><td align=\"right\" class=\"tablenav\" background=\"$imagesURL/tabnav_back.jpg\" width=\"10\">";
if($no_help == false) $o .= "<a class=\"link\" onclick=\"ShowHelp('".$node_key."');\"><img src=\"$HelpIcon\" border=\"0\"></A>";
$o .= "</td></tr></table><!-- END SECTION NAVIGATOR -->";
}
return $o;
}
} /* clsSectionList */
$objSections = new clsSectionList();
$objSections->AddSection("in-portal:root", $objConfig->Get("Site_Name"), $objConfig->Get("Site_Name"), $admin."/","subitems.php",
$admin."/icons/icon46_site.gif", $admin."/icons/icon24_site.gif",
"in-portal:site", NULL, NULL,"in-portal:users",0,"",1, NULL,NULL,NULL, "", "la_section_overview");
$objSections->AddSection("in-portal:site", "la_tab_Site_Structure","la_title_Site_Structure", $admin."/","subitems.php",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_struct.gif",
"in-portal:browse", "in-portal:root", NULL,"in-portal:users",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_struct.gif","la_selecting_categories");
$objSections->AddSection("in-portal:users","la_tab_Community","la_title_Community",$admin."/","subitems.php",
$admin."/icons/icon46_community.gif",$admin."/icons/icon24_community.gif", NULL,"in-portal:root","in-portal:site","in-portal:modules",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_community.gif","la_section_overview");
$objSections->AddSection("in-portal:modules","la_tab_ModulesSettings","la_title_Settings",$admin."/","subitems.php",
$admin."/icons/icon46_modules.gif",$admin."/icons/icon24_modules.gif",NULL, "in-portal:root","in-portal:users","in-portal:reports",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_modules.gif","la_section_overview");
$objSections->AddSection("in-portal:mod_status","la_tab_Modules","la_title_Module_Status",$admin."/modules/","mod_status.php",
$admin."/icons/icon46_modules.gif",$admin."/icons/icon24_modules.gif",NULL, NULL,NULL,NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_modules.gif");
$objSections->AddSection("in-portal:addmodule","la_tab_Modules","la_title_Add_Module",$admin."/modules/","addmodule.php",
$admin."/icons/icon46_modules.gif",$admin."/icons/icon24_modules.gif",NULL, NULL,NULL,NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_modules.gif");
$objSections->AddSection("in-portal:reports","la_tab_Reports","la_title_Reports",$admin."/","subitems.php",
$admin."/icons/icon46_summary_logs.gif",$admin."/icons/icon24_summary_logs.gif",NULL, "in-portal:root","in-portal:modules","in-portal:system",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_summary_logs.gif","la_section_overview");
$objSections->AddSection("in-portal:log_summary","la_tab_Summary","la_tab_Summary",$admin."/logs/","summary.php",
$admin."/icons/icon46_summary.gif",$admin."/icons/icon24_summary.gif",NULL,
"in-portal:reports",NULL,"in-portal:searchlog",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_summary.gif");
$objSections->AddSection("in-portal:searchlog","la_tab_SearchLog","la_tab_SearchLog",$admin."/logs/","searchlog.php",
$admin."/icons/icon46_search_log.gif",$admin."/icons/icon24_search_log.gif",
NULL,"in-portal:reports","in-portal:log_summary","in-portal:sessionlog",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_search_log.gif");
$objSections->AddSection("in-portal:sessionlog","la_tab_SessionLog","la_tab_SessionLog",$admin."/logs/","session_list.php",
$admin."/icons/icon46_sessions_log.gif",$admin."/icons/icon24_sessions_log.gif",
NULL,"in-portal:reports","in-portal:sessionlog",'in-portal:emaillog',0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_sessions_log.gif");
$objSections->AddSection("in-portal:emaillog","la_tab_EmailLog","la_tab_EmailLog",$admin."/logs/","email_log.php",
$admin."/icons/icon46_email_log.gif",$admin."/icons/icon24_email_log.gif",
NULL,"in-portal:reports","in-portal:emaillog",NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_email_log.gif");
/* Help */
$objSections->AddSection("in-portal:help","la_tab_Help","la_title_Help",$admin."/help/","manual.pdf",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"in-portal:root","in-portal:system",NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_help.gif");
/*
$objSections->AddSection("in-portal:help","la_tab_Help","la_title_Help",$admin."/help/topics/","download.html",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"in-portal:root","in-portal:system",NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_help.gif");
$objSections->AddSection("in-portal:help_overview","la_tab_Overview","la_title_Help",$admin."/help/","help.php",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"in-portal:help",NULL,"in-portal:help_ch1",NULL,NULL,NULL,NULL,NULL,NULL,$admin."/icons/icon46_list_help.gif");
$objSections->AddSection("in-portal:help_ch1","Chapter 1","Chapter 1",$admin."/help/","help.php",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"inportal:help","in-portal:help_overview","in-portal:help_ch2");
$objSections->AddSection("in-portal:help_ch2","Chapter 2","Chapter 2",$admin."/help/","help.php",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"inportal:help","in-portal:help_ch1",NULL);
*/
/* Help ends */
$objSections->AddSection("in-portal:item_select","la_title_Select_Item","Select Item",$admin."/","item_select.php","","",
NULL,NULL,NULL,0,"",1,1);
$objSections->AddSection("in-portal:rel_select","la_title_Select_Target_Item","Select Item",$admin."/","rel_select.php","","",
NULL,NULL,NULL,0,"",1,0,1,1);
$NewButtons = array();
/* each module will add to the array declared below, which contains the info for the
'new' button for the module's Browse data. The array is an array of arrays,
and the subarray should contain the following indexes:
ImagePath = URL to the directory containing the image
Action = Action attribute of the image (this is also the "base name" of the image
Alt = Image ALT value
Tab = If set, button will only be displayed when this div is active
*/
$m = GetModuleArray("admin");
if(is_array($m))
{
foreach($m as $key=>$value)
{
$mod = $pathtoroot . $value . "admin/include/navmenu.php";
include_once($mod);
}
}
$objSections->AddSection("default","","",$admin."/","#",NULL,NULL,NULL,NULL,NULL,NULL);
?>
Property changes on: trunk/admin/include/sections.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.10
\ No newline at end of property
+1.11
\ No newline at end of property
Index: trunk/admin/help/manual.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/admin/help/manual.pdf
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.9
\ No newline at end of property
Index: trunk/admin/help/help.php
===================================================================
--- trunk/admin/help/help.php (revision 439)
+++ trunk/admin/help/help.php (revision 440)
@@ -1,137 +1,137 @@
<?php
if(!strlen($pathtoroot))
{
$path=dirname(realpath(__FILE__));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
-$baseURL = $_SERVER['DOCUMENT_ROOT'].$path_char.$objConfig->Get("Site_Path");
+$baseURL = $_SERVER['DOCUMENT_ROOT'].$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
$section = $_REQUEST["section"];
$envar = BuildEnv();
int_help_header();
$section = explode(':', $section);
if($section[0] == 'in-portal') $section[0] = 'kernel';
$topic_path = $baseURL.$section[0].'/'.$admin.'/include/help/'.$section[1].'.txt';
// for debugging: save new help content
if( GetVar('action') == 'save_help' )
{
error_reporting(E_ALL);
$fp = fopen($topic_path, 'w');
fwrite($fp, stripslashes(GetVar('help_content')) );
fclose($fp);
}
$help_data = file_exists($topic_path) ? file_get_contents($topic_path) : GetVar('help_content');
if($section[0] == 'kernel') $section[0] = 'in-portal';
?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<tr>
<td bgcolor="F6F6F6">
<div class="help_box">
<?php
if( file_exists($topic_path) )
echo $help_data;
else
echo defined('DEBUG_HELP') ? 'missing section help file <b>'.$section[1].'.txt</b><br>' : admin_language('la_help_in_progress');
?>
</div>
<?php
if( defined('DEBUG_HELP') )
{
?>
<br><input type="button" onclick="document.save_help.submit();" value="Save Changes" style="font-weight: bolder; background-color: #F6F6F6;"><br>
<form name="save_help" id="save_help" method="post" action="<?php echo $_SERVER['PHP_SELF'].'?env='.$envar; ?>">
<textarea id="help_content" name="help_content" rows="15" cols="85"><?php echo $help_data; ?></textarea>
<input type="hidden" name="section" value="<?php echo implode(':',$section); ?>">
<input type="hidden" name="action" value="save_help">
<?php if( GetVar('help_usage') ) { ?>
<input type="hidden" name="help_usage" value="<?php echo GetVar('help_usage'); ?>">
<?php } ?>
</form>
<?php
}
?>
</td>
</tr>
</table>
<? int_footer(); ?>
\ No newline at end of file
Property changes on: trunk/admin/help/help.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/admin/import/step4.php
===================================================================
--- trunk/admin/import/step4.php (revision 439)
+++ trunk/admin/import/step4.php (revision 440)
@@ -1,224 +1,225 @@
<?php
if(!strlen($pathtoroot))
{
$path=dirname(realpath(__FILE__));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
//Set Section
$section = "in-portal:main_import";
//Set Environment Variable
$envar = "env=" . BuildEnv();
$sec = $objSections->GetSection($section);
$objCatToolBar = new clsToolBar();
//check if the previous input is correct
if( $_POST["Action"] == 'checkconn')
{
// save supplied connection info
$objSession->SetVariable("import_sql_type", $_POST["db_sql_type"]);
$objSession->SetVariable("import_server", $_POST["db_server"]);
$objSession->SetVariable("import_db", $_POST["db_db"]);
$objSession->SetVariable("import_user", $_POST["db_user"]);
$objSession->SetVariable("import_pass", $_POST["db_pass"]);
$objSession->SetVariable("error_importing", '');
// get them for using here
$db_sql_type = $objSession->GetVariable("import_sql_type");
$db_server = $objSession->GetVariable("import_server");
$db_db = $objSession->GetVariable("import_db");
$db_user = $objSession->GetVariable("import_user");
$db_pass = $objSession->GetVariable("import_pass");
// check supplied connection
$linkconn = ADONewConnection($db_sql_type);
if( !$linkconn->PConnect($db_server, $db_user, $db_pass, $db_db) || !$db_server || !$db_db )
{
$objSession->SetVariable("error_importing","Error: The connection to the DB failed please check your settings");
header('Location: step3.php?'.$envar);
}
unset($linkconn);
}
$import_script = GetImportScript( $objSession->GetVariable('ImportScriptID') );
$var = "?env=".BuildEnv();
// Previous Button
$MouseOver = "swap('moveleft','toolbar/tool_prev_f2.gif');";
$MouseOut = "swap('moveleft', 'toolbar/tool_prev.gif');";
$link = $adminURL."/import/step3.php".$var;
$objCatToolBar->Add("moveleft",admin_language("la_ToolTip_Previous")." ".admin_language("la_Text_Step"),$link,$MouseOver,$MouseOut,"","tool_prev.gif");
// Next Button
$MouseOver = "swap('moveright','toolbar/tool_next_f2.gif');";
$MouseOut = "swap('moveright', 'toolbar/tool_next.gif');";
$formaction = $rootURL.$import_script['module'].'/'.$admin.'/import/'.$import_script['url'].'.php?'.$envar;
$onClick = "if( !CheckFinalForm('import_form') ) alert('Please fill in all of the fields'); else import_submit('import_form','$formaction'); ";
$objCatToolBar->Add("moveright",admin_language("la_ToolTip_Next")." ".admin_language("la_Text_Step"),'#',$MouseOver,$MouseOut,$onClick,"tool_next.gif");
// Header
$title = admin_language("la_performing_import")." - ".admin_language("la_Step")." 4";
- int_header($objCatToolBar,NULL,$title);
+ $NewSection = strtolower($import_script['module']).':'.$import_script['id'];
+ int_header($objCatToolBar,NULL,$title,NULL,NULL,Array(),$NewSection);
?>
<form id="import_form" name="import_form" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>">
<input type="hidden" name="Action" value="m_save_import_config">
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<?php int_subsection_title("Matching Fields - Intechnic In-Portal "); ?>
<!-- script common fields: begin -->
<?php
if( $import_script['id'] == 'in-link' )
{
?>
<tr <?php echo int_table_color(); ?>>
<td width="60%" valign="top"><span class="text"><?php echo admin_language("la_prompt_AdminId"); ?></span></td>
<td>
<b><?php echo $objSession->GetVariable("user_admin_names"); ?></b>
<input type="hidden" name="user_admin" size="15" class="text" value="<?php echo $objSession->GetVariable("user_admin_values"); ?>">
<input type="hidden" name="grouplist1" value="<?php echo $objSession->GetVariable('grouplist1'); ?>">
<a href="#"><img src="../images/icon_users_sm.gif" style="cursor:hand;" border="0" onclick="OpenGroupSelector('<?php echo $envar; ?>&en=0&destform=import_form&destfield=grouplist1&Selector=radio');"></a>
</td>
</tr>
<?php
}
?>
<tr <?php echo int_table_color(); ?>>
<td width="60%" valign="top"><span class="text"><?php echo admin_language("la_prompt_RegUserId"); ?></span></td>
<td>
<b><?php echo $objSession->GetVariable("user_regular_names"); ?></b>
<input type="hidden" name="user_regular" size="15" class="text" value="<?php echo $objSession->GetVariable("user_regular_values"); ?>">
<input type="hidden" name="grouplist2" value="<?php echo $objSession->GetVariable('grouplist2'); ?>">
<a href="#"><img src="../images/icon_users_sm.gif" style="cursor:hand;" border="0" onclick="OpenGroupSelector('<?php echo $envar; ?>&en=0&destform=import_form&destfield=grouplist2&Selector=radio');"></a>
</td>
</tr>
<tr <?php echo int_table_color(); ?>>
<td width="60%" valign="top"><span class="text"><?php
echo admin_language("la_prompt_InitImportCat");
$catid = $objSession->GetVariable('categoryid');
$path = prompt_language($objConfig->Get("Root_Name"));
if($catid > 0)
{
$c = $objCatList->GetItemByField('ResourceId', $catid);
$path .= "&gt;".$c->GetCachedNavBar();
}
?>
</td>
<td>
<b><?php echo $path; ?></b>
<input type="hidden" name="init_cat" size="15" class="text" value="<?php echo $objSession->GetVariable("categoryid"); ?>">
<a href="#"><img src="<?php echo $imagesURL; ?>/folder.gif" style="cursor:hand;" border="0" ONCLICK="OpenCatSelector('<?php echo $envar; ?>&source=inlinkimport4&continue_sess=1&destform=import_form&destfield=categorylist&Selector=radio');"></a>
<input type="hidden" name="categorylist" value="<?php echo $objSession->GetVariable('categorylist'); ?>">
</td>
</tr>
<!-- script common fields: end -->
<!-- script spefific fields: begin -->
<?php
if( $import_script['id'] == 'in-link' )
{
if( GetVar('link_image') ) $objSession->SetVariable('link_image', GetVar('link_image') );
?>
<tr <?php echo int_table_color(); ?>>
<td width="60%" valign="top"><span class="text"><?php echo admin_language("la_prompt_Import_ImageName"); ?></span></td>
<td>
<input type="text" name="link_image" class="text" size="30" value="<?php echo $objSession->GetVariable('link_image'); ?>">
</td>
</tr>
<?php
}
if( $import_script['module'] == 'in-bulletin' )
{
if( GetVar('bb_prefix') ) $objSession->SetVariable('import_table_prefix', GetVar('bb_prefix') );
?>
<tr <?php echo int_table_color(); ?>>
<td width="60%" valign="top"><span class="text"><?php echo admin_language("la_prompt_Import_Prefix"); ?></span></td>
<td>
<input type="text" name="bb_prefix" class="text" size="30" value="<?php echo $objSession->GetVariable('import_table_prefix'); ?>">
</td>
</tr>
<?php
}
?>
<!-- script spefific fields: end -->
</table>
</form>
<?php
int_footer();
?>
Property changes on: trunk/admin/import/step4.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5
\ No newline at end of property
+1.6
\ No newline at end of property

Event Timeline