Merge branch 'develop' into patch-9

This commit is contained in:
Laurent Destailleur 2018-09-27 09:18:42 +02:00 committed by GitHub
commit 7e58662c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 473 additions and 256 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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 '<tr><td><label for="jabberid">'.$langs->trans("IM").'</label></td>';
print '<td colspan="3"><input name="jabberid" id="jabberid" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("jabberid",'alpha')?GETPOST("jabberid",'alpha'):$object->jabberid).'"></td></tr>';
print '<td colspan="3"><input name="jabberid" id="jabberid" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid",'alpha'):$object->jabberid).'"></td></tr>';
// Skype
if (! empty($conf->skype->enabled))
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td><label for="skype">'.$langs->trans("Skype").'</label></td>';
print '<td colspan="3"><input name="skype" id="skype" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("skype",'alpha')?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
// Skype
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td><label for="skype">'.fieldLabel('Skype','skype').'</label></td>';
print '<td colspan="3"><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td><label for="twitter">'.fieldLabel('Twitter','twitter').'</label></td>';
print '<td colspan="3"><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td><label for="facebook">'.fieldLabel('Facebook','facebook').'</label></td>';
print '<td colspan="3"><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
}
// Visibility
@ -914,11 +933,26 @@ else
}
print '</tr>';
// Skype
if (! empty($conf->skype->enabled))
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td><label for="skype">'.$langs->trans("Skype").'</label></td>';
print '<td><input name="skype" id="skype" type="text" class="minwidth100" maxlength="80" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>';
// Skype
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td><label for="skype">'.fieldLabel('Skype','skype').'</label></td>';
print '<td><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td><label for="twitter">'.fieldLabel('Twitter','twitter').'</label></td>';
print '<td><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td><label for="facebook">'.fieldLabel('Facebook','facebook').'</label></td>';
print '<td><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
}
// Visibility

View File

@ -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;

View File

@ -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();

View File

@ -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 '<tr ' . $bc [$var] . '>';
print '<tr class="oddeven">';
print '<td aling="left">';
print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>';
print '</td>';

View File

@ -185,7 +185,7 @@ class FormFile
if ($linkfiles)
{
$out .= "\n<!-- Start form attach new link -->\n";
$out .= "\n<!-- Start form link new url -->\n";
$langs->load('link');
$title = $langs->trans("LinkANewFile");
$out .= load_fiche_titre($title, null, null);
@ -213,19 +213,18 @@ class FormFile
$out .= '</div>';
$out .= '<div class="clearboth"></div>';
$out .= '</form><br>';
$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<!-- End form attach new file -->\n";
$out .= "\n<!-- End form link new url -->\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 '<div class="attacharea attacharea'.$htmlname.'">';
print $out;
print '</div>';
}
print $hookmanager->resPrint;
return 1;

View File

@ -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));
}
}

View File

@ -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';

View File

@ -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'],

View File

@ -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='<span class="phptag">...php...</span>';
$replacewith='<span class="phptag">...php...</span>';
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 <head> part of content
$content = preg_replace('/<head>.*<\/head>/ims', '', $content);
$content = preg_replace('/^.*<body(\s[^>]*)*>/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 = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$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.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent.= "ob_start();\n";
@ -663,7 +673,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
$indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
@ -679,7 +689,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
$wrappercontent = '<?php'."\n";
$wrappercontent.= "// BEGIN PHP File generated to provide a wrapper.php - DO NOT MODIFY - It is just a generated wrapper.\n";
$wrappercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$wrappercontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$wrappercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$wrappercontent.= '$original_file=str_replace("../","/", GETPOST("file","alpha"));'."\n";
$wrappercontent.= 'if ($_GET["modulepart"] == "mycompany" && preg_match(\'/^\/?logos\//\', $original_file)) readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file));'."\n";
$wrappercontent.= "else print 'Bad value for modulepart or file';\n";

View File

@ -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;
/**

View File

@ -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;
/**

View File

@ -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;
/**

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -115,7 +115,7 @@ class pdf_azur extends ModelePDFPropales
/**
* Issuer
* @var Objet societe qui emet
* @var Company object that emits
*/
public $emetteur;

View File

@ -106,7 +106,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Issuer
* @var Objet societe qui emet
* @var Company object that emits
*/
public $emetteur;

View File

@ -110,7 +110,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/**
* Issuer
* @var Objet societe qui emet
* @var Company object that emits
*/
public $emetteur;

View File

@ -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 '<div class="inline-block toolbarbutton centpercent">';
// Toolbar
//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) {
//if ($module == 'ecm') {
if ($permtoadd)
{
print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).($websitekey?'&website='.$websitekey:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
else
{
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
if ($module == 'ecm')
{
$tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'')));
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print '</a>';
}
//}
if ($permtoadd)
{
print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).($websitekey?'&website='.$websitekey:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
else
{
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
if ($module == 'ecm')
{
$tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'')));
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print '</a>';
}
// Start "Add new file" area
$nameforformuserfile = 'formuserfileecm';
@ -148,7 +147,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
print '<!-- Title for manual directories -->'."\n";
print '<tr class="liste_titre">'."\n";
print '<th class="liste_titre" align="left" colspan="6">';
print '<th class="liste_titre" align="left">';
print '&nbsp;'.$langs->trans("ECMSections");
print '</th></tr>';
@ -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 '<tr><td colspan="6">';
// Show the link to "Root"
if ($showroot)
{
print '<tr><td><div style="padding-left: 5px; padding-right: 5px;"><a href="'.$_SERVER["PHP_SELF"].'?file_manager=1&pageid='.$pageid.'">'.$langs->trans("Root").'</a></div></td></tr>';
}
// Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php)
print '<tr><td>';
// Show filemanager tree (will be filled by call of ajax /ecm/tpl/enablefiletreeajax.tpl.php that execute ajaxdirtree.php)
print '<div id="filetree" class="ecmfiletree"></div>';
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 '<tr><td colspan="6" style="padding-left: 20px">';
print '<tr><td style="padding-left: 20px">';
$_POST['modulepart'] = $module;
$_POST['openeddir'] = GETPOST('openeddir');

