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'); }
/** * 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; }
/** * 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_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 gui_loi_cam_on_da_lien_he($ten, $email, $chude, $noidung) { include_once 'xtemplate.class.php'; $header = 'Content-type: text/html; charset=utf-8\\r\\n'; $title = get_bloginfo('name'); $contact_email = get_option('contactemail'); $contact_name = get_bloginfo('name'); $date = date('d-m-Y'); $parseTemplate = new XTemplate('xtemplate.cam-on-da-lien-he.html'); $parseTemplate->assign('fullname', $ten); $parseTemplate->assign('link', get_bloginfo('home')); $parseTemplate->assign('website', get_bloginfo('name')); $parseTemplate->assign('date', $date); $parseTemplate->assign('email', $email); $parseTemplate->assign('tieude', $chude); $parseTemplate->assign('noidung', $noidung); $parseTemplate->assign('contact_email', $contact_email); $parseTemplate->assign('contact_name', $contact_name); $parseTemplate->parse('main'); $mail = wp_mail($email, $title, $parseTemplate->text('main'), $title); if ($mail) { ?> <script> alert ('Gửi mail thành công'); </script> <?php } else { ?> <script> alert ('Vui lòng thử lại'); </script> <?php } }
function execute() { if ($this->user['user_level'] < USER_ADMIN) { return $this->error('Access Denied: You do not have permission to perform that action.'); } $this->title('Banned IPs'); if (!isset($this->post['submit'])) { $ips = null; if (isset($this->settings['banned_ips'])) { $ips = implode("\n", $this->settings['banned_ips']); } $xtpl = new XTemplate('./skins/' . $this->skin . '/AdminCP/ban.xtpl'); $xtpl->assign('token', $this->generate_token()); $xtpl->assign('ip_addresses', $ips); $xtpl->parse('Bans'); return $xtpl->text('Bans'); } if (!$this->is_valid_token()) { return $this->error('Invalid or expired security token. Please go back, reload the form, and try again.'); } $banned_ips = trim($this->post['banned_ips']); if ($banned_ips) { $banned_ips = explode("\n", $banned_ips); } else { $banned_ips = array(); } $this->settings['banned_ips'] = $banned_ips; $this->save_settings(); return $this->message('Banned IPs', 'Bans updated.', 'Continue', 'admin.php?a=ban'); }
function nv_news_category($block_config) { global $module_array_cat, $module_info, $lang_module; $xtpl = new XTemplate("block_category.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/news"); if (!empty($module_array_cat)) { $title_length = $block_config['title_length']; $xtpl->assign('LANG', $lang_module); $xtpl->assign('BLOCK_ID', $block_config['bid']); $xtpl->assign('TEMPLATE', $module_info['template']); $html = ""; foreach ($module_array_cat as $cat) { if ($cat['parentid'] == 0) { $html .= "<li>\n"; $html .= "<a title=\"" . $cat['title'] . "\" href=\"" . $cat['link'] . "\">" . nv_clean60($cat['title'], $title_length) . "</a>\n"; if (!empty($cat['subcatid'])) { $html .= nv_news_sub_category($cat['subcatid'], $title_length); } $html .= "</li>\n"; } } $xtpl->assign('HTML_CONTENT', $html); $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'); }
/** * Create HTML form to enter a new record with the minimum necessary fields. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. */ function get_new_record_form() { global $app_strings; global $app_list_strings; global $mod_strings; global $currentModule; global $current_user; global $timedate; $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']); $form = new XTemplate('modules/Campaigns/Forms.html'); $module_select = empty($_REQUEST['module_select']) ? '' : $_REQUEST['module_select']; $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', SugarThemeRegistry::current()->__toString()); $form->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js()); $form->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], "Planning")); $form->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['campaign_type_dom'], "")); $form->assign("USER_ID", $current_user->id); $form->assign("TEAM_ID", sprintf('<input type="hidden" name="team_id" value="%s">', $current_user->default_team)); $form->assign("CALENDAR_LANG", "en"); $form->assign("USER_DATEFORMAT", '(' . $timedate->get_user_date_format() . ')'); $form->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format()); $form->parse('main'); $the_form .= $form->text('main'); $focus = BeanFactory::getBean('Campaigns'); $javascript = new javascript(); $javascript->setFormName('quick_save'); $javascript->setSugarBean($focus); $javascript->addRequiredFields(''); $jscript = $javascript->getScript(); $the_form .= $jscript . get_left_form_footer(); return $the_form; }
function cot_ukarma($userid, $area = 'users', $code = '', $onlyscore = false) { global $db, $cfg, $db_ukarma, $db_users; if ($area == 'users' && $db->fieldExists($db_users, "user_ukarma")) { $score = $db->query("SELECT user_ukarma FROM {$db_users} WHERE user_id=" . $userid)->fetchColumn(); } else { $where['ukarma_userid'] = "ukarma_userid=" . $userid; if (!empty($area) && $area != 'users') { $where['ukarma_area'] = "ukarma_area='" . $area . "'"; } if (!empty($code)) { $where['ukarma_code'] = "ukarma_code='" . $code . "'"; } $where = $where ? 'WHERE ' . implode(' AND ', $where) : ''; $score = $db->query("SELECT SUM(ukarma_value) FROM {$db_ukarma} {$where}")->fetchColumn(); } if ($onlyscore) { return !empty($score) ? $score : 0; } if ($score > 0) { $sign = '+'; } elseif ($score < 0) { $sign = '-'; } $t = new XTemplate(cot_tplfile(array('ukarma', $area), 'plug')); $t->assign(cot_generate_usertags($userid, 'UKARMA_USER_')); $t->assign(array('UKARMA_AREA' => $area, 'UKARMA_CODE' => $code, 'UKARMA_SELECTOR' => 'ukarma_' . $userid . $area . $code, 'UKARMA_SCOREENABLED' => cot_ukarma_checkenablescore($userid, $area, $code), 'UKARMA_SCORE' => !empty($score) ? $score : 0, 'UKARMA_SCORE_ABS' => !empty($score) ? abs($score) : 0, 'UKARMA_SIGN' => $sign)); $t->parse('MAIN'); return $t->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 ''; } }
function send_subcribe_thank_you($subcriber, $emailto, $code, $user_id) { include 'xtemplate.class.php'; $header = 'Content-type: text/html; charset=utf-8\\r\\n'; $title = "You have subcribed at " . get_bloginfo('name'); $contact_email = get_option('contact_email'); if (!is_email($contact_email)) { $contact_email = get_option('admin_email'); } $contact_name = get_option('contact_name'); if (!$contact_name) { $contact_name = get_bloginfo('name'); } $parseTemplate = new XTemplate('xtemplate-email-subscrib-thank-you.html'); $parseTemplate->assign('subscriber', $subcriber); $parseTemplate->assign('link', get_bloginfo('home')); $parseTemplate->assign('website', get_bloginfo('name')); $parseTemplate->assign('title', $title); $parseTemplate->assign('code', $code); $parseTemplate->assign('user_id', $user_id); $parseTemplate->assign('contact_email', $contact_email); $parseTemplate->assign('contact_name', $contact_name); $parseTemplate->parse('main'); wp_mail($emailto, $title, $parseTemplate->text('main'), $header); }
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 ""; }
/** * 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; }
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_block_video() { global $global_config, $site_mods, $db, $module_name; $rVid = 1; $get_video_query = "SELECT * FROM `nv_vi_video_picture` WHERE `pictureid`={$rVid}"; if (($query = $db->sql_query($get_video_query)) !== false) { if (($row = $db->sql_fetchrow($query)) !== false) { $rs = $row; } } if (!empty($rs['path']) and file_exists(NV_UPLOADS_REAL_DIR . "/" . "video" . $rs['path'])) { $rs['path'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . "video" . $rs['path']; } if (!empty($rs['vpath']) and file_exists(NV_UPLOADS_REAL_DIR . "/" . "video" . $rs['vpath'])) { $rs['vpath'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . "video" . $rs['vpath']; } $block_theme = "default"; $xtpl = new XTemplate("global.video.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks"); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('URL_PP', $rs['path']); $xtpl->assign('URL_V', $rs['vpath']); $xtpl->assign('VID_NAME', $rs['name']); $xtpl->assign('VID_DES', $rs['description']); $xtpl->assign('NUM_VVIEW', $rs['num_view']); $xtpl->assign('IMGP', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/" . $module_name . "/"); $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'); }
function nv_blog_newsletters($block_config) { global $module_info, $global_config, $site_mods, $client_info, $module_name; $module = $block_config['module']; $module_file = $site_mods[$module]['module_file']; if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file . "/block.newsletters.tpl")) { $block_theme = $module_info['template']; } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/modules/" . $module_file . "/block.newsletters.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } // 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"; } } // Goi ngon ngu module include NV_ROOTDIR . "/modules/" . $module_file . "/language/" . NV_LANG_DATA . ".php"; $xtpl = new XTemplate("block.newsletters.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $module_file); $xtpl->assign("LANG", $lang_module); $xtpl->assign("CHECKSESS", md5($global_config['sitekey'] . $client_info['session_id'])); $xtpl->assign("MODULE_NAME", $module); $xtpl->parse('main'); return $xtpl->text('main'); }
function displayNewsFeed($template_file, $level = "") { $tpl = new XTemplate($template_file); $rss = getNewsFeed(); if (!$rss) { return 'There are no articles in this news feed'; } // end if $limit = 2; $count = 0; foreach ($rss as $item) { if ($count > $limit - 1) { break; } $count++; $tpl->assign('BlogNewsLink', $item['link']); $tpl->assign('BlogNewsTitle', $item['title']); $tpl->assign('BlogNewsPubDate', $item['date']); $tpl->assign('BlogNewsCreator', $item['creator']); $tpl->assign('BlogNewsCategory', $item['category']); $tpl->parse('main' . $level . '.BlogNews'); } // end foreach return $tpl->text('main' . $level . '.BlogNews'); }
function nv_archives_category($block_config) { global $module_archives_cat, $module_info, $lang_module, $global_config, $site_mods; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $mod_file = $site_mods[$module]['module_file']; if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/modules/" . $mod_file . "/block_category.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } $xtpl = new XTemplate("block_category.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/laws"); $xtpl->assign('LANG', $lang_module); if (!empty($module_archives_cat)) { $title_length = $block_config['title_length']; $xtpl->assign('LANG', $lang_module); $xtpl->assign('BLOCK_ID', $block_config['bid']); $xtpl->assign('TEMPLATE', $block_theme); $html = ""; foreach ($module_archives_cat as $cat) { if ($cat['parentid'] == 0) { $html .= "<li>\n"; $html .= "<a title=\"" . $cat['title'] . "\" href=\"" . $cat['link'] . "\">" . nv_clean60($cat['title'], $title_length) . "</a>\n"; if (!empty($cat['subcatid'])) { $html .= nv_archives_sub_category($cat['subcatid'], $title_length); } $html .= "</li>\n"; } } $xtpl->assign('HTML_CONTENT', $html); $xtpl->parse('main'); return $xtpl->text('main'); } }
function send() { // Grab list of advertisers $this->accounts = $this->db->getsql("SELECT * FROM adrev_users WHERE balance <= ? AND status='1' ORDER BY email", array($this->minbal)); if (count($this->accounts) > 0) { $admin = array(); foreach ($this->accounts as $rec) { $tpl = new XTemplate("templates/user_notify_email.txt"); $tpl->assign("USER", $rec[name]); $tpl->assign("SITENAME", $this->default[adrevenue][name]); $tpl->assign("URL", $this->default[adrevenue][url]); $tpl->assign("LOGIN", $rec[email]); $tpl->assign("PASSWORD", $rec[password]); $tpl->assign("SITEEMAIL", $this->default[adrevenue][email]); $tpl->parse("main"); $msg = $tpl->text("main"); $admin[] = "{$rec['name']}\t{$rec['email']}\t{$rec['balance']}"; mail($rec[email], "[" . $this->default[adrevenue][name] . "] " . lib_lang("Account balance low"), $msg, "From: " . $this->default[adrevenue][name] . "<" . $this->default[adrevenue][email] . ">"); } $amsg = lib_lang("Dear Admin") . ",\n\n"; $amsg .= lib_lang("The following users have low balances") . ":\n\n"; foreach ($admin as $a) { $amsg .= "{$a}\n"; } // Send message to admin mail($this->default[adrevenue][email], "[" . $this->default[adrevenue][name] . "] " . lib_lang("Account Balances Summary"), $amsg, "From: " . $this->default[adrevenue][name] . "<" . $this->default[adrevenue][email] . ">"); } return TRUE; }
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 gui_loi_cam_on_da_dang_ky($ten, $dienthoai, $email, $cty, $diachi, $tp) { include_once 'xtemplate.class.php'; $header = 'Content-type: text/html; charset=utf-8\\r\\n'; $title = get_bloginfo('name'); $contact_email = get_option('contact_email'); $contact_name = get_bloginfo('name'); $parseTemplate = new XTemplate('xtemplate.cam-on-da-dang-ky.html'); $parseTemplate->assign('website', get_bloginfo('name')); $parseTemplate->assign('link', get_bloginfo('home')); $parseTemplate->assign('fullname', $ten); $parseTemplate->assign('phone', $dienthoai); $parseTemplate->assign('email', $email); $parseTemplate->assign('cty', $cty); $parseTemplate->assign('diachi', $diachi); $parseTemplate->assign('tp', $tp); $parseTemplate->assign('contact_email', $contact_email); $parseTemplate->assign('contact_name', $contact_name); $parseTemplate->parse('main'); $mail = wp_mail($email, $title, $parseTemplate->text('main'), $title); if ($mail) { ?> <script> alert ('Gửi mail thành công'); </script> <?php } else { ?> <script> alert ('Vui lòng thử lại'); </script> <?php } }
function nv_menu_theme_social($block_config) { global $global_config, $site_mods; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.social.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.social.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('global.social.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks'); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('BLOCK_THEME', $block_theme); $xtpl->assign('DATA', $block_config); if (!empty($block_config['facebook'])) { $xtpl->parse('main.facebook'); } if (!empty($block_config['google_plus'])) { $xtpl->parse('main.google_plus'); } if (!empty($block_config['youtube'])) { $xtpl->parse('main.youtube'); } if (!empty($block_config['twitter'])) { $xtpl->parse('main.twitter'); } if (isset($site_mods['feeds'])) { $xtpl->assign('FEEDS_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=feeds'); $xtpl->parse('main.feeds'); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_theme_crawler_search() * * @param mixed $array_data * @return */ function nv_theme_crawler_search($array_data) { global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info, $op; $xtpl = new XTemplate($op . ".tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_product_center() * * @return */ function nv_product_center($block_config) { global $module_name, $lang_module, $module_info, $module_file, $global_array_shops_cat, $db, $module_data, $db_config, $pro_config, $global_config, $site_mods; $module = $block_config['module']; $num_view = 5; $num = 30; $array = array(); $xtpl = new XTemplate('block.product_center.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('THEME_TEM', NV_BASE_SITEURL . 'themes/' . $module_info['template']); $xtpl->assign('WIDTH', $pro_config['homewidth']); $xtpl->assign('NUMVIEW', $num_view); $cache_file = NV_LANG_DATA . '_block_module_product_center_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache($module_name, $cache_file)) != false) { $array = unserialize($cache); } else { $db->sqlreset()->select('bid')->from($db_config['prefix'] . '_' . $module_data . '_block_cat')->order('weight ASC')->limit(1); $result = $db->query($db->sql()); $bid = $result->fetchColumn(); $db->sqlreset()->select('t1.id, t1.listcatid, t1.' . NV_LANG_DATA . '_title AS title, t1.' . NV_LANG_DATA . '_alias AS alias, t1.homeimgfile, t1.homeimgthumb , t1.homeimgalt, t1.showprice, t1.discount_id')->from($db_config['prefix'] . '_' . $module_data . '_rows t1')->join('INNER JOIN ' . $db_config['prefix'] . '_' . $module_data . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $bid . ' AND t1.status =1')->order('t1.id DESC')->limit($num); $array = nv_db_cache($db->sql(), 'id', $module_name); $cache = serialize($array); nv_set_cache($module_name, $cache_file, $cache); } foreach ($array as $row) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$row['listcatid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl']; if ($row['homeimgthumb'] == 1) { $src_img = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile']; } elseif ($row['homeimgthumb'] == 2) { $src_img = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile']; } elseif ($row['homeimgthumb'] == 3) { $src_img = $row['homeimgfile']; } else { $src_img = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/shops/no-image.jpg'; } $xtpl->assign('LINK', $link); $xtpl->assign('TITLE', $row['title']); $xtpl->assign('TITLE0', nv_clean60($row['title'], 30)); $xtpl->assign('SRC_IMG', $src_img); if ($pro_config['active_price'] == '1') { if ($row['showprice'] == '1') { $price = nv_get_price($row['id'], $pro_config['money_unit']); $xtpl->assign('PRICE', $price); if ($row['discount_id'] and $price['discount_percent'] > 0) { $xtpl->parse('main.items.price.discounts'); } else { $xtpl->parse('main.items.price.no_discounts'); } $xtpl->parse('main.items.price'); } else { $xtpl->parse('main.items.contact'); } } $xtpl->parse('main.items'); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * sendcontact() * * @param mixed $url * @return */ function sendcontact($url) { global $module_file, $global_config, $module_info, $lang_module; $xtpl = new XTemplate("sendcontact.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $lang_module['urlrefresh'] = $url; $xtpl->assign('LANG', $lang_module); $xtpl->parse('main'); return $xtpl->text('main'); }
/** * sendcontact() * * @param mixed $url * @return */ function sendcontact($url) { global $module_file, $module_info, $lang_module; $xtpl = new XTemplate('sendcontact.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $lang_module['urlrefresh'] = nv_url_rewrite($url, true); $xtpl->assign('LANG', $lang_module); $xtpl->parse('main'); return $xtpl->text('main'); }
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; }