Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Philippe GRAND 2018-09-11 10:22:00 +02:00
commit f0a3d64492
32 changed files with 221 additions and 98 deletions

View File

@ -15,6 +15,13 @@ For developers:
* Code changes to be more compatible with PSR2
* Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that)
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* If you use some links like viewimages.php?modulepart=mycompany&file=... in you external modules, you must
relace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for
modulepart=mycompany that now works like others).
***** ChangeLog for 8.0.1 compared to 8.0.0 *****

View File

@ -50,6 +50,7 @@ $error=0;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admincompany','globaladmin'));
/*
* Actions
*/
@ -397,7 +398,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
print ' &nbsp; ';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
}
} else {
print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
@ -791,7 +792,7 @@ else
}
else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
{
print '<img class="img_logo" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
print '<img class="img_logo" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
}
else
{

View File

@ -413,7 +413,7 @@ if ($action == 'edit') // Edit
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
print ' &nbsp; ';
print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
}
} else {
print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
@ -561,7 +561,7 @@ else // Show
print $conf->global->MAIN_LOGIN_BACKGROUND;
if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND))
{
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'">';
print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
}
else
{

View File

@ -63,7 +63,7 @@ top_htmlhead('','',0,0,'',$arrayofcss);
<?php
if (! empty($mysoc->logo_small))
{
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">';
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
}
else
{

View File

@ -47,7 +47,7 @@ $object->fetch($facid);
<div class="entete">
<div class="logo">
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?>
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">'; ?>
</div>
<div class="infos">
<p class="address"><?php echo $mysoc->name; ?><br>

View File

@ -2161,10 +2161,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$dirins.'/'.$original_file;
}
// Wrapping for some images
elseif (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output))
{
$accessallowed=1;
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file;
$original_file=$conf->mycompany->dir_output.'/'.$original_file;
}
// Wrapping for users photos
elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output))

View File

@ -662,6 +662,7 @@ function accessforbidden($message='',$printheader=1,$printfooter=1,$showonlymess
{
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
$langs=new Translate('',$conf);
$langs->setDefaultLang();
}
$langs->load("errors");

View File

@ -228,11 +228,11 @@ if (! function_exists('dol_loginfunction'))
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
}
elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode($mysoc->logo);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
$width=128;
}
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png'))

View File

@ -160,9 +160,9 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
$urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('thumbs/' . $mysoc->logo_small);
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/thumbs/'.$mysoc->logo_small);
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode($mysoc->logo);
$urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('logos/'.$mysoc->logo);
$width = 128;
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';

View File

@ -150,11 +150,13 @@ function dolWebsiteOutput($content)
$nbrep=0;
if (! $symlinktomediaexists)
{
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\document.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
}
else
{
@ -163,6 +165,8 @@ function dolWebsiteOutput($content)
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
}
}
@ -516,6 +520,31 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
/**
* Save content of a page on disk
*
* @param string $filemaster Full path of filename master.inc.php for website to generate
* @return boolean True if OK
*/
function dolSaveMasterFile($filemaster)
{
global $conf;
// Now generate the master.inc.php page
dol_syslog("We regenerate the master file");
dol_delete_file($filemaster);
$mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
@ -541,7 +570,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
if (! empty($conf->global->MAIN_UMASK))
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
return ($result?true:false);
return ($result?true:false);
}
@ -585,9 +614,9 @@ function dolSavePageContent($filetpl, $object, $objectpage)
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent.= '<!-- Include HTML header from common file -->'."\n";
$tplcontent.= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/'.$object->ref.'/htmlheader.html")); ?>'."\n";
$tplcontent.= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n";
$tplcontent.= '<!-- Include HTML header from page header block -->'."\n";
$tplcontent.= preg_replace('/<\/?html>/ims', '', $objectpage->htmlheader)."\n";
$tplcontent.= '</head>'."\n";
@ -612,22 +641,24 @@ function dolSavePageContent($filetpl, $object, $objectpage)
/**
* Save content of the index.php page
* Save content of the index.php and wrapper.php page
*
* @param string $pathofwebsite Path of website root
* @param string $fileindex Full path of file index.php
* @param string $filetpl File tpl to index.php page redirect to
* @param string $fileindex Full path of file wrapper.php
* @return boolean True if OK
*/
function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl)
function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
{
global $conf;
$result=0;
$result1=false;
$result2=false;
dol_mkdir($pathofwebsite);
dol_delete_file($fileindex);
dol_delete_file($fileindex);
$indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
@ -639,11 +670,25 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl)
$indexcontent.= "}\n";
$indexcontent.= "include_once './".basename($filetpl)."'\n";
$indexcontent.= '// END PHP ?>'."\n";
$result = file_put_contents($fileindex, $indexcontent);
$result1 = file_put_contents($fileindex, $indexcontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
return $result;
dol_delete_file($filewrapper);
$wrappercontent = '<?php'."\n";
$wrappercontent.= "// BEGIN PHP File generated to provide a wrapper.php - DO NOT MODIFY - It is just a generated wrapper.\n";
$wrappercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$wrappercontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$wrappercontent.= '$original_file=str_replace("../","/", GETPOST("file","alpha"));'."\n";
$wrappercontent.= 'if ($_GET["modulepart"] == "mycompany" && preg_match(\'/^\/?logos\//\', $original_file)) readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file));'."\n";
$wrappercontent.= "else print 'Bad value for modulepart or file';\n";
$wrappercontent.= 'if (is_object($db)) $db->close();'."\n";
$wrappercontent.= '// END PHP ?>'."\n";
$result2 = file_put_contents($filewrapper, $wrappercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filewrapper, octdec($conf->global->MAIN_UMASK));
return ($result1 && $result2);
}

