diff createdb.php @ 27:b27204653615

Work on adding support for entry submission.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 08 Dec 2012 06:49:53 +0200
parents 7be3f8cf1f7a
children bf567e6402bf
line wrap: on
line diff
--- a/createdb.php	Sat Dec 08 04:57:32 2012 +0200
+++ b/createdb.php	Sat Dec 08 06:49:53 2012 +0200
@@ -13,11 +13,13 @@
 
   "voteTimeout"      => array(VT_INT, 120, "Vote page timeout (minutes)"),
   "admTimeout"       => array(VT_INT, 15, "Administration interface timeout (minutes)"),
+
   "showAdmin"        => array(VT_BOOL, false, "Show administration interface link on the menu"),
-
   "showAttendees"    => array(VT_BOOL, false, "Show attendees list"),
   "allowRegister"    => array(VT_BOOL, false, "Enable event registration"),
-  "allowVoting"      => array(VT_BOOL, false, "Enable voting"),
+  "allowSubmit"      => array(VT_BOOL, false, "Enable compo entry submission"),
+  "allowVoting"      => array(VT_BOOL, false, "Enable voting (individual compos must be enabled as well)"),
+
   "showResults"      => array(VT_BOOL, false, "Enable results page"),
   "showResAuthors"   => array(VT_BOOL, false, "Show entry authors on results page"),
   "showVoteAuthors"  => array(VT_BOOL, false, "Show entry authors on voting page"),
@@ -210,11 +212,25 @@
 
 echo "Using database spec '".$spec."'.\n";
 
-switch (stCArg(1))
+switch (stCArgLC(1))
 {
   case "new":
     if (stCreateTables())
       stAddSettings();
+    
+    if (substr($spec, 0, 7) == "sqlite:")
+    {
+      $filename = substr($spec, 7);
+      echo "NOTICE! It seems you have SQLite database in use, changing permission ".
+      "of the target file '".$filename."' to 0600, for security. You may have to ".
+      "loosen up that for the things to actually work, but be careful. Having your ".
+      "database world-readable in the web is NOT good.\n";
+
+      if (chmod($filename, 0600) === FALSE)
+      {
+        echo "ERROR! Could not set permissions!\n";
+      }
+    }
     break;
 
   case "reset":
@@ -224,6 +240,10 @@
     if (stCreateOneTable("settings", $sqlTables["settings"]))
       stAddSettings();
     break;
+
+  default:
+    echo "ERROR! Invalid operation mode '".stCArg(1)."'.\n";
+    break;
 }
 
 ?>
\ No newline at end of file