diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 2eedcda8760..0e3b2c7513f 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -295,6 +295,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0; if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0; if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0; + if (preg_match('/InDolibarr$/', $value)) $qualifiedforclean=0; // admin.lang if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0; if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0773e6eedc1..3ab5d84bfdb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1982,7 +1982,8 @@ class Facture extends CommonInvoice if (! dol_delete_file($file,0,0,0,$this)) // For triggers { - $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); + $langs->load("errors"); + $this->error=$langs->trans("ErrorFailToDeleteFile",$file); $this->db->rollback(); return 0; } @@ -1991,7 +1992,8 @@ class Facture extends CommonInvoice { if (! dol_delete_dir_recursive($dir)) // For remove dir and meta { - $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir); + $langs->load("errors"); + $this->error=$langs->trans("ErrorFailToDeleteDir",$dir); $this->db->rollback(); return 0; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 9e1757fdc5a..babc7e1453a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -186,6 +186,8 @@ if (empty($reshook)) $object->country_id = GETPOST("country_id",'int'); $object->state_id = GETPOST("state_id",'int'); $object->skype = GETPOST("skype",'alpha'); + $object->twitter = GETPOST("twitter",'alpha'); + $object->facebook = GETPOST("facebook",'alpha'); $object->email = GETPOST("email",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha'); @@ -358,6 +360,8 @@ if (empty($reshook)) $object->email = GETPOST("email",'alpha'); $object->skype = GETPOST("skype",'alpha'); + $object->twitter = GETPOST("twitter",'alpha'); + $object->facebook = GETPOST("facebook",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha'); $object->phone_mobile = GETPOST("phone_mobile",'alpha'); @@ -658,13 +662,28 @@ else // Instant message and no email print ''; - print 'jabberid).'">'; + print 'jabberid).'">'; - // Skype - if (! empty($conf->skype->enabled)) + if (! empty($conf->socialnetworks->enabled)) { - print ''; - print 'skype).'">'; + // Skype + if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) + { + print ''; + print 'skype).'">'; + } + // Twitter + if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) + { + print ''; + print 'twitter).'">'; + } + // Facebook + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print 'facebook).'">'; + } } // Visibility @@ -914,11 +933,26 @@ else } print ''; - // Skype - if (! empty($conf->skype->enabled)) + if (! empty($conf->socialnetworks->enabled)) { - print ''; - print 'skype).'">'; + // Skype + if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) + { + print ''; + print 'skype).'">'; + } + // Twitter + if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) + { + print ''; + print 'twitter).'">'; + } + // Facebook + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print 'facebook).'">'; + } } // Visibility diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4dc50a3d623..b8cadaa4632 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -354,6 +354,8 @@ class Contact extends CommonObject $sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", email='".$this->db->escape($this->email)."'"; $sql .= ", skype='".$this->db->escape($this->skype)."'"; + $sql .= ", twitter='".$this->db->escape($this->twitter)."'"; + $sql .= ", facebook='".$this->db->escape($this->facebook)."'"; $sql .= ", photo='".$this->db->escape($this->photo)."'"; $sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); @@ -441,6 +443,16 @@ class Contact extends CommonObject $tmpobj->skype = $this->skype; $usermustbemodified++; } + if ($tmpobj->twitter != $this->twitter) + { + $tmpobj->twitter = $this->twitter; + $usermustbemodified++; + } + if ($tmpobj->facebook != $this->facebook) + { + $tmpobj->facebook = $this->facebook; + $usermustbemodified++; + } if ($usermustbemodified) { $result=$tmpobj->update($user, 0, 1, 1, 1); @@ -690,7 +702,7 @@ class Contact extends CommonObject $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; - $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,"; + $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook,"; $sql.= " c.photo,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.import_key,"; @@ -756,6 +768,8 @@ class Contact extends CommonObject $this->email = $obj->email; $this->jabberid = $obj->jabberid; $this->skype = $obj->skype; + $this->twitter = $obj->twitter; + $this->facebook = $obj->facebook; $this->photo = $obj->photo; $this->priv = $obj->priv; $this->mail = $obj->email; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 475fbf2b1f0..9e85bac1fec 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2899,6 +2899,7 @@ abstract class CommonObject // Special case if ($origin == 'order') $origin='commande'; if ($origin == 'invoice') $origin='facture'; + if ($origin == 'invoice_template') $origin='facturerec'; $this->db->begin(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2c7b5e2fabb..149f1681725 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6370,6 +6370,7 @@ class Form 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'), + 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'), 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), @@ -6432,8 +6433,7 @@ class Form { $objp = $this->db->fetch_object($resqllist); - $var = ! $var; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f9fc04d47de..4a59e28f044 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -185,7 +185,7 @@ class FormFile if ($linkfiles) { - $out .= "\n\n"; + $out .= "\n\n"; $langs->load('link'); $title = $langs->trans("LinkANewFile"); $out .= load_fiche_titre($title, null, null); @@ -213,19 +213,18 @@ class FormFile $out .= ''; $out .= '
'; $out .= '
'; - $parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm); - $res = $hookmanager->executeHooks('formattachOptions',$parameters,$object); - $out .= "\n\n"; + $out .= "\n\n"; } + $parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm); + $res = $hookmanager->executeHooks('formattachOptions',$parameters,$object); if (empty($res)) { print '
'; print $out; print '
'; } - print $hookmanager->resPrint; return 1; diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index b7ae66da36c..8715d979c4d 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -341,7 +341,7 @@ class Utils { // Renommer fichier sortie en fichier erreur //print "$outputfile -> $outputerror"; - @dol_delete_file($outputerror,1); + @dol_delete_file($outputerror, 1, 0, 0, null, false, 0); @rename($outputfile,$outputerror); // Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide if (! $errormsg) @@ -448,7 +448,7 @@ class Utils { $i++; if ($i <= $keeplastnfiles) continue; - dol_delete_file($val['fullname']); + dol_delete_file($val['fullname'], 0, 0, 0, null, false, 0); } } @@ -675,8 +675,9 @@ class Utils } /** - * This saves syslog files and compresses older ones - * Used from cronjob + * This saves syslog files and compresses older ones. + * Nb of archive to keep is defined into $conf->global->SYSLOG_FILE_SAVES + * CAN BE A CRON TASK * * @return int 0 if OK, < 0 if KO */ @@ -714,50 +715,52 @@ class Utils $logname = $file['name']; $logpath = $file['path']; - // Handle already compressed files to rename them and add +1 + if (dol_is_file($logpath.'/'.$logname) && dol_filesize($logpath.'/'.$logname) > 0) // If log file exists and is not empty + { + // Handle already compressed files to rename them and add +1 - $filter = '^'.preg_quote($logname, '/').'\.([0-9]+)\.gz$'; + $filter = '^'.preg_quote($logname, '/').'\.([0-9]+)\.gz$'; - $gzfilestmp = dol_dir_list($logpath, 'files', 0, $filter); - $gzfiles = array(); + $gzfilestmp = dol_dir_list($logpath, 'files', 0, $filter); + $gzfiles = array(); - foreach($gzfilestmp as $gzfile) { - $tabmatches = array(); - preg_match('/'.$filter.'/i', $gzfile['name'], $tabmatches); + foreach($gzfilestmp as $gzfile) { + $tabmatches = array(); + preg_match('/'.$filter.'/i', $gzfile['name'], $tabmatches); - $numsave = intval($tabmatches[1]); + $numsave = intval($tabmatches[1]); - $gzfiles[$numsave] = $gzfile; - } - - krsort($gzfiles, SORT_NUMERIC); - - foreach($gzfiles as $numsave => $dummy) { - if (dol_is_file($logpath.'/'.$logname.'.'.($numsave+1).'.gz')) { - return -2; + $gzfiles[$numsave] = $gzfile; } - if($numsave >= $nbSaves) { - dol_delete_file($logpath.'/'.$logname.'.'.$numsave.'.gz'); - } else { - dol_move($logpath.'/'.$logname.'.'.$numsave.'.gz', $logpath.'/'.$logname.'.'.($numsave+1).'.gz', 0, 1, 0, 0); - } - } + krsort($gzfiles, SORT_NUMERIC); - // Compress last save - if (dol_is_file($logpath.'/'.$logname.'.1')) { - if($nbSaves > 1) { - $gzfilehandle = gzopen($logpath.'/'.$logname.'.2.gz', 'wb9'); + foreach($gzfiles as $numsave => $dummy) { + if (dol_is_file($logpath.'/'.$logname.'.'.($numsave+1).'.gz')) { + return -2; + } + + if($numsave >= $nbSaves) { + dol_delete_file($logpath.'/'.$logname.'.'.$numsave.'.gz', 0, 0, 0, null, false, 0); + } else { + dol_move($logpath.'/'.$logname.'.'.$numsave.'.gz', $logpath.'/'.$logname.'.'.($numsave+1).'.gz', 0, 1, 0, 0); + } + } + + // Compress current file and recreate it + + if ($nbSaves > 0) { // If $nbSaves is 1, we keep 1 archive .gz file, If 2, we keep 2 .gz files + $gzfilehandle = gzopen($logpath.'/'.$logname.'.1.gz', 'wb9'); if (empty($gzfilehandle)) { - $this->error = 'Failted to open file '.$logpath.'/'.$logname.'.2.gz'; + $this->error = 'Failted to open file '.$logpath.'/'.$logname.'.1.gz'; return -3; } - $sourcehandle = fopen($logpath.'/'.$logname.'.1', 'r'); + $sourcehandle = fopen($logpath.'/'.$logname, 'r'); if (empty($sourcehandle)) { - $this->error = 'Failed to open file '.$logpath.'/'.$logname.'.1'; + $this->error = 'Failed to open file '.$logpath.'/'.$logname; return -4; } @@ -767,19 +770,18 @@ class Utils fclose($sourcehandle); gzclose($gzfilehandle); - } else { - dol_delete_file($logpath.'/'.$logname.'.1'); - } - } - // Compress current file et recreate it - - if (dol_is_file($logpath.'/'.$logname)) { - if (dol_move($logpath.'/'.$logname, $logpath.'/'.$logname.'.1', 0, 1, 0, 0)) - { - $newlog = fopen($logpath.'/'.$logname, 'a+'); - fclose($newlog); + @chmod($logpath.'/'.$logname.'.1.gz', octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK)); } + + dol_delete_file($logpath.'/'.$logname, 0, 0, 0, null, false, 0); + + // Create empty file + $newlog = fopen($logpath.'/'.$logname, 'a+'); + fclose($newlog); + + //var_dump($logpath.'/'.$logname." - ".octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK)); + @chmod($logpath.'/'.$logname, octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK)); } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4df32ca4a35..5aff804b4da 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1133,10 +1133,11 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param int $nohook Disable all hooks * @param object $object Current object in use * @param boolean $allowdotdot Allow to delete file path with .. inside. Never use this, it is reserved for migration purpose. + * @param int $indexdatabase Try to remove also index entries. * @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error * @see dol_delete_dir */ -function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null,$allowdotdot=false) +function dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1) { global $db, $conf, $user, $langs; global $hookmanager; @@ -1200,7 +1201,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n { $rel_filetodelete = preg_replace('/^[\\/]/', '', $rel_filetodelete); - if (is_object($db)) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1) + if (is_object($db) && $indexdatabase) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1) { dol_syslog("Try to remove also entries in database for full relative path = ".$rel_filetodelete, LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dd42c2666e0..8b7e4b70c63 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6159,12 +6159,13 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray=array_merge($substitutionarray, array( '__DAY__' => (string) $tmp['mday'], - '__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), - '__DAY_TEXT_SHORT__' => $outputlangs->trans('Short'.$tmp['weekday']), - '__DAY_TEXT_MIN__' => $outputlangs->trans($tmp['weekday'].'Min'), + '__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday + '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon + '__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M '__MONTH__' => (string) $tmp['mon'], - '__MONTH_TEXT__' => $outputlangs->trans($tmp['month']), - '__MONTH_TEXT_MIN__' => $outputlangs->trans($tmp['month'].'Min'), + '__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])), + '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])), + '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])), '__YEAR__' => (string) $tmp['year'], '__PREVIOUS_DAY__' => (string) $tmp2['day'], '__PREVIOUS_MONTH__' => (string) $tmp3['month'], diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 452a9da08c7..4cbbdebbf14 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -52,6 +52,11 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0) if ($removephppart) $replacewith=''; $content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); + $replacewith='href="php'; + if ($removephppart) $replacewith=''; + $content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); + + //$replacewith='...php...'; $replacewith='...php...'; if ($removephppart) $replacewith=''; $content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content); @@ -89,23 +94,28 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0) * * @param string $content Content string * @return void - * @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice editor context + * @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice context when USEDOLIBARREDITOR is not on */ function dolWebsiteOutput($content) { global $db, $langs, $conf, $user; global $dolibarr_main_url_root, $dolibarr_main_data_root; - dol_syslog("dolWebsiteOutput start (mode=".(defined('USEDOLIBARRSERVER')?'USEDOLIBARRSERVER':'').')'); + dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." (USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')'); // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $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 - // Note: This seems never called when page is output inside the website editor (search 'REPLACEMENT OF LINKS When page called by website editor') - - if (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server + if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor + { + // We remove the part of content + $content = preg_replace('/.*<\/head>/ims', '', $content); + $content = preg_replace('/^.*]*)*>/ims', '', $content); + $content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $content); + } + elseif (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server { global $website; @@ -139,7 +149,7 @@ function dolWebsiteOutput($content) // action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage $content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep); } - else // REPLACEMENT OF LINKS When page called from virtual host + else // REPLACEMENT OF LINKS When page called from virtual host { $symlinktomediaexists=1; @@ -536,7 +546,7 @@ function dolSaveMasterFile($filemaster) $mastercontent = ''."\n"; $result = file_put_contents($filemaster, $mastercontent); if (! empty($conf->global->MAIN_UMASK)) @@ -598,7 +608,7 @@ function dolSavePageContent($filetpl, $object, $objectpage) $tplcontent =''; $tplcontent.= "mycompany->dir_output."/".$original_file));'."\n"; $wrappercontent.= "else print 'Bad value for modulepart or file';\n"; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 9cbd5f31959..e0c82446962 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -116,9 +116,9 @@ class pdf_einstein extends ModelePDFCommandes /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 8086667a4f5..678c5d5da7e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -105,9 +105,9 @@ class pdf_rouget extends ModelePdfExpedition /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index ec06221e5de..28f36a406e0 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -107,9 +107,9 @@ class pdf_standard extends ModeleExpenseReport /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 93f4dbe88ca..a823bae2d4b 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -40,9 +40,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures { /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** * @var array() Minimum version of PHP required by module. diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 7d39969ece9..c99da970a6b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -117,9 +117,9 @@ class pdf_crabe extends ModelePDFFactures /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** * @var bool Situation invoice type diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index c51e0452481..7dc4f0594ab 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -107,9 +107,9 @@ class pdf_soleil extends ModelePDFFicheinter /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** * Constructor diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index ae0dcb6a74f..3227c75b3af 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -108,9 +108,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** * Constructor diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index dd1a26c1d4f..d7d6c154881 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -107,9 +107,9 @@ class pdf_baleine extends ModelePDFProjects /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** * Constructor diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index d76ae3b586a..941ebb4db3e 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -56,9 +56,9 @@ class doc_generic_task_odt extends ModelePDFTask { /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** * @var array() Minimum version of PHP required by module. diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 6b5bf3fe3a2..e27fc868155 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -39,9 +39,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales { /** * Issuer - * @var Societe + * @var Company object that emits */ - public $emetteur; // Objet societe qui emet + public $emetteur; /** * @var array() Minimum version of PHP required by module. diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 54009821fff..40b73e4bf7f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -115,7 +115,7 @@ class pdf_azur extends ModelePDFPropales /** * Issuer - * @var Objet societe qui emet + * @var Company object that emits */ public $emetteur; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 243a692eed8..e7d47f67bda 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -106,7 +106,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Issuer - * @var Objet societe qui emet + * @var Company object that emits */ public $emetteur; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 1be46ee2eca..8478fd70e89 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -110,7 +110,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** * Issuer - * @var Objet societe qui emet + * @var Company object that emits */ public $emetteur; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index baf2a66c399..8ca6b6f215a 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -38,15 +38,18 @@ if (empty($module)) $module='ecm'; $permtoadd = 0; $permtoupload = 0; +$showroot = 0; if ($module == 'ecm') { $permtoadd = $user->rights->ecm->setup; $permtoupload = $user->rights->ecm->upload; + $showroot = 0; } if ($module == 'medias') { $permtoadd = ($user->rights->mailing->creer || $user->rights->website->write); $permtoupload = ($user->rights->mailing->creer || $user->rights->website->write); + $showroot = 1; } @@ -69,29 +72,25 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us print '
'; // Toolbar -//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) { -//if ($module == 'ecm') { - - if ($permtoadd) - { - print ''; - print ''; - print ''; - } - else - { - print ''; - print ''; - print ''; - } - if ($module == 'ecm') - { - $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); - print ''; - print ''; - print ''; - } -//} +if ($permtoadd) +{ + print ''; + print ''; + print ''; +} +else +{ + print ''; + print ''; + print ''; +} +if ($module == 'ecm') +{ + $tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); + print ''; + print ''; + print ''; +} // Start "Add new file" area $nameforformuserfile = 'formuserfileecm'; @@ -148,7 +147,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg print ''."\n"; print ''."\n"; - print ''; + print ''; print ' '.$langs->trans("ECMSections"); print ''; @@ -159,9 +158,17 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { - print ''; + // Show the link to "Root" + if ($showroot) + { + print '
'.$langs->trans("Root").'
'; + } - // Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php) + + + print ''; + + // Show filemanager tree (will be filled by call of ajax /ecm/tpl/enablefiletreeajax.tpl.php that execute ajaxdirtree.php) print '
'; if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); @@ -170,7 +177,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg } else { - print ''; + print ''; $_POST['modulepart'] = $module; $_POST['openeddir'] = GETPOST('openeddir'); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 5cfb09946e5..f3367d3e90f 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -213,7 +213,9 @@ if ($forgetpasslink || $helpcenterlink) echo '
'; echo '
'; if ($forgetpasslink) { - echo ''; + $url=DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam; + if (! empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) $url=$conf->global->MAIN_PASSWORD_FORGOTLINK; + echo ''; echo $langs->trans('PasswordForgotten'); echo ''; } diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 46b1f955177..3ed3a92cb50 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2018 Laurent Destailleur * * 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 @@ -19,10 +19,11 @@ /** * \file htdocs/core/website.inc.php * \brief Common file loaded used by all website pages (after master.inc.php) - * The global variable $website must be defined. + * The global variable $websitekey must be defined. */ - include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; $website=new Website($db); $website->fetch(0,$websitekey); + +include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 0a51e8cc73d..b7c20e33d2d 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -27,7 +27,7 @@ if (empty($conf) || ! is_object($conf)) ?> - + "; - print $out; /*file_put_contents($filetpl, $out);