/**
  * nv_message_page()
  *
  * @return
  */
 function nv_genealogy_anniversary($block_config)
 {
     global $global_config, $site_mods, $db, $module_name, $lang_block;
     $module = $block_config['module'];
     if (!isset($site_mods[$module])) {
         return '';
     }
     $is_show = false;
     $pattern = '/^' . NV_LANG_DATA . '\\_([a-zA-z0-9\\_\\-]+)\\_([0-9]+)\\_' . NV_CACHE_PREFIX . '\\.cache$/i';
     $cache_files = nv_scandir(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module, $pattern);
     $anniversary = array();
     if (($count = sizeof($cache_files)) >= 1) {
         $num = rand(1, $count);
         --$num;
         $cache_file = $cache_files[$num];
         if (($cache = nv_get_cache($module, $cache_file)) != false) {
             $cache = unserialize($cache);
             $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $cache['alias'] . $global_config['rewrite_exturl'];
             $anniversary = $cache;
             $is_show = true;
         }
     }
     if (!$is_show) {
         $date_array = getdate();
         $dd = 0;
         $mm = 0;
         $yy = 0;
         if ($dd == 0) {
             $dd = $date_array['mday'];
         }
         if ($mm == 0) {
             $mm = $date_array['mon'];
         }
         if ($yy == 0) {
             $yy = $date_array['year'];
         }
         $al = convertSolar2Lunar($dd, $mm, $yy, 7.0);
         $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status=2 AND  anniversary_mont = ' . $al[1] . ' ORDER BY rand() DESC';
         if (($query = $db->query($sql)) !== false) {
             while ($row = $query->fetch()) {
                 $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $row['alias'] . $global_config['rewrite_exturl'];
                 $anniversary[] = $row;
                 $is_show = true;
             }
         }
     }
     if ($is_show) {
         if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/genealogy/block.anniversary.tpl')) {
             $block_theme = $global_config['module_theme'];
         } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/genealogy/block.anniversary.tpl')) {
             $block_theme = $global_config['site_theme'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block.anniversary.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/genealogy');
         $xtpl->assign('LINK', $link);
         $xtpl->assign('LANG', $lang_block);
         $xtpl->assign('MONT', $al[1]);
         $i = 0;
         $n = count($anniversary);
         foreach ($anniversary as $anniversary_i) {
             $i++;
             $xtpl->assign('ANNIVERSARY', $anniversary_i);
             if ($i < $n) {
                 $xtpl->parse('main.anniversary.comma');
             }
             $xtpl->parse('main.anniversary');
             $xtpl->parse('main.anniversary_list');
         }
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
     return '';
 }
/**
 * nv_delete_cache()
 * 
 * @param mixed $pattern
 * @return
 */
function nv_delete_cache($pattern)
{
    $files = nv_scandir(NV_ROOTDIR . "/" . NV_CACHEDIR, $pattern);
    if (!empty($files)) {
        foreach ($files as $f) {
            nv_deletefile(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $f, true);
        }
    }
}
 /**
  * nv_message_about()
  * 
  * @return
  */
 function nv_message_about()
 {
     global $global_config, $site_mods, $db, $module_name;
     if (!isset($site_mods['about'])) {
         return "";
     }
     if ($module_name == 'about') {
         return "";
     }
     $is_show = false;
     $pattern = "/^" . NV_LANG_DATA . "\\_about\\_([0-9]+)\\_" . NV_CACHE_PREFIX . "\\.cache\$/i";
     $cache_files = nv_scandir(NV_ROOTDIR . "/" . NV_CACHEDIR, $pattern);
     if (($count = count($cache_files)) >= 1) {
         $num = rand(1, $count);
         $num--;
         $cache_file = $cache_files[$num];
         if (($cache = nv_get_cache($cache_file)) != false) {
             $cache = unserialize($cache);
             $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=about&amp;" . NV_OP_VARIABLE . "=" . $cache['alias'];
             $title = $cache['page_title'];
             $bodytext = strip_tags($cache['contents']);
             $bodytext = nv_clean60($bodytext, 300);
             $is_show = true;
         }
     }
     if (!$is_show) {
         $sql = "SELECT `id`,`title`,`alias`,`bodytext`,`keywords`,`add_time`,`edit_time` FROM `" . NV_PREFIXLANG . "_" . $site_mods['about']['module_data'] . "` ORDER BY rand() DESC LIMIT 1";
         if (($query = $db->sql_query($sql)) !== false) {
             if (($row = $db->sql_fetchrow($query)) !== false) {
                 $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=about&amp;" . NV_OP_VARIABLE . "=" . $row['alias'];
                 $title = $row['title'];
                 $bodytext = $row['bodytext'];
                 //$bodytext = strip_tags( $row['bodytext'] );
                 $bodytext = nv_clean60($bodytext, 300);
                 $is_show = true;
             }
         }
     }
     if ($is_show) {
         if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/blocks/global.about.tpl")) {
             $block_theme = $global_config['module_theme'];
         } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/blocks/global.about.tpl")) {
             $block_theme = $global_config['site_theme'];
         } else {
             $block_theme = "default";
         }
         $xtpl = new XTemplate("global.about.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks");
         $xtpl->assign('LINK', $link);
         $xtpl->assign('TITLE', $title);
         $xtpl->assign('BODYTEXT', $bodytext);
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
     return "";
 }
