install.php3
上传用户:xiao730204
上传日期:2007-01-04
资源大小:141k
文件大小:5k
- <?php
- /* Override the default setting of ./prometheus-library */
- // $PROMETHEUS_LIBRARY_BASE = './';
- /* Include all of the prometheus library bits */
- include( './prometheus-library/all.lib' );
- /* Autoload these classes */
- AutoLoad( 'PhpCapabilities' );
- AutoLoad( 'TemplateObject' );
- AutoLoad( 'Install_Mysql_Db' );
- /* Detect the capabilities of the php that is installed */
- $php_capabilities = new PhpCapabilities();
- $php_capabilities->Detect();
- $php_up_to_snuff = 0;
- if ( $php_capabilities->mysql != 1 ) {
- echo( 'NO SUPPORTED DATABASES - <BR>' );
- echo( 'Please install one of the following databases :<br>' );
- echo( '<ul>' );
- echo( '<li>Mysql --with-mysql' );
- echo( '</ul>' );
- $php_up_to_snuff = 0;
- } else {
- $php_up_to_snuff = 1;
- }
- if ( $php_capabilities->imap != 1 ) {
- echo( 'NO IMAP SUPPORT - <BR>' );
- echo( 'Please configure php with imap and try again.' );
- echo( '--with-imap MISSING' );
- $php_up_to_snuff = 0;
- } else {
- $php_up_to_snuff = 1;
- }
- if ( $php_up_to_snuff == 0 ) {
- // Their php does not meet our requirements
- exit();
- }
- /* Create the template obj */
- $template_obj = new TemplateObject();
- //echo 'Mysql available : ' . $php_capabilities->mysql . '<br>';
- //echo 'IMAP available : ' . $php_capabilities->imap . '<br>';
- //phpinfo();
- $template_dir = './templates/install';
- // Load the theme for the installer
- include( $template_dir . '/theme.inc' );
- $title = 'Prometheus installer';
- switch( $action ) {
- case MYSQL_DATABASE_CREATE:
- $status = '<ul>';
- $database_creation = new Install_Mysql_Db(
- $temp = new DbDefaults(
- $db_username,
- $db_password,
- $db_hostname,
- '',
- 'mysql',
- true,
- ''
- )
- );
- $database_creation->sql_base = './prometheus-library/sql/table/mysql';
- if ( $admin_privileges_db == 'on' ) {
- $database_creation->Create_AdminPrivileges_Db();
- $status .= '<li>Created the user admin privileges database';
- }
- if ( $customer_db == 'on' ) {
- $database_creation->Create_CustomerInformation_Db();
- $status .= '<li>Created the customer information database';
- }
- if ( $domain_db == 'on' ) {
- $database_creation->Create_Domains_Db();
- $status .= '<li>Created the user domains database';
- }
- if ( $mail_settings_db == 'on' ) {
- $database_creation->Create_MailServerSettings_Db();
- $status .= '<li>Created the mail server settings database';
- }
- if ( $user_settings_db == 'on' ) {
- $database_creation->Create_Settings_Db();
- $status .= '<li>Created the user settings database';
- }
- if ( $session_db == 'on' ) {
- $database_creation->Create_Sessions_Db();
- $status .= '<li>Created the sessions database';
- }
- if ( $user_db == 'on' ) {
- $database_creation->Create_User_Db();
- $status .= '<li>Created the user database';
- }
- if ( $prouser_create == 'on' ) {
- $database_creation->Create_ProUser();
- $status .= '<li>Created the prouser - prometheus mysql user';
- }
- $status .= '</ul>';
- $title = 'Database create';
- $form = 'create_results.inc';
- $action = 'CREATE_DB';
- $template_obj->Register( 'status', $status );
- break;
- case CHOOSE_DATABASE:
- if ( $db_type == 'mysql' ) {
- $title = 'Database creation';
- $form = 'mysql/create_dbs.inc';
- $action = 'MYSQL_AUTH_PARAMS';
- }
- break;
- case MYSQL_AUTH_PARAMS:
- $title = 'Mysql database creation account';
- $form = 'mysql/auth_params.inc';
- $action = 'MYSQL_DATABASE_CREATE';
- break;
- default:
- $action = 'CHOOSE_DATABASE';
- $title = 'Choose database';
- $form = 'choose_database.inc';
- break;
- }
- $template_obj->Register( 'title', $title );
- $template_obj->ParseTemplate( $template_dir . '/header.inc' );
- if ( $action != 'CHOOSE_DATABASE' ) {
- $hidden_vars = Array(
- 'action',
- 'db_type',
- 'session_db',
- 'user_db',
- 'domain_db',
- 'admin_privileges_db',
- 'customer_db',
- 'mail_settings_db',
- 'user_settings_db',
- 'prouser_create'
- );
- for( $i = 0; $i < count( $hidden_vars ); $i++ ) {
- $var = $hidden_vars[ $i ];
- $template_obj->Register( $var, $$var );
- }
- $template_obj->ParseTemplate( $template_dir . '/hidden.inc' );
- }
- $template_obj->ParseTemplate( $template_dir . '/' . $form );
- $template_obj->ParseTemplate( $template_dir . '/footer.inc' );
- ?>