Commit graph

1399 commits

Author SHA1 Message Date
canyonknight
66fe10df63 Add the new package icon back to the front page
This regression was introduced with d2480e8b9d.
Re-implement the functionality in a cleaner way.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:58:58 +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
5dfbb783f1 Adjust user directions after registering to reflect new login page
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:58:52 +02:00
canyonknight
e171f6f34e Migrate all DB code to use PDO
All DB code currently uses the quickly aging mysql_* functions. These
functions are strongly discouraged and may eventually be deprecated.

Transition all code to utilize the PDO data access abstraction layer. PDO
allows for consistent query code across multiple databases. This could
potentially allow for someone to use a database other than MySQL with
minimal code changes.

All functions and behaviors are reproduced as faithfully as possible with
PDO equivalents and some changes in code.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:58:46 +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
49073b1e82 Fix broken RSS feed link 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
e8cd6abc6e Allow only Trusted Users, Developers, and Maintainers to unflag packages
Currently everyone is allowed to unflag a package as out of date. This should
be limited to only the appropriate people for a specific package.

Fixes FS#27263

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
cac3ef74cb pkg_details.php: Fix broken HTML for package page with no dependencies
The "Required by" column already handles an empty list appropriately. Move a
</div> tag to match that behavior in the "Dependencies" column

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-08-23 22:47:49 +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
51b8213ff1 pkg_details.php: Remove field set in actions box
archweb uses "<div></div>" and "<p></p>" here.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 08:07:18 +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
9de84d2fd5 pkg_comments.php: Fix comment deletion links
* Add a missing quote to the "alt" attribute. Regression introduced in
  d8b2eb4b62.

* Retrieve and store the package name before overwriting the "$row"
  variable.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 08:07:17 +02:00
Lukas Fleischer
bd4a7aa0ff pkg_comments.php: Fix links to user accounts
Regression introduced in 2425f963f8.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 08:07:17 +02:00
Lukas Fleischer
3d07a58aac pkgfuncs.inc.php: Fix pkg_change_category()
Make sure that pkg_change_category() works, even if the "N" get
parameter is used and "ID" is unset. Note that this is considered to be
a hack rather than a proper fix; pkg_change_category() needs a lot of
work.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 08:07:03 +02:00
Lukas Fleischer
0608bcae12 routing.inc.php: Add missing "/account" route
Minor oversight when adding the routing back end in commit
eb22bcc754.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-18 07:25:46 +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
af95c2b1fe pkg_comments.php: Fix notice
Fix a notice that appeared if comments were available and the package
was requested by name. See 07d3649c2d for
a similar fix for links to the voters page.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 22:44:27 +02:00
Lukas Fleischer
10c774f034 Rearrange package actions
Move the flag/unflag action below the flag date.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 22:41:49 +02:00
Lukas Fleischer
9ede9e0faa pkg_details.php: Verbose labels for package actions
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 22:33:49 +02:00
Lukas Fleischer
55f05b3861 actions_form.php: Hide empty form
Do not show the actions form if it doesn't contain any elements. This
comes into effect if the virtual path feature is enabled and the current
user doesn't have TU/developer privileges.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 22:23:40 +02:00
Lukas Fleischer
c87ae9d299 Move adoption button to package actions box
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 22:23:26 +02:00
Lukas Fleischer
4679e8ef5d Move package actions to the action box
Note that this currently only works if the virtual path feature is
enabled. If you don't use virtual paths, these will still be displayed
as buttons below the package details listing.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 22:22:09 +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
fc657af7f6 account_edit_form.php: Remove another stray "</div>"
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 17:55:59 +02:00
Lukas Fleischer
07d3649c2d pkg_details.php: Fix link to voters if ID is unset
When a package is requested by name, the "ID" request parameter might be
unset. Use the "ID" field of the query result instead.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-17 17:55:53 +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
799c1ead82 Redirect to the home page after successful login
Jump to the home page instead of displaying a page that only tells you
that you're logged in.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 22:48:33 +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
a03c684ecd Use absolute URIs for style sheets and images
This is needed for our new URI scheme, since we will use virtual
directories, such as "/packages/" instead of "/packages.php" etc.

Having relative URIs results in incorrect paths, such as
"/packages/css/aur.css" (instead of "/css/aur.css").

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 22:42:45 +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
canyonknight
1fd559151b aur.inc.php: Use delete_session_id() where appropriate
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-14 22:19:52 +02:00
canyonknight
50e97446bb acctfuncs.inc.php: Make user_suspended() work correctly
Fixes broken account suspension system.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-14 22:18:58 +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
8201dead3b pkgsubmit.php: Remove stray "</div>" tag
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-11 19:26:30 +02:00
Lukas Fleischer
44b857a98c pkg_details.php: Move "<div>" tag into if-branch
The corresponding closing "</div>" tag is only printed if the if-branch
is taken, which results in broken HTML code if the if-branch is skipped.
Move the "<div>" tag so that either both or none of the tags are
included in the generated HTML code.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-09 20:36:53 +02:00
Lukas Fleischer
6f7de5c818 pkg_details.php: Fix dependency links
Remove an erroneous quote from the destination URL of links to
officially supported package dependencies on archweb.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-09 20:28:53 +02:00
Lukas Fleischer
a5f1fb66fc Update archweb stylesheet
Pull in the latest changes from the archweb Git repository.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-09 13:10:35 +02:00
Lukas Fleischer
a64f23ff94 Remove legacy CSS
We completely switched to using the archweb stylesheet (with some custom
extensions in "aur.css"). The old CSS files are no longer needed.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-08 10:32:40 +02:00
Lukas Fleischer
8a5adf46ae acctfuncs.inc.php: Fix "Undefined variable" notices
Initialize the "$details" and "$whovoted" variables with an empty
array/string to suppress a "Undefined variable" notice if the
votes/voters list is empty.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-08 10:31:18 +02:00
canyonknight
c1bb1df2b3 acctfuncs.inc.php: Move XHTML to account_details.php template
XHTML should be eliminated from lib/ as much as possible. This pulls the XHTML
out of the display_account_info function that echoes the code, and moves it
to the new account_details.php template file.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:27:16 +02:00
canyonknight
b5ffdeb63e pkgsubmit.php: Improve file upload error messages
* Currently, $_FILES showing a filesize of zero is interpreted as no file was
uploaded, despite other errors potentially being the cause.
* The $_FILES superglobal stores what the actual error was, so use it. This
includes file write problems, empty uploads, partial uploads, and
upload_max_filesize being exceeded.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:27:14 +02:00
canyonknight
5ebf9d64ee aur.inc.php: Remove old and unused make_seed function
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:27:12 +02:00
canyonknight
d8d36d6f4b acctfuncs.inc.php: Make user_is_privileged() work
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:27:11 +02:00