diff options
-rw-r--r-- | engine/lib/sites.php | 18 | ||||
-rw-r--r-- | languages/en.php | 2 |
2 files changed, 20 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 diff --git a/languages/en.php b/languages/en.php index 537c6e0a2..655d7285d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -158,6 +158,8 @@ 'SecurityException:authenticationfailed' => "User could not be authenticated", 'CronException:unknownperiod' => '%s is not a recognised period.', + + 'SecurityException:deletedisablecurrentsite' => 'You can not delete or disable the site you are currently viewing!', /** * API */ |