function cron_dump_autobackup()
{
    global $db, $db_config, $global_config, $client_info;
    $result = true;
    $current_day = mktime(0, 0, 0, date("n", NV_CURRENTTIME), date("j", NV_CURRENTTIME), date("Y", NV_CURRENTTIME));
    $w_day = $current_day - $global_config['dump_backup_day'] * 86400;
    $contents = array();
    $contents['savetype'] = $global_config['dump_backup_ext'] == "sql" ? "sql" : "gz";
    $file_ext = $contents['savetype'] == "sql" ? "sql" : "sql.gz";
    $log_dir = NV_ROOTDIR . "/" . NV_LOGS_DIR . "/dump_backup";
    $contents['filename'] = $log_dir . "/" . md5(nv_genpass(10) . $client_info['session_id']) . "_" . $current_day . "." . $file_ext;
    if (!file_exists($contents['filename'])) {
        $files = scandir($log_dir);
        foreach ($files as $file) {
            unset($mc);
            if (preg_match("/^([a-zA-Z0-9]+)\\_([0-9]+)\\.(" . nv_preg_quote($file_ext) . ")/", $file, $mc)) {
                if (intval($mc[2]) > 0 and intval($mc[2]) < $w_day) {
                    @unlink($log_dir . "/" . $file);
                }
            }
        }
        $contents['tables'] = array();
        $res = $db->sql_query("SHOW TABLES LIKE '" . $db_config['prefix'] . "_%'");
        while ($item = $db->sql_fetchrow($res)) {
            $contents['tables'][] = $item[0];
        }
        $db->sql_freeresult($res);
        $contents['type'] = "all";
        include NV_ROOTDIR . "/includes/core/dump.php";
        if (!nv_dump_save($contents)) {
            $result = false;
        }
    }
    return $result;
}
Esempio n. 2
0
function validUserLog($array_user, $remember, $opid)
{
    global $db, $client_info, $crypt, $nv_Request;
    $remember = intval($remember);
    $checknum = nv_genpass(10);
    $checknum = $crypt->hash($checknum);
    $user = array('userid' => $array_user['userid'], 'checknum' => $checknum, 'current_agent' => $client_info['agent'], 'last_agent' => $array_user['last_agent'], 'current_ip' => $client_info['ip'], 'last_ip' => $array_user['last_ip'], 'current_login' => NV_CURRENTTIME, 'last_login' => intval($array_user['last_login']), 'last_openid' => $array_user['last_openid'], 'current_openid' => $opid);
    $user = nv_base64_encode(serialize($user));
    $db->sql_query("UPDATE `" . NV_USERS_GLOBALTABLE . "` SET \r\n    `checknum` = " . $db->dbescape($checknum) . ", \r\n    `last_login` = " . NV_CURRENTTIME . ", \r\n    `last_ip` = " . $db->dbescape($client_info['ip']) . ", \r\n    `last_agent` = " . $db->dbescape($client_info['agent']) . ", \r\n    `last_openid` = " . $db->dbescape($opid) . ", \r\n    `remember` = " . $remember . " \r\n    WHERE `userid`=" . $array_user['userid']);
    $live_cookie_time = $remember ? NV_LIVE_COOKIE_TIME : 0;
    $nv_Request->set_Cookie('nvloginhash', $user, $live_cookie_time);
}
Esempio n. 3
0
/**
 * validUserLog()
 *
 * @param mixed $array_user
 * @param mixed $remember
 * @param mixed $opid
 * @return
 */
function validUserLog($array_user, $remember, $opid, $current_mode = 0)
{
    global $db, $db_config, $global_config, $nv_Request;
    $remember = intval($remember);
    $checknum = md5(nv_genpass(10));
    $user = array('userid' => $array_user['userid'], 'current_mode' => $current_mode, 'checknum' => $checknum, 'checkhash' => md5($array_user['userid'] . $checknum . $global_config['sitekey'] . NV_USER_AGENT), 'current_agent' => NV_USER_AGENT, 'last_agent' => $array_user['last_agent'], 'current_ip' => NV_CLIENT_IP, 'last_ip' => $array_user['last_ip'], 'current_login' => NV_CURRENTTIME, 'last_login' => intval($array_user['last_login']), 'last_openid' => $array_user['last_openid'], 'current_openid' => $opid);
    $user = nv_base64_encode(serialize($user));
    $stmt = $db->prepare("UPDATE " . NV_USERS_GLOBALTABLE . " SET\n\t\tchecknum = :checknum,\n\t\tlast_login = "******",\n\t\tlast_ip = :last_ip,\n\t\tlast_agent = :last_agent,\n\t\tlast_openid = :opid,\n\t\tremember = " . $remember . "\n\t\tWHERE userid=" . $array_user['userid']);
    $stmt->bindValue(':checknum', $checknum, PDO::PARAM_STR);
    $stmt->bindValue(':last_ip', NV_CLIENT_IP, PDO::PARAM_STR);
    $stmt->bindValue(':last_agent', NV_USER_AGENT, PDO::PARAM_STR);
    $stmt->bindValue(':opid', $opid, PDO::PARAM_STR);
    $stmt->execute();
    $live_cookie_time = $remember ? NV_LIVE_COOKIE_TIME : 0;
    $nv_Request->set_Cookie('nvloginhash', $user, $live_cookie_time);
}
Esempio n. 4
0
/**
 * lost_pass_sendMail()
 *
 * @param mixed $row
 * @return void
 */
function lost_pass_sendMail($row)
{
    global $db, $global_config, $lang_module;
    $passlostkey = (!empty($row['passlostkey']) and preg_match("/^([0-9]{10,15})\\|([a-z0-9]{32})\$/i", $row['passlostkey'], $matches)) ? array($matches[1], $matches[2]) : array();
    if (!isset($passlostkey[0]) or !isset($passlostkey[1]) or (int) $passlostkey[0] < NV_CURRENTTIME) {
        $key = strtoupper(nv_genpass(10));
        $passlostkey = md5($row['userid'] . $key . $global_config['sitekey']);
        $pa = NV_CURRENTTIME + 3600;
        $passlostkey = $pa . '|' . $passlostkey;
        $sql = "UPDATE " . NV_MOD_TABLE . " SET passlostkey='" . $passlostkey . "' WHERE userid=" . $row['userid'];
        $db->query($sql);
        $name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']);
        $name = array_filter($name);
        $name = implode(' ', $name);
        $sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>';
        $message = sprintf($lang_module['lostpass_email_content'], $name, $sitename, $key, nv_date('H:i d/m/Y', $pa));
        @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['lostpass_email_subject'], $message);
    }
}
Esempio n. 5
0
/**
 * cron_dump_autobackup()
 *
 * @return
 */
