diff usrajax.php @ 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 4c76b4994414
children 0a2117349f46
line wrap: on
line diff
--- 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"]);
         }
       }