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

This commit is contained in:
Frédéric FRANCE 2018-09-09 13:36:53 +02:00
commit 7e0b1055db
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
38 changed files with 122 additions and 66 deletions

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 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admincompany','globaladmin')); $hookmanager->initHooks(array('admincompany','globaladmin'));
/* /*
* Actions * Actions
*/ */
@ -397,7 +398,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>'; 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)) { if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
print ' &nbsp; '; 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 { } else {
print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">'; 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)) 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 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>'; 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)) { if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
print ' &nbsp; '; 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 { } else {
print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">'; 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; print $conf->global->MAIN_LOGIN_BACKGROUND;
if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$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 else
{ {

View File

@ -63,7 +63,7 @@ top_htmlhead('','',0,0,'',$arrayofcss);
<?php <?php
if (! empty($mysoc->logo_small)) 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 else
{ {

View File

@ -47,7 +47,7 @@ $object->fetch($facid);
<div class="entete"> <div class="entete">
<div class="logo"> <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>
<div class="infos"> <div class="infos">
<p class="address"><?php echo $mysoc->name; ?><br> <p class="address"><?php echo $mysoc->name; ?><br>

View File

@ -85,7 +85,6 @@ class PaymentVarious extends CommonObject
$this->db = $db; $this->db = $db;
$this->element = 'payment_various'; $this->element = 'payment_various';
$this->table_element = 'payment_various'; $this->table_element = 'payment_various';
return 1;
} }
/** /**
@ -387,13 +386,14 @@ class PaymentVarious extends CommonObject
// Insert payment into llx_bank // Insert payment into llx_bank
// Add link 'payment_various' in bank_url between payment and bank transaction // Add link 'payment_various' in bank_url between payment and bank transaction
if ($this->sens == '0') $sign='-'; $sign=1;
if ($this->sens == '0') $sign=-1;
$bank_line_id = $acc->addline( $bank_line_id = $acc->addline(
$this->datep, $this->datep,
$this->type_payment, $this->type_payment,
$this->label, $this->label,
$sign.abs($this->amount), $sign * abs($this->amount),
$this->num_payment, $this->num_payment,
'', '',
$user $user
@ -545,11 +545,13 @@ class PaymentVarious extends CommonObject
/** /**
* Send name clicable (with possibly the picto) * Send name clicable (with possibly the picto)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option link option * @param string $option link option
* @return string Chaine with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0, $option='', $save_lastsearch_value=-1, $notooltip=0)
{ {
global $langs; global $langs;
@ -560,8 +562,8 @@ class PaymentVarious extends CommonObject
$linkend='</a>'; $linkend='</a>';
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref); if ($withpicto != 2) $result.= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '');
$result .= $linkend; $result .= $linkend;
return $result; return $result;

View File

@ -1268,7 +1268,7 @@ function dol_delete_dir($dir,$nophperrors=0)
* @param int $nophperrors Disable all PHP output errors * @param int $nophperrors Disable all PHP output errors
* @param int $onlysub Delete only files and subdir, not main directory * @param int $onlysub Delete only files and subdir, not main directory
* @param int $countdeleted Counter to count nb of elements found really deleted * @param int $countdeleted Counter to count nb of elements found really deleted
* @return int Number of files and directory we try to remove. NB really removed is returned into $countdeleted. * @return int Number of files and directory we try to remove. NB really removed is returned into var by reference $countdeleted.
*/ */
function dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0) function dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0)
{ {
@ -2161,10 +2161,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$dirins.'/'.$original_file; $original_file=$dirins.'/'.$original_file;
} }
// Wrapping for some images // Wrapping for some images
elseif (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output)) elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; $original_file=$conf->mycompany->dir_output.'/'.$original_file;
} }
// Wrapping for users photos // Wrapping for users photos
elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output))

View File

@ -451,7 +451,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
// Contact on a thirdparty that is a different thirdparty than the thirdparty of object // Contact on a thirdparty that is a different thirdparty than the thirdparty of object
if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id)
{ {
$targetcontact->fetch_thirparty(); $targetcontact->fetch_thirdparty();
$companytouseforaddress = $targetcontact->thirdparty; $companytouseforaddress = $targetcontact->thirdparty;
} }

View File

@ -662,6 +662,7 @@ function accessforbidden($message='',$printheader=1,$printfooter=1,$showonlymess
{ {
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
$langs=new Translate('',$conf); $langs=new Translate('',$conf);
$langs->setDefaultLang();
} }
$langs->load("errors"); $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)) 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)) 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; $width=128;
} }
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) 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'; $urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { 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)) { } 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; $width = 128;
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) { } elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png'; $urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';

View File

