Revert install to require admin, rather than founder.

This commit is contained in:
Ice
2008-02-03 11:54:26 +00:00
parent 341ce7a74c
commit f521c31aef
3 changed files with 680 additions and 672 deletions

View File

@@ -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.<br /><a href="../ucp.php?mode=login"><strong>Zum Login</strong></a>',
'INSTALLER_NEEDS_ADMIN' => 'Du musst als Gründer eingeloggt sein.<br /><a href="../ucp.php?mode=login"><strong>Zum Login</strong></a>',
'INSTALLER_UPDATE' => 'Update',
'INSTALLER_UPDATE_MENU' => 'Updatemenü',

View File

@@ -27,23 +27,25 @@ $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');
if( $user->data['is_registered'] && $user->data['user_type'] == USER_ADMIN )
{
$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;
$old_version = 0;
$phpbb3portal = false;
$installed = $updated = $uninstalled =false;
$sql = 'SELECT config_value as version
$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 )
{
$result = @$db->sql_query_limit( $sql, 1 );
if( $db->sql_affectedrows($result) > 0 )
{
$version = $db->sql_fetchrow( $result );
$old_version = strtolower($version['version']);
}
else
{
}
else
{
$db->sql_freeresult( $result );
$sql = 'SELECT config_value as version
FROM ' . CONFIG_TABLE . "
@@ -55,26 +57,26 @@ else
$phpbb3portal = true;
$old_version = ( strtolower($version['version']) == '1.1.0.b' ) ? '1.1.0b' : strtolower($version['version']) ;
}
}
$db->sql_freeresult( $result );
}
$db->sql_freeresult( $result );
$check_mode = 'none';
$check_mode = 'none';
if( $old_version == 0 )
{
if( $old_version == 0 )
{
$check_mode = 'install';
}
elseif( $phpbb3portal === TRUE || version_compare( $old_version, $current_version, "<" ) === TRUE )
{
}
elseif( $phpbb3portal === TRUE || version_compare( $old_version, $current_version, "<" ) === TRUE )
{
$check_mode = 'update';
}
}
$confirm = request_var('confirm', 0);
$confirm = request_var('confirm', 0);
$error_array = array();
$error_array = array();
function split_sql_file($sql, $delimiter)
{
function split_sql_file($sql, $delimiter)
{
$sql = str_replace("\r" , '', $sql);
$data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);
@@ -89,10 +91,10 @@ function split_sql_file($sql, $delimiter)
}
return $data;
}
}
function db_error( $error, $sql, $line, $file, $skip = false )
{
function db_error( $error, $sql, $line, $file, $skip = false )
{
global $error, $lang, $db;
if( $skip )
@@ -110,10 +112,10 @@ function db_error( $error, $sql, $line, $file, $skip = false )
include $phpbb_root_path . 'install_portal/style/layout_footer.php';
exit;
}
}
}
function remove_comments(&$output)
{
function remove_comments(&$output)
{
$lines = explode("\n", $output);
$output = '';
@@ -141,16 +143,16 @@ function remove_comments(&$output)
unset($lines);
return $output;
}
}
function remove_remarks(&$sql)
{
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)
{
// What sql_layer should we use?
switch ($db->sql_layer)
{
case 'mysql':
$db_schema = 'mysql_40';
$delimiter = ';';
@@ -209,14 +211,14 @@ switch ($db->sql_layer)
default:
trigger_error('Sorry, unsupported DBMS found.');
break;
}
}
// Get old version if it is installed.
// Get old version if it is installed.
switch ($mode)
{
// Installing from scratch
case 'install':
switch ($mode)
{
// Installing from scratch
case 'install':
if( $check_mode == 'install' )
{
if( $confirm == 1)
@@ -472,9 +474,9 @@ case 'install':
{
include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
}
break;
// Updating
case 'update':
break;
// Updating
case 'update':
if( $check_mode == 'update' )
{
$confirm = request_var('confirm', '');
@@ -841,9 +843,9 @@ case 'update':
include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
}
break;
// Uninstalling
case 'uninstall':
break;
// Uninstalling
case 'uninstall':
if( $old_version != 0 )
{
if( $confirm == 1)
@@ -956,13 +958,19 @@ case 'uninstall':
include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
}
break;
// Welcome page!
default:
break;
// Welcome page!
default:
include($phpbb_root_path . 'install_portal/style/layout_menu.'.$phpEx);
break;
break;
}
} else {
include($phpbb_root_path . 'install_portal/style/layout_header.'.$phpEx);
echo '<h1>' . $user->lang['INSTALLER_ERROR'] . '</h1>';
echo '<p>' . $user->lang['INSTALLER_NEEDS_ADMIN'] . '</p>';
include($phpbb_root_path . 'install_portal/style/layout_footer.'.$phpEx);
}
?>

View File

@@ -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.<br /><a href="../ucp.php?mode=login"><strong>Go to login</strong>',
'INSTALLER_NEEDS_ADMIN' => 'You must be logged in as an admin.<br /><a href="../ucp.php?mode=login"><strong>Go to login</strong>',
'INSTALLER_UPDATE' => 'Update',
'INSTALLER_UPDATE_MENU' => 'Updatemenu',