<?php /** * @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 03-05-2010 */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $db_slave->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $m_values['module_data'] . '_rows r')->join('INNER JOIN ' . NV_PREFIXLANG . '_' . $m_values['module_data'] . '_detail c ON (r.id=c.id)')->where('(' . nv_like_logic('r.title', $dbkeywordhtml, $logic) . ' OR ' . nv_like_logic('r.hometext', $dbkeyword, $logic) . ' OR ' . nv_like_logic('c.bodyhtml', $dbkeyword, $logic) . ') AND r.status= 1'); $num_items = $db_slave->query($db_slave->sql())->fetchColumn(); if ($num_items) { $array_cat_alias = array(); $array_cat_alias[0] = 'other'; $sql_cat = 'SELECT catid, alias FROM ' . NV_PREFIXLANG . '_' . $m_values['module_data'] . '_cat'; $re_cat = $db_slave->query($sql_cat); while (list($catid, $alias) = $re_cat->fetch(3)) { $array_cat_alias[$catid] = $alias; } $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; $db_slave->select('r.id, r.title, r.alias, r.catid, r.hometext, c.bodyhtml')->order('publtime DESC')->limit($limit)->offset(($page - 1) * $limit); $result = $db_slave->query($db_slave->sql()); while (list($id, $tilterow, $alias, $catid, $hometext, $bodytext) = $result->fetch(3)) { $content = $hometext . strip_tags($bodytext); $url = $link . $array_cat_alias[$catid] . '/' . $alias . '-' . $id . $global_config['rewrite_exturl']; $result_array[] = array('link' => $url, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); } }
function nv_sdown_cats($_mod_table) { global $db; $sql = 'SELECT id, title, alias, groups_view FROM ' . $_mod_table . '_categories WHERE status=1'; $result = $db->query($sql); $list = array(); while ($row = $result->fetch()) { if (nv_user_in_groups($row['groups_view'])) { $list[$row['id']] = array('id' => $row['id'], 'title' => $row['title'], 'alias' => $row['alias']); } } return $list; } } $_mod_table = defined('SYS_DOWNLOAD_TABLE') ? SYS_DOWNLOAD_TABLE : NV_PREFIXLANG . '_' . $m_values['module_data']; $list_cats = nv_sdown_cats($_mod_table); if (!empty($list_cats)) { $_where = 'catid IN (' . implode(',', array_keys($list_cats)) . ') AND (' . nv_like_logic('title', $dbkeyword, $logic) . ' OR ' . nv_like_logic('introtext', $dbkeyword, $logic) . ')'; $db->sqlreset()->select('COUNT(*)')->from($_mod_table)->where($_where); $num_items = $db->query($db->sql())->fetchColumn(); if ($num_items) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; $db->select('alias, title, introtext, catid')->limit($limit)->offset(($page - 1) * $limit); $tmp_re = $db->query($db->sql()); while (list($alias, $tilterow, $introtext, $catid) = $tmp_re->fetch(3)) { $result_array[] = array('link' => $link . $list_cats[$catid]['alias'] . '/' . $alias . $global_config['rewrite_exturl'], 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($introtext, $key, $logic)); } } }
<?php /** * @Project NUKEVIET V3 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 03-05-2010 */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $sql = "SELECT SQL_CALC_FOUND_ROWS `id`,`title`,`description` \r\nFROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "_rows` \r\nWHERE (" . nv_like_logic('title', $dbkeyword, $logic) . " \r\nOR " . nv_like_logic('description', $dbkeyword, $logic) . ") \r\nLIMIT " . $pages . "," . $limit; $tmp_re = $db->sql_query($sql); $result = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($result); if ($all_page) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '=visitlink&id='; while (list($id, $tilterow, $content) = $db->sql_fetchrow($tmp_re)) { $url = $link . $alias . "-" . $id; $result_array[] = array('link' => $link . $id, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); } }
/** * nv_faq_list_cats() * * @param mixed $module_data * @return */ function nv_faq_list_cats($module_data) { global $db; $sql = "SELECT id, title, alias, who_view, groups_view FROM " . NV_PREFIXLANG . "_" . $module_data . "_categories WHERE status=1"; $result = $db->query($sql); $list = array(); while ($row = $result->fetch()) { if (nv_faq_set_allow($row['who_view'], $row['groups_view'])) { $list[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'alias' => $row['alias']); } } return $list; } $list_cats = nv_faq_list_cats($m_values['module_data']); $in = implode(",", array_keys($list_cats)); $sql = "SELECT SQL_CALC_FOUND_ROWS id,question, answer, catid \nFROM " . NV_PREFIXLANG . "_" . $m_values['module_data'] . " \nWHERE catid IN (" . $in . ") \nAND \n(" . nv_like_logic('question', $dbkeyword, $logic) . " \nOR " . nv_like_logic('answer', $dbkeyword, $logic) . ") \nLIMIT " . $pages . "," . $limit; $tmp_re = $db->query($sql); $result = $db->query("SELECT FOUND_ROWS()"); $all_page = $result->fetchColumn(); if ($all_page) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $question, $answer, $catid) = $tmp_re->fetch(3)) { $result_array[] = array('link' => $link . $list_cats[$catid]['alias'] . '#faq' . $id, 'title' => BoldKeywordInStr($question, $key, $logic), 'content' => BoldKeywordInStr($answer, $key, $logic)); } }
<?php /** * @Project NUKEVIET 4.x * @Author KENNY NGUYEN (nguyentiendat713@gmail.com) * @Copyright (C) 2013 Webdep24.com. All rights reserved * @Based on NukeViet CMS * @License GNU/GPL version 2 or any later version * @Createdate Wed, 21 Jan 2015 14:00:59 GMT */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $sql = "SELECT SQL_CALC_FOUND_ROWS id,title,alias,bodytext \nFROM " . NV_PREFIXLANG . "_" . $m_values['module_data'] . " \nWHERE status=1 AND (" . nv_like_logic('title', $dbkeyword, $logic) . " \nOR " . nv_like_logic('bodytext', $dbkeyword, $logic) . ") \nLIMIT " . $pages . "," . $limit; $tmp_re = $db->query($sql); $result = $db->query("SELECT FOUND_ROWS()"); $all_page = $result->fetchColumn(); if ($all_page) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $tilterow, $alias, $content) = $tmp_re->fetch(3)) { $url = $link . $alias . "-" . $id; $result_array[] = array('link' => $url, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); } }
<?php /** * @Project NUKEVIET V3 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 03-05-2010 */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $sql = "SELECT SQL_CALC_FOUND_ROWS `id`,`title`,`alias`,`bodytext` \r\nFROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "` \r\nWHERE (" . nv_like_logic('title', $dbkeyword, $logic) . " \r\nOR " . nv_like_logic('bodytext', $dbkeyword, $logic) . ") \r\nLIMIT " . $pages . "," . $limit; $tmp_re = $db->sql_query($sql); $result = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($result); if ($all_page) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $tilterow, $alias, $content) = $db->sql_fetchrow($tmp_re)) { $url = $link . $alias . "-" . $id; $result_array[] = array('link' => $url, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); } }
<?php /** * @Project NUKEVIET V3 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2012 VINADES.,JSC. All rights reserved * @Createdate 03-05-2010 */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $sql = "SELECT SQL_CALC_FOUND_ROWS r.id, r.title, r.alias, r.catid, r.hometext, c.bodytext \nFROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "_rows` as r \nINNER JOIN `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "_bodytext` as c ON (r.id=c.id) \nWHERE (" . nv_like_logic('r.title', $dbkeyword, $logic) . " \nOR " . nv_like_logic('r.hometext', $dbkeyword, $logic) . ") \nOR " . nv_like_logic('c.bodytext', $dbkeyword, $logic) . " \nAND r.status= 1 \nLIMIT " . $pages . "," . $limit; $tmp_re = $db->sql_query($sql); $result = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($result); if ($all_page) { $array_cat_alias = array(); $array_cat_alias[0] = "other"; $sql_cat = "SELECT `catid`, `alias` FROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "_cat`"; $re_cat = $db->sql_query($sql_cat); while (list($catid, $alias) = $db->sql_fetchrow($re_cat)) { $array_cat_alias[$catid] = $alias; } $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $tilterow, $alias, $catid, $hometext, $bodytext) = $db->sql_fetchrow($tmp_re)) { $content = $hometext . $bodytext; $url = $link . $array_cat_alias[$catid] . '/' . $alias . "-" . $id; $result_array[] = array('link' => $url, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); } }
<?php /** * @Project PaCorp 1x * @Author PaCorp Co.,Ltd (contact@pacorp.vn) * @Copyright (C) 2014 PaCorp Co.,Ltd. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 03-05-2010 */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $db->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $m_values['module_data'])->where('status=1 AND (' . nv_like_logic('title', $dbkeyword, $logic) . ' OR ' . nv_like_logic('description', $dbkeyword, $logic) . ' OR ' . nv_like_logic('bodytext', $dbkeyword, $logic) . ')'); $num_items = $db->query($db->sql())->fetchColumn(); if ($num_items) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; $db->select('id,title, alias, description, bodytext')->limit($limit)->offset(($page - 1) * $limit); $result = $db->query($db->sql()); while (list($id, $tilterow, $alias, $description, $content) = $result->fetch(3)) { $result_array[] = array('link' => $link . $alias . $global_config['rewrite_exturl'], 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($description . ' ' . $content, $key, $logic)); } }
} // Fetch Limit $db->sqlreset()->select('COUNT(*)')->from($db_config['prefix'] . '_' . $m_values['module_data'] . '_group')->where("(" . nv_like_logic(NV_LANG_DATA . '_title', $dbkeywordhtml, $logic) . "\n\t\tOR " . nv_like_logic(NV_LANG_DATA . '_description', $dbkeywordhtml, $logic) . ")"); $num_items = $db->query($db->sql())->fetchColumn(); $db->select('groupid, ' . NV_LANG_DATA . '_title, ' . NV_LANG_DATA . '_alias, ' . NV_LANG_DATA . '_description')->order('groupid DESC'); $tmp_re = $db->query($db->sql()); if ($num_items) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '=group/'; while (list($groupid, $tilterow, $alias, $description) = $tmp_re->fetch(3)) { $content = $description; $url = $link . $alias . $global_config['rewrite_exturl']; $result_array[] = array('link' => $url, 'title' => '[' . $lang_module['group_title'] . '] ' . BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); } } // Fetch Limit $db->sqlreset()->select('COUNT(*)')->from($db_config['prefix'] . '_' . $m_values['module_data'] . '_rows')->where("(" . nv_like_logic(NV_LANG_DATA . '_title', $dbkeywordhtml, $logic) . "\n\t\tOR " . nv_like_logic('product_code', $dbkeyword, $logic) . "\n\t\tOR " . nv_like_logic(NV_LANG_DATA . '_bodytext', $dbkeywordhtml, $logic) . "\n\t\tOR " . nv_like_logic(NV_LANG_DATA . '_hometext', $dbkeywordhtml, $logic) . ")\n\t\tAND ( publtime < " . NV_CURRENTTIME . " AND (exptime=0 OR exptime>" . NV_CURRENTTIME . ") )"); $num_items += $db->query($db->sql())->fetchColumn(); $db->select('id, ' . NV_LANG_DATA . '_title,' . NV_LANG_DATA . '_alias, listcatid, ' . NV_LANG_DATA . '_hometext, ' . NV_LANG_DATA . '_bodytext')->order('id DESC')->limit($limit)->offset(($page - 1) * $limit); $tmp_re = $db->query($db->sql()); if ($num_items) { $array_cat_alias = array(); $sql = 'SELECT catid, ' . NV_LANG_DATA . '_alias AS alias FROM ' . $db_config['prefix'] . '_' . $m_values['module_data'] . '_catalogs'; $array_cat_alias = nv_db_cache($sql, 'catid', $m_values['module_name']); $array_cat_alias[0] = array('alias' => 'Other'); $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $tilterow, $alias, $listcatid, $hometext, $bodytext) = $tmp_re->fetch(3)) { $content = $hometext . $bodytext; $catid = explode(',', $listcatid); $catid = end($catid); $url = $link . $array_cat_alias[$catid]['alias'] . '/' . $alias . $global_config['rewrite_exturl']; $result_array[] = array('link' => $url, 'title' => '[' . $lang_module['cart_products'] . '] ' . BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic));
<?php /** * @Project NUKEVIET V3 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 03-05-2010 */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $sql = "SELECT SQL_CALC_FOUND_ROWS `id`,`title`,`alias`,`listcatid`,`hometext`,`bodytext` \r\nFROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "_rows` \r\nWHERE (" . nv_like_logic('title', $dbkeyword, $logic) . " \r\nOR " . nv_like_logic('bodytext', $dbkeyword, $logic) . " \r\nOR " . nv_like_logic('hometext', $dbkeyword, $logic) . ") \r\nAND ( `publtime` < " . NV_CURRENTTIME . " AND (`exptime`=0 OR `exptime`>" . NV_CURRENTTIME . ") ) \r\nLIMIT " . $pages . "," . $limit; $tmp_re = $db->sql_query($sql); $result = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($result); if ($all_page) { $array_cat_alias = array(); $array_cat_alias[0] = "other"; $sql_cat = "SELECT `catid`, `alias` FROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "_cat`"; $re_cat = $db->sql_query($sql_cat); while (list($catid, $alias) = $db->sql_fetchrow($re_cat)) { $array_cat_alias[$catid] = $alias; } $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $tilterow, $alias, $listcatid, $hometext, $bodytext) = $db->sql_fetchrow($tmp_re)) { $content = $hometext . $bodytext; $catid = explode(",", $listcatid); $catid = end($catid); $url = $link . $array_cat_alias[$catid] . '/' . $alias . "-" . $id; $result_array[] = array('link' => $url, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); }
/** * nv_faq_list_cats() * * @param mixed $module_data * @return */ function nv_faq_list_cats($module_data) { global $db; $sql = "SELECT `id`, `title`, `alias`, `who_view`, `groups_view` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `status`=1"; $result = $db->sql_query($sql); $list = array(); while ($row = $db->sql_fetchrow($result)) { if (nv_faq_set_allow($row['who_view'], $row['groups_view'])) { $list[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'alias' => $row['alias']); } } return $list; } $list_cats = nv_faq_list_cats($m_values['module_data']); $in = implode(",", array_keys($list_cats)); $sql = "SELECT SQL_CALC_FOUND_ROWS `id`,`question`, `answer`, `catid` \r\nFROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "` \r\nWHERE `catid` IN (" . $in . ") \r\nAND \r\n(" . nv_like_logic('question', $dbkeyword, $logic) . " \r\nOR " . nv_like_logic('answer', $dbkeyword, $logic) . ") \r\nLIMIT " . $pages . "," . $limit; $tmp_re = $db->sql_query($sql); $result = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($result); if ($all_page) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $question, $answer, $catid) = $db->sql_fetchrow($tmp_re)) { $result_array[] = array('link' => $link . $list_cats[$catid]['alias'] . '#faq' . $id, 'title' => BoldKeywordInStr($question, $key, $logic), 'content' => BoldKeywordInStr($answer, $key, $logic)); } }
/** * nv_faq_list_cats() * * @param mixed $module_data * @return */ function nv_faq_list_cats($module_data) { global $db; $sql = "SELECT id, title, alias, groups_view FROM " . NV_PREFIXLANG . "_" . $module_data . "_categories WHERE status=1"; $result = $db->query($sql); $list = array(); while ($row = $result->fetch()) { if (nv_user_in_groups($row['groups_view'])) { $list[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'alias' => $row['alias']); } } return $list; } $list_cats = nv_faq_list_cats($m_values['module_data']); $in = implode(",", array_keys($list_cats)); $db->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $m_values['module_data'])->where("catid IN (" . $in . ") \n\tAND \n\t(" . nv_like_logic('question', $dbkeyword, $logic) . " \n\tOR " . nv_like_logic('answer', $dbkeyword, $logic) . ")"); $num_items = $db->query($db->sql())->fetchColumn(); if ($num_items) { $db->select('id,question, answer, catid')->order('id DESC')->limit($limit)->offset(($page - 1) * $limit); $tmp_re = $db->query($db->sql()); $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($id, $question, $answer, $catid) = $tmp_re->fetch(3)) { $result_array[] = array('link' => $link . $list_cats[$catid]['alias'] . '#faq' . $id, 'title' => BoldKeywordInStr($question, $key, $logic), 'content' => BoldKeywordInStr($answer, $key, $logic)); } }
* * @param mixed $module_data * @return */ function nv_sdown_cats($module_data) { global $db; $sql = "SELECT `id`, `title`, `alias`, `who_view`, `groups_view` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `status`=1"; $result = $db->sql_query($sql); $list = array(); while ($row = $db->sql_fetchrow($result)) { if (nv_set_allow($row['who_view'], $row['groups_view'])) { $list[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'alias' => $row['alias']); } } return $list; } } $list_cats = nv_sdown_cats($m_values['module_data']); $in = implode(",", array_keys($list_cats)); $sql = "SELECT SQL_CALC_FOUND_ROWS `alias`,`title`,`description`, `introtext`, `catid` \nFROM `" . NV_PREFIXLANG . "_" . $m_values['module_data'] . "` \nWHERE `catid` IN (" . $in . ") \nAND (" . nv_like_logic('title', $dbkeyword, $logic) . " \nOR " . nv_like_logic('description', $dbkeyword, $logic) . " \nOR " . nv_like_logic('introtext', $dbkeyword, $logic) . ") \nLIMIT " . $pages . "," . $limit; $tmp_re = $db->sql_query($sql); $result = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($result); if ($all_page) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; while (list($alias, $tilterow, $content, $introtext, $catid) = $db->sql_fetchrow($tmp_re)) { $content = $content . ' ' . $introtext; $result_array[] = array('link' => $link . $list_cats[$catid]['alias'] . '/' . $alias, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); } }
<?php /** * @Project PHOTOS 4.x * @Author KENNY NGUYEN (nguyentiendat713@gmail.com) * @Copyright (C) 2015 tradacongnghe.com. All rights reserved * @Based on NukeViet CMS * @License GNU/GPL version 2 or any later version * @Createdate Fri, 18 Sep 2015 11:52:59 GMT */ if (!defined('NV_IS_MOD_SEARCH')) { die('Stop!!!'); } $db->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $m_values['module_data'] . '_album a ')->join('LEFT JOIN ' . NV_PREFIXLANG . '_' . $m_values['module_data'] . '_category c ON (c.category_id=a.category_id)')->where('(' . nv_like_logic('a.name', $dbkeyword, $logic) . ' OR ' . nv_like_logic('a.description', $dbkeyword, $logic) . ') AND a.status=1'); $num_items = $db->query($db->sql())->fetchColumn(); if ($num_items) { $array_cat_alias = array(); $array_cat_alias[0] = 'other'; $db->select('c.category_id, c.alias '); $re_cat = $db->query($db->sql()); while (list($category_id, $alias) = $re_cat->fetch(3)) { $array_cat_alias[$category_id] = $alias; } $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $m_values['module_name'] . '&' . NV_OP_VARIABLE . '='; $db->select('a.album_id, a.name, a.category_id, a.alias, a.description')->order('a.date_added DESC')->limit($limit)->offset(($page - 1) * $limit); $result = $db->query($db->sql()); while (list($album_id, $tilterow, $category_id, $alias, $description) = $result->fetch(3)) { $content = $description; $url = $link . $array_cat_alias[$category_id] . '/' . $alias . "-" . $album_id . $global_config['rewrite_exturl']; $result_array[] = array('link' => $url, 'title' => BoldKeywordInStr($tilterow, $key, $logic), 'content' => BoldKeywordInStr($content, $key, $logic)); }