Changeset 1431

Show
Ignore:
Timestamp:
08/22/08 16:50:29 (3 months ago)
Author:
donncha
Message:

xhtml fixes by momo360modena, fixes #709. Not all changes applied however.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.6/index-install.php

    r1351 r1431  
    33if( strpos( $_SERVER["REQUEST_URI"], 'index-install.php' ) ) { 
    44        header( "Location: index.php" ); 
    5         die(); 
    6 
     5        exit(); 
     6
     7 
    78if( $_SERVER[ 'HTTP_HOST' ] == 'localhost' ) { 
    8         die( "<h2>Warning!</h2> Installing to http://localhost/ is not supported. Please use <a href='http://localhost.localdomain/'>http://localhost.localdomain/</a> instead." ); 
    9 
     9        die( "<h2>Warning!</h2><p>Installing to http://localhost/ is not supported. Please use <a href='http://localhost.localdomain/'>http://localhost.localdomain/</a> instead.</p>" ); 
     10
     11 
    1012define('WP_INSTALLING', true); 
    1113 
     
    1315 
    1416function printheader() { 
    15 ?> 
    16 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    17 <html xmlns="http://www.w3.org/1999/xhtml"> 
    18 <head> 
    19         <title>WordPress &rsaquo; Installation</title> 
    20         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    21         <style media="screen" type="text/css"> 
    22         html { 
    23                 background: #eee; 
    24         } 
    25         body { 
    26                 background: #fff; 
    27                 color: #000
    28                 font-family: Georgia, "Times New Roman", Times, serif
    29                 margin-left: 20%
    30                 margin-right: 20%; 
    31                 padding: .2em 2em
    32         } 
    33          
    34         h1, h2 { 
    35                 color: #006; 
    36                 font-size: 18px
    37                 font-weight: lighter
    38         } 
    39          
    40         p, li, dt { 
    41                 line-height: 140%; 
    42                 padding-bottom: 2px
    43         } 
    44  
    45         ul, ol { 
    46                 padding: 5px 5px 5px 20px; 
    47         } 
    48         #logo { 
    49                 margin-bottom: 2em; 
    50         } 
    51 .step a, .step input { 
    52         font-size: 2em; 
    53 
    54 .step, th { 
    55         text-align: right; 
    56 
    57 #footer { 
    58 text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic; 
    59 
    60 .fakelink { 
    61     color: #00a; 
    62     text-decoration: underline
    63 
    64         </style> 
    65 </head
    66 <body
    67  
    68 <h1><img src="wp-includes/images/wordpress-mu.png" alt="WordPress &micro;" /></h1> 
    69 <?php 
     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 &rsaquo; Installation</title> 
     22               <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     23 
     24                <style media="screen" type="text/css"> 
     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, h2 { 
     38                       color: #006
     39                       font-size: 18px
     40                        font-weight: lighter; 
     41                } 
     42 
     43                p, li, dt { 
     44                       line-height: 140%
     45                        padding-bottom: 2px; 
     46                } 
     47 
     48                ul, ol { 
     49                        padding: 5px 5px 5px 20px; 
     50                } 
     51                #logo { 
     52                        margin-bottom: 2em; 
     53                } 
     54                .step a, .step input { 
     55                        font-size: 2em; 
     56                } 
     57                .step, th { 
     58                        text-align: right; 
     59                } 
     60                #footer { 
     61                        text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic; 
     62                } 
     63                .fakelink { 
     64                       color: #00a
     65                        text-decoration: underline; 
     66                } 
     67               </style
     68       </head
     69        <body> 
     70               <h1><img src="wp-includes/images/wordpress-mu.png" alt="WordPress &micro;" /></h1> 
     71               <?php 
    7072} 
    7173 
     
    7577 
    7678        print "<blockquote style='background: #eee; border: 1px solid #333; padding: 5px;'>"; 
    77         print "<br /><strong>ERROR: $err</strong></br >"; 
     79        print "<br /><strong>ERROR: $err</strong><br />"; 
    7880        clearstatcache(); 
    7981        $files = array( "htaccess.dist", ".htaccess" ); 
    80         while( list( $key, $val ) = each( $files ) ) {  
     82         
     83        foreach ( (array) $files as $val ) { 
    8184                $stats = @stat( $val ); 
    8285                if( $stats ) { 
     
    9396                } elseif( file_exists( $val ) == false ) { 
    9497                        print "<h2>$val</h2>"; 
    95                         print "&nbsp;&nbsp;&nbsp;&nbsp;FILE NOT FOUND: $val<br>"; 
     98                        print "&nbsp;&nbsp;&nbsp;&nbsp;FILE NOT FOUND: $val<br />"; 
    9699                } 
    97100        } 
     
    154157                print "<p>If you use Cpanel then read <a href='http://mu.wordpress.org/forums/topic.php?id=99'>this post</a>. Cpanel creates files that I need to overwrite and you have to fix that.</p>"; 
    155158                print "<p>If all else fails then you'll have to create it by hand:"; 
    156                 print "<ul><li> Download htaccess.dist to your computer and open it in your favourite text editor.</li> 
    157                 <li> Replace the following text:<ul><li>BASE by '$base'</li><li>HOST by '$url'</li></li> 
    158                 <li> Rename htaccess.dist to .htaccess and upload it back to the same directory.</li></ul>"; 
     159                print "<ul> 
     160                        <li> Download htaccess.dist to your computer and open it in your favourite text editor.</li> 
     161                        <li> Replace the following text: 
     162                        <ul> 
     163                        <li>BASE by '$base'</li> 
     164                        <li>HOST by '$url'</li> 
     165                        </ul> 
     166                        </li> 
     167                        <li> Rename htaccess.dist to .htaccess and upload it back to the same directory.</li> 
     168                        </ul>"; 
    159169                die( "Installation Aborted!" ); 
    160170        } 
     
    163173function checkdirs() { 
    164174        global $dirs; 
    165  
    166         $ret = true; 
    167         foreach( $dirs as $dir ) { 
     175        $return = true; 
     176 
     177        $errors = array(); 
     178        foreach( (array) $dirs as $dir ) { 
    168179                if( false == is_writeable( $dir ) ) { 
    169                         $err[] = $dir; 
    170                 } 
    171         } 
    172  
    173         if( is_array( $err ) ) { 
    174                 ?><h2>Warning!</h2> 
     180                        $errors[] = $dir; 
     181                } 
     182        } 
     183 
     184        if( !empty( $errors ) ) { 
     185                ?> 
     186                <h2>Warning!</h2> 
    175187                <div style='border: 1px solid #ccc'> 
    176                 <p style='font-weight: bold; padding-left: 10px'>One or more of the directories must be made writeable by the webserver. You will be reminded to reset the permissions at the end of the install.<br
    177                 Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br
    178                 Refresh this page when you're done!<br></p> 
     188                       <p style='font-weight: bold; padding-left: 10px'>One or more of the directories must be made writeable by the webserver. You will be reminded to reset the permissions at the end of the install.<br /
     189                               Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br /
     190                               Refresh this page when you're done!<br /></p> 
    179191                </div> 
    180192                <p>Quick fix:<br /> <code>chmod&nbsp;777&nbsp;<?php 
    181                 foreach( $err as $dir ) { 
     193                foreach( $errors as $dir ) { 
    182194                        echo "$dir&nbsp;"; 
    183195                } 
    184                 ?></code></p><?php 
    185                 $ret = false; 
    186         } 
     196                ?></code> 
     197                </p> 
     198                </div> 
     199                <?php 
     200                $return = false; 
     201        } 
     202         
    187203        if( file_exists( "./.htaccess" ) && is_writeable( "./.htaccess" ) == false ) { 
    188                 $ret = false; 
    189                 print "<h2>Warning! .htaccess already exists.</h2>"; 
    190                 print "<div style='border: 1px solid #ccc'>"; 
    191                 print "<p style='font-weight: bold; padding-left: 10px'>A file with the name '.htaccess' already exists in this directory and I cannot write to it. Please ftp to the server and delete this file from this directory!<br />"; 
    192                 print "Offending file: " . realpath( '.htaccess' ) . "</p>"; 
    193                 print "</div>"; 
    194         } 
    195         return $ret; 
     204                ?> 
     205                <h2>Warning! .htaccess already exists.</h2> 
     206                <div style='border: 1px solid #ccc'> 
     207                        <p style='font-weight: bold; padding-left: 10px'>A file with the name '.htaccess' already exists in this directory and I cannot write to it. Please ftp to the server and delete this file from this directory!<br />Offending file: <?php echo realpath( '.htaccess' ); ?></p> 
     208                </div> 
     209                <?php 
     210                $return = false; 
     211        } 
     212         
     213        return $return; 
    196214} 
    197215 
    198216function step1() { 
    199         ?><h2>Installing WordPress &micro;</h2> 
     217        ?> 
     218        <h2>Installing WordPress &micro;</h2> 
    200219        <p><strong>Welcome to WordPress &micro;.</strong> I will help you install this software by asking you a few questions and asking that you change the permissions on a few directories so I can create configuration files and make a directory to store all your uploaded files.</p> 
    201220        <p>If you have installed the single-blog version of WordPress before, please note that the WordPress &micro; installer is different and trying to create the configuration file wp-config.php youself may result in a broken site. It's much easier to use this installer to get the job done.</p> 
     221         
    202222        <h3>What do I need?</h3> 
    203         <p><ul><li>Access to your server to change directory permissions. This can be done through ssh or ftp for example.</li><li>A valid email where your password and administrative emails will be sent.</li><li>An empty MySQL database.Tables are prefixed with <code>wp_</code> which may conflict with an existing WordPress install.</li><li> Wildcard dns records if you're going to use the virtual host functionality. Check the <a href='http://trac.mu.wordpress.org/browser/trunk/README.txt'>README</a> for further details.</li></ul><p> 
     223        <ul> 
     224                <li>Access to your server to change directory permissions. This can be done through ssh or ftp for example.</li> 
     225                <li>A valid email where your password and administrative emails will be sent.</li> 
     226                <li>An empty MySQL database.Tables are prefixed with <code>wp_</code> which may conflict with an existing WordPress install.</li> 
     227                <li> Wildcard dns records if you're going to use the virtual host functionality. Check the <a href='http://trac.mu.wordpress.org/browser/trunk/README.txt'>README</a> for further details.</li> 
     228        </ul> 
    204229        <?php 
    205230        $mod_rewrite_msg = "<p>If the <code>mod_rewrite</code> module is disabled ask your administrator to enable that module, or look at the <a href='http://httpd.apache.org/docs/mod/mod_rewrite.html'>Apache documentation</a> or <a href='http://www.google.com/search?q=apache+mod_rewrite'>elsewhere</a> for help setting it up.</p>"; 
     231         
    206232        if( function_exists( "apache_get_modules" ) ) { 
    207233                $modules = apache_get_modules(); 
     
    213239                echo $mod_rewrite_msg; 
    214240        } 
     241         
    215242        if( checkdirs() == false ) { 
    216243                return false; 
     
    222249        $url = stripslashes( "http://".$_SERVER["SERVER_NAME"] . dirname( $_SERVER[ "SCRIPT_NAME" ] ) ); 
    223250        if( substr( $url, -1 ) == '/' ) 
    224         $url = substr( $url, 0, -1 ); 
     251               $url = substr( $url, 0, -1 ); 
    225252        $base = stripslashes( dirname( $_SERVER["SCRIPT_NAME"] ) ); 
    226253        if( $base != "/") { 
    227254                $base .= "/"; 
    228255        }  
    229         $realpath = dirname(__FILE__); 
    230256 
    231257        return true; 
     
    238264        if( substr( $_SERVER[ 'HTTP_HOST' ], 0, 4 ) == 'www.' ) 
    239265                $hostname = str_replace( "www.", "", $_SERVER[ 'HTTP_HOST' ] ); 
    240     ?> 
    241     <form method='post' action='index.php'>  
    242     <input type='hidden' name='action' value='step2'> 
    243     <h2>Blog Addresses</h2> 
    244         <p>Please choose whether you would like blogs for the WordPress &micro; install to use sub-domains or sub-directories. You can not change this later. We recommend sub-domains.</p> 
    245         <p><label><input type='radio' name='vhost' value='yes' <?php if( $vhost == 'yes' ) echo 'checked '; ?> /> Sub-domains (like <code>blog1.example.com</code>)</label><br /> 
    246         <label><input type='radio' name='vhost' value='no' <?php if( $vhost == 'no' ) echo 'checked '; ?> /> Sub-directories (like <code>example.com/blog1</code></label></p> 
    247          
    248     <h2>Database</h2> 
    249  
    250   <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p> 
    251   <table cellpadding='5'>  
    252     <tr>  
    253       <th scope='row' width='33%'>Database Name</th>  
    254       <td><input name='dbname' type='text' size='45' value='<?php echo $dbname ?>' /></td>   
    255     </tr>  
    256     <tr>  
    257       <th scope='row'>User Name</th>  
    258       <td><input name='uname' type='text' size='45' value='<?php echo $uname ?>' /></td>  
    259     </tr>  
    260     <tr>  
    261       <th scope='row'>Password</th>  
    262       <td><input name='pwd' type='text' size='45' value='<?php echo $pwd ?>' /></td>  
    263     </tr>  
    264     <tr>  
    265       <th scope='row'>Database Host</th>  
    266       <td><input name='dbhost' type='text' size='45' value='<?php echo $dbhost ?>' /></td>  
    267     </tr> 
    268   </table>  
    269   <h2>Server Address</h2> 
    270   <p><label>What is the Internet address of your site? You should enter the shortest address possible. For example, use <em>example.com</em> instead of <em>www.example.com</em> but if you are going to use an address like <em>blogs.example.com</em> then enter that unaltered in the box below.<br /><b>Server Address:</b> <input type='text' name='basedomain' value='<?php echo $hostname ?>'></label></p> 
    271   <h2>Site Details</h2> 
    272   <table width='100%'>  
    273   <tr>  
    274   <th scope='row'>Site&nbsp;Title</th>  
    275   <td><input name='weblog_title' type='text' size='45' value='<?php echo $weblog_title ?>' /></td>  
    276   <td>What would you like to call your site? </td>  
    277   </tr>  
    278   <tr>  
    279   <th scope='row'>Email</th>  
    280   <td><input name='email' type='text' size='45' value='<?php echo $email ?>' /></td>  
    281   <td>Your email address.</td>  
    282   </tr>  
    283   </table>  
    284   <p class='submit'><input name='submit' type='submit' value='Submit' /> </p> 
    285 </form>  
    286 <?php 
     266        ?> 
     267        <form method='post' action='index.php'>  
     268                <input type='hidden' name='action' value='step2' /> 
     269                <h2>Blog Addresses</h2> 
     270                <p>Please choose whether you would like blogs for the WordPress &micro; install to use sub-domains or sub-directories. You can not change this later. We recommend sub-domains.</p> 
     271                <p> 
     272                        <label><input type='radio' name='vhost' value='yes' <?php if( $vhost == 'yes' ) echo 'checked="checked"'; ?> /> Sub-domains (like <code>blog1.example.com</code>)</label><br /> 
     273                        <label><input type='radio' name='vhost' value='no' <?php if( $vhost == 'no' ) echo 'checked="checked"'; ?> /> Sub-directories (like <code>example.com/blog1</code></label> 
     274                </p> 
     275 
     276                <h2>Database</h2> 
     277 
     278                <p>Below you should enter your database connection details. If you're not sure about these, contact your host.</p> 
     279                <table cellpadding='5'>  
     280                        <tr>  
     281                                <th scope='row' width='33%'>Database Name</th>  
     282                                <td><input name='dbname' type='text' size='45' value='<?php echo $dbname ?>' /></td>   
     283                        </tr>  
     284                        <tr>  
     285                                <th scope='row'>User Name</th>  
     286                                <td><input name='uname' type='text' size='45' value='<?php echo $uname ?>' /></td>  
     287                        </tr>  
     288                        <tr>  
     289                                <th scope='row'>Password</th>  
     290                                <td><input name='pwd' type='text' size='45' value='<?php echo $pwd ?>' /></td>  
     291                        </tr>  
     292                        <tr>  
     293                                <th scope='row'>Database Host</th>  
     294                                <td><input name='dbhost' type='text' size='45' value='<?php echo $dbhost ?>' /></td>  
     295                        </tr> 
     296                </table>  
     297 
     298                <h2>Server Address</h2> 
     299                <p><label>What is the Internet address of your site? You should enter the shortest address possible. For example, use <em>example.com</em> instead of <em>www.example.com</em> but if you are going to use an address like <em>blogs.example.com</em> then enter that unaltered in the box below.<br /> 
     300                        <label><strong>Server Address:</strong> <input type='text' name='basedomain' value='<?php echo $hostname ?>'></label> 
     301                </p> 
     302 
     303                <h2>Site Details</h2> 
     304                <table width='100%'>  
     305                        <tr>  
     306                                <th scope='row'>Site&nbsp;Title</th>  
     307                                <td><input name='weblog_title' type='text' size='45' value='<?php echo $weblog_title ?>' /></td>  
     308                                <td>What would you like to call your site? </td>  
     309                        </tr>  
     310                        <tr>  
     311                                <th scope='row'>Email</th>  
     312                                <td><input name='email' type='text' size='45' value='<?php echo $email ?>' /></td>  
     313                                <td>Your email address.</td>  
     314                        </tr>  
     315                </table>  
     316                <p class='submit'><input name='submit' type='submit' value='Submit' /></p> 
     317        </form>  
     318        <?php 
    287319} 
    288320 
    289321function step2() { 
    290         global $wpdb, $table_prefix, $base, $blog_id; 
    291         $dbname  = $_POST['dbname']; 
    292         $uname   = $_POST['uname']; 
    293         $passwrd = $_POST['pwd']; 
    294         $dbhost  = $_POST['dbhost']; 
    295         $vhost   = $_POST['vhost' ];  
    296         $prefix  = 'wp_'; 
    297         $base = stripslashes( dirname( $_SERVER["SCRIPT_NAME"] ) ); 
     322        global $base, $wpdb; 
     323 
     324        $dbname  = stripslashes($_POST['dbname']); 
     325        $uname   = stripslashes($_POST['uname']); 
     326        $passwrd = stripslashes($_POST['pwd']); 
     327        $dbhost  = stripslashes($_POST['dbhost']); 
     328        $vhost   = stripslashes($_POST['vhost' ]); 
     329        $prefix  = 'wp_'; // Hardcoded 
     330         
     331        $base = stripslashes( dirname($_SERVER["SCRIPT_NAME"]) ); 
    298332        if( $base != "/") 
    299333                $base .= "/"; 
     
    308342                die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 
    309343 
    310         $configFile = file('wp-config-sample.php'); 
     344        $wp_config_file = file('wp-config-sample.php'); 
    311345        // We'll fail here if the values are no good. 
    312346        require_once('wp-includes/wp-db.php'); 
     
    315349        $handle = fopen('wp-config.php', 'w'); 
    316350 
    317         foreach ($configFile as $line_num => $line) { 
    318                 switch (trim( substr($line,0,16) )) { 
     351        foreach ($wp_config_file as $line) { 
     352                switch ( trim( substr($line,0,16) ) ) { 
    319353                        case "define('DB_NAME'": 
    320354                                fwrite($handle, str_replace("wordpress", $dbname, $line)); 
     
    391425 
    392426You can log in to the administrator account with the following information: 
    393  Username: USERNAME 
    394  Password: PASSWORD 
     427Username: USERNAME 
     428Password: PASSWORD 
    395429Login Here: BLOG_URLwp-login.php 
    396430 
     
    400434--The Team @ SITE_NAME')" ); 
    401435        $wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'first_post', 'Welcome to <a href=\"SITE_URL\">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' )" ); 
    402  
    403436        $weblog_title = stripslashes( $_POST[ 'weblog_title' ] ); 
    404437 
     
    413446        update_blog_option( 1, 'template', 'home'); 
    414447        update_blog_option( 1, 'stylesheet', 'home'); 
     448         
    415449        if( constant( 'VHOST' ) == 'yes' ) { 
    416450                update_blog_option( 1, 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); 
     
    418452                update_blog_option( 1, 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/'); 
    419453        } 
     454         
    420455        update_blog_option( 1, 'rewrite_rules', ''); 
     456         
    421457        $msg = "Your new WordPress MU site has been created at\nhttp://{$domain}{$base}\n\nLogin details:\nUsername: admin\nPassword: $pass\nLogin: http://{$domain}{$base}wp-login.php\n"; 
    422458        wp_mail( $email, "Your new WordPress MU site is ready!", $msg, "From: wordpress@" . $_SERVER[ 'HTTP_HOST' ]  ); 
    423459        ?><h2>Installation Finished!</h2> 
    424         <p>Congratulations! Your <a href='http://<?php echo $domain . $base; ?>'>WordPress &micro; site</a> has been configured.</p> 
     460        <p>Congratulations! <br />Your <a href='http://<?php echo $domain . $base; ?>'>WordPress &micro; site</a> has been configured.</p> 
    425461        <p>You can <a href='wp-login.php'>log in</a> using the username "admin" and password <?php echo $pass; ?></p> 
    426462        <h3>Directory Permissions</h3> 
    427         <p>Please remember to reset the permissions on the following directories:<ul> 
    428         <?php 
    429         reset( $dirs ); 
    430         foreach( $dirs as $dir ) { 
    431                 echo "<li> $dir</li>"; 
    432         } 
    433         ?></ul></p> 
    434         <p>You can probably use the following command to fix the permissions but check with your host if it doubt:<br /><code>chmod&nbsp;755&nbsp;<?php 
    435         reset( $dirs ); 
    436         foreach( $dirs as $dir ) { 
    437                 echo "$dir&nbsp;"; 
    438         } 
    439         ?></code></p> 
     463        <p>Please remember to reset the permissions on the following directories: 
     464                <ul> 
     465                <?php 
     466                reset( $dirs ); 
     467                foreach( (array) $dirs as $dir ) { 
     468                        echo "<li>$dir</li>"; 
     469                } 
     470                ?> 
     471                </ul> 
     472        </p> 
     473        <p>You can probably use the following command to fix the permissions but check with your host if it doubt: 
     474                <br /><code>chmod&nbsp;755&nbsp; 
     475                        <?php 
     476                        reset( $dirs ); 
     477                        foreach( (array) $dirs as $dir ) { 
     478                                echo "$dir&nbsp;"; 
     479                        } 
     480                        ?></code> 
     481        </p> 
     482         
    440483        <h3>Further reading</h3> 
    441         <p><ul><li>If you run into problems, please search the <a href='http://mu.wordpress.org/forums/'>WordPress &micro; Forums</a> where you will most likely find a solution. Please don't post there before searching. It's not polite.</li> 
    442         <li>There is also the <a href='http://trac.mu.wordpress.org/'>WordPress &micro; Trac</a>. That's our bug tracker.</li></ul></p> 
    443         <p>Thanks for installing WordPress &micro;!<br /><br /> 
    444          
    445         Donncha<br /> 
    446         <code>wpmu version: <?php echo $wpmu_version ?></code></p> 
     484        <p> 
     485                <ul> 
     486                        <li>If you run into problems, please search the <a href='http://mu.wordpress.org/forums/'>WordPress &micro; Forums</a> where you will most likely find a solution. Please don't post there before searching. It's not polite.</li> 
     487                        <li>There is also the <a href='http://trac.mu.wordpress.org/'>WordPress &micro; Trac</a>. That's our bug tracker.</li> 
     488                </ul> 
     489        </p> 
     490        <p>Thanks for installing WordPress &micro;!<br /><br />Donncha<br /><code>wpmu version: <?php echo $wpmu_version ?></code></p> 
    447491        <?php 
    448492} 
     
    453497        <h1>No-www</h1> 
    454498        <p>WordPress &micro; strips the string "www" from the URLs of sites using this software. It is still possible to visit your site using the "www" prefix with an address like <em><?php echo $_POST[ 'basedomain' ] ?></em> but any links will not have the "www" prefix. They will instead point at <?php echo $nowww ?>.</p> 
    455         <p>The preferred method of hosting blogs is without the "www" prefix as it's more compact and simple.</p><p>You can still use "<?php echo $_POST[ 'basedomain' ] ?>" and URLs like "www.blog1.<?php echo $nowww; ?>" to address your site and blogs after installation but internal links will use the <?php echo $nowww ?> format.</p> 
    456         <p><a target='_blank' href="http://no-www.org/">www. is depreciated</a> has a lot more information on why 'www.' isn't needed any more.</p> 
    457         <p><form method='POST'> 
    458         <input type='hidden' name='dbname' value='<?php echo $_POST[ 'dbname' ]; ?>'> 
    459         <input type='hidden' name='uname' value='<?php echo $_POST[ 'uname' ]; ?>'> 
    460         <input type='hidden' name='pwd' value='<?php echo $_POST[ 'pwd' ]; ?>'> 
    461         <input type='hidden' name='dbhost' value='<?php echo $_POST[ 'dbhost' ]; ?>'> 
    462         <input type='hidden' name='vhost' value='<?php echo $_POST[ 'vhost' ]; ?>'> 
    463         <input type='hidden' name='weblog_title' value='<?php echo $_POST[ 'weblog_title' ]; ?>'> 
    464         <input type='hidden' name='email' value='<?php echo $_POST[ 'email' ]; ?>'> 
    465         <input type='hidden' name='action' value='step2'> 
    466         <input type='hidden' name='basedomain' value='<?echo $nowww ?>'> 
    467         <input type='submit' value='Continue'> 
    468         </form></p> 
     499        <p>The preferred method of hosting blogs is without the "www" prefix as it's more compact and simple.</p> 
     500        <p>You can still use "<?php echo $_POST[ 'basedomain' ] ?>" and URLs like "www.blog1.<?php echo $nowww; ?>" to address your site and blogs after installation but internal links will use the <?php echo $nowww ?> format.</p> 
     501 
     502        <p><a href="http://no-www.org/">www. is depreciated</a> has a lot more information on why 'www.' isn't needed any more.</p> 
     503        <p> 
     504                <form method='post'> 
     505                        <input type='hidden' name='dbname' value='<?php echo $_POST[ 'dbname' ]; ?>' /> 
     506                        <input type='hidden' name='uname' value='<?php echo $_POST[ 'uname' ]; ?>' /> 
     507                        <input type='hidden' name='pwd' value='<?php echo $_POST[ 'pwd' ]; ?>' /> 
     508                        <input type='hidden' name='dbhost' value='<?php echo $_POST[ 'dbhost' ]; ?>' /> 
     509                        <input type='hidden' name='vhost' value='<?php echo $_POST[ 'vhost' ]; ?>' /> 
     510                        <input type='hidden' name='weblog_title' value='<?php echo $_POST[ 'weblog_title' ]; ?>' /> 
     511                        <input type='hidden' name='email' value='<?php echo $_POST[ 'email' ]; ?>' /> 
     512                        <input type='hidden' name='action' value='step2' /> 
     513                        <input type='hidden' name='basedomain' value='<?echo $nowww ?>' /> 
     514                        <input type='submit' value='Continue' /> 
     515                </form> 
     516        </p> 
    469517        <?php 
    470518} 
     
    478526                        continue; 
    479527                } 
    480                 // get blog username 
    481                 // create wp-config.php  
     528                 
     529                // get blog username, create wp-config.php  
    482530                step2(); 
     531 
    483532                // Install Blog! 
    484533                include_once('./wp-config.php'); 
    485534                include_once('./wp-admin/includes/upgrade.php'); 
    486                 // normalise hostname - no www. 
    487                 $_SERVER[ 'HTTP_HOST' ] = str_replace( 'www.', '', $_SERVER[ 'HTTP_HOST' ] ); 
     535                 
     536                $_SERVER[ 'HTTP_HOST' ] = str_replace( 'www.', '', $_SERVER[ 'HTTP_HOST' ] ); // normalise hostname - no www. 
    488537                make_db_current_silent(); 
    489538                populate_options(); 
     539                global $base; 
    490540                do_htaccess( 'htaccess.dist', '.htaccess', $base, ''); 
     541                 
    491542                step3(); 
    492543        break; 
    493544        default: 
    494                 // check that directories are writeable. 
    495                 // create wpmu-settings.php 
    496                 // get db auth info. 
     545                // check that directories are writeable, create wpmu-settings.php and get db auth info 
    497546                printheader(); 
    498547                if( step1() ) { 
     
    504553<br /><br /> 
    505554<div style="text-align:center;"> 
    506 <a href="http://mu.wordpress.org/">WordPress &micro;</a> | <a href="http://mu.wordpress.org/forums/">Support Forums</a> 
     555       <a href="http://mu.wordpress.org/">WordPress &micro;</a> | <a href="http://mu.wordpress.org/forums/">Support Forums</a> 
    507556</div> 
    508557</body> 
  • trunk/index-install.php

    r1422 r1431  
    33if( strpos( $_SERVER["REQUEST_URI"], 'index-install.php' ) ) { 
    44        header( "Location: index.php" ); 
    5         die(); 
    6 
     5        exit(); 
     6
     7 
    78if( $_SERVER[ 'HTTP_HOST' ] == 'localhost' ) { 
    8         die( "<h2>Warning!</h2> Installing to http://localhost/ is not supported. Please use <a href='http://localhost.localdomain/'>http://localhost.localdomain/</a> instead." ); 
    9 
     9        die( "<h2>Warning!</h2><p>Installing to http://localhost/ is not supported. Please use <a href='http://localhost.localdomain/'>http://localhost.localdomain/</a> instead.</p>" ); 
     10
     11 
    1012define('WP_INSTALLING', true); 
    1113 
     
    1315 
    1416function printheader() { 
    15 ?> 
    16 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    17 <html xmlns="http://www.w3.org/1999/xhtml"> 
    18 <head> 
    19         <title>WordPress &rsaquo; Installation</title> 
    20         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    21         <style media="screen" type="text/css"> 
    22         html { 
    23                 background: #eee; 
    24         } 
    25         body { 
    26                 background: #fff; 
    27                 color: #000
    28                 font-family: Georgia, "Times New Roman", Times, serif
    29                 margin-left: 20%
    30                 margin-right: 20%; 
    31                 padding: .2em 2em
    32         } 
    33          
    34         h1, h2 { 
    35                 color: #006; 
    36                 font-size: 18px
    37                 font-weight: lighter
    38         } 
    39          
    40         p, li, dt { 
    41                 line-height: 140%; 
    42                 padding-bottom: 2px
    43         } 
    44  
    45         ul, ol { 
    46                 padding: 5px 5px 5px 20px; 
    47         } 
    48         #logo { 
    49                 margin-bottom: 2em; 
    50         } 
    51 .step a, .step input { 
    52         font-size: 2em; 
    53 
    54 .step, th { 
    55         text-align: right; 
    56 
    57 #footer { 
    58 text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic; 
    59 
    60 .fakelink { 
    61     color: #00a; 
    62     text-decoration: underline
    63 
    64         </style> 
    65 </head
    66 <body
    67  
    68 <h1><img src="wp-includes/images/wordpress-mu.png" alt="WordPress &micro;" /></h1> 
    69 <?php 
     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 &rsaquo; Installation</title> 
     22               <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     23 
     24                <style media="screen" type="text/css"> 
     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, h2 { 
     38                       color: #006
     39                       font-size: 18px
     40                        font-weight: lighter; 
     41                } 
     42 
     43                p, li, dt { 
     44                       line-height: 140%
     45                        padding-bottom: 2px; 
     46                } 
     47 
     48                ul, ol { 
     49                        padding: 5px 5px 5px 20px; 
     50                } 
     51                #logo { 
     52                        margin-bottom: 2em; 
     53                } 
     54                .step a, .step input { 
     55                        font-size: 2em; 
     56                } 
     57                .step, th { 
     58                        text-align: right; 
     59                } 
     60                #footer { 
     61                        text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic; 
     62                } 
     63                .fakelink { 
     64                       color: #00a
     65                        text-decoration: underline; 
     66                } 
     67               </style
     68       </head
     69        <body> 
     70               <h1><img src="wp-includes/images/wordpress-mu.png" alt="WordPress &micro;" /></h1> 
     71               <?php 
    7072} 
    7173 
     
    7577 
    7678        print "<blockquote style='background: #eee; border: 1px solid #333; padding: 5px;'>"; 
    77         print "<br /><strong>ERROR: $err</strong></br >"; 
     79        print "<br /><strong>ERROR: $err</strong><br />"; 
    7880        clearstatcache(); 
    7981        $files = array( "htaccess.dist", ".htaccess" ); 
    80         while( list( $key, $val ) = each( $files ) ) {  
     82         
     83        foreach ( (array) $files as $val ) { 
    8184                $stats = @stat( $val ); 
    8285                if( $stats ) { 
     
    9396                } elseif( file_exists( $val ) == false ) { 
    9497                        print "<h2>$val</h2>"; 
    95                         print "&nbsp;&nbsp;&nbsp;&nbsp;FILE NOT FOUND: $val<br>"; 
     98                        print "&nbsp;&nbsp;&nbsp;&nbsp;FILE NOT FOUND: $val<br />"; 
    9699                } 
    97100        } 
     
    154157                print "<p>If you use Cpanel then read <a href='http://mu.wordpress.org/forums/topic.php?id=99'>this post</a>. Cpanel creates files that I need to overwrite and you have to fix that.</p>"; 
    155158                print "<p>If all else fails then you'll have to create it by hand:"; 
    156                 print "<ul><li> Download htaccess.dist to your computer and open it in your favourite text editor.</li> 
    157                 <li> Replace the following text:<ul><li>BASE by '$base'</li><li>HOST by '$url'</li></li> 
    158                 <li> Rename htaccess.dist to .htaccess and upload it back to the same directory.</li></ul>"; 
     159                print "<ul> 
     160                        <li> Download htaccess.dist to your computer and open it in your favourite text editor.</li> 
     161                        <li> Replace the following text: 
     162                        <ul> 
     163                        <li>BASE by '$base'</li> 
     164                        <li>HOST by '$url'</li> 
     165                        </ul> 
     166                        </li> 
     167                        <li> Rename htaccess.dist to .htaccess and upload it back to the same directory.</li> 
     168                        </ul>"; 
    159169                die( "Installation Aborted!" ); 
    160170        } 
     
    163173function checkdirs() { 
    164174        global $dirs; 
    165  
    166         $ret = true; 
    167         foreach( $dirs as $dir ) { 
     175        $return = true; 
     176 
     177        $errors = array(); 
     178        foreach( (array) $dirs as $dir ) { 
    168179                if( false == is_writeable( $dir ) ) { 
    169                         $err[] = $dir; 
    170                 } 
    171         } 
    172  
    173         if( is_array( $err ) ) { 
    174                 ?><h2>Warning!</h2> 
     180                        $errors[] = $dir; 
     181                } 
     182        } 
     183 
     184        if( !empty( $errors ) ) { 
     185                ?> 
     186                <h2>Warning!</h2> 
    175187                <div style='border: 1px solid #ccc'> 
    176                 <p style='font-weight: bold; padding-left: 10px'>One or more of the directories must be made writeable by the webserver. You will be reminded to reset the permissions at the end of the install.<br
    177                 Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br
    178                 Refresh this page when you're done!<br></p> 
     188                       <p style='font-weight: bold; padding-left: 10px'>One or more of the directories must be made writeable by the webserver. You will be reminded to reset the permissions at the end of the install.<br /
     189                               Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br /
     190                               Refresh this page when you're done!<br /></p> 
    179191                </div> 
    180192                <p>Quick fix:<br /> <code>chmod&nbsp;777&nbsp;<?php 
    181                 foreach( $err as $dir ) { 
     193                foreach( $errors as $dir ) { 
    182194                        echo "$dir&nbsp;"; 
    183195                } 
    184                 ?></code></p><?php 
    185                 $ret = false; 
    186         } 
     196                ?></code> 
     197                </p> 
     198                </div> 
     199                <?php 
     200                $return = false; 
     201        } 
     202         
    187203        if( file_exists( "./.htaccess" ) && is_writeable( "./.htaccess" ) == false ) { 
    188                 $ret = false; 
    189                 print "<h2>Warning! .htaccess already exists.</h2>"; 
    190                 print "<div style='border: 1px solid #ccc'>"; 
    191                 print "<p style='font-weight: bold; padding-left: 10px'>A file with the name '.htaccess' already exists in this directory and I cannot write to it. Please ftp to the server and delete this file from this directory!<br />"; 
    192                 print "Offending file: " . realpath( '.htaccess' ) . "</p>"; 
    193                 print "</div>"; 
    194         } 
    195         return $ret; 
     204                ?> 
     205                <h2>Warning! .htaccess already exists.</h2> 
     206                <div style='border: 1px solid #ccc'> 
     207                        <p style='font-weight: bold; padding-left: 10px'>A file with the name '.htaccess' already exists in this directory and I cannot write to it. Please ftp to the server and delete this file from this directory!<br />Offending file: <?php echo realpath( '.htaccess' ); ?></p> 
     208                </div> 
     209                <?php 
     210                $return = false; 
     211        } 
     212         
     213        return $return; 
    196214} 
    197215 
    198216function step1() { 
    199         ?><h2>Installing WordPress &micro;</h2> 
     217        ?> 
     218        <h2>Installing WordPress &micro;</h2> 
    200219        <p><strong>Welcome to WordPress &micro;.</strong> I will help you install this software by asking you a few questions and asking that you change the permissions on a few directories so I can create configuration files and make a directory to store all your uploaded files.</p> 
    201220        <p>If you have installed the single-blog version of WordPress before, please note that the WordPress &micro; installer is different and trying to create the configuration file wp-config.php youself may result in a broken site. It's much easier to use this installer to get the job done.</p> 
     221         
    202222        <h3>What do I need?</h3> 
    203         <p><ul><li>Access to your server to change directory permissions. This can be done through ssh or ftp for example.</li><li>A valid email where your password and administrative emails will be sent.</li><li>An empty MySQL database.Tables are prefixed with <code>wp_</code> which may conflict with an existing WordPress install.</li><li>