View File

@ -273,7 +273,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('thumbs/'.$mysoc->logo_mini);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini);
}
else
{
@ -517,7 +517,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$tmp=explode('?',$menu_array[$i]['url'],2);
$url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link
// Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
{

View File

@ -469,7 +469,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('thumbs/'.$mysoc->logo_mini);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini);
}
else
{

View File

@ -67,7 +67,7 @@ $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize
?>
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
<?php if (empty($conf->dol_use_jmobile)) { ?>
<script type="text/javascript">
@ -78,7 +78,7 @@ $(document).ready(function () {
</script>
<?php } ?>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.'), rgb(240,240,240));"':'' ?>>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.5), rgb(240,240,240));"':'' ?>>
<div class="login_vertical_align">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">

View File

@ -54,7 +54,7 @@ $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize
?>
<!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
<?php if (empty($conf->dol_use_jmobile)) { ?>
<script type="text/javascript">
@ -66,7 +66,7 @@ $(document).ready(function () {
<?php } ?>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.'), rgb(240,240,240));"':'' ?>>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.5), rgb(240,240,240));"':'' ?>>
<div class="login_vertical_align">
<form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">

View File

@ -37,13 +37,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
// For bittorent link, we don't need to load/check we are into a login session
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'bittorrent')
{
if (! defined("NOLOGIN")) define("NOLOGIN",1);
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
if (! defined("NOIPCHECK")) define("NOIPCHECK",1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
// For direct external download link, we don't need to load/check we are into a login session
if (isset($_GET["hashp"]))
{

View File

@ -88,4 +88,5 @@ AliasPageAlreadyExists=Alias page <strong>%s</strong> already exists
CorporateHomePage=Corporate Home page
EmptyPage=Empty page
ExternalURLMustStartWithHttp=External URL must start with http:// or https://
ZipOfWebsitePackageToImport=Zip file of website package
ZipOfWebsitePackageToImport=Zip file of website package
ShowSubcontainers=Show included containers

View File

@ -79,7 +79,7 @@ function llxHeaderSurvey($title, $head="", $disablejs=0, $disablehead=0, $arrayo
// Print logo
if ($mysoc->logo) {
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file=thumbs/'.urlencode($mysoc->logo_small);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
}
}

View File

@ -400,7 +400,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$urllogo=$urlwithroot."/viewimage.php?modulepart=mycompany&file=".$mysoc->logo;
$urllogo=$urlwithroot."/viewimage.php?modulepart=mycompany&file=".urlencode('logos/'.$mysoc->logo);
$nvpstr = $nvpstr . "&LOGOIMG=" . urlencode($urllogo);
}
if (! empty($conf->global->PAYPAL_BRANDNAME))

View File

@ -99,11 +99,11 @@ function llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayo
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
}
elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode($mysoc->logo);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
$width=128;
}
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))

