changeset 1092:95b74632cfe2

Rename votekeys table to userkeys, and all related variables and settings.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 26 Jan 2017 13:38:19 +0200
parents c4b93729269d
children 7bfa5a38b6ca
files admajax.js.php admajax.php dbdefs.inc.php mconfig.inc.php.example msite.inc.php pages/vote.inc.php usrajax.php usrlogin.php
diffstat 8 files changed, 117 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.js.php	Thu Jan 26 01:59:33 2017 +0200
+++ b/admajax.js.php	Thu Jan 26 13:38:19 2017 +0200
@@ -619,22 +619,22 @@
 
 
 //
-// Votekey management
+// Userkey management
 //
-function voteKeyInfoRefresh()
+function userKeyInfoRefresh()
 {
-  jsRefreshItems("vkeyInfo", "votekey", "info");
+  jsRefreshItems("vkeyInfo", "userkey", "info");
 }
 
 
-function voteKeyRefresh(id)
+function userKeyRefresh(id)
 {
   var msuccess2 = function(txt)
   {
     var nitem = document.getElementById("vkey"+id);
     if (nitem)
       nitem.className = txt;
-    voteKeyInfoRefresh();
+    userKeyInfoRefresh();
   }
 
   var msuccess1 = function(txt)
@@ -642,38 +642,38 @@
     var nitem = document.getElementById("vkey"+id);
     if (nitem)
       nitem.innerHTML = txt;
-    voteKeyInfoRefresh();
+    userKeyInfoRefresh();
   }
 
-  jsSendPOSTRequest("action=get&type=votekey&id="+id, msuccess1);
-  jsSendPOSTRequest("action=get&type=votekeyclass&id="+id, msuccess2);
+  jsSendPOSTRequest("action=get&type=userkey&id="+id, msuccess1);
+  jsSendPOSTRequest("action=get&type=userkeyclass&id="+id, msuccess2);
 }
 
 
-function voteKeyUpdate(id, type, args)
+function userKeyUpdate(id, type, args)
 {
   var msuccess = function(txt)
   {
-    voteKeyRefresh(id);
-    voteKeyInfoRefresh();
+    userKeyRefresh(id);
+    userKeyInfoRefresh();
   }
 
-  jsSendPOSTRequest("action=votekey&type="+type+"&id="+id+"&"+args, msuccess);
+  jsSendPOSTRequest("action=userkey&type="+type+"&id="+id+"&"+args, msuccess);
 }
 
 
-function voteKeySetActive(id)
+function userKeySetActive(id)
 {
   var args = jsMakePostArgs({"active":3}, "vk", id);
 
   var mcb_ok = function (data)
   {
-    voteKeyUpdate(id, "active", args);
+    userKeyUpdate(id, "active", args);
   }
 
   var mcb_cancel = function (data)
   {
-    voteKeyRefresh(id);
+    userKeyRefresh(id);
   }
   
   if (lastPostArgs["active"] == 0)
@@ -683,13 +683,13 @@
 }
 
 
-function voteKeyAssign(id, mode)
+function userKeyAssign(id, mode)
 {
   var args = jsMakePostArgs({"key_id":2}, "vk", id);
 
   var mcb_ok = function (data)
   {
-    voteKeyUpdate(id, (mode ? "assign" : "clear"), args);
+    userKeyUpdate(id, (mode ? "assign" : "clear"), args);
   }
   
   if (mode == 0)
--- a/admajax.php	Thu Jan 26 01:59:33 2017 +0200
+++ b/admajax.php	Thu Jan 26 13:38:19 2017 +0200
@@ -380,11 +380,11 @@
 }
 
 
-function stGetVoteKeyClass($item)
+function stGetUserKeyClass($item)
 {
-  global $setVoteKeyMode;
+  global $setUserKeyMode;
   
-  switch ($setVoteKeyMode)
+  switch ($setUserKeyMode)
   {
     case VOTE_FREELY:
       $cond = 0;
@@ -400,43 +400,43 @@
   }
 
   return
-    "votekey ".($cond ? "vkeyActive" : "vkeyInactive").
+    "userkey ".($cond ? "vkeyActive" : "vkeyInactive").
     " ".($item["nvotes"] > 0 ? "vkeyUsed" : "vkeyUnused");
 }
 
 
