- Timestamp:
- Dec 2, 2009, 9:27:06 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/template/goto/install.tpl
r3768 r4410 85 85 <th colspan="3">{'step1_title'|@translate}</th> 86 86 </tr> 87 {if count($F_DB_ENGINES)>1} 88 <tr> 89 <td style="width: 30%;">{'step1_dbengine'|@translate}</td> 90 <td> 91 <select name="dblayer"> 92 {html_options options=$F_DB_ENGINES selected=$F_DB_LAYER} 93 </select> 94 </td> 95 <td>{'step1_dbengine_info'|@translate}</td> 96 {else} 97 <td colspan="3"> 98 <input type="hidden" name="dbengine" value="{$F_DB_LAYER}"> 99 </td> 100 {/if} 101 </tr> 87 102 <tr> 88 103 <td style="width: 30%;">{'step1_host'|@translate}</td> -
trunk/install.php
r4385 r4410 25 25 define('PHPWG_ROOT_PATH','./'); 26 26 27 /** 28 * loads an sql file and executes all queries 29 * 30 * Before executing a query, $replaced is... replaced by $replacing. This is 31 * useful when the SQL file contains generic words. Drop table queries are 32 * not executed. 33 * 34 * @param string filepath 35 * @param string replaced 36 * @param string replacing 37 * @return void 38 */ 39 function execute_sqlfile($filepath, $replaced, $replacing) 40 { 41 $sql_lines = file($filepath); 42 $query = ''; 43 foreach ($sql_lines as $sql_line) 44 { 45 $sql_line = trim($sql_line); 46 if (preg_match('/(^--|^$)/', $sql_line)) 47 { 48 continue; 49 } 50 $query.= ' '.$sql_line; 51 // if we reached the end of query, we execute it and reinitialize the 52 // variable "query" 53 if (preg_match('/;$/', $sql_line)) 54 { 55 $query = trim($query); 56 $query = str_replace($replaced, $replacing, $query); 57 // we don't execute "DROP TABLE" queries 58 if (!preg_match('/^DROP TABLE/i', $query)) 59 { 60 global $install_charset_collate; 61 if ( !empty($install_charset_collate) ) 62 { 63 if ( preg_match('/^(CREATE TABLE .*)[\s]*;[\s]*/im', $query, $matches) ) 64 { 65 $query = $matches[1].' '.$install_charset_collate.';'; 66 } 67 } 68 pwg_query($query); 69 } 70 $query = ''; 71 } 72 } 73 } 27 include(PHPWG_ROOT_PATH . 'admin/include/functions_install.inc.php'); 74 28 75 29 @set_magic_quotes_runtime(0); // Disable magic_quotes_runtime … … 150 104 $dbpasswd = (!empty($_POST['dbpasswd'])) ? $_POST['dbpasswd'] : ''; 151 105 $dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : ''; 106 $dblayer = (!empty($_POST['dblayer'])) ? $_POST['dblayer'] : 'mysql'; 152 107 153 108 if (isset($_POST['install'])) … … 183 138 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); 184 139 @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); 185 include(PHPWG_ROOT_PATH . 'include/dblayer/functions_mysql.inc.php');140 include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php'); 186 141 include(PHPWG_ROOT_PATH . 'include/constants.php'); 187 142 include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); … … 233 188 //----------------------------------------------------- template initialization 234 189 include( PHPWG_ROOT_PATH .'include/template.class.php'); 235 $template =new Template(PHPWG_ROOT_PATH.'admin/template/goto', 'roma');190 $template = new Template(PHPWG_ROOT_PATH.'admin/template/goto', 'roma'); 236 191 $template->set_filenames( array('install'=>'install.tpl') ); 237 192 $step = 1; … … 239 194 if ( isset( $_POST['install'] )) 240 195 { 241 if ( @mysql_connect( $_POST['dbhost'], 242 $_POST['dbuser'], 243 $_POST['dbpasswd'] ) ) 244 { 245 if ( @mysql_select_db($_POST['dbname'] ) ) 246 { 247 array_push( $infos, l10n('step1_confirmation') ); 196 if (($pwg_db_link = pwg_db_connect($_POST['dbhost'], $_POST['dbuser'], 197 $_POST['dbpasswd'], $_POST['dbname']))!==false) 198 { 199 200 array_push( $infos, l10n('step1_confirmation') ); 201 202 $required_version = constant('REQUIRED_'.strtoupper($conf['dblayer']).'_VERSION'); 203 if ( version_compare(pwg_get_db_version(), $required_version, '>=') ) 204 { 205 $pwg_charset = 'utf-8'; 206 $pwg_db_charset = 'utf8'; 207 if ($dblayer=='mysql') 208 { 209 $install_charset_collate = "DEFAULT CHARACTER SET $pwg_db_charset"; 210 } 211 else 212 { 213 $install_charset_collate = ''; 214 } 248 215 } 249 216 else 250 217 { 251 array_push( $errors, l10n('step1_err_db') ); 252 } 253 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) 254 { 255 $pwg_charset='utf-8'; 256 $pwg_db_charset='utf8'; 257 $install_charset_collate = "DEFAULT CHARACTER SET $pwg_db_charset"; 258 } 259 else 260 { 261 $pwg_charset='iso-8859-1'; 262 $pwg_db_charset='latin1'; 218 $pwg_charset = 'iso-8859-1'; 219 $pwg_db_charset = 'latin1'; 263 220 $install_charset_collate = ''; 264 221 if ( !array_key_exists($language, get_languages($pwg_charset) ) ) … … 293 250 $step = 2; 294 251 $file_content = '<?php 295 $conf[\'dblayer\'] = \' mysql\';252 $conf[\'dblayer\'] = \''.$dblayer.'\'; 296 253 $conf[\'db_base\'] = \''.$dbname.'\'; 297 254 $conf[\'db_user\'] = \''.$dbuser.'\'; … … 327 284 // tables creation, based on piwigo_structure.sql 328 285 execute_sqlfile( 329 PHPWG_ROOT_PATH.'install/piwigo_structure .sql',286 PHPWG_ROOT_PATH.'install/piwigo_structure-'.$dblayer.'.sql', 330 287 DEFAULT_PREFIX_TABLE, 331 288 $table_prefix … … 337 294 $table_prefix 338 295 ); 296 297 $query = ' 298 INSERT INTO piwigo_config (param,value,comment) 299 VALUES (\'secret_key\',\'md5('.pwg_db_cast_to_text(DB_RANDOM_FUNCTION.'()').')\', 300 \'a secret key specific to the gallery for internal use\');'; 301 pwg_query($query); 339 302 340 303 // fill $conf global array … … 390 353 391 354 //------------------------------------------------------ start template output 355 $dbengines = available_engines(); 356 392 357 foreach (get_languages('utf-8') as $language_code => $language_name) 393 358 { … … 403 368 array( 404 369 'T_CONTENT_ENCODING' => 'utf-8', 405 'RELEASE' =>PHPWG_VERSION,370 'RELEASE' => PHPWG_VERSION, 406 371 'F_ACTION' => 'install.php?language=' . $language, 407 'F_DB_HOST'=>$dbhost, 408 'F_DB_USER'=>$dbuser, 409 'F_DB_NAME'=>$dbname, 372 'F_DB_ENGINES' => $dbengines, 373 'F_DB_LAYER' => $dblayer, 374 'F_DB_HOST' => $dbhost, 375 'F_DB_USER' => $dbuser, 376 'F_DB_NAME' => $dbname, 410 377 'F_DB_PREFIX' => $table_prefix, 411 'F_ADMIN' =>$admin_name,412 'F_ADMIN_EMAIL' =>$admin_mail,413 'L_INSTALL_HELP' =>sprintf(l10n('install_help'), PHPWG_URL.'/forum'),378 'F_ADMIN' => $admin_name, 379 'F_ADMIN_EMAIL' => $admin_mail, 380 'L_INSTALL_HELP' => sprintf(l10n('install_help'), PHPWG_URL.'/forum'), 414 381 )); 415 382 -
trunk/install/config.sql
r3445 r4410 18 18 INSERT INTO piwigo_config (param,value,comment) VALUES ('history_guest','true','keep a history of guest visits on your website'); 19 19 INSERT INTO piwigo_config (param,value,comment) VALUES ('allow_user_registration','true','allow visitors to register?'); 20 INSERT INTO piwigo_config (param,value,comment) VALUES ('secret_key', MD5(RAND()), 'a secret key specific to the gallery for internal use');21 20 INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_send_html_mail','true','Send mail on HTML format for notification by mail'); 22 21 INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_send_mail_as','','Send mail as param value for notification by mail'); -
trunk/language/de_DE/install.lang.php
r4280 r4410 37 37 $lang['step1_err_server'] = 'Es konnte keine Verbindung zum Datenbankserver aufgebaut werden'; 38 38 39 $lang['step1_host'] = 'MySQL Host'; 39 $lang['step1_dbengine'] = 'Database type'; 40 $lang['step1_dbengine_info'] = 'The type of database your piwigo data will be store in'; 41 $lang['step1_host'] = 'Host'; 40 42 $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr'; 41 43 $lang['step1_user'] = 'Benutzer'; -
trunk/language/en_UK/install.lang.php
r4280 r4410 40 40 $lang['step1_err_copy'] = 'Copy the text in pink between hyphens and paste it into the file "include/config_database.inc.php"(Warning : config_database.inc.php must only contain what is in pink, no line return or space character)'; 41 41 42 $lang['step1_host'] = 'MySQL host'; 42 $lang['step1_dbengine'] = 'Database type'; 43 $lang['step1_dbengine_info'] = 'The type of database your piwigo data will be store in'; 44 $lang['step1_host'] = 'Host'; 43 45 $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr'; 44 46 $lang['step1_user'] = 'User'; -
trunk/language/es_ES/install.lang.php
r4280 r4410 37 37 $lang['step1_err_server'] = 'Imposible conectarse al servidor'; 38 38 39 $lang['step1_host'] = 'Huésped MySQL'; 39 $lang['step1_dbengine'] = 'Database type'; 40 $lang['step1_dbengine_info'] = 'The type of database your piwigo data will be store in'; 41 $lang['step1_host'] = 'Huésped'; 40 42 $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr'; 41 43 $lang['step1_user'] = 'Utilizador'; -
trunk/language/fr_FR/install.lang.php
r4280 r4410 37 37 $lang['step1_err_server'] = 'Impossible de se connecter au serveur'; 38 38 39 $lang['step1_host'] = 'Hôte MySQL'; 39 $lang['step1_dbengine'] = 'Type de base de données'; 40 $lang['step1_dbengine_info'] = 'La base de données à utiliser pour installer piwigo'; 41 $lang['step1_host'] = 'Hôte'; 40 42 $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr'; 41 43 $lang['step1_user'] = 'Utilisateur'; -
trunk/language/it_IT/install.lang.php
r4280 r4410 37 37 $lang['step1_err_server'] = 'Non è stato possibile connettersi al server'; 38 38 39 $lang['step1_host'] = 'MySQL host'; 39 $lang['step1_dbengine'] = 'Database type'; 40 $lang['step1_dbengine_info'] = 'The type of database your piwigo data will be store in'; 41 $lang['step1_host'] = 'Host'; 40 42 $lang['step1_host_info'] = 'localhost, sql.multimania.com, pluto.libero.it'; 41 43 $lang['step1_user'] = 'Utente'; -
trunk/language/nl_NL/install.lang.php
r4280 r4410 40 40 $lang['step1_err_copy'] = 'Kopieer de tekst tussen de lijnen en plak deze in het bestand "include/config_database.inc.php"(Waarschuwing: config_database.inc.php mag alleen het roze gedeelte bevatten, geen return of extra spatie). Dit moet alleen wanneer dit bestand geen schrijfrechten'; 41 41 42 $lang['step1_host'] = 'MySQL host'; 42 $lang['step1_dbengine'] = 'Database type'; 43 $lang['step1_dbengine_info'] = 'The type of database your piwigo data will be store in'; 44 $lang['step1_host'] = 'Host'; 43 45 $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr'; 44 46 $lang['step1_user'] = 'Gebruiker'; -
trunk/language/pl_PL/install.lang.php
r4280 r4410 40 40 $lang['step1_err_copy'] = 'Skopiuj tekst zaznaczony na różowo pomiędzy cudzysłowiami i wklej do pliku "include/config_database.inc.php"(Uwaga : config_database.inc.php musi zawierać tylko to co jest na różowo bez żadnych znaków końca linii czy spacji)'; 41 41 42 $lang['step1_host'] = 'MySQL host'; 42 $lang['step1_dbengine'] = 'Database type'; 43 $lang['step1_dbengine_info'] = 'The type of database your piwigo data will be store in'; 44 $lang['step1_host'] = 'Host'; 43 45 $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr'; 44 46 $lang['step1_user'] = 'Uzytkownik';
Note: See TracChangeset
for help on using the changeset viewer.