clsItemDB(); $this->tablename=GetTablePrefix()."BanRules"; $this->type=61; $this->BasePermission=""; $this->id_field = "RuleId"; $this->NoResourceId=1; $this->debuglevel = 0; if(isset($RuleId)) $this->LoadFromDatabase($RuleId); } } class clsBanRuleList extends clsItemCollection { function clsBanRuleList() { $this->clsItemCollection(); $this->classname = "clsBanRule"; //class type for items $this->SourceTable = GetTablePrefix()."BanRules"; $this->PerPageVar = "Perpage_BanRules"; $this->Page = 1; $this->AdminSearchFields = array("ItemValue"); $this->BasePermission = ""; $this->debuglevel = 0; } function LoadItemRules($ItemType) { $sql = "SELECT * FROM ".$this->SourceTable." WHERE ItemType=$ItemType AND Status=1 ORDER BY Priority DESC"; $this->Clear(); return $this->Query_Item($sql); } function GetMaxPriority() { $sql = "SELECT MAX(Priority) as MaxPri FROM ".GetTablePrefix()."BanRules"; $rs = $this->adodbConnection->Execute($sql); if($rs && !$rs->EOF) return $rs->fields["MaxPri"]; return 0; } function &AddRule($ItemType,$RuleType,$ItemField,$ItemVerb,$ItemValue,$Priority,$Status, $ErrorTag = NULL) { $r = new clsBanRule(NULL); $r->tablename = $this->SourceTable; if($Priority==0) $Priority = $this->GetMaxPriority()+1; //echo "Creating User..
\n"; $r->Set(array("ItemType", "RuleType", "ItemField", "ItemVerb", "ItemValue", "Status", "Priority", "ErrorTag"), array($ItemType, $RuleType, $ItemField, $ItemVerb, $ItemValue, $Status, $Priority, $ErrorTag)); $r->Create(); return $r; } function EditRule($RuleId,$ItemType,$RuleType,$ItemField,$ItemVerb,$ItemValue,$Priority,$Status, $ErrorTag) { $r = $this->GetItem($RuleId); if(is_object($r)) { $r->tablename = $this->SourceTable; $r->Set(array("ItemType", "RuleType", "ItemField", "ItemVerb", "ItemValue", "Status", "Priority", "ErrorTag"), array($ItemType, $RuleType, $ItemField, $ItemVerb, $ItemValue, $Status, $Priority, $ErrorTag)); $r->Update(); return $r; } else return FALSE; } function DeleteRule($RuleId) { $r = $this->GetItem($RuleId); $r->Delete(); } }