Example #1
0
 public function __construct(&$params, FoxMessageBoard &$messageboard)
 {
     parent::__construct($params, $messageboard);
     $this->ValidateEmail();
     // email can have text without being valid
     // Load resources only once
     static $resources = true;
     if ($resources) {
         // The easy way to include chosen. It taunts the page source with tons of embedded javascripts.
         // JHtml::_("jquery.framework"); // jquery
         // JHtml::_('behavior.framework', true); // mootools
         // JHtml::_('formbehavior.chosen', 'select'); // chosen
         // We need jQuery to be loaded before our scripts
         JHtml::_("jquery.framework");
         $foxDocument = FoxDocument::getInstance();
         $foxDocument->addResource(array("root" => "components", "filename" => "foxtext", "type" => "js"));
         // Prevent further load of the same resources
         $resources = false;
     }
     $this->isvalid = intval($this->ValidateForm());
     // Are all fields valid?
     $lang_handler = new FLangHandler();
     if ($lang_handler->HasMessages()) {
         $messageboard->Append($lang_handler->GetMessages(), FoxMessageBoard::warning);
     }
     $conflict = new FoxConflicting();
     if ($conflict->HasMessages()) {
         $messageboard->Append($conflict->GetMessages(), FoxMessageBoard::warning);
     }
 }
Example #2
0
 public function __construct(&$params, FoxMessageBoard &$messageboard)
 {
     parent::__construct($params, $messageboard);
     $this->ValidateEmail();
     // email can have text without being valid
     // Load required js only once
     if (!isset($GLOBALS[$GLOBALS["ext_name"] . '_js_loaded'])) {
         // The easy way to include chosen. It taunts the page source with tons of embedded javascripts.
         // JHtml::_("jquery.framework"); // jquery
         // JHtml::_('behavior.framework', true); // mootools
         // JHtml::_('formbehavior.chosen', 'select'); // chosen
         // We need jQuery to be loaded before our scripts
         JHtml::_("jquery.framework");
         $foxDocument = FoxDocument::getInstance();
         $min = JFactory::getConfig()->get("debug") ? "" : ".min";
         $foxDocument->addResource(array("root" => "components", "filename" => "jtext", "type" => "js"));
         $foxDocument->addScript(JUri::base(true) . "/components/" . $GLOBALS["com_name"] . "/js/fileuploader" . $min . ".js");
         $document = JFactory::getDocument();
         // chosen.jquery requires core for Joomla.JText
         $uncompressed = JFactory::getConfig()->get("debug") ? "-uncompressed" : "";
         $document->addScript(JUri::base(true) . "/media/system/js/core" . $uncompressed . ".js");
         $document->addScript(JUri::base(true) . "/media/jui/js/chosen.jquery" . $min . ".js");
         $GLOBALS[$GLOBALS["ext_name"] . '_js_loaded'] = true;
     }
     $this->isvalid = intval($this->ValidateForm());
     // Are all fields valid?
     $lang_handler = new FLangHandler();
     if ($lang_handler->HasMessages()) {
         $messageboard->Append($lang_handler->GetMessages(), FoxMessageBoard::warning);
     }
     $conflict = new FoxConflicting();
     if ($conflict->HasMessages()) {
         $messageboard->Append($conflict->GetMessages(), FoxMessageBoard::warning);
     }
 }
require_once $helpdir . "messageboard.php";
require_once $helpdir . "document.php";
// Dispatchers
$dispatchers_dir = $helpdir . "dispatchers/";
require_once $dispatchers_dir . "fadminmailer.php";
require_once $dispatchers_dir . "fsubmittermailer.php";
require_once $dispatchers_dir . "fjmessenger.php";
require_once $dispatchers_dir . "database.php";
$libsdir = JPATH_BASE . "/components/com_foxcontact/lib/";
include_once $libsdir . 'functions.php';
// Disable EmailCloak plugin. It only hurts when loaded using loadposition. Successful tested with Modules Anywhere.
// $scope is set in libraries/cms/module/helper.php
if (isset($scope) && $scope == "com_content") {
    echo "<!--{emailcloak=off}-->";
}
$foxDocument = FoxDocument::getInstance();
// User interface stylesheet
$foxDocument->addResource(array("root" => "media", "filename" => "foxcontact", "type" => "css"));
// User selected stylesheet
$stylesheet = $params->get("css", "bootstrap.css");
$stylesheet = preg_replace("/\\.[^.\\s]{3,4}\$/", "", $stylesheet);
$foxDocument->addResource(array("root" => "components", "filename" => $stylesheet, "type" => "css"));
//$link = FGetLink(NULL, "#mid_" . $module->id);
// FGetLink doesn't work for blog view -> article, because active page is always blog view even if you are into an article
$action = $app->input->server->get("REQUEST_URI", "", "string") . "#mid_" . $module->id;
// Load component language in addition
$language = JFactory::getLanguage();
// Reload the default language (en-GB)
$language->load($GLOBALS["com_name"], JPATH_SITE, $language->getDefault(), true);
// Reload current language, overwriting nearly all the strings, but keeping the english version for untranslated strings
$language->load($GLOBALS["com_name"], JPATH_SITE, null, true);
Example #4
0
 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" => "foxcontact", "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->FoxCaptcha = new FCaptcha($this->cparams, $this->MessageBoard);
     $this->JMessenger = new FJMessenger($this->cparams, $this->MessageBoard, $this->FieldsBuilder);
     $this->DatabaseDispatcher = new DatabaseDispatcher($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->FoxCaptcha->IsValid():
             break;
         case $this->Antispam->IsValid():
             break;
         case $this->JMessenger->Process():
             break;
         case $this->DatabaseDispatcher->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 the solution of the captcha in the session after read, avoiding further (ab)uses of the same valid session
             $jsession = JFactory::getSession();
             $namespace = "foxcontact_component_" . $this->Application->cid;
             $jsession->clear("captcha_answer", $namespace);
             HeaderRedirect($this->cparams);
     }
     // Display the view
     parent::display($tpl);
 }