- improved include/db.php

- updated TODO regarding db queries
This commit is contained in:
Jonathan Ernst
2004-12-29 03:36:57 +00:00
committed by WineHQ
parent ea27897238
commit a81b132d83
2 changed files with 33 additions and 30 deletions

14
TODO
View File

@@ -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 and assign them to a special account number that prints (account deleted due
to inactivity) to inactivity)
# screenshot submission isn't very friendly. it would be really cool if # replace all mysql_query() by query_appdb() (available from include/db.php).
people could submit screenshots via a web interface. We would store the When it's done we have to remove opendb() function call in incl.php and definition
image and related information in the database and send email to the database in util.php as query_appdb already does the connection when needed.
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 # we have to check if we really need to separate user database from appdb database
sat for too long it would be rejected and an email would be send to the (as seen in the config file and include/db.php)
submitter saying it timed out. If the admin/maintainer clicked on accept it
would go into the db like every other image.
# when deleting an application we should delete linked entries (screenshots, comments, etc.) # when deleting an application we should delete linked entries (screenshots, comments, etc.)

View File

@@ -1,33 +1,38 @@
<?php <?php
$public_link = null; function query_appdb($sQuery)
$private_link = null;
function apidb_query($query)
{ {
global $public_link; global $hPublicLink;
if(!$public_link) if(!$hPublicLink)
{ {
$public_link = mysql_pconnect($db_public_host, $db_public_user, $db_public_pass); $hPublicLink = mysql_pconnect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS);
mysql_select_db($db_public_db); mysql_select_db(APPS_DB);
} }
$hResult = mysql_query($sQuery, $hPublicLink);
return mysql_query($query, $public_link); if(!$hResult)
{
$sStatusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
addmsg($sStatusMessage, "red");
}
return $hResult;
} }
function userdb_query($query) function query_userdb($sQuery)
{ {
global $private_link; global $hPrivateLink;
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);
}
if(!$hPrivateLink)
{
$hPrivateLink = mysql_pconnect(USERS_DBHOST, USERS_DBUSER, USERS_DBPASS);
mysql_select_db(USERS_DB);
}
$hResult = mysql_query($sQuery, $hPrivateLink);
if(!$hResult)
{
$sStatusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
addmsg($sStatusMessage, "red");
}
return $hResult;
}
?> ?>