Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ip behind proxies #914

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fc33876
move IP detection function to more global location
michield Jul 10, 2021
98ad57f
replace (almost) all REMOTE_ADDR with getClientIP(), so that it conti…
michield Jul 10, 2021
66bf671
Merge branch 'master' into handle_IP_behind_proxies
michield Oct 17, 2021
8676f77
cache the ip address found
michield Oct 20, 2021
02faef6
tidy up
michield Oct 20, 2021
dcff53c
detect proxy in hostname
michield Dec 13, 2022
bb458e6
Merge branch 'main' into handle_IP_behind_proxies
michield Dec 13, 2022
27c00fb
Allow config to set ADMIN_WWWROOT and USER_WWWROOT to bypass the URL …
michield Jul 27, 2023
3771d43
Merge branch 'main' into handle_IP_behind_proxies
michield Jul 27, 2023
a26eccf
add section to config_extended about the new values
michield Jul 27, 2023
0b472cd
fix publicBaseUrl initialisation, as functions and vars are not avail…
michield Jul 30, 2023
e5a17ad
default to http:// to make CI pass
michield Jul 30, 2023
b7e3265
define new global vars for user and admin base urls
michield Aug 28, 2023
d853540
keep the URL config method as before, but override the config when fe…
michield Aug 28, 2023
da74e1a
use new global adminBaseUrl
michield Aug 28, 2023
66a1a78
use intermediate config var for initialisation of the config URLs
michield Aug 28, 2023
7a36207
use new global adminBaseUrl
michield Aug 28, 2023
6cbfdec
update pageroot only when not set, and add explanation in config_exte…
michield Sep 4, 2023
a1e9bc3
fix some more links with the new global var
michield Sep 4, 2023
0b36b40
remove obsolete line
michield Sep 4, 2023
0dadc39
fix typo
michield Sep 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file that keeps track of the latest tag in cvs and the corresponding version
# this automates publishing a new version, when it's tagged
# if you don't understand this, don't worry. You don't need this file
VERSION=3.6.13
VERSION=3.6.14-dev
2 changes: 1 addition & 1 deletion public_html/lists/admin/actions/import2.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
$some = 1;
}

$history_entry = $GLOBALS['admin_scheme'].'://'.getConfig('website').$GLOBALS['adminpages'].'/?page=user&id='.$userid."\n\n";
$history_entry = $GLOBALS['adminBaseUrl'].'/?page=user&id='.$userid."\n\n";
reset($_SESSION['import_attribute']);
// var_dump($_SESSION);exit;
if ($new || (!$new && $_SESSION['overwrite'] == 'yes')) {
Expand Down
15 changes: 8 additions & 7 deletions public_html/lists/admin/actions/processqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ function finish($flag, $message, $script_stage)

// If plugins have not sent the report, send it the default way
if (!$reportSent) {
$messageWithIntro = s('The following events occured while processing the message queue:')."\n".$message;
$messageWithIntroAndFooter = $messageWithIntro."\n\n".s('To stop receiving these reports read:').' https://resources.phplist.com/system/config/send_queue_processing_report'."\n\n";
$messageWithIntro = '<br/>'.s('The following events occured while processing the message queue:')."<br/>\n".$message;
$messageWithIntroAndFooter = $messageWithIntro."<br/>\n<br/>\n".s('To stop receiving these reports read:').' https://resources.phplist.com/system/config/send_queue_processing_report'."\n\n";
sendReport($subject, $messageWithIntroAndFooter);
}
}
Expand Down Expand Up @@ -458,7 +458,7 @@ function processQueueOutput($message, $logit = 1, $target = 'summary')
flush();
}