@ -150,9 +150,11 @@ function dolWebsiteOutput($content)
$nbrep=0; $nbrep=0;
if (! $symlinktomediaexists) if (! $symlinktomediaexists)
{ {
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); $content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\document.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1'.$urlwithroot.'/viewimage.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);
} }
else else
{ {

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; $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)) 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 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); $tmp=explode('?',$menu_array[$i]['url'],2);
$url = $shorturl = $tmp[0]; $url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link $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. // 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'])) 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; $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)) 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 else
{ {

View File

@ -67,7 +67,7 @@ $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize
?> ?>
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP --> <!-- 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)) { ?> <?php if (empty($conf->dol_use_jmobile)) { ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -54,7 +54,7 @@ $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize
?> ?>
<!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP --> <!-- 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)) { ?> <?php if (empty($conf->dol_use_jmobile)) { ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -37,13 +37,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','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 // For direct external download link, we don't need to load/check we are into a login session
if (isset($_GET["hashp"])) if (isset($_GET["hashp"]))
{ {

View File

@ -485,8 +485,8 @@ if (! $error && $db->connected && $action == "set")
'products' => 'product', 'products' => 'product',
'projects' => 'project', 'projects' => 'project',
'proposals' => 'proposal', 'proposals' => 'proposal',
'shipment' => 'shipment', 'shipments' => 'shipment',
'supplier_proposal' => 'supplier_proposal', 'supplier_proposals' => 'supplier_proposal',
'tasks' => 'task_summary', 'tasks' => 'task_summary',
'thirdparties' => 'thirdparty', 'thirdparties' => 'thirdparty',
'usergroups' => 'usergroups', 'usergroups' => 'usergroups',

View File

@ -18,10 +18,10 @@ HtmlHeaderPage=HTML header (specific to this page only)
PageNameAliasHelp=Name or alias of the page.<br>This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "<strong>%s</strong>" to edit this alias. PageNameAliasHelp=Name or alias of the page.<br>This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "<strong>%s</strong>" to edit this alias.
EditTheWebSiteForACommonHeader=Note: If you want to define a personalized header for all pages, edit the header on the site level instead of on the page/container. EditTheWebSiteForACommonHeader=Note: If you want to define a personalized header for all pages, edit the header on the site level instead of on the page/container.
MediaFiles=Media library MediaFiles=Media library
EditCss=Edit Style/CSS or HTML header EditCss=Edit website properties
EditMenu=Edit menu EditMenu=Edit menu
EditMedias=Edit medias EditMedias=Edit medias
EditPageMeta=Edit Meta EditPageMeta=Edit page/container properties
EditInLine=Edit inline EditInLine=Edit inline
AddWebsite=Add website AddWebsite=Add website
Webpage=Web page/container Webpage=Web page/container
@ -30,6 +30,7 @@ HomePage=Home Page
PageContainer=Page/container PageContainer=Page/container
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page. PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page.
RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this. RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this.
SiteDeleted=Web site '%s' deleted
PageContent=Page/Contenair PageContent=Page/Contenair
PageDeleted=Page/Contenair '%s' of website %s deleted PageDeleted=Page/Contenair '%s' of website %s deleted
PageAdded=Page/Contenair '%s' added PageAdded=Page/Contenair '%s' added
@ -38,8 +39,8 @@ ViewPageInNewTab=View page in new tab
SetAsHomePage=Set as Home page SetAsHomePage=Set as Home page
RealURL=Real URL RealURL=Real URL
ViewWebsiteInProduction=View web site using home URLs ViewWebsiteInProduction=View web site using home URLs
SetHereVirtualHost=If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on<br><strong>%s</strong><br>then enter here the virtual hostname you have created, so the preview can be done also using this dedicated web server access instead of only using Dolibarr server. SetHereVirtualHost=<u>Use with Apache/NGinx/...</u><br>If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on<br><strong>%s</strong><br>then enter here the virtual hostname you have created, so the preview can be done also using this dedicated web server access instead of only using Dolibarr server.
YouCanAlsoTestWithPHPS=On develop environment, you may prefer to test the site with the PHP embedded web server (PHP 5.5 required) by running<br><strong>php -S 0.0.0.0:8080 -t %s</strong> YouCanAlsoTestWithPHPS=<u>Use with PHP embedded server</u><br>On develop environment, you may prefer to test the site with the PHP embedded web server (PHP 5.5 required) by running<br><strong>php -S 0.0.0.0:8080 -t %s</strong>
CheckVirtualHostPerms=Check also that virtual host has permission <strong>%s</strong> on files into<br><strong>%s</strong> CheckVirtualHostPerms=Check also that virtual host has permission <strong>%s</strong> on files into<br><strong>%s</strong>
ReadPerm=Read ReadPerm=Read
WritePerm=Write WritePerm=Write
@ -50,7 +51,7 @@ NoPageYet=No pages yet
YouCanCreatePageOrImportTemplate=You can create a new page or import a full website template YouCanCreatePageOrImportTemplate=You can create a new page or import a full website template
SyntaxHelp=Help on specific syntax tips SyntaxHelp=Help on specific syntax tips
YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor. YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor.
YouCanEditHtmlSource=<br><span class="fa fa-bug"></span> You can include PHP code into this source using tags <strong>&lt;?php ?&gt;</strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br><span class="fa fa-bug"></span> You can also include content of another Page/Container with the following syntax:<br><strong>&lt;?php includeContainer('alias_of_container_to_include'); ?&gt;</strong><br><br><span class="fa fa-bug"></span> You can make a redirect to another Page/Container with the following syntax:<br><strong>&lt;?php redirectToContainer('alias_of_container_to_redirect_to'); ?&gt;</strong><br><br><span class="fa fa-download"></span> To include a <strong>link to download</strong> a file stored into the <strong>documents</strong> directory, use the <strong>document.php</strong> wrapper:<br>Example, for a file into documents/ecm (need to be logged), syntax is:<br><strong>&lt;a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file into documents/medias (open directory for public access), syntax is:<br><strong>&lt;a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file shared with a share link (open access using the sharing hash key of file), syntax is:<br><strong>&lt;a href="/document.php?hashp=publicsharekeyoffile"&gt;</strong><br><br><span class="fa fa-picture-o"></span> To include an <strong>image</strong> stored into the <strong>documents</strong> directory, use the <strong>viewimage.php</strong> wrapper:<br>Example, for an image into documents/medias (open access), syntax is:<br><strong>&lt;a href="/viewimage.php?modulepart=medias&amp;file=[relative_dir/]filename.ext"&gt;</strong><br> YouCanEditHtmlSource=<br><span class="fa fa-bug"></span> You can include PHP code into this source using tags <strong>&lt;?php ?&gt;</strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br><span class="fa fa-bug"></span> You can also include content of another Page/Container with the following syntax:<br><strong>&lt;?php includeContainer('alias_of_container_to_include'); ?&gt;</strong><br><br><span class="fa fa-bug"></span> You can make a redirect to another Page/Container with the following syntax (Note: do not output any content before a redirect):<br><strong>&lt;?php redirectToContainer('alias_of_container_to_redirect_to'); ?&gt;</strong><br><br><span class="fa fa-download"></span> To include a <strong>link to download</strong> a file stored into the <strong>documents</strong> directory, use the <strong>document.php</strong> wrapper:<br>Example, for a file into documents/ecm (need to be logged), syntax is:<br><strong>&lt;a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file into documents/medias (open directory for public access), syntax is:<br><strong>&lt;a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file shared with a share link (open access using the sharing hash key of file), syntax is:<br><strong>&lt;a href="/document.php?hashp=publicsharekeyoffile"&gt;</strong><br><br><span class="fa fa-picture-o"></span> To include an <strong>image</strong> stored into the <strong>documents</strong> directory, use the <strong>viewimage.php</strong> wrapper:<br>Example, for an image into documents/medias (open directory for public access), syntax is:<br><strong>&lt;img src="/viewimage.php?modulepart=medias&amp;file=[relative_dir/]filename.ext"&gt;</strong><br>
ClonePage=Clone page/container ClonePage=Clone page/container
CloneSite=Clone site CloneSite=Clone site
SiteAdded=Web site added SiteAdded=Web site added

View File

@ -120,6 +120,7 @@ class MyModuleApi extends DolibarrApi
$restictonsocid = 0; // Set to 1 if there is a field socid in table of object $restictonsocid = 0; // Set to 1 if there is a field socid in table of object
// If the internal user must only see his customers, force searching by him // If the internal user must only see his customers, force searching by him
$search_sale = 0;
if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT t.rowid"; $sql = "SELECT t.rowid";

View File

@ -79,7 +79,7 @@ function llxHeaderSurvey($title, $head="", $disablejs=0, $disablehead=0, $arrayo
// Print logo // Print logo
if ($mysoc->logo) { if ($mysoc->logo) {
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { 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=$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 //$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); $nvpstr = $nvpstr . "&LOGOIMG=" . urlencode($urllogo);
} }
if (! empty($conf->global->PAYPAL_BRANDNAME)) 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)) 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)) 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; $width=128;
} }
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) 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=''; $urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) 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)) 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; $width=96;
} }
// Output html code for logo // Output html code for logo

