Commit graph

125 commits

Author SHA1 Message Date
Lukas Fleischer
938b1058eb pkgfuncs.inc.php: Squelch PHP warning
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-25 08:35:44 +02:00
Marcel Korpel
4516f07d9c Add search for keywords only
Implements FS#45619.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-23 21:45:47 +02:00
Lukas Fleischer
f3ec4d1ef5 Rename "Age" search order to "Last modified"
Use a better description for sorting by modification time, as it is not
clear whether "Age" refers to the package creation date or to the
modification date.

The possibility to sort by "Age" is kept internally (but hidden from the
user interface) such that old links to search results still work.

Fixes FS#46319.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-20 11:09:47 +02:00
Lukas Fleischer
9cae17ff7c Extract package name from details
When requesting package details, instead of performing another SQL query
to obtain the package name, extract the name from the result of the
package details query.

Also, drop pkg_name_from_id() which is no longer needed after this
optimization.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-18 08:03:56 +02:00
Lukas Fleischer
0dd27a86b1 Remove legacy code
In 74edb6f (Use Git repositories to store packages, 2014-06-06), package
creation was moved to the Python backend. Remove several PHP functions
that are no longer needed.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-18 07:55:50 +02:00
Lukas Fleischer
9d2d8f1c8c Honor virtual provisions in package requirements
Implements FS#14125.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-17 23:04:58 +02:00
Lukas Fleischer
dd808ac802 Use a separate function for "Required by" links
Do not use the same function for generating dependency and inverse
dependency links. Instead, factor out common code and create two
separate functions for those (rather different) functionalities.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-17 19:06:18 +02:00
Lukas Fleischer
f9476c1093 Show providers in dependencies
For all "virtual provisions" in package dependencies, show links to the
actual packages providing the dependency.

This partly implements FS#14125.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-16 22:00:04 +02:00
Lukas Fleischer
57db4814a4 Allow users to unflag packages they flagged themselves
Sometimes, a user accidentally flags a package out-of-date. Allow users
to unflag packages that they flagged themselves, thereby providing a way
to undo these actions.

Implements FS#46145.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-30 16:51:14 +02:00
Marcel Korpel
c7025054c6 Split pkg_comment_form.php so the outer box is not always included
For use in the new RPC interface to edit comments, the form shouldn't
always print a header. Create a new template pkg_comment_box.php that
prints form and box, change template pkg_comment_form.php to only
print the form.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Lukas Fleischer
e610360c95 Show popularity in package base details
Fixes FS#45600.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Marcel Korpel
e331ce273c Support comment editing in the backend
Create two new actions, do_AddComment and do_EditComment. When editing
or deleting a comment, a timestamp is added.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Marcel Korpel
92e19e95f3 Add comment edit icon and form
Show an icon next to the comment deletion icon, which leads to a
comment edit form.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:23 +02:00
Lukas Fleischer
d1c331613d Display (reverse) optional dependencies as "Required by"
Also, change pkg_required() such that the returned array has the same
structure as the result of pkg_dependencies().

Fixes FS#45452.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Lukas Fleischer
2d7b68ac4c Remove can_submit_blacklisted()
This function is unneeded since commit 74edb6f (Use Git repositories to
store packages, 2014-06-06).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-19 16:52:07 +02:00
Lukas Fleischer
5fb7a74e23 Replace categories with keywords
Remove package base categories. Instead, users can now specify up to
twenty custom keywords that are taken into consideration when searching.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-14 17:58:55 +02:00
Lukas Fleischer
15ee85b456 Show package popularity in search results
Display the popularity score (weighted votes) in the package search
results.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-11 19:15:44 +02:00
Lukas Fleischer
08cdc5ca64 Invert order when sorting packages by age
Fixes FS#44195.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-09 09:22:46 +02:00
Lukas Fleischer
5c64ae1a0e Drop suffixes from confirm parameters
Remove the _delete and _disown suffixes from HTTP POST confirmation
parameters.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-09 09:05:05 +02:00
Lukas Fleischer
8aa4c51dfb Fix searching for an empty string
Return all packages when an empty search term is used with keyword
search.

Reported-by: G. Schlisio <g.schlisio@dukun.de>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 21:35:52 +02:00
Lukas Fleischer
643dae80eb pkgfuncs.inc.php: Remove a conflict marker
Remove a Git conflict marker that was added accidentally in 74edb6f (Use
Git repositories to store packages, 2014-06-06).

Reported-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-04 11:24:56 +02:00
Lukas Fleischer
2db1a55922 Support boolean operators in search queries
This adds very basic support for boolean search queries such as "video
or movie" or "lin and not linux". However, nested queries such as
"(video or movie) and editing" are not (yet) supported.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-22 17:09:26 +02:00
Lukas Fleischer
0f48341ed6 Do not allow more than 20 terms in search queries
Specifying a huge number of search terms currently results in complex
SQL queries. In practice, queries with more than 20 terms are rarely
needed. Ignore everything apart from the first 20 keywords to prevent
from potential abuse.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-22 17:09:25 +02:00
Lukas Fleischer
20b838a90c Use keyword search by default
Change the default search mode such that packages that contain all of
the space-separated search terms are returned. For example, the query

    image edit "command line"