-function stGetVoteKeyInfo()
+function stGetUserKeyInfo()
 {
-  $nkeys = stFetchSQLColumn("SELECT COUNT(*) FROM votekeys WHERE active=1");
-  $totalKeys = stFetchSQLColumn("SELECT COUNT(*) FROM votekeys");
+  $nkeys = stFetchSQLColumn("SELECT COUNT(*) FROM userkeys WHERE active=1");
+  $totalKeys = stFetchSQLColumn("SELECT COUNT(*) FROM userkeys");
   
   $nvoters = stFetchSQLColumn("SELECT COUNT(DISTINCT(key_id)) FROM votes");
 
   return
-    "Info: <b>".$nkeys."</b> of <b>".$totalKeys."</b> votekeys are activated. ".
+    "Info: <b>".$nkeys."</b> of <b>".$totalKeys."</b> userkeys are activated. ".
     "Also, <b>".$nvoters."</b> keys have been used for voting.";
 }
 
 
-function stGetVoteKeyItemData($id, $item, $prefix)
+function stGetUserKeyItemData($id, $item, $prefix)
 {
-  global $setVoteKeyMode, $setVoteKeyLen;
+  global $setUserKeyMode, $setUserKeyLen;
 
-  switch ($setVoteKeyMode)
+  switch ($setUserKeyMode)
   {
     case VOTE_FREELY:
     case VOTE_ACTIVATE:
-      $klen = $setVoteKeyLen - strlen($item["key"]);
+      $klen = $setUserKeyLen - strlen($item["key"]);
       $str = sprintf(
         "<span class=\"keyid\">%03d</span>&nbsp;:&nbsp;".
         "<span class=\"keycode\">%s</span>",
         $id,
         (($klen > 0) ? str_repeat("&nbsp;", $klen) : "").$item["key"]);
 
-      if ($setVoteKeyMode == VOTE_ACTIVATE)
+      if ($setUserKeyMode == VOTE_ACTIVATE)
       {
         $str .= stGetFormCheckBoxInput("active", $id, $prefix, $item["active"], FALSE,
-          "class=\"keyactive\" onChange=\"voteKeySetActive(".$id.")\"", "");
+          "class=\"keyactive\" onChange=\"userKeySetActive(".$id.")\"", "");
       }
       
       return $str;
@@ -447,10 +447,10 @@
         "  <td class=\"groups\">".chentities($item["groups"])."</td>\n".
         "  <td class=\"vkeynum\">".
           stGetFormTextInput(5, 5, "key_id", $id, $prefix, $item["key_id"]).
-          stGetFormButtonInput("assign", $id, $prefix, "Set", "voteKeyAssign(".$id.",1)");
+          stGetFormButtonInput("assign", $id, $prefix, "Set", "userKeyAssign(".$id.",1)");
 
         if ($item["key_id"] != 0)
-          $str .= stGetFormButtonInput("clear", $id, $prefix, "Clear", "voteKeyAssign(".$id.",0)");
+          $str .= stGetFormButtonInput("clear", $id, $prefix, "Clear", "userKeyAssign(".$id.",0)");
         
       $str .=
         "</td>\n".
@@ -806,8 +806,8 @@
 stSessionExpire(SESS_ADMIN, FALSE);
 
 
-$setVoteKeyMode = stGetSetting("voteKeyMode");
-$setVoteKeyLen = stGetSetting("userKeyLength");
+$setUserKeyMode = stGetSetting("userKeyMode");
+$setUserKeyLen = stGetSetting("userKeyLength");
 $type = stGetRequestItem("type", "");
 switch (stGetRequestItem("action", ""))
 {
@@ -1406,37 +1406,37 @@
           stError("No such attendee ID!");
         break;
 
-      case "votekeyinfo":
-        echo stGetVoteKeyInfo();
+      case "userkeyinfo":
+        echo stGetUserKeyInfo();
         break;
 
-      case "votekey":
-      case "votekeyclass":
-        switch ($setVoteKeyMode)
+      case "userkey":
+      case "userkeyclass":
+        switch ($setUserKeyMode)
         {
           case VOTE_FREELY:
           case VOTE_ACTIVATE:
-            $sql = stPrepareSQL("SELECT (SELECT COUNT(id) FROM votes WHERE key_id=%D) AS nvotes,votekeys.* FROM votekeys WHERE id=%D", "id", "id");
+            $sql = stPrepareSQL("SELECT (SELECT COUNT(id) FROM votes WHERE key_id=%D) AS nvotes,userkeys.* FROM userkeys WHERE id=%D", "id", "id");
             break;
 
           case VOTE_ASSIGN:
-            $sql = stPrepareSQL("SELECT (SELECT COUNT(id) FROM votes WHERE key_id=%D) AS nvotes,votekeys.key,attendees.* FROM attendees ".
-              "LEFT JOIN votekeys ON votekeys.id=attendees.key_id ".
+            $sql = stPrepareSQL("SELECT (SELECT COUNT(id) FROM votes WHERE key_id=%D) AS nvotes,userkeys.key,attendees.* FROM attendees ".
+              "LEFT JOIN userkeys ON userkeys.id=attendees.key_id ".
               "WHERE attendees.id=%D", "id", "id");
             break;
         }
         if (($res = stFetchSQL($sql)) !== FALSE)
         {
-          if ($type == "votekeyclass")
-            echo stGetVoteKeyClass($res);
+          if ($type == "userkeyclass")
+            echo stGetUserKeyClass($res);
           else
-            echo stGetVoteKeyItemData($res["id"], $res, "vk");
+            echo stGetUserKeyItemData($res["id"], $res, "vk");
         }
         break;
 
       case "voters":
-        // Generate vote keys, if needed
-        $numVKeys = stFetchSQLColumn("SELECT COUNT(*) FROM votekeys");
+        // Generate user keys, if needed
+        $numVKeys = stFetchSQLColumn("SELECT COUNT(*) FROM userkeys");
         $numUsers = stFetchSQLColumn("SELECT COUNT(*) FROM attendees");
         if (($tmp = stGetSetting("maxAttendeesHard")) > $numUsers)
           $numUsers = $tmp;
@@ -1448,7 +1448,7 @@
         {
           if (($key = stGenerateUserKey()) !== false)
           {
-            if (stExecSQL(stPrepareSQL("INSERT INTO votekeys (key) VALUES (%s)", $key)) !== false)
+            if (stExecSQL(stPrepareSQL("INSERT INTO userkeys (key) VALUES (%s)", $key)) !== false)
               $numVKeys++;
           }
         }
@@ -1456,48 +1456,50 @@
         // Some information
         echo
           "<div class=\"tabHeadersSub\">\n".
-          " <a href=\"print.php?type=votekeys\" target=\"_blank\">Show printable key list</a>\n".
+          " <a href=\"print.php?type=userkeys\" target=\"_blank\">Show printable key list</a>\n".
           " <a href=\"print.php?type=results&flags=".(RFLAG_NORMAL)."\" target=\"_blank\">Printable results</a>\n".
           " <a href=\"print.php?type=results&flags=".(RFLAG_DISQUALIFIED)."\" target=\"_blank\">Printable full results</a> (shows also disqualified entries)\n".
           " <a href=\"print.php?type=results&flags=".(RFLAG_DISQUALIFIED | RFLAG_HIDDEN_COMPOS)."\" target=\"_blank\">Printable FULL results</a> (shows also hidden and empty compos)\n".
-          " <div id=\"vkeyInfo\">".stGetVoteKeyInfo()."</div>\n".
+          " <div id=\"vkeyInfo\">".stGetUserKeyInfo()."</div>\n".
           "</div>\n";
 
         echo
-          "<div class=\"info\"><b>Voting mode: ";
+          "<div class=\"info\">".
+          "User key length ".stGetSetting("userKeyLength")." ".
+          "<b>Voting mode: ";
         
-        if (isset($voteModeData[$setVoteKeyMode]))
-          echo $voteModeData[$setVoteKeyMode][0]."</b>. ".$voteModeData[$setVoteKeyMode][1];
+        if (isset($voteModeData[$setUserKeyMode]))
+          echo $voteModeData[$setUserKeyMode][0]."</b>. ".$voteModeData[$setUserKeyMode][1];
         else
           echo "VOTE MODE NOT SET! CHECK CONFIGURATION!</b>";
 
         echo "</div>\n";
 
-        // List of votekeys
-        switch ($setVoteKeyMode)
+        // List of userkeys
+        switch ($setUserKeyMode)
         {
           case VOTE_FREELY:
           case VOTE_ACTIVATE:
-            $sql = "SELECT votekeys.*,COUNT(votes.id) AS nvotes FROM votekeys ".
-              "LEFT JOIN votes ON votes.key_id=votekeys.id ".
-              "GROUP BY votekeys.id ".
-              "ORDER BY votekeys.id ASC";
+            $sql = "SELECT userkeys.*,COUNT(votes.id) AS nvotes FROM userkeys ".
+              "LEFT JOIN votes ON votes.key_id=userkeys.id ".
+              "GROUP BY userkeys.id ".
+              "ORDER BY userkeys.id ASC";
 
             foreach (stExecSQL($sql) as $item)
             {
               echo
-                "<div class=\"".stGetVoteKeyClass($item).
+                "<div class=\"".stGetUserKeyClass($item).
                 "\" id=\"vkey".$item["id"]."\">".
-                stGetVoteKeyItemData($item["id"], $item, "vk").
+                stGetUserKeyItemData($item["id"], $item, "vk").
                 "</div>\n";
             }
             break;
 
           case VOTE_ASSIGN:
-            $sql = "SELECT votekeys.*,attendees.*,COUNT(votes.id) AS nvotes FROM attendees ".
-              "LEFT JOIN votekeys ON votekeys.id=attendees.key_id ".
+            $sql = "SELECT userkeys.*,attendees.*,COUNT(votes.id) AS nvotes FROM attendees ".
+              "LEFT JOIN userkeys ON userkeys.id=attendees.key_id ".
               "LEFT JOIN votes ON votes.key_id=attendees.key_id ".
-              "GROUP BY votekeys.id ".
+              "GROUP BY userkeys.id ".
               "ORDER BY attendees.regtime DESC";
 
             echo
@@ -1506,16 +1508,16 @@
               "  <th class=\"name\">Name</th>\n".
               "  <th class=\"groups\">Groups</th>\n".
               "  <th class=\"vkeynum\">Key #</th>\n".
-              "  <th class=\"vkey\">Votekey</th>\n".
+              "  <th class=\"vkey\">Userkey</th>\n".
               " </tr>\n";
 
             $index = 0;
             foreach (stExecSQL($sql) as $item)
             {
               echo
-                " <tr class=\"".stGetVoteKeyClass($item).
+                " <tr class=\"".stGetUserKeyClass($item).
                 "\" id=\"vkey".$item["id"]."\">\n".
-                stGetVoteKeyItemData($item["id"], $item, "vk").
+                stGetUserKeyItemData($item["id"], $item, "vk").
                 " </tr>\n";
             }
 
@@ -1716,11 +1718,11 @@
           $sql = stPrepareSQL("DELETE FROM attendees WHERE id=%d", $id);
           stExecSQLCond($sql, "OK, attendee ".$id." deleted.");
 
-          // If assigned votekey mode, delete the key and votes as well
-          if ($setVoteKeyMode == VOTE_ASSIGN && $attn["key_id"] != 0)
+          // If assigned userkey mode, delete the key and votes as well
+          if ($setUserKeyMode == VOTE_ASSIGN && $attn["key_id"] != 0)
           {
-            $sql = stPrepareSQL("DELETE FROM votekeys WHERE id=%d", $attn["key_id"]);
-            stExecSQLCond($sql, "OK, attendee ".$id." votekey deleted.");
+            $sql = stPrepareSQL("DELETE FROM userkeys WHERE id=%d", $attn["key_id"]);
+            stExecSQLCond($sql, "OK, attendee ".$id." userkey deleted.");
 
             $sql = stPrepareSQL("DELETE FROM votes WHERE key_id=%d", $attn["key_id"]);
             stExecSQLCond($sql, "OK, attendee ".$id." votes deleted.");
@@ -1748,10 +1750,10 @@
       }
     }
     else
-    if ($type == "votekeys")
+    if ($type == "userkeys")
     {
-      $sql = stPrepareSQL("DELETE FROM votekeys");
-      stExecSQLCond($sql, "OK, all votekeys purged");
+      $sql = stPrepareSQL("DELETE FROM userkeys");
+      stExecSQLCond($sql, "OK, all userkeys purged");
     }
 
     stDBCommitTransaction();
@@ -1940,9 +1942,9 @@
     stDBCommitTransaction();
     break;
 
-  case "votekey":
+  case "userkey":
     //
-    // Votekey activation/deactivation handling
+    // Userkey activation/deactivation handling
     //
     stDBBeginTransaction();
     if (stChkRequestItem("id", $id, array(CHK_TYPE, VT_INT, "Invalid data.")))
@@ -1952,7 +1954,7 @@
         case "assign":
           // Check if already assigned to someone ..
           $key_id = intval(stGetRequestItem("key_id", 0));
-          $sql = stPrepareSQL("SELECT * FROM votekeys WHERE id=%d", $key_id);
+          $sql = stPrepareSQL("SELECT * FROM userkeys WHERE id=%d", $key_id);
           if (stFetchSQL($sql) === false)
             stError("Invalid key ID #.");
           else
@@ -1976,8 +1978,8 @@
         
         case "active":
           // Autobots activate!
-          $sql = stPrepareSQL("UPDATE votekeys SET active=%B WHERE id=%d", "active", $id);
-          stExecSQLCond($sql, "Votekey status changed.");
+          $sql = stPrepareSQL("UPDATE userkeys SET active=%B WHERE id=%d", "active", $id);
+          stExecSQLCond($sql, "Userkey status changed.");
           break;
       }
     }
--- a/dbdefs.inc.php	Thu Jan 26 01:59:33 2017 +0200
+++ b/dbdefs.inc.php	Thu Jan 26 13:38:19 2017 +0200
@@ -1,6 +1,6 @@
 <?php
 
-$dbVersion = 30;
+$dbVersion = 31;
 
 //
 // Site settings and defaults we put in
@@ -288,7 +288,7 @@
     array("preview_id"   , "INT", "DEFAULT 0"), // uploaded preview file id from "files" table
     array("preview_type" , "INT", "DEFAULT 0"), // see EFILE_*, overrides compo's general type if != 0
     array("utime"        , "INT", "DEFAULT 0"),
-    array("owner_id"     , "INT", "DEFAULT 0"), // 0 = admin, otherwise votekey id
+    array("owner_id"     , "INT", "DEFAULT 0"), // 0 = admin, otherwise userkey id
   ),
 
   "files" => array(
@@ -299,7 +299,7 @@
     array("uploadtype"   , "VARCHAR(32)", "DEFAULT NULL"), // "preview", "entry"
     array("filesize"     , "INT", "DEFAULT 0"), // uploaded size
     array("entry_id"     , "INT", "DEFAULT 0"), // belongs to this entry (0 = none)
-    array("uploader_id"  , "INT", "DEFAULT 0"), // 0 = admin, otherwise votekey id
+    array("uploader_id"  , "INT", "DEFAULT 0"), // 0 = admin, otherwise userkey id
     array("deleted"      , "INT", "DEFAULT 0"), // 1 = to be deleted
     array("utime"        , "INT", "DEFAULT 0"),
   ),