View File

@ -681,12 +681,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->
$urllogo=''; $urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) 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; $width=150;
} }
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) 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; $width=150;
} }
// Output html code for logo // Output html code for logo

View File

@ -219,12 +219,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->
$urllogo=''; $urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) 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; $width=150;
} }
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) 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; $width=150;
} }
// Output html code for logo // Output html code for logo

View File

@ -157,12 +157,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->
$urllogo=''; $urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) 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; $width=150;
} }
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) 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; $width=150;
} }
// Output html code for logo // Output html code for logo

View File

@ -612,7 +612,7 @@ if ($user->rights->societe->creer)
$newcardbutton.= '</a>'; $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.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';

View File

@ -826,7 +826,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<td></td>'; print '<td></td>';
print '<td align="center">'.$langs->trans('Default').'</td>'; print '<td align="center">'.$langs->trans('Default').'</td>';
print '<td>'.$langs->trans('Note').'</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; $nbremote = 0;
$nblocal = 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"); if (empty($companypaymentmodetemp->stripe_card_ref)) print $langs->trans("Local");
else print $langs->trans("LocalAndRemote"); else print $langs->trans("LocalAndRemote");
print '</td>'; print '</td>';
print '<td>';
print dol_print_date($companypaymentmodetemp->tms, 'dayhour');
print '</td>';
print '<td align="right" class="nowraponall">'; print '<td align="right" class="nowraponall">';
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
@ -1019,6 +1024,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<td>'; print '<td>';
print $langs->trans("Remote"); print $langs->trans("Remote");
print '</td>'; print '</td>';
print '<td>';
print '';
print '</td>';
print '<td align="right" class="nowraponall">'; print '<td align="right" class="nowraponall">';
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {

View File

@ -177,11 +177,11 @@ $rowspan=2;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) 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)) 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; $width=128;
} }
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) 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'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
// Some value of modulepart can be used to get resources that are public so no login are required. // 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("NOLOGIN")) define("NOLOGIN",1);
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",1); // We accept to go on this page from external web site. 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 'main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP). $original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp=GETPOST('hashp','aZ09'); $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 if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility
/* /*
* Actions * Actions
*/ */