Esempio n. 4
0
 /**
  * nv_message_page()
  *
  * @return
  */
 function nv_message_page($block_config)
 {
     global $global_config, $site_mods, $db, $module_name;
     $module = $block_config['module'];
     if (!isset($site_mods[$module])) {
         return '';
     }
     if ($module_name == $module) {
         return '';
     }
     $is_show = false;
     $pattern = '/^' . NV_LANG_DATA . '\\_([a-zA-z0-9\\_\\-]+)\\_([0-9]+)\\_' . NV_CACHE_PREFIX . '\\.cache$/i';
     $cache_files = nv_scandir(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module, $pattern);
     if (($count = sizeof($cache_files)) >= 1) {
         $num = rand(1, $count);
         --$num;
         $cache_file = $cache_files[$num];
         if (($cache = nv_get_cache($module, $cache_file)) != false) {
             $cache = unserialize($cache);
             $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $cache['alias'] . $global_config['rewrite_exturl'];
             $title = $cache['page_title'];
             $bodytext = strip_tags($cache['bodytext']);
             $is_show = true;
         }
     }
     if (!$is_show) {
         $sql = 'SELECT id,title,alias,bodytext,keywords,add_time,edit_time FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status=1 ORDER BY rand() DESC';
         if (($query = $db->query($sql)) !== false) {
             if (($row = $query->fetch()) !== false) {
                 $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $row['alias'] . $global_config['rewrite_exturl'];
                 $title = $row['title'];
                 $bodytext = strip_tags($row['bodytext']);
                 $bodytext = nv_clean60($bodytext, 300);
                 $is_show = true;
             }
         }
     }
     if ($is_show) {
         if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/page/block.about.tpl')) {
             $block_theme = $global_config['module_theme'];
         } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/page/block.about.tpl')) {
             $block_theme = $global_config['site_theme'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block.about.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/page');
         $xtpl->assign('LINK', $link);
         $xtpl->assign('TITLE', $title);
         $xtpl->assign('BODYTEXT', $bodytext);
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
     return '';
 }
Esempio n. 5
0
/**
 * LoadModulesSearch()
 * 
 * @return
 */
function LoadModulesSearch()
{
    global $site_mods, $global_config;
    $pathmodule = NV_ROOTDIR . "/modules";
    $folder = nv_scandir($pathmodule, $global_config['check_module']);
    $arrayfolder = array();
    foreach ($site_mods as $mod => $arr_mod) {
        $pathserch = $pathmodule . "/" . $arr_mod['module_file'] . "/search.php";
        if (file_exists($pathserch)) {
            $arrayfolder[$mod] = array("module_name" => $mod, "module_file" => $arr_mod['module_file'], "module_data" => $arr_mod['module_data'], "custom_title" => $arr_mod['custom_title']);
        }
    }
    return $arrayfolder;
}
function cron_del_ip_logs()
{
    $dir = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ip_logs';
    $files = nv_scandir($dir, "/^([0-9]+)\\." . NV_LOGS_EXT . "\$/");
    $result = true;
    if (!empty($files)) {
        foreach ($files as $file) {
            if (filemtime($dir . '/' . $file) + 7200 < NV_CURRENTTIME) {
                if (!@unlink($dir . '/' . $file)) {
                    $result = false;
                }
            }
            clearstatcache();
        }
    }
    return $result;
}
function cron_auto_del_temp_download()
{
    $dir = NV_ROOTDIR . "/" . NV_TEMP_DIR;
    $files = nv_scandir($dir, "/^(" . nv_preg_quote(NV_TEMPNAM_PREFIX) . ")[a-zA-Z0-9\\_\\.]+\$/");
    $result = true;
    if (!empty($files)) {
        foreach ($files as $file) {
            if (filemtime($dir . '/' . $file) + 600 < NV_CURRENTTIME) {
                if (!@unlink($dir . '/' . $file)) {
                    $result = false;
                }
            }
            clearstatcache();
        }
    }
    return $result;
}
Esempio n. 8
0
/**
 * nv_CreateXML_bannerPlan()
 *
 * @return
 */
function nv_CreateXML_bannerPlan()
{
    global $db, $global_config;
    $pattern = $global_config['idsite'] ? '/^site\\_' . $global_config['idsite'] . '\\_bpl\\_([0-9]+)\\.xml$/' : '/^bpl\\_([0-9]+)\\.xml$/';
    $files = nv_scandir(NV_ROOTDIR . '/' . NV_DATADIR, $pattern);
    if (!empty($files)) {
        foreach ($files as $file) {
            nv_deletefile(NV_ROOTDIR . '/' . NV_DATADIR . '/' . $file);
        }
    }
    include NV_ROOTDIR . '/includes/class/array2xml.class.php';
    $sql = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_plans WHERE act = 1';
    $result = $db->query($sql);
    while ($row = $result->fetch()) {
        $id = intval($row['id']);
        if ($global_config['idsite']) {
            $xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_bpl_' . $id . '.xml';
        } else {
            $xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/bpl_' . $id . '.xml';
        }
        $plan = array();
        $plan['id'] = $id;
        $plan['lang'] = $row['blang'];
        $plan['title'] = $row['title'];
        if (!empty($row['description'])) {
            $plan['description'] = $row['description'];
        }
        $plan['form'] = $row['form'];
        $plan['width'] = $row['width'];
        $plan['height'] = $row['height'];
        $query2 = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_rows WHERE pid = ' . $id . ' AND (exp_time > ' . NV_CURRENTTIME . ' OR exp_time = 0 ) AND act = 1';
        if ($row['form'] == 'sequential') {
            $query2 .= ' ORDER BY weight ASC';
        }
        $plan['banners'] = array();
        $result2 = $db->query($query2);
        while ($row2 = $result2->fetch()) {
            $plan['banners'][] = array('id' => $row2['id'], 'title' => $row2['title'], 'clid' => $row2['clid'], 'file_name' => $row2['file_name'], 'imageforswf' => $row2['imageforswf'], 'file_ext' => $row2['file_ext'], 'file_mime' => $row2['file_mime'], 'file_width' => $row2['width'], 'file_height' => $row2['height'], 'file_alt' => $row2['file_alt'], 'file_click' => $row2['click_url'], 'target' => $row2['target'], 'publ_time' => $row2['publ_time'], 'exp_time' => $row2['exp_time']);
        }
        if (sizeof($plan['banners'])) {
            $array2XML = new Array2XML();
            $array2XML->saveXML($plan, 'plan', $xmlfile, $encoding = $global_config['site_charset']);
        }
    }
}
Esempio n. 9
0
/**
 * nv_CreateXML_bannerPlan()
 * 
 * @return
 */
function nv_CreateXML_bannerPlan()
{
    global $db, $global_config;
    $files = nv_scandir(NV_ROOTDIR . '/' . NV_DATADIR, "/^bpl\\_([0-9]+)\\.xml\$/");
    if (!empty($files)) {
        foreach ($files as $file) {
            nv_deletefile(NV_ROOTDIR . '/' . NV_DATADIR . '/' . $file);
        }
    }
    include NV_ROOTDIR . '/includes/class/array2xml.class.php';
    $sql = "SELECT * FROM `" . NV_BANNERS_PLANS_GLOBALTABLE . "` WHERE `act` = 1";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $id = intval($row['id']);
        $xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/bpl_' . $id . '.xml';
        $plan = array();
        $plan['id'] = $id;
        $plan['lang'] = $row['blang'];
        $plan['title'] = $row['title'];
        if (!empty($row['description'])) {
            $plan['description'] = $row['description'];
        }
        $plan['form'] = $row['form'];
        $plan['width'] = $row['width'];
        $plan['height'] = $row['height'];
        $query2 = "SELECT * FROM `" . NV_BANNERS_ROWS_GLOBALTABLE . "` WHERE `pid` = " . $id . " AND (`exp_time` > " . NV_CURRENTTIME . " OR `exp_time` = 0 ) AND `act` = 1";
        if ($row['form'] == "sequential") {
            $query2 .= " ORDER BY `weight` ASC";
        }
        $result2 = $db->sql_query($query2);
        $numrows2 = $db->sql_numrows($result2);
        if (empty($numrows2)) {
            continue;
        }
        $plan['banners'] = array();
        while ($row2 = $db->sql_fetchrow($result2)) {
            $plan['banners'][] = array('id' => $row2['id'], 'title' => $row2['title'], 'clid' => $row2['clid'], 'file_name' => $row2['file_name'], 'file_ext' => $row2['file_ext'], 'file_mime' => $row2['file_mime'], 'file_width' => $row2['width'], 'file_height' => $row2['height'], 'file_alt' => $row2['file_alt'], 'file_click' => $row2['click_url']);
        }
        $array2XML = new Array2XML();
        $array2XML->saveXML($plan, 'plan', $xmlfile, $encoding = $global_config['site_charset']);
    }
}
function cron_ref_expired_del()
{
    $log_path = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ref_logs';
    if (!is_dir($log_path)) {
        @nv_mkdir(NV_ROOTDIR . '/' . NV_LOGS_DIR, 'ref_logs', true);
    }
    $log_start = mktime(0, 0, 0, date("n", NV_CURRENTTIME), 1, date("Y", NV_CURRENTTIME));
    $logfiles = nv_scandir($log_path, "/^[0-9]{10,12}\\." . preg_quote(NV_LOGS_EXT) . "\$/");
    $result = true;
    if (!empty($logfiles)) {
        foreach ($logfiles as $logfile) {
            unset($matches);
            preg_match("/^([0-9]{10,12})\\." . preg_quote(NV_LOGS_EXT) . "\$/", $logfile, $matches);
            $d = (int) $matches[1];
            if ($d < $log_start) {
                if (!@unlink($log_path . '/' . $logfile)) {
                    $result = false;
                }
            }
        }
    }
    return $result;
}
Esempio n. 11
0
        }
    }
} else {
    $min = date('i', NV_CURRENTTIME);
    $hour = date('G', NV_CURRENTTIME);
    $start_time = NV_CURRENTTIME;
    $interval = 60;
    $cron_name = $run_file = $run_func = $params = '';
    $del = 0;
}
$contents = array();
$contents['is_error'] = !empty($error) ? 1 : 0;
$contents['title'] = !empty($error) ? $error : $lang_module['nv_admin_add_title'];
$contents['action'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=cronjobs_add';
$contents['cron_name'] = array($lang_module['cron_name'], $cron_name, 100);
$filelist = nv_scandir(NV_ROOTDIR . '/includes/cronjobs', '/^([a-zA-Z0-9\\_\\.]+)\\.php$/');
$contents['run_file'] = array($lang_module['run_file'], $lang_module['file_none'], $filelist, $run_file, $lang_module['run_file_info']);
$contents['run_func'] = array($lang_module['run_func'], $run_func, 255, $lang_module['run_func_info']);
$contents['params'] = array($lang_module['params'], $params, 255, $lang_module['params_info']);
$contents['start_time'] = array($lang_module['start_time'], $lang_module['day'], date('d/m/Y', $start_time));
$contents['min'] = array($lang_module['min'], $min);
$contents['hour'] = array($lang_module['hour'], $hour);
$contents['interval'] = array($lang_module['interval'], $interval, 11, $lang_module['min'], $lang_module['interval_info']);
$contents['del'] = array($lang_module['is_del'], $del);
$contents['submit'] = $lang_global['submit'];
$contents = nv_admin_add_theme($contents);
$page_title = $lang_global['mod_cronjobs'] . ' -> ' . $lang_module['nv_admin_add'];
$set_active_op = 'cronjobs';
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Esempio n. 12
0
        } elseif (isset($language_array[$typelang])) {
            nv_copyfile(NV_ROOTDIR . "/js/language/" . $typelang . ".js", NV_ROOTDIR . "/js/language/" . $newslang . ".js");
            $db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "_file` SET `author_" . $newslang . "`=`author_" . $typelang . "`");
            $db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "` SET `lang_" . $newslang . "`=`lang_" . $typelang . "`");
        }
        $nv_Request->set_Cookie('dirlang', $newslang, NV_LIVE_COOKIE_TIME);
        $xtpl->assign('URL', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=interface");
        $xtpl->parse('copyok');
        $contents = $xtpl->text('copyok');
        include NV_ROOTDIR . "/includes/header.php";
        echo nv_admin_theme($contents);
        include NV_ROOTDIR . "/includes/footer.php";
    }
}
$lang_array_file = array();
$lang_array_file_temp = nv_scandir(NV_ROOTDIR . "/language", "/^[a-z]{2}+\$/");
foreach ($lang_array_file_temp as $value) {
    if (file_exists(NV_ROOTDIR . "/language/" . $value . "/global.php")) {
        $lang_array_file[] = $value;
    }
}
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('OP', $op);
$xtpl->assign('CHECKSESS', md5(session_id()));
foreach ($language_array as $key => $value) {
    if (!in_array($key, $array_lang_exit) and !in_array($key, $lang_array_file)) {
        $xtpl->assign('NEWSLANG', array('key' => $key, 'title' => $value['name']));
        $xtpl->parse('main.newslang');
Esempio n. 13
0
$contents .= "<select name=\"parentid\" site=\"3\">\n";
if ($parentid == 0) {
    $sl = " selected=\"selected\"";
}
$sl = "";
$contents .= "<option value=\"0\" " . $sl . ">" . $lang_module['cat_sub_sl'] . "</option>\n";
foreach ($array_cat as $catid_i => $array_cat_i) {
    if ($catid_i == $parentid) {
        $sl = " selected=\"selected\"";
    }
    $contents .= "<option value=\"" . $catid_i . "\" " . $sl . ">" . $array_cat_i['title'] . "</option>\n";
}
$contents .= "</select>\n";
$contents .= "</td>";
$contents .= "</tr>";
$filelist = nv_scandir(NV_ROOTDIR . "/uploads/{$module_name}/cat", "/^([a-zA-Z0-9\\-\\_]+)\\.(jpg|gif)\$/");
$contents .= "<tr>";
$contents .= "<td align=\"right\"><strong>" . $lang_module['weblink_fileimage'] . ": </strong></td>\n";
$contents .= "<td>";
$contents .= "<div style='float:left'>";
$contents .= "<select name=\"catimage\" id='catimage'>\n";
foreach ($filelist as $image) {
    $selected = $catimage == $image ? ' selected' : '';
    $contents .= "<option value=\"" . $image . "\" " . $selected . ">" . $image . "</option>\n";
}
$contents .= "</select>\n";
$contents .= "</div>\n";
$contents .= "<div style='float:left;padding-left:30px' id='preview'></div>";
//show preview
$contents .= '
<script>
Esempio n. 14
0
}
$array_site_cat_module = array();
if ($global_config['idsite']) {
    $_module = $db->query('SELECT module FROM ' . $db_config['dbsystem'] . '.' . $db_config['prefix'] . '_site_cat t1 INNER JOIN ' . $db_config['dbsystem'] . '.' . $db_config['prefix'] . '_site t2 ON t1.cid=t2.cid WHERE t2.idsite=' . $global_config['idsite'])->fetchColumn();
    if (!empty($_module)) {
        $array_site_cat_module = explode(',', $_module);
    }
}
$title = $note = $modfile = $error = '';
$modules_site = nv_scandir(NV_ROOTDIR . '/modules', $global_config['check_module']);
if ($nv_Request->get_title('checkss', 'post') == NV_CHECK_SESSION) {
    $title = $nv_Request->get_title('title', 'post', '', 1);
    $modfile = $nv_Request->get_title('module_file', 'post', '', 1);
    $note = $nv_Request->get_title('note', 'post', '', 1);
    $title = strtolower(change_alias($title));
    $modules_admin = nv_scandir(NV_ROOTDIR . '/' . NV_ADMINDIR, $global_config['check_module']);
    $error = $lang_module['vmodule_exit'];
    if (!empty($title) and !empty($modfile) and !in_array($title, $modules_site) and !in_array($title, $modules_admin) and preg_match($global_config['check_module'], $title) and preg_match($global_config['check_module'], $modfile)) {
        $version = '';
        $author = '';
        $note = nv_nl2br($note, '<br />');
        $module_data = preg_replace('/(\\W+)/i', '_', $title);
        if (empty($array_site_cat_module) or in_array($modfile, $array_site_cat_module)) {
            try {
                $sth = $db->prepare('INSERT INTO ' . $db_config['prefix'] . '_setup_extensions (type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES ( \'module\', :title, 0, 0, :basename, :table_prefix, :version, ' . NV_CURRENTTIME . ', :author, :note)');
                $sth->bindParam(':title', $title, PDO::PARAM_STR);
                $sth->bindParam(':basename', $modfile, PDO::PARAM_STR);
                $sth->bindParam(':table_prefix', $module_data, PDO::PARAM_STR);
                $sth->bindParam(':version', $version, PDO::PARAM_STR);
                $sth->bindParam(':author', $author, PDO::PARAM_STR);
                $sth->bindParam(':note', $note, PDO::PARAM_STR);
Esempio n. 15
0
/**
 * nv_save_file_config_global()
 *
 * @return
 */
function nv_save_file_config_global()
{
    global $db, $sys_info, $global_config, $db_config;
    if ($global_config['idsite']) {
        return false;
    }
    $content_config = "<?php" . "\n\n";
    $content_config .= NV_FILEHEAD . "\n\n";
    $content_config .= "if ( ! defined( 'NV_MAINFILE' ) ) die( 'Stop!!!' );\n\n";
    //disable_classes
    $sys_info['disable_classes'] = (($disable_classes = ini_get('disable_classes')) != '' and $disable_classes != false) ? array_map('trim', preg_split("/[\\s,]+/", $disable_classes)) : array();
    if (!empty($sys_info['disable_classes'])) {
        $disable_classes = "'" . implode("','", $sys_info['disable_classes']) . "'";
    } else {
        $disable_classes = '';
    }
    $content_config .= "\$sys_info['disable_classes']=array(" . $disable_classes . ");\n";
    //disable_functions
    $sys_info['disable_functions'] = (($disable_functions = ini_get('disable_functions')) != '' and $disable_functions != false) ? array_map('trim', preg_split("/[\\s,]+/", $disable_functions)) : array();
    if (extension_loaded('suhosin')) {
        $sys_info['disable_functions'] = array_merge($sys_info['disable_functions'], array_map('trim', preg_split("/[\\s,]+/", ini_get('suhosin.executor.func.blacklist'))));
    }
    if (!empty($sys_info['disable_functions'])) {
        $disable_functions = "'" . implode("','", $sys_info['disable_functions']) . "'";
    } else {
        $disable_functions = '';
    }
    $content_config .= "\$sys_info['disable_functions']=array(" . $disable_functions . ");\n";
    //ini_set_support
    $sys_info['ini_set_support'] = (function_exists('ini_set') and !in_array('ini_set', $sys_info['disable_functions'])) ? true : false;
    $ini_set_support = $sys_info['ini_set_support'] ? 'true' : 'false';
    $content_config .= "\$sys_info['ini_set_support']= " . $ini_set_support . ";\n";
    //Kiem tra ho tro rewrite
    if (function_exists('apache_get_modules')) {
        $apache_modules = apache_get_modules();
        if (in_array('mod_rewrite', $apache_modules)) {
            $sys_info['supports_rewrite'] = 'rewrite_mode_apache';
        } else {
            $sys_info['supports_rewrite'] = false;
        }
    } elseif (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false) {
        if (isset($_SERVER['IIS_UrlRewriteModule']) and class_exists('DOMDocument')) {
            $sys_info['supports_rewrite'] = 'rewrite_mode_iis';
        } else {
            $sys_info['supports_rewrite'] = false;
        }
    }
    if ($sys_info['supports_rewrite'] == 'rewrite_mode_iis' or $sys_info['supports_rewrite'] == 'rewrite_mode_apache') {
        $content_config .= "\$sys_info['supports_rewrite']='" . $sys_info['supports_rewrite'] . "';\n";
    } else {
        $content_config .= "\$sys_info['supports_rewrite']=false;\n";
    }
    $content_config .= "\n";
    $config_variable = array();
    $allowed_html_tags = '';
    $sql = "SELECT module, config_name, config_value FROM " . NV_CONFIG_GLOBALTABLE . " WHERE lang='sys' AND (module='global' OR module='define') ORDER BY config_name ASC";
    $result = $db->query($sql);
    while (list($c_module, $c_config_name, $c_config_value) = $result->fetch(3)) {
        if ($c_module == 'define') {
            if (preg_match('/^\\d+$/', $c_config_value)) {
                $content_config .= "define('" . strtoupper($c_config_name) . "', " . $c_config_value . ");\n";
            } else {
                $content_config .= "define('" . strtoupper($c_config_name) . "', '" . $c_config_value . "');\n";
            }
            if ($c_config_name == 'nv_allowed_html_tags') {
                $allowed_html_tags = $c_config_value;
            }
        } else {
            $config_variable[$c_config_name] = $c_config_value;
        }
    }
    $nv_eol = strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '"\\r\\n"' : (strtoupper(substr(PHP_OS, 0, 3) == 'MAC') ? '"\\r"' : '"\\n"');
    $upload_max_filesize = min(nv_converttoBytes(ini_get('upload_max_filesize')), nv_converttoBytes(ini_get('post_max_size')), $config_variable['nv_max_size']);
    $content_config .= "define('NV_EOL', " . $nv_eol . ");\n";
    $content_config .= "define('NV_UPLOAD_MAX_FILESIZE', " . floatval($upload_max_filesize) . ");\n";
    if ($config_variable['openid_mode']) {
        $content_config .= "define('NV_OPENID_ALLOWED', true);\n\n";
    }
    $my_domains = array_map('trim', explode(',', $config_variable['my_domains']));
    $my_domains[] = NV_SERVER_NAME;
    $config_variable['my_domains'] = implode(',', array_unique($my_domains));
    $config_variable['check_rewrite_file'] = nv_check_rewrite_file();
    $config_variable['allow_request_mods'] = NV_ALLOW_REQUEST_MODS != '' ? NV_ALLOW_REQUEST_MODS : "request";
    $config_variable['request_default_mode'] = NV_REQUEST_DEFAULT_MODE != '' ? trim(NV_REQUEST_DEFAULT_MODE) : 'request';
    $config_variable['session_save_path'] = NV_SESSION_SAVE_PATH;
    $config_variable['log_errors_list'] = NV_LOG_ERRORS_LIST;
    $config_variable['display_errors_list'] = NV_DISPLAY_ERRORS_LIST;
    $config_variable['send_errors_list'] = NV_SEND_ERRORS_LIST;
    $config_variable['error_log_path'] = NV_LOGS_DIR . '/error_logs';
    $config_variable['error_log_filename'] = NV_ERRORLOGS_FILENAME;
    $config_variable['error_log_fileext'] = NV_LOGS_EXT;
    $config_variable['error_send_email'] = $config_variable['error_send_email'];
    $config_name_array = array('file_allowed_ext', 'forbid_extensions', 'forbid_mimes', 'allow_sitelangs', 'openid_servers', 'allow_request_mods', 'config_sso');
    if (empty($config_variable['openid_servers'])) {
        $config_variable['openid_mode'] = 0;
    }
    if ($config_variable['is_user_forum']) {
        $forum_files = @scandir(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet');
        if (!empty($forum_files) and in_array('is_user.php', $forum_files) and in_array('changepass.php', $forum_files) and in_array('editinfo.php', $forum_files) and in_array('login.php', $forum_files) and in_array('logout.php', $forum_files) and in_array('lostpass.php', $forum_files) and in_array('register.php', $forum_files)) {
            $content_config .= "define( 'NV_IS_USER_FORUM', true );\n\n";
        } else {
            $config_variable['is_user_forum'] = 0;
        }
    }
    foreach ($config_variable as $c_config_name => $c_config_value) {
        if ($c_config_name == 'config_sso') {
            $config_sso = empty($c_config_value) ? '' : nv_var_export(unserialize($c_config_value));
            $content_config .= "\$global_config['" . $c_config_name . "']=" . $config_sso . ";\n";
        } elseif (in_array($c_config_name, $config_name_array)) {
            if (!empty($c_config_value)) {
                $c_config_value = "'" . implode("','", array_map("trim", explode(',', $c_config_value))) . "'";
            } else {
                $c_config_value = '';
            }
            $content_config .= "\$global_config['" . $c_config_name . "']=array(" . $c_config_value . ");\n";
        } else {
            if (preg_match('/^\\d+$/', $c_config_value) and $c_config_name != 'facebook_client_id') {
                $content_config .= "\$global_config['" . $c_config_name . "']=" . $c_config_value . ";\n";
            } else {
                $c_config_value = nv_unhtmlspecialchars($c_config_value);
                if (!preg_match("/^[a-z0-9\\-\\_\\.\\,\\;\\:\\@\\/\\s]+\$/i", $c_config_value) and $c_config_name != 'my_domains') {
                    $c_config_value = nv_htmlspecialchars($c_config_value);
                }
                $content_config .= "\$global_config['" . $c_config_name . "']='" . $c_config_value . "';\n";
            }
        }
    }
    $content_config .= "\$global_config['array_theme_type']=" . nv_var_export(array_filter(array_map('trim', explode(',', NV_THEME_TYPE)))) . ";\n";
    //allowed_html_tags
    if (!empty($allowed_html_tags)) {
        $allowed_html_tags = "'" . implode("','", array_map('trim', explode(',', $allowed_html_tags))) . "'";
    } else {
        $allowed_html_tags = '';
    }
    $content_config .= "\$global_config['allowed_html_tags']=array(" . $allowed_html_tags . ");\n";
    //Xac dinh cac search_engine
    $engine_allowed = file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml') ? nv_object2array(simplexml_load_file(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml')) : array();
    $content_config .= "\$global_config['engine_allowed']=" . nv_var_export($engine_allowed) . ";\n";
    $content_config .= "\n";
    $language_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/langs.ini', true);
    $tmp_array = array();
    $lang_array_exit = nv_scandir(NV_ROOTDIR . "/language", "/^[a-z]{2}+\$/");
    foreach ($lang_array_exit as $lang) {
        $tmp_array[$lang] = $language_array[$lang];
    }
    unset($language_array);
    $content_config .= "\$language_array=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/br.ini', true);
    $content_config .= "\$nv_parse_ini_browsers=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/mobile.ini', true);
    $content_config .= "\$nv_parse_ini_mobile=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/os.ini', true);
    $content_config .= "\$nv_parse_ini_os=" . nv_var_export($tmp_array) . ";\n";
    $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/timezone.ini', true);
    $content_config .= "\$nv_parse_ini_timezone=" . nv_var_export($tmp_array) . ";\n";
    $rewrite = array();
    $global_config['rewrite_optional'] = $config_variable['rewrite_optional'];
    $global_config['rewrite_op_mod'] = $config_variable['rewrite_op_mod'];
    $global_config['rewrite_endurl'] = $config_variable['rewrite_endurl'];
    $global_config['rewrite_exturl'] = $config_variable['rewrite_exturl'];
    if ($config_variable['check_rewrite_file']) {
        require NV_ROOTDIR . '/includes/rewrite.php';
    } else {
        require NV_ROOTDIR . '/includes/rewrite_index.php';
    }
    $content_config .= "\n";
    $nv_plugin_area = array();
    $_sql = 'SELECT * FROM ' . $db_config['prefix'] . '_plugin ORDER BY plugin_area ASC, weight ASC';
    $_query = $db->query($_sql);
    while ($row = $_query->fetch()) {
        $nv_plugin_area[$row['plugin_area']][] = $row['plugin_file'];
    }
    $content_config .= "\$nv_plugin_area=" . nv_var_export($nv_plugin_area) . ";\n\n";
    $content_config .= "\$rewrite_keys=" . nv_var_export(array_keys($rewrite)) . ";\n";
    $content_config .= "\$rewrite_values=" . nv_var_export(array_values($rewrite)) . ";\n";
    $return = file_put_contents(NV_ROOTDIR . "/" . NV_DATADIR . "/config_global.php", trim($content_config), LOCK_EX);
    nv_delete_all_cache();
    return $return;
}
Esempio n. 16
0
    $allow_files_type = array('images', 'archives');
    $allow_modify_files = $allow_create_subdirectories = $allow_modify_subdirectories = 0;
}
$page_title = $lang_module['nv_admin_add'];
$info = !empty($error) ? $error : sprintf($lang_module['nv_admin_add_info'], $row['username']);
$is_error = !empty($error) ? 1 : 0;
$mods = array();
foreach (array_keys($site_mods) as $mod) {
    $mods[$mod]['checked'] = in_array($mod, $modules) ? 1 : 0;
    $mods[$mod]['custom_title'] = $site_mods[$mod]['custom_title'];
}
$contents = array();
$contents['action'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=add&amp;userid=" . $userid;
$contents['lev'] = array($lang_module['lev'], $lev, $lang_module['level2'], $lang_module['level3']);
$editors = array();
$dirs = nv_scandir(NV_ROOTDIR . '/' . NV_EDITORSDIR, "/^[a-zA-Z0-9_]+\$/");
if (!empty($dirs)) {
    foreach ($dirs as $dir) {
        if (file_exists(NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . $dir . '/nv.php')) {
            $editors[] = $dir;
        }
    }
}
if (!empty($editors)) {
    $contents['editor'] = array($lang_module['editor'], $editors, $editor, $lang_module['not_use']);
}
if (!empty($global_config['file_allowed_ext'])) {
    $contents['allow_files_type'] = array($lang_module['allow_files_type'], $global_config['file_allowed_ext'], $allow_files_type);
}
$contents['allow_modify_files'] = array($lang_module['allow_modify_files'], $allow_modify_files);
$contents['allow_create_subdirectories'] = array($lang_module['allow_create_subdirectories'], $allow_create_subdirectories);
Esempio n. 17
0
<?php

/**
 * @Project NUKEVIET 3.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2012 VINADES.,JSC. All rights reserved
 * @Createdate 2-2-2010 12:55
 */
if (!defined('NV_IS_FILE_THEMES')) {
    die('Stop!!!');
}
$select_options = array();
$theme_array = nv_scandir(NV_ROOTDIR . "/themes", array($global_config['check_theme'], $global_config['check_theme_mobile']));
if (!defined('SHADOWBOX')) {
    $my_head = "<link type=\"text/css\" rel=\"Stylesheet\" href=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.css\" />\n";
    $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.js\"></script>\n";
    $my_head .= "<script type=\"text/javascript\">Shadowbox.init();</script>";
    define('SHADOWBOX', true);
}
foreach ($theme_array as $themes_i) {
    if (file_exists(NV_ROOTDIR . '/themes/' . $themes_i . '/config.ini')) {
        $select_options[NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=blocks&amp;selectthemes=" . $themes_i] = $themes_i;
    }
}
$selectthemes_old = $nv_Request->get_string('selectthemes', 'cookie', $global_config['site_theme']);
$selectthemes = $nv_Request->get_string('selectthemes', 'get', $selectthemes_old);
if (!in_array($selectthemes, $theme_array)) {
    $selectthemes = $global_config['site_theme'];
}
if ($selectthemes_old != $selectthemes) {
    $nv_Request->set_Cookie('selectthemes', $selectthemes, NV_LIVE_COOKIE_TIME);
Esempio n. 18
0
        $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();
$theme_array_file = nv_scandir(NV_ROOTDIR . '/themes', $global_config['check_theme']);
$mobile_theme_array = array();
$mobile_theme_array_file = nv_scandir(NV_ROOTDIR . '/themes', $global_config['check_theme_mobile']);
$sql = 'SELECT DISTINCT theme FROM ' . NV_PREFIXLANG . '_modthemes WHERE func_id=0';
$result = $db->query($sql);
while (list($theme) = $result->fetch(3)) {
    if (in_array($theme, $theme_array_file)) {
        $theme_array[] = $theme;
    } elseif (in_array($theme, $mobile_theme_array_file)) {
        $mobile_theme_array[] = $theme;
    }
}
$global_config['switch_mobi_des'] = !empty($global_config['switch_mobi_des']) ? ' checked="checked"' : '';
$site_logo = '';
if (!empty($global_config['site_logo']) and $global_config['site_logo'] != NV_ASSETS_DIR . '/images/logo.png' and !nv_is_url($global_config['site_logo']) and file_exists(NV_ROOTDIR . '/' . $global_config['site_logo'])) {
    $site_logo = NV_BASE_SITEURL . $global_config['site_logo'];
}
$site_banner = '';
Esempio n. 19
0
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 3/12/2010 22:1
 */
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
$id = $nv_Request->get_int('id', 'get', 0);
$query = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_plans WHERE id=' . $id;
$row = $db->query($query)->fetch();
if (empty($row)) {
    Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name);
    die;
}
$forms = nv_scandir(NV_ROOTDIR . '/modules/' . $module_name . '/forms', '/^form\\_([a-zA-Z0-9\\_\\-]+)\\.php$/');
$forms = preg_replace('/^form\\_([a-zA-Z0-9\\_\\-]+)\\.php$/', '\\1', $forms);
$error = '';
if ($nv_Request->get_int('save', 'post') == '1') {
    $blang = strip_tags($nv_Request->get_string('blang', 'post', ''));
    if (!empty($blang) and !in_array($blang, $global_config['allow_sitelangs'])) {
        $blang = '';
    }
    $title = nv_htmlspecialchars(strip_tags($nv_Request->get_string('title', 'post', '')));
    $description = defined('NV_EDITOR') ? $nv_Request->get_string('description', 'post', '') : strip_tags($nv_Request->get_string('description', 'post', ''));
    $form = $nv_Request->get_string('form', 'post', 'sequential');
    if (!in_array($form, $forms)) {
        $form = 'sequential';
    }
    $width = $nv_Request->get_int('width', 'post', 0);
    $height = $nv_Request->get_int('height', 'post', 0);
Esempio n. 20
0
}
$mod = filter_text_input('mod', 'get');
if (empty($mod) or !preg_match($global_config['check_module'], $mod)) {
    Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name);
    die;
}
$query = "SELECT * FROM `" . NV_MODULES_TABLE . "` WHERE `title`=" . $db->dbescape($mod);
$result = $db->sql_query($query);
$numrows = $db->sql_numrows($result);
if ($numrows != 1) {
    Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name);
    die;
}
$row = $db->sql_fetchrow($result);
$theme_list = array();
$theme_array_file = nv_scandir(NV_ROOTDIR . "/themes", $global_config['check_theme']);
$theme_array_file = array_flip($theme_array_file);
$theme_array_file = array_keys($theme_array_file);
$sql = "SELECT DISTINCT `theme` FROM `" . NV_PREFIXLANG . "_modthemes`  WHERE `func_id`=0";
$result = $db->sql_query($sql);
while (list($theme) = $db->sql_fetchrow($result)) {
    if (in_array($theme, $theme_array_file)) {
        $theme_list[] = $theme;
    }
}
$groups_list = nv_groups_list();
if ($nv_Request->get_int('save', 'post') == '1') {
    nv_insert_logs(NV_LANG_DATA, $module_name, 'log_edit_modul', "module  " . $mod, $admin_info['userid']);
    $custom_title = filter_text_input('custom_title', 'post', 1);
    $theme = filter_text_input('theme', 'post', '', 1);
    $keywords = filter_text_input('keywords', 'post', '', 1);
Esempio n. 21
0
}
// Kiem tra ton tai goi update
if (!file_exists(NV_ROOTDIR . '/install/update_data.php')) {
    Header('Location:' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA));
    die;
}
require NV_ROOTDIR . '/install/update_data.php';
if (empty($nv_update_config)) {
    Header('Location:' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA));
    die;
}
// Ham cua admin
define('NV_ADMIN', true);
include_once NV_ROOTDIR . '/includes/core/admin_functions.php';
// Xac dinh ngon ngu cap nhat
$dirs = nv_scandir(NV_ROOTDIR . '/includes/language', '/^([a-z]{2})/');
$languageslist = array();
foreach ($dirs as $file) {
    if (is_file(NV_ROOTDIR . '/includes/language/' . $file . '/install.php')) {
        $languageslist[] = $file;
    }
}
$data_update_lang = array_keys($nv_update_config['lang']);
$array_lang_update = array_intersect($data_update_lang, $languageslist);
$nv_update_config['allow_lang'] = $array_lang_update;
$cookie_lang = $nv_Request->get_string('update_lang', 'cookie', '');
$update_lang = $nv_Request->get_string(NV_LANG_VARIABLE, 'get,post', '');
if (!empty($update_lang) and in_array($update_lang, $array_lang_update) and file_exists(NV_ROOTDIR . '/includes/language/' . $update_lang . '/global.php')) {
    if ($update_lang != $cookie_lang) {
        $nv_Request->set_Cookie('update_lang', $update_lang, NV_LIVE_COOKIE_TIME);
    }
Esempio n. 22
0
 */
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
$page_title = $lang_module['setup_payment'];
$array_setting_payment = array();
// Load config template payment port in data
$sql = "SELECT * FROM " . $db_config['prefix'] . "_" . $module_data . "_payment ORDER BY weight ASC";
$result = $db->query($sql);
$num_items = $result->rowCount();
while ($row = $result->fetch()) {
    $array_setting_payment[$row['payment']] = $row;
}
// Load config template payment port in file
$check_config_payment = "/^([a-zA-Z0-9\\-\\_]+)\\.config\\.ini\$/";
$payment_funcs = nv_scandir(NV_ROOTDIR . '/modules/' . $module_file . '/payment', $check_config_payment);
if (!empty($payment_funcs)) {
    $payment_funcs = preg_replace($check_config_payment, "\\1", $payment_funcs);
}
$array_setting_payment_key = array_keys($array_setting_payment);
$array_payment_other = array();
foreach ($payment_funcs as $payment) {
    $xml = simplexml_load_file(NV_ROOTDIR . '/modules/' . $module_file . '/payment/' . $payment . '.config.ini');
    if ($xml !== false) {
        $xmlconfig = $xml->xpath('config');
        $config = $xmlconfig[0];
        $array_config = array();
        $array_config_title = array();
        foreach ($config as $key => $value) {
            $config_lang = $value->attributes();
            if (isset($config_lang[NV_LANG_INTERFACE])) {
Esempio n. 23
0
$xmlpositions = $xml->xpath('positions');
$positions = $xmlpositions[0]->position;
if ($row['bid'] != 0) {
    $xtpl->parse('main.block_group_notice');
}
$xtpl->assign('SELECTTHEMES', $selectthemes);
$xtpl->assign('BLOCKREDIRECT', $blockredirect);
$xtpl->assign('THEME_SELECTED', $row['module'] == 'theme' ? ' selected="selected"' : '');
$sql = 'SELECT title, custom_title FROM ' . NV_MODULES_TABLE . ' ORDER BY weight ASC';
$result = $db->query($sql);
while ($row_i = $result->fetch()) {
    $xtpl->assign('MODULE', array('key' => $row_i['title'], 'selected' => $row_i['title'] == $row['module'] ? ' selected="selected"' : '', 'title' => $row_i['custom_title']));
    $xtpl->parse('main.module');
}
$xtpl->assign('ROW', array('title' => $row['title'], 'exp_time' => $row['exp_time'] > 0 ? date('d/m/Y', $row['exp_time']) : '', 'block_active' => intval($row['active']) == 1 ? ' checked="checked"' : '', 'link' => $row['link'], 'bid' => $row['bid'], 'module' => $row['module'], 'file_name' => $row['file_name']));
$templ_list = nv_scandir(NV_ROOTDIR . '/themes/' . $selectthemes . '/layout', '/^block\\.([a-zA-Z0-9\\-\\_]+)\\.tpl$/');
$templ_list = preg_replace('/^block\\.([a-zA-Z0-9\\-\\_]+)\\.tpl$/', '\\1', $templ_list);
foreach ($templ_list as $value) {
    if (!empty($value) and $value != 'default') {
        $xtpl->assign('TEMPLATE', array('key' => $value, 'selected' => $row['template'] == $value ? ' selected="selected"' : '', 'title' => $value));
        $xtpl->parse('main.template');
    }
}
for ($i = 0, $count = sizeof($positions); $i < $count; ++$i) {
    $xtpl->assign('POSITION', array('key' => (string) $positions[$i]->tag, 'selected' => $row['position'] == $positions[$i]->tag ? ' selected="selected"' : '', 'title' => (string) $positions[$i]->name));
    $xtpl->parse('main.position');
}
foreach ($groups_list as $group_id => $grtl) {
    $xtpl->assign('GROUPS_LIST', array('key' => $group_id, 'selected' => in_array($group_id, $groups_view) ? ' checked="checked"' : '', 'title' => $grtl));
    $xtpl->parse('main.groups_list');
}
Esempio n. 24
0
$id = $nv_Request->get_int('id', 'post,get', 0);
if ($id) {
    $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE id=' . $id;
    $row = $db->query($sql)->fetch();
    if (empty($row)) {
        Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name);
        die;
    }
    $page_title = $lang_module['edit'];
    $action = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '&amp;id=' . $id;
} else {
    $page_title = $lang_module['add'];
    $action = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op;
}
$selectthemes = !empty($site_mods[$module_name]['theme']) ? $site_mods[$module_name]['theme'] : $global_config['site_theme'];
$layout_array = nv_scandir(NV_ROOTDIR . '/themes/' . $selectthemes . '/layout', $global_config['check_op_layout']);
$error = '';
$groups_list = nv_groups_list();
if ($nv_Request->get_int('save', 'post') == '1') {
    $row['title'] = $nv_Request->get_title('title', 'post', '', 1);
    $row['alias'] = $nv_Request->get_title('alias', 'post', '', 1);
    $image = $nv_Request->get_string('image', 'post', '');
    if (nv_is_file($image, NV_UPLOADS_DIR . '/' . $module_upload)) {
        $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/');
        $row['image'] = substr($image, $lu);
    } else {
        $row['image'] = '';
    }
    $row['imagealt'] = $nv_Request->get_title('imagealt', 'post', '', 1);
    $row['imageposition'] = $nv_Request->get_int('imageposition', 'post', 0);
    $row['description'] = $nv_Request->get_textarea('description', '', 'br', 1);
Esempio n. 25
0
<?php

/**
 * @Project NUKEVIET 4.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 2-2-2010 12:55
 */
if (!defined('NV_IS_FILE_SETTINGS')) {
    die('Stop!!!');
}
$adminThemes = array('');
$adminThemes = array_merge($adminThemes, nv_scandir(NV_ROOTDIR . '/themes', $global_config['check_theme_admin']));
unset($adminThemes[0]);
$closed_site_Modes = array();
$closed_site_Modes[0] = $lang_module['closed_site_0'];
if (defined('NV_IS_GODADMIN')) {
    $closed_site_Modes[1] = $lang_module['closed_site_1'];
}
$closed_site_Modes[2] = $lang_module['closed_site_2'];
$closed_site_Modes[3] = $lang_module['closed_site_3'];
$allow_sitelangs = array();
foreach ($global_config['allow_sitelangs'] as $lang_i) {
    if (file_exists(NV_ROOTDIR . '/includes/language/' . $lang_i . '/global.php')) {
        $allow_sitelangs[] = $lang_i;
    }
}
$timezone_array = array_keys($nv_parse_ini_timezone);
$errormess = '';
if ($nv_Request->isset_request('submit', 'post')) {
Esempio n. 26
0
/**
 * nv_admin_write_lang()
 *
 * @param mixed $dirlang
 * @param mixed $idfile
 * @return error write file
 */
function nv_admin_write_lang($dirlang, $idfile)
{
    global $db, $language_array, $global_config, $include_lang, $lang_module, $array_lang_exit, $array_lang_no_check;
    list($module, $admin_file, $langtype, $author_lang) = $db->query('SELECT module, admin_file, langtype, author_' . $dirlang . ' FROM ' . NV_LANGUAGE_GLOBALTABLE . '_file WHERE idfile =' . intval($idfile))->fetch(3);
    if (!empty($dirlang) and !empty($module)) {
        if (empty($author_lang)) {
            $array_translator = array();
            $array_translator['author'] = '';
            $array_translator['createdate'] = '';
            $array_translator['copyright'] = '';
            $array_translator['info'] = '';
            $array_translator['langtype'] = $langtype;
        } else {
            eval('$array_translator = ' . $author_lang . ';');
        }
        $include_lang = '';
        $modules_exit = nv_scandir(NV_ROOTDIR . '/modules', $global_config['check_module']);
        if ($module == 'global' and preg_match('/^block\\.global\\.([a-zA-Z0-9\\-\\_]+)$/', $admin_file)) {
            $include_lang = NV_ROOTDIR . '/includes/language/' . $dirlang . '/' . $admin_file . '.php';
        } elseif (in_array($module, $modules_exit) and preg_match('/^block\\.(global|module)\\.([a-zA-Z0-9\\-\\_]+)$/', $admin_file)) {
            $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/' . $admin_file . '_' . $dirlang . '.php';
        } elseif (in_array($module, $modules_exit) and $admin_file == 1) {
            $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/admin_' . $dirlang . '.php';
        } elseif (in_array($module, $modules_exit) and $admin_file == 0) {
            $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/' . $dirlang . '.php';
        } elseif ($module == 'global' and $admin_file == 1) {
            $include_lang = NV_ROOTDIR . '/includes/language/' . $dirlang . '/admin_' . $module . '.php';
        } elseif ($module == 'global' and $admin_file == 0) {
            $include_lang = NV_ROOTDIR . '/includes/language/' . $dirlang . '/' . $module . '.php';
        } elseif ($module == 'install' and $admin_file == 0) {
            $include_lang = NV_ROOTDIR . '/includes/language/' . $dirlang . '/' . $module . '.php';
        } else {
            $admin_file = 1;
            $include_lang = NV_ROOTDIR . '/includes/language/' . $dirlang . '/admin_' . $module . '.php';
        }
        if ($include_lang == '') {
            return $lang_module['nv_error_write_module'] . ' : ' . $module;
        } else {
            if (preg_match('/^(0?\\d|[1-2]{1}\\d|3[0-1]{1})[\\-\\/\\.]{1}(0?\\d|1[0-2]{1})[\\-\\/\\.]{1}(19[\\d]{2}|20[\\d]{2})[\\-\\/\\.\\,\\s]{2}(0?\\d|[1]{1}\\d|2[0-4]{1})[\\-\\/\\.\\:]{1}([0-5]?[0-9])$/', $array_translator['createdate'], $m)) {
                $createdate = mktime($m[4], $m[5], 0, $m[2], $m[1], $m[3]);
            } elseif (preg_match('/^(0?\\d|[1-2]{1}\\d|3[0-1]{1})[\\-\\/\\.]{1}(0?\\d|1[0-2]{1})[\\-\\/\\.]{1}(19[\\d]{2}|20[\\d]{2})$/', $array_translator['createdate'], $m)) {
                $createdate = mktime(0, 0, 0, $m[2], $m[1], $m[3]);
            } else {
                $createdate = time();
            }
            $content_lang_no_tran = '';
            $content_lang = "<?php\n\n";
            $content_lang .= "/**\n";
            $content_lang .= "* @Project NUKEVIET 4.x\n";
            $content_lang .= "* @Author VINADES.,JSC (contact@vinades.vn)\n";
            $content_lang .= "* @Copyright (C) " . date("Y") . " VINADES.,JSC. All rights reserved\n";
            $content_lang .= "* @Language " . $language_array[$dirlang]['name'] . "\n";
            $content_lang .= "* @License CC BY-SA (http://creativecommons.org/licenses/by-sa/4.0/)\n";
            $content_lang .= "* @Createdate " . gmdate("M d, Y, h:i:s A", $createdate) . "\n";
            $content_lang .= "*/\n";
            if ($admin_file) {
                $content_lang .= "\nif (! defined('NV_ADMIN') or ! defined('NV_MAINFILE')) {";
            } else {
                $content_lang .= "\nif (! defined('NV_MAINFILE')) {";
            }
            $content_lang .= "\n    die( 'Stop!!!' );\n}\n\n";
            $array_translator['info'] = isset($array_translator['info']) ? $array_translator['info'] : "";
            $content_lang .= "\$lang_translator['author'] = '" . $array_translator['author'] . "';\n";
            $content_lang .= "\$lang_translator['createdate'] = '" . $array_translator['createdate'] . "';\n";
            $content_lang .= "\$lang_translator['copyright'] = '" . $array_translator['copyright'] . "';\n";
            $content_lang .= "\$lang_translator['info'] = '" . $array_translator['info'] . "';\n";
            $content_lang .= "\$lang_translator['langtype'] = '" . $array_translator['langtype'] . "';\n";
            $content_lang .= "\n";
            $content_lang_no_check = '';
            $numrows = 0;
            if (in_array('vi', $array_lang_exit) and in_array('en', $array_lang_exit) and $dirlang != 'vi' and $dirlang != 'en') {
                $result = $db->query('SELECT lang_key, lang_vi, lang_en, lang_' . $dirlang . ', update_' . $dirlang . ' FROM ' . NV_LANGUAGE_GLOBALTABLE . ' WHERE idfile=' . $idfile . ' ORDER BY id ASC');
                while (list($lang_key, $lang_value_vi, $lang_value_en, $lang_value, $update_time) = $result->fetch(3)) {
                    if ($lang_value != '') {
                        $numrows++;
                        $lang_value = nv_unhtmlspecialchars($lang_value);
                        $lang_value = str_replace("\\'", "'", $lang_value);
                        $lang_value = str_replace("'", "\\'", $lang_value);
                        $lang_value = nv_nl2br($lang_value);
                        $lang_value = str_replace('<br />', '<br />', $lang_value);
                        $content_temp = "\$" . $langtype . "['" . $lang_key . "'] = '{$lang_value}';\n";
                        if ($update_time > 0) {
                            $content_lang .= $content_temp;
                        } else {
                            $content_lang_no_check .= $content_temp;
                        }
                    }
                }
                if (!empty($content_lang_no_check)) {
                    $content_lang .= "\n\n/*---------------------------------------- Language untested ----------------------------------------------*/\n";
                    $content_lang .= $content_lang_no_check;
                    $array_lang_no_check[] = $include_lang;
                }
            } else {
                $result = $db->query('SELECT lang_key, lang_' . $dirlang . ' FROM ' . NV_LANGUAGE_GLOBALTABLE . ' WHERE idfile=' . $idfile . ' ORDER BY id ASC');
                while (list($lang_key, $lang_value) = $result->fetch(3)) {
                    if ($lang_value != '') {
                        $numrows++;
                        $lang_value = nv_unhtmlspecialchars($lang_value);
                        $lang_value = str_replace("\\'", "'", $lang_value);
                        $lang_value = str_replace("'", "\\'", $lang_value);
                        $lang_value = nv_nl2br($lang_value);
                        $lang_value = str_replace('<br />', '<br />', $lang_value);
                        $content_lang .= "\$" . $langtype . "['" . $lang_key . "'] = '" . $lang_value . "';\n";
                    }
                }
            }
            if ($numrows) {
                $number_bytes = file_put_contents($include_lang, trim($content_lang), LOCK_EX);
                if (empty($number_bytes)) {
                    $errfile = str_replace(NV_ROOTDIR, '', str_replace('\\', '/', $include_lang));
                    return $lang_module['nv_error_write_file'] . ' : ' . $errfile;
                }
            }
        }
        return '';
    } else {
        return $lang_module['nv_error_exit_module'] . ' : ' . $module;
    }
}
Esempio n. 27
0
/**
 * nv_admin_read_lang()
 *
 * @param mixed $dirlang
 * @param mixed $idfile
 * @return error read file
 */
function nv_admin_read_lang($dirlang, $module, $admin_file = 1)
{
    global $db, $global_config, $include_lang, $lang_module;
    $include_lang = '';
    $modules_exit = nv_scandir(NV_ROOTDIR . '/modules', $global_config['check_module']);
    if ($module == 'global' and preg_match('/^block\\.global\\.([a-zA-Z0-9\\-\\_]+)\\.php$/', $admin_file, $m)) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/' . $admin_file;
        $admin_file = 'block.global.' . $m[1];
    } elseif (preg_match('/^block\\.(global|module)\\.([a-zA-Z0-9\\-\\_]+)\\_' . $dirlang . '\\.php$/', $admin_file, $m)) {
        $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/' . $admin_file;
        $admin_file = 'block.' . $m[1] . '.' . $m[2];
    } elseif ($module == 'global' and $admin_file == 1) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/admin_' . $module . '.php';
    } elseif ($module == 'global' and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/' . $module . '.php';
    } elseif ($module == 'install' and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/' . $module . '.php';
    } elseif (in_array($module, $modules_exit) and $admin_file == 1) {
        $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/admin_' . $dirlang . '.php';
    } elseif (in_array($module, $modules_exit) and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/' . $dirlang . '.php';
    } elseif (file_exists(NV_ROOTDIR . '/language/' . $dirlang . '/admin_' . $module . '.php')) {
        $admin_file = 1;
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/admin_' . $module . '.php';
    }
    if ($include_lang != '' and file_exists($include_lang)) {
        $lang_module_temp = $lang_module;
        $lang_module = array();
        $lang_global = array();
        $lang_block = array();
        $lang_translator = array();
        include $include_lang;
        $sth = $db->prepare('SELECT idfile, langtype FROM ' . NV_LANGUAGE_GLOBALTABLE . '_file WHERE module = :module AND admin_file= :admin_file');
        $sth->bindParam(':module', $module, PDO::PARAM_STR);
        $sth->bindParam(':admin_file', $admin_file, PDO::PARAM_STR);
        $sth->execute();
        list($idfile, $langtype) = $sth->fetch(3);
        if (empty($idfile)) {
            $langtype = isset($lang_translator['langtype']) ? strip_tags($lang_translator['langtype']) : 'lang_module';
            $lang_translator_save = array();
            $lang_translator_save['author'] = isset($lang_translator['author']) ? strip_tags($lang_translator['author']) : 'VINADES.,JSC (contact@vinades.vn)';
            $lang_translator_save['createdate'] = isset($lang_translator['createdate']) ? strip_tags($lang_translator['createdate']) : date('d/m/Y, H:i');
            $lang_translator_save['copyright'] = isset($lang_translator['copyright']) ? strip_tags($lang_translator['copyright']) : 'Copyright (C) ' . date('Y') . ' VINADES.,JSC. All rights reserved';
            $lang_translator_save['info'] = isset($lang_translator['info']) ? strip_tags($lang_translator['info']) : '';
            $lang_translator_save['langtype'] = $langtype;
            $author = var_export($lang_translator_save, true);
            $data = array();
            $data['module'] = $module;
            $data['admin_file'] = $admin_file;
            $data['langtype'] = $langtype;
            $data['author'] = $author;
            $idfile = $db->insert_id('INSERT INTO ' . NV_LANGUAGE_GLOBALTABLE . '_file (module, admin_file, langtype, author_' . $dirlang . ') VALUES (:module, :admin_file, :langtype, :author)', 'idfile', $data);
            if (empty($idfile)) {
                nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], 'error read file: ' . str_replace(NV_ROOTDIR . '/', '', $include_lang));
            }
        } else {
            $lang_translator_save = array();
            $langtype = isset($lang_translator['langtype']) ? strip_tags($lang_translator['langtype']) : 'lang_module';
            $lang_translator_save['author'] = isset($lang_translator['author']) ? strip_tags($lang_translator['author']) : 'VINADES.,JSC (contact@vinades.vn)';
            $lang_translator_save['createdate'] = isset($lang_translator['createdate']) ? strip_tags($lang_translator['createdate']) : date('d/m/Y, H:i');
            $lang_translator_save['copyright'] = isset($lang_translator['copyright']) ? strip_tags($lang_translator['copyright']) : 'Copyright (C) ' . date('Y') . ' VINADES.,JSC. All rights reserved';
            $lang_translator_save['info'] = isset($lang_translator['info']) ? strip_tags($lang_translator['info']) : '';
            $lang_translator_save['langtype'] = $langtype;
            $author = var_export($lang_translator_save, true);
            try {
                $sth = $db->prepare('UPDATE ' . NV_LANGUAGE_GLOBALTABLE . '_file SET author_' . $dirlang . '= :author WHERE idfile= ' . $idfile);
                $sth->bindParam(':author', $author, PDO::PARAM_STR, strlen($author));
                $sth->execute();
            } catch (PDOException $e) {
                nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $e->getMessage());
            }
        }
        $temp_lang = array();
        switch ($langtype) {
            case 'lang_global':
                $temp_lang = $lang_global;
                break;
            case 'lang_module':
                $temp_lang = $lang_module;
                break;
            case 'lang_block':
                $temp_lang = $lang_block;
                break;
        }
        $add_field = true;
        $array_lang_key = array();
        $array_lang_value = array();
        $columns_array = $db->columns_array(NV_LANGUAGE_GLOBALTABLE . '_file');
        foreach ($columns_array as $row) {
            if (substr($row['field'], 0, 7) == 'author_' and $row['field'] != 'author_' . $dirlang) {
                $array_lang_key[] = str_replace('author_', 'lang_', $row['field']);
                $array_lang_value[] = '';
            }
        }
        $string_lang_key = implode(', ', $array_lang_key);
        $string_lang_value = '';
        if ($string_lang_key != '') {
            $string_lang_key = ', ' . $string_lang_key;
            $string_lang_value = implode("', '", $array_lang_value);
            $string_lang_value = ", '" . $string_lang_value . "'";
        }
        $read_type = intval($global_config['read_type']);
        $sth_is = $db->prepare('INSERT INTO ' . NV_LANGUAGE_GLOBALTABLE . ' (idfile, lang_key, lang_' . $dirlang . ', update_' . $dirlang . ') VALUES (:idfile, :lang_key, :lang_value, ' . NV_CURRENTTIME . ')');
        $sth_ud = $db->prepare('UPDATE ' . NV_LANGUAGE_GLOBALTABLE . ' SET lang_' . $dirlang . ' = :lang_value, update_' . $dirlang . ' = ' . NV_CURRENTTIME . ' WHERE idfile = :idfile AND lang_key = :lang_key');
        while (list($lang_key, $lang_value) = each($temp_lang)) {
            $check_type_update = false;
            $lang_key = trim($lang_key);
            $lang_value = nv_nl2br($lang_value);
            $lang_value = preg_replace("/<br\\s*\\/>/", '<br />', $lang_value);
            $lang_value = preg_replace("/<\\/\\s*br\\s*>/", '<br />', $lang_value);
            if ($read_type == 0 or $read_type == 1) {
                try {
                    $sth_is->bindParam(':idfile', $idfile, PDO::PARAM_INT);
                    $sth_is->bindParam(':lang_key', $lang_key, PDO::PARAM_STR);
                    $sth_is->bindParam(':lang_value', $lang_value, PDO::PARAM_STR);
                    $sth_is->execute();
                    if ($read_type == 0 and !$sth_is->rowCount()) {
                        $check_type_update = true;
                    }
                } catch (PDOException $e) {
                    if ($read_type == 0) {
                        $check_type_update = true;
                    }
                }
            }
            if ($read_type == 2 or $check_type_update) {
                $sth_ud->bindParam(':idfile', $idfile, PDO::PARAM_INT);
                $sth_ud->bindParam(':lang_key', $lang_key, PDO::PARAM_STR);
                $sth_ud->bindParam(':lang_value', $lang_value, PDO::PARAM_STR);
                $sth_ud->execute();
            }
        }
        $lang_module = $lang_module_temp;
        return '';
    } else {
        $include_lang = '';
        return $lang_module['nv_error_exit_module'] . ' : ' . $module;
    }
}
    $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 . "'/>";
    $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";
    $contents .= "<select name=\"modulename\">\n";
    $contents .= "<option value=\"0\">" . $lang_module['autoinstall_method__module_none'] . "</option>\n";
    $sql = "SELECT module_file, custom_title FROM `" . NV_MODULES_TABLE . "` ORDER BY `weight` ASC";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $contents .= "<option value=\"" . $row['module_file'] . "\">" . $row['custom_title'] . "</option>\n";
    }
    $contents .= "</select>\n";
    $contents .= "</td>";
    $contents .= "</tr>";
    $contents .= "</tbody>";
Esempio n. 29
0
         trigger_error($e->getMessage());
         break;
     }
 }
 // Cai dat du lieu cho cac module
 if (empty($db_config['error'])) {
     define('NV_IS_MODADMIN', true);
     $module_name = 'modules';
     $lang_module['modules'] = '';
     $lang_module['vmodule_add'] = '';
     $lang_module['autoinstall'] = '';
     $lang_global['mod_modules'] = '';
     define('NV_UPLOAD_GLOBALTABLE', $db_config['prefix'] . '_upload');
     require_once NV_ROOTDIR . '/' . NV_ADMINDIR . '/modules/functions.php';
     $module_name = '';
     $modules_exit = nv_scandir(NV_ROOTDIR . '/modules', $global_config['check_module']);
     // Cai dat du lieu cho ngon ngu
     require_once NV_ROOTDIR . '/includes/action_' . $db_config['dbtype'] . '.php';
     $sql_create_table = nv_create_table_sys(NV_LANG_DATA);
     foreach ($sql_create_table as $_sql) {
         try {
             $db->query($_sql);
         } catch (PDOException $e) {
             $nv_Request->set_Session('maxstep', 4);
             $db_config['error'] = $e->getMessage();
             trigger_error($e->getMessage());
             break;
         }
     }
     unset($sql_create_table);
     $sql = 'SELECT * FROM ' . $db_config['prefix'] . '_' . NV_LANG_DATA . '_modules ORDER BY weight ASC';
Esempio n. 30
0
/**
 * nv_admin_write_lang()
 * 
 * @param mixed $dirlang
 * @param mixed $idfile
 * @return error write file
 */
function nv_admin_write_lang($dirlang, $idfile)
{
    global $db, $language_array, $global_config, $include_lang, $lang_module, $array_lang_exit, $array_lang_no_check;
    list($module, $admin_file, $langtype, $author_lang) = $db->sql_fetchrow($db->sql_query("SELECT `module`, `admin_file`, `langtype`, `author_" . $dirlang . "` FROM `" . NV_LANGUAGE_GLOBALTABLE . "_file` WHERE `idfile` ='" . intval($idfile) . "'"));
    if (!empty($dirlang) and !empty($module)) {
        if (empty($author_lang)) {
            $array_translator = array();
            $array_translator['author'] = "";
            $array_translator['createdate'] = "";
            $array_translator['copyright'] = "";
            $array_translator['info'] = "";
            $array_translator['langtype'] = $langtype;
        } else {
            eval('$array_translator = ' . $author_lang . ';');
        }
        $include_lang = "";
        $modules_exit = nv_scandir(NV_ROOTDIR . "/modules", $global_config['check_module']);
        if ($module == "global" and preg_match("/^block\\.global\\.([a-zA-Z0-9\\-\\_]+)\$/", $admin_file)) {
            $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/" . $admin_file . ".php";
        } elseif (in_array($module, $modules_exit) and preg_match("/^block\\.(global|module)\\.([a-zA-Z0-9\\-\\_]+)\$/", $admin_file)) {
            $include_lang = NV_ROOTDIR . "/modules/" . $module . "/language/" . $admin_file . "_" . $dirlang . ".php";
        } elseif (in_array($module, $modules_exit) and $admin_file == 1) {
            $include_lang = NV_ROOTDIR . "/modules/" . $module . "/language/admin_" . $dirlang . ".php";
        } elseif (in_array($module, $modules_exit) and $admin_file == 0) {
            $include_lang = NV_ROOTDIR . "/modules/" . $module . "/language/" . $dirlang . ".php";
        } elseif ($module == "global" and $admin_file == 1) {
            $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/admin_" . $module . ".php";
        } elseif ($module == "global" and $admin_file == 0) {
            $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/" . $module . ".php";
        } elseif ($module == "install" and $admin_file == 0) {
            $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/" . $module . ".php";
        } else {
            $admin_file = 1;
            $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/admin_" . $module . ".php";
        }
        if ($include_lang == "") {
            return $lang_module['nv_error_write_module'] . " : " . $module;
        } else {
            if (preg_match("/^(0?\\d|[1-2]{1}\\d|3[0-1]{1})[\\-\\/\\.]{1}(0?\\d|1[0-2]{1})[\\-\\/\\.]{1}(19[\\d]{2}|20[\\d]{2})[\\-\\/\\.\\,\\s]{2}(0?\\d|[1]{1}\\d|2[0-4]{1})[\\-\\/\\.\\:]{1}([0-5]?[0-9])\$/", $array_translator['createdate'], $m)) {
                $createdate = mktime($m[4], $m[5], 0, $m[2], $m[1], $m[3]);
            } elseif (preg_match("/^(0?\\d|[1-2]{1}\\d|3[0-1]{1})[\\-\\/\\.]{1}(0?\\d|1[0-2]{1})[\\-\\/\\.]{1}(19[\\d]{2}|20[\\d]{2})\$/", $array_translator['createdate'], $m)) {
                $createdate = mktime(0, 0, 0, $m[2], $m[1], $m[3]);
            } else {
                $createdate = time();
            }
            $content_lang_no_tran = "";
            $content_lang = "<?php\n\n";
            $content_lang .= "/**\n";
            $content_lang .= "* @Project NUKEVIET 3.x\n";
            $content_lang .= "* @Author VINADES.,JSC (contact@vinades.vn)\n";
            $content_lang .= "* @Copyright (C) " . date("Y") . " VINADES.,JSC. All rights reserved\n";
            $content_lang .= "* @Language " . $language_array[$dirlang]['name'] . "\n";
            $content_lang .= "* @Createdate " . gmdate("M d, Y, h:i:s A", $createdate) . "\n";
            $content_lang .= "*/\n";
            if ($admin_file) {
                $content_lang .= "\nif( ! defined( 'NV_ADMIN' ) or ! defined( 'NV_MAINFILE' ) ) ";
            } else {
                $content_lang .= "\nif( ! defined( 'NV_MAINFILE' ) ) ";
            }
            $content_lang .= " die( 'Stop!!!' );\n\n";
            $array_translator['info'] = isset($array_translator['info']) ? $array_translator['info'] : "";
            $content_lang .= "\$lang_translator['author'] = '" . $array_translator['author'] . "';\n";
            $content_lang .= "\$lang_translator['createdate'] = '" . $array_translator['createdate'] . "';\n";
            $content_lang .= "\$lang_translator['copyright'] = '" . $array_translator['copyright'] . "';\n";
            $content_lang .= "\$lang_translator['info'] = '" . $array_translator['info'] . "';\n";
            $content_lang .= "\$lang_translator['langtype'] = '" . $array_translator['langtype'] . "';\n";
            $content_lang .= "\n";
            $content_lang_no_check = "";
            $numrows = 0;
            if (in_array("vi", $array_lang_exit) and in_array("en", $array_lang_exit) and $dirlang != "vi" and $dirlang != "en") {
                $sql = "SELECT `lang_key`, `lang_vi`, `lang_en`, `lang_" . $dirlang . "`, `update_" . $dirlang . "` FROM `" . NV_LANGUAGE_GLOBALTABLE . "` WHERE `idfile`='" . $idfile . "' ORDER BY `id` ASC";
                $result = $db->sql_query($sql);
                while (list($lang_key, $lang_value_vi, $lang_value_en, $lang_value, $update_time) = $db->sql_fetchrow($result)) {
                    if ($lang_value != "") {
                        $numrows++;
                        $lang_value = nv_unhtmlspecialchars($lang_value);
                        $lang_value = str_replace("\\'", "'", $lang_value);
                        $lang_value = str_replace("'", "\\'", $lang_value);
                        $lang_value = nv_nl2br($lang_value);
                        $lang_value = str_replace('<br  />', '<br />', $lang_value);
                        $content_temp = "\$" . $langtype . "['" . $lang_key . "'] = '{$lang_value}';\n";
                        $content_temp .= "/*\n";
                        if ($dirlang != "vi" and !empty($lang_value_vi)) {
                            $lang_value_vi = nv_unhtmlspecialchars($lang_value_vi);
                            $lang_value_vi = str_replace("\\'", "'", $lang_value_vi);
                            $lang_value_vi = str_replace("'", "\\'", $lang_value_vi);
                            $lang_value_vi = nv_nl2br($lang_value_vi);
                            $lang_value_vi = str_replace('<br  />', '<br />', $lang_value_vi);
                            $content_temp .= "\t vietnam:\t  " . $lang_value_vi . "\n";
                        }
                        if ($dirlang != "en" and !empty($lang_value_en)) {
                            $lang_value_en = nv_unhtmlspecialchars($lang_value_en);
                            $lang_value_en = str_replace("\\'", "'", $lang_value_en);
                            $lang_value_en = str_replace("'", "\\'", $lang_value_en);
                            $lang_value_en = nv_nl2br($lang_value_en);
                            $lang_value_en = str_replace('<br  />', '<br />', $lang_value_en);
                            $content_temp .= "\t english:\t  " . $lang_value_en . "\n";
                        }
                        $content_temp .= "*/\n\n";
                        if ($update_time > 0) {
                            $content_lang .= $content_temp;
                        } else {
                            $content_lang_no_check .= $content_temp;
                        }
                    }
                }
                if (!empty($content_lang_no_check)) {
                    $content_lang .= "\n\n/*---------------------------------------- Language untested ----------------------------------------------*/\n";
                    $content_lang .= $content_lang_no_check;
                    $array_lang_no_check[] = $include_lang;
                }
            } else {
                $sql = "SELECT `lang_key`, `lang_" . $dirlang . "` FROM `" . NV_LANGUAGE_GLOBALTABLE . "` WHERE `idfile`='" . $idfile . "' ORDER BY `id` ASC";
                $result = $db->sql_query($sql);
                while (list($lang_key, $lang_value) = $db->sql_fetchrow($result)) {
                    if ($lang_value != "") {
                        $numrows++;
                        $lang_value = nv_unhtmlspecialchars($lang_value);
                        $lang_value = str_replace("\\'", "'", $lang_value);
                        $lang_value = str_replace("'", "\\'", $lang_value);
                        $lang_value = nv_nl2br($lang_value);
                        $lang_value = str_replace('<br  />', '<br />', $lang_value);
                        $content_lang .= "\$" . $langtype . "['" . $lang_key . "'] = '{$lang_value}';\n";
                    }
                }
            }
            if ($numrows) {
                $content_lang .= "\n";
                $content_lang .= "?>";
                $number_bytes = file_put_contents($include_lang, $content_lang, LOCK_EX);
                if (empty($number_bytes)) {
                    $errfile = str_replace(NV_ROOTDIR, "", str_replace('\\', '/', $include_lang));
                    return $lang_module['nv_error_write_file'] . " : " . $errfile;
                }
            }
        }
        return "";
    } else {
        return $lang_module['nv_error_exit_module'] . " : " . $module;
    }
}