]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - install.php
say that it's OK to do OpenID login in private mode
[quix0rs-gnu-social.git] / install.php
index bae296a350ab5925284b2a2cd1f20f64d5cefef5..c222afa7b5fc34083be68b358c6f50a87891c12d 100644 (file)
@@ -70,17 +70,16 @@ function checkPrereqs()
             $pass = false;
        }
 
-       if (!is_writable(INSTALLDIR.'/avatar/')) {
-         ?><p class="error">Cannot write avatar directory: <code><?php echo INSTALLDIR; ?>/avatar/</code></p>
-              <p>On your server, try this command: <code>chmod a+w <?php echo INSTALLDIR; ?>/avatar/</code></p>
-         <?
-            $pass = false;
-       }
-       if (!is_writable(INSTALLDIR.'/background/')) {
-         ?><p class="error">Cannot write background directory: <code><?php echo INSTALLDIR; ?>/background/</code></p>
-              <p>On your server, try this command: <code>chmod a+w <?php echo INSTALLDIR; ?>/background/</code></p>
-         <?
-            $pass = false;
+       // Check the subdirs used for file uploads
+       $fileSubdirs = array('avatar', 'background', 'file');
+       foreach ($fileSubdirs as $fileSubdir) {
+               $fileFullPath = INSTALLDIR."/$fileSubdir/";
+               if (!is_writable($fileFullPath)) {
+            ?><p class="error">Cannot write <?php echo $fileSubdir; ?> directory: <code><?php echo $fileFullPath; ?></code></p>
+                      <p>On your server, try this command: <code>chmod a+w <?php echo $fileFullPath; ?></code></p>
+            <?php
+                    $pass = false;
+               }
        }
 
        return $pass;
@@ -220,9 +219,9 @@ function handlePost()
     }
     
     switch($dbtype) {
-      case 'mysql':    mysql_db_installer($host, $database, $username, $password, $sitename);
+      case 'mysql':    mysql_db_installer($host, $database, $username, $password, $sitename, $fancy);
       break;
-      case 'pgsql':    pgsql_db_installer($host, $database, $username, $password, $sitename);
+      case 'pgsql':    pgsql_db_installer($host, $database, $username, $password, $sitename, $fancy);
       break;
       default:
     }
@@ -233,7 +232,7 @@ function handlePost()
 <?php
 }
 
-function pgsql_db_installer($host, $database, $username, $password, $sitename) {
+function pgsql_db_installer($host, $database, $username, $password, $sitename, $fancy) {
   $connstring = "dbname=$database host=$host user=$username";
 
   //No password would mean trust authentication used.
@@ -243,6 +242,20 @@ function pgsql_db_installer($host, $database, $username, $password, $sitename) {
   updateStatus("Starting installation...");
   updateStatus("Checking database...");
   $conn = pg_connect($connstring);
+  
+  if ($conn ===false) {
+    updateStatus("Failed to connect to database: $connstring");
+    showForm();
+    return false;
+  }
+
+  //ensure database encoding is UTF8
+  $record = pg_fetch_object(pg_query($conn, 'SHOW server_encoding'));
+  if ($record->server_encoding != 'UTF8') {
+    updateStatus("Laconica requires UTF8 character encoding. Your database is ". htmlentities($record->server_encoding));
+    showForm();
+    return false;
+  }
 
   updateStatus("Running database script...");
   //wrap in transaction;
@@ -285,7 +298,7 @@ function pgsql_db_installer($host, $database, $username, $password, $sitename) {
       
 }
 
-function mysql_db_installer($host, $database, $username, $password, $sitename) {
+function mysql_db_installer($host, $database, $username, $password, $sitename, $fancy) {
   updateStatus("Starting installation...");
   updateStatus("Checking database...");