private function queryString_CFG() { $this->orig_queryString = $this->queryString; $this->queryString .= MySQL::limit($this->limitFrom, $this->limitTo); $this->queryString .= $this->addToEnd; if (!is_null($this->addToQuery)) { $this->queryString = AddToQuery::go($this->queryString, $this->addToQuery); } }
private function _getTopComments($content_id = NULL, $returnQuery = NULL) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $queryString = AddToQuery::go($this->commentMngr->_getComments($content_id, NULL, NULL, true, false), array("{last}AND" => " topComments.comments_id = comments.id AND ", "FROM" => " topComments, ")); //---------------------------------------------------------- $resultObj = array_merge(array('returnQuery' => $returnQuery), $this->resultObj); //---------------------------------------------------------- $chk = Result::go($queryString, $this->resultObj); //---------------------------------------------------------- $chk['result'] = $this->commentMngr->getReplies($chk['result']); //---------------------------------------------------------- return $chk; }
public function _getComments($content_id = NULL, $comment_id = NULL, $reply_comments_id = NULL, $returnQuery = NULL, $withReplies = true, $setResultObj = true) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $resultObj = array("chkForQuery" => true, 'returnQuery' => $returnQuery); $resultObj = $setResultObj ? array_merge($resultObj, $this->resultObj) : $resultObj; $chk = array("bool" => true, "traceID" => "getComments"); //---------------------------------------------------------- //Select comments.*, agreeWith.accounts_id as shit FROM comments LEFT JOIN agreeWith ON agreeWith.accounts_id = 125 AND agreeWith.comments_id = comments.id $queryString = "Select "; $queryString .= "CONCAT(accounts.first,' ',accounts.last) as name, "; $queryString .= "comments.reply_comments_id, "; $queryString .= "comments.content_id, "; $queryString .= "comments.id,"; //$queryString .= "Count(*) as num_agree from (Select agreeWith.* From agreeWith where agreeWith.comments_id = 150) as t $queryString .= "comments.accounts_id, "; $queryString .= "CONCAT('" . $this->thumbPath . "',files.hash,'/', files.name) as img_url, "; $queryString .= "comments.comment, "; $queryString .= "comments.avg_rating, "; $queryString .= "comments.date "; $queryString .= "FROM "; $queryString .= "comments, "; $queryString .= "accounts, "; $queryString .= "files "; $queryString .= "WHERE "; $queryString .= "accounts.id = comments.accounts_id AND "; $queryString .= "files.id = accounts.profile_files_id AND "; if (!is_null($content_id)) { $queryString .= "comments.content_id = {$content_id} AND "; } $queryString .= "comments.disabled is NULL "; $queryString .= "Group by comments.id "; $queryString .= "ORDER BY comments.id DESC"; //SELECT agreeWith.comments_id FROM agreeWith,comments Where agreeWith.comments_id = 156 AND agreeWith.accounts_id = 125 Group BY comments.id //---------------------------------------------------------- //if (!is_null($content_id)) $queryString = AddToQuery::go($queryString, array("{last}AND" => " comments.content_id = $content_id AND ")); //---------------------------------------------------------- if (is_null($reply_comments_id)) { if (is_null($comment_id)) { $queryString = AddToQuery::go($queryString, array("{last}AND" => " comments.reply_comments_id IS NULL AND ")); } } else { $queryString = AddToQuery::go($queryString, array("{last}AND" => " comments.reply_comments_id = {$reply_comments_id} AND ")); } //---------------------------------------------------------- if (!is_null($comment_id)) { $queryString = AddToQuery::go($queryString, array("{last}AND" => " comments.id = {$comment_id} AND ")); } //---------------------------------------------------------- $chk = Result::go($queryString, $resultObj); //---------------------------------------------------------- if (sizeof($chk['result']) == 0) { return $chk; } //---------------------------------------------------------- if ($withReplies) { $chk = $this->getReplies($chk); } //---------------------------------------------------------- return $chk; }
public function _getComments($content_id = NULL, $comment_id = NULL, $reply_comments_id = NULL, $returnQuery = NULL) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $resultObj = array_merge(array("chkForQuery" => true, 'returnQuery' => $returnQuery), $this->resultObj); $chk = array("bool" => true, "traceID" => "getComments"); //---------------------------------------------------------- $queryString = "Select CONCAT(accounts.first,' ',accounts.last) as name, "; $queryString .= $this->contentComments_tbl . ".reply_comments_id, comments.id, "; $queryString .= $this->contentComments_tbl . ".content_id, files.name as img_url, comments.comment, comments.avg_rating, comments.date FROM "; $queryString .= $this->contentComments_tbl . ", accounts, files, comments WHERE "; $queryString .= $this->contentComments_tbl . ".comments_id = comments.id AND files.id = accounts.profile_files_id AND "; $queryString .= "comments.accounts_id = accounts.id AND "; $queryString .= $this->contentComments_tbl . ".disabled is NULL Group by comments.id ORDER BY comments.id DESC"; //---------------------------------------------------------- if (!is_null($content_id)) { $queryString = AddToQuery::go($queryString, array("{last}AND" => " " . $this->contentComments_tbl . ".content_id = {$content_id} AND " . $this->contentComments_tbl . ".reply_comments_id IS NULL AND ")); } //---------------------------------------------------------- if (!is_null($reply_comments_id)) { $queryString = AddToQuery::go($queryString, array("{last}AND" => " " . $this->contentComments_tbl . ".reply_comments_id = {$reply_comments_id} AND ")); } //---------------------------------------------------------- if (!is_null($comment_id)) { $queryString = AddToQuery::go($queryString, array("{last}AND" => " comments.id = {$comment_id} AND ")); } //---------------------------------------------------------- $chk = Result::go($queryString, $resultObj); //---------------------------------------------------------- //$totalRows = $chk['totalRows']; //unset($resultObj['getTotalRows']); //---------------------------------------------------------- if (sizeof($chk['result']) == 0) { return $chk; } //---------------------------------------------------------- $chk['result'] = $this->encodeResult($chk['result']); //---------------------------------------------------------- //if ($chk['bool'] && is_null($reply_comments_id)) $chk = $this->getReplies($chk['result']); //---------------------------------------------------------- //$chk['totalRows'] = $totalRows; //---------------------------------------------------------- return $chk; }
public function getInvite($hash) { $queryString = $this->getEvents(NULL, NULL, NULL, NULL, true); $queryString = AddToQuery::go($queryString, array('select' => "invites.*,Concat(accounts.first,' ', accounts.last) as inviter_name,", 'from' => 'invites,accounts,', 'condition' => "from_accounts_id = accounts.id AND invites.hash = '" . $hash . "' AND events.id = invites.events_id AND"))->queryString; $chk = Result::go($queryString); return $chk; }
public function _getVideoMatches($string, $filters = NULL, $returnQuery = false) { Trace::output($this->traceID, "_getVideoMatches"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $resultObj = array_merge(array("chkForQuery" => true, 'returnQuery' => $returnQuery ? $returnQuery : false), $this->resultObj); //---------------------------------------------------------- $string = StringUtil::removeWhiteSpace($string); $queryString = AddToQuery::go($this->_getVideos(NULL, true), array("{last}AND" => " videos.title LIKE '" . $string . "%' AND ")); //---------------------------------------------------------- if (!$returnQuery) { $chk = Result::go($queryString, $resultObj); } else { return $queryString; } //---------------------------------------------------------- $chk['result'] = $this->encodeResult($chk['result']); //---------------------------------------------------------- $chk['print'] = print_r($string, true); //---------------------------------------------------------- return $chk; }