14function getLanguage() {
33 'Shift_JIS' =>
'ja_utf8',
36 $language =
'english';
37 if ( ! empty( $_POST[
'lang'] ) ) {
38 $language = $_POST[
'lang'];
40 if ( isset( $_COOKIE[
'install_lang'] ) ) {
41 $language = $_COOKIE[
'install_lang'];
43 if ( isset( $_SERVER[
'HTTP_ACCEPT_LANGUAGE'] ) ) {
44 $accept_langs = explode(
',', $_SERVER[
'HTTP_ACCEPT_LANGUAGE'] );
45 foreach ( $accept_langs as $al ) {
46 $al = strtolower( $al );
47 $al_len = strlen( $al );
49 if ( preg_match(
'/([a-z]{2});q=[0-9.]+$/', $al, $al_match ) ) {
55 if ( isset( $language_array[ $al ] ) ) {
56 $language = $language_array[ $al ];
60 } elseif ( isset( $_SERVER[
'HTTP_ACCEPT_CHARSET'] ) ) {
61 foreach ( $charset_array as $ac => $lg ) {
62 if ( strstr( $_SERVER[
'HTTP_ACCEPT_CHARSET'], $ac ) ) {
70 if ( ! file_exists(
'./language/' . $language .
'/install.php' ) ) {
71 $language =
'english';
73 setcookie(
'install_lang', $language );
81function getDirList( $dirname ) {
83 if ( is_dir( $dirname ) && $handle = opendir( $dirname ) ) {
84 while (
false !== ( $file = readdir( $handle ) ) ) {
85 if ( ! preg_match(
'/^[.]{1,2}$/', $file ) ) {
86 if (
'cvs' != strtolower( $file ) && is_dir( $dirname . $file ) ) {
87 $dirlist[ $file ] = $file;
102function getImageFileList( $dirname ) {
104 if ( is_dir( $dirname ) && $handle = opendir( $dirname ) ) {
105 while (
false !== ( $file = readdir( $handle ) ) ) {
106 if ( ! preg_match(
'/^[.]{1,2}$/', $file ) && preg_match(
'/[.gif|.jpg|.png]$/i', $file ) ) {
107 $filelist[ $file ] = $file;
118function &xoops_module_gettemplate( $dirname, $template, $block =
false ) {
120 $path = XOOPS_ROOT_PATH .
'/modules/' . $dirname .
'/templates/blocks/' . $template;
122 $path = XOOPS_ROOT_PATH .
'/modules/' . $dirname .
'/templates/' . $template;
124 if ( ! file_exists( $path ) ) {
129 $lines = file( $path );
137 $count = count( $lines );
138 for ( $i = 0; $i < $count; $i ++ ) {
139 $ret .= str_replace(
"\n",
"\r\n", str_replace(
"\r\n",
"\n", $lines[ $i ] ) );
145function check_language( $language ) {
146 if ( file_exists(
'./language/' . $language .
'/install.php' ) ) {
153function b_back( $option =
null ) {
154 if ( ! isset( $option ) || ! is_array( $option ) ) {
158 if ( isset( $option[0] ) &&
'' != $option[0] ) {
159 $content .=
'<a href="javascript:void(0);" onclick=\'location.href="index.php?op=' . htmlspecialchars( $option[0] ) .
'"\' class="back" style="display:inline-block;vertical-align:top;"><img src="img/back.png" alt="' . _INSTALL_L42 .
'"></a>';
161 $content .=
'<a href="javascript:history.back();" class="back" style="display:inline-block;vertical-align:top;"><img src="img/back.png" alt="' . _INSTALL_L42 .
'"></a>';
163 if ( isset( $option[1] ) &&
'' != $option[1] ) {
164 $content .=
'<span style="font-size:90%;"> << ' . htmlspecialchars( $option[1] ) .
'</span>';
170function b_reload( $option =
'' ) {
171 if ( empty( $option ) ) {
174 if ( ! defined(
'_INSTALL_L200' ) ) {
175 define(
'_INSTALL_L200',
'Reload' );
178 return '<input type="image" src="img/reload.png" class="reload" title="Reload" value="' . _INSTALL_L200 .
'" onclick="location.reload();">';
181function b_next( $option =
null ) {
182 if ( ! isset( $option ) || ! is_array( $option ) ) {
186 if ( isset( $option[1] ) &&
'' != $option[1] ) {
187 $content .=
'<span style="font-size:90%;">' . htmlspecialchars( $option[1] ) .
' >> </span>';
189 $content .=
'<input type="hidden" name="op" value="' . htmlspecialchars( $option[0] ) .
'">';
190 $content .=
'<input type="image" src="img/next.png" class="next" title="' . _INSTALL_L47 .
'" name="submit" value="' . _INSTALL_L47 .
'">';