From c16cd99a6ded6139305a074bfddf0cba9edc63f1 Mon Sep 17 00:00:00 2001 From: Tekimaki Date: Thu, 5 Feb 2009 17:39:33 +0000 Subject: fix comment status joins - need comment table ref independently - was dependent on libertysecure join before naughty naught --- liberty_lib.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/liberty_lib.php b/liberty_lib.php index 9e55267..ad0c234 100644 --- a/liberty_lib.php +++ b/liberty_lib.php @@ -1,6 +1,6 @@ mType['content_type_guid'] ) && $pObject->mType['content_type_guid'] == 'bitcomment' ) || ( !empty( $pParamHash['include_comments'] ) && $pParamHash['include_comments'] == 'y' )) { // if we are getting a list of comments then lets check the owner of the comment root and the owner of the content - $ret['join_sql'] = " INNER JOIN `".BIT_DB_PREFIX."liberty_content` rlcs ON( rlcs.`content_id`=lcom.`root_id` )"; + $ret['join_sql'] = " + INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcoms ON (lc.`content_id` = lcoms.`content_id`) + INNER JOIN `".BIT_DB_PREFIX."liberty_content` rlcs ON( rlcs.`content_id`=lcoms.`root_id` )"; $ret['where_sql'] = " AND lc.`content_status_id` < 100 AND ( ( (rlcs.`user_id` = '".$gBitUser->getUserId()."' OR lc.`user_id` = '".$gBitUser->getUserId()."') AND lc.`content_status_id` > -100) OR lc.`content_status_id` > 0 )"; } else { // let owner see any of their own content with a status > -100 @@ -337,7 +339,9 @@ function liberty_content_list_sql( &$pObject, $pParamHash=NULL ) { if(( is_object( $pObject ) && !empty( $pObject->mType['content_type_guid'] ) && $pObject->mType['content_type_guid'] == 'bitcomment' ) || ( !empty( $pParamHash['include_comments'] ) && $pParamHash['include_comments'] == 'y' )) { // if we are getting a list of comments then lets check the owner of the comment root and the owner of the content - $ret['join_sql'] = " INNER JOIN `".BIT_DB_PREFIX."liberty_content` rlcs ON( rlcs.`content_id`=lcom.`root_id` )"; + $ret['join_sql'] = " + LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_comments` lcoms ON (lc.`content_id` = lcoms.`content_id`) + LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_content` rlcs ON( rlcs.`content_id`=lcoms.`root_id` )"; $ret['where_sql'] = " AND lc.`content_status_id` < ".$max_status_id. " AND ( -- cgit v1.3