The code assumes that civicrm is a standard drupal (7) install with the civicrm installed in the 'sites/all/modules/civicrm' directory. Sometimes this location is different, for example 'sites/all/modules/contrib/civicrm'. The $config->userFrameworkResourceURL points to this place. This commit removes the assumption.

This commit is contained in:
Klaas Eikelboom 2022-06-08 08:33:24 +02:00
parent 5c1e804055
commit cde4373435
1 changed files with 3 additions and 2 deletions

View File

@ -53,12 +53,13 @@ class CRM_Civiproxy_Mailer {
$config = CRM_Core_Config::singleton();
$system_base = $config->userFrameworkBaseURL;
$proxy_base = CRM_Core_BAO_Setting::getItem('CiviProxy Settings', 'proxy_url');
$resource_url = $config->userFrameworkResourceURL;
// General external functions
$value = preg_replace("#{$system_base}civicrm/mailing/url#i", $proxy_base.'/url.php', $value);
$value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/url.php#i", $proxy_base.'/url.php', $value);
$value = preg_replace("#{$resource_url}extern/url.php#i", $proxy_base.'/url.php', $value);
$value = preg_replace("#{$system_base}civicrm/mailing/open#i", $proxy_base.'/open.php', $value);
$value = preg_replace("#{$system_base}sites/all/modules/civicrm/extern/open.php#i", $proxy_base.'/open.php', $value);
$value = preg_replace("#{$resource_url}extern/open.php#i", $proxy_base.'/open.php', $value);
$value = preg_replace("#{$system_base}sites/default/files/civicrm/persist/#i", $proxy_base.'/file.php?id=', $value);
$value = preg_replace("#{$system_base}civicrm/mosaico/img\?src=#i", $proxy_base.'/mosaico.php?id=', $value);
$value = preg_replace("#{$system_base}civicrm/mosaico/img/\?src=#i", $proxy_base.'/mosaico.php?id=', $value);