From 0d9e0384fcfe77b9adef14e823d1fdda33ce4179 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Sat, 13 Dec 2008 12:52:16 +0000 Subject: [PATCH] Fail gracefully when a bad filter ID is given in the URL. --- SpecialAbuseFilter.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SpecialAbuseFilter.php b/SpecialAbuseFilter.php index 513546637..d4888a6f3 100644 --- a/SpecialAbuseFilter.php +++ b/SpecialAbuseFilter.php @@ -342,13 +342,14 @@ class SpecialAbuseFilter extends SpecialPage { // Build the edit form global $wgOut,$wgLang,$wgUser; $sk = $this->mSkin; - $wgOut->setSubtitle( wfMsg( 'abusefilter-edit-subtitle', $filter, $history_id ) ); list ($row, $actions) = $this->loadRequest($filter, $history_id); if( !$row ) { return false; } + + $wgOut->setSubtitle( wfMsg( 'abusefilter-edit-subtitle', $filter, $history_id ) ); if (isset($row->af_hidden) && $row->af_hidden && !$this->canEdit()) { return wfMsg( 'abusefilter-edit-denied' ); @@ -545,13 +546,18 @@ class SpecialAbuseFilter extends SpecialPage { } function loadFilterData( $id ) { + + if ($id == 'new') { + return array( new StdClass, array() ); + } + $dbr = wfGetDB( DB_SLAVE ); // Load the main row $row = $dbr->selectRow( 'abuse_filter', '*', array( 'af_id' => $id ), __METHOD__ ); if (!isset($row) || !isset($row->af_id) || !$row->af_id) - return array( new stdClass,array() ); + return null; // Load the actions $actions = array();