View File

@ -180,11 +180,11 @@ else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONL
$urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('thumbs/'.$logosmall);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
}
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode($logo);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
$width=96;
}
// Output html code for logo

View File

@ -681,12 +681,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->
$urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('thumbs/'.$logosmall);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
$width=150;
}
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode($logo);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
$width=150;
}
// Output html code for logo

View File

@ -219,12 +219,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->
$urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('thumbs/'.$logosmall);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$logosmall);
$width=150;
}
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode($logo);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$logo);
$width=150;
}
// Output html code for logo

View File

@ -157,12 +157,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->
$urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('thumbs/'.$logosmall);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$logosmall);
$width=150;
}
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode($logo);
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$logo);
$width=150;
}
// Output html code for logo

View File

@ -85,7 +85,7 @@ if (empty($pageid))
$objectpage=new WebsitePage($db);
$array=$objectpage->fetchAll($object->id);
if (count($array) > 0)
if (is_array($array) && count($array) > 0)
{
$firstrep=reset($array);
$pageid=$firstrep->id;

View File

@ -612,7 +612,7 @@ if ($user->rights->societe->creer)
$newcardbutton.= '</a>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
@ -1069,13 +1069,13 @@ while ($i < min($num, $limit))
// Customer code
if (! empty($arrayfields['s.code_client']['checked']))
{
print '<td>'.$obj->code_client.'</td>';
print '<td class="nowraponall">'.$obj->code_client.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Supplier code
if (! empty($arrayfields['s.code_fournisseur']['checked']))
{
print '<td>'.$obj->code_fournisseur.'</td>';
print '<td class="nowraponall">'.$obj->code_fournisseur.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Account customer code

View File

@ -826,7 +826,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<td></td>';
print '<td align="center">'.$langs->trans('Default').'</td>';
print '<td>'.$langs->trans('Note').'</td>';
print "<td></td></tr>\n";
print '<td>'.$langs->trans('DateModification').'</td>';
print "<td></td>";
print "</tr>\n";
$nbremote = 0;
$nblocal = 0;
@ -907,6 +909,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
if (empty($companypaymentmodetemp->stripe_card_ref)) print $langs->trans("Local");
else print $langs->trans("LocalAndRemote");
print '</td>';
print '<td>';
print dol_print_date($companypaymentmodetemp->tms, 'dayhour');
print '</td>';
print '<td align="right" class="nowraponall">';
if ($user->rights->societe->creer)
{
@ -1018,6 +1023,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '</td>';
print '<td>';
print $langs->trans("Remote");
//if ($src->cvc_check == 'fail') print ' - CVC check fail';
print '</td>';
print '<td>';
//var_dump($src);
print '';
print '</td>';
print '<td align="right" class="nowraponall">';
if ($user->rights->societe->creer)

View File

@ -177,7 +177,7 @@ $colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); // Norma
$tmppart=explode(',',$colorbacktabcard1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
else { $colortextbacktab='111111'; }
else { $colortextbacktab='000000'; }
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
@ -2460,21 +2460,24 @@ span.butAction, span.butActionDelete {
cursor: pointer;
/*color: #fff !important;
background: rgb(<?php echo $colorbackhmenu1 ?>);
border: 1px solid rgb(<?php echo $colorbackhmenu1 ?>);*/
border: 1px solid rgb(<?php echo $colorbackhmenu1 ?>);
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;*/
}
a.butActionNew>span.fa-plus-circle, a.butActionNew>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; }
a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; }
.butAction:hover, .butActionNew:hover {
.butAction:hover {
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
}
.butActionNew:hover {
text-decoration: underline;
box-shadow: unset !important;
}
.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
background: rgb(239, 232, 230);
@ -3875,6 +3878,13 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
float: right;
padding-top: 8px;
}
.websiteselectionsection {
border-left: 1px solid #bbb;
border-right: 1px solid #bbb;
margin-left: 0px;
padding-left: 8px;
margin-right: 5px;
}
/* ============================================================================== */

View File

@ -177,11 +177,11 @@ $rowspan=2;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
}
elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode($mysoc->logo);
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
$width=128;
}
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png'))

View File

