summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc.php
AgeCommit message (Collapse)AuthorFilesLines
2014-05-06Add a packager field to packagesLukas Fleischer1-1/+1
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-01Fix vote/notify link on the package details pageLukas Fleischer1-5/+6
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-04-26Support multiple licenses per packageLukas Fleischer1-7/+74
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-26Display package groups on the details pageLukas Fleischer1-0/+26
The groups field is hidden if a package doesn't belong to any group. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-26Store package groups in the databaseLukas Fleischer1-0/+43
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-26Display package relations on the details pageLukas Fleischer1-0/+28
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-26Store conflicts, provides and replaces in the DBLukas Fleischer1-0/+36
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-17Display dependency type of package dependenciesLukas Fleischer1-1/+42
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-17Store {make,check,opt}depends in the databaseLukas Fleischer1-6/+23
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-05Refactor pkgbase_comments()Lukas Fleischer1-1/+2
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05Fix searching by categoryLukas Fleischer1-1/+1
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05pkgfuncs.inc.php: Remove several unused functionsLukas Fleischer1-54/+0
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05Split out package base functionsLukas Fleischer1-967/+1
Move functions operating on package bases to a separate file. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05Prefix package functions with pkg_/pkgbase_Lukas Fleischer1-44/+44
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05Use snake case for all package functionsLukas Fleischer1-7/+7
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05Move package actions to package basesLukas Fleischer1-32/+32
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-05Allow for searching by package base nameLukas Fleischer1-1/+10
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05Add package base detail pagesLukas Fleischer1-0/+84
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-05Add full support for the new .AURINFO formatLukas Fleischer1-0/+27
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-05Make the delete function remove package basesLukas Fleischer1-28/+54
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-05Store comments on a per-package base basisLukas Fleischer1-39/+40
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-05Add provisional support for package basesLukas Fleischer1-76/+153
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-02-10Set Content-type header when sending UTF-8 mailsLukas Fleischer1-3/+9
Fixes FS#38568. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-10Use CRLF to separate headers in mail()Lukas Fleischer1-3/+12
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-09Remove LastVoted columnLukas Fleischer1-6/+0
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-06Simplify canDeleteComment()Lukas Fleischer1-10/+10
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-06pkgfuncs.inc.php: Fix comment styleLukas Fleischer1-52/+56
* 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-06Style fixes: Capitalization of "true" and "false"Lukas Fleischer1-9/+9
Use "true" instead of "TRUE" and "false" instead of "FALSE" or "False". Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-06Do not allow unauthenticated users to delete commentsLukas Fleischer1-1/+8
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-04Add support for anonymous commentsLukas Fleischer1-5/+5
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-01-22Further optimize voters.php to only need the package namecanyonknight1-5/+6
* Extends changes in 81d4cc13dcae2f159ed937d4ce41e1df7d3c82b0 * 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>
2013-08-27Move package comment check to packages.phpLukas Fleischer1-4/+0
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-27Add boolean return values to several pkg_*() functionsLukas Fleischer1-42/+42
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-03-19Fix typo in delete permission warningConnor Behan1-1/+1
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-02-10Remove checks before calling connection methodcanyonknight1-108/+36
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-10Remove documentation references to database parametercanyonknight1-24/+0
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-02-10Remove unnecessary database connection parameter from all functionscanyonknight1-54/+54
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-10Add database wrapper class and new connection methodcanyonknight1-36/+36
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-01-19Add description meta-element to package pagesMarcel Korpel1-30/+51
Implements FS#33294 Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-12-07Split package flagging and unflagging into separate functionscanyonknight@gmail.com1-31/+43
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-11-15pkgfuncs.inc.php: Rework query to avoid "Required by" duplicatescanyonknight1-1/+1
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-04Avoid double slashes in notificationsLukas Fleischer1-3/+3
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-10-11pkgfuncs.inc.php: Fix blacklisting functionalitycanyonknight1-1/+1
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 e171f6f34eeacf35cf7142b4788d43e7d0978546 Fixes FS#31867 Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-04pkgfuncs.inc.php: Document all functions using PHPDoc formatcanyonknight1-40/+263
Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-03Do not notify if status is unchanged in pkg_flag()Lukas Fleischer1-2/+6
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-03pkgfuncs.inc.php: Fix undefined variable noticeLukas Fleischer1-0/+1
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-09-20Remove unused pkgnotify_from_sid functioncanyonknight1-23/+0
Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-20Remove unused canManagePackage() functioncanyonknight1-22/+0
Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-19Sync search result statistics with archwebLukas Fleischer1-6/+0
* 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-18Fix category selectionLukas Fleischer1-9/+1
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>