prepare ("SELECT `c`.*, `p`.`account_id`, `p`.`id` AS `profile_id`, `p`.`status` AS `profile_status` FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` AS `c` INNER JOIN `sys_profiles` AS `p` ON (`p`.`content_id` = `c`.`id` AND `p`.`type` = ?) WHERE `c`.`id` = ?", $this->_oConfig->getName(), $iContentId); return $this->getRow($sQuery); } public function updateContentPictureById($iContentId, $iProfileId, $iPictureId, $sFieldPicture) { $sWhere = ''; if ($iProfileId) $sWhere = $this->prepare (" AND `author` = ? ", $iProfileId); $sQuery = $this->prepare ("UPDATE `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` SET `" . $sFieldPicture . "` = ? WHERE `id` = ?", $iPictureId, $iContentId); return $this->res($sQuery . $sWhere); } public function searchByTerm($sTerm, $iLimit) { if (!$this->_oConfig->CNF['FIELDS_QUICK_SEARCH']) return array(); $sWhere = ''; foreach ($this->_oConfig->CNF['FIELDS_QUICK_SEARCH'] as $sField) $sWhere .= $this->prepare(" OR `c`.`$sField` LIKE ? ", '%' . $sTerm . '%'); $sOrderBy = $this->prepare(" ORDER BY `added` DESC LIMIT ?", (int)$iLimit); $sQuery = $this->prepare("SELECT `c`.`id` AS `content_id`, `p`.`account_id`, `p`.`id` AS `profile_id`, `p`.`status` AS `profile_status` FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` AS `c` INNER JOIN `sys_profiles` AS `p` ON (`p`.`content_id` = `c`.`id` AND `p`.`type` = ?) WHERE `p`.`status` = ?", $this->_oConfig->getName(), BX_PROFILE_STATUS_ACTIVE); return $this->getAll($sQuery . " AND (0 $sWhere) " . $sOrderBy); } } /** @} */