26if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
27 define(
'CSRFCHECK_WITH_TOKEN',
'1');
31require
'../../main.inc.php';
42$langs->loadLangs(array(
"other",
"admin"));
48$radio_dump =
GETPOST(
'radio_dump');
49$action =
GETPOST(
'action',
'aZ09');
60$help_url =
'EN:Restores|FR:Restaurations|ES:Restauraciones';
61llxHeader(
'',
'', $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-tools_dolibarr_import');
64<script
type=
"text/javascript">
65jQuery(document).ready(
function() {
66 jQuery(
"#mysql_options").<?php echo $radio_dump ==
'mysql_options' ?
'show()' :
'hide()'; ?>;
67 jQuery(
"#postgresql_options").<?php echo $radio_dump ==
'postgresql_options' ?
'show()' :
'hide()'; ?>;
69 jQuery(
"#radio_dump_mysql").click(
function() {
70 jQuery(
"#mysql_options").show();
72 jQuery(
"#radio_dump_postgresql").click(
function() {
73 jQuery(
"#postgresql_options").show();
76 if ($label ==
'MySQL') {
77 print
'jQuery("#radio_dump_mysql").click();';
79 if ($label ==
'PostgreSQL') {
80 print
'jQuery("#radio_dump_postgresql").click();';
89print
'<div class="center">';
90print $langs->trans(
"RestoreDesc", DOL_DATA_ROOT);
96<legend style=
"font-size: 3em">1</legend>
98print
'<span class="opacitymedium">';
99print $langs->trans(
"RestoreDesc2", DOL_DATA_ROOT).
'<br><br>';
107<legend style=
"font-size: 3em">2</legend>
109print
'<span class="opacitymedium">';
110print $langs->trans(
"RestoreDesc3", $dolibarr_main_db_name).
'<br><br>';
114<?php print $langs->trans(
"DatabaseName").
' : <b>'.$dolibarr_main_db_name.
'</b>'; ?><br><br>
116<
table class=
"centpercent"><tr><td
class=
"tdtop">
118<?php
if (
$conf->use_javascript_ajax) { ?>
119<div
id=
"div_container_exportoptions">
120<fieldset
id=
"exportoptions">
121 <legend><?php echo $langs->trans(
"ImportMethod"); ?></legend>
123 if (in_array($type, array(
'mysql',
'mysqli'))) {
125 <div
class=
"formelementrow">
126 <input
type=
"radio" name=
"what" value=
"mysql" id=
"radio_dump_mysql"<?php echo($radio_dump ==
'mysql_options' ?
' checked' :
''); ?> />
127 <label
for=
"radio_dump_mysql">MySQL (mysql)</label>
130 } elseif (in_array($type, array(
'pgsql'))) {
132 <div
class=
"formelementrow">
133 <input
type=
"radio" name=
"what" value=
"mysql" id=
"radio_dump_postgresql"<?php echo($radio_dump ==
'postgresql_options' ?
' checked' :
''); ?> />
134 <label
for=
"radio_dump_postgresql">PostgreSQL Restore (pg_restore or psql)</label>
138 print
'No method available with database '.$label;
145</td><td
class=
"tdtop">
148<div
id=
"div_container_sub_exportoptions" >
150if (in_array($type, array(
'mysql',
'mysqli'))) {
151 print
'<fieldset id="mysql_options">';
152 print
'<legend>'.$langs->trans(
'RestoreMySQL').
'</legend>';
153 print
'<div class="formelementrow centpercent">';
156 $command = $db->getPathOfRestore();
157 if (preg_match(
"/\s/", $command)) {
158 $command = $command = escapeshellarg($command);
161 $param = $dolibarr_main_db_name;
162 $param .=
" -h ".$dolibarr_main_db_host;
163 if (!empty($dolibarr_main_db_port)) {
164 $param .=
" -P ".$dolibarr_main_db_port;
166 $param .=
" -u ".$dolibarr_main_db_user;
167 $paramcrypted = $param;
168 $paramclear = $param;
169 if (!empty($dolibarr_main_db_pass)) {
170 $paramcrypted .=
" -p".preg_replace(
'/./i',
'*', $dolibarr_main_db_pass);
171 $paramclear .=
" -p".$dolibarr_main_db_pass;
174 print $langs->trans(
"ImportMySqlDesc");
176 print
'<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans(
"ImportMySqlCommand", $command, ($action ==
'showpass' ? $paramclear : $paramcrypted)).
'</textarea><br>';
179 if (
GETPOST(
"action") !=
'showpass' && $dolibarr_main_db_pass) {
180 print
'<br><a href="'.$_SERVER[
"PHP_SELF"].
'?action=showpass&token='.
newToken().
'&radio_dump=mysql_options">'.$langs->trans(
"UnHidePassword").
'</a>';
185} elseif (in_array($type, array(
'pgsql'))) {
186 print
'<fieldset id="postgresql_options">';
187 print
'<legend>Restore PostgreSQL</legend>';
188 print
'<div class="formelementrow">';
190 $command = $db->getPathOfRestore();
191 if (preg_match(
"/\s/", $command)) {
192 $command = $command = escapeshellarg($command);
195 $param =
" -d ".$dolibarr_main_db_name;
196 $param .=
" -h ".$dolibarr_main_db_host;
197 if (!empty($dolibarr_main_db_port)) {
198 $param .=
" -p ".$dolibarr_main_db_port;
200 $param .=
" -U ".$dolibarr_main_db_user;
201 $paramcrypted = $param;
202 $paramclear = $param;
208 $paramcrypted .=
" -W";
209 $paramclear .=
" -W";
211 $paramcrypted .=
" -f";
212 $paramclear .=
" -f";
214 echo $langs->trans(
"ImportPostgreSqlDesc");
216 print
'<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans(
"ImportPostgreSqlCommand", $command, ($action ==
'showpass' ? $paramclear : $paramcrypted)).
'</textarea><br>';
228print
'</td></tr></table>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
load_fiche_titre($title, $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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
treeview li table
No Email.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.