diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php
index 151e116f03a..d398f3631a0 100644
--- a/htdocs/admin/agenda_xcal.php
+++ b/htdocs/admin/agenda_xcal.php
@@ -130,15 +130,22 @@ clearstatcache();
//if ($mesg) print " $mesg ";
print " ";
+
+// 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
+
+
// Show message
$message='';
-$urlvcal=''.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'';
+$urlvcal=''.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
$message.=' ';
-$urlical=''.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'';
+$urlical=''.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'ical/ics',$urlical);
$message.=' ';
-$urlrss=''.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'';
+$urlrss=''.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'rss',$urlrss);
$message.=' ';
$message.=' ';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index dfc80a04051..c31d2cd1115 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -952,8 +952,11 @@ class ActionComm extends CommonObject
$event['location']=$obj->location;
$event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy)
$event['category']=$obj->libelle; // libelle type action
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id;
+ // 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
+ $url=$urlwithroot.'/comm/action/fiche.php?id='.$obj->id;
$event['url']=$url;
$event['created']=$this->db->jdate($obj->datec);
$event['modified']=$this->db->jdate($obj->datem);
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 1474cb7686a..c4b6d15ef20 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -172,26 +172,30 @@ class Notify
$message.= "\n";
$message.= $texte;
// Add link
+ $link='';
switch($objet_type)
{
case 'ficheinter':
- $link=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$objet_id;
+ $link='/fichinter/fiche.php?id='.$objet_id;
break;
case 'propal':
- $link=DOL_URL_ROOT.'/comm/propal.php?id='.$objet_id;
+ $link='/comm/propal.php?id='.$objet_id;
break;
case 'facture':
- $link=DOL_URL_ROOT.'/compta/facture.php?facid='.$objet_id;
+ $link='/compta/facture.php?facid='.$objet_id;
break;
case 'order':
- $link=DOL_URL_ROOT.'/commande/fiche.php?facid='.$objet_id;
+ $link='/commande/fiche.php?facid='.$objet_id;
break;
case 'order_supplier':
- $link=DOL_URL_ROOT.'/fourn/commande/fiche.php?facid='.$objet_id;
+ $link='/fourn/commande/fiche.php?facid='.$objet_id;
break;
}
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
- if ($link) $message.="\n".$urlwithouturlroot.$link;
+ // 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
+ if ($link) $message.="\n".$urlwithroot.$link;
$filename = basename($file);
diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php
index 277dca6cc37..03f0fbb1416 100644
--- a/htdocs/core/lib/xcal.lib.php
+++ b/htdocs/core/lib/xcal.lib.php
@@ -322,8 +322,11 @@ function build_rssfile($format,$title,$desc,$events_array,$outputfile,$filter=''
''.$date.''."\n".
'Dolibarr'."\n";
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
- $url=$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
+ // 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
+ $url=$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
$form.=''."\n";
//print $form;
diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php
index c311fd20893..42af4f169ab 100644
--- a/htdocs/public/paybox/newpayment.php
+++ b/htdocs/public/paybox/newpayment.php
@@ -75,9 +75,13 @@ if (! GETPOST("action"))
}
}
+// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
-$urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/paymentok.php?';
-$urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/paymentko.php?';
+$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
+
+$urlok=$urlwithroot.'/public/paybox/paymentok.php?';
+$urlko=$urlwithroot.'/public/paybox/paymentko.php?';
// Complete urls
$SOURCE=GETPOST("source",'alpha');
diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php
index 93cb723c19e..bdb605d4aa5 100755
--- a/htdocs/public/paypal/newpayment.php
+++ b/htdocs/public/paypal/newpayment.php
@@ -86,9 +86,13 @@ if (! GETPOST("action"))
}
}
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
-$urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentok.php?';
-$urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentko.php?';
+// 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
+
+$urlok=$urlwithroot.'/public/paypal/paymentok.php?';
+$urlko=$urlwithroot.'/public/paypal/paymentko.php?';
// Complete urls for post treatment
$SOURCE=GETPOST("source",'alpha');
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 805090d3956..dc6a52ae811 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1462,17 +1462,10 @@ class User extends CommonObject
$outputlangs=$langs;
}
- // Define urlwithouturlroot
- if (! empty($_SERVER["HTTP_HOST"])) // Autodetect main url root
- {
- $urlwithouturlroot='http://'.preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$_SERVER["HTTP_HOST"]);
- }
- else
- {
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
- }
- if (! empty($dolibarr_main_force_https)
- || (! empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on')) $urlwithouturlroot=preg_replace('/http:/i','https:',$urlwithouturlroot);
+ // 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
// TODO Use outputlangs to translate messages
if (! $changelater)
@@ -1482,7 +1475,7 @@ class User extends CommonObject
$mesg.= $langs->trans("Login")." : $this->login\n";
$mesg.= $langs->trans("Password")." : $password\n\n";
$mesg.= "\n";
- $url = $urlwithouturlroot.DOL_URL_ROOT;
+ $url = $urlwithroot;
$mesg.= 'Click here to go to Dolibarr: '.$url."\n\n";
$mesg.= "--\n";
$mesg.= $user->getFullName($langs); // Username that make then sending
@@ -1495,7 +1488,7 @@ class User extends CommonObject
$mesg.= $langs->trans("Password")." : $password\n\n";
$mesg.= "\n";
$mesg.= "You must click on the folowing link to validate its change.\n";
- $url = $urlwithouturlroot.DOL_URL_ROOT.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordmd5=".dol_hash($password);
+ $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordmd5=".dol_hash($password);
$mesg.= $url."\n\n";
$mesg.= "If you didn't ask anything, just forget this email\n\n";
dol_syslog(get_class($this)."::send_password url=".$url);