function main($albums) { global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $module_name, $my_head; $xtpl = new XTemplate("main.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('IMGP', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/" . $module_file . "/"); $xtpl->assign('LANG', $lang_module); foreach ($albums as $album) { $xtpl->assign('TITLE_ALBUM', $album['name']); $xtpl->assign('NUM_PHOTO', $album['num_photo']); $xtpl->assign('NUM_VIEW', $album['num_view']); $url_link = NV_BASE_SITEURL . "?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $album['alias']; $xtpl->assign('URL_AB', $url_link); $xtpl->assign('AB_DES', $album['description']); if (!empty($album['listimg'])) { foreach ($album['listimg'] as $listimg) { if (!nv_is_url($listimg['thumb_name']) && $listimg['thumb_name'] != "") { $listimg['thumb_name'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/" . $listimg['thumb_name']; $listimg['path'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . $listimg['path']; } else { $listimg['thumb_name'] = NV_BASE_SITEURL . "themes/" . $global_config['site_theme'] . "/images/" . $module_name . "/no_image.gif"; } $xtpl->assign('NAME', $listimg['name']); $xtpl->assign('URL_VID', NV_BASE_SITEURL . "?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $album['alias'] . "/" . $listimg['alias'] . "/" . $listimg['pictureid'] . ""); $xtpl->assign('VID_VIEW', $listimg['num_view']); $xtpl->assign('DES', $listimg['description']); $xtpl->parse('main.alb.vid'); } } else { $xtpl->assign('NONE', "no image"); } $xtpl->parse('main.alb'); } $xtpl->parse('main'); return $xtpl->text('main'); }
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 . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . 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_news_block_news($block_config, $mod_data) { global $module_array_cat, $module_info, $db, $module_config; $module = $block_config['module']; $blockwidth = $module_config[$module]['blockwidth']; $array_block_news = array(); $cache_file = NV_LANG_DATA . "_" . $module . "_block_news_" . NV_CACHE_PREFIX . ".cache"; if (($cache = nv_get_cache($cache_file)) != false) { $array_block_news = unserialize($cache); } else { $numrow = isset($block_config['numrow']) ? $block_config['numrow'] : 20; $sql = "SELECT id, catid, publtime, exptime, title, alias, homeimgthumb, homeimgfile FROM `" . NV_PREFIXLANG . "_" . $mod_data . "_rows` WHERE `status`= 1 ORDER BY `publtime` DESC LIMIT 0 , " . $numrow; $result = $db->sql_query($sql); while (list($id, $catid, $publtime, $exptime, $title, $alias, $homeimgthumb, $homeimgfile) = $db->sql_fetchrow($result)) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module . "&" . NV_OP_VARIABLE . "=" . $module_array_cat[$catid]['alias'] . "/" . $alias . "-" . $id; if (!empty($homeimgthumb)) { $array_img = explode("|", $homeimgthumb); } else { $array_img = array("", ""); } if ($array_img[0] != "" and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/' . $array_img[0])) { $imgurl = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module . '/' . $array_img[0]; } elseif (nv_is_url($homeimgfile)) { $imgurl = $homeimgfile; } elseif ($homeimgfile != "" and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module . '/' . $homeimgfile)) { $imgurl = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/' . $homeimgfile; } else { $imgurl = ""; } $array_block_news[] = array('id' => $id, 'title' => $title, 'link' => $link, 'imgurl' => $imgurl, 'width' => $blockwidth); } $cache = serialize($array_block_news); nv_set_cache($cache_file, $cache); } if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/news/block_news.tpl")) { $block_theme = $module_info['template']; } else { $block_theme = "default"; } $xtpl = new XTemplate("block_news.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/news/"); $a = 1; foreach ($array_block_news as $array_news) { $xtpl->assign('blocknews', $array_news); if (!empty($array_news['imgurl'])) { $xtpl->parse('main.newloop.imgblock'); } $xtpl->parse('main.newloop'); $xtpl->assign('BACKGROUND', $a % 2 ? 'bg ' : ''); ++$a; } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_block_data_config_rss_submit() * * @param mixed $module * @param mixed $lang_block * @return * */ function nv_block_data_config_rss_submit($module, $lang_block) { global $nv_Request; $return = array(); $return['error'] = array(); $return['config'] = array(); $return['config']['url'] = $nv_Request->get_title('config_url', 'post', '', 0); $return['config']['number'] = $nv_Request->get_int('config_number', 'post', 0); $return['config']['isdescription'] = $nv_Request->get_int('config_isdescription', 'post', 0); $return['config']['ishtml'] = $nv_Request->get_int('config_ishtml', 'post', 0); $return['config']['ispubdate'] = $nv_Request->get_int('config_ispubdate', 'post', 0); $return['config']['istarget'] = $nv_Request->get_int('config_istarget', 'post', 0); $return['config']['title_length'] = $nv_Request->get_int('config_title_length', 'post', 0); if (!nv_is_url($return['config']['url'])) { $return['error'][] = $lang_block['error_url']; } return $return; }
function view($albumimg, $ialbum, $list_pages) { global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $module_name; $xtpl = new XTemplate("view.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $i = 0; $num_per_rows = 4; $xtpl->assign('AL_NAME', $ialbum['name']); $xtpl->assign('NUM_PHOTO', $ialbum['num_photo']); $xtpl->assign('NUM_VIEW', $ialbum['num_view']); $xtpl->assign('NV_BASE_SITE', NV_BASE_SITEURL); $xtpl->assign('DES_AL', $ialbum['description']); while ($i < count($albumimg)) { for ($j = 0; $j < $num_per_rows; $j++) { $album = $albumimg[$i]; $i++; if (!nv_is_url($album['path']) && $album['thumb_name'] != "") { $album['thumb_name'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/" . $album['thumb_name']; $album['path'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . $album['path']; } else { $album['thumb_name'] = NV_BASE_SITEURL . "themes/" . $global_config['site_theme'] . "/images/" . $module_name . "/no_image.gif"; $album['path'] = NV_BASE_SITEURL . "themes/" . $global_config['site_theme'] . "/images/" . $module_name . "/no_image.gif"; } $xtpl->assign('SRC', $album['thumb_name']); $xtpl->assign('SRC_LAGE', $album['path']); $xtpl->assign('DES', $album['description']); $xtpl->assign('NAME', $album['name']); // $xtpl->assign('NUM_VIEW', $album['numview']); $xtpl->parse('main.row.album.img'); $xtpl->parse('main.row.album'); if ($i >= count($albumimg)) { break; } } $xtpl->parse('main.row'); } $xtpl->assign('PAGES', $list_pages); if (!empty($list_pages)) { $xtpl->parse('main.pages'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_block_news_groups($block_config) { global $module_array_cat, $module_info, $site_mods; $module = $block_config['module']; $sql = "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` as t1 INNER JOIN `" . NV_PREFIXLANG . "_" . $site_mods[$module]['module_data'] . "_block` AS t2 ON t1.id = t2.id WHERE t2.bid= " . $block_config['blockid'] . " AND t1.status= 1 ORDER BY t2.weight ASC LIMIT 0 , " . $block_config['numrow']; $list = nv_db_cache($sql, '', $module); $i = 1; if (!empty($list)) { if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/news/block_groups.tpl")) { $block_theme = $module_info['template']; } else { $block_theme = "default"; } $xtpl = new XTemplate("block_groups.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/news"); 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']; $l['thumb'] = ""; if (!empty($l['homeimgthumb'])) { $array_img = array(); $array_img = explode("|", $l['homeimgthumb']); if ($array_img[0] != "" and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/' . $array_img[0])) { $imgurl = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module . '/' . $array_img[0]; $l['thumb'] = $imgurl; } } elseif (nv_is_url($l['homeimgfile'])) { $l['thumb'] = $l['homeimgfile']; } $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.loop.img'); } $xtpl->assign('bg', ++$i % 2 ? "bg" : ""); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } }
function creat_thumbs($id, $homeimgfile, $module_name, $width = 200, $height = 150) { if ($width >= $height) { $rate = $width / $height; } else { $rate = $height / $width; } $image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $homeimgfile; if ($homeimgfile != '' and file_exists($image)) { $imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $homeimgfile; $imginfo = nv_is_image($image); $basename = $module_name . $width . 'x' . $height . '-' . $id . '-' . md5_file($image) . '.' . $imginfo['ext']; if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) { $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); if ($imginfo['width'] <= $imginfo['height']) { $_image->resizeXY($width, 0); } elseif ($imginfo['width'] / $imginfo['height'] < $rate) { $_image->resizeXY($width, 0); } elseif ($imginfo['width'] / $imginfo['height'] >= $rate) { $_image->resizeXY(0, $height); } $_image->cropFromCenter($width, $height); $_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename); if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) { $imgsource = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename; } } } elseif (nv_is_url($homeimgfile)) { $imgsource = $homeimgfile; } else { $imgsource = ''; } return $imgsource; }
function photos_thumbs($id, $file, $module_upload, $width = 270, $height = 210, $quality = 90) { if ($width >= $height) { $rate = $width / $height; } else { $rate = $height / $width; } $image = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/images/' . $file; if ($file != '' and file_exists($image)) { $imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/images/' . $file; $imginfo = nv_is_image($image); $basename = $module_upload . '_' . $width . 'x' . $height . '-' . $id . '-' . md5_file($image) . '.' . $imginfo['ext']; if (file_exists(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename)) { $imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename; } else { $_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT); if ($imginfo['width'] <= $imginfo['height']) { $_image->resizeXY($width, 0); } elseif ($imginfo['width'] / $imginfo['height'] < $rate) { $_image->resizeXY($width, 0); } elseif ($imginfo['width'] / $imginfo['height'] >= $rate) { $_image->resizeXY(0, $height); } $_image->cropFromCenter($width, $height); $_image->save(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/', $basename, $quality); if (file_exists(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename)) { $imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename; } } } elseif (nv_is_url($file)) { $imgsource = $file; } else { $imgsource = ''; } return $imgsource; }
} $url = rawurldecode($url); if ($is_myurl) { $url = substr($url, strlen(NV_BASE_SITEURL)); $url = NV_ROOTDIR . '/' . $url; if (!file_exists($url)) { die($lang_module['file_checkUrl_error']); } } else { $url = trim($url); $url = nv_nl2br($url, '<br />'); $url = explode('<br />', $url); $url = array_map('trim', $url); foreach ($url as $l) { if (!empty($l)) { if (!nv_is_url($l)) { die($lang_module['file_checkUrl_error']); } if (!nv_check_url($l)) { die($lang_module['file_checkUrl_error']); } } } } die($lang_module['file_checkUrl_ok']); } // Download file if ($nv_Request->isset_request('fdownload', 'get')) { $file = $nv_Request->get_string('fdownload', 'get', ''); if (!empty($file)) { $file = substr($file, strlen(NV_BASE_SITEURL));
} } // Xu ly anh minh hoa $rowcontent['homeimgthumb'] = 0; if (empty($rowcontent['homeimgfile']) and ($rowcontent['imgposition'] == 1 or $rowcontent['imgposition'] == 2)) { $rowcontent['homeimgfile'] = nv_get_firstimage($rowcontent['bodyhtml']); } if (!nv_is_url($rowcontent['homeimgfile']) and nv_is_file($rowcontent['homeimgfile'], NV_UPLOADS_DIR . '/' . $module_upload) === true) { $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/'); $rowcontent['homeimgfile'] = substr($rowcontent['homeimgfile'], $lu); if (file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_upload . '/' . $rowcontent['homeimgfile'])) { $rowcontent['homeimgthumb'] = 1; } else { $rowcontent['homeimgthumb'] = 2; } } elseif (nv_is_url($rowcontent['homeimgfile'])) { $rowcontent['homeimgthumb'] = 3; } else { $rowcontent['homeimgfile'] = ''; } if ($rowcontent['id'] == 0) { if (!defined('NV_IS_SPADMIN') and intval($rowcontent['publtime']) < NV_CURRENTTIME) { $rowcontent['publtime'] = NV_CURRENTTIME; } if ($rowcontent['status'] == 1 and $rowcontent['publtime'] > NV_CURRENTTIME) { $rowcontent['status'] = 2; } $sql = 'INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_rows (catid, listcatid, topicid, admin_id, author, sourceid, addtime, edittime, status, publtime, exptime, archive, title, alias, hometext, homeimgfile, homeimgalt, homeimgthumb, inhome, allowed_comm, allowed_rating, hitstotal, hitscm, total_rating, click_rating) VALUES (' . intval($rowcontent['catid']) . ', :listcatid,
$_user['gender'] = filter_text_input('gender', 'post', '', 1, 1); $_user['website'] = filter_text_input('website', 'post', ''); $_user['location'] = filter_text_input('location', 'post', '', 1); $_user['yim'] = filter_text_input('yim', 'post', '', 1, 100); $_user['telephone'] = filter_text_input('telephone', 'post', '', 1, 100); $_user['fax'] = filter_text_input('fax', 'post', '', 1, 100); $_user['mobile'] = filter_text_input('mobile', 'post', '', 1, 100); $_user['view_mail'] = $nv_Request->get_int('view_mail', 'post', 0); $_user['sig'] = filter_text_textarea('sig', '', NV_ALLOWED_HTML_TAGS); $_user['birthday'] = filter_text_input('birthday', 'post', '', 1, 10); $_user['in_groups'] = $nv_Request->get_typed_array('group', 'post', 'int'); if (!empty($_user['website'])) { if (!preg_match("#^(http|https|ftp|gopher)\\:\\/\\/#", $_user['website'])) { $_user['website'] = "http://" . $_user['website']; } if (!nv_is_url($_user['website'])) { $_user['website'] = ""; } } if (($error_username = nv_check_valid_login($_user['username'], NV_UNICKMAX, NV_UNICKMIN)) != "") { $error = $error_username; } elseif ($_user['username'] != $db->fixdb($_user['username'])) { $error = sprintf($lang_module['account_deny_name'], '<strong>' . $_user['username'] . '</strong>'); } elseif (($error_xemail = nv_check_valid_email($_user['email'])) != "") { $error = $error_xemail; } elseif ($db->sql_numrows($db->sql_query("SELECT `userid` FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `md5username`=" . $db->dbescape(md5($_user['username'])))) != 0) { $error = $lang_module['edit_error_username_exist']; } elseif ($db->sql_numrows($db->sql_query("SELECT `userid` FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `email`=" . $db->dbescape($_user['email']))) != 0) { $error = $lang_module['edit_error_email_exist']; } elseif ($db->sql_numrows($db->sql_query("SELECT `userid` FROM `" . NV_USERS_GLOBALTABLE . "_reg` WHERE `email`=" . $db->dbescape($_user['email']))) != 0) { $error = $lang_module['edit_error_email_exist'];
$rowcat['description'] = $description; } elseif ($id > 0) { $query = $db->sql_query("SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $id . ""); $rowcat = $db->sql_fetchrow($query); if ($rowcat['id'] > 0) { $page_title = $lang_module['weblink_edit_link']; } } if (empty($rowcat['id'])) { $page_title = $lang_module['weblink_add_link']; } $rowcat['description'] = defined('NV_EDITOR') ? nv_editor_br2nl($rowcat['description']) : nv_br2nl($rowcat['description']); // dung de lay data tu CSDL $rowcat['description'] = nv_htmlspecialchars($rowcat['description']); // dung de dua vao editor if (!empty($rowcat['urlimg']) and !nv_is_url($rowcat['urlimg'])) { $rowcat['urlimg'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $rowcat['urlimg']; } if (defined('NV_EDITOR')) { require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php'; } $contents = ""; if ($error != "") { $contents .= "<div class=\"quote\" style=\"width:780px;\">\n"; $contents .= "<blockquote class=\"error\"><span>" . $error . "</span></blockquote>\n"; $contents .= "</div>\n"; $contents .= "<div class=\"clear\"></div>\n"; } $contents .= "<div id=\"list_mods\">"; $contents .= "<form action=\"" . NV_BASE_ADMINURL . "index.php\" method=\"post\">"; // post header parameter
if (!preg_match("/^([0-9]+)\$/", $array['sysGoogleAuthor'])) { $array['sysGoogleAuthor'] = ''; } if (!preg_match("/^([0-9]+)\$/", $array['sysFbAppID'])) { $array['sysFbAppID'] = ''; } if (!preg_match("/^([0-9]+)\$/", $array['sysFbAdminID'])) { $array['sysFbAdminID'] = ''; } if (!empty($array['sysDefaultImage'])) { if (preg_match("/^\\//i", $array['sysDefaultImage'])) { $array['sysDefaultImage'] = substr($array['sysDefaultImage'], strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name)); if (!is_file(NV_UPLOADS_REAL_DIR . '/' . $module_name . $array['sysDefaultImage'])) { $array['sysDefaultImage'] = ''; } } elseif (!nv_is_url($array['sysDefaultImage'])) { $array['sysDefaultImage'] = ''; } } foreach ($array as $config_name => $config_value) { $sql = "REPLACE INTO " . $BL->table_prefix . "_config VALUES (" . $db->quote($config_name) . "," . $db->quote($config_value) . ")"; $db->query($sql); } nv_del_moduleCache($module_name); Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op); die; } $xtpl = new XTemplate("config-structured-data.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); $xtpl->assign('UPLOADS_PATH', NV_UPLOADS_DIR . '/' . $module_name);
$data['id'] = $nv_Request->get_int('id', 'post', 0); $data['title'] = nv_substr($nv_Request->get_title('title', 'post', ''), 0, 255); $data['description'] = $nv_Request->get_editor('description', '', NV_ALLOWED_HTML_TAGS); $data['link'] = nv_substr($nv_Request->get_string('link', 'post', ''), 0, 255); $data['target'] = nv_substr($nv_Request->get_title('target', 'post', ''), 0, 10); $data['image'] = nv_substr($nv_Request->get_title('image', 'post', ''), 0, 255); $data['status'] = $nv_Request->get_int('status', 'post', 0) == 0 ? 0 : 1; $data['exptime'] = $nv_Request->get_int('exptime', 'post', 0); if (empty($data['title'])) { $error[] = array('name' => 'title', 'value' => $lang_module['content_title_error']); } if (!empty($data['link'])) { if (!preg_match("/\\:\\/\\//i", $data['link'])) { $data['link'] = 'http://' . $data['link']; } if (!nv_is_url($data['link'])) { $error[] = array('name' => 'link', 'value' => $lang_module['content_link_error']); } } // Prosess image if (is_file(NV_DOCUMENT_ROOT . $data['image'])) { $data['image'] = substr($data['image'], strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/')); } else { $data['image'] = ''; } // Prosess time $data['start_time'] = $data['status'] ? NV_CURRENTTIME : 0; $data['end_time'] = $data['exptime'] ? $data['start_time'] + $data['exptime'] * 3600 : 0; if (empty($error)) { if ($data['id']) { $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_rows SET
} } elseif (nv_is_url($rowcontent['homeimgfile'])) { $rowcontent['homeimgthumb'] = 3; } else { $rowcontent['homeimgfile'] = ''; } // Xu ly Video link $rowcontent['vid_type'] = 0; if (!nv_is_url($rowcontent['vid_path']) and is_file(NV_DOCUMENT_ROOT . $rowcontent['vid_path'])) { $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/vid/'); $rowcontent['vid_path'] = substr($rowcontent['vid_path'], $lu); if (file_exists(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/vid/' . $rowcontent['vid_path'])) { $rowcontent['vid_type'] = 1; //is uploaded file } } elseif (nv_is_url($rowcontent['vid_path'])) { if (is_youtube($rowcontent['vid_path'])) { $rowcontent['vid_type'] = 2; //is Youtube } elseif (is_picasa($rowcontent['vid_path'])) { $rowcontent['vid_type'] = 3; //is Picasa } elseif (is_facebook($rowcontent['vid_path'])) { $rowcontent['vid_type'] = 4; //is Facebook } else { $rowcontent['vid_type'] = 5; //hotlink from other site } } else { $rowcontent['vid_path'] = '';
$array['linkdirect'] = array_unique($array['linkdirect']); } $stmt = $db->prepare('SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE title= :title '); $stmt->bindParam(':title', $array['title'], PDO::PARAM_STR); $stmt->execute(); $is_exists = $stmt->fetchColumn(); if (empty($array['title'])) { $is_error = true; $error = $lang_module['file_error_title']; } elseif ($is_exists) { $is_error = true; $error = $lang_module['file_title_exists']; } elseif (!empty($array['author_email']) and ($check_valid_email = nv_check_valid_email($array['author_email'])) != '') { $is_error = true; $error = $check_valid_email; } elseif (!empty($array['author_url']) and !nv_is_url($array['author_url'])) { $is_error = true; $error = $lang_module['file_error_author_url']; } elseif (empty($array['fileupload']) and empty($array['linkdirect']) and empty($array['fileupload2'])) { $is_error = true; $error = $lang_module['file_error_fileupload']; } else { $alias = change_alias($array['title']); $array['introtext'] = nv_nl2br($array['introtext'], '<br />'); if ($row['user_id']) { $array['user_name'] = $row['user_name']; } if (!empty($array['fileupload2'])) { $array['fileupload'] = $array['fileupload2']; } elseif (!empty($array['fileupload'])) { $fileupload = $array['fileupload'];
function nv_news_block_news($block_config, $mod_data) { global $module_array_cat, $module_info, $db, $module_config, $global_config; $module = 'news'; $blockwidth = $module_config[$module]['blockwidth']; $show_no_image = $module_config[$module]['show_no_image']; $numrow = isset($block_config['numrow']) ? $block_config['numrow'] : 20; $cache_file = NV_LANG_DATA . '__block_news_' . $numrow . '_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache($module, $cache_file)) != false) { $array_block_news = unserialize($cache); } else { $array_block_news = array(); $db->sqlreset()->select('id, catid, publtime, exptime, title, alias, homeimgthumb, homeimgfile, hometext')->from(NV_PREFIXLANG . '_' . $mod_data . '_rows')->where('status= 1')->order('publtime DESC')->limit($numrow); $result = $db->query($db->sql()); while (list($id, $catid, $publtime, $exptime, $title, $alias, $homeimgthumb, $homeimgfile, $hometext) = $result->fetch(3)) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$catid]['alias'] . '/' . $alias . '-' . $id . $global_config['rewrite_exturl']; $array_block_news[] = array('id' => $id, 'title' => $title, 'link' => $link, 'homeimgfile' => $homeimgfile, 'width' => $blockwidth, 'hometext' => $hometext); } $cache = serialize($array_block_news); nv_set_cache($module, $cache_file, $cache); } if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks/block_news.tpl')) { $block_theme = $module_info['template']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_news.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks/'); $i = 1; foreach ($array_block_news as $array_news) { $array_news['hometext'] = nv_clean60($array_news['hometext'], 20); $image = NV_UPLOADS_REAL_DIR . '/' . $module . '/' . $array_news['homeimgfile']; if ($array_news['homeimgfile'] != '' and file_exists($image)) { if ($i == 1) { $width = 370; $height = 150; } else { $width = 170; $height = 115; } $array_news['imgurl'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_news['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)) { $array_news['imgurl'] = 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)) { $array_news['imgurl'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename; } } } } elseif (nv_is_url($array_news['homeimgfile'])) { $array_news['imgurl'] = $array_news['homeimgfile']; } elseif (!empty($module_config[$module_name]['show_no_image'])) { $array_news['imgurl'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image']; } else { $array_news['imgurl'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png'; } $xtpl->assign('blocknews', $array_news); if ($i == 1) { $xtpl->parse('main.news_main'); } else { $array_news['title0'] = nv_clean60($array_news['title'], 40); $xtpl->assign('blocknews', $array_news); $xtpl->assign('FL', $i % 2 != 0 ? 'right' : 'left'); $xtpl->parse('main.newsloop'); } $i++; } $xtpl->parse('main'); return $xtpl->text('main'); }
$stmt = $db->prepare("SELECT * FROM " . $db_config['prefix'] . "_" . $module_data . "_payment WHERE payment= :payment"); $stmt->bindParam(':payment', $payment, PDO::PARAM_STR); $stmt->execute(); $data_pay = $stmt->fetch(); } if ($nv_Request->isset_request('saveconfigpaymentedit', 'post')) { $payment = $nv_Request->get_title('payment', 'post', '', 0); $paymentname = $nv_Request->get_title('paymentname', 'post', '', 0); $domain = $nv_Request->get_title('domain', 'post', '', 0); $images_button = $nv_Request->get_title('images_button', 'post', '', 0); $active = $nv_Request->get_int('active', 'post', 0); $array_config = $nv_Request->get_array('config', 'post', array()); if (!nv_is_url($images_button) and file_exists(NV_DOCUMENT_ROOT . $images_button)) { $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/'); $images_button = substr($images_button, $lu); } elseif (!nv_is_url($images_button)) { $images_button = ''; } $stmt = $db->prepare("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_payment SET paymentname = :paymentname, domain = :domain, active=" . $active . ", config = '" . nv_base64_encode(serialize($array_config)) . "',images_button= :images_button WHERE payment = :payment"); $stmt->bindParam(':paymentname', $paymentname, PDO::PARAM_STR); $stmt->bindParam(':domain', $domain, PDO::PARAM_STR); $stmt->bindParam(':images_button', $images_button, PDO::PARAM_STR); $stmt->bindParam(':payment', $payment, PDO::PARAM_STR); $stmt->execute(); nv_insert_logs(NV_LANG_DATA, $module_name, 'log_edit_product', "edit " . $paymentname, $admin_info['userid']); nv_del_moduleCache($module_name); Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op); } $xtpl = new XTemplate("payport.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $a = 0;
$sql = "SELECT id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` WHERE `status`=1 ORDER BY `publtime` DESC LIMIT 30"; } else { $sql = "SELECT id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `status`=1 AND `inhome`='1' ORDER BY `publtime` DESC LIMIT 30"; } if ($module_info['rss']) { $result = $db->sql_query($sql); while (list($id, $catid_i, $publtime, $title, $alias, $hometext, $homeimgthumb, $homeimgfile) = $db->sql_fetchrow($result)) { if (!empty($catid)) { $catid_i = $catid; } $catalias = $global_array_cat[$catid_i]['alias']; if (!empty($homeimgthumb)) { $array_img = explode("|", $homeimgthumb); } else { $array_img = array("", ""); } if ($array_img[0] != "" and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/' . $array_img[0])) { $rimages = NV_MY_DOMAIN . NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_name . '/' . $array_img[0]; } elseif (nv_is_url($homeimgfile)) { $rimages = $homeimgfile; } elseif ($homeimgfile != "" and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $homeimgfile)) { $rimages = NV_MY_DOMAIN . NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $homeimgfile; } else { $rimages = ""; } $rimages = !empty($rimages) ? "<img src=\"" . $rimages . "\" width=\"100\" align=\"left\" border=\"0\">" : ""; $items[] = array('title' => $title, 'link' => NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $catalias . '/' . $alias . '-' . $id, 'guid' => $module_name . '_' . $id, 'description' => $rimages . $hometext, 'pubdate' => $publtime); } } nv_rss_generate($channel, $items); die;
$array_in_cat = GetCatidInParent($catid); } } if ($nv_Request->get_int('savecat', 'post') == '1') { $catdata['catid'] = $nv_Request->get_int('catid', 'post', 0); $catdata['parentid'] = $nv_Request->get_int('parentid', 'post', 0); $catdata['title'] = filter_text_input('title', 'post', '', 1); $catdata['alias'] = filter_text_input('alias', 'post', '', 1); $catdata['image'] = filter_text_input('image', 'post', ''); $catdata['meta_title'] = filter_text_input('meta_title', 'post', '', 1); $catdata['meta_keywords'] = filter_text_input('meta_keywords', 'post', '', 1); $catdata['tags_cloud'] = $catdata['meta_keywords']; $catdata['meta_description'] = filter_text_input('meta_description', 'post', '', 1); $catdata['who_view'] = $nv_Request->get_int('who_view', 'post', 0); $groups_view = ""; if (!nv_is_url($catdata['image']) and file_exists(NV_DOCUMENT_ROOT . $catdata['image'])) { $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/"); $catdata['image'] = substr($catdata['image'], $lu); } $groups = $nv_Request->get_typed_array('groups_view', 'post', 'int', array()); $groups = array_intersect($groups, array_keys($groups_list)); $catdata['groups_view'] = implode(",", $groups); $oldAdminArray = filter_text_input('old_admins', 'post', '', 1); if (empty($catdata['alias'])) { $catdata['alias'] = change_alias($catdata['title']); } $newAdminArray = array_unique($nv_Request->get_typed_array('adminids', 'post', 'int', array())); $old_parentid = $nv_Request->get_int('old_parentid', 'post', 0); $catdata['adminids'] = implode(',', $newAdminArray); if (empty($catdata['title'])) { $np->error[] = "- Chưa có tiêu đề";
$array_config['copyright'] = $nv_Request->get_editor('copyright', '', NV_ALLOWED_HTML_TAGS); $array_config['showtooltip'] = $nv_Request->get_int('showtooltip', 'post', 0); $array_config['tooltip_position'] = $nv_Request->get_string('tooltip_position', 'post', ''); $array_config['tooltip_length'] = $nv_Request->get_int('tooltip_length', 'post', 0); $array_config['showhometext'] = $nv_Request->get_int('showhometext', 'post', 0); $array_config['facebookappid'] = $nv_Request->get_title('facebookappid', 'post', ''); $array_config['socialbutton'] = $nv_Request->get_int('socialbutton', 'post', 0); $array_config['show_no_image'] = $nv_Request->get_title('show_no_image', 'post', '', 0); $array_config['structure_upload'] = $nv_Request->get_title('structure_upload', 'post', '', 0); $array_config['config_source'] = $nv_Request->get_int('config_source', 'post', 0); $array_config['imgposition'] = $nv_Request->get_int('imgposition', 'post', 0); $array_config['alias_lower'] = $nv_Request->get_int('alias_lower', 'post', 0); $array_config['tags_alias'] = $nv_Request->get_int('tags_alias', 'post', 0); $array_config['auto_tags'] = $nv_Request->get_int('auto_tags', 'post', 0); $array_config['tags_remind'] = $nv_Request->get_int('tags_remind', 'post', 0); if (!nv_is_url($array_config['show_no_image']) and file_exists(NV_DOCUMENT_ROOT . $array_config['show_no_image'])) { $lu = strlen(NV_BASE_SITEURL); $array_config['show_no_image'] = substr($array_config['show_no_image'], $lu); } else { $array_config['show_no_image'] = ''; } $sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = :config_value WHERE lang = '" . NV_LANG_DATA . "' AND module = :module_name AND config_name = :config_name"); $sth->bindParam(':module_name', $module_name, PDO::PARAM_STR); foreach ($array_config as $config_name => $config_value) { $sth->bindParam(':config_name', $config_name, PDO::PARAM_STR); $sth->bindParam(':config_value', $config_value, PDO::PARAM_STR); $sth->execute(); } nv_del_moduleCache('settings'); nv_del_moduleCache($module_name); Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&rand=' . nv_genpass());
$value = mktime(0, 0, 0, $m[2], $m[1], $m[3]); if ($value < $row_f['min_length'] or $value > $row_f['max_length']) { $error = sprintf($lang_module['field_min_max_value'], $row_f['title'], date('d/m/Y', $row_f['min_length']), date('d/m/Y', $row_f['max_length'])); } } else { $error = sprintf($lang_module['field_match_type_error'], $row_f['title']); } } elseif ($row_f['question_type'] == 'textbox') { if ($row_f['match_type'] == 'alphanumeric') { if (!preg_match("/^[a-zA-Z0-9\\_]+\$/", $value)) { $error = sprintf($lang_module['field_match_type_error'], $row_f['title']); } } elseif ($row_f['match_type'] == 'email') { $error = nv_check_valid_email($value); } elseif ($row_f['match_type'] == 'url') { if (!nv_is_url($value)) { $error = sprintf($lang_module['field_match_type_error'], $row_f['title']); } } elseif ($row_f['match_type'] == 'regex') { if (!preg_match("/" . $row_f['match_regex'] . "/", $value)) { $error = sprintf($lang_module['field_match_type_error'], $row_f['title']); } } elseif ($row_f['match_type'] == 'callback') { if (function_exists($row_f['func_callback'])) { if (!call_user_func($row_f['func_callback'], $value)) { $error = sprintf($lang_module['field_match_type_error'], $row_f['title']); } } else { $error = "error function not exists " . $row_f['func_callback']; } } else {
$autologomod = implode(',', $autologomod); } $sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = :config_value WHERE lang = '" . NV_LANG_DATA . "' AND module = 'global' AND config_name = 'upload_logo'"); $sth->bindParam(':config_value', $upload_logo, PDO::PARAM_STR); $sth->execute(); $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $autologosize1 . "' WHERE lang = '" . NV_LANG_DATA . "' AND module = 'global' AND config_name = 'autologosize1'"); $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $autologosize2 . "' WHERE lang = '" . NV_LANG_DATA . "' AND module = 'global' AND config_name = 'autologosize2'"); $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $autologosize3 . "' WHERE lang = '" . NV_LANG_DATA . "' AND module = 'global' AND config_name = 'autologosize3'"); $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $autologomod . "' WHERE lang = '" . NV_LANG_DATA . "' AND module = 'global' AND config_name = 'autologomod'"); $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $upload_logo_pos . "' WHERE lang = '" . NV_LANG_DATA . "' AND module = 'global' AND config_name = 'upload_logo_pos'"); $nv_Cache->delAll(); Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&rand=' . nv_genpass()); die; } $page_title = $lang_module['configlogo']; if (!empty($global_config['upload_logo']) and !nv_is_url($global_config['upload_logo']) and file_exists(NV_ROOTDIR . '/' . $global_config['upload_logo'])) { $upload_logo = NV_BASE_SITEURL . $global_config['upload_logo']; } else { $upload_logo = ''; } $array_autologosize = array('upload_logo' => $upload_logo, 'autologosize1' => $global_config['autologosize1'], 'autologosize2' => $global_config['autologosize2'], 'autologosize3' => $global_config['autologosize3']); $xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('ADMIN_THEME', $global_config['module_theme']); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('LANG', $lang_module); $xtpl->assign('OP', $op); $xtpl->assign('AUTOLOGOSIZE', $array_autologosize); $a = 0;
if (!empty($savecat)) { $sourceid = $nv_Request->get_int('sourceid', 'post', 0); $title = $nv_Request->get_title('title', 'post', '', 1); $link = strtolower($nv_Request->get_title('link', 'post', '')); $url_info = @parse_url($link); if (isset($url_info['scheme']) and isset($url_info['host'])) { $link = $url_info['scheme'] . '://' . $url_info['host']; } else { $link = ''; } $logo_old = $db->query('SELECT logo FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources WHERE sourceid =' . $sourceid)->fetchColumn(); $logo = $nv_Request->get_title('logo', 'post', ''); if (!nv_is_url($logo) and file_exists(NV_DOCUMENT_ROOT . $logo)) { $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/source/'); $logo = substr($logo, $lu); } elseif (!nv_is_url($logo)) { $logo = $logo_old; } if ($logo != $logo_old and !empty($logo_old)) { $_count = $db->query('SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources WHERE sourceid != ' . $sourceid . ' AND logo =' . $db->quote(basename($logo_old)))->fetchColumn(); if (empty($_count)) { @unlink(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/source/' . $logo_old); @unlink(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_upload . '/source/' . $logo_old); $_did = $db->query('SELECT did FROM ' . NV_UPLOAD_GLOBALTABLE . '_dir WHERE dirname=' . $db->quote(dirname(NV_UPLOADS_DIR . '/' . $module_upload . '/source/' . $logo_old)))->fetchColumn(); $db->query('DELETE FROM ' . NV_UPLOAD_GLOBALTABLE . '_file WHERE did = ' . $_did . ' AND title=' . $db->quote(basename($logo_old))); } } if (empty($title)) { $error = $lang_module['error_name']; } elseif ($sourceid == 0) { $weight = $db->query('SELECT max(weight) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources')->fetchColumn();
if ($page > 1) { $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page; } } } else { $array_cat = array(); $key = 0; $query_cat = $db->sql_query("SELECT `bid`, `number`, `title`, `alias` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block_cat` ORDER BY `weight` ASC"); while (list($bid, $numberlink, $btitle, $balias) = $db->sql_fetchrow($query_cat, 1)) { $array_cat[$key] = array('catid' => $bid, 'alias' => '', 'subcatid' => '', 'title' => $btitle, 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=groups/" . $balias); $query = $db->sql_query("SELECT t1.id, t1.catid, t1.admin_id, t1.author, t1.sourceid, t1.addtime, t1.edittime, t1.publtime, t1.title, t1.alias, t1.hometext, t1.homeimgfile, t1.homeimgalt, t1.homeimgthumb, t1.allowed_rating, t1.hitstotal, t1.hitscm, t1.total_rating, t1.click_rating, t1.keywords FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` as t1 INNER JOIN `" . NV_PREFIXLANG . "_" . $module_data . "_block` AS t2 ON t1.id = t2.id WHERE t2.bid= " . $bid . " AND t1.status= 1 ORDER BY t2.weight ASC LIMIT 0," . $numberlink); while ($item = $db->sql_fetch_assoc($query)) { $array_img = !empty($item['homeimgthumb']) ? explode("|", $item['homeimgthumb']) : ($array_img = array("", "")); if ($array_img[0] != "" and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/' . $array_img[0])) { $item['imghome'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_name . '/' . $array_img[0]; } elseif (nv_is_url($item['homeimgfile'])) { $item['imghome'] = $item['homeimgfile']; } elseif ($item['homeimgfile'] != "" and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $item['homeimgfile'])) { $item['imghome'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $item['homeimgfile']; } else { $item['imghome'] = ""; } $item['alt'] = !empty($item['homeimgalt']) ? $item['homeimgalt'] : $item['title']; $item['width'] = $module_config[$module_name]['homewidth']; $item['link'] = $global_array_cat[$item['catid']]['link'] . "/" . $item['alias'] . "-" . $item['id']; $array_cat[$key]['content'][] = $item; } ++$key; } $viewcat = $module_config[$module_name]['indexfile']; if ($viewcat != "viewcat_main_left" and $viewcat != "viewcat_main_bottom") {
// Xac dinh media if ($row['mediatype'] == 0) { $row['mediavalue'] = $row['images']; } if (!empty($row['mediavalue'])) { if (is_file(NV_UPLOADS_REAL_DIR . '/' . $module_name . $row['mediavalue'])) { $row['mediavalue'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . $row['mediavalue']; } elseif (!nv_is_url($row['mediavalue'])) { $row['mediavalue'] = ''; } } // Xac dinh images if (!empty($row['images'])) { if (is_file(NV_UPLOADS_REAL_DIR . '/' . $module_name . $row['images'])) { $row['images'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . $row['images']; } elseif (!nv_is_url($row['images'])) { $row['images'] = ''; } } // Đánh dấu fullpage if (!empty($row['fullpage'])) { $table = ceil($row['id'] / 4000); $array_table_pass[$table][$row['id']] = $row['id']; unset($table); } $array[$row['id']] = $row; $array_userids[$row['postid']] = $row['postid']; } // Khong cho dat $page tuy y if ($page > 1 and empty($array)) { header('Location:' . nv_url_rewrite(NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name, true));
$theme_array[] = $theme; } elseif (in_array($theme, $mobile_theme_array_file)) { $mobile_theme_array[] = $theme; } } $global_config['switch_mobi_des'] = !empty($global_config['switch_mobi_des']) ? ' checked="checked"' : ''; $site_logo = ''; if (!empty($global_config['site_logo']) and $global_config['site_logo'] != NV_ASSETS_DIR . '/images/logo.png' and !nv_is_url($global_config['site_logo']) and file_exists(NV_ROOTDIR . '/' . $global_config['site_logo'])) { $site_logo = NV_BASE_SITEURL . $global_config['site_logo']; } $site_banner = ''; if (!empty($global_config['site_banner']) and !nv_is_url($global_config['site_banner']) and file_exists(NV_ROOTDIR . '/' . $global_config['site_banner'])) { $site_banner = NV_BASE_SITEURL . $global_config['site_banner']; } $site_favicon = ''; if (!empty($global_config['site_favicon']) and $global_config['site_favicon'] != NV_ASSETS_DIR . '/favicon.ico' and !nv_is_url($global_config['site_favicon']) and file_exists(NV_ROOTDIR . '/' . $global_config['site_favicon'])) { $site_favicon = NV_BASE_SITEURL . $global_config['site_favicon']; } $value_setting = array('sitename' => $global_config['site_name'], 'site_logo' => $site_logo, 'site_banner' => $site_banner, 'site_favicon' => $site_favicon, 'site_keywords' => $global_config['site_keywords'], 'description' => $global_config['site_description'], 'switch_mobi_des' => $global_config['switch_mobi_des']); if (defined('NV_EDITOR')) { require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php'; } $lang_module['browse_image'] = $lang_global['browse_image']; $xtpl = new XTemplate('main.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL); $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('OP', $op); $xtpl->assign('LANG', $lang_module); $xtpl->assign('VALUE', $value_setting);
$lang_module['add_playlist_cat'] = $lang_module['edit_playlist_cat']; } $xtpl = new XTemplate('user-playlist.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_SITEURL', NV_BASE_SITEURL); $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('OP', $op); $xtpl->assign('PLAYLIST_CAT_LIST', nv_show_playlist_cat_list()); $xtpl->assign('PLAYLIST_ID', $playlist_id); $xtpl->assign('title', $title); $xtpl->assign('alias', $alias); $xtpl->assign('keywords', $keywords); $xtpl->assign('image', $image); if (nv_is_url($image)) { $xtpl->assign('disabled', ''); } else { $xtpl->assign('disabled', 'disabled="disabled"'); } $xtpl->assign('description', nv_htmlspecialchars(nv_br2nl($description))); foreach ($array_share_mode as $key => $val) { $xtpl->assign('PRIVATE_MODE', array('key' => $key, 'title' => $val, 'selected' => $key == $private_mode ? ' selected="selected"' : '')); $xtpl->parse('main.edit_playlist.private_mode'); } if (!empty($error)) { $xtpl->assign('ERROR', $error); $xtpl->parse('main.error'); } if (empty($alias)) { $xtpl->parse('main.getalias');
$publ_date = ""; } if (!empty($exp_date) and !preg_match("/^([0-9]{1,2})\\.([0-9]{1,2})\\.([0-9]{4})\$/", $exp_date)) { $exp_date = ""; } if (!empty($clid) and !isset($clients[$clid])) { $clid = 0; } if ($click_url == "http://") { $click_url = ""; } if (empty($title)) { $error = $lang_module['title_empty']; } elseif (empty($pid) or !isset($plans[$pid])) { $error = $lang_module['plan_not_selected']; } elseif (!empty($click_url) and !nv_is_url($click_url)) { $error = $lang_module['click_url_invalid']; } else { if (isset($_FILES['banner']) and is_uploaded_file($_FILES['banner']['tmp_name'])) { require_once NV_ROOTDIR . "/includes/class/upload.class.php"; $upload = new upload($contents['file_allowed_ext'], $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT); $upload_info = $upload->save_file($_FILES['banner'], NV_UPLOADS_REAL_DIR . '/' . NV_BANNER_DIR, false); @unlink($_FILES['banner']['tmp_name']); if (!empty($upload_info['error'])) { $error = $upload_info['error']; } else { @chmod($upload_info['name'], 0644); if (!empty($file_name) and is_file(NV_ROOTDIR . '/' . $file_name)) { @nv_deletefile(NV_ROOTDIR . '/' . $file_name); } $file_name = $upload_info['basename'];
function nv_filters($urlink, $urlimages, $tieude, $linktd, $tomtat, $hinhanh, $chitiet, $thoigian, $e) { global $folder, $module, $module_name, $module_config, $global_config; $title = $e->find($tieude, 0)->innertext; $title = trim(nv_unhtmlspecialchars(strip_tags($title))); $link = $urlink . $e->find($linktd, 0)->href; $alias = change_alias($title); if ($e->find($tomtat, 0)) { $hometext = $e->find($tomtat, 0)->innertext; $hometext = trim($hometext); } else { $hometext = ''; } $getContent = new UrlGetContents($global_config); $link_t = $getContent->get($link); $html = str_get_html($link_t); $date = $html->find($thoigian, 0)->plaintext; $number = preg_replace("/[^0-9]/", "", $date); $image = array(); $homeimgthumb = ""; if ($html->find($chitiet, 0)->find('img')) { foreach ($html->find($chitiet, 0)->find('img') as $img) { if (!nv_is_url($img)) { $abc = $img->src = $urlimages . $img->src; } else { $abc = $img->src; } $image[] = $abc; if ($module_config[$module_name]['load_image'] == 1) { $images = filter_images($folder, $abc); $img->src = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module . "/" . $images; } } } if ($html->find($chitiet, 0)->find('a')) { foreach ($html->find($chitiet, 0)->find('a') as $href) { if (substr($href->href, 0, 1) == "/") { $href->href = $urlink . $href->href; } } } if ($image) { $homeimg = filter_images($folder, $image[0]); $homeimgfile = NV_UPLOADS_REAL_DIR . "/" . $module . "/" . $homeimg; if (file_exists($homeimgfile)) { require_once NV_ROOTDIR . "/includes/class/image.class.php"; $basename = basename($homeimgfile); $image = new image($homeimgfile, NV_MAX_WIDTH, NV_MAX_HEIGHT); $thumb_basename = $basename; $i = 1; while (file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/thumb/' . $thumb_basename)) { $thumb_basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', '\\1_' . $i . '\\2', $basename); ++$i; } $image->resizeXY($module_config[$module]['homewidth'], $module_config[$module]['homeheight']); $image->save(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/thumb', $thumb_basename); $image_info = $image->create_Image_info; $thumb_name = str_replace(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/', '', $image_info['src']); $block_basename = $basename; $i = 1; while (file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/block/' . $block_basename)) { $block_basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', '\\1_' . $i . '\\2', $basename); ++$i; } $image->resizeXY($module_config[$module]['blockwidth'], $module_config[$module]['blockheight']); $image->save(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/block', $block_basename); $image_info = $image->create_Image_info; $block_name = str_replace(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/', '', $image_info['src']); $image->close(); $homeimgthumb = $thumb_name . "|" . $block_name; } } else { if ($e->find($hinhanh, 0)) { $homeimg1 = $e->find($hinhanh, 0)->src; if (nv_is_url($homeimg1)) { $home_img = $urlimages . $homeimg1; } else { $home_img = $homeimg1; } if ($module_config[$module_name]['load_image'] == 1) { $homeimg = filter_images($folder, $home_img); } else { $homeimg = $home_img; } } else { $homeimg = ""; } } $bodyhtml = $html->find($chitiet, 0)->innertext; $html->clear(); unset($html); $bodyhtml = nv_unhtmlspecialchars($bodyhtml); $content = array($title, $link, $alias, $hometext, $homeimg, $homeimgthumb, $number, $bodyhtml); return $content; }