View File

@ -213,7 +213,9 @@ if ($forgetpasslink || $helpcenterlink)
echo '<br>';
echo '<div class="center" style="margin-top: 15px;">';
if ($forgetpasslink) {
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">';
$url=DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam;
if (! empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) $url=$conf->global->MAIN_PASSWORD_FORGOTLINK;
echo '<a class="alogin" href="'.dol_escape_htmltag($url).'">';
echo $langs->trans('PasswordForgotten');
echo '</a>';
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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';

View File

@ -27,7 +27,7 @@ if (empty($conf) || ! is_object($conf))
?>
<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<!-- Doc of fileTree plugin at https://www.abeautifulsite.net/jquery-file-tree: http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<script type="text/javascript">

View File

@ -967,7 +967,8 @@ class Fichinter extends CommonObject
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);
return 0;
}
}
@ -975,7 +976,8 @@ class Fichinter extends CommonObject
{
if (! dol_delete_dir_recursive($dir))
{
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
$langs->load("errors");
$this->error=$langs->trans("ErrorFailToDeleteDir",$dir);
return 0;
}
}

View File

@ -74,3 +74,7 @@ ALTER TABLE llx_societe ADD COLUMN twitter varchar(255) after skype;
ALTER TABLE llx_societe ADD COLUMN facebook varchar(255) after skype;
ALTER TABLE llx_socpeople ADD COLUMN twitter varchar(255) after skype;
ALTER TABLE llx_socpeople ADD COLUMN facebook varchar(255) after skype;
ALTER TABLE llx_website CHANGE COLUMN fk_user_create fk_user_creat integer;
ALTER TABLE llx_website_page CHANGE COLUMN fk_user_create fk_user_creat integer;

View File

@ -27,9 +27,9 @@ CREATE TABLE llx_website
status integer DEFAULT 1,
fk_default_home integer,
virtualhost varchar(255),
fk_user_create integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
fk_user_creat integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@ -32,10 +32,10 @@ CREATE TABLE llx_website_page
htmlheader text,
content mediumtext, -- text is not enough in size
status integer DEFAULT 1,
grabbed_from varchar(255),
fk_user_create integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
grabbed_from varchar(255),
fk_user_creat integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@ -546,3 +546,4 @@ AutoFillDateFromShort=Set start date
AutoFillDateTo=Set end date for service line with next invoice date
AutoFillDateToShort=Set end date
MaxNumberOfGenerationReached=Max number of gen. reached
BILL_DELETEInDolibarr=Invoice deleted

View File

@ -531,18 +531,6 @@ September=September
October=October
November=November
December=December
JanuaryMin=Jan
FebruaryMin=Feb
MarchMin=Mar
AprilMin=Apr
MayMin=May
JuneMin=Jun
JulyMin=Jul
AugustMin=Aug
SeptemberMin=Sep
OctoberMin=Oct
NovemberMin=Nov
DecemberMin=Dec
Month01=January
Month02=February
Month03=March

View File

