diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php
index 5f2dbc07..1c218568 100644
--- a/root/includes/acp/acp_portal.php
+++ b/root/includes/acp/acp_portal.php
@@ -44,6 +44,7 @@ class acp_portal
'title' => 'ACP_PORTAL_GENERAL_INFO',
'vars' => array(
'legend1' => 'ACP_PORTAL_GENERAL_SETTINGS',
+ 'portal_enable' => array('lang' => 'PORTAL_ENABLE' , 'validate' => 'bool', 'type' => 'radio:yes_no' , 'explain' => true),
'portal_leaders_ext' => array('lang' => 'PORTAL_LEADERS_EXT' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
'portal_birthdays_ahead' => array('lang' => 'PORTAL_BIRTHDAYS_AHEAD' , 'validate' => 'int' , 'type' => 'text:3:3' , 'explain' => true),
'portal_forum_index' => array('lang' => 'PORTAL_FORUM_INDEX' , 'validate' => 'bool' , 'type' => 'radio:yes_no' , 'explain' => true),
diff --git a/root/install_portal/schemas/_schema_data.sql b/root/install_portal/schemas/_schema_data.sql
index 5af7d233..6c11c9a9 100644
--- a/root/install_portal/schemas/_schema_data.sql
+++ b/root/install_portal/schemas/_schema_data.sql
@@ -54,6 +54,7 @@ INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_link
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_show_announcements_replies_views', '1');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_show_news_replies_views', '1');
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_welcome_guest', '1');
+INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_enable', '1');
# Inserts who have to be checked at a later stage of the block pallet feature #
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_leaders_ext', '0');
diff --git a/root/install_portal/schemas/update_schema.php b/root/install_portal/schemas/update_schema.php
index 0d1c7826..c831adc7 100644
--- a/root/install_portal/schemas/update_schema.php
+++ b/root/install_portal/schemas/update_schema.php
@@ -73,4 +73,8 @@ $sql_update['1.0.0RC3'] = array(
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_show_news_replies_views', '1');",
);
+$sql_update['1.0.3'] = array(
+ "INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_enable', '1');",
+);
+
?>
\ No newline at end of file
diff --git a/root/language/de/mods/lang_portal_acp.php b/root/language/de/mods/lang_portal_acp.php
index 8e6a8ec4..c6e2dcb4 100644
--- a/root/language/de/mods/lang_portal_acp.php
+++ b/root/language/de/mods/lang_portal_acp.php
@@ -44,8 +44,8 @@ $lang = array_merge($lang, array(
'ACP_PORTAL_VERSION' => 'Board3 Portal Version v%s',
'ACP_PORTAL_GENERAL_SETTINGS' => 'Allgemeine Einstellungen',
'ACP_PORTAL_GENERAL_SETTINGS_EXPLAIN' => 'Hier kannst du die Haupteinstellungen vornehmen.',
- 'ACP_PORTAL_ENABLE' => 'Portal aktivieren',
- 'ACP_PORTAL_ENABLE_EXPLAIN' => 'Wenn deaktiviert, wird das komplette Portal abgeschaltet.',
+ 'PORTAL_ENABLE' => 'Portal aktivieren',
+ 'PORTAL_ENABLE_EXPLAIN' => 'Wenn deaktiviert, wird das komplette Portal abgeschaltet.',
'PORTAL_ADVANCED_STAT' => 'Erweiterte Statistik',
'PORTAL_ADVANCED_STAT_EXPLAIN' => 'Diesen Block auf dem Portal anzeigen.',
'PORTAL_LEADERS' => 'Team',
diff --git a/root/language/en/mods/lang_portal_acp.php b/root/language/en/mods/lang_portal_acp.php
index a1356255..e1269a44 100644
--- a/root/language/en/mods/lang_portal_acp.php
+++ b/root/language/en/mods/lang_portal_acp.php
@@ -45,6 +45,8 @@ $lang = array_merge($lang, array(
'ACP_PORTAL_VERSION' => 'Board3 Portal Version v%s',
'ACP_PORTAL_GENERAL_SETTINGS' => 'General settings',
'ACP_PORTAL_GENERAL_SETTINGS_EXPLAIN' => 'Here you can change your general and certain specific options.',
+ 'PORTAL_ENABLE' => 'Enable Portal',
+ 'PORTAL_ENABLE_EXPLAIN' => 'Turns the whole portal off.',
'PORTAL_ADVANCED_STAT' => 'Advanced statistics block',
'PORTAL_ADVANCED_STAT_EXPLAIN' => 'Display this block on the portal.',
'PORTAL_LEADERS' => 'Leaders / Team block',
diff --git a/root/portal.php b/root/portal.php
index 3f4d2d04..fa41ec98 100644
--- a/root/portal.php
+++ b/root/portal.php
@@ -22,6 +22,42 @@ include($phpbb_root_path . 'portal/includes/functions.'.$phpEx);
$portal_config = obtain_portal_config();
+ if (!$portal_config['portal_enable'])
+ {
+ // Redirect the user to the installer
+ // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information
+ // available as used by the redirect function
+ $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
+ $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
+ $secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
+
+ $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
+ if (!$script_name)
+ {
+ $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
+ }
+
+ // Replace any number of consecutive backslashes and/or slashes with a single slash
+ // (could happen on some proxy setups and/or Windows servers)
+ $script_path = trim(dirname($script_name)) . '/'.$phpbb_root_path.'index.' . $phpEx;
+ $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
+
+ $url = (($secure) ? 'https://' : 'http://') . $server_name;
+
+ if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
+ {
+ // HTTP HOST can carry a port number...
+ if (strpos($server_name, ':') === false)
+ {
+ $url .= ':' . $server_port;
+ }
+ }
+
+ $url .= $script_path;
+ header('Location: ' . $url);
+ exit;
+ }
+
// Start session management
$user->session_begin();
$auth->acl($user->data);