X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=install.php;h=9b0d19882cf5e4f3e4af9507230490eef9ca6f31;hb=3d835bb8b5473783fffb571ccc7f51b6b82b225e;hp=0240349bb15d1220f2cdd7babdef83c720febabd;hpb=aa1bc6216e61faf5d5000f875f65b86bdb097c03;p=quix0rs-gnu-social.git diff --git a/install.php b/install.php index 0240349bb1..9b0d19882c 100644 --- a/install.php +++ b/install.php @@ -1,255 +1,368 @@ -. + * + * @category Installation + * @package Installation + * + * @author Adrian Lang + * @author Brenda Wallace + * @author Brett Taylor + * @author Brion Vibber + * @author CiaranG + * @author Craig Andrews + * @author Eric Helgeson + * @author Evan Prodromou + * @author Robin Millette + * @author Sarven Capadisli + * @author Tom Adams + * @author Zach Copley + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org + * @license GNU Affero General Public License http://www.gnu.org/licenses/ + * @version 0.9.x + * @link http://status.net + */ -function main() -{ - if (!checkPrereqs()) - { - return; - } +define('INSTALLDIR', dirname(__FILE__)); - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - handlePost(); - } else { - showForm(); - } -} +require INSTALLDIR . '/lib/installer.php'; -function checkPrereqs() -{ - if (file_exists(INSTALLDIR.'/config.php')) { - ?>

Config file "config.php" already exists.

- string($name)); } - if (version_compare(PHP_VERSION, '5.0.0', '<')) { - ?>

Require PHP version 5 or greater.

raw($name)); } - $reqs = array('gd', 'mysql', 'curl', - 'xmlwriter', 'mbstring', - 'gettext'); - - foreach ($reqs as $req) { - if (!checkExtension($req)) { - ?>

Cannot load required extension "".

dequote($_POST[$name]); + } else { + return null; } } - if (!is_writable(INSTALLDIR)) { - ?>

Cannot write config file to "".

-

On your server, try this command:

-
chmod a+w
-

Cannot write avatar directory "/avatar/".

-

On your server, try this command:

-
chmod a+w /avatar/
- -

Enter your database connection information below to initialize the database.

-
-
-
    -
  • - - -

    The name of your site

    -
  • -
  • -
  • - - -

    Database hostname

    -
  • -
  • - - -

    Database name

    -
  • -
  • - - -

    Database username

    -
  • -
  • - - -

    Database password

    -
  • -
- -
-
- -
  • - -
  • -checkPrereqs()) { + $this->showForm(); + return; + } -function handlePost() -{ -?> -
      -handlePost(); + } else { + $this->showForm(); + } } - if (empty($database)) { - updateStatus("No database specified.", true); - showForm(); - return; + /** + * Web implementation of warning output + */ + function warning($message, $submessage='') + { + print "

      $message

      \n"; + if ($submessage != '') { + print "

      $submessage

      \n"; + } } - if (empty($username)) { - updateStatus("No username specified.", true); - showForm(); - return; + /** + * Web implementation of status output + */ + function updateStatus($status, $error=false) + { + echo '$status"; } - if (empty($password)) { - updateStatus("No password specified.", true); - showForm(); - return; - } + /** + * Show the web form! + */ + function showForm() + { + global $dbModules; + $post = new Posted(); + $dbRadios = ''; + $dbtype = $post->raw('dbtype'); + 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 .= " $info[name]
      \n"; + } + } - if (empty($sitename)) { - updateStatus("No sitename specified.", true); - showForm(); - return; - } + echo<< +
      +
      + Site settings +
        +
      • + + +

        The name of your site

        +
      • +
      • + + enable
        + disable
        +

        Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.

        +
      • +
      +
      - updateStatus("Starting installation..."); - updateStatus("Checking database..."); - $conn = mysql_connect($host, $username, $password); - if (!$conn) { - updateStatus("Can't connect to server '$host' as '$username'.", true); - showForm(); - return; - } - updateStatus("Changing to database..."); - $res = mysql_select_db($database, $conn); - if (!$res) { - updateStatus("Can't change to database.", true); - showForm(); - return; - } - updateStatus("Running database script..."); - $res = runDbScript(INSTALLDIR.'/db/laconica.sql', $conn); - if ($res === false) { - updateStatus("Can't run database script.", true); - showForm(); - return; +
      + Database settings +
        +
      • + + +

        Database hostname

        +
      • +
      • + + $dbRadios +

        Database type

        +
      • +
      • + + +

        Database name

        +
      • +
      • + + +

        Database username

        +
      • +
      • + + +

        Database password (optional)

        +
      • +
      +
      + +
      + Administrator settings +
        +
      • + + +

        Nickname for the initial StatusNet user (administrator)

        +
      • +
      • + + +

        Password for the initial StatusNet user (administrator)

        +
      • +
      • + + +
      • +
      • + + +

        Optional email address for the initial StatusNet user (administrator)

        +
      • +
      • + + +

        Release and security feed from update@status.net (recommended)

        +
      • +
      +
      + +
      + + +E_O_T; } - foreach (array('sms_carrier' => 'SMS carrier', - 'notice_source' => 'notice source', - 'foreign_services' => 'foreign service') - as $scr => $name) { - updateStatus(sprintf("Adding %s data to database...", $name)); - $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn); - if ($res === false) { - updateStatus(sprintf("Can't run %d script.", $name), true); - showForm(); - return; + + /** + * Handle a POST submission... if we have valid input, start the install! + * Otherwise shows the form along with any error messages. + */ + function handlePost() + { + echo << +
      Page notice
      +
      +
        +STR; + $this->validated = $this->prepare(); + if ($this->validated) { + $this->doInstall(); + } + echo << +
      + +STR; + if (!$this->validated) { + $this->showForm(); } } - updateStatus("Writing config file..."); - $sqlUrl = "mysqli://$username:$password@$host/$database"; - $res = writeConf($sitename, $sqlUrl); - if (!$res) { - updateStatus("Can't write config file.", true); - showForm(); - return; - } - updateStatus("Done!"); -?> -
    -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'); -function runDbScript($filename, $conn) -{ - $sql = trim(file_get_contents($filename)); - $stmts = explode(';', $sql); - foreach ($stmts as $stmt) { - $stmt = trim($stmt); - if (!mb_strlen($stmt)) { - continue; + $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'); + + $this->server = $_SERVER['HTTP_HOST']; + $this->path = substr(dirname($_SERVER['PHP_SELF']), 1); + + $fail = false; + if (!$this->validateDb()) { + $fail = true; } - $res = mysql_query($stmt, $conn); - if ($res === false) { - return $res; + + if (!$this->validateAdmin()) { + $fail = true; } + + if ($this->adminPass != $adminPass2) { + $this->updateStatus("Administrator passwords do not match. Did you mistype?", true); + $fail = true; + } + + return !$fail; } - return true; + } ?> - - - Install Laconica - - - - - -
    -
    -
    -

    Install Laconica

    - -
    -
    -
    - - \ No newline at end of file + xml version="1.0" encoding="UTF-8" "; ?> + + + + Install StatusNet + + + + + + + + + +
    + +
    +
    +
    +

    Install StatusNet

    +main(); +?> +
    +
    +
    +
    + +