@ -28,7 +28,7 @@ Webpage=Web page/container
AddPage=Add page/container
HomePage=Home Page
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 '<strong>Import a full website template</strong>' or just '<strong>Add a page/container</strong>'.
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
@ -51,7 +51,7 @@ NoPageYet=No pages yet
YouCanCreatePageOrImportTemplate=You can create a new page or import a full website template
SyntaxHelp=Help on specific syntax tips
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 (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>
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-link"></span> To add a link to another page, use the syntax:<br><strong>&lt;a href="alias_of_page_to_link_to.php"&gt;mylink&lt;a&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
CloneSite=Clone site
SiteAdded=Web site added
@ -63,8 +63,8 @@ WebsiteId=Website ID
CreateByFetchingExternalPage=Create page/container by fetching page from external URL...
OrEnterPageInfoManually=Or create page from scratch or from a page template...
FetchAndCreate=Fetch and Create
ExportSite=Export site
ImportSite=Import site
ExportSite=Export website
ImportSite=Import website template
IDOfPage=Id of page
Banner=Banner
BlogPost=Blog post

View File

@ -1244,7 +1244,7 @@ else
print '</td></tr>';
}
// Email web
// Email / Web
print '<tr><td>'.fieldLabel('EMail','email',$conf->global->SOCIETE_EMAIL_MANDATORY).'</td>';
print '<td colspan="3"><input type="text" name="email" id="email" value="'.$object->email.'"></td></tr>';
print '<tr><td>'.fieldLabel('Web','url').'</td>';
@ -1256,19 +1256,19 @@ else
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td>'.fieldLabel('Skype','skype').'</td>';
print '<td colspan="3"><input type="text" name="skype" id="skype" value="'.$object->skype.'"></td></tr>';
print '<td colspan="3"><input type="text" name="skype" class="minwidth100" maxlength="80" id="skype" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td>'.fieldLabel('Twitter','twitter').'</td>';
print '<td colspan="3"><input type="text" name="twitter" id="twitter" value="'.$object->twitter.'"></td></tr>';
print '<td colspan="3"><input type="text" name="twitter" class="minwidth100" maxlength="80" id="twitter" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td>'.fieldLabel('Facebook','facebook').'</td>';
print '<td colspan="3"><input type="text" name="facebook" id="facebook" value="'.$object->facebook.'"></td></tr>';
print '<td colspan="3"><input type="text" name="facebook" class="minwidth100" maxlength="80" id="facebook" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
}

View File

@ -79,9 +79,9 @@ class Societe extends CommonObject
*/
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
@ -186,6 +186,16 @@ class Societe extends CommonObject
* @var string
*/
public $skype;
/**
* Twitter username
* @var string
*/
public $twitter;
/**
* Facebook username
* @var string
*/
public $facebook;
/**
* Webpage
* @var string
@ -811,6 +821,8 @@ class Societe extends CommonObject
$this->fax = preg_replace("/\./","",$this->fax);
$this->email = trim($this->email);
$this->skype = trim($this->skype);
$this->twitter = trim($this->twitter);
$this->facebook = trim($this->facebook);
$this->url = $this->url?clean_url($this->url,0):'';
$this->note_private = trim($this->note_private);
$this->note_public = trim($this->note_public);
@ -934,6 +946,8 @@ class Societe extends CommonObject
$sql .= ",fax = ".(! empty($this->fax)?"'".$this->db->escape($this->fax)."'":"null");
$sql .= ",email = ".(! empty($this->email)?"'".$this->db->escape($this->email)."'":"null");
$sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
$sql .= ",twitter = ".(! empty($this->twitter)?"'".$this->db->escape($this->twitter)."'":"null");
$sql .= ",facebook = ".(! empty($this->facebook)?"'".$this->db->escape($this->facebook)."'":"null");
$sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");
$sql .= ",parent = " . ($this->parent > 0 ? $this->parent : "null");
@ -1059,6 +1073,8 @@ class Societe extends CommonObject
$lmember->address=$this->address;
$lmember->email=$this->email;
$lmember->skype=$this->skype;
$lmember->twitter=$this->twitter;
$lmember->facebook=$this->facebook;
$lmember->phone=$this->phone;
$result=$lmember->update($user,0,1,1,1); // Use nosync to 1 to avoid cyclic updates
@ -1162,7 +1178,7 @@ class Societe extends CommonObject
$sql .= ', s.status';
$sql .= ', s.price_level';
$sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif';
$sql .= ', s.phone, s.fax, s.email, s.skype, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
$sql .= ', s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
$sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6';
$sql .= ', s.capital, s.tva_intra';
$sql .= ', s.fk_typent as typent_id';
@ -1255,6 +1271,8 @@ class Societe extends CommonObject
$this->email = $obj->email;
$this->skype = $obj->skype;
$this->twitter = $obj->twitter;
$this->facebook = $obj->facebook;
$this->url = $obj->url;
$this->phone = $obj->phone;
$this->fax = $obj->fax;
@ -3221,6 +3239,8 @@ class Societe extends CommonObject
$this->phone=$member->phone; // Prof phone
$this->email=$member->email;
$this->skype=$member->skype;
$this->twitter=$member->twitter;
$this->facebook=$member->facebook;
$this->client = 1; // A member is a customer by default
$this->code_client = -1;
@ -3360,6 +3380,8 @@ class Societe extends CommonObject
$this->country_code='FR';
$this->email='specimen@specimen.com';
$this->skype='tom.hanson';
$this->twitter='tomhanson';
$this->facebook='tomhanson';
$this->url='http://www.specimen.com';
$this->phone='0909090901';

View File

@ -497,6 +497,7 @@ input#onlinepaymenturl, input#directdownloadlink {
}
hr { border: 0; border-top: 1px solid #ccc; }
.tabBar hr { margin-top: 20px; margin-bottom: 17px; }
.button, .buttonDelete, input[name="sbmtConnexion"] {
margin-bottom: 0;
@ -4430,7 +4431,7 @@ td.gminorheading {
.ecmfiletree {
width: 99%;
height: 99%;
background: #FFF;
/* background: #FFF; */
padding-left: 2px;
font-weight: normal;
}

