Commit graph

39 commits

Author SHA1 Message Date
Joakim Saario
9c6c13b78a
style: Run pre-commit 2022-08-22 22:40:45 +02:00
Lukas Fleischer
6892ec7791 Call check_sid() from a central location
Instead of calling check_sid() from every single PHP script representing
a web page, add the call to aur.inc.php which is sourced by all of them.

Also, remove set_lang() calls from the scripts since these are also
already included in aur.inc.php.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-27 09:22:53 +02:00
Lukas Fleischer
cc1e8aed30 Rename the AUR software to aurweb
Rename the project to help differentiate between the software providing
access to the Arch User Repository and the collection of source packages
itself.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2015-02-04 09:50:01 +01:00
Lukas Fleischer
03c6304e19 Rework permission handling
Add a new function has_credential() that checks whether the currently
logged in user is allowed to perform a given action. Moving all
permission handling to this central place makes adding new user groups
and adjusting permissions much more convenient.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-07-15 22:56:57 +02:00
Balló György
d8ea2d4a02 Forbid developers to vote
According to Trusted User Bylaws, TUs (and only TUs) must take part in
votes. Developers who want to take part in votes should set their account
type to 'Trusted User'.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-01-11 12:08:51 +01:00
Lukas Fleischer
3130a887e8 Move "Add Proposal" link to "Current Votes"
The page this links to allows for adding an item to the list of current
votes. Move the link accordingly.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-09-03 12:53:58 +02:00
Lukas Fleischer
a4a170e58e Move "Past Votes" navigation to "Past Votes" box
These are navigation links and do not belong to the action box.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-08-26 17:53:24 +02:00
Lukas Fleischer
2dd3d04f45 Add "Last Votes by TU" list
This shows a list of all Trusted Users and the vote ID of the last
proposal each of the TUs voted on. This list is sorted by vote ID.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-08-26 17:34:31 +02:00
canyonknight
d94a9e7299 tu.php: Fix page showing a user hasn't voted when they have
An ended vote details page will report a user hasn't voted even when
they have. This is a result of faulty logic that only checks if a user
has voted if the vote is still running.

Regression with commit c15441762c6f6ab4438eaf2854c0ee3146a98b30

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-10 17:22:22 +02:00
Lukas Fleischer
6102759b7c Use echo shortcut syntax
Replace all occurrences of "<?php echo" and "<?php print" by "<?=" to
reduce noise in templates.

Note that as of PHP 5.4.0, "<?=" is always available and no longer
requires "short_open_tag" to be set.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-24 12:23:04 +02:00
Lukas Fleischer
2425f963f8 Use virtual path feature for links
Use virtual paths in links (e.g. link to "/packages/" instead of
"/packages.php" etc.) if the virtual path feature is enabled.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 22:44:51 +02:00
Lukas Fleischer
f3ce74c714 Merge branch 'maint'
Conflicts:
	web/html/account.php
	web/html/addvote.php
	web/html/pkgsubmit.php
	web/lib/acctfuncs.inc.php
	web/template/actions_form.php
	web/template/pkg_comment_form.php
	web/template/pkg_comments.php
	web/template/pkg_details.php
	web/template/pkg_search_results.php
	web/template/tu_details.php
2012-07-14 22:52:04 +02:00
canyonknight
81e0b7fe18 tu.php: Fix PHP notice for "hasvoted" variable
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-11 19:26:30 +02:00
canyonknight
c15441762c Pull out DB code from trusted user page
* Move DB code in tu.php and tu.php and tu_list.php to new functions in
accfuncs.inc.php
* Centralization of DB code important in a future transition to PDO interface

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:27:04 +02:00
canyonknight
af8f60fe7f Overhaul trusted user proposal page to match archweb
* Change all boxes and other CSS to match archweb
* General fixups in XHTML formatting
* Change results table to match color scheme everywhere else

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:26:26 +02:00
canyonknight
345b3216c8 Be consistent in PHP logical operator usage
A mix of logical operator styles are currently in use. The predominant style
uses "&&" and "||" instead of "and" and "or", respectively. This inconsistency
is minor, but is easily avoided.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:25:45 +02:00
canyonknight
2c93f0a98f Implement token system to fix CSRF vulnerabilities
Specially crafted pages can force authenticated users to unknowingly perform
actions on the AUR website despite being on an attacker's website. This
cross-site request forgery (CSRF) vulnerability applies to all POST data on
the AUR.

Implement a token system using a double submit cookie. Have a hidden form
value on every page containing POST forms. Use the newly added check_token() to
verify the token sent via POST matches the "AURSID" cookie value. Random
nature of the token limits potential for CSRF.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-06-24 10:59:23 +02:00
Andrea Scarpino
7cb89be81f Set the title in the Trusted User page
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-12-17 14:53:56 +01:00
elij
888db089c5 rename *.inc files to *.inc.php and adjust imports and references
Lukas: Add note to "UPGRADING".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-06-22 15:15:04 +02:00
elij
0898f1447a test return value from db_query before assuming it is valid
make the sql query form consistent in usage by cleaning up instances
where db_query's result was not inspected before attempting to fetch row
data from the handle

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-17 10:43:42 +02:00
elij
10ea5f5ff6 create variable before referencing it with .=
fixes php notice level error:
  Undefined variable: whovoted in ../tu.php

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:28 +02:00
Dan McGee
fcda6671f3 SQL: use standard LIMIT/OFFSET syntax
Increases compatibility with standard SQL dialect.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:27 +02:00
Lukas Fleischer
7f9e498e48 Fix broken XHTML.
Fix a lot of invalid XHTML in the templates and actions. There might
still be some legacy code left, but this should cover most of it.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-11 19:00:50 +01:00
Andrea Scarpino
a417224988 Do not display current votes in All Votes, and rename it as Past Votes
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-12-04 23:03:33 -05:00
Loui Chang
55dcf5ce87 tu.php: Sort votes by descending date.
Also make syntax more straightforward.
'asc' is ascending, rather than 'up'.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-12-26 14:36:05 -05:00
Loui Chang
cdd2e5dbd4 tu: Bring Trusted User interface in line with the rest of the site.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-11-23 14:14:23 -05:00
Loui Chang
f6387253b4 tu.php: Remove trailing whitespace.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-11-23 13:21:36 -05:00
Loui Chang
847475fe54 Untranslate TU vote fields so they're properly saved in the database.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-10-26 17:28:07 -04:00
Dan McGee
46f2798524 Use include_once where applicable
All of these are sourcing function libraries so we don't need to include
them more than once. Things that insert actual HTML into the output were
left calling include().

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-08-11 13:58:12 -04:00
Loui Chang
e83e593ac4 Change layout of tu_details.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-02-13 15:31:05 -05:00
Angel 'angvp' Velasquez
df75621d23 List TUs that voted on a proposal.
This patch lists who voted on a proposal after the proposal is closed.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-02-13 15:27:05 -05:00
Loui Chang
2ee3276348 Use new conglomerated translation files.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-01-19 16:29:45 -05:00
Loui Chang
78c2b5c67f Introduce function include_lang for translations.
This includes only the requested language for each page and
makes top level language include files obsolete.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-12-21 18:03:27 +09:00
Loui Chang
21840941eb Tweak TU interface for appearance.
Show ten votes per page instead of five.
Change the vote preview to 75 characters so entries fit better
in the table.
Remove [More] links and make the description itself a link.
Clean up a couple notices.
Send unauthorised users to index.php.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-11-10 09:21:13 -05:00
Callan Barrett
2d49849e2c Setup translation files for tu.php
Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
2008-10-08 04:02:37 +08:00
Callan Barrett
34c8a9cf80 Major rearrangement of tu.php, strings setup for translation
All the strings are set up to be translated now, HTML of tu.php has been
moved to templates and the worst of it rewritten (there's no longer a
massive function in it)

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-10-05 19:15:47 -04:00
Loui Chang
3a42725601 Remove all vim mode lines. Add HACKING file.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-06-17 01:38:01 -04:00
Callan Barrett
5f4afcc8cb Add support for variable length votes in voting application
Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
2008-01-20 00:21:19 -06:00
Callan Barrett
a8e574ef28 AUR Voting Application
Added support for TU voting through AUR

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
2008-01-20 00:21:19 -06:00