View File

@ -484,6 +484,14 @@ class Website extends CommonObject
} }
} }
if (! $error && ! empty($this->ref))
{
global $dolibarr_main_data_root;
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$this->ref;
dol_delete_dir_recursive($pathofwebsite);
}
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
$this->db->rollback(); $this->db->rollback();

View File

@ -58,6 +58,7 @@ $type_container=GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha');
$section_dir = GETPOST('section_dir', 'alpha'); $section_dir = GETPOST('section_dir', 'alpha');
$file_manager = GETPOST('file_manager', 'alpha'); $file_manager = GETPOST('file_manager', 'alpha');
if (GETPOST('deletesite','alpha')) { $action='deletesite'; }
if (GETPOST('delete','alpha')) { $action='delete'; } if (GETPOST('delete','alpha')) { $action='delete'; }
if (GETPOST('preview','alpha')) $action='preview'; if (GETPOST('preview','alpha')) $action='preview';
if (GETPOST('createsite','alpha')) { $action='createsite'; } if (GETPOST('createsite','alpha')) { $action='createsite'; }
@ -714,6 +715,41 @@ if ($action == 'addcontainer')
} }
} }
// Delete site
if ($action == 'deletesite')
{
$error = 0;
$db->begin();
$res = $object->fetch(0, $websitekey);
$website = $object;
if ($res > 0)
{
$res = $object->delete($user);
if ($res <= 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("SiteDeleted", $object->ref, $websitekey), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
$db->rollback();
dol_print_error($db);
}
}
// Delete page // Delete page
if ($action == 'delete') if ($action == 'delete')
{ {
@ -1590,6 +1626,8 @@ if (count($object->records) > 0)
print '<input type="submit" class="button nobordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">'; print '<input type="submit" class="button nobordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
} }
print '<input type="submit" class="buttonDelete" name="deletesite" value="'.$langs->trans("Delete").'"'.($atleastonepage?' disabled="disabled"':'').'>';
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">'; print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
@ -1635,11 +1673,11 @@ if (count($object->records) > 0)
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$websitekey.'" value="'.$langs->trans("ViewSiteInNewTab").'">'; //print '<input type="submit" class="button" name="previewwebsite" target="tab'.$websitekey.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
$htmltext =$langs->trans("SetHereVirtualHost", $dataroot); $htmltext =$langs->trans("SetHereVirtualHost", $dataroot);
$htmltext.='<br>'; $htmltext.='<br>';
$htmltext.='<br>';
$htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot);
$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"), DOL_DATA_ROOT); $htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT);
$htmltext.='<br>';
$htmltext.='<br>';
$htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot);
print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helpvirtualhost'); print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helpvirtualhost');
print '</div>'; print '</div>';