diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 123dfe759ab..8be32bec500 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -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')?'§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';
@@ -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 '';
- print '';
+ print '';
if ($websitekey)