public function __construct()
 {
     tslib_eidtools::connectDB();
     tslib_eidtools::initFeUser();
     tslib_eidtools::initLanguage();
     tslib_eidtools::initTCA();
 }
 /**
  * Initializes the instance of this class.
  */
 public function __construct()
 {
     $params = unserialize(base64_decode(t3lib_div::_GP('data')));
     if (is_array($params)) {
         $this->pageId = $params['id'];
         $this->parameters = $params['parameters'];
     }
     if (method_exists('tslib_eidtools', 'initTCA')) {
         tslib_eidtools::initTCA();
     }
     tslib_eidtools::connectDB();
 }
示例#3
0
 function init()
 {
     $value = t3lib_div::_GP("value");
     $value = stripslashes(str_replace('\\n', '###FORMIDABLECR###', $value));
     $value = str_replace("###FORMIDABLECR###", '\\n', $value);
     $context = t3lib_div::_GP("context");
     $context = stripslashes(str_replace('\\n', '###FORMIDABLECR###', $context));
     $context = str_replace("###FORMIDABLECR###", '\\n', $context);
     $this->aRequest = array("safelock" => t3lib_div::_GP("safelock"), "sessionhash" => t3lib_div::_GP("sessionhash"), "object" => t3lib_div::_GP("object"), "servicekey" => t3lib_div::_GP("servicekey"), "eventid" => t3lib_div::_GP("eventid"), "serviceid" => t3lib_div::_GP("serviceid"), "value" => $value, "context" => $context, "formid" => t3lib_div::_GP("formid"), "thrower" => t3lib_div::_GP("thrower"), "arguments" => t3lib_div::_GP("arguments"), "trueargs" => t3lib_div::_GP("trueargs"));
     if (array_key_exists("_SESSION", $GLOBALS) && array_key_exists("ameos_formidable", $GLOBALS["_SESSION"])) {
         if (array_key_exists($this->aRequest["object"], $GLOBALS["TYPO3_CONF_VARS"]["EXTCONF"]["ameos_formidable"]["ajax_services"])) {
             if (array_key_exists($this->aRequest["servicekey"], $GLOBALS["TYPO3_CONF_VARS"]["EXTCONF"]["ameos_formidable"]["ajax_services"][$this->aRequest["object"]])) {
                 // requested service exists
                 if (array_key_exists($this->aRequest["sessionhash"], $GLOBALS["_SESSION"]["ameos_formidable"]["hibernate"])) {
                     if (array_key_exists($this->aRequest["safelock"], $GLOBALS["_SESSION"]["ameos_formidable"]["ajax_services"][$this->aRequest["object"]][$this->aRequest["servicekey"]])) {
                         // valid session data
                         // proceed then
                         tslib_eidtools::connectDB();
                         if (method_exists('tslib_eidtools', 'initTCA')) {
                             tslib_eidtools::initTCA();
                         }
                         $this->aConf =& $GLOBALS["TYPO3_CONF_VARS"]["EXTCONF"]["ameos_formidable"]["ajax_services"][$this->aRequest["object"]][$this->aRequest["servicekey"]]["conf"];
                         $this->aSession =& $GLOBALS["_SESSION"]["ameos_formidable"]["ajax_services"][$this->aRequest["object"]][$this->aRequest["servicekey"]][$this->aRequest["safelock"]];
                         $this->aHibernation =& $GLOBALS["_SESSION"]["ameos_formidable"]["hibernate"][$this->aRequest["sessionhash"]];
                         require_once PATH_formidable . "api/class.tx_ameosformidable.php";
                         $this->oForm =& tx_ameosformidable::unHibernate($this->aHibernation);
                         $this->oForm->cObj = t3lib_div::makeInstance('\\TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                         if ($this->aConf["virtualizeFE"]) {
                             $this->oForm->__virtualizeFE($this->aHibernation["tsfe_config"]);
                             $GLOBALS["TSFE"]->config = $this->aHibernation["tsfe_config"];
                             $GLOBALS["TSFE"]->tmpl->setup["config."]["sys_language_uid"] = $this->aHibernation["sys_language_uid"];
                             $GLOBALS["TSFE"]->tmpl->setup["config."]["tx_ameosformidable."] = $this->aHibernation["formidable_tsconfig"];
                             $GLOBALS["TSFE"]->sys_language_uid = $this->aHibernation["sys_language_uid"];
                             $GLOBALS["TSFE"]->sys_language_content = $this->aHibernation["sys_language_content"];
                             $GLOBALS["TSFE"]->lang = $this->aHibernation["lang"];
                             $GLOBALS["TSFE"]->id = $this->aHibernation["pageid"];
                             $GLOBALS["TSFE"]->spamProtectEmailAddresses = $this->aHibernation["spamProtectEmailAddresses"];
                             $GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst'] = $this->aHibernation["spamProtectEmailAddresses_atSubst"];
                             $GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst'] = $this->aHibernation["spamProtectEmailAddresses_lastDotSubst"];
                         }
                         if ($this->aConf["initBEuser"]) {
                             $this->_initBeUser();
                         }
                         $aRdtKeys = array_keys($this->oForm->aORenderlets);
                         reset($aRdtKeys);
                         while (list(, $sKey) = each($aRdtKeys)) {
                             if (is_object($this->oForm->aORenderlets[$sKey])) {
                                 $this->oForm->aORenderlets[$sKey]->awakeInSession($this->oForm);
                             } else {
                                 //debug($sKey);
                             }
                         }
                         reset($this->oForm->aODataSources);
                         while (list($sKey, ) = each($this->oForm->aODataSources)) {
                             $this->oForm->aODataSources[$sKey]->awakeInSession($this->oForm);
                         }
                         $sAjaxCharset = strtoupper($this->oForm->getAjaxCharset());
                         // pas de distinction entre "iso" et "ISO"
                         $bIsIso = strpos($sAjaxCharset, 'ISO') !== FALSE;
                         $bIsLatin = strpos($sAjaxCharset, 'LATIN') !== FALSE;
                         if ($bIsIso || $bIsLatin) {
                             // Source was in ISO charset. Since we always receive Ajax data in UTF-8, we know how to get it back to ISO:
                             $this->aRequest['context'] = utf8_decode($this->aRequest['context']);
                             $this->aRequest['value'] = utf8_decode($this->aRequest['value']);
                             $this->aRequest['trueargs'] = utf8_decode($this->aRequest['trueargs']);
                         }
                         $this->aRequest["params"] = $this->oForm->json2array($this->aRequest["value"]);
                         $this->aRequest["trueargs"] = $this->oForm->json2array($this->aRequest["trueargs"]);
                         $this->aRequest["context"] = $this->oForm->json2array($this->aRequest["context"]);
                         return TRUE;
                     } else {
                         $this->denyService("no safelock");
                     }
                 } else {
                     $this->denyService("no hibernate; Check: that you have cookies enabled; that the formidable is NOT CACHED;");
                 }
             } else {
                 $this->denyService("no service key");
             }
         } else {
             $this->denyService("no object");
         }
     } else {
         $this->denyService("SESSION is not started !");
     }
     // reject invalid request
     return FALSE;
 }