| 
									
										
										
										
											2009-04-15 08:38:05 +02:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2009-09-15 16:31:09 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2009-08-25 18:14:12 -04:00
										 |  |  |  * StatusNet - the distributed open-source microblogging tool | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |  * Copyright (C) 2009-2010, StatusNet, Inc. | 
					
						
							| 
									
										
										
										
											2009-04-15 08:38:05 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU Affero General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
					
						
							| 
									
										
										
										
											2009-09-15 16:31:09 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-09-13 17:43:02 +12:00
										 |  |  |  * @category Installation | 
					
						
							|  |  |  |  * @package  Installation | 
					
						
							| 
									
										
										
										
											2009-09-15 16:31:09 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-09-14 19:19:11 +12:00
										 |  |  |  * @author   Adrian Lang <mail@adrianlang.de> | 
					
						
							|  |  |  |  * @author   Brenda Wallace <shiny@cpan.org> | 
					
						
							|  |  |  |  * @author   Brett Taylor <brett@webfroot.co.nz> | 
					
						
							|  |  |  |  * @author   Brion Vibber <brion@pobox.com> | 
					
						
							|  |  |  |  * @author   CiaranG <ciaran@ciarang.com> | 
					
						
							|  |  |  |  * @author   Craig Andrews <candrews@integralblue.com> | 
					
						
							| 
									
										
										
										
											2009-11-14 17:38:10 +01:00
										 |  |  |  * @author   Eric Helgeson <helfire@Erics-MBP.local> | 
					
						
							| 
									
										
										
										
											2009-09-15 22:28:59 -04:00
										 |  |  |  * @author   Evan Prodromou <evan@status.net> | 
					
						
							| 
									
										
										
										
											2013-08-12 13:08:14 +02:00
										 |  |  |  * @author   Mikael Nordfeldth <mmn@hethane.se> | 
					
						
							| 
									
										
										
										
											2009-09-14 19:19:11 +12:00
										 |  |  |  * @author   Robin Millette <millette@controlyourself.ca> | 
					
						
							| 
									
										
										
										
											2009-09-16 11:14:26 +02:00
										 |  |  |  * @author   Sarven Capadisli <csarven@status.net> | 
					
						
							| 
									
										
										
										
											2009-09-14 19:19:11 +12:00
										 |  |  |  * @author   Tom Adams <tom@holizz.com> | 
					
						
							| 
									
										
										
										
											2010-03-03 23:26:45 -08:00
										 |  |  |  * @author   Zach Copley <zach@status.net> | 
					
						
							| 
									
										
										
										
											2010-05-27 18:26:47 -04:00
										 |  |  |  * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org | 
					
						
							| 
									
										
										
										
											2009-09-14 19:19:11 +12:00
										 |  |  |  * @license  GNU Affero General Public License http://www.gnu.org/licenses/ | 
					
						
							| 
									
										
										
										
											2009-10-03 17:36:53 +13:00
										 |  |  |  * @version  0.9.x | 
					
						
							| 
									
										
										
										
											2009-09-19 16:01:42 +12:00
										 |  |  |  * @link     http://status.net | 
					
						
							| 
									
										
										
										
											2009-04-15 08:38:05 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-09-15 16:31:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-28 20:33:22 -08:00
										 |  |  | define('INSTALLDIR', dirname(__FILE__)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  | require INSTALLDIR . '/lib/installer.php'; | 
					
						
							| 
									
										
										
										
											2009-08-26 19:08:30 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-15 16:31:09 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |  * Helper class for building form | 
					
						
							| 
									
										
										
										
											2009-09-13 17:44:22 +12:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  | class Posted { | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * HTML-friendly escaped string for the POST param of given name, or empty. | 
					
						
							|  |  |  |      * @param string $name | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     function value($name) | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |     { | 
					
						
							|  |  |  |         return htmlspecialchars($this->string($name)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The given POST parameter value, forced to a string. | 
					
						
							|  |  |  |      * Missing value will give ''. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $name | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function string($name) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return strval($this->raw($name)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The given POST parameter value, in its original form. | 
					
						
							|  |  |  |      * Magic quotes are stripped, if provided. | 
					
						
							|  |  |  |      * Missing value will give null. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $name | 
					
						
							|  |  |  |      * @return mixed | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function raw($name) | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (isset($_POST[$name])) { | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |             return $this->dequote($_POST[$name]); | 
					
						
							| 
									
										
										
										
											2009-08-26 19:08:30 -04:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |             return null; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * If necessary, strip magic quotes from the given value. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param mixed $val | 
					
						
							|  |  |  |      * @return mixed | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function dequote($val) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (get_magic_quotes_gpc()) { | 
					
						
							|  |  |  |             if (is_string($val)) { | 
					
						
							|  |  |  |                 return stripslashes($val); | 
					
						
							|  |  |  |             } else if (is_array($val)) { | 
					
						
							|  |  |  |                 return array_map(array($this, 'dequote'), $val); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-08-26 19:08:30 -04:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |         return $val; | 
					
						
							| 
									
										
										
										
											2009-08-26 19:08:30 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-02-28 21:01:33 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-13 18:29:10 +12:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |  * Web-based installer: provides a form and such. | 
					
						
							| 
									
										
										
										
											2009-09-13 18:29:10 +12:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  | class WebInstaller extends Installer | 
					
						
							| 
									
										
										
										
											2009-02-28 20:33:22 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * the actual installation. | 
					
						
							|  |  |  |      * If call libraries are present, then install | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function main() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (!$this->checkPrereqs()) { | 
					
						
							| 
									
										
										
										
											2014-03-01 16:27:34 +01:00
										 |  |  |             $this->warning(_('Please fix the above stated problems and refresh this page to continue installing.')); | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |             return; | 
					
						
							| 
									
										
										
										
											2009-09-13 17:53:15 -07:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-02-28 21:01:33 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         if ($_SERVER['REQUEST_METHOD'] == 'POST') { | 
					
						
							|  |  |  |             $this->handlePost(); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $this->showForm(); | 
					
						
							| 
									
										
										
										
											2009-09-14 19:05:14 +12:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-02-28 21:01:33 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Web implementation of warning output | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function warning($message, $submessage='') | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         print "<p class=\"error\">$message</p>\n"; | 
					
						
							|  |  |  |         if ($submessage != '') { | 
					
						
							|  |  |  |             print "<p>$submessage</p>\n"; | 
					
						
							| 
									
										
										
										
											2009-10-03 17:36:53 +13:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-02-28 21:01:33 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-02-28 20:33:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Web implementation of status output | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function updateStatus($status, $error=false) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         echo '<li' . ($error ? ' class="error"': '' ) . ">$status</li>"; | 
					
						
							| 
									
										
										
										
											2009-08-26 19:08:30 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Show the web form! | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function showForm() | 
					
						
							| 
									
										
										
										
											2010-03-04 07:45:26 -08:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         global $dbModules; | 
					
						
							|  |  |  |         $post = new Posted(); | 
					
						
							|  |  |  |         $dbRadios = ''; | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |         $dbtype = $post->raw('dbtype'); | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         foreach (self::$dbModules as $type => $info) { | 
					
						
							|  |  |  |             if ($this->checkExtension($info['check_module'])) { | 
					
						
							|  |  |  |                 if ($dbtype == null || $dbtype == $type) { | 
					
						
							|  |  |  |                     $checked = 'checked="checked" '; | 
					
						
							|  |  |  |                     $dbtype = $type; // if we didn't have one checked, hit the first
 | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     $checked = ''; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 $dbRadios .= "<input type=\"radio\" name=\"dbtype\" id=\"dbtype-$type\" value=\"$type\" $checked/> $info[name]<br />\n";
 | 
					
						
							| 
									
										
										
										
											2010-03-04 07:45:26 -08:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-09-13 17:53:15 -07:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-03-09 11:08:21 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-12 13:08:14 +02:00
										 |  |  |         $ssl = array('always'=>null, 'never'=>null); | 
					
						
							|  |  |  |         if (!empty($_SERVER['HTTPS'])) { | 
					
						
							|  |  |  |             $ssl['always'] = 'checked="checked"'; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $ssl['never'] = 'checked="checked"'; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         echo<<<E_O_T | 
					
						
							|  |  |  |     <form method="post" action="install.php" class="form_settings" id="form_install"> | 
					
						
							|  |  |  |         <fieldset> | 
					
						
							|  |  |  |             <fieldset id="settings_site"> | 
					
						
							|  |  |  |                 <legend>Site settings</legend> | 
					
						
							|  |  |  |                 <ul class="form_data"> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="sitename">Site name</label> | 
					
						
							|  |  |  |                         <input type="text" id="sitename" name="sitename" value="{$post->value('sitename')}" /> | 
					
						
							|  |  |  |                         <p class="form_guide">The name of your site</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="fancy-enable">Fancy URLs</label> | 
					
						
							|  |  |  |                         <input type="radio" name="fancy" id="fancy-enable" value="enable" checked='checked' /> enable<br /> | 
					
						
							|  |  |  |                         <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> | 
					
						
							| 
									
										
										
										
											2013-08-12 13:08:14 +02:00
										 |  |  |                     <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> | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |                 </ul> | 
					
						
							|  |  |  |             </fieldset> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             <fieldset id="settings_db"> | 
					
						
							|  |  |  |                 <legend>Database settings</legend> | 
					
						
							|  |  |  |                 <ul class="form_data"> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="host">Hostname</label> | 
					
						
							|  |  |  |                         <input type="text" id="host" name="host" value="{$post->value('host')}" /> | 
					
						
							|  |  |  |                         <p class="form_guide">Database hostname</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="dbtype">Type</label> | 
					
						
							|  |  |  |                         $dbRadios | 
					
						
							|  |  |  |                         <p class="form_guide">Database type</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="database">Name</label> | 
					
						
							|  |  |  |                         <input type="text" id="database" name="database" value="{$post->value('database')}" /> | 
					
						
							|  |  |  |                         <p class="form_guide">Database name</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="dbusername">DB username</label> | 
					
						
							|  |  |  |                         <input type="text" id="dbusername" name="dbusername" value="{$post->value('dbusername')}" /> | 
					
						
							|  |  |  |                         <p class="form_guide">Database username</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="dbpassword">DB password</label> | 
					
						
							|  |  |  |                         <input type="password" id="dbpassword" name="dbpassword" value="{$post->value('dbpassword')}" /> | 
					
						
							|  |  |  |                         <p class="form_guide">Database password (optional)</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                 </ul> | 
					
						
							|  |  |  |             </fieldset> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             <fieldset id="settings_admin"> | 
					
						
							|  |  |  |                 <legend>Administrator settings</legend> | 
					
						
							|  |  |  |                 <ul class="form_data"> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="admin_nickname">Administrator nickname</label> | 
					
						
							|  |  |  |                         <input type="text" id="admin_nickname" name="admin_nickname" value="{$post->value('admin_nickname')}" /> | 
					
						
							| 
									
										
										
										
											2014-03-01 13:17:17 +01:00
										 |  |  |                         <p class="form_guide">Nickname for the initial user (administrator)</p> | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="admin_password">Administrator password</label> | 
					
						
							|  |  |  |                         <input type="password" id="admin_password" name="admin_password" value="{$post->value('admin_password')}" /> | 
					
						
							| 
									
										
										
										
											2014-03-01 13:17:17 +01:00
										 |  |  |                         <p class="form_guide">Password for the initial user (administrator)</p> | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="admin_password2">Confirm password</label> | 
					
						
							|  |  |  |                         <input type="password" id="admin_password2" name="admin_password2" value="{$post->value('admin_password2')}" /> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="admin_email">Administrator e-mail</label> | 
					
						
							|  |  |  |                         <input id="admin_email" name="admin_email" value="{$post->value('admin_email')}" /> | 
					
						
							| 
									
										
										
										
											2014-03-01 13:17:17 +01:00
										 |  |  |                         <p class="form_guide">Optional email address for the initial user (administrator)</p> | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |                     </li> | 
					
						
							|  |  |  |                     <li> | 
					
						
							|  |  |  |                         <label for="admin_updates">Subscribe to announcements</label> | 
					
						
							|  |  |  |                         <input type="checkbox" id="admin_updates" name="admin_updates" value="true" checked="checked" /> | 
					
						
							|  |  |  |                         <p class="form_guide">Release and security feed from <a href="http://update.status.net/">update@status.net</a> (recommended)</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                 </ul> | 
					
						
							|  |  |  |             </fieldset> | 
					
						
							| 
									
										
										
										
											2011-08-26 13:37:04 -07:00
										 |  |  |             <fieldset id="settings_profile"> | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  |                 <legend>Site profile</legend> | 
					
						
							| 
									
										
										
										
											2011-08-26 13:37:04 -07:00
										 |  |  |                 <ul class="form_data"> | 
					
						
							|  |  |  |                     <li> | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  |                         <label for="site_profile">Type of site</label> | 
					
						
							|  |  |  |                         <select id="site_profile" name="site_profile"> | 
					
						
							| 
									
										
										
										
											2011-08-26 13:37:04 -07:00
										 |  |  |                             <option value="private">Private</option> | 
					
						
							|  |  |  |                             <option value="community">Community</option> | 
					
						
							|  |  |  |                             <option value ="public">Public</option> | 
					
						
							| 
									
										
										
										
											2011-08-27 12:14:41 -07:00
										 |  |  |                             <option value ="singleuser">Single User</option> | 
					
						
							| 
									
										
										
										
											2011-08-26 13:37:04 -07:00
										 |  |  |                         </select> | 
					
						
							|  |  |  |                         <p class="form_guide">Initial access settings for your site</p> | 
					
						
							|  |  |  |                     </li> | 
					
						
							|  |  |  |                 </ul> | 
					
						
							|  |  |  |             </fieldset> | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |             <input type="submit" name="submit" class="submit" value="Submit" /> | 
					
						
							| 
									
										
										
										
											2010-03-04 11:32:30 -05:00
										 |  |  |         </fieldset> | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     </form> | 
					
						
							| 
									
										
										
										
											2009-05-17 00:05:07 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | E_O_T; | 
					
						
							| 
									
										
										
										
											2009-09-13 18:22:32 +12:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Handle a POST submission... if we have valid input, start the install! | 
					
						
							|  |  |  |      * Otherwise shows the form along with any error messages. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function handlePost() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         echo <<<STR | 
					
						
							|  |  |  |         <dl class="system_notice"> | 
					
						
							|  |  |  |             <dt>Page notice</dt> | 
					
						
							|  |  |  |             <dd> | 
					
						
							|  |  |  |                 <ul> | 
					
						
							|  |  |  | STR; | 
					
						
							|  |  |  |         $this->validated = $this->prepare(); | 
					
						
							|  |  |  |         if ($this->validated) { | 
					
						
							|  |  |  |             $this->doInstall(); | 
					
						
							| 
									
										
										
										
											2009-09-13 18:22:32 +12:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         echo <<<STR | 
					
						
							|  |  |  |             </ul> | 
					
						
							|  |  |  |         </dd> | 
					
						
							|  |  |  |     </dl> | 
					
						
							|  |  |  | STR; | 
					
						
							|  |  |  |         if (!$this->validated) { | 
					
						
							|  |  |  |             $this->showForm(); | 
					
						
							| 
									
										
										
										
											2009-09-13 18:22:32 +12:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Read and validate input data. | 
					
						
							|  |  |  |      * May output side effects. | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |      * @return boolean success | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function prepare() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |         $post = new Posted(); | 
					
						
							|  |  |  |         $this->host     = $post->string('host'); | 
					
						
							|  |  |  |         $this->dbtype   = $post->string('dbtype'); | 
					
						
							|  |  |  |         $this->database = $post->string('database'); | 
					
						
							|  |  |  |         $this->username = $post->string('dbusername'); | 
					
						
							|  |  |  |         $this->password = $post->string('dbpassword'); | 
					
						
							|  |  |  |         $this->sitename = $post->string('sitename'); | 
					
						
							|  |  |  |         $this->fancy    = (bool)$post->string('fancy'); | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-14 16:47:56 -07:00
										 |  |  |         $this->adminNick    = strtolower($post->string('admin_nickname')); | 
					
						
							|  |  |  |         $this->adminPass    = $post->string('admin_password'); | 
					
						
							|  |  |  |         $adminPass2         = $post->string('admin_password2'); | 
					
						
							|  |  |  |         $this->adminEmail   = $post->string('admin_email'); | 
					
						
							|  |  |  |         $this->adminUpdates = $post->string('admin_updates'); | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  |         $this->siteProfile = $post->string('site_profile'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-12 13:08:14 +02:00
										 |  |  |         $this->ssl = $post->string('ssl'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         $this->server = $_SERVER['HTTP_HOST']; | 
					
						
							|  |  |  |         $this->path = substr(dirname($_SERVER['PHP_SELF']), 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $fail = false; | 
					
						
							|  |  |  |         if (!$this->validateDb()) { | 
					
						
							|  |  |  |             $fail = true; | 
					
						
							| 
									
										
										
										
											2009-02-28 20:33:22 -08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         if (!$this->validateAdmin()) { | 
					
						
							|  |  |  |             $fail = true; | 
					
						
							| 
									
										
										
										
											2010-03-04 11:00:02 -08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         if ($this->adminPass != $adminPass2) { | 
					
						
							|  |  |  |             $this->updateStatus("Administrator passwords do not match. Did you mistype?", true); | 
					
						
							|  |  |  |             $fail = true; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-12 13:08:14 +02:00
										 |  |  |         if (!in_array($this->ssl, array('never', 'sometimes', 'always'))) { | 
					
						
							|  |  |  |             $this->updateStatus("Bad value for server SSL enabling."); | 
					
						
							|  |  |  |             $fail = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  |         if (!$this->validateSiteProfile()) { | 
					
						
							|  |  |  |             $fail = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  |         return !$fail; | 
					
						
							| 
									
										
										
										
											2010-03-04 11:00:02 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-03 23:26:45 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-28 17:42:27 -08:00
										 |  |  | ?>
 | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  | <?php echo"<?"; ?> xml version="1.0" encoding="UTF-8" <?php echo "?>"; ?>
 | 
					
						
							|  |  |  | <!DOCTYPE html | 
					
						
							|  |  |  | PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | 
					
						
							|  |  |  |        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | 
					
						
							|  |  |  | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> | 
					
						
							|  |  |  |     <head> | 
					
						
							| 
									
										
										
										
											2014-03-01 13:17:17 +01:00
										 |  |  |         <title>Install GNU social</title> | 
					
						
							| 
									
										
										
										
											2014-03-01 14:05:39 +01:00
										 |  |  |         <link rel="shortcut icon" href="favicon.ico"/> | 
					
						
							| 
									
										
										
										
											2011-07-26 15:19:50 -04:00
										 |  |  |         <link rel="stylesheet" type="text/css" href="theme/base/css/display.css" media="screen, projection, tv"/> | 
					
						
							| 
									
										
										
										
											2011-06-27 17:14:35 -04:00
										 |  |  |         <link rel="stylesheet" type="text/css" href="theme/neo/css/display.css" media="screen, projection, tv"/> | 
					
						
							| 
									
										
										
										
											2014-03-01 14:05:39 +01:00
										 |  |  |         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | 
					
						
							| 
									
										
										
										
											2010-03-03 23:59:10 -08:00
										 |  |  |         <!--[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]-->
 | 
					
						
							| 
									
										
										
										
											2011-09-22 09:22:08 -04:00
										 |  |  |         <!--[if lte IE 7]><link rel="stylesheet" type="text/css" theme/base/css/ie7.css" /><![endif]-->
 | 
					
						
							| 
									
										
										
										
											2014-03-01 13:21:42 +01:00
										 |  |  |         <script src="js/extlib/jquery.js"></script> | 
					
						
							| 
									
										
										
										
											2009-05-22 16:38:06 +00:00
										 |  |  |         <script src="js/install.js"></script> | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  |     </head> | 
					
						
							|  |  |  |     <body id="install"> | 
					
						
							|  |  |  |         <div id="wrap"> | 
					
						
							|  |  |  |             <div id="header"> | 
					
						
							|  |  |  |                 <address id="site_contact" class="vcard"> | 
					
						
							|  |  |  |                     <a class="url home bookmark" href="."> | 
					
						
							| 
									
										
										
										
											2014-03-01 13:17:17 +01:00
										 |  |  |                         <img class="logo photo" src="theme/neo/logo.png" alt="GNU social"/> | 
					
						
							|  |  |  |                         <span class="fn org">GNU social</span> | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  |                     </a> | 
					
						
							|  |  |  |                 </address> | 
					
						
							| 
									
										
										
										
											2011-07-26 15:19:50 -04:00
										 |  |  |                 <div id="site_nav_global_primary"></div> | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  |             </div> | 
					
						
							|  |  |  |             <div id="core"> | 
					
						
							| 
									
										
										
										
											2011-07-26 15:19:50 -04:00
										 |  |  |              <div id="aside_primary_wrapper"> | 
					
						
							|  |  |  |               <div id="content_wrapper"> | 
					
						
							|  |  |  |                <div id="site_nav_local_views_wrapper"> | 
					
						
							|  |  |  |                 <div id="site_nav_local_views"></div> | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  |                 <div id="content"> | 
					
						
							| 
									
										
										
										
											2010-03-03 23:59:10 -08:00
										 |  |  |                      <div id="content_inner"> | 
					
						
							| 
									
										
										
										
											2014-03-01 13:17:17 +01:00
										 |  |  |                         <h1>Install GNU social</h1> | 
					
						
							| 
									
										
										
										
											2011-08-26 21:10:24 -07:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2010-04-07 17:47:08 -07:00
										 |  |  | $installer = new WebInstaller(); | 
					
						
							|  |  |  | $installer->main(); | 
					
						
							|  |  |  | ?>
 | 
					
						
							| 
									
										
										
										
											2010-03-03 23:59:10 -08:00
										 |  |  |                    </div> | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  |                 </div> | 
					
						
							| 
									
										
										
										
											2011-07-26 15:19:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 <div id="aside_primary" class="aside"></div> | 
					
						
							|  |  |  |                </div> | 
					
						
							|  |  |  |               </div> | 
					
						
							|  |  |  |              </div> | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  |             </div> | 
					
						
							| 
									
										
										
										
											2011-07-26 15:19:50 -04:00
										 |  |  |             <div id="footer"></div> | 
					
						
							| 
									
										
										
										
											2009-05-01 03:50:24 +00:00
										 |  |  |         </div> | 
					
						
							|  |  |  |     </body> | 
					
						
							| 
									
										
										
										
											2009-04-15 08:38:05 +02:00
										 |  |  | </html> |