diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 60b4e4e20cb3a..1ec9c2c65c417 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -213,7 +213,21 @@
* Actions
*/
-$backtopage=$_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir','alpha')?'§ion_dir='.urlencode(GETPOST('section_dir','alpha')):''); // used after a confirm_deletefile into actions_linkedfiles.inc.php
+// 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')?'§ion_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';
if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfiles, if action were renamefile, we set it to 'file_manager'
@@ -270,15 +284,6 @@
}
*/
-
-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')
{
@@ -1755,7 +1760,7 @@
$out.=ajax_combobox('website');
print $out;
//print '';
- print '';
+ print '';
if ($websitekey)