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