changeset 16:6da681d1f62a

Moar work.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Dec 2012 17:30:12 +0200
parents ea0f98a0bed8
children b015c0dea42c
files admin.inc.php ajax.php createdb.php msite.inc.php register.inc.php
diffstat 5 files changed, 90 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/admin.inc.php	Thu Dec 06 16:52:38 2012 +0200
+++ b/admin.inc.php	Thu Dec 06 17:30:12 2012 +0200
@@ -427,9 +427,7 @@
 
 <div id="tabSettings">
   <form method="post" action="" onsubmit="return updateSettings()">
-    <input id="stsave1" type="submit" value=" Save settings " />
     <div id="nsettings"></div>
-    <input id="stsave2" type="submit" value=" Save settings " />
   </form>
 </div>
 
--- a/ajax.php	Thu Dec 06 16:52:38 2012 +0200
+++ b/ajax.php	Thu Dec 06 17:30:12 2012 +0200
@@ -19,6 +19,12 @@
 stReloadSettings();
 
 
+function saveButton()
+{
+  return "<input type=\"submit\" value=\" Save \" />\n";
+}
+
+
 function setStatus($val, $msg)
 {
   global $statusSet;
@@ -99,6 +105,7 @@
         $prefix = "st";
 
         echo
+        "<h1>Site settings</h1>\n".
         "<table>\n";
         foreach (stExecSQL("SELECT * FROM settings WHERE vtype<>".VT_TEXT) as $item)
         {
@@ -122,13 +129,13 @@
           "  <td>".$item["desc"]."</td>\n".
           " </tr>\n";
         }
-        echo "</table>\n";
+        echo "</table>\n".saveButton();
 
         foreach (stExecSQL("SELECT * FROM settings WHERE vtype=".VT_TEXT) as $item)
         {
           echo "<h2>".chentities($item["desc"])."</h2>\n".
           stGetFormTextArea(10, 60, "", $item["key"], $prefix, $item["vtext"]).
-          "\n<br />\n";
+          "\n<br />\n".saveButton();
         }
         break;
       
--- a/createdb.php	Thu Dec 06 16:52:38 2012 +0200
+++ b/createdb.php	Thu Dec 06 17:30:12 2012 +0200
@@ -11,8 +11,8 @@
 $siteDefaults = array(
   "maxAttendees"     => array(VT_INT, 30, "Maximum attendees (soft limit)"),
 
-  "voteTimeout"      => array(VT_INT, 120*60, "Vote page timeout (seconds)"),
-  "admTimeout"       => array(VT_INT, 15*60, "Administration interface timeout (seconds)"),
+  "voteTimeout"      => array(VT_INT, 120, "Vote page timeout (minutes)"),
+  "admTimeout"       => array(VT_INT, 15, "Administration interface timeout (minutes)"),
 
   "allowRegister"    => array(VT_BOOL, false, "Enable event registration"),
   "allowVoting"      => array(VT_BOOL, false, "Enable voting"),
@@ -21,7 +21,53 @@
   "showResAuthors"   => array(VT_BOOL, false, "Show entry authors on results page"),
   "showVoteAuthors"  => array(VT_BOOL, false, "Show entry authors on voting page"),
 
-  "eventDescription" => array(VT_TEXT, "", "Event general description / timetables etc."),
+  "requireEMail"     => array(VT_BOOL, false, "Require e-mail address in registrations"),
+
+  "registerInfoText" => array(VT_TEXT, "<p>
+Only your <b>handle</b> and the answer to the botcheck are strictly required.
+If you plan on joining the IRC channel
+(<a href=\"irc://#fap2022@ircnet\">#fap2022 @ IRCNet</a>) or staying up to date by other means,
+<b>e-mail</b> is not required either.
+</p>", "Registration page info text"),
+
+  "registerPostText" => array(VT_TEXT, "<p>Now go make a demo about it!</p>", "Successful post-registration note text"),
+
+  "registerPostNoEmail" => array(VT_TEXT, "
+<h2>By the way ...</h2>
+<p>As you did not specify an e-mail contact address, you'll have to get updates
+and information about the location (if you don't already know it) by 
+some other means (IRC, for example.)</p>
+", "No e-mail address registration note"),
+
+  "eventDescription" => array(VT_TEXT, "
+<h1>Event program &amp; schedule</h1>
+<ul>
+ <li><b>Aegis</b> of DSS and FAG will be performing a DJ gig.</li>
+ <li>.. and possible additional live acts. More info to come.</li>
+</ul>
+
+<h2>Friday 30.11.</h2>
+<ul>
+ <li><b>18:00</b> - <i>Doors open</i>.</li>
+ <li><b>22:00</b> - DJ set by Aegis.</li>
+</ul>
+
+<h2>Saturday 1.12.</h2>
+<ul>
+ <li><b>14:00</b> - Deadline for remote entries.</li>
+ <li><b>18:00</b> - Deadline for the entries delivered on location.</li>
+ <li><b>20:00</b> - Competitions start.</li>
+</ul>
+
+Competition schedule and voting deadline will depend on number of entries.
+
+<h2>Sunday 2.12.</h2>
+<ul>
+ <li><b>12:00</b> - Party over?</li>
+</ul>
+", "Event general description / timetables etc."),
+
+
   "compoDescription" => array(VT_TEXT, "
 <h1>General</h1>
 <p class=\"notice\">
@@ -42,9 +88,19 @@
 
 <h1>Compos</h1>
 ", "Compo general description"),
-  "siteInfoText"     => array(VT_TEXT,
-"<a href=\"news\"><img src=\"img/fapsm.png\" alt=\"Finnish Amiga Party 2012\" class=\"logo\" /></a><div id=\"date\">30.11. - 2.12.2012<br />Helsinki, Finland<br />@ old location<br />Entry 15 EUR + prod</div>",
-  "Site header text"),
+
+
+  "siteInfoText"     => array(VT_TEXT, "
+<a href=\"news\">
+<img src=\"img/fapsm.png\" alt=\"Finnish Amiga Party 2012\" class=\"logo\" /></a>
+<div id=\"date\">
+30.11. - 2.12.2012<br />
+Helsinki, Finland<br />
+@ old location<br />
+Entry 15 EUR + prod
+</div>", "Site header text"),
+
+
   "newsDescription"  => array(VT_TEXT, "
 <div style=\"text-align: center;\">
 <img src=\"img/fap.png\" alt=\"FAP\" />
--- a/msite.inc.php	Thu Dec 06 16:52:38 2012 +0200
+++ b/msite.inc.php	Thu Dec 06 17:30:12 2012 +0200
@@ -53,7 +53,7 @@
 
   // Add more time to expiration
   if (stGetSetting("debug")) error_log("Adding more time to $type session ".session_id()." :: ".stGetSetting($type));
-  $_SESSION["expires"] = time() + stGetSetting($type);
+  $_SESSION["expires"] = time() + stGetSetting($type) * 60;
   return TRUE;
 }
 
@@ -95,7 +95,7 @@
     if (stGetSetting("debug")) error_log("START admin session OK.");
     $_SESSION["type"] = "admin";
     $_SESSION["admPassword"] = stGetSetting("admPassword");
-    $_SESSION["expires"] = time() + stGetSetting("admTimeout");
+    $_SESSION["expires"] = time() + stGetSetting("admTimeout") * 60;
     return TRUE;
   }
   else
@@ -120,7 +120,7 @@
   if (@session_start() === TRUE)
   {
     $_SESSION["type"] = "vote";
-    $_SESSION["expires"] = time() + stGetSetting("voteTimeout");
+    $_SESSION["expires"] = time() + stGetSetting("voteTimeout") * 60;
     return TRUE;
   }
   else
--- a/register.inc.php	Thu Dec 06 16:52:38 2012 +0200
+++ b/register.inc.php	Thu Dec 06 17:30:12 2012 +0200
@@ -115,18 +115,13 @@
 stPrintFormTextInput("Oneliner:", "(whatever)", 64, 64, "oneliner");
 stPrintFormTextInput(hashToCheckStr($botCheckHash)." = ", "(I.Q. / robot check".
 //" [".hashToAnswer($botCheckHash)."]".
-")", 20, 20, "botcheck");
+")", 20, 20, "botcheck", "autocomplete=\"off\"");
 ?>
   <tr><td colspan="2"></td><td><input type="submit" value="Register" /></td></tr>
  </table>
 </form>
-<p>
-Only your <b>handle</b> and the answer to the botcheck are strictly required. If you plan on joining the IRC channel
-(<? stPrintSpecURL("irc") ?>) or staying up to date by other means,
-<b>e-mail</b> is not required either.
-</p>
-
 <?
+echo stGetSetting("registerInfoText");
 }
 else
 if ($mode == "check")
@@ -137,6 +132,16 @@
   if (stChkDataItem("hash"))
     stError("Invalid data.");
 
+  $email = stGetRequestItem("email");
+  if (stGetSetting("requireEMail"))
+  {
+    if (stChkDataItem("email") || strlen($email) < 4)
+      stError("E-mail address not given, or it is too short.");
+  }
+
+  if (strlen($email >= 4) && (strpos($email, "@") === FALSE || strpos($email, ".") === FALSE))
+    stError("E-mail address not in proper format.");
+
   $hash = stGetRequestItem("hash");
   $answer = stGetRequestItem("botcheck");
   if (hashToAnswer($hash) != intval($answer))
@@ -156,15 +161,11 @@
 
     if (stExecSQL($sql) !== FALSE)
     {
-      echo "<h1>Registration successful</h1>\n";
-      echo "<p>Now go make a demo about it!</p>\n";
+      echo "<h1>Registration successful</h1>\n".
+      stGetSetting("registerPostText");
+
       if (stChkDataItem("email"))
-      {
-        echo "<h2>By the way ...</h2>".
-        "<p>As you did not specify an e-mail contact address, you'll have to get updates ".
-        "and information about the location (if you don't already know it) by ".
-        "some other means (<b>".stSpecURL("irc").", for example.</b>)</p>";
-      }
+        echo stGetSetting("registerPostNoEmail");
     }
     else
     {