|
indvdum@0
|
1 |
<?php
|
|
indvdum@0
|
2 |
/**
|
|
indvdum@0
|
3 |
*
|
|
indvdum@0
|
4 |
* @package install
|
|
indvdum@0
|
5 |
* @version $Id$
|
|
indvdum@0
|
6 |
* @copyright (c) 2005 phpBB Group
|
|
indvdum@0
|
7 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
indvdum@0
|
8 |
*
|
|
indvdum@0
|
9 |
*/
|
|
indvdum@0
|
10 |
|
|
indvdum@0
|
11 |
/**#@+
|
|
indvdum@0
|
12 |
* @ignore
|
|
indvdum@0
|
13 |
*/
|
|
indvdum@0
|
14 |
define('IN_PHPBB', true);
|
|
indvdum@0
|
15 |
define('IN_INSTALL', true);
|
|
indvdum@0
|
16 |
/**#@-*/
|
|
indvdum@0
|
17 |
|
|
indvdum@0
|
18 |
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
|
|
indvdum@0
|
19 |
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
indvdum@0
|
20 |
|
|
indvdum@0
|
21 |
// @todo Review this test and see if we can find out what it is which prevents PHP 4.2.x from even displaying the page with requirements on it
|
|
indvdum@0
|
22 |
if (version_compare(PHP_VERSION, '4.3.3') < 0)
|
|
indvdum@0
|
23 |
{
|
|
indvdum@0
|
24 |
die('You are running an unsupported PHP version. Please upgrade to PHP 4.3.3 or higher before trying to install phpBB 3.0');
|
|
indvdum@0
|
25 |
}
|
|
indvdum@0
|
26 |
|
|
indvdum@0
|
27 |
function phpbb_require_updated($path, $optional = false)
|
|
indvdum@0
|
28 |
{
|
|
indvdum@0
|
29 |
global $phpbb_root_path;
|
|
indvdum@0
|
30 |
|
|
indvdum@0
|
31 |
$new_path = $phpbb_root_path . 'install/update/new/' . $path;
|
|
indvdum@0
|
32 |
$old_path = $phpbb_root_path . $path;
|
|
indvdum@0
|
33 |
|
|
indvdum@0
|
34 |
if (file_exists($new_path))
|
|
indvdum@0
|
35 |
{
|
|
indvdum@0
|
36 |
require($new_path);
|
|
indvdum@0
|
37 |
}
|
|
indvdum@0
|
38 |
else if (!$optional || file_exists($old_path))
|
|
indvdum@0
|
39 |
{
|
|
indvdum@0
|
40 |
require($old_path);
|
|
indvdum@0
|
41 |
}
|
|
indvdum@0
|
42 |
}
|
|
indvdum@0
|
43 |
|
|
indvdum@0
|
44 |
phpbb_require_updated('includes/startup.' . $phpEx);
|
|
indvdum@0
|
45 |
|
|
indvdum@0
|
46 |
// Try to override some limits - maybe it helps some...
|
|
indvdum@0
|
47 |
@set_time_limit(0);
|
|
indvdum@0
|
48 |
$mem_limit = @ini_get('memory_limit');
|
|
indvdum@0
|
49 |
if (!empty($mem_limit))
|
|
indvdum@0
|
50 |
{
|
|
indvdum@0
|
51 |
$unit = strtolower(substr($mem_limit, -1, 1));
|
|
indvdum@0
|
52 |
$mem_limit = (int) $mem_limit;
|
|
indvdum@0
|
53 |
|
|
indvdum@0
|
54 |
if ($unit == 'k')
|
|
indvdum@0
|
55 |
{
|
|
indvdum@0
|
56 |
$mem_limit = floor($mem_limit / 1024);
|
|
indvdum@0
|
57 |
}
|
|
indvdum@0
|
58 |
else if ($unit == 'g')
|
|
indvdum@0
|
59 |
{
|
|
indvdum@0
|
60 |
$mem_limit *= 1024;
|
|
indvdum@0
|
61 |
}
|
|
indvdum@0
|
62 |
else if (is_numeric($unit))
|
|
indvdum@0
|
63 |
{
|
|
indvdum@0
|
64 |
$mem_limit = floor((int) ($mem_limit . $unit) / 1048576);
|
|
indvdum@0
|
65 |
}
|
|
indvdum@0
|
66 |
$mem_limit = max(128, $mem_limit) . 'M';
|
|
indvdum@0
|
67 |
}
|
|
indvdum@0
|
68 |
else
|
|
indvdum@0
|
69 |
{
|
|
indvdum@0
|
70 |
$mem_limit = '128M';
|
|
indvdum@0
|
71 |
}
|
|
indvdum@0
|
72 |
@ini_set('memory_limit', $mem_limit);
|
|
indvdum@0
|
73 |
|
|
indvdum@0
|
74 |
// Include essential scripts
|
|
indvdum@0
|
75 |
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
|
indvdum@0
|
76 |
|
|
indvdum@0
|
77 |
phpbb_require_updated('includes/functions_content.' . $phpEx, true);
|
|
indvdum@0
|
78 |
|
|
indvdum@0
|
79 |
include($phpbb_root_path . 'includes/auth.' . $phpEx);
|
|
indvdum@0
|
80 |
include($phpbb_root_path . 'includes/session.' . $phpEx);
|
|
indvdum@0
|
81 |
include($phpbb_root_path . 'includes/template.' . $phpEx);
|
|
indvdum@0
|
82 |
include($phpbb_root_path . 'includes/acm/acm_file.' . $phpEx);
|
|
indvdum@0
|
83 |
include($phpbb_root_path . 'includes/cache.' . $phpEx);
|
|
indvdum@0
|
84 |
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
|
indvdum@0
|
85 |
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
|
indvdum@0
|
86 |
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
|
|
indvdum@0
|
87 |
|
|
indvdum@0
|
88 |
// Try and load an appropriate language if required
|
|
indvdum@0
|
89 |
$language = basename(request_var('language', ''));
|
|
indvdum@0
|
90 |
|
|
indvdum@0
|
91 |
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language)
|
|
indvdum@0
|
92 |
{
|
|
indvdum@0
|
93 |
$accept_lang_ary = explode(',', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
|
|
indvdum@0
|
94 |
foreach ($accept_lang_ary as $accept_lang)
|
|
indvdum@0
|
95 |
{
|
|
indvdum@0
|
96 |
// Set correct format ... guess full xx_yy form
|
|
indvdum@0
|
97 |
$accept_lang = substr($accept_lang, 0, 2) . '_' . substr($accept_lang, 3, 2);
|
|
indvdum@0
|
98 |
|
|
indvdum@0
|
99 |
if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang))
|
|
indvdum@0
|
100 |
{
|
|
indvdum@0
|
101 |
$language = $accept_lang;
|
|
indvdum@0
|
102 |
break;
|
|
indvdum@0
|
103 |
}
|
|
indvdum@0
|
104 |
else
|
|
indvdum@0
|
105 |
{
|
|
indvdum@0
|
106 |
// No match on xx_yy so try xx
|
|
indvdum@0
|
107 |
$accept_lang = substr($accept_lang, 0, 2);
|
|
indvdum@0
|
108 |
if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang))
|
|
indvdum@0
|
109 |
{
|
|
indvdum@0
|
110 |
$language = $accept_lang;
|
|
indvdum@0
|
111 |
break;
|
|
indvdum@0
|
112 |
}
|
|
indvdum@0
|
113 |
}
|
|
indvdum@0
|
114 |
}
|
|
indvdum@0
|
115 |
}
|
|
indvdum@0
|
116 |
|
|
indvdum@0
|
117 |
// No appropriate language found ... so let's use the first one in the language
|
|
indvdum@0
|
118 |
// dir, this may or may not be English
|
|
indvdum@0
|
119 |
if (!$language)
|
|
indvdum@0
|
120 |
{
|
|
indvdum@0
|
121 |
$dir = @opendir($phpbb_root_path . 'language');
|
|
indvdum@0
|
122 |
|
|
indvdum@0
|
123 |
if (!$dir)
|
|
indvdum@0
|
124 |
{
|
|
indvdum@0
|
125 |
die('Unable to access the language directory');
|
|
indvdum@0
|
126 |
exit;
|
|
indvdum@0
|
127 |
}
|
|
indvdum@0
|
128 |
|
|
indvdum@0
|
129 |
while (($file = readdir($dir)) !== false)
|
|
indvdum@0
|
130 |
{
|
|
indvdum@0
|
131 |
$path = $phpbb_root_path . 'language/' . $file;
|
|
indvdum@0
|
132 |
|
|
indvdum@0
|
133 |
if (!is_file($path) && !is_link($path) && file_exists($path . '/iso.txt'))
|
|
indvdum@0
|
134 |
{
|
|
indvdum@0
|
135 |
$language = $file;
|
|
indvdum@0
|
136 |
break;
|
|
indvdum@0
|
137 |
}
|
|
indvdum@0
|
138 |
}
|
|
indvdum@0
|
139 |
closedir($dir);
|
|
indvdum@0
|
140 |
}
|
|
indvdum@0
|
141 |
|
|
indvdum@0
|
142 |
if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_root_path . 'language/' . $language))
|
|
indvdum@0
|
143 |
{
|
|
indvdum@0
|
144 |
die('No language found!');
|
|
indvdum@0
|
145 |
}
|
|
indvdum@0
|
146 |
|
|
indvdum@0
|
147 |
// And finally, load the relevant language files
|
|
indvdum@0
|
148 |
include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx);
|
|
indvdum@0
|
149 |
include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx);
|
|
indvdum@0
|
150 |
include($phpbb_root_path . 'language/' . $language . '/acp/board.' . $phpEx);
|
|
indvdum@0
|
151 |
include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx);
|
|
indvdum@0
|
152 |
include($phpbb_root_path . 'language/' . $language . '/posting.' . $phpEx);
|
|
indvdum@0
|
153 |
|
|
indvdum@0
|
154 |
// usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :(
|
|
indvdum@0
|
155 |
|
|
indvdum@0
|
156 |
// Define needed constants
|
|
indvdum@0
|
157 |
define('CHMOD_ALL', 7);
|
|
indvdum@0
|
158 |
define('CHMOD_READ', 4);
|
|
indvdum@0
|
159 |
define('CHMOD_WRITE', 2);
|
|
indvdum@0
|
160 |
define('CHMOD_EXECUTE', 1);
|
|
indvdum@0
|
161 |
|
|
indvdum@0
|
162 |
$mode = request_var('mode', 'overview');
|
|
indvdum@0
|
163 |
$sub = request_var('sub', '');
|
|
indvdum@0
|
164 |
|
|
indvdum@0
|
165 |
// Set PHP error handler to ours
|
|
indvdum@0
|
166 |
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
|
indvdum@0
|
167 |
|
|
indvdum@0
|
168 |
$user = new user();
|
|
indvdum@0
|
169 |
$auth = new auth();
|
|
indvdum@0
|
170 |
$cache = new cache();
|
|
indvdum@0
|
171 |
$template = new template();
|
|
indvdum@0
|
172 |
|
|
indvdum@0
|
173 |
// Add own hook handler, if present. :o
|
|
indvdum@0
|
174 |
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
|
|
indvdum@0
|
175 |
{
|
|
indvdum@0
|
176 |
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
|
indvdum@0
|
177 |
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
|
indvdum@0
|
178 |
|
|
indvdum@0
|
179 |
foreach ($cache->obtain_hooks() as $hook)
|
|
indvdum@0
|
180 |
{
|
|
indvdum@0
|
181 |
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
|
indvdum@0
|
182 |
}
|
|
indvdum@0
|
183 |
}
|
|
indvdum@0
|
184 |
else
|
|
indvdum@0
|
185 |
{
|
|
indvdum@0
|
186 |
$phpbb_hook = false;
|
|
indvdum@0
|
187 |
}
|
|
indvdum@0
|
188 |
|
|
indvdum@0
|
189 |
// Set some standard variables we want to force
|
|
indvdum@0
|
190 |
$config = array(
|
|
indvdum@0
|
191 |
'load_tplcompile' => '1'
|
|
indvdum@0
|
192 |
);
|
|
indvdum@0
|
193 |
|
|
indvdum@0
|
194 |
$template->set_custom_template('../adm/style', 'admin');
|
|
indvdum@0
|
195 |
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
|
|
indvdum@0
|
196 |
|
|
indvdum@0
|
197 |
// the acp template is never stored in the database
|
|
indvdum@0
|
198 |
$user->theme['template_storedb'] = false;
|
|
indvdum@0
|
199 |
|
|
indvdum@0
|
200 |
$install = new module();
|
|
indvdum@0
|
201 |
|
|
indvdum@0
|
202 |
$install->create('install', "index.$phpEx", $mode, $sub);
|
|
indvdum@0
|
203 |
$install->load();
|
|
indvdum@0
|
204 |
|
|
indvdum@0
|
205 |
// Generate the page
|
|
indvdum@0
|
206 |
$install->page_header();
|
|
indvdum@0
|
207 |
$install->generate_navigation();
|
|
indvdum@0
|
208 |
|
|
indvdum@0
|
209 |
$template->set_filenames(array(
|
|
indvdum@0
|
210 |
'body' => $install->get_tpl_name())
|
|
indvdum@0
|
211 |
);
|
|
indvdum@0
|
212 |
|
|
indvdum@0
|
213 |
$install->page_footer();
|
|
indvdum@0
|
214 |
|
|
indvdum@0
|
215 |
/**
|
|
indvdum@0
|
216 |
* @package install
|
|
indvdum@0
|
217 |
*/
|
|
indvdum@0
|
218 |
class module
|
|
indvdum@0
|
219 |
{
|
|
indvdum@0
|
220 |
var $id = 0;
|
|
indvdum@0
|
221 |
var $type = 'install';
|
|
indvdum@0
|
222 |
var $module_ary = array();
|
|
indvdum@0
|
223 |
var $filename;
|
|
indvdum@0
|
224 |
var $module_url = '';
|
|
indvdum@0
|
225 |
var $tpl_name = '';
|
|
indvdum@0
|
226 |
var $mode;
|
|
indvdum@0
|
227 |
var $sub;
|
|
indvdum@0
|
228 |
|
|
indvdum@0
|
229 |
/**
|
|
indvdum@0
|
230 |
* Private methods, should not be overwritten
|
|
indvdum@0
|
231 |
*/
|
|
indvdum@0
|
232 |
function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
|
|
indvdum@0
|
233 |
{
|
|
indvdum@0
|
234 |
global $db, $config, $phpEx, $phpbb_root_path;
|
|
indvdum@0
|
235 |
|
|
indvdum@0
|
236 |
$module = array();
|
|
indvdum@0
|
237 |
|
|
indvdum@0
|
238 |
// Grab module information using Bart's "neat-o-module" system (tm)
|
|
indvdum@0
|
239 |
$dir = @opendir('.');
|
|
indvdum@0
|
240 |
|
|
indvdum@0
|
241 |
if (!$dir)
|
|
indvdum@0
|
242 |
{
|
|
indvdum@0
|
243 |
$this->error('Unable to access the installation directory', __LINE__, __FILE__);
|
|
indvdum@0
|
244 |
}
|
|
indvdum@0
|
245 |
|
|
indvdum@0
|
246 |
$setmodules = 1;
|
|
indvdum@0
|
247 |
while (($file = readdir($dir)) !== false)
|
|
indvdum@0
|
248 |
{
|
|
indvdum@0
|
249 |
if (preg_match('#^install_(.*?)\.' . $phpEx . '$#', $file))
|
|
indvdum@0
|
250 |
{
|
|
indvdum@0
|
251 |
include($file);
|
|
indvdum@0
|
252 |
}
|
|
indvdum@0
|
253 |
}
|
|
indvdum@0
|
254 |
closedir($dir);
|
|
indvdum@0
|
255 |
|
|
indvdum@0
|
256 |
unset($setmodules);
|
|
indvdum@0
|
257 |
|
|
indvdum@0
|
258 |
if (!sizeof($module))
|
|
indvdum@0
|
259 |
{
|
|
indvdum@0
|
260 |
$this->error('No installation modules found', __LINE__, __FILE__);
|
|
indvdum@0
|
261 |
}
|
|
indvdum@0
|
262 |
|
|
indvdum@0
|
263 |
// Order to use and count further if modules get assigned to the same position or not having an order
|
|
indvdum@0
|
264 |
$max_module_order = 1000;
|
|
indvdum@0
|
265 |
|
|
indvdum@0
|
266 |
foreach ($module as $row)
|
|
indvdum@0
|
267 |
{
|
|
indvdum@0
|
268 |
// Module order not specified or module already assigned at this position?
|
|
indvdum@0
|
269 |
if (!isset($row['module_order']) || isset($this->module_ary[$row['module_order']]))
|
|
indvdum@0
|
270 |
{
|
|
indvdum@0
|
271 |
$row['module_order'] = $max_module_order;
|
|
indvdum@0
|
272 |
$max_module_order++;
|
|
indvdum@0
|
273 |
}
|
|
indvdum@0
|
274 |
|
|
indvdum@0
|
275 |
$this->module_ary[$row['module_order']]['name'] = $row['module_title'];
|
|
indvdum@0
|
276 |
$this->module_ary[$row['module_order']]['filename'] = $row['module_filename'];
|
|
indvdum@0
|
277 |
$this->module_ary[$row['module_order']]['subs'] = $row['module_subs'];
|
|
indvdum@0
|
278 |
$this->module_ary[$row['module_order']]['stages'] = $row['module_stages'];
|
|
indvdum@0
|
279 |
|
|
indvdum@0
|
280 |
if (strtolower($selected_mod) == strtolower($row['module_title']))
|
|
indvdum@0
|
281 |
{
|
|
indvdum@0
|
282 |
$this->id = (int) $row['module_order'];
|
|
indvdum@0
|
283 |
$this->filename = (string) $row['module_filename'];
|
|
indvdum@0
|
284 |
$this->module_url = (string) $module_url;
|
|
indvdum@0
|
285 |
$this->mode = (string) $selected_mod;
|
|
indvdum@0
|
286 |
// Check that the sub-mode specified is valid or set a default if not
|
|
indvdum@0
|
287 |
if (is_array($row['module_subs']))
|
|
indvdum@0
|
288 |
{
|
|
indvdum@0
|
289 |
$this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_subs'])) ? $selected_submod : $row['module_subs'][0]);
|
|
indvdum@0
|
290 |
}
|
|
indvdum@0
|
291 |
else if (is_array($row['module_stages']))
|
|
indvdum@0
|
292 |
{
|
|
indvdum@0
|
293 |
$this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_stages'])) ? $selected_submod : $row['module_stages'][0]);
|
|
indvdum@0
|
294 |
}
|
|
indvdum@0
|
295 |
else
|
|
indvdum@0
|
296 |
{
|
|
indvdum@0
|
297 |
$this->sub = '';
|
|
indvdum@0
|
298 |
}
|
|
indvdum@0
|
299 |
}
|
|
indvdum@0
|
300 |
} // END foreach
|
|
indvdum@0
|
301 |
} // END create
|
|
indvdum@0
|
302 |
|
|
indvdum@0
|
303 |
/**
|
|
indvdum@0
|
304 |
* Load and run the relevant module if applicable
|
|
indvdum@0
|
305 |
*/
|
|
indvdum@0
|
306 |
function load($mode = false, $run = true)
|
|
indvdum@0
|
307 |
{
|
|
indvdum@0
|
308 |
global $phpbb_root_path, $phpEx;
|
|
indvdum@0
|
309 |
|
|
indvdum@0
|
310 |
if ($run)
|
|
indvdum@0
|
311 |
{
|
|
indvdum@0
|
312 |
if (!empty($mode))
|
|
indvdum@0
|
313 |
{
|
|
indvdum@0
|
314 |
$this->mode = $mode;
|
|
indvdum@0
|
315 |
}
|
|
indvdum@0
|
316 |
|
|
indvdum@0
|
317 |
$module = $this->filename;
|
|
indvdum@0
|
318 |
if (!class_exists($module))
|
|
indvdum@0
|
319 |
{
|
|
indvdum@0
|
320 |
$this->error('Module "' . htmlspecialchars($module) . '" not accessible.', __LINE__, __FILE__);
|
|
indvdum@0
|
321 |
}
|
|
indvdum@0
|
322 |
$this->module = new $module($this);
|
|
indvdum@0
|
323 |
|
|
indvdum@0
|
324 |
if (method_exists($this->module, 'main'))
|
|
indvdum@0
|
325 |
{
|
|
indvdum@0
|
326 |
$this->module->main($this->mode, $this->sub);
|
|
indvdum@0
|
327 |
}
|
|
indvdum@0
|
328 |
}
|
|
indvdum@0
|
329 |
}
|
|
indvdum@0
|
330 |
|
|
indvdum@0
|
331 |
/**
|
|
indvdum@0
|
332 |
* Output the standard page header
|
|
indvdum@0
|
333 |
*/
|
|
indvdum@0
|
334 |
function page_header()
|
|
indvdum@0
|
335 |
{
|
|
indvdum@0
|
336 |
if (defined('HEADER_INC'))
|
|
indvdum@0
|
337 |
{
|
|
indvdum@0
|
338 |
return;
|
|
indvdum@0
|
339 |
}
|
|
indvdum@0
|
340 |
|
|
indvdum@0
|
341 |
define('HEADER_INC', true);
|
|
indvdum@0
|
342 |
global $template, $lang, $stage, $phpbb_root_path;
|
|
indvdum@0
|
343 |
|
|
indvdum@0
|
344 |
$template->assign_vars(array(
|
|
indvdum@0
|
345 |
'L_CHANGE' => $lang['CHANGE'],
|
|
indvdum@0
|
346 |
'L_INSTALL_PANEL' => $lang['INSTALL_PANEL'],
|
|
indvdum@0
|
347 |
'L_SELECT_LANG' => $lang['SELECT_LANG'],
|
|
indvdum@0
|
348 |
'L_SKIP' => $lang['SKIP'],
|
|
indvdum@0
|
349 |
'PAGE_TITLE' => $this->get_page_title(),
|
|
indvdum@0
|
350 |
'T_IMAGE_PATH' => $phpbb_root_path . 'adm/images/',
|
|
indvdum@0
|
351 |
|
|
indvdum@0
|
352 |
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
|
|
indvdum@0
|
353 |
'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
|
|
indvdum@0
|
354 |
'S_CONTENT_FLOW_END' => ($lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
|
|
indvdum@0
|
355 |
'S_CONTENT_ENCODING' => 'UTF-8',
|
|
indvdum@0
|
356 |
|
|
indvdum@0
|
357 |
'S_USER_LANG' => $lang['USER_LANG'],
|
|
indvdum@0
|
358 |
)
|
|
indvdum@0
|
359 |
);
|
|
indvdum@0
|
360 |
|
|
indvdum@0
|
361 |
header('Content-type: text/html; charset=UTF-8');
|
|
indvdum@0
|
362 |
header('Cache-Control: private, no-cache="set-cookie"');
|
|
indvdum@0
|
363 |
header('Expires: 0');
|
|
indvdum@0
|
364 |
header('Pragma: no-cache');
|
|
indvdum@0
|
365 |
|
|
indvdum@0
|
366 |
return;
|
|
indvdum@0
|
367 |
}
|
|
indvdum@0
|
368 |
|
|
indvdum@0
|
369 |
/**
|
|
indvdum@0
|
370 |
* Output the standard page footer
|
|
indvdum@0
|
371 |
*/
|
|
indvdum@0
|
372 |
function page_footer()
|
|
indvdum@0
|
373 |
{
|
|
indvdum@0
|
374 |
global $db, $template;
|
|
indvdum@0
|
375 |
|
|
indvdum@0
|
376 |
$template->display('body');
|
|
indvdum@0
|
377 |
|
|
indvdum@0
|
378 |
// Close our DB connection.
|
|
indvdum@0
|
379 |
if (!empty($db) && is_object($db))
|
|
indvdum@0
|
380 |
{
|
|
indvdum@0
|
381 |
$db->sql_close();
|
|
indvdum@0
|
382 |
}
|
|
indvdum@0
|
383 |
|
|
indvdum@0
|
384 |
if (function_exists('exit_handler'))
|
|
indvdum@0
|
385 |
{
|
|
indvdum@0
|
386 |
exit_handler();
|
|
indvdum@0
|
387 |
}
|
|
indvdum@0
|
388 |
}
|
|
indvdum@0
|
389 |
|
|
indvdum@0
|
390 |
/**
|
|
indvdum@0
|
391 |
* Returns desired template name
|
|
indvdum@0
|
392 |
*/
|
|
indvdum@0
|
393 |
function get_tpl_name()
|
|
indvdum@0
|
394 |
{
|
|
indvdum@0
|
395 |
return $this->module->tpl_name . '.html';
|
|
indvdum@0
|
396 |
}
|
|
indvdum@0
|
397 |
|
|
indvdum@0
|
398 |
/**
|
|
indvdum@0
|
399 |
* Returns the desired page title
|
|
indvdum@0
|
400 |
*/
|
|
indvdum@0
|
401 |
function get_page_title()
|
|
indvdum@0
|
402 |
{
|
|
indvdum@0
|
403 |
global $lang;
|
|
indvdum@0
|
404 |
|
|
indvdum@0
|
405 |
if (!isset($this->module->page_title))
|
|
indvdum@0
|
406 |
{
|
|
indvdum@0
|
407 |
return '';
|
|
indvdum@0
|
408 |
}
|
|
indvdum@0
|
409 |
|
|
indvdum@0
|
410 |
return (isset($lang[$this->module->page_title])) ? $lang[$this->module->page_title] : $this->module->page_title;
|
|
indvdum@0
|
411 |
}
|
|
indvdum@0
|
412 |
|
|
indvdum@0
|
413 |
/**
|
|
indvdum@0
|
414 |
* Generate an HTTP/1.1 header to redirect the user to another page
|
|
indvdum@0
|
415 |
* This is used during the installation when we do not have a database available to call the normal redirect function
|
|
indvdum@0
|
416 |
* @param string $page The page to redirect to relative to the installer root path
|
|
indvdum@0
|
417 |
*/
|
|
indvdum@0
|
418 |
function redirect($page)
|
|
indvdum@0
|
419 |
{
|
|
indvdum@0
|
420 |
// HTTP_HOST is having the correct browser url in most cases...
|
|
indvdum@0
|
421 |
$server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
|
|
indvdum@0
|
422 |
$server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
|
|
indvdum@0
|
423 |
$secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
|
|
indvdum@0
|
424 |
|
|
indvdum@0
|
425 |
$script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
|
|
indvdum@0
|
426 |
if (!$script_name)
|
|
indvdum@0
|
427 |
{
|
|
indvdum@0
|
428 |
$script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
|
|
indvdum@0
|
429 |
}
|
|
indvdum@0
|
430 |
|
|
indvdum@0
|
431 |
// Replace backslashes and doubled slashes (could happen on some proxy setups)
|
|
indvdum@0
|
432 |
$script_name = str_replace(array('\\', '//'), '/', $script_name);
|
|
indvdum@0
|
433 |
$script_path = trim(dirname($script_name));
|
|
indvdum@0
|
434 |
|
|
indvdum@0
|
435 |
$url = (($secure) ? 'https://' : 'http://') . $server_name;
|
|
indvdum@0
|
436 |
|
|
indvdum@0
|
437 |
if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
|
|
indvdum@0
|
438 |
{
|
|
indvdum@0
|
439 |
// HTTP HOST can carry a port number...
|
|
indvdum@0
|
440 |
if (strpos($server_name, ':') === false)
|
|
indvdum@0
|
441 |
{
|
|
indvdum@0
|
442 |
$url .= ':' . $server_port;
|
|
indvdum@0
|
443 |
}
|
|
indvdum@0
|
444 |
}
|
|
indvdum@0
|
445 |
|
|
indvdum@0
|
446 |
$url .= $script_path . '/' . $page;
|
|
indvdum@0
|
447 |
header('Location: ' . $url);
|
|
indvdum@0
|
448 |
exit;
|
|
indvdum@0
|
449 |
}
|
|
indvdum@0
|
450 |
|
|
indvdum@0
|
451 |
/**
|
|
indvdum@0
|
452 |
* Generate the navigation tabs
|
|
indvdum@0
|
453 |
*/
|
|
indvdum@0
|
454 |
function generate_navigation()
|
|
indvdum@0
|
455 |
{
|
|
indvdum@0
|
456 |
global $lang, $template, $phpEx, $language;
|
|
indvdum@0
|
457 |
|
|
indvdum@0
|
458 |
if (is_array($this->module_ary))
|
|
indvdum@0
|
459 |
{
|
|
indvdum@0
|
460 |
@ksort($this->module_ary);
|
|
indvdum@0
|
461 |
foreach ($this->module_ary as $cat_ary)
|
|
indvdum@0
|
462 |
{
|
|
indvdum@0
|
463 |
$cat = $cat_ary['name'];
|
|
indvdum@0
|
464 |
$l_cat = (!empty($lang['CAT_' . $cat])) ? $lang['CAT_' . $cat] : preg_replace('#_#', ' ', $cat);
|
|
indvdum@0
|
465 |
$cat = strtolower($cat);
|
|
indvdum@0
|
466 |
$url = $this->module_url . "?mode=$cat&language=$language";
|
|
indvdum@0
|
467 |
|
|
indvdum@0
|
468 |
if ($this->mode == $cat)
|
|
indvdum@0
|
469 |
{
|
|
indvdum@0
|
470 |
$template->assign_block_vars('t_block1', array(
|
|
indvdum@0
|
471 |
'L_TITLE' => $l_cat,
|
|
indvdum@0
|
472 |
'S_SELECTED' => true,
|
|
indvdum@0
|
473 |
'U_TITLE' => $url,
|
|
indvdum@0
|
474 |
));
|
|
indvdum@0
|
475 |
|
|
indvdum@0
|
476 |
if (is_array($this->module_ary[$this->id]['subs']))
|
|
indvdum@0
|
477 |
{
|
|
indvdum@0
|
478 |
$subs = $this->module_ary[$this->id]['subs'];
|
|
indvdum@0
|
479 |
foreach ($subs as $option)
|
|
indvdum@0
|
480 |
{
|
|
indvdum@0
|
481 |
$l_option = (!empty($lang['SUB_' . $option])) ? $lang['SUB_' . $option] : preg_replace('#_#', ' ', $option);
|
|
indvdum@0
|
482 |
$option = strtolower($option);
|
|
indvdum@0
|
483 |
$url = $this->module_url . '?mode=' . $this->mode . "&sub=$option&language=$language";
|
|
indvdum@0
|
484 |
|
|
indvdum@0
|
485 |
$template->assign_block_vars('l_block1', array(
|
|
indvdum@0
|
486 |
'L_TITLE' => $l_option,
|
|
indvdum@0
|
487 |
'S_SELECTED' => ($this->sub == $option),
|
|
indvdum@0
|
488 |
'U_TITLE' => $url,
|
|
indvdum@0
|
489 |
));
|
|
indvdum@0
|
490 |
}
|
|
indvdum@0
|
491 |
}
|
|
indvdum@0
|
492 |
|
|
indvdum@0
|
493 |
if (is_array($this->module_ary[$this->id]['stages']))
|
|
indvdum@0
|
494 |
{
|
|
indvdum@0
|
495 |
$subs = $this->module_ary[$this->id]['stages'];
|
|
indvdum@0
|
496 |
$matched = false;
|
|
indvdum@0
|
497 |
foreach ($subs as $option)
|
|
indvdum@0
|
498 |
{
|
|
indvdum@0
|
499 |
$l_option = (!empty($lang['STAGE_' . $option])) ? $lang['STAGE_' . $option] : preg_replace('#_#', ' ', $option);
|
|
indvdum@0
|
500 |
$option = strtolower($option);
|
|
indvdum@0
|
501 |
$matched = ($this->sub == $option) ? true : $matched;
|
|
indvdum@0
|
502 |
|
|
indvdum@0
|
503 |
$template->assign_block_vars('l_block2', array(
|
|
indvdum@0
|
504 |
'L_TITLE' => $l_option,
|
|
indvdum@0
|
505 |
'S_SELECTED' => ($this->sub == $option),
|
|
indvdum@0
|
506 |
'S_COMPLETE' => !$matched,
|
|
indvdum@0
|
507 |
));
|
|
indvdum@0
|
508 |
}
|
|
indvdum@0
|
509 |
}
|
|
indvdum@0
|
510 |
}
|
|
indvdum@0
|
511 |
else
|
|
indvdum@0
|
512 |
{
|
|
indvdum@0
|
513 |
$template->assign_block_vars('t_block1', array(
|
|
indvdum@0
|
514 |
'L_TITLE' => $l_cat,
|
|
indvdum@0
|
515 |
'S_SELECTED' => false,
|
|
indvdum@0
|
516 |
'U_TITLE' => $url,
|
|
indvdum@0
|
517 |
));
|
|
indvdum@0
|
518 |
}
|
|
indvdum@0
|
519 |
}
|
|
indvdum@0
|
520 |
}
|
|
indvdum@0
|
521 |
}
|
|
indvdum@0
|
522 |
|
|
indvdum@0
|
523 |
/**
|
|
indvdum@0
|
524 |
* Output an error message
|
|
indvdum@0
|
525 |
* If skip is true, return and continue execution, else exit
|
|
indvdum@0
|
526 |
*/
|
|
indvdum@0
|
527 |
function error($error, $line, $file, $skip = false)
|
|
indvdum@0
|
528 |
{
|
|
indvdum@0
|
529 |
global $lang, $db, $template;
|
|
indvdum@0
|
530 |
|
|
indvdum@0
|
531 |
if ($skip)
|
|
indvdum@0
|
532 |
{
|
|
indvdum@0
|
533 |
$template->assign_block_vars('checks', array(
|
|
indvdum@0
|
534 |
'S_LEGEND' => true,
|
|
indvdum@0
|
535 |
'LEGEND' => $lang['INST_ERR'],
|
|
indvdum@0
|
536 |
));
|
|
indvdum@0
|
537 |
|
|
indvdum@0
|
538 |
$template->assign_block_vars('checks', array(
|
|
indvdum@0
|
539 |
'TITLE' => basename($file) . ' [ ' . $line . ' ]',
|
|
indvdum@0
|
540 |
'RESULT' => '<b style="color:red">' . $error . '</b>',
|
|
indvdum@0
|
541 |
));
|
|
indvdum@0
|
542 |
|
|
indvdum@0
|
543 |
return;
|
|
indvdum@0
|
544 |
}
|
|
indvdum@0
|
545 |
|
|
indvdum@0
|
546 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
|
indvdum@0
|
547 |
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
|
|
indvdum@0
|
548 |
echo '<head>';
|
|
indvdum@0
|
549 |
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
|
|
indvdum@0
|
550 |
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
|
|
indvdum@0
|
551 |
echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
|
|
indvdum@0
|
552 |
echo '</head>';
|
|
indvdum@0
|
553 |
echo '<body id="errorpage">';
|
|
indvdum@0
|
554 |
echo '<div id="wrap">';
|
|
indvdum@0
|
555 |
echo ' <div id="page-header">';
|
|
indvdum@0
|
556 |
echo ' </div>';
|
|
indvdum@0
|
557 |
echo ' <div id="page-body">';
|
|
indvdum@0
|
558 |
echo ' <div id="acp">';
|
|
indvdum@0
|
559 |
echo ' <div class="panel">';
|
|
indvdum@0
|
560 |
echo ' <span class="corners-top"><span></span></span>';
|
|
indvdum@0
|
561 |
echo ' <div id="content">';
|
|
indvdum@0
|
562 |
echo ' <h1>' . $lang['INST_ERR_FATAL'] . '</h1>';
|
|
indvdum@0
|
563 |
echo ' <p>' . $lang['INST_ERR_FATAL'] . "</p>\n";
|
|
indvdum@0
|
564 |
echo ' <p>' . basename($file) . ' [ ' . $line . " ]</p>\n";
|
|
indvdum@0
|
565 |
echo ' <p><b>' . $error . "</b></p>\n";
|
|
indvdum@0
|
566 |
echo ' </div>';
|
|
indvdum@0
|
567 |
echo ' <span class="corners-bottom"><span></span></span>';
|
|
indvdum@0
|
568 |
echo ' </div>';
|
|
indvdum@0
|
569 |
echo ' </div>';
|
|
indvdum@0
|
570 |
echo ' </div>';
|
|
indvdum@0
|
571 |
echo ' <div id="page-footer">';
|
|
indvdum@0
|
572 |
echo ' Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group';
|
|
indvdum@0
|
573 |
echo ' </div>';
|
|
indvdum@0
|
574 |
echo '</div>';
|
|
indvdum@0
|
575 |
echo '</body>';
|
|
indvdum@0
|
576 |
echo '</html>';
|
|
indvdum@0
|
577 |
|
|
indvdum@0
|
578 |
if (!empty($db) && is_object($db))
|
|
indvdum@0
|
579 |
{
|
|
indvdum@0
|
580 |
$db->sql_close();
|
|
indvdum@0
|
581 |
}
|
|
indvdum@0
|
582 |
|
|
indvdum@0
|
583 |
exit_handler();
|
|
indvdum@0
|
584 |
}
|
|
indvdum@0
|
585 |
|
|
indvdum@0
|
586 |
/**
|
|
indvdum@0
|
587 |
* Output an error message for a database related problem
|
|
indvdum@0
|
588 |
* If skip is true, return and continue execution, else exit
|
|
indvdum@0
|
589 |
*/
|
|
indvdum@0
|
590 |
function db_error($error, $sql, $line, $file, $skip = false)
|
|
indvdum@0
|
591 |
{
|
|
indvdum@0
|
592 |
global $lang, $db, $template;
|
|
indvdum@0
|
593 |
|
|
indvdum@0
|
594 |
if ($skip)
|
|
indvdum@0
|
595 |
{
|
|
indvdum@0
|
596 |
$template->assign_block_vars('checks', array(
|
|
indvdum@0
|
597 |
'S_LEGEND' => true,
|
|
indvdum@0
|
598 |
'LEGEND' => $lang['INST_ERR_FATAL'],
|
|
indvdum@0
|
599 |
));
|
|
indvdum@0
|
600 |
|
|
indvdum@0
|
601 |
$template->assign_block_vars('checks', array(
|
|
indvdum@0
|
602 |
'TITLE' => basename($file) . ' [ ' . $line . ' ]',
|
|
indvdum@0
|
603 |
'RESULT' => '<b style="color:red">' . $error . '</b><br />» SQL:' . $sql,
|
|
indvdum@0
|
604 |
));
|
|
indvdum@0
|
605 |
|
|
indvdum@0
|
606 |
return;
|
|
indvdum@0
|
607 |
}
|
|
indvdum@0
|
608 |
|
|
indvdum@0
|
609 |
$template->set_filenames(array(
|
|
indvdum@0
|
610 |
'body' => 'install_error.html')
|
|
indvdum@0
|
611 |
);
|
|
indvdum@0
|
612 |
$this->page_header();
|
|
indvdum@0
|
613 |
$this->generate_navigation();
|
|
indvdum@0
|
614 |
|
|
indvdum@0
|
615 |
$template->assign_vars(array(
|
|
indvdum@0
|
616 |
'MESSAGE_TITLE' => $lang['INST_ERR_FATAL_DB'],
|
|
indvdum@0
|
617 |
'MESSAGE_TEXT' => '<p>' . basename($file) . ' [ ' . $line . ' ]</p><p>SQL : ' . $sql . '</p><p><b>' . $error . '</b></p>',
|
|
indvdum@0
|
618 |
));
|
|
indvdum@0
|
619 |
|
|
indvdum@0
|
620 |
// Rollback if in transaction
|
|
indvdum@0
|
621 |
if ($db->transaction)
|
|
indvdum@0
|
622 |
{
|
|
indvdum@0
|
623 |
$db->sql_transaction('rollback');
|
|
indvdum@0
|
624 |
}
|
|
indvdum@0
|
625 |
|
|
indvdum@0
|
626 |
$this->page_footer();
|
|
indvdum@0
|
627 |
}
|
|
indvdum@0
|
628 |
|
|
indvdum@0
|
629 |
/**
|
|
indvdum@0
|
630 |
* Generate the relevant HTML for an input field and the associated label and explanatory text
|
|
indvdum@0
|
631 |
*/
|
|
indvdum@0
|
632 |
function input_field($name, $type, $value='', $options='')
|
|
indvdum@0
|
633 |
{
|
|
indvdum@0
|
634 |
global $lang;
|
|
indvdum@0
|
635 |
$tpl_type = explode(':', $type);
|
|
indvdum@0
|
636 |
$tpl = '';
|
|
indvdum@0
|
637 |
|
|
indvdum@0
|
638 |
switch ($tpl_type[0])
|
|
indvdum@0
|
639 |
{
|
|
indvdum@0
|
640 |
case 'text':
|
|
indvdum@0
|
641 |
case 'password':
|
|
indvdum@0
|
642 |
$size = (int) $tpl_type[1];
|
|
indvdum@0
|
643 |
$maxlength = (int) $tpl_type[2];
|
|
indvdum@0
|
644 |
|
|
indvdum@0
|
645 |
$tpl = '<input id="' . $name . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $value . '" />';
|
|
indvdum@0
|
646 |
break;
|
|
indvdum@0
|
647 |
|
|
indvdum@0
|
648 |
case 'textarea':
|
|
indvdum@0
|
649 |
$rows = (int) $tpl_type[1];
|
|
indvdum@0
|
650 |
$cols = (int) $tpl_type[2];
|
|
indvdum@0
|
651 |
|
|
indvdum@0
|
652 |
$tpl = '<textarea id="' . $name . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $value . '</textarea>';
|
|
indvdum@0
|
653 |
break;
|
|
indvdum@0
|
654 |
|
|
indvdum@0
|
655 |
case 'radio':
|
|
indvdum@0
|
656 |
$key_yes = ($value) ? ' checked="checked" id="' . $name . '"' : '';
|
|
indvdum@0
|
657 |
$key_no = (!$value) ? ' checked="checked" id="' . $name . '"' : '';
|
|
indvdum@0
|
658 |
|
|
indvdum@0
|
659 |
$tpl_type_cond = explode('_', $tpl_type[1]);
|
|
indvdum@0
|
660 |
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
|
|
indvdum@0
|
661 |
|
|
indvdum@0
|
662 |
$tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? $lang['NO'] : $lang['DISABLED']) . '</label>';
|
|
indvdum@0
|
663 |
$tpl_yes = '<label><input type="radio" name="' . $name . '" value="1"' . $key_yes . ' class="radio" /> ' . (($type_no) ? $lang['YES'] : $lang['ENABLED']) . '</label>';
|
|
indvdum@0
|
664 |
|
|
indvdum@0
|
665 |
$tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . ' ' . $tpl_no : $tpl_no . ' ' . $tpl_yes;
|
|
indvdum@0
|
666 |
break;
|
|
indvdum@0
|
667 |
|
|
indvdum@0
|
668 |
case 'select':
|
|
indvdum@0
|
669 |
eval('$s_options = ' . str_replace('{VALUE}', $value, $options) . ';');
|
|
indvdum@0
|
670 |
$tpl = '<select id="' . $name . '" name="' . $name . '">' . $s_options . '</select>';
|
|
indvdum@0
|
671 |
break;
|
|
indvdum@0
|
672 |
|
|
indvdum@0
|
673 |
case 'custom':
|
|
indvdum@0
|
674 |
eval('$tpl = ' . str_replace('{VALUE}', $value, $options) . ';');
|
|
indvdum@0
|
675 |
break;
|
|
indvdum@0
|
676 |
|
|
indvdum@0
|
677 |
default:
|
|
indvdum@0
|
678 |
break;
|
|
indvdum@0
|
679 |
}
|
|
indvdum@0
|
680 |
|
|
indvdum@0
|
681 |
return $tpl;
|
|
indvdum@0
|
682 |
}
|
|
indvdum@0
|
683 |
|
|
indvdum@0
|
684 |
/**
|
|
indvdum@0
|
685 |
* Generate the drop down of available language packs
|
|
indvdum@0
|
686 |
*/
|
|
indvdum@0
|
687 |
function inst_language_select($default = '')
|
|
indvdum@0
|
688 |
{
|
|
indvdum@0
|
689 |
global $phpbb_root_path, $phpEx;
|
|
indvdum@0
|
690 |
|
|
indvdum@0
|
691 |
$dir = @opendir($phpbb_root_path . 'language');
|
|
indvdum@0
|
692 |
|
|
indvdum@0
|
693 |
if (!$dir)
|
|
indvdum@0
|
694 |
{
|
|
indvdum@0
|
695 |
$this->error('Unable to access the language directory', __LINE__, __FILE__);
|
|
indvdum@0
|
696 |
}
|
|
indvdum@0
|
697 |
|
|
indvdum@0
|
698 |
while ($file = readdir($dir))
|
|
indvdum@0
|
699 |
{
|
|
indvdum@0
|
700 |
$path = $phpbb_root_path . 'language/' . $file;
|
|
indvdum@0
|
701 |
|
|
indvdum@0
|
702 |
if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS')
|
|
indvdum@0
|
703 |
{
|
|
indvdum@0
|
704 |
continue;
|
|
indvdum@0
|
705 |
}
|
|
indvdum@0
|
706 |
|
|
indvdum@0
|
707 |
if (file_exists($path . '/iso.txt'))
|
|
indvdum@0
|
708 |
{
|
|
indvdum@0
|
709 |
list($displayname, $localname) = @file($path . '/iso.txt');
|
|
indvdum@0
|
710 |
$lang[$localname] = $file;
|
|
indvdum@0
|
711 |
}
|
|
indvdum@0
|
712 |
}
|
|
indvdum@0
|
713 |
closedir($dir);
|
|
indvdum@0
|
714 |
|
|
indvdum@0
|
715 |
@asort($lang);
|
|
indvdum@0
|
716 |
@reset($lang);
|
|
indvdum@0
|
717 |
|
|
indvdum@0
|
718 |
$user_select = '';
|
|
indvdum@0
|
719 |
foreach ($lang as $displayname => $filename)
|
|
indvdum@0
|
720 |
{
|
|
indvdum@0
|
721 |
$selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : '';
|
|
indvdum@0
|
722 |
$user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
|
|
indvdum@0
|
723 |
}
|
|
indvdum@0
|
724 |
|
|
indvdum@0
|
725 |
return $user_select;
|
|
indvdum@0
|
726 |
}
|
|
indvdum@0
|
727 |
}
|
|
indvdum@0
|
728 |
|
|
indvdum@0
|
729 |
?> |