forked from Wavyzz/dolibarr
Fix: Files related to running company must not be saved into same directory dedicated to module third party.
This commit is contained in:
@@ -62,12 +62,12 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||
$isimage=image_format_supported($original_file);
|
||||
if ($isimage >= 0)
|
||||
{
|
||||
dol_syslog("Move file ".$_FILES["logo"]["tmp_name"]." to ".$conf->societe->dir_output.'/logos/'.$original_file);
|
||||
if (! is_dir($conf->societe->dir_output.'/logos/')) // TODO ne fonctionne qu'avec le module Tiers d'activ<69>
|
||||
dol_syslog("Move file ".$_FILES["logo"]["tmp_name"]." to ".$conf->mycompany->dir_output.'/logos/'.$original_file);
|
||||
if (! is_dir($conf->mycompany->dir_output.'/logos/'))
|
||||
{
|
||||
create_exdir($conf->societe->dir_output.'/logos/');
|
||||
create_exdir($conf->mycompany->dir_output.'/logos/');
|
||||
}
|
||||
if (dol_move_uploaded_file($_FILES["logo"]["tmp_name"],$conf->societe->dir_output.'/logos/'.$original_file,1) > 0)
|
||||
if (dol_move_uploaded_file($_FILES["logo"]["tmp_name"],$conf->mycompany->dir_output.'/logos/'.$original_file,1) > 0)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity);
|
||||
|
||||
@@ -76,7 +76,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||
{
|
||||
$quality = 80;
|
||||
|
||||
$imgThumbSmall = vignette($conf->societe->dir_output.'/logos/'.$original_file, 200, 100, '_small', $quality);
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 200, 100, '_small', $quality);
|
||||
if (eregi('([^\\\/:]+)$',$imgThumbSmall,$reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1];
|
||||
@@ -85,7 +85,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||
else dol_syslog($imgThumbSmall);
|
||||
|
||||
// Cr<43>ation de la vignette de la page "Soci<63>t<EFBFBD>/Institution"
|
||||
$imgThumbMini = vignette($conf->societe->dir_output.'/logos/'.$original_file, 100, 30, '_mini', $quality);
|
||||
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 100, 30, '_mini', $quality);
|
||||
if (eregi('([^\\\/:]+)$',$imgThumbMini,$reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1];
|
||||
@@ -136,7 +136,7 @@ if ($_GET["action"] == 'addthumb')
|
||||
if ($isimage > 0)
|
||||
{
|
||||
// Cr<43>ation de la vignette de la page login
|
||||
$imgThumbSmall = vignette($conf->societe->dir_output.'/logos/'.$_GET["file"], 200, 100, '_small',80);
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 200, 100, '_small',80);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbSmall,$reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1];
|
||||
@@ -145,7 +145,7 @@ if ($_GET["action"] == 'addthumb')
|
||||
else dol_syslog($imgThumbSmall);
|
||||
|
||||
// Cr<43>ation de la vignette de la page "Soci<63>t<EFBFBD>/Institution"
|
||||
$imgThumbMini = vignette($conf->societe->dir_output.'/logos/'.$_GET["file"], 100, 30, '_mini',80);
|
||||
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 100, 30, '_mini',80);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbMini,$reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1];
|
||||
@@ -171,17 +171,17 @@ if ($_GET["action"] == 'addthumb')
|
||||
|
||||
if ($_GET["action"] == 'removelogo')
|
||||
{
|
||||
$logofile=$conf->societe->dir_output.'/logos/'.$mysoc->logo;
|
||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
||||
dol_delete_file($logofile);
|
||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity);
|
||||
$mysoc->logo='';
|
||||
|
||||
$logosmallfile=$conf->societe->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
|
||||
$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
|
||||
dol_delete_file($logosmallfile);
|
||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
|
||||
$mysoc->logo_small='';
|
||||
|
||||
$logominifile=$conf->societe->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
|
||||
$logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
|
||||
dol_delete_file($logominifile);
|
||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
|
||||
$mysoc->logo_mini='';
|
||||
@@ -282,7 +282,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
if ($mysoc->logo_mini)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->societe->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
|
||||
{
|
||||
print ' ';
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
|
||||
@@ -550,11 +550,11 @@ else
|
||||
print '</td><td valign="center" align="right">';
|
||||
|
||||
// On propose la g<>n<EFBFBD>ration de la vignette si elle n'existe pas
|
||||
if (!is_file($conf->societe->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && eregi('(\.jpg|\.jpeg|\.png)$',$mysoc->logo))
|
||||
if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && eregi('(\.jpg|\.jpeg|\.png)$',$mysoc->logo))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=addthumb&file='.urlencode($mysoc->logo).'">'.img_refresh($langs->trans('GenerateThumb')).' </a>';
|
||||
}
|
||||
else if ($mysoc->logo_mini && is_file($conf->societe->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 src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
}
|
||||
|
||||
.logo {
|
||||
background: url('<?php echo $conf_url_racine; ?>/documents/societe/logos/logo.jpg') no-repeat top left;
|
||||
background: url('<?php echo DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_mini); ?>') no-repeat top left;
|
||||
height: 128px;
|
||||
width: 650px;
|
||||
}
|
||||
|
||||
@@ -194,13 +194,21 @@ class Conf
|
||||
//print 'this->'.$module.'->dir_temp='.$this->$module->dir_temp.'<br>';
|
||||
}
|
||||
|
||||
// Exception: Some dir are not the name of module. So we keep exception here
|
||||
// for backward compatibility.
|
||||
// For mycompany setup
|
||||
$this->mycompany->dir_output=$rootfordata."/mycompany";
|
||||
$this->mycompany->dir_temp=$rootfordata."/mycompany/temp";
|
||||
|
||||
// For admin features
|
||||
$this->admin->dir_output=$rootfordata.'/admin';
|
||||
$this->admin->dir_temp=$rootfordata.'/admin/temp';
|
||||
|
||||
// Module user
|
||||
$this->user->dir_output=$rootforuser."/users";
|
||||
$this->user->dir_temp=$rootforuser."/users/temp";
|
||||
|
||||
// Exception: Some dir are not the name of module. So we keep exception here
|
||||
// for backward compatibility.
|
||||
|
||||
// Module RSS
|
||||
$this->externalrss->dir_output=$rootfordata."/rss";
|
||||
$this->externalrss->dir_temp=$rootfordata."/rss/temp";
|
||||
@@ -214,9 +222,6 @@ class Conf
|
||||
$this->livraison_bon->dir_output=$rootfordata."/expedition/receipt";
|
||||
$this->livraison_bon->dir_temp =$rootfordata."/expedition/receipt/temp";
|
||||
|
||||
// Module societe
|
||||
if (defined('SOCIETE_OUTPUTDIR') && SOCIETE_OUTPUTDIR) { $this->societe->dir_output=SOCIETE_OUTPUTDIR; } # Pour passer outre le rep par defaut
|
||||
|
||||
// Module don
|
||||
$this->don->dir_output=$rootfordata."/dons";
|
||||
$this->don->dir_temp =$rootfordata."/dons/temp";
|
||||
@@ -261,9 +266,6 @@ class Conf
|
||||
// Module oscommerce 1
|
||||
$this->boutique->livre->enabled=defined("BOUTIQUE_LIVRE")?BOUTIQUE_LIVRE:0;
|
||||
$this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0;
|
||||
// Other
|
||||
$this->admin->dir_output=$rootfordata.'/admin';
|
||||
$this->admin->dir_temp=$rootfordata.'/admin/temp';
|
||||
|
||||
/*
|
||||
* Modification de quelques variable de conf en fonction des Constantes
|
||||
|
||||
@@ -101,7 +101,7 @@ class MenuLeft {
|
||||
if (! empty($conf->global->MAIN_SHOW_LOGO))
|
||||
{
|
||||
$mysoc->logo_small=$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL;
|
||||
if (! empty($mysoc->logo_small) && is_readable($conf->societe->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=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small);
|
||||
print '<img title="'.$title.'" src="'.$urllogo.'">';
|
||||
|
||||
@@ -99,7 +99,7 @@ class MenuLeft {
|
||||
if (! empty($conf->global->MAIN_SHOW_LOGO))
|
||||
{
|
||||
$mysoc->logo_small=$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL;
|
||||
if (! empty($mysoc->logo_small) && is_readable($conf->societe->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=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small);
|
||||
print '<img title="'.$title.'" src="'.$urllogo.'">';
|
||||
|
||||
@@ -377,7 +377,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -733,7 +733,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -351,7 +351,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
|
||||
//*********************LOGO****************************
|
||||
$pdf->SetXY(11,7);
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -107,7 +107,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -913,7 +913,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -812,7 +812,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$pdf->SetXY($this->marges['g'],6);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -174,7 +174,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$mysoc->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
||||
if ($mysoc->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -455,7 +455,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$mysoc->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
||||
if ($mysoc->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -68,7 +68,7 @@ class modSociete extends DolibarrModules
|
||||
$this->picto='company';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array("/societe/temp","/societe/logos");
|
||||
$this->dirs = array("/societe/temp");
|
||||
|
||||
// Dependances
|
||||
$this->depends = array();
|
||||
|
||||
@@ -786,7 +786,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -594,7 +594,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_output.'/logos/'.$mysoc->logo;
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
||||
if ($mysoc->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
|
||||
@@ -40,7 +40,7 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
|
||||
// Add a background image on document
|
||||
if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF))
|
||||
{
|
||||
$pdf->Image($conf->societe->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, 0, 0, 0, $page_height);
|
||||
$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, 0, 0, 0, $page_height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,11 +160,11 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
$title='';
|
||||
$width=0;
|
||||
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
|
||||
if (! empty($mysoc->logo_small) && is_readable($conf->societe->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=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small);
|
||||
}
|
||||
elseif (! empty($mysoc->logo_small) && is_readable($conf->societe->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?modulepart=companylogo&file='.urlencode($mysoc->logo);
|
||||
$width=96;
|
||||
|
||||
@@ -157,11 +157,11 @@ if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo;
|
||||
else if (! empty($conf->global->PAYBOX_LOGO)) $logosmall=$conf->global->PAYBOX_LOGO;
|
||||
// Define urllogo
|
||||
$urllogo='';
|
||||
if (! empty($logosmall) && is_readable($conf->societe->dir_output.'/logos/thumbs/'.$logosmall))
|
||||
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('thumbs/'.$logosmall);
|
||||
}
|
||||
elseif (! empty($logo) && is_readable($conf->societe->dir_output.'/logos/'.$logo))
|
||||
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode($logo);
|
||||
$width=96;
|
||||
|
||||
@@ -231,11 +231,11 @@ $title='';
|
||||
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
|
||||
$width=0;
|
||||
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
|
||||
if (isset($mysoc->logo_small) && is_readable($conf->societe->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
||||
if (isset($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small);
|
||||
}
|
||||
elseif (isset($mysoc->logo) && is_readable($conf->societe->dir_output.'/logos/'.$mysoc->logo))
|
||||
elseif (isset($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode($mysoc->logo);
|
||||
$width=96;
|
||||
|
||||
@@ -74,7 +74,7 @@ if ($modulepart)
|
||||
if ($modulepart == 'companylogo')
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->societe->dir_output.'/logos/'.$original_file;
|
||||
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les photos utilisateurs
|
||||
|
||||
Reference in New Issue
Block a user