if (!empty($key)) { $keyword = '%' . addcslashes($key, '_%') . '%'; $sth->bindParam(':keyword1', $keyword, PDO::PARAM_STR); $sth->bindParam(':keyword2', $keyword, PDO::PARAM_STR); $sth->bindParam(':keyword3', $keyword, PDO::PARAM_STR); } $sth->execute(); while ($row = $sth->fetch()) { $cattitle = '<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '">' . $list_cats[$row['catid']]['title'] . '</a>'; $uploadtime = (int) $row['uploadtime']; if ($uploadtime >= $today) { $uploadtime = $lang_module['today'] . ', ' . date('H:i', $row['uploadtime']); } elseif ($uploadtime >= $yesterday) { $uploadtime = $lang_module['yesterday'] . ', ' . date('H:i', $row['uploadtime']); } else { $uploadtime = nv_date('d/m/Y H:i', $row['uploadtime']); } $array[$row['id']] = array('id' => $row['id'], 'title' => $row['title'], 'cattitle' => $cattitle, 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => $row['author_name'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : '', 'imagesrc' => !empty($row['fileimage']) ? NV_BASE_SITEURL . NV_FILES_DIR . $row['fileimage'] : '', 'view_hits' => $row['view_hits'], 'download_hits' => $row['download_hits'], 'more_link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'], 'edit_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&edit=1&id=' . $row['id'] : '', 'del_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name : ''); } $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page); $contents = theme_viewcat_list($array, $generate_page); if ($page > 1) { $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page; } } else { $contents = $lang_module['search_noresult']; } $key_words = $description = 'no'; include NV_ROOTDIR . '/includes/header.php'; echo nv_site_theme($contents); include NV_ROOTDIR . '/includes/footer.php';
/** * theme_viewcat_main() * * @param mixed $viewcat * @param mixed $array_cats * @param mixed $list_cats * @param mixed $download_config * @return */ function theme_viewcat_main($viewcat, $array_cats, $array_files = array(), $cat_data = array(), $generate_page = '') { global $global_config, $site_mods, $lang_module, $lang_global, $module_info, $module_name, $module_file, $my_head, $download_config, $list_cats; $xtpl = new XTemplate($viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/'); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); $xtpl->assign('IMG_FOLDER', NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/download/'); $xtpl->assign('MODULELINK', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '='); foreach ($array_cats as $cat) { if (empty($cat['parentid'])) { if ($download_config['is_addfile_allow']) { $cat['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'] . '/' . $cat['catid']; } $xtpl->assign('catbox', $cat); if (!empty($cat['subcats'])) { $i = 0; foreach ($list_cats as $subcat) { if ($subcat['parentid'] == $cat['catid']) { $subcat['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $subcat['alias']; $xtpl->assign('listsubcat', $subcat); if (++$i >= 3) { $xtpl->assign('MORE', $cat['link']); $xtpl->parse('main.catbox.subcatbox.more'); break; } $xtpl->parse('main.catbox.subcatbox.listsubcat'); } } $xtpl->parse('main.catbox.subcatbox'); } $items = $cat['items']; #parse the first items $thefirstcat = current($items); $xtpl->assign('itemcat', $thefirstcat); if (!empty($thefirstcat['imagesrc'])) { $xtpl->parse('main.catbox.itemcat.image'); } if (defined('NV_IS_MODADMIN')) { $xtpl->assign('EDIT', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&edit=1&id=' . $thefirstcat['id']); $xtpl->assign('DEL', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name); $xtpl->parse('main.catbox.itemcat.adminlink'); } if ($download_config['is_addfile_allow']) { $xtpl->parse('main.catbox.is_addfile_allow'); } $xtpl->parse('main.catbox.itemcat'); foreach ($items as $item) { if ($item['id'] != $thefirstcat['id']) { $xtpl->assign('loop', $item); $xtpl->parse('main.catbox.related.loop'); } } $xtpl->parse('main.catbox.related'); $xtpl->parse('main.catbox'); } } // Danh sach file trong chu de if (!empty($array_files)) { if (!empty($cat_data)) { $xtpl->assign('CAT_TITLE', sprintf($lang_module['viewcat_listfile'], $cat_data['title'])); } $xtpl->assign('FILE_LIST', theme_viewcat_list($array_files, $generate_page, $cat_data, false)); $xtpl->parse('main.filelist'); } $xtpl->parse('main'); return $xtpl->text('main'); }
$array_cats[$catid_i]['items'] = $array_item; } } } $contents = theme_viewcat_main($viewcat, $array_cats); } elseif ($viewcat == 'viewcat_list_new') { $array_files = array(); $base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name; // Fetch Limit $db->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $module_data)->where('status=1'); $all_page = $db->query($db->sql())->fetchColumn(); $db->select('id, catid, title, alias, introtext , uploadtime, author_name, filesize, fileimage, view_hits, download_hits, comment_hits')->order('uploadtime DESC')->limit($per_page)->offset(($page - 1) * $per_page); $_query = $db->query($db->sql()); while ($row = $_query->fetch()) { $uploadtime = (int) $row['uploadtime']; if ($uploadtime >= $today) { $uploadtime = $lang_module['today'] . ', ' . date('H:i', $row['uploadtime']); } elseif ($uploadtime >= $yesterday) { $uploadtime = $lang_module['yesterday'] . ', ' . date('H:i', $row['uploadtime']); } else { $uploadtime = nv_date('d/m/Y H:i', $row['uploadtime']); } $array_files[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => !empty($row['author_name']) ? $row['author_name'] : $lang_module['unknown'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : '', 'imagesrc' => !empty($row['fileimage']) ? NV_BASE_SITEURL . NV_FILES_DIR . $row['fileimage'] : '', 'view_hits' => (int) $row['view_hits'], 'download_hits' => (int) $row['download_hits'], 'comment_hits' => (int) $row['comment_hits'], 'more_link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'], 'edit_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&edit=1&id=' . $row['id'] : '', 'del_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name : ''); } $page_title = $page > 1 ? $page_title . ' - ' . $lang_module['page'] . ' ' . $page : $page_title; $page = nv_alias_page($page_title, $base_url, $all_page, $per_page, $page); $contents = theme_viewcat_list($array_files, $page); } include NV_ROOTDIR . '/includes/header.php'; echo nv_site_theme($contents); include NV_ROOTDIR . '/includes/footer.php';
/** * theme_search() * * @param mixed $array * @param mixed $generate_page * @param mixed $is_search * @return */ function theme_search($array, $generate_page, $is_search) { global $module_info, $module_name, $module_file, $lang_module, $lang_global; $xtpl = new XTemplate('search.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/'); $xtpl->assign('LANG', $lang_module); if ($is_search) { if (!empty($array)) { $xtpl->assign('SEARCH', theme_viewcat_list($array, $generate_page, array(), false, false)); $xtpl->parse('main.is_search.data'); } else { $xtpl->parse('main.is_search.empty'); } $xtpl->parse('main.is_search'); } else { $xtpl->parse('main.not_search'); } $xtpl->parse('main'); return $xtpl->text('main'); }