diff options
Diffstat (limited to '')
-rw-r--r-- | include/common.inc.php | 9 | ||||
-rw-r--r-- | include/functions_user.inc.php | 12 | ||||
-rw-r--r-- | include/user.inc.php | 3 | ||||
-rw-r--r-- | install.php | 509 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/admin.lang.php | 5 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/install.lang.php | 14 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/lang.lang.php | 1 | ||||
-rw-r--r-- | template/default/htmlfunctions.inc.php | 4 | ||||
-rw-r--r-- | template/default/install.tpl | 150 | ||||
-rw-r--r-- | template/default/install.vtp | 254 |
10 files changed, 457 insertions, 504 deletions
diff --git a/include/common.inc.php b/include/common.inc.php index 844c8f433..577917e0d 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -112,7 +112,7 @@ $user = array(); $lang = array(); -include(PHPWG_ROOT_PATH .'config.php'); +include(PHPWG_ROOT_PATH .'include/mysql.inc.php'); if( !defined("PHPWG_INSTALLED") ) { header( 'Location: install.php' ); @@ -121,18 +121,18 @@ if( !defined("PHPWG_INSTALLED") ) include(PHPWG_ROOT_PATH . 'include/constants.php'); +include(PHPWG_ROOT_PATH . 'include/config.inc.php'); include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); include(PHPWG_ROOT_PATH . 'include/template.php'); include(PHPWG_ROOT_PATH . 'include/vtemplate.class.php'); -include(PHPWG_ROOT_PATH . 'include/config.inc.php'); // // Database connection // -mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) +mysql_connect( $dbhost, $dbuser, $dbpasswd ) or die ( "Could not connect to server" ); -mysql_select_db( $cfgBase ) +mysql_select_db( $dbname ) or die ( "Could not connect to database" ); // @@ -210,3 +210,4 @@ if ( $user['is_the_guest'] ) $user['username'] = $lang['guest']; include_once( './template/'.$user['template'].'/htmlfunctions.inc.php' ); define('PREFIX_TABLE', $table_prefix); ?> + diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 1d205414f..34697897f 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -271,11 +271,11 @@ function init_userprefs($userdata) function setup_style($style) { - $template_path = 'template/' ; - $template_name = $style ; - - $template = new Template(PHPWG_ROOT_PATH . $template_path . $template_name); - return $template; + $template_path = 'template/' ; + $template_name = $style ; + include_once( PHPWG_ROOT_PATH . $template_path . $template_name.'/htmlfunctions.inc.php' ); + $template = new Template(PHPWG_ROOT_PATH . $template_path . $template_name); + return $template; } function encode_ip($dotquad_ip) @@ -289,4 +289,4 @@ function decode_ip($int_ip) $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); } -?>
\ No newline at end of file +?> diff --git a/include/user.inc.php b/include/user.inc.php index f28a395f0..c86ce93fc 100644 --- a/include/user.inc.php +++ b/include/user.inc.php @@ -128,6 +128,7 @@ $isadmin = false; if ($user['status'] == 'admin') $isadmin =true; // calculation of the number of picture to display per page $user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page']; - init_userprefs($user); +$user['lien_expanded']='./template/'.$user['template'].'/theme/expanded..gif'; +$user['lien_collapsed']='./template/'.$user['template'].'/theme/collapsed.gif'; ?> diff --git a/install.php b/install.php index 4e358b775..467d9075f 100644 --- a/install.php +++ b/install.php @@ -25,292 +25,343 @@ // | USA. | // +-----------------------------------------------------------------------+ -//-------------------------------------------------------------------- includes -define( 'PREFIX_INCLUDE', '' ); -include( './include/vtemplate.class.php' ); -include( './include/functions.inc.php' ); +//----------------------------------------------------------- include +define('PHPWG_ROOT_PATH','./'); -$config_file = './config.php'; -//----------------------------------------------------- template initialization -$vtp = new VTemplate; -$handle = $vtp->Open( './template/default/install.vtp' ); -$vtp->setGlobalVar( $handle, 'release', '1.4' ); -//-------------------------------------------------------------------- language -if ( isset( $_GET['language'] ) ) +// Guess an initial language ... +function guess_lang() { - $isadmin = true; - $lang = array(); - include( './language/'.$_GET['language'].'.php' ); - $tpl = array( 'step1_err_copy', 'step1_err_copy_2', 'step1_err_copy_next', - 'errors_title', 'step1_title','step1_host','step1_host_info', - 'step1_user','step1_user_info','step1_pass','step1_pass_info', - 'step1_database','step1_database_info','step1_prefix', - 'step1_prefix_info','submit','infos_title','step2_title', - 'conf_general_webmaster','conf_general_webmaster_info', - 'step2_pwd','step2_pwd_info','step2_pwd_conf', - 'step2_pwd_conf_info','conf_general_mail', - 'conf_general_mail_info','install_end_title', - 'install_end_message','install_help'); - templatize_array( $tpl, 'lang', $handle ); - $vtp->setGlobalVar( $handle, 'language', $_GET['language'] ); + global $_SERVER; + $languages = array(); + $i = 0; + if ( $opendir = opendir ( PHPWG_ROOT_PATH.'language/' ) ) + { + while ( $file = readdir ( $opendir ) ) + { + if ( is_dir ( PHPWG_ROOT_PATH.'language/'.$file )&& !substr_count($file,'.')) + { + $languages[$i++] =$file; + } + } + } + + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) + { + $accept_lang_ary = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); + for ($i = 0; $i < sizeof($accept_lang_ary); $i++) + { + for ($j=0; $j<sizeof($languages); $j++) + { + if (preg_match('#' . substr($languages[$j],0,2) . '#i', substr(trim($accept_lang_ary[$i]),0,2))) + { + if (file_exists(PHPWG_ROOT_PATH . 'language/' . $languages[$j].'/install.lang.php')) + { + return $languages[$j]; + } + } + } + } + } + return 'en_EN'; } -//---------------------- Step 1 : connection informations, write of config file -if ( isset($_GET['step']) && $_GET['step'] == 1 ) + +set_magic_quotes_runtime(0); // Disable magic_quotes_runtime +// +// addslashes to vars if magic_quotes_gpc is off this is a security +// precaution to prevent someone trying to break out of a SQL statement. +// +if( !get_magic_quotes_gpc() ) { - $errors = array(); - $infos = array(); - // creation of ./include/mysql.inc.php : file containing database - // connection informations - if ( isset( $_POST['cfgBase'] ) - and isset( $_POST['cfgUser'] ) - and isset( $_POST['cfgPassword'] ) - and isset( $_POST['cfgHote'] ) ) + if( is_array($_POST) ) { - if ( @mysql_connect( $_POST['cfgHote'], - $_POST['cfgUser'], - $_POST['cfgPassword'] ) ) + while( list($k, $v) = each($_POST) ) { - if ( @mysql_select_db($_POST['cfgBase'] ) ) + if( is_array($_POST[$k]) ) { - array_push( $infos, $lang['step1_confirmation'] ); + while( list($k2, $v2) = each($_POST[$k]) ) + { + $_POST[$k][$k2] = addslashes($v2); + } + @reset($_POST[$k]); } else { - array_push( $errors, $lang['step1_err_db'] ); + $_POST[$k] = addslashes($v); } } - else - { - array_push( $errors, $lang['step1_err_server'] ); - } - - if ( count( $errors ) == 0 ) + @reset($_POST); + } + + if( is_array($_COOKIE) ) + { + while( list($k, $v) = each($_COOKIE) ) { - $file_content = "<?php"; - $file_content.= "\n\$cfgBase = '". $_POST['cfgBase']."';"; - $file_content.= "\n\$cfgUser = '". $_POST['cfgUser']."';"; - $file_content.= "\n\$cfgPassword = '". $_POST['cfgPassword']."';"; - $file_content.= "\n\$cfgHote = '". $_POST['cfgHote']."';"; - $file_content.= "\n"; - $file_content.= "\n\$table_prefix = '".$_POST['prefixeTable']."';"; - $file_content.= "\n"; - $file_content.= "\ndefine('PHPWG_INSTALLED', true);"; - $file_content.= "\n?>"; - // writting the configuration file - if ( $fp = @fopen( $config_file, 'a+' ) ) + if( is_array($_COOKIE[$k]) ) { - ftruncate($fp, 0); - fwrite( $fp, $file_content ); - fclose( $fp ); - } - $cfgHote = ''; - $cfgUser = ''; - $cfgPassword = ''; - $cfgBase = ''; - if ( is_file( $config_file ) ) include( $config_file ); - $file_OK = false; - if ( @mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) ) - { - if ( @mysql_select_db( $cfgBase ) ) $file_OK = true; - } - if ( !$file_OK ) - { - $vtp->addSession( $handle, 'error_copy' ); - $html_content = htmlentities( $file_content, ENT_QUOTES ); - $html_content = nl2br( $html_content ); - $vtp->setVar( $handle, 'error_copy.file_content', $html_content ); - $vtp->closeSession( $handle, 'error_copy' ); + while( list($k2, $v2) = each($_COOKIE[$k]) ) + { + $_COOKIE[$k][$k2] = addslashes($v2); + } + @reset($_COOKIE[$k]); } else { - $url = 'install.php?step=2&language='.$_GET['language']; - header( 'Request-URI: '.$url ); - header( 'Content-Location: '.$url); - header( 'Location: '.$url ); - exit(); + $_COOKIE[$k] = addslashes($v); } } + @reset($_COOKIE); } - // errors display - if ( sizeof( $errors ) != 0 ) - { - $vtp->addSession( $handle, 'errors' ); - foreach ( $errors as $error ) { - $vtp->addSession( $handle, 'error' ); - $vtp->setVar( $handle, 'error.content', $error ); - $vtp->closeSession( $handle, 'error' ); - } - $vtp->closeSession( $handle, 'errors' ); - } - // infos display - if ( sizeof( $infos ) != 0 ) - { - $vtp->addSession( $handle, 'infos' ); - foreach ( $infos as $info ) { - $vtp->addSession( $handle, 'info' ); - $vtp->setVar( $handle, 'info.content', $info ); - $vtp->closeSession( $handle, 'info' ); - } - $vtp->closeSession( $handle, 'infos' ); - } - // form display (if necessary) - if ( !isset( $_POST['submit'] ) or sizeof( $errors ) > 0 ) - { - $vtp->addSession( $handle, 'step1' ); +} - // host - if ( !isset( $_POST['cfgHote'] ) ) - $vtp->setVar( $handle, 'step1.f_host', 'localhost' ); - else - $vtp->setVar( $handle, 'step1.f_host', $_POST['cfgHote'] ); - // user - if ( isset( $_POST['cfgUser'] ) ) - $vtp->setVar( $handle, 'step1.f_user', $_POST['cfgUser'] ); - // base - if ( isset( $_POST['cfgBase'] ) ) - $vtp->setVar( $handle, 'step1.f_base', $_POST['cfgBase'] ); - // prefixeTable - if ( !isset( $_POST['prefixeTable'] ) ) - $vtp->setVar( $handle, 'step1.f_prefixeTable', 'phpwebgallery_' ); - else - $vtp->setVar( $handle, 'step1.f_prefixeTable', $_POST['prefixeTable'] ); +//----------------------------------------------------- variable initialization +$install_style = 'default'; +$release_version = '1.4'; +if ( isset( $_POST['language'] )) +{ + $language = strip_tags($_POST['language']); +} +else +{ + $language = guess_lang(); +} - $vtp->closeSession( $handle, 'step1' ); - } +if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language . '/install.lang.php')) ) +{ + $language = 'en_EN'; } -//------------------------------------- Step 2 : creation of tables in database -else if ( isset($_GET['step']) && $_GET['step'] == 2 ) +include( './language/'.$language.'/install.lang.php' ); +include( './language/'.$language.'/admin.lang.php' ); +$mapping_lang = $language; +if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language . '/lang.lang.php')) ) { - $errors = array(); - $infos = array(); + $mapping_lang = 'en_EN'; +} +include_once(PHPWG_ROOT_PATH . 'language/' . $mapping_lang . '/lang.lang.php'); - include( $config_file ); - mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) - or die ( "Can't connect to database host" ); - mysql_select_db( $cfgBase ) - or die ( "Connection to host succeeded, but database selection failed" ); - - if ( !isset( $_POST['submit'] ) ) - { - // tables creation, based on phpwebgallery_structure.sql - $sql_lines = file( './admin/phpwebgallery_structure.sql' ); - $query = ''; - foreach ( $sql_lines as $sql_line ) { - $sql_line = trim( $sql_line ); - if ( preg_match( '/(^--|^$)/', $sql_line ) ) continue; - $query.= ' '.$sql_line; - // if we reached the end of query, we execute it and reinitialize the - // variable "query" - if ( preg_match( '/;$/', $sql_line ) ) +// Obtain various vars +$dbhost = (!empty($_POST['dbhost'])) ? $_POST['dbhost'] : 'localhost'; +$dbuser = (!empty($_POST['dbuser'])) ? $_POST['dbuser'] : ''; +$dbpasswd = (!empty($_POST['dbpasswd'])) ? $_POST['dbpasswd'] : ''; +$dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : ''; + +$table_prefix = (!empty($_POST['prefix'])) ? $_POST['prefix'] : 'phpwg_'; + +$admin_name = (!empty($_POST['admin_name'])) ? $_POST['admin_name'] : ''; +$admin_pass1 = (!empty($_POST['admin_pass1'])) ? $_POST['admin_pass1'] : ''; +$admin_pass2 = (!empty($_POST['admin_pass2'])) ? $_POST['admin_pass2'] : ''; +$admin_mail = (!empty($_POST['admin_mail'])) ? $_POST['admin_mail'] : ''; + +$lang_options = $lang['lang']; +@asort($lang_options); +@reset($lang_options); + +$infos = array(); +$errors = array(); + +// Open config.php ... if it exists +$config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php'; +if (@file_exists($config_file)) +{ + include($config_file); +} + +// Is phpBB already installed? Yes? Redirect to the index +if (defined("PHPWG_INSTALLED")) +{ + header( 'Location: index.php' ); + exit; +} + +include(PHPWG_ROOT_PATH . 'include/constants.php'); +include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); +include(PHPWG_ROOT_PATH . 'include/template.php'); +//----------------------------------------------------- template initialization +$template=setup_style($install_style); +$template->set_filenames( array('install'=>'install.tpl') ); +$step = 1; +//----------------------------------------------------- form analyze +if ( isset( $_POST['install'] )) +{ + if ( @mysql_connect( $_POST['dbhost'], + $_POST['dbuser'], + $_POST['dbpasswd'] ) ) + { + if ( @mysql_select_db($_POST['dbname'] ) ) { - $query = trim( $query ); - $query = str_replace( 'phpwebgallery_', $table_prefix, $query ); - // we don't execute "DROP TABLE" queries - if ( !preg_match( '/^DROP TABLE/i', $query ) ) - mysql_query( $query ); - $query = ''; + array_push( $infos, $lang['step1_confirmation'] ); + } + else + { + array_push( $errors, $lang['step1_err_db'] ); } } - } - - if ( isset( $_POST['submit'] ) ) - { - // webmaster login must be - // 1. non empty - // 2. without characters ' or " - $webmaster = preg_replace( '/\s{2,}/', ' ', $_POST['webmaster'] ); - $webmaster = trim( $webmaster ); - if ( $webmaster == '' ) + else + { + array_push( $errors, $lang['step1_err_server'] ); + } + + $webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name )); + if ( empty($webmaster)) array_push( $errors, $lang['step2_err_login1'] ); - if ( preg_match( '/[\'"]/', $webmaster ) ) + else if ( preg_match( '/[\'"]/', $webmaster ) ) array_push( $errors, $lang['step2_err_login3'] ); - // the webmaster string must be the same as its confirmation - if ( $_POST['pwdWebmaster'] != $_POST['pwdWebmasterConf'] ) - array_push( $errors, $lang['step2_err_pass'] ); - // mail address must have this format : name@server.com - $error_mail_address = validate_mail_address( $_POST['mail_webmaster'] ); - if ( $error_mail_address != '' ) - array_push( $errors, $error_mail_address ); - if ( $_POST['mail_webmaster'] == '' ) - array_push( $errors, $lang['reg_err_mail_address'] ); - - // if no error found till here : insertion of data in tables - if ( count( $errors ) == 0 ) + if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) ) + array_push( $errors, $lang['step2_err_pass'] ); + if ( empty($admin_mail)) + array_push( $errors, $lang['reg_err_mail_address'] ); + else + { + $error_mail_address = validate_mail_address($admin_mail); + if (!empty($error_mail_address)) array_push( $errors, $error_mail_address ); + } + + if ( count( $errors ) == 0 ) { - $query = 'DELETE FROM '.$table_prefix.'config'; + $step = 2; + $file_content = "<?php"; + $file_content.= "\n\$dbname = '". $dbname."';"; + $file_content.= "\n\$dbuser = '". $dbuser."';"; + $file_content.= "\n\$dbpasswd = '". $dbpasswd."';"; + $file_content.= "\n\$dbhost = '". $dbhost."';"; + $file_content.= "\n"; + $file_content.= "\n\$table_prefix = '".$table_prefix."';"; + $file_content.= "\n"; + $file_content.= "\ndefine('PHPWG_INSTALLED', true);"; + $file_content.= "\n?".">"; + + @umask(0111); + // writing the configuration file + if ( !($fp = @fopen( $config_file, 'w' ))) + { + $html_content = htmlentities( $file_content, ENT_QUOTES ); + $html_content = nl2br( $html_content ); + $template->assign_block_vars('error_copy',array('FILE_CONTENT'=>$html_content)); + } + @fputs($fp, $file_content, strlen($file_content)); + @fclose($fp); + + // tables creation, based on phpwebgallery_structure.sql + $sql_lines = file( './admin/phpwebgallery_structure.sql' ); + $query = ''; + foreach ( $sql_lines as $sql_line ) + { + $sql_line = trim( $sql_line ); + if ( preg_match( '/(^--|^$)/', $sql_line ) ) continue; + $query.= ' '.$sql_line; + // if we reached the end of query, we execute it and reinitialize the + // variable "query" + if ( preg_match( '/;$/', $sql_line ) ) + { + $query = trim( $query ); + $query = str_replace( 'phpwebgallery_', $table_prefix, $query ); + // we don't execute "DROP TABLE" queries + if ( !preg_match( '/^DROP TABLE/i', $query ) ) mysql_query( $query ); + $query = ''; + } + } + + // We fill the tables with basic informations + $query = 'DELETE FROM '.CONFIG_TABLE; mysql_query( $query ); - $query = 'INSERT INTO '.$table_prefix.'config'; + $query = 'INSERT INTO '.CONFIG_TABLE; $query.= ' (webmaster,mail_webmaster) VALUES '; - $query.= " ('".$webmaster."','".$_POST['mail_webmaster']."')"; - $query.= ';'; + $query.= " ('".$admin_name."','".$admin_mail."');"; mysql_query( $query ); - $query = 'INSERT INTO '.$table_prefix.'sites'; - $query.= " (id,galleries_url) VALUES (1, './galleries/')"; - $query.= ';'; + $query = 'INSERT INTO '.SITES_TABLE; + $query.= " (id,galleries_url) VALUES (1, './galleries/');"; mysql_query( $query ); // webmaster admin user - $query = 'INSERT INTO '.$table_prefix.'users'; + $query = 'INSERT INTO '.USERS_TABLE; $query.= ' (id,username,password,status,language,mail_address) VALUES '; - $query.= "(1,'".$webmaster."','".md5( $_POST['pwdWebmaster'] )."'"; - $query.= ",'admin','".$_GET['language']."'"; - $query.= ",'".$_POST['mail_webmaster']."')"; - $query.= ';'; + $query.= "(1,'".$admin_name."','".md5( $admin_pass1 )."'"; + $query.= ",'admin','".$language."'"; + $query.= ",'".$admin_mail."');"; mysql_query($query); // guest user - $query = 'INSERT INTO '.$table_prefix.'users'; + $query = 'INSERT INTO '.USERS_TABLE; $query.= '(id,username,password,status,language) VALUES '; - $query.= "(2,'guest','','guest','".$_GET['language']."')"; + $query.= "(2,'guest','','guest','".$language."')"; $query.= ';'; mysql_query( $query ); } - } +} - // errors display - if ( sizeof( $errors ) != 0 ) +$template->assign_vars(array( + 'RELEASE'=>$release_version, + + 'L_BASE_TITLE'=>$lang['Initial_config'], + 'L_LANG_TITLE'=>$lang['Default_lang'], + 'L_DB_TITLE'=>$lang['step1_title'], + 'L_DB_HOST'=>$lang['step1_host'], + 'L_DB_HOST_INFO'=>$lang['step1_host_info'], + 'L_DB_USER'=>$lang['step1_user'], + 'L_DB_USER_INFO'=>$lang['step1_user_info'], + 'L_DB_PASS'=>$lang['step1_pass'], + 'L_DB_PASS_INFO'=>$lang['step1_pass_info'], + 'L_DB_NAME'=>$lang['step1_database'], + 'L_DB_NAME_INFO'=>$lang['step1_database_info'], + 'L_DB_PREFIX'=>$lang['step1_prefix'], + 'L_DB_PREFIX_INFO'=>$lang['step1_prefix_info'], + 'L_ADMIN_TITLE'=>$lang['step2_title'], + 'L_ADMIN'=>$lang['conf_general_webmaster'], + 'L_ADMIN_INFO'=>$lang['conf_general_webmaster_info'], + 'L_ADMIN_PASSWORD'=>$lang['step2_pwd'], + 'L_ADMIN_PASSWORD_INFO'=>$lang['step2_pwd_info'], + 'L_ADMIN_CONFIRM_PASSWORD'=>$lang['step2_pwd_conf'], + 'L_ADMIN_CONFIRM_PASSWORD_INFO'=>$lang['step2_pwd_conf_info'], + 'L_ADMIN_EMAIL'=>$lang['conf_general_mail'], + 'L_ADMIN_EMAIL_INFO'=>$lang['conf_general_mail_info'], + 'L_SUBMIT'=>$lang['Start_Install'], + 'L_HELP'=>$lang['install_help'], + 'L_ERR_COPY'=>$lang['step1_err_copy'], + 'L_END_TITLE'=>$lang['install_end_title'], + 'L_END_MESSAGE'=>$lang['install_end_message'], + + 'F_ACTION'=>add_session_id( 'install.php' ), + 'F_DB_HOST'=>$dbhost, + 'F_DB_USER'=>$dbuser, + 'F_DB_NAME'=>$dbname, + 'F_DB_PREFIX'=>$table_prefix, + 'F_ADMIN'=>$admin_name, + 'F_ADMIN_EMAIL'=>$admin_mail, + 'F_LANG_SELECT'=>make_jumpbox($lang_options, $language, true), + + 'T_CONTENT_ENCODING' => $lang['charset'], + 'T_STYLE' => './template/'.$install_style.'/'.$install_style.'-admin.css') + ); + +//-------------------------------------------------------- errors & infos display +if ( sizeof( $errors ) != 0 ) +{ + $template->assign_block_vars('errors',array()); + for ( $i = 0; $i < sizeof( $errors ); $i++ ) { - $vtp->addSession( $handle, 'errors' ); - foreach ( $errors as $error ) { - $vtp->addSession( $handle, 'error' ); - $vtp->setVar( $handle, 'error.content', $error ); - $vtp->closeSession( $handle, 'error' ); - } - $vtp->closeSession( $handle, 'errors' ); + $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i])); } +} - if ( !isset( $_POST['submit'] ) or sizeof( $errors ) > 0 ) +if ( sizeof( $infos ) != 0 ) +{ + $template->assign_block_vars('infos',array()); + for ( $i = 0; $i < sizeof( $infos ); $i++ ) { - $vtp->addSession( $handle, 'step2' ); - if ( isset( $_POST['webmaster'] )) - $vtp->setVar( $handle, 'step2.f_webmaster', $_POST['webmaster'] ); - if ( isset( $_POST['mail_webmaster'] )) - $vtp->setVar( $handle, 'step2.f_mail_webmaster', $_POST['mail_webmaster']); - $vtp->closeSession( $handle, 'step2' ); + $template->assign_block_vars('infos.info',array('INFO'=>$infos[$i])); } +} - // end of installation message - if ( isset( $_POST['submit'] ) and count( $errors ) == 0 ) - { - $vtp->addSession( $handle, 'install_end' ); - $vtp->closeSession( $handle, 'install_end' ); - } +if ($step ==1) +{ + $template->assign_block_vars('install',array()); } -//---------------------------------------------------- Step 0 : language choice else { - $vtp->addSession( $handle, 'step0' ); - $languages = get_languages( './language/' ); - foreach ( $languages as $language ) { - $vtp->addSession( $handle, 'language' ); - $vtp->setVar( $handle, 'language.name', $language ); - $vtp->closeSession( $handle, 'language' ); - } - $vtp->closeSession( $handle, 'step0' ); + $template->assign_block_vars('install_end',array()); } + //----------------------------------------------------------- html code display -$code = $vtp->Display( $handle, 0 ); -echo $code; +$template->pparse('install'); ?> diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index dd74ed8a1..e0bfcc38a 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -299,10 +299,13 @@ $lang['help_access_title'] = 'Access authorization'; $lang['help_access'][0] = 'PhpWebGallery is able to forbid access to categories. Categories can be "public" or "private". In order to forbid access to a category :'; $lang['help_access'][1] = '1. Modify category informations (from the "categories" section in tha admin panel) and make it "private".'; $lang['help_access'][2] = '2. On the page of permissions (for a group or a user) the private category will be shown and you\'ll be able to authorize access or not.'; -$lang['help_infos'][2] = 'If you have any question, do not hesitate to take a look at the forum or ask a question there. The <a href="'.$conf['forum_url'].'" style="text-decoration:underline">forum</a> (message board) is available on the presentation site of PhpWebGallery.'; +if (isset($conf)) + $lang['help_infos'][2] = 'If you have any question, do not hesitate to take a look at the forum or ask a question there. The <a href="'.$conf['forum_url'].'" style="text-decoration:underline">forum</a> (message board) is available on the presentation site of PhpWebGallery.'; $lang['step1_err_copy'] = 'Copy the text between hyphens and paste it into the file "include/mysql.inc.php"(Warning : mysql.inc.php must only contain what is in blue, no line return or space character)'; $lang['permuser_only_private'] = 'Only private categories are shown'; $lang['waiting_update'] = 'Validated pictures will be displayed only once pictures database updated'; $lang['conf_upload_available_info'] = 'Authorizing the upload of pictures by users on the categories of the website (not on a remote server). This is general parameter, it is needed to authorize upload category by category, by default, no category is "uploadable".'; $lang['cat_unknown_id'] = 'This category is unknown in the database'; +$lang['install_warning'] = 'The file "install.php" is still present. Please remove it from your server. It is not secure to keep it.'; + ?>
\ No newline at end of file diff --git a/language/en_UK.iso-8859-1/install.lang.php b/language/en_UK.iso-8859-1/install.lang.php index 8907806b0..5e23892cf 100644 --- a/language/en_UK.iso-8859-1/install.lang.php +++ b/language/en_UK.iso-8859-1/install.lang.php @@ -26,12 +26,18 @@ // +-----------------------------------------------------------------------+ $lang['install_message'] = 'Message'; +$lang['Initial_config'] = 'Basic configuration'; +$lang['Default_lang'] = 'Default galerie language'; +$lang['step1_title'] = 'Database configuration'; +$lang['step2_title'] = 'Admin configuration'; +$lang['Start_Install'] = 'Start Install'; +$lang['reg_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)'; + $lang['step1_confirmation'] = 'Parameters are correct'; $lang['step1_err_db'] = 'Connection to server succeed, but it was impossible to connect to database'; $lang['step1_err_server'] = 'Can\'t connect to server'; $lang['step1_err_copy_2'] = 'The next step of the installation is now possible'; $lang['step1_err_copy_next'] = 'next step'; -$lang['step1_title'] = 'Step 1/2'; $lang['step1_host'] = 'MySQL host'; $lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr'; $lang['step1_user'] = 'user'; @@ -45,9 +51,7 @@ $lang['step1_prefix_info'] = 'database tables names will be prefixed with it (en $lang['step2_err_login1'] = 'enter a login for webmaster'; $lang['step2_err_login3'] = 'webmaster login can\'t contain characters \' or "'; $lang['step2_err_pass'] = 'please enter your password again'; -$lang['step2_err_mail'] = $lang['conf_err_mail']; $lang['install_end_title'] = 'Installation finished'; -$lang['step2_title'] = 'Step 2/2'; $lang['step2_pwd'] = 'webmaster password'; $lang['step2_pwd_info'] = 'Keep it confidential, it enables you to access administration panel'; $lang['step2_pwd_conf'] = 'confirm password'; @@ -57,9 +61,7 @@ $lang['install_end_message'] = 'The configuration of PhpWebGallery is finished, For security reason, please delete file "install.php"<br /> Once this file deleted , follow this instructions : <ul> -<li>go to the identification page : [ <a href="../identification.php">identification</a> ] and use the login/password given for webmaster</li> +<li>go to the identification page : [ <a href="identification.php">identification</a> ] and use the login/password given for webmaster</li> <li>this login will enable you to access to the administration panel and to the instructions in order to place pictures in your directories</li> </ul>'; -$lang['install_warning'] = 'The file "install.php" is still present. Please remove it from your server. It is not secure to keep it.'; - ?>
\ No newline at end of file diff --git a/language/en_UK.iso-8859-1/lang.lang.php b/language/en_UK.iso-8859-1/lang.lang.php index 51a127db9..b6e229b5e 100644 --- a/language/en_UK.iso-8859-1/lang.lang.php +++ b/language/en_UK.iso-8859-1/lang.lang.php @@ -37,4 +37,5 @@ $lang['lang'] = array( 'sv'=>'Swedish' ); +$lang['charset'] = 'iso-8859-1'; ?>
\ No newline at end of file diff --git a/template/default/htmlfunctions.inc.php b/template/default/htmlfunctions.inc.php index 170defc46..81c123ead 100644 --- a/template/default/htmlfunctions.inc.php +++ b/template/default/htmlfunctions.inc.php @@ -25,9 +25,6 @@ // | USA. | // +-----------------------------------------------------------------------+ -$user['lien_expanded']='./template/'.$user['template'].'/theme/expanded.gif'; -$user['lien_collapsed']='./template/'.$user['template'].'/theme/collapsed.gif'; - function get_icon( $date_comparaison ) { global $user, $conf; @@ -263,3 +260,4 @@ function make_radio($name, $value, $selected, $usekeys=false) return $boxstring; } ?> + diff --git a/template/default/install.tpl b/template/default/install.tpl new file mode 100644 index 000000000..89ac5f949 --- /dev/null +++ b/template/default/install.tpl @@ -0,0 +1,150 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset={T_CONTENT_ENCODING}" /> +<meta http-equiv="Content-script-type" content="text/javascript" /> +<meta http-equiv="Content-Style-Type" content="text/css" /> +<title>PhpWebGallery {RELEASE}</title> +<link rel="stylesheet" href="{T_STYLE}" type="text/css" /> +</head> +<body> + <table style="width:100%;height:100%"> + <tr align="center" valign="middle"> + <td> + <div class="grostitre">PhpWebGallery {RELEASE}</div> + <table class="table1"> + <!-- BEGIN errors --> + <tr> + <td class="contenucellule" colspan="3"> + <div class="errors"> + <ul> + <!-- BEGIN error --> + <li>{errors.error.ERROR}</li> + <!-- END error --> + </ul> + </div> + </td> + </tr> + <!-- END errors --> + <!-- BEGIN infos --> + <tr> + <td class="contenucellule" colspan="3"> + <div class="infos"> + <ul> + <!-- BEGIN info --> + <li>{infos.info.INFO}</li> + <!-- END info --> + </ul> + </div> + </td> + </tr> + <!-- END infos --> + <tr> + <td class="contenucellule"> + +<!-- BEGIN error_copy --> +{L_ERR_COPY} : +<br />-----------------------------------------------------<br /> +<div style="color:blue;">{error_copy.FILE_CONTENT}</div> +-----------------------------------------------------<br /> +<!-- END error_copy --> +<!-- BEGIN install --> +<form method="POST" action="{F_ACTION}" name="install_form"> + <table width="100%"> + <tr> + <th colspan="3">{L_BASE_TITLE}</th> + </tr> + <tr> + <td width="30%">{L_LANG_TITLE}</td> + <td colspan="2" align="left"> + <select name="language" onchange="this.form.submit()"> + {F_LANG_SELECT} + </select> + </td> + </tr> + <tr> + <th colspan="3">{L_DB_TITLE}</th> + </tr> + <tr> + <td colspan="3"> </td> + </tr> + <tr> + <td>{L_DB_HOST}</td> + <td align=center><input type="text" name="dbhost" value="{F_DB_HOST}" /></td> + <td class="row2">{L_DB_HOST_INFO}</td> + </tr> + <tr> + <td>{L_DB_USER}</td> + <td align=center><input type="text" name="dbuser" value="{F_DB_USER}" /></td> + <td class="row2">{L_DB_USER_INFO}</td> + </tr> + <tr> + <td>{L_DB_PASS}</td> + <td align=center><input type="password" name="dbpasswd" value="" /></td> + <td class="row2">{L_DB_PASS_INFO}</td> + </tr> + <tr> + <td>{L_DB_NAME}</td> + <td align=center><input type="text" name="dbname" value="{F_DB_NAME}" /></td> + <td class="row2">{L_DB_NAME_INFO}</td> + </tr> + <tr> + <td>{L_DB_PREFIX}</td> + <td align=center><input type="text" name="prefixeTable" value="{F_DB_PREFIX}" /></td> + <td class="row2">{L_DB_PREFIX_INFO}</td> + </tr> + <tr> + <td colspan="3"> </td> + </tr> + <tr> + <th colspan="3">{L_ADMIN_TITLE}</th> + </tr> + <tr> + <td colspan="3"> </td> + </tr> + <tr> + <td>{L_ADMIN}</td> + <td align="center"><input type="text" name="admin_name" value="{F_ADMIN}" /></td> + <td class="row2">{L_ADMIN_INFO}</td> + </tr> + <tr> + <td>{L_ADMIN_PASSWORD}</td> + <td align="center"><input type="password" name="admin_pass1" value="" /></td> + <td class="row2">{L_ADMIN_PASSWORD_INFO}</td> + </tr> + <tr> + <td>{L_ADMIN_CONFIRM_PASSWORD}</td> + <td align="center"><input type="password" name="admin_pass2" value="" /></td> + <td class="row2">{L_ADMIN_CONFIRM_PASSWORD_INFO}</td> + </tr> + <tr> + <td>{L_ADMIN_EMAIL}</td> + <td align="center"><input type="text" name="admin_mail" value="{F_ADMIN_EMAIL}" /></td> + <td class="row2">{L_ADMIN_EMAIL_INFO}</td> + </tr> + <tr> + <td colspan="3"> </th> + </tr> + <tr> + <td colspan="3" align="center"> + <input type="submit" name="install" value="{L_SUBMIT}" /> + </td> + </tr> + </table> +</form> +<!-- END install --> + +<!-- BEGIN install_end --> +<div class="infos_title">{L_END_TITLE}</div> +<div style="padding:5px;">{L_END_MESSAGE}</div> +<!-- END install_end --> + + </td> + </tr> + </table> + <div style="text-align:center;margin:20px;">{L_INSTALL_HELP}</div> + </td> + </tr> + </table> + </body> +</html>
\ No newline at end of file diff --git a/template/default/install.vtp b/template/default/install.vtp deleted file mode 100644 index 36c66bcac..000000000 --- a/template/default/install.vtp +++ /dev/null @@ -1,254 +0,0 @@ -<html> - <head> - <title>PhpWebGallery {#release}</title> - <style> - a { - text-decoration : none; - color : #006699; - } - a:hover { - text-decoration : underline; - } - body,table,input,form,select,textarea { - font-family : Arial, Verdana, Sans-Serif; - font-size : 12px; - } - .miniature { - border : solid 1px black; - } - body { - background-color : #E5E5E5; - } - .titretable1 { - color : black; - background-color : #D3DCE3; - text-align : center; - border : 2px solid #006699; - } - .grostitre { - text-align : center; - font-size : 20px; - margin-bottom : 20px; - } - .plan { - margin : 10px 10px 10px 2px; - white-space : nowrap; - } - .table1 { - border-collapse:collapse; - background-color:#FFFFFF; - width:700px; - margin:auto; - } - .contenucellule { - background-color : #EEEEEE; - border : 2px solid #006699; - } - .style1 { - margin-top : 20px; - } - th { - font-weight : bold; - background-color : #D3DCE3; - } - td.row1 { - background-color : #DDDDDD; - } - td.row2 { - background-color : #E8E8E8; - } - .cat_plan { - font-weight : bold; - } - .retrait { - margin : 10px; - margin-left : 30px; - margin-top : 2px; - } - input,textarea { - border-width : 1; - border-color : #000000; - background : #ffffff; - color: #000000; - } - .errors,.infos { - margin:10px; - } - .errors { - border:1px solid red; - background-color:#ffe1e1; - } - .infos { - background-color:#eff4fa; - border:1px solid #9cb4ce; - } - .errors_title,.infos_title { - margin:5px; - font-weight:bold; - font-size:120%; - text-align:center; - } - .errors_title { - color:red; - } - .infos_title { - color:#9cb4ce; - } - </style> - </head> - <body> - <table style="width:100%;height:100%"> - <tr align="center" valign="middle"> - <td> - <div class="grostitre">PhpWebGallery {#release}</div> - <table class="table1"> - <tr> - <td class="contenucellule"> -<!--VTP_errors--> -<div class="errors"> - <div class="errors_title">{#errors_title}</div> - <ul> - <!--VTP_error--> - <li>{#content}</li> - <!--/VTP_error--> - </ul> -</div> -<!--/VTP_errors--> - -<!--VTP_infos--> -<div class="infos"> - <div class="infos_title">{#infos_title}</div> - <ul> - <!--VTP_info--> - <li>{#content}</li> - <!--/VTP_info--> - </ul> -</div> -<!--/VTP_infos--> - -<!--VTP_error_copy--> -{#step1_err_copy} : -<br />-----------------------------------------------------<br /> -<div style="color:blue;">{#file_content}</div> ------------------------------------------------------<br /> -<div style="text-align:center;">{#step1_err_copy_2}<br /> -<a href="./install.php?step=2&language={#language}">{#step1_err_copy_next}</a></div> -<!--/VTP_error_copy--> - -<!--VTP_step0--> -<form method="get" action="install.php"> - <input type="hidden" name="step" value="1" /> - <table width="100%"> - <tr> - <td align="center"> - <select name="language"> - <!--VTP_language--> - <option>{#name}</option> - <!--/VTP_language--> - </select> - <input name="submit" type="submit" value="Submit" /> - </td> - </tr> - </table> -</form> -<!--/VTP_step0--> - -<!--VTP_step1--> -<form method="post" action="install.php?step=1&language={#language}"> - <table width="100%"> - <tr> - <th colspan="3">{#step1_title}</th> - </tr> - <tr> - <td colspan="3"> </td> - </tr> - <tr> - <td>{#step1_host}</td> - <td align=center><input type="text" name="cfgHote" value="{#f_host}" /></td> - <td class="row2">{#step1_host_info}</td> - </tr> - <tr> - <td>{#step1_user}</td> - <td align=center><input type="text" name="cfgUser" value="{#f_user}" /></td> - <td class="row2">{#step1_user_info}</td> - </tr> - <tr> - <td>{#step1_pass}</td> - <td align=center><input type="password" name="cfgPassword" value="" /></td> - <td class="row2">{#step1_pass_info}</td> - </tr> - <tr> - <td>{#step1_database}</td> - <td align=center><input type="text" name="cfgBase" value="{#f_base}" /></td> - <td class="row2">{#step1_database_info}</td> - </tr> - <tr> - <td>{#step1_prefix}</td> - <td align=center><input type="text" name="prefixeTable" value="{#f_prefixeTable}" /></td> - <td class="row2">{#step1_prefix_info}</td> - </tr> - <tr> - <td colspan="3"> </td> - </tr> - <tr> - <td colspan="3" align="center"><input type="submit" name="submit" value="{#submit}" /></td> - </tr> - </table> -</form> -<!--/VTP_step1--> - -<!--VTP_step2--> -<form method="post" action="install.php?step=2&language={#language}"> - <table width=100%> - <tr> - <th colspan="3">{#step2_title}</th> - </tr> - <tr> - <td colspan="3"> </td> - </tr> - <tr> - <td>{#conf_general_webmaster}</td> - <td align="center"><input type="text" name="webmaster" value="{#f_webmaster}" /></td> - <td class="row2">{#conf_general_webmaster_info}</td> - </tr> - <tr> - <td>{#step2_pwd}</td> - <td align="center"><input type="password" name="pwdWebmaster" value="" /></td> - <td class="row2">{#step2_pwd_info}</td> - </tr> - <tr> - <td>{#step2_pwd_conf}</td> - <td align="center"><input type="password" name="pwdWebmasterConf" value="" /></td> - <td class="row2">{#step2_pwd_conf_info}</td> - </tr> - <tr> - <td>{#conf_general_mail}</td> - <td align="center"><input type="text" name="mail_webmaster" value="{#f_mail_webmaster}" /></td> - <td class="row2">{#conf_general_mail_info}</td> - </tr> - <tr> - <td colspan="3"> </th> - </tr> - <tr> - <td colspan="3" align="center"> - <input type="submit" name="submit" value="{#submit}" /> - </td> - </tr> - </table> -</form> -<!--/VTP_step2--> - -<!--VTP_install_end--> -<div class="infos_title">{#install_end_title}</div> -<div style="padding:5px;">{#install_end_message}</div> -<!--/VTP_install_end--> - - </td> - </tr> - </table> - <div style="text-align:center;margin:20px;">{#install_help}</div> - </td> - </tr> - </table> - </body> -</html>
\ No newline at end of file |