source: trunk/www.guidonia.net/wp/wp-admin/setup-config.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 7.1 KB
Line 
1<?php
2/**
3 * Retrieves and creates the wp-config.php file.
4 *
5 * The permissions for the base directory must allow for writing files in order
6 * for the wp-config.php to be created using this page.
7 *
8 * @package WordPress
9 * @subpackage Administration
10 */
11
12/**
13 * We are installing.
14 *
15 * @package WordPress
16 */
17define('WP_INSTALLING', true);
18
19/**#@+
20 * These three defines are required to allow us to use require_wp_db() to load
21 * the database class while being wp-content/db.php aware.
22 * @ignore
23 */
24define('ABSPATH', dirname(dirname(__FILE__)).'/');
25define('WPINC', 'wp-includes');
26define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
27/**#@-*/
28
29require_once(ABSPATH . WPINC . '/compat.php');
30require_once(ABSPATH . WPINC . '/functions.php');
31require_once(ABSPATH . WPINC . '/classes.php');
32
33if (!file_exists(ABSPATH . 'wp-config-sample.php'))
34 wp_die('Spiacente, mi serve un file wp-config-sample.php su cui lavorare. Per favore ricaricare questo file dalla installazione di WordPress.');
35
36$configFile = file(ABSPATH . 'wp-config-sample.php');
37
38if ( !is_writable(ABSPATH))
39 wp_die("Spiacente, non posso scrivere la directory. Occorre cambiare i permessi sulla directory di WordPress o creare il file wp-config.php manualmente.");
40
41// Check if wp-config.php has been created
42if (file_exists(ABSPATH . 'wp-config.php'))
43 wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
44
45// Check if wp-config.php exists above the root directory but is not part of another install
46if (file_exists(ABSPATH . '../wp-config.php') && ! file_exists(ABSPATH . '../wp-settings.php'))
47 wp_die("<p>Il file 'wp-config.php' esiste già ad un livello superiore rispetto a quello dell'installazione di WordPress. Se si desidera azzerare uno qualsiasi degli elementi di configurazione di questo file, cancellarlo. &Egrave; anche possibile <a href='install.php'>provare ad installare ora</a>.</p>");
48
49if (isset($_GET['step']))
50 $step = $_GET['step'];
51else
52 $step = 0;
53
54/**
55 * Display setup wp-config.php file header.
56 *
57 * @ignore
58 * @since 2.3.0
59 * @package WordPress
60 * @subpackage Installer_WP_Config
61 */
62function display_header() {
63 header( 'Content-Type: text/html; charset=utf-8' );
64?>
65<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
66<html xmlns="http://www.w3.org/1999/xhtml">
67<head>
68<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
69<title>WordPress &rsaquo; Impostazione File di Configurazione</title>
70<link rel="stylesheet" href="css/install.css" type="text/css" />
71
72</head>
73<body>
74<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
75<?php
76}//end function display_header();
77
78switch($step) {
79 case 0:
80 display_header();
81?>
82
83<p>Benvenuti in WordPress. Prima di iniziare ci occorrono alcune informazioni sul database. Occorre conoscere i seguenti elementi prima di procedere.</p>
84<ol>
85 <li>Nome del database</li>
86 <li>Username del database</li>
87 <li>Password del database</li>
88 <li>Host del database</li>
89 <li>Prefisso tabella (se si desidera eseguire diverse istanze di WordPress con un solo database) </li>
90</ol>
91<p><strong>Se per qualsiasi ragione la creazione automatica del file non funzionasse non preoccuparsi. Tutto quello che si deve fare &egrave; immettere le informazioni sul database in un file di configurazione. &Egrave;possibile anche semplicemente aprire il file <code>wp-config-sample.php</code> con un editor di testo, immettere le informazioni e salvare il file come <code>wp-config.php</code>. </strong></p>
92<p>In ogni caso, queste informazioni vengono fornite dal proprio ISP. Se non si dispone di tali informazioni, allora si dovr&agrave; contattarlo prima di proseguire. Se si &egrave; pronti <a href="setup-config.php?step=1">iniziamo</a>! </p>
93
94<p class="step"><a href="setup-config.php?step=1" class="button">Iniziamo!</a></p>
95<?php
96 break;
97
98 case 1:
99 display_header();
100 ?>
101<form method="post" action="setup-config.php?step=2">
102 <p>Di seguito si dovranno immettere i dettagli della connessione al database. Se non si &egrave; sicuri riguardo a questi dati, contattare il proprio fornitore di hosting.</p>
103 <table class="form-table">
104 <tr>
105 <th scope="row"><label for="dbname">Nome del database</label></th>
106 <td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
107 <td>Il nome del database da usare per far funzionare WP. </td>
108 </tr>
109 <tr>
110 <th scope="row"><label for="uname">Nome utente del database</label></th></th>
111 <td><input name="uname" id="uname" type="text" size="25" value="username" /></td>
112 <td>Il nome utente MySQL</td>
113 </tr>
114 <tr>
115 <th scope="row"><label for="pwd">Password</label></th>
116 <td><input name="pwd" id="pwd" type="text" size="25" value="password" /></td>
117 <td>...e la password MySQL.</td>
118 </tr>
119 <tr>
120 <th scope="row"><label for="dbhost">Host del database</label></th>
121 <td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
122 <td>al 99% non si dovr&agrave; cambiare questa impostazione.</td>
123 </tr>
124 <tr>
125 <th scope="row"><label for="prefix">Prefisso tabella</label></th>
126 <td><input name="prefix" id="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
127 <td>Se si desidera eseguire pi&ugrave; istanze di WordPress con un singolo database, modificare questo valore.</td>
128 </tr>
129 </table>
130 <p class="step"><input name="submit" type="submit" value="Prosegui" class="button" /></p>
131</form>
132<?php
133 break;
134
135 case 2:
136 $dbname = trim($_POST['dbname']);
137 $uname = trim($_POST['uname']);
138 $passwrd = trim($_POST['pwd']);
139 $dbhost = trim($_POST['dbhost']);
140 $prefix = trim($_POST['prefix']);
141 if (empty($prefix)) $prefix = 'wp_';
142
143 // Test the db connection.
144 /**#@+
145 * @ignore
146 */
147 define('DB_NAME', $dbname);
148 define('DB_USER', $uname);
149 define('DB_PASSWORD', $passwrd);
150 define('DB_HOST', $dbhost);
151 /**#@-*/
152
153 // We'll fail here if the values are no good.
154 require_wp_db();
155 if ( !empty($wpdb->error) )
156 wp_die($wpdb->error->get_error_message());
157
158 $handle = fopen(ABSPATH . 'wp-config.php', 'w');
159
160 foreach ($configFile as $line_num => $line) {
161 switch (substr($line,0,16)) {
162 case "define('DB_NAME'":
163 fwrite($handle, str_replace("putyourdbnamehere", $dbname, $line));
164 break;
165 case "define('DB_USER'":
166 fwrite($handle, str_replace("'usernamehere'", "'$uname'", $line));
167 break;
168 case "define('DB_PASSW":
169 fwrite($handle, str_replace("'yourpasswordhere'", "'$passwrd'", $line));
170 break;
171 case "define('DB_HOST'":
172 fwrite($handle, str_replace("localhost", $dbhost, $line));
173 break;
174 case '$table_prefix =':
175 fwrite($handle, str_replace('wp_', $prefix, $line));
176 break;
177 default:
178 fwrite($handle, $line);
179 }
180 }
181 fclose($handle);
182 chmod(ABSPATH . 'wp-config.php', 0666);
183
184 display_header();
185?>
186<p>Tutto a posto! Si &egrave; superata questa fase della installazione. Ora WordPress pu&ograve; comunicare con il database. Se si &egrave, pronti ora &egrave; il momento di <a href="install.php">eseguire la installazione!</a></p>
187
188<p class="step"><a href="install.php" class="button">Avvia installazione</a></p>
189<?php
190 break;
191}
192?>
193</body>
194</html>
Note: See TracBrowser for help on using the repository browser.