Make "Learn more..." translatable
[aur.git] / web / html / addvote.php
blob0372518246bd438769358fae053f4a52cfb33b48
1 <?php
3 set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
5 include_once("aur.inc.php");
6 set_lang();
7 check_sid();
9 $title = __("Add Proposal");
11 html_header($title);
13 if (isset($_COOKIE["AURSID"])) {
14 $uid = uid_from_sid($_COOKIE["AURSID"]);
17 if (has_credential(CRED_TU_ADD_VOTE)) {
19 if (!empty($_POST['addVote']) && !check_token()) {
20 $error = __("Invalid token for user action.");
23 if (!empty($_POST['addVote']) && check_token()) {
24 $error = "";
26 if (!empty($_POST['user'])) {
27 if (!valid_user($_POST['user'])) {
28 $error.= __("Username does not exist.");
29 } else {
31 if (open_user_proposals($_POST['user'])) {
32 $error.= __("%s already has proposal running for them.", htmlentities($_POST['user']));
37 if (!empty($_POST['type'])) {
38 switch ($_POST['type']) {
39 case "add_tu":
40 /* Addition of a TU */
41 $len = 7 * 24 * 60 * 60;
42 $quorum = 0.66;
43 break;
44 case "remove_tu":
45 /* Removal of a TU */
46 $len = 7 * 24 * 60 * 60;
47 $quorum = 0.75;
48 break;
49 case "remove_inactive_tu":
50 /* Removal of a TU (undeclared inactivity) */
51 $len = 5 * 24 * 60 * 60;
52 $quorum = 0.66;
53 break;
54 case "bylaws":
55 /* Amendment of Bylaws */
56 $len = 7 * 24 * 60 * 60;
57 $quorum = 0.75;
58 break;
59 default:
60 $error.= __("Invalid type.") ;
61 break;
63 } else {
64 $error.= __("Invalid type.") ;
67 if (empty($_POST['agenda'])) {
68 $error.= __("Proposal cannot be empty.");
72 if (!empty($_POST['addVote']) && empty($error)) {
73 add_tu_proposal($_POST['agenda'], $_POST['user'], $len, $quorum, $uid);
75 print "<p class=\"pkgoutput\">" . __("New proposal submitted.") . "</p>\n";
76 } else {
79 <?php if (!empty($error)): ?>
80 <p style="color: red;" class="pkgoutput"><?= $error ?></p>
81 <?php endif; ?>
83 <div class="box">
84 <h2><?= __("Submit a proposal to vote on.") ?></h2>
86 <form action="<?= get_uri('/addvote/'); ?>" method="post">
87 <p>
88 <label for="id_user"><?= __("Applicant/TU") ?></label>
89 <input type="text" name="user" id="id_user" value="<?php if (!empty($_POST['user'])) { print htmlentities($_POST['user'], ENT_QUOTES); } ?>" />
90 <?= __("(empty if not applicable)") ?>
91 </p>
92 <p>
93 <label for="id_type"><?= __("Type") ?></label>
94 <select name="type" id="id_type">
95 <option value="add_tu"><?= __("Addition of a TU") ?></option>
96 <option value="remove_tu"><?= __("Removal of a TU") ?></option>
97 <option value="remove_inactive_tu"><?= __("Removal of a TU (undeclared inactivity)") ?></option>
98 <option value="bylaws"><?= __("Amendment of Bylaws") ?></option>
99 </select>
100 </p>
102 <label for="id_agenda"><?= __("Proposal") ?></label><br />
103 <textarea name="agenda" id="id_agenda" rows="15" cols="80"><?php if (!empty($_POST['agenda'])) { print htmlentities($_POST['agenda']); } ?></textarea><br />
104 <input type="hidden" name="addVote" value="1" />
105 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
106 <input type="submit" class="button" value="<?= __("Submit"); ?>" />
107 </p>
108 </form>
109 </div>
110 <?php
112 } else {
113 print __("You are not allowed to access this area.");
116 html_footer(AURWEB_VERSION);