示例#1
0
 /**
  * set up the mail object
  *
  */
 public function __construct()
 {
     $this->_view = new Zend_View();
     $settings = new Model_SiteSettings();
     if ($settings->get('use_smtp_mail') == 1) {
         $config = array('auth' => 'Login', 'username' => $settings->get('smtp_username'), 'password' => $settings->get('smtp_password'));
         $this->_transport = new Zend_Mail_Transport_Smtp($settings->get('smtp_host'), $config);
     }
     $this->_mail = new Zend_Mail();
 }
 /**
  * Return a string with the XML declaration if required
  *
  * Return a string with the XML declaration if required
  * If option 'browser' is used, it is decided by the browser's HTTP_USER_AGENT
  *
  * @param   string  $option  decide whether to set the XML declaration or not
  * @return  string|null  XML declaration or null
  */
 public function getXmlDeclaration($option = null)
 {
     // get xml declaration option from site settings if not given as argument
     if (is_null($option)) {
         $siteSettings = new Model_SiteSettings();
         $option = $siteSettings->get('xml_declaration');
     }
     // return null if content is not XHTML but simply HTML
     if (!$this->view->docType()->isXhtml()) {
         return null;
     }
     // decide whether to return an xml declaration depending on the option
     switch (strtolower($option)) {
         case 'always':
             return '<?xml version="1.0" encoding="' . $this->view->placeholder('charset') . '" ?>' . PHP_EOL;
         case 'browser':
             if ($this->_userAgentAcceptsXhtml()) {
                 return $this->getXmlDeclaration('always');
             }
             return $this->getXmlDeclaration('never');
         case 'never':
         default:
             return null;
     }
 }
示例#3
0
 public static function getAdminLanguage()
 {
     $siteSettings = new Model_SiteSettings();
     $adminLang = $siteSettings->get('admin_language');
     if (empty($adminLang)) {
         $config = Zend_Registry::get('config');
         $adminLang = $config->language->defaultLocale;
     }
     if (empty($adminLang)) {
         $locale = new Zend_Locale();
         $adminLang = $locale->getLanguage();
     }
     if (empty($adminLang)) {
         throw new Digitalus_Language_Exception('No administrator language found!');
     }
     return $adminLang;
 }
示例#4
0
 public function get404Page()
 {
     $settings = new Model_SiteSettings();
     $page = $settings->get('page_not_found');
     $front = Zend_Controller_Front::getInstance();
     if ($page > 0) {
         $response = $front->getResponse();
         $response->setRawHeader('HTTP/1.1 404 Not Found');
         return $page;
     }
 }
示例#5
0
 public function getOfflinePage()
 {
     $settings = new Model_SiteSettings();
     return $settings->get('offline_page');
 }
示例#6
0
 /**
  * Sends a confirmation email
  *
  * @param  string $userName     User name to send email to
  * @param  string $emailAddress User's email address
  * @param  string $$emailText   Content of email
  * @return bool   True if successful, otherwise false
  */
 public function sendConfirmationMail($userName, $emailAddress, $emailText, $action = null)
 {
     $settings = new Model_SiteSettings();
     $emailText = $this->_createEmailText($userName, $emailAddress, $emailText, $action);
     $mail = new Zend_Mail();
     $mail->setBodyHtml($emailText, 'utf8');
     $mail->setBodyText(strip_tags($emailText), 'utf8');
     $mail->setFrom($settings->get('default_email'), $settings->get('default_email_sender'));
     $mail->addTo($emailAddress, $userName);
     $mail->setSubject($this->view->getTranslation('Registration'));
     if ($mail->send()) {
         return true;
     }
     return false;
 }
示例#7
0
 public function googleIntegration()
 {
     $view = $this->_page->getView();
     $settings = new Model_SiteSettings();
     $view->placeholder('google_verify')->set($settings->get('google_verify'));
     $view->placeholder('google_tracking')->set($settings->get('google_tracking'));
 }
示例#8
0
 protected function _getCharset()
 {
     $settings = new Model_SiteSettings();
     $this->_charset = $settings->get('default_charset');
 }
示例#9
0
 /**
  * Mail test action
  *
  * @return void
  */
 public function mailTestAction()
 {
     $settings = new Model_SiteSettings();
     $message = new Digitalus_Mail();
     $message->send($settings->get('default_email'), array($settings->get('default_email'), $settings->get('default_email_sender')), 'Digitalus CMS Test Message', 'test');
     $this->_forward('index');
 }