- improved include/db.php
- updated TODO regarding db queries
This commit is contained in:
14
TODO
14
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.)
|
||||
|
||||
|
||||
@@ -1,33 +1,38 @@
|
||||
<?php
|
||||
$public_link = null;
|
||||
$private_link = null;
|
||||
|
||||
|
||||
function apidb_query($query)
|
||||
function query_appdb($sQuery)
|
||||
{
|
||||
global $public_link;
|
||||
global $hPublicLink;
|
||||
|
||||
if(!$public_link)
|
||||
if(!$hPublicLink)
|
||||
{
|
||||
$public_link = mysql_pconnect($db_public_host, $db_public_user, $db_public_pass);
|
||||
mysql_select_db($db_public_db);
|
||||
$hPublicLink = mysql_pconnect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS);
|
||||
mysql_select_db(APPS_DB);
|
||||
}
|
||||
|
||||
return mysql_query($query, $public_link);
|
||||
$hResult = mysql_query($sQuery, $hPublicLink);
|
||||
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)
|
||||
if(!$hPrivateLink)
|
||||
{
|
||||
$private_link = mysql_pconnect($db_private_host, $db_private_user, $db_private_pass);
|
||||
mysql_select_db($db_private_db);
|
||||
$hPrivateLink = mysql_pconnect(USERS_DBHOST, USERS_DBUSER, USERS_DBPASS);
|
||||
mysql_select_db(USERS_DB);
|
||||
}
|
||||
|
||||
return mysql_query($query, $private_link);
|
||||
$hResult = mysql_query($sQuery, $hPrivateLink);
|
||||
if(!$hResult)
|
||||
{
|
||||
$sStatusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
|
||||
addmsg($sStatusMessage, "red");
|
||||
}
|
||||
return $hResult;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user