FIX A page of a site replaced with another when switching in edit mode

This commit is contained in:
Laurent Destailleur 2019-04-05 11:34:06 +02:00
parent 9e98421333
commit 44f113c718

View File

@ -210,6 +210,20 @@ $htmlheadercontentdefault.='-->'."\n";
* Actions
*/
// Protections
if ($action == 'updatesource' && (GETPOST('refreshsite_x') || GETPOST('refreshsite.x') || GETPOST('refreshpage_x') || GETPOST('refreshpage.x')))
{
$action = 'preview'; // To avoid to update another page or another site when we click on button to select another site or page.
}
if (GETPOST('refreshsite', 'alpha')) // If we change the site, we reset the pageid and cancel addsite action.
{
$pageid=0;
if ($action == 'addsite') $action = 'preview';
if ($action == 'updatesource') $action = 'preview';
}
if (GETPOST('refreshpage', 'alpha') && ! in_array($action, array('updatecss'))) $action='preview';
$backtopage=$_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha')?'&section_dir='.urlencode(GETPOST('section_dir', 'alpha')):''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
@ -267,15 +281,6 @@ if ($action == 'adddir' && $permtouploadfile)
}
*/
if (GETPOST('refreshsite', 'alpha')) // If we change the site, we reset the pageid and cancel addsite action.
{
$pageid=0;
if ($action == 'addsite') $action = 'preview';
}
if (GETPOST('refreshpage', 'alpha') && ! in_array($action, array('updatecss'))) $action='preview';
// Add site
if ($action == 'addsite')
{
@ -1752,7 +1757,7 @@ if (! GETPOST('hide_websitemenu'))
$out.=ajax_combobox('website');
print $out;
//print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'">';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshsite" value="'.$langs->trans("Load").'">';
if ($websitekey)