1 to 12 of 12
$this->CategoryID = ForceIncomingInt('CategoryID', 0);
// Validate the Discussion topic$Name = FormatStringForDatabaseInput($Discussion->Name);Validate($this->Context->GetDefinition('DiscussionTopicLower'), 1, $Name, 100, '', $this->Context);//Validate the category ID and role$s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder');$s->SetMainTable('Category', 'c');$s->AddSelect('CategoryID', 'c');$s->AddJoin('CategoryRoleBlock', 'crb', 'CategoryID', 'c', 'CategoryID', 'left join', ' and crb.'.$this->Context->DatabaseColumns['CategoryRoleBlock']['RoleID'].' = '.$this->Context->Session->User->RoleID);$s->AddWhere('crb', 'Blocked', '', '0', '=', 'and', '', 1, 1);$s->AddWhere('crb', 'Blocked', '', '0', '=', 'or', '', 0, 0);$s->AddWhere('crb', 'Blocked', '', 'null', 'is', 'or', '', 0, 0);$s->AddWhere('c', 'CategoryID', '', $Discussion->CategoryID, '=', 'and');$s->EndWhereGroup();$CategoryAllowed = $this->Context->Database->Select($s, $this->Name, 'SaveDiscussion', 'An error occurred while validating categories.');if ($this->Context->Database->RowCount($CategoryAllowed) < 1) $Discussion->CategoryID = 0;if ($Discussion->CategoryID <= 0) $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrSelectCategory'));
if ($this->Context->Database->RowCount($CategoryAllowed) < 1) { $Discussion->CategoryID = 0; }
if ($this->Context->Database->RowCount($CategoryAllowed) < 1) $Discussion->CategoryID = 0;
Index: Vanilla.Class.DiscussionManager.php===================================================================--- Vanilla.Class.DiscussionManager.php (revision 674)+++ Vanilla.Class.DiscussionManager.php (revision 675)@@ -428,6 +428,20 @@ // Validate the Discussion topic $Name = FormatStringForDatabaseInput($Discussion->Name); Validate($this->Context->GetDefinition('DiscussionTopicLower'), 1, $Name, 100, '', $this->Context);++ //Validate the category ID and role+ $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder');+ $s->SetMainTable('Category', 'c');+ $s->AddSelect('CategoryID', 'c');+ $s->AddJoin('CategoryRoleBlock', 'crb', 'CategoryID', 'c', 'CategoryID', 'left join', ' and crb.'.$this->Context->DatabaseColumns['CategoryRoleBlock']['RoleID'].' = '.$this->Context->Session->User->RoleID);+ $s->AddWhere('crb', 'Blocked', '', '0', '=', 'and', '', 1, 1);+ $s->AddWhere('crb', 'Blocked', '', '0', '=', 'or', '', 0, 0);+ $s->AddWhere('crb', 'Blocked', '', 'null', 'is', 'or', '', 0, 0);+ $s->AddWhere('c', 'CategoryID', '', $Discussion->CategoryID, '=', 'and');+ $s->EndWhereGroup();++ $CategoryAllowed = $this->Context->Database->Select($s, $this->Name, 'SaveDiscussion', 'An error occurred while validating category permissions.');+ if ($Discussion->CategoryID <= 0) $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrSelectCategory')); // Validate first comment@@ -452,7 +466,7 @@ if ($this->Context->WarningCollector->Count() == 0) $Discussion->Name = $Name; if($this->Context->WarningCollector->Iif()) {- $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder');+ $s->Clear(); // Update the user info & check for spam if ($NewDiscussion) {
Bug Tracker
Vanilla 1.1.2 is a product of Lussumo. More Information: Documentation, Community Support.