function lng($str) { global $CONFIG; $l = $CONFIG['LANG']; if (!$l) { $l = $CONFIG['LANG_DEF']; } $result = ''; $lang_file = $CONFIG['SITE_TEMPLATES'] . "/lang/{$l}.txt"; # logger("$str => $lang_file"); if ($l) { $LANG_STR = load_lang($lang_file); $lang_str = @$LANG_STR[$str]; $result = $lang_str; } if (!$result) { $result = $str; #if no language - return original string # logger("before update $result"); # if ($l=='en'){ #update only if we are under English (this keep performance better) if ($CONFIG['IS_LANG_UPD']) { update_lang($result, $CONFIG['LANG_DEF']); } #if no translation - add string to en.txt file (but only if we allowed to update) # } } return $result; }
dmkdir(DISCUZ_ROOT . 'source/plugin/yiqixueba/template'); } $github_ver = '1.0'; if (!C::t('common_setting')->skey_exists('yiqixueba_siteurlkey')) { $salt = random(6); $yiqixueba_settings = array('yiqixueba_salt' => $salt, 'yiqixueba_siteurlkey' => md5($_G['siteurl'] . $salt), 'yiqixueba_mainver' => '1.0'); C::t('common_setting')->update_batch($yiqixueba_settings); } $sitekey = C::t('common_setting')->fetch('yiqixueba_siteurlkey'); $pages = $tables = $templates = array(); $mokuaiver = array('main' => '1.0', 'server' => '1.0', 'shop' => '1.0', 'yqxb' => '1.0', 'wxq123' => '1.0', 'yikatong' => '1.0', 'cheyouhui' => '1.0'); foreach ($mokuaiver as $k => $v) { update_pages($k, $v); update_table($k, $v); update_template($k, $v); update_lang($k, $v); } writelangfile($nplang); C::t('common_setting')->update('yiqixueba_pages', serialize($pages)); C::t('common_setting')->update('yiqixueba_tables', serialize($tables)); C::t('common_setting')->update('yiqixueba_templates', serialize($templates)); unset($sitekey); //更新page页面 function update_pages($mokuai, $ver) { global $sitekey, $pages; $pages_dir = MOKUAI_DIR . '/' . $mokuai . '/' . $ver . '/Controler'; if ($handle = opendir($pages_dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && substr($file, 0, 1) != "." && $file != "index.html") { $page_filename = md5($sitekey . $mokuai . '_' . substr($file, 0, -4));