function display_page($p) { $page = $this->db->quick_query('SELECT * FROM %ppages WHERE page_id=%d', $p); if (!$page) { return $this->error('The page you are looking for does not exist. It may have been deleted or the URL is incorrect.', 404); } $xtpl = new XTemplate('./skins/' . $this->skin . '/page.xtpl'); $this->title($page['page_title']); $this->meta_description($page['page_meta']); $sidebar = null; $content = $this->format($page['page_content'], $page['page_flags']); if ($page['page_flags'] & POST_HTML && $page['page_flags'] & POST_BBCODE) { $content = html_entity_decode($content, ENT_COMPAT, 'UTF-8'); } $xtpl->assign('content', $content); if ($page['page_flags'] & POST_SIDEBAR) { $SideBar = new sidebar($this); $sidebar = $SideBar->build_sidebar(); $xtpl->parse('Page.HasSidebar'); } else { $xtpl->parse('Page.NoSidebar'); } $xtpl->assign('sidebar', $sidebar); $xtpl->parse('Page'); return $xtpl->text('Page'); }
function nv_block_archives_search() { global $lang_module, $module_name, $module_data, $module_file, $module_config, $module_info, $global_archives_cat, $nv_Request, $array_op; $q = $nv_Request->get_string('q', 'get', ''); $oid = $nv_Request->get_int('catid', 'get', 0); if (!empty($global_archives_cat)) { $xtpl = new XTemplate("block_search.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('SEARCH', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=search"); $xtpl->assign('LANG', $lang_module); foreach ($global_archives_cat as $catid => $catinfo) { if ($catinfo['parentid'] == '0') { $xtpl->assign('ROW', $catinfo); $xtpl->parse('main.loop'); } $xtitle = ""; if ($catinfo['lev'] > 0) { for ($i = 1; $i <= $catinfo['lev']; $i++) { $xtitle .= " "; } } $catinfo['xtitle'] = $xtitle . $catinfo['title']; $catinfo['select'] = $catinfo['catid'] == $oid ? "selected=\"selected\"" : ""; $xtpl->assign('PAR', $catinfo); $xtpl->parse('main.parent_loop'); } $xtpl->assign('text_search', $q); $xtpl->parse('main'); return $xtpl->text('main'); } return ""; }
/** * nv_page_list() * * @return */ function nv_page_list($block_config) { global $global_config, $site_mods, $db, $module_name; $module = $block_config['module']; if (!isset($site_mods[$module])) { return ''; } $db->sqlreset()->select('id, title, alias')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status = 1')->order('weight ASC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), 'id', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/page/block.page_list.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/page/block.page_list.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block.page_list.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/page'); foreach ($list as $l) { $l['title_clean60'] = nv_clean60($l['title'], $block_config['title_length']); $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $l['alias'] . $global_config['rewrite_exturl']; $xtpl->assign('ROW', $l); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } else { return ''; } }
/** * nv_theme_event_detail() * * @param mixed $array_data * @return */ function nv_theme_event_detail($array_data) { global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info, $op, $global_array_event_cat; if (NV_CURRENTTIME >= $array_data['start_time'] and NV_CURRENTTIME <= $array_data['end_time']) { $array_data['status_str'] = $lang_module['status_2']; } elseif (NV_CURRENTTIME < $array_data['start_time']) { $array_data['status_str'] = $lang_module['status_1']; } else { $array_data['status_str'] = $lang_module['status_0']; } $array_data['start_date'] = nv_date('d/m/Y', $array_data['start_time']); $array_data['start_time'] = nv_date('H:i', $array_data['start_time']); $array_data['end_date'] = nv_date('d/m/Y', $array_data['end_time']); $array_data['end_time'] = nv_date('H:i', $array_data['end_time']); $array_data['title_cat'] = $global_array_event_cat[$array_data['catid']]['title']; $array_data['url_cat'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_event_cat[$array_data['catid']]['alias']; $xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('DATA', $array_data); if ($array_data['start_date'] == $array_data['end_date']) { $xtpl->parse('main.day'); } else { $xtpl->parse('main.longday'); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * main_theme() * * @param mixed $contents * @return */ function main_theme($contents) { if (empty($contents)) { return ''; } global $global_config, $module_file; $xtpl = new XTemplate('cronjobs_list.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); foreach ($contents as $id => $values) { $xtpl->assign('DATA', array('caption' => $values['caption'], 'edit' => empty($values['edit']) ? array() : $values['edit'], 'disable' => empty($values['disable']) ? array() : $values['disable'], 'delete' => empty($values['delete']) ? array() : $values['delete'], 'id' => $id)); if (!empty($values['edit'][0])) { $xtpl->parse('main.edit'); } if (!empty($values['disable'][0])) { $xtpl->parse('main.disable'); } if (!empty($values['delete'][0])) { $xtpl->parse('main.delete'); } $a = 0; foreach ($values['detail'] as $key => $value) { $xtpl->assign('ROW', array('key' => $key, 'value' => $value)); $xtpl->parse('main.loop'); } $xtpl->parse('main'); } return $xtpl->text('main'); }
/** * nv_show_sources_list() * * @return * */ function nv_show_sources_list() { global $db, $lang_module, $lang_global, $module_name, $module_data, $nv_Request, $module_file, $global_config; $num = $db->query('SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources')->fetchColumn(); $base_url = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_data . '&' . NV_OP_VARIABLE . '=sources'; $num_items = $num > 1 ? $num : 1; $per_page = 15; $page = $nv_Request->get_int('page', 'get', 1); $xtpl = new XTemplate('sources_list.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); if ($num > 0) { $db->sqlreset()->select('*')->from(NV_PREFIXLANG . '_' . $module_data . '_sources')->order('weight')->limit($per_page)->offset(($page - 1) * $per_page); $result = $db->query($db->sql()); while ($row = $result->fetch()) { $xtpl->assign('ROW', array('sourceid' => $row['sourceid'], 'title' => $row['title'], 'link' => $row['link'], 'url_edit' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=sources&sourceid=' . $row['sourceid'] . '#edit')); for ($i = 1; $i <= $num; ++$i) { $xtpl->assign('WEIGHT', array('key' => $i, 'title' => $i, 'selected' => $i == $row['weight'] ? ' selected="selected"' : '')); $xtpl->parse('main.loop.weight'); } $xtpl->parse('main.loop'); } $result->closeCursor(); $generate_page = nv_generate_page($base_url, $num_items, $per_page, $page); if (!empty($generate_page)) { $xtpl->assign('GENERATE_PAGE', $generate_page); $xtpl->parse('main.generate_page'); } $xtpl->parse('main'); $contents = $xtpl->text('main'); } else { $contents = ' '; } return $contents; }
function getEditor() { $xtpl = new XTemplate(dirname(__FILE__) . '/editor.xtpl'); $xtpl->parse('main.menu_item_list'); $xtpl->parse('main'); return $xtpl->text('main'); }
/** * viewdirtree() * * @param mixed $dir * @param mixed $currentpath * @return */ function viewdirtree($dir, $currentpath) { global $array_dirname, $global_config, $module_file; $pattern = !empty($dir) ? '/^(' . nv_preg_quote($dir) . ')\\/([^\\/]+)$/' : '/^([^\\/]+)$/'; $_dirlist = preg_grep($pattern, array_keys($array_dirname)); $content = ''; foreach ($_dirlist as $_dir) { $check_allow_upload_dir = nv_check_allow_upload_dir($_dir); if (!empty($check_allow_upload_dir)) { $class_li = ($_dir == $currentpath or strpos($currentpath, $_dir . '/') !== false) ? 'open collapsable' : 'expandable'; $style_color = $_dir == $currentpath ? ' style="color:red"' : ''; $tree = array(); $tree['class1'] = $class_li; $tree['class2'] = nv_set_dir_class($check_allow_upload_dir) . ' pos' . nv_string_to_filename($dir); $tree['style'] = $style_color; $tree['title'] = $_dir; $tree['titlepath'] = basename($_dir); $content2 = viewdirtree($_dir, $currentpath); $xtpl = new XTemplate('foldlist.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('DIRTREE', $tree); if (empty($content2)) { $content2 = '<li class="hide"> </li>'; } if (!empty($content2)) { $xtpl->assign('TREE_CONTENT', $content2); $xtpl->parse('tree.tree_content'); } $xtpl->parse('tree'); $content .= $xtpl->text('tree'); } } return $content; }
function nv_block_language($block_config) { global $global_config, $site_mods, $lang_global, $language_array; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.block_language.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.block_language.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('global.block_language.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks'); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('BLOCK_THEME', $block_theme); $xtpl->assign('SELECT_LANGUAGE', $lang_global['langsite']); // Multiple languages if ($global_config['lang_multi'] and sizeof($global_config['allow_sitelangs']) > 1) { foreach ($global_config['allow_sitelangs'] as $lang_i) { $xtpl->assign('LANGSITENAME', $language_array[$lang_i]['name']); $xtpl->assign('LANGSITEURL', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . $lang_i); if (NV_LANG_DATA != $lang_i) { $xtpl->parse('main.language.langitem'); } else { $xtpl->parse('main.language.langcuritem'); } } $xtpl->parse('main.language'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_weather_blocks($block_config) { global $global_config, $site_mods, $db, $module_name; $module = $block_config['module']; $array_th = array(); $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_weather WHERE status = 1 ORDER BY weight ASC'; $list = nv_db_cache($sql, '', $module); if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/weather/block.weather.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/weather/block.weather.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block.weather.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/weather'); $xtpl->assign('TEMPLATE', $block_theme); $xtpl->assign('CODE', $block_config['location']); $xtpl->assign('NUM_DAY', $block_config['numday']); foreach ($list as $row) { $block_config['location'] == $row['location_code'] ? $row['selected'] = ' selected="selected"' : ($row['selected'] = ''); $xtpl->assign('ROW', $row); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_menu_theme_default_footer() * * @param mixed $block_config * @return * */ function nv_menu_theme_default_footer($block_config) { global $global_config, $site_mods, $lang_global, $module_name, $home; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.menu_footer.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.menu_footer.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('global.menu_footer.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks'); $xtpl->assign('LANG', $lang_global); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('BLOCK_THEME', $block_theme); $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA); $a = 0; foreach ($site_mods as $modname => $modvalues) { if (in_array($modname, $block_config['module_in_menu']) and !empty($modvalues['funcs'])) { $_array_menu = array('title' => $modvalues['custom_title'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $modname); $xtpl->assign('FOOTER_MENU', $_array_menu); $xtpl->parse('main.footer_menu'); ++$a; } } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_page_list() * * @return */ function nv_page_list($block_config) { global $global_config, $site_mods, $db, $module_name; $module = $block_config['module']; if (!isset($site_mods[$module])) { return ''; } $db->sqlreset()->select('id, title, phone,phone1,image')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status = 1')->order('weight ASC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), 'id', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/nhan-vien/block.nhanvien.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/nhan-vien/block.nhanvien.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block.nhanvien.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/nhan-vien'); foreach ($list as $l) { $l['img'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['image']; $xtpl->assign('ROW', $l); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } else { return ''; } }
/** * viewdirtree() * * @param mixed $dir * @param mixed $currentpath * @return */ function viewdirtree($dir, $currentpath) { global $dirlist, $global_config, $module_file; $pattern = !empty($dir) ? "/^(" . nv_preg_quote($dir) . ")\\/([^\\/]+)\$/" : "/^([^\\/]+)\$/"; $_dirlist = preg_grep($pattern, $dirlist); $content = ""; foreach ($_dirlist as $_dir) { $check_allow_upload_dir = nv_check_allow_upload_dir($_dir); if (!empty($check_allow_upload_dir)) { $class_li = ($_dir == $currentpath or strpos($currentpath, $_dir . '/') !== false) ? "open collapsable" : "expandable"; $style_color = $_dir == $currentpath ? ' style="color:red"' : ''; $tree = array(); $tree['class1'] = $class_li; $tree['class2'] = nv_set_dir_class($check_allow_upload_dir) . " pos" . nv_string_to_filename($dir); $tree['style'] = $style_color; $tree['title'] = $_dir; $tree['titlepath'] = basename($_dir); $content2 = viewdirtree($_dir, $currentpath); $xtpl = new XTemplate("foldlist.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign("DIRTREE", $tree); if (!empty($content2)) { $xtpl->assign("TREE_CONTENT", $content2); $xtpl->parse('tree.tree_content'); } $xtpl->parse('tree'); $content .= $xtpl->text('tree'); } } return $content; }
/** * nv_page_main_list() * * @param mixed $array_data * @return */ function nv_page_main_list($array_data, $generate_page) { global $module_file, $lang_module, $module_upload, $module_info, $meta_property, $my_head, $client_info, $page_config, $module_name; $template = file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/main_list.tpl') ? $module_info['template'] : 'default'; $xtpl = new XTemplate('main_list.tpl', NV_ROOTDIR . '/themes/' . $template . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); if (!empty($array_data)) { foreach ($array_data as $data) { if (!empty($data['image'])) { $data['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $data['image']; $data['imagealt'] = !empty($data['imagealt']) ? $data['imagealt'] : $data['title']; } $xtpl->assign('DATA', $data); if (!empty($data['image'])) { $xtpl->parse('main.loop.image'); } $xtpl->parse('main.loop'); } if ($generate_page != '') { $xtpl->assign('GENERATE_PAGE', $generate_page); } } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * main action */ public function mainAction() { $template['file'] = ONXSHOP_DIR . "templates/{$this->GET['template']}"; $tpl = new XTemplate($template['file']); $tpl->parse('title'); $tpl->parse('description'); $tpl->parse('keywords'); $tpl->parse('head'); $template['title'] = $tpl->text('title'); $template['description'] = $tpl->text('description'); $template['keywords'] = $tpl->text('keywords'); $template['head'] = $tpl->text('head'); if (file_exists($template['file'])) { $file_content = file($template['file']); foreach ($file_content as $file_line) { $proc = 1; if (preg_match('/<\\!-- BEGIN: content -->/', $file_line)) { $add = 1; $proc = 0; } else { if (preg_match('/<\\!-- END: content -->/', $file_line)) { $add = 0; } } if ($add == 1 && $proc == 1) { $template['content'] = $template['content'] . $file_line; } } } else { msg("template {$template['file']} does not exists!", 'error', 1); } $this->tpl->assign('template', $template); return true; }
function nv_block_counter() { global $global_config, $db, $lang_global; if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/blocks/global.counter.tpl")) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/blocks/global.counter.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } $xtpl = new XTemplate("global.counter.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks"); $xtpl->assign('LANG', $lang_global); $xtpl->assign('IMG_PATH', NV_BASE_SITEURL . "themes/" . $block_theme . "/"); $sql = "SELECT `c_type`, `c_val`, `c_count` FROM `" . NV_COUNTER_TABLE . "`"; $query = $db->sql_query($sql); while (list($c_type, $c_val, $c_count) = $db->sql_fetchrow($query)) { if ($c_type == 'day' and $c_val == NV_CURRENTDAY_2NUM) { $xtpl->assign('COUNT_DAY', $c_count); } elseif ($c_type == 'month' and $c_val == NV_CURRENTMONTH_STXT) { $xtpl->assign('COUNT_MONTH', $c_count); } elseif ($c_type == 'total' and $c_val == 'hits') { $xtpl->assign('COUNT_ALL', $c_count); } } $sql = "SELECT `uid`, `full_name` FROM `" . NV_SESSIONS_GLOBALTABLE . "` WHERE `onl_time` >= " . NV_DEL_ONLINE_TIME; $query = $db->sql_query($sql); $count_online = $users = $bots = $guests = 0; while ($row = $db->sql_fetchrow($query)) { $count_online++; if ($row['uid'] != 0) { $users++; } else { if (preg_match("/^bot\\:/", $row['full_name'])) { $bots++; } else { $guests++; } } } $xtpl->assign('COUNT_ONLINE', $count_online); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); if ($users) { $xtpl->assign('COUNT_USERS', $users); $xtpl->parse('main.users'); } if ($bots) { $xtpl->assign('COUNT_BOTS', $bots); $xtpl->parse('main.bots'); } if ($guests and $guests != $count_online) { $xtpl->assign('COUNT_GUESTS', $guests); $xtpl->parse('main.guests'); } $xtpl->parse('main'); $content = $xtpl->text('main'); return $content; }
public function indexAction() { global $structure; if (!cot_module_active('rss')) { cot_die_message(404, TRUE); } $c = cot_import('c', 'G', 'TXT'); if (!empty($c)) { if (!isset($structure['advboard'][$c])) { cot_die_message(404, TRUE); } list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', $c); cot_block(cot::$usr['auth_read']); } $rss_title = cot::$L['advboard_rss_feed'] . cot::$cfg['maintitle']; $rss_link = cot::$cfg['mainurl']; $rss_description = cot::$cfg['subtitle']; $domain = cot::$sys['domain']; $condition = array(array('state', advboard_model_Advert::PUBLISHED), array('begin', cot::$sys['now'], '<='), array('SQL', "expire = 0 OR expire > " . cot::$sys['now'])); if (!empty($c)) { $rss_title = cot::$L['advboard_rss_feed'] . $structure['advboard'][$c]['title'] . ' - ' . cot::$cfg['maintitle']; $condition[] = array('category', $c); } $advertisement = advboard_model_Advert::find($condition, cot::$cfg['rss']['rss_maxitems'], 0, array(array('sort', 'desc'))); $t = new XTemplate(cot_tplfile('rss')); $now = cot::$sys['now']; $now += cot::$usr['timezone'] * 3600; $t->assign(array('RSS_ENCODING' => cot::$cfg['rss']['rss_charset'], 'RSS_TITLE' => htmlspecialchars($rss_title), 'RSS_LINK' => $rss_link, 'RSS_LANG' => cot::$cfg['defaultlang'], 'RSS_DESCRIPTION' => htmlspecialchars($rss_description), 'RSS_DATE' => $this->fixPubDate(date("r", $now)))); if (!empty($advertisement)) { foreach ($advertisement as $advert) { $url = $advert->url; if (!cot_url_check($url)) { $url = COT_ABSOLUTE_URL . $url; } $date = ''; if (!empty($advert->created)) { $date = strtotime($advert->created); $date += cot::$usr['timezone'] * 3600; $date = date('r', $date); $date = $this->fixPubDate($date); } $text = $advert->text; $textlength = intval(cot::$cfg['rss']['rss_pagemaxsymbols']); if ($textlength > 0 && mb_strlen($text) > $textlength) { $text = cot_string_truncate($text, $textlength, true, false, cot::$R['advboard_cuttext']); } $t->assign(array('RSS_ROW_TITLE' => htmlspecialchars($advert->title), 'RSS_ROW_DESCRIPTION' => $this->convertRelativeUrls($text), 'RSS_ROW_DATE' => $date, 'RSS_ROW_LINK' => $url)); $t->parse('MAIN.ITEM_ROW'); } } $t->parse('MAIN'); // ob_clean(); header('Content-type: text/xml; charset=UTF-8'); echo $t->text('MAIN'); exit; }
/** * Success display function * @param array $oks Success messages * @param XTemplate $t1 XTemplate object */ function oks($oks, $t1) { if (!empty($oks)) { foreach ($oks as $key => $msg) { $t1->assign('OK_ROW_MSG', $msg); $t1->parse('MAIN.OK.OK_ROW'); } $t1->parse('MAIN.OK'); } }
function nv_block_counter_button() { global $global_config, $db, $lang_global; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/statistics/global.counter_button.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/statistics/global.counter_button.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('global.counter_button.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/statistics'); $xtpl->assign('LANG', $lang_global); $xtpl->assign('IMG_PATH', NV_BASE_SITEURL . 'themes/' . $block_theme . '/'); $sql = "SELECT c_type, c_count FROM " . NV_COUNTER_GLOBALTABLE . " WHERE (c_type='day' AND c_val='" . date('d', NV_CURRENTTIME) . "') OR (c_type='month' AND c_val='" . date('M', NV_CURRENTTIME) . "') OR (c_type='total' AND c_val='hits')"; $query = $db->query($sql); while (list($c_type, $c_count) = $query->fetch(3)) { if ($c_type == 'day') { $xtpl->assign('COUNT_DAY', number_format($c_count)); } elseif ($c_type == 'month') { $xtpl->assign('COUNT_MONTH', number_format($c_count)); } elseif ($c_type == 'total') { $xtpl->assign('COUNT_ALL', number_format($c_count)); } } $sql = 'SELECT userid, username FROM ' . NV_SESSIONS_GLOBALTABLE . ' WHERE onl_time >= ' . (NV_CURRENTTIME - NV_ONLINE_UPD_TIME); $query = $db->query($sql); $count_online = $users = $bots = $guests = 0; while ($row = $query->fetch()) { ++$count_online; if ($row['userid']) { ++$users; } elseif (preg_match('/^bot\\:/', $row['username'])) { ++$bots; } else { ++$guests; } } $xtpl->assign('COUNT_ONLINE', number_format($count_online)); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); if ($users) { $xtpl->assign('COUNT_USERS', number_format($users)); $xtpl->parse('main.users'); } if ($bots) { $xtpl->assign('COUNT_BOTS', number_format($bots)); $xtpl->parse('main.bots'); } if ($guests and $guests != $count_online) { $xtpl->assign('COUNT_GUESTS', number_format($guests)); $xtpl->parse('main.guests'); } $xtpl->parse('main'); $content = $xtpl->text('main'); return $content; }
function nv_block_thongbao() { global $global_config, $site_mods, $db, $module_name, $global_array_cat, $lang_global; if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/blocks/global.thongbao.tpl")) { $cp_block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/blocks/global.thongbao.tpl")) { $cp_block_theme = $global_config['site_theme']; } else { $cp_block_theme = "default"; } $xtpl = new XTemplate("global.thongbao.tpl", NV_ROOTDIR . "/themes/" . $cp_block_theme . "/blocks"); $sql_news_module = "SELECT `title`,`module_data` FROM `" . NV_PREFIXLANG . "_modules` WHERE `module_file` = 'news'"; $news_modules = $db->sql_query($sql_news_module); while (list($cp_module_title, $cp_module_data) = $db->sql_fetchrow($news_modules)) { $sql = "SELECT id, listcatid, publtime, exptime, title, alias, homeimgthumb FROM `" . NV_PREFIXLANG . "_" . $cp_module_data . "_rows` WHERE `status`= 1 AND `publtime` < " . NV_CURRENTTIME . " AND (`exptime`=0 OR `exptime`>" . NV_CURRENTTIME . ") AND `is_notice`=1 ORDER BY `publtime` DESC LIMIT 0 , 10"; $result = $db->sql_query($sql); $rows = array(); while (list($id, $listcatid, $publtime, $exptime, $title, $alias, $homeimgthumb) = $db->sql_fetchrow($result)) { $catid = end(explode(",", $listcatid)); $cp_find_category = "SELECT `alias` FROM `" . NV_PREFIXLANG . "_" . $cp_module_data . "_cat` WHERE `catid`=" . $catid . " LIMIT 1"; $cp_cat_results = $db->sql_query($cp_find_category); list($cp_cat_alias) = $db->sql_fetchrow($cp_cat_results); if (!$cp_cat_alias) { continue; } $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $cp_module_title . "&" . NV_OP_VARIABLE . "=" . $cp_cat_alias . "/" . $alias . "-" . $id; $row['id'] = $id; $row['link'] = $link; $row['title'] = $title; $xtpl->assign("CONTENT", $row); $xtpl->parse("main.items"); } } /* $sql = "SELECT id, listcatid, publtime, exptime, title, alias, homeimgthumb FROM `" . NV_PREFIXLANG . "_news_rows` WHERE `status`= 1 AND `publtime` < " . NV_CURRENTTIME . " AND (`exptime`=0 OR `exptime`>" . NV_CURRENTTIME . ") AND `is_notice`=1 ORDER BY `publtime` DESC LIMIT 0 , 10"; $result = $db->sql_query($sql); $rows = array(); while (list( $id, $listcatid, $publtime, $exptime, $title, $alias, $homeimgthumb ) = $db->sql_fetchrow($result)) { $catid = end( explode( ",", $listcatid ) ); $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=news&" . NV_OP_VARIABLE . "=" . $global_array_cat[$catid]['alias'] . "/" . $alias . "-" . $id; $row['id'] = $id; $row['link'] = $link; $row['title'] = $title; $xtpl->assign("CONTENT", $row); $xtpl->parse("main.items"); } */ $xtpl->parse("main"); return $xtpl->text("main"); }
function nv_block_voting_select($block_config, $global_array_cat) { global $module_info, $global_config, $db, $site_mods, $module_name, $my_head, $client_info; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $sql = "SELECT vid, question, link, acceptcm, groups_view, publ_time, exp_time FROM " . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . " WHERE act=1"; $list = nv_db_cache($sql, 'vid', 'voting'); if (isset($list[$block_config['vid']])) { $current_voting = $list[$block_config['vid']]; if ($current_voting['publ_time'] <= NV_CURRENTTIME and nv_user_in_groups($current_voting['groups_view'])) { $sql = "SELECT id, vid, title, url FROM " . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . "_rows WHERE vid = " . $block_config['vid'] . " ORDER BY id ASC"; $list = nv_db_cache($sql, '', 'voting'); if (empty($list)) { return ''; } include NV_ROOTDIR . '/modules/' . $site_mods['voting']['module_file'] . '/language/' . NV_LANG_INTERFACE . '.php'; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } if (!defined('SHADOWBOX')) { $my_head .= "<link rel=\"Stylesheet\" href=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.css\" />\n"; $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\">Shadowbox.init();</script>"; define('SHADOWBOX', true); } $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "modules/" . $site_mods['voting']['module_file'] . "/js/user.js\"></script>\n"; $action = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=voting"; $voting_array = array('checkss' => md5($current_voting['vid'] . $client_info['session_id'] . $global_config['sitekey']), 'accept' => $current_voting['acceptcm'], 'errsm' => $current_voting['acceptcm'] > 1 ? sprintf($lang_module['voting_warning_all'], $current_voting['acceptcm']) : $lang_module['voting_warning_accept1'], 'vid' => $current_voting['vid'], 'question' => empty($current_voting['link']) ? $current_voting['question'] : '<a target="_blank" href="' . $current_voting['link'] . '">' . $current_voting['question'] . '</a>', 'action' => $action, 'langresult' => $lang_module['voting_result'], 'langsubmit' => $lang_module['voting_hits']); $xtpl = new XTemplate('global.voting.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $site_mods['voting']['module_file']); $xtpl->assign('VOTING', $voting_array); foreach ($list as $row) { if (!empty($row['url'])) { $row['title'] = '<a target="_blank" href="' . $row['url'] . '">' . $row['title'] . '</a>'; } $xtpl->assign('RESULT', $row); if ((int) $current_voting['acceptcm'] > 1) { $xtpl->parse('main.resultn'); } else { $xtpl->parse('main.result1'); } } if (!defined('MODAL_LOADED')) { $xtpl->parse('main.modal_loaded'); define('MODAL_LOADED', true); } $xtpl->parse('main'); return $xtpl->text('main'); } } }
function nv_news_block_news($block_config, $mod_data) { global $module_array_cat, $module_info, $db, $module_config; $module = $block_config['module']; $blockwidth = $module_config[$module]['blockwidth']; $array_block_news = array(); $cache_file = NV_LANG_DATA . "_" . $module . "_block_news_" . NV_CACHE_PREFIX . ".cache"; if (($cache = nv_get_cache($cache_file)) != false) { $array_block_news = unserialize($cache); } else { $numrow = isset($block_config['numrow']) ? $block_config['numrow'] : 20; $sql = "SELECT id, catid, publtime, exptime, title, alias, homeimgthumb, homeimgfile FROM `" . NV_PREFIXLANG . "_" . $mod_data . "_rows` WHERE `status`= 1 ORDER BY `publtime` DESC LIMIT 0 , " . $numrow; $result = $db->sql_query($sql); while (list($id, $catid, $publtime, $exptime, $title, $alias, $homeimgthumb, $homeimgfile) = $db->sql_fetchrow($result)) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module . "&" . NV_OP_VARIABLE . "=" . $module_array_cat[$catid]['alias'] . "/" . $alias . "-" . $id; if (!empty($homeimgthumb)) { $array_img = explode("|", $homeimgthumb); } else { $array_img = array("", ""); } if ($array_img[0] != "" and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/' . $array_img[0])) { $imgurl = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module . '/' . $array_img[0]; } elseif (nv_is_url($homeimgfile)) { $imgurl = $homeimgfile; } elseif ($homeimgfile != "" and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module . '/' . $homeimgfile)) { $imgurl = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/' . $homeimgfile; } else { $imgurl = ""; } $array_block_news[] = array('id' => $id, 'title' => $title, 'link' => $link, 'imgurl' => $imgurl, 'width' => $blockwidth); } $cache = serialize($array_block_news); nv_set_cache($cache_file, $cache); } if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/news/block_news.tpl")) { $block_theme = $module_info['template']; } else { $block_theme = "default"; } $xtpl = new XTemplate("block_news.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/news/"); $a = 1; foreach ($array_block_news as $array_news) { $xtpl->assign('blocknews', $array_news); if (!empty($array_news['imgurl'])) { $xtpl->parse('main.newloop.imgblock'); } $xtpl->parse('main.newloop'); $xtpl->assign('BACKGROUND', $a % 2 ? 'bg ' : ''); ++$a; } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_block_global_banners($block_config) { global $global_config; $xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/bpl_' . $block_config['idplanbanner'] . '.xml'; if (!file_exists($xmlfile)) { return ''; } $xml = simplexml_load_file($xmlfile); if ($xml === false) { return ''; } $width_banners = intval($xml->width); $height_banners = intval($xml->height); $array_banners = $xml->banners->banners_item; $array_banners_content = array(); foreach ($array_banners as $banners) { $banners = (array) $banners; $banners['file_height'] = round($banners['file_height'] * $width_banners / $banners['file_width']); $banners['file_width'] = $width_banners; $banners['file_alt'] = !empty($banners['file_alt']) ? $banners['file_alt'] : $banners['title']; $banners['file_image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . NV_BANNER_DIR . "/" . $banners['file_name']; $banners['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=banners&" . NV_OP_VARIABLE . "=click&id=" . $banners['id']; $array_banners_content[] = $banners; } if ($xml->form == "random") { shuffle($array_banners_content); } unset($xml, $array_banners); if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/blocks/global.banners.tpl")) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/blocks/global.banners.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } $xtpl = new XTemplate("global.banners.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks"); foreach ($array_banners_content as $banners) { $xtpl->assign('DATA', $banners); if ($banners['file_ext'] == "swf") { if (!empty($banners['file_click'])) { $xtpl->parse('main.loop.type_swf.fix_link'); } $xtpl->parse('main.loop.type_swf'); } elseif (!empty($banners['file_click'])) { $xtpl->parse('main.loop.type_image_link'); } else { $xtpl->parse('main.loop.type_image'); } $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_department_info($block_config) { global $global_config, $site_mods, $db, $module_name, $lang_module; $module = $block_config['module']; $module_data = $site_mods[$module]['module_data']; if ($module != $module_name) { $lang_temp = $lang_module; if (file_exists(NV_ROOTDIR . '/modules/' . $module . '/language/' . $global_config['site_lang'] . '.php')) { require NV_ROOTDIR . '/modules/' . $module . '/language/' . $global_config['site_lang'] . '.php'; } $lang_module = $lang_module + $lang_temp; unset($lang_temp); } if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module . '/block.department.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $module . '/block.department.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } //Danh sach cac bo phan $sql = 'SELECT id, full_name, phone, fax, email, yahoo, skype, note FROM ' . NV_PREFIXLANG . '_' . $module_data . '_department WHERE act=1 AND id=' . $block_config['departmentid']; $array_department = nv_db_cache($sql, 'id', $module); $xtpl = new XTemplate('block.department.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $module); $xtpl->assign('LANG', $lang_module); if (!empty($array_department)) { foreach ($array_department as $value => $row) { if (!empty($row)) { $xtpl->assign('DEPARTMENT', $row); if (!empty($row['phone'])) { $xtpl->parse('main.phone'); } if (!empty($row['fax'])) { $xtpl->parse('main.fax'); } if (!empty($row['email'])) { $xtpl->parse('main.email'); } if (!empty($row['yahoo'])) { $xtpl->parse('main.yahoo'); } if (!empty($row['skype'])) { $xtpl->parse('main.skype'); } } else { return ''; } } } $xtpl->parse('main'); return $xtpl->text('main'); }
function cot_get_topusers($maingrp, $count, $sqlsearch = '', $tpl = 'index') { global $L, $cfg, $db, $db_users; $t1 = new XTemplate(cot_tplfile(array('userpoints', $tpl), 'plug')); $sqlsearch = !empty($sqlsearch) ? " AND " . $sqlsearch : ''; $topusers = $db->query("SELECT * FROM {$db_users}\n\t\tWHERE user_userpoints>0 AND user_maingrp=" . $maingrp . " {$sqlsearch} ORDER BY user_userpoints DESC LIMIT " . $count)->fetchAll(); foreach ($topusers as $tur) { $t1->assign(cot_generate_usertags($tur, 'TOP_ROW_')); $t1->parse('MAIN.TOP_ROW'); } $t1->parse('MAIN'); return $t1->text('MAIN'); }
function nv_blog_listTags($block_config) { global $module_info, $global_config, $site_mods, $client_info, $global_array_cat, $module_name, $BL, $db; $module = $block_config['module']; $module_file = $site_mods[$module]['module_file']; $module_data = $site_mods[$module]['module_data']; if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file . "/block.tags.tpl")) { $block_theme = $module_info['template']; } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/modules/" . $module_file . "/block.tags.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } // Lay danh sach chuyen muc if ($module_name == $module and !empty($BL)) { $BLL = $BL; } else { require_once NV_ROOTDIR . "/modules/" . $module_file . "/blog.class.php"; $BLL = new nv_mod_blog($module_data, $module, $module_file); } // Goi css if ($module_name != $module and !defined('NV_IS_BLOG_CSS')) { global $my_head; $css_file = 'themes/' . $block_theme . '/css/' . $module_file . '.css'; if (file_exists(NV_ROOTDIR . '/' . $css_file)) { define('NV_IS_BLOG_CSS', true); $my_head .= "<link rel=\"stylesheet\" href=\"" . NV_BASE_SITEURL . $css_file . "\"/>\n"; } } $xtpl = new XTemplate("block.tags.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $module_file); $sql = "SELECT title, alias FROM " . $BLL->table_prefix . "_tags"; switch ($BLL->setting['blockTagsShowType']) { case 'random': $sql .= " ORDER BY RAND()"; break; case 'latest': $sql .= " ORDER BY id DESC"; break; default: $sql .= " ORDER BY numposts DESC"; } $sql .= " LIMIT 0," . $BLL->setting['blockTagsNums']; $result = $db->query($sql); while ($row = $result->fetch()) { $row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=tags/' . $row['alias']; $xtpl->assign('ROW', $row); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_block_voting_select($block_config, $global_array_cat) { global $module_info, $global_config, $db, $site_mods, $module_name, $my_head, $client_info; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $sql = "SELECT `vid`, `question`, `link`, `acceptcm`, `who_view`, `groups_view`, `publ_time`, `exp_time` \n FROM `" . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . "` \n WHERE `act`=1"; $list = nv_db_cache($sql, 'vid', 'voting'); if (isset($list[$block_config['vid']])) { $current_voting = $list[$block_config['vid']]; if ($current_voting['publ_time'] <= NV_CURRENTTIME and nv_set_allow($current_voting['who_view'], $current_voting['groups_view'])) { $sql = "SELECT `id`, `vid`, `title`, `url` FROM `" . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . "_rows` \n WHERE `vid` = " . $block_config['vid'] . " ORDER BY `id` ASC"; $list = nv_db_cache($sql, '', 'voting'); if (empty($list)) { return ""; } include NV_ROOTDIR . "/modules/" . $site_mods['voting']['module_file'] . "/language/" . NV_LANG_INTERFACE . ".php"; if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $site_mods['voting']['module_file'] . "/global.voting.tpl")) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/modules/" . $site_mods['voting']['module_file'] . "/global.voting.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } if (!defined('SHADOWBOX')) { $my_head .= "<link rel=\"Stylesheet\" href=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.css\" />\n"; $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\">Shadowbox.init();</script>"; define('SHADOWBOX', true); } $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "modules/" . $site_mods['voting']['module_file'] . "/js/user.js\"></script>\n"; $action = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=voting"; $voting_array = array("checkss" => md5($current_voting['vid'] . $client_info['session_id'] . $global_config['sitekey']), "accept" => $current_voting['acceptcm'], "errsm" => $current_voting['acceptcm'] > 1 ? sprintf($lang_module['voting_warning_all'], $current_voting['acceptcm']) : $lang_module['voting_warning_accept1'], "vid" => $current_voting['vid'], "question" => empty($current_voting['link']) ? $current_voting['question'] : '<a target="_blank" href="' . $current_voting['link'] . '">' . $current_voting['question'] . '</a>', "action" => $action, "langresult" => $lang_module['voting_result'], "langsubmit" => $lang_module['voting_hits']); $xtpl = new XTemplate("global.voting.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $site_mods['voting']['module_file']); $xtpl->assign('VOTING', $voting_array); foreach ($list as $row) { if (!empty($row['url'])) { $row['title'] = '<a target="_blank" href="' . $row['url'] . '">' . $row['title'] . '</a>'; } $xtpl->assign('RESULT', $row); if ((int) $current_voting['acceptcm'] > 1) { $xtpl->parse('main.resultn'); } else { $xtpl->parse('main.result1'); } } $xtpl->parse('main'); return $xtpl->text('main'); } } }
function nv_about_main($row, $ab_links) { global $global_config, $module_name, $module_file, $lang_module, $module_info; $xtpl = new XTemplate("main.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('CONTENT', $row); if (!empty($ab_links)) { foreach ($ab_links as $row) { $xtpl->assign('OTHER', $row); $xtpl->parse('main.loop'); } } $xtpl->parse('main'); return $xtpl->text('main'); }
function form_structure_new($parentid = '') { global $cot_structure, $cot_extrafields, $db_structure, $structure, $L, $R; $t = new XTemplate(cot_tplfile('cateditor.admin.new', 'plug')); $t->assign(array('ADMIN_STRUCTURE_URL_FORM_ADD' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&a=add'), 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode', null, 'size="16"'), 'ADMIN_STRUCTURE_PARENT' => $cot_structure->select($parentid, 'rstructureparent'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle', null, 'size="64" maxlength="100"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc', null, 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon', null, 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox(null, 'rstructurelocked'), 'ADMIN_STRUCTURE_TPL' => cot_inputbox('text', 'rstructuretpl', null, 'size="10" maxlength="255"'))); // Extra fields foreach ($cot_extrafields[$db_structure] as $exfld) { $exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'], $exfld, null); $exfld_title = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) => $exfld_val, 'ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) . '_TITLE' => $exfld_title, 'ADMIN_STRUCTURE_EXTRAFLD' => $exfld_val, 'ADMIN_STRUCTURE_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } $t->parse('MAIN'); return $t->text('MAIN'); }
function nv_blog_verticalCategoriesSubs($list_cats, $cat, $block_theme, $module_file, $module) { if (empty($cat['subcats'])) { return ""; } $xtpl = new XTemplate("block.verticalCategories.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $module_file); foreach ($cat['subcats'] as $catid) { $list_cats[$catid]['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module . "&" . NV_OP_VARIABLE . "=" . $list_cats[$catid]['alias']; $xtpl->assign("ROW", $list_cats[$catid]); $xtpl->assign("SUB", nv_blog_verticalCategoriesSubs($list_cats, $list_cats[$catid], $block_theme, $module_file, $module)); $xtpl->parse('sub.loop'); } $xtpl->parse('sub'); return $xtpl->text('sub'); }