15function getLanguage() {
34 'Shift_JIS' =>
'ja_utf8',
37 $language =
'english';
38 if ( ! empty( $_POST[
'lang'] ) ) {
39 $language = $_POST[
'lang'];
40 }
else if ( isset( $_COOKIE[
'install_lang'] ) ) {
41 $language = $_COOKIE[
'install_lang'];
42 }
else if ( isset( $_SERVER[
'HTTP_ACCEPT_LANGUAGE'] ) ) {
43 $accept_langs = explode(
',', $_SERVER[
'HTTP_ACCEPT_LANGUAGE'] );
44 foreach ( $accept_langs as $al ) {
45 $al = strtolower( $al );
46 $al_len = strlen( $al );
48 if ( preg_match(
'/([a-z]{2});q=[0-9.]+$/', $al, $al_match ) ) {
54 if ( isset( $language_array[ $al ] ) ) {
55 $language = $language_array[ $al ];
59 if ( file_exists( dirname( __DIR__ ) .
'/language/' . $al .
'_utf8' ) ) {
60 $language = $al .
'_utf8';
62 } elseif ( isset( $_SERVER[
'HTTP_ACCEPT_CHARSET'] ) ) {
63 foreach ( $charset_array as $ac => $lg ) {
64 if ( strpos( $_SERVER[
'HTTP_ACCEPT_CHARSET'], $ac ) !==
false ) {
70 if ( ! file_exists(
'./language/' . $language .
'/install.php' ) ) {
71 $language =
'english';
73 setcookie(
'install_lang', $language, [
'expires' => ini_get(
'session.cookie_lifetime' ),
'path' => ini_get(
'session.cookie_path' ),
'domain' => ini_get(
'session.cookie_domain' ),
'secure' => ini_get(
'session.cookie_secure' ),
'httponly' => ini_get(
'session.cookie_httponly' )] );
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 if ( ! empty( $_POST[
'op'] ) ) {
180 } elseif ( ! empty( $_GET[
'op'] ) ) {
186 return '<input type="image" src="img/reload.png" class="reload" title="Reload" value="' . _INSTALL_L200 .
'" onclick="location.reload();" />';
189function b_next( $option =
null ) {
190 if ( ! isset( $option ) || ! is_array( $option ) ) {
194 if ( isset( $option[1] ) &&
'' !== $option[1] ) {
195 $content .=
'<span style="font-size:90%;">' . htmlspecialchars( $option[1], ENT_QUOTES | ENT_HTML5 ) .
' >> </span>';
197 $content .=
'<input type="hidden" name="op" value="' . htmlspecialchars( $option[0], ENT_QUOTES | ENT_HTML5 ) .
'" />';
198 $content .=
'<input type="image" src="img/next.png" class="next" title="' . _INSTALL_L47 .
'" name="submit" value="' . _INSTALL_L47 .
'" />';