* @author Robin Millette <millette@controlyourself.ca>
* @author Sarven Capadisli <csarven@status.net>
* @author Tom Adams <tom@holizz.com>
+ * @author Zach Copley <zach@status.net>
* @license GNU Affero General Public License http://www.gnu.org/licenses/
* @version 0.9.x
* @link http://status.net
<p class="form_guide">Database name</p>
</li>
<li>
- <label for="username">Username</label>
+ <label for="username">DB username</label>
<input type="text" id="username" name="username" />
<p class="form_guide">Database username</p>
</li>
<li>
- <label for="password">Password</label>
+ <label for="password">DB password</label>
<input type="password" id="password" name="password" />
<p class="form_guide">Database password (optional)</p>
</li>
+ <li>
+ <label for="admin_nickname">Administrator nickname</label>
+ <input type="text" id="admin_nickname" name="admin_nickname" />
+ <p class="form_guide">Nickname for the initial StatusNet user (administrator)</p>
+ </li>
+ <li>
+ <label for="initial_user_password">Administrator password</label>
+ <input type="password" id="admin_password" name="admin_password" />
+ <p class="form_guide">Password for the initial StatusNet user (administrator)</p>
+ </li>
</ul>
<input type="submit" name="submit" class="submit" value="Submit" />
</fieldset>
$password = $_POST['password'];
$sitename = $_POST['sitename'];
$fancy = !empty($_POST['fancy']);
+
+ $adminNick = $_POST['admin_nickname'];
+ $adminPass = $_POST['admin_password'];
+
$server = $_SERVER['HTTP_HOST'];
$path = substr(dirname($_SERVER['PHP_SELF']), 1);
$fail = true;
}
+ if (empty($adminNick)) {
+ updateStatus("No initial StatusNet user nickname specified.", true);
+ $fail = true;
+ }
+
+ if (empty($adminPass)) {
+ updateStatus("No initial StatusNet user password specified.", true);
+ $fail = true;
+ }
+
if ($fail) {
showForm();
return;
return;
}
+ // Okay, cross fingers and try to register an initial user
+ if (registerInitialUser($adminNick, $adminPass)) {
+ updateStatus(
+ "An initial user with the administrator role has been created."
+ );
+ } else {
+ updateStatus(
+ "Could not create initial StatusNet user (administrator).",
+ true
+ );
+ showForm();
+ return;
+ }
+
/*
TODO https needs to be considered
*/
$link = "http://".$server.'/'.$path;
updateStatus("StatusNet has been installed at $link");
- updateStatus("You can visit your <a href='$link'>new StatusNet site</a>.");
+ updateStatus(
+ "You can visit your <a href='$link'>new StatusNet site</a> (login as '$adminNick')."
+ );
}
function Pgsql_Db_installer($host, $database, $username, $password)
return true;
}
+function registerInitialUser($nickname, $password)
+{
+ define('STATUSNET', true);
+ define('LACONICA', true); // compatibility
+
+ require_once INSTALLDIR . '/lib/common.php';
+
+ $user = User::register(
+ array('nickname' => $nickname,
+ 'password' => $password,
+ 'fullname' => $nickname
+ )
+ );
+
+ if (empty($user)) {
+ return false;
+ }
+
+ // give initial user carte blanche
+
+ $user->grantRole('owner');
+ $user->grantRole('moderator');
+ $user->grantRole('administrator');
+
+ return true;
+}
+
?>
<?php echo"<?"; ?> xml version="1.0" encoding="UTF-8" <?php echo "?>"; ?>
<!DOCTYPE html