diff options
Diffstat (limited to 'web/html')
-rw-r--r-- | web/html/account.php | 57 | ||||
-rw-r--r-- | web/html/addvote.php | 83 | ||||
-rw-r--r-- | web/html/css/arch.css | 424 | ||||
-rw-r--r-- | web/html/css/archweb.css | 1052 | ||||
-rw-r--r-- | web/html/css/aur.css | 4 | ||||
-rw-r--r-- | web/html/css/containers.css | 188 | ||||
-rw-r--r-- | web/html/css/fonts.css | 115 | ||||
-rw-r--r-- | web/html/index.php | 165 | ||||
-rw-r--r-- | web/html/login.php | 55 | ||||
-rw-r--r-- | web/html/logout.php | 11 | ||||
-rw-r--r-- | web/html/packages.php | 20 | ||||
-rw-r--r-- | web/html/passreset.php | 122 | ||||
-rw-r--r-- | web/html/pkgsubmit.php | 169 | ||||
-rw-r--r-- | web/html/rpc.php | 11 | ||||
-rw-r--r-- | web/html/rss.php | 8 | ||||
-rw-r--r-- | web/html/tu.php | 99 | ||||
-rw-r--r-- | web/html/voters.php | 43 |
17 files changed, 1460 insertions, 1166 deletions
diff --git a/web/html/account.php b/web/html/account.php index 5a0ef50d..b0906d91 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -12,9 +12,8 @@ html_header(__('Accounts')); # Main page processing here # -echo "<div class=\"pgbox\">\n"; -echo " <div class=\"pgboxtitle\"><span class=\"f3\">".__("Accounts")."</span></div>\n"; -echo " <div class=\"pgboxbody\">\n"; +echo "<div class=\"box\">\n"; +echo " <h2>".__("Accounts")."</h2>\n"; $action = in_request("Action"); @@ -33,7 +32,8 @@ if (isset($_COOKIE["AURSID"])) { # search_results_page($atype, in_request("O"), in_request("SB"), in_request("U"), in_request("T"), in_request("S"), - in_request("E"), in_request("R"), in_request("I")); + in_request("E"), in_request("R"), in_request("I"), + in_request("K")); } else { # a non-privileged user is trying to access the search page @@ -44,17 +44,10 @@ if (isset($_COOKIE["AURSID"])) { } elseif ($action == "DisplayAccount") { # the user has clicked 'edit', display the account details in a form # - $q = "SELECT Users.*, AccountTypes.AccountType "; - $q.= "FROM Users, AccountTypes "; - $q.= "WHERE AccountTypes.ID = Users.AccountTypeID "; - $q.= "AND Users.ID = ".intval(in_request("ID")); - $result = db_query($q, $dbh); - if (!mysql_num_rows($result)) { + $row = account_details(in_request("ID"), in_request("U")); + if (empty($row)) { print __("Could not retrieve information for the specified user."); - } else { - $row = mysql_fetch_assoc($result); - # double check to make sure logged in user can edit this account # if ($atype == "User" || ($atype == "Trusted User" && $row["AccountType"] == "Developer")) { @@ -64,27 +57,20 @@ if (isset($_COOKIE["AURSID"])) { display_account_form($atype, "UpdateAccount", $row["Username"], $row["AccountType"], $row["Suspended"], $row["Email"], "", "", $row["RealName"], $row["LangPreference"], - $row["IRCNick"], $row["ID"]); + $row["IRCNick"], $row["PGPKey"], $row["ID"]); } } } elseif ($action == "AccountInfo") { # no editing, just looking up user info # - $q = "SELECT Users.*, AccountTypes.AccountType "; - $q.= "FROM Users, AccountTypes "; - $q.= "WHERE AccountTypes.ID = Users.AccountTypeID "; - $q.= "AND Users.ID = ".intval(in_request("ID")); - $result = db_query($q, $dbh); - if (!mysql_num_rows($result)) { + $row = account_details(in_request("ID"), in_request("U")); + if (empty($row)) { print __("Could not retrieve information for the specified user."); } else { - $row = mysql_fetch_assoc($result); - display_account_info($row["Username"], - $row["AccountType"], $row["Email"], $row["RealName"], - $row["IRCNick"]); + include("account_details.php"); } - + } elseif ($action == "UpdateAccount") { # user is submitting their modifications to an existing account # @@ -93,10 +79,8 @@ if (isset($_COOKIE["AURSID"])) { in_request("U"), in_request("T"), in_request("S"), in_request("E"), in_request("P"), in_request("C"), in_request("R"), in_request("L"), in_request("I"), - in_request("ID")); + in_request("K"), in_request("ID")); } - - } else { if ($atype == "Trusted User" || $atype == "Developer") { # display the search page if they're a TU/dev @@ -108,18 +92,10 @@ if (isset($_COOKIE["AURSID"])) { # A normal user, give them the ability to edit # their own account # - $q = "SELECT Users.*, AccountTypes.AccountType "; - $q.= "FROM Users, AccountTypes, Sessions "; - $q.= "WHERE AccountTypes.ID = Users.AccountTypeID "; - $q.= "AND Users.ID = Sessions.UsersID "; - $q.= "AND Sessions.SessionID = '"; - $q.= db_escape_string($_COOKIE["AURSID"])."'"; - $result = db_query($q, $dbh); - if (!mysql_num_rows($result)) { + $row = own_account_details($_COOKIE["AURSID"]); + if (empty($row)) { print __("Could not retrieve information for the specified user."); - } else { - $row = mysql_fetch_assoc($result); # don't need to check if they have permissions, this is a # normal user editing themselves. # @@ -129,7 +105,7 @@ if (isset($_COOKIE["AURSID"])) { display_account_form($atype, "UpdateAccount", $row["Username"], $row["AccountType"], $row["Suspended"], $row["Email"], "", "", $row["RealName"], $row["LangPreference"], - $row["IRCNick"], $row["ID"]); + $row["IRCNick"], $row["PGPKey"], $row["ID"]); } } } @@ -145,7 +121,7 @@ if (isset($_COOKIE["AURSID"])) { process_account_form("","new", "NewAccount", in_request("U"), 1, 0, in_request("E"), in_request("P"), in_request("C"), in_request("R"), - in_request("L"), in_request("I")); + in_request("L"), in_request("I"), in_request("K")); } else { # display the account request form @@ -155,7 +131,6 @@ if (isset($_COOKIE["AURSID"])) { } } -echo " </div>"; echo "</div>"; html_footer(AUR_VERSION); diff --git a/web/html/addvote.php b/web/html/addvote.php index a5ec4a1f..d3bd7d4b 100644 --- a/web/html/addvote.php +++ b/web/html/addvote.php @@ -5,16 +5,19 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); include_once("aur.inc.php"); set_lang(); check_sid(); -html_header(); + +$title = __("Add Proposal"); + +html_header($title); if (isset($_COOKIE["AURSID"])) { $atype = account_from_sid($_COOKIE["AURSID"]); + $uid = uid_from_sid($_COOKIE["AURSID"]); } else { $atype = ""; } -if ($atype == "Trusted User" OR $atype == "Developer") { - $dbh = db_connect(); +if ($atype == "Trusted User" || $atype == "Developer") { if (!empty($_POST['addVote']) && !check_token()) { $error = __("Invalid token for user action."); @@ -24,29 +27,11 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $error = ""; if (!empty($_POST['user'])) { - $qcheck = "SELECT * FROM Users WHERE Username = '" . db_escape_string($_POST['user']) . "'"; - $result = db_query($qcheck, $dbh); - if ($result) { - $check = mysql_num_rows($result); - } - else { - $check = 0; - } - - if ($check == 0) { + if (!valid_user($_POST['user'])) { $error.= __("Username does not exist."); } else { - $qcheck = "SELECT * FROM TU_VoteInfo WHERE User = '" . db_escape_string($_POST['user']) . "'"; - $qcheck.= " AND End > UNIX_TIMESTAMP()"; - $result = db_query($qcheck, $dbh); - if ($result) { - $check = mysql_num_rows($result); - } - else { - $check = 0; - } - if ($check != 0) { + if (open_user_proposals($_POST['user'])) { $error.= __("%s already has proposal running for them.", htmlentities($_POST['user'])); } } @@ -70,13 +55,8 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } if (!empty($_POST['addVote']) && empty($error)) { - $q = "INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End, SubmitterID) VALUES "; - $q.= "('" . db_escape_string($_POST['agenda']) . "', "; - $q.= "'" . db_escape_string($_POST['user']) . "', "; - $q.= "UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + " . db_escape_string($len); - $q.= ", " . uid_from_sid($_COOKIE["AURSID"]) . ")"; + add_tu_proposal($_POST['agenda'], $_POST['user'], $len, $uid); - db_query($q, $dbh); print "<p class=\"pkgoutput\">" . __("New proposal submitted.") . "</p>\n"; } else { ?> @@ -85,29 +65,28 @@ if ($atype == "Trusted User" OR $atype == "Developer") { <p style="color: red;" class="pkgoutput"><?php print $error ?></p> <?php endif; ?> -<div class="pgbox"> -<div class="pgboxtitle"><?php print __("Submit a proposal to vote on.") ?></div> -<div class="pgboxbody"> -<form action='addvote.php' method='post'> -<p> -<b><?php print __('Applicant/TU') ?></b> -<input type='text' name='user' value='<?php if (!empty($_POST['user'])) { print htmlentities($_POST['user'], ENT_QUOTES); } ?>' /> -<?php print __("(empty if not applicable)") ?> -</p> -<p> -<b><?php print __('Length in days') ?></b> -<input type='text' name='length' value='<?php if (!empty($_POST['length'])) { print htmlentities($_POST['length'], ENT_QUOTES); } ?>' /> -<?php print __("(defaults to 7 if empty)") ?> -</p> -<p> -<b><?php print __('Proposal') ?></b><br /> -<textarea name='agenda' rows='25' cols='80'><?php if (!empty($_POST['agenda'])) { print htmlentities($_POST['agenda']); } ?></textarea><br /> -<input type='hidden' name='addVote' value='1' /> -<input type='hidden' name='token' value='<?php print htmlspecialchars($_COOKIE['AURSID']) ?>' /> -<input type='submit' class='button' value='<?php print __('Submit'); ?>' /> -</p> -</form> -</div> +<div class="box"> + <h2><?php print __("Submit a proposal to vote on.") ?></h2> + + <form action="addvote.php" method="post"> + <p> + <b><?php print __("Applicant/TU") ?></b> + <input type="text" name="user" value="<?php if (!empty($_POST['user'])) { print htmlentities($_POST['user'], ENT_QUOTES); } ?>" /> + <?php print __("(empty if not applicable)") ?> + </p> + <p> + <b><?php print __("Length in days") ?></b> + <input type="text" name="length" value="<?php if (!empty($_POST['length'])) { print htmlentities($_POST['length'], ENT_QUOTES); } ?>" /> + <?php print __("(defaults to 7 if empty)") ?> + </p> + <p> + <b><?php print __("Proposal") ?></b><br /> + <textarea name="agenda" rows="15" cols="80"><?php if (!empty($_POST['agenda'])) { print htmlentities($_POST['agenda']); } ?></textarea><br /> + <input type="hidden" name="addVote" value="1" /> + <input type="hidden" name="token" value="<?php print htmlspecialchars($_COOKIE['AURSID']) ?>" /> + <input type="submit" class="button" value="<?php print __("Submit"); ?>" /> + </p> + </form> </div> <?php } diff --git a/web/html/css/arch.css b/web/html/css/arch.css deleted file mode 100644 index eec02eec..00000000 --- a/web/html/css/arch.css +++ /dev/null @@ -1,424 +0,0 @@ -* { margin: 0; padding: 0; } -* ul { padding: 20px; } -body { - min-width: 600px; - background-color: white; - color: #555; - font-family: "DejaVu Sans", sans-serif; - font-size: 12px; -} -/* Divs */ -#title { - display: block; - position: relative; - height: 123px; -} -#main_nav, -#sub_nav { - list-style: none; - font-size: 13px; - line-height: 26px; - padding: 0 32px; -} -#main_nav { - background-color: #333; - text-align: right; -} -#sub_nav { - min-width: 700px; - background-color: #1793d1; - text-align: right; -} -#main_nav a.selected { - background-color: #1793d1; -} -#sub_nav a.selected { - background-color: #333; -} -#main_nav a, -#sub_nav a { - padding: 5px 9px; - line-height: 26px; - color: #fff; - font-weight: bold; - text-decoration: none; -} -#main_nav a:hover { - background-color: #1793d1; -} -#sub_nav a:hover { - background-color: #333; -} -#lang_sub { - display: block; - font-size: 10pt; - text-align: right; - margin-bottom: 40px; - margin-right: 35px; - margin-left: 35px; -} -#lang_sub ul { - list-style: none; - padding: 0px; -} -#lang_sub ul a { - text-decoration: none; -} -#lang_sub ul a:hover { - text-decoration: underline; -} -#lang_sub ul li { - display: inline; - padding-right: 1px; -} -#login_bar { - display: block; - margin-bottom: 10px; -} -#login_bar input { - margin-right: 5px; -} -#login_bar .button { - margin: 2px; -} -#updates { - font-size: small; - /*position: relative;*/ - top: 0px; - background-color: #e7f0f6; - border: 1px solid #92cbe8; - padding: 10px; -} -#logo { - z-index: 1; - position: relative; - top: 10px; - left: 25px; - width: 350px; -} -#logo h1#archtitle { - background: transparent url("../images/titlelogo.png") no-repeat top left; - margin: 0px; - padding: 0px; -} -#logo h1#archtitle a { - color: transparent; - display: block; - width: 350px; - height: 103px; -} -.clear { - clear: both; - margin: 0px; - padding: 0px; -} -.right { - float: right; - width: 320px; - padding: 0px 10px 10px 0px; -} -.left { - padding: 10px; - margin-right: 360px; -} -.left p { - padding-bottom: 10px; -} -.box { - padding: 10px; -} -.greybox { - padding: 10px; - background-color: #f6f3dd; - border: 1px solid #d9d6c2; -} -div.listing { - padding-right: 10px; -} -.error { - color: #dd0000; - font-size: small; -} -.foot { - clear: both; - text-align: center; - font-size: 0.75em; -} -#search { - float: right; - position: relative; - top: -2em; - font-size: 0.8em; -} -#search input { - background-color: #f6f3dd; - border: 1px solid #d9d6c2; -} -.smalltext { - text-align: right; - font-size: x-small; -} -/* Headers */ -h2 { - margin: 20px 0px 10px 0px; -} -h2.title { - border-bottom: 1px solid #46494d; -} -h3 { - margin-bottom: 10px; -} -h3.title { - text-align: right; - border-bottom: 1px solid #46494d; -} -h4.title { - border-bottom: 1px solid #46494d; -} -h4.news { - border-bottom: 1px dotted #0771a6; - margin-bottom: .25em; - padding-bottom: .2em; -} -div.listing h4 { - color: #fff; - background-color: #0771a6; - padding: 3px; -} -/* Paragraphs, Anchors, Images */ -p { - padding-bottom: 20px; -} -p.news { - font-size: small; -} -a { - color: #0771a6; -} -a:hover { - color: #333; -} -#about { - position: relative; - top: -9px; -} -ol { - padding-left: 45px; -} -ul.small { - list-style: none; - font-size: x-small; -} -ul.links { - list-style: none; - font-size: small; - padding: 0px 0px 20px 20px; -} -img { - border: none; -} -hr { - border: none; - border-top: 1px solid #46494d; -} -.greybox input, -button, -textarea, -select { - background-color: #e1e3e6; - border: 1px solid #8faecd; -} -.box input, button { - padding: 2px; - background-color: #c1c3f6; - font-size: x-small; - border: 1px solid #8faecd; -} -button#f_trigger { - background-color: #e1e3e6; -} -/* Table stuff */ -table.center { - margin-left: auto; - margin-right: auto; -} -table.results { - padding: 0px; - border-collapse: collapse; -} -.results th { - background-color: #e1e3e6; - border-bottom: 1px solid #46494d; - border-top: 1px solid #46494d; - padding: 0px 5px 0px 0px; -} -.results th>a { - text-decoration: none; - color: #46494d; -} -.results td { - padding-right: 5px; - vertical-align: top; - font-size: 0.8em; -} -.listing th { - font-size: small; - vertical-align: top; - padding: 2px; -} -.listing td { - font-size: small; - padding: 2px; -} -blockquote.code { - background-color: #f3f3f3; - border: 1px solid #ccc; - margin-left: auto; - margin-right: auto; - white-space: nowrap; - padding: 5px; - font-family: "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Courier, "Courier New", Monospace; - color: #333; - font-size: .95em; -} -.pkg_search_results_footer { - overflow: auto; -} -.pkg_search_results_footer .legend_and_actions { - float: left; -} -.pkg_search_results_footer .legend { - margin-bottom: 3px; -} -.pkg_search_results_footer .page_links { - float: right; - margin: 0 0; - padding: 0 0; -} - - -/* AUR Styles */ -.pgbox { - margin: 0 25px; - margin-bottom: 1%; - background-color: #fff; - border: 2px solid #ddd; - padding: 3px; -} -.frontpgboxbody { - padding: 10px; -} -.frontpgboxbody > table { - width: 100%; -} -.pgboxtitle { - border: 2px solid #ddd; - border-top: 1px solid #fff; - border-left: 1px solid #fff; - background-color: #f1f2f4; - padding: 2px 10px 2px 10px; -} -.pgboxbody, -.pgboxbody-comment { - padding: 10px; -} -.pgboxbody input { - margin-right: 10px; -} -.pgboxbody-comment > table { - border-collapse: separate; - border-spacing: 0px 15px; -} - -#advanced-search li { - font-size: 11px; - list-style: none; - display: inline; - padding-right: 15px; - text-decoration: none; -} - -.page_nav { - margin: 5px 0; -} -.page_nav .page_num { - border: 1px solid #ddd; - padding: 2px; - color: #0771a6; -} -.page_nav .page_num:hover { - border: 1px solid #8faecd; - color: #333; -} -.page_nav .page_sel { - border: 1px solid #8faecd; - padding: 2px; - color: #333; - font-weight: bold; -} - -.comment-header { - background-color: #f1f2f4; - color: #888; - font-size: 14px; - font-weight: bold; - margin-left: 5px; - margin-top: 5px; - padding: 2px; -} - -.comment-body { - margin-left: 5px; - padding: 2px; - font-family: monospace; -} - -.pkgoutput { - margin: 0 25px; - font-size: 18px; - font-weight: bold; -} - -div.version { - font-weight:bold; - font-size:14px; - text-align:right; -} - - - - -/** - * - * =============== Language-specific declarations ====================== - * - * (e.g. right-to-left texts for Hebrew) - * - * */ - - -/** - * RIGHT - TO - LEFT - * - * Too add a language, just add it's language code to all - * :lang()-pseudo-classes, delimited by a hyphen ("-"). - * */ - -body:lang(he) { - direction: rtl; -} -th:lang(he) { - text-align: right; -} -#lang_sub:lang(he) { - text-align: left; -} -.pkg_search_results_footer:lang(he) .legend_and_actions { - float: right; -} -.pkg_search_results_footer:lang(he) .page_links { - float: left; -} -div.version:lang(he) { - text-align: left; -} diff --git a/web/html/css/archweb.css b/web/html/css/archweb.css new file mode 100644 index 00000000..cafae777 --- /dev/null +++ b/web/html/css/archweb.css @@ -0,0 +1,1052 @@ +/* + * ARCH LINUX DJANGO (MAIN SITE) + * + * Font sizing based on 16px browser defaults (use em): + * 14px = 0.875em + * 13px = 0.812em + * 12px = 0.75em + * 11px = 0.6875em + * + */ + +/* import the global navbar stylesheet */ +@import url('archnavbar/archnavbar.css'); + +/* simple reset */ +* { + margin: 0; + padding: 0; + line-height: 1.4; +} + +/* general styling */ +body { + min-width: 650px; + background: #f6f9fc; + color: #222; + font: normal 100% sans-serif; + text-align: center; +} + +p { + margin: .33em 0 1em; +} + +ol, +ul { + margin-bottom: 1em; + padding-left: 2em; +} + + ul { + list-style: square; + } + +code { + font: 1.2em monospace; + background: #ffd; + padding: 0.15em 0.25em; +} + +pre { + font: 1.2em monospace; + border: 1px solid #bdb; + background: #dfd; + padding: 0.5em; + margin: 1em; +} + + pre code { + display: block; + background: none; + } + +blockquote { + margin: 1.5em 2em; +} + +input { + vertical-align: middle; +} + +select[multiple] { + padding: 1px 0; +} + + select[multiple] option { + padding: 0 0.5em 0 0.3em; + } + +input[type=submit] { + padding: 0 0.6em; +} + +.clear { + clear: both; +} + +.hide { + display: none; +} + +hr { + border: none; + border-top: 1px solid #888; +} + +img { + border: 0; +} + +/* scale fonts down to a sane default (16 * .812 = 13px) */ +#content { + font-size: 0.812em; +} + +/* link style */ +a { + text-decoration: none; +} + + a:link, + th a:visited { + color: #07b; + } + + a:visited { + color: #666; + } + + a:hover { + text-decoration: underline; + color: #666; + } + + a:active { + color: #e90; + } + +/* special anchor elements */ +a.headerlink { + visibility: hidden; + padding-left: 0.5em; +} + +h3:hover > a.headerlink { + visibility: visible; +} + +/* headings */ +h2 { + font-size: 1.5em; + margin-bottom: 0.5em; + border-bottom: 1px solid #888; +} + +h3 { + font-size: 1.25em; + margin-top: .5em; +} + +h4 { + font-size: 1.15em; + margin-top: 1em; +} + +h5 { + font-size: 1em; + margin-top: 1em; +} + +/* general layout */ +div#content { + width: 95%; + margin: 0 auto; + text-align: left; +} + +div#content-left-wrapper { + float: left; + width: 100%; /* req to keep content above sidebar in source code */ +} + +div#content-left { + margin: 0 340px 0 0; +} + +div#content-right { + float: left; + width: 300px; + margin-left: -300px; +} + +div.box { + margin-bottom: 1.5em; + padding: 0.65em; + background: #ecf2f5; + border: 1px solid #bcd; +} + +div#footer { + clear: both; + margin: 2em 0 1em; +} + + div#footer p { + margin: 0; + text-align: center; + font-size: 0.85em; + } + +/* alignment */ +div.center, +table.center, +img.center { + width: auto; + margin-left: auto; + margin-right: auto; +} + +p.center, +td.center, +th.center { + text-align: center; +} + +/* table generics */ +table { + width: 100%; + border-collapse: collapse; +} + + table .wrap { + white-space: normal; + } + +th, +td { + white-space: nowrap; + text-align: left; +} + + th { + vertical-align: middle; + font-weight: bold; + } + + td { + vertical-align: top; + } + +/* table pretty styles */ +table.pretty1 { + width: auto; + margin-top: 0.25em; + margin-bottom: 0.5em; + border-collapse: collapse; + border: 1px solid #bcd; +} + + table.pretty1 th { + padding: 0.35em; + background: #e4eeff; + border: 1px solid #bcd; + } + + table.pretty1 td { + padding: 0.35em; + border: 1px dotted #bcd; + } + +table.pretty2 { + width: auto; + margin-top: 0.25em; + margin-bottom: 0.5em; + border-collapse: collapse; + border: 1px solid #bbb; +} + + table.pretty2 th { + padding: 0.35em; + background: #eee; + border: 1px solid #bbb; + } + + /* additional styles for JS sorting */ + table.pretty2 th.header { + padding-right: 20px; + background-image: url(nosort.gif); + background-repeat: no-repeat; + background-position: center right; + cursor: pointer; + } + + table.pretty2 th.headerSortDown { + background-image: url(desc.gif); + } + + table.pretty2 th.headerSortUp { + background-image: url(asc.gif); + } + + table.pretty2 td { + padding: 0.35em; + border: 1px dotted #bbb; + } + +/* definition lists */ +dl { + clear: both; +} + + dl dt, + dl dd { + margin-bottom: 4px; + padding: 8px 0px 4px; + font-weight: bold; + border-top: 1px dotted #bbb; + } + + dl dt { + color: #333; + float:left; + padding-right:15px; + } + +/* forms and input styling */ +form p { + margin: 0.5em 0; +} + +fieldset { + border: 0; +} + +label { + width: 12em; + vertical-align: top; + display: inline-block; + font-weight: bold; +} + +input[type=text], +input[type=password], +textarea { + padding: 0.10em; +} + +form.general-form label, +form.general-form .form-help { + width: 10em; + vertical-align: top; + display: inline-block; +} + +form.general-form input[type=text], +form.general-form textarea { + width: 45%; +} + +/* archdev navbar */ +div#archdev-navbar { + margin: 1.5em 0; +} + + div#archdev-navbar ul { + list-style: none; + margin: -0.5em 0; + padding: 0; + } + + div#archdev-navbar li { + display: inline; + margin: 0; + padding: 0; + font-size: 0.9em; + } + + div#archdev-navbar li a { + padding: 0 0.5em; + color: #07b; + } + +/* error/info messages (x pkg is already flagged out-of-date, etc) */ +#sys-message { + width: 35em; + text-align: center; + margin: 1em auto; + padding: 0.5em; + background: #fff; + border: 1px solid #f00; +} + + #sys-message p { + margin: 0; + } + +ul.errorlist { + color: red; +} + +/** + * PAGE SPECIFIC STYLES + */ + +/* home: introduction */ +#intro p.readmore { + margin: -0.5em 0 0 0; + font-size: .9em; + text-align: right; +} + +/* home: news */ +#news { + margin-top: 1.5em; +} + + #news h3 { + float: left; + padding-bottom: .5em + } + + #news div { + margin-bottom: 1em; + } + + #news div p { + margin-bottom: 0.5em; + } + + #news .more { + font-weight: normal; + } + + #news .rss-icon { + float: right; + margin-top: 1em; + } + + #news h4 { + clear: both; + font-size: 1em; + margin-top: 1.5em; + border-bottom: 1px dotted #bbb; + } + + #news .timestamp { + float: right; + font-size: 0.85em; + margin: -1.8em 0.5em 0 0; + } + +/* home: arrowed headings */ +#news h3 a { + display: block; + background: #1794D1; + font-size: 15px; + padding: 2px 10px; + color: white; +} + + #news a:active { + color: white; + } + +h3 span.arrow { + display: block; + width: 0px; + height: 0px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #1794D1; + margin: 0 auto; + font-size: 0px; + line-height: 0px; +} + +/* home: pkgsearch box */ +#pkgsearch { + padding: 1em 0.75em; + background: #3ad; + color: #fff; + border: 1px solid #08b; +} + + #pkgsearch label { + width: auto; + padding: 0.1em 0; + } + + #pkgsearch input { + width: 10em; + float: right; + font-size: 1em; + color: #000; + background: #fff; + border: 1px solid #09c; + } + +/* home: recent pkg updates */ +#pkg-updates h3 { + margin: 0 0 0.3em; +} + + #pkg-updates .more { + font-weight: normal; + } + + #pkg-updates .rss-icon { + float: right; + margin: -2em 0 0 0; + } + + #pkg-updates table { + margin: 0; + } + + #pkg-updates td.pkg-name { + white-space: normal; + } + + #pkg-updates td.pkg-arch { + text-align: right; + } + + #pkg-updates span.testing { + font-style: italic; + } + + #pkg-updates span.staging { + font-style: italic; + color: #ff8040; + } + +/* home: sidebar navigation */ +div#nav-sidebar ul { + list-style: none; + margin: 0.5em 0 0.5em 1em; + padding: 0; +} + +/* home: sponsor banners */ +div#arch-sponsors img { + padding: 0.3em 0; +} + +/* home: sidebar components (navlist, sponsors, pkgsearch, etc) */ +div.widget { + margin-bottom: 1.5em; +} + +/* feeds page */ +#rss-feeds .rss { + padding-right: 20px; + background: url(rss.png) top right no-repeat; +} + +/* artwork: logo images */ +#artwork img.inverted { + background: #333; + padding: 0; +} + +#artwork div.imagelist img { + display: inline; + margin: 0.75em; +} + +/* news: article list */ +.news-nav { + float: right; + margin-top: -2.2em; +} + + .news-nav .prev, + .news-nav .next { + margin: 0 1em; + } + +/* news: article pages */ +div.news-article .article-info { + margin: 0; + color: #999; +} + +/* news: add/edit article */ +form#newsform { + width: 60em; +} + + form#newsform input[type=text], + form#newsform textarea { + width: 75%; + } + +/* donate: donor list */ +div#donor-list ul { + width: 100%; +} + /* max 4 columns, but possibly fewer if screen size doesn't allow for more */ + div#donor-list li { + float: left; + width: 25%; + min-width: 20em; + } + +/* download page */ +#arch-downloads h3 { + border-bottom: 1px dotted #bbb; +} + +table#download-torrents .cpu-arch { + text-align: center; +} + +/* pkglists/devlists */ +table.results { + font-size: 0.846em; + border-top: 1px dotted #999; + border-bottom: 1px dotted #999; +} + + table.results th { + padding: 0.5em 1em 0.25em 0.25em; + border-bottom: 1px solid #999; + white-space: nowrap; + background-color:#fff; + } + + /* additional styles for JS sorting */ + table.results th.header { + padding-right: 20px; + background-image: url(nosort.gif); + background-repeat: no-repeat; + background-position: center right; + cursor: pointer; + } + + table.results th.headerSortDown { + background-color: #e4eeff; + background-image: url(desc.gif); + } + + table.results th.headerSortUp { + background-color: #e4eeff; + background-image: url(asc.gif); + } + + table.results td { + padding: .3em 1em .3em 3px; + } + + table.results tr.odd { + background: #fff; + } + + table.results tr.even { + background: #e4eeff; + } + + table.results .flagged { + color: red; + } + +/* pkglist: layout */ +div#pkglist-about { + margin-top: 1.5em; +} + +/* pkglist: results navigation */ +.pkglist-stats { + font-size: 0.85em; +} + +#pkglist-results .pkglist-nav { + float: right; + margin-top: -2.2em; +} + +.pkglist-nav .prev { + margin-right: 1em; +} + +.pkglist-nav .next { + margin-right: 1em; +} + +/* search fields and other filter selections */ +.filter-criteria { + margin-bottom: 1em; +} + +.filter-criteria h3 { + font-size: 1em; + margin-top: 0; +} + +.filter-criteria div { + float: left; + margin-right: 1.65em; + font-size: 0.85em; +} + +.filter-criteria legend { + display: none; +} + +.filter-criteria label { + width: auto; + display: block; + font-weight: normal; +} + +/* pkgdetails: details links that float on the right */ +#pkgdetails #detailslinks { + float: right; +} + + #pkgdetails #detailslinks h4 { + margin-top: 0; + margin-bottom: 0.25em; + } + + #pkgdetails #detailslinks ul { + list-style: none; + padding: 0; + margin-bottom: 0; + font-size: 0.846em; + } + + #pkgdetails #detailslinks > div { + padding: 0.5em; + margin-bottom: 1em; + background: #eee; + border: 1px solid #bbb; + } + +#pkgdetails #actionlist .flagged { + color: red; + font-size: 0.9em; + font-style: italic; +} + +/* pkgdetails: pkg info */ +#pkgdetails #pkginfo { + width: auto; +} + + #pkgdetails #pkginfo td { + padding: 0.25em 0 0.25em 1.5em; + } + + #pkgdetails #pkginfo .userdata { + font-size: 0.85em; + padding: 0.5em; + } + +/* pkgdetails: flag package */ +form#flag-pkg-form label { + width: 10em; +} + +form#flag-pkg-form textarea, +form#flag-pkg-form input[type=text] { + width: 45%; +} + +/* pkgdetails: deps, required by and file lists */ +#pkgdetails #metadata { + clear: both; +} + +#pkgdetails #metadata h3 { + background: #555; + color: #fff; + font-size: 1em; + margin-bottom: 0.5em; + padding: 0.2em 0.35em; +} + +#pkgdetails #metadata ul { + list-style: none; + margin: 0; + padding: 0; +} + +#pkgdetails #metadata li { + padding-left: 0.5em; +} + +#pkgdetails #metadata p { + padding-left: 0.5em; +} + +#pkgdetails #metadata .message { + font-style: italic; +} + +#pkgdetails #metadata br { + clear: both; +} + +#pkgdetails #pkgdeps { + float: left; + width: 48%; + margin-right: 2%; +} + +#pkgdetails #metadata .virtual-dep, +#pkgdetails #metadata .testing-dep, +#pkgdetails #metadata .opt-dep, +#pkgdetails #metadata .dep-desc { + font-style: italic; +} +#pkgdetails #pkgreqs { + float: left; + width: 50%; +} + +#pkgdetails #pkgfiles { + clear: left; + padding-top: 1em; +} + + #pkgdetails #pkgfiles li.d { + color: #666; + } + + #pkgdetails #pkgfiles li.f { + } + +/* mirror stuff */ +table td.country { + white-space: normal; +} + +form#list-generator div ul { + list-style: none; + display: inline; + padding-left: 0; +} + + form#list-generator div ul li { + display: inline; + } + +/* dev/TU biographies */ +div#arch-bio-toc { + width: 75%; + margin: 0 auto; + text-align: center; +} + + div#arch-bio-toc a { + white-space: nowrap; + } + +table.arch-bio-entry { + width: 75%; + min-width: 640px; + margin: 0 auto; +} + + table.arch-bio-entry td.pic { + vertical-align: top; + padding-right: 15px; + padding-top: 2.25em; + } + + table.arch-bio-entry td.pic img { + padding: 4px; + border: 1px solid #ccc; + } + + table.arch-bio-entry td h3 { + border-bottom: 1px dotted #ccc; + margin-bottom: 0.5em; + } + + table.arch-bio-entry table.bio { + margin-bottom: 2em; + } + + table.arch-bio-entry table.bio th { + color: #666; + font-weight: normal; + text-align: right; + padding-right: 0.5em; + vertical-align: top; + white-space: nowrap; + } + + table.arch-bio-entry table.bio td { + width: 100%; + padding-bottom: 0.25em; + } + +/* dev: login/out */ +table#dev-login { + width: auto; +} + +/* dev dashboard: flagged packages */ +form#dash-pkg-notify { + text-align: right; + padding: 1em 0 0; + margin-top: 1em; + font-size: 0.85em; + border-top: 1px dotted #bbb; +} + + form#dash-pkg-notify label { + width: auto; + font-weight: normal; + } + + form#dash-pkg-notify input { + vertical-align: middle; + margin: 0 0.25em; + } + + form#dash-pkg-notify input[type=submit] { + margin-top: -0.25em; + } + + form#dash-pkg-notify p { + margin: 0; + } + +table.dash-stats .key { + width: 50%; +} + +/* dev dashboard: admin actions (add news items, todo list, etc) */ +ul.admin-actions { + float: right; + list-style: none; + margin-top: -2.5em; +} + + ul.admin-actions li { + display: inline; + padding-left: 1.5em; + } + +/* todo lists (public and private) */ +.todo-table .complete { + color: green; +} + +.todo-table .incomplete { + color: red; +} +.todo-info { + margin: 0; color: #999; +} + +.todo-list h4 { + margin-top: 0; + margin-bottom: 0.4em; +} + +/* dev: signoff page */ +#dev-signoffs tr:hover { + background: #ffd; +} + +ul.signoff-list { + list-style: none; + margin: 0; + padding: 0; +} + +.signoff-yes { + color: green; + font-weight: bold; +} + +.signoff-no { + color: red; +} + +.signoff-bad { + color: darkorange; +} + +.signoff-disabled { + color: gray; +} + +/* iso testing feedback form */ +#releng-feedback label { + width: auto; + display: inline; + font-weight: normal; +} + +#releng-feedback ul { + padding-left: 1em; +} + +#releng-feedback li { + list-style: none; +} + +#releng-feedback ul+.helptext { + position: relative; top: -0.9em; +} + +#releng-result .success-yes { + color: green; +} + +#releng-result .success-no { + color: red; +} + +#key-status .signed-yes { + color: green; +} + +#key-status .signed-no { + color: red; +} + +/* highlight current website in the navbar */ +#archnavbar.anb-home ul li#anb-home a, +#archnavbar.anb-packages ul li#anb-packages a, +#archnavbar.anb-download ul li#anb-download a { + color: white !important; +} + +/* visualizations page */ +.visualize-buttons { + margin: 0.5em 0.33em; +} + + .visualize-buttons button.active { + depressed: true; + } + +.visualize-chart { + position: relative; + height: 500px; + margin: 0.33em; +} + +#visualize-archrepo .treemap-cell { + border: solid 1px white; + overflow: hidden; + position: absolute; +} + + #visualize-archrepo .treemap-cell span { + padding: 3px; + font-size: 0.85em; + line-height: 1em; + } + +#visualize-keys svg { + width: 100%; + height: 100%; +} diff --git a/web/html/css/aur.css b/web/html/css/aur.css new file mode 100644 index 00000000..741446e4 --- /dev/null +++ b/web/html/css/aur.css @@ -0,0 +1,4 @@ +/* AUR-specific customizations to "archweb.css". */ +#lang_sub { + float: right; +} diff --git a/web/html/css/containers.css b/web/html/css/containers.css deleted file mode 100644 index 237950f5..00000000 --- a/web/html/css/containers.css +++ /dev/null @@ -1,188 +0,0 @@ -body,table,td,img { - border: none; - margin: 0; - padding: 0; -} -/* Main Wrapper Data Format */ -td.preHeader { - background-color: #000; - border-bottom: 1px solid #455471; - height: 16px; - text-align: right; -} -td.headerFill { - background-color: #6c83b0; - border-bottom: 1px solid #000; -} -td.headerDisplay { - background-color: #6c83b0; - padding-left: 16px; -} -td.mainLinks { - background-color: #eee; - border-bottom: 1px solid #000; - height: 22px; - padding-left: 12px; -} -td.sideBar { - background-color: #fff; - text-align: center; - vertical-align: top; - width: 150px; -} -td.sideBarGrey { - background-color: #eee; - border-bottom: 1px solid #000; - vertical-align: top; - width: 150px; -} -td.sideBarSmall { - background-color: #6c83b0; - border-bottom: 1px solid #000; - height: 16px; - text-align: right; - width: 150px; -} -td.sideBarSmallHeader { - background-color: #6c83b0; - vertical-align: top; - height: 16px; - padding-top: 1px; - padding-bottom: 2px; - text-align: right; - width: 150px; -} -td.subLinks { - background-color: #ffe4e8; - border-right: 1px solid #000; - color: #787878; - padding-left: 12px; - height: 19px; -} -td.contentDisplay { - background-color: #fff; - border: 1px solid #000; - border-top: none; - text-align: center; - vertical-align: top; - padding: 10px; -} -td.footerDisplay { - background-color: #eee; - border-bottom: 1px solid #000; - text-align: center; -} -/* Containers Used Globally */ -table.boxSoft { - width: 90%; - background-color: #ddd; -} -td.boxSoft { - background-color: #fff; - padding: 2px; -} -td.boxSoftColumn { - padding-left: 16px; - padding-right: 16px; - text-align: justify; - vertical-align: top; - text-indent: 20px; -} -td.div { - background-color: #eee; - width: 3px; -} -.boxSoftTitle { - border-bottom: 1px solid #fff; - border-top: 1px solid #fff; - background-color: #f1f2f4; - padding: 1px 0 0 3px; -} -table.boxSoftSmall { - width: 94px; - background-color: #ddd; -} -td.boxSoftSmall { - background-color: #fff; - text-align: center; - padding-top: 2px; - padding-bottom: 2px; -} -td.boxSoftSmallTitle { - border-bottom: 1px solid #ccc; - background-color: #f1f2f4; - padding-left: 10px; -} -/* ss = small space */ -td.ss { - padding-left: 6px; - vertical-align: top; -} -td.display { - border-bottom: 1px solid #000; - padding-bottom: 6px; -} -td.features { - padding: 4px; - text-align: justify; - vertical-align:top; -} -td.formLeft { - padding: 6px; - vertical-align: top; -} -td.data1 { - background-color: #eee; - vertical-align: top; - padding-left: .3em; -} -td.data2 { - background-color: #ddd; - vertical-align: top; - padding-left: .3em; -} -.outofdate { - background-color: #faa; - padding-left: .3em; -} -.legend span { - padding: 1px; - margin-left: .3em; - border: solid 1px #888; -} -td.text { - color: #000; - font-size: 12px; -} -th { - text-align: left; -} -th.header { - border-bottom: #666 1px solid; - vertical-align: bottom; -} -fieldset { - border: none; -} -input, -textarea, -select { - background-color: #6c83b0; - font-family: monospace; - font-size: 12px; - background-color: #ccc; - border: #000 1px solid; - color: #111; -} -input.button { - background-color: #fff; - color: #6c83b0; - border: 1px solid #6c83b0; - font-size: 12px; - padding: 2px 8px; -} -input[type=image] { - border: 0; - background: none; -} - diff --git a/web/html/css/fonts.css b/web/html/css/fonts.css deleted file mode 100644 index 9dea9354..00000000 --- a/web/html/css/fonts.css +++ /dev/null @@ -1,115 +0,0 @@ -/* Standard Fonts */ -span /* Applicable by default in all fonts */ -{ - color: #555; - font-family: Bitstream Vera Sans, Lucida Grande, Arial, sans-serif; -} -span.f1 /* Important */ -{ - font-size: 20px; - letter-spacing: 1px; -} -span.f2 /* Title */ -{ - font-size: 14px; - color: #6c83b0; - font-weight: bold; -} -span.f3 /* Sub Title */ -{ - color: #888; - font-size: 14px; - font-weight: bold; - padding-right: 2px; -} -span.f4 /* Content Text */ -{ - color: #444; - font-size: 12px; -} -span.f5 /* Content Small */ -{ - color: #333; - font-size: 11px; -} -span.f6 /* Red Message */ -{ - color: #b06d6e; - font-size: 14px; - font-weight: bold; -} -span.f7 /* Green Message */ -{ - color: #6db06d; - font-size: 14px; - font-weight: bold; -} -span.f8 /* Internal Sources in Package Details */ -{ - color: #888; - font-size: 12px; - font-weight: bold; -} -span.fix /* Monospace fixed-font */ -{ - color: #000; - font-family: monospace, fixed, terminal; - font-size: 12px; -} -span.error /* Content Text */ -{ - color: #900; - font-size: 12px; -} -span.warning /* Content Text */ -{ - color: #c0c000; - font-size: 12px; -} -/* Font Attribute Change (#6c83b0)*/ -.blue { color: #6c83b0; } -.white { color: #fff; } -.black { color: #000; } -.green { color: #6db06d; } -/* Better contrast on out-of-date rows (FS#20514) */ -.outofdate .blue { color: #444; } -.link -{ - color: #6c83b0; - font-weight: bold; -} -/* Misc (c9d1e2) */ -span.preHeader -{ - color: #c9d1e2; - font-weight: bold; - font-size: 11px; - padding-right: 8px; - word-spacing: 8px; -} -span.sideBarSmallHeader -{ - color: #fff; - font-weight: bold; - font-size: 11px; - padding-right: 8px; -} -a { - color: #0771a6; - text-decoration: none; - font-weight: bold; -} -a:hover { - color: #333; - text-decoration: none; - font-weight: bold; -} -h1, h2, h3, h4 { - font-size: 16pt; -} - -.important { - font-weight: bold; - color: #f00; -} - diff --git a/web/html/index.php b/web/html/index.php index ffc5f008..48f5e00a 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -10,75 +10,114 @@ include_once('stats.inc.php'); html_header( __("Home") ); -include('pkg_search_form.php'); - $dbh = db_connect(); ?> -<div class="pgbox"> -<div class="pgboxtitle"> -<span class="f3">AUR <?php print __("Home"); ?></span> +<div id="content-left-wrapper"> + <div id="content-left"> + <div id="intro" class="box"> + <h2>AUR <?php print __("Home"); ?></h2> + <p> + <?php + echo __( + 'Welcome to the AUR! Please read the %sAUR User Guidelines%s and %sAUR TU Guidelines%s for more information.', + '<a href="http://wiki.archlinux.org/index.php/AUR_User_Guidelines">', + '</a>', + '<a href="http://wiki.archlinux.org/index.php/AUR_Trusted_User_Guidelines">', + '</a>' + ); + ?> + </p> + <p> + <?php + echo __( + 'Contributed PKGBUILDs %smust%s conform to the %sArch Packaging Standards%s otherwise they will be deleted!', + '<b>', '</b>', + '<a href="http://wiki.archlinux.org/index.php/Arch_Packaging_Standards">', + '</a>' + ); + ?> + </p> + <p> + <?php echo __('Remember to vote for your favourite packages!'); ?> + <?php echo __('Some packages may be provided as binaries in [community].'); ?> + </p> + <p> + <h4><?php echo __('Discussion') ?></h4> + <?php + echo __( + 'General discussion regarding the Arch User Repository (AUR) and Trusted User structure takes place on %saur-general%s. This list can be used for package orphan requests, merge requests, and deletion requests. For discussion relating to the development of the AUR, use the %saur-dev%s mailing list.', + '<a href="http://mailman.archlinux.org/mailman/listinfo/aur-general">', + '</a>', + '<a href="http://mailman.archlinux.org/mailman/listinfo/aur-dev">', + '</a>' + ); + ?> + </p> + <h4><?php echo __('Bug Reporting') ?></h4> + <?php + echo __( + 'If you find a bug in the AUR, please fill out a bug report on our %sbug tracker%s. Use the tracker to report bugs in the AUR %sonly%s. To report packaging bugs contact the package maintainer or leave a comment on the appropriate package page.', + '<a href="https://bugs.archlinux.org/index.php?project=2">', + '</a>', + '<strong>', + '</strong>' + ); + ?> + </p> + + <div class="important"> + <b><?php echo __('DISCLAIMER') ?> :</b> + <br /> + <?php echo __('Unsupported packages are user produced content. Any use of the provided files is at your own risk.'); ?> + </div> + </div> + <?php if (!empty($_COOKIE["AURSID"])): ?> + <div id="pkg-updates" class="widget box"> + <table> + <tr> + <td class="pkg-name"> + <?php + $userid = uid_from_sid($_COOKIE["AURSID"]); + user_table($userid, $dbh); + ?> + </td> + </tr> + </table> + </div> + <?php endif; ?> + </div> </div> -<div class="frontpgboxbody"> -<p> - -<?php -echo __( - 'Welcome to the AUR! Please read the %hAUR User Guidelines%h and %hAUR TU Guidelines%h for more information.', - '<a href="http://wiki.archlinux.org/index.php/AUR_User_Guidelines">', - '</a>', - '<a href="http://wiki.archlinux.org/index.php/AUR_Trusted_User_Guidelines">', - '</a>' - ); -?> - -<br /> +<div id="content-right"> + <div id="pkgsearch" class="widget"> + <form id="pkgsearch-form" method="get" action="packages.php"> + <fieldset> + <label for="pkgsearch-field">Package Search:</label> + <input type="hidden" name="O" value="0" /> + <input type="text" name="K" size="30" value="<?php if (isset($_REQUEST["K"])) { print stripslashes(trim(htmlspecialchars($_REQUEST["K"], ENT_QUOTES))); } ?>" maxlength="35" /> + </fieldset> + </form> + </div> + <div id="pkg-updates" class="widget box"> + <table> + <tr> + <td class="pkg-name"> + <?php updates_table($dbh); ?> + </td> + </tr> + </table> + </div> + <div id="pkg-updates" class="widget box"> + <table> + <tr> + <td class="pkg-name"> + <?php general_stats_table($dbh); ?> + </td> + </tr> + </table> + </div> -<?php -echo __( - 'Contributed PKGBUILDs %hmust%h conform to the %hArch Packaging Standards%h otherwise they will be deleted!', - '<b>', '</b>', - '<a href="http://wiki.archlinux.org/index.php/Arch_Packaging_Standards">', - '</a>' - ); -?> - -</p> -<p> -<?php echo __('Remember to vote for your favourite packages!'); ?> -<br /> -<?php echo __('Some packages may be provided as binaries in [community].'); ?> -</p> -<table border='0' cellpadding='0' cellspacing='3' width='90%'> -<tr> -<td class='boxSoft' valign='top'> -<?php updates_table($dbh); ?> -</td> -<td class='boxSoft' valign='top'> -<?php -if (!empty($_COOKIE["AURSID"])) { - $user = username_from_sid($_COOKIE["AURSID"]); - user_table($user, $dbh); - echo '<br />'; -} - -general_stats_table($dbh); -?> - -</td> -</tr> -</table> - -<br /> -<div class="important"><?php -echo __('DISCLAIMER') . ':<br />'; -echo __('Unsupported packages are user produced content. Any use of the provided files is at your own risk.'); -?></div> - -</div> </div> - <?php html_footer(AUR_VERSION); - diff --git a/web/html/login.php b/web/html/login.php new file mode 100644 index 00000000..7f4f3420 --- /dev/null +++ b/web/html/login.php @@ -0,0 +1,55 @@ +<?php +set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); + +include_once("aur.inc.php"); +set_lang(); +check_sid(); + +if (!$DISABLE_HTTP_LOGIN || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) { + $login = try_login(); + $login_error = $login['error']; +} + +html_header('AUR ' . __("Login")); +?> +<div id="dev-login" class="box"> + <h2>AUR <?php echo __('Login') ?></h2> + <?php if (isset($_COOKIE["AURSID"])): ?> + <p> + <?php echo __("Logged-in as: %s", '<strong>' . username_from_sid($_COOKIE["AURSID"]) . '</strong>'); ?> + <a href="logout.php">[<?php print __("Logout"); ?>]</a> + </p> + <?php elseif (!$DISABLE_HTTP_LOGIN || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])): ?> + <form method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES) ?>"> + <fieldset> + <legend><?php echo __('Enter login credentials') ?></legend> + <?php if (!empty($login_error)): ?> + <ul class="errorlist"><li><?php echo $login_error ?></li></ul> + <?php endif; ?> + <p> + <label for="id_username"><?php print __('Username') . ':'; ?></label> + <input id="id_username" type="text" name="user" size="30" maxlength="<?php print USERNAME_MAX_LEN; ?>" value="<?php if (isset($_POST['user'])) { print htmlspecialchars($_POST['user'], ENT_QUOTES); } ?>" /> + </p> + <p> + <label for="id_password"><?php print __('Password') . ':'; ?></label> + <input id="id_password" type="password" name="passwd" size="30" maxlength="<?php print PASSWD_MAX_LEN; ?>" /> + </p> + <p> + <input type="checkbox" name="remember_me" id="id_remember_me" /> + <label for="id_remember_me"><?php print __("Remember me"); ?></label> + </p> + <p> + <input type="submit" class="button" value="<?php print __("Login"); ?>" /> + <a href="passreset.php">[<?php echo __('Forgot Password') ?>]</a> + </p> + </fieldset> + </form> + <?php else: ?> + <p> + <?php printf(__("HTTP login is disabled. Please %sswitch to HTTPs%s if you want to login."), + '<a href="' . $AUR_LOCATION . htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES) . '">', '</a>'); ?> + </p> + <?php endif; ?> +</div> +<?php +html_footer(AUR_VERSION); diff --git a/web/html/logout.php b/web/html/logout.php index 45ab564e..fe8ffb01 100644 --- a/web/html/logout.php +++ b/web/html/logout.php @@ -10,16 +10,15 @@ include_once("acctfuncs.inc.php"); # access AUR common functions # sending any HTML output. # if (isset($_COOKIE["AURSID"])) { - $dbh = db_connect(); - $q = "DELETE FROM Sessions WHERE SessionID = '"; - $q.= db_escape_string($_COOKIE["AURSID"]) . "'"; - db_query($q, $dbh); + if (!$dbh) { + $dbh = db_connect(); + } + delete_session_id($_COOKIE["AURSID"], $dbh); # setting expiration to 1 means '1 second after midnight January 1, 1970' setcookie("AURSID", "", 1, "/", null, !empty($_SERVER['HTTPS']), true); unset($_COOKIE['AURSID']); + clear_expired_sessions($dbh); } -clear_expired_sessions(); - header('Location: index.php'); diff --git a/web/html/packages.php b/web/html/packages.php index 7f31d3d8..ec76e41a 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -10,6 +10,8 @@ check_sid(); # see if they're still logged in # Set the title to the current query if required if (isset($_GET['ID']) && ($pkgname = pkgname_from_id($_GET['ID']))) { $title = $pkgname; +} else if (isset($_GET['N'])) { + $title = $pkgname = $_GET['N']; } else if (!empty($_GET['K'])) { $title = __("Search Criteria") . ": " . $_GET['K']; } else { @@ -89,16 +91,24 @@ html_header($title); <?php if (isset($_GET['ID'])) { + $pkgid = intval($_GET['ID']); +} else if (isset($_GET['N'])) { + $pkgid = pkgid_from_name($_GET['N']); +} else { + unset($pkgid); +} + +if (isset($pkgid)) { include('pkg_search_form.php'); - if (!$_GET['ID'] = intval($_GET['ID'])) { - print __("Error trying to retrieve package details.")."<br />\n"; - } else { + if ($pkgid) { if (isset($_COOKIE["AURSID"])) { - package_details($_GET['ID'], $_COOKIE["AURSID"]); + package_details($pkgid, $_COOKIE["AURSID"]); } else { - package_details($_GET['ID'], null); + package_details($pkgid, null); } + } else { + print __("Error trying to retrieve package details.")."<br />\n"; } } else { if (!isset($_GET['K']) && !isset($_GET['SB'])) { diff --git a/web/html/passreset.php b/web/html/passreset.php index 97fbebb0..cb88e5ab 100644 --- a/web/html/passreset.php +++ b/web/html/passreset.php @@ -30,25 +30,10 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir } if (empty($error)) { - $dbh = db_connect(); $salt = generate_salt(); $hash = salted_hash($password, $salt); - # The query below won't affect any records unless the ResetKey - # and Email combination is correct and ResetKey is nonempty - $q = "UPDATE Users - SET Passwd = '$hash', - Salt = '$salt', - ResetKey = '' - WHERE ResetKey != '' - AND ResetKey = '".db_escape_string($resetkey)."' - AND Email = '".db_escape_string($email)."'"; - $result = db_query($q, $dbh); - if (!mysql_affected_rows($dbh)) { - $error = __('Invalid e-mail and reset key combination.'); - } else { - header('Location: passreset.php?step=complete'); - exit(); - } + + $error = password_reset($hash, $salt, $resetkey, $email); } } elseif (isset($_POST['email'])) { $email = $_POST['email']; @@ -56,22 +41,18 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir if ($uid != NULL && $uid != 'None') { # We (ab)use new_sid() to get a random 32 characters long string $resetkey = new_sid(); - $dbh = db_connect(); - $q = "UPDATE Users - SET ResetKey = '" . $resetkey . "' - WHERE ID = " . $uid; - db_query($q, $dbh); + create_resetkey($resetkey, $uid); # Send email with confirmation link $body = __('A password reset request was submitted for the account '. 'associated with your e-mail address. If you wish to reset '. 'your password follow the link below, otherwise ignore '. 'this message and nothing will happen.'). "\n\n". - 'https://aur.archlinux.org/passreset.php?'. + "{$AUR_LOCATION}/passreset.php?". "resetkey={$resetkey}"; $body = wordwrap($body, 70); - $headers = "To: {$email}\nReply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR"; - @mail(' ', 'AUR Password Reset', $body, $headers); + $headers = "Reply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR"; + @mail($email, 'AUR Password Reset', $body, $headers); } header('Location: passreset.php?step=confirm'); @@ -84,54 +65,49 @@ html_header(__("Password Reset")); ?> -<div class="pgbox"> - <div class="pgboxtitle"> - <span class="f3"><?php print __("Password Reset"); ?></span> - </div> - <div class="pgboxbody"> - <?php - if ($error) { - echo '<p><span class="error">'.$error.'</span></p>'; - } - ?> - <?php - if ($step == 'confirm') { - echo __('Check your e-mail for the confirmation link.'); - } elseif ($step == 'complete') { - echo __('Your password has been reset successfully.'); - } elseif (isset($_GET['resetkey'])) { - ?> - <form action="" method="post"> - <table> - <tr> - <td><?php echo __("Confirm your e-mail address:"); ?></td> - <td><input type="text" name="email" size="30" maxlength="64" /></td> - </tr> - <tr> - <td><?php echo __("Enter your new password:"); ?></td> - <td><input type="password" name="password" size="30" maxlength="32" /></td> - </tr> - <tr> - <td><?php echo __("Confirm your new password:"); ?></td> - <td><input type="password" name="confirm" size="30" maxlength="32" /></td> - </tr> - </table> - <br /> - <input type="submit" class="button" value="<?php echo __('Continue') ?>" /> - </form> - <?php - } else { - ?> - <p><?php echo __('If you have forgotten the e-mail address you used to register, please send a message to the %haur-general%h mailing list.', - '<a href="http://mailman.archlinux.org/mailman/listinfo/aur-general">', - '</a>'); ?></p> - <form action="" method="post"> - <p><?php echo __("Enter your e-mail address:"); ?> - <input type="text" name="email" size="30" maxlength="64" /></p> - <input type="submit" class="button" value="<?php echo __('Continue') ?>" /> - </form> - <?php } ?> - </div> +<div class="box"> + <h2><?php print __("Password Reset"); ?></h2> + + <?php if ($error): ?> + <p><span class="error"><?php echo $error ?></span></p> + <?php endif;?> + <?php + if ($step == 'confirm') { + echo __('Check your e-mail for the confirmation link.'); + } elseif ($step == 'complete') { + echo __('Your password has been reset successfully.'); + } elseif (isset($_GET['resetkey'])) { + ?> + <form action="" method="post"> + <table> + <tr> + <td><?php echo __("Confirm your e-mail address:"); ?></td> + <td><input type="text" name="email" size="30" maxlength="64" /></td> + </tr> + <tr> + <td><?php echo __("Enter your new password:"); ?></td> + <td><input type="password" name="password" size="30" maxlength="32" /></td> + </tr> + <tr> + <td><?php echo __("Confirm your new password:"); ?></td> + <td><input type="password" name="confirm" size="30" maxlength="32" /></td> + </tr> + </table> + <br /> + <input type="submit" class="button" value="<?php echo __('Continue') ?>" /> + </form> + <?php + } else { + ?> + <p><?php echo __('If you have forgotten the e-mail address you used to register, please send a message to the %saur-general%s mailing list.', + '<a href="http://mailman.archlinux.org/mailman/listinfo/aur-general">', + '</a>'); ?></p> + <form action="" method="post"> + <p><?php echo __("Enter your e-mail address:"); ?> + <input type="text" name="email" size="30" maxlength="64" /></p> + <input type="submit" class="button" value="<?php echo __('Continue') ?>" /> + </form> + <?php } ?> </div> <?php diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index c566cb47..65e2f6db 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -33,10 +33,23 @@ if ($uid): } # Before processing, make sure we even have a file - if (!$error) { - if ($_FILES['pfile']['size'] == 0){ + switch($_FILES['pfile']['error']) { + case UPLOAD_ERR_INI_SIZE: + $maxsize = ini_get('upload_max_filesize'); + $error = __("Error - Uploaded file larger than maximum allowed size (%s)", $maxsize); + break; + case UPLOAD_ERR_PARTIAL: + $error = __("Error - File partially uploaded"); + break; + case UPLOAD_ERR_NO_FILE: $error = __("Error - No file uploaded"); - } + break; + case UPLOAD_ERR_NO_TMP_DIR: + $error = __("Error - Could not locate temporary upload folder"); + break; + case UPLOAD_ERR_CANT_WRITE: + $error = __("Error - File could not be written"); + break; } # Check whether the file is gzip'ed @@ -72,23 +85,25 @@ if ($uid): $pkgbuild_raw = ''; $dircount = 0; foreach ($tar->listContent() as $tar_file) { - if (preg_match('/^[^\/]+\/PKGBUILD$/', $tar_file['filename'])) { - $pkgbuild_raw = $tar->extractInString($tar_file['filename']); + if ($tar_file['typeflag'] == 0) { + if (strchr($tar_file['filename'], '/') === false) { + $error = __("Error - source tarball may not contain files outside a directory."); + break; + } + elseif (substr($tar_file['filename'], -9) == '/PKGBUILD') { + $pkgbuild_raw = $tar->extractInString($tar_file['filename']); + } } - elseif (preg_match('/^[^\/]+\/$/', $tar_file['filename'])) { - if (++$dircount > 1) { + elseif ($tar_file['typeflag'] == 5) { + if (substr_count($tar_file['filename'], "/") > 1) { + $error = __("Error - source tarball may not contain nested subdirectories."); + break; + } + elseif (++$dircount > 1) { $error = __("Error - source tarball may not contain more than one directory."); break; } } - elseif (preg_match('/^[^\/]+$/', $tar_file['filename'])) { - $error = __("Error - source tarball may not contain files outside a directory."); - break; - } - elseif (preg_match('/^[^\/]+\/[^\/]+\//', $tar_file['filename'])) { - $error = __("Error - source tarball may not contain nested subdirectories."); - break; - } } if (!$error && empty($pkgbuild_raw)) { @@ -280,7 +295,7 @@ if ($uid): $error = __( "Could not create directory %s.", $incoming_pkgdir); } } else { - $error = __( "You are not allowed to overwrite the %h%s%h package.", "<b>", $pkg_name, "</b>"); + $error = __( "You are not allowed to overwrite the %s%s%s package.", "<b>", $pkg_name, "</b>"); } if (!$error) { @@ -304,13 +319,10 @@ if ($uid): # Update the backend database if (!$error) { - $dbh = db_connect(); - db_query("BEGIN", $dbh); + begin_atomic_commit($dbh); - $q = "SELECT * FROM Packages WHERE Name = '" . db_escape_string($new_pkgbuild['pkgname']) . "'"; - $result = db_query($q, $dbh); - $pdata = mysql_fetch_assoc($result); + $pdata = pkgdetails_by_pkgname($new_pkgbuild['pkgname'], $dbh); if (isset($new_pkgbuild['epoch']) && (int)$new_pkgbuild['epoch'] > 0) { $pkg_version = sprintf('%d:%s-%s', $new_pkgbuild['epoch'], $new_pkgbuild['pkgver'], $new_pkgbuild['pkgrel']); @@ -337,46 +349,20 @@ if ($uid): $packageID = $pdata["ID"]; # Flush out old data that will be replaced with new data - $q = "DELETE FROM PackageDepends WHERE PackageID = " . $packageID; - db_query($q, $dbh); - $q = "DELETE FROM PackageSources WHERE PackageID = " . $packageID; - db_query($q, $dbh); + remove_pkg_deps($packageID, $dbh); + remove_pkg_sources($packageID, $dbh); # If a new category was chosen, change it to that if ($category_id > 1) { - $q = sprintf( "UPDATE Packages SET CategoryID = %d WHERE ID = %d", - $category_id, - $packageID); - - db_query($q, $dbh); + update_pkg_category($packageID, $category_id); } # Update package data - $q = sprintf("UPDATE Packages SET ModifiedTS = UNIX_TIMESTAMP(), Name = '%s', Version = '%s', License = '%s', Description = '%s', URL = '%s', OutOfDateTS = NULL, MaintainerUID = %d WHERE ID = %d", - db_escape_string($new_pkgbuild['pkgname']), - db_escape_string($pkg_version), - db_escape_string($new_pkgbuild['license']), - db_escape_string($new_pkgbuild['pkgdesc']), - db_escape_string($new_pkgbuild['url']), - $uid, - $packageID); - - db_query($q, $dbh); - + update_pkgdetails($packageID, $new_pkgbuild['pkgname'], $new_pkgbuild['license'], $pkg_version, "", $new_pkgbuild['pkgdesc'], $new_pkgbuild['url'], "", $uid, $dbh); } else { # This is a brand new package - $q = sprintf("INSERT INTO Packages (Name, License, Version, CategoryID, Description, URL, SubmittedTS, ModifiedTS, SubmitterUID, MaintainerUID) VALUES ('%s', '%s', '%s', %d, '%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), %d, %d)", - db_escape_string($new_pkgbuild['pkgname']), - db_escape_string($new_pkgbuild['license']), - db_escape_string($pkg_version), - $category_id, - db_escape_string($new_pkgbuild['pkgdesc']), - db_escape_string($new_pkgbuild['url']), - $uid, - $uid); - - db_query($q, $dbh); - $packageID = mysql_insert_id($dbh); + new_pkgdetails($new_pkgbuild['pkgname'], $new_pkgbuild['license'], $pkg_version, $category_id, $new_pkgbuild['pkgdesc'], $new_pkgbuild['url'], $uid, $dbh); + $packageID = last_insert_id($dbh); } @@ -393,23 +379,15 @@ if ($uid): else if ($deppkgname == "#") { break; } - - $q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, '%s', '%s')", - $packageID, - db_escape_string($deppkgname), - db_escape_string($depcondition)); - - db_query($q, $dbh); + add_pkg_dep($packageID, $deppkgname, $depcondition, $dbh); } } # Insert sources - $sources = explode(" ", $new_pkgbuild['source']); - foreach ($sources as $src) { - if ($src != "" ) { - $q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; - $q .= $packageID . ", '" . db_escape_string($src) . "')"; - db_query($q, $dbh); + if (!empty($new_pkgbuild['source'])) { + $sources = explode(" ", $new_pkgbuild['source']); + foreach ($sources as $src) { + add_pkg_src($packageID, $src, $dbh); } } @@ -420,7 +398,7 @@ if ($uid): } # Entire package creation process is atomic - db_query("COMMIT", $dbh); + end_atomic_commit($dbh); header('Location: packages.php?ID=' . $packageID); } @@ -438,11 +416,8 @@ html_header("Submit"); <p class="pkgoutput"><?php print $error ?></p> <?php endif; ?> -<div class="pgbox"> - <div class="pgboxtitle"> - <span class="f3"><?php print __("Submit"); ?></span> - </div> - <div class="pgboxbody"> +<div class="box"> + <h2><?php echo __("Submit"); ?></h2> <p><?php echo __("Upload your source packages here. Create source packages with `makepkg --source`.") ?></p> <?php @@ -454,39 +429,36 @@ html_header("Submit"); $pkg_categories = pkgCategories(); ?> -<form action='pkgsubmit.php' method='post' enctype='multipart/form-data'> - <div> <input type='hidden' name='pkgsubmit' value='1' /> - <input type='hidden' name='token' value='<?php print htmlspecialchars($_COOKIE['AURSID']) ?>' /> </div> - <table border='0' cellspacing='5'> - <tr> - <td class='f4' align='right'><?php print __("Package Category"); ?>:</td> - <td class='f4' align='left'> - <select name='category'> - <option value='1'><?php print __("Select Category"); ?></option> +<form action="pkgsubmit.php" method="post" enctype="multipart/form-data"> + <fieldset> + <div> + <input type="hidden" name="pkgsubmit" value="1" /> + <input type="hidden" name="token" value="<?php print htmlspecialchars($_COOKIE['AURSID']) ?>" /> </div> + </div> + <p> + <label for="id_category"><?php print __("Package Category"); ?>:</label> + <select id="id_category" name="category"> + <option value="1"><?php print __("Select Category"); ?></option> <?php foreach ($pkg_categories as $num => $cat): - print "<option value='" . $num . "'"; + print '<option value="' . $num . '"'; if (isset($_POST['category']) && $_POST['category'] == $cat): - print " selected='selected'"; + print ' selected="selected"'; endif; - print ">" . $cat . "</option>"; + print '>' . $cat . '</option>'; endforeach; ?> </select> - </td> - </tr> - <tr> - <td class='f4' align='right'><?php print __("Upload package file"); ?>:</td> - <td class='f4' align='left'> - <input type='file' name='pfile' size='30' /> - </td> - </tr> - <tr> - <td align='left'> - <input class='button' type='submit' value='<?php print __("Upload"); ?>' /> - </td> - </tr> - </table> + </p> + <p> + <label for="id_file"><?php print __("Upload package file"); ?>:</label> + <input id="id_file" type="file" name="pfile" size='30' /> + </p> + <p> + <label></label> + <input class="button" type="submit" value="<?php print __("Upload"); ?>" /> + </p> + </fieldset> </form> <?php @@ -511,7 +483,6 @@ else: endif; ?> - </div> </div> <?php diff --git a/web/html/rpc.php b/web/html/rpc.php index ee7cda3d..415dcb82 100644 --- a/web/html/rpc.php +++ b/web/html/rpc.php @@ -18,7 +18,7 @@ else { // here. ?> <html><body> -<p>The methods currently allowed are:</p> +<h2>Allowed methods</h2> <ul> <li><tt>search</tt></li> <li><tt>info</tt></li> @@ -29,7 +29,14 @@ else { <pre>type=<em>methodname</em>&arg=<em>data</em></pre> <p>Where <em>methodname</em> is the name of an allowed method, and <em>data</em> is the argument to the call.</p> <p>If you need jsonp type callback specification, you can provide an additional variable <em>callback</em>.</p> -<p>Example URL: <tt>http://aur-url/rpc.php?type=search&arg=foobar&callback=jsonp1192244621103</tt></p> +<h2>Examples</h2> +<dl> + <dt><tt>search</tt></dt><dd><tt>http://aur-url/rpc.php?type=search&arg=foobar</tt></li></dd> + <dt><tt>info</tt></dt><dd><tt>http://aur-url/rpc.php?type=info&arg=foobar</tt></dd> + <dt><tt>multiinfo</tt></dt><dd><tt>http://aur-url/rpc.php?type=multiinfo&arg[]=foo&arg[]=bar</tt></dd> + <dt><tt>msearch</tt></dt><dd><tt>http://aur-url/rpc.php?type=msearch&arg=john</tt></li></dd> + <dt>Callback</dt><dd><tt>http://aur-url/rpc.php?type=search&arg=foobar&callback=jsonp1192244621103</tt></dd> +</dl> </body></html> <?php // close if statement diff --git a/web/html/rss.php b/web/html/rss.php index c7de4c65..6f057bfe 100644 --- a/web/html/rss.php +++ b/web/html/rss.php @@ -37,13 +37,9 @@ $image->description = "AUR Newest Packages Feed"; $rss->image = $image; #Get the latest packages and add items for them -$dbh = db_connect(); -$q = "SELECT * FROM Packages "; -$q.= "ORDER BY SubmittedTS DESC "; -$q.= "LIMIT 20"; -$result = db_query($q, $dbh); +$packages = latest_pkgs(20); -while ($row = mysql_fetch_assoc($result)) { +while (list($indx, $row) = each($packages)) { $item = new FeedItem(); $item->title = $row["Name"]; $item->link = "{$protocol}://{$host}/packages.php?ID={$row["ID"]}"; diff --git a/web/html/tu.php b/web/html/tu.php index 59cac1a2..86199039 100644 --- a/web/html/tu.php +++ b/web/html/tu.php @@ -5,7 +5,10 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); include_once("aur.inc.php"); set_lang(); check_sid(); -html_header(); + +$title = __("Trusted User"); + +html_header($title); # Default votes per page $pp = 10; @@ -16,49 +19,22 @@ if (isset($_COOKIE["AURSID"])) { $atype = account_from_sid($_COOKIE["AURSID"]); } -if ($atype == "Trusted User" OR $atype == "Developer") { +if ($atype == "Trusted User" || $atype == "Developer") { if (isset($_GET['id'])) { if (is_numeric($_GET['id'])) { - - $q = "SELECT * FROM TU_VoteInfo "; - $q.= "WHERE ID = " . $_GET['id']; - - $dbh = db_connect(); - $results = db_query($q, $dbh); - $row = mysql_fetch_assoc($results); + $row = vote_details($_GET['id']); if (empty($row)) { print __("Could not retrieve proposal details."); } else { $isrunning = $row['End'] > time() ? 1 : 0; - $qvoted = "SELECT * FROM TU_Votes WHERE "; - $qvoted.= "VoteID = " . $row['ID'] . " AND "; - $qvoted.= "UserID = " . uid_from_sid($_COOKIE["AURSID"]); - $result = db_query($qvoted, $dbh); - if ($result) { - $hasvoted = mysql_num_rows($result); - } - else { - $hasvoted = 0; - } - # List voters of a proposal. - $qwhoVoted = "SELECT tv.UserID,U.Username - FROM TU_Votes tv, Users U - WHERE tv.VoteID = {$row['ID']} - AND tv.UserID = U.ID - ORDER BY Username"; - $result = db_query($qwhoVoted,$dbh); - if (mysql_num_rows($result) > 0) { - $whovoted = ''; - while ($who = mysql_fetch_assoc($result)) { - $whovoted.= '<a href="account.php?Action=AccountInfo&ID='.$who['UserID'].'">'.$who['Username'].'</a> '; - } - } + $whovoted = voter_list($row['ID']); $canvote = 1; + $hasvoted = 0; $errorvote = ""; if ($isrunning == 0) { $canvote = 0; @@ -66,8 +42,9 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) { $canvote = 0; $errorvote = __("You cannot vote in an proposal about you."); - } else if ($hasvoted != 0) { + } else if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))) { $canvote = 0; + $hasvoted = 1; $errorvote = __("You've already voted for this proposal."); } @@ -81,25 +58,18 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $myvote = "Abstain"; } - $qvote = "UPDATE TU_VoteInfo SET " . $myvote . " = " . ($row[$myvote] + 1) . " WHERE ID = " . $row['ID']; - db_query($qvote, $dbh); - $qvote = "INSERT INTO TU_Votes (VoteID, UserID) VALUES (" . $row['ID'] . ", " . uid_from_sid($_COOKIE["AURSID"]) . ")"; - db_query($qvote, $dbh); + cast_proposal_vote($row['ID'], uid_from_sid($_COOKIE["AURSID"]), $myvote, $row[$myvote] + 1); # Can't vote anymore # $canvote = 0; $errorvote = __("You've already voted for this proposal."); - # Update if they voted - $result = db_query($qvoted, $dbh); - if ($result) { - $hasvoted = mysql_num_rows($result); - } - $results = db_query($q, $dbh); - if ($results) { - $row = mysql_fetch_assoc($results); + # Update if they voted + if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))) { + $hasvoted = 1; } + $row = vote_details($_GET['id']); } } include("tu_details.php"); @@ -109,8 +79,6 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } } else { - $dbh = db_connect(); - $limit = $pp; if (isset($_GET['off'])) $offset = $_GET['off']; @@ -120,7 +88,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { else $by = 'desc'; - if (!empty($offset) AND is_numeric($offset)) { + if (!empty($offset) && is_numeric($offset)) { if ($offset >= 1) { $off = $offset; } else { @@ -134,34 +102,33 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $lim = ($limit > 0) ? " LIMIT $limit OFFSET $off" : ""; $by_next = ($by == 'desc') ? 'asc' : 'desc'; - $q = "SELECT * FROM TU_VoteInfo WHERE End > " . time() . " ORDER BY Submitted " . $order; - $result = db_query($q, $dbh); - + $result = current_proposal_list($order); $type = __("Current Votes"); include("tu_list.php"); ?> <?php - $q = "SELECT * FROM TU_VoteInfo WHERE End < " . time() . " ORDER BY Submitted " . $order . $lim; - $result = db_query($q, $dbh); + $result = past_proposal_list($order, $lim); $type = __("Past Votes"); include("tu_list.php"); - $qnext = "SELECT ID FROM TU_VoteInfo"; - $nextresult = db_query($qnext, $dbh); + $nextresult = proposal_count(); ?> -<div class="pgbox"> -<p><a href='addvote.php'><?php print __("Add Proposal") ?></a></p> - - <?php if (mysql_num_rows($result)) { $by = htmlentities($by, ENT_QUOTES); ?> - <?php if ($off != 0) { $back = (($off - $limit) <= 0) ? 0 : $off - $limit; ?> - <a href='tu.php?off=<?php print $back ?>&by=<?php print $by ?>'><?php print __("Back") ?></a> - <?php } ?> - <?php if (($off + $limit) < mysql_num_rows($nextresult)) { $forw = $off + $limit; ?> - <a href='tu.php?off=<?php print $forw ?>&by=<?php print $by ?>'><?php print __("Next") ?></a> - <?php } ?> - <?php } ?> +<div class="box"> + <p><a href="addvote.php"><?php print __("Add Proposal") ?></a></p> + + <?php if ($result): + $by = htmlentities($by, ENT_QUOTES); ?> + <?php if ($off != 0): + $back = (($off - $limit) <= 0) ? 0 : $off - $limit; ?> + <a href='tu.php?off=<?php print $back ?>&by=<?php print $by ?>'><?php print __("Back") ?></a> + <?php endif; ?> + <?php if (($off + $limit) < $nextresult): + $forw = $off + $limit; ?> + <a href="tu.php?off=<?php print $forw ?>&by=<?php print $by ?>"><?php print __("Next") ?></a> + <?php endif; ?> + <?php endif; ?> </div> <?php } diff --git a/web/html/voters.php b/web/html/voters.php index 02abe290..231e3230 100644 --- a/web/html/voters.php +++ b/web/html/voters.php @@ -3,38 +3,29 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); include('aur.inc.php'); include('pkgfuncs.inc.php'); -function getvotes($pkgid) { - $dbh = db_connect(); - $pkgid = db_escape_string($pkgid); - - $result = db_query("SELECT UsersID,Username FROM PackageVotes LEFT JOIN Users on (UsersID = ID) WHERE PackageID = $pkgid ORDER BY Username", $dbh); - return $result; -} - $SID = $_COOKIE['AURSID']; $pkgid = intval($_GET['ID']); $votes = getvotes($pkgid); -$account = account_from_sid($SID); +$atype = account_from_sid($SID); -if ($account == 'Trusted User' || $account == 'Developer') { -?> -<html> -<body> -<h3><?php echo account_from_sid($SID) ?></h3> -<h2>Votes for <a href="packages.php?ID=<?php echo $pkgid ?>"><?php echo pkgname_from_id($pkgid) ?></a></h2> -<?php - while ($row = mysql_fetch_assoc($votes)) { - $uid = $row['UsersID']; - $username = $row['Username']; +html_header(__("Voters")); + +if ($atype == 'Trusted User' || $atype== 'Developer'): ?> -<a href="account.php?Action=AccountInfo&ID=<?php echo $uid ?>"> -<?php echo htmlspecialchars($username) ?></a><br /> + +<div class="box"> + <h2>Votes for <a href="packages.php?ID=<?php echo $pkgid ?>"><?php echo pkgname_from_id($pkgid) ?></a></h2> + <div class="boxbody"> + <?php - } -?> -</body> -</html> + while (list($indx, $row) = each($votes)): ?> + <a href="account.php?Action=AccountInfo&ID=<?php echo $row['UsersID'] ?>"><?php echo htmlspecialchars($row['Username']) ?></a><br /> + <?php endwhile; ?> + </div> +</div> + <?php -} +endif; +html_footer(AUR_VERSION); |