function cron_dump_autobackup()
{
    global $db, $db_config, $global_config, $client_info;
    $result = true;
    $current_day = mktime(0, 0, 0, date('n', NV_CURRENTTIME), date('j', NV_CURRENTTIME), date('Y', NV_CURRENTTIME));
    $w_day = $current_day - $global_config['dump_backup_day'] * 86400;
    $contents = array();
    $contents['savetype'] = $global_config['dump_backup_ext'] == 'sql' ? 'sql' : 'gz';
    $file_ext = $contents['savetype'] == 'sql' ? 'sql' : 'sql.gz';
    $log_dir = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/dump_backup';
    $contents['filename'] = $log_dir . '/' . md5(nv_genpass(10) . $client_info['session_id']) . '_' . $current_day . '.' . $file_ext;
    if (!file_exists($contents['filename'])) {
        if ($dh = opendir($log_dir)) {
            while (($file = readdir($dh)) !== false) {
                if (preg_match('/^([a-zA-Z0-9]+)\\_([0-9]+)\\.(' . nv_preg_quote($file_ext) . ')/', $file, $m)) {
                    if (intval($m[2]) > 0 and intval($m[2]) < $w_day) {
                        @unlink($log_dir . '/' . $file);
                    }
                }
            }
            closedir($dh);
            clearstatcache();
        }
        if ($global_config['dump_autobackup']) {
            $contents['tables'] = array();
            $res = $db->query("SHOW TABLES LIKE '" . $db_config['prefix'] . "_%'");
            while ($item = $res->fetch(3)) {
                $contents['tables'][] = $item[0];
            }
            $res->closeCursor();
            $contents['type'] = 'all';
            include NV_ROOTDIR . '/includes/core/dump.php';
            if (!nv_dump_save($contents)) {
                $result = false;
            }
        }
    }
    return $result;
}
Esempio n. 6
0
function nv_save_file_config()
{
    global $nv_Request, $file_config_temp, $db_config, $global_config, $step;
    if (is_writable(NV_ROOTDIR . '/' . $file_config_temp) or is_writable(NV_ROOTDIR . '/' . NV_TEMP_DIR)) {
        $global_config['cookie_prefix'] = (empty($global_config['cookie_prefix']) or $global_config['cookie_prefix'] == 'nv4') ? 'nv4c_' . nv_genpass(5) : $global_config['cookie_prefix'];
        $global_config['session_prefix'] = (empty($global_config['session_prefix']) or $global_config['session_prefix'] == 'nv4') ? 'nv4s_' . nv_genpass(6) : $global_config['session_prefix'];
        $global_config['site_email'] = !isset($global_config['site_email']) ? '' : $global_config['site_email'];
        $db_config['dbhost'] = !isset($db_config['dbhost']) ? 'localhost' : $db_config['dbhost'];
        $db_config['dbport'] = !isset($db_config['dbport']) ? '' : $db_config['dbport'];
        $db_config['dbname'] = !isset($db_config['dbname']) ? '' : $db_config['dbname'];
        $db_config['dbuname'] = !isset($db_config['dbuname']) ? '' : $db_config['dbuname'];
        $db_config['dbsystem'] = isset($db_config['dbsystem']) ? $db_config['dbsystem'] : $db_config['dbuname'];
        $db_config['dbpass'] = !isset($db_config['dbpass']) ? '' : $db_config['dbpass'];
        $db_config['prefix'] = !isset($db_config['prefix']) ? 'nv4' : $db_config['prefix'];
        $db_config['charset'] = strstr($db_config['collation'], '_', true);
        $persistent = $db_config['persistent'] ? 'true' : 'false';
        $content = '';
        $content .= "<?php\n\n";
        $content .= NV_FILEHEAD . "\n\n";
        $content .= "if ( ! defined( 'NV_MAINFILE' ) )\n";
        $content .= "{\n";
        $content .= "\tdie( 'Stop!!!' );\n";
        $content .= "}\n\n";
        $content .= "\$db_config['dbhost'] = '" . $db_config['dbhost'] . "';\n";
        $content .= "\$db_config['dbport'] = '" . $db_config['dbport'] . "';\n";
        $content .= "\$db_config['dbname'] = '" . $db_config['dbname'] . "';\n";
        $content .= "\$db_config['dbsystem'] = '" . $db_config['dbsystem'] . "';\n";
        $content .= "\$db_config['dbuname'] = '" . $db_config['dbuname'] . "';\n";
        $content .= "\$db_config['dbpass'] = '******'dbpass'] . "';\n";
        $content .= "\$db_config['dbtype'] = '" . $db_config['dbtype'] . "';\n";
        $content .= "\$db_config['collation'] = '" . $db_config['collation'] . "';\n";
        $content .= "\$db_config['charset'] = '" . $db_config['charset'] . "';\n";
        $content .= "\$db_config['persistent'] = " . $persistent . ";\n";
        $content .= "\$db_config['prefix'] = '" . $db_config['prefix'] . "';\n";
        $content .= "\n";
        $content .= "\$global_config['site_domain'] = '';\n";
        $content .= "\$global_config['name_show'] = 0;\n";
        $content .= "\$global_config['idsite'] = 0;\n";
        $content .= "\$global_config['sitekey'] = '" . $global_config['sitekey'] . "';// Do not change sitekey!\n";
        $content .= "\$global_config['hashprefix'] = '" . $global_config['hashprefix'] . "';\n";
        $content .= "\$global_config['cached'] = 'files';\n";
        if ($step < 7) {
            $content .= "\$global_config['cookie_prefix'] = '" . $global_config['cookie_prefix'] . "';\n";
            $content .= "\$global_config['session_prefix'] = '" . $global_config['session_prefix'] . "';\n";
            $global_config['ftp_server'] = !isset($global_config['ftp_server']) ? "localhost" : $global_config['ftp_server'];
            $global_config['ftp_port'] = !isset($global_config['ftp_port']) ? 21 : $global_config['ftp_port'];
            $global_config['ftp_user_name'] = !isset($global_config['ftp_user_name']) ? "" : $global_config['ftp_user_name'];
            $global_config['ftp_user_pass'] = !isset($global_config['ftp_user_pass']) ? "" : $global_config['ftp_user_pass'];
            $global_config['ftp_path'] = !isset($global_config['ftp_path']) ? "" : $global_config['ftp_path'];
            $global_config['ftp_check_login'] = !isset($global_config['ftp_check_login']) ? 0 : $global_config['ftp_check_login'];
            if ($global_config['ftp_check_login']) {
                $ftp_server_array = array("ftp_server" => $global_config['ftp_server'], "ftp_port" => $global_config['ftp_port'], "ftp_user_name" => $global_config['ftp_user_name'], "ftp_user_pass" => $global_config['ftp_user_pass'], "ftp_path" => $global_config['ftp_path'], "ftp_check_login" => $global_config['ftp_check_login']);
                $nv_Request->set_Session('ftp_server_array', serialize($ftp_server_array));
            }
            $content .= "\n";
            $content .= "\$global_config['ftp_server'] = '" . $global_config['ftp_server'] . "';\n";
            $content .= "\$global_config['ftp_port'] = '" . $global_config['ftp_port'] . "';\n";
            $content .= "\$global_config['ftp_user_name'] = '" . $global_config['ftp_user_name'] . "';\n";
            $content .= "\$global_config['ftp_user_pass'] = '******'ftp_user_pass'] . "';\n";
            $content .= "\$global_config['ftp_path'] = '" . $global_config['ftp_path'] . "';\n";
            $content .= "\$global_config['ftp_check_login'] = '******'ftp_check_login'] . "';\n";
        }
        file_put_contents(NV_ROOTDIR . '/' . $file_config_temp, trim($content), LOCK_EX);
        //Resets the contents of the opcode cache
        if (function_exists('opcache_reset')) {
            opcache_reset();
        }
        return true;
    } else {
        return false;
    }
}
Esempio n. 7
0
                         $sth = $db->prepare('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_tags_id SET keyword = :keyword WHERE id = ' . $rowcontent['id'] . ' AND tid=' . intval($tid));
                         $sth->bindParam(':keyword', $keyword, PDO::PARAM_STR);
                         $sth->execute();
                     }
                     unset($array_keywords_old[$tid]);
                 }
             }
             foreach ($array_keywords_old as $tid => $keyword) {
                 if (!in_array($keyword, $keywords)) {
                     $db->query('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_tags SET numnews = numnews-1 WHERE tid = ' . $tid);
                     $db->query('DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_tags_id WHERE id = ' . $rowcontent['id'] . ' AND tid=' . $tid);
                 }
             }
         }
         if (isset($module_config['seotools']['prcservice']) and !empty($module_config['seotools']['prcservice']) and $rowcontent['status'] == 1 and $rowcontent['publtime'] < NV_CURRENTTIME + 1 and ($rowcontent['exptime'] == 0 or $rowcontent['exptime'] > NV_CURRENTTIME + 1)) {
             Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=rpc&id=' . $rowcontent['id'] . '&rand=' . nv_genpass());
             die;
         } else {
             $url = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
             $msg1 = $lang_module['content_saveok'];
             $msg2 = $lang_module['content_main'] . ' ' . $module_info['custom_title'];
             redriect($msg1, $msg2, $url, $module_data . '_bodyhtml');
         }
     }
 } else {
     $url = 'javascript: history.go(-1)';
     $msg1 = implode('<br />', $error);
     $msg2 = $lang_module['content_back'];
     redriect($msg1, $msg2, $url, $module_data . '_bodyhtml', 'back');
 }
 $id_block_content = $id_block_content_post;