View File

@ -62,7 +62,7 @@ class User extends CommonObject
public $birth;
public $email;
public $skype;
public $job;
public $job; // job position
public $signature;
public $address;
public $zip;

View File

@ -1,10 +1,9 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -158,7 +157,7 @@ class Website extends CommonObject
$sql.= 'status,';
$sql.= 'fk_default_home,';
$sql.= 'virtualhost,';
$sql.= 'fk_user_create,';
$sql.= 'fk_user_creat,';
$sql.= 'date_creation,';
$sql.= 'tms';
$sql .= ') VALUES (';
@ -168,7 +167,7 @@ class Website extends CommonObject
$sql .= ' '.(! isset($this->status)?'1':$this->status).',';
$sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).',';
$sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").",";
$sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).',';
$sql .= ' '.(! isset($this->fk_user_creat)?$user->id:$this->fk_user_creat).',';
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").",";
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_creation)."'");
$sql .= ')';
@ -227,7 +226,7 @@ class Website extends CommonObject
$sql .= " t.status,";
$sql .= " t.fk_default_home,";
$sql .= " t.virtualhost,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
@ -253,7 +252,7 @@ class Website extends CommonObject
$this->status = $obj->status;
$this->fk_default_home = $obj->fk_default_home;
$this->virtualhost = $obj->virtualhost;
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
@ -317,7 +316,7 @@ class Website extends CommonObject
$sql .= " t.status,";
$sql .= " t.fk_default_home,";
$sql .= " t.virtualhost,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
@ -357,7 +356,7 @@ class Website extends CommonObject
$line->status = $obj->status;
$line->fk_default_home = $obj->fk_default_home;
$line->virtualhost = $obj->virtualhost;
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_modification = $this->db->jdate($obj->date_modification);
@ -639,10 +638,11 @@ class Website extends CommonObject
if (! $error)
{
$filetpl=$pathofwebsitenew.'/page'.$newidforhome.'.tpl.php';
$filewrapper=$pathofwebsitenew.'/wrapper.php';
// Generate the index.php page to be the home page
//-------------------------------------------------
$result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl);
$result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl, $filewrapper);
}
}
@ -769,7 +769,7 @@ class Website extends CommonObject
$this->status = '';
$this->fk_default_home = null;
$this->virtualhost = 'http://myvirtualhost';
$this->fk_user_create = $user->id;
$this->fk_user_creat = $user->id;
$this->fk_user_modif = $user->id;
$this->date_creation = dol_now();
$this->tms = dol_now();
@ -783,7 +783,7 @@ class Website extends CommonObject
*/
function exportWebSite()
{
global $conf;
global $conf, $mysoc;
$website = $this;
@ -904,6 +904,9 @@ class Website extends CommonObject
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
$line.= "'".$this->db->escape(str_replace(array("\r\n","\r","\n"), "__N__", $stringtoexport))."', "; // Replace \r \n to have record on 1 line
$stringtoexport = $objectpageold->content;
@ -912,6 +915,9 @@ class Website extends CommonObject
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
$line.= "'".$this->db->escape($stringtoexport)."'"; // Replace \r \n to have record on 1 line
$line.= ");";
$line.= "\n";
@ -951,7 +957,7 @@ class Website extends CommonObject
*/
function importWebSite($pathtofile)
{
global $conf;
global $conf, $mysoc;
$error = 0;
@ -1000,10 +1006,14 @@ class Website extends CommonObject
$arrayreplacement['__WEBSITE_ID__'] = $object->id;
$arrayreplacement['__WEBSITE_KEY__'] = $object->ref;
$arrayreplacement['__N__'] = $this->db->escape("\n"); // Restore \n
$arrayreplacement['__LOGO_SMALL_KEY__'] = $this->db->escape($mysoc->logo_small);
$arrayreplacement['__LOGO_MINI_KEY__'] = $this->db->escape($mysoc->logo_mini);
$arrayreplacement['__LOGO_KEY__'] = $this->db->escape($mysoc->logo);
$result = dolReplaceInFile($sqlfile, $arrayreplacement);
$this->db->begin();
// Search the $maxrowid because we need it later
$sqlgetrowid='SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page';
$resql=$this->db->query($sqlgetrowid);
if ($resql)
@ -1012,7 +1022,8 @@ class Website extends CommonObject
$maxrowid=$obj->max;
}
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1);
// Load sql record
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); // The maxrowid of table is searched into this function two
if ($runsql <= 0)
{
$this->errors[]='Failed to load sql file '.$sqlfile;
@ -1035,13 +1046,19 @@ class Website extends CommonObject
$newid = ($reg[2] + $maxrowid);
$aliasesarray = explode(',', $reg[3]);
$objectpagestatic->fetch($newid);
dol_syslog("Found ID ".$oldid." to replace with ID ".$newid." and shortcut aliases to create: ".$reg[3]);
dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0);
// The move is not enough, so we regenerate page
$filetpl=$conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php';
dolSavePageContent($filetpl, $object, $objectpagestatic);
// Regenerate alternative aliases pages
foreach($aliasesarray as $aliasshortcuttocreate)
{
$objectpagestatic->id = $newid;
$filealias=$conf->website->dir_output.'/'.$object->ref.'/'.$aliasshortcuttocreate.'.php';
dolSavePageAlias($filealias, $object, $objectpagestatic);
}

