[1927] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[2297] | 4 | // +-----------------------------------------------------------------------+ |
---|
[26461] | 5 | // | Copyright(C) 2008-2014 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 | { |
---|
[25018] | 76 | $tables[] = $row[0]; |
---|
[1927] | 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 | { |
---|
[25018] | 103 | $columns_of[$table][] = $row[0]; |
---|
[1927] | 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'); |
---|
[2819] | 141 | if (isset($_GET['language'])) |
---|
| 142 | { |
---|
| 143 | $language = strip_tags($_GET['language']); |
---|
[13956] | 144 | |
---|
| 145 | if (!in_array($language, array_keys($languages->fs_languages))) |
---|
| 146 | { |
---|
| 147 | $language = PHPWG_DEFAULT_LANGUAGE; |
---|
| 148 | } |
---|
[2819] | 149 | } |
---|
| 150 | else |
---|
| 151 | { |
---|
| 152 | $language = 'en_UK'; |
---|
| 153 | // Try to get browser language |
---|
[9518] | 154 | foreach ($languages->fs_languages as $language_code => $fs_language) |
---|
[2819] | 155 | { |
---|
| 156 | if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)) |
---|
| 157 | { |
---|
| 158 | $language = $language_code; |
---|
| 159 | break; |
---|
| 160 | } |
---|
| 161 | } |
---|
| 162 | } |
---|
| 163 | |
---|
[3203] | 164 | if ('fr_FR' == $language) { |
---|
| 165 | define('PHPWG_DOMAIN', 'fr.piwigo.org'); |
---|
| 166 | } |
---|
[5234] | 167 | else if ('it_IT' == $language) { |
---|
| 168 | define('PHPWG_DOMAIN', 'it.piwigo.org'); |
---|
| 169 | } |
---|
| 170 | else if ('de_DE' == $language) { |
---|
| 171 | define('PHPWG_DOMAIN', 'de.piwigo.org'); |
---|
| 172 | } |
---|
| 173 | else if ('es_ES' == $language) { |
---|
| 174 | define('PHPWG_DOMAIN', 'es.piwigo.org'); |
---|
| 175 | } |
---|
[4816] | 176 | else if ('pl_PL' == $language) { |
---|
| 177 | define('PHPWG_DOMAIN', 'pl.piwigo.org'); |
---|
| 178 | } |
---|
| 179 | else if ('zh_CN' == $language) { |
---|
| 180 | define('PHPWG_DOMAIN', 'cn.piwigo.org'); |
---|
| 181 | } |
---|
[5234] | 182 | else if ('hu_HU' == $language) { |
---|
| 183 | define('PHPWG_DOMAIN', 'hu.piwigo.org'); |
---|
| 184 | } |
---|
| 185 | else if ('ru_RU' == $language) { |
---|
| 186 | define('PHPWG_DOMAIN', 'ru.piwigo.org'); |
---|
| 187 | } |
---|
[6152] | 188 | else if ('nl_NL' == $language) { |
---|
| 189 | define('PHPWG_DOMAIN', 'nl.piwigo.org'); |
---|
| 190 | } |
---|
[21166] | 191 | else if ('tr_TR' == $language) { |
---|
| 192 | define('PHPWG_DOMAIN', 'tr.piwigo.org'); |
---|
| 193 | } |
---|
| 194 | else if ('da_DK' == $language) { |
---|
| 195 | define('PHPWG_DOMAIN', 'da.piwigo.org'); |
---|
| 196 | } |
---|
[22570] | 197 | else if ('pt_BR' == $language) { |
---|
| 198 | define('PHPWG_DOMAIN', 'br.piwigo.org'); |
---|
| 199 | } |
---|
[3203] | 200 | else { |
---|
| 201 | define('PHPWG_DOMAIN', 'piwigo.org'); |
---|
| 202 | } |
---|
| 203 | define('PHPWG_URL', 'http://'.PHPWG_DOMAIN); |
---|
| 204 | |
---|
[2836] | 205 | load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
| 206 | load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
[3203] | 207 | load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
[2836] | 208 | load_language( 'upgrade.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) ); |
---|
[3203] | 209 | // check php version |
---|
| 210 | if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) |
---|
| 211 | { |
---|
| 212 | include(PHPWG_ROOT_PATH.'install/php5_apache_configuration.php'); |
---|
| 213 | } |
---|
| 214 | |
---|
[2819] | 215 | // +-----------------------------------------------------------------------+ |
---|
[5387] | 216 | // | database connection | |
---|
| 217 | // +-----------------------------------------------------------------------+ |
---|
| 218 | include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php'); |
---|
| 219 | include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php'); |
---|
| 220 | |
---|
| 221 | upgrade_db_connect(); |
---|
| 222 | pwg_db_check_charset(); |
---|
| 223 | |
---|
[5982] | 224 | list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); |
---|
| 225 | define('CURRENT_DATE', $dbnow); |
---|
| 226 | |
---|
[5387] | 227 | // +-----------------------------------------------------------------------+ |
---|
[1927] | 228 | // | template initialization | |
---|
| 229 | // +-----------------------------------------------------------------------+ |
---|
| 230 | |
---|
[9596] | 231 | $template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'clear'); |
---|
[1927] | 232 | $template->set_filenames(array('upgrade'=>'upgrade.tpl')); |
---|
[3203] | 233 | $template->assign(array( |
---|
| 234 | 'RELEASE' => PHPWG_VERSION, |
---|
[25005] | 235 | 'L_UPGRADE_HELP' => l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.', PHPWG_URL.'/forum'), |
---|
[3203] | 236 | ) |
---|
| 237 | ); |
---|
[1927] | 238 | |
---|
| 239 | // +-----------------------------------------------------------------------+ |
---|
[15680] | 240 | // | Remote sites are not compatible with Piwigo 2.4+ | |
---|
| 241 | // +-----------------------------------------------------------------------+ |
---|
| 242 | |
---|
| 243 | $has_remote_site = false; |
---|
| 244 | |
---|
| 245 | $query = 'SELECT galleries_url FROM '.SITES_TABLE.';'; |
---|
| 246 | $result = pwg_query($query); |
---|
| 247 | while ($row = pwg_db_fetch_assoc($result)) |
---|
| 248 | { |
---|
| 249 | if (url_is_remote($row['galleries_url'])) |
---|
| 250 | { |
---|
| 251 | $has_remote_site = true; |
---|
| 252 | } |
---|
| 253 | } |
---|
| 254 | |
---|
| 255 | if ($has_remote_site) |
---|
| 256 | { |
---|
| 257 | include_once(PHPWG_ROOT_PATH.'admin/include/updates.class.php'); |
---|
| 258 | include_once(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php'); |
---|
| 259 | |
---|
| 260 | $page['errors'] = array(); |
---|
| 261 | $step = 3; |
---|
| 262 | updates::upgrade_to('2.3.4', $step, false); |
---|
| 263 | |
---|
| 264 | if (!empty($page['errors'])) |
---|
| 265 | { |
---|
| 266 | echo '<ul>'; |
---|
| 267 | foreach ($page['errors'] as $error) |
---|
| 268 | { |
---|
| 269 | echo '<li>'.$error.'</li>'; |
---|
| 270 | } |
---|
| 271 | echo '</ul>'; |
---|
| 272 | } |
---|
| 273 | |
---|
| 274 | exit(); |
---|
| 275 | } |
---|
| 276 | |
---|
| 277 | // +-----------------------------------------------------------------------+ |
---|
[1927] | 278 | // | upgrade choice | |
---|
| 279 | // +-----------------------------------------------------------------------+ |
---|
| 280 | |
---|
[1999] | 281 | $tables = get_tables(); |
---|
| 282 | $columns_of = get_columns_of($tables); |
---|
| 283 | |
---|
[2836] | 284 | // find the current release |
---|
| 285 | if (!in_array('param', $columns_of[PREFIX_TABLE.'config'])) |
---|
[1927] | 286 | { |
---|
[2836] | 287 | // we're in branch 1.3, important upgrade, isn't it? |
---|
| 288 | if (in_array(PREFIX_TABLE.'user_category', $tables)) |
---|
[1927] | 289 | { |
---|
[2836] | 290 | $current_release = '1.3.1'; |
---|
[1927] | 291 | } |
---|
[2836] | 292 | else |
---|
[1927] | 293 | { |
---|
[2836] | 294 | $current_release = '1.3.0'; |
---|
[1927] | 295 | } |
---|
[2836] | 296 | } |
---|
| 297 | else if (!in_array(PREFIX_TABLE.'user_cache', $tables)) |
---|
| 298 | { |
---|
| 299 | $current_release = '1.4.0'; |
---|
| 300 | } |
---|
| 301 | else if (!in_array(PREFIX_TABLE.'tags', $tables)) |
---|
| 302 | { |
---|
| 303 | $current_release = '1.5.0'; |
---|
| 304 | } |
---|
[2862] | 305 | else if ( !in_array(PREFIX_TABLE.'plugins', $tables) ) |
---|
[2836] | 306 | { |
---|
| 307 | if (!in_array('auto_login_key', $columns_of[PREFIX_TABLE.'user_infos'])) |
---|
[1927] | 308 | { |
---|
[2836] | 309 | $current_release = '1.6.0'; |
---|
[1927] | 310 | } |
---|
| 311 | else |
---|
| 312 | { |
---|
[2836] | 313 | $current_release = '1.6.2'; |
---|
[1927] | 314 | } |
---|
| 315 | } |
---|
[2836] | 316 | else if (!in_array('md5sum', $columns_of[PREFIX_TABLE.'images'])) |
---|
| 317 | { |
---|
| 318 | $current_release = '1.7.0'; |
---|
| 319 | } |
---|
[5982] | 320 | else if (!in_array(PREFIX_TABLE.'themes', $tables)) |
---|
| 321 | { |
---|
| 322 | $current_release = '2.0.0'; |
---|
| 323 | } |
---|
[9595] | 324 | else if (!in_array('added_by', $columns_of[PREFIX_TABLE.'images'])) |
---|
| 325 | { |
---|
| 326 | $current_release = '2.1.0'; |
---|
| 327 | } |
---|
[12296] | 328 | else if (!in_array('rating_score', $columns_of[PREFIX_TABLE.'images'])) |
---|
| 329 | { |
---|
| 330 | $current_release = '2.2.0'; |
---|
| 331 | } |
---|
[21103] | 332 | else if (!in_array('rotation', $columns_of[PREFIX_TABLE.'images'])) |
---|
| 333 | { |
---|
| 334 | $current_release = '2.3.0'; |
---|
| 335 | } |
---|
[26401] | 336 | else if (!in_array('website_url', $columns_of[PREFIX_TABLE.'comments'])) |
---|
| 337 | { |
---|
| 338 | $current_release = '2.4.0'; |
---|
| 339 | } |
---|
[29665] | 340 | else if (!in_array('nb_available_tags', $columns_of[PREFIX_TABLE.'user_cache'])) |
---|
| 341 | { |
---|
| 342 | $current_release = '2.5.0'; |
---|
| 343 | } |
---|
[2836] | 344 | else |
---|
| 345 | { |
---|
[16313] | 346 | // retrieve already applied upgrades |
---|
| 347 | $query = ' |
---|
| 348 | SELECT id |
---|
| 349 | FROM '.PREFIX_TABLE.'upgrade |
---|
| 350 | ;'; |
---|
| 351 | $applied_upgrades = array_from_query($query, 'id'); |
---|
| 352 | |
---|
[29665] | 353 | if (!in_array(144, $applied_upgrades)) |
---|
[16313] | 354 | { |
---|
[29665] | 355 | $current_release = '2.6.0'; |
---|
[16313] | 356 | } |
---|
| 357 | else |
---|
| 358 | { |
---|
| 359 | // confirm that the database is in the same version as source code files |
---|
| 360 | conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); |
---|
[26401] | 361 | |
---|
| 362 | header('Content-Type: text/html; charset='.get_pwg_charset()); |
---|
[16313] | 363 | echo 'No upgrade required, the database structure is up to date'; |
---|
| 364 | echo '<br><a href="index.php">← back to gallery</a>'; |
---|
| 365 | exit(); |
---|
| 366 | } |
---|
[2836] | 367 | } |
---|
[1927] | 368 | |
---|
| 369 | // +-----------------------------------------------------------------------+ |
---|
| 370 | // | upgrade launch | |
---|
| 371 | // +-----------------------------------------------------------------------+ |
---|
[2836] | 372 | $page['infos'] = array(); |
---|
| 373 | $page['errors'] = array(); |
---|
[2863] | 374 | $mysql_changes = array(); |
---|
[1927] | 375 | |
---|
[6110] | 376 | check_upgrade_access_rights(); |
---|
[2254] | 377 | |
---|
[6110] | 378 | if ((isset($_POST['submit']) or isset($_GET['now'])) |
---|
| 379 | and check_upgrade()) |
---|
[2836] | 380 | { |
---|
| 381 | $upgrade_file = PHPWG_ROOT_PATH.'install/upgrade_'.$current_release.'.php'; |
---|
[1927] | 382 | if (is_file($upgrade_file)) |
---|
| 383 | { |
---|
[29665] | 384 | // reset SQL counters |
---|
| 385 | $page['queries_time'] = 0; |
---|
| 386 | $page['count_queries'] = 0; |
---|
| 387 | |
---|
[1927] | 388 | $page['upgrade_start'] = get_moment(); |
---|
| 389 | $conf['die_on_sql_error'] = false; |
---|
| 390 | include($upgrade_file); |
---|
[11511] | 391 | conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); |
---|
[1927] | 392 | |
---|
[5213] | 393 | // Something to add in database.inc.php? |
---|
[2863] | 394 | if (!empty($mysql_changes)) |
---|
| 395 | { |
---|
| 396 | $config_file_contents = |
---|
| 397 | substr($config_file_contents, 0, $php_end_tag) . "\r\n" |
---|
[2865] | 398 | . implode("\r\n" , $mysql_changes) . "\r\n" |
---|
[2863] | 399 | . substr($config_file_contents, $php_end_tag); |
---|
| 400 | |
---|
| 401 | if (!@file_put_contents($config_file, $config_file_contents)) |
---|
| 402 | { |
---|
[25018] | 403 | $page['infos'][] = l10n( |
---|
| 404 | 'In <i>%s</i>, before <b>?></b>, insert:', |
---|
| 405 | PWG_LOCAL_DIR.'config/database.inc.php' |
---|
| 406 | ) |
---|
| 407 | .'<p><textarea rows="4" cols="40">' |
---|
| 408 | .implode("\r\n" , $mysql_changes).'</textarea></p>'; |
---|
[2863] | 409 | } |
---|
| 410 | } |
---|
| 411 | |
---|
[29735] | 412 | // Deactivate non standard extensions |
---|
| 413 | deactivate_non_standard_plugins(); |
---|
[9597] | 414 | deactivate_non_standard_themes(); |
---|
[14206] | 415 | deactivate_templates(); |
---|
[9597] | 416 | |
---|
[1927] | 417 | $page['upgrade_end'] = get_moment(); |
---|
| 418 | |
---|
[2254] | 419 | $template->assign( |
---|
[1927] | 420 | 'upgrade', |
---|
| 421 | array( |
---|
[2836] | 422 | 'VERSION' => $current_release, |
---|
[1927] | 423 | 'TOTAL_TIME' => get_elapsed_time( |
---|
| 424 | $page['upgrade_start'], |
---|
| 425 | $page['upgrade_end'] |
---|
| 426 | ), |
---|
| 427 | 'SQL_TIME' => number_format( |
---|
| 428 | $page['queries_time'], |
---|
| 429 | 3, |
---|
| 430 | '.', |
---|
| 431 | ' ' |
---|
| 432 | ).' s', |
---|
| 433 | 'NB_QUERIES' => $page['count_queries'] |
---|
| 434 | ) |
---|
| 435 | ); |
---|
| 436 | |
---|
[25018] | 437 | $page['infos'][] = l10n('Perform a maintenance check in [Administration>Tools>Maintenance] if you encounter any problem.'); |
---|
[1927] | 438 | |
---|
[3072] | 439 | // Save $page['infos'] in order to restore after maintenance actions |
---|
| 440 | $page['infos_sav'] = $page['infos']; |
---|
| 441 | $page['infos'] = array(); |
---|
| 442 | |
---|
[2808] | 443 | $query = ' |
---|
| 444 | REPLACE INTO '.PLUGINS_TABLE.' |
---|
| 445 | (id, state) |
---|
[28207] | 446 | VALUES (\'TakeATour\', \'active\') |
---|
| 447 | ;'; |
---|
| 448 | pwg_query($query); |
---|
| 449 | |
---|
[29665] | 450 | $template->assign( |
---|
| 451 | array( |
---|
| 452 | 'button_label' => l10n('Home'), |
---|
| 453 | 'button_link' => 'index.php', |
---|
| 454 | ) |
---|
| 455 | ); |
---|
| 456 | |
---|
| 457 | // if the webmaster has a session, let's give a link to discover new features |
---|
| 458 | if (!empty($_SESSION['pwg_uid'])) |
---|
| 459 | { |
---|
| 460 | $version_ = str_replace('.', '_', get_branch_from_version(PHPWG_VERSION).'.0'); |
---|
| 461 | |
---|
| 462 | if (file_exists(PHPWG_PLUGINS_PATH .'TakeATour/tours/'.$version_.'/config.inc.php')) |
---|
| 463 | { |
---|
| 464 | load_language( |
---|
| 465 | 'plugin.lang', |
---|
| 466 | PHPWG_PLUGINS_PATH.'TakeATour/', |
---|
| 467 | array( |
---|
| 468 | 'language' => $language, |
---|
| 469 | 'force_fallback'=>'en_UK', |
---|
| 470 | ) |
---|
| 471 | ); |
---|
| 472 | |
---|
| 473 | // we need the secret key for get_pwg_token() |
---|
| 474 | load_conf_from_db(); |
---|
| 475 | |
---|
| 476 | $template->assign( |
---|
| 477 | array( |
---|
| 478 | 'button_label' => l10n('2_7_0_descrp'), // TODO avoid to update it on each release |
---|
| 479 | 'button_link' => 'admin.php?submited_tour_path=tours/'.$version_.'&pwg_token='.get_pwg_token(), |
---|
| 480 | ) |
---|
| 481 | ); |
---|
| 482 | } |
---|
| 483 | } |
---|
| 484 | |
---|
[2890] | 485 | // Delete cache data |
---|
| 486 | invalidate_user_cache(true); |
---|
| 487 | $template->delete_compiled_templates(); |
---|
| 488 | |
---|
| 489 | // Tables Maintenance |
---|
| 490 | do_maintenance_all_tables(); |
---|
| 491 | |
---|
[3072] | 492 | // Restore $page['infos'] in order to hide informations messages from functions calles |
---|
| 493 | // errors messages are not hide |
---|
| 494 | $page['infos'] = $page['infos_sav']; |
---|
| 495 | |
---|
[1927] | 496 | } |
---|
[2836] | 497 | } |
---|
| 498 | |
---|
| 499 | // +-----------------------------------------------------------------------+ |
---|
| 500 | // | start template output | |
---|
| 501 | // +-----------------------------------------------------------------------+ |
---|
| 502 | else |
---|
| 503 | { |
---|
[5982] | 504 | if (!defined('PWG_CHARSET')) |
---|
[1927] | 505 | { |
---|
[5982] | 506 | define('PWG_CHARSET', 'utf-8'); |
---|
| 507 | } |
---|
| 508 | |
---|
| 509 | include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php'); |
---|
| 510 | $languages = new languages(); |
---|
| 511 | |
---|
[9518] | 512 | foreach ($languages->fs_languages as $language_code => $fs_language) |
---|
[5982] | 513 | { |
---|
[2836] | 514 | if ($language == $language_code) |
---|
| 515 | { |
---|
| 516 | $template->assign('language_selection', $language_code); |
---|
| 517 | } |
---|
[9518] | 518 | $languages_options[$language_code] = $fs_language['name']; |
---|
[1927] | 519 | } |
---|
[2836] | 520 | $template->assign('language_options', $languages_options); |
---|
| 521 | |
---|
| 522 | $template->assign('introduction', array( |
---|
| 523 | 'CURRENT_RELEASE' => $current_release, |
---|
| 524 | 'F_ACTION' => 'upgrade.php?language=' . $language)); |
---|
| 525 | |
---|
| 526 | if (!check_upgrade()) |
---|
| 527 | { |
---|
| 528 | $template->assign('login', true); |
---|
| 529 | } |
---|
[1927] | 530 | } |
---|
| 531 | |
---|
[2836] | 532 | if (count($page['errors']) != 0) |
---|
| 533 | { |
---|
| 534 | $template->assign('errors', $page['errors']); |
---|
| 535 | } |
---|
| 536 | |
---|
| 537 | if (count($page['infos']) != 0) |
---|
| 538 | { |
---|
| 539 | $template->assign('infos', $page['infos']); |
---|
| 540 | } |
---|
| 541 | |
---|
[1927] | 542 | // +-----------------------------------------------------------------------+ |
---|
| 543 | // | sending html code | |
---|
| 544 | // +-----------------------------------------------------------------------+ |
---|
| 545 | |
---|
| 546 | $template->pparse('upgrade'); |
---|
| 547 | ?> |
---|