]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - install.php
Merge commit 'refs/merge-requests/8' of git://gitorious.org/statusnet/gnu-social...
[quix0rs-gnu-social.git] / install.php
index fdcbce84c91b41f9b9931455acb754f7dc152167..088116d5c222034bea45fa6768fcbc70f8c55e6c 100644 (file)
@@ -27,6 +27,7 @@
  * @author   Craig Andrews <candrews@integralblue.com>
  * @author   Eric Helgeson <helfire@Erics-MBP.local>
  * @author   Evan Prodromou <evan@status.net>
+ * @author   Mikael Nordfeldth <mmn@hethane.se>
  * @author   Robin Millette <millette@controlyourself.ca>
  * @author   Sarven Capadisli <csarven@status.net>
  * @author   Tom Adams <tom@holizz.com>
@@ -168,6 +169,13 @@ class WebInstaller extends Installer
             }
         }
 
+        $ssl = array('always'=>null, 'never'=>null);
+        if (!empty($_SERVER['HTTPS'])) {
+            $ssl['always'] = 'checked="checked"';
+        } else {
+            $ssl['never'] = 'checked="checked"';
+        }
+
         echo<<<E_O_T
     <form method="post" action="install.php" class="form_settings" id="form_install">
         <fieldset>
@@ -185,6 +193,12 @@ class WebInstaller extends Installer
                         <input type="radio" name="fancy" id="fancy-disable" value="" /> disable<br />
                         <p class="form_guide" id='fancy-form_guide'>Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.</p>
                     </li>
+                    <li>
+                        <label for="ssl">Server SSL</label>
+                        <input type="radio" name="ssl" id="ssl-always" value="always" {$ssl['always']} /> enable<br />
+                        <input type="radio" name="ssl" id="ssl-never" value="never" {$ssl['never']} /> disable<br />
+                        <p class="form_guide" id="ssl-form_guide">Enabling SSL (https://) requires extra webserver configuration and certificate generation not offered by this installation.</p>
+                    </li>
                 </ul>
             </fieldset>
 
@@ -249,14 +263,15 @@ class WebInstaller extends Installer
                 </ul>
             </fieldset>
             <fieldset id="settings_profile">
-                <legend>Installation profile</legend>
+                <legend>Site profile</legend>
                 <ul class="form_data">
                     <li>
-                        <label for="profile">Profile</label>
-                        <select id="profile" name="profile">
+                        <label for="site_profile">Type of site</label>
+                        <select id="site_profile" name="site_profile">
                             <option value="private">Private</option>
                             <option value="community">Community</option>
                             <option value ="public">Public</option>
+                            <option value ="singleuser">Single User</option>
                         </select>
                         <p class="form_guide">Initial access settings for your site</p>
                     </li>
@@ -298,7 +313,7 @@ STR;
     /**
      * Read and validate input data.
      * May output side effects.
-     * 
+     *
      * @return boolean success
      */
     function prepare()
@@ -318,6 +333,10 @@ STR;
         $this->adminEmail   = $post->string('admin_email');
         $this->adminUpdates = $post->string('admin_updates');
 
+        $this->siteProfile = $post->string('site_profile');
+
+        $this->ssl = $post->string('ssl');
+
         $this->server = $_SERVER['HTTP_HOST'];
         $this->path = substr(dirname($_SERVER['PHP_SELF']), 1);
 
@@ -329,12 +348,21 @@ STR;
         if (!$this->validateAdmin()) {
             $fail = true;
         }
-        
+
         if ($this->adminPass != $adminPass2) {
             $this->updateStatus("Administrator passwords do not match. Did you mistype?", true);
             $fail = true;
         }
-        
+
+        if (!in_array($this->ssl, array('never', 'sometimes', 'always'))) {
+            $this->updateStatus("Bad value for server SSL enabling.");
+            $fail = true;
+        }
+
+        if (!$this->validateSiteProfile()) {
+            $fail = true;
+        }
+
         return !$fail;
     }
 
@@ -353,8 +381,8 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         <link rel="stylesheet" type="text/css" href="theme/neo/css/display.css" media="screen, projection, tv"/>
         <!--[if IE]><link rel="stylesheet" type="text/css" href="theme/base/css/ie.css" /><![endif]-->
         <!--[if lte IE 6]><link rel="stylesheet" type="text/css" theme/base/css/ie6.css" /><![endif]-->
-        <!--[if IE]><link rel="stylesheet" type="text/css" href="theme/neo/css/ie.css" /><![endif]-->
-        <script src="js/jquery.min.js"></script>
+        <!--[if lte IE 7]><link rel="stylesheet" type="text/css" theme/base/css/ie7.css" /><![endif]-->
+        <script src="js/extlib/jquery.min.js"></script>
         <script src="js/install.js"></script>
     </head>
     <body id="install">
@@ -373,11 +401,11 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
               <div id="content_wrapper">
                <div id="site_nav_local_views_wrapper">
                 <div id="site_nav_local_views"></div>
-                
+
                 <div id="content">
                      <div id="content_inner">
                         <h1>Install StatusNet</h1>
-<?php 
+<?php
 $installer = new WebInstaller();
 $installer->main();
 ?>