Commit graph

1922 commits

Author SHA1 Message Date
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
2c20403cc4 git-update: Use proper stop value for slice
Fixes a regression introduced in 4112e57 (Add a restore command to the
SSH interface, 2015-08-14).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-16 22:10:06 +02:00
Lukas Fleischer
34e7f7084a Transfer notifications when merging packages
When a package base is merged into another one, followers of the old
package base usually want to be notified about comments the new package
base as well.

Fixes FS#27687.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-16 22:05:40 +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
209b0b6eda Mitigate JSONP callback vulnerabilities
The callback parameter of the RPC interface currently allows for
specifying a prefix of arbitrary length of the returned result. This can
be exploited by certain attacks.

As a countermeasure, this patch restricts the allowed character set for
the callback name to letters, digits, underscores, parenthesis and dots.
It also limits the length of the name to 128 characters. Furthermore,
the reflected callback name is now always prepended with "/**/", which
is a common workaround to protect against attacks such as Rosetta Flash.

Fixes FS#46259.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-12 10:20:03 +02:00
Lukas Fleischer
ee9a8f232b Allow for logging in via email address
Accept both user names and email addresses in the login prompt.

Suggested-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-11 22:18:31 +02:00
Lukas Fleischer
c5014b0752 Remove superfluous function valid_user()
This helper function was almost 100% identical to uid_from_username().
Switch to using uid_from_username(), which has a much better name and
implementation, everywhere.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-11 22:14:28 +02:00
Lukas Fleischer
396e50bdc8 Require comments when flagging packages out-of-date
Implements FS#42827.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-11 22:14:26 +02:00
Lukas Fleischer
6b7e26a2d1 Move package base flagging to a separate form
Show a separate confirmation page when flagging a package out-of-date.

Implements FS#44967.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-11 22:11:52 +02:00
Lukas Fleischer
209879d63f Fix duplicate escaping of action links
The __() helper function already escapes HTML special characters. Do not
escape them again in html_action_*().

Fixes FS#45780.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-31 18:04:50 +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
Lukas Fleischer
e1a258bd83 Remember user ID when flagging package bases
Add a new FlaggerUID field to the database and use it to store the user
ID of the account who recently flagged a package out-of-date.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-30 16:44:12 +02:00
Marcel Korpel
57250a1641 updates_table.php: Fix identification of new packages
Currently, package creation has to be done separately from first
submission, so ModifiedTS will never be the same as SubmittedTS.
Consider all packages that are submitted within an hour from package
creation as new.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-19 09:49:28 +02:00
Marcel Korpel
e1f6de68a2 account_edit_form.php: Warn users to correctly enter their email address
Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-19 09:48:10 +02:00
Stefan Auditor
e9e9b41484 Update link to package submission documentation
Fixes FS#45942.

Signed-off-by: Stefan Auditor <stefan.auditor@erdfisch.de>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-17 04:20:45 +02:00
Stefan Auditor
85b54157ea Display sources count on package details page
Show item count on sources section just like it is done for
dependencies and required by.

Fixes FS#45881.

Signed-off-by: Stefan Auditor <stefan.auditor@erdfisch.de>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-17 04:20:45 +02:00
Marcel Korpel
095986b449 Do not allow empty comments
Fixes FS#45870.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-17 04:20:45 +02:00
Marcel Korpel
60433a930d Remove success message from comment form
To be more flexible with messages, we shouldn't always output this
message when a comment has been sent. Moreover, currently it is not
displayed due to the POST-Redirect-GET pattern, where the comment
parameter is lost after redirection.

Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-17 04:20:45 +02:00
Stefan Auditor
ff659fa05c Remove trailing slash from git urls
Circumvents the temporary regression in git that clones a repository
as foo-git.git instead of foo-git and matches the format used by
other commonly used git hosting providers.

Fixes FS#45834.

Signed-off-by: Stefan Auditor <stefan.auditor@erdfisch.de>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-16 21:37:51 +02:00
Stefan Auditor
7eaab63216 Update translation documentation
Update the link to the project page on Transifex and remove an outdated link
to the Arch Wiki.

Fixes FS#45966.

Signed-off-by: Stefan Auditor <stefan.auditor@erdfisch.de>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-16 21:35:31 +02:00
Lukas Fleischer
4112e572aa Add a restore command to the SSH interface
Implement a new command that can be used to restore deleted package
bases without having to push a new commit.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-16 06:49:12 +02:00
Lukas Fleischer
da875276d4 git-update: Add comments
Add some comments to explain the major steps performed in the update
hook.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-14 12:52:32 +02:00
Lukas Fleischer
80e06e5fc3 git-update: Remove superfluous assignment
The pkgbase variable already contains the package base name at this
point, no need to reassign it.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-14 12:50:35 +02:00
Lukas Fleischer
4bc6c55d98 git-update: Move blacklist reading further down
Since c4870a9 (git-update: Only check HEAD for blacklisted packages,
2015-06-04), only the HEAD commit package name is looked up in the
blacklist. This means that we no longer need to read the blacklist
before running the commit walker. Moving the blacklist reading code
further down makes the code easier to read.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-14 12:45:36 +02:00
Johannes Löthberg
da1153857f rpc: msearch: Give orphans on empty maintainer argument
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-11 13:57:04 +02:00
Lukas Fleischer
e8a6fe1efc Document the Git/SSH interface
Add a document describing how the Git/SSH interface works internally.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Lukas Fleischer
ab25775259 Move documentation to a subdirectory
Create a new subdirectory doc/ that contains documentation.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Lukas Fleischer
080b6f3d12 aurjson.class.php: Add missing PHPDoc
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:24 +02:00
Marcel Korpel
54d812ec79 pkg_comments.php: Add JavaScript function to edit comments
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
8328223a5e aurjson.class.php: Add method get_comment_form()
This method will be used by the JavaScript comment editing and produces
a form containing the comment.

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
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
Marcel Korpel
41b6cff7c0 pkg_comments.php: Merge two DIVs with same ID
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
c751921aff Do not use the term "unsupported" for AUR packages
We no longer use the term [unsupported] to refer to the "repository" of
AUR packages. Update texts and variable names accordingly.

Fixes FS#45381.

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
8db2ff5da6 Set correct 'My Account' link after changing username
Don't print messages (and the account form) in process_account_form()
anymore, but return them to the caller. When updating accounts, this
function will be called before the headers are written.

If a username has been changed by process_account_form(), the headers
now show the updated username from the database in the 'My Account'
link. Clicking on it immediately after changing a username will no
longer lead to a non-existing URL.

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
cb9c0d2477 Surround message with <p> tags
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
7927a6decd Use username from the database if one is provided by the user
This fixes a bug where the new user name input by the user was
invalid, causing the account deletion link and the form action to be
wrong.

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
f2ff9782a5 Jump to latest comments after adding a comment
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
19aff5f958 Jump to comment after editing
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
67cff2cd5a Add IDs to comments
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
4c5a299e80 Only autofocus search field on the package search page
This needs to be disabled on package pages to be able to add a URL
fragment after comment editing.

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
9cde6b0566 Show dateline when a comment is edited or deleted
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
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
Marcel Korpel
8375d21210 Use SVG image for comment deletion icon
This also puts the icon to the right and the timestamp in the byline
and wipes out a repeated instance of the byline.

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
Marcel Korpel
4ca8747396 Remove superfluous close tags
These are already output by html_action_link.

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
Johannes Löthberg
828506e868 Reindent web/html/packages with tabs
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:23 +02:00