aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--install.php119
-rw-r--r--language/en_UK/install.lang.php2
-rw-r--r--language/es_ES/install.lang.php2
-rw-r--r--language/fr_FR/install.lang.php2
-rw-r--r--template/yoga/install.tpl117
5 files changed, 98 insertions, 144 deletions
diff --git a/install.php b/install.php
index f423842a1..b8dca9fdd 100644
--- a/install.php
+++ b/install.php
@@ -27,24 +27,6 @@
//----------------------------------------------------------- include
define('PHPWG_ROOT_PATH','./');
-//
-// Pick a language, any language ...
-//
-function language_select($default, $select_name = "language")
-{
- $available_lang = get_languages('utf-8');
-
- $lang_select = '<select name="' . $select_name . '" onchange="document.location = \''.PHPWG_ROOT_PATH.'install.php?language=\'+this.options[this.selectedIndex].value;">';
- foreach ($available_lang as $code => $displayname)
- {
- $selected = ( strtolower($default) == strtolower($code) ) ? ' selected="selected"' : '';
- $lang_select .= '<option value="'.$code.'" ' . $selected . '>' . ucwords($displayname) . '</option>';
- }
- $lang_select .= '</select>';
-
- return $lang_select;
-}
-
/**
* loads an sql file and executes all queries
*
@@ -209,13 +191,22 @@ include(PHPWG_ROOT_PATH . 'admin/include/functions.php');
include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
include(PHPWG_ROOT_PATH . 'include/template.php');
-if ( isset( $_REQUEST['language'] ))
+if (isset($_GET['language']))
{
- $language = strip_tags($_REQUEST['language']);
+ $language = strip_tags($_GET['language']);
}
else
{
$language = 'en_UK';
+ // Try to get browser language
+ foreach (get_languages('utf-8') as $language_code => $language_name)
+ {
+ if (substr($language_code,0,2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2))
+ {
+ $language = $language_code;
+ break;
+ }
+ }
}
load_language( 'common.lang', '', $language, false, 'utf-8' );
@@ -223,7 +214,7 @@ load_language( 'admin.lang', '', $language, false, 'utf-8' );
load_language( 'install.lang', '', $language, false, 'utf-8' );
//----------------------------------------------------- template initialization
-$template=new Template(PHPWG_ROOT_PATH.'template/yoga');
+$template=new Template(PHPWG_ROOT_PATH.'template/yoga', 'clear');
$template->set_filenames( array('install'=>'install.tpl') );
$step = 1;
//---------------------------------------------------------------- form analyze
@@ -303,12 +294,7 @@ define(\'DB_COLLATE\', \'\');
{
$html_content = htmlentities( $file_content, ENT_QUOTES );
$html_content = nl2br( $html_content );
- $template->assign_block_vars(
- 'error_copy',
- array(
- 'FILE_CONTENT' => $html_content,
- )
- );
+ $template->assign('error_copy', $html_content);
}
@fputs($fp, $file_content, strlen($file_content));
@fclose($fp);
@@ -380,80 +366,45 @@ define(\'DB_COLLATE\', \'\');
}
}
-$template->assign_vars(
+//------------------------------------------------------ start template output
+foreach (get_languages('utf-8') as $language_code => $language_name)
+{
+ if ($language == $language_code)
+ {
+ $template->assign('language_selection', $language_code);
+ }
+ $languages_options[$language_code] = $language_name;
+}
+$template->assign('language_options', $languages_options);
+
+$template->assign(
array(
+ 'T_CONTENT_ENCODING' => 'utf-8',
'RELEASE'=>PHPWG_VERSION,
-
- 'L_BASE_TITLE'=>l10n('Initial_config'),
- 'L_LANG_TITLE'=>l10n('Default_lang'),
- 'L_DB_TITLE'=>l10n('step1_title'),
- 'L_DB_HOST'=>l10n('step1_host'),
- 'L_DB_HOST_INFO'=>l10n('step1_host_info'),
- 'L_DB_USER'=>l10n('step1_user'),
- 'L_DB_USER_INFO'=>l10n('step1_user_info'),
- 'L_DB_PASS'=>l10n('step1_pass'),
- 'L_DB_PASS_INFO'=>l10n('step1_pass_info'),
- 'L_DB_NAME'=>l10n('step1_database'),
- 'L_DB_NAME_INFO'=>l10n('step1_database_info'),
- 'L_DB_PREFIX'=>l10n('step1_prefix'),
- 'L_DB_PREFIX_INFO'=>l10n('step1_prefix_info'),
- 'L_ADMIN_TITLE'=>l10n('step2_title'),
- 'L_ADMIN'=>l10n('install_webmaster'),
- 'L_ADMIN_INFO'=>l10n('install_webmaster_info'),
- 'L_ADMIN_PASSWORD'=>l10n('step2_pwd'),
- 'L_ADMIN_PASSWORD_INFO'=>l10n('step2_pwd_info'),
- 'L_ADMIN_CONFIRM_PASSWORD'=>l10n('step2_pwd_conf'),
- 'L_ADMIN_CONFIRM_PASSWORD_INFO'=>l10n('step2_pwd_conf_info'),
- 'L_ADMIN_EMAIL'=>l10n('conf_mail_webmaster'),
- 'L_ADMIN_EMAIL_INFO'=>l10n('conf_mail_webmaster_info'),
- 'L_SUBMIT'=>l10n('Start_Install'),
- 'L_INSTALL_HELP'=>sprintf(l10n('install_help'), 'http://forum.'.PHPWG_DOMAIN.'/'),
- 'L_ERR_COPY'=>l10n('step1_err_copy'),
- 'L_END_TITLE'=>l10n('install_end_title'),
- 'L_END_MESSAGE'=>l10n('install_end_message'),
-
- 'F_ACTION'=>'install.php',
+ 'F_ACTION' => 'install.php?language=' . $language,
'F_DB_HOST'=>$dbhost,
'F_DB_USER'=>$dbuser,
'F_DB_NAME'=>$dbname,
- 'F_DB_PREFIX' => (
- $table_prefix != DEFAULT_PREFIX_TABLE
- ? $table_prefix
- : DEFAULT_PREFIX_TABLE
- ),
+ 'F_DB_PREFIX' => $table_prefix,
'F_ADMIN'=>$admin_name,
'F_ADMIN_EMAIL'=>$admin_mail,
- 'F_LANG_SELECT'=>language_select($language),
-
- 'T_CONTENT_ENCODING' => 'utf-8'
+ 'L_INSTALL_HELP'=>sprintf(l10n('install_help'), 'http://forum.'.PHPWG_DOMAIN.'/'),
));
//------------------------------------------------------ errors & infos display
-if ( sizeof( $errors ) != 0 )
+if (count($errors) != 0)
{
- $template->assign_block_vars('errors',array());
- for ( $i = 0; $i < sizeof( $errors ); $i++ )
- {
- $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
- }
+ $template->assign('errors', $errors);
}
-if ( sizeof( $infos ) != 0 )
+if (count($infos) != 0 )
{
- $template->assign_block_vars('infos',array());
- for ( $i = 0; $i < sizeof( $infos ); $i++ )
- {
- $template->assign_block_vars('infos.info',array('INFO'=>$infos[$i]));
- }
+ $template->assign('infos', $infos);
}
-if ($step ==1)
-{
- $template->assign_block_vars('install',array());
-}
-else
+if ($step == 1)
{
- $template->assign_block_vars('install_end',array());
+ $template->assign('install', true);
}
//----------------------------------------------------------- html code display
diff --git a/language/en_UK/install.lang.php b/language/en_UK/install.lang.php
index d0e6f1139..e8564446c 100644
--- a/language/en_UK/install.lang.php
+++ b/language/en_UK/install.lang.php
@@ -40,7 +40,7 @@ $lang['step1_err_db'] = 'Connection to server succeed, but it was impossible to
$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_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['step1_err_copy'] = 'Copy the text in red 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['step1_host'] = 'MySQL host';
$lang['step1_host_info'] = 'localhost, sql.multimania.com, toto.freesurf.fr';
diff --git a/language/es_ES/install.lang.php b/language/es_ES/install.lang.php
index e64008f4c..8db63c8ab 100644
--- a/language/es_ES/install.lang.php
+++ b/language/es_ES/install.lang.php
@@ -58,7 +58,7 @@ $lang['step2_pwd'] = 'Palabra de paso';
$lang['step2_pwd_info'] = 'Debe quedar confidencial, permite acceder al tabla de administración.';
$lang['step2_pwd_conf'] = 'Palabra de paso [Confirmar]';
$lang['step2_pwd_conf_info'] = 'Comprobación';
-$lang['step1_err_copy'] = 'Copie el texto en azul entre las rayas y pegúelo en el fichero mysql.inc.php que se encuentra en el repertorio " include " a la base del lugar donde usted instaló a PhpWebGallery (el fichero mysql.inc.php debe contener SÓLO lo que está en azul entre las rayas, ninguna vuelta a la línea o espacio es autorizado)';
+$lang['step1_err_copy'] = 'Copie el texto en rojo entre las rayas y pegúelo en el fichero mysql.inc.php que se encuentra en el repertorio " include " a la base del lugar donde usted instaló a PhpWebGallery (el fichero mysql.inc.php debe contener SÓLO lo que está en azul entre las rayas, ninguna vuelta a la línea o espacio es autorizado)';
$lang['install_help'] = '¿ Necesidad de ayudante? Plantee su cuestión sobre él <a href="%s">foro de PhpWebGallery</a>.';
$lang['install_end_message'] = 'La configuración de la aplicación correctamente se celebró, coloca en la etapa próxima<br /><br />
Por medida de seguridad, gracias por suprimir el fichero "install.php"<br />
diff --git a/language/fr_FR/install.lang.php b/language/fr_FR/install.lang.php
index 03e891d4b..50c9312ef 100644
--- a/language/fr_FR/install.lang.php
+++ b/language/fr_FR/install.lang.php
@@ -57,7 +57,7 @@ $lang['step2_pwd'] = 'Mot de passe';
$lang['step2_pwd_info'] = 'Il doit rester confidentiel, il permet d\'accéder au panneau d\'administration.';
$lang['step2_pwd_conf'] = 'Mot de passe [ Confirmer ]';
$lang['step2_pwd_conf_info'] = 'Vérification';
-$lang['step1_err_copy'] = 'Copiez le texte en bleu entre les tirets et collez-le dans le fichier mysql.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé PhpWebGallery (le fichier mysql.inc.php ne doit comporter QUE ce qui est en bleu entre les tirets, aucun retour à la ligne ou espace n\'est autorisé)';
+$lang['step1_err_copy'] = 'Copiez le texte en rouge entre les tirets et collez-le dans le fichier mysql.inc.php qui se trouve dans le répertoire "include" à la base de l\'endroit où vous avez installé PhpWebGallery (le fichier mysql.inc.php ne doit comporter QUE ce qui est en bleu entre les tirets, aucun retour à la ligne ou espace n\'est autorisé)';
$lang['install_help'] = 'Besoin d\'aide ? Posez votre question sur le <a href="%s">forum de PhpWebGallery</a>.';
$lang['install_end_message'] = 'La configuration de l\'application s\'est correctement déroulée, place à la prochaine étape<br /><br />
Par mesure de sécurité, merci de supprimer le fichier "install.php"<br />
diff --git a/template/yoga/install.tpl b/template/yoga/install.tpl
index 822c16374..691da9784 100644
--- a/template/yoga/install.tpl
+++ b/template/yoga/install.tpl
@@ -1,12 +1,13 @@
-<!-- DEV TAG: not smarty migrated -->
+{* $Id$ *}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="fr">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset={T_CONTENT_ENCODING}">
+<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>
+<title>PhpWebGallery {$RELEASE}</title>
+{literal}
<style type="text/css">
body, input, select {
@@ -106,123 +107,127 @@ td.row {
border:1px solid red;
}
</style>
+{/literal}
</head>
<body>
<table style="width:100%;height:100%">
<tr align="center" valign="middle">
<td>
- <div class="title">PhpWebGallery {RELEASE}</div>
+ <div class="title">PhpWebGallery {$RELEASE}</div>
<table class="table1">
- <!-- BEGIN errors -->
+ {if isset($errors)}
<tr>
<td class="contenucellule" colspan="3">
<div class="errors">
<ul>
- <!-- BEGIN error -->
- <li>{errors.error.ERROR}</li>
- <!-- END error -->
+ {foreach from=$errors item=error}
+ <li>{$error}</li>
+ {/foreach}
</ul>
</div>
</td>
</tr>
- <!-- END errors -->
- <!-- BEGIN infos -->
+ {/if}
+ {if isset($infos)}
<tr>
<td class="contenucellule" colspan="3">
<div class="infos">
<ul>
- <!-- BEGIN info -->
- <li>{infos.info.INFO}</li>
- <!-- END info -->
+ {foreach from=$infos item=info}
+ <li>{$info}</li>
+ {/foreach}
</ul>
</div>
</td>
</tr>
- <!-- END infos -->
+ {/if}
<tr>
<td class="contenucellule">
-<!-- BEGIN error_copy -->
-{L_ERR_COPY} :
+{if isset($error_copy)}
+{'step1_err_copy'|@translate} :
<br />-----------------------------------------------------<br />
-<div class="error_copy">{error_copy.FILE_CONTENT}</div>
+<div class="error_copy">{$error_copy}</div>
-----------------------------------------------------<br />
-<!-- END error_copy -->
-<!-- BEGIN install -->
-<form method="POST" action="{F_ACTION}" name="install_form">
+{/if}
+
+{if isset($install)}
+<form method="POST" action="{$F_ACTION}" name="install_form">
<table>
<tr>
- <th colspan="3">{L_BASE_TITLE}</th>
+ <th colspan="3">{'Initial_config'|@translate}</th>
</tr>
<tr>
- <td style="width:30%;">{L_LANG_TITLE}</td>
+ <td style="width:30%;">{'Default_lang'|@translate}</td>
<td colspan="2" align="left">
- {F_LANG_SELECT}
+ <select name="language" onchange="document.location = 'install.php?language='+this.options[this.selectedIndex].value;">
+ {html_options options=$language_options selected=$language_selection}
+ </select>
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
- <th colspan="3">{L_DB_TITLE}</th>
+ <th colspan="3">{'step1_title'|@translate}</th>
</tr>
<tr>
- <td>{L_DB_HOST}</td>
- <td align=center><input type="text" name="dbhost" value="{F_DB_HOST}" /></td>
- <td class="row">{L_DB_HOST_INFO}</td>
+ <td>{'step1_host'|@translate}</td>
+ <td align=center><input type="text" name="dbhost" value="{$F_DB_HOST}" /></td>
+ <td class="row">{'step1_host_info'|@translate}</td>
</tr>
<tr>
- <td>{L_DB_USER}</td>
- <td align=center><input type="text" name="dbuser" value="{F_DB_USER}" /></td>
- <td class="row">{L_DB_USER_INFO}</td>
+ <td>{'step1_user'|@translate}</td>
+ <td align=center><input type="text" name="dbuser" value="{$F_DB_USER}" /></td>
+ <td class="row">{'step1_user_info'|@translate}</td>
</tr>
<tr>
- <td>{L_DB_PASS}</td>
+ <td>{'step1_pass'|@translate}</td>
<td align=center><input type="password" name="dbpasswd" value="" /></td>
- <td class="row">{L_DB_PASS_INFO}</td>
+ <td class="row">{'step1_pass_info'|@translate}</td>
</tr>
<tr>
- <td>{L_DB_NAME}</td>
- <td align=center><input type="text" name="dbname" value="{F_DB_NAME}" /></td>
- <td class="row">{L_DB_NAME_INFO}</td>
+ <td>{'step1_database'|@translate}</td>
+ <td align=center><input type="text" name="dbname" value="{$F_DB_NAME}" /></td>
+ <td class="row">{'step1_database_info'|@translate}</td>
</tr>
<tr>
- <td>{L_DB_PREFIX}</td>
- <td align=center><input type="text" name="prefix" value="{F_DB_PREFIX}" /></td>
- <td class="row">{L_DB_PREFIX_INFO}</td>
+ <td>{'step1_prefix'|@translate}</td>
+ <td align=center><input type="text" name="prefix" value="{$F_DB_PREFIX}" /></td>
+ <td class="row">{'step1_prefix_info'|@translate}</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
- <th colspan="3">{L_ADMIN_TITLE}</th>
+ <th colspan="3">{'step2_title'|@translate}</th>
</tr>
<tr>
- <td>{L_ADMIN}</td>
- <td align="center"><input type="text" name="admin_name" value="{F_ADMIN}" /></td>
- <td class="row">{L_ADMIN_INFO}</td>
+ <td>{'install_webmaster'|@translate}</td>
+ <td align="center"><input type="text" name="admin_name" value="{$F_ADMIN}" /></td>
+ <td class="row">{'install_webmaster_info'|@translate}</td>
</tr>
<tr>
- <td>{L_ADMIN_PASSWORD}</td>
+ <td>{'step2_pwd'|@translate}</td>
<td align="center"><input type="password" name="admin_pass1" value="" /></td>
- <td class="row">{L_ADMIN_PASSWORD_INFO}</td>
+ <td class="row">{'step2_pwd_info'|@translate}</td>
</tr>
<tr>
- <td>{L_ADMIN_CONFIRM_PASSWORD}</td>
+ <td>{'step2_pwd_conf'|@translate}</td>
<td align="center"><input type="password" name="admin_pass2" value="" /></td>
- <td class="row">{L_ADMIN_CONFIRM_PASSWORD_INFO}</td>
+ <td class="row">{'step2_pwd_conf_info'|@translate}</td>
</tr>
<tr>
- <td>{L_ADMIN_EMAIL}</td>
- <td align="center"><input type="text" name="admin_mail" value="{F_ADMIN_EMAIL}" /></td>
- <td class="row">{L_ADMIN_EMAIL_INFO}</td>
+ <td>{'conf_mail_webmaster'|@translate}</td>
+ <td align="center"><input type="text" name="admin_mail" value="{$F_ADMIN_EMAIL}" /></td>
+ <td class="row">{'conf_mail_webmaster_info'|@translate}</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center">
- <input class="submit" type="submit" name="install" value="{L_SUBMIT}" />
+ <input class="submit" type="submit" name="install" value="{'Start_Install'|@translate}" />
</td>
</tr>
<tr>
@@ -230,21 +235,19 @@ td.row {
</tr>
</table>
</form>
-<!-- END install -->
-
-<!-- BEGIN install_end -->
+{else}
<div class="infos_title">
-{L_END_TITLE}
+{'install_end_title'|@translate}
</div>
<div class="infos">
-{L_END_MESSAGE}
+{'install_end_message'|@translate}
</div>
-<!-- END install_end -->
+{/if}
</td>
</tr>
</table>
- <div class="header">{L_INSTALL_HELP}</div>
+ <div class="header">{$L_INSTALL_HELP}</div>
</td>
</tr>
</table>