[218] | 1 | <?php |
---|
[354] | 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[2297] | 4 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 5 | // | Copyright(C) 2008-2011 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 | // +-----------------------------------------------------------------------+ |
---|
[218] | 23 | |
---|
[367] | 24 | //----------------------------------------------------------- include |
---|
| 25 | define('PHPWG_ROOT_PATH','./'); |
---|
[345] | 26 | |
---|
[3747] | 27 | @set_magic_quotes_runtime(0); // Disable magic_quotes_runtime |
---|
[367] | 28 | // |
---|
| 29 | // addslashes to vars if magic_quotes_gpc is off this is a security |
---|
| 30 | // precaution to prevent someone trying to break out of a SQL statement. |
---|
| 31 | // |
---|
[4006] | 32 | if( !@get_magic_quotes_gpc() ) |
---|
[218] | 33 | { |
---|
[367] | 34 | if( is_array($_POST) ) |
---|
[218] | 35 | { |
---|
[367] | 36 | while( list($k, $v) = each($_POST) ) |
---|
[218] | 37 | { |
---|
[367] | 38 | if( is_array($_POST[$k]) ) |
---|
[218] | 39 | { |
---|
[367] | 40 | while( list($k2, $v2) = each($_POST[$k]) ) |
---|
| 41 | { |
---|
| 42 | $_POST[$k][$k2] = addslashes($v2); |
---|
| 43 | } |
---|
| 44 | @reset($_POST[$k]); |
---|
[218] | 45 | } |
---|
| 46 | else |
---|
| 47 | { |
---|
[367] | 48 | $_POST[$k] = addslashes($v); |
---|
[218] | 49 | } |
---|
| 50 | } |
---|
[367] | 51 | @reset($_POST); |
---|
| 52 | } |
---|
| 53 | |
---|
[1855] | 54 | if( is_array($_GET) ) |
---|
| 55 | { |
---|
| 56 | while( list($k, $v) = each($_GET) ) |
---|
| 57 | { |
---|
| 58 | if( is_array($_GET[$k]) ) |
---|
| 59 | { |
---|
| 60 | while( list($k2, $v2) = each($_GET[$k]) ) |
---|
| 61 | { |
---|
| 62 | $_GET[$k][$k2] = addslashes($v2); |
---|
| 63 | } |
---|
| 64 | @reset($_GET[$k]); |
---|
| 65 | } |
---|
| 66 | else |
---|
| 67 | { |
---|
| 68 | $_GET[$k] = addslashes($v); |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | @reset($_GET); |
---|
| 72 | } |
---|
| 73 | |
---|
[367] | 74 | if( is_array($_COOKIE) ) |
---|
| 75 | { |
---|
| 76 | while( list($k, $v) = each($_COOKIE) ) |
---|
[218] | 77 | { |
---|
[367] | 78 | if( is_array($_COOKIE[$k]) ) |
---|
[218] | 79 | { |
---|
[367] | 80 | while( list($k2, $v2) = each($_COOKIE[$k]) ) |
---|
| 81 | { |
---|
| 82 | $_COOKIE[$k][$k2] = addslashes($v2); |
---|
| 83 | } |
---|
| 84 | @reset($_COOKIE[$k]); |
---|
[218] | 85 | } |
---|
| 86 | else |
---|
| 87 | { |
---|
[367] | 88 | $_COOKIE[$k] = addslashes($v); |
---|
[218] | 89 | } |
---|
| 90 | } |
---|
[367] | 91 | @reset($_COOKIE); |
---|
[218] | 92 | } |
---|
[367] | 93 | } |
---|
[218] | 94 | |
---|
[367] | 95 | //----------------------------------------------------- variable initialization |
---|
[1147] | 96 | |
---|
[2339] | 97 | define('DEFAULT_PREFIX_TABLE', 'piwigo_'); |
---|
[1147] | 98 | |
---|
| 99 | if (isset($_POST['install'])) |
---|
| 100 | { |
---|
[5220] | 101 | $prefixeTable = $_POST['prefix']; |
---|
[1147] | 102 | } |
---|
| 103 | else |
---|
| 104 | { |
---|
[5220] | 105 | $prefixeTable = DEFAULT_PREFIX_TABLE; |
---|
[1147] | 106 | } |
---|
[367] | 107 | |
---|
[8722] | 108 | if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php')) |
---|
| 109 | { |
---|
| 110 | include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'); |
---|
| 111 | define('PWG_LOCAL_DIR', $conf['local_dir_site']); |
---|
| 112 | } |
---|
| 113 | else |
---|
| 114 | { |
---|
| 115 | define('PWG_LOCAL_DIR', 'local/'); |
---|
| 116 | } |
---|
| 117 | |
---|
[5220] | 118 | include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); |
---|
| 119 | @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); |
---|
[8722] | 120 | if (isset($conf['local_dir_site'])) |
---|
| 121 | { |
---|
| 122 | @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php'); |
---|
| 123 | } |
---|
[5220] | 124 | |
---|
[5266] | 125 | // download database config file if exists |
---|
| 126 | if (!empty($_GET['dl']) && file_exists($conf['local_data_dir'].'/pwg_'.$_GET['dl'])) |
---|
| 127 | { |
---|
| 128 | $filename = $conf['local_data_dir'].'/pwg_'.$_GET['dl']; |
---|
| 129 | header('Cache-Control: no-cache, must-revalidate'); |
---|
| 130 | header('Pragma: no-cache'); |
---|
| 131 | header('Content-Disposition: attachment; filename="database.inc.php"'); |
---|
| 132 | header('Content-Transfer-Encoding: binary'); |
---|
| 133 | header('Content-Length: '.filesize($filename)); |
---|
| 134 | echo file_get_contents($filename); |
---|
| 135 | unlink($filename); |
---|
| 136 | exit(); |
---|
| 137 | } |
---|
| 138 | |
---|
[5220] | 139 | // Obtain various vars |
---|
| 140 | $dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost'; |
---|
| 141 | $dbuser = (!empty($_POST['dbuser'])) ? $_POST['dbuser'] : ''; |
---|
| 142 | $dbpasswd = (!empty($_POST['dbpasswd'])) ? $_POST['dbpasswd'] : ''; |
---|
| 143 | $dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : ''; |
---|
[12103] | 144 | $dblayer = 'mysql'; |
---|
[5220] | 145 | |
---|
[367] | 146 | $admin_name = (!empty($_POST['admin_name'])) ? $_POST['admin_name'] : ''; |
---|
| 147 | $admin_pass1 = (!empty($_POST['admin_pass1'])) ? $_POST['admin_pass1'] : ''; |
---|
| 148 | $admin_pass2 = (!empty($_POST['admin_pass2'])) ? $_POST['admin_pass2'] : ''; |
---|
| 149 | $admin_mail = (!empty($_POST['admin_mail'])) ? $_POST['admin_mail'] : ''; |
---|
| 150 | |
---|
[8311] | 151 | $is_newsletter_subscribe = true; |
---|
| 152 | if (isset($_POST['install'])) |
---|
| 153 | { |
---|
| 154 | $is_newsletter_subscribe = isset($_POST['newsletter_subscribe']); |
---|
| 155 | } |
---|
| 156 | |
---|
[367] | 157 | $infos = array(); |
---|
| 158 | $errors = array(); |
---|
| 159 | |
---|
[8722] | 160 | $config_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php'; |
---|
[5983] | 161 | if (@file_exists($config_file)) |
---|
[4423] | 162 | { |
---|
[529] | 163 | include($config_file); |
---|
[2339] | 164 | // Is Piwigo already installed ? |
---|
[529] | 165 | if (defined("PHPWG_INSTALLED")) |
---|
| 166 | { |
---|
[2339] | 167 | die('Piwigo is already installed'); |
---|
[529] | 168 | } |
---|
[367] | 169 | } |
---|
| 170 | |
---|
[529] | 171 | include(PHPWG_ROOT_PATH . 'include/constants.php'); |
---|
| 172 | include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); |
---|
[1221] | 173 | include(PHPWG_ROOT_PATH . 'admin/include/functions.php'); |
---|
[529] | 174 | |
---|
[5357] | 175 | include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php'); |
---|
| 176 | $languages = new languages('utf-8'); |
---|
| 177 | |
---|
[2248] | 178 | if (isset($_GET['language'])) |
---|
[405] | 179 | { |
---|
[2248] | 180 | $language = strip_tags($_GET['language']); |
---|
[13955] | 181 | |
---|
| 182 | if (!in_array($language, array_keys($languages->fs_languages))) |
---|
| 183 | { |
---|
| 184 | $language = PHPWG_DEFAULT_LANGUAGE; |
---|
| 185 | } |
---|
[367] | 186 | } |
---|
[2127] | 187 | else |
---|
[1855] | 188 | { |
---|
[2127] | 189 | $language = 'en_UK'; |
---|
[2248] | 190 | // Try to get browser language |
---|
[9518] | 191 | foreach ($languages->fs_languages as $language_code => $fs_language) |
---|
[2248] | 192 | { |
---|
| 193 | if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)) |
---|
| 194 | { |
---|
| 195 | $language = $language_code; |
---|
| 196 | break; |
---|
| 197 | } |
---|
| 198 | } |
---|
[1855] | 199 | } |
---|
[367] | 200 | |
---|
[3197] | 201 | if ('fr_FR' == $language) { |
---|
| 202 | define('PHPWG_DOMAIN', 'fr.piwigo.org'); |
---|
| 203 | } |
---|
[5234] | 204 | else if ('it_IT' == $language) { |
---|
| 205 | define('PHPWG_DOMAIN', 'it.piwigo.org'); |
---|
| 206 | } |
---|
[4047] | 207 | else if ('de_DE' == $language) { |
---|
| 208 | define('PHPWG_DOMAIN', 'de.piwigo.org'); |
---|
| 209 | } |
---|
| 210 | else if ('es_ES' == $language) { |
---|
| 211 | define('PHPWG_DOMAIN', 'es.piwigo.org'); |
---|
| 212 | } |
---|
[4816] | 213 | else if ('pl_PL' == $language) { |
---|
| 214 | define('PHPWG_DOMAIN', 'pl.piwigo.org'); |
---|
| 215 | } |
---|
| 216 | else if ('zh_CN' == $language) { |
---|
| 217 | define('PHPWG_DOMAIN', 'cn.piwigo.org'); |
---|
| 218 | } |
---|
[6152] | 219 | else if ('hu_HU' == $language) { |
---|
[5234] | 220 | define('PHPWG_DOMAIN', 'hu.piwigo.org'); |
---|
| 221 | } |
---|
[6152] | 222 | else if ('ru_RU' == $language) { |
---|
[5234] | 223 | define('PHPWG_DOMAIN', 'ru.piwigo.org'); |
---|
| 224 | } |
---|
[6152] | 225 | else if ('nl_NL' == $language) { |
---|
| 226 | define('PHPWG_DOMAIN', 'nl.piwigo.org'); |
---|
| 227 | } |
---|
[3197] | 228 | else { |
---|
| 229 | define('PHPWG_DOMAIN', 'piwigo.org'); |
---|
| 230 | } |
---|
| 231 | define('PHPWG_URL', 'http://'.PHPWG_DOMAIN); |
---|
| 232 | |
---|
[5983] | 233 | load_language('common.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); |
---|
| 234 | load_language('admin.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); |
---|
| 235 | load_language('install.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); |
---|
| 236 | |
---|
[4463] | 237 | header('Content-Type: text/html; charset=UTF-8'); |
---|
[3203] | 238 | //------------------------------------------------- check php version |
---|
| 239 | if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) |
---|
| 240 | { |
---|
| 241 | include(PHPWG_ROOT_PATH.'install/php5_apache_configuration.php'); |
---|
| 242 | } |
---|
| 243 | |
---|
[367] | 244 | //----------------------------------------------------- template initialization |
---|
[3203] | 245 | include( PHPWG_ROOT_PATH .'include/template.class.php'); |
---|
[8310] | 246 | $template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'clear'); |
---|
[4423] | 247 | $template->set_filenames( array('install' => 'install.tpl') ); |
---|
| 248 | if (!isset($step)) |
---|
| 249 | { |
---|
| 250 | $step = 1; |
---|
| 251 | } |
---|
[529] | 252 | //---------------------------------------------------------------- form analyze |
---|
[5384] | 253 | include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php'); |
---|
| 254 | include(PHPWG_ROOT_PATH . 'admin/include/functions_install.inc.php'); |
---|
[5387] | 255 | include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); |
---|
[5384] | 256 | |
---|
[367] | 257 | if ( isset( $_POST['install'] )) |
---|
| 258 | { |
---|
[5982] | 259 | install_db_connect($infos, $errors); |
---|
| 260 | pwg_db_check_charset(); |
---|
[5384] | 261 | |
---|
[382] | 262 | $webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name )); |
---|
| 263 | if ( empty($webmaster)) |
---|
[5021] | 264 | array_push( $errors, l10n('enter a login for webmaster') ); |
---|
[382] | 265 | else if ( preg_match( '/[\'"]/', $webmaster ) ) |
---|
[5207] | 266 | array_push( $errors, l10n('webmaster login can\'t contain characters \' or "') ); |
---|
[382] | 267 | if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) ) |
---|
[5021] | 268 | array_push( $errors, l10n('please enter your password again') ); |
---|
[382] | 269 | if ( empty($admin_mail)) |
---|
[5021] | 270 | array_push( $errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)') ); |
---|
[2127] | 271 | else |
---|
[382] | 272 | { |
---|
[2124] | 273 | $error_mail_address = validate_mail_address(null, $admin_mail); |
---|
[382] | 274 | if (!empty($error_mail_address)) |
---|
| 275 | array_push( $errors, $error_mail_address ); |
---|
| 276 | } |
---|
[2127] | 277 | |
---|
[382] | 278 | if ( count( $errors ) == 0 ) |
---|
| 279 | { |
---|
| 280 | $step = 2; |
---|
[1147] | 281 | $file_content = '<?php |
---|
[4410] | 282 | $conf[\'dblayer\'] = \''.$dblayer.'\'; |
---|
[4280] | 283 | $conf[\'db_base\'] = \''.$dbname.'\'; |
---|
| 284 | $conf[\'db_user\'] = \''.$dbuser.'\'; |
---|
| 285 | $conf[\'db_password\'] = \''.$dbpasswd.'\'; |
---|
| 286 | $conf[\'db_host\'] = \''.$dbhost.'\'; |
---|
[1147] | 287 | |
---|
[5220] | 288 | $prefixeTable = \''.$prefixeTable.'\'; |
---|
[1147] | 289 | |
---|
| 290 | define(\'PHPWG_INSTALLED\', true); |
---|
[5982] | 291 | define(\'PWG_CHARSET\', \'utf-8\'); |
---|
| 292 | define(\'DB_CHARSET\', \'utf8\'); |
---|
[2127] | 293 | define(\'DB_COLLATE\', \'\'); |
---|
| 294 | |
---|
[1147] | 295 | ?'.'>'; |
---|
[2127] | 296 | |
---|
[382] | 297 | @umask(0111); |
---|
| 298 | // writing the configuration file |
---|
| 299 | if ( !($fp = @fopen( $config_file, 'w' ))) |
---|
[367] | 300 | { |
---|
[5266] | 301 | $tmp_filename = md5(uniqid(time())); |
---|
| 302 | $fh = @fopen( $conf['local_data_dir'] . '/pwg_' . $tmp_filename, 'w' ); |
---|
| 303 | @fputs($fh, $file_content, strlen($file_content)); |
---|
| 304 | @fclose($fh); |
---|
| 305 | |
---|
[5571] | 306 | $template->assign( |
---|
| 307 | array( |
---|
| 308 | 'config_creation_failed' => true, |
---|
| 309 | 'config_url' => 'install.php?dl='.$tmp_filename, |
---|
| 310 | 'config_file_content' => $file_content, |
---|
| 311 | ) |
---|
[5266] | 312 | ); |
---|
[382] | 313 | } |
---|
| 314 | @fputs($fp, $file_content, strlen($file_content)); |
---|
| 315 | @fclose($fp); |
---|
[2127] | 316 | |
---|
[2339] | 317 | // tables creation, based on piwigo_structure.sql |
---|
[1147] | 318 | execute_sqlfile( |
---|
[4410] | 319 | PHPWG_ROOT_PATH.'install/piwigo_structure-'.$dblayer.'.sql', |
---|
[1147] | 320 | DEFAULT_PREFIX_TABLE, |
---|
[5982] | 321 | $prefixeTable, |
---|
| 322 | $dblayer |
---|
[1147] | 323 | ); |
---|
[382] | 324 | // We fill the tables with basic informations |
---|
[1147] | 325 | execute_sqlfile( |
---|
| 326 | PHPWG_ROOT_PATH.'install/config.sql', |
---|
| 327 | DEFAULT_PREFIX_TABLE, |
---|
[5982] | 328 | $prefixeTable, |
---|
| 329 | $dblayer |
---|
[1147] | 330 | ); |
---|
[218] | 331 | |
---|
[4410] | 332 | $query = ' |
---|
[5220] | 333 | INSERT INTO '.$prefixeTable.'config (param,value,comment) |
---|
[6130] | 334 | VALUES (\'secret_key\',md5('.pwg_db_cast_to_text(DB_RANDOM_FUNCTION.'()').'), |
---|
[4410] | 335 | \'a secret key specific to the gallery for internal use\');'; |
---|
| 336 | pwg_query($query); |
---|
| 337 | |
---|
[11511] | 338 | conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION)); |
---|
[12008] | 339 | conf_update_param('gallery_title', l10n('Just another Piwigo gallery')); |
---|
| 340 | conf_update_param('page_banner', '<h1>%gallery_title%</h1>'."\n\n<p>".l10n('Welcome to my photo gallery').'</p>'); |
---|
[11511] | 341 | |
---|
[5341] | 342 | // fill languages table |
---|
[9520] | 343 | foreach ($languages->fs_languages as $language_code => $fs_language) |
---|
[5341] | 344 | { |
---|
[5357] | 345 | $languages->perform_action('activate', $language_code); |
---|
[5341] | 346 | } |
---|
| 347 | |
---|
[1284] | 348 | // fill $conf global array |
---|
| 349 | load_conf_from_db(); |
---|
| 350 | |
---|
[5340] | 351 | // PWG_CHARSET is required for building the fs_themes array in the |
---|
| 352 | // themes class |
---|
[5452] | 353 | if (!defined('PWG_CHARSET')) |
---|
| 354 | { |
---|
[5982] | 355 | define('PWG_CHARSET', 'utf-8'); |
---|
[5452] | 356 | } |
---|
[5982] | 357 | activate_core_themes(); |
---|
[5340] | 358 | |
---|
[1284] | 359 | $insert = array( |
---|
| 360 | 'id' => 1, |
---|
| 361 | 'galleries_url' => PHPWG_ROOT_PATH.'galleries/', |
---|
| 362 | ); |
---|
| 363 | mass_inserts(SITES_TABLE, array_keys($insert), array($insert)); |
---|
[2127] | 364 | |
---|
[382] | 365 | // webmaster admin user |
---|
[1284] | 366 | $inserts = array( |
---|
| 367 | array( |
---|
| 368 | 'id' => 1, |
---|
| 369 | 'username' => $admin_name, |
---|
| 370 | 'password' => md5($admin_pass1), |
---|
| 371 | 'mail_address' => $admin_mail, |
---|
| 372 | ), |
---|
| 373 | array( |
---|
| 374 | 'id' => 2, |
---|
| 375 | 'username' => 'guest', |
---|
| 376 | ), |
---|
| 377 | ); |
---|
| 378 | mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts); |
---|
[801] | 379 | |
---|
[1930] | 380 | create_user_infos(array(1,2), array('language' => $language)); |
---|
[808] | 381 | |
---|
[1027] | 382 | // Available upgrades must be ignored after a fresh installation. To |
---|
| 383 | // make PWG avoid upgrading, we must tell it upgrades have already been |
---|
| 384 | // made. |
---|
[4325] | 385 | list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); |
---|
[1221] | 386 | define('CURRENT_DATE', $dbnow); |
---|
| 387 | $datas = array(); |
---|
[1027] | 388 | foreach (get_available_upgrade_ids() as $upgrade_id) |
---|
| 389 | { |
---|
[1221] | 390 | array_push( |
---|
| 391 | $datas, |
---|
| 392 | array( |
---|
| 393 | 'id' => $upgrade_id, |
---|
| 394 | 'applied' => CURRENT_DATE, |
---|
| 395 | 'description' => 'upgrade included in installation', |
---|
| 396 | ) |
---|
| 397 | ); |
---|
[1027] | 398 | } |
---|
[1221] | 399 | mass_inserts( |
---|
| 400 | UPGRADE_TABLE, |
---|
| 401 | array_keys($datas[0]), |
---|
| 402 | $datas |
---|
| 403 | ); |
---|
[8311] | 404 | |
---|
| 405 | if ($is_newsletter_subscribe) |
---|
| 406 | { |
---|
| 407 | fetchRemote( |
---|
| 408 | get_newsletter_subscribe_base_url($language).$admin_mail, |
---|
| 409 | $result, |
---|
| 410 | array(), |
---|
| 411 | array('origin' => 'installation') |
---|
| 412 | ); |
---|
| 413 | } |
---|
[382] | 414 | } |
---|
[367] | 415 | } |
---|
[218] | 416 | |
---|
[2248] | 417 | //------------------------------------------------------ start template output |
---|
[9518] | 418 | foreach ($languages->fs_languages as $language_code => $fs_language) |
---|
[4423] | 419 | { |
---|
[5983] | 420 | if ($language == $language_code) |
---|
[4423] | 421 | { |
---|
[5983] | 422 | $template->assign('language_selection', $language_code); |
---|
[4423] | 423 | } |
---|
[9518] | 424 | $languages_options[$language_code] = $fs_language['name']; |
---|
[4423] | 425 | } |
---|
[5983] | 426 | $template->assign('language_options', $languages_options); |
---|
[4423] | 427 | |
---|
[5983] | 428 | $template->assign( |
---|
| 429 | array( |
---|
| 430 | 'T_CONTENT_ENCODING' => 'utf-8', |
---|
| 431 | 'RELEASE' => PHPWG_VERSION, |
---|
| 432 | 'F_ACTION' => 'install.php?language=' . $language, |
---|
| 433 | 'F_DB_HOST' => $dbhost, |
---|
| 434 | 'F_DB_USER' => $dbuser, |
---|
| 435 | 'F_DB_NAME' => $dbname, |
---|
| 436 | 'F_DB_PREFIX' => $prefixeTable, |
---|
| 437 | 'F_ADMIN' => $admin_name, |
---|
| 438 | 'F_ADMIN_EMAIL' => $admin_mail, |
---|
[8311] | 439 | 'EMAIL' => '<span class="adminEmail">'.$admin_mail.'</span>', |
---|
| 440 | 'F_NEWSLETTER_SUBSCRIBE' => $is_newsletter_subscribe, |
---|
[5983] | 441 | 'L_INSTALL_HELP' => sprintf(l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.'), PHPWG_URL.'/forum'), |
---|
| 442 | )); |
---|
[4423] | 443 | |
---|
[529] | 444 | //------------------------------------------------------ errors & infos display |
---|
[2747] | 445 | if ($step == 1) |
---|
| 446 | { |
---|
| 447 | $template->assign('install', true); |
---|
| 448 | } |
---|
| 449 | else |
---|
| 450 | { |
---|
[5408] | 451 | array_push( |
---|
| 452 | $infos, |
---|
| 453 | l10n('Congratulations, Piwigo installation is completed') |
---|
| 454 | ); |
---|
[2747] | 455 | |
---|
| 456 | if (isset($error_copy)) |
---|
| 457 | { |
---|
| 458 | array_push($errors, $error_copy); |
---|
| 459 | } |
---|
[3715] | 460 | else |
---|
| 461 | { |
---|
| 462 | session_set_save_handler('pwg_session_open', |
---|
| 463 | 'pwg_session_close', |
---|
| 464 | 'pwg_session_read', |
---|
| 465 | 'pwg_session_write', |
---|
| 466 | 'pwg_session_destroy', |
---|
| 467 | 'pwg_session_gc' |
---|
| 468 | ); |
---|
| 469 | if ( function_exists('ini_set') ) |
---|
| 470 | { |
---|
| 471 | ini_set('session.use_cookies', $conf['session_use_cookies']); |
---|
| 472 | ini_set('session.use_only_cookies', $conf['session_use_only_cookies']); |
---|
| 473 | ini_set('session.use_trans_sid', intval($conf['session_use_trans_sid'])); |
---|
| 474 | ini_set('session.cookie_httponly', 1); |
---|
| 475 | } |
---|
| 476 | session_name($conf['session_name']); |
---|
| 477 | session_set_cookie_params(0, cookie_path()); |
---|
| 478 | $user = build_user(1, true); |
---|
| 479 | log_user($user['id'], false); |
---|
| 480 | } |
---|
[2747] | 481 | } |
---|
[2248] | 482 | if (count($errors) != 0) |
---|
[367] | 483 | { |
---|
[2248] | 484 | $template->assign('errors', $errors); |
---|
[367] | 485 | } |
---|
[218] | 486 | |
---|
[2248] | 487 | if (count($infos) != 0 ) |
---|
[367] | 488 | { |
---|
[2248] | 489 | $template->assign('infos', $infos); |
---|
[367] | 490 | } |
---|
[218] | 491 | |
---|
| 492 | //----------------------------------------------------------- html code display |
---|
[367] | 493 | $template->pparse('install'); |
---|
[3203] | 494 | ?> |
---|