Commit graph

29 commits

Author SHA1 Message Date
canyonknight
ecf2caf7fb Remove unneeded database connection calls
Since all database related functions will establish a connection
when needed, there is no need to pre-emptively try and establish
a database connection.

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2013-02-10 12:10:38 +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
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
canyonknight
c133826a7c logout.php: Fix PHP undefined variable notice
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-18 00:58:55 +02:00
Lukas Fleischer
2425f963f8 Use virtual path feature for links
Use virtual paths in links (e.g. link to "/packages/" instead of
"/packages.php" etc.) if the virtual path feature is enabled.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 22:44:51 +02:00
canyonknight
f93f1a652f logout.php: Pull out DB code
* Move DB code for removing a session in logout.php to a new function in
acctfuncs.inc.php
* Add ability for clear_expired_sessions function to check for DB connection
* Centralization of DB code important in a future transition to PDO interface

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:26:59 +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
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
Lukas Fleischer
00e4e0294f Use secure and httponly session cookies
As discussed on the mailing list, enable "secure" and "httponly" for
session cookies to prevent them from being transferred over insecure
connections.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-12 00:09:24 +02:00
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
Dan McGee
984ce9529c Improve cookie handling
* Remove comment that is mostly bogus- the domain is automatically set.
* When logging out, don't delete the language cookie.
* Make the language cookie persistent.
* Use the minimal time possible to expire cookies; no need to compute
  anything.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:13 +01:00
Dan McGee
46f2798524 Use include_once where applicable
All of these are sourcing function libraries so we don't need to include
them more than once. Things that insert actual HTML into the output were
left calling include().

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-08-11 13:58:12 -04:00
Loui Chang
78c2b5c67f Introduce function include_lang for translations.
This includes only the requested language for each page and
makes top level language include files obsolete.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-12-21 18:03:27 +09:00
Loui Chang
cf2a82fe85 Clear out old expired sessions on log out.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-11-13 15:18:48 -05:00
Loui Chang
3a42725601 Remove all vim mode lines. Add HACKING file.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2008-06-17 01:38:01 -04:00
tardo
881b921eb3 Fixed version strings.
Added AUR_VERSION to config file, so now we should only need to
change one location. KISS ftw.

Signed-off-by: tardo <tardo@nagi-fanboi.net>
2007-10-02 07:29:27 -04:00
tardo
03a44d4900 Logout now redirects instead of displaying a page.
Thanks to Alex for the heads-up.

Signed-off-by: tardo <tardo@nagi-fanboi.net>
2007-09-30 12:51:06 -04:00
pjmattal
452d6b1245 patch from eliott to convert all <? to <?php 2007-09-20 21:46:43 +00:00
swiergot
0b92839bee - Applied a patch from Loui to fix session removal.
- Replaced all occurences of mysql_escape_string()
  with mysql_real_escape_string().
2007-09-20 15:33:04 +00:00
pjmattal
c3a90420e2 added dsa's header include patch 2006-08-08 00:59:10 +00:00
pjmattal
ce505210fa added dsa's "My Packages" patch 2006-08-01 05:50:48 +00:00
eric
a54ca6bfaf started working on package delete support 2005-01-25 22:52:32 +00:00
eric
74d81b288d continuing with pkgsubmit, added vim instructions to php files 2004-09-10 12:47:37 +00:00
eric
ae26c9ce2a baby steps 2004-07-02 12:47:16 +00:00
eric
1f62f86af5 getting closer to printing package search results - also fixed some XHTML stuff 2004-06-24 19:08:35 +00:00
eric
84912ddb2e account adding/editing is working 2004-06-23 00:28:13 +00:00
eric
84e15d0463 finished the login/logout/session stuff 2004-06-20 23:26:28 +00:00
eric
22e8556691 finished tweaking language selection 2004-06-19 14:36:22 +00:00