Commit graph

1031 commits

Author SHA1 Message Date
elij
888db089c5 rename *.inc files to *.inc.php and adjust imports and references
Lukas: Add note to "UPGRADING".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-06-22 15:15:04 +02:00
elij
023d2a2521 make rss.php use the apc cache instead of a cache file
utilize the apc cache functionality in aur.inc to cache the rss feed
output. the cache will cache on a per-protocol basis (http/https) so
that urls are appropriate regardless of which url people hit.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-06-22 15:04:23 +02:00
elij
af5d05f4ad refactor apc code and move to aur.inc
- move apc cache code to aur.inc (centralize)
- refactor the apc usage in stats.inc to utilize new code in aur.inc

Lukas: Small commenting style and spelling changes.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-06-22 15:02:21 +02:00
Lukas Fleischer
fa53ca68b0 Cleanup RPC usage output a bit
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-29 16:06:28 +02:00
Lukas Fleischer
21827dfb1c Properly encode ampersands in the RPC usage output
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-29 15:58:46 +02:00
elij
4c9da512af fix two issues (php notice level) with html/rss.php
- Undefined index: HTTPS in rss.php on line 8
- Undefined property: RSSCreator20::$cssStyleSheet in
  feedcreator.class.php on line 591

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-29 15:57:45 +02:00
elij
4a24bca069 restructure the html/rpc.php endpoint
- move request_method test to the top, and catch other request types
  (HEAD, PUT, etc)
- change how html output is handled. instead of building a string, just
  output the html
- set appropriate response header for incorrect request_method.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-29 15:57:45 +02:00
kachelaqa
0df6d7b4e7 add first submitted and last modified to rpc output
after reading the discussion about the submitter field, i looked again
at my previous patch and realized that it was not very good at all.

hopefully this simplified version will be more acceptable.

