changeset 100:3939cb04bdce

Cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 19 Oct 2013 12:59:55 +0300
parents 2169c3177f47
children 1b4ae1432989
files createdb.php
diffstat 1 files changed, 28 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/createdb.php	Fri Oct 18 20:30:55 2013 +0300
+++ b/createdb.php	Sat Oct 19 12:59:55 2013 +0300
@@ -3,36 +3,6 @@
 require "mconfig.inc.php";
 require "msite.inc.php";
 
-//
-// CLI utility helper functions
-//
-function stCArg($index)
-{
-  global $argc, $argv;
-  if ($index < $argc)
-    return $argv[$index];
-  else
-    return FALSE;
-}
-
-function stCArgLC($index)
-{
-  global $argc, $argv;
-  if ($index < $argc)
-    return strtolower($argv[$index]);
-  else
-    return FALSE;
-}
-
-
-function stCSQLError($sql)
-{
-  global $db;
-  die("Error executing SQL query: ".implode("; ", $db->errorInfo())." in statement \"".$sql."\"\n");
-  exit;
-}
-
-
 // Check if we are running from commandline or not
 if (php_sapi_name() != "cli" || !empty($_SERVER["REMOTE_ADDR"]))
 {
@@ -41,7 +11,6 @@
 }
 
 
-
 // The defaults we put in
 $siteDefaults = array(
   "maxAttendees"     => array(VT_INT, 60, "Maximum attendees (soft limit)"),
@@ -217,6 +186,33 @@
 //
 // Helper functions
 //
+function stCArg($index)
+{
+  global $argc, $argv;
+  if ($index < $argc)
+    return $argv[$index];
+  else
+    return FALSE;
+}
+
+function stCArgLC($index)
+{
+  global $argc, $argv;
+  if ($index < $argc)
+    return strtolower($argv[$index]);
+  else
+    return FALSE;
+}
+
+
+function stCSQLError($sql)
+{
+  global $db;
+  die("Error executing SQL query: ".implode("; ", $db->errorInfo())." in statement \"".$sql."\"\n");
+  exit;
+}
+
+
 function stConnectDB($dbspec)
 {
   global $db;
@@ -322,7 +318,7 @@
 
 if (!isset($siteSettings["voteKeyMode"]) || $siteSettings["voteKeyMode"] < 0)
 {
-  echo "FATAL ERROR! VoteKeyMode not set in site settings! This setting "
+  echo "FATAL ERROR! VoteKeyMode not set in site settings! This setting ".
   "MUST be defined and should not be changed after database creation.\n";
   exit;
 }