@ -37,7 +37,8 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
// Some value of modulepart can be used to get resources that are public so no login are required.
if ((isset($_GET["modulepart"]) && ($_GET["modulepart"] == 'mycompany' || $_GET["modulepart"] == 'companylogo')))
// Note that only directory logo is free to access without login.
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file']))
{
if (! defined("NOLOGIN")) define("NOLOGIN",1);
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
@ -82,7 +83,6 @@ function llxFooter()
require 'main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$action=GETPOST('action','alpha');
$original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp=GETPOST('hashp','aZ09');
@ -96,6 +96,7 @@ if (empty($original_file) && empty($hashp) && $modulepart != 'barcode') accessfo
if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility
/*
* Actions
*/

View File

@ -158,7 +158,7 @@ class Website extends CommonObject
$sql .= ' '.((empty($this->entity) && $this->entity != '0')?'NULL':$this->entity).',';
$sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").',';
$sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").',';
$sql .= ' '.(! isset($this->status)?'NULL':$this->status).',';
$sql .= ' '.(! isset($this->status)?'1':$this->status).',';
$sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).',';
$sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").",";
$sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).',';
@ -873,7 +873,7 @@ class Website extends CommonObject
$allaliases = $objectpageold->pageurl;
$allaliases.= ($objectpageold->aliasalt ? ','.$objectpageold->aliasalt : '');
$line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;';
$line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2...
$line.= "\n";
fputs($fp, $line);
@ -914,6 +914,15 @@ class Website extends CommonObject
$line.= ");";
$line.= "\n";
fputs($fp, $line);
// Add line to update home page id during import
//var_dump($this->fk_default_home.' - '.$objectpageold->id.' - '.$objectpageold->newid);exit;
if ($this->fk_default_home > 0 && ($objectpageold->id == $this->fk_default_home) && ($objectpageold->newid > 0)) // This is the record with home page
{
$line = "UPDATE llx_website SET fk_default_home = ".($objectpageold->newid > 0 ? $this->db->escape($objectpageold->newid)."__+MAX_llx_website_page__" : "null")." WHERE rowid = __WEBSITE_ID__;";
$line.= "\n";
fputs($fp, $line);
}
}
fclose($fp);
@ -971,6 +980,15 @@ class Website extends CommonObject
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/containers', $conf->website->dir_output.'/'.$object->ref, 0, 1); // Overwrite if exists
// Now generate the master.inc.php page
$filemaster=$conf->website->dir_output.'/'.$object->ref.'/master.inc.php';
$result = dolSaveMasterFile($filemaster);
if (! $result)
{
$this->errors[]='Failed to write file '.$filemaster;
$error++;
}
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
@ -995,7 +1013,7 @@ class Website extends CommonObject
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1);
if ($runsql <= 0)
{
$this->errors[]='Failed to load sql file '.$sqlfile.'.';
$this->errors[]='Failed to load sql file '.$sqlfile;
$error++;
}

View File

