Example #1
0
 /**
  * @inheritdoc
  */
 public function route($path, $absolute = false, $forceSecure = false)
 {
     $path = $path . (!preg_match('/\\/$/', $path) ? '/' : '');
     $pathArray = preg_split('=/=', $path, -1, PREG_SPLIT_NO_EMPTY);
     if (isset($pathArray[1]) === false) {
         $path .= 'index/';
     }
     if (isset($pathArray[2]) === false) {
         $path .= 'index/';
     }
     $prefix = '';
     // Append the current hostname to the URL
     if ($absolute === true) {
         $prefix .= $forceSecure === true ? 'https://' : $this->request->getScheme() . '://';
         $prefix .= $this->request->getHost();
     }
     $prefix .= $this->appPath->getPhpSelf() . '/';
     return $prefix . $path;
 }
Example #2
0
File: Router.php Project: acp3/core
 /**
  * @param string $path
  * @param bool   $isAbsolute
  * @param bool   $forceSecure
  *
  * @return string
  */
 protected function addUriPrefix($path, $isAbsolute, $forceSecure)
 {
     $prefix = '';
     if ($isAbsolute === true || $forceSecure === true) {
         $prefix .= $forceSecure === true ? 'https://' : $this->request->getScheme() . '://';
         $prefix .= $this->request->getHost();
     }
     $prefix .= $this->useModRewrite($path) ? $this->appPath->getWebRoot() : $this->appPath->getPhpSelf() . '/';
     return $prefix;
 }
Example #3
0
 /**
  * @param string $emailAddress
  * @param string $hash
  *
  * @return bool
  */
 protected function sendDoubleOptInEmail($emailAddress, $hash)
 {
     $url = $this->router->route('newsletter/index/activate/hash_' . $hash, true);
     $systemSettings = $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME);
     $settings = $this->config->getSettings(Schema::MODULE_NAME);
     $subject = $this->translator->t('newsletter', 'subscribe_mail_subject', ['%title%' => $systemSettings['site_title']]);
     $body = $this->translator->t('newsletter', 'subscribe_mail_body', ['{host}' => $this->request->getHost()]) . "\n\n";
     $from = ['email' => $settings['mail'], 'name' => $systemSettings['site_title']];
     $this->mailer->reset()->setFrom($from)->setSubject($subject)->setMailSignature($settings['mailsig']);
     if ($settings['html'] == 1) {
         $this->mailer->setTemplate('newsletter/layout.email.tpl');
         $body .= '<a href="' . $url . '">' . $url . '<a>';
         $this->mailer->setHtmlBody($this->stringFormatter->nl2p($body));
     } else {
         $body .= $url;
         $this->mailer->setBody($body);
     }
     $this->mailer->setRecipients($emailAddress);
     return $this->mailer->send();
 }