Esempio n. 8
0
    // General css
    $config_theme['generalcss'] = nv_unhtmlspecialchars($nv_Request->get_textarea('generalcss', 'post', ''));
    $config_value = serialize($config_theme);
    if (isset($module_config['themes'][$selectthemes])) {
        $sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value= :config_value WHERE config_name = :config_name AND lang = '" . NV_LANG_DATA . "' AND module='themes'");
    } else {
        $sth = $db->prepare("INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', 'themes', :config_name, :config_value)");
    }
    $sth->bindParam(':config_name', $selectthemes, PDO::PARAM_STR);
    $sth->bindParam(':config_value', $config_value, PDO::PARAM_STR, strlen($config_value));
    $sth->execute();
    nv_del_moduleCache('settings');
    if (file_exists(NV_ROOTDIR . "/" . SYSTEM_FILES_DIR . "/css/theme_" . $selectthemes . "_" . $global_config['idsite'] . ".css")) {
        nv_deletefile(NV_ROOTDIR . "/" . SYSTEM_FILES_DIR . "/css/theme_" . $selectthemes . "_" . $global_config['idsite'] . ".css");
    }
    Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&selectthemes=' . $selectthemes . '&rand=' . nv_genpass());
    die;
} elseif (isset($module_config['themes'][$selectthemes])) {
    $config_theme = unserialize($module_config['themes'][$selectthemes]);
} else {
    require NV_ROOTDIR . '/themes/' . $selectthemes . '/config_default.php';
}
$xtpl = new XTemplate('config.tpl', NV_ROOTDIR . '/themes/' . $selectthemes . '/system/');
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE);
$xtpl->assign('NV_LANG_DATA', NV_LANG_DATA);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('OP', $op);
Esempio n. 9
0
function nv_site_theme($contents, $full = true)
{
    global $home, $array_mod_title, $lang_global, $language_array, $global_config, $site_mods, $module_name, $module_info, $op_file, $mod_title, $my_head, $my_footer, $client_info, $module_config, $op, $drag_block;
    // Determine tpl file, check exists tpl file
    $layout_file = $full ? 'layout.' . $module_info['layout_funcs'][$op_file] . '.tpl' : 'simple.tpl';
    if (!file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout/' . $layout_file)) {
        nv_info_die($lang_global['error_layout_title'], $lang_global['error_layout_title'], $lang_global['error_layout_content']);
    }
    if (isset($global_config['sitetimestamp'])) {
        $global_config['timestamp'] += $global_config['sitetimestamp'];
    }
    $css = nv_html_css();
    // Css for admin
    if (defined('NV_IS_ADMIN') and $full) {
        $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/admin.css\" />\n";
    }
    // Style config
    if (isset($module_config['themes'][$global_config['module_theme']])) {
        if (!file_exists(NV_ROOTDIR . '/' . SYSTEM_FILES_DIR . '/css/theme_' . $global_config['module_theme'] . '_' . $global_config['idsite'] . '.css')) {
            $config_theme = unserialize($module_config['themes'][$global_config['module_theme']]);
            $css_content = nv_css_setproperties('body', $config_theme['body']);
            $css_content .= nv_css_setproperties('a, a:link, a:active, a:visited', $config_theme['a_link']);
            $css_content .= nv_css_setproperties('a:hover', $config_theme['a_link_hover']);
            $css_content .= nv_css_setproperties('#wraper', $config_theme['content']);
            $css_content .= nv_css_setproperties('#header, #banner', $config_theme['header']);
            $css_content .= nv_css_setproperties('#footer', $config_theme['footer']);
            $css_content .= nv_css_setproperties('.panel, .well, .nv-block-banners', $config_theme['block']);
            $css_content .= nv_css_setproperties('.panel-default>.panel-heading', $config_theme['block_heading']);
            $css_content .= nv_css_setproperties('generalcss', $config_theme['generalcss']);
            // Không nên thay đổi "generalcss"
            file_put_contents(NV_ROOTDIR . '/' . SYSTEM_FILES_DIR . '/css/theme_' . $global_config['module_theme'] . '_' . $global_config['idsite'] . '.css', $css_content);
            unset($config_theme, $css_content);
        }
        $my_footer .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . SYSTEM_FILES_DIR . "/css/theme_" . $global_config['module_theme'] . "_" . $global_config['idsite'] . ".css?t=" . $global_config['timestamp'] . "\" />\n";
    }
    $xtpl = new XTemplate($layout_file, NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout');
    $xtpl->assign('LANG', $lang_global);
    $xtpl->assign('TEMPLATE', $global_config['module_theme']);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    // System variables
    $xtpl->assign('THEME_PAGE_TITLE', nv_html_page_title());
    $xtpl->assign('THEME_META_TAGS', nv_html_meta_tags());
    $xtpl->assign('THEME_SITE_RSS', nv_html_site_rss());
    $xtpl->assign('THEME_CSS', $css);
    $xtpl->assign('THEME_SITE_JS', nv_html_site_js());
    // Module contents
    $xtpl->assign('MODULE_CONTENT', $contents);
    // Header variables
    $xtpl->assign('SITE_NAME', $global_config['site_name']);
    $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA);
    $xtpl->assign('LOGO_SRC', NV_BASE_SITEURL . $global_config['site_logo']);
    $size = @getimagesize(NV_ROOTDIR . '/' . $global_config['site_logo']);
    $xtpl->assign('LOGO_WIDTH', $size[0]);
    $xtpl->assign('LOGO_HEIGHT', $size[1]);
    if (isset($size['mime']) and $size['mime'] == 'application/x-shockwave-flash') {
        $xtpl->parse('main.swf');
    } else {
        $xtpl->parse('main.image');
    }
    if ($op == 'main') {
        $xtpl->parse('main.main_h1');
    } else {
        $xtpl->parse('main.main_none_h1');
    }
    // Only full theme
    if ($full) {
        // Search form variables
        $xtpl->assign('THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH);
        $xtpl->assign('THEME_SEARCH_SUBMIT_ONCLICK', "nv_search_submit('topmenu_search_query', 'topmenu_search_submit', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ");");
        // Breadcrumbs
        if ($home != 1) {
            if ($global_config['rewrite_op_mod'] != $module_name) {
                $arr_cat_title_i = array('catid' => 0, 'title' => $module_info['custom_title'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name);
                array_unshift($array_mod_title, $arr_cat_title_i);
            }
            if (!empty($array_mod_title)) {
                foreach ($array_mod_title as $arr_cat_title_i) {
                    $xtpl->assign('BREADCRUMBS', $arr_cat_title_i);
                    $xtpl->parse('main.breadcrumbs.loop');
                }
                $xtpl->parse('main.breadcrumbs');
            }
        }
        // Statistics image
        $theme_stat_img = '';
        if ($global_config['statistic'] and isset($site_mods['statistics'])) {
            $theme_stat_img .= "<a title=\"" . $lang_global['viewstats'] . "\" href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&amp;p=" . nv_genpass() . "\" width=\"88\" height=\"31\" /></a>\n";
        }
        $xtpl->assign('THEME_STAT_IMG', $theme_stat_img);
        // Change theme types
        if (!empty($global_config['switch_mobi_des'])) {
            $mobile_theme = empty($module_info['mobile']) ? $global_config['mobile_theme'] : $module_info['mobile'];
            if (!empty($mobile_theme)) {
                $num_theme_type = sizeof($global_config['array_theme_type']) - 1;
                foreach ($global_config['array_theme_type'] as $i => $theme_type) {
                    $xtpl->assign('STHEME_TYPE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;nv' . NV_LANG_DATA . 'themever=' . $theme_type . '&amp;nv_redirect=' . nv_base64_encode($client_info['selfurl']));
                    $xtpl->assign('STHEME_TITLE', $lang_global['theme_type_' . $theme_type]);
                    $xtpl->assign('STHEME_INFO', sprintf($lang_global['theme_type_chose'], $lang_global['theme_type_' . $theme_type]));
                    if ($theme_type == $global_config['current_theme_type']) {
                        $xtpl->parse('main.theme_type.loop.current');
                    } else {
                        $xtpl->parse('main.theme_type.loop.other');
                    }
                    if ($i < $num_theme_type) {
                        $xtpl->parse('main.theme_type.loop.space');
                    }
                    $xtpl->parse('main.theme_type.loop');
                }
                $xtpl->parse('main.theme_type');
            }
        }
    }
    if (!$drag_block) {
        $xtpl->parse('main.no_drag_block');
    }
    $xtpl->parse('main');
    $sitecontent = $xtpl->text('main');
    // Only full theme
    if ($full) {
        $sitecontent = nv_blocks_content($sitecontent);
        $sitecontent = str_replace('[THEME_ERROR_INFO]', nv_error_info(), $sitecontent);
        if (defined('NV_IS_ADMIN')) {
            $my_footer = nv_admin_menu() . $my_footer;
        }
    }
    if (!empty($my_head)) {
        $sitecontent = preg_replace('/(<\\/head>)/i', $my_head . '\\1', $sitecontent, 1);
    }
    if (!empty($my_footer)) {
        $sitecontent = preg_replace('/(<\\/body>)/i', $my_footer . '\\1', $sitecontent, 1);
    }
    return $sitecontent;
}
Esempio n. 10
0
 } elseif (!empty($check_pass)) {
     die('action');
 } elseif ($global_config['gfx_chk'] and !nv_capcha_txt($seccode)) {
     die('action');
 } else {
     $stmt = $db->prepare('SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_clients WHERE login = :login AND act=1');
     $stmt->bindParam(':login', $login, PDO::PARAM_STR);
     $stmt->execute();
     $row = $stmt->fetch();
     if (empty($row)) {
         die('action');
     } else {
         if (!$crypt->validate_password($password, $row['pass'])) {
             die('action');
         } else {
             $checknum = md5(nv_genpass(10));
             $current_login = NV_CURRENTTIME;
             $id = intval($row['id']);
             $agent = substr(NV_USER_AGENT, 0, 254);
             $stmt = $db->prepare('UPDATE ' . NV_BANNERS_GLOBALTABLE . '_clients SET check_num = :check_num, last_login = '******', last_ip = :last_ip, last_agent = :last_agent WHERE id=' . $id);
             $stmt->bindValue(':check_num', $checknum, PDO::PARAM_STR);
             $stmt->bindValue(':last_ip', NV_CLIENT_IP, PDO::PARAM_STR);
             $stmt->bindValue(':last_agent', NV_USER_AGENT, PDO::PARAM_STR);
             if (!$stmt->execute()) {
                 die('action');
             }
             $client = array('login' => $login, 'checknum' => $checknum, 'current_agent' => NV_USER_AGENT, 'last_agent' => $row['last_agent'], 'current_ip' => NV_CLIENT_IP, 'last_ip' => $row['last_ip'], 'current_login' => $current_login, 'last_login' => intval($row['last_login']));
             $client = serialize($client);
             $nv_Request->set_Cookie('bncl', $client, NV_LIVE_COOKIE_TIME);
             echo 'OK';
             exit;
Esempio n. 11
0
// Ket noi ngon ngu
if (file_exists(NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_seotools.php';
} elseif (file_exists(NV_ROOTDIR . '/includes/language/' . NV_LANG_DATA . '/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/' . NV_LANG_DATA . '/admin_seotools.php';
} elseif (file_exists(NV_ROOTDIR . '/includes/language/en/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/en/admin_seotools.php';
}
$page_title = $lang_module['rpc'];
if (nv_function_exists('curl_init') and nv_function_exists('curl_exec')) {
    $id = $nv_Request->get_int('id', 'post,get', '');
    if ($id > 0) {
        $query = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE id = ' . $id);
        $news_contents = $query->fetch();
        $nv_redirect = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
        $nv_redirect2 = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&id=' . $id . '&checkss=' . md5($id . NV_CHECK_SESSION) . '&rand=' . nv_genpass();
        $prcservice = isset($module_config['seotools']['prcservice']) ? $module_config['seotools']['prcservice'] : '';
        $prcservice = !empty($prcservice) ? explode(',', $prcservice) : array();
        if ($news_contents['id'] > 0 and !empty($prcservice)) {
            if ($news_contents['status'] == 1 and $news_contents['publtime'] < NV_CURRENTTIME + 1 and ($news_contents['exptime'] == 0 or $news_contents['exptime'] > NV_CURRENTTIME + 1)) {
                if ($nv_Request->get_string('checkss', 'post,get', '') == md5($id . NV_CHECK_SESSION)) {
                    $services_active = array();
                    require NV_ROOTDIR . '/' . NV_DATADIR . '/rpc_services.php';
                    foreach ($services as $key => $service) {
                        if (in_array($service[1], $prcservice)) {
                            $services_active[] = $service;
                        }
                    }
                    $getdata = $nv_Request->get_int('getdata', 'post,get', '0');
                    if (empty($getdata)) {
                        $page_title = $lang_module['rpc'] . ': ' . $news_contents['title'];
Esempio n. 12
0
// Ket noi ngon ngu
if (file_exists(NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_seotools.php';
} elseif (file_exists(NV_ROOTDIR . '/includes/language/' . NV_LANG_DATA . '/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/' . NV_LANG_DATA . '/admin_seotools.php';
} elseif (file_exists(NV_ROOTDIR . '/includes/language/en/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/en/admin_seotools.php';
}
$page_title = $lang_module['rpc'];
if (nv_function_exists('curl_init') and nv_function_exists('curl_exec')) {
    $id = $nv_Request->get_int('id', 'post,get', '');
    if ($id > 0) {
        $query = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE id = ' . $id);
        $news_contents = $query->fetch();
        $nv_redirect = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
        $nv_redirect2 = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&id=' . $id . '&checkss=' . md5($id . $global_config['sitekey'] . session_id()) . '&rand=' . nv_genpass();
        $prcservice = isset($module_config['seotools']['prcservice']) ? $module_config['seotools']['prcservice'] : '';
        $prcservice = !empty($prcservice) ? explode(',', $prcservice) : array();
        if ($news_contents['id'] > 0 and !empty($prcservice)) {
            if ($news_contents['status'] == 1 and $news_contents['publtime'] < NV_CURRENTTIME + 1 and ($news_contents['exptime'] == 0 or $news_contents['exptime'] > NV_CURRENTTIME + 1)) {
                if ($nv_Request->get_string('checkss', 'post,get', '') == md5($id . $global_config['sitekey'] . session_id())) {
                    $services_active = array();
                    require NV_ROOTDIR . '/' . NV_DATADIR . '/rpc_services.php';
                    foreach ($services as $key => $service) {
                        if (in_array($service[1], $prcservice)) {
                            $services_active[] = $service;
                        }
                    }
                    $getdata = $nv_Request->get_int('getdata', 'post,get', '0');
                    if (empty($getdata)) {
                        $page_title = $lang_module['rpc'] . ': ' . $news_contents['title'];
Esempio n. 13
0
    die($alias);
}
if (!file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_upload)) {
    nv_mkdir(NV_ROOTDIR . '/' . NV_FILES_DIR, $module_upload);
}
if (defined('NV_EDITOR')) {
    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$row = array();
$error = array();
$row['id'] = $nv_Request->get_int('id', 'post,get', 0);
if ($nv_Request->isset_request('submit', 'post')) {
    $row['catid'] = $nv_Request->get_int('catid', 'post', 0);
    $row['title'] = $nv_Request->get_title('title', 'post', '');
    if (empty($row['title'])) {
        $row['title'] = $admin_info['username'] . '-' . nv_genpass(6);
    }
    $row['alias'] = $nv_Request->get_title('alias', 'post', '');
    $row['alias'] = empty($row['alias']) ? change_alias($row['title']) : change_alias($row['alias']);
    $row['description'] = $nv_Request->get_textarea('description', '', 'br');
    $row['descriptionhtml'] = $nv_Request->get_editor('descriptionhtml', '', NV_ALLOWED_HTML_TAGS);
    $row['image'] = $nv_Request->get_title('image', 'post', '');
    $row['code_php'] = $nv_Request->get_textarea('code_php', 'post', NV_ALLOWED_HTML_TAGS);
    $row['code_php_template'] = $nv_Request->get_textarea('code_php_template', 'post', NV_ALLOWED_HTML_TAGS);
    $row['code_html'] = $nv_Request->get_textarea('code_html', '');
    $row['code_css'] = $nv_Request->get_textarea('code_css', '');
    $row['code_js'] = $nv_Request->get_textarea('code_js', 'post', NV_ALLOWED_HTML_TAGS);
    $row['viewdemo'] = $nv_Request->get_int('viewdemo', 'post', 0);
    $row['sourcetext'] = $nv_Request->get_title('sourcetext', 'post', '');
    if (empty($row['title'])) {
        die('NO_' . $lang_module['error_required_title']);
Esempio n. 14
0
function nv_site_theme($contents)
{
    global $home, $array_mod_title, $lang_global, $language_array, $global_config, $site_mods, $module_name, $module_info, $op, $mod_title, $my_head, $my_footer, $client_info;
    if (!file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/layout." . $module_info['layout_funcs'][$op] . ".tpl")) {
        nv_info_die($lang_global['error_layout_title'], $lang_global['error_layout_title'], $lang_global['error_layout_content']);
    }
    $css = nv_html_css();
    $js = nv_html_site_js();
    if ($client_info['browser']['key'] != "explorer") {
        if (!$client_info['is_bot']) {
            $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/real.css\" />\n";
        }
    } else {
        if ($client_info['browser']['version'] == 6) {
            $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie6.css\" />\n";
            $js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/fix-png-ie6.js\"></script>\n";
            $js .= "<script type=\"text/javascript\">DD_belatedPNG.fix('#');</script>\n";
        } else {
            $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/gtie6.css\" />\n";
            if ($client_info['browser']['version'] >= 9) {
                $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie9.css\" />\n";
            }
        }
    }
    if (defined('NV_IS_ADMIN')) {
        $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/admin.css\" />\n";
    }
    if (defined('NV_DISPLAY_ERRORS_LIST') and NV_DISPLAY_ERRORS_LIST != 0) {
        $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/tab_info.css\" />\n";
    }
    $xtpl = new XTemplate("layout." . $module_info['layout_funcs'][$op] . ".tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/");
    $xtpl->assign('LANG', $lang_global);
    $xtpl->assign('TEMPLATE', $global_config['module_theme']);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('THEME_META_TAGS', nv_html_meta_tags());
    $xtpl->assign('THEME_SITE_JS', $js);
    $xtpl->assign('THEME_CSS', $css);
    $xtpl->assign('THEME_PAGE_TITLE', nv_html_page_title());
    $xtpl->assign('NV_TOP_MENU_HOME', $lang_global['Home']);
    $xtpl->assign('MODULE_CONTENT', $contents . "&nbsp;");
    $xtpl->assign('THEME_NOJS', $lang_global['nojs']);
    $xtpl->assign('THEME_LOGO_TITLE', $global_config['site_name']);
    $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA);
    $xtpl->assign('THEME_SITE_RSS', nv_html_site_rss());
    $xtpl->assign('THEME_DIGCLOCK_TEXT', nv_date("H:i T l, d/m/Y", NV_CURRENTTIME));
    $xtpl->assign('THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH);
    $xtpl->assign('THEME_SEARCH_SUBMIT_ONCLICK', "nv_search_submit('topmenu_search_query', 'topmenu_search_checkss', 'topmenu_search_submit', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ");");
    $xtpl->assign('SITE_NAME', $global_config['site_name']);
    $xtpl->assign('LOGO_SRC', NV_BASE_SITEURL . $global_config['site_logo']);
    if ($global_config['lang_multi'] and sizeof($global_config['allow_sitelangs']) > 1) {
        $xtpl->assign('SELECTLANGSITE', $lang_global['langsite']);
        foreach ($global_config['allow_sitelangs'] as $lang_i) {
            $langname = $language_array[$lang_i]['name'];
            $xtpl->assign('LANGSITENAME', $langname);
            $xtpl->assign('LANGSITEURL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang_i);
            if (NV_LANG_DATA != $lang_i) {
                $xtpl->parse('main.language.langitem');
            } else {
                $xtpl->parse('main.language.langcuritem');
            }
        }
        $xtpl->parse('main.language');
    }
    //Breakcolumn
    if ($home != 1) {
        $arr_cat_title_i = array('catid' => 0, 'title' => $module_info['custom_title'], 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name);
        $xtpl->assign('BREAKCOLUMN', $arr_cat_title_i);
        $xtpl->parse('main.mod_title.breakcolumn');
        foreach ($array_mod_title as $arr_cat_title_i) {
            $xtpl->assign('BREAKCOLUMN', $arr_cat_title_i);
            $xtpl->parse('main.mod_title.breakcolumn');
        }
        $xtpl->parse('main.mod_title');
    }
    $theme_stat_img = "";
    if ($global_config['statistic'] and isset($site_mods['statistics'])) {
        $theme_stat_img .= "<a title=\"" . $lang_global['viewstats'] . "\" href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" title=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&amp;p=" . nv_genpass() . "\" width=\"88\" height=\"31\" /></a>\n";
    }
    $theme_footer_js = "<script type=\"text/javascript\">\n";
    $theme_footer_js .= "nv_DigitalClock('digclock');\n";
    $theme_footer_js .= "</script>\n";
    if (NV_LANG_INTERFACE == 'vi') {
        $theme_footer_js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/mudim.js\"></script>";
    }
    $xtpl->assign('THEME_STAT_IMG', $theme_stat_img);
    $xtpl->assign('THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&amp;p=" . nv_genpass());
    // Chuyen doi giao dien
    if (!empty($global_config['switch_mobi_des']) and !empty($module_info['mobile'])) {
        $num_theme_type = sizeof($global_config['array_theme_type']) - 1;
        foreach ($global_config['array_theme_type'] as $i => $theme_type) {
            $xtpl->assign('STHEME_TYPE', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;nv" . NV_LANG_DATA . "themever=" . $theme_type . "&amp;nv_redirect=" . nv_base64_encode($client_info['selfurl']));
            $xtpl->assign('STHEME_TITLE', $lang_global['theme_type_' . $i]);
            $xtpl->assign('STHEME_INFO', sprintf($lang_global['theme_type_chose'], $lang_global['theme_type_' . $i]));
            if ($theme_type == $global_config['current_theme_type']) {
                $xtpl->parse('main.theme_type.loop.current');
            } else {
                $xtpl->parse('main.theme_type.loop.other');
            }
            if ($i < $num_theme_type) {
                $xtpl->parse('main.theme_type.loop.space');
            }
            $xtpl->parse('main.theme_type.loop');
        }
        $xtpl->parse('main.theme_type');
    }
    unset($theme_type, $i, $num_theme_type);
    $xtpl->parse('main');
    $sitecontent = $xtpl->text('main');
    $sitecontent = nv_blocks_content($sitecontent);
    $sitecontent = str_replace('[THEME_ERROR_INFO]', nv_error_info(), $sitecontent);
    $my_footer = $theme_footer_js . $my_footer;
    if (defined('NV_IS_ADMIN')) {
        $my_footer = nv_admin_menu() . $my_footer;
    }
    if (!empty($my_head)) {
        $sitecontent = preg_replace('/(<\\/head>)/i', $my_head . "\\1", $sitecontent, 1);
    }
    if (!empty($my_footer)) {
        $sitecontent = preg_replace('/(<\\/body>)/i', $my_footer . "\\1", $sitecontent, 1);
    }
    return $sitecontent;
}
Esempio n. 15
0
        $file_name = change_alias($page_title) . "_" . $id_export_save;
        $result = "OK_GETFILE";
        $nv_Request->set_Session($module_data . '_id_export', $id_export_save);
        $nv_Request->set_Session($module_data . '_export_filename', $export_filename . "@" . $file_name);
    }
    $objWriter->save(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $file_name . "." . $excel_ext);
    die($result);
} elseif ($step == 2 and $nv_Request->isset_request($module_data . '_export_filename', 'session')) {
    $export_filename = $nv_Request->get_string($module_data . '_export_filename', 'session', '');
    $array_filename = explode("@", $export_filename);
    $arry_file_zip = array();
    foreach ($array_filename as $file_name) {
        if (!empty($file_name) and file_exists(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $file_name . '.' . $excel_ext)) {
            $arry_file_zip[] = NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $file_name . "." . $excel_ext;
        }
    }
    $file_src = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . change_alias($lang_module['export']) . '_' . md5(nv_genpass(10) . session_id()) . '.zip';
    require_once NV_ROOTDIR . '/includes/class/pclzip.class.php';
    $zip = new PclZip($file_src);
    $zip->create($arry_file_zip, PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR . "/" . NV_CACHEDIR);
    $filesize = @filesize($file_src);
    $nv_Request->unset_request($module_data . '_export_filename', 'session');
    foreach ($arry_file_zip as $file) {
        nv_deletefile($file);
    }
    //Download file
    require_once NV_ROOTDIR . '/includes/class/download.class.php';
    $download = new download($file_src, NV_ROOTDIR . "/" . NV_TEMP_DIR, basename(change_alias($lang_module['export']) . ".zip"));
    $download->download_file();
    exit;
}
Esempio n. 16
0
                                     }
                                 }
                             }
                         }
                     }
                 } elseif (is_dir($current_file) and !in_array($current_file, $dir_no_scan)) {
                     $stack[] = $current_file;
                 }
             }
             $i++;
         }
     }
 }
 if (empty($error)) {
     $allowzip = array_unique($allowzip);
     $file_src = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . 'cdn_' . md5(nv_genpass(10) . NV_CHECK_SESSION) . '.zip';
     $zip = new PclZip($file_src);
     $zip->add($allowzip, PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR);
     $zip->add(NV_ROOTDIR . '/themes/index.html', PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR . '/themes');
     //Download file
     $download = new NukeViet\Files\Download($file_src, NV_ROOTDIR . '/' . NV_TEMP_DIR, 'js_css_cdn_' . date('Ymd') . '.zip');
     $download->download_file();
     exit;
 } else {
     $page_title = 'File not exit';
     $contents = '<br>';
     foreach ($error as $key => $value) {
         $value = array_unique($value);
         asort($value);
         $contents .= '<strong>' . $key . ' </strong><br>&nbsp;&nbsp;&nbsp;&nbsp; ' . implode('<br>&nbsp;&nbsp;&nbsp;&nbsp;', $value) . '<br><br>';
     }
Esempio n. 17
0
    $custom_fields = $nv_Request->get_array('custom_fields', 'post');
    require NV_ROOTDIR . '/modules/users/fields.check.php';
    $db->query('UPDATE ' . NV_USERS_GLOBALTABLE . '_info SET ' . implode(', ', $query_field) . ' WHERE userid=' . $user_info['userid']);
    die(json_encode(array('status' => 'ok', 'input' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=editinfo/others', true), 'mess' => $lang_module['editinfo_ok'])));
} elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'safemode') {
    $nv_password = $nv_Request->get_title('nv_password', 'post', '');
    if (empty($nv_password) or !$crypt->validate_password($nv_password, $row['password'])) {
        die(json_encode(array('status' => 'error', 'input' => 'nv_password', 'mess' => $lang_global['incorrect_password'])));
    }
    if ($nv_Request->isset_request('resend', 'post')) {
        if (empty($row['safekey'])) {
            $rand = rand(NV_UPASSMIN, NV_UPASSMAX);
            if ($rand < 6) {
                $rand = 6;
            }
            $row['safekey'] = md5(nv_genpass($rand));
            $stmt = $db->prepare('UPDATE ' . NV_USERS_GLOBALTABLE . ' SET safekey= :safekey WHERE userid=' . $user_info['userid']);
            $stmt->bindParam(':safekey', $row['safekey'], PDO::PARAM_STR);
            $stmt->execute();
            $nv_Request->set_Session('safesend', 0);
        }
        $ss_safesend = $nv_Request->get_int('safesend', 'session', 0);
        if ($ss_safesend < NV_CURRENTTIME) {
            $name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']);
            $name = array_filter($name);
            $name = implode(' ', $name);
            $sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>';
            $message = sprintf($lang_module['safe_send_content'], $name, $sitename, $row['safekey']);
            @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['safe_send_subject'], $message);
            $ss_safesend = NV_CURRENTTIME + 600;
            $nv_Request->set_Session('safesend', $ss_safesend);
Esempio n. 18
0
             }
             $data_sql[] = array('table' => $table, 'sql' => $sql);
         } elseif (strlen($sql) > 10) {
             $table = $tablename[$key];
             if (!empty($table)) {
                 $table = str_replace("_", "-", $table);
                 $table = change_alias($table);
                 $table = str_replace("-", "_", $table);
             }
             $data_sql[] = array('table' => $table, 'sql' => $sql);
         }
     }
 }
 if (!empty($data_system['module_name'])) {
     if ($nv_Request->get_string('download', 'post', 0)) {
         $tempdir = 'nv4_module_' . $data_system['module_name'] . '_' . md5(nv_genpass(10) . session_id());
         if (is_dir(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir)) {
             nv_deletefile(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir, true);
         }
         nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR, $tempdir);
         nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir, "modules");
         nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/modules", $data_system['module_name'], 1);
         nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/modules/" . $data_system['module_name'], "blocks", 1, 1);
         nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/modules/" . $data_system['module_name'], "js", 1);
         nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/modules/" . $data_system['module_name'], "language", 1, 1);
         nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir, "themes");
         if (!empty($data_admin)) {
             nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/modules/" . $data_system['module_name'], "admin", 1, 1);
             nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/themes", "admin_default");
             nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/themes/admin_default", "css");
             nv_mkdir_nvtools(NV_ROOTDIR . "/" . NV_TEMP_DIR . "/" . $tempdir . "/themes/admin_default", "images");
Esempio n. 19
0
 }
 if ($nv_update_config['substep'] == 1) {
     // Backup CSDL va CODE
     // Backup CSDL
     if ($nv_Request->isset_request('dump', 'get')) {
         $checksess = $nv_Request->get_title('checksess', 'get', '');
         if ($checksess != md5($global_config['sitekey'] . session_id())) {
             die('Error!!!');
         }
         $type = $nv_Request->get_title('type', 'get', '');
         $current_day = mktime(0, 0, 0, date('n', NV_CURRENTTIME), date('j', NV_CURRENTTIME), date('Y', NV_CURRENTTIME));
         $contents = array();
         $contents['savetype'] = $type == 'sql' ? 'sql' : 'gz';
         $file_ext = $contents['savetype'] == 'sql' ? 'sql' : 'sql.gz';
         $log_dir = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/dump_backup';
         $contents['filename'] = $log_dir . '/' . md5(nv_genpass(10) . $client_info['session_id']) . '_' . $current_day . '.' . $file_ext;
         if (!file_exists($contents['filename'])) {
             $contents['tables'] = array();
             $res = $db->query("SHOW TABLES LIKE '" . $db_config['prefix'] . "_%'");
             while ($item = $res->fetch(3)) {
                 $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 {
Esempio n. 20
0
    if (!empty($array_config['deny_email'])) {
        $array_config['deny_email'] = valid_name_config(explode(",", $array_config['deny_email']));
        $array_config['deny_email'] = implode("|", $array_config['deny_email']);
    }
    $sql = "UPDATE `" . NV_USERS_GLOBALTABLE . "_config` SET `content`=" . $db->dbescape($array_config['deny_email']) . ", `edit_time`=" . NV_CURRENTTIME . " WHERE `config`='deny_email'";
    $db->sql_query($sql);
    $array_config['deny_name'] = filter_text_input('deny_name', 'post', '', 1);
    if (!empty($array_config['deny_name'])) {
        $array_config['deny_name'] = valid_name_config(explode(",", $array_config['deny_name']));
        $array_config['deny_name'] = implode("|", $array_config['deny_name']);
    }
    $sql = "UPDATE `" . NV_USERS_GLOBALTABLE . "_config` SET `content`=" . $db->dbescape($array_config['deny_name']) . ", `edit_time`=" . NV_CURRENTTIME . " WHERE `config`='deny_name'";
    $db->sql_query($sql);
    nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['ChangeConfigModule'], "", $admin_info['userid']);
    nv_save_file_config_global();
    Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op . "&rand=" . nv_genpass());
    die;
}
$array_config = array();
$sql = "SELECT `config_name`, `config_value` FROM `" . NV_CONFIG_GLOBALTABLE . "` WHERE `lang`='sys' AND `module`='global' AND \n`config_name` IN ('allowmailchange','allowuserpublic','allowquestion','allowuserreg','allowloginchange','allowuserlogin','openid_mode','is_user_forum','openid_servers', 'whoviewuser')";
$result = $db->sql_query($sql);
while (list($c_config_name, $c_config_value) = $db->sql_fetchrow($result)) {
    $array_config[$c_config_name] = $c_config_value;
}
$array_config['allowmailchange'] = !empty($array_config['allowmailchange']) ? " checked=\"checked\"" : "";
$array_config['allowuserpublic'] = !empty($array_config['allowuserpublic']) ? " checked=\"checked\"" : "";
$array_config['allowquestion'] = !empty($array_config['allowquestion']) ? " checked=\"checked\"" : "";
$array_config['allowloginchange'] = !empty($array_config['allowloginchange']) ? " checked=\"checked\"" : "";
$array_config['allowuserlogin'] = !empty($array_config['allowuserlogin']) ? " checked=\"checked\"" : "";
$array_config['openid_mode'] = !empty($array_config['openid_mode']) ? " checked=\"checked\"" : "";
$array_config['is_user_forum'] = !empty($array_config['is_user_forum']) ? " checked=\"checked\"" : "";
Esempio n. 21
0
    $array_config['disable_site_content'] = $nv_Request->get_editor('disable_site_content', '', NV_ALLOWED_HTML_TAGS);
    if (empty($array_config['disable_site_content'])) {
        $array_config['disable_site_content'] = $lang_global['disable_site_content'];
    }
    $array_config['ssl_https_modules'] = $nv_Request->get_array('ssl_https_modules', 'post', array());
    $array_config['ssl_https_modules'] = array_intersect($array_config['ssl_https_modules'], array_keys($site_mods));
    $array_config['ssl_https_modules'] = empty($array_config['ssl_https_modules']) ? '' : implode(',', $array_config['ssl_https_modules']);
    $sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value= :config_value WHERE config_name = :config_name AND lang = '" . NV_LANG_DATA . "' AND module='global'");
    foreach ($array_config as $config_name => $config_value) {
        $sth->bindParam(':config_name', $config_name, PDO::PARAM_STR, 30);
        $sth->bindParam(':config_value', $config_value, PDO::PARAM_STR);
        $sth->execute();
    }
    $nv_Cache->delAll();
    if (empty($errormess)) {
        Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . ($show_ssl_modules ? '&show_ssl_modules=1' : '') . '&rand=' . nv_genpass());
        exit;
    } else {
        $sql = "SELECT module, config_name, config_value FROM " . NV_CONFIG_GLOBALTABLE . " WHERE lang='sys' OR lang='" . NV_LANG_DATA . "' ORDER BY module ASC";
        $result = $db->query($sql);
        while (list($c_module, $c_config_name, $c_config_value) = $result->fetch(3)) {
            if ($c_module == 'global') {
                $global_config[$c_config_name] = $c_config_value;
            } else {
                $module_config[$c_module][$c_config_name] = $c_config_value;
            }
        }
        $global_config['ssl_https_modules'] = empty($global_config['ssl_https_modules']) ? array() : array_intersect(array_map("trim", explode(',', $global_config['ssl_https_modules'])), array_keys($site_mods));
    }
}
$theme_array = array();
Esempio n. 22
0
<?php

/**
 * @Project NUKEVIET 4.x
 * @Author VINADES (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 04/05/2010
 */
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
if ($nv_Request->isset_request('nv_genpass', 'post')) {
    $_len = round((NV_UPASSMIN + NV_UPASSMAX) / 2);
    echo nv_genpass($_len, $global_config['nv_upass_type']);
    exit;
}
$page_title = $lang_module['user_add'];
$groups_list = nv_groups_list($module_data);
$array_field_config = array();
$result_field = $db->query('SELECT * FROM ' . NV_MOD_TABLE . '_field ORDER BY weight ASC');
while ($row_field = $result_field->fetch()) {
    $language = unserialize($row_field['language']);
    $row_field['title'] = isset($language[NV_LANG_DATA]) ? $language[NV_LANG_DATA][0] : $row['field'];
    $row_field['description'] = isset($language[NV_LANG_DATA]) ? nv_htmlspecialchars($language[NV_LANG_DATA][1]) : '';
    if (!empty($row_field['field_choices'])) {
        $row_field['field_choices'] = unserialize($row_field['field_choices']);
    } elseif (!empty($row_field['sql_choices'])) {
        $row_field['sql_choices'] = explode('|', $row_field['sql_choices']);
        $query = 'SELECT ' . $row_field['sql_choices'][2] . ', ' . $row_field['sql_choices'][3] . ' FROM ' . $row_field['sql_choices'][1];
        $result = $db->query($query);
Esempio n. 23
0
            }
        }
        $db->query('ALTER TABLE ' . NV_COUNTER_GLOBALTABLE . ' DROP ' . $deletekeylang . '_count');
        require_once NV_ROOTDIR . '/includes/action_' . $db->dbtype . '.php';
        $sql_drop_table = nv_delete_table_sys($deletekeylang);
        foreach ($sql_drop_table as $sql) {
            try {
                $db->query($sql);
            } catch (PDOException $e) {
                trigger_error($e->getMessage());
            }
        }
        $db->query("DELETE FROM " . NV_CONFIG_GLOBALTABLE . " WHERE lang = '" . $deletekeylang . "'");
        $db->query("DELETE FROM " . $db_config['prefix'] . "_setup_language WHERE lang = '" . $deletekeylang . "'");
        $nv_Cache->delAll();
        Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . $global_config['site_lang'] . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&' . NV_LANG_VARIABLE . '=' . $global_config['site_lang'] . '&rand=' . nv_genpass());
        exit;
    }
}
$a = 0;
foreach ($lang_array_exit as $keylang) {
    $delete = '';
    $allow_sitelangs = '';
    $xtpl->assign('ROW', array('keylang' => $keylang, 'name' => $language_array[$keylang]['name']));
    if (defined('NV_IS_GODADMIN') or $global_config['idsite'] > 0 and defined('NV_IS_SPADMIN')) {
        if (isset($array_lang_setup[$keylang]) and $array_lang_setup[$keylang] == 1) {
            if (!in_array($keylang, $global_config['allow_sitelangs'])) {
                $xtpl->assign('DELETE', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;deletekeylang=' . $keylang . '&amp;checksess=' . md5($keylang . session_id() . 'deletekeylang'));
                $xtpl->parse('main.loop.setup_delete');
            } else {
                $xtpl->parse('main.loop.setup_note');
Esempio n. 24
0
     include NV_ROOTDIR . '/includes/header.php';
     echo nv_site_theme($contents);
     include NV_ROOTDIR . '/includes/footer.php';
 }
 if ($global_config['allowquestion'] == 0) {
     $data['send'] = 1;
     $data['answer'] = $row['answer'];
 }
 if ($data['send']) {
     if ($data['answer'] == $row['answer']) {
         $nv_Request->unset_request('lostpass_seccode', 'session');
         $rand = rand(NV_UPASSMIN, NV_UPASSMAX);
         if ($rand < 6) {
             $rand = 6;
         }
         $password_new = nv_genpass($rand);
         $passlostkey = md5($row['userid'] . $password_new . $global_config['sitekey']);
         $k = md5($row['userid'] . $passlostkey . $global_config['sitekey']);
         $subject = sprintf($lang_module['lostpass_email_subject'], $global_config['site_name']);
         $link_lostpass_content_email = NV_MY_DOMAIN . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&u=' . $row['userid'] . '&k=' . $k;
         $row['full_name'] = nv_show_name_user($row['first_name'], $row['last_name'], $row['username']);
         $message = sprintf($lang_module['lostpass_email_content'], $row['full_name'], $global_config['site_name'], $link_lostpass_content_email, $row['username']);
         $ok = nv_sendmail($global_config['site_email'], $row['email'], $subject, $message);
         if ($ok) {
             $sql = "UPDATE " . NV_USERS_GLOBALTABLE . " SET passlostkey='" . $passlostkey . "' WHERE userid=" . $row['userid'];
             $db->query($sql);
             if (!empty($check_email)) {
                 $row['email'] = substr($row['email'], 0, 3) . '***' . substr($row['email'], -6);
             }
             $info = sprintf($lang_module['lostpass_content_mess'], $row['email']);
         } else {
Esempio n. 25
0
     die(reg_result(array('status' => 'error', 'input' => 'your_question', 'mess' => $lang_global['your_question_empty'])));
 }
 if (empty($array_register['answer'])) {
     die(reg_result(array('status' => 'error', 'input' => 'answer', 'mess' => $lang_global['answer_empty'])));
 }
 if (empty($array_register['agreecheck'])) {
     die(reg_result(array('status' => 'error', 'input' => 'agreecheck', 'mess' => $lang_global['agreecheck_empty'])));
 }
 $query_field = array('userid' => 0);
 if (!empty($array_field_config)) {
     $userid = 0;
     require NV_ROOTDIR . '/modules/users/fields.check.php';
 }
 $password = $crypt->hash_password($array_register['password'], $global_config['hashprefix']);
 $your_question = !empty($array_register['your_question']) ? $array_register['your_question'] : $data_questions[$array_register['question']]['title'];
 $checknum = nv_genpass(10);
 $checknum = md5($checknum);
 if (empty($array_register['first_name'])) {
     $array_register['first_name'] = $array_register['username'];
 }
 if ($global_config['allowuserreg'] == 2 or $global_config['allowuserreg'] == 3) {
     $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . "_reg (username, md5username, password, email, first_name, last_name, regdate, question, answer, checknum, users_info) VALUES (\n\t\t\t:username,\n\t\t\t:md5username,\n\t\t\t:password,\n\t\t\t:email,\n\t\t\t:first_name,\n\t\t\t:last_name,\n\t\t\t" . NV_CURRENTTIME . ",\n\t\t\t:your_question,\n\t\t\t:answer,\n\t\t\t:checknum,\n\t\t\t:users_info\n\t\t)";
     $data_insert = array();
     $data_insert['username'] = $array_register['username'];
     $data_insert['md5username'] = nv_md5safe($array_register['username']);
     $data_insert['password'] = $password;
     $data_insert['email'] = $array_register['email'];
     $data_insert['first_name'] = $array_register['first_name'];
     $data_insert['last_name'] = $array_register['last_name'];
     $data_insert['your_question'] = $your_question;
     $data_insert['answer'] = $array_register['answer'];
Esempio n. 26
0
                $client = array('login' => $login, 'checknum' => $checknum, 'current_agent' => $agent, 'last_agent' => $row['last_agent'], 'current_ip' => $client_info['ip'], 'last_ip' => $row['last_ip'], 'current_login' => $current_login, 'last_login' => intval($row['last_login']));
                $client = serialize($client);
                $nv_Request->set_Cookie('bncl', $client, NV_LIVE_COOKIE_TIME);
                echo "OK";
                exit;
            }
        }
    }
}
$contents = array();
$contents['client_info'] = sprintf($lang_module['client_info'], NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=contact");
$contents['login'] = $lang_module['login'];
$contents['login_input_name'] = "lg_iavim";
$contents['login_input_maxlength'] = NV_UNICKMAX;
$contents['password'] = $lang_module['password'];
$contents['pass_input_name'] = "pw_iavim";
$contents['pass_input_maxlength'] = NV_UPASSMAX;
$contents['gfx_chk'] = $global_config['gfx_chk'];
$contents['captcha'] = $lang_global['securitycode'];
$contents['captcha_name'] = "seccode_iavim";
$contents['captcha_img'] = NV_BASE_SITEURL . "index.php?scaptcha=captcha&cch=" . nv_genpass(10);
$contents['captcha_maxlength'] = NV_GFX_NUM;
$contents['captcha_refresh'] = $lang_global['captcharefresh'];
$contents['captcha_refr_src'] = NV_BASE_SITEURL . "images/refresh.png";
$contents['submit'] = $lang_global['loginsubmit'];
$contents['sm_button_name'] = "sm_button";
$contents['sm_button_onclick'] = "nv_cl_login_submit(" . NV_UNICKMAX . ", " . NV_UNICKMIN . ", " . NV_UPASSMAX . ", " . NV_UPASSMIN . ", " . NV_GFX_NUM . ", " . $global_config['gfx_chk'] . ",'lg_iavim','pw_iavim','seccode_iavim','sm_button');";
$contents = logininfo_theme($contents);
include NV_ROOTDIR . "/includes/header.php";
echo $contents;
include NV_ROOTDIR . "/includes/footer.php";
Esempio n. 27
0
 $array['w'] = $nv_Request->get_int('w', 'post', 0);
 $array['h'] = $nv_Request->get_int('h', 'post', 0);
 // Caculate crop size
 $array['avatar_width'] = intval($array['x2'] - $array['x1']);
 $array['avatar_height'] = intval($array['y2'] - $array['y1']);
 if (sizeof(array_filter(array($array['x1'], $array['y1'], $array['x2'], $array['y2'], $array['w'], $array['h']))) < 4 or $array['avatar_width'] < $global_config['avatar_width'] or $array['avatar_height'] < $global_config['avatar_height']) {
     $array['error'] = $lang_module['avata_error_data'];
 } else {
     $upload = new upload(array('images'), $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);
     // Storage in temp dir
     $upload_info = $upload->save_file($_FILES['image_file'], NV_ROOTDIR . '/' . NV_TEMP_DIR, false);
     // Delete upload tmp
     @unlink($_FILES['image_file']['tmp_name']);
     if (empty($upload_info['error'])) {
         $basename = $upload_info['basename'];
         $basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', '\\1_' . nv_genpass(8) . "_" . $user_info['userid'] . '\\2', $basename);
         $image = new image($upload_info['name'], NV_MAX_WIDTH, NV_MAX_HEIGHT);
         // Resize image, crop image
         $image->resizeXY($array['w'], $array['h']);
         $image->cropFromLeft($array['x1'], $array['y1'], $array['avatar_width'], $array['avatar_height']);
         $image->resizeXY($global_config['avatar_width'], $global_config['avatar_height']);
         // Save new image
         $image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
         $image->close();
         if (file_exists($image->create_Image_info['src'])) {
             $array['success'] = true;
             $array['filename'] = str_replace(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/', '', $image->create_Image_info['src']);
         } else {
             $array['error'] = $lang_module['avata_error_save'];
         }
         @nv_deletefile($upload_info['name']);
    }
    return $dir_array;
}
if ($nv_Request->isset_request('op', 'post')) {
    require_once NV_ROOTDIR . '/includes/class/pclzip.class.php';
    $themename = $nv_Request->get_string('themename', 'post');
    $modulename = $nv_Request->get_string('modulename', 'post');
    $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 . "&amp;" . NV_OP_VARIABLE . "=getfile&amp;mod=nv3_theme_" . $themename . "_" . $modulename . ".zip&amp;checkss=" . md5($file_name . $client_info['session_id'] . $global_config['sitekey']) . "&amp;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 . "'/>";
Esempio n. 29
0
        $endtime = 0;
    }
    $notice = filter_text_input('notice', 'post', '', 1);
    if (empty($error)) {
        if ($cid > 0) {
            $db->sql_query("UPDATE `" . $db_config['prefix'] . "_banip` SET `ip`=" . $db->dbescape($ip) . ", `mask`=" . $db->dbescape($mask) . ",`area`=" . $area . ",`begintime`=" . $begintime . ", `endtime`=" . $endtime . ", `notice`=" . $db->dbescape($notice) . "  WHERE `id`=" . $cid . "");
        } else {
            $db->sql_query("REPLACE INTO `" . $db_config['prefix'] . "_banip` VALUES (NULL, " . $db->dbescape($ip) . "," . $db->dbescape($mask) . ",{$area},{$begintime}, {$endtime}," . $db->dbescape($notice) . " )");
        }
        $save = nv_save_file_banip();
        if ($save !== true) {
            $xtpl->assign('MESSAGE', sprintf($lang_module['banip_error_write'], NV_DATADIR, NV_DATADIR));
            $xtpl->assign('CODE', str_replace(array("\n", "\t"), array("<br />", "&nbsp;&nbsp;&nbsp;&nbsp;"), nv_htmlspecialchars($save)));
            $xtpl->parse('main.manual_save');
        } else {
            Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&rand=' . nv_genpass());
            die;
        }
    } else {
        $xtpl->assign('ERROR', implode('<br/>', $error));
        $xtpl->parse('main.error');
    }
} else {
    $id = $ip = $mask = $area = $begintime = $endtime = $notice = '';
}
$mask_text_array = array();
$mask_text_array[0] = "255.255.255.255";
$mask_text_array[3] = "255.255.255.xxx";
$mask_text_array[2] = "255.255.xxx.xxx";
$mask_text_array[1] = "255.xxx.xxx.xxx";
$banip_area_array = array();
Esempio n. 30
0
// Ket noi ngon ngu
if (file_exists(NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_seotools.php';
} elseif (file_exists(NV_ROOTDIR . '/includes/language/' . NV_LANG_DATA . '/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/' . NV_LANG_DATA . '/admin_seotools.php';
} elseif (file_exists(NV_ROOTDIR . '/includes/language/en/admin_seotools.php')) {
    require NV_ROOTDIR . '/includes/language/en/admin_seotools.php';
}
$page_title = $lang_module['rpc'];
if (nv_function_exists("curl_init") and nv_function_exists("curl_exec")) {
    $id = $nv_Request->get_int('id', 'post,get', '');
    if ($id > 0) {
        $query = $db->query("SELECT * FROM " . NV_PREFIXLANG . "_" . $module_data . "_rows WHERE id = " . $id);
        $news_contents = $query->fetch();
        $nv_redirect = NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name;
        $nv_redirect2 = NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op . "&id=" . $id . "&checkss=" . md5($id . $global_config['sitekey'] . session_id()) . "&rand=" . nv_genpass();
        $prcservice = isset($module_config['seotools']['prcservice']) ? $module_config['seotools']['prcservice'] : "";
        $prcservice = !empty($prcservice) ? explode(',', $prcservice) : array();
        if ($news_contents['id'] > 0 and !empty($prcservice)) {
            if ($news_contents['status'] == 1 and $news_contents['publtime'] < NV_CURRENTTIME + 1 and ($news_contents['exptime'] == 0 or $news_contents['exptime'] > NV_CURRENTTIME + 1)) {
                if ($nv_Request->get_string('checkss', 'post,get', '') == md5($id . $global_config['sitekey'] . session_id())) {
                    $services_active = array();
                    require NV_ROOTDIR . '/' . NV_DATADIR . '/rpc_services.php';
                    foreach ($services as $key => $service) {
                        if (in_array($service[1], $prcservice)) {
                            $services_active[] = $service;
                        }
                    }
                    $getdata = $nv_Request->get_int('getdata', 'post,get', '0');
                    if (empty($getdata)) {
                        $page_title = $lang_module['rpc'] . ": " . $news_contents['title'];