diff msite.inc.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 00632d30bafe
children 0a2117349f46
line wrap: on
line diff
--- 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();