function _subscriptions_mail_check_baseurl in Subscriptions 7
Same name and namespace in other branches
- 6 subscriptions_mail.module \_subscriptions_mail_check_baseurl()
- 2.0.x subscriptions_mail/subscriptions_mail.module \_subscriptions_mail_check_baseurl()
Checks the $base_url and provide a warning if needed.
Parameters
bool $interactive:
2 calls to _subscriptions_mail_check_baseurl()
- _subscriptions_mail_cron in ./
subscriptions_mail.cron.inc - Implementation of hook_cron().
- _subscriptions_mail_form_subscriptions_settings_form_alter in ./
subscriptions_mail.admin.inc - Implementation of hook_form_alter().
File
- ./
subscriptions_mail.module, line 278 - Subscriptions module mail gateway.
Code
function _subscriptions_mail_check_baseurl($interactive) {
// Check the $base_url (#199039, #226335, #1015320).
$url = url('', array(
'absolute' => TRUE,
));
if (empty($_POST) && preg_match('!//($|/|localhost/|([0-9]{1,3}\\.){3}[0-9]{1,3}/)!', $url)) {
$msg = t('Your installation returns %url as the base URL of the site. This is probably not what you want, and it can usually be fixed by setting the %variable variable in your %file file.', array(
'%url' => $url,
'%variable' => '$base_url',
'%file' => 'settings.php',
));
if ($interactive) {
drupal_set_message($msg, 'error');
}
else {
$watchdog = 'watchdog';
// keep potx from translating 'cron'
$watchdog('cron', $msg . ' ' . t('If it happens only when running from cron, then it could be due to a mis-configuration of your cron job.'), NULL, WATCHDOG_ERROR);
}
}
}