aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-21 11:07:48 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-21 11:07:48 +0000
commitb6a056305ad04c220eae451037d3c885bf7f1e76 (patch)
tree46197b3aea81e2d508d1ca34b0ee68f0557e3c5f /engine
parentacce3b5e92e4264f39961618a844553e2fdc685b (diff)
downloadelgg-b6a056305ad04c220eae451037d3c885bf7f1e76.tar.gz
elgg-b6a056305ad04c220eae451037d3c885bf7f1e76.tar.bz2
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
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/sites.php18
1 files changed, 18 insertions, 0 deletions
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,6 +135,10 @@
*/
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;
@@ -142,6 +146,20 @@
}
/**
+ * 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.
*
* @param int $limit