/** * 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'); }
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'); }
function getEditor() { $xtpl = new XTemplate(dirname(__FILE__) . '/editor.xtpl'); $xtpl->parse('main.menu_item_list'); $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_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_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 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_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 . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . 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'); }
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'); }
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'); } }
/** * 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 . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=content&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'); }
/** * */ 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; }
/** * 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'); }
/** * 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_news_groups_multi_tabs($block_config) { global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db; $module = $block_config['module']; $show_no_image = $module_config[$module]['show_no_image']; $blockwidth = $module_config[$module]['blockwidth']; if (empty($block_config['blockid'])) { return ''; } $blockid = implode(',', $block_config['blockid']); if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_groups_multi_tabs.tpl')) { $block_theme = $global_config['module_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_groups_multi_tabs.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news'); $n = 0; $sql = 'SELECT bid, title FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block_cat WHERE bid IN ( ' . $blockid . ' ) ORDER BY weight ASC'; $result = $db->query($sql); while ($data = $result->fetch()) { $n++; if ($n == 1) { $data['active'] = 'active'; } $xtpl->assign('BLOCK_INFO', $data); $xtpl->parse('main.group_info'); $db->sqlreset()->select('t1.id, t1.catid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgthumb,t1.hometext,t1.publtime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows t1')->join('INNER JOIN ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $data['bid'] . ' AND t1.status= 1')->order('t2.weight ASC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), '', $module); if (!empty($list)) { foreach ($list as $l) { $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl']; if ($l['homeimgthumb'] == 1) { $l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 2) { $l['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 3) { $l['thumb'] = $l['homeimgfile']; } elseif (!empty($show_no_image)) { $l['thumb'] = NV_BASE_SITEURL . $show_no_image; } else { $l['thumb'] = ''; } $l['bid'] = $data['bid']; $l['blockwidth'] = $blockwidth; $l['title'] = nv_clean60($l['title'], $block_config['title_length']); $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.group_content.loop.img'); } $xtpl->parse('main.group_content.loop'); } $xtpl->parse('main.group_content'); } } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * 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'); } }
/** * 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'); }
function nv_show_playlist_list($playlist_id) { global $db, $lang_module, $lang_global, $module_name, $module_data, $op, $global_array_cat, $module_file, $module_config, $global_config; $xtpl = new XTemplate('playlist_list.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL); $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('OP', $op); $xtpl->assign('PLAYLIST_ID', $playlist_id); $global_array_cat[0] = array('alias' => 'Other'); $sql = 'SELECT t1.id, t1.catid, t1.title, t1.alias, t2.playlist_sort FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows t1 INNER JOIN ' . NV_PREFIXLANG . '_' . $module_data . '_playlist t2 ON t1.id = t2.id WHERE t2.playlist_id= ' . $playlist_id . ' AND t1.status=1 ORDER BY t2.playlist_sort ASC'; $array_block = $db->query($sql)->fetchAll(); $num = sizeof($array_block); if ($num > 0) { foreach ($array_block as $row) { $xtpl->assign('ROW', array('id' => $row['id'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'], 'title' => $row['title'])); for ($i = 1; $i <= $num; ++$i) { $xtpl->assign('WEIGHT', array('key' => $i, 'title' => $i, 'selected' => $i == $row['playlist_sort'] ? ' selected="selected"' : '')); $xtpl->parse('list_videos.loop.playlist_sort'); } $xtpl->parse('list_videos.loop'); } $xtpl->parse('list_videos'); $contents = $xtpl->text('list_videos'); } else { $xtpl->parse('no_videos'); $contents = $xtpl->text('no_videos'); } return $contents; }
/** * 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 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; }
/** * 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_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_news_cat($block_config) { global $nv_Cache, $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db; $module = $block_config['module']; $show_no_image = $module_config[$module]['show_no_image']; $blockwidth = $module_config[$module]['blockwidth']; if (empty($block_config['catid'])) { return ''; } $catid = implode(',', $block_config['catid']); $db->sqlreset()->select('id, catid, title, alias, homeimgfile, homeimgthumb, hometext, publtime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows')->where('status= 1 AND catid IN(' . $catid . ')')->order('publtime DESC')->limit($block_config['numrow']); $list = $nv_Cache->db($db->sql(), '', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_groups.tpl')) { $block_theme = $global_config['module_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_groups.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news'); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $block_theme); foreach ($list as $l) { $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl']; if ($l['homeimgthumb'] == 1) { $l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 2) { $l['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 3) { $l['thumb'] = $l['homeimgfile']; } elseif (!empty($show_no_image)) { $l['thumb'] = NV_BASE_SITEURL . $show_no_image; } else { $l['thumb'] = ''; } $l['blockwidth'] = $blockwidth; $l['hometext'] = nv_clean60($l['hometext'], $block_config['tooltip_length'], true); if (!$block_config['showtooltip']) { $xtpl->assign('TITLE', 'title="' . $l['title'] . '"'); } $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.loop.img'); } $xtpl->parse('main.loop'); } if ($block_config['showtooltip']) { $xtpl->assign('TOOLTIP_POSITION', $block_config['tooltip_position']); $xtpl->parse('main.tooltip'); } $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'); }
/** * nv_theme_c34to40_main() * * @param mixed $array_data * @return */ function nv_theme_c34to40_main($data) { global $module_file, $lang_module, $module_info, $op, $my_head; $my_head .= '<link href="' . NV_BASE_SITEURL . 'editors/ckeditor/plugins/codesnippet/lib/highlight/styles/github.css" rel="stylesheet">'; $my_head .= '<script src="' . NV_BASE_SITEURL . 'editors/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js"></script>'; $my_head .= '<script>hljs.initHighlightingOnLoad();</script>'; $xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('DATA', $data); $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 share() { global $cfg; if ($cfg['jquery']) { $t = new XTemplate(cot_tplfile('share', 'plug')); if ($cfg['plugin']['share']['sh_counter']) { $t->assign(array('SHARE_GP_COUNTER' => '<q data-counter="gp"></q>', 'SHARE_VK_COUNTER' => '<q data-counter="vk"></q>', 'SHARE_FB_COUNTER' => '<q data-counter="fb"></q>', 'SHARE_MR_COUNTER' => '<q data-counter="mr"></q>', 'SHARE_LI_COUNTER' => '<q data-counter="li"></q>', 'SHARE_OK_COUNTER' => '<q data-counter="ok"></q>', 'SHARE_TM_COUNTER' => '<q data-counter="tm"></q>', 'SHARE_PT_COUNTER' => '<q data-counter="pt"></q>', 'SHARE_RD_COUNTER' => '<q data-counter="rd"></q>', 'SHARE_SU_COUNTER' => '<q data-counter="su"></q>', 'SHARE_PO_COUNTER' => '<q data-counter="po"></q>', 'SHARE_BF_COUNTER' => '<q data-counter="bf"></q>', 'SHARE_XI_COUNTER' => '<q data-counter="xi"></q>')); } $t->assign(array('SHARE_MESSAGERS' => $cfg['plugin']['share']['sh_messagers'], 'SHARE_SIZE' => 'sh-' . $cfg['plugin']['share']['sh_size'])); $t->parse('MAIN'); return $t->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_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'); } }