View File

@ -1,9 +1,8 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -92,8 +91,8 @@ class WebsitePage extends CommonObject
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>502),
//'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510),
//'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1),
);
@ -130,7 +129,7 @@ class WebsitePage extends CommonObject
* Load object in memory from the database
*
* @param int $id Id object.
* - If this is 0, the value into $page will be used. If not found of $page not defined, the default page of website_id will be used or the first page found if not set.
* - If this is 0, the value into $page will be used. If not found or $page not defined, the default page of website_id will be used or the first page found if not set.
* - If value is < 0, we must exclude this ID.
* @param string $website_id Web site id (page name must also be filled if this parameter is used)
* @param string $page Page name (website id must also be filled if this parameter is used)
@ -159,7 +158,7 @@ class WebsitePage extends CommonObject
$sql .= " t.grabbed_from,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
@ -202,7 +201,7 @@ class WebsitePage extends CommonObject
$this->grabbed_from = $obj->grabbed_from;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
}
$this->db->free($resql);
@ -255,7 +254,7 @@ class WebsitePage extends CommonObject
$sql .= " t.grabbed_from,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid;
@ -271,11 +270,11 @@ class WebsitePage extends CommonObject
}
}
if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
$sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield,$sortorder);
$sql .= $this->db->order($sortfield, $sortorder);
}
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit, $offset);
@ -305,7 +304,7 @@ class WebsitePage extends CommonObject
$record->grabbed_from = $obj->grabbed_from;
$record->date_creation = $this->db->jdate($obj->date_creation);
$record->date_modification = $this->db->jdate($obj->date_modification);
$record->fk_user_create = $obj->fk_user_create;
$record->fk_user_creat = $obj->fk_user_creat;
$record->fk_user_modif = $obj->fk_user_modif;
//var_dump($record->id);
$records[$record->id] = $record;
@ -401,7 +400,7 @@ class WebsitePage extends CommonObject
$object->ref = $newref;
$object->pageurl = $newref;
$object->aliasalt = '';
$object->fk_user_create = $user->id;
$object->fk_user_creat = $user->id;
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
if (! empty($newlang)) $object->lang=$newlang;
if ($istranslation) $object->fk_page = $fromid;
@ -555,6 +554,6 @@ class WebsitePage extends CommonObject
$this->grabbed_from = '';
$this->date_creation = $now - (24 * 30 * 3600);
$this->date_modification = $now - (24 * 7 * 3600);
$this->fk_user_create = $user->id;
$this->fk_user_creat = $user->id;
}
}

