From b6a056305ad04c220eae451037d3c885bf7f1e76 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 21 Oct 2008 11:07:48 +0000 Subject: Added safety rail to prevent disabling/deleting of currently viewed site. git-svn-id: https://code.elgg.org/elgg/trunk@2287 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/sites.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'engine/lib/sites.php') diff --git a/engine/lib/sites.php b/engine/lib/sites.php index add5424e2..b7af3a3c3 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -135,12 +135,30 @@ */ public function delete() { + global $CONFIG; + if ($CONFIG->site->getGUID() == $this->guid) + throw new SecurityException('SecurityException:deletedisablecurrentsite'); + if (!delete_site_entity($this->get('guid'))) return false; return parent::delete(); } + /** + * Disable override to add safety rail. + * + * @param unknown_type $reason + */ + public function disable($reason = "") + { + global $CONFIG; + if ($CONFIG->site->getGUID() == $this->guid) + throw new SecurityException('SecurityException:deletedisablecurrentsite'); + + return parent::disable($reason); + } + /** * Return a list of users using this site. * -- cgit v1.2.3