From a81b132d83080cd074d3bbd2b519c27dce6b444f Mon Sep 17 00:00:00 2001
From: Jonathan Ernst
Date: Wed, 29 Dec 2004 03:36:57 +0000
Subject: [PATCH] - improved include/db.php - updated TODO regarding db queries
---
TODO | 14 ++++++--------
include/db.php | 49 +++++++++++++++++++++++++++----------------------
2 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/TODO b/TODO
index 84e432a..9559d1c 100644
--- a/TODO
+++ b/TODO
@@ -13,14 +13,12 @@ RELATED TODO: how to handle deleting accounts that have comments? go through
and assign them to a special account number that prints (account deleted due
to inactivity)
-# screenshot submission isn't very friendly. it would be really cool if
-people could submit screenshots via a web interface. We would store the
-image and related information in the database and send email to the database
-admins and to any maintainers of the app. They would then be able to click
-on a link in the email to view the image and accept/reject it. If the image
-sat for too long it would be rejected and an email would be send to the
-submitter saying it timed out. If the admin/maintainer clicked on accept it
-would go into the db like every other image.
+# replace all mysql_query() by query_appdb() (available from include/db.php).
+When it's done we have to remove opendb() function call in incl.php and definition
+in util.php as query_appdb already does the connection when needed.
+
+# we have to check if we really need to separate user database from appdb database
+(as seen in the config file and include/db.php)
# when deleting an application we should delete linked entries (screenshots, comments, etc.)
diff --git a/include/db.php b/include/db.php
index 1d6ec6c..2bcb49d 100644
--- a/include/db.php
+++ b/include/db.php
@@ -1,33 +1,38 @@
Database Error!
".mysql_error()."
\n";
+ addmsg($sStatusMessage, "red");
+ }
+ return $hResult;
}
-function userdb_query($query)
+function query_userdb($sQuery)
{
- global $private_link;
-
- if(!$private_link)
- {
- $private_link = mysql_pconnect($db_private_host, $db_private_user, $db_private_pass);
- mysql_select_db($db_private_db);
- }
-
- return mysql_query($query, $private_link);
-}
+ global $hPrivateLink;
+ if(!$hPrivateLink)
+ {
+ $hPrivateLink = mysql_pconnect(USERS_DBHOST, USERS_DBUSER, USERS_DBPASS);
+ mysql_select_db(USERS_DB);
+ }
+ $hResult = mysql_query($sQuery, $hPrivateLink);
+ if(!$hResult)
+ {
+ $sStatusMessage = "Database Error!
".mysql_error()."
\n";
+ addmsg($sStatusMessage, "red");
+ }
+ return $hResult;
+}
?>