summaryrefslogtreecommitdiffstats
path: root/web/html
diff options
context:
space:
mode:
authorcanyonknight <canyonknight@gmail.com>2013-02-03 17:26:28 +0100
committerLukas Fleischer <archlinux@cryptocrack.de>2013-02-10 12:10:37 +0100
commit8e03e68d687015b5cd8c9d3857e1a1d007252afa (patch)
tree26cd5d7aa6cfac4f6fddfa1f76fdc59d2cbd4a0f /web/html
parentb3a2b6c4a59a2cd90b020120b64f16797af1b6fb (diff)
downloadaur-8e03e68d687015b5cd8c9d3857e1a1d007252afa.tar.gz
aur-8e03e68d687015b5cd8c9d3857e1a1d007252afa.tar.xz
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>
Diffstat (limited to 'web/html')
-rw-r--r--web/html/account.php2
-rw-r--r--web/html/home.php2
-rw-r--r--web/html/logout.php2
-rw-r--r--web/html/pkgsubmit.php2
4 files changed, 4 insertions, 4 deletions
diff --git a/web/html/account.php b/web/html/account.php
index 2133734c..7cd02634 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -20,7 +20,7 @@ $action = in_request("Action");
if (isset($_COOKIE["AURSID"])) {
# visitor is logged in
#
- $dbh = db_connect();
+ $dbh = DB::connect();
$atype = account_from_sid($_COOKIE["AURSID"]);
if ($action == "SearchAccounts") {
diff --git a/web/html/home.php b/web/html/home.php
index 0b51d555..a10ebf01 100644
--- a/web/html/home.php
+++ b/web/html/home.php
@@ -10,7 +10,7 @@ include_once('stats.inc.php');
html_header( __("Home") );
-$dbh = db_connect();
+$dbh = DB::connect();
?>
diff --git a/web/html/logout.php b/web/html/logout.php
index 3d059e70..2d8bebc6 100644
--- a/web/html/logout.php
+++ b/web/html/logout.php
@@ -11,7 +11,7 @@ include_once("acctfuncs.inc.php"); # access AUR common functions
#
if (isset($_COOKIE["AURSID"])) {
if (!isset($dbh)) {
- $dbh = db_connect();
+ $dbh = DB::connect();
}
delete_session_id($_COOKIE["AURSID"], $dbh);
# setting expiration to 1 means '1 second after midnight January 1, 1970'
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 5dd58af0..78fceac2 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -356,7 +356,7 @@ if ($uid):
# Update the backend database
if (!$error) {
- $dbh = db_connect();
+ $dbh = DB::connect();
begin_atomic_commit($dbh);
$pdata = pkgdetails_by_pkgname($new_pkgbuild['pkgname'], $dbh);