diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 6563386f4c9..cd9a26dfa8c 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -45,7 +45,7 @@ if (! ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHI } $error=0; -$website=GETPOST('website', 'alpha'); +$websitekey=GETPOST('website', 'alpha'); $page=GETPOST('page', 'alpha'); $pageid=GETPOST('pageid', 'int'); $pageref=GETPOST('pageref', 'aZ09'); @@ -92,18 +92,19 @@ $objectpage=new WebsitePage($db); $object->fetchAll(); // Init $object->records // If website not defined, we take first found -if (empty($website)) +if (empty($websitekey)) { foreach($object->records as $key => $valwebsite) { - $website=$valwebsite->ref; + $websitekey=$valwebsite->ref; break; } } -if ($website) +if ($websitekey) { - $res = $object->fetch(0, $website); + $res = $object->fetch(0, $websitekey); } +$website = $object; if ($pageid < 0) $pageid = 0; if (($pageid > 0 || $pageref) && $action != 'addcontainer') @@ -128,7 +129,7 @@ if (($pageid > 0 || $pageref) && $action != 'addcontainer') } global $dolibarr_main_data_root; -$pathofwebsite=$dolibarr_main_data_root.'/website/'.$website; +$pathofwebsite=$dolibarr_main_data_root.'/website/'.$websitekey; $filehtmlheader=$pathofwebsite.'/htmlheader.html'; $filecss=$pathofwebsite.'/styles.css.php'; $filejs=$pathofwebsite.'/javascript.js.php'; @@ -167,7 +168,7 @@ $htmlheadercontentdefault.='-->'."\n"; * Actions */ -$backtopage=$_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid; // used after a confirm_deletefile into actions_linkedfiles.inc.php +$backtopage=$_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid; // 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' @@ -636,13 +637,13 @@ if ($action == 'addcontainer') if ($result) { setEventMessages($langs->trans("Saved"), null, 'mesgs'); - //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); //exit; } else { setEventMessages('Failed to write file '.$filetpl, null, 'errors'); - //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); //exit; } } @@ -717,7 +718,8 @@ if ($action == 'delete') $db->begin(); - $res = $object->fetch(0, $website); + $res = $object->fetch(0, $websitekey); + $website = $object; $res = $objectpage->fetch($pageid, $object->fk_website); @@ -734,9 +736,9 @@ if ($action == 'delete') if (! $error) { $db->commit(); - setEventMessages($langs->trans("PageDeleted", $objectpage->pageurl, $website), null, 'mesgs'); + setEventMessages($langs->trans("PageDeleted", $objectpage->pageurl, $websitekey), null, 'mesgs'); - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey); exit; } else @@ -755,7 +757,8 @@ if ($action == 'updatecss') } else { - $res = $object->fetch(0, $website); + $res = $object->fetch(0, $websitekey); + $website = $object; // Html header file $htmlheadercontent =''; @@ -922,7 +925,8 @@ if ($action == 'updatecss') if ($action == 'setashome') { $db->begin(); - $object->fetch(0, $website); + $object->fetch(0, $websitekey); + $website = $object; $object->fk_default_home = $pageid; $res = $object->update($user); @@ -956,7 +960,8 @@ if ($action == 'updatemeta') { $db->begin(); - $object->fetch(0, $website); + $object->fetch(0, $websitekey); + $website = $object; $objectpage->fk_website = $object->id; @@ -1074,13 +1079,13 @@ if ($action == 'updatemeta') if ($result) { setEventMessages($langs->trans("Saved"), null, 'mesgs'); - //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); //exit; } else { setEventMessages('Failed to write file '.$filetpl, null, 'errors'); - //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + //header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); //exit; } @@ -1092,7 +1097,8 @@ if ($action == 'updatemeta') if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'confirm_createfromclone' || $action == 'confirm_createpagefromclone') || ($action == 'preview' && (GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview')))) { - $object->fetch(0, $website); + $object->fetch(0, $websitekey); + $website = $object; if ($action == 'confirm_createfromclone') { @@ -1244,13 +1250,13 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf if ($result) { setEventMessages($langs->trans("Saved"), null, 'mesgs'); - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); exit; } else { setEventMessages('Failed to write file '.$filetpl, null, 'errors'); - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); exit; } } @@ -1261,7 +1267,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf } else { - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$websitekey.'&pageid='.$pageid); exit; } } @@ -1401,10 +1407,10 @@ if (count($object->records) > 0) $i=0; foreach($object->records as $key => $valwebsite) { - if (empty($website)) $website=$valwebsite->ref; + if (empty($websitekey)) $websitekey=$valwebsite->ref; $out.=''; @@ -1417,14 +1423,14 @@ if (count($object->records) > 0) print ''; - if ($website) + if ($websitekey) { $virtualurl=''; - $dataroot=DOL_DATA_ROOT.'/website/'.$website; + $dataroot=DOL_DATA_ROOT.'/website/'.$websitekey; if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost; } - if ($website && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) + if ($websitekey && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) { $disabled=''; if (empty($user->rights->website->write)) $disabled=' disabled="disabled"'; @@ -1443,7 +1449,7 @@ if (count($object->records) > 0) print '