25if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
 
   26  define(
'CSRFCHECK_WITH_TOKEN', 
'1');    
 
   30require 
'../../main.inc.php';
 
   33$langs->loadLangs(array(
"other", 
"admin"));
 
   39$radio_dump = 
GETPOST(
'radio_dump');
 
   51$help_url = 
'EN:Restores|FR:Restaurations|ES:Restauraciones';
 
   55<script 
type=
"text/javascript">
 
   56jQuery(document).ready(
function() {
 
   57  jQuery(
"#mysql_options").<?php echo $radio_dump == 
'mysql_options' ? 
'show()' : 
'hide()'; ?>;
 
   58  jQuery(
"#postgresql_options").<?php echo $radio_dump == 
'postgresql_options' ? 
'show()' : 
'hide()'; ?>;
 
   60  jQuery(
"#radio_dump_mysql").click(
function() {
 
   61    jQuery(
"#mysql_options").show();
 
   63  jQuery(
"#radio_dump_postgresql").click(
function() {
 
   64    jQuery(
"#postgresql_options").show();
 
   67  if ($label == 
'MySQL') {
 
   68    print 
'jQuery("#radio_dump_mysql").click();';
 
   70  if ($label == 
'PostgreSQL') {
 
   71    print 
'jQuery("#radio_dump_postgresql").click();';
 
   80print 
'<div class="center">';
 
   81print $langs->trans(
"RestoreDesc", DOL_DATA_ROOT);
 
   87<legend style=
"font-size: 3em">1</legend>
 
   89print 
'<span class="opacitymedium">';
 
   90print $langs->trans(
"RestoreDesc2", DOL_DATA_ROOT).
'<br><br>';
 
   98<legend style=
"font-size: 3em">2</legend>
 
  100print 
'<span class="opacitymedium">';
 
  101print $langs->trans(
"RestoreDesc3", $dolibarr_main_db_name).
'<br><br>';
 
  105<?php print $langs->trans(
"DatabaseName").
' : <b>'.$dolibarr_main_db_name.
'</b>'; ?><br><br>
 
  107<table 
class=
"centpercent"><tr><td 
class=
"tdtop">
 
  109<?php 
if ($conf->use_javascript_ajax) { ?>
 
  110<div 
id=
"div_container_exportoptions">
 
  111<fieldset 
id=
"exportoptions">
 
  112  <legend><?php echo $langs->trans(
"ImportMethod"); ?></legend>
 
  114  if (in_array($type, array(
'mysql', 
'mysqli'))) {
 
  116  <div 
class=
"formelementrow">
 
  117    <input 
type=
"radio" name=
"what" value=
"mysql" id=
"radio_dump_mysql"<?php echo($radio_dump == 
'mysql_options' ? 
' checked' : 
''); ?> />
 
  118    <label 
for=
"radio_dump_mysql">MySQL (mysql)</label>
 
  121  } elseif (in_array($type, array(
'pgsql'))) {
 
  123  <div 
class=
"formelementrow">
 
  124    <input 
type=
"radio" name=
"what" value=
"mysql" id=
"radio_dump_postgresql"<?php echo($radio_dump == 
'postgresql_options' ? 
' checked' : 
''); ?> />
 
  125    <label 
for=
"radio_dump_postgresql">PostgreSQL Restore (pg_restore or psql)</label>
 
  129    print 
'No method available with database '.$label;
 
  136</td><td 
class=
"tdtop">
 
  139<div 
id=
"div_container_sub_exportoptions" >
 
  141if (in_array($type, array(
'mysql', 
'mysqli'))) {
 
  142    print 
'<fieldset id="mysql_options">';
 
  143    print 
'<legend>'.$langs->trans(
'RestoreMySQL').
'</legend>';
 
  144    print 
'<div class="formelementrow centpercent">';
 
  146    $command = $db->getPathOfRestore();
 
  147  if (preg_match(
"/\s/", $command)) {
 
  148    $command = $command = escapeshellarg($command); 
 
  151    $param = $dolibarr_main_db_name;
 
  152    $param .= 
" -h ".$dolibarr_main_db_host;
 
  153  if (!empty($dolibarr_main_db_port)) {
 
  154    $param .= 
" -P ".$dolibarr_main_db_port;
 
  156    $param .= 
" -u ".$dolibarr_main_db_user;
 
  157    $paramcrypted = $param;
 
  158    $paramclear = $param;
 
  159  if (!empty($dolibarr_main_db_pass)) {
 
  160    $paramcrypted .= 
" -p".preg_replace(
'/./i', 
'*', $dolibarr_main_db_pass);
 
  161    $paramclear .= 
" -p".$dolibarr_main_db_pass;
 
  164    echo $langs->trans(
"ImportMySqlDesc");
 
  166    print 
'<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans(
"ImportMySqlCommand", $command, ($showpass ? $paramclear : $paramcrypted)).
'</textarea><br>';
 
  169  if (empty($_GET[
"showpass"]) && $dolibarr_main_db_pass) {
 
  170    print 
'<br><a href="'.$_SERVER[
"PHP_SELF"].
'?showpass=1&radio_dump=mysql_options">'.$langs->trans(
"UnHidePassword").
'</a>';
 
  175} elseif (in_array($type, array(
'pgsql'))) {
 
  176  print 
'<fieldset id="postgresql_options">';
 
  177  print 
'<legend>Restore PostgreSQL</legend>';
 
  178  print 
'<div class="formelementrow">';
 
  180  $command = $db->getPathOfRestore();
 
  181  if (preg_match(
"/\s/", $command)) {
 
  182    $command = $command = escapeshellarg($command); 
 
  185  $param = 
" -d ".$dolibarr_main_db_name;
 
  186  $param .= 
" -h ".$dolibarr_main_db_host;
 
  187  if (!empty($dolibarr_main_db_port)) {
 
  188    $param .= 
" -p ".$dolibarr_main_db_port;
 
  190  $param .= 
" -U ".$dolibarr_main_db_user;
 
  191  $paramcrypted = $param;
 
  192  $paramclear = $param;
 
  198  $paramcrypted .= 
" -W";
 
  199  $paramclear .= 
" -W";
 
  201  $paramcrypted .= 
" -f";
 
  202  $paramclear .= 
" -f";
 
  204  echo $langs->trans(
"ImportPostgreSqlDesc");
 
  206  print 
'<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans(
"ImportPostgreSqlCommand", $command, ($showpass ? $paramclear : $paramcrypted)).
'</textarea><br>';
 
  220print 
'</td></tr></table>';
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
 
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
 
$conf db name
Only used if Module[ID]Name translation string is not found.
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.