FIX wrong website data root with multicompany
This commit is contained in:
parent
ad7fcd264b
commit
8a2cc52b5c
@ -113,7 +113,7 @@ $tabcond[1] = (!empty($conf->website->enabled));
|
|||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp = array();
|
$tabhelp = array();
|
||||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>'));
|
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/<i>websiteref</i>'));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck = array();
|
$tabfieldcheck = array();
|
||||||
@ -271,8 +271,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
$newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09'));
|
$newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09'));
|
||||||
if ($newname != $website->ref) {
|
if ($newname != $website->ref) {
|
||||||
$srcfile = DOL_DATA_ROOT.'/website/'.$website->ref;
|
$srcfile = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$website->ref;
|
||||||
$destfile = DOL_DATA_ROOT.'/website/'.$newname;
|
$destfile = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$newname;
|
||||||
|
|
||||||
if (dol_is_dir($destfile)) {
|
if (dol_is_dir($destfile)) {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -173,7 +173,7 @@ class FormWebsite
|
|||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
|
||||||
$listofsamples = dol_dir_list(DOL_DOCUMENT_ROOT.'/website/samples', 'files', 0, '^page-sample-.*\.html$');
|
$listofsamples = dol_dir_list(DOL_DOCUMENT_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/samples', 'files', 0, '^page-sample-.*\.html$');
|
||||||
|
|
||||||
$arrayofsamples = array();
|
$arrayofsamples = array();
|
||||||
$arrayofsamples['empty'] = 'EmptyPage'; // Always this one first
|
$arrayofsamples['empty'] = 'EmptyPage'; // Always this one first
|
||||||
|
|||||||
@ -50,7 +50,7 @@ $Config['Enabled'] = true;
|
|||||||
$extEntity = (empty($entity) ? 1 : $entity); // For multicompany with external access
|
$extEntity = (empty($entity) ? 1 : $entity); // For multicompany with external access
|
||||||
|
|
||||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website) ? '' : '_'.$website).'&entity='.$extEntity.'&file=';
|
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website) ? '' : '_'.$website).'&entity='.$extEntity.'&file=';
|
||||||
$Config['UserFilesAbsolutePathRelative'] = (empty($website) ? ((!empty($entity) ? '/'.$entity : '').'/medias/') : ('/website/'.$website));
|
$Config['UserFilesAbsolutePathRelative'] = (!empty($entity) ? '/'.$entity : '').(empty($website) ? '/medias/' : ('/website/'.$website));
|
||||||
|
|
||||||
|
|
||||||
// Fill the following value it you prefer to specify the absolute path for the
|
// Fill the following value it you prefer to specify the absolute path for the
|
||||||
|
|||||||
@ -495,7 +495,7 @@ function includeContainer($containerref)
|
|||||||
$containerref .= '.php';
|
$containerref .= '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$fullpathfile = DOL_DATA_ROOT.'/website/'.$websitekey.'/'.$containerref;
|
$fullpathfile = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity.'/' : '').'/website/'.$websitekey.'/'.$containerref;
|
||||||
|
|
||||||
if (empty($includehtmlcontentopened)) {
|
if (empty($includehtmlcontentopened)) {
|
||||||
$includehtmlcontentopened = 0;
|
$includehtmlcontentopened = 0;
|
||||||
@ -984,7 +984,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
|
|||||||
if (!$error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo))) {
|
if (!$error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo))) {
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
|
|
||||||
$pathofwebsite = $dolibarr_main_data_root.'/website/'.$website->ref;
|
$pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity.'/' : '').'/website/'.$website->ref;
|
||||||
$filehtmlheader = $pathofwebsite.'/htmlheader.html';
|
$filehtmlheader = $pathofwebsite.'/htmlheader.html';
|
||||||
$filecss = $pathofwebsite.'/styles.css.php';
|
$filecss = $pathofwebsite.'/styles.css.php';
|
||||||
$filejs = $pathofwebsite.'/javascript.js.php';
|
$filejs = $pathofwebsite.'/javascript.js.php';
|
||||||
|
|||||||
@ -169,9 +169,9 @@ if ($pageid == 'css') { // No more used ?
|
|||||||
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||||
//else
|
//else
|
||||||
header('Cache-Control: no-cache');
|
header('Cache-Control: no-cache');
|
||||||
$original_file = $dolibarr_main_data_root.'/website/'.$websitekey.'/styles.css.php';
|
$original_file = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websitekey.'/styles.css.php';
|
||||||
} else {
|
} else {
|
||||||
$original_file = $dolibarr_main_data_root.'/website/'.$websitekey.'/page'.$pageid.'.tpl.php';
|
$original_file = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websitekey.'/page'.$pageid.'.tpl.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the subdirectory name as the reference
|
// Find the subdirectory name as the reference
|
||||||
|
|||||||
@ -122,7 +122,7 @@ if (empty($pageid))
|
|||||||
// Security: Delete string ../ into $original_file
|
// Security: Delete string ../ into $original_file
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
|
|
||||||
$original_file = $dolibarr_main_data_root.'/website/'.$website.'/styles.css.php';
|
$original_file = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$website.'/styles.css.php';
|
||||||
|
|
||||||
// Find the subdirectory name as the reference
|
// Find the subdirectory name as the reference
|
||||||
$refname = basename(dirname($original_file)."/");
|
$refname = basename(dirname($original_file)."/");
|
||||||
|
|||||||
@ -587,6 +587,8 @@ class Website extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function delete(User $user, $notrigger = false)
|
public function delete(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -618,7 +620,7 @@ class Website extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !empty($this->ref)) {
|
if (!$error && !empty($this->ref)) {
|
||||||
$pathofwebsite = DOL_DATA_ROOT.'/website/'.$this->ref;
|
$pathofwebsite = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$this->ref;
|
||||||
|
|
||||||
dol_delete_dir_recursive($pathofwebsite);
|
dol_delete_dir_recursive($pathofwebsite);
|
||||||
}
|
}
|
||||||
@ -678,8 +680,8 @@ class Website extends CommonObject
|
|||||||
$oldidforhome = $object->fk_default_home;
|
$oldidforhome = $object->fk_default_home;
|
||||||
$oldref = $object->ref;
|
$oldref = $object->ref;
|
||||||
|
|
||||||
$pathofwebsiteold = $dolibarr_main_data_root.'/website/'.dol_sanitizeFileName($oldref);
|
$pathofwebsiteold = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.dol_sanitizeFileName($oldref);
|
||||||
$pathofwebsitenew = $dolibarr_main_data_root.'/website/'.dol_sanitizeFileName($newref);
|
$pathofwebsitenew = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.dol_sanitizeFileName($newref);
|
||||||
dol_delete_dir_recursive($pathofwebsitenew);
|
dol_delete_dir_recursive($pathofwebsitenew);
|
||||||
|
|
||||||
$fileindex = $pathofwebsitenew.'/index.php';
|
$fileindex = $pathofwebsitenew.'/index.php';
|
||||||
|
|||||||
@ -642,7 +642,7 @@ class WebsitePage extends CommonObject
|
|||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
$pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteobj->ref;
|
$pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websiteobj->ref;
|
||||||
|
|
||||||
$filealias = $pathofwebsite.'/'.$this->pageurl.'.php';
|
$filealias = $pathofwebsite.'/'.$this->pageurl.'.php';
|
||||||
$filetpl = $pathofwebsite.'/page'.$this->id.'.tpl.php';
|
$filetpl = $pathofwebsite.'/page'.$this->id.'.tpl.php';
|
||||||
|
|||||||
@ -226,7 +226,7 @@ if (empty($pageid) && empty($pageref) && $object->id > 0 && $action != 'createco
|
|||||||
|
|
||||||
|
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
$pathofwebsite = $dolibarr_main_data_root.'/website/'.$websitekey;
|
$pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websitekey;
|
||||||
$filehtmlheader = $pathofwebsite.'/htmlheader.html';
|
$filehtmlheader = $pathofwebsite.'/htmlheader.html';
|
||||||
$filecss = $pathofwebsite.'/styles.css.php';
|
$filecss = $pathofwebsite.'/styles.css.php';
|
||||||
$filejs = $pathofwebsite.'/javascript.js.php';
|
$filejs = $pathofwebsite.'/javascript.js.php';
|
||||||
@ -1924,7 +1924,7 @@ if ($usercanedit && (($action == 'updatesource' || $action == 'updatecontent' ||
|
|||||||
$tmpwebsite = new Website($db);
|
$tmpwebsite = new Website($db);
|
||||||
if ($newwebsiteid > 0 && $newwebsiteid != $object->id) {
|
if ($newwebsiteid > 0 && $newwebsiteid != $object->id) {
|
||||||
$tmpwebsite->fetch($newwebsiteid);
|
$tmpwebsite->fetch($newwebsiteid);
|
||||||
$pathofwebsitenew = $dolibarr_main_data_root.'/website/'.$tmpwebsite->ref;
|
$pathofwebsitenew = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$tmpwebsite->ref;
|
||||||
} else {
|
} else {
|
||||||
$tmpwebsite = $object;
|
$tmpwebsite = $object;
|
||||||
}
|
}
|
||||||
@ -2573,7 +2573,7 @@ if (!GETPOST('hide_websitemenu')) {
|
|||||||
|
|
||||||
if ($websitekey) {
|
if ($websitekey) {
|
||||||
$virtualurl = '';
|
$virtualurl = '';
|
||||||
$dataroot = DOL_DATA_ROOT.'/website/'.$websitekey;
|
$dataroot = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websitekey;
|
||||||
if (!empty($object->virtualhost)) {
|
if (!empty($object->virtualhost)) {
|
||||||
$virtualurl = $object->virtualhost;
|
$virtualurl = $object->virtualhost;
|
||||||
}
|
}
|
||||||
@ -3342,7 +3342,7 @@ if ($action == 'editcss') {
|
|||||||
// VirtualHost
|
// VirtualHost
|
||||||
print '<tr><td class="tdtop">';
|
print '<tr><td class="tdtop">';
|
||||||
|
|
||||||
$htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/{s1}'.$websitekey.'{s2}');
|
$htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/{s1}'.$websitekey.'{s2}');
|
||||||
$htmltext = str_replace(array('{s1}', '{s2}'), array('<i>', '</i>'), $htmltext);
|
$htmltext = str_replace(array('{s1}', '{s2}'), array('<i>', '</i>'), $htmltext);
|
||||||
$htmltext .= '<br>';
|
$htmltext .= '<br>';
|
||||||
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||||
@ -3528,7 +3528,7 @@ if ($action == 'createsite') {
|
|||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
|
|
||||||
$htmltext = $langs->trans("SetHereVirtualHost", '{s1}');
|
$htmltext = $langs->trans("SetHereVirtualHost", '{s1}');
|
||||||
$htmltext = str_replace('{s1}', DOL_DATA_ROOT.'/website/<i>websiteref</i>', $htmltext);
|
$htmltext = str_replace('{s1}', DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/<i>websiteref</i>', $htmltext);
|
||||||
$htmltext .= '<br>';
|
$htmltext .= '<br>';
|
||||||
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||||
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), '{s1}');
|
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), '{s1}');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user