3 set_include_path(get_include_path() . PATH_SEPARATOR
. '../lib');
5 include_once("aur.inc.php");
9 $title = __("Trusted User");
13 # Default votes per page
17 if (has_credential(CRED_TU_LIST_VOTES
)) {
19 if (isset($_GET['id'])) {
20 if (is_numeric($_GET['id'])) {
21 $row = vote_details($_GET['id']);
24 print __("Could not retrieve proposal details.");
26 $isrunning = $row['End'] > time() ?
1 : 0;
28 # List voters of a proposal.
29 $whovoted = voter_list($row['ID']);
34 if ($isrunning == 0) {
36 $errorvote = __("Voting is closed for this proposal.");
37 } else if (!has_credential(CRED_TU_VOTE
)) {
39 $errorvote = __("Only Trusted Users are allowed to vote.");
40 } else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) {
42 $errorvote = __("You cannot vote in an proposal about you.");
44 if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))) {
48 $errorvote = __("You've already voted for this proposal.");
53 if (isset($_POST['doVote']) && check_token()) {
54 if (isset($_POST['voteYes'])) {
56 } else if (isset($_POST['voteNo'])) {
58 } else if (isset($_POST['voteAbstain'])) {
62 cast_proposal_vote($row['ID'], uid_from_sid($_COOKIE["AURSID"]), $myvote, $row[$myvote] +
1);
67 $errorvote = __("You've already voted for this proposal.");
69 # Update if they voted
70 if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))) {
73 $row = vote_details($_GET['id']);
76 include("tu_details.php");
79 print __("Vote ID not valid.");
84 if (isset($_GET['off']))
85 $offset = $_GET['off'];
87 if (isset($_GET['by']))
92 if (!empty($offset) && is_numeric($offset)) {
102 $order = ($by == 'asc') ?
'ASC' : 'DESC';
103 $lim = ($limit > 0) ?
" LIMIT $limit OFFSET $off" : "";
104 $by_next = ($by == 'desc') ?
'asc' : 'desc';
106 $result = current_proposal_list($order);
107 $type = __("Current Votes");
109 include("tu_list.php");
111 $result = past_proposal_list($order, $lim);
112 $type = __("Past Votes");
113 $nextresult = proposal_count();
114 include("tu_list.php");
116 $result = last_votes_list();
117 include("tu_last_votes_list.php");
121 header('Location: /');
124 html_footer(AURWEB_VERSION
);