Changeset 5266 for trunk/install.php
- Timestamp:
- Mar 22, 2010, 9:30:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/install.php
r5239 r5266 120 120 @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); 121 121 122 // download database config file if exists 123 if (!empty($_GET['dl']) && file_exists($conf['local_data_dir'].'/pwg_'.$_GET['dl'])) 124 { 125 $filename = $conf['local_data_dir'].'/pwg_'.$_GET['dl']; 126 header('Cache-Control: no-cache, must-revalidate'); 127 header('Pragma: no-cache'); 128 header('Content-Disposition: attachment; filename="database.inc.php"'); 129 header('Content-Transfer-Encoding: binary'); 130 header('Content-Length: '.filesize($filename)); 131 echo file_get_contents($filename); 132 unlink($filename); 133 exit(); 134 } 135 122 136 // Obtain various vars 123 137 $dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost'; … … 321 335 if ( !($fp = @fopen( $config_file, 'w' ))) 322 336 { 323 $html_content = htmlentities( $file_content, ENT_QUOTES ); 324 $html_content = nl2br( $html_content ); 325 $error_copy = l10n('Copy the text in pink between hyphens and paste it into the file "local/config/database.inc.php"(Warning : database.inc.php must only contain what is in pink, no line return or space character)'); 326 $error_copy .= '<br>--------------------------------------------------------------------<br>'; 327 $error_copy .= '<span class="sql_content">' . $html_content . '</span>'; 328 $error_copy .= '<br>--------------------------------------------------------------------<br>'; 337 $tmp_filename = md5(uniqid(time())); 338 $fh = @fopen( $conf['local_data_dir'] . '/pwg_' . $tmp_filename, 'w' ); 339 @fputs($fh, $file_content, strlen($file_content)); 340 @fclose($fh); 341 342 $error_copy = l10n('Creation of config file local/config/database.inc.php failed.'); 343 $error_copy .= sprintf('<br><a href="install.php?dl=%s">%s</a> %s', 344 $tmp_filename, 345 l10n('You can download the config file'), 346 l10n('and upload it to local/config directory of your installation.') 347 ); 348 349 $error_copy .= '<br><br>'; 350 $error_copy .= l10n('An alternate solution is to copy the text in the box above and paste it into the file "local/config/database.inc.php" (Warning : database.inc.php must only contain what is in the textarea, no line return or space character)'); 351 $error_copy .= '<br><br>'; 352 $error_copy .= '<textarea rows="15" cols="70">' . $file_content . '</textarea>'; 329 353 } 330 354 @fputs($fp, $file_content, strlen($file_content));
Note: See TracChangeset
for help on using the changeset viewer.