Commit graph

2971 commits

Author SHA1 Message Date
Lukas Fleischer
132856a938 Unify function declaration style
Always put the opening brace on the same line as the beginning of the
function declaration.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-24 10:34:35 +01:00
Lukas Fleischer
985795a210 Add field for PGP key in profile information
This is handy for verifying the PGP key of new Trusted Users. Also, this
could potentially used as a basis to allow signed package uploads in the
future.

Implements FS#29028.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-24 10:34:32 +01:00
BlackEagle
0a1e1729d9 valid_email :: check if domain part is real
this can be used as an intermediate 'patch' util there is a validation
system in place.

the extra check is to verify that the domain part of a correctly
formatted email address is existing and in use. this will not at all
stop spammers since they can use bogus emails with valid domain parts

Lukas: Minor formatting changes.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-21 10:16:38 +01:00
Lukas Fleischer
1f36664e9f web/html/pkgsubmit.php: Revamp tarball validation
* Reorder checks.
* Use simple string functions instead of regular expressions.
* Check for type flags before validating paths.

The latter ensures we don't treat tarball keywords/flags as directories.
This avoids problems with bsdtar inserting PaxHeader attributes into the
archive which look something like the following to Archive_Tar:

    PaxHeader/xcursor-protozoa
    xcursor-protozoa/
    xcursor-protozoa/PaxHeader/PKGBUILD
    xcursor-protozoa/PKGBUILD

This only occurs on certain filesystems (e.g. jfs), but the tarball is
by no means invalid. When extracted, it will only contain the PKGBUILD
within a single subdirectory.

Addresses FS#28802.

Thanks-to: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-19 23:29:58 +01:00
Lukas Fleischer
1e29bd2217 Merge branch 'maint'
Conflicts:
	UPGRADING
	web/lib/config.inc.php.proto
2012-03-09 09:27:49 +01:00
Lukas Fleischer
bfb25807c4 Release 1.9.1
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-09 09:24:52 +01:00
Lukas Fleischer
d4272a6172 UPGRADING: Add release notes for 1.9.1
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-09 08:28:48 +01:00
Lukas Fleischer
172549d830 Replace "nb_NO" translation by "nb"
This one is not a specific dialect, so "nb" (Norwegian Bokmål) is the
better name to use here.

