diff --git a/extension.driver.php b/extension.driver.php index be5ef96..385f0d9 100755 --- a/extension.driver.php +++ b/extension.driver.php @@ -74,6 +74,14 @@ public function appendPreferences($context) { // Append help $group->appendChild(new XMLElement('p', __('Maintenance mode will redirect all visitors, other than developers, to the specified maintenance page. To specify a maintenance page, give a page a type of maintenance'), array('class' => 'help'))); + // IP White list + $label = Widget::Label(__('IP Whitelist')); + $label->appendChild(Widget::Input('settings[maintenance_mode][ip_whitelist]', Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode'))); + $group->appendChild($label); + + // Append help + $group->appendChild(new XMLElement('p', __('Any user that has an IP listed above will be granted access. This eliminates the need to allow a user backend access. Separate each with a space.'), array('class' => 'help'))); + // Append new preference group $context['wrapper']->appendChild($group); } @@ -170,6 +178,13 @@ public function __appendType($context) { public function __checkForMaintenanceMode($context) { if(!Symphony::Engine()->isLoggedIn() && Symphony::Configuration()->get('enabled', 'maintenance_mode') == 'yes'){ + // Check the IP white list + $whitelist = Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode'); + if(strlen(trim($whitelist)) > 0){ + $whitelist = explode(' ', $whitelist); + if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)) return; + } + // Find custom maintenance page $row = PageManager::fetchPageByType('maintenance');