]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - install.php
Merge branch 'master' into 0.7.x
[quix0rs-gnu-social.git] / install.php
index 3d76dace14d36835dd5fb86a3cf013af14339d38..0240349bb15d1220f2cdd7babdef83c720febabd 100644 (file)
@@ -130,6 +130,36 @@ function handlePost()
     $password = $_POST['password'];
     $sitename = $_POST['sitename'];
 
+    if (empty($host)) {
+        updateStatus("No hostname specified.", true);
+        showForm();
+        return;
+    }
+
+    if (empty($database)) {
+        updateStatus("No database specified.", true);
+        showForm();
+        return;
+    }
+
+    if (empty($username)) {
+        updateStatus("No username specified.", true);
+        showForm();
+        return;
+    }
+
+    if (empty($password)) {
+        updateStatus("No password specified.", true);
+        showForm();
+        return;
+    }
+
+    if (empty($sitename)) {
+        updateStatus("No sitename specified.", true);
+        showForm();
+        return;
+    }
+
     updateStatus("Starting installation...");
     updateStatus("Checking database...");
     $conn = mysql_connect($host, $username, $password);
@@ -152,12 +182,17 @@ function handlePost()
         showForm();
         return;
     }
-    updateStatus("Adding SMS carrier data to database...");
-    $res = runDbScript(INSTALLDIR.'/db/sms_carrier.sql', $conn);
-    if ($res === false) {
-        updateStatus("Can't run SMS carrier script.", true);
-        showForm();
-        return;
+    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;
+        }
     }
     updateStatus("Writing config file...");
     $sqlUrl = "mysqli://$username:$password@$host/$database";