Thanks-to: Alexander Rødseth <rodseth@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-09 08:21:38 +01:00
Lukas Fleischer
4168eaa55e Replace "pt" translation by "pt_PT"
This makes the difference between Portuguese (Brazil) and Portuguese
(Portugal) a bit clearer. Also, "pt_PT" is way more up to date than
"pt".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-09 08:15:10 +01:00
Lukas Fleischer
89fb3d4500 Translation updates from Transifex
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-09 08:11:52 +01:00
Lukas Fleischer
f5e1652bf9 Always set the "To:" header when sending mail
Use "undisclosed-recipients: ;" when sending mass notifications (such as
comment notifications and the like. Addresses FS#28229.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-08 11:43:48 +01:00
Lukas Fleischer
a774b3d355 Merge branch 'maint' 2012-02-19 16:41:47 +01:00
Lukas Fleischer
19789c3f75 Escape all output strings in the header and footer
Escape each output string using htmlspecialchars(). These aren't
exploitable; it's still better to escape them properly.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-02-19 05:21:48 +01:00
Lukas Fleischer
6f6904db3f Fix some more XSS vulnerabilities
Escape strings properly using htmlspecialchars(). Seems like we missed
these in former cleanups. Fixes FS#28515.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-02-19 04:48:31 +01:00
Andrea Scarpino
7cb89be81f Set the title in the Trusted User page
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-12-17 14:53:56 +01:00
Lukas Fleischer
0557f7705a RPC: Do not return an error on 0 results
Return an empty array and set the result count to zero instead.

Before:

    $ curl 'http://localhost/rpc.php?type=search&arg=raboof'
    {"type":"error","resultcount":0,"results":"No results found"}

After:

    $ curl 'http://localhost/rpc.php?type=search&arg=raboof'
    {"type":"search","resultcount":0,"results":[]}

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-11-03 08:48:20 +01:00
Dave Reisner
168a51431b aurjson: add result count to JSON result
We already ask for the result count, but only use it as a basis for testing
query success or failure. Add the value to the JSON reply.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-11-02 21:21:23 +01:00
Alexander Rødseth
9415e078a3 web/README: Update instructions
Signed-off-by: Alexander Rødseth <rodseth@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-11-02 21:21:23 +01:00
Dan McGee
e571a694d6 Add a new AUR_LOCATION setting
This should be set to something like 'http://localhost' for development
or 'https://aur.archlinux.org' in production. It ensures all links in
the site stay in the development site and there is no sudden jump from
development to production environments.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-11-02 21:21:23 +01:00
Lukas Fleischer
fe90b4bc3e Merge branch 'maint' 2011-10-25 09:31:13 +02:00
Lukas Fleischer
e53b91fe52 Escape wildcards in "LIKE" patterns
Percent signs ("%") and underscores ("_") are not escaped by
mysql_real_escape_string() and are interpreted as wildcards if combined
with "LIKE". Write a wrapper function db_escape_like() and use it where
appropriate.

Note that we already fixed this for the RPC interface in commit
da2ebb667b but missed the other places.
This patch should fix all remaining flaws reported in FS#26527.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-25 09:25:43 +02:00
Lukas Fleischer
10b6a8fff7 Wrap mysql_real_escape_string() in a function
Wrap mysql_real_escape_string() in a wrapper function db_escape_string()
to ease porting to other databases, and as another step to pulling more
of the database code into a central location.

This is a rebased version of a patch by elij submitted about half a year
ago.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>

Conflicts:

	web/lib/aur.inc.php
2011-10-25 09:25:30 +02:00
Lukas Fleischer
47c5167acb Escape wildcards in "LIKE" patterns
Percent signs ("%") and underscores ("_") are not escaped by
mysql_real_escape_string() and are interpreted as wildcards if combined
with "LIKE". Write a wrapper function db_escape_like() and use it where
appropriate.

Note that we already fixed this for the RPC interface in commit
da2ebb667b but missed the other places.
This patch should fix all remaining flaws reported in FS#26527.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-24 17:57:54 +02:00
Lukas Fleischer
323d418f02 Wrap mysql_real_escape_string() in a function
Wrap mysql_real_escape_string() in a wrapper function db_escape_string()
to ease porting to other databases, and as another step to pulling more
of the database code into a central location.

This is a rebased version of a patch by elij submitted about half a year
ago.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:54 +02:00
Florian Pritz
54d5dcc6e8 send emails when delteing packages
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:54 +02:00
Dan McGee
c7a9c2f3d3 Show last voted date on account details page
We already show it in the account listing page as well, so we should
show it here too.

Also use a standard date format; we weren't using this non-punctuated
format anywhere else.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:53 +02:00
Dan McGee
a21739aae5 Add LastLogin column to Users table
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:53 +02:00
Dan McGee
e6ecdcc835 Require DB handle for most user account functions
This affects login the most, where we save about 4 calls to db_connect()
by passing a single handle into functions where necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:53 +02:00
Dan McGee
8dc7b37909 Remove a boatload of inline table styles
Replacing with CSS styles where appropriate. A previously unused CSS
style is tweaked in the stylesheet to match most of what was done via
non-CSS styling.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:52 +02:00
Dan McGee
10355ec959 Remove explicit utf8 declarations in table creation
The create database statement sets the default character set of the
database to UTF-8, so no need to do it down below.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:52 +02:00
Dan McGee
99a2bb81cf aurblup: update for pacman 4 revised libalpm API
Notable changes include the necessary handle object and the splitting
of provides and replaces into alpm_depend_t objects.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:52 +02:00
Dan McGee
d20f90ead3 aurblup: remove use of alpm_list_getdata()
This is not strictly necessry as listitem->data is public.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:51 +02:00
Dan McGee
156bfbddb9 aurblup: style cleanups
Always use two lines for if statements, use a character constant rather
than the 0 integer when NULL-terminating a string, and remove the
unnecessary NULL check before free(value)- free(NULL) is a no-op and
always safe.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:51 +02:00
Dan McGee
f5736ace65 aurblup: remove ';' from queries
The semicolons are not necessary when performing queries via the MySQL
API, so remove them.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:51 +02:00
Dan McGee
bd361242f9 Move SUPPORTED_LANGS out of config.inc.php
This has no real business being here, and is a pain to update when new
languages are shipped. Move it and the set_lang() function to
translator.inc.php instead so it doesn't overwhelm the user-configurable
settings file with static stuff.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:51 +02:00
Lukas Fleischer
795971bc80 RPC: Coerce numeric values into integers
Coerce following fields into integers to ensure json_encode() serializes
them as integers:

* ID
* CategoryID
* NumVotes
* OutOfDate
* FirstSubmitted
* LastModified

This means that there will be a minor API break. There's no better way
to do this properly, though. Fixes FS#25693.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-09-23 15:30:32 +02:00
Lukas Fleischer
04a0fd4748 RPC: Provide out-of-date timestamp
Convert the "OutOfDate" field to provide a timestamp instead of a
boolean flag in JSON results. We don't really care about backward
compatibility here, as most AUR helpers would break anyway when trying
to parse RPC responses after the data type overhaul that should come
with one of the following patches.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-09-23 14:05:41 +02:00
Lukas Fleischer
675b7e3d02 Merge branch 'maint' 2011-09-05 17:09:03 +02:00
Lukas Fleischer
e1687f1830 Update message catalog
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-09-05 17:02:38 +02:00
Lukas Fleischer
20b20c20f2 web/template/login_form.php: Escape the request URI
Reported-by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-09-05 16:56:09 +02:00
Lukas Fleischer
1b63994b8d web/html/pkgsubmit.php: Deal with unset category ID
Do not move the package to the incoming package directory and fail to
create proper database entries if some AUR upload helper doesn't provide
a category. We got several failing constraints here, such as:

  Cannot add or update a child row: a foreign key constraint fails
  (`AUR`.`Packages`, CONSTRAINT `Packages_ibfk_1` FOREIGN KEY
  (`CategoryID`) REFERENCES `PackageCategories` (`ID`) ON DELETE NO
  ACTION)

Instead, default to "1" (which is "none", or "keep category" for
existing packages) if no category is supplied.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-09-05 16:47:59 +02:00
Lukas Fleischer
a00e5b040a Link to current page in the login bar HTTPs link
This is way more convenient if you follow a HTTP link. Implements
FS#25757.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-09-05 16:47:57 +02:00
Lukas Fleischer
e411ef1d80 Merge branch 'maint' 2011-08-22 08:35:18 +02:00
Lukas Fleischer
114edd9ff8 Provide more examples on the RPC info page
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-22 08:24:21 +02:00
Lukas Fleischer
53a31865f4 RPC: Fix info queries when using package IDs
Info queries using package IDs were no longer working due to commit
c6d84b3a8d, which introduced a table join
in process_query(), thus making the "ID" column ambiguous. Fix this by
explicitly specifying the table to use. Fixes FS#25696.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-22 08:17:26 +02:00
Lukas Fleischer
dad42297c7 Add missing __() to category info in package details
This makes the "Category" label as well as "Change category" button on
the package details page translatable. Fixes FS#25692.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-22 08:15:36 +02:00
Lukas Fleischer
fdddd76cbf UPGRADING: Fix rewrite rules
Do not attempt to rewrite "/packages/fo/foo/foo.tar.gz".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-22 08:15:36 +02:00
Lukas Fleischer
b5d5687517 web/lib/translator.inc.php: Use vsprintf() in __()
Remove hacky substitution code from __() and use vsprintf() instead
which will deal with all sorts of format strings properly.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-20 20:28:47 +02:00
Lukas Fleischer
ee4b398033 Use "%s" instead of "%h" in format strings
Use the standard string type specifier instead of "%h" in format
strings. Both specifiers are treated equally in __() so we shouldn't
break anything here. This also allows us to replace the hacky
substitution algorithm in __() by vsprintf().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-20 20:28:47 +02:00
Lukas Fleischer
72b657eb17 Release 1.9.0
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-20 18:38:34 +02:00