diff --git a/web/html/tu.php b/web/html/tu.php index 524e14d8..e2e44b77 100644 --- a/web/html/tu.php +++ b/web/html/tu.php @@ -8,44 +8,30 @@ set_lang(); check_sid(); html_header(); -# get login privileges -# +# Default votes per page +$pp = 5; + +$atype = ""; if (isset($_COOKIE["AURSID"])) { - # Only logged in users can do stuff - # $atype = account_from_sid($_COOKIE["AURSID"]); -} else { - $atype = ""; } if ($atype == "Trusted User" OR $atype == "Developer") { - # Show the TU interface - # - - # Temp value for results per page $pp = 5; - if (isset($_REQUEST['id'])) { - # Show application details - # depending on action and time frame will show either - # sponsor button, comments and vote buttons - # - - if (intval($_REQUEST['id'])) { + if (isset($_GET['id'])) { + if (is_numeric($_GET['id'])) { $q = "SELECT * FROM TU_VoteInfo "; - $q.= "WHERE ID = " . $_REQUEST['id']; + $q.= "WHERE ID = " . $_GET['id']; $dbh = db_connect(); $results = db_query($q, $dbh); $row = mysql_fetch_assoc($results); if (empty($row)) { - print "Could not retrieve proposal details.\n"; + print __("Could not retrieve proposal details."); } else { - # Print out application details, thanks again AUR - # - $isrunning = $row['End'] > time() ? 1 : 0; $qvoted = "SELECT * FROM TU_Votes WHERE "; @@ -53,30 +39,27 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $qvoted.= "UserID = " . uid_from_sid($_COOKIE["AURSID"]); $hasvoted = mysql_num_rows(db_query($qvoted, $dbh)); - # Can this person vote? - # - $canvote = 1; // we assume they can - $errorvote = ""; // error message to give + $canvote = 1; + $errorvote = ""; if ($isrunning == 0) { $canvote = 0; - $errorvote = "Voting is closed for this proposal."; + $errorvote = __("Voting is closed for this proposal."); } else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) { $canvote = 0; - $errorvote = "You cannot vote in an proposal regarding you."; + $errorvote = __("You cannot vote in an proposal about you."); } else if ($hasvoted != 0) { $canvote = 0; - $errorvote = "You've already voted in this proposal."; + $errorvote = __("You've already voted in this proposal."); } - # have to put this here so results are correct immediately after voting if ($canvote == 1) { if (isset($_POST['doVote'])) { if (isset($_POST['voteYes'])) { - $myvote = "Yes"; + $myvote = __("Yes"); } else if (isset($_POST['voteNo'])) { - $myvote = "No"; + $myvote = __("No"); } else if (isset($_POST['voteAbstain'])) { - $myvote = "Abstain"; + $myvote = __("Abstain"); } $qvote = "UPDATE TU_VoteInfo SET " . $myvote . " = " . ($row[$myvote] + 1) . " WHERE ID = " . $row['ID']; @@ -87,7 +70,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { # Can't vote anymore # $canvote = 0; - $errorvote = "You've already voted for this proposal."; + $errorvote = __("You've already voted for this proposal."); # Update if they voted $hasvoted = mysql_num_rows(db_query($qvoted, $dbh)); @@ -95,357 +78,76 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $row = mysql_fetch_assoc($results); } } - - # I think I understand why MVC is good for this stuff.. - echo "
because it still maintains word wrapping - print str_replace("\n", "
\n", $row['Agenda']); - - print "
\n"; - print "
\n"; - - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - - echo "\n"; - print " \n"; - print " \n"; - - print "
\n"; - print "\n"; - print " \n"; - - $c = "data1"; - - print ""; - print "Yes"; - print " \n"; - print ""; - print "No"; - print " \n"; - print ""; - print "Abstain"; - print " \n"; - print ""; - print "Total"; - print " \n"; - print ""; - print "Voted?"; - print " \n"; - print "\n"; - print " \n"; - - print ""; - print $row['Yes']; - print " \n"; - print ""; - print $row['No']; - print " \n"; - print ""; - print $row['Abstain']; - print " \n"; - print ""; - print ($row['Yes'] + $row['No'] + $row['Abstain']); - print " \n"; - print ""; - - if ($hasvoted == 0) { - print "No"; - } else { - print "Yes"; - } - - print " \n"; - print "
\n"; - print " $application\n"; - print " | \n"; - print "||||||||||||||||
\n";
- print "
|
\n"; - if ($off != 0) { - $back = (($off - $limit) <= 0) ? 0 : $off - $limit; - print "Back"; - } - print " | \n"; - - print "\n"; - if (($off + $limit) < mysql_num_rows($nextresult)) { - $forw = $off + $limit; - print "Next"; - } - print " | \n"; - print "
+ + + + | ++ + + + | +
+
|
+ + | +||||||||||||||
+
|
+