protected function init() { $this->fieldName = $_GET['field']; $this->uploadedFileName = $_GET['uploadedFileName']; if (isset($_GET['pid'])) { $this->id = intval($_GET['pid']); } else { $this->id = intval($_GET['id']); } $this->componentManager = Tx_Formhandler_Component_Manager::getInstance(); tslib_eidtools::connectDB(); $this->initializeTSFE($this->id); Tx_Formhandler_Globals::$cObj = $GLOBALS['TSFE']->cObj; $randomID = t3lib_div::_GP('randomID'); Tx_Formhandler_Globals::$randomID = $randomID; if (!Tx_Formhandler_Globals::$session) { $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.']; $sessionClass = 'Tx_Formhandler_Session_PHP'; if ($ts['session.']) { $sessionClass = Tx_Formhandler_StaticFuncs::prepareClassName($ts['session.']['class']); } Tx_Formhandler_Globals::$session = $this->componentManager->getComponent($sessionClass); } $this->settings = Tx_Formhandler_Globals::$session->get('settings'); //init ajax if ($this->settings['ajax.']) { $class = $this->settings['ajax.']['class']; if (!$class) { $class = 'Tx_Formhandler_AjaxHandler_JQuery'; } $class = Tx_Formhandler_StaticFuncs::prepareClassName($class); $ajaxHandler = $this->componentManager->getComponent($class); Tx_Formhandler_Globals::$ajaxHandler = $ajaxHandler; $ajaxHandler->init($this->settings['ajax.']['config.']); $ajaxHandler->initAjax(); } }
protected function init() { $this->settings = $this->getSettings(); $this->formValuesPrefix = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'formValuesPrefix'); Tx_Formhandler_Globals::$formID = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'formID'); Tx_Formhandler_Globals::$formValuesPrefix = $this->formValuesPrefix; //set debug mode $isDebugMode = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'debug'); $this->debugMode = intval($isDebugMode) === 1; $sessionClass = 'Tx_Formhandler_Session_PHP'; if ($this->settings['session.']) { $sessionClass = Tx_Formhandler_StaticFuncs::prepareClassName($this->settings['session.']['class']); } Tx_Formhandler_Globals::$session = $this->componentManager->getComponent($sessionClass); $this->gp = Tx_Formhandler_Staticfuncs::getMergedGP(); $randomID = $this->gp['randomID']; if (!$randomID) { $randomID = Tx_Formhandler_StaticFuncs::generateRandomID(); } Tx_Formhandler_Globals::$randomID = $randomID; $action = t3lib_div::_GP('action'); if (Tx_Formhandler_Globals::$formValuesPrefix) { $temp = t3lib_div::_GP(Tx_Formhandler_Globals::$formValuesPrefix); $action = $temp['action']; } if (Tx_Formhandler_Globals::$session->get('finished') && !$action) { Tx_Formhandler_Globals::$session->reset(); unset($_GET[Tx_Formhandler_Globals::$formValuesPrefix]); unset($_GET['id']); Tx_Formhandler_StaticFuncs::doRedirect($GLOBALS['TSFE']->id, FALSE, $_GET); exit; } $this->parseConditions(); $this->initializeDebuggers(); $this->getStepInformation(); $currentStepFromSession = Tx_Formhandler_Globals::$session->get('currentStep'); $prevStep = $currentStepFromSession; if (intval($prevStep) !== intval($currentStepFromSession)) { $this->currentStep = 1; $this->lastStep = 1; Tx_Formhandler_StaticFuncs::throwException('You messed with the steps!'); } $this->mergeGPWithSession(FALSE, $this->currentStep); $this->parseConditions(); //read template file $this->templateFile = Tx_Formhandler_StaticFuncs::readTemplateFile($this->templateFile, $this->settings); Tx_Formhandler_Globals::$templateCode = $this->templateFile; $this->langFiles = Tx_Formhandler_StaticFuncs::readLanguageFiles($this->langFiles, $this->settings); Tx_Formhandler_Globals::$langFiles = $this->langFiles; $this->validateConfig(); Tx_Formhandler_Globals::$settings = $this->settings; //set debug mode again cause it may have changed in specific step settings $this->debugMode = intval($this->settings['debug']) === 1; Tx_Formhandler_Globals::$session->set('debug', $this->debugMode); Tx_Formhandler_StaticFuncs::debugMessage('using_prefix', array($this->formValuesPrefix)); //init view $viewClass = $this->settings['view']; if (!$viewClass) { $viewClass = 'Tx_Formhandler_View_Form'; } Tx_Formhandler_StaticFuncs::debugMessage('using_view', array($viewClass)); Tx_Formhandler_StaticFuncs::debugMessage('current_gp', array(), 1, $this->gp); $this->storeSettingsInSession(); $this->mergeGPWithSession(FALSE, $this->currentStep); //set submitted $this->submitted = $this->isFormSubmitted(); if (!$this->submitted) { $this->reset(); } // set stylesheet file(s) $this->addCSS(); // add JavaScript file(s) $this->addJS(); Tx_Formhandler_StaticFuncs::debugMessage('current_session_params', array(), 1, (array) Tx_Formhandler_Globals::$session->get('values')); $viewClass = Tx_Formhandler_StaticFuncs::prepareClassName($viewClass); $this->view = $this->componentManager->getComponent($viewClass); $this->view->setLangFiles($this->langFiles); $this->view->setSettings($this->settings); Tx_Formhandler_Globals::$gp = $this->gp; //init ajax if ($this->settings['ajax.']) { $class = $this->settings['ajax.']['class']; if (!$class) { $class = 'Tx_Formhandler_AjaxHandler_JQuery'; } Tx_Formhandler_StaticFuncs::debugMessage('using_ajax', array($class)); $class = Tx_Formhandler_StaticFuncs::prepareClassName($class); $ajaxHandler = $this->componentManager->getComponent($class); Tx_Formhandler_Globals::$ajaxHandler = $ajaxHandler; $ajaxHandler->init($this->settings['ajax.']['config.']); $ajaxHandler->initAjax(); } if (!$this->gp['randomID']) { $this->gp['randomID'] = Tx_Formhandler_Globals::$randomID; } }
public function loadConfig() { if (!Tx_Formhandler_Globals::$session) { $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.']; $sessionClass = 'Tx_Formhandler_Session_PHP'; if ($ts['session.']) { $sessionClass = Tx_Formhandler_StaticFuncs::prepareClassName($ts['session.']['class']); } Tx_Formhandler_Globals::$session = $this->componentManager->getComponent($sessionClass); } $tsConfig = Tx_Formhandler_Globals::$session->get('settings'); $this->settings = array(); if ($tsConfig['validators.']) { foreach ($tsConfig['validators.'] as $idx => $settings) { if (is_array($settings['config.'])) { $this->settings = array_merge($this->settings, $settings['config.']); } } } }