[1927] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[2297] | 4 | // +-----------------------------------------------------------------------+ |
---|
[19703] | 5 | // | Copyright(C) 2008-2013 Piwigo Team http://piwigo.org | |
---|
[2297] | 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
[1927] | 23 | |
---|
| 24 | define('PHPWG_ROOT_PATH', './'); |
---|
| 25 | |
---|
[2863] | 26 | // load config file |
---|
[12768] | 27 | include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); |
---|
| 28 | @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); |
---|
| 29 | defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/'); |
---|
[8722] | 30 | |
---|
| 31 | $config_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'config/database.inc.php'; |
---|
[2863] | 32 | $config_file_contents = @file_get_contents($config_file); |
---|
| 33 | if ($config_file_contents === false) |
---|
[2836] | 34 | { |
---|
[2863] | 35 | die('Cannot load '.$config_file); |
---|
[2836] | 36 | } |
---|
[2863] | 37 | $php_end_tag = strrpos($config_file_contents, '?'.'>'); |
---|
| 38 | if ($php_end_tag === false) |
---|
| 39 | { |
---|
| 40 | die('Cannot find php end tag in '.$config_file); |
---|
| 41 | } |
---|
[2836] | 42 | |
---|
[8722] | 43 | include($config_file); |
---|
[1927] | 44 | |
---|
[5387] | 45 | // $conf is not used for users tables - define cannot be re-defined |
---|
| 46 | define('USERS_TABLE', $prefixeTable.'users'); |
---|
[1927] | 47 | include_once(PHPWG_ROOT_PATH.'include/constants.php'); |
---|
| 48 | define('PREFIX_TABLE', $prefixeTable); |
---|
[5982] | 49 | define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db'); |
---|
[1927] | 50 | |
---|
[6110] | 51 | include_once(PHPWG_ROOT_PATH.'include/functions.inc.php'); |
---|
| 52 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
| 53 | |
---|
[1927] | 54 | // +-----------------------------------------------------------------------+ |
---|
| 55 | // | functions | |
---|
| 56 | // +-----------------------------------------------------------------------+ |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | * list all tables in an array |
---|
| 60 | * |
---|
| 61 | * @return array |
---|
| 62 | */ |
---|
| 63 | function get_tables() |
---|
| 64 | { |
---|
| 65 | $tables = array(); |
---|
[2290] | 66 | |
---|
[1927] | 67 | $query = ' |
---|
| 68 | SHOW TABLES |
---|
| 69 | ;'; |
---|
[2884] | 70 | $result = pwg_query($query); |
---|
[1927] | 71 | |
---|
[4325] | 72 | while ($row = pwg_db_fetch_row($result)) |
---|
[1927] | 73 | { |
---|
| 74 | if (preg_match('/^'.PREFIX_TABLE.'/', $row[0])) |
---|
| 75 | { |
---|
| 76 | array_push($tables, $row[0]); |
---|
| 77 | } |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | return $tables; |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * list all columns of each given table |
---|
| 85 | * |
---|
| 86 | * @return array of array |
---|
| 87 | */ |
---|
| 88 | function get_columns_of($tables) |
---|
| 89 | { |
---|
| 90 | $columns_of = array(); |
---|
| 91 | |
---|
| 92 | foreach ($tables as $table) |
---|
| 93 | { |
---|
| 94 | $query = ' |
---|
| 95 | DESC '.$table.' |
---|
| 96 | ;'; |
---|
[2884] | 97 | $result = pwg_query($query); |
---|
[1927] | 98 | |
---|
| 99 | $columns_of[$table] = array(); |
---|
| 100 | |
---|
[4325] | 101 | while ($row = pwg_db_fetch_row($result)) |
---|
[1927] | 102 | { |
---|
| 103 | array_push($columns_of[$table], $row[0]); |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | return $columns_of; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | /** |
---|
| 111 | */ |
---|
| 112 | function print_time($message) |
---|
| 113 | { |
---|
| 114 | global $last_time; |
---|
[2290] | 115 | |
---|
[1927] | 116 | $new_time = get_moment(); |
---|
| 117 | echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
---|
| 118 | echo ' '.$message; |
---|
| 119 | echo '</pre>'; |
---|
| 120 | flush(); |
---|
| 121 | $last_time = $new_time; |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | // +-----------------------------------------------------------------------+ |
---|
| 125 | // | playing zone | |
---|
| 126 | // +-----------------------------------------------------------------------+ |
---|
| 127 | |
---|
| 128 | // echo implode('<br>', get_tables()); |
---|
| 129 | // echo '<pre>'; print_r(get_columns_of(get_tables())); echo '</pre>'; |
---|
| 130 | |
---|
| 131 | // foreach (get_available_upgrade_ids() as $upgrade_id) |
---|
| 132 | // { |
---|
| 133 | // echo $upgrade_id, '<br>'; |
---|
| 134 | // } |
---|
| 135 | |
---|
| 136 | // +-----------------------------------------------------------------------+ |
---|
[2819] | 137 | // | language | |
---|
| 138 | // +-----------------------------------------------------------------------+ |
---|
[5387] | 139 | include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php'); |
---|
| 140 | $languages = new languages('utf-8'); |
---|
| 141 | |
---|
[2819] | 142 | if (isset($_GET['language'])) |
---|
| 143 | { |
---|
| 144 | $language = strip_tags($_GET['language']); |
---|
[13956] | 145 | |
---|
| 146 | if (!in_array($language, array_keys($languages->fs_languages))) |
---|
| 147 | { |
---|
| 148 | $language = PHPWG_DEFAULT_LANGUAGE; |
---|
| 149 | } |
---|
[2819] | 150 | } |
---|
| 151 | else |
---|
| 152 | { |
---|
| 153 | $language = 'en_UK'; |
---|
| 154 | // Try to get browser language |
---|
[9518] | 155 | foreach ($languages->fs_languages as $language_code => $fs_language) |
---|
[2819] | 156 | { |
---|
| 157 | if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)) |
---|
| 158 | { |
---|
| 159 | $language = $language_code; |
---|
| 160 | break; |
---|
| 161 | } |
---|
| 162 | } |
---|
| 163 | } |
---|
| 164 | |
---|
[3203] | 165 | if ('fr_FR' == $language) { |
---|
| 166 | define('PHPWG_DOMAIN', 'fr.piwigo.org'); |
---|
| 167 | } |
---|
[5234] | 168 | else if ('it_IT' == $language) { |
---|
| 169 | define('PHPWG_DOMAIN', 'it.piwigo.org'); |
---|
| 170 | } |
---|
| 171 | else if ('de_DE' == $language) { |
---|
| 172 | define('PHPWG_DOMAIN', 'de.piwigo.org'); |
---|
| 173 | } |
---|
| 174 | else if ('es_ES' == $language) { |
---|
| 175 | define('PHPWG_DOMAIN', 'es.piwigo.org'); |
---|
| 176 | } |
---|
[4816] | 177 | else if ('pl_PL' == $language) { |
---|
| 178 | define('PHPWG_DOMAIN', 'pl.piwigo.org'); |
---|
| 179 | } |
---|
| 180 | else if ('zh_CN' == $language) { |
---|
| 181 | define('PHPWG_DOMAIN', 'cn.piwigo.org'); |
---|
| 182 | } |
---|
[5234] | 183 | else if ('hu_HU' == $language) { |
---|
| 184 | define('PHPWG_DOMAIN', 'hu.piwigo.org'); |
---|
| 185 | } |
---|
| 186 | else if ('ru_RU' == $language) { |
---|
| 187 | define('PHPWG_DOMAIN', 'ru.piwigo.org'); |
---|
| 188 | } |
---|
[6152] | 189 | else if ('nl_NL' == $language) { |
---|
| 190 | define('PHPWG_DOMAIN', 'nl.piwigo.org'); |
---|
| 191 | } |
---|
[3203] | 192 | else { |
---|
| 193 | define('PHPWG_DOMAIN', 'piwigo.org'); |
---|
| 194 | } |
---|
| 195 | define('PHPWG_URL', 'http://'.PHPWG_DOMAIN); |
---|
| 196 | |
---|
[2836] | 197 | load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
| 198 | load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
[3203] | 199 | load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
[2836] | 200 | load_language( 'upgrade.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
[2819] | 201 | |
---|
[3203] | 202 | // check php version |
---|
| 203 | if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) |
---|
| 204 | { |
---|
| 205 | include(PHPWG_ROOT_PATH.'install/php5_apache_configuration.php'); |
---|
| 206 | } |
---|
| 207 | |
---|
[2819] | 208 | // +-----------------------------------------------------------------------+ |
---|
[5387] | 209 | // | database connection | |
---|
| 210 | // +-----------------------------------------------------------------------+ |
---|
| 211 | include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php'); |
---|
| 212 | include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php'); |
---|
| 213 | |
---|
| 214 | upgrade_db_connect(); |
---|
| 215 | pwg_db_check_charset(); |
---|
| 216 | |
---|
[5982] | 217 | list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); |
---|
| 218 | define('CURRENT_DATE', $dbnow); |
---|
| 219 | |
---|
[5387] | 220 | // +-----------------------------------------------------------------------+ |
---|
[1927] | 221 | // | template initialization | |
---|
| 222 | // +-----------------------------------------------------------------------+ |
---|
| 223 | |
---|
[9596] | 224 | $template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'clear'); |
---|
[1927] | 225 | $template->set_filenames(array('upgrade'=>'upgrade.tpl')); |
---|
[3203] | 226 | $template->assign(array( |
---|
| 227 | 'RELEASE' => PHPWG_VERSION, |
---|
[5207] | 228 | 'L_UPGRADE_HELP' => sprintf(l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.'), PHPWG_URL.'/forum'), |
---|
[3203] | 229 | ) |
---|
| 230 | ); |
---|
[1927] | 231 | |
---|
| 232 | // +-----------------------------------------------------------------------+ |
---|
[15680] | 233 | // | Remote sites are not compatible with Piwigo 2.4+ | |
---|
| 234 | // +-----------------------------------------------------------------------+ |
---|
| 235 | |
---|
| 236 | $has_remote_site = false; |
---|
| 237 | |
---|
| 238 | $query = 'SELECT galleries_url FROM '.SITES_TABLE.';'; |
---|
| 239 | $result = pwg_query($query); |
---|
| 240 | while ($row = pwg_db_fetch_assoc($result)) |
---|
| 241 | { |
---|
| 242 | if (url_is_remote($row['galleries_url'])) |
---|
| 243 | { |
---|
| 244 | $has_remote_site = true; |
---|
| 245 | } |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | if ($has_remote_site) |
---|
| 249 | { |
---|
| 250 | include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php'); |
---|
| 251 | include_once(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php'); |
---|
| 252 | |
---|
| 253 | $page['errors'] = array(); |
---|
| 254 | $step = 3; |
---|
| 255 | updates::upgrade_to('2.3.4', $step, false); |
---|
| 256 | |
---|
| 257 | if (!empty($page['errors'])) |
---|
| 258 | { |
---|
| 259 | echo '<ul>'; |
---|
| 260 | foreach ($page['errors'] as $error) |
---|
| 261 | { |
---|
| 262 | echo '<li>'.$error.'</li>'; |
---|
| 263 | } |
---|
| 264 | echo '</ul>'; |
---|
| 265 | } |
---|
| 266 | |
---|
| 267 | exit(); |
---|
| 268 | } |
---|
| 269 | |
---|
| 270 | // +-----------------------------------------------------------------------+ |
---|
[1927] | 271 | // | upgrade choice | |
---|
| 272 | // +-----------------------------------------------------------------------+ |
---|
| 273 | |
---|
[1999] | 274 | $tables = get_tables(); |
---|
| 275 | $columns_of = get_columns_of($tables); |
---|
| 276 | |
---|
[2836] | 277 | // find the current release |
---|
| 278 | if (!in_array('param', $columns_of[PREFIX_TABLE.'config'])) |
---|
[1927] | 279 | { |
---|
[2836] | 280 | // we're in branch 1.3, important upgrade, isn't it? |
---|
| 281 | if (in_array(PREFIX_TABLE.'user_category', $tables)) |
---|
[1927] | 282 | { |
---|
[2836] | 283 | $current_release = '1.3.1'; |
---|
[1927] | 284 | } |
---|
[2836] | 285 | else |
---|
[1927] | 286 | { |
---|
[2836] | 287 | $current_release = '1.3.0'; |
---|
[1927] | 288 | } |
---|
[2836] | 289 | } |
---|
| 290 | else if (!in_array(PREFIX_TABLE.'user_cache', $tables)) |
---|
| 291 | { |
---|
| 292 | $current_release = '1.4.0'; |
---|
| 293 | } |
---|
| 294 | else if (!in_array(PREFIX_TABLE.'tags', $tables)) |
---|
| 295 | { |
---|
| 296 | $current_release = '1.5.0'; |
---|
| 297 | } |
---|
[2862] | 298 | else if ( !in_array(PREFIX_TABLE.'plugins', $tables) ) |
---|
[2836] | 299 | { |
---|
| 300 | if (!in_array('auto_login_key', $columns_of[PREFIX_TABLE.'user_infos'])) |
---|
[1927] | 301 | { |
---|
[2836] | 302 | $current_release = '1.6.0'; |
---|
[1927] | 303 | } |
---|
| 304 | else |
---|
| 305 | { |
---|
[2836] | 306 | $current_release = '1.6.2'; |
---|
[1927] | 307 | } |
---|
| 308 | } |
---|
[2836] | 309 | else if (!in_array('md5sum', $columns_of[PREFIX_TABLE.'images'])) |
---|
| 310 | { |
---|
| 311 | $current_release = '1.7.0'; |
---|
| 312 | } |
---|
[5982] | 313 | else if (!in_array(PREFIX_TABLE.'themes', $tables)) |
---|
| 314 | { |
---|
| 315 | $current_release = '2.0.0'; |
---|
| 316 | } |
---|
[9595] | 317 | else if (!in_array('added_by', $columns_of[PREFIX_TABLE.'images'])) |
---|
| 318 | { |
---|
| 319 | $current_release = '2.1.0'; |
---|
| 320 | } |
---|
[12296] | 321 | else if (!in_array('rating_score', $columns_of[PREFIX_TABLE.'images'])) |
---|
| 322 | { |
---|
| 323 | $current_release = '2.2.0'; |
---|
| 324 | } |
---|
[2836] | 325 | else |
---|
| 326 | { |
---|
[16313] | 327 | // retrieve already applied upgrades |
---|
| 328 | $query = ' |
---|
| 329 | SELECT id |
---|
| 330 | FROM '.PREFIX_TABLE.'upgrade |
---|
| 331 | ;'; |
---|
| 332 | $applied_upgrades = array_from_query($query, 'id'); |
---|
| 333 | |
---|
| 334 | if (!in_array(127, $applied_upgrades)) |
---|
| 335 | { |
---|
| 336 | $current_release = '2.3.0'; |
---|
| 337 | } |
---|
| 338 | else |
---|
| 339 | { |
---|
| 340 | // confirm that the database is in the same version as source code files |
---|
| 341 | conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); |
---|
| 342 | |
---|
| 343 | echo 'No upgrade required, the database structure is up to date'; |
---|
| 344 | echo '<br><a href="index.php">← back to gallery</a>'; |
---|
| 345 | exit(); |
---|
| 346 | } |
---|
[2836] | 347 | } |
---|
[1927] | 348 | |
---|
| 349 | // +-----------------------------------------------------------------------+ |
---|
| 350 | // | upgrade launch | |
---|
| 351 | // +-----------------------------------------------------------------------+ |
---|
[2836] | 352 | $page['infos'] = array(); |
---|
| 353 | $page['errors'] = array(); |
---|
[2863] | 354 | $mysql_changes = array(); |
---|
[1927] | 355 | |
---|
[6110] | 356 | check_upgrade_access_rights(); |
---|
[2254] | 357 | |
---|
[6110] | 358 | if ((isset($_POST['submit']) or isset($_GET['now'])) |
---|
| 359 | and check_upgrade()) |
---|
[2836] | 360 | { |
---|
| 361 | $upgrade_file = PHPWG_ROOT_PATH.'install/upgrade_'.$current_release.'.php'; |
---|
[1927] | 362 | if (is_file($upgrade_file)) |
---|
| 363 | { |
---|
| 364 | $page['upgrade_start'] = get_moment(); |
---|
| 365 | $conf['die_on_sql_error'] = false; |
---|
| 366 | include($upgrade_file); |
---|
[11511] | 367 | conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); |
---|
[1927] | 368 | |
---|
[5213] | 369 | // Something to add in database.inc.php? |
---|
[2863] | 370 | if (!empty($mysql_changes)) |
---|
| 371 | { |
---|
| 372 | $config_file_contents = |
---|
| 373 | substr($config_file_contents, 0, $php_end_tag) . "\r\n" |
---|
[2865] | 374 | . implode("\r\n" , $mysql_changes) . "\r\n" |
---|
[2863] | 375 | . substr($config_file_contents, $php_end_tag); |
---|
| 376 | |
---|
| 377 | if (!@file_put_contents($config_file, $config_file_contents)) |
---|
| 378 | { |
---|
[5982] | 379 | array_push( |
---|
| 380 | $page['infos'], |
---|
| 381 | sprintf( |
---|
| 382 | l10n('In <i>%s</i>, before <b>?></b>, insert:'), |
---|
[8722] | 383 | PWG_LOCAL_DIR.'config/database.inc.php' |
---|
[5982] | 384 | ) |
---|
| 385 | .'<p><textarea rows="4" cols="40">' |
---|
| 386 | .implode("\r\n" , $mysql_changes).'</textarea></p>' |
---|
| 387 | ); |
---|
[2863] | 388 | } |
---|
| 389 | } |
---|
| 390 | |
---|
[2787] | 391 | // Plugins deactivation |
---|
| 392 | if (in_array(PREFIX_TABLE.'plugins', $tables)) |
---|
| 393 | { |
---|
[2815] | 394 | deactivate_non_standard_plugins(); |
---|
[2787] | 395 | } |
---|
| 396 | |
---|
[9597] | 397 | deactivate_non_standard_themes(); |
---|
[14206] | 398 | deactivate_templates(); |
---|
[9597] | 399 | |
---|
[1927] | 400 | $page['upgrade_end'] = get_moment(); |
---|
| 401 | |
---|
[2254] | 402 | $template->assign( |
---|
[1927] | 403 | 'upgrade', |
---|
| 404 | array( |
---|
[2836] | 405 | 'VERSION' => $current_release, |
---|
[1927] | 406 | 'TOTAL_TIME' => get_elapsed_time( |
---|
| 407 | $page['upgrade_start'], |
---|
| 408 | $page['upgrade_end'] |
---|
| 409 | ), |
---|
| 410 | 'SQL_TIME' => number_format( |
---|
| 411 | $page['queries_time'], |
---|
| 412 | 3, |
---|
| 413 | '.', |
---|
| 414 | ' ' |
---|
| 415 | ).' s', |
---|
| 416 | 'NB_QUERIES' => $page['count_queries'] |
---|
| 417 | ) |
---|
| 418 | ); |
---|
| 419 | |
---|
[2819] | 420 | array_push($page['infos'], |
---|
[6335] | 421 | l10n('Perform a maintenance check in [Administration>Tools>Maintenance] if you encounter any problem.') |
---|
[1927] | 422 | ); |
---|
| 423 | |
---|
[3072] | 424 | // Save $page['infos'] in order to restore after maintenance actions |
---|
| 425 | $page['infos_sav'] = $page['infos']; |
---|
| 426 | $page['infos'] = array(); |
---|
| 427 | |
---|
[2812] | 428 | // c13y_upgrade plugin means "check integrity after upgrade", so it |
---|
| 429 | // becomes useful just after an upgrade |
---|
[2808] | 430 | $query = ' |
---|
| 431 | REPLACE INTO '.PLUGINS_TABLE.' |
---|
| 432 | (id, state) |
---|
| 433 | VALUES (\'c13y_upgrade\', \'active\') |
---|
| 434 | ;'; |
---|
| 435 | pwg_query($query); |
---|
[2890] | 436 | |
---|
| 437 | // Delete cache data |
---|
| 438 | invalidate_user_cache(true); |
---|
| 439 | $template->delete_compiled_templates(); |
---|
| 440 | |
---|
| 441 | // Tables Maintenance |
---|
| 442 | do_maintenance_all_tables(); |
---|
| 443 | |
---|
[3072] | 444 | // Restore $page['infos'] in order to hide informations messages from functions calles |
---|
| 445 | // errors messages are not hide |
---|
| 446 | $page['infos'] = $page['infos_sav']; |
---|
| 447 | |
---|
[1927] | 448 | } |
---|
[2836] | 449 | } |
---|
| 450 | |
---|
| 451 | // +-----------------------------------------------------------------------+ |
---|
| 452 | // | start template output | |
---|
| 453 | // +-----------------------------------------------------------------------+ |
---|
| 454 | else |
---|
| 455 | { |
---|
[5982] | 456 | if (!defined('PWG_CHARSET')) |
---|
[1927] | 457 | { |
---|
[5982] | 458 | define('PWG_CHARSET', 'utf-8'); |
---|
| 459 | } |
---|
| 460 | |
---|
| 461 | include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php'); |
---|
| 462 | $languages = new languages(); |
---|
| 463 | |
---|
[9518] | 464 | foreach ($languages->fs_languages as $language_code => $fs_language) |
---|
[5982] | 465 | { |
---|
[2836] | 466 | if ($language == $language_code) |
---|
| 467 | { |
---|
| 468 | $template->assign('language_selection', $language_code); |
---|
| 469 | } |
---|
[9518] | 470 | $languages_options[$language_code] = $fs_language['name']; |
---|
[1927] | 471 | } |
---|
[2836] | 472 | $template->assign('language_options', $languages_options); |
---|
| 473 | |
---|
| 474 | $template->assign('introduction', array( |
---|
| 475 | 'CURRENT_RELEASE' => $current_release, |
---|
| 476 | 'F_ACTION' => 'upgrade.php?language=' . $language)); |
---|
| 477 | |
---|
| 478 | if (!check_upgrade()) |
---|
| 479 | { |
---|
| 480 | $template->assign('login', true); |
---|
| 481 | } |
---|
[1927] | 482 | } |
---|
| 483 | |
---|
[2836] | 484 | if (count($page['errors']) != 0) |
---|
| 485 | { |
---|
| 486 | $template->assign('errors', $page['errors']); |
---|
| 487 | } |
---|
| 488 | |
---|
| 489 | if (count($page['infos']) != 0) |
---|
| 490 | { |
---|
| 491 | $template->assign('infos', $page['infos']); |
---|
| 492 | } |
---|
| 493 | |
---|
[1927] | 494 | // +-----------------------------------------------------------------------+ |
---|
| 495 | // | sending html code | |
---|
| 496 | // +-----------------------------------------------------------------------+ |
---|
| 497 | |
---|
| 498 | $template->pparse('upgrade'); |
---|
| 499 | ?> |
---|