[218] | 1 | <?php |
---|
[354] | 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[5196] | 5 | // | Copyright(C) 2008-2010 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 | |
---|
[5239] | 99 | // default database engine proposed if severals are available |
---|
| 100 | // choices : sqlite, mysql, pgsql, pdo-sqlite |
---|
| 101 | // see include/dblayer/dblayers.inc.php |
---|
| 102 | define('DEFAULT_DB_ENGINE', 'mysql'); |
---|
| 103 | |
---|
| 104 | // database engine default choice between sqlite (native or via pdo) |
---|
| 105 | // if the twice are available. |
---|
| 106 | define('DEFAULT_DB_SQLITE', 'native'); |
---|
| 107 | |
---|
[1147] | 108 | if (isset($_POST['install'])) |
---|
| 109 | { |
---|
[5220] | 110 | $prefixeTable = $_POST['prefix']; |
---|
[1147] | 111 | } |
---|
| 112 | else |
---|
| 113 | { |
---|
[5220] | 114 | $prefixeTable = DEFAULT_PREFIX_TABLE; |
---|
[1147] | 115 | } |
---|
[367] | 116 | |
---|
[5220] | 117 | include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); |
---|
| 118 | @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); |
---|
| 119 | |
---|
[5266] | 120 | // download database config file if exists |
---|
| 121 | if (!empty($_GET['dl']) && file_exists($conf['local_data_dir'].'/pwg_'.$_GET['dl'])) |
---|
| 122 | { |
---|
| 123 | $filename = $conf['local_data_dir'].'/pwg_'.$_GET['dl']; |
---|
| 124 | header('Cache-Control: no-cache, must-revalidate'); |
---|
| 125 | header('Pragma: no-cache'); |
---|
| 126 | header('Content-Disposition: attachment; filename="database.inc.php"'); |
---|
| 127 | header('Content-Transfer-Encoding: binary'); |
---|
| 128 | header('Content-Length: '.filesize($filename)); |
---|
| 129 | echo file_get_contents($filename); |
---|
| 130 | unlink($filename); |
---|
| 131 | exit(); |
---|
| 132 | } |
---|
| 133 | |
---|
[5220] | 134 | // Obtain various vars |
---|
| 135 | $dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost'; |
---|
| 136 | $dbuser = (!empty($_POST['dbuser'])) ? $_POST['dbuser'] : ''; |
---|
| 137 | $dbpasswd = (!empty($_POST['dbpasswd'])) ? $_POST['dbpasswd'] : ''; |
---|
| 138 | $dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : ''; |
---|
[5239] | 139 | $dblayer = (!empty($_POST['dblayer'])) ? $_POST['dblayer'] : DEFAULT_DB_ENGINE; |
---|
[5220] | 140 | |
---|
[367] | 141 | $admin_name = (!empty($_POST['admin_name'])) ? $_POST['admin_name'] : ''; |
---|
| 142 | $admin_pass1 = (!empty($_POST['admin_pass1'])) ? $_POST['admin_pass1'] : ''; |
---|
| 143 | $admin_pass2 = (!empty($_POST['admin_pass2'])) ? $_POST['admin_pass2'] : ''; |
---|
| 144 | $admin_mail = (!empty($_POST['admin_mail'])) ? $_POST['admin_mail'] : ''; |
---|
| 145 | |
---|
| 146 | $infos = array(); |
---|
| 147 | $errors = array(); |
---|
| 148 | |
---|
[5213] | 149 | $config_file = PHPWG_ROOT_PATH . 'local/config/database.inc.php'; |
---|
[5983] | 150 | if (@file_exists($config_file)) |
---|
[4423] | 151 | { |
---|
[529] | 152 | include($config_file); |
---|
[2339] | 153 | // Is Piwigo already installed ? |
---|
[529] | 154 | if (defined("PHPWG_INSTALLED")) |
---|
| 155 | { |
---|
[2339] | 156 | die('Piwigo is already installed'); |
---|
[529] | 157 | } |
---|
[367] | 158 | } |
---|
| 159 | |
---|
[529] | 160 | include(PHPWG_ROOT_PATH . 'include/constants.php'); |
---|
| 161 | include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); |
---|
[1221] | 162 | include(PHPWG_ROOT_PATH . 'admin/include/functions.php'); |
---|
[529] | 163 | |
---|
[5357] | 164 | include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php'); |
---|
| 165 | $languages = new languages('utf-8'); |
---|
| 166 | |
---|
[2248] | 167 | if (isset($_GET['language'])) |
---|
[405] | 168 | { |
---|
[2248] | 169 | $language = strip_tags($_GET['language']); |
---|
[367] | 170 | } |
---|
[2127] | 171 | else |
---|
[1855] | 172 | { |
---|
[2127] | 173 | $language = 'en_UK'; |
---|
[2248] | 174 | // Try to get browser language |
---|
[5357] | 175 | foreach ($languages->fs_languages as $language_code => $language_name) |
---|
[2248] | 176 | { |
---|
| 177 | if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2)) |
---|
| 178 | { |
---|
| 179 | $language = $language_code; |
---|
| 180 | break; |
---|
| 181 | } |
---|
| 182 | } |
---|
[1855] | 183 | } |
---|
[367] | 184 | |
---|
[3197] | 185 | if ('fr_FR' == $language) { |
---|
| 186 | define('PHPWG_DOMAIN', 'fr.piwigo.org'); |
---|
| 187 | } |
---|
[5234] | 188 | else if ('it_IT' == $language) { |
---|
| 189 | define('PHPWG_DOMAIN', 'it.piwigo.org'); |
---|
| 190 | } |
---|
[4047] | 191 | else if ('de_DE' == $language) { |
---|
| 192 | define('PHPWG_DOMAIN', 'de.piwigo.org'); |
---|
| 193 | } |
---|
| 194 | else if ('es_ES' == $language) { |
---|
| 195 | define('PHPWG_DOMAIN', 'es.piwigo.org'); |
---|
| 196 | } |
---|
[4816] | 197 | else if ('pl_PL' == $language) { |
---|
| 198 | define('PHPWG_DOMAIN', 'pl.piwigo.org'); |
---|
| 199 | } |
---|
| 200 | else if ('zh_CN' == $language) { |
---|
| 201 | define('PHPWG_DOMAIN', 'cn.piwigo.org'); |
---|
| 202 | } |
---|
[6152] | 203 | else if ('hu_HU' == $language) { |
---|
[5234] | 204 | define('PHPWG_DOMAIN', 'hu.piwigo.org'); |
---|
| 205 | } |
---|
[6152] | 206 | else if ('ru_RU' == $language) { |
---|
[5234] | 207 | define('PHPWG_DOMAIN', 'ru.piwigo.org'); |
---|
| 208 | } |
---|
[6152] | 209 | else if ('nl_NL' == $language) { |
---|
| 210 | define('PHPWG_DOMAIN', 'nl.piwigo.org'); |
---|
| 211 | } |
---|
[3197] | 212 | else { |
---|
| 213 | define('PHPWG_DOMAIN', 'piwigo.org'); |
---|
| 214 | } |
---|
| 215 | define('PHPWG_URL', 'http://'.PHPWG_DOMAIN); |
---|
| 216 | |
---|
[5983] | 217 | load_language('common.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); |
---|
| 218 | load_language('admin.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); |
---|
| 219 | load_language('install.lang', '', array('language' => $language, 'target_charset'=>'utf-8')); |
---|
| 220 | |
---|
[4463] | 221 | header('Content-Type: text/html; charset=UTF-8'); |
---|
[3203] | 222 | //------------------------------------------------- check php version |
---|
| 223 | if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<')) |
---|
| 224 | { |
---|
| 225 | include(PHPWG_ROOT_PATH.'install/php5_apache_configuration.php'); |
---|
| 226 | } |
---|
| 227 | |
---|
[367] | 228 | //----------------------------------------------------- template initialization |
---|
[3203] | 229 | include( PHPWG_ROOT_PATH .'include/template.class.php'); |
---|
[5123] | 230 | $template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'roma'); |
---|
[4423] | 231 | $template->set_filenames( array('install' => 'install.tpl') ); |
---|
| 232 | if (!isset($step)) |
---|
| 233 | { |
---|
| 234 | $step = 1; |
---|
| 235 | } |
---|
[529] | 236 | //---------------------------------------------------------------- form analyze |
---|
[5384] | 237 | include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php'); |
---|
| 238 | include(PHPWG_ROOT_PATH . 'admin/include/functions_install.inc.php'); |
---|
[5387] | 239 | include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); |
---|
[5384] | 240 | |
---|
[367] | 241 | if ( isset( $_POST['install'] )) |
---|
| 242 | { |
---|
[5982] | 243 | install_db_connect($infos, $errors); |
---|
| 244 | pwg_db_check_charset(); |
---|
[5384] | 245 | |
---|
[382] | 246 | $webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name )); |
---|
| 247 | if ( empty($webmaster)) |
---|
[5021] | 248 | array_push( $errors, l10n('enter a login for webmaster') ); |
---|
[382] | 249 | else if ( preg_match( '/[\'"]/', $webmaster ) ) |
---|
[5207] | 250 | array_push( $errors, l10n('webmaster login can\'t contain characters \' or "') ); |
---|
[382] | 251 | if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) ) |
---|
[5021] | 252 | array_push( $errors, l10n('please enter your password again') ); |
---|
[382] | 253 | if ( empty($admin_mail)) |
---|
[5021] | 254 | array_push( $errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)') ); |
---|
[2127] | 255 | else |
---|
[382] | 256 | { |
---|
[2124] | 257 | $error_mail_address = validate_mail_address(null, $admin_mail); |
---|
[382] | 258 | if (!empty($error_mail_address)) |
---|
| 259 | array_push( $errors, $error_mail_address ); |
---|
| 260 | } |
---|
[2127] | 261 | |
---|
[382] | 262 | if ( count( $errors ) == 0 ) |
---|
| 263 | { |
---|
| 264 | $step = 2; |
---|
[1147] | 265 | $file_content = '<?php |
---|
[4410] | 266 | $conf[\'dblayer\'] = \''.$dblayer.'\'; |
---|
[4280] | 267 | $conf[\'db_base\'] = \''.$dbname.'\'; |
---|
| 268 | $conf[\'db_user\'] = \''.$dbuser.'\'; |
---|
| 269 | $conf[\'db_password\'] = \''.$dbpasswd.'\'; |
---|
| 270 | $conf[\'db_host\'] = \''.$dbhost.'\'; |
---|
[1147] | 271 | |
---|
[5220] | 272 | $prefixeTable = \''.$prefixeTable.'\'; |
---|
[1147] | 273 | |
---|
| 274 | define(\'PHPWG_INSTALLED\', true); |
---|
[5982] | 275 | define(\'PWG_CHARSET\', \'utf-8\'); |
---|
| 276 | define(\'DB_CHARSET\', \'utf8\'); |
---|
[2127] | 277 | define(\'DB_COLLATE\', \'\'); |
---|
| 278 | |
---|
[1147] | 279 | ?'.'>'; |
---|
[2127] | 280 | |
---|
[382] | 281 | @umask(0111); |
---|
| 282 | // writing the configuration file |
---|
| 283 | if ( !($fp = @fopen( $config_file, 'w' ))) |
---|
[367] | 284 | { |
---|
[5266] | 285 | $tmp_filename = md5(uniqid(time())); |
---|
| 286 | $fh = @fopen( $conf['local_data_dir'] . '/pwg_' . $tmp_filename, 'w' ); |
---|
| 287 | @fputs($fh, $file_content, strlen($file_content)); |
---|
| 288 | @fclose($fh); |
---|
| 289 | |
---|
[5571] | 290 | $template->assign( |
---|
| 291 | array( |
---|
| 292 | 'config_creation_failed' => true, |
---|
| 293 | 'config_url' => 'install.php?dl='.$tmp_filename, |
---|
| 294 | 'config_file_content' => $file_content, |
---|
| 295 | ) |
---|
[5266] | 296 | ); |
---|
[382] | 297 | } |
---|
| 298 | @fputs($fp, $file_content, strlen($file_content)); |
---|
| 299 | @fclose($fp); |
---|
[2127] | 300 | |
---|
[2339] | 301 | // tables creation, based on piwigo_structure.sql |
---|
[1147] | 302 | execute_sqlfile( |
---|
[4410] | 303 | PHPWG_ROOT_PATH.'install/piwigo_structure-'.$dblayer.'.sql', |
---|
[1147] | 304 | DEFAULT_PREFIX_TABLE, |
---|
[5982] | 305 | $prefixeTable, |
---|
| 306 | $dblayer |
---|
[1147] | 307 | ); |
---|
[382] | 308 | // We fill the tables with basic informations |
---|
[1147] | 309 | execute_sqlfile( |
---|
| 310 | PHPWG_ROOT_PATH.'install/config.sql', |
---|
| 311 | DEFAULT_PREFIX_TABLE, |
---|
[5982] | 312 | $prefixeTable, |
---|
| 313 | $dblayer |
---|
[1147] | 314 | ); |
---|
[218] | 315 | |
---|
[4410] | 316 | $query = ' |
---|
[5220] | 317 | INSERT INTO '.$prefixeTable.'config (param,value,comment) |
---|
[6130] | 318 | VALUES (\'secret_key\',md5('.pwg_db_cast_to_text(DB_RANDOM_FUNCTION.'()').'), |
---|
[4410] | 319 | \'a secret key specific to the gallery for internal use\');'; |
---|
| 320 | pwg_query($query); |
---|
| 321 | |
---|
[5341] | 322 | // fill languages table |
---|
[5982] | 323 | foreach ($languages->get_fs_languages() as $language_code => $language_name) |
---|
[5341] | 324 | { |
---|
[5357] | 325 | $languages->perform_action('activate', $language_code); |
---|
[5341] | 326 | } |
---|
| 327 | |
---|
[1284] | 328 | // fill $conf global array |
---|
| 329 | load_conf_from_db(); |
---|
| 330 | |
---|
[5340] | 331 | // PWG_CHARSET is required for building the fs_themes array in the |
---|
| 332 | // themes class |
---|
[5452] | 333 | if (!defined('PWG_CHARSET')) |
---|
| 334 | { |
---|
[5982] | 335 | define('PWG_CHARSET', 'utf-8'); |
---|
[5452] | 336 | } |
---|
[5982] | 337 | activate_core_themes(); |
---|
[5340] | 338 | |
---|
[1284] | 339 | $insert = array( |
---|
| 340 | 'id' => 1, |
---|
| 341 | 'galleries_url' => PHPWG_ROOT_PATH.'galleries/', |
---|
| 342 | ); |
---|
| 343 | mass_inserts(SITES_TABLE, array_keys($insert), array($insert)); |
---|
[2127] | 344 | |
---|
[382] | 345 | // webmaster admin user |
---|
[1284] | 346 | $inserts = array( |
---|
| 347 | array( |
---|
| 348 | 'id' => 1, |
---|
| 349 | 'username' => $admin_name, |
---|
| 350 | 'password' => md5($admin_pass1), |
---|
| 351 | 'mail_address' => $admin_mail, |
---|
| 352 | ), |
---|
| 353 | array( |
---|
| 354 | 'id' => 2, |
---|
| 355 | 'username' => 'guest', |
---|
| 356 | ), |
---|
| 357 | ); |
---|
| 358 | mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts); |
---|
[801] | 359 | |
---|
[1930] | 360 | create_user_infos(array(1,2), array('language' => $language)); |
---|
[808] | 361 | |
---|
[1027] | 362 | // Available upgrades must be ignored after a fresh installation. To |
---|
| 363 | // make PWG avoid upgrading, we must tell it upgrades have already been |
---|
| 364 | // made. |
---|
[4325] | 365 | list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); |
---|
[1221] | 366 | define('CURRENT_DATE', $dbnow); |
---|
| 367 | $datas = array(); |
---|
[1027] | 368 | foreach (get_available_upgrade_ids() as $upgrade_id) |
---|
| 369 | { |
---|
[1221] | 370 | array_push( |
---|
| 371 | $datas, |
---|
| 372 | array( |
---|
| 373 | 'id' => $upgrade_id, |
---|
| 374 | 'applied' => CURRENT_DATE, |
---|
| 375 | 'description' => 'upgrade included in installation', |
---|
| 376 | ) |
---|
| 377 | ); |
---|
[1027] | 378 | } |
---|
[1221] | 379 | mass_inserts( |
---|
| 380 | UPGRADE_TABLE, |
---|
| 381 | array_keys($datas[0]), |
---|
| 382 | $datas |
---|
| 383 | ); |
---|
[382] | 384 | } |
---|
[367] | 385 | } |
---|
[218] | 386 | |
---|
[2248] | 387 | //------------------------------------------------------ start template output |
---|
[5983] | 388 | $dbengines = available_engines(); |
---|
| 389 | |
---|
| 390 | foreach ($languages->fs_languages as $language_code => $language_name) |
---|
[4423] | 391 | { |
---|
[5983] | 392 | if ($language == $language_code) |
---|
[4423] | 393 | { |
---|
[5983] | 394 | $template->assign('language_selection', $language_code); |
---|
[4423] | 395 | } |
---|
[5983] | 396 | $languages_options[$language_code] = $language_name; |
---|
[4423] | 397 | } |
---|
[5983] | 398 | $template->assign('language_options', $languages_options); |
---|
[4423] | 399 | |
---|
[5983] | 400 | $template->assign( |
---|
| 401 | array( |
---|
| 402 | 'T_CONTENT_ENCODING' => 'utf-8', |
---|
| 403 | 'RELEASE' => PHPWG_VERSION, |
---|
| 404 | 'F_ACTION' => 'install.php?language=' . $language, |
---|
| 405 | 'F_DB_ENGINES' => $dbengines, |
---|
| 406 | 'F_DB_LAYER' => $dblayer, |
---|
| 407 | 'F_DB_HOST' => $dbhost, |
---|
| 408 | 'F_DB_USER' => $dbuser, |
---|
| 409 | 'F_DB_NAME' => $dbname, |
---|
| 410 | 'F_DB_PREFIX' => $prefixeTable, |
---|
| 411 | 'F_ADMIN' => $admin_name, |
---|
| 412 | 'F_ADMIN_EMAIL' => $admin_mail, |
---|
| 413 | 'L_INSTALL_HELP' => sprintf(l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.'), PHPWG_URL.'/forum'), |
---|
| 414 | )); |
---|
[4423] | 415 | |
---|
[529] | 416 | //------------------------------------------------------ errors & infos display |
---|
[2747] | 417 | if ($step == 1) |
---|
| 418 | { |
---|
| 419 | $template->assign('install', true); |
---|
| 420 | } |
---|
| 421 | else |
---|
| 422 | { |
---|
[5408] | 423 | array_push( |
---|
| 424 | $infos, |
---|
| 425 | l10n('Congratulations, Piwigo installation is completed') |
---|
| 426 | ); |
---|
[2747] | 427 | |
---|
| 428 | if (isset($error_copy)) |
---|
| 429 | { |
---|
| 430 | array_push($errors, $error_copy); |
---|
| 431 | } |
---|
[3715] | 432 | else |
---|
| 433 | { |
---|
| 434 | session_set_save_handler('pwg_session_open', |
---|
| 435 | 'pwg_session_close', |
---|
| 436 | 'pwg_session_read', |
---|
| 437 | 'pwg_session_write', |
---|
| 438 | 'pwg_session_destroy', |
---|
| 439 | 'pwg_session_gc' |
---|
| 440 | ); |
---|
| 441 | if ( function_exists('ini_set') ) |
---|
| 442 | { |
---|
| 443 | ini_set('session.use_cookies', $conf['session_use_cookies']); |
---|
| 444 | ini_set('session.use_only_cookies', $conf['session_use_only_cookies']); |
---|
| 445 | ini_set('session.use_trans_sid', intval($conf['session_use_trans_sid'])); |
---|
| 446 | ini_set('session.cookie_httponly', 1); |
---|
| 447 | } |
---|
| 448 | session_name($conf['session_name']); |
---|
| 449 | session_set_cookie_params(0, cookie_path()); |
---|
| 450 | $user = build_user(1, true); |
---|
| 451 | log_user($user['id'], false); |
---|
| 452 | } |
---|
[3382] | 453 | |
---|
| 454 | $template->assign( |
---|
| 455 | 'SUBSCRIBE_BASE_URL', |
---|
| 456 | get_newsletter_subscribe_base_url($language) |
---|
| 457 | ); |
---|
[2747] | 458 | } |
---|
[2248] | 459 | if (count($errors) != 0) |
---|
[367] | 460 | { |
---|
[2248] | 461 | $template->assign('errors', $errors); |
---|
[367] | 462 | } |
---|
[218] | 463 | |
---|
[2248] | 464 | if (count($infos) != 0 ) |
---|
[367] | 465 | { |
---|
[2248] | 466 | $template->assign('infos', $infos); |
---|
[367] | 467 | } |
---|
[218] | 468 | |
---|
| 469 | //----------------------------------------------------------- html code display |
---|
[367] | 470 | $template->pparse('install'); |
---|
[3203] | 471 | ?> |
---|