* @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 31/05/2010, 00:36 */ if (!defined('NV_SYSTEM') and !defined('NV_ADMIN') or !defined('NV_MAINFILE')) { die('Stop!!!'); } unset($lang_module, $language_array, $nv_parse_ini_timezone, $countries, $module_info, $site_mods); global $db, $nv_Request, $nv_plugin_area; $contents = ob_get_contents(); ob_end_clean(); $contents = nv_url_rewrite($contents); if (!defined('NV_IS_AJAX')) { $contents = nv_change_buffer($contents); if (defined('NV_IS_SPADMIN')) { $contents = str_replace('[MEMORY_TIME_USAGE]', sprintf($lang_global['memory_time_usage'], nv_convertfromBytes(memory_get_usage()), number_format(microtime(true) - NV_START_TIME, 3, '.', '')), $contents); } } if (isset($nv_plugin_area[3])) { // Kết nối với các plugin Trước khi website gửi nội dung tới trình duyệt foreach ($nv_plugin_area[3] as $_fplugin) { include NV_ROOTDIR . '/includes/plugin/' . $_fplugin; } } $db = null; unset($lang_global, $global_config, $client_info); //Nen trang if (defined('NV_IS_GZIP')) { $http_accept_encoding = $nv_Request->get_string('HTTP_ACCEPT_ENCODING', 'server', ''); if (!empty($http_accept_encoding)) { $compress_list = array();
function nv_show_tab() { global $db, $db_config, $module_name, $page_title, $lang_global, $lang_module, $nv_Request; $tab = filter_text_input('tab', 'get'); $result = $db->sql_query("SHOW TABLE STATUS WHERE `Name`=" . $db->dbescape($tab)); $item = $db->sql_fetch_assoc($result); $db->sql_freeresult($result); if (empty($item)) { Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name); die; } if (in_array(filter_text_input('show_highlight', 'post'), array('php', 'sql'))) { $content = nv_highlight_string($tab, filter_text_input('show_highlight', 'post')); include NV_ROOTDIR . "/includes/header.php"; echo $content; include NV_ROOTDIR . "/includes/footer.php"; } $tablename = substr($item['Name'], strlen($db_config['prefix']) + 1); $contents = array(); $contents['table']['caption'] = sprintf($lang_module['table_caption'], $tablename); $contents['table']['info']['name'] = array($lang_module['table_name'], $tablename); $contents['table']['info']['engine'] = array($lang_module['table_type'], isset($item['Engine']) ? $item['Engine'] : $item['Type']); $contents['table']['info']['row_format'] = array($lang_module['row_format'], $item['Row_format']); $contents['table']['info']['data_length'] = array($lang_module['table_size'], nv_convertfromBytes(intval($item['Data_length']) + intval($item['Index_length']))); $contents['table']['info']['max_data_length'] = array($lang_module['table_max_size'], !empty($item['Max_data_length']) ? nv_convertfromBytes(floatval($item['Max_data_length'])) : 'n/a'); $contents['table']['info']['data_free'] = array($lang_module['table_datafree'], !empty($item['Data_free']) ? nv_convertfromBytes(intval($item['Data_free'])) : 0); $contents['table']['info']['rows'] = array($lang_module['table_numrow'], $item['Rows']); $contents['table']['info']['auto_increment'] = array($lang_module['table_auto_increment'], isset($item['Auto_increment']) ? intval($item['Auto_increment']) : "n/a"); $contents['table']['info']['create_time'] = array($lang_module['table_create_time'], !empty($item['Create_time']) ? strftime("%H:%M:%S %d/%m/%Y", strtotime($item['Create_time'])) : "n/a"); $contents['table']['info']['update_time'] = array($lang_module['table_update_time'], !empty($item['Update_time']) ? strftime("%H:%M:%S %d/%m/%Y", strtotime($item['Update_time'])) : "n/a"); $contents['table']['info']['check_time'] = array($lang_module['table_check_time'], !empty($item['Check_time']) ? strftime("%H:%M:%S %d/%m/%Y", strtotime($item['Check_time'])) : "n/a"); $contents['table']['info']['collation'] = array($lang_module['table_charset'], !empty($item['Collation']) && preg_match("/^([a-z0-9]+)_/i", $item['Collation'], $m) ? $m[1] : ""); $contents['table']['show'] = nv_highlight_string($tab, "php"); $contents['table']['show_lang'] = array($lang_module['php_code'], $lang_module['sql_code']); $contents['table']['row']['caption'] = sprintf($lang_module['table_row_caption'], $tablename); $contents['table']['row']['columns'] = array($lang_module['field_name'], $lang_module['field_type'], $lang_module['field_null'], $lang_module['field_key'], $lang_module['field_default'], $lang_module['field_extra']); $contents['table']['row']['detail'] = array(); $result = $db->sql_query("SHOW COLUMNS FROM `" . $tab . "`"); while ($row = $db->sql_fetch_assoc($result)) { $row['Null'] = $row['Null'] == "NO" ? "NOT NULL" : "NULL"; $row['Key'] = empty($row['Key']) ? "" : ($row['Key'] == 'PRI' ? "PRIMARY KEY" : ($row['Key'] == 'UNI' ? "UNIQUE KEY" : "KEY")); $contents['table']['row']['detail'][] = $row; } $db->sql_freeresult($result); $contents = call_user_func("nv_show_tab_theme", $contents); $page_title = sprintf($lang_module['nv_show_tab'], $tablename); include NV_ROOTDIR . "/includes/header.php"; echo nv_admin_theme($contents); include NV_ROOTDIR . "/includes/footer.php"; }
$xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); $array_content = $array_time = array(); $files = scandir($log_dir); foreach ($files as $file) { if (preg_match("/^([a-zA-Z0-9]+)\\_([a-zA-Z0-9\\-\\_]+)\\.(sql|sql\\.gz)+\$/", $file, $mc)) { $filesize = filesize($log_dir . '/' . $file); $filetime = intval(filemtime($log_dir . '/' . $file)); $array_time[] = $filetime; $array_content[$filetime] = array("file" => $file, 'mc' => $mc, "filesize" => $filesize); } } sort($array_time); $a = 0; $count = sizeof($array_time) - 1; for ($index = $count; $index >= 0; --$index) { $filetime = $array_time[$index]; $value = $array_content[$filetime]; $file = $value['file']; $mc = $value['mc']; $link_getfile = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=getfile&filename=" . $file . "&checkss=" . md5($file . $client_info['session_id'] . $global_config['sitekey']); $link_delete = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=delfile&filename=" . $file . "&checkss=" . md5($file . $client_info['session_id'] . $global_config['sitekey']); $xtpl->assign('ROW', array('class' => ++$a % 2 == 0 ? "" : " class=\"second\"", 'stt' => $a, 'name' => $mc[2] . "." . $mc[3], 'filesize' => nv_convertfromBytes($value['filesize']), 'filetime' => nv_date("l d-m-Y h:i:s A", $filetime), 'link_getfile' => $link_getfile, 'link_delete' => $link_delete)); $xtpl->parse('main.loop'); } $page_title = $lang_module['file_backup']; $xtpl->parse('main'); $contents = $xtpl->text('main'); include NV_ROOTDIR . "/includes/header.php"; echo nv_admin_theme($contents); include NV_ROOTDIR . "/includes/footer.php";
$contents['tables'][] = $item[0]; } $res->closeCursor(); $contents['type'] = 'all'; include NV_ROOTDIR . '/includes/core/dump.php'; $dump = nv_dump_save($contents); // Ghi log $NvUpdate->log($nv_update_config, $lang_module['update_dump'] . ' ' . $contents['savetype'], $dump); if ($dump == false) { die($lang_module['update_dump_error']); } else { $file = str_replace(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/dump_backup/', '', $dump[0]); // Danh dau da sao luu CSDL $nv_update_config['updatelog']['data_backuped'] = NV_CURRENTTIME; $NvUpdate->set_data_log($nv_update_config['updatelog']); die($lang_module['update_dump_ok'] . ' ' . nv_convertfromBytes($dump[1]) . '<br /><a href="' . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=database&" . NV_OP_VARIABLE . "=getfile&filename=" . $file . "&checkss=" . md5($file . $client_info['session_id'] . $global_config['sitekey']) . '" title="' . $lang_module['update_dump_download'] . '">' . $lang_module['update_dump_download'] . '</a>'); } } else { die($lang_module['update_dump_exist']); } } // Download CODE thay doi if ($nv_Request->isset_request('downfile', 'get')) { $checksess = $nv_Request->get_title('checksess', 'get', ''); if ($checksess != md5($global_config['sitekey'] . session_id())) { die('Error!!!'); } $file = $nv_Request->get_title('downfile', 'get', ''); if (!file_exists(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/data_logs/' . $file)) { $NvUpdate->log($nv_update_config, $lang_module['update_log_dump_file_down'], false); die('Error Access!!!');
if (!empty($key)) { $keyword = '%' . addcslashes($key, '_%') . '%'; $sth->bindParam(':keyword1', $keyword, PDO::PARAM_STR); $sth->bindParam(':keyword2', $keyword, PDO::PARAM_STR); $sth->bindParam(':keyword3', $keyword, PDO::PARAM_STR); } $sth->execute(); while ($row = $sth->fetch()) { $cattitle = '<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '">' . $list_cats[$row['catid']]['title'] . '</a>'; $uploadtime = (int) $row['uploadtime']; if ($uploadtime >= $today) { $uploadtime = $lang_module['today'] . ', ' . date('H:i', $row['uploadtime']); } elseif ($uploadtime >= $yesterday) { $uploadtime = $lang_module['yesterday'] . ', ' . date('H:i', $row['uploadtime']); } else { $uploadtime = nv_date('d/m/Y H:i', $row['uploadtime']); } $array[$row['id']] = array('id' => $row['id'], 'title' => $row['title'], 'cattitle' => $cattitle, 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => $row['author_name'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : '', 'imagesrc' => !empty($row['fileimage']) ? NV_BASE_SITEURL . NV_FILES_DIR . $row['fileimage'] : '', 'view_hits' => $row['view_hits'], 'download_hits' => $row['download_hits'], 'more_link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'], 'edit_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&edit=1&id=' . $row['id'] : '', 'del_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name : ''); } $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page); $contents = theme_viewcat_list($array, $generate_page); if ($page > 1) { $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page; } } else { $contents = $lang_module['search_noresult']; } $key_words = $description = 'no'; include NV_ROOTDIR . '/includes/header.php'; echo nv_site_theme($contents); include NV_ROOTDIR . '/includes/footer.php';
} if (file_exists(NV_ROOTDIR . '/themes/' . $themename . '/images/' . $modulename . '/')) { $allowfolder[] = NV_ROOTDIR . '/themes/' . $themename . '/images/' . $modulename . '/'; } $file_src = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . 'theme_' . $themename . '_' . $modulename . '_' . md5(nv_genpass(10) . session_id()) . '.zip'; require_once NV_ROOTDIR . '/includes/class/pclzip.class.php'; $zip = new PclZip($file_src); $zip->create($allowfolder, PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR . '/themes'); $filesize = filesize($file_src); $file_name = basename($file_src); nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['autoinstall_method_packet_module'], 'file name : ' . $themename . '_' . $modulename . ".zip", $admin_info['userid']); $linkgetfile = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=getfile&mod=nv3_theme_" . $themename . "_" . $modulename . ".zip&checkss=" . md5($file_name . $client_info['session_id'] . $global_config['sitekey']) . "&filename=" . $file_name; $xtpl->assign('LINKGETFILE', $linkgetfile); $xtpl->assign('THEMENAME', $themename); $xtpl->assign('MODULENAME', $modulename); $xtpl->assign('FILESIZE', nv_convertfromBytes($filesize)); $xtpl->parse('complete'); $contents = $xtpl->text('complete'); } include NV_ROOTDIR . "/includes/header.php"; echo $contents; include NV_ROOTDIR . "/includes/footer.php"; } else { $op = $nv_Request->get_string(NV_OP_VARIABLE, 'get', ''); $theme_list = nv_scandir(NV_ROOTDIR . "/themes", array($global_config['check_theme'], $global_config['check_theme_mobile'])); foreach ($theme_list as $themes_i) { if (file_exists(NV_ROOTDIR . '/themes/' . $themes_i . '/config.ini')) { $xtpl->assign('THEME', $themes_i); $xtpl->parse('main.theme'); } }
$query = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($query); if ($all_page) { $array_item = array(); while ($row = $db->sql_fetchrow($result)) { $uploadtime = (int) $row['uploadtime']; if ($uploadtime >= $today) { $uploadtime = $lang_module['today'] . ", " . date("H:i", $row['uploadtime']); } elseif ($uploadtime >= $yesterday) { $uploadtime = $lang_module['yesterday'] . ", " . date("H:i", $row['uploadtime']); } else { $uploadtime = nv_date("d/m/Y H:i", $row['uploadtime']); } $img = substr($row['fileimage'], strlen(NV_BASE_SITEURL)); $imageinfo = nv_ImageInfo(NV_ROOTDIR . '/' . $img, 400, true, NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb'); $array_item[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => !empty($row['author_name']) ? $row['author_name'] : $lang_module['unknown'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : "", 'fileimage' => $imageinfo, 'view_hits' => (int) $row['view_hits'], 'download_hits' => (int) $row['download_hits'], 'more_link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list_cats[$row['catid']]['alias'] . "/" . $row['alias'], 'edit_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&edit=1&id=" . (int) $row['id'] : "", 'del_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name : ""); // if ($row['comment_allow']) { $array_item[$row['id']]['comment_hits'] = (int) $row['comment_hits']; } } $array_cats[$catid_i] = array(); $array_cats[$catid_i]['id'] = $value['id']; $array_cats[$catid_i]['title'] = $value['title']; $array_cats[$catid_i]['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $value['alias']; $array_cats[$catid_i]['description'] = $list_cats[$value['id']]['description']; $array_cats[$catid_i]['subcats'] = $list_cats[$value['id']]['subcats']; //$array_cats[$catid_i]['image'] = $list_cats[$value['id']]['image']; $array_cats[$catid_i]['items'] = $array_item; } }
$xtpl->assign('GLANG', $lang_global); $array_content = $array_time = array(); $files = scandir($log_dir); foreach ($files as $file) { if (preg_match('/^([a-zA-Z0-9]+)\\_([a-zA-Z0-9\\-\\_]+)\\.(sql|sql\\.gz)+$/', $file, $mc)) { $filesize = filesize($log_dir . '/' . $file); $filetime = intval(filemtime($log_dir . '/' . $file)); $array_time[] = $filetime; $array_content[$filetime] = array('file' => $file, 'mc' => $mc, 'filesize' => $filesize); } } sort($array_time); $a = 0; $count = sizeof($array_time) - 1; for ($index = $count; $index >= 0; --$index) { $filetime = $array_time[$index]; $value = $array_content[$filetime]; $file = $value['file']; $mc = $value['mc']; $link_getfile = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=getfile&filename=' . $file . '&checkss=' . md5($file . $client_info['session_id'] . $global_config['sitekey']); $link_delete = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=delfile&filename=' . $file . '&checkss=' . md5($file . $client_info['session_id'] . $global_config['sitekey']); $xtpl->assign('ROW', array('stt' => ++$a, 'name' => $mc[2] . '.' . $mc[3], 'filesize' => nv_convertfromBytes($value['filesize']), 'filetime' => nv_date('l d/m/Y h:i:s A', $filetime), 'link_getfile' => $link_getfile, 'link_delete' => $link_delete)); $xtpl->parse('main.loop'); } $xtpl->assign('BACKUPNOW', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=download&checkss=' . md5($client_info['session_id'] . $global_config['sitekey'])); $page_title = $lang_module['file_backup']; $xtpl->parse('main'); $contents = $xtpl->text('main'); include NV_ROOTDIR . '/includes/header.php'; echo nv_admin_theme($contents); include NV_ROOTDIR . '/includes/footer.php';
/** * nv_avatar() * * @param mixed $array * @return void */ function nv_avatar($array) { global $module_info, $module_file, $module_name, $lang_module, $lang_global, $global_config; $xtpl = new XTemplate('avatar.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $global_config['module_theme']); $xtpl->assign('MODULE_FILE', $module_file); $xtpl->assign('NV_AVATAR_WIDTH', $global_config['avatar_width']); $xtpl->assign('NV_AVATAR_HEIGHT', $global_config['avatar_height']); $xtpl->assign('NV_MAX_WIDTH', NV_MAX_WIDTH); $xtpl->assign('NV_MAX_HEIGHT', NV_MAX_HEIGHT); $xtpl->assign('NV_UPLOAD_MAX_FILESIZE', NV_UPLOAD_MAX_FILESIZE); $form_action = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=avatar'; if (!empty($array['u'])) { $form_action .= '/' . $array['u']; } $xtpl->assign('NV_AVATAR_UPLOAD', $form_action); $lang_module['avatar_bigfile'] = sprintf($lang_module['avatar_bigfile'], nv_convertfromBytes(NV_UPLOAD_MAX_FILESIZE)); $lang_module['avatar_bigsize'] = sprintf($lang_module['avatar_bigsize'], NV_MAX_WIDTH, NV_MAX_HEIGHT); $lang_module['avatar_smallsize'] = sprintf($lang_module['avatar_smallsize'], $global_config['avatar_width'], $global_config['avatar_height']); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); if ($array['error']) { $xtpl->assign('ERROR', $array['error']); $xtpl->parse('main.error'); } if ($array['success'] == 1) { $xtpl->assign('FILENAME', $array['filename']); $xtpl->parse('main.complete'); } elseif ($array['success'] == 2) { $xtpl->parse('main.complete2'); } elseif ($array['success'] == 3) { $xtpl->assign('FILENAME', $array['filename']); $xtpl->parse('main.complete3'); } else { $xtpl->parse('main.init'); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_avatar() * * @param mixed $array * @return void */ function nv_avatar($array) { global $module_info, $module_file, $module_name, $lang_module, $global_config, $my_head; // Include JS and CSS $my_head .= "<script src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.Jcrop.min.js\" type=\"text/javascript\"></script>" . NV_EOL; $my_head .= "<link href=\"" . NV_BASE_SITEURL . "js/jquery/jquery.Jcrop.min.css\" rel=\"stylesheet\" type=\"text/css\" />" . NV_EOL; $xtpl = new XTemplate('avatar.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $global_config['module_theme']); $xtpl->assign('MODULE_FILE', $module_file); $xtpl->assign('NV_AVATAR_WIDTH', $global_config['avatar_width']); $xtpl->assign('NV_AVATAR_HEIGHT', $global_config['avatar_height']); $xtpl->assign('NV_MAX_WIDTH', NV_MAX_WIDTH); $xtpl->assign('NV_MAX_HEIGHT', NV_MAX_HEIGHT); $xtpl->assign('NV_UPLOAD_MAX_FILESIZE', NV_UPLOAD_MAX_FILESIZE); $xtpl->assign('NV_AVATAR_UPLOAD', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=avatar'); $lang_module['avata_bigfile'] = sprintf($lang_module['avata_bigfile'], nv_convertfromBytes(NV_UPLOAD_MAX_FILESIZE)); $lang_module['avata_bigsize'] = sprintf($lang_module['avata_bigsize'], NV_MAX_WIDTH, NV_MAX_HEIGHT); $lang_module['avata_smallsize'] = sprintf($lang_module['avata_smallsize'], $global_config['avatar_width'], $global_config['avatar_height']); $xtpl->assign('LANG', $lang_module); if ($array['error']) { $xtpl->assign('ERROR', $array['error']); $xtpl->parse('main.error'); } if (!$array['success']) { $xtpl->parse('main.init'); } else { $xtpl->assign('FILENAME', $array['filename']); $xtpl->parse('main.complete'); } $xtpl->parse('main'); return $xtpl->text('main'); }
$where = join(" OR ", $where_conditions); } $sql1 = "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE " . $where . $allcat . " AND `status`=1"; $sql2 = "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE " . $where . $allcat . " AND `status`=1 ORDER BY `uploadtime` DESC LIMIT " . $page . ", " . $per_page; } else { $sql1 = "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `status`=1"; $sql2 = "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `status`=1 ORDER BY `uploadtime` DESC LIMIT " . $page . ", " . $per_page; } $result = $db->sql_query($sql1); list($all_page) = $db->sql_fetchrow($result); if (!empty($all_page)) { $result = $db->sql_query($sql2); $imageinfo = array(); while ($row = $db->sql_fetchrow($result)) { list($catalias) = $db->sql_fetchrow($db->sql_query("SELECT alias FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE id=" . $row['catid'] . "")); $row['filesize'] = !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : ""; $row['view_hits'] = (int) $row['view_hits']; $row['download_hits'] = (int) $row['download_hits']; $row['more_link'] = NV_BASE_SITEURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $catalias . '/' . $row['alias']; $xtpl->assign('ROW', $row); $imageinfo['src'] = $row['fileimage']; if (!empty($row['fileimage'])) { $xtpl->assign('FILEIMAGE', $imageinfo); $xtpl->parse('main.row.is_image'); } $xtpl->parse('main.row'); } $generate_page = nv_generate_page($base_url, $all_page, $per_page, $page); if (!empty($generate_page)) { $xtpl->assign('GENERATE_PAGE', $generate_page); $xtpl->parse('main.generate_page');
$contents .= "<tr>"; $contents .= "<td align=\"right\"><strong>" . $lang_module['nv_max_size'] . ": </strong></td>\n"; $contents .= "<td>"; $contents .= "<select name=\"nv_max_size\">\n"; $sys_max_size = min(nv_converttoBytes(ini_get('upload_max_filesize')), nv_converttoBytes(ini_get('post_max_size'))); $p_size = $sys_max_size / 100; for ($index = 100; $index > 0; $index--) { $size = floor($index * $p_size); $sl = ""; if ($size == $global_config['nv_max_size']) { $sl = " selected=\"selected\""; } $contents .= "<option value=\"" . $size . "\" " . $sl . ">" . nv_convertfromBytes($size) . "</option>\n"; } $contents .= "</select> \n"; $contents .= " (" . $lang_module['sys_max_size'] . ": " . nv_convertfromBytes($sys_max_size) . ")"; $contents .= "</td>"; $contents .= "</tr>"; $contents .= "</tbody>"; $contents .= "<tbody>\n"; $contents .= "<tr>\n"; $contents .= "<td colspan='2' style='text-align:center'>"; $contents .= "<input type='submit' value='" . $lang_module['banip_confirm'] . "' name='submit'/>\n"; $contents .= "</td>\n"; $contents .= "</tr>\n"; $contents .= "</tbody>\n"; $contents .= "</table>\n"; $contents .= "</form>\n"; include NV_ROOTDIR . "/includes/header.php"; echo nv_admin_theme($contents); include NV_ROOTDIR . "/includes/footer.php";
} if ($type != 'image' and $type != 'flash') { $type = 'file'; } $xtpl = new XTemplate('main.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); if ($popup) { $lang_module['browse_file'] = $lang_global['browse_file']; $sys_max_size = min($global_config['nv_max_size'], nv_converttoBytes(ini_get('upload_max_filesize')), nv_converttoBytes(ini_get('post_max_size'))); $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('NV_LANG_INTERFACE', NV_LANG_INTERFACE); $xtpl->assign('LANG', $lang_module); $xtpl->assign('NV_MAX_SIZE', nv_convertfromBytes($sys_max_size)); $xtpl->assign('NV_MAX_SIZE_BYTES', $sys_max_size); $xtpl->assign('NV_MAX_WIDTH', NV_MAX_WIDTH); $xtpl->assign('NV_MAX_HEIGHT', NV_MAX_HEIGHT); $xtpl->assign('NV_MIN_WIDTH', 10); $xtpl->assign('NV_MIN_HEIGHT', 10); $xtpl->assign('CURRENTPATH', $currentpath); $xtpl->assign('PATH', $path); $xtpl->assign('TYPE', $type); $xtpl->assign('AREA', $area); $xtpl->assign('ALT', $alt); $xtpl->assign('FUNNUM', $nv_Request->get_int('CKEditorFuncNum', 'get', 0)); $sfile = $type == 'file' ? ' selected="selected"' : ''; $simage = $type == 'image' ? ' selected="selected"' : ''; $sflash = $type == 'flash' ? ' selected="selected"' : ''; $xtpl->assign('SFLASH', $sflash);
$sel = ''; $selid = ''; } $arr_temp = explode('.', $imglist[$i]); $ext = strtolower(end($arr_temp)); echo '<td style="width:170px; padding-bottom:10px; text-align:center;"><div style="width:150px" ' . $selid . '>'; if (in_array($ext, $array_images)) { echo '<img class="previewimg" title="' . $imglist[$i] . '" src="' . NV_BASE_SITEURL . $pathimg . '/' . $imglist[$i] . '" style="padding:5px' . $sel . '" width="100" height="100"/><br />'; } elseif (in_array($ext, $array_archives)) { echo '<img class="previewimg" title="' . $imglist[$i] . '" src="' . NV_BASE_SITEURL . 'images/zip.gif" style="padding:5px' . $sel . '" width="32" height="32"/><br />'; } elseif (in_array($ext, $array_documents)) { echo '<img class="previewimg" title="' . $imglist[$i] . '" src="' . NV_BASE_SITEURL . 'images/doc.gif" style="padding:5px' . $sel . '" width="32" height="32"/><br />'; } else { echo '<img class="previewimg" title="' . $imglist[$i] . '" src="' . NV_BASE_SITEURL . 'images/file.gif" style="padding:5px' . $sel . '" width="32" height="32"/><br />'; } $filesize = nv_convertfromBytes(@filesize(NV_ROOTDIR . '/' . $pathimg . '/' . $imglist[$i])); //$filetime = date( "d-m-Y H:i:s", filemtime( NV_ROOTDIR . '/' . $pathimg . '/' . $imglist[$i] ) ); echo '</div><div style="width:150px;overflow:hidden;font-size:12px;font-family:tahoma;">' . $imglist[$i] . '<br/>'; //echo $filetime.'<br/>'; echo $filesize . '</div>'; echo '</td>'; if (($i + 1) % 4 == 0 && $i != 0) { echo '</tr><tr>'; } } echo '</table>'; echo ' <script type="text/javascript" src="' . NV_BASE_SITEURL . 'js/jquery/jquery.min.js"></script> <link rel="StyleSheet" href="' . NV_BASE_SITEURL . 'themes/' . $global_config['admin_theme'] . '/css/admin.css" type="text/css" /> <link type="text/css" href="' . NV_BASE_SITEURL . 'js/ui/jquery.ui.all.css" rel="stylesheet" /> <script type="text/javascript" src="' . NV_BASE_SITEURL . 'js/ui/jquery-ui-1.8.2.custom.js"></script>
$results = nv_filesList($pathimg, $refresh); if (!empty($results)) { $xtpl = new XTemplate("listimg.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign("NV_BASE_SITEURL", NV_BASE_SITEURL); $author = $author === true ? $admin_info['userid'] : 0; foreach ($results as $title => $file) { if ($type == "file" or $type != "file" and $file[2] == $type) { if (!$author or $author == $file[8]) { $file = array_combine(array('name0', 'ext', 'type', 'filesize', 'src', 'srcWidth', 'srcHeight', 'name', 'author', 'mtime'), $file); $file['title'] = $title; if ($file['type'] == "image" or $file['ext'] == "swf") { $file['size'] = str_replace("|", " x ", $file['name']) . " pixels"; } else { $file['size'] = nv_convertfromBytes($file['filesize']); } $file['name'] .= "|" . $file['ext'] . "|" . $file['type'] . "|" . nv_convertfromBytes($file['filesize']) . "|" . $file['author'] . "|" . nv_date("l, d F Y, H:i:s P", $file['mtime']); $file['sel'] = $selectfile == $title ? " imgsel" : ""; $file['src'] = NV_BASE_SITEURL . $file['src'] . '?' . $file['mtime']; $xtpl->assign("IMG", $file); $xtpl->parse('main.loopimg'); } } } if (!empty($selectfile)) { $xtpl->assign("NV_CURRENTTIME", NV_CURRENTTIME); $xtpl->parse('main.imgsel'); } $xtpl->parse('main'); $contents = $xtpl->text('main'); include NV_ROOTDIR . "/includes/header.php"; echo $contents;
* @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-1-2010 21:47 */ if (!defined('NV_IS_FILE_DATABASE')) { die('Stop!!!'); } $tables = filter_text_input('tables', 'post'); if (empty($tables)) { $tables = array(); } else { $tables = explode(",", $tables); } $totalfree = 0; $tabs = array(); $result = $db->sql_query("SHOW TABLE STATUS LIKE '" . $db_config['prefix'] . "\\_%'"); while ($item = $db->sql_fetch_assoc($result)) { if (empty($tables) or !empty($tables) and in_array($item['Name'], $tables)) { $totalfree += $item['Data_free']; $tabs[] = substr($item['Name'], strlen($db_config['prefix']) + 1); $db->sql_query("LOCK TABLE " . $item['Name'] . " WRITE"); $db->sql_query("REPAIR TABLE " . $item['Name']); $db->sql_query("OPTIMIZE TABLE " . $item['Name']); $db->sql_query("UNLOCK TABLE " . $item['Name']); } } $db->sql_freeresult($result); $totalfree = !empty($totalfree) ? nv_convertfromBytes($totalfree) : 0; $content = sprintf($lang_module['optimize_result'], implode(", ", $tabs), $totalfree); include NV_ROOTDIR . "/includes/header.php"; echo $content; include NV_ROOTDIR . "/includes/footer.php";
for ($i = 2; $i <= 60; ++$i) { $xtpl->assign('PER_PAGE_PHOTO', array('key' => $i, 'title' => $i, 'selected' => $i == $module_config[$module_name]['per_page_photo'] ? ' selected="selected"' : '')); $xtpl->parse('main.per_page_photo'); } $array_structure_image = array(); $array_structure_image[''] = NV_UPLOADS_DIR . '/' . $module_upload; $array_structure_image['Y'] = NV_UPLOADS_DIR . '/' . $module_upload . '/' . date('Y'); $array_structure_image['Ym'] = NV_UPLOADS_DIR . '/' . $module_upload . '/' . date('Y_m'); $array_structure_image['Y_m'] = NV_UPLOADS_DIR . '/' . $module_upload . '/' . date('Y/m'); $array_structure_image['Ym_d'] = NV_UPLOADS_DIR . '/' . $module_upload . '/' . date('Y_m/d'); $array_structure_image['Y_m_d'] = NV_UPLOADS_DIR . '/' . $module_upload . '/' . date('Y/m/d'); $structure_image_upload = isset($module_config[$module_name]['structure_upload']) ? $module_config[$module_name]['structure_upload'] : "Ym"; // Thu muc uploads foreach ($array_structure_image as $type => $dir) { $xtpl->assign('STRUCTURE_UPLOAD', array('key' => $type, 'title' => $dir . '/' . $lang_module['setting_dir_album'], 'selected' => $type == $structure_image_upload ? ' selected="selected"' : '')); $xtpl->parse('main.structure_upload'); } $sys_max_size = min(nv_converttoBytes(ini_get('upload_max_filesize')), nv_converttoBytes(ini_get('post_max_size'))); $p_size = $sys_max_size / 100; $xtpl->assign('SYS_MAX_SIZE', nv_convertfromBytes($sys_max_size)); $data_maxupload = min(nv_converttoBytes(ini_get('upload_max_filesize')), nv_converttoBytes(ini_get('post_max_size')), $module_config[$module_name]['maxupload']); for ($index = 100; $index > 0; --$index) { $size1 = floor($index * $p_size); $xtpl->assign('SIZE1', array('key' => $size1, 'title' => nv_convertfromBytes($size1), 'selected' => $data_maxupload == $size1 ? ' selected=\'selected\'' : '')); $xtpl->parse('main.size1'); } $xtpl->parse('main'); $contents = $xtpl->text('main'); include NV_ROOTDIR . '/includes/header.php'; echo nv_admin_theme($contents); include NV_ROOTDIR . '/includes/footer.php';
$contents['tables'][] = $item[0]; } $res->closeCursor(); $contents['type'] = 'all'; include NV_ROOTDIR . '/includes/core/dump.php'; $dump = nv_dump_save($contents); // Ghi log $NvUpdate->log($nv_update_config, $lang_module['update_dump'] . ' ' . $contents['savetype'], $dump); if ($dump == false) { die($lang_module['update_dump_error']); } else { $file = str_replace(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/dump_backup/', '', $dump[0]); // Danh dau da sao luu CSDL $nv_update_config['updatelog']['data_backuped'] = NV_CURRENTTIME; $NvUpdate->set_data_log($nv_update_config['updatelog']); die($lang_module['update_dump_ok'] . ' ' . nv_convertfromBytes($dump[1]) . '<br /><a href="' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . "=database&" . NV_OP_VARIABLE . "=getfile&filename=" . $file . "&checkss=" . md5($file . NV_CHECK_SESSION) . '" title="' . $lang_module['update_dump_download'] . '">' . $lang_module['update_dump_download'] . '</a>'); } } else { die($lang_module['update_dump_exist']); } } // Download CODE thay doi if ($nv_Request->isset_request('downfile', 'get')) { $checksess = $nv_Request->get_title('checksess', 'get', ''); if ($checksess != NV_CHECK_SESSION) { die('Error!!!'); } $file = $nv_Request->get_title('downfile', 'get', ''); if (!file_exists(NV_ROOTDIR . '/' . NV_LOGS_DIR . '/data_logs/' . $file)) { $NvUpdate->log($nv_update_config, $lang_module['update_log_dump_file_down'], false); die('Error Access!!!');
$allowfolder = array(); $allowfolder[] = NV_ROOTDIR . '/themes/' . $themename . '/modules/' . $modulename . '/'; if (file_exists(NV_ROOTDIR . '/themes/' . $themename . '/css/' . $modulename . '.css')) { $allowfolder[] = NV_ROOTDIR . '/themes/' . $themename . '/css/' . $modulename . '.css'; } if (file_exists(NV_ROOTDIR . '/themes/' . $themename . '/images/' . $modulename . '/')) { $allowfolder[] = NV_ROOTDIR . '/themes/' . $themename . '/images/' . $modulename . '/'; } $file_src = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . 'theme_' . $themename . '_' . $modulename . '_' . md5(nv_genpass(10) . session_id()) . '.zip'; require_once NV_ROOTDIR . '/includes/class/pclzip.class.php'; $zip = new PclZip($file_src); $zip->create($allowfolder, PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR . '/themes'); $filesize = @filesize($file_src); $file_name = basename($file_src); $linkgetfile = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=getfile&mod=nv3_theme_" . $themename . "_" . $modulename . ".zip&checkss=" . md5($file_name . $client_info['session_id'] . $global_config['sitekey']) . "&filename=" . $file_name; echo '<a href="' . $linkgetfile . '"><span style="font-size:16px;color:red">nv3_theme_' . $themename . '_' . $modulename . ' - ' . nv_convertfromBytes($filesize) . '</span></a>'; } else { $op = $nv_Request->get_string('op', 'get'); $contents .= "<form name='install_theme' enctype='multipart/form-data' action=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "\" method=\"post\">"; $contents .= "<table summary=\"\" class=\"tab1\">\n"; $contents .= "<tbody class=\"second\">"; $contents .= "<tr>"; $contents .= "<td align=\"center\" colspan='2'><strong>" . $lang_module['autoinstall_package_module_select'] . ": </strong>\n"; $contents .= "<input type='hidden' name='" . NV_OP_VARIABLE . "' value='" . $op . "'/>"; $contents .= "<select name=\"themename\">\n"; $contents .= "<option value=\"0\">" . $lang_module['autoinstall_method_theme_none'] . "</option>\n"; $theme_list = nv_scandir(NV_ROOTDIR . "/themes/", $global_config['check_theme']); foreach ($theme_list as $value) { $contents .= "<option value=\"" . $value . "\">" . $value . "</option>\n"; } $contents .= "</select>\n";
$db->limit($per_page)->offset(($page - 1) * $per_page); $sth = $db->prepare($db->sql()); if ($check_like) { $keyword = '%' . addcslashes($q, '_%') . '%'; $sth->bindParam(':keyword1', $keyword, PDO::PARAM_STR); $sth->bindParam(':keyword2', $keyword, PDO::PARAM_STR); } $sth->execute(); while ($file = $sth->fetch()) { $file['data'] = $file['sizes']; if ($file['type'] == 'image' or $file['ext'] == 'swf') { $file['size'] = str_replace('|', ' x ', $file['sizes']) . ' pixels'; } else { $file['size'] = nv_convertfromBytes($file['filesize']); } $file['data'] .= '|' . $file['ext'] . '|' . $file['type'] . '|' . nv_convertfromBytes($file['filesize']) . '|' . $file['userid'] . '|' . nv_date('l, d F Y, H:i:s P', $file['mtime']) . '|'; $file['data'] .= empty($q) ? '' : $file['dirname']; $file['data'] .= '|' . $file['mtime']; $file['is_img'] = $file['type'] == 'image' ? 'true' : 'false'; $file['sel'] = in_array($file['title'], $selectfile) ? ' imgsel' : ''; $file['src'] = NV_BASE_SITEURL . $file['src'] . '?' . $file['mtime']; $file['nameLong'] = substr($file['title'], 0, 0 - strlen($file['ext']) - 1); if (strlen($file['nameLong']) >= 30) { $file['nameLong'] = substr($file['nameLong'], 0, 28) . '..'; } $file['nameLong'] = $file['nameLong'] . '.' . $file['ext']; $xtpl->assign('IMG', $file); $xtpl->parse('main.loopimg'); } if (!empty($selectfile)) { $xtpl->assign('NV_CURRENTTIME', NV_CURRENTTIME);
$array_config['groups_addfile'][$key] = array('key' => $key, 'title' => $title, 'checked' => in_array($key, $groups_addfile) ? ' checked="checked"' : ''); } } $groups_upload = explode(',', $array_config['groups_upload']); $array_config['groups_upload'] = array(); if (!empty($groups_list)) { foreach ($groups_list as $key => $title) { $array_config['groups_upload'][$key] = array('key' => $key, 'title' => $title, 'checked' => in_array($key, $groups_upload) ? ' checked="checked"' : ''); } } $array_config['maxfilesize'] = number_format($array_config['maxfilesize'] / 1048576, 2); $xtpl = new XTemplate('config.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file); $xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op); $xtpl->assign('LANG', $lang_module); $xtpl->assign('DATA', $array_config); $xtpl->assign('NV_UPLOAD_MAX_FILESIZE', nv_convertfromBytes(NV_UPLOAD_MAX_FILESIZE)); foreach ($array_config['groups_addfile'] as $group) { $xtpl->assign('GROUPS_ADDFILE', $group); $xtpl->parse('main.groups_addfile'); } foreach ($array_config['groups_upload'] as $group) { $xtpl->assign('GROUPS_UPLOAD', $group); $xtpl->parse('main.groups_upload'); } if ($array_config['indexfile'] != 'viewcat_list_new') { $xtpl->parse('main.display_viewlist_type'); } $array_indexfile = array('viewcat_main_bottom' => $lang_module['config_indexfile_main_bottom'], 'viewcat_list_new' => $lang_module['config_indexfile_list_new'], 'none' => $lang_module['config_indexfile_none']); foreach ($array_indexfile as $key => $value) { $sl = $array_config['indexfile'] == $key ? 'selected="selected"' : ''; $xtpl->assign('INDEXFILE', array('key' => $key, 'value' => $value, 'selected' => $sl));
$contents .= "<td>" . $lang_module['file_site'] . "</td>\n"; $contents .= "<td>" . $lang_module['file_time'] . "</td>\n"; $contents .= "<td></td>\n"; $contents .= "</tr>"; $contents .= "</thead>"; $a = 1; $files = scandir($log_dir); foreach ($files as $file) { unset($mc); $global_config['check_op_layout'] = "/^layout\\.([a-zA-Z0-9\\-\\_]+)\\.tpl\$/"; if (preg_match("/^([a-zA-Z0-9]+)\\_([a-zA-Z0-9\\-\\_]+)\\.(sql|sql\\.gz)+\$/", $file, $mc)) { $link_getfile = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=getfile&filename=" . $file . "&checkss=" . md5($file . $client_info['session_id'] . $global_config['sitekey']); $link_delete = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=delfile&filename=" . $file . "&checkss=" . md5($file . $client_info['session_id'] . $global_config['sitekey']); $filesize = filesize($log_dir . '/' . $file); $class = $a % 2 == 0 ? "" : " class=\"second\""; $contents .= "<tbody" . $class . ">"; $contents .= "<tr>\n"; $contents .= "<td align=\"center\">" . $a++ . "</td>\n"; $contents .= "<td>" . $mc[2] . "." . $mc[3] . "</td>\n"; $contents .= "<td align=\"right\">" . nv_convertfromBytes($filesize) . "</td>\n"; $contents .= "<td>" . nv_date("l d-m-Y h:i:s A", filemtime($log_dir . '/' . $file)) . "</td>\n"; $contents .= "<td align=\"center\">\r\n \t\t\t\t<span class=\"default_icon\"><a href=\"" . $link_getfile . "\">" . $lang_module['download'] . "</a></span>\r\n \t\t\t\t - \r\n \t\t\t\t<span class=\"delete_icon\"><a onclick=\"return confirm(nv_is_del_confirm[0]);\" href=\"" . $link_delete . "\">" . $lang_global['delete'] . "</a></span>\r\n \t\t\t\t</td>\n"; $contents .= "</tr>"; $contents .= "</tbody>"; } } $contents .= "</table>\n"; $page_title = $lang_module['file_backup']; include NV_ROOTDIR . "/includes/header.php"; echo nv_admin_theme($contents); include NV_ROOTDIR . "/includes/footer.php";
/** * upload::check_tmpfile() * * @param mixed $userfile * @return */ private function check_tmpfile($userfile, $no_check_size) { if (empty($userfile)) { return _ERROR_UPLOAD_NO_FILE; } if (!isset($userfile['name']) or empty($userfile['name'])) { return _ERROR_UPLOAD_NAMEEMPTY; } if (!isset($userfile['size']) or empty($userfile['size'])) { return _ERROR_UPLOAD_SIZEEMPTY; } if (!isset($userfile['tmp_name']) or empty($userfile['tmp_name']) or !file_exists($userfile['tmp_name'])) { return _ERROR_UPLOAD_SIZEEMPTY; } if (!isset($userfile['error']) or $userfile['error'] != UPLOAD_ERR_OK) { switch ($userfile['error']) { case UPLOAD_ERR_INI_SIZE: $er = _ERROR_UPLOAD_INI_SIZE; break; case UPLOAD_ERR_FORM_SIZE: $er = _ERROR_UPLOAD_FORM_SIZE; break; case UPLOAD_ERR_PARTIAL: $er = _ERROR_UPLOAD_PARTIAL; break; case UPLOAD_ERR_NO_FILE: $er = _ERROR_UPLOAD_NO_FILE; break; case UPLOAD_ERR_NO_TMP_DIR: $er = _ERROR_UPLOAD_NO_TMP_DIR; break; case UPLOAD_ERR_CANT_WRITE: $er = _ERROR_UPLOAD_CANT_WRITE; break; case UPLOAD_ERR_EXTENSION: $er = _ERROR_UPLOAD_EXTENSION; break; default: $er = _ERROR_UPLOAD_UNKNOWN; } return $er; } $extension = $this->getextension($userfile['name']); if (empty($extension) or !isset($this->config['allowed_files'][$extension])) { return _ERROR_UPLOAD_TYPE_NOT_ALLOWED; } $this->file_extension = $extension; $this->file_mime = $this->get_mime_type($userfile); if (empty($this->file_mime)) { return _ERROR_UPLOAD_MIME_NOT_RECOGNIZE; } if (!empty($this->config['maxsize']) and $userfile['size'] > $this->config['maxsize']) { if (!($no_check_size and preg_match('#image\\/[x\\-]*([a-z]+)#', $this->file_mime))) { return sprintf(_ERROR_UPLOAD_MAX_USER_SIZE, nv_convertfromBytes($this->config['maxsize'])); } } if (preg_match('#image\\/[x\\-]*([a-z]+)#', $this->file_mime) or preg_match('#application\\/[x\\-]*(shockwave\\-flash)#', $this->file_mime)) { $this->is_img = true; if (empty($this->img_info)) { $this->img_info = @getimagesize($userfile['tmp_name']); } if (empty($this->img_info) or !isset($this->img_info[0]) or empty($this->img_info[0]) or !isset($this->img_info[1]) or empty($this->img_info[1])) { return _ERROR_UPLOAD_NOT_IMAGE; } if (!$this->verify_image($userfile['tmp_name'])) { return _ERROR_UPLOAD_IMAGE_FAILED; } if (!($no_check_size and preg_match('#image\\/[x\\-]*([a-z]+)#', $this->file_mime))) { if (!empty($this->config['maxwidth']) and $this->img_info[0] > $this->config['maxwidth']) { return sprintf(_ERROR_UPLOAD_IMAGE_WIDTH, $this->config['maxwidth']); } if (!empty($this->config['maxheight']) and $this->img_info[1] > $this->config['maxheight']) { return sprintf(_ERROR_UPLOAD_IMAGE_HEIGHT, $this->config['maxheight']); } } } return ''; }
$check_number++; } } } if ($check_number == 2) { nv_insert_logs(NV_LANG_DATA, $module_name, 'log_intall_theme', "theme " . $theme, $admin_info['userid']); $filefolder = ''; $filelist = ''; $validfolder = array(); $filesize = nv_convertfromBytes($_FILES['themefile']['size']); $contents .= $lang_module['autoinstall_theme_uploadedfile'] . '<span style="color:red;font-weight:bold">' . $_FILES['themefile']['name'] . '</span> - ' . $lang_module['autoinstall_theme_uploadedfilesize'] . '<span style="color:red;font-weight:bold">' . $filesize . '</span><br />'; #show file and folder $contents .= "<br /><b>" . $lang_module['autoinstall_theme_uploaded_filenum'] . $status['nb'] . "</b><br />"; for ($i = 0, $j = 1; $i < sizeof($list); $i++, $j++) { if (!$list[$i]['folder']) { $bytes = nv_convertfromBytes($list[$i]['size']); } else { $bytes = ""; $validfolder[] = $list[$i]['filename']; } $filefolder .= $list[$i]['filename'] . "\n"; $filelist .= '[' . $j . "] " . $list[$i]['filename'] . " {$bytes}<br />"; } $contents .= '<div style="overflow:auto;height:200px;width:700px">' . $filelist . '</div>'; #write filefolder to file $fh = @fopen($xauto, 'w') or die("" . $lang_module['autoinstall_theme_error_createfile'] . ""); flock($fh, LOCK_EX); fwrite($fh, $filefolder); flock($fh, LOCK_UN); fclose($fh); #write folder to file
die; } // Lay don vi san pham $sql = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_units WHERE id = ' . $data_content['product_unit']); $data_unit = $sql->fetch(); $data_unit['title'] = $data_unit[NV_LANG_DATA . '_title']; // Hien thi tabs $sql = 'SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_tabs where active=1 ORDER BY weight ASC'; $data_content['tabs'] = nv_db_cache($sql, 'id', $module_name); $data_content['files'] = array(); if (!empty($data_content['tabs'])) { // Download tai lieu san pham if ($pro_config['download_active']) { $result = $db->query('SELECT id, ' . NV_LANG_DATA . '_title title, ' . NV_LANG_DATA . '_description description, path, filesize, extension, download_groups FROM ' . $db_config['prefix'] . '_' . $module_data . '_files WHERE id IN (SELECT id_files FROM ' . $db_config['prefix'] . '_' . $module_data . '_files_rows WHERE id_rows=' . $data_content['id'] . ')'); while ($row = $result->fetch()) { $row['filesize'] = !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : $lang_module['download_file_unknown']; $data_content['files'][] = $row; } } } // Danh gia - Phan hoi $rating_total = 0; $result = $db->query('SELECT rating FROM ' . $db_config['prefix'] . '_' . $module_data . '_review WHERE product_id = ' . $data_content['id'] . ' AND status=1'); $rating_count = $result->rowCount(); if ($rating_count > 0) { while (list($rating) = $result->fetch(3)) { $rating_total += $rating; } } $data_content['rating_total'] = $rating_count; $data_content['rating_point'] = $rating_total;
function nv_show_tab() { global $db, $db_config, $module_name, $page_title, $lang_module, $nv_Request; $tab = $nv_Request->get_title('tab', 'get'); $sth = $db->prepare('SHOW TABLE STATUS WHERE name= :tab'); $sth->bindParam(':tab', $tab, PDO::PARAM_STR); $sth->execute(); $item = $sth->fetch(); if (empty($item)) { Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name); die; } if (in_array($nv_Request->get_title('show_highlight', 'post'), array('php', 'sql'))) { $content = nv_highlight_string($tab, $nv_Request->get_title('show_highlight', 'post')); include NV_ROOTDIR . '/includes/header.php'; echo $content; include NV_ROOTDIR . '/includes/footer.php'; } $tablename = substr($item['name'], strlen($db_config['prefix']) + 1); $contents = array(); $contents['table']['caption'] = sprintf($lang_module['table_caption'], $tablename); $contents['table']['info']['name'] = array($lang_module['table_name'], $tablename); $contents['table']['info']['engine'] = array($lang_module['table_type'], isset($item['engine']) ? $item['engine'] : $item['type']); $contents['table']['info']['row_format'] = array($lang_module['row_format'], $item['row_format']); $contents['table']['info']['data_length'] = array($lang_module['table_size'], nv_convertfromBytes(intval($item['data_length']) + intval($item['index_length']))); $contents['table']['info']['max_data_length'] = array($lang_module['table_max_size'], !empty($item['max_data_length']) ? nv_convertfromBytes(floatval($item['max_data_length'])) : 'n/a'); $contents['table']['info']['data_free'] = array($lang_module['table_datafree'], !empty($item['data_free']) ? nv_convertfromBytes(intval($item['data_free'])) : 0); $contents['table']['info']['rows'] = array($lang_module['table_numrow'], $item['rows']); $contents['table']['info']['auto_increment'] = array($lang_module['table_auto_increment'], isset($item['auto_increment']) ? intval($item['auto_increment']) : 'n/a'); $contents['table']['info']['create_time'] = array($lang_module['table_create_time'], !empty($item['create_time']) ? strftime('%H:%M:%S %d/%m/%Y', strtotime($item['create_time'])) : 'n/a'); $contents['table']['info']['update_time'] = array($lang_module['table_update_time'], !empty($item['update_time']) ? strftime('%H:%M:%S %d/%m/%Y', strtotime($item['update_time'])) : 'n/a'); $contents['table']['info']['check_time'] = array($lang_module['table_check_time'], !empty($item['check_time']) ? strftime('%H:%M:%S %d/%m/%Y', strtotime($item['check_time'])) : 'n/a'); $contents['table']['info']['collation'] = array($lang_module['table_charset'], !empty($item['collation']) && preg_match('/^([a-z0-9]+)_/i', $item['collation'], $m) ? $m[1] : ''); $contents['table']['show'] = nv_highlight_string($tab, 'php'); $contents['table']['show_lang'] = array($lang_module['php_code'], $lang_module['sql_code']); $contents['table']['row']['caption'] = sprintf($lang_module['table_row_caption'], $tablename); $contents['table']['row']['columns'] = array($lang_module['field_name'], $lang_module['field_type'], $lang_module['field_null'], $lang_module['field_key'], $lang_module['field_default'], $lang_module['field_extra']); $contents['table']['row']['detail'] = array(); $columns_array = $db->columns_array($tab); foreach ($columns_array as $row) { $row['null'] = $row['null'] == 'NO' ? 'NOT NULL' : 'NULL'; $row['key'] = empty($row['key']) ? '' : ($row['key'] == 'PRI' ? 'PRIMARY KEY' : ($row['key'] == 'UNI' ? 'UNIQUE KEY' : 'KEY')); $contents['table']['row']['detail'][] = $row; } $contents = nv_show_tab_theme($contents); $page_title = sprintf($lang_module['nv_show_tab'], $tablename); include NV_ROOTDIR . '/includes/header.php'; echo nv_admin_theme($contents); include NV_ROOTDIR . '/includes/footer.php'; }
$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('NV_MAX_WIDTH', NV_MAX_WIDTH); $xtpl->assign('NV_MAX_HEIGHT', NV_MAX_HEIGHT); $sys_max_size = min(nv_converttoBytes(ini_get('upload_max_filesize')), nv_converttoBytes(ini_get('post_max_size'))); $p_size = $sys_max_size / 100; $xtpl->assign('SYS_MAX_SIZE', nv_convertfromBytes($sys_max_size)); $xtpl->assign('NV_AUTO_RESIZE', $global_config['nv_auto_resize'] ? ' checked="checked"' : ''); $xtpl->assign('UPLOAD_ALT_REQUIRE', $global_config['upload_alt_require'] ? ' checked="checked"' : ''); $xtpl->assign('UPLOAD_AUTO_ALT', $global_config['upload_auto_alt'] ? ' checked="checked"' : ''); for ($index = 100; $index > 0; --$index) { $size = floor($index * $p_size); $xtpl->assign('SIZE', array('key' => $size, 'title' => nv_convertfromBytes($size), 'selected' => $size == $global_config['nv_max_size'] ? ' selected="selected"' : '')); $xtpl->parse('main.size'); } $_upload_checking_mode = array('strong' => $lang_module['strong_mode'], 'mild' => $lang_module['mild_mode'], 'lite' => $lang_module['lite_mode'], 'none' => $lang_module['none_mode']); foreach ($_upload_checking_mode as $m => $n) { $xtpl->assign('UPLOAD_CHECKING_MODE', array('key' => $m, 'title' => $n, 'selected' => $m == $global_config['upload_checking_mode'] ? ' selected="selected"' : '')); $xtpl->parse('main.upload_checking_mode'); } $strong = false; if (nv_function_exists('finfo_open') or nv_class_exists('finfo', false) or nv_function_exists('mime_content_type') or substr($sys_info['os'], 0, 3) != 'WIN' and (nv_function_exists('system') or nv_function_exists('exec'))) { $strong = true; } $xtpl->assign('UPLOAD_CHECKING_NOTE', !$strong ? $lang_module['upload_checking_note'] : ''); foreach ($myini['types'] as $key => $name) { $xtpl->assign('TYPES', array('key' => $key, 'title' => $name, 'checked' => in_array($name, $global_config['file_allowed_ext']) ? ' checked="checked"' : '')); $xtpl->parse('main.types');
$today = mktime(0, 0, 0, date("n"), date("j"), date("Y")); $yesterday = $today - 86400; while ($row = $db->sql_fetchrow($result)) { $cattitle = "<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list_cats[$row['catid']]['alias'] . "\">" . $list_cats[$row['catid']]['title'] . "</a>"; $more_link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list_cats[$row['catid']]['alias'] . "/" . $row['alias']; $uploadtime = (int) $row['uploadtime']; if ($uploadtime >= $today) { $uploadtime = $lang_module['today'] . ", " . date("H:i", $row['uploadtime']); } elseif ($uploadtime >= $yesterday) { $uploadtime = $lang_module['yesterday'] . ", " . date("H:i", $row['uploadtime']); } else { $uploadtime = nv_date("d/m/Y H:i", $row['uploadtime']); } $img = NV_UPLOADS_DIR . $row['fileimage']; $imageinfo = nv_ImageInfo(NV_ROOTDIR . '/' . $img, 300, true, NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb'); $array[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'cattitle' => $cattitle, 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => $row['author_name'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : "", 'fileimage' => $imageinfo, 'view_hits' => (int) $row['view_hits'], 'download_hits' => (int) $row['download_hits'], 'more_link' => $more_link, 'edit_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&edit=1&id=" . (int) $row['id'] : "", 'del_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name : ""); if ($row['comment_allow']) { $array[$row['id']]['comment_hits'] = (int) $row['comment_hits']; } } $generate_page = nv_alias_page($page_title, $base_url, $all_page, $per_page, $page); $contents = theme_viewcat_download($array, $download_config, "", $generate_page); if ($page > 1) { $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page; } } else { $contents = $lang_module['search_noresult']; } include NV_ROOTDIR . "/includes/header.php"; echo nv_site_theme($contents); include NV_ROOTDIR . "/includes/footer.php";