New: Can show full password on restore option

This commit is contained in:
Laurent Destailleur 2008-12-10 13:56:01 +00:00
parent f6bffc9322
commit 1aba0ab93a

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,9 +17,9 @@
*/ */
/** /**
\file htdocs/admin/tools/dolibarr_import.php * \file htdocs/admin/tools/dolibarr_import.php
\brief Page import de la base * \brief Page import de la base
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -31,6 +31,10 @@ if (! $user->admin)
accessforbidden(); accessforbidden();
/*
* View
*/
llxHeader(); llxHeader();
print_fiche_titre($langs->trans("Restore"),'','setup'); print_fiche_titre($langs->trans("Restore"),'','setup');
@ -44,7 +48,7 @@ print_titre($langs->trans("Restore")).'<br>';
?> ?>
<!-- Run on page load -->
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
//<![CDATA[ //<![CDATA[
function hide_them_all() { function hide_them_all() {
@ -53,27 +57,10 @@ function hide_them_all() {
// document.getElementById("latex_options").style.display = 'none'; // document.getElementById("latex_options").style.display = 'none';
// document.getElementById("pdf_options").style.display = 'none'; // document.getElementById("pdf_options").style.display = 'none';
// document.getElementById("none_options").style.display = 'none'; // document.getElementById("none_options").style.display = 'none';
}
function show_checked_option() {
hide_them_all();
if (document.getElementById('radio_dump_mysql')) {
document.getElementById('mysql_options').style.display = 'block';
}
// if (document.getElementById('radio_dump_latex').checked) {
// document.getElementById('latex_options').style.display = 'block';
// }
// if (document.getElementById('radio_dump_pdf').checked) {
// document.getElementById('pdf_options').style.display = 'block';
// }
// if (document.getElementById('radio_dump_xml').checked) {
// document.getElementById('none_options').style.display = 'block';
// }
// if (document.getElementById('radio_dump_csv')) {
// document.getElementById('csv_options').style.display = 'block';
// }
<?php
if (! empty($_GET["radio_dump"])) print "document.getElementById('mysql_options').style.display = 'block';";
?>
} }
//]]> //]]>
@ -89,6 +76,7 @@ function show_checked_option() {
<legend><?php echo $langs->trans("ImportMethod"); ?></legend> <legend><?php echo $langs->trans("ImportMethod"); ?></legend>
<div class="formelementrow"> <div class="formelementrow">
<input type="radio" name="what" value="mysql" id="radio_dump_mysql" <input type="radio" name="what" value="mysql" id="radio_dump_mysql"
<?php echo ($_GET["radio_dump"]=='mysql_options'?' checked':''); ?>
onclick=" onclick="
if (this.checked) { if (this.checked) {
hide_them_all(); hide_them_all();
@ -110,9 +98,13 @@ function show_checked_option() {
<div class="formelementrow"> <div class="formelementrow">
<?php <?php
// Parameteres execution // Parameteres execution
$command=escapeshellarg('mysql'); $command='mysql';
if (eregi(" ",$command)) $command=$command=escapeshellarg($command); // Use quotes on command
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host." -u ".$dolibarr_main_db_user; $param=$dolibarr_main_db_name;
$param.=" -h ".$dolibarr_main_db_host;
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
$param.=" -u ".$dolibarr_main_db_user;
$paramcrypted=$param; $paramcrypted=$param;
$paramclear=$param; $paramclear=$param;
if (! empty($dolibarr_main_db_pass)) if (! empty($dolibarr_main_db_pass))
@ -121,13 +113,18 @@ function show_checked_option() {
$paramclear.=" -p".$dolibarr_main_db_pass; $paramclear.=" -p".$dolibarr_main_db_pass;
} }
echo $langs->trans("ImportMySqlDesc"); ?><br> echo $langs->trans("ImportMySqlDesc");
<textarea rows="1" cols="120"><?php echo $langs->trans("ImportMySqlCommand",$command,$paramcrypted); ?></textarea><br> print '<br>';
</div> print '<textarea rows="1" cols="120">'.$langs->trans("ImportMySqlCommand",$command,$_GET["showpass"]?$paramclear:$paramcrypted).'</textarea><br>';
if ($_GET["showpass"]) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>';
print '</div>';
?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
//<![CDATA[ //<![CDATA[
show_checked_option();
hide_them_all(); hide_them_all();
//]]> //]]>
</script> </script>