# HG changeset patch # User Matti Hamalainen # Date 1382117140 -10800 # Node ID 8efda89e765ac1fb5120f60267d3d6f838770cac # Parent b58a36f4821e2f6a6463231faf8a11805ae55213 Removed obsolete file, this is moving to AJAX. diff -r b58a36f4821e -r 8efda89e765a vsubmit.php --- a/vsubmit.php Fri Oct 18 15:51:56 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ - $compo) - foreach ($compo["entries"] as $eid => $entry) - { - $vote = stGetRequestItem("entry".$eid); - $sql = stPrepareSQL("SELECT id FROM votes WHERE voter_id=%d AND entry_id=%d", - $voter_id, $eid); - - if (($res = stFetchSQLColumn($sql)) === false) - { - $sql = stPrepareSQL( - "INSERT INTO votes (voter_id,entry_id,value) VALUES (%d,%d,%d)", - $voter_id, $eid, $vote); - - if (stExecSQL($sql) === false) - return FALSE; - } - else - { - $sql = stPrepareSQL( - "UPDATE votes SET value=%d WHERE voter_id=%d AND entry_id=%d", - $vote, $voter_id, $eid); - - if (stExecSQL($sql) === false) - return FALSE; - } - } - return TRUE; -} - - -// -// Start of the main code -// -if (stStartSubmitSession("allowVoting", $sessionType)) -{ - // Vote submission - if (!$errorSet && $mode == "vote") - { - stSetSessionStatus(1); - stGetCompoList(FALSE); - - // Check the submitted vote values - foreach ($compos as $id => $compo) - foreach ($compo["entries"] as $eid => $entry) - { - $name = "entry".$eid; - $vote = stGetRequestItem($name); - if (!$errorSet && ($vote < stGetSetting("voteMin") || $vote > stGetSetting("voteMax"))) - { - stError("One or more vote value was out of bounds. Trying to cheat, eh?"); - $vote = 0; - } - stSetSessionItem($name, $vote); - } - - if (!$errorSet) - { - if (stSubmitVotes($user["id"])) - stSetSessionStatus(2); - } - } - - stEndSubmitSession($sessionType); -} - -?> \ No newline at end of file