* Copyright (C) 2006-2012 Regis Houssin * * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/admin/tools/dolibarr_import.php * \ingroup core * \brief Page to import database */ if (! defined('CSRFCHECK_WITH_TOKEN')) { define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET } // Load Dolibarr environment require '../../main.inc.php'; // Load translation files required by the page $langs->loadLangs(array("other", "admin")); if (!$user->admin) { accessforbidden(); } $radio_dump = GETPOST('radio_dump'); $showpass = GETPOST('showpass'); /* * View */ $label = $db::LABEL; $type = $db->type; $help_url = 'EN:Restores|FR:Restaurations|ES:Restauraciones'; llxHeader('', '', $help_url); ?> trans("Restore"), '', 'title_setup'); print '
'; print $langs->trans("RestoreDesc", DOL_DATA_ROOT); print '
'; print '
'; ?>
1 '; print $langs->trans("RestoreDesc2", DOL_DATA_ROOT).'

'; print ''; ?>

2 '; print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'

'; print ''; ?> trans("DatabaseName").' : '.$dolibarr_main_db_name.''; ?>

use_javascript_ajax) { ?>
trans("ImportMethod"); ?>
/>
/>
'; print ''.$langs->trans('RestoreMySQL').''; print '
'; // Parameteres execution $command = $db->getPathOfRestore(); if (preg_match("/\s/", $command)) { $command = $command = escapeshellarg($command); // Use quotes on command } $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; $paramclear = $param; if (!empty($dolibarr_main_db_pass)) { $paramcrypted .= " -p".preg_replace('/./i', '*', $dolibarr_main_db_pass); $paramclear .= " -p".$dolibarr_main_db_pass; } echo $langs->trans("ImportMySqlDesc"); print '
'; print '
'; print ajax_autoselect('restorecommand'); if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) { print '
'.$langs->trans("UnHidePassword").''; } //else print '
'.$langs->trans("HidePassword").''; print '
'; print ''; } elseif (in_array($type, array('pgsql'))) { print '
'; print 'Restore PostgreSQL'; print '
'; // Parameteres execution $command = $db->getPathOfRestore(); if (preg_match("/\s/", $command)) { $command = $command = escapeshellarg($command); // Use quotes on command } $param = " -d ".$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; $paramclear = $param; /*if (!empty($dolibarr_main_db_pass)) { $paramcrypted.=" -p".preg_replace('/./i','*',$dolibarr_main_db_pass); $paramclear.=" -p".$dolibarr_main_db_pass; }*/ $paramcrypted .= " -W"; $paramclear .= " -W"; // With psql: $paramcrypted .= " -f"; $paramclear .= " -f"; echo $langs->trans("ImportPostgreSqlDesc"); print '
'; print '
'; print ajax_autoselect('restorecommand'); //if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '
'.$langs->trans("UnHidePassword").''; //else print '
'.$langs->trans("HidePassword").''; print '
'; print '
'; print '
'; } print '
'; print '
'; print '
'; // End of page llxFooter(); $db->close();