$report .= "\n$infostring $message";
$report .= "<br/>\n$infostring $message";
if ($logit) {
logEvent($message);
}
Expand Down Expand Up @@ -715,10 +715,10 @@ function sendEmailTest($messageid, $email)
if (!empty($msgdata['notify_start']) && !isset($msgdata['start_notified'])) {
$notifications = explode(',', $msgdata['notify_start']);
foreach ($notifications as $notification) {
$progressUrl = $GLOBALS['adminBaseUrl'].'/?page=messages&amp;tab=active';
sendMail($notification, s('Campaign started'),
s('phplist has started sending the campaign with subject %s', $msgdata['subject'])."\n\n".
s('to view the progress of this campaign, go to %s://%s', $GLOBALS['admin_scheme'],
hostName().$GLOBALS['adminpages'].'/?page=messages&amp;tab=active'));
s('to view the progress of this campaign, go to %s',$progressUrl));
}
Sql_Query(sprintf('insert ignore into %s (name,id,data) values("start_notified",%d,now())',
$GLOBALS['tables']['messagedata'], $messageid));
Expand Down Expand Up @@ -1369,10 +1369,11 @@ function sendEmailTest($messageid, $email)
if (!empty($msgdata['notify_end']) && !isset($msgdata['end_notified'])) {
$notifications = explode(',', $msgdata['notify_end']);
foreach ($notifications as $notification) {
$resultsUrl = $GLOBALS['adminBaseUrl'].'/?page=statsoverview&id='.$messageid;
sendMail($notification, s('Message campaign finished'),

s('phpList has finished sending the campaign with subject %s', $msgdata['subject'])."\n\n".
s('to view the statistics of this campaign, go to %s://%s', $GLOBALS['admin_scheme'],
getConfig('website').$GLOBALS['adminpages'].'/?page=statsoverview&id='.$messageid)
s('to view the statistics of this campaign, go to %s',$resultsUrl )
);
}
Sql_Query(sprintf('insert ignore into %s (name,id,data) values("end_notified",%d,now())',
Expand Down
18 changes: 16 additions & 2 deletions public_html/lists/admin/connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
if (empty($organisation_name)) {
$organisation_name = $_SERVER['SERVER_NAME'];
}
if (defined('USER_WWWROOT')) {
$publicBaseUrl = USER_WWWROOT;
$domainParts = parse_url($publicBaseUrl);
$GLOBALS['public_scheme'] = $domainParts['scheme'];
$GLOBALS['website'] = $domainParts['host'];
} else {
$publicBaseUrl = $GLOBALS['public_scheme'].'://'.$website.$GLOBALS['pageroot'];
}
if (defined('ADMIN_WWWROOT')) {
$adminBaseUrl = ADMIN_WWWROOT;
} else {
$adminBaseUrl = $GLOBALS['admin_scheme'].'://'.$website.$GLOBALS['pageroot'].'/admin';
}

$xormask = getConfig('xormask');
if (empty($xormask)) {
Expand Down Expand Up @@ -1496,6 +1509,8 @@ function hostName()
{
if (HTTP_HOST) {
return HTTP_HOST;
} elseif (!empty($_SERVER['X_FORWARDED_FOR'])) {
return $_SERVER['X_FORWARDED_FOR'];
} elseif (!empty($_SERVER['HTTP_HOST'])) {
return $_SERVER['HTTP_HOST'];
} else {
Expand All @@ -1506,8 +1521,7 @@ function hostName()

function Redirect($page)
{
$website = hostName();
header('Location: '.$GLOBALS['admin_scheme'].'://'.$website.$GLOBALS['adminpages']."/?page=$page");
header('Location: '.$GLOBALS['adminBaseUrl']."/?page=$page");
exit;
}

Expand Down
34 changes: 22 additions & 12 deletions public_html/lists/admin/defaultconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
if (preg_match("#^www\.(.*)#i", $D_domain, $regs)) {
$D_domain = $regs[1];
}

if (preg_match("#(.*):(\d+)#i", $D_domain, $regs)) {
$D_domain = $regs[1];
}
// for starters, you want to leave this line as it is.
$default_config = array(

Expand Down Expand Up @@ -299,7 +301,7 @@

// the location of your subscribe script
'subscribeurl' => array(
'value' => $GLOBALS['public_scheme']."://[WEBSITE]$pageroot/?p=subscribe",
'value' => $publicConfigBaseUrl."/?p=subscribe",
'description' => s('URL where subscribers can sign up'),
'type' => 'url',
'allowempty' => 0,
Expand All @@ -308,7 +310,7 @@

// the location of your unsubscribe script:
'unsubscribeurl' => array(
'value' => $GLOBALS['public_scheme']."://[WEBSITE]$pageroot/?p=unsubscribe",
'value' => $publicConfigBaseUrl."/?p=unsubscribe",
'description' => s('URL where subscribers can unsubscribe'),
'type' => 'url',
'allowempty' => 0,
Expand All @@ -318,7 +320,7 @@
//0013076: Blacklisting posibility for unknown users
// the location of your blacklist script:
'blacklisturl' => array(
'value' => $GLOBALS['public_scheme']."://[WEBSITE]$pageroot/?p=donotsend",
'value' => $publicConfigBaseUrl."/?p=donotsend",
'description' => s('URL where unknown users can unsubscribe (do-not-send-list)'),
'type' => 'url',
'allowempty' => 0,
Expand All @@ -327,7 +329,7 @@

// the location of your confirm script:
'confirmationurl' => array(
'value' => $GLOBALS['public_scheme']."://[WEBSITE]$pageroot/?p=confirm",
'value' => $publicConfigBaseUrl."/?p=confirm",
'description' => s('URL where subscribers have to confirm their subscription'),
'type' => 'text',
'allowempty' => 0,
Expand All @@ -336,7 +338,7 @@

// url to change their preferences
'preferencesurl' => array(
'value' => $GLOBALS['public_scheme']."://[WEBSITE]$pageroot/?p=preferences",
'value' => $publicConfigBaseUrl."/?p=preferences",
'description' => s('URL where subscribers can update their details'),
'type' => 'text',
'allowempty' => 0,
Expand All @@ -345,7 +347,7 @@

// url to change their preferences
'forwardurl' => array(
'value' => $GLOBALS['public_scheme']."://[WEBSITE]$pageroot/?p=forward",
'value' => $publicConfigBaseUrl."/?p=forward",
'description' => s('URL for forwarding messages'),
'type' => 'text',
'allowempty' => 0,
Expand All @@ -354,7 +356,7 @@

// url to download vcf card
'vcardurl' => array(
'value' => $GLOBALS['public_scheme']."://[WEBSITE]$pageroot/?p=vcard",
'value' => $publicConfigBaseUrl."/?p=vcard",
'description' => s('URL for downloading vcf card'),
'type' => 'text',
'allowempty' => 0,
Expand All @@ -369,10 +371,6 @@
'category' => 'subscription',
),

// the location of your subscribe script
//"subscribe_baseurl" => array("http://[WEBSITE]$pageroot/",
// "Base URL for public pages","text"),

// the subject of the message
'subscribesubject' => array(
'value' => s('Request for confirmation'),
Expand Down Expand Up @@ -740,6 +738,18 @@ function getConfig($item)
$hasconf = $_SESSION['hasconf'];
}

if (defined('USER_WWWROOT')) {
switch ($item) {
case 'subscribeurl': return USER_WWWROOT.'/?p=subscribe';
case 'unsubscribeurl': return USER_WWWROOT.'/?p=unsubscribe';
case 'blacklisturl': return USER_WWWROOT.'/?p=donotsend';
case 'confirmationurl': return USER_WWWROOT.'/?p=confirm';
case 'preferencesurl': return USER_WWWROOT.'/?p=preferences';
case 'forwardurl': return USER_WWWROOT.'/?p=forward';
case 'vcardurl': return USER_WWWROOT.'/?p=vcard';
}
}

$value = '';
if (!empty($hasconf)) {
$req = Sql_Query(sprintf('select value,editable from %s where item = "%s"', $tables['config'],
Expand Down
10 changes: 1 addition & 9 deletions public_html/lists/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,14 +602,6 @@ function mb_strtolower($string)
}
}

/*
if (USEFCK) {
$imgdir = getenv("DOCUMENT_ROOT").$GLOBALS["pageroot"].'/'.FCKIMAGES_DIR.'/';
if (!is_dir($imgdir) || !is_writeable ($imgdir)) {
Warn("The FCK image directory does not exist, or is not writable");
}
}
*/

/*
*
Expand Down Expand Up @@ -708,7 +700,7 @@ function mb_strtolower($string)
}

if (WARN_ABOUT_PHP_SETTINGS && !$GLOBALS['commandline']) {
if (strpos(getenv('REQUEST_URI'), $pageroot.'/admin') !== 0) {
if (!defined('USER_WWWROOT') && strpos(getenv('REQUEST_URI'), $pageroot.'/admin') !== 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!defined('USER_WWWROOT') && strpos(getenv('REQUEST_URI'), $pageroot.'/admin') !== 0) {

This test is of the admin URL not the public URL, but should it still be a valid test when ADMIN_WWWROOT is used?

When using the new USER_WWWROOT and ADMIN_WWWROOT Which value should $pageroot in config.php be set to?

Warn(s(
'The pageroot in your config "%s" does not match the current location "%s". Check your config file.',
$pageroot,
Expand Down
19 changes: 14 additions & 5 deletions public_html/lists/admin/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
define('NOTIFY_SPAM', 1);
}
if (!defined('CLICKTRACK_LINKMAP')) {
define('CLICKTRACK_LINKMAP', 0);
define('CLICKTRACK_LINKMAP', false);
}
if (!defined('SIGN_WITH_HMAC')) {
define('SIGN_WITH_HMAC', false);
Expand Down Expand Up @@ -713,13 +713,22 @@
$attachment_repository = $tmpdir;
}

if (isset($pageroot)) {
if ($pageroot == '/') {
$pageroot = '';
if (defined('USER_WWWROOT')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (defined('USER_WWWROOT')) {
  $pageroot = USER_WWWROOT;
  $publicBaseUrl = USER_WWWROOT;
} else {

$pageroot is only the path, not the whole URL. But I am not sure that is should be used, as there is ambiguity as to which path is meant - the public or admin. Hiding it with the $publicBaseUrl and $adminBaseUrl variables should mean that it is no longer used.

if (!isset($pageroot)) {
$pageroot = parse_url(USER_WWWROOT, PHP_URL_PATH);
}
$publicConfigBaseUrl = USER_WWWROOT;
} else {
$pageroot = '/lists';
if (isset($pageroot)) {
if ($pageroot == '/') {
$pageroot = '';
}
} else {
$pageroot = '/lists';
}
$publicConfigBaseUrl = "http://[WEBSITE]$pageroot";
}

// as the "admin" in adminpages is hardcoded, don't put it in the config file
$adminpages = $GLOBALS['pageroot'].'/admin';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using $pageroot taken from the public URL but it is used to create URLs for admin pages. Related to the previous comment.


Expand Down
3 changes: 1 addition & 2 deletions public_html/lists/admin/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,11 @@ function sendAdminPasswordToken($adminId)
$adminName = $row[0];
$email = $row[1];

$urlroot = getConfig('website').$GLOBALS['adminpages'];
//Build the email body to be sent, and finally send it.
$emailBody = $GLOBALS['I18N']->get('Hello').' '.$adminName."\n\n";
$emailBody .= $GLOBALS['I18N']->get('You have requested a new password for phpList.')."\n\n";
$emailBody .= $GLOBALS['I18N']->get('To enter a new one, please visit the following link:')."\n\n";
$emailBody .= sprintf('%s://%s/?page=login&token=%s', $GLOBALS['admin_scheme'], $urlroot, $key)."\n\n";
$emailBody .= sprintf('%s/?page=login&token=%s',$GLOBALS['adminBaseUrl'], $key)."\n\n";
$emailBody .= $GLOBALS['I18N']->get('You have 24 hours left to change your password. After that, your token won\'t be valid.');

if (sendMail($email, $GLOBALS['I18N']->get('New password'), "\n\n".$emailBody, '', '', true)) {
Expand Down
5 changes: 3 additions & 2 deletions public_html/lists/admin/processbounces.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ function processMessages($link, $max = 3000)
if ($row['user']) {
$userdata = Sql_Fetch_Array_Query("select * from {$tables['user']} where id = ".$row['user']);
}
$report_linkroot = $GLOBALS['admin_scheme'].'://'.$GLOBALS['website'].$GLOBALS['adminpages'];
$report_linkroot = $GLOBALS['adminBaseUrl'];

Sql_Query(sprintf('update %s set count = count + 1 where id = %d',
$GLOBALS['tables']['bounceregex'], $rule['id']));
Expand Down Expand Up @@ -797,7 +797,8 @@ function processMessages($link, $max = 3000)
Sql_Query(sprintf('update %s set confirmed = 0 where id = %d', $tables['user'], $user[0]));
$email_req = Sql_Fetch_Row_Query(sprintf('select email from %s where id = %d', $tables['user'],
$user[0]));
$unsubscribed_users .= $email_req[0]."\t\t($cnt)\t\t".$GLOBALS['scheme'].'://'.getConfig('website').$GLOBALS['adminpages'].'/?page=user&amp;id='.$user[0].PHP_EOL;
$unsubscribed_users .= $email_req[0]."\t\t($cnt)\t\t";
$unsubscribed_users .= $GLOBALS['adminBaseUrl'].'/?page=user&amp;id='.$user[0].PHP_EOL;
$unsubscribed = 1;
}
if (BLACKLIST_EMAIL_ON_BOUNCE && $cnt >= BLACKLIST_EMAIL_ON_BOUNCE) {
Expand Down
30 changes: 14 additions & 16 deletions public_html/lists/admin/sendemaillib.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array()
You can configure how the credits are added to your pages and emails in your
config file.

Michiel Dethmers, phpList Ltd 2003 - 2013
Michiel Dethmers, phpList Ltd 2003 - 2023
*/
if (!EMAILTEXTCREDITS) {
$html['signature'] = $PoweredByImage; //'<div align="center" id="signature"><a href="https://www.phplist.com"><img src="powerphplist.png" width=88 height=31 title="Powered by PHPlist" alt="Powered by PHPlist" border="0" /></a></div>';
Expand Down Expand Up @@ -427,15 +427,15 @@ function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array()
if (ALWAYS_ADD_USERTRACK) {
if (stripos($htmlmessage, '</body>')) {
$htmlmessage = str_replace('</body>',
'<img src="'.$GLOBALS['public_scheme'].'://'.$website.$GLOBALS['pageroot'].'/ut.php?u='.$hash.'&amp;m='.$messageid.'" width="1" height="1" border="0" alt="" /></body>',
'<img src="'.$GLOBALS['publicBaseUrl'].'/ut.php?u='.$hash.'&amp;m='.$messageid.'" width="1" height="1" border="0" alt="" /></body>',
$htmlmessage);
} else {
$htmlmessage .= '<img src="'.$GLOBALS['public_scheme'].'://'.$website.$GLOBALS['pageroot'].'/ut.php?u='.$hash.'&amp;m='.$messageid.'" width="1" height="1" border="0" alt="" />';
$htmlmessage .= '<img src="'.$GLOBALS['publicBaseUrl'].'/ut.php?u='.$hash.'&amp;m='.$messageid.'" width="1" height="1" border="0" alt="" />';
}
} else {
//# can't use str_replace or str_ireplace, because those replace all, and we only want to replace one
$htmlmessage = preg_replace('/\[USERTRACK\]/i',
'<img src="'.$GLOBALS['public_scheme'].'://'.$website.$GLOBALS['pageroot'].'/ut.php?u='.$hash.'&amp;m='.$messageid.'" width="1" height="1" border="0" alt="" />',
'<img src="'.$GLOBALS['publicBaseUrl'].'/ut.php?u='.$hash.'&amp;m='.$messageid.'" width="1" height="1" border="0" alt="" />',
$htmlmessage, 1);
}
// make sure to only include usertrack once, otherwise the stats would go silly
Expand Down Expand Up @@ -512,7 +512,7 @@ function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array()
if (CLICKTRACK && $hash != 'forwarded' && !empty($userdata['id'])) {
// convert html message
preg_match_all('/<a (.*)href=(["\'])(.*)\2([^>]*)>(.*)<\/a>/Umis', $htmlmessage, $links);
$clicktrack_root = sprintf('%s://%s/lt.php', $GLOBALS['public_scheme'], $website.$GLOBALS['pageroot']);
$clicktrack_root = sprintf('%s/lt.php', $GLOBALS['publicBaseUrl']);

for ($i = 0; $i < count($links[3]); ++$i) {
$link = cleanUrl(trim($links[3][$i]));
Expand Down Expand Up @@ -544,16 +544,16 @@ function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array()
$masked = preg_replace('/=$/', '', $masked);
$masked = urlencode($masked);
if (SIGN_WITH_HMAC) {
$masked .= '&amp;hm='.hash_hmac(HASH_ALGO, sprintf('%s://%s/lt.php?tid=%s', $GLOBALS['public_scheme'], $website.$GLOBALS['pageroot'], $masked), HMACKEY);
$masked .= '&amp;hm='.hash_hmac(HASH_ALGO, sprintf('%s/lt.php?tid=%s', $GLOBALS['publicBaseUrl'], $masked), HMACKEY);
}

## this may need removing, CLICKTRACK_LINKMAP is badly documented, so slightly unclear how this works
if (!CLICKTRACK_LINKMAP) {
$newlink = sprintf('<a %shref="%s://%s/lt.php?tid=%s" %s>%s</a>', $links[1][$i],
$GLOBALS['public_scheme'], $website.$GLOBALS['pageroot'], $masked, $links[4][$i],
$newlink = sprintf('<a %shref="%s/lt.php?tid=%s" %s>%s</a>', $links[1][$i],
$GLOBALS['publicBaseUrl'], $masked, $links[4][$i],
$links[5][$i]);
} else {
$newlink = sprintf('<a %shref="%s://%s%s" %s>%s</a>', $links[1][$i], $GLOBALS['public_scheme'],
$website.CLICKTRACK_LINKMAP, $masked, $links[4][$i], $links[5][$i]);
$newlink = sprintf('<a %shref="%s%s" %s>%s</a>', $links[1][$i], $GLOBALS['publicBaseUrl'].CLICKTRACK_LINKMAP, $masked, $links[4][$i], $links[5][$i]);
}
$htmlmessage = str_replace($links[0][$i], $newlink, $htmlmessage);
}
Expand Down Expand Up @@ -584,17 +584,15 @@ function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array()
$masked = str_replace('=', '', base64_encode(hex2bin(str_replace('-', '', $masked))));

if (SIGN_WITH_HMAC) {
$masked .= '&hm='.hash_hmac(HASH_ALGO, sprintf('%s://%s/lt.php?tid=%s', $GLOBALS['public_scheme'], $website.$GLOBALS['pageroot'], $masked), HMACKEY);
$masked .= '&hm='.hash_hmac(HASH_ALGO, sprintf('/lt.php?tid=%s', $GLOBALS['publicBaseUrl'], $masked), HMACKEY);
}

if (!CLICKTRACK_LINKMAP) {
$newlinks[$linkUUID] = sprintf('%s://%s/lt.php?tid=%s', $GLOBALS['public_scheme'],
$website.$GLOBALS['pageroot'], $masked);
$newlinks[$linkUUID] = sprintf('%s/lt.php?tid=%s', $GLOBALS['publicBaseUrl'], $masked);
} else {
$newlinks[$linkUUID] = sprintf('%s://%s%s', $GLOBALS['public_scheme'], $website.CLICKTRACK_LINKMAP,
$newlinks[$linkUUID] = sprintf('%s%s', $GLOBALS['publicBaseUrl'].CLICKTRACK_LINKMAP,
$masked);
}

$textmessage = str_replace($links[1][$i], '[%%%'.$linkUUID.'%%%]', $textmessage);
}
}
Expand Down Expand Up @@ -1064,7 +1062,7 @@ function addAttachments($msgid, &$mail, $type,$hash = '')
break;

case 'text':
$viewurl = $GLOBALS['public_scheme'].'://'.$website.$GLOBALS['pageroot'].'/dl.php?id='.$att['id'];
$viewurl = $GLOBALS['publicBaseUrl'].'/dl.php?id='.$att['id'];
if (!empty($hash)) {
$viewurl .= '&uid='.$hash;
}
Expand Down
Loading
Loading