- Timestamp:
- Apr 11, 2006, 9:50:15 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/install.php
r1079 r1147 33 33 { 34 34 return 'en_UK.iso-8859-1'; 35 36 // $languages = array();37 // $i = 0;38 // if ($opendir = opendir(PHPWG_ROOT_PATH.'language/'))39 // {40 // while ( $file = readdir ( $opendir ) )41 // {42 // if ( is_dir ( PHPWG_ROOT_PATH.'language/'.$file )&& !substr_count($file,'.'))43 // {44 // $languages[$i++] =$file;45 // }46 // }47 // }48 49 // if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))50 // {51 // $accept_lang_ary = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);52 // for ($i = 0; $i < sizeof($accept_lang_ary); $i++)53 // {54 // for ($j=0; $j<sizeof($languages); $j++)55 // {56 // if (preg_match('#' . substr($languages[$j],0,2) . '#i', substr(trim($accept_lang_ary[$i]),0,2)))57 // {58 // if (file_exists(PHPWG_ROOT_PATH . 'language/' . $languages[$j].'/install.lang.php'))59 // {60 // return $languages[$j];61 // }62 // }63 // }64 // }65 // }66 // return 'en_EN';67 35 } 68 36 … … 156 124 157 125 //----------------------------------------------------- variable initialization 126 127 define('DEFAULT_PREFIX_TABLE', 'phpwebgallery_'); 128 158 129 // Obtain various vars 159 130 $dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost'; … … 162 133 $dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : ''; 163 134 164 $table_prefix = (!empty($_POST['prefix'])) ? $_POST['prefix'] : 'phpwebgallery_'; 135 if (isset($_POST['install'])) 136 { 137 $table_prefix = $_POST['prefix']; 138 } 139 else 140 { 141 $table_prefix = DEFAULT_PREFIX_TABLE; 142 } 165 143 166 144 $admin_name = (!empty($_POST['admin_name'])) ? $_POST['admin_name'] : ''; … … 252 230 { 253 231 $step = 2; 254 $file_content = "<?php";255 $file_content.= "\n\$cfgBase = '". $dbname."';";256 $file_content.= "\n\$cfgUser = '". $dbuser."';";257 $file_content.= "\n\$cfgPassword = '". $dbpasswd."';";258 $file_content.= "\n\$cfgHote = '". $dbhost."';";259 $file_content.= "\n"; 260 $file_content.= "\n\$prefixeTable = '".$table_prefix."';";261 $file_content.= "\n"; 262 $file_content.= "\ndefine('PHPWG_INSTALLED', true);";263 $file_content.= "\n?".">";232 $file_content = '<?php 233 $cfgBase = \''.$dbname.'\'; 234 $cfgUser = \''.$dbuser.'\'; 235 $cfgPassword = \''.$dbpasswd.'\'; 236 $cfgHote = \''.$dbhost.'\'; 237 238 $prefixeTable = \''.$table_prefix.'\'; 239 240 define(\'PHPWG_INSTALLED\', true); 241 ?'.'>'; 264 242 265 243 @umask(0111); … … 276 254 277 255 // tables creation, based on phpwebgallery_structure.sql 278 execute_sqlfile( PHPWG_ROOT_PATH.'install/phpwebgallery_structure.sql' 279 , 'phpwebgallery_' 280 , $table_prefix ); 256 execute_sqlfile( 257 PHPWG_ROOT_PATH.'install/phpwebgallery_structure.sql', 258 DEFAULT_PREFIX_TABLE, 259 $table_prefix 260 ); 281 261 // We fill the tables with basic informations 282 execute_sqlfile( PHPWG_ROOT_PATH.'install/config.sql' 283 , 'phpwebgallery_' 284 , $table_prefix ); 285 286 $query = 'UPDATE '.CONFIG_TABLE; 287 $query.= " SET value = '".$admin_mail."'"; 288 $query.= " WHERE param = 'mail_webmaster'"; 289 $query.= ';'; 290 mysql_query( $query ); 262 execute_sqlfile( 263 PHPWG_ROOT_PATH.'install/config.sql', 264 DEFAULT_PREFIX_TABLE, 265 $table_prefix 266 ); 267 268 $query = ' 269 UPDATE '.CONFIG_TABLE.' 270 SET value = \''.$admin_mail.'\' 271 WHERE param = \'mail_webmaster\' 272 ;'; 273 mysql_query($query); 291 274 292 $query = 'UPDATE '.CONFIG_TABLE; 293 $query.= " SET value = '".$language."'"; 294 $query.= " WHERE param = 'default_language'"; 295 $query.= ';'; 296 mysql_query( $query ); 297 298 $query = 'INSERT INTO '.SITES_TABLE; 299 $query.= " (id,galleries_url) VALUES (1, '".PHPWG_ROOT_PATH."galleries/');"; 300 mysql_query( $query ); 275 $query = ' 276 UPDATE '.CONFIG_TABLE.' 277 SET value = \''.$language.'\' 278 WHERE param = \'default_language\' 279 ;'; 280 mysql_query($query); 281 282 $query = ' 283 INSERT 284 INTO '.SITES_TABLE.' 285 (id, galleries_url) 286 VALUES 287 (1, \''.PHPWG_ROOT_PATH.'galleries/\') 288 ;'; 289 mysql_query($query); 301 290 302 291 // webmaster admin user … … 393 382 'F_DB_USER'=>$dbuser, 394 383 'F_DB_NAME'=>$dbname, 395 'F_DB_PREFIX'=>$table_prefix, 384 'F_DB_PREFIX' => ( 385 $table_prefix != DEFAULT_PREFIX_TABLE 386 ? $table_prefix 387 : DEFAULT_PREFIX_TABLE 388 ), 396 389 'F_ADMIN'=>$admin_name, 397 390 'F_ADMIN_EMAIL'=>$admin_mail,
Note: See TracChangeset
for help on using the changeset viewer.