Clean up variable naming in grab_comments() , use null instead of -1 for parent ID
This commit is contained in:
@@ -252,22 +252,22 @@ class Comment {
|
|||||||
* grab comments for appId / versionId
|
* grab comments for appId / versionId
|
||||||
* if parentId is not -1 only comments for that thread are returned
|
* if parentId is not -1 only comments for that thread are returned
|
||||||
*/
|
*/
|
||||||
function grab_comments($versionId, $parentId = -1)
|
function grab_comments($iVersionId, $iParentId = null)
|
||||||
{
|
{
|
||||||
/* escape input so we can use query_appdb() without concern */
|
/* escape input so we can use query_appdb() without concern */
|
||||||
$versionId = mysql_real_escape_string($versionId);
|
$iVersionId = mysql_real_escape_string($iVersionId);
|
||||||
$parentId = mysql_real_escape_string($parentId);
|
$iParentId = mysql_real_escape_string($iParentId);
|
||||||
|
|
||||||
$extra = "";
|
$sExtra = "";
|
||||||
if($parentId != -1)
|
if($iParentId)
|
||||||
$extra = "AND parentId = $parentId ";
|
$sExtra = "AND parentId = '".$iParentId."' ";
|
||||||
|
|
||||||
$qstring = "SELECT from_unixtime(unix_timestamp(appComments.time), \"%W %M %D %Y, %k:%i\") as time, ".
|
$sQuery = "SELECT from_unixtime(unix_timestamp(appComments.time), \"%W %M %D %Y, %k:%i\") as time, ".
|
||||||
"appComments.commentId, appComments.parentId, appComments.versionId, appComments.userId, appComments.subject, appComments.body, appVersion.appId ".
|
"appComments.commentId, appComments.parentId, appComments.versionId, appComments.userId, appComments.subject, appComments.body, appVersion.appId ".
|
||||||
"FROM appComments, appVersion WHERE appComments.versionId = appVersion.versionId AND appComments.versionId = '$versionId' ".
|
"FROM appComments, appVersion WHERE appComments.versionId = appVersion.versionId AND appComments.versionId = '".$iVersionId."' ".
|
||||||
$extra.
|
$sExtra.
|
||||||
"ORDER BY appComments.time ASC";
|
"ORDER BY appComments.time ASC";
|
||||||
$hResult = query_appdb($qstring);
|
$hResult = query_appdb($sQuery);
|
||||||
|
|
||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user