View File

@ -109,28 +109,55 @@ if ($websitekey)
}
$website = $object;
// Check pageid received as aprameter
if ($pageid < 0) $pageid = 0;
if (($pageid > 0 || $pageref) && $action != 'addcontainer')
{
$res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
//var_dump($res);exit;
//if ($res == 0) // Page ref not found, we check in alias
//{
// $res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
//}
// Check if pageid is inside the new website, if not we reset param pageid
if ($object->id > 0 && ($objectpage->fk_website != $object->id))
if ($res >= 0 && $object->id > 0)
{
$res = $objectpage->fetch(0, $object->id, '');;
if ($res == 0) // Page was not found, we reset it
if ($objectpage->fk_website != $object->id) // We have a bad page.
{
$objectpage=new WebsitePage($db);
$res = $objectpage->fetch(0, $object->id, ''); // We search first page of web site
if ($res == 0) // Page was not found, we reset it
{
$objectpage=new WebsitePage($db);
}
else // We found a page, we set pageid to it.
{
$pageid = $objectpage->id;
}
}
else // We have a valid page. We force pageid for the case we got the page with a fetch on ref.
{
$pageid = $objectpage->id;
}
}
$pageid = $objectpage->id;
}
// Define pageid if pageid and pageref not received as parameter or was wrong
if (empty($pageid) && empty($pageref) && $object->id > 0 && $action != 'createcontainer')
{
$pageid = $object->fk_default_home;
if (empty($pageid))
{
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
$firstpageid=0;$homepageid=0;
foreach($array as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
}
$pageid=($homepageid?$homepageid:$firstpageid); // We choose home page and if not defined yet, we take first page
}
}
global $dolibarr_main_data_root;
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$websitekey;
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
@ -180,6 +207,7 @@ if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfil
if ($action == 'seteditinline')
{
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings');
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of show included containers
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int'));
exit;
@ -360,7 +388,7 @@ if ($action == 'addcontainer')
// Remove comments
$tmp['content'] = removeHtmlComment($tmp['content']);
preg_match('/<head>(.*)<\/head>/is', $tmp['content'], $reg);
preg_match('/<head>(.*)<\/head>/ims', $tmp['content'], $reg);
$head = $reg[1];
$objectpage->type_container = 'page';
@ -820,7 +848,7 @@ if ($action == 'updatecss')
/* We disable php code since htmlheader is never executed as an include but only read by fgets_content.
$htmlheadercontent.= "<?php // BEGIN PHP\n";
$htmlheadercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$htmlheadercontent.= "ob_start();\n";
@ -843,7 +871,7 @@ if ($action == 'updatecss')
$csscontent.= "<?php // BEGIN PHP\n";
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$csscontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$csscontent.= "ob_start();\n";
@ -875,7 +903,7 @@ if ($action == 'updatecss')
$jscontent.= "<?php // BEGIN PHP\n";
$jscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$jscontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$jscontent.= "ob_start();\n";
@ -907,7 +935,7 @@ if ($action == 'updatecss')
/*$robotcontent.= "<?php // BEGIN PHP\n";
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$robotcontent.= "ob_start();\n";
@ -939,7 +967,7 @@ if ($action == 'updatecss')
/*$robotcontent.= "<?php // BEGIN PHP\n";
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$robotcontent.= "ob_start();\n";
@ -1203,6 +1231,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
if ($action == 'confirm_createfromclone')
{
$db->begin();
$objectnew = new Website($db);
$result = $objectnew->createFromClone($user, GETPOST('id','int'), GETPOST('siteref','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''));
if ($result < 0)
@ -1210,6 +1240,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
$error++;
setEventMessages($objectnew->error, $objectnew->errors, 'errors');
$action='preview';
$db->rollback();
}
else
{
@ -1217,6 +1249,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
$id = $object->id;
$pageid = $object->fk_default_home;
$websitekey = GETPOST('siteref','aZ09');
$db->commit();
}
}
@ -1235,17 +1269,51 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
if (! $error)
{
$db->begin();
$newwebsiteid = GETPOST('newwebsite','int');
$pathofwebsitenew = $pathofwebsite;
$tmpwebsite=new Website($db);
if ($newwebsiteid > 0 && $newwebsiteid != $object->id)
{
$tmpwebsite->fetch($newwebsiteid);
$pathofwebsitenew = $dolibarr_main_data_root.'/website/'.$tmpwebsite->ref;
}
else
{
$tmpwebsite = $object;
}
$objectpage = new WebsitePage($db);
$result = $objectpage->createFromClone($user, $pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation, GETPOST('newwebsite','int'));
if ($result < 0)
$resultpage = $objectpage->createFromClone($user, $pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation, $newwebsiteid);
if ($resultpage < 0)
{
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
$action='createpagefromclone';
$db->rollback();
}
else
{
// TODO Switch on the new page ?
$fileindex=$pathofwebsitenew.'/index.php';
$filetpl=$pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php';
$filewrapper=$pathofwebsitenew.'/wrapper.php';
//var_dump($pathofwebsitenew);
//var_dump($filetpl);
//exit;
dolSavePageContent($filetpl, $tmpwebsite, $resultpage);
// Switch on the new page if web site of new page/container is same
if (empty($newwebsiteid) || $newwebsiteid == $object->id)
{
$pageid = $resultpage->id;
}
$db->commit();
}
}
}
@ -1299,7 +1367,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
$objectpage->content = GETPOST('PAGE_CONTENT','none');
// Clean data. We remove all the head section.
$objectpage->content = preg_replace('/<head>.*<\/head>/s', '', $objectpage->content);
$objectpage->content = preg_replace('/<head>.*<\/head>/ims', '', $objectpage->content);
/* $objectpage->content = preg_replace('/<base\s+href=[\'"][^\'"]+[\'"]\s/?>/s', '', $objectpage->content); */
@ -1566,7 +1634,7 @@ if (! GETPOST('hide_websitemenu'))
//var_dump($objectpage);exit;
print '<div class="centpercent websitebar">';
if (count($object->records) > 0)
if (count($object->records) > 0) // There is at least one web site
{
// ***** Part for web sites
@ -1662,7 +1730,8 @@ if (count($object->records) > 0)
print '</div>';
// Toolbar for website
// Toolbar for websites
print '<div class="websitetools">';
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')
@ -1762,7 +1831,7 @@ if (count($object->records) > 0)
$out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>';
$out.='['.$valpage->type_container.' '.$valpage->id.'] ';
$out.='['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] ';
$out.=$valpage->pageurl.' - '.$valpage->title;
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>';
@ -2368,10 +2437,15 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pagekeywords=$objectpage->keywords;
$pagelang=$objectpage->lang;
$pagehtmlheader=$objectpage->htmlheader;
$pagedatecreation=$objectpage->date_creation;
$pagedatemodification=$objectpage->date_modification;
$pageauthorid=$objectpage->fk_user_create;
}
else
{
$type_container = 'page';
$pagedatecreation=dol_now();
$pageauthorid=$user->id;
}
if (GETPOST('WEBSITE_TITLE','alpha')) $pagetitle=GETPOST('WEBSITE_TITLE','alpha');
if (GETPOST('WEBSITE_PAGENAME','alpha')) $pageurl=GETPOST('WEBSITE_PAGENAME','alpha');
@ -2436,13 +2510,37 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<input type="text" class="flat minwidth300" name="WEBSITE_ALIASALT" value="'.dol_escape_htmltag($pagealiasalt).'">';
print '</td></tr>';
$fuser=new User($db);
$fuser->fetch($pageauthorid);
print '<tr><td>';
print $langs->trans('Author');
print '</td><td>';
if ($pageauthorid > 0) print $fuser->getNomUrl(1);
print '</td></tr>';
print '<tr><td>';
print $langs->trans('DateCreation');
print '</td><td>';
print dol_print_date($pagedatecreation, 'dayhour');
print '</td></tr>';
if ($action != 'createcontainer')
{
print '<tr><td>';
print $langs->trans('DateModification');
print '</td><td>';
print dol_print_date($pagedatemodification, 'dayhour');
print '</td></tr>';
}
print '<tr><td class="tdhtmlheader tdtop">';
$htmlhelp=$langs->trans("EditTheWebSiteForACommonHeader").'<br><br>';
$htmlhelp=$langs->trans("Example").' :<br>';
$htmlhelp.=dol_htmlentitiesbr($htmlheadercontentdefault);
print $form->textwithpicto($langs->trans('HtmlHeaderPage'), $htmlhelp, 1, 'help', '', 0, 2, 'htmlheadertooltip');
print '</td><td>';
$doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '180', 'ace', 'In', true, false, 'ace', 0, '100%', '');
$doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '120', 'ace', 'In', true, false, 'ace', ROWS_3, '100%', '');
print $doleditor->Create(1, '', true, 'HTML Header', 'html');
print '</td></tr>';
@ -2508,31 +2606,34 @@ if ($action == 'editmenu')
if ($action == 'editsource')
{
/*
* Editing with source editor
*/
// Editing with source editor
$contentforedit = '';
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
$contentforedit.=$csscontent;
$contentforedit.='</style>'."\n";*/
//$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
//$contentforedit.=$csscontent;
//$contentforedit.='</style>'."\n";
$contentforedit .= $objectpage->content;
//var_dump($_SESSION["dol_screenheight"]);
$maxheightwin=480;
if (isset($_SESSION["dol_screenheight"]))
{
if ($_SESSION["dol_screenheight"] > 680) $maxheightwin = $_SESSION["dol_screenheight"]-400;
if ($_SESSION["dol_screenheight"] > 800) $maxheightwin = $_SESSION["dol_screenheight"]-490;
}
//var_dump($_SESSION["dol_screenheight"]);
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,'ace',ROWS_5,'90%');
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',$maxheightwin,'Full','',true,true,'ace',ROWS_5,'40%');
$doleditor->Create(0, '', false, 'HTML Source', 'php');
}
if ($action == 'editcontent')
/*if ($action == 'editcontent')
{
/*
* Editing with default ckeditor
*/
// Editing with default ckeditor
$contentforedit = '';
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
$contentforedit.=$csscontent;
$contentforedit.='</style>'."\n";*/
//$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
//$contentforedit.=$csscontent;
//$contentforedit.='</style>'."\n";
$contentforedit .= $objectpage->content;
$contentforedit = preg_replace('/(<img.*src=")(?!http)/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $contentforedit, -1, $nbrep);
@ -2540,7 +2641,7 @@ if ($action == 'editcontent')
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,ROWS_5,'90%');
$doleditor->Create(0, '', false);
}
}*/
print "</div>\n</form>\n";
@ -2557,16 +2658,21 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
$objectpage->fetch($pageid);
$jscontent = @file_get_contents($filejs);
$out = '<!-- Page content '.$filetpl.' : Div with (CSS Of website from file + Style/htmlheader of page from database + Page content from database) -->'."\n";
$out = '<!-- Page content '.$filetpl.' : Div with (CSS Of website from file + Style/htmlheader of page from database + Page content from database or by include if WEBSITE_SUBCONTAINERSINLINE is on) -->'."\n";
// Include a html so we can benefit of the header of page.
// Note: We can't use iframe as it can be used to include another external html file
// Note: We can't use frame as it is deprecated.
/*if ($includepageintoaframeoradiv == 'iframe')
{
$out .= "<iframe><body></html>";
}*/
$out.="\n<html><head>\n";
$out.=dolWebsiteReplacementOfLinks($object, $objectpage->htmlheader, 1);
$out.="</head>\n";
$out.="\n<body>";
$out.='<div id="websitecontentundertopmenu" class="websitecontentundertopmenu">'."\n";
// REPLACEMENT OF LINKS When page called by website editor
@ -2601,27 +2707,32 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
// Do not enable the contenteditable when page was grabbed, ckeditor is removing span and adding borders,
// so editable will be available only from container created from scratch
//$out.='<div id="bodywebsite" class="bodywebsite"'.($objectpage->grabbed_from ? ' contenteditable="true"' : '').'>'."\n";
$out.='<div id="bodywebsite" class="bodywebsite">'."\n";
$out.='<div id="divbodywebsite" class="bodywebsite">'."\n";
// TODO Add the contenteditable="true" when mode Edit Inline is on
$newcontent = $objectpage->content;
// If mode WEBSITE_SUBCONTAINERSINLINE is on
if (! empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{
define('USEDOLIBARREDITOR', 1);
//var_dump($filetpl);
$filephp = $filetpl;
ob_start();
include $filephp;
$newcontent = ob_get_contents();
ob_end_clean();
}
// Change the contenteditable to "true" or "false" when mode Edit Inline is on or off
if (empty($conf->global->WEBSITE_EDITINLINE))
{
$newcontent = preg_replace('/(div|section)(\s[^\>]*)contenteditable="true"/', '\1\2', $newcontent);
}
else
{
// TODO Add the contenteditable="true" when mode Edit Inline is on
}
/*
$filephp = $objectpage->
ob_start();
include $filephp;
$newcontent = ob_get_contents();
ob_end_clean();
*/
$out.=dolWebsiteReplacementOfLinks($object, $newcontent)."\n";
$out.='</div>';
@ -2636,9 +2747,6 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
$out.= "\n".'<!-- End page content '.$filetpl.' -->'."\n\n";
// For jqueryscoped (does not work as expected)
//$out.="<script>$.scoped();</script>";
print $out;
/*file_put_contents($filetpl, $out);