/** * Fetches the SQL for loading. * * @param int $required_query - The required query * @return string */ protected function getLoadQuery($required_query) { // Hooks should check the required query before populating the hook vars $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook($this->query_hook)) ? eval($hook) : false; if (self::QUERY_BASIC == $required_query) { $sql = "SELECT node.nodeid " . ($this->requireLoad(self::INFO_BASIC) ? ", node.contenttypeid, node.contentid, node.url, node.parentnode, node.styleid, node.userid, node.permissionsfrom, node.layoutid, node.publishdate, node.publicpreview, node.nodeleft, node.noderight, node.issection, node.showtitle, node.showuser, node.showpreview, node.showupdated, node.showviewcount, node.showcreation, node.settingsforboth, " : '') . ($this->requireLoad(self::INFO_NODE) ? ", info.description, info.title, info.html_title, info.viewcount, info.creationdate, info.workflowdate, info.associatedthreadid, info.workflowstatus, info.workflowcheckedout, info.viewcount, info.workflowlevelid, user.username" : '') . ($this->requireLoad(self::INFO_CONTENT) ? ", statichtml.html " : '') . " $hook_query_fields FROM " . TABLE_PREFIX . "cms_node AS node" . ($this->requireLoad(self::INFO_CONTENT) ? " INNER JOIN " . TABLE_PREFIX . "cms_statichtml AS statichtml ON statichtml.contentid = node.contentid" : '') . ($this->requireLoad(self::INFO_NODE) ? " INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = node.userid" : '') . " $hook_query_joins WHERE " . (is_numeric($this->itemid) ? 'node.nodeid = ' . intval($this->nodeid) : 'node.contenttypeid = ' . intval($this->contenttypeid) . ' AND node.contentid = ' . intval($this->contentid)) . " $hook_query_where "; return $sql; } return parent::getLoadQuery($required_query); }
/** * Fetches the SQL for loading. * * @param int $required_query - The required query * @return string */ protected function getLoadQuery($required_query) { // Hooks should check the required query before populating the hook vars $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook($this->query_hook)) ? eval($hook) : false; if (self::QUERY_BASIC == $required_query OR self::QUERY_CONTENT == $required_query) { $sql = "SELECT node.nodeid, node.showrating, node.setpublish, node.contenttypeid, node.contentid, node.url, node.parentnode, node.styleid, node.userid, node.nodeleft, node.noderight, node.layoutid, node.publishdate, node.publicpreview, node.issection, node.permissionsfrom, node.showtitle, node.showuser, node.showpreviewonly, node.showupdated, node.showviewcount, node.showpublishdate, node.settingsforboth, node.includechildren, node.showall, node.editshowchildren, node.shownav, node.hidden, node.nosearch, node.comments_enabled, info.description, info.html_title, info.title, info.viewcount, info.creationdate, info.workflowdate, info.associatedthreadid, info.workflowstatus, info.workflowcheckedout, info.viewcount, info.workflowlevelid, info.keywords, info.ratingnum, info.ratingtotal, info.rating, user.username, article.pagetext, article.threadid, article.blogid, article.posttitle, article.postauthor, thread.replycount, article.poststarter, article.previewimage, article.imagewidth, article.imageheight, article.previewvideo, article.postid, article.blogpostid, article.post_started, article.post_posted, article.htmlstate $hook_query_fields FROM " . TABLE_PREFIX . "cms_node AS node INNER JOIN " . TABLE_PREFIX . "cms_article AS article ON article.contentid = node.contentid INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid LEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = node.userid LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON thread.threadid = info.associatedthreadid $hook_query_joins WHERE " . (is_numeric($this->itemid) ? 'node.nodeid = ' . intval($this->nodeid) : 'node.contenttypeid = ' . intval($this->contenttypeid) . ' AND node.contentid = ' . intval($this->contentid)) . " $hook_query_where "; return $sql; } return parent::getLoadQuery($required_query); }