function display($tpl = null) { $this->Application = JFactory::getApplication(); // Access the Component-wide default parameters, already overridden with those for the menu item (if applicable): //$this->cparams = $this->Application->getParams('com_foxcontact'); // Can't use getParams('com_foxcontact') because JRegistry::merge converts StdClass properties to arrays $this->cparams = $this->Application->getMenu()->getActive()->params; // Set Meta Description if ($description = $this->cparams->get('menu-meta_description')) { $this->document->setDescription($description); } // Set Meta Keywords if ($keywords = $this->cparams->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $keywords); } // Set robots (index, follow) if ($robots = $this->cparams->get('robots')) { $this->document->setMetadata('robots', $robots); } $foxDocument = FoxDocument::getInstance(); // User interface stylesheet $foxDocument->addResource(array("root" => "media", "filename" => "chosen", "type" => "css")); $foxDocument->addResource(array("root" => "media", "filename" => "bootstrap", "type" => "css")); // User selected stylesheet $stylesheet = $this->cparams->get("css", "bootstrap.css"); // Removes the extension part from the file name $stylesheet = preg_replace("/\\.[^.\\s]{3,4}\$/", "", $stylesheet); $foxDocument->addResource(array("root" => "components", "filename" => $stylesheet, "type" => "css")); $this->MessageBoard = new FoxMessageBoard(); $this->Submitter = new FSubmitter($this->cparams, $this->MessageBoard); $this->FieldsBuilder = new FieldsBuilder($this->cparams, $this->MessageBoard); $this->AjaxUploader = new FAjaxUploader($this->cparams, $this->MessageBoard); $this->Uploader = new FUploader($this->cparams, $this->MessageBoard); $this->FoxCaptcha = new FCaptcha($this->cparams, $this->MessageBoard); $this->JMessenger = new FJMessenger($this->cparams, $this->MessageBoard, $this->FieldsBuilder); $this->Antispam = new FAntispam($this->cparams, $this->MessageBoard, $this->FieldsBuilder); $this->Newsletter = new FNewsletter($this->cparams, $this->MessageBoard, $this->FieldsBuilder); $this->AcyMailing = new FAcyMailing($this->cparams, $this->MessageBoard, $this->FieldsBuilder); $this->JNews = new FJNewsSubscriber($this->cparams, $this->MessageBoard, $this->FieldsBuilder); $this->AdminMailer = new FAdminMailer($this->cparams, $this->MessageBoard, $this->FieldsBuilder); $this->SubmitterMailer = new FSubmitterMailer($this->cparams, $this->MessageBoard, $this->FieldsBuilder); $this->FormText .= $this->FieldsBuilder->Show(); $this->FormText .= $this->AjaxUploader->Show(); $this->FormText .= $this->AcyMailing->Show(); $this->FormText .= $this->JNews->Show(); $this->FormText .= $this->FoxCaptcha->Show(); $this->FormText .= $this->Antispam->Show(); $this->FormText .= $this->Submitter->Show(); switch (0) { case $this->Submitter->IsValid(): break; case $this->FieldsBuilder->IsValid(): break; case $this->AjaxUploader->IsValid(): break; case $this->Uploader->IsValid(): break; case $this->FoxCaptcha->IsValid(): break; case $this->Antispam->IsValid(): break; case $this->JMessenger->Process(): break; case $this->Newsletter->Process(): break; case $this->AcyMailing->Process(): break; case $this->JNews->Process(): break; case $this->AdminMailer->Process(): break; case $this->SubmitterMailer->Process(): break; default: // None of the previous checks are failed // Avoid to show the Form and the button again $this->FormText = ""; // Reset captcha solution in the session after reading, // avoiding further uses (abuses) of the same valid session, // in order to send tons of email $jsession = JFactory::getSession(); $fsession = new FSession($jsession->getId(), $this->Application->cid, $this->Application->mid); $fsession->PurgeValue("captcha_answer"); HeaderRedirect($this->cparams); } // Check for errors. if (count($errors = $this->get('Errors'))) { $this->Application->enqueueMessage(implode('<br />', $errors), 'error'); //return false; } // Display the view parent::display($tpl); }
case $fcaptcha->IsValid(): break; case $antispam->IsValid(): break; // Spam check passed or disabled // Spam check passed or disabled case $jMessenger->Process(): break; case $newsletter->Process(): break; case $acymailing->Process(): break; case $jnews->Process(): break; case $adminMailer->Process(): break; case $submitterMailer->Process(): break; default: // None of the previous checks are failed // Avoid to show the Form and the button again $form_text = ""; // Reset the solution of the captcha in the session after read, // avoiding further uses (abuses) of the same valid session, // in order to send tons of email $jsession = JFactory::getSession(); $fsession = new FSession($jsession->getId(), 0, $module->id); $fsession->PurgeValue("captcha_answer"); HeaderRedirect($params); } require JModuleHelper::getLayoutPath($app->scope, $params->get('layout', 'default'));
function display($tpl = null) { $this->Application = JFactory::getApplication(); // The following code will access the Component-wide default parameters, // already overridden with those for the menu item (if applicable): $this->cparams = $this->Application->getParams('com_foxcontact'); $this->Submitter = new FSubmitter($this->cparams, $this->messages); $this->FieldsBuilder = new FieldsBuilder($this->cparams, $this->messages); $this->AjaxUploader = new FAjaxUploader($this->cparams, $this->messages); $this->Uploader = new FUploader($this->cparams, $this->messages); $this->FoxCaptcha = new FCaptcha($this->cparams, $this->messages); $this->JMessenger = new FJMessenger($this->cparams, $this->messages, $this->FieldsBuilder); $this->Antispam = new FAntispam($this->cparams, $this->messages, $this->FieldsBuilder); $this->AdminMailer = new FAdminMailer($this->cparams, $this->messages, $this->FieldsBuilder); $this->SubmitterMailer = new FSubmitterMailer($this->cparams, $this->messages, $this->FieldsBuilder); // Build $FormText $this->FormText .= $this->FieldsBuilder->Show(); $this->FormText .= $this->AjaxUploader->Show(); $this->FormText .= $this->FoxCaptcha->Show(); $this->FormText .= $this->Antispam->Show(); // Usually we want the submit button at the bottom $this->FormText .= $this->Submitter->Show(); switch (0) { case $this->Submitter->IsValid(): break; case $this->FieldsBuilder->IsValid(): break; case $this->AjaxUploader->IsValid(): break; case $this->Uploader->IsValid(): break; case $this->FoxCaptcha->IsValid(): break; case $this->Antispam->IsValid(): break; // Spam check passed or disabled // Spam check passed or disabled case $this->JMessenger->Process(): break; case $this->AdminMailer->Process(): break; case $this->SubmitterMailer->Process(): break; default: // None of the previous checks are failed // Avoid to show the Form and the button again $this->FormText = ""; // Reset captcha solution in the session after read it, avoiding that a f****d lamer // abuse of the *same session* without request the captcha again, to send tons of email $jsession = JFactory::getSession(); $fsession = new FSession($jsession->getId(), $this->Application->cid, $this->Application->mid); $fsession->PurgeValue("captcha_answer"); HeaderRedirect($this->cparams); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Display the view parent::display($tpl); }