Changeset 2819
- Timestamp:
- 11/17/08 02:30:09 (8 weeks ago)
- Location:
- branches/081018-handlers/htdocs
- Files:
-
- 1 removed
- 7 modified
-
index.php (modified) (2 diffs)
-
system/classes/installhandler.php (modified) (3 diffs)
-
system/schema/mysql/install/mysqlinstall.php (modified) (4 diffs)
-
system/schema/pgsql/install/pgsqlinstall.php (modified) (4 diffs)
-
system/schema/sqlite/install/sqliteinstall.php (modified) (2 diffs)
-
system/themes/installer/locale_dropdown.php (deleted)
-
system/themes/installer/script.js (modified) (1 diff)
-
system/themes/installer/theme.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/081018-handlers/htdocs/index.php
r2818 r2819 20 20 date_default_timezone_set( 'UTC' ); 21 21 22 define('MIN_PHP_VERSION', '5.2.0'); 23 22 24 // Compares PHP version against our requirement. 23 if ( ! version_compare( PHP_VERSION, '5.2.0', '>=' ) ) {25 if ( ! version_compare( PHP_VERSION, MIN_PHP_VERSION, '>=' ) ) { 24 26 die ( 'Habari needs PHP 5.2.x or higher to run. You are currently running PHP ' . PHP_VERSION . '.' ); 25 27 } … … 112 114 Error::handle_errors(); 113 115 114 /* Initiate install verifications */115 116 117 /**118 * We make sure the configuration file exist.119 * If it does, we load it and check it's validity.120 *121 * @todo Call the installer from the database classes.122 */123 /*if ( file_exists( $config ) ) {124 require_once $config;125 126 if ( !defined( 'DEBUG' ) ) define( 'DEBUG', false );127 128 // Make sure we have a DSN string and database credentials.129 // $db_connection is an array with necessary informations to connect to the database.130 if ( ! isset($db_connection) ) {131 $installer = new InstallHandler();132 $installer->begin_install();133 }134 135 // Try to connect to the database.136 if (DB::connect()) {137 // Make sure Habari is installed properly.138 // If the 'installed' option is missing, we assume the database tables are missing or corrupted.139 // @todo Find a decent solution, we have to compare tables and restore or upgrade them.140 if (! @ Options::get('installed')) {141 $installer = new InstallHandler();142 $installer->begin_install();143 }144 }145 else {146 $installer = new InstallHandler();147 $installer->begin_install();148 }149 }150 else151 {152 if ( !defined( 'DEBUG' ) ) define( 'DEBUG', false );153 // The configuration file does not exist.154 // Therefore we load the installer to create the configuration file and install a base database.155 $installer = new InstallHandler();156 $installer->begin_install();157 } */158 159 116 DB::connect(); 160 117 -
branches/081018-handlers/htdocs/system/classes/installhandler.php
r2818 r2819 1 1 <?php 2 define('MIN_PHP_VERSION', '5.2.0');3 4 2 /** 5 3 * The class which responds to installer actions … … 28 26 * Set user selected Locale or default 29 27 */ 30 $this->theme->locales = Locale::list_all();31 28 if ( isset($_POST['locale']) && $_POST['locale'] != null ) { 32 29 Locale::set($_POST['locale']); 33 30 $this->theme->locale = $_POST['locale']; 34 31 $this->handler_vars['locale'] = $_POST['locale']; 35 }36 else {37 Locale::set( 'en-us' );38 $this->theme->locale = 'en-us';39 $this->handler_vars['locale'] = 'en_us';40 32 } 41 33 … … 137 129 EventLog::log(_t('Habari successfully installed.'), 'info', 'default', 'habari'); 138 130 return true; 139 }140 141 /*142 * Helper function to grab list of plugins143 */144 public function get_plugins() {145 $all_plugins = Plugins::list_all();146 $recommended_list = array(147 'coredashmodules.plugin.php',148 'habarisilo.plugin.php',149 'pingback.plugin.php',150 'spamchecker.plugin.php',151 'undelete.plugin.php'152 );153 154 foreach ( $all_plugins as $file ) {155 $plugin = array();156 $plugin_id = Plugins::id_from_file( $file );157 $plugin['plugin_id']= $plugin_id;158 $plugin['file']= $file;159 160 $error = '';161 if ( Utils::php_check_file_syntax( $file, $error ) ) {162 $plugin['debug']= false;163 // instantiate this plugin164 // in order to get its info()165 include_once( $file );166 Plugins::get_plugin_classes();167 $pluginobj = Plugins::load( $file, false );168 $plugin['active']= false;169 $plugin['verb']= _t( 'Activate' );170 $plugin['actions']= array();171 $plugin['info']= $pluginobj->info;172 $plugin['recommended'] = in_array( basename($file), $recommended_list );173 }174 else {175 $plugin['debug']= true;176 $plugin['error']= $error;177 $plugin['active']= false;178 }179 180 $plugins[$plugin_id]= $plugin;181 }182 183 return $plugins;184 131 } 185 132 -
branches/081018-handlers/htdocs/system/schema/mysql/install/mysqlinstall.php
r2818 r2819 22 22 23 23 $form->mysqlsettings->append('text', 'mysqldatabasehost', 'null:null', _t('Database Host')); 24 $form->mysqldatabasehost->value = $theme->mysqldatabasehost;24 $form->mysqldatabasehost->value = 'localhost'; 25 25 $form->mysqldatabasehost->required = true; 26 26 $form->mysqldatabasehost->help = _t('<strong>Database Host</strong> is the host (domain) name or server IP … … 31 31 32 32 $form->mysqlsettings->append('text', 'mysqldatabaseuser', 'null:null', _t('Username')); 33 $form->mysqldatabaseuser->value = $theme->mysqldatabaseuser;34 33 $form->mysqldatabaseuser->required = true; 35 34 $form->mysqldatabaseuser->help = _t('<strong>Database User</strong> is the username used to connect Habari … … 37 36 38 37 $form->mysqlsettings->append('text', 'mysqldatabasepass', 'null:null', _t('Password')); 39 $form->mysqldatabasepass->value = $theme->mysqldatabasepass;40 38 $form->mysqldatabasepass->required = true; 41 39 $form->mysqldatabasepass->help = _t('<strong>Database Password</strong> is the password used to connect … … 43 41 44 42 $form->mysqlsettings->append('text', 'mysqldatabasename', 'null:null', _t('Database Name')); 45 $form->mysqldatabasename->value = $theme->mysqldatabasename;43 $form->mysqldatabasename->value = 'habari'; 46 44 $form->mysqldatabasename->required = true; 47 45 $form->mysqldatabasename->help = _t('<strong>Database Name</strong> is the name of the MySQL database to -
branches/081018-handlers/htdocs/system/schema/pgsql/install/pgsqlinstall.php
r2818 r2819 22 22 23 23 $form->pgsqlsettings->append('text', 'pgsqldatabasehost', 'null:null', _t('Database Host')); 24 $form->pgsqldatabasehost->value = $theme->pgsqldatabasehost;24 $form->pgsqldatabasehost->value = 'localhost'; 25 25 $form->pgsqldatabasehost->required = true; 26 26 $form->pgsqldatabasehost->help = _t('<strong>Database Host</strong> is the host (domain) name or server IP … … 31 31 32 32 $form->pgsqlsettings->append('text', 'pgsqldatabaseuser', 'null:null', _t('Username')); 33 $form->pgsqldatabaseuser->value = $theme->pgsqldatabaseuser;34 33 $form->pgsqldatabaseuser->required = true; 35 34 $form->pgsqldatabaseuser->help = _t('<strong>Database User</strong> is the username used to connect Habari … … 37 36 38 37 $form->pgsqlsettings->append('text', 'pgsqldatabasepass', 'null:null', _t('Password')); 39 $form->pgsqldatabasepass->value = $theme->pgsqldatabasepass;40 38 $form->pgsqldatabasepass->required = true; 41 39 $form->pgsqldatabasepass->help = _t('<strong>Database Password</strong> is the password used to connect … … 43 41 44 42 $form->pgsqlsettings->append('text', 'pgsqldatabasename', 'null:null', _t('Database Name')); 45 $form->pgsqldatabasename->value = $theme->pgsqldatabasename;43 $form->pgsqldatabasename->value = 'habari'; 46 44 $form->pgsqldatabasename->required = true; 47 45 $form->pgsqldatabasename->help = _t('<strong>Database Name</strong> is the name of the PostgreSQL database to -
branches/081018-handlers/htdocs/system/schema/sqlite/install/sqliteinstall.php
r2818 r2819 22 22 23 23 $form->sqlitesettings->append('text', 'databasefile', 'null:null', _t('Data file')); 24 $form->databasefile->value = $theme->databasefile;24 $form->databasefile->value = 'habari.db'; 25 25 $form->databasefile->required = true; 26 26 $form->databasefile->help = _t('<strong>Data file</strong> is the SQLite file that will store … … 45 45 $theme->handler_vars['db_file']= $remainder; 46 46 } 47 48 /** 49 * Checks for the existance of a SQLite datafile 50 * tries to create it if it does not exist 51 **/ 52 private function check_sqlite() { 53 $db_file = $this->db_file; 54 if ( file_exists( $db_file ) && is_writable( $db_file ) && is_writable( dirname( $db_file ) ) ) { 55 // the file exists, and is writable. We're all set 56 return true; 57 } 58 59 // try to figure out what the problem is. 60 if ( file_exists( $db_file ) ) { 61 // the DB file exists, why can't we access it? 62 if ( ! is_writable( $db_file ) ) { 63 $this->assign('form_errors', array('db_file'=>_t('The SQLite data file is not writable by the web server.') ) ); 64 return false; 65 } 66 if ( ! is_writable( dirname( $db_file ) ) ) { 67 $this->assign('form_errors', array('db_file'=>_t('SQLite requires that the directory that holds the DB file be writable by the web server.') ) ); 68 return false; 69 } 70 } 71 72 if ( ! file_exists( $db_file ) ) { 73 // let's see if the directory is writable 74 // so that we could create the file 75 if ( ! is_writable( dirname( $db_file ) ) ) { 76 $this->assign('form_errors', array('db_file'=>_t('The SQLite data file does not exist, and it cannot be created in the specified directory. SQLite requires that the directory containing the database file be writable by the web server.')) ); 77 return false; 78 } 79 } 80 return true; 81 } 82 47 83 48 84 /** -
branches/081018-handlers/htdocs/system/themes/installer/script.js
r2818 r2819 56 56 if(installok) { 57 57 $('#siteconfiguration').addClass('done'); 58 $('#install').children('.options').fadeIn(). addClass('ready').addClass('done');59 $('#pluginactivation').children('.options').fadeIn(). addClass('ready').addClass('done');58 $('#install').children('.options').fadeIn().parent().addClass('ready').addClass('done'); 59 $('#pluginactivation').children('.options').fadeIn().parent().addClass('ready').addClass('done'); 60 60 $('#pluginactivation').children('.help-me').show(); 61 61 $('#submitinstall').removeAttr( 'disabled' ); -
branches/081018-handlers/htdocs/system/themes/installer/theme.php
r2818 r2819 4 4 class DefaultInstaller extends Theme 5 5 { 6 6 7 7 public function filter_control_theme_dir( $dirs ) 8 8 { … … 10 10 } 11 11 12 public function add_template_vars() 13 { 14 Locale::set( $this->form_locales()->locales->value ); 15 $this->plugins = $this->get_plugins(); 16 } 17 12 18 public function form_locales() 13 19 { 14 $loc s= array();15 foreach ( $this->locales as $loc) {16 $loc s[$loc]= $loc;20 $locales= array(); 21 foreach (Locale::list_all() as $locale) { 22 $locales[$locale]= $locale; 17 23 } 18 24 … … 24 30 25 31 $form->locale->append('wrapper', 'locale_options', null, 'installer_options'); 26 $form->locale_options->append('select', 'locales', 'null:null', _t('Language'), $loc s);27 $form->locales-> selected = $this->locale;32 $form->locale_options->append('select', 'locales', 'null:null', _t('Language'), $locales); 33 $form->locales->value = Options::get('locale'); 28 34 $form->locales->required = false; 29 35 $form->locales->help = ''; … … 31 37 $form->append('wrapper', 'locale_nextstep', null, 'installer_nextstep'); 32 38 39 $form->on_success( array($this, 'set_locale') ); 40 33 41 Plugins::act('install_form_localeform', $form, $this); 34 42 return $form; … … 47 55 // Database Type 48 56 $form->databasesetup_options->append('select', 'db_type', 'null:null', _t('Database Type')); 49 $form->db_type-> selected = $this->db_type;57 $form->db_type->value = 'mysql'; 50 58 $form->db_type->required = true; 51 59 $form->db_type->help = _t('<strong>Database Type</strong> specifies the type of database to which … … 57 65 // Table Prefix 58 66 $form->databasesetup_advancedoptions->append('text', 'table_prefix', 'null:null', _t('Table Prefix')); 59 $form->table_prefix->value = $this->table_prefix;67 $form->table_prefix->value = 'habari__'; 60 68 $form->table_prefix->help = _t('<strong>Table Prefix</strong> is a prefix that will be appended to 61 69 each table that Habari creates in the database, making it easy to … … 73 81 // Blog Title 74 82 $form->siteconfiguration_options->append('text', 'blog_title', 'null:null', _t('Site Name')); 75 $form->blog_title->value = $this->blog_title;83 $form->blog_title->value = 'My Habari'; 76 84 $form->blog_title->required = true; 77 85 $form->blog_title->help = _t('<strong>Site Name</strong> is the name of your site as it will appear … … 79 87 // Admin Username 80 88 $form->siteconfiguration_options->append('text', 'admin_username', 'null:null', _t('Username')); 81 $form->admin_username->value = $this->admin_username;89 $form->admin_username->value = 'admin'; 82 90 $form->admin_username->required = true; 83 91 $form->admin_username->help = _t('<strong>Username</strong> is the username of the initial user in … … 86 94 $form->siteconfiguration_options->append('wrapper', 'admin_pass_wrapper', null, 'installer_password_wrapper'); 87 95 $form->admin_pass_wrapper->append('password', 'admin_pass1', 'null:null', _t('Password'), 'installer_password'); 88 $form->admin_pass1->value = $this->admin_pass1;89 96 $form->admin_pass1->required = true; 90 97 $form->admin_pass_wrapper->append('password', 'admin_pass2', 'null:null', _t('Password (again)'), 'installer_password'); 91 $form->admin_pass2->value = $this->admin_pass2;92 98 $form->admin_pass2->required = true; 93 99 $form->admin_pass_wrapper->message = ''; … … 96 102 // Admin Email 97 103 $form->siteconfiguration_options->append('text', 'admin_email', 'null:null', _t('E-mail')); 98 $form->admin_email->value = $this->admin_email;99 104 $form->admin_email->required = true; 100 105 $form->admin_email->help = _t('<strong>Admin Email</strong> is the email address of the first user … … 130 135 } 131 136 137 /* 138 * Helper function to grab list of plugins 139 */ 140 public function get_plugins() { 141 $all_plugins = Plugins::list_all(); 142 $recommended_list = array( 143 'coredashmodules.plugin.php', 144 'habarisilo.plugin.php', 145 'pingback.plugin.php', 146 'spamchecker.plugin.php', 147 'undelete.plugin.php' 148 ); 149 150 foreach ( $all_plugins as $file ) { 151 $plugin = array(); 152 $plugin_id = Plugins::id_from_file( $file ); 153 $plugin['plugin_id']= $plugin_id; 154 $plugin['file']= $file; 155 156 $error = ''; 157 if ( Utils::php_check_file_syntax( $file, $error ) ) { 158 $plugin['debug']= false; 159 // instantiate this plugin 160 // in order to get its info() 161 include_once( $file ); 162 Plugins::get_plugin_classes(); 163 $pluginobj = Plugins::load( $file, false ); 164 $plugin['active']= false; 165 $plugin['verb']= _t( 'Activate' ); 166 $plugin['actions']= array(); 167 $plugin['info']= $pluginobj->info; 168 $plugin['recommended'] = in_array( basename($file), $recommended_list ); 169 } 170 else { 171 $plugin['debug']= true; 172 $plugin['error']= $error; 173 $plugin['active']= false; 174 } 175 176 $plugins[$plugin_id]= $plugin; 177 } 178 179 return $plugins; 180 } 181 132 182 } 133 183 ?>
