view entry.inc.php @ 29:4b5a176805e2

Moar work.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 09 Dec 2012 05:41:18 +0200
parents b27204653615
children 36392d1d6b5f
line wrap: on
line source

<?
// Check if voting is enabled
if (!stChkSetting("allowSubmit"))
{
  echo
  "<h1>Sorry, entry submission disabled!</h1>\n".
  "<p>Compo entry submission not available at this time.</p>\n";
}
else
{
  stUserSessionAuth();
  $mode = stGetSessionItem("status", 0);
  
  if ($mode < 0)
  {
    echo "<h1>Oh noes, an error!</h1>\n".
    "<ul>\n".stGetSessionItem("message", "")."</ul>\n".
    stGetFormStart("entry").
    "  ".stGetFormHiddenInput("goto", "entry")."\n".
    "  ".stGetFormSubmitInput("back", "Go back")."\n".
    "</form>\n";
    stSetSessionStatus(0);
  }
  else
  if ($mode == 0)
  {
    echo
    "<h1>Compo entry submission (login)</h1>\n".
    stGetFormStart("entry", "submit.php").
    " ".stGetFormHiddenInput("mode", "key")."\n".
    " ".stGetFormHiddenInput("goto", "entry")."\n".
    " <div class=\"votectrl\">\n".
    "  Enter your user key:\n".
    "  ".stGetFormTextInput(30, 30, "key", "", "", stGetSessionItem("key"), "autocomplete=\"off\"")."\n".
    "  ".stGetFormSubmitInput("login", "Login")."\n".
    " </div>\n".
    "</form>\n";
  }
  else
  if ($mode == 1)
  {
    echo
    "<h1>Compo entry submission (info)</h1>\n".
    stGetFormStart("entry", "submit.php")."\n".
    " ".stGetFormHiddenInput("mode", "info")."\n".
    " ".stGetFormHiddenInput("goto", "entry")."\n".
    " ".stGetFormHiddenInput("key", stGetSessionItem("key"))."\n".
    " <table>\n".
    "  <tr>\n".
    "   <th>Compo</th>\n".
    "   <th>Title</th>\n".
    "   <th>Author(s)</th>\n".
    "  </tr>\n".
    "  <tr>\n".
    "   <td>\n".
    "    <select class=\"dropdown\" name=\"compo_id\">\n";
    foreach (stExecSQL("SELECT id,name FROM compos WHERE visible<>0") as $entry)
      echo "   <option value=\"".$entry["id"]."\">".chentities($entry["name"])."</option>\n";
    echo
    "    </select>\n".
    "   </td>\n".
    "   <td>".stGetFormTextInput(35, 64, "name", "", "", stGetSessionItem("name"))."</td>\n".
    "   <td>".stGetFormTextInput(30, 64, "author", "", "", stGetSessionItem("author"))."</td>\n".
    "  </tr>\n".
    " </table>\n".
    " <div>".stGetFormSubmitInput("entry", "Continue")."</div>\n".
    "</form>\n".
    "<p>".stGetSetting("entrySubmitInfo")."</p>\n";
  }
  else
  if ($mode == 2)
  {
    $compo = stFetchSQLColumn(
      stPrepareSQL("SELECT name FROM compos WHERE visible<>0 AND id=%D",
      "compo_id"));

    echo
    "<h1>Compo entry submission (files)</h1>\n".
    stGetFormStart("entry", "submit.php")."\n".
    " ".stGetFormHiddenInput("mode", "files")."\n".
    " ".stGetFormHiddenInput("goto", "entry")."\n".
    " ".stGetFormHiddenInput("key", stGetSessionItem("key"))."\n".
    " <table>\n".
    "  <tr>\n".
    "   <td>".chentities($compo)."</td>\n".
    "   <td>".chentities(stGetSessionItem("name"))."</td>\n".
    "   <td>".chentities(stGetSessionItem("author"))."</td>\n".
    "  </tr>\n".
    "  <tr>\n".
    "   <td>Entry file:</td>\n".
    "   <td><input type=\"file\" name=\"file\" id=\"file\"></td>\n".
    "   <td>".stGetFormSubmitInput("entry", "Submit entry")."</td>\n".
    "  </tr>\n".
    " </table>\n".
    "</form>\n".
    "<p>".stGetSetting("entrySubmitInfo")."</p>\n";
  }
  else
  if ($mode == 3)
  {
    echo "<h1>Yay, you submitted some entries!</h1>\n".
    "<p>Now go FAP some more! And make wait for voting.</p>";
    stSessionEnd(TRUE);
  }
}
?>