diff --git a/languages/de/mods/portal_install.php b/languages/de/mods/portal_install.php
index 646648b5..6ef366fb 100644
--- a/languages/de/mods/portal_install.php
+++ b/languages/de/mods/portal_install.php
@@ -59,7 +59,7 @@ $lang = array_merge($lang, array(
'INSTALLER_UNINSTALL_NOTE' => 'Wikommen im Aktualisierungs Menü',
'INSTALLER_UNINSTALL_SUCCESSFUL' => 'Die Deinstallation des MODs v%s war erfolgreich.',
- 'INSTALLER_NEEDS_FOUNDER' => 'Du musst als Gründer eingeloggt sein.
Zum Login',
+ 'INSTALLER_NEEDS_ADMIN' => 'Du musst als Gründer eingeloggt sein.
Zum Login',
'INSTALLER_UPDATE' => 'Update',
'INSTALLER_UPDATE_MENU' => 'Updatemenü',
diff --git a/root/install_portal/install.php b/root/install_portal/install.php
index 4a9e8560..d2daebcd 100644
--- a/root/install_portal/install.php
+++ b/root/install_portal/install.php
@@ -27,460 +27,201 @@ $mode = request_var('mode', '');
$page_title = 'Board3portal v' . $current_version;
-$version_array = array('0.1.0', 'p3p1.2.2', 'p3p1.2.1', 'p3p1.2.0', 'p3p1.1.0b');
-
-$old_version = 0;
-$phpbb3portal = false;
-$installed = $updated = $uninstalled =false;
-
-$sql = 'SELECT config_value as version
- FROM ' . PORTAL_CONFIG_TABLE . "
- WHERE config_name = 'portal_version'";
-$result = @$db->sql_query_limit( $sql, 1 );
-if( $db->sql_affectedrows($result) > 0 )
+if( $user->data['is_registered'] && $user->data['user_type'] == USER_ADMIN )
{
- $version = $db->sql_fetchrow( $result );
- $old_version = strtolower($version['version']);
-}
-else
-{
- $db->sql_freeresult( $result );
+ $version_array = array('0.1.0', 'p3p1.2.2', 'p3p1.2.1', 'p3p1.2.0', 'p3p1.1.0b');
+
+ $old_version = 0;
+ $phpbb3portal = false;
+ $installed = $updated = $uninstalled =false;
+
$sql = 'SELECT config_value as version
- FROM ' . CONFIG_TABLE . "
+ FROM ' . PORTAL_CONFIG_TABLE . "
WHERE config_name = 'portal_version'";
$result = @$db->sql_query_limit( $sql, 1 );
- if( $db->sql_affectedrows($result) > 0 )
+ if( $db->sql_affectedrows($result) > 0 )
{
$version = $db->sql_fetchrow( $result );
- $phpbb3portal = true;
- $old_version = ( strtolower($version['version']) == '1.1.0.b' ) ? '1.1.0b' : strtolower($version['version']) ;
- }
-}
-$db->sql_freeresult( $result );
-
-$check_mode = 'none';
-
-if( $old_version == 0 )
-{
- $check_mode = 'install';
-}
-elseif( $phpbb3portal === TRUE || version_compare( $old_version, $current_version, "<" ) === TRUE )
-{
- $check_mode = 'update';
-}
-
-$confirm = request_var('confirm', 0);
-
-$error_array = array();
-
-function split_sql_file($sql, $delimiter)
-{
- $sql = str_replace("\r" , '', $sql);
- $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);
-
- $data = array_map('trim', $data);
-
- // The empty case
- $end_data = end($data);
-
- if (empty($end_data))
- {
- unset($data[key($data)]);
- }
-
- return $data;
-}
-
-function db_error( $error, $sql, $line, $file, $skip = false )
-{
- global $error, $lang, $db;
-
- if( $skip )
- {
- $error_array[] = '' . $user->lang['GENERAL_ERROR'] . ': ' . basename($file) . ' [ ' . $line . ' ]
- ' . $error . '
» SQL:' . $sql;
- return;
- } else {
- include $phpbb_root_path . 'install_portal/style/layout_header.php';
- echo '
-
'. $user->lang['GENERAL_ERROR'] .'
-
' . $error . '
» SQL:' . $sql . '
- ' . basename($file) . ' [ ' . $line . ' ]
-
';
- include $phpbb_root_path . 'install_portal/style/layout_footer.php';
- exit;
- }
-}
-
-function remove_comments(&$output)
-{
- $lines = explode("\n", $output);
- $output = '';
-
- // try to keep mem. use down
- $linecount = sizeof($lines);
-
- $in_comment = false;
- for ($i = 0; $i < $linecount; $i++)
- {
- if (trim($lines[$i]) == '/*')
- {
- $in_comment = true;
- }
-
- if (!$in_comment)
- {
- $output .= $lines[$i] . "\n";
- }
-
- if (trim($lines[$i]) == '*/')
- {
- $in_comment = false;
- }
- }
-
- unset($lines);
- return $output;
-}
-
-function remove_remarks(&$sql)
-{
- $sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
-}
-
-// What sql_layer should we use?
-switch ($db->sql_layer)
-{
- case 'mysql':
- $db_schema = 'mysql_40';
- $delimiter = ';';
- $comments = 'remove_remarks';
- break;
-
- case 'mysql4':
- if (version_compare($db->mysql_version, '4.1.3', '>='))
- {
- $db_schema = 'mysql_41';
- }
- else
- {
- $db_schema = 'mysql_40';
- }
- $delimiter = ';';
- $comments = 'remove_remarks';
- break;
-
- case 'mysqli':
- $db_schema = 'mysql_41';
- $delimiter = ';';
- $comments = 'remove_remarks';
- break;
-
- case 'mssql':
- $db_schema = 'mssql';
- $delimiter = 'GO';
- $comments = 'remove_comments';
- break;
-
- case 'postgres':
- $db_schema = 'postgres';
- $delimiter = ';';
- $comments = 'remove_comments';
- break;
-
- case 'sqlite':
- $db_schema = 'sqlite';
- $delimiter = ';';
- $comments = 'remove_remarks';
- break;
-
- case 'firebird':
- $db_schema = 'firebird';
- $delimiter = ';;';
- $comments = 'remove_remarks';
- break;
-
- case 'oracle':
- $db_schema = 'oracle';
- $delimiter = '/';
- $comments = 'remove_comments';
- break;
-
- default:
- trigger_error('Sorry, unsupported DBMS found.');
- break;
-}
-
-// Get old version if it is installed.
-
-switch ($mode)
-{
-// Installing from scratch
-case 'install':
- if( $check_mode == 'install' )
- {
- if( $confirm == 1)
- {
- // Drop thes tables if existing
- switch( $db->sql_layer )
- {
- case 'mysql4':
- case 'mysqli':
- case 'oracle':
- case 'firebird':
- case 'sqlite':
- case 'mysql':
- $sql = 'DROP TABLE IF EXISTS ' . $table_prefix . 'portal_config';
- $result = $db->sql_query($sql);
- $db->sql_freeresult($result);
- break;
- case '':
- $sql = 'SELECT version() as version';
- $result = $db->sql_query($sql);
- $data = $db->sql_fetchrow($result);
- if( version_compare($data['version'], '8.1.11', '>') === TRUE )
- {
- $sql = 'DROP TABLE IF EXISTS ' . $table_prefix . 'portal_config';
- $result = $db->sql_query($sql);
- $db->sql_freeresult($result);
- } else {
- $sql = 'DROP TABLE ' . $table_prefix . 'portal_config';
- $result = @$db->sql_query($sql);
- $db->sql_freeresult($result);
- }
- break;
- case 'mssql':
- $sql = 'if exists (select * from sysobjects where name = ' . $table_prefix . 'portal_config)
- drop table ' . $table_prefix . 'portal_config';
- $result = $db->sql_query($sql);
- $db->sql_freeresult($result);
- break;
- }
-
- // locate the schema files
- $dbms_schema = 'schemas/_' . $db_schema . '_schema.sql';
- $sql_query = @file_get_contents($dbms_schema);
- $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
- $comments($sql_query);
- $sql_query = split_sql_file($sql_query, $delimiter);
-
- // Make tables
- foreach ($sql_query as $sql)
- {
- if (!$db->sql_query($sql))
- {
- $error = $db->sql_error();
- db_error($error['message'], $sql, __LINE__, __FILE__);
- }
- }
- unset($sql_query);
-
- // Now for the data
-
- $sql_query = @file_get_contents('schemas/_schema_data.sql');
- switch ($db->sql_layer)
- {
- case 'mssql':
- case 'mssql_odbc':
- $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query);
- break;
- case 'postgres':
- $sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query);
- break;
- }
-
- $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
- $sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query));
- $sql_query = split_sql_file($sql_query, ';');
-
- $sql_query[] = "INSERT INTO {$table_prefix}portal_config (config_name, config_value) VALUES ('portal_version', '{$current_version}')";
-
- foreach ($sql_query as $sql)
- {
- if (!$db->sql_query($sql))
- {
- $error = $db->sql_error();
- db_error($error['message'], $sql, __LINE__, __FILE__);
- }
- }
- unset($sql_query);
-
- // create the acp modules - Nickvergessen's code
- $modules = new acp_modules();
- $portal = array(
- 'module_basename' => '',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => 31,
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_INFO',
- 'module_mode' => '',
- 'module_auth' => ''
- );
- $modules->update_module_data($portal);
- $general = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_GENERAL_INFO',
- 'module_mode' => 'general',
- 'module_auth' => ''
- );
- $modules->update_module_data($general);
- $news = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_NEWS_INFO',
- 'module_mode' => 'news',
- 'module_auth' => ''
- );
- $modules->update_module_data($news);
- $announcements = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_ANNOUNCE_INFO',
- 'module_mode' => 'announcements',
- 'module_auth' => ''
- );
- $modules->update_module_data($announcements);
- $welcome = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_WELCOME_INFO',
- 'module_mode' => 'welcome',
- 'module_auth' => ''
- );
- $modules->update_module_data($welcome);
- $recent = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_RECENT_INFO',
- 'module_mode' => 'recent',
- 'module_auth' => ''
- );
- $modules->update_module_data($recent);
- $wordgraph = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_WORDGRAPH_INFO',
- 'module_mode' => 'wordgraph',
- 'module_auth' => ''
- );
- $modules->update_module_data($wordgraph);
- $paypal = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_PAYPAL_INFO',
- 'module_mode' => 'paypal',
- 'module_auth' => ''
- );
- $modules->update_module_data($paypal);
- $attachments = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_INFO',
- 'module_mode' => 'attachments',
- 'module_auth' => ''
- );
- $modules->update_module_data($attachments);
- $members = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_MEMBERS_INFO',
- 'module_mode' => 'members',
- 'module_auth' => ''
- );
- $modules->update_module_data($members);
- $polls = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_POLLS_INFO',
- 'module_mode' => 'polls',
- 'module_auth' => ''
- );
- $modules->update_module_data($polls);
- $bots = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_BOTS_INFO',
- 'module_mode' => 'bots',
- 'module_auth' => ''
- );
- $modules->update_module_data($bots);
- $poster = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_MOST_POSTER_INFO',
- 'module_mode' => 'poster',
- 'module_auth' => ''
- );
- $modules->update_module_data($poster);
- $minicalendar = array(
- 'module_basename' => 'portal',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => $portal['module_id'],
- 'module_class' => 'acp',
- 'module_langname' => 'ACP_PORTAL_MINICALENDAR_INFO',
- 'module_mode' => 'minicalendar',
- 'module_auth' => ''
- );
- $modules->update_module_data($minicalendar);
- // clear cache and log what we did
- $cache->purge();
- add_log('admin', $page_title . ' installed');
- $installed = true;
- }
- include($phpbb_root_path . 'install_portal/style/layout_install.'.$phpEx);
+ $old_version = strtolower($version['version']);
}
else
{
- include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
- }
-break;
-// Updating
-case 'update':
- if( $check_mode == 'update' )
- {
- $confirm = request_var('confirm', '');
- if( $confirm == 1 )
+ $db->sql_freeresult( $result );
+ $sql = 'SELECT config_value as version
+ FROM ' . CONFIG_TABLE . "
+ WHERE config_name = 'portal_version'";
+ $result = @$db->sql_query_limit( $sql, 1 );
+ if( $db->sql_affectedrows($result) > 0 )
{
- if( $phpbb3portal === TRUE )
+ $version = $db->sql_fetchrow( $result );
+ $phpbb3portal = true;
+ $old_version = ( strtolower($version['version']) == '1.1.0.b' ) ? '1.1.0b' : strtolower($version['version']) ;
+ }
+ }
+ $db->sql_freeresult( $result );
+
+ $check_mode = 'none';
+
+ if( $old_version == 0 )
+ {
+ $check_mode = 'install';
+ }
+ elseif( $phpbb3portal === TRUE || version_compare( $old_version, $current_version, "<" ) === TRUE )
+ {
+ $check_mode = 'update';
+ }
+
+ $confirm = request_var('confirm', 0);
+
+ $error_array = array();
+
+ function split_sql_file($sql, $delimiter)
+ {
+ $sql = str_replace("\r" , '', $sql);
+ $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);
+
+ $data = array_map('trim', $data);
+
+ // The empty case
+ $end_data = end($data);
+
+ if (empty($end_data))
+ {
+ unset($data[key($data)]);
+ }
+
+ return $data;
+ }
+
+ function db_error( $error, $sql, $line, $file, $skip = false )
+ {
+ global $error, $lang, $db;
+
+ if( $skip )
+ {
+ $error_array[] = '' . $user->lang['GENERAL_ERROR'] . ': ' . basename($file) . ' [ ' . $line . ' ]
+ ' . $error . '
» SQL:' . $sql;
+ return;
+ } else {
+ include $phpbb_root_path . 'install_portal/style/layout_header.php';
+ echo '
+
'. $user->lang['GENERAL_ERROR'] .'
+
' . $error . '
» SQL:' . $sql . '
+ ' . basename($file) . ' [ ' . $line . ' ]
+
';
+ include $phpbb_root_path . 'install_portal/style/layout_footer.php';
+ exit;
+ }
+ }
+
+ function remove_comments(&$output)
+ {
+ $lines = explode("\n", $output);
+ $output = '';
+
+ // try to keep mem. use down
+ $linecount = sizeof($lines);
+
+ $in_comment = false;
+ for ($i = 0; $i < $linecount; $i++)
+ {
+ if (trim($lines[$i]) == '/*')
+ {
+ $in_comment = true;
+ }
+
+ if (!$in_comment)
+ {
+ $output .= $lines[$i] . "\n";
+ }
+
+ if (trim($lines[$i]) == '*/')
+ {
+ $in_comment = false;
+ }
+ }
+
+ unset($lines);
+ return $output;
+ }
+
+ function remove_remarks(&$sql)
+ {
+ $sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
+ }
+
+ // What sql_layer should we use?
+ switch ($db->sql_layer)
+ {
+ case 'mysql':
+ $db_schema = 'mysql_40';
+ $delimiter = ';';
+ $comments = 'remove_remarks';
+ break;
+
+ case 'mysql4':
+ if (version_compare($db->mysql_version, '4.1.3', '>='))
+ {
+ $db_schema = 'mysql_41';
+ }
+ else
+ {
+ $db_schema = 'mysql_40';
+ }
+ $delimiter = ';';
+ $comments = 'remove_remarks';
+ break;
+
+ case 'mysqli':
+ $db_schema = 'mysql_41';
+ $delimiter = ';';
+ $comments = 'remove_remarks';
+ break;
+
+ case 'mssql':
+ $db_schema = 'mssql';
+ $delimiter = 'GO';
+ $comments = 'remove_comments';
+ break;
+
+ case 'postgres':
+ $db_schema = 'postgres';
+ $delimiter = ';';
+ $comments = 'remove_comments';
+ break;
+
+ case 'sqlite':
+ $db_schema = 'sqlite';
+ $delimiter = ';';
+ $comments = 'remove_remarks';
+ break;
+
+ case 'firebird':
+ $db_schema = 'firebird';
+ $delimiter = ';;';
+ $comments = 'remove_remarks';
+ break;
+
+ case 'oracle':
+ $db_schema = 'oracle';
+ $delimiter = '/';
+ $comments = 'remove_comments';
+ break;
+
+ default:
+ trigger_error('Sorry, unsupported DBMS found.');
+ break;
+ }
+
+ // Get old version if it is installed.
+
+ switch ($mode)
+ {
+ // Installing from scratch
+ case 'install':
+ if( $check_mode == 'install' )
+ {
+ if( $confirm == 1)
{
// Drop thes tables if existing
switch( $db->sql_layer )
@@ -517,7 +258,7 @@ case 'update':
$db->sql_freeresult($result);
break;
}
-
+
// locate the schema files
$dbms_schema = 'schemas/_' . $db_schema . '_schema.sql';
$sql_query = @file_get_contents($dbms_schema);
@@ -536,7 +277,7 @@ case 'update':
}
unset($sql_query);
- // Start by inserting default data
+ // Now for the data
$sql_query = @file_get_contents('schemas/_schema_data.sql');
switch ($db->sql_layer)
@@ -553,8 +294,9 @@ case 'update':
$sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
$sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query));
$sql_query = split_sql_file($sql_query, ';');
-
+
$sql_query[] = "INSERT INTO {$table_prefix}portal_config (config_name, config_value) VALUES ('portal_version', '{$current_version}')";
+
foreach ($sql_query as $sql)
{
if (!$db->sql_query($sql))
@@ -564,84 +306,8 @@ case 'update':
}
}
unset($sql_query);
-
- // Set old settings.
- $sql = 'SELECT * FROM ' . PORTAL_CONFIG_TABLE;
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- if (isset($config[$row['config_name']]))
- {
- $sql2 = 'UPDATE ' . PORTAL_CONFIG_TABLE . " SET config_value = '" . $config[$row['config_name']] . "' WHERE config_name = '" . $row['config_name'] . "' LIMIT 1";
- $db->sql_query($sql2);
- $sql3 = 'DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = '" . $row['config_name'] . "' LIMIT 1";
- $db->sql_query($sql3);
- }
- }
- $db->sql_freeresult($result);
- $sql = 'UPDATE ' . PORTAL_CONFIG_TABLE . " SET config_value = '{$current_version}' where config_name = 'portal_version'";
- $db->sql_query($sql);
-
- // Delete old portal stuff
- $sql = "ALTER TABLE {$table_prefix}config CHANGE config_value config_value varchar(255) NOT NULL";
- $db->sql_query($sql);
-
- $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
- WHERE module_langname = 'ACP_PORTAL_GENERAL_INFO'
- OR module_langname = 'ACP_PORTAL_NEWS_INFO'
- OR module_langname = 'ACP_PORTAL_ANNOUNCE_INFO'
- OR module_langname = 'ACP_PORTAL_WELCOME_INFO'
- OR module_langname = 'ACP_PORTAL_RECENT_INFO'
- OR module_langname = 'ACP_PORTAL_WORDGRAPH_INFO'
- OR module_langname = 'ACP_PORTAL_PAYPAL_INFO'
- OR module_langname = 'ACP_PORTAL_ADS_INFO'
- OR module_langname = 'ACP_PORTAL_ATTACHMENTS_NUMBER_INFO'
- OR module_langname = 'ACP_PORTAL_MEMBERS_INFO'
- OR module_langname = 'ACP_PORTAL_POLLS_INFO'
- OR module_langname = 'ACP_PORTAL_BOTS_INFO'
- OR module_langname = 'ACP_PORTAL_MOST_POSTER_INFO'
- OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
- $db->sql_query($sql);
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET left_id = left_id - 2
- WHERE module_class = 'acp'
- AND left_id > {$row['right_id']}";
- $db->sql_query($sql);
-
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET right_id = right_id - 2
- WHERE module_class = 'acp'
- AND right_id > {$row['right_id']}";
- $db->sql_query($sql);
- }
- $db->sql_freeresult($result);
-
- $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
- WHERE module_langname = 'ACP_PORTAL_INFO'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
- $db->sql_query($sql);
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET left_id = left_id - 2
- WHERE module_class = 'acp'
- AND left_id > {$row['right_id']}";
- $db->sql_query($sql);
-
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET right_id = right_id - 2
- WHERE module_class = 'acp'
- AND right_id > {$row['right_id']}";
- $db->sql_query($sql);
- }
- $db->sql_freeresult($result);
-
- // create the acp modules
+
+ // create the acp modules - Nickvergessen's code
$modules = new acp_modules();
$portal = array(
'module_basename' => '',
@@ -797,172 +463,514 @@ case 'update':
'module_auth' => ''
);
$modules->update_module_data($minicalendar);
-
// clear cache and log what we did
$cache->purge();
- add_log('admin', $page_title . ' updated');
- $updated = true;
- }
- else
- {
- $portal_update_array = array();
-
- include 'schemas/update_schema.php';
-
- foreach( $sql_update as $sql_ver => $sql_data )
- {
- if( version_compare($old_version, $sql_ver, ">=") === TRUE )
- {
- continue;
- } else {
- $portal_update_array = array_merge($portal_update_array, $sql_data);
- }
- }
-
- $portal_update_array[] = 'UPDATE ' . PORTAL_CONFIG_TABLE . " SET config_value='{$current_version}' WHERE config_name = 'portal_version'";
-
- foreach($portal_update_array as $sql)
- {
- $sql = preg_replace('#phpbb_#i', $table_prefix, $sql);
- if (!$db->sql_query($sql))
- {
- $error = $db->sql_error();
- db_error($error['message'], $sql, __LINE__, __FILE__);
- }
- }
- unset($portal_update_array, $sql_update);
- $updated = true;
+ add_log('admin', $page_title . ' installed');
+ $installed = true;
}
+ include($phpbb_root_path . 'install_portal/style/layout_install.'.$phpEx);
}
- include($phpbb_root_path . 'install_portal/style/layout_update.'.$phpEx);
- }
- else
- {
- include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
- }
-
-break;
-// Uninstalling
-case 'uninstall':
- if( $old_version != 0 )
- {
- if( $confirm == 1)
+ else
{
- if( $phpbb3portal === FALSE )
+ include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
+ }
+ break;
+ // Updating
+ case 'update':
+ if( $check_mode == 'update' )
+ {
+ $confirm = request_var('confirm', '');
+ if( $confirm == 1 )
{
- // Drop thes tables if existing
- switch( $db->sql_layer )
+ if( $phpbb3portal === TRUE )
{
- case 'mysql4':
- case 'mysqli':
- case 'oracle':
- case 'firebird':
- case 'sqlite':
- case 'mysql':
- $sql = 'DROP TABLE IF EXISTS ' . $table_prefix . 'portal_config';
- $result = $db->sql_query($sql);
- $db->sql_freeresult($result);
- break;
- case '':
- $sql = 'SELECT version() as version';
- $result = $db->sql_query($sql);
- $data = $db->sql_fetchrow($result);
- if( version_compare($data['version'], '8.1.11', '>') === TRUE )
- {
+ // Drop thes tables if existing
+ switch( $db->sql_layer )
+ {
+ case 'mysql4':
+ case 'mysqli':
+ case 'oracle':
+ case 'firebird':
+ case 'sqlite':
+ case 'mysql':
$sql = 'DROP TABLE IF EXISTS ' . $table_prefix . 'portal_config';
$result = $db->sql_query($sql);
$db->sql_freeresult($result);
- } else {
- $sql = 'DROP TABLE ' . $table_prefix . 'portal_config';
- $result = @$db->sql_query($sql);
+ break;
+ case '':
+ $sql = 'SELECT version() as version';
+ $result = $db->sql_query($sql);
+ $data = $db->sql_fetchrow($result);
+ if( version_compare($data['version'], '8.1.11', '>') === TRUE )
+ {
+ $sql = 'DROP TABLE IF EXISTS ' . $table_prefix . 'portal_config';
+ $result = $db->sql_query($sql);
+ $db->sql_freeresult($result);
+ } else {
+ $sql = 'DROP TABLE ' . $table_prefix . 'portal_config';
+ $result = @$db->sql_query($sql);
+ $db->sql_freeresult($result);
+ }
+ break;
+ case 'mssql':
+ $sql = 'if exists (select * from sysobjects where name = ' . $table_prefix . 'portal_config)
+ drop table ' . $table_prefix . 'portal_config';
+ $result = $db->sql_query($sql);
$db->sql_freeresult($result);
+ break;
+ }
+
+ // locate the schema files
+ $dbms_schema = 'schemas/_' . $db_schema . '_schema.sql';
+ $sql_query = @file_get_contents($dbms_schema);
+ $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
+ $comments($sql_query);
+ $sql_query = split_sql_file($sql_query, $delimiter);
+
+ // Make tables
+ foreach ($sql_query as $sql)
+ {
+ if (!$db->sql_query($sql))
+ {
+ $error = $db->sql_error();
+ db_error($error['message'], $sql, __LINE__, __FILE__);
}
- break;
- case 'mssql':
- $sql = 'if exists (select * from sysobjects where name = ' . $table_prefix . 'portal_config)
- drop table ' . $table_prefix . 'portal_config';
- $result = $db->sql_query($sql);
- $db->sql_freeresult($result);
- break;
- }
-
- $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
- WHERE module_langname = 'ACP_PORTAL_GENERAL_INFO'
- OR module_langname = 'ACP_PORTAL_NEWS_INFO'
- OR module_langname = 'ACP_PORTAL_ANNOUNCE_INFO'
- OR module_langname = 'ACP_PORTAL_WELCOME_INFO'
- OR module_langname = 'ACP_PORTAL_RECENT_INFO'
- OR module_langname = 'ACP_PORTAL_WORDGRAPH_INFO'
- OR module_langname = 'ACP_PORTAL_PAYPAL_INFO'
- OR module_langname = 'ACP_PORTAL_ADS_INFO'
- OR module_langname = 'ACP_PORTAL_ATTACHMENTS_NUMBER_INFO'
- OR module_langname = 'ACP_PORTAL_MEMBERS_INFO'
- OR module_langname = 'ACP_PORTAL_POLLS_INFO'
- OR module_langname = 'ACP_PORTAL_BOTS_INFO'
- OR module_langname = 'ACP_PORTAL_MOST_POSTER_INFO'
- OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
- $db->sql_query($sql);
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET left_id = left_id - 2
- WHERE module_class = 'acp'
- AND left_id > {$row['right_id']}";
+ }
+ unset($sql_query);
+
+ // Start by inserting default data
+
+ $sql_query = @file_get_contents('schemas/_schema_data.sql');
+ switch ($db->sql_layer)
+ {
+ case 'mssql':
+ case 'mssql_odbc':
+ $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query);
+ break;
+ case 'postgres':
+ $sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query);
+ break;
+ }
+
+ $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
+ $sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query));
+ $sql_query = split_sql_file($sql_query, ';');
+
+ $sql_query[] = "INSERT INTO {$table_prefix}portal_config (config_name, config_value) VALUES ('portal_version', '{$current_version}')";
+ foreach ($sql_query as $sql)
+ {
+ if (!$db->sql_query($sql))
+ {
+ $error = $db->sql_error();
+ db_error($error['message'], $sql, __LINE__, __FILE__);
+ }
+ }
+ unset($sql_query);
+
+ // Set old settings.
+ $sql = 'SELECT * FROM ' . PORTAL_CONFIG_TABLE;
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (isset($config[$row['config_name']]))
+ {
+ $sql2 = 'UPDATE ' . PORTAL_CONFIG_TABLE . " SET config_value = '" . $config[$row['config_name']] . "' WHERE config_name = '" . $row['config_name'] . "' LIMIT 1";
+ $db->sql_query($sql2);
+ $sql3 = 'DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = '" . $row['config_name'] . "' LIMIT 1";
+ $db->sql_query($sql3);
+ }
+ }
+ $db->sql_freeresult($result);
+ $sql = 'UPDATE ' . PORTAL_CONFIG_TABLE . " SET config_value = '{$current_version}' where config_name = 'portal_version'";
$db->sql_query($sql);
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET right_id = right_id - 2
- WHERE module_class = 'acp'
- AND right_id > {$row['right_id']}";
- $db->sql_query($sql);
- }
- $db->sql_freeresult($result);
-
- $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
- WHERE module_langname = 'ACP_PORTAL_INFO'";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
- $db->sql_query($sql);
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET left_id = left_id - 2
- WHERE module_class = 'acp'
- AND left_id > {$row['right_id']}";
+ // Delete old portal stuff
+ $sql = "ALTER TABLE {$table_prefix}config CHANGE config_value config_value varchar(255) NOT NULL";
$db->sql_query($sql);
- $sql = 'UPDATE ' . MODULES_TABLE . "
- SET right_id = right_id - 2
- WHERE module_class = 'acp'
- AND right_id > {$row['right_id']}";
- $db->sql_query($sql);
+ $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
+ WHERE module_langname = 'ACP_PORTAL_GENERAL_INFO'
+ OR module_langname = 'ACP_PORTAL_NEWS_INFO'
+ OR module_langname = 'ACP_PORTAL_ANNOUNCE_INFO'
+ OR module_langname = 'ACP_PORTAL_WELCOME_INFO'
+ OR module_langname = 'ACP_PORTAL_RECENT_INFO'
+ OR module_langname = 'ACP_PORTAL_WORDGRAPH_INFO'
+ OR module_langname = 'ACP_PORTAL_PAYPAL_INFO'
+ OR module_langname = 'ACP_PORTAL_ADS_INFO'
+ OR module_langname = 'ACP_PORTAL_ATTACHMENTS_NUMBER_INFO'
+ OR module_langname = 'ACP_PORTAL_MEMBERS_INFO'
+ OR module_langname = 'ACP_PORTAL_POLLS_INFO'
+ OR module_langname = 'ACP_PORTAL_BOTS_INFO'
+ OR module_langname = 'ACP_PORTAL_MOST_POSTER_INFO'
+ OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
+ $db->sql_query($sql);
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET left_id = left_id - 2
+ WHERE module_class = 'acp'
+ AND left_id > {$row['right_id']}";
+ $db->sql_query($sql);
+
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET right_id = right_id - 2
+ WHERE module_class = 'acp'
+ AND right_id > {$row['right_id']}";
+ $db->sql_query($sql);
+ }
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
+ WHERE module_langname = 'ACP_PORTAL_INFO'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
+ $db->sql_query($sql);
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET left_id = left_id - 2
+ WHERE module_class = 'acp'
+ AND left_id > {$row['right_id']}";
+ $db->sql_query($sql);
+
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET right_id = right_id - 2
+ WHERE module_class = 'acp'
+ AND right_id > {$row['right_id']}";
+ $db->sql_query($sql);
+ }
+ $db->sql_freeresult($result);
+
+ // create the acp modules
+ $modules = new acp_modules();
+ $portal = array(
+ 'module_basename' => '',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => 31,
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_INFO',
+ 'module_mode' => '',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($portal);
+ $general = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_GENERAL_INFO',
+ 'module_mode' => 'general',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($general);
+ $news = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_NEWS_INFO',
+ 'module_mode' => 'news',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($news);
+ $announcements = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_ANNOUNCE_INFO',
+ 'module_mode' => 'announcements',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($announcements);
+ $welcome = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_WELCOME_INFO',
+ 'module_mode' => 'welcome',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($welcome);
+ $recent = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_RECENT_INFO',
+ 'module_mode' => 'recent',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($recent);
+ $wordgraph = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_WORDGRAPH_INFO',
+ 'module_mode' => 'wordgraph',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($wordgraph);
+ $paypal = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_PAYPAL_INFO',
+ 'module_mode' => 'paypal',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($paypal);
+ $attachments = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_INFO',
+ 'module_mode' => 'attachments',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($attachments);
+ $members = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_MEMBERS_INFO',
+ 'module_mode' => 'members',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($members);
+ $polls = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_POLLS_INFO',
+ 'module_mode' => 'polls',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($polls);
+ $bots = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_BOTS_INFO',
+ 'module_mode' => 'bots',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($bots);
+ $poster = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_MOST_POSTER_INFO',
+ 'module_mode' => 'poster',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($poster);
+ $minicalendar = array(
+ 'module_basename' => 'portal',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $portal['module_id'],
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_PORTAL_MINICALENDAR_INFO',
+ 'module_mode' => 'minicalendar',
+ 'module_auth' => ''
+ );
+ $modules->update_module_data($minicalendar);
+
+ // clear cache and log what we did
+ $cache->purge();
+ add_log('admin', $page_title . ' updated');
+ $updated = true;
+ }
+ else
+ {
+ $portal_update_array = array();
+
+ include 'schemas/update_schema.php';
+
+ foreach( $sql_update as $sql_ver => $sql_data )
+ {
+ if( version_compare($old_version, $sql_ver, ">=") === TRUE )
+ {
+ continue;
+ } else {
+ $portal_update_array = array_merge($portal_update_array, $sql_data);
+ }
+ }
+
+ $portal_update_array[] = 'UPDATE ' . PORTAL_CONFIG_TABLE . " SET config_value='{$current_version}' WHERE config_name = 'portal_version'";
+
+ foreach($portal_update_array as $sql)
+ {
+ $sql = preg_replace('#phpbb_#i', $table_prefix, $sql);
+ if (!$db->sql_query($sql))
+ {
+ $error = $db->sql_error();
+ db_error($error['message'], $sql, __LINE__, __FILE__);
+ }
+ }
+ unset($portal_update_array, $sql_update);
+ $updated = true;
}
- $db->sql_freeresult($result);
-
- $installed = true;
- }
- else
- {
- include($phpbb_root_path . 'install_portal/style/layout_header.'.$phpEx);
- echo '' . $user->lang['INSTALLER_ERROR'] . '
';
- echo '' . $user->lang['INSTALLER_UNINSTALL_OLDVERSION'] . '
';
- include($phpbb_root_path . 'install_portal/style/layout_footer.'.$phpEx);
}
+ include($phpbb_root_path . 'install_portal/style/layout_update.'.$phpEx);
}
- include($phpbb_root_path . 'install_portal/style/layout_uninstall.'.$phpEx);
- } else {
+ else
+ {
+ include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
+ }
+
+ break;
+ // Uninstalling
+ case 'uninstall':
+ if( $old_version != 0 )
+ {
+ if( $confirm == 1)
+ {
+ if( $phpbb3portal === FALSE )
+ {
+ // Drop thes tables if existing
+ switch( $db->sql_layer )
+ {
+ case 'mysql4':
+ case 'mysqli':
+ case 'oracle':
+ case 'firebird':
+ case 'sqlite':
+ case 'mysql':
+ $sql = 'DROP TABLE IF EXISTS ' . $table_prefix . 'portal_config';
+ $result = $db->sql_query($sql);
+ $db->sql_freeresult($result);
+ break;
+ case '':
+ $sql = 'SELECT version() as version';
+ $result = $db->sql_query($sql);
+ $data = $db->sql_fetchrow($result);
+ if( version_compare($data['version'], '8.1.11', '>') === TRUE )
+ {
+ $sql = 'DROP TABLE IF EXISTS ' . $table_prefix . 'portal_config';
+ $result = $db->sql_query($sql);
+ $db->sql_freeresult($result);
+ } else {
+ $sql = 'DROP TABLE ' . $table_prefix . 'portal_config';
+ $result = @$db->sql_query($sql);
+ $db->sql_freeresult($result);
+ }
+ break;
+ case 'mssql':
+ $sql = 'if exists (select * from sysobjects where name = ' . $table_prefix . 'portal_config)
+ drop table ' . $table_prefix . 'portal_config';
+ $result = $db->sql_query($sql);
+ $db->sql_freeresult($result);
+ break;
+ }
+
+ $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
+ WHERE module_langname = 'ACP_PORTAL_GENERAL_INFO'
+ OR module_langname = 'ACP_PORTAL_NEWS_INFO'
+ OR module_langname = 'ACP_PORTAL_ANNOUNCE_INFO'
+ OR module_langname = 'ACP_PORTAL_WELCOME_INFO'
+ OR module_langname = 'ACP_PORTAL_RECENT_INFO'
+ OR module_langname = 'ACP_PORTAL_WORDGRAPH_INFO'
+ OR module_langname = 'ACP_PORTAL_PAYPAL_INFO'
+ OR module_langname = 'ACP_PORTAL_ADS_INFO'
+ OR module_langname = 'ACP_PORTAL_ATTACHMENTS_NUMBER_INFO'
+ OR module_langname = 'ACP_PORTAL_MEMBERS_INFO'
+ OR module_langname = 'ACP_PORTAL_POLLS_INFO'
+ OR module_langname = 'ACP_PORTAL_BOTS_INFO'
+ OR module_langname = 'ACP_PORTAL_MOST_POSTER_INFO'
+ OR module_langname = 'ACP_PORTAL_MINICALENDAR_INFO'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
+ $db->sql_query($sql);
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET left_id = left_id - 2
+ WHERE module_class = 'acp'
+ AND left_id > {$row['right_id']}";
+ $db->sql_query($sql);
+
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET right_id = right_id - 2
+ WHERE module_class = 'acp'
+ AND right_id > {$row['right_id']}";
+ $db->sql_query($sql);
+ }
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT right_id, module_id FROM ' . MODULES_TABLE . "
+ WHERE module_langname = 'ACP_PORTAL_INFO'";
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql = 'DELETE FROM ' . MODULES_TABLE . " WHERE module_id = '{$row['module_id']}'";
+ $db->sql_query($sql);
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET left_id = left_id - 2
+ WHERE module_class = 'acp'
+ AND left_id > {$row['right_id']}";
+ $db->sql_query($sql);
+
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET right_id = right_id - 2
+ WHERE module_class = 'acp'
+ AND right_id > {$row['right_id']}";
+ $db->sql_query($sql);
+ }
+ $db->sql_freeresult($result);
+
+ $installed = true;
+ }
+ else
+ {
+ include($phpbb_root_path . 'install_portal/style/layout_header.'.$phpEx);
+ echo '' . $user->lang['INSTALLER_ERROR'] . '
';
+ echo '' . $user->lang['INSTALLER_UNINSTALL_OLDVERSION'] . '
';
+ include($phpbb_root_path . 'install_portal/style/layout_footer.'.$phpEx);
+ }
+ }
+ include($phpbb_root_path . 'install_portal/style/layout_uninstall.'.$phpEx);
+ } else {
+ include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
+ }
+
+ break;
+ // Welcome page!
+ default:
+
include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
+
+ break;
}
-
-break;
-// Welcome page!
-default:
-
- include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
-
-break;
+} else {
+ include($phpbb_root_path . 'install_portal/style/layout_header.'.$phpEx);
+ echo '' . $user->lang['INSTALLER_ERROR'] . '
';
+ echo '' . $user->lang['INSTALLER_NEEDS_ADMIN'] . '
';
+ include($phpbb_root_path . 'install_portal/style/layout_footer.'.$phpEx);
}
?>
\ No newline at end of file
diff --git a/root/language/en/mods/portal_install.php b/root/language/en/mods/portal_install.php
index a4d161d3..d22a1220 100644
--- a/root/language/en/mods/portal_install.php
+++ b/root/language/en/mods/portal_install.php
@@ -59,7 +59,7 @@ $lang = array_merge($lang, array(
'INSTALLER_UNINSTALL_NOTE' => 'Welcome to the Updatemenu',
'INSTALLER_UNINSTALL_SUCCESSFUL' => 'Installation of the MOD v%s was successful.',
- 'INSTALLER_NEEDS_FOUNDER' => 'You must be logged in as a founder.
Go to login',
+ 'INSTALLER_NEEDS_ADMIN' => 'You must be logged in as an admin.
Go to login',
'INSTALLER_UPDATE' => 'Update',
'INSTALLER_UPDATE_MENU' => 'Updatemenu',