Skip to content
Snippets Groups Projects
Commit 7b241891 authored by Jared Hancock's avatar Jared Hancock
Browse files

topics: Restrict delete and disable on default topic

parent dabbab59
No related branches found
No related tags found
No related merge requests found
...@@ -198,6 +198,10 @@ class Topic { ...@@ -198,6 +198,10 @@ class Topic {
} }
function delete() { function delete() {
global $cfg;
if ($this->getId() == $cfg->getDefaultTopicId())
return false;
$sql='DELETE FROM '.TOPIC_TABLE.' WHERE topic_id='.db_input($this->getId()).' LIMIT 1'; $sql='DELETE FROM '.TOPIC_TABLE.' WHERE topic_id='.db_input($this->getId()).' LIMIT 1';
if(db_query($sql) && ($num=db_affected_rows())) { if(db_query($sql) && ($num=db_affected_rows())) {
......
...@@ -68,7 +68,8 @@ if($_POST){ ...@@ -68,7 +68,8 @@ if($_POST){
break; break;
case 'disable': case 'disable':
$sql='UPDATE '.TOPIC_TABLE.' SET isactive=0 ' $sql='UPDATE '.TOPIC_TABLE.' SET isactive=0 '
.' WHERE topic_id IN ('.implode(',', db_input($_POST['ids'])).')'; .' WHERE topic_id IN ('.implode(',', db_input($_POST['ids'])).')'
.' AND topic_id <> '.db_input($cfg->getDefaultTopicId());
if(db_query($sql) && ($num=db_affected_rows())) { if(db_query($sql) && ($num=db_affected_rows())) {
if($num==$count) if($num==$count)
$msg = 'Selected help topics disabled'; $msg = 'Selected help topics disabled';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment