Commit graph

490 commits

Author SHA1 Message Date
canyonknight
aab6eed138 Replace permission check code with can_edit_account()
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-01-30 09:25:29 +01:00
canyonknight
87fe4701cd Fix account editing and hijacking vulnerability
Checks are in place to avoid users getting account editing forms
they shouldn't have access to. The appropriate checks before
editing the account in the backend are not in place.

This vulnerability allows a user to craft malicious POST data to
edit other user accounts, thereby allowing account hijacking.

Add a new flexible function can_edit_account() to determine if
a user has appropriate permissions. Run the permission check before
processing any account information in the backend.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-11-29 23:23:10 +01:00
canyonknight
e383205eda login.php: Properly link to logout page when already logged in
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-11-24 13:20:35 +01:00
Lukas Fleischer
630f1cbae8 Avoid use of "$_SERVER['REQUEST_URI']"
Use the routing library to build proper URIs instead of relying on the
"REQUEST_URI" server variable which can be manipulated and might return
bogus URIs.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-11-04 19:19:32 +01:00
Lukas Fleischer
789245077d pkgsubmit.php: Show a warning for split packages
Display a special error message if the package is identified as split
package.

Currently, the AUR displays a very vague error message when a split
package is submitted ("Invalid name: only lowercase letters are
allowed"). This often caused confusion among package submitters, see
FS#22834 and FS#32450.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-11-04 18:03:18 +01:00
Lukas Fleischer
274182a424 Add missing internationalization to a few strings
Fixes FS#32449.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-11-04 17:08:31 +01:00
Lukas Fleischer
69e2d1dcff Return 404 for invalid account/package subpages
Display an error page and return a 404 status code in the following
cases:

* An invalid package name is passed to the "packages" action.
* An invalid user name is passed to the "account" action.
* An invalid package action is passed.
* An invalid account action is passed.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-30 14:56:43 +01:00
canyonknight
9fd4845d16 pkgsubmit.php: Check that there is one directory in a tarball
Users are able to upload tarballs without a directory.
The directory count for a tarball is available, so use it to
display an error when there is not a single directory.

This patch has no effect on users who generate their uploaded
tarballs using makepkg. All other users must include a directory
in their tarball.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-29 12:28:45 +01:00
Lukas Fleischer
985a2ed49c home.php: Remove unneeded tables
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-28 19:56:27 +01:00
Lukas Fleischer
6897bb0097 Implement word-wrap for package statistics
Word-wrap labels in the package statistics box, just as we wrap package
names in the "Recent Updates" box.

Addresses FS#32160.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-28 02:17:54 +02:00
Dan McGee
5222bf0932 Use HTTPS links everywhere for Arch sites
The main site, wiki, and BBS are using HTTPS exclusively, so link
directly to the correct protocol rather than forcing a redirect.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-22 12:33:11 +02:00
canyonknight
d25a57c973 home.php: Fix XHTML tag errors
* Add missing <p> tag
* Move <h4> outside of a <p> tag
* Rename an id to avoid a conflict with an already existing id

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-20 18:47:01 +02:00
Lukas Fleischer
c4b5584eef Sync CSS with archweb
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-20 18:28:17 +02:00
Lukas Fleischer
f0be65875b Display an error page if a virtual path doesn't exist
Give user feedback instead of bailing out with an empty HTTP response
body.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-20 18:28:17 +02:00
canyonknight
aef6fdfe17 pkgsubmit.php: Fix package version not updating
Parameters were not correct for a package update operation.
Fix regression of 763cbf8373

Fixes FS#31868

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-11 21:19:17 +02:00
canyonknight
24a8452880 Remove character limit on password length
As all new passwords are hashed and therefore stored in the database
at the same length, this limitation is no longer needed.

Fixes FS#31855

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-11 21:19:16 +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
canyonknight
238695c402 pkgsubmit.php: Fix PHP notice for depends processing
A foreach() is run without verifying an uploaded package has any depends.
Fix the undefined index notice for packages uploaded with no depends.
Similar to commit 857de725d1.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-03 00:21:21 +02:00
canyonknight
752c5a6e34 Move package merging to a separate page
Package actions now have a separate box on the package details page. Add
a package merge link in that box.

Link leads to a new page (pkgmerge.php) that can be used to confirm package
merging. A separate page with confirmation is used to avoid CSRFs.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-28 08:57:25 +02:00
canyonknight
00cffd7ddb Move package deletion to a separate page
Package actions now have a separate box on the package details page. Make
a package deletion link in that box.

Link leads to a new page (pkgdel.php) that can be used to confirm package
deletion. A separate page with confirmation is used to avoid CSRFs.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-28 08:57:24 +02:00
Lukas Fleischer
d56a88897b Avoid use of "<b>"/"</b>"
* Use "<label>"/"</label>" for form labels.
* Use "<strong>"/"</strong>" for important text.
* Use "<h4>"/"</h4>" for headings.
* Drop "<b>"/"</b>" everywhere else.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-24 12:23:05 +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
canyonknight
19df708551 rss.php: Update links to reflect URL changes
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-21 07:35:52 +02:00
Lukas Fleischer
4aad42d993 Sync search result statistics with archweb
* Use archweb classes for search result statistics.
* Add some space between page numbers.
* Display current page number instead of current item range.
* Hide page numbers if the result fits into a single page.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-19 02:42:01 +02:00
Lukas Fleischer
7c004693f7 Wrap long lines in the "Recent Updates" sidebar
* Sync the sidebar layout with archweb, use the "pkg-name" class to wrap
  long package names.

* Move the "New!" logo to a separate column to make sure it isn't
  wrapped to a new line on its own.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-19 01:17:32 +02:00
Lukas Fleischer
3b1dad229b Fix category selection
Add a package ID parameter to pkg_change_category() instead of relying
on the "ID" or "N" GET parameters.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 16:09:30 +02:00
Lukas Fleischer
2e552cbcad Do not set GET parameters in the routing framework
Setting GET parameters manually is bad style and causes some strange
side effects when using virtual URLs and mkurl().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 14:05:11 +02:00
Lukas Fleischer
3d4cb66aed index.php: Fix undefined variable notice
Spotted when browsing the package details page while being logged out.

Reported-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 14:01:09 +02:00
canyonknight
e84eb4ae54 Overhaul ability to edit own account
* Restructure account.php to remove redundant code.
* Remove own_account_details().
* Rework logic check to default to no access to account edit form.
* Make default account action viewing account info.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:59:45 +02:00
canyonknight
d6f89f97c0 Use URL rewriting for user account update page
The "UpdateAccount" page displays information as to whether an account
update was successful. All POST account info goes to this page, so use
it with sane URLs.

Before:
AUR_URL/account/?Action=UpdateAccount&U=userfoo

After:
AUR_URL/account/userfoo/update

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:59:29 +02:00
canyonknight
5c0de7825d Use URL rewriting for user editing page
Allows for easier account editing and saner URLs. Update account editing links
to use new URL.

Before:
AUR_URL/account/?Action=DisplayAccount&U=userfoo

After:
AUR_URL/account/userfoo/edit

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:59:23 +02:00
canyonknight
98b6ba9479 Use URL rewriting for user info page
Navigation to the "AccountInfo" page should only require a user to know the
username of the account they are looking for. Update all AUR links that use
the user info page to reflect the new URL.

Before:
AUR_URL/account/?Action=AccountInfo&U=userfoo

After:
AUR_URL/account/userfoo

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:59:21 +02:00
canyonknight
3013ab8eb0 Remove unused image "titlelogo.png"
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:59:01 +02:00
canyonknight
36abb9efb9 Use the "new" icon from archweb for the recent updates table
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:59:00 +02:00
canyonknight
c133826a7c logout.php: Fix PHP undefined variable notice
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:58:55 +02:00
canyonknight
b3393208fb Fix broken package search on front page
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-08-23 22:47:50 +02:00
canyonknight
44d8588b63 Print error message when maximum DB character length is exceeded
Packages can currently be submitted with variables longer than the maximum
allowed by the DB for that specific field. The string will be shortened
without informing the user. This can result in unexpected oddities on
submitted packages. Print error messages informing the user when the package
name, URL, description, license, or version is too long.

Also move the resolution of full package version (including epoch) to an
earlier point in pkgsubmit.php

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-08-23 22:47:50 +02:00
canyonknight
4cf075811c pkgsubmit.php: Make page friendlier for logged out users
Logged out users who navigate to /submit currently reach a page with only an
error message. This adds the full navigation bar for users who errantly reach
/submit before logging in.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-08-23 22:47:49 +02:00
Lukas Fleischer
7ad4bc352d Use virtual paths for voters page
Link to "/packages/$pkgname/voters/" instead of using "/voters/" and a
get parameter to request a specific package by ID.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 08:23:27 +02:00
Lukas Fleischer
caf997d9b1 voters.php: Use "<ul></ul>" for the list of voters
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 08:07:17 +02:00
Lukas Fleischer
8e412cb5b0 voters.php: Do not re-include libraries
Use include_once() instead of include(). Otherwise, a fatal error is
shown if the virtual path feature is used since "web/lib/aur.inc.php" is
already included in the routing front end.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 08:07:17 +02:00
Lukas Fleischer
f2301ca922 routing.inc.php: rtrim() path in get_route()
Return the correct route -- even if a "/" is appended to the URI.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 23:10:27 +02:00
Lukas Fleischer
6790b36247 aur.inc.php: Include routing backend
This needs to be available on every page since it is needed for
get_uri() and get_pkg_uri() and "web/html/index.php" isn't executed if
the virtual path feature is disabled.

Reported-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 23:10:26 +02:00
Lukas Fleischer
c349cb2fea Add virtual path support for package actions
This allows for using following URLs:

* /package/$pkg_name/flag: Flag a package out-of-date
* /package/$pkg_name/unflag: Unflag a package
* /package/$pkg_name/notify: Enable comment notifications
* /package/$pkg_name/unnotify: Disable comment notifications
* /package/$pkg_name/vote: Vote for the package
* /package/$pkg_name/unvote: Remove vote

Note that this code is very hackish and should be refactored once we
drop support for legacy URLs.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 22:19:07 +02:00
Lukas Fleischer
7c1c36ebc8 web/html/pkgsubmit.php: Remove stray "</div>"
Regression introduced in f3ce74c714 when
resolving conflicts.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 22:55:48 +02:00
Lukas Fleischer
03486c3b6f Use virtual paths for package details
Extend the routing front/back ends to allow for using
"/package/$pkgname/" for individual packages.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 22:48:32 +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
eb22bcc754 Add routing front/back ends
This adds a URL mapping library that can be used to implement virtual
paths. Also, "web/html/index.php" is moved to "web/html/home.php" and
"web/html/index.php" becomes a routing front end that maps virtual paths
to corresponding files.

To enable the virtual path feature, all requests need to be redirected
to the "index.php" routing script. If you use lighttpd, following
rewrite rule can be used:

    url.rewrite = ( "^(.*)$" => "/index.php/$1" )

A similar rule can be used for Apache (using mod_rewrite).

Note that the current routing front end only works if PATH_INFO is
provided.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 18:16:26 +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
857de725d1 pkgsubmit.php: Refactor source processing to fix PHP notice
A foreach() being run without checking to see if the uploaded PKGBUILD had any
sources now no longer causes an undefined index notice when there are no
sources.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-14 22:19:52 +02:00