Commit graph

88 commits

Author SHA1 Message Date
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
Lukas Fleischer
5415bc945a Refactor pkgbase_comments()
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 19:52:51 +02:00
Lukas Fleischer
724a737815 Fix searching by category
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 17:42:19 +02:00
Lukas Fleischer
434b04e826 pkgfuncs.inc.php: Remove several unused functions
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 16:02:20 +02:00
Lukas Fleischer
ee1048b268 Split out package base functions
Move functions operating on package bases to a separate file.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 15:58:44 +02:00
Lukas Fleischer
676595f9bf Prefix package functions with pkg_/pkgbase_
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 15:55:31 +02:00
Lukas Fleischer
d16f7cf712 Use snake case for all package functions
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 15:54:21 +02:00
Lukas Fleischer
f461344211 Move package actions to package bases
Package actions now operate on package bases instead of packages. Move
all actions to the correct locations.

This also fixes some issues with comment notifications.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 13:54:06 +02:00
Lukas Fleischer
c1c77836a8 Allow for searching by package base name
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 13:51:28 +02:00
Lukas Fleischer
f7d13b5b36 Add package base detail pages
This adds package base details pages, similar to the package details
pages. Each package base details page contains general information
(package base name, category, submitter, maintainer, ...) and links to
all the corresponding packages. As on the package details pages,
comments and links to several package actions are also provided.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 12:21:36 +02:00
Lukas Fleischer
fb81bfd8df Add full support for the new .AURINFO format
This adds full support for the new .AURINFO format used by mkaurball,
including support for split packages.

The old PKGBUILD parser is still available for compatibility reasons.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 12:21:36 +02:00
Lukas Fleischer
b558572a2e Make the delete function remove package bases
Deleting a single package without deleting the whole package base makes
no sense. Comments and votes are already stored on a per-package basis,
making this a straightforward extension.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 12:21:36 +02:00
Lukas Fleischer
d35cf67f7b Store comments on a per-package base basis
Move comments from the Packages table to PackageBases. Sharing comments
makes sense since they almost always refer to a source package.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 12:21:35 +02:00
Lukas Fleischer
b7941073ac Add provisional support for package bases
This adds a PackageBases table to the database schema and moves the
following fields from the Packages table to PackageBases:

* CategoryID
* NumVotes
* OutOfDateTS
* SubmittedTS
* ModifiedTS
* SubmitterUID
* MaintainerUID

It also fixes all database accesses to comply with the new layout.

Having a separate PackageBases table is the first step to split package
support. By now, we create one PackageBases entry per package (where the
package base has the same name as the corresponding package). When
adding full support for split packages later, the package base name will
be derived from the pkgbase variable and a single package base will be
shared amongst all packages built from one source package.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 12:21:35 +02:00
Lukas Fleischer
94a4f597ff Set Content-type header when sending UTF-8 mails
Fixes FS#38568.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-10 21:00:36 +01:00
Lukas Fleischer
16c3a86193 Use CRLF to separate headers in mail()
This is the correct delimiter for mail headers according to the PHP
documentation and RFC 2822.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-10 20:48:34 +01:00
Lukas Fleischer
8c07c091e8 Remove LastVoted column
This has been introduced by commit aae43d9 (started working on package
comments, 2005-03-05) but it seems to be of no practical use. Remove the
field to save some space.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-09 01:43:37 +01:00
Lukas Fleischer
c09dcc4e98 Simplify canDeleteComment()
Use COUNT(*) instead of COUNT(ID) and PDO::FETCH_NUM instead of
PDO::FETCH_ASSOC. This also includes some minor formatting fixes.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-06 18:59:40 +01:00
Lukas Fleischer
3f0a1a827a pkgfuncs.inc.php: Fix comment style
* Use C-style comments (/* */) instead of # or //.
* Remove some superfluous comments and slightly reword others.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-06 18:59:40 +01:00
Lukas Fleischer
165bcba54e Style fixes: Capitalization of "true" and "false"
Use "true" instead of "TRUE" and "false" instead of "FALSE" or "False".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-06 16:32:31 +01:00
Lukas Fleischer
b8a31dcc72 Do not allow unauthenticated users to delete comments
Since commit fb7bde3 (Add support for anonymous comments, 2014-02-04),
we support comments with no specific author. Add a check to
canDeleteComment() and canDeleteCommentArray() to ensure an
unauthenticated user cannot delete such comments.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-06 16:28:33 +01:00
Lukas Fleischer
fb7bde3a6c Add support for anonymous comments
This allows for removing users without also removing the corresponding
comments. Instead, all comments from deleted users will be displayed as
"Anonymous comment".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-04 18:48:23 +01:00
canyonknight
1e9d539acf Further optimize voters.php to only need the package name
* Extends changes in 81d4cc13dc
* Modify getvotes() to use the package name rather than package ID
* Rename getvotes() to votes_for_pkgname() for clarity with new changes
* Modify routing framework and links to now use package names for voters.php

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-01-22 18:27:42 +01:00
Lukas Fleischer
c1c7f9b350 Move package comment check to packages.php
Checking whether to add a comment is something that really does not
belong to a function named display_package_details().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-08-27 11:35:26 +02:00
Lukas Fleischer
23867a211c Add boolean return values to several pkg_*() functions
Change the return values of following functions to return both
error/success and an error/success message:

