- replaced mysql_query() with query_appdb()
- removed opendb() - removed query_userdb() - removed error handling from the code as it is done with query_appdb()
This commit is contained in:
@@ -87,7 +87,7 @@ function grab_comments($appId, $versionId, $parentId = -1)
|
||||
$extra.
|
||||
"ORDER BY appComments.time ASC";
|
||||
|
||||
$result = mysql_query($qstring);
|
||||
$result = query_appdb($qstring);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ function grab_comments($appId, $versionId, $parentId = -1)
|
||||
function count_comments($appId, $versionId)
|
||||
{
|
||||
$qstring = "SELECT count(commentId) as hits FROM appComments WHERE appId = $appId AND versionId = $versionId";
|
||||
$result = mysql_query($qstring);
|
||||
$result = query_appdb($qstring);
|
||||
$ob = mysql_fetch_object($result);
|
||||
return $ob->hits;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ function display_comments_flat($appId, $versionId)
|
||||
function view_app_comments($appId, $versionId, $threadId = 0)
|
||||
{
|
||||
// count posts
|
||||
$result = mysql_query("SELECT commentId FROM appComments WHERE appId = $appId AND versionId = $versionId");
|
||||
$result = query_appdb("SELECT commentId FROM appComments WHERE appId = $appId AND versionId = $versionId");
|
||||
$messageCount = mysql_num_rows($result);
|
||||
|
||||
//start comment format table
|
||||
|
||||
@@ -30,15 +30,6 @@ define("APPS_DBHOST","localhost");
|
||||
define("APPS_DB","apidb");
|
||||
|
||||
|
||||
/*
|
||||
* users database info
|
||||
*/
|
||||
define("USERS_DBUSER","wineowner");
|
||||
define("USERS_DBPASS","lemonade");
|
||||
define("USERS_DBHOST","localhost");
|
||||
define("USERS_DB","apidb");
|
||||
|
||||
|
||||
/*
|
||||
* bugzilla database info
|
||||
*/
|
||||
|
||||
@@ -14,21 +14,6 @@ function query_appdb($sQuery,$sComment="")
|
||||
}
|
||||
|
||||
|
||||
function query_userdb($sQuery)
|
||||
{
|
||||
global $hUserLink;
|
||||
|
||||
if(!$hUserLink)
|
||||
{
|
||||
$hUserLink = mysql_pconnect(USERS_DBHOST, USERS_DBUSER, USERS_DBPASS);
|
||||
mysql_select_db(USERS_DB);
|
||||
}
|
||||
$hResult = mysql_query($sQuery, $hUserLink);
|
||||
if(!$hResult) query_error($sComment);
|
||||
return $hResult;
|
||||
}
|
||||
|
||||
|
||||
function query_bugzilladb($sQuery,$sComment="")
|
||||
{
|
||||
global $hBugzillaLink;
|
||||
|
||||
@@ -210,13 +210,7 @@ function dumpmsgbuffer()
|
||||
query_appdb("DELETE FROM sessionMessages WHERE sessionId = '".session_id()."'");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Start DB Connection
|
||||
*/
|
||||
opendb();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Init Session (stores user info and cart info in session)
|
||||
*/
|
||||
$session = new session("whq_appdb");
|
||||
|
||||
@@ -18,8 +18,6 @@ class TableVE {
|
||||
$this->titleField = "";
|
||||
$this->titleText = "";
|
||||
$this->numberedTitles = 0;
|
||||
|
||||
opendb();
|
||||
}
|
||||
|
||||
function test($query)
|
||||
|
||||
@@ -122,7 +122,7 @@ class User {
|
||||
$sFields = "({$aInsert['FIELDS']}, `password`, `stamp`, `created`)";
|
||||
$sValues = "({$aInsert['VALUES']}, password('".$sPassword."'), NOW(), NOW() )";
|
||||
|
||||
if (!query_userdb("INSERT INTO user_list $sFields VALUES $sValues"))
|
||||
if (!query_appdb("INSERT INTO user_list $sFields VALUES $sValues"))
|
||||
{
|
||||
return mysql_error();
|
||||
}
|
||||
|
||||
@@ -1,27 +1,4 @@
|
||||
<?php
|
||||
|
||||
$dbcon = null;
|
||||
$dbref = 0;
|
||||
|
||||
function opendb()
|
||||
{
|
||||
global $dbcon, $dbref;
|
||||
|
||||
$dbref++;
|
||||
|
||||
if($dbcon)
|
||||
return $dbcon;
|
||||
|
||||
$dbcon = mysql_connect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS);
|
||||
if(!$dbcon)
|
||||
{
|
||||
echo "An error occurred: ".mysql_error()."<p>\n";
|
||||
exit;
|
||||
}
|
||||
mysql_select_db(APPS_DB);
|
||||
return $dbcon;
|
||||
}
|
||||
|
||||
function build_urlarg($vars)
|
||||
{
|
||||
$arr = array();
|
||||
|
||||
Reference in New Issue
Block a user