FIX #10984 FIX reposition on "Build backup" button
FIX Fatal error on dol_htmloutput_mesg with corrupted array
This commit is contained in:
parent
90ddc0a214
commit
d6ae62478c
@ -446,8 +446,10 @@ print "\n";
|
||||
|
||||
|
||||
<br>
|
||||
<div class="center"><input type="submit" class="button"
|
||||
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
|
||||
<div class="center">
|
||||
<input type="submit" class="button reposition" value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo">
|
||||
<input type="hidden" name="page_y" value="<?php echo GETPOST('page_y', 'int'); ?>">
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
@ -459,7 +461,7 @@ if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
|
||||
//print $paramclear;
|
||||
|
||||
// Now run command and show result
|
||||
// Now show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
print $_SESSION["commandbackupresult"];
|
||||
|
||||
@ -598,9 +600,6 @@ print '<br>';
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
// End of page
|
||||
|
||||
@ -50,7 +50,7 @@ if (! $user->admin) accessforbidden();
|
||||
if ($file && ! $what)
|
||||
{
|
||||
//print DOL_URL_ROOT.'/dolibarr_export.php';
|
||||
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))));
|
||||
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int')?'&page_y='.GETPOST('page_y', 'int'):''));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -122,25 +122,15 @@ $utils = new Utils($db);
|
||||
// MYSQL
|
||||
if ($what == 'mysql')
|
||||
{
|
||||
|
||||
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
if (! empty($dolibarr_main_restrict_os_commands))
|
||||
{
|
||||
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
|
||||
$ok=0;
|
||||
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
|
||||
foreach($arrayofallowedcommand as $allowedcommand)
|
||||
{
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$ok=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (! $ok)
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
|
||||
}
|
||||
@ -176,6 +166,18 @@ if ($what == 'postgresql')
|
||||
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
/* Not required, the command is output on screen but not ran for pgsql
|
||||
if (! empty($dolibarr_main_restrict_os_commands))
|
||||
{
|
||||
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
|
||||
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
|
||||
}
|
||||
} */
|
||||
|
||||
if (! $errormsg && $cmddump)
|
||||
{
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity);
|
||||
@ -193,7 +195,6 @@ if ($what == 'postgresql')
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($errormsg)
|
||||
{
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
@ -230,8 +231,8 @@ $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/
|
||||
print '<br>';
|
||||
*/
|
||||
|
||||
// Redirect t backup page
|
||||
header("Location: dolibarr_export.php");
|
||||
// Redirect to backup page
|
||||
header("Location: dolibarr_export.php".(GETPOST('page_y', 'int')?'?page_y='.GETPOST('page_y', 'int'):''));
|
||||
|
||||
$time_end = time();
|
||||
|
||||
|
||||
@ -148,6 +148,7 @@ print '
|
||||
/* Set handler to add page_y param on output (click on href links or submit button) */
|
||||
jQuery(".reposition").click(function() {
|
||||
var page_y = $(document).scrollTop();
|
||||
|
||||
if (page_y > 0)
|
||||
{
|
||||
if (this.href)
|
||||
@ -157,7 +158,7 @@ print '
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update form field page_y with value "+page_y);
|
||||
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field page_y with value "+page_y);
|
||||
jQuery("input[type=hidden][name=page_y]").val(page_y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6554,10 +6554,17 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o
|
||||
$newmesgarray=array();
|
||||
foreach($mesgarray as $val)
|
||||
{
|
||||
$tmpmesgstring=preg_replace('/<\/div><div class="(error|warning)">/', '<br>', $val);
|
||||
$tmpmesgstring=preg_replace('/<div class="(error|warning)">/', '', $tmpmesgstring);
|
||||
$tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring);
|
||||
$newmesgarray[]=$tmpmesgstring;
|
||||
if (is_string($val))
|
||||
{
|
||||
$tmpmesgstring=preg_replace('/<\/div><div class="(error|warning)">/', '<br>', $val);
|
||||
$tmpmesgstring=preg_replace('/<div class="(error|warning)">/', '', $tmpmesgstring);
|
||||
$tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring);
|
||||
$newmesgarray[]=$tmpmesgstring;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Error call of dol_htmloutput_mesg with an array with a value that is not a string", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
$mesgarray=$newmesgarray;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user