* pkg_flag()
* pkg_unflag()
* pkg_adopt()
* pkg_vote()
* pkg_delete()
* pkg_notify()
* pkg_delete_comment()
* pkg_change_category()

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-08-27 11:19:45 +02:00
Connor Behan
a386bbd35d Fix typo in delete permission warning
Signed-off-by: Connor Behan <connor.behan@gmail.com>
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-03-19 13:50:45 +01:00
canyonknight
cf2ab50b82 Remove checks before calling connection method
Large amount of boilerplate code that checks if a database
connection exists is useless now that the new connection method
automatically does the same check.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-02-10 12:10:38 +01:00
canyonknight
4235d24039 Remove documentation references to database parameter
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-02-10 12:10:38 +01:00
canyonknight
8d6c872297 Remove unnecessary database connection parameter from all functions
All functions now have a database connection method that will use
the same database connection. This imitates the functionality of
passing a database connection as an argument and makes it redundant.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-02-10 12:10:38 +01:00
canyonknight
8e03e68d68 Add database wrapper class and new connection method
Uses the Singleton pattern to ensure all queries use the same
database connection that is released upon script completion.

All database connections should now be called with DB::connect() and
not db_connect().

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-02-10 12:10:37 +01:00
Marcel Korpel
8e1051932e Add description meta-element to package pages
Implements FS#33294

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-01-19 12:18:13 +01:00
canyonknight@gmail.com
20407bb8c6 Split package flagging and unflagging into separate functions
Currently, package flagging and unflagging takes place within the
pkg_flag() function. A bool is set to true or false depending on the
action.

Create new pkg_unflag() function with sole purpose of unflagging
and keep pkg_flag() in place. This split will be useful in the
overhaul of the notification system.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-12-07 23:24:11 +01:00
canyonknight
16a20693be pkgfuncs.inc.php: Rework query to avoid "Required by" duplicates
Packages with multiple DepConditions are returned multiple
times in the "Required by" column.

Limit SQL results to distinct packages.

Fixes FS#32478

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-11-15 20:03:33 +01:00
Lukas Fleischer
f190a84577 Avoid double slashes in notifications
Both get_pkg_uri() and get_user_uri() should always return root-relative
URLs -- do not prepend another "/".

Fixes FS#32460.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-11-04 19:19:22 +01:00
canyonknight
f3325ce66f pkgfuncs.inc.php: Fix blacklisting functionality
An array that contains whether the package is blacklisted is
being improperly used for a comparison. Use fetchColumn() to
avoid the array completely and compare a value directly.

Regression with e171f6f34e

Fixes FS#31867

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-11 21:19:16 +02:00
canyonknight
49864b9667 pkgfuncs.inc.php: Document all functions using PHPDoc format
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-04 01:47:00 +02:00
Lukas Fleischer
e9ed60566e Do not notify if status is unchanged in pkg_flag()
Check if a package actually changed its status before sending an email
to prevent from spamming. Addresses FS#31745.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-03 00:21:21 +02:00
Lukas Fleischer
e2f3bee01e pkgfuncs.inc.php: Fix undefined variable notice
Fixes a undefined variable notice in getvotes() that popped up when a
package without any votes was requested.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-03 00:21:21 +02:00