Esempio n. 1
0
function initial($table)
{
    global $global, $smarty, $lang;
    $tab = substr($table, 0, 3);
    if (check_copr() && !$global['id']) {
        $page_title = '';
        $cat_name = '';
        $keywords = get_varia('site_keywords');
        $describe = get_varia('site_description');
    } else {
        $global['cat'] = get_data($table, $global['id'], $tab . '_cat_id');
        if (!($page_title = get_data($table, $global['id'], $tab . '_title'))) {
            $page_title = get_data($table, $global['id'], $tab . '_name');
        }
        $cat_name = get_data('cat_' . $tab, $global['cat'], 'cat_name');
        $keywords = get_data($table, $global['id'], $tab . '_keywords');
        $describe = get_data($table, $global['id'], $tab . '_description');
    }
    if ($global['cat']) {
        $cat_name = get_data('cat_' . $tab, $global['cat'], 'cat_name');
    }
    $global['entrance'] = get_lang_info(S_LANG, 2);
    $global['entrance'] = $global['entrance'] == 'index.php' ? '' : $global['entrance'];
    $smarty->assign('global', $global);
    $smarty->assign('lang', $lang);
    $smarty->assign('version', get_varia('version'));
    $smarty->assign('site_title', get_varia('site_title'));
    $smarty->assign('channel_title', get_channel_title());
    $smarty->assign('page_title', $page_title);
    $smarty->assign('cat_name', $cat_name);
    $smarty->assign('keywords', $keywords);
    $smarty->assign('describe', $describe);
    $smarty->assign('S_ROOT', S_ROOT);
    $smarty->assign('S_TPL_PATH', S_ROOT . S_TPL_PATH);
    $smarty->assign('S_LANG', S_LANG);
    $smarty->assign('S_MULTILINGUAL', S_MULTILINGUAL);
    $smarty->registerPlugin('function', 'run', 'run');
    $smarty->registerPlugin('function', 'url', 'url');
}
Esempio n. 2
0
function select_lang()
{
    global $db, $tpf, $settings;
    $q = $db->query("select * from {$tpf}langs");
    $langs_sw = array();
    while ($rs = $db->fetch_array($q)) {
        $arr = get_lang_info($rs[lang_name]);
        $rs[lang_txt] = $arr[lang_title];
        $rs['lang_href'] = $settings[phpdisk_url] . '?lang=' . $rs['lang_name'] . '&ref=' . base64_encode($_SERVER['REQUEST_URI']);
        $langs_sw[] = $rs;
    }
    $db->free($q);
    unset($rs);
    return $langs_sw;
}
Esempio n. 3
0
            form_auth(gpc('formhash', 'P', ''), formhash());
            $setting = array('open_switch_langs' => 0);
            $settings = gpc('setting', 'P', $setting);
            if (!$error) {
                settings_cache($settings);
                $sysmsg[] = __('lang_update_success');
                redirect(urr(ADMINCP, "item=lang&menu=lang_tpl"), $sysmsg);
            } else {
                redirect('back', $sysmsg);
            }
        } else {
            syn_languages();
            $q = $db->query("select * from {$tpf}langs order by actived desc,lang_name asc");
            while ($rs = $db->fetch_array($q)) {
                if (check_lang($rs['lang_name'])) {
                    $languages_arr[] = get_lang_info($rs['lang_name']);
                }
            }
            $db->free($q);
            unset($rs);
            require_once template_echo('lang', $admin_tpl_dir, '', 1);
        }
}
function syn_languages()
{
    global $db, $tpf;
    $dirs = scandir(PHPDISK_ROOT . './languages');
    sort($dirs);
    for ($i = 0; $i < count($dirs); $i++) {
        if (check_lang($dirs[$i])) {
            $arr[] = $dirs[$i];