Exemplo n.º 1
5
 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');
 }
Exemplo n.º 2
0
 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');
 }
Exemplo n.º 3
0
 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');
     }
 }
Exemplo n.º 4
0
/**
 * result_theme()
 * 
 * @param mixed $result_array
 * @param mixed $mod
 * @param mixed $mod_custom_title
 * @param mixed $key
 * @param mixed $ss
 * @param mixed $is_generate_page
 * @param mixed $pages
 * @param mixed $limit
 * @param mixed $all_page
 * @return
 */
function result_theme($result_array, $mod, $mod_custom_title, $key, $logic, $ss, $is_generate_page, $pages, $limit, $all_page)
{
    global $module_info, $module_file, $global_config, $lang_global, $lang_module, $db, $module_name;
    $xtpl = new XTemplate("result.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('HIDDEN_KEY', $key);
    $xtpl->assign('SEARCH_RESULT_NUM', $all_page);
    $xtpl->assign('MODULE_CUSTOM_TITLE', $mod_custom_title);
    foreach ($result_array as $result) {
        $xtpl->assign('RESULT', $result);
        $xtpl->parse('main.result');
    }
    $base_url = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=adv&amp;search_query=" . rawurlencode($key) . "&amp;search_mod=" . $mod . "&amp;search_ss=" . $ss . "&amp;logic=" . $logic;
    if ($is_generate_page) {
        $generate_page = nv_generate_page($base_url, $all_page, $limit, $pages, true, true, 'nv_urldecode_ajax', 'search_result');
        if (!empty($generate_page)) {
            $xtpl->assign('GENERATE_PAGE', $generate_page);
            $xtpl->parse('main.generate_page');
        }
    } else {
        if ($all_page > $limit) {
            $xtpl->assign('MORE', "nv_search_viewall('" . $mod . "', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ")");
            $xtpl->parse('main.more');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Exemplo n.º 5
0
 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');
 }
Exemplo n.º 6
0
 /**
  * nv_menu_theme_default_footer()
  *
  * @param mixed $block_config
  * @return
  */
 function nv_copyright_info($block_config)
 {
     global $global_config, $lang_global;
     if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.copyright.tpl')) {
         $block_theme = $global_config['module_theme'];
     } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.copyright.tpl')) {
         $block_theme = $global_config['site_theme'];
     } else {
         $block_theme = 'default';
     }
     $xtpl = new XTemplate('global.copyright.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks');
     $xtpl->assign('LANG', $lang_global);
     if (empty($block_config['copyright_by'])) {
         $block_config['copyright_by'] = $global_config['site_name'];
     }
     if (empty($block_config['copyright_url'])) {
         $block_config['copyright_url'] = "http://" . $global_config['my_domains'][0];
     }
     $xtpl->assign('DATA', $block_config);
     $xtpl->parse('main.copyright_by.copyright_url');
     $xtpl->parse('main.copyright_by.copyright_url2');
     $xtpl->parse('main.copyright_by');
     if (!empty($block_config['design_by'])) {
         if (!empty($block_config['design_url'])) {
             $xtpl->parse('main.design_by.design_url');
             $xtpl->parse('main.design_by.design_url2');
         }
         $xtpl->parse('main.design_by');
     }
     if (!empty($block_config['siteterms_url'])) {
         $xtpl->parse('main.siteterms_url');
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }
Exemplo n.º 7
0
/**
 * 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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . 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');
}
Exemplo n.º 8
0
/**
 * 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 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 
    }
}
Exemplo n.º 10
0
 function nv_blog_news_tags($block_config)
 {
     global $site_mods, $module_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
     $module = $block_config['module'];
     $mod_data = $site_mods[$module]['module_data'];
     $mod_file = $site_mods[$module]['module_file'];
     $block_theme = nv_check_theme($mod_file);
     $xtpl = new XTemplate('block.news_tags.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
     $xtpl->assign('LANG', $lang_module);
     $xtpl->assign('TEMPLATE', $block_theme);
     $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
     $excluded = $block_config['excluded'];
     if (!empty($excluded)) {
         $sql = 'SELECT tid, numnews, alias, keywords FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_tags WHERE tid NOT IN (' . $excluded . ') ORDER BY ' . $block_config['tagsort'] . ' ' . $block_config['tagsort_type'] . ' LIMIT 0, ' . $block_config['numrow'];
     } else {
         $sql = 'SELECT tid, numnews, alias, keywords FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_tags ORDER BY ' . $block_config['tagsort'] . ' ' . $block_config['tagsort_type'] . ' LIMIT 0, ' . $block_config['numrow'];
     }
     $list = $nv_Cache->db($sql, 'id', $module);
     if (!empty($list)) {
         foreach ($list as $l) {
             $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=tag/' . $l['alias'];
             if (!empty($block_config['newslinks'])) {
                 $xtpl->assign('COUNT', $l['numnews']);
                 $xtpl->parse('main.loop.count_tags');
             }
             $xtpl->assign('LOOP', $l);
             $xtpl->parse('main.loop');
         }
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }
Exemplo n.º 11
0
 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');
 }
Exemplo n.º 12
0
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');
     }
 }
Exemplo n.º 14
0
/**
 * 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">&nbsp;</li>';
            }
            if (!empty($content2)) {
                $xtpl->assign('TREE_CONTENT', $content2);
                $xtpl->parse('tree.tree_content');
            }
            $xtpl->parse('tree');
            $content .= $xtpl->text('tree');
        }
    }
    return $content;
}
Exemplo n.º 15
0
 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 . '&amp;' . NV_NAME_VARIABLE . '=feeds');
         $xtpl->parse('main.feeds');
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }
Exemplo n.º 16
0
 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');
 }
Exemplo n.º 17
0
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');
}
Exemplo n.º 18
0
/**
 * result_theme()
 *
 * @param mixed $result_array
 * @param mixed $mod
 * @param mixed $mod_custom_title
 * @param mixed $search
 * @param mixed $is_generate_page
 * @param mixed $limit
 * @param mixed $num_items
 * @return
 */
function search_result_theme($result_array, $mod, $mod_custom_title, $search, $is_generate_page, $limit, $num_items)
{
    global $module_info, $module_file, $global_config, $lang_global, $lang_module, $db, $module_name;
    $xtpl = new XTemplate('result.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('SEARCH_RESULT_NUM', $num_items);
    $xtpl->assign('MODULE_CUSTOM_TITLE', $mod_custom_title);
    $xtpl->assign('HIDDEN_KEY', $search['key']);
    foreach ($result_array as $result) {
        $xtpl->assign('RESULT', $result);
        $xtpl->parse('main.result');
    }
    $base_url = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&q=" . urlencode($search['key']);
    if ($mod != "all") {
        $base_url .= "&m=" . $mod;
    }
    $base_url .= "&l=" . $search['logic'];
    if ($is_generate_page) {
        $generate_page = nv_generate_page($base_url, $num_items, $limit, $search['page']);
        if (!empty($generate_page)) {
            $xtpl->assign('GENERATE_PAGE', $generate_page);
            $xtpl->parse('main.generate_page');
        }
    } else {
        if ($num_items > $limit) {
            $xtpl->assign('MORE', $base_url);
            $xtpl->parse('main.more');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Exemplo n.º 19
0
/**
 * 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');
}
Exemplo n.º 20
0
 /**
  * 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 . '&amp;' . NV_NAME_VARIABLE . '=' . $modname);
             $xtpl->assign('FOOTER_MENU', $_array_menu);
             $xtpl->parse('main.footer_menu');
             ++$a;
         }
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }
Exemplo n.º 21
0
 function nv_news_category($block_config)
 {
     global $module_array_cat, $module_info, $lang_module, $global_config;
     if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_category.tpl')) {
         $block_theme = $global_config['module_theme'];
     } else {
         $block_theme = 'default';
     }
     $xtpl = new XTemplate('block_category.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/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', $block_theme);
         $html = '';
         foreach ($module_array_cat as $cat) {
             if ($block_config['catid'] == 0 && $cat['parentid'] == 0 || $block_config['catid'] > 0 && $cat['parentid'] == $block_config['catid']) {
                 $html .= "<li>\n";
                 $html .= "<a title=\"" . $cat['title'] . "\" href=\"" . $cat['link'] . "\">" . nv_clean60($cat['title'], $title_length) . "</a>\n";
                 if (!empty($cat['subcatid'])) {
                     $html .= "<span class=\"fa arrow expand\"></span>";
                     $html .= nv_news_sub_category($cat['subcatid'], $title_length);
                 }
                 $html .= "</li>\n";
             }
         }
         $xtpl->assign('MENUID', $block_config['bid']);
         $xtpl->assign('HTML_CONTENT', $html);
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
Exemplo n.º 22
0
/**
 * nv_page_main_list()
 *
 * @param mixed $array_data
 * @return
 */
function nv_page_main_list($array_data, $generate_page)
{
    global $global_config, $module_file, $lang_global, $module_upload, $module_info, $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('GLANG', $lang_global);
    if (!empty($array_data)) {
        foreach ($array_data as $row) {
            if (!empty($row['image'])) {
                $row['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['image'];
                $row['imagealt'] = !empty($row['imagealt']) ? $row['imagealt'] : $row['title'];
            }
            $xtpl->assign('DATA', $row);
            if (!empty($row['image'])) {
                $xtpl->parse('main.loop.image');
            }
            if (defined('NV_IS_MODADMIN')) {
                $xtpl->assign('ADMIN_CHECKSS', md5($row['id'] . $global_config['sitekey'] . session_id()));
                $xtpl->assign('ADMIN_EDIT', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=content&amp;id=' . $row['id']);
                $xtpl->parse('main.loop.adminlink');
            }
            $xtpl->parse('main.loop');
        }
        if ($generate_page != '') {
            $xtpl->assign('GENERATE_PAGE', $generate_page);
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Exemplo n.º 23
0
/**
 * 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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_data . '&amp;' . 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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=sources&amp;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 = '&nbsp;';
    }
    return $contents;
}
 /**
  *
  */
 function process_page()
 {
     global $theme;
     global $mod_strings;
     global $app_strings;
     global $currentModule;
     global $sugar_version, $sugar_config;
     $output_html = '';
     $where = '';
     $where = $this->_get_where_clause();
     $image_path = 'themes/' . $theme . '/images/';
     $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name'];
     $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name'];
     $user_name = empty($_REQUEST['user_name']) ? '' : $_REQUEST['user_name'];
     $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
     $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
     $button = "<form action='index.php' method='post' name='form' id='form'>\n";
     if (!$hide_clear_button) {
         $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  ' />\n";
     }
     $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  ' />\n";
     $button .= "</form>\n";
     $form = new XTemplate('modules/Employees/Popup_picker.html');
     $form->assign('MOD', $mod_strings);
     $form->assign('APP', $app_strings);
     $form->assign('THEME', $theme);
     $form->assign('MODULE_NAME', $currentModule);
     $form->assign('FIRST_NAME', $first_name);
     $form->assign('LAST_NAME', $last_name);
     $form->assign('USER_NAME', $user_name);
     $form->assign('request_data', $request_data);
     ob_start();
     insert_popup_header($theme);
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
     $form->parse('main.SearchHeader');
     $output_html .= $form->text('main.SearchHeader');
     $output_html .= get_form_footer();
     // Reset the sections that are already in the page so that they do not print again later.
     $form->reset('main.SearchHeader');
     // create the listview
     $seed_bean = new Employee();
     $ListView = new ListView();
     $ListView->show_export_button = false;
     $ListView->process_for_popups = true;
     $ListView->setXTemplate($form);
     $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
     $ListView->setHeaderText($button);
     $ListView->setQuery($where, '', 'user_name', 'EMPLOYEE');
     $ListView->setModStrings($mod_strings);
     ob_start();
     $ListView->processListView($seed_bean, 'main', 'EMPLOYEE');
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= get_form_footer();
     $output_html .= insert_popup_footer();
     return $output_html;
 }
Exemplo n.º 25
0
 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;
 }
Exemplo n.º 26
0
 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;
 }
Exemplo n.º 27
0
 /**
  * nv_message_about()
  * 
  * @return
  */
 function nv_message_about()
 {
     global $global_config, $site_mods, $db, $module_name;
     if (!isset($site_mods['about'])) {
         return "";
     }
     if ($module_name == 'about') {
         return "";
     }
     $is_show = false;
     $pattern = "/^" . NV_LANG_DATA . "\\_about\\_([0-9]+)\\_" . NV_CACHE_PREFIX . "\\.cache\$/i";
     $cache_files = nv_scandir(NV_ROOTDIR . "/" . NV_CACHEDIR, $pattern);
     if (($count = count($cache_files)) >= 1) {
         $num = rand(1, $count);
         $num--;
         $cache_file = $cache_files[$num];
         if (($cache = nv_get_cache($cache_file)) != false) {
             $cache = unserialize($cache);
             $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=about&amp;" . NV_OP_VARIABLE . "=" . $cache['alias'];
             $title = $cache['page_title'];
             $bodytext = strip_tags($cache['contents']);
             $bodytext = nv_clean60($bodytext, 300);
             $is_show = true;
         }
     }
     if (!$is_show) {
         $sql = "SELECT `id`,`title`,`alias`,`bodytext`,`keywords`,`add_time`,`edit_time` FROM `" . NV_PREFIXLANG . "_" . $site_mods['about']['module_data'] . "` ORDER BY rand() DESC LIMIT 1";
         if (($query = $db->sql_query($sql)) !== false) {
             if (($row = $db->sql_fetchrow($query)) !== false) {
                 $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=about&amp;" . NV_OP_VARIABLE . "=" . $row['alias'];
                 $title = $row['title'];
                 $bodytext = $row['bodytext'];
                 //$bodytext = strip_tags( $row['bodytext'] );
                 $bodytext = nv_clean60($bodytext, 300);
                 $is_show = true;
             }
         }
     }
     if ($is_show) {
         if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/blocks/global.about.tpl")) {
             $block_theme = $global_config['module_theme'];
         } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/blocks/global.about.tpl")) {
             $block_theme = $global_config['site_theme'];
         } else {
             $block_theme = "default";
         }
         $xtpl = new XTemplate("global.about.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks");
         $xtpl->assign('LINK', $link);
         $xtpl->assign('TITLE', $title);
         $xtpl->assign('BODYTEXT', $bodytext);
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
     return "";
 }
 function nv_news_block_newscenter($block_config)
 {
     global $module_data, $module_name, $module_file, $global_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
     $module_name = 'news';
     $module_data = 'news';
     $xtpl = new XTemplate('block_newscenter.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks');
     $xtpl->assign('lang', $lang_module);
     $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
     $db->sqlreset()->select('id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status= 1')->order('publtime DESC')->limit(5);
     $list = nv_db_cache($db->sql(), 'id', $module_name);
     $i = 1;
     foreach ($list as $row) {
         $row['publtime'] = nv_date('m/d/Y', $row['publtime']);
         $row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
         $row['title0'] = nv_clean60(strip_tags($row['title']), $i == 1 ? 50 : 30);
         $row['hometext'] = nv_clean60(strip_tags($row['hometext']), 260);
         $image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
         if ($row['homeimgfile'] != '' and file_exists($image)) {
             if ($i == 1) {
                 $width = 570;
                 $height = 490;
             } else {
                 $width = 270;
                 $height = 230;
             }
             $row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
             $imginfo = nv_is_image($image);
             $basename = basename($image);
             if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
                 $basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
                 if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
                     $row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
                 } else {
                     require_once NV_ROOTDIR . '/includes/class/image.class.php';
                     $_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
                     $_image->cropFromCenter($width, $height);
                     $_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
                     if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
                         $row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
                     }
                 }
             }
         } elseif (nv_is_url($row['homeimgfile'])) {
             $row['imgsource'] = $row['homeimgfile'];
         } elseif (!empty($module_config[$module_name]['show_no_image'])) {
             $row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
         } else {
             $row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png';
         }
         $xtpl->assign('main' . $i, $row);
         ++$i;
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }
 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 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 
    }
}