@ -158,7 +158,9 @@ class WebsitePage extends CommonObject
$sql .= " t.status,";
$sql .= " t.grabbed_from,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
$sql .= ' WHERE 1 = 1';
@ -200,6 +202,8 @@ class WebsitePage extends CommonObject
$this->grabbed_from = $obj->grabbed_from;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_modif = $obj->fk_user_modif;
}
$this->db->free($resql);
@ -250,7 +254,9 @@ class WebsitePage extends CommonObject
$sql .= " t.status,";
$sql .= " t.grabbed_from,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid;
// Manage filter
@ -299,6 +305,8 @@ class WebsitePage extends CommonObject
$record->grabbed_from = $obj->grabbed_from;
$record->date_creation = $this->db->jdate($obj->date_creation);
$record->date_modification = $this->db->jdate($obj->date_modification);
$record->fk_user_create = $obj->fk_user_create;
$record->fk_user_modif = $obj->fk_user_modif;
//var_dump($record->id);
$records[$record->id] = $record;
}
@ -393,6 +401,7 @@ class WebsitePage extends CommonObject
$object->ref = $newref;
$object->pageurl = $newref;
$object->aliasalt = '';
$object->fk_user_create = $user->id;
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
if (! empty($newlang)) $object->lang=$newlang;
if ($istranslation) $object->fk_page = $fromid;
@ -526,6 +535,8 @@ class WebsitePage extends CommonObject
*/
public function initAsSpecimen()
{
global $user;
$this->id = 0;
$now=dol_now();
@ -543,5 +554,6 @@ class WebsitePage extends CommonObject
$this->grabbed_from = '';
$this->date_creation = $now - (24 * 30 * 3600);
$this->date_modification = $now - (24 * 7 * 3600);
$this->fk_user_create = $user->id;
}
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -140,6 +140,7 @@ $filerobot=$pathofwebsite.'/robots.txt';
$filehtaccess=$pathofwebsite.'/.htaccess';
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
$fileindex=$pathofwebsite.'/index.php';
$filewrapper=$pathofwebsite.'/wrapper.php';
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
@ -179,6 +180,7 @@ if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfil
if ($action == 'seteditinline')
{
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of show included containers
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int'));
exit;
}
@ -188,6 +190,19 @@ if ($action == 'unseteditinline')
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int'));
exit;
}
if ($action == 'setshowsubcontainers')
{
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 1);
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 0); // Force disable of edit inline
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int'));
exit;
}
if ($action == 'unsetshowsubcontainers')
{
dolibarr_del_const($db, 'WEBSITE_SUBCONTAINERSINLINE');
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int'));
exit;
}
// Add directory
/*
@ -981,7 +996,7 @@ if ($action == 'setashome')
// Generate the index.php page to be the home page
//-------------------------------------------------
$result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl);
$result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper);
if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs');
else setEventMessages('Failed to write file '.$fileindex, null, 'errors');
@ -1119,19 +1134,7 @@ if ($action == 'updatemeta')
// Now generate the master.inc.php page
dol_syslog("We regenerate the master file (because we update meta)");
dol_delete_file($filemaster);
$mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
//$mastercontent.= "include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';"."\n";
//$mastercontent.= '$website = new WebSite($db)'."\n";
$mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
$result = dolSaveMasterFile($filemaster);
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
// Now delete the alias.php page
@ -1319,16 +1322,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
// Now generate the master.inc.php page
dol_syslog("We regenerate the master file");
dol_delete_file($filemaster);
$mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
$result = dolSaveMasterFile($filemaster);
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
@ -1410,6 +1404,21 @@ if ($action == 'importsiteconfirm')
{
if (! empty($_FILES))
{
// Check symlink to medias and restore it if ko
$pathtomedias=DOL_DATA_ROOT.'/medias';
$pathtomediasinwebsite=$pathofwebsite.'/medias';
if (! is_link(dol_osencode($pathtomediasinwebsite)))
{
dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite);
dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists
$result = symlink($pathtomedias, $pathtomediasinwebsite);
if (! $result)
{
setEventMessages($langs->trans("ErrorFieldToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors');
$action = 'importsite';
}
}
if (is_array($_FILES['userfile']['tmp_name'])) $userfiles=$_FILES['userfile']['tmp_name'];
else $userfiles=array($_FILES['userfile']['tmp_name']);
@ -1857,14 +1866,18 @@ if (count($object->records) > 0)
print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditHTMLSource")).'" name="editsource">';
print '<div class="websiteselectionsection inline-block">';
print '<div class="inline-block">';
if ($websitepage->grabbed_from)
{
//print '<input type="submit" class="button nobordertransp" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'" value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
$langs->trans("EditInLine");
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="#" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'">'.img_picto($langs->trans("EditInLineOff"),'switch_off','',false,0,0,'','nomarginleft').'</a>';
}
else
{
//print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
print $langs->trans("EditInLine");
if (empty($conf->global->WEBSITE_EDITINLINE))
{
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=seteditinline">'.img_picto($langs->trans("EditInLineOff"),'switch_off','',false,0,0,'','nomarginleft').'</a>';
@ -1874,8 +1887,19 @@ if (count($object->records) > 0)
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unseteditinline">'.img_picto($langs->trans("EditInLineOn"),'switch_on','',false,0,0,'','nomarginleft').'</a>';
}
}
print ' &nbsp; ';
print '</div>';
print '<div class="inline-block">';
print $langs->trans("ShowSubcontainers");
if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOff"),'switch_off','',false,0,0,'','nomarginleft').'</a>';
}
else
{
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOn"),'switch_on','',false,0,0,'','nomarginleft').'</a>';
}
print '</div>';
print '</div>';
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button nobordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
else print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';