[ Index ] |
|
Code source de WordPress 2.1.2 |
1 <?php 2 define('WP_INSTALLING', true); 3 4 if (!file_exists('../wp-config-sample.php')) 5 die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 6 7 $configFile = file('../wp-config-sample.php'); 8 9 if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually."); 10 11 12 if (isset($_GET['step'])) 13 $step = $_GET['step']; 14 else 15 $step = 0; 16 header( 'Content-Type: text/html; charset=utf-8' ); 17 ?> 18 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 19 <html xmlns="http://www.w3.org/1999/xhtml"> 20 <head> 21 <title>WordPress › Setup Configuration File</title> 22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 23 <style media="screen" type="text/css"> 24 <!-- 25 html { 26 background: #eee; 27 } 28 body { 29 background: #fff; 30 color: #000; 31 font-family: Georgia, "Times New Roman", Times, serif; 32 margin-left: 20%; 33 margin-right: 20%; 34 padding: .2em 2em; 35 } 36 37 h1 { 38 color: #006; 39 font-size: 18px; 40 font-weight: lighter; 41 } 42 43 h2 { 44 font-size: 16px; 45 } 46 47 p, li, dt { 48 line-height: 140%; 49 padding-bottom: 2px; 50 } 51 52 ul, ol { 53 padding: 5px 5px 5px 20px; 54 } 55 #logo { 56 margin-bottom: 2em; 57 } 58 .step a, .step input { 59 font-size: 2em; 60 } 61 td input { 62 font-size: 1.5em; 63 } 64 .step, th { 65 text-align: right; 66 } 67 #footer { 68 text-align: center; 69 border-top: 1px solid #ccc; 70 padding-top: 1em; 71 font-style: italic; 72 } 73 --> 74 </style> 75 </head> 76 <body> 77 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1> 78 <?php 79 // Check if wp-config.php has been created 80 if (file_exists('../wp-config.php')) 81 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></body></html>"); 82 83 switch($step) { 84 case 0: 85 ?> 86 87 <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> 88 <ol> 89 <li>Database name</li> 90 <li>Database username</li> 91 <li>Database password</li> 92 <li>Database host</li> 93 <li>Table prefix (if you want to run more than one WordPress in a single database) </li> 94 </ol> 95 <p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p> 96 <p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready, <a href="setup-config.php?step=1">let’s go</a>! </p> 97 <?php 98 break; 99 100 case 1: 101 ?> 102 </p> 103 <form method="post" action="setup-config.php?step=2"> 104 <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p> 105 <table> 106 <tr> 107 <th scope="row">Database Name</th> 108 <td><input name="dbname" type="text" size="25" value="wordpress" /></td> 109 <td>The name of the database you want to run WP in. </td> 110 </tr> 111 <tr> 112 <th scope="row">User Name</th> 113 <td><input name="uname" type="text" size="25" value="username" /></td> 114 <td>Your MySQL username</td> 115 </tr> 116 <tr> 117 <th scope="row">Password</th> 118 <td><input name="pwd" type="text" size="25" value="password" /></td> 119 <td>...and MySQL password.</td> 120 </tr> 121 <tr> 122 <th scope="row">Database Host</th> 123 <td><input name="dbhost" type="text" size="25" value="localhost" /></td> 124 <td>99% chance you won't need to change this value.</td> 125 </tr> 126 <tr> 127 <th scope="row">Table Prefix</th> 128 <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td> 129 <td>If you want to run multiple WordPress installations in a single database, change this.</td> 130 </tr> 131 </table> 132 <h2 class="step"> 133 <input name="submit" type="submit" value="Submit" /> 134 </h2> 135 </form> 136 <?php 137 break; 138 139 case 2: 140 $dbname = trim($_POST['dbname']); 141 $uname = trim($_POST['uname']); 142 $passwrd = trim($_POST['pwd']); 143 $dbhost = trim($_POST['dbhost']); 144 $prefix = trim($_POST['prefix']); 145 if (empty($prefix)) $prefix = 'wp_'; 146 147 // Test the db connection. 148 define('DB_NAME', $dbname); 149 define('DB_USER', $uname); 150 define('DB_PASSWORD', $passwrd); 151 define('DB_HOST', $dbhost); 152 153 // We'll fail here if the values are no good. 154 require_once ('../wp-includes/wp-db.php'); 155 $handle = fopen('../wp-config.php', 'w'); 156 157 foreach ($configFile as $line_num => $line) { 158 switch (substr($line,0,16)) { 159 case "define('DB_NAME'": 160 fwrite($handle, str_replace("wordpress", $dbname, $line)); 161 break; 162 case "define('DB_USER'": 163 fwrite($handle, str_replace("'username'", "'$uname'", $line)); 164 break; 165 case "define('DB_PASSW": 166 fwrite($handle, str_replace("'password'", "'$passwrd'", $line)); 167 break; 168 case "define('DB_HOST'": 169 fwrite($handle, str_replace("localhost", $dbhost, $line)); 170 break; 171 case '$table_prefix =': 172 fwrite($handle, str_replace('wp_', $prefix, $line)); 173 break; 174 default: 175 fwrite($handle, $line); 176 } 177 } 178 fclose($handle); 179 chmod('../wp-config.php', 0666); 180 ?> 181 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> 182 <?php 183 break; 184 } 185 ?> 186 <p id="footer"><a href="http://wordpress.org/">WordPress</a>, personal publishing platform.</p> 187 </body> 188 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 30 19:41:27 2007 | par Balluche grâce à PHPXref 0.7 |