returns all packages where "image", "edit" and "command line" occurs in
the package name or description. This is much more convenient and
general than a simple substring search (one can still perform a
substring search by quoting the whole search term).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-22 13:08:06 +02:00
Lukas Fleischer
d1df490370 Hide fresh package bases from stats and results
Do not show package bases that have just been created in the package
update statistics or in the search results.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-12-28 17:44:25 +01:00
Lukas Fleischer
74edb6fea9 Use Git repositories to store packages
* Remove package submission page from the web interface.
* Replace PKGBUILD and tarball links with links to cgit.
* Remove the "URLPath" field from RPC replies.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-12-27 12:42:12 +01:00
Lukas Fleischer
571b74b901 Always use virtual URLs
Support for non-virtual URLs has been broken for a long time and is no
longer used on the official AUR setup.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-11-21 11:43:31 +01:00
Lukas Fleischer
76343fb915 Use an INI-style configuration file
Replace web/lib/config.inc.php with an INI-style configuration file.
This allows us to get rid of several globals and makes it easier to use
the same configuration file in external scripts.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-10-24 10:03:54 +02:00
Lukas Fleischer
a1bee1a21e Add support for architecture-specific sources
As a follow-up to 4d7da95 (Add support for architecture-specific fields,
2014-08-10), handle architecture-specific source fields as well.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-10-10 12:29:18 +02:00
Lukas Fleischer
4d7da95906 Add support for architecture-specific fields
This adds support for architecture-specific dependencies and relations.
Support for this has recently been added to makepkg, see commit 2b556d8
(PKGBUILD: handle arch specific attributes, 2014-07-25) in the pacman
repository for details.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-08-10 12:32:46 +02:00
Lukas Fleischer
d136d7c874 Allow users to delete their own comments
Fixes a regression introduced in 03c6304 (Rework permission handling,
2014-07-15). Fixes FS#41379.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-07-29 15:17:58 +02:00
Lukas Fleischer
daceef50eb Make deleted comments visible to Trusted Users
This allows Trusted Users to check whether a user posted a politically
incorrect comment, even if he already deleted it.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-07-25 11:30:32 +02:00
Lukas Fleischer
f8343e5a68 Remove unused function pkg_details_by_name()
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-07-16 10:33:01 +02: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
Lukas Fleischer
111d836912 Display number of pending requests in actions box
For packages with pending package requests, display the number of
requests above the "File Request" link.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-07-04 12:28:12 +02:00
Lukas Fleischer
cf4ea0171e Simplify code to bound integer values
Suggested-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-07-01 19:46:16 +02:00
Lukas Fleischer
43f5167f75 Fix latest_pkgs() again
In 4cd6841 (pkgfuncs.inc.php: Fix latest_pkgs(), 2014-05-29),
latest_pkgs() was modified to work with the new database layout.
However, since all columns were selected, package names have been
overwritten by package base names since that change. Qualify the
*-shorthand to avoid this.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-06-07 05:24:11 +02:00
Lukas Fleischer
26a0919937 Fix SQL query when searching for a missing submitter
uid_from_username() returns a non-integer value when the user does not
exist. This results in a broken SQL query when searching for a
nonexistent submitter. Fix this by explicitly converting the result of
uid_from_username() to an integer.

Fixes FS#40625.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-06-05 15:12:10 +02:00
Lukas Fleischer
b1c754300a Fix links to AUR packages in optional dependencies
Extend the SQL query that tries to find a package's dependencies so that
optional dependencies with a description are correctly resolved.

Fixes FS#40700.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-06-05 15:12:10 +02:00
Lukas Fleischer
4cd6841541 pkgfuncs.inc.php: Fix latest_pkgs()
This fixes a regression introduced when adding split package support and
makes the RSS feed work again.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-05-29 21:19:06 +02:00
Lukas Fleischer
44268778c8 Move latest_pkgs() to pkgfuncs.inc.php
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-05-29 21:13:45 +02:00
Lukas Fleischer
a93363ac08 Add a packager field to packages
Store the last packager in addition to storing the submitter and the
maintainer of a package. This allows for checking who last updated a
package, even if the package has been disowned.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-05-06 20:52:32 +02:00
Lukas Fleischer
e161c4f94b Fix vote/notify link on the package details page
Call pkgbase_user_voted() and pkgbase_user_notify() using the package
base ID instead of using the package ID.

Fixes FS#40165.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-05-01 09:29:55 +02:00
Lukas Fleischer
9553790cfc Support multiple licenses per package
Split out package licenses into two separate tables in order to support
multiple licenses per package. The code on the package details page is
adjusted accordingly.

UPGRADING contains instructions on how to convert existing licenses in
the database to the new layout.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-26 14:48:19 +02:00
Lukas Fleischer
38eb8d2a3a Display package groups on the details page
The groups field is hidden if a package doesn't belong to any group.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-26 14:21:55 +02:00
Lukas Fleischer
cc3244ea8a Store package groups in the database
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-26 14:07:20 +02:00
Lukas Fleischer
3720bdf6b2 Display package relations on the details page
This adds information from the following three fields to the package
details page:

* conflicts
* provides
* replaces

If either of these fields is empty, it is not displayed.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-26 13:34:17 +02:00
Lukas Fleischer
92812050a0 Store conflicts, provides and replaces in the DB
Package conflicts, provides and replaces are now stored in the new
PackageRelations table. The gendummydata script generates test entries
for these relations.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-26 13:20:56 +02:00
Lukas Fleischer
895907579e Display dependency type of package dependencies
This adds a label to makedepends, checkdepends and optdepends on the
package details page. makedepends are labelled with "(make)",
checkdepends with "(check)" and optdepends are labeled with
"(optional)", followed by the optdepend description.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-17 21:10:58 +02:00
Lukas Fleischer
73936002f7 Store {make,check,opt}depends in the database
In addition to parsing and storing dependencies of packages, store
makedepends, checkdepends and optdepends. Every dependency (of any type)
is displayed on the package details page.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-17 21:09:16 +02:00