the justification for this patch is that many third-party tools will
want to know how new a package is, or when it last changed. adding the
submitted and modified timestamps will allow users to get all the
relevant package data in a single query.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-17 10:46:56 +02:00
elij
77f3aa56b7 add support for etag and conditional get (if-none-match)
Add etag and if-none-match conditional get support. This will allow
'smart client' to save network bandwidth, as they can save the etag hash
value for queries and test it later. Still an http request because this
patch specifically sets a cache lifetime of zero, and must-revalidate.
The benefit here is bandwidth savings. Caching based on expires headers
would likely be counter productive, as the api data can change rather
quickly...but etag is a nice compromise, and could be quite beneficial
for bandwidth recution in some scenarios.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-17 10:43:49 +02:00
elij
3e81712fd6 fix case where user does not exist
the query was being performed when $id was not set, resulting in an
invalid sql query being performed.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-17 10:43:46 +02:00
elij
0898f1447a test return value from db_query before assuming it is valid
make the sql query form consistent in usage by cleaning up instances
where db_query's result was not inspected before attempting to fetch row
data from the handle

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-17 10:43:42 +02:00
Karlis Lauva
d38f3460e5 Added label tags for login form fields.
Lukas: Use tabs for indentation instead of spaces.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-05-09 10:54:36 +02:00
Lukas Fleischer
cffdb0fe0d UPGRADING: Add note on merging config file changes.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 17:51:48 +02:00
elij
c43558ba60 add SQL_DEBUG variable and database logging
add a hook to db_query to log all sql queries when SQL_DEBUG is set
Additionally, provide better logging for sql error situations (provide
backtrace as well as error message).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:44 +02:00
elij
10ea5f5ff6 create variable before referencing it with .=
fixes php notice level error:
  Undefined variable: whovoted in ../tu.php

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:28 +02:00
Dan McGee
33a765ef03 stats: capitalize FROM in all SQL queries
Matches our normal code conventions.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:28 +02:00
Dan McGee
3609cf140e SQL: treat all UID/ID values as numbers, not strings
Ensure we are not quoting these values in any of our SQL queries.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:27 +02:00
Dan McGee
fcda6671f3 SQL: use standard LIMIT/OFFSET syntax
Increases compatibility with standard SQL dialect.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:27 +02:00
Lukas Fleischer
ed9c95623f pkgsubmit.php: Ensure the session is linked to a valid user.
Prevent race conditions that may occur when either the session or the
user is deleted before we extract the actual user identifier.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-24 14:22:24 +02:00
Lukas Fleischer
9ff30614b8 pkgsubmit.php: Remove redundant uid_from_sid() invocations.
uid_from_sid() is called once at the very beginning of the script,
storing the actual user identifier in "$uid". No need to fire up another
query.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-24 14:00:09 +02:00
Lukas Fleischer
897211374f Use HTTPs for links in the main site navigation bar (fixes FS#23832).
Basically just sync with what archweb currently uses, prefixing all
relative URLs with "http://www.archlinux.org".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-20 00:13:10 +02:00
Lukas Fleischer
973e4f8558 Use HTTPs for links in out of date notification mails.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-20 00:02:09 +02:00
Lukas Fleischer
5ea9fc197d Use HTTPs for links in password reset confirmation mails.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-19 23:59:19 +02:00
Lukas Fleischer
1e7b9d570d Use HTTPs for links in comment notification mails.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-19 23:58:32 +02:00
Lukas Fleischer
0e5f2e1f1e urlencode() query args for main site package search (fixes FS#23774).
There may be characters in package dependencies that are reserved within
URLs (e.g. "+"). Use urlencode() to ensure those are encoded correctly.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-19 23:45:43 +02:00
Dan McGee
0f4da329d8 Add a .mailmap file
This takes `git shortlog -sen | wc -l` length from 69 to 56 authors for
me, fixing a lot of the author fields that have snuck in over time, and
allows credit to be given where due for some contributors that couldn't
pick a single email address in the past.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-19 23:41:42 +02:00
tuxce
c6d84b3a8d rpc: unify methods return (fixes FS#17597)
Include maintainer in info and search method.

Lukas: Adjustments for "multiinfo" queries.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-16 17:49:01 +02:00
Dan McGee
0488e8597c rpc: introduce multiinfo query (fixes FS#17583)
The majority of "real world" info requests [1] come in hefty batches. We
would be better served to handle these in one request rather than
multiple by allowing AUR clients to send multiple arguments.

This enables things like this to work:
    http://aur.test/rpc.php?type=multiinfo&arg[]=cups-xerox&arg[]=cups-mc2430dl&arg[]=10673

Note to RPC users: unfortunately due to the asinine design of PHP, you
unfortunately have to use the 'arg[]' syntax if you want more than one
query argument, or you will only get the package satisfying the last arg
you pass.

[1] Rough data from April 11, 2011, with a total hit count of 1,109,163:
     12 /login.php
     13 /rpc.php?type=sarch
     15 /rpc.php?type=msearch
     16 /pingserver.php
     16 /rpc.php
     22 /logout.php
    163 /passreset.php
    335 /account.php
    530 /pkgsubmit.php
    916 /rss2.php
   3838 /index.php
   6752 /rss.php
   9699 /
  42478 /rpc.php?type=search
 184737 /packages.php
 681725 /rpc.php?type=info

That means a whopping 61.5% of our requests were for info over the RPC
interface; package pages are a distant second at only 16.7%.

Lukas: Introduce "multiinfo" query instead of extending "info" (for the
sake of backward compatibility).

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-16 17:49:00 +02:00
Dan McGee
a3ad060158 rpc.php: be a bit more consistent in query building
Do the implode as the same but separate step each time, and remove
indentation where no other query has it.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-16 17:49:00 +02:00
Dan McGee
aa206b343a rpc.php overhaul
* Mark things static in the class rather than use a constructor every
  single invocation of the service.
* Don't call mysql_real_escape_string() before we even have a database
  connection, and don't do work in the database if we don't need to.
* Formatting consistency fixups in a few places.
* Add new process_query() helper function; use this instead of
  copy-pasted code in all of the RPC method calls.
* Remove the escaping code meant to fix FS#15526, introduced in commit
  4d1eb4dd7a. It broke more than it solved, only fixed the output in
  one of three RPC calls (and who knows what the web interface then also
  does), and proper encoding should be done at the database level rather
  than up here.

Lukas: Add special case for "info" queries to process_query() (return a
single result instead of an array of results here).

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-16 17:47:57 +02:00
Dan McGee
8fdb382d67 Don't allow dl() of json module
You need this enabled for the AUR, period. No need for this BS.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-13 12:36:07 +02:00
Lukas Fleischer
56de32c016 Pass array_map() callback function properly.
PHP requires callback functions to be passed as strings. Fix this to
supress PHP notices.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-13 12:24:01 +02:00
Lukas Fleischer
664303956e Remove obsolete README file in "support/".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-13 12:22:35 +02:00
Lukas Fleischer
2b460a8f2d Remove "NewPkgNotify" column from "Users" table.
We do not require this column anymore. New package notifications are no
longer supported.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-13 12:22:35 +02:00
Lukas Fleischer
d73f9df39b Remove new package notification script.
We discussed this on aur-dev. Everything that depends on tupkgs should
be removed. Those who still want to be notified should move on to the
RSS feed.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-13 12:22:34 +02:00
Lukas Fleischer
eef5353bde Remove "New Package Notify" option from user account settings.
Do this in preparation for the upcoming notification script removal.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-13 12:22:28 +02:00
Lukas Fleischer
31cda618ca Make "gendummydata.py" Python 3 compliant.
* Transform into valid Python 3.x code using 2to3.

* Change shebang from "/usr/bin/python2" to "/usr/bin/python3".

* Invoke with "python3" instead of "python2" in "reloadtestdb.sh".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-13 12:14:37 +02:00
Lukas Fleischer
e1bf49e03c Fix dependency generation in "gendummydata.py".
Package dependencies are no longer stored as references to the
"Packages" table but kept directly in "PackageDepends", so the dummy
data generation script should be fixed to create package names instead
of references, also. Regression introduced in commit
7c91c59245.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-12 13:03:17 +02:00
Lukas Fleischer
bd78b14cb5 Fix syntax error in "CREATE TABLE" statement in the SQL schema.
Regression introduced in commit
7c91c59245.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-12 13:02:54 +02:00
elij
3d3fed6910 wrap long SQL commands to improve formatting and readability
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-12 11:57:31 +02:00
elij
e08731d24c replace print statements with logging module in gendummydata
use the logging module instead of writing directly to stderr
this makes the code cleaner as it removes the numerous tests for the value
of DBUG, yet allows devs to control the level of output verbosity.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-12 11:57:31 +02:00
elij
2e444a79d5 remove mysql dependency from gendummydata
- remove need to use mysql for escaping the sql -- removing single quote
  should be enough
- instead of using sql to fetch categories from a live database, simply
  consider categories an integer range, specified to the size of that in the
  aur-schema.

Lukas: Add "CATEGORIES_COUNT" initialization. Fix random number range
used in genCategory() (AUTO_INCREMENT columns are 1-based by default,
not 0-based).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-12 11:56:32 +02:00
Dan McGee
eaffdc27f8 Add base transifex config
This simplifies instructions for translators and allows them to have an
out of the box working configuration.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-11 09:53:51 +02:00
Dan McGee
c996368024 Use HTTPS for transifex URLs
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-11 09:53:51 +02:00
Lukas Fleischer
a85f140ace Add ".mo" and ".po~" files to ".gitignore".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-10 16:27:49 +02:00
Lukas Fleischer
8bca269b81 Update "TRANSLATING" with gettext and Transifex instructions.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-10 16:27:48 +02:00
Lukas Fleischer
3a5693166c Remove comment on translation helpers from "web/lib/translator.inc".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-10 16:27:48 +02:00
Lukas Fleischer
525a079503 Supress rm(1) warnings showing up when running make clean.
Use `rm -f` instead of just `rm` here to supress those annoying warnings
about failed removal if either ".po~" backup files or compiled ".mo"
files are missing.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-10 16:27:48 +02:00
Lukas Fleischer
3d8c298adb Add "--check" to msgfmt(1) invocation in Makefile.
We can add this as we finally have proper portable objects now.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-10 16:27:47 +02:00
Lukas Fleischer
7364625510 Update portable object files using make update-po.
This ensures we have proper native portable objects instead of those
created by sed(1)'ing the former translation files.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-10 16:27:46 +02:00