@@ -317,9 +317,9 @@
     array("adm_flags"    , "INT", "DEFAULT 0"),
   ),
 
-  "votekeys" => array(
+  "userkeys" => array(
     array("id"           , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"),
-    array("key"          , "VARCHAR(".SET_LEN_VOTEKEY.")"),
+    array("key"          , "VARCHAR(".SET_LEN_USERKEY.")"),
     array("active"       , "INT", "DEFAULT 0"),
   ),
 
@@ -404,7 +404,7 @@
     array("Good news, everybody!", "...", "The Professor"),
   ),
 
-  "votekeys" => array(
+  "userkeys" => array(
     "key",
     "%s",
     array("test1"),
@@ -482,6 +482,10 @@
     "ctype" => array("key" => "type"),
     "cpath" => array("key" => "path"),
   ),
+
+  31 => array(
+    "userkeys" => array("table" => "votekeys"),
+  ),
 );
 
 
--- a/mconfig.inc.php.example	Thu Jan 26 01:59:33 2017 +0200
+++ b/mconfig.inc.php.example	Thu Jan 26 13:38:19 2017 +0200
@@ -27,6 +27,7 @@
   "defaultPage"     => "about", // Default page
 
   // User key/votekey settings
+  "userKeyMode"     => -1, // See msite.inc.php for VOTE_*
   "userKeyLength"   => 6,       // Vote key length in characters
   //"userKeyCase"     => true,   // If false, keys are case-INsensitive
   //"userKeyChars"    => "abdefghjkmnpqrstwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789", // Characters to be used for key generation
@@ -35,7 +36,6 @@
   "voteMin"         => -1,
   "voteMax"         => 2,
   
-  "voteKeyMode"     => -1, // See msite.inc.php for VOTE_*
 
   "userTimeout"     => 120, // In minutes
   "admTimeout"      => 15,
--- a/msite.inc.php	Thu Jan 26 01:59:33 2017 +0200
+++ b/msite.inc.php	Thu Jan 26 13:38:19 2017 +0200
@@ -40,7 +40,7 @@
 define("SET_LEN_DISP_SLIDE_TEXT", 4096);
 define("SET_LEN_ROT_LIST_NAME", 128);
 
-define("SET_LEN_VOTEKEY", 64);
+define("SET_LEN_USERKEY", 64);
 
 
 //
@@ -119,16 +119,16 @@
 
 $voteModeData = array(
   VOTE_FREELY => array("Freeform voting",
-    "Vote keys are not tied to attendees, and do not need to be activated. ".
+    "User keys are not tied to attendees, and do not need to be activated. ".
     "Take one printed key slip, give it to attendee."
     ),
   VOTE_ACTIVATE => array("Key activation",
-    "Vote keys are not tied to attendees, but require manual activation. ".
+    "User keys are not tied to attendees, but require manual activation. ".
     "Take one printed key slip, find it by the index number in the list below, set to activated. ".
     "Give key slip to attendee."
     ),
   VOTE_ASSIGN => array("Assigned keys",
-    "Votekeys are tied to attendees, activated by assigning the key to attendee. ".
+    "User keys are tied to attendees, activated by assigning the key to attendee. ".
     "Take one printed key slip, find attendee in the list below, enter key ID number, assign, check. ".
     "Give key slip to attendee."
     ),
@@ -577,7 +577,7 @@
     // Check if it already exists, to avoid duplicates
     // We need custom query code here, because stFetchSQLColumn()
     // won't work due to it returning FALSE in error cases.
-    $sql = stPrepareSQL("SELECT * FROM votekeys WHERE key=%s", $key);
+    $sql = stPrepareSQL("SELECT * FROM userkeys WHERE key=%s", $key);
     if (($res = @$db->query($sql)) !== FALSE)
     {
       // Did we get results?
@@ -718,8 +718,8 @@
           $sql =
             "SELECT entries.*, ".
               "(SELECT SUM(votes.value) FROM votes ".
-              "LEFT JOIN votekeys ON votes.key_id=votekeys.id ".
-              "WHERE votes.entry_id=entries.id AND votekeys.active<>0) ".
+              "LEFT JOIN userkeys ON votes.key_id=userkeys.id ".
+              "WHERE votes.entry_id=entries.id AND userkeys.active<>0) ".
               "AS votesum ".
             "FROM entries";
           break;
@@ -728,8 +728,8 @@
           $sql =
             "SELECT entries.*, ".
               "(SELECT SUM(votes.value) FROM votes ".
-              "LEFT JOIN votekeys ON votes.key_id=votekeys.id ".
-              "LEFT JOIN attendees ON votekeys.id=attendees.key_id ".
+              "LEFT JOIN userkeys ON votes.key_id=userkeys.id ".
+              "LEFT JOIN attendees ON userkeys.id=attendees.key_id ".
               "WHERE votes.entry_id=entries.id AND attendees.key_id<>0) ".
               "AS votesum ".
             "FROM entries";
@@ -767,7 +767,7 @@
 
 function stGetCompoResults($flags)
 {
-  $voteKeyMode = stGetSetting("voteKeyMode");
+  $userKeyMode = stGetSetting("userKeyMode");
   $out = array();
   $sql = "SELECT * FROM compos ".(($flags & RFLAG_HIDDEN_COMPOS) ? "" : "WHERE visible<>0 ")."ORDER BY name DESC";
   if (($res = stExecSQL($sql)) === false)
@@ -786,7 +786,7 @@
         ($nentries > 0 || ($flags & RFLAG_HIDDEN_COMPOS)))
     {
       // Get voting results by mode
-      $sql = stGetCompoResultsSQL($voteKeyMode, $compo, $flags);
+      $sql = stGetCompoResultsSQL($userKeyMode, $compo, $flags);
 
       $out[$compo["id"]] = $compo;
       $out[$compo["id"]]["results"] = array();
--- a/pages/vote.inc.php	Thu Jan 26 01:59:33 2017 +0200
+++ b/pages/vote.inc.php	Thu Jan 26 13:38:19 2017 +0200
@@ -46,7 +46,7 @@
     switch ($error)
     {
       case 1:
-        echo "The votekey does not exist. Please try again.";
+        echo "The userkey does not exist. Please try again.";
         break;
 
       case 2:
@@ -55,7 +55,7 @@
 
       case 3:
         echo
-          "The votekey is not yet activated, try again later. If ".
+          "The userkey is not yet activated, try again later. If ".
           "you are certain that it should be working now, go pester an organizer.";
         break;
       
--- a/usrajax.php	Thu Jan 26 01:59:33 2017 +0200
+++ b/usrajax.php	Thu Jan 26 13:38:19 2017 +0200
@@ -79,30 +79,30 @@
 
 stReloadSettings();
 
-$voteKeyId = stGetSessionItem("key_id");
+$userKeyId = stGetSessionItem("key_id");
 
 //
 // Check vote key validity
 //
-$sql = stPrepareSQL("SELECT * FROM votekeys WHERE id=%d", $voteKeyId);
+$sql = stPrepareSQL("SELECT * FROM userkeys WHERE id=%d", $userKeyId);
 if (($key = stFetchSQL($sql)) === false)
 {
-  stError("Votekey does not exist.");
+  stError("Userkey does not exist.");
 }
 else
 {
   // Validate login based on current vote key mode
-  switch (stGetSetting("voteKeyMode"))
+  switch (stGetSetting("userKeyMode"))
   {
     case VOTE_ACTIVATE:
       if ($key["active"] == 0)
-        stError("Votekey is not active.");
+        stError("Userkey is not active.");
       break;
 
     case VOTE_ASSIGN:
       $sql = stPrepareSQL("SELECT id FROM attendees WHERE key_id=%d", $key["id"]);
       if (stFetchSQL($sql) === false)
-        stError("Votekey is not assigned to any user.");
+        stError("Userkey is not assigned to any user.");
       break;
   }
 }
@@ -132,7 +132,7 @@
         // Check if the compo is valid for the entry
         $sql = stPrepareSQL("SELECT * FROM compos WHERE id=%d", $entry["compo_id"]);
         if (($compo = stFetchSQL($sql)) !== false && $compo["voting"] != 0)
-          stUpdateVote($voteKeyId, $entry_id, $vote);
+          stUpdateVote($userKeyId, $entry_id, $vote);
       }
       stDBCommitTransaction();
     }
@@ -153,7 +153,7 @@
       {
         if (stCheckVoteValue("ventry".$entry["id"], $value))
         {
-          if (!stUpdateVote($voteKeyId, $entry["id"], $value))
+          if (!stUpdateVote($userKeyId, $entry["id"], $value))
             stError("Could not set vote for compo #".$compo["id"].", entry #".$entry["id"]);
         }
       }
--- a/usrlogin.php	Thu Jan 26 01:59:33 2017 +0200
+++ b/usrlogin.php	Thu Jan 26 13:38:19 2017 +0200
@@ -31,13 +31,13 @@
 
 $error = 0;
 
-$sql = stPrepareSQL("SELECT * FROM votekeys WHERE key=%s", $password);
+$sql = stPrepareSQL("SELECT * FROM userkeys WHERE key=%s", $password);
 if (($key = stFetchSQL($sql)) !== false)
 {
   //
-  // Validate login based on current vote key mode
+  // Validate login based on current user key mode
   //
-  switch (stGetSetting("voteKeyMode"))
+  switch (stGetSetting("userKeyMode"))
   {
     case VOTE_ACTIVATE:
       if ($key["active"] == 0)