Beispiel #1
0
 public static function getRecaptchaCode($sId = '')
 {
     $oTemplate = self::constructTemplateForModuleAndType(self::$MODULE_TYPE, 'form', 'recaptcha');
     $oTemplate->replaceIdentifier('key', Settings::getSetting('frontend', 're_captcha_public_key', '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'));
     $sAPI = 'https://www.google.com/recaptcha/api.js?';
     $oOutput = new XHTMLOutput();
     if ($oOutput->getContentType() === 'application/xhtml+xml') {
         // Use fallback version because users don’t want to wait for timeout when document.write isn’t working.
         $sAPI .= '&fallback=true';
     }
     ResourceIncluder::defaultIncluder()->addResource($sAPI, ResourceIncluder::RESOURCE_TYPE_JS);
     return $oTemplate;
 }
Beispiel #2
0
 public function __construct()
 {
     parent::__construct(false);
     $this->sAction = 'login';
     if (Manager::isPost()) {
         ArrayUtil::trimStringsInArray($_POST);
     }
     //1st step: user clicked on the recovery link
     //	• Display email field
     if (isset($_REQUEST['password_forgotten'])) {
         $this->sAction = 'password_forgotten';
     }
     //2nd step: user has entered an email address
     //	• Send the email with the recovery link (and generate the hint)
     //	• Add confirmation message to flash
     if (isset($_POST['password_reset_user_name'])) {
         $this->sAction = self::processPasswordReset();
     }
     //3rd step: user has clicked on the reset link in the e-mail
     //	• Validate the hint
     //	• Display a form for entering a new password (form also contains hidden fields for email and hint)
     //	• Add the referrer to the session (again)
     if (isset($_REQUEST['recover_username'])) {
         $this->sAction = self::passwordReset();
     }
     //4th step: user has submitted the new password
     //	• Validate the hint (again)
     //	• Validate password constraints
     //	• Set the new password (if valid)
     //	• Log in (if valid)
     //	• Redirect to the referrer (if valid)
     if (isset($_POST['new_password'])) {
         $this->sAction = self::loginNewPassword();
     }
     if (isset($_POST[self::USER_NAME])) {
         self::login();
     }
     $oOutput = new XHTMLOutput('transitional');
     $oOutput->render();
     $this->oTemplate = new Template('login', array(DIRNAME_TEMPLATES, 'login'), false, true);
 }
 /**
  * renderFile()
  * @return string xhtml output
  */
 public function renderFile()
 {
     $oOutput = new XHTMLOutput(XHTMLOutput::SETTING_HTML_4_TRANSITIONAL, true, null, $this->oNewsletter->getLanguageId());
     $oOutput->render();
     $oNewsletterTemplate = new Template('main_display', array(DIRNAME_TEMPLATES, 'newsletter'), false, true);
     $oNewsletterTemplate->replaceIdentifier('newsletter_template_css', new Template("{$this->oNewsletter->getTemplateName()}.css", array(DIRNAME_TEMPLATES, 'newsletter')));
     $oNewsletterContent = RichtextUtil::parseStorageForFrontendOutput(stream_get_contents($this->oNewsletter->getNewsletterBody()));
     if (ResourceFinder::findResource(array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME, "{$this->oNewsletter->getTemplateName()}.body.tmpl")) !== null) {
         $oNewsletterTemplate->replaceIdentifier('newsletter_content', new Template("{$this->oNewsletter->getTemplateName()}.body", array(DIRNAME_TEMPLATES, NewsletterDetailWidgetModule::NEWSLETTER_DIRNAME)), null, Template::LEAVE_IDENTIFIERS);
     }
     $oNewsletterTemplate->replaceIdentifier('newsletter_content', $oNewsletterContent, null, Template::LEAVE_IDENTIFIERS);
     $oNewsletterTemplate->replaceIdentifier('language', $this->oNewsletter->getLanguageId());
     if ($this->oMailing !== null) {
         $oNewsletterTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate($this->oMailing->getDateSent(null)->getTimestamp(), $this->oNewsletter->getLanguageId()));
         $oNewsletterTemplate->replaceIdentifier('newsletter_timestamp', $this->oMailing->getDateSent(null)->getTimestamp());
     } else {
         $oNewsletterTemplate->replaceIdentifier('newsletter_date', LocaleUtil::localizeDate($this->oNewsletter->getCreatedAt(null)->getTimestamp(), $this->oNewsletter->getLanguageId()));
         $oNewsletterTemplate->replaceIdentifier('newsletter_timestamp', $this->oNewsletter->getCreatedAt(null)->getTimestamp());
     }
     $oNewsletterTemplate->replaceIdentifier('recipient', TranslationPeer::getString('wns.newsletter.recipient', $this->oNewsletter->getLanguageId()));
     $oNewsletterTemplate->replaceIdentifier('subject', $this->oNewsletter->getSubject());
     $oNewsletterTemplate->render();
 }
Beispiel #4
0
 protected function preRender()
 {
     $oConstants = new Template('constants.js', array(DIRNAME_TEMPLATES, 'admin'));
     $oConstants->replaceIdentifier('current_admin_module', $this->sModuleName ? $this->sModuleName : self::DEFAULT_MODULE);
     $oConstants->replaceIdentifier('is_logged_in', Session::getSession()->isAuthenticated() && Session::getSession()->getUser()->getIsBackendLoginEnabled());
     $this->oResourceIncluder->addJavaScriptLibrary('jquery', self::JQUERY_VERSION);
     $this->oResourceIncluder->addCustomJs($oConstants);
     $this->oResourceIncluder->addJavaScriptLibrary('jqueryui', AdminManager::JQUERY_UI_VERSION);
     $this->oResourceIncluder->addResource('admin/admin-skeleton.css');
     $this->oResourceIncluder->addResource('admin/theme/jquery-ui-1.10.2.custom.min.css');
     $this->oResourceIncluder->addResource('widget/widget.css');
     $this->oResourceIncluder->addResource('admin/admin-ui.css');
     $this->oResourceIncluder->addResource('admin/print.css', null, null, array('media' => 'print'), ResourceIncluder::PRIORITY_NORMAL, null, true);
     $this->oResourceIncluder->addResource('widget/widget.js');
     $this->oResourceIncluder->addResource('widget/widget_skeleton.js');
     //Provides some basic overrides for tooltip, notifyuser and stuff
     $this->oResourceIncluder->addResource('admin/admin.js');
     $this->oResourceIncluder->addResource('admin/skeleton.js');
     $this->oResourceIncluder->addResource('backend/additions.js', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $this->oResourceIncluder->addResource('admin/additions.js', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $this->oResourceIncluder->addResource('backend/additions.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $this->oResourceIncluder->addResource('admin/additions.css', null, null, null, ResourceIncluder::PRIORITY_NORMAL, null, true);
     $oOutput = new XHTMLOutput('html5');
     $oOutput->render();
 }