10402_v3.patch
| Classes/Finisher/Tx_Formhandler_Finisher_SubmittedOK.php (working copy) | ||
|---|---|---|
| 46 | 46 |
|
| 47 | 47 |
//set session value to prevent another validation or finisher circle. Formhandler will call only this Finisher if the user reloads the page. |
| 48 | 48 |
Tx_Formhandler_Session::set('submittedOK', TRUE);
|
| 49 |
|
|
| 50 |
$action = $this->gp['action']; |
|
| 51 |
if($action) {
|
|
| 52 |
|
|
| 53 |
$this->processAction($action); |
|
| 54 |
} |
|
| 55 | 49 | |
| 56 | 50 |
//read template file |
| 57 | 51 |
$this->templateFile = Tx_Formhandler_Globals::$templateCode; |
| ... | ... | |
| 72 | 66 |
$view->setComponentSettings($this->settings); |
| 73 | 67 |
return $view->render($this->gp, array()); |
| 74 | 68 |
} |
| 75 |
|
|
| 76 |
protected function processAction($action) {
|
|
| 77 |
if(is_array($this->settings['actions.'])) {
|
|
| 78 |
foreach($this->settings['actions.'] as $key=>$options) {
|
|
| 79 |
if(strpos($key, '.') !== FALSE) {
|
|
| 80 |
$currentAction = str_replace('.', '', $key);
|
|
| 81 |
if($currentAction === $action) {
|
|
| 82 |
$class = $options['class']; |
|
| 83 |
if($class) {
|
|
| 84 |
$class = Tx_Formhandler_StaticFuncs::prepareClassName($class); |
|
| 85 |
$object = $this->componentManager->getComponent($class); |
|
| 86 |
$object->init($this->gp, $options['config.']); |
|
| 87 |
$object->process(); |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
} |
|
| 91 |
} |
|
| 92 |
} |
|
| 93 |
} |
|
| 94 | 69 | |
| 95 | 70 |
} |
| 96 | 71 |
?> |
| Classes/Finisher/Tx_Formhandler_Finisher_Mail.php (working copy) | ||
|---|---|---|
| 52 | 52 |
* finishers.2.config.user.attachment = fileadmin/files/file.txt,picture |
| 53 | 53 |
* |
| 54 | 54 |
* # attaches a PDF file with submitted values |
| 55 |
* finishers.2.config.user.attachPDF.class = Tx_Formhandler_Generator_PDF |
|
| 55 |
* finishers.2.config.user.attachPDF.class = Tx_Formhandler_Generator_TcPdf |
|
| 56 | 56 |
* finishers.2.config.user.attachPDF.exportFields = firstname,lastname,email,interests,pid,submission_date,ip |
| 57 | 57 |
* |
| 58 | 58 |
* #configure how the attached files are prefixes (PDF/HTML). |
| Classes/Logger/Tx_Formhandler_Logger_DB.php (working copy) | ||
|---|---|---|
| 56 | 56 |
//query the database |
| 57 | 57 |
$res = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $fields); |
| 58 | 58 |
$insertedUID = $GLOBALS['TYPO3_DB']->sql_insert_id(); |
| 59 |
$lastId = Tx_Formhandler_Session::set('inserted_uid', $insertedUID);
|
|
| 60 | ||
| 59 |
Tx_Formhandler_Session::set('inserted_uid', $insertedUID);
|
|
| 60 |
Tx_Formhandler_Session::set('inserted_tstamp', $fields['tstamp']);
|
|
| 61 |
Tx_Formhandler_Session::set('key_hash', $hash);
|
|
| 61 | 62 |
if(!$this->settings['nodebug']) {
|
| 62 | 63 |
Tx_Formhandler_StaticFuncs::debugMessage('logging', $table, implode(',', $fields));
|
| 63 | 64 |
if(strlen($GLOBALS['TYPO3_DB']->sql_error()) > 0) {
|
| Classes/Controller/Tx_Formhandler_Controller_Form.php (working copy) | ||
|---|---|---|
| 183 | 183 |
|
| 184 | 184 |
$this->processFileRemoval(); |
| 185 | 185 | |
| 186 |
//not submitted |
|
| 187 |
if(!$this->submitted) {
|
|
| 188 |
|
|
| 186 |
$action = t3lib_div::_GP('action');
|
|
| 187 |
if(Tx_Formhandler_Globals::$formValuesPrefix) {
|
|
| 188 |
$temp = t3lib_div::_GP(Tx_Formhandler_Globals::$formValuesPrefix); |
|
| 189 |
$action = $temp['action']; |
|
| 190 |
} |
|
| 191 |
if($action) {
|
|
| 192 |
$this->processAction($action); |
|
| 193 |
} |
|
| 194 |
|
|
| 195 |
if($this->submittedOK) {
|
|
| 196 |
return $this->processSubmittedOK(); |
|
| 197 |
} elseif(!$this->submitted) {
|
|
| 189 | 198 |
return $this->processNotSubmitted(); |
| 190 |
|
|
| 191 |
//submitted |
|
| 192 | 199 |
} else {
|
| 193 |
if($this->submittedOK) {
|
|
| 194 |
|
|
| 195 |
return $this->processSubmittedOK(); |
|
| 200 |
return $this->processSubmitted(); |
|
| 201 |
} |
|
| 196 | 202 | |
| 197 |
} else {
|
|
| 198 |
|
|
| 199 |
return $this->processSubmitted(); |
|
| 200 |
|
|
| 203 |
} |
|
| 204 |
|
|
| 205 |
protected function processAction($action) {
|
|
| 206 |
$gp = $_GET; |
|
| 207 |
if(Tx_Formhandler_Globals::$formValuesPrefix) {
|
|
| 208 |
$gp = t3lib_div::_GP(Tx_Formhandler_Globals::$formValuesPrefix); |
|
| 209 |
} |
|
| 210 |
if(is_array($this->settings['finishers.'])) {
|
|
| 211 |
$finisherConf = array(); |
|
| 212 |
foreach($this->settings['finishers.'] as $key => $config) {
|
|
| 213 |
if(strpos($key, '.') !== FALSE) {
|
|
| 214 |
$className = Tx_Formhandler_StaticFuncs::prepareClassName($config['class']); |
|
| 215 |
if($className === 'Tx_Formhandler_Finisher_SubmittedOK' && is_array($config['config.']['actions.'])) {
|
|
| 216 |
$finisherConf = $config['config.']['actions.']; |
|
| 217 |
} |
|
| 218 |
} |
|
| 219 |
} |
|
| 220 |
if($finisherConf[$action . '.']) {
|
|
| 221 |
$tstamp = $GLOBALS['TYPO3_DB']->fullQuoteStr($gp['tstamp']); |
|
| 222 |
$hash = $GLOBALS['TYPO3_DB']->fullQuoteStr($gp['hash']); |
|
| 223 |
if($tstamp && $hash) {
|
|
| 224 |
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('params', 'tx_formhandler_log', 'tstamp=' . $tstamp . ' AND key_hash=' . $hash);
|
|
| 225 |
if($res && $GLOBALS['TYPO3_DB']->sql_num_rows($res) === 1) {
|
|
| 226 |
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); |
|
| 227 |
$GLOBALS['TYPO3_DB']->sql_free_result($res); |
|
| 228 |
$params = unserialize($row['params']); |
|
| 229 |
$class = $finisherConf[$action . '.']['class']; |
|
| 230 |
if($class) {
|
|
| 231 |
$class = Tx_Formhandler_StaticFuncs::prepareClassName($class); |
|
| 232 |
$object = $this->componentManager->getComponent($class); |
|
| 233 |
$object->init($params, $finisherConf[$action . '.']['config.']); |
|
| 234 |
$object->process(); |
|
| 235 |
} |
|
| 236 |
} |
|
| 237 |
} |
|
| 201 | 238 |
} |
| 202 | 239 |
} |
| 203 | ||
| 204 | 240 |
} |
| 205 | 241 |
|
| 206 | 242 |
protected function processSubmitted() {
|
| ... | ... | |
| 445 | 481 |
} |
| 446 | 482 |
|
| 447 | 483 |
protected function processSubmittedOK() {
|
| 484 |
|
|
| 485 |
$gp = $_GET; |
|
| 486 |
if(Tx_Formhandler_Globals::$formValuesPrefix) {
|
|
| 487 |
$gp = t3lib_div::_GP(Tx_Formhandler_Globals::$formValuesPrefix); |
|
| 488 |
} |
|
| 489 |
$tstamp = $GLOBALS['TYPO3_DB']->fullQuoteStr($gp['tstamp']); |
|
| 490 |
$hash = $GLOBALS['TYPO3_DB']->fullQuoteStr($gp['hash']); |
|
| 491 |
if($tstamp && $hash) {
|
|
| 492 |
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('params', 'tx_formhandler_log', 'tstamp=' . $tstamp . ' AND key_hash=' . $hash);
|
|
| 493 |
if($res && $GLOBALS['TYPO3_DB']->sql_num_rows($res) === 1) {
|
|
| 494 |
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); |
|
| 495 |
$GLOBALS['TYPO3_DB']->sql_free_result($res); |
|
| 496 |
$this->gp = unserialize($row['params']); |
|
| 497 |
} |
|
| 498 |
} |
|
| 499 |
|
|
| 448 | 500 |
$this->loadSettingsForStep($this->currentStep); |
| 449 | 501 |
$this->parseConditions(); |
| 450 | 502 |
$this->view->setLangFiles($this->langFiles); |
| ... | ... | |
| 781 | 833 |
Tx_Formhandler_Session::set('startblock', NULL);
|
| 782 | 834 |
Tx_Formhandler_Session::set('endblock', NULL);
|
| 783 | 835 |
Tx_Formhandler_Session::set('currentStep', 1);
|
| 836 |
Tx_Formhandler_Session::set('inserted_uid', NULL);
|
|
| 837 |
Tx_Formhandler_Session::set('inserted_tstamp', NULL);
|
|
| 838 |
Tx_Formhandler_Session::set('key_hash', NULL);
|
|
| 784 | 839 |
$this->gp = array(); |
| 840 |
$this->currentStep = 1; |
|
| 785 | 841 |
Tx_Formhandler_Globals::$gp = $this->gp; |
| 786 | 842 |
Tx_Formhandler_StaticFuncs::debugMessage('cleared_session');
|
| 787 | 843 |
} |
| ... | ... | |
| 1042 | 1098 |
$this->submittedOK = Tx_Formhandler_Session::get('submittedOK');
|
| 1043 | 1099 |
|
| 1044 | 1100 |
if(!$this->submittedOK) {
|
| 1101 |
$this->submittedOK = $this->gp['submitted_ok']; |
|
| 1102 |
} |
|
| 1103 |
|
|
| 1104 |
if(!$this->submittedOK) {
|
|
| 1045 | 1105 |
$this->submittedOK = t3lib_div::_GP('submitted_ok');
|
| 1046 | 1106 |
} |
| 1047 | 1107 |
|
| Classes/Generator/FE/Tx_Formhandler_Generator_PdfGenerator.php (working copy) | ||
|---|---|---|
| 10 | 10 |
public function process() {
|
| 11 | 11 |
|
| 12 | 12 |
} |
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
public function getLink($linkGP) {
|
|
| 17 |
$params = array(); |
|
| 18 | 13 | |
| 19 |
$url = Tx_Formhandler_StaticFuncs::getHostname() . $this->cObj->getTypolink_URL($GLOBALS['TSFE']->id, $linkGP); |
|
| 20 | ||
| 21 |
$target = '_blank'; |
|
| 22 |
if($this->settings['target']) {
|
|
| 23 |
$target = $this->settings['target']; |
|
| 24 |
} |
|
| 25 | ||
| 26 |
$type = 123; |
|
| 27 |
if($this->settings['type']) {
|
|
| 28 |
$type = $this->settings['type']; |
|
| 29 |
} |
|
| 30 | ||
| 31 |
$params = array( |
|
| 32 |
'type' => $type, |
|
| 33 |
'no_cache' => 1, |
|
| 34 |
'submitted_ok' => 1 |
|
| 35 |
); |
|
| 36 | ||
| 37 |
$params = array_merge($params, $linkGP); |
|
| 38 | ||
| 39 |
return $this->cObj->getTypolink('PDF', $GLOBALS['TSFE']->id, $params, $target);
|
|
| 14 |
protected function getComponentLinkParams($linkGP) {
|
|
| 15 |
$prefix = Tx_Formhandler_Globals::$formValuesPrefix; |
|
| 16 |
$type = 123; |
|
| 17 |
if($this->settings['type']) {
|
|
| 18 |
$type = $this->settings['type']; |
|
| 19 |
} |
|
| 20 |
$params = array(); |
|
| 21 |
if($prefix) {
|
|
| 22 |
$params[$prefix] = array( |
|
| 23 |
'submitted_ok' => 1 |
|
| 24 |
); |
|
| 25 |
} else {
|
|
| 26 |
$params['submitted_ok'] = 1; |
|
| 27 |
} |
|
| 28 |
$params['type'] = $type; |
|
| 29 |
return $params; |
|
| 40 | 30 |
} |
| 31 | ||
| 41 | 32 |
} |
| 42 | 33 | |
| 43 | 34 |
?> |
| Classes/Generator/FE/Tx_Formhandler_Generator_TcPdf.php (working copy) | ||
|---|---|---|
| 64 | 64 |
} |
| 65 | 65 |
$downloadpath = str_replace(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '', $downloadpath);
|
| 66 | 66 |
header('Location: ' . $downloadpath);
|
| 67 |
exit; |
|
| 67 | 68 |
} else {
|
| 68 |
$this->pdf->Output('formhandler.pdf','I');
|
|
| 69 |
|
|
| 69 |
$this->pdf->Output('formhandler.pdf','D');
|
|
| 70 |
exit; |
|
| 70 | 71 |
} |
| 71 | 72 |
} |
| 72 | 73 |
|
| 73 |
public function getLink($linkGP) {
|
|
| 74 |
$linkGP = array(); |
|
| 74 |
protected function getComponentLinkParams($linkGP) {
|
|
| 75 | 75 |
$prefix = Tx_Formhandler_Globals::$formValuesPrefix; |
| 76 |
|
|
| 77 |
$target = '_blank'; |
|
| 78 |
if($this->settings['target']) {
|
|
| 79 |
$target = $this->settings['target']; |
|
| 80 |
} |
|
| 81 |
|
|
| 76 |
$tempParams = array( |
|
| 77 |
'action' => 'pdf' |
|
| 78 |
); |
|
| 79 |
$params = array(); |
|
| 82 | 80 |
if($prefix) {
|
| 83 |
$linkGP[$prefix]['action'] = 'pdf'; |
|
| 84 |
$linkGP[$prefix]['submitted'] = '1'; |
|
| 85 |
$linkGP[$prefix]['submitted_ok'] = '1'; |
|
| 81 |
$params[$prefix] = $tempParams; |
|
| 86 | 82 |
} else {
|
| 87 |
$linkGP['action'] = 'pdf'; |
|
| 88 |
$linkGP['submitted'] = '1'; |
|
| 89 |
$linkGP['submitted_ok'] = '1'; |
|
| 83 |
$params = $tempParams; |
|
| 90 | 84 |
} |
| 91 |
$linkGP['no_cache'] = 1; |
|
| 92 |
$linkGP['dontReset'] = 1; |
|
| 93 |
|
|
| 94 | ||
| 95 |
return $this->cObj->getTypolink('PDF', $GLOBALS['TSFE']->id, $linkGP, $target);
|
|
| 85 |
return $params; |
|
| 96 | 86 |
} |
| 97 | 87 |
} |
| 98 | 88 | |
| Classes/Generator/FE/Tx_Formhandler_Generator_Csv.php (working copy) | ||
|---|---|---|
| 10 | 10 |
public function process() {
|
| 11 | 11 |
$params = $this->gp; |
| 12 | 12 |
require_once(t3lib_extMgm::extPath('formhandler') . 'Resources/PHP/parsecsv.lib.php');
|
| 13 | ||
| 13 |
$exportParams = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'exportParams'); |
|
| 14 |
if(!is_array($exportParams)) {
|
|
| 15 |
$exportParams = t3lib_div::trimExplode(',', $exportParams);
|
|
| 16 |
} |
|
| 14 | 17 |
//build data |
| 15 | 18 |
foreach($params as $key => &$value) {
|
| 16 | 19 |
if(is_array($value)) {
|
| ... | ... | |
| 24 | 27 | |
| 25 | 28 |
// create new parseCSV object. |
| 26 | 29 |
$csv = new parseCSV(); |
| 27 |
$csv->output('formhandler.csv', $data, $exportParams);
|
|
| 30 |
$csv->output('formhandler.csv', $data, $params);
|
|
| 28 | 31 |
die(); |
| 29 | 32 |
} |
| 30 |
|
|
| 31 |
public function getLink($linkGP) {
|
|
| 32 |
$linkGP = array(); |
|
| 33 | ||
| 34 |
protected function getComponentLinkParams($linkGP) {
|
|
| 33 | 35 |
$prefix = Tx_Formhandler_Globals::$formValuesPrefix; |
| 36 |
$tempParams = array( |
|
| 37 |
'action' => 'csv' |
|
| 38 |
); |
|
| 39 |
$params = array(); |
|
| 34 | 40 |
if($prefix) {
|
| 35 |
$linkGP[$prefix]['action'] = 'csv'; |
|
| 36 |
$linkGP[$prefix]['submitted'] = '1'; |
|
| 37 |
$linkGP[$prefix]['submitted_ok'] = '1'; |
|
| 41 |
$params[$prefix] = $tempParams; |
|
| 38 | 42 |
} else {
|
| 39 |
$linkGP['action'] = 'csv'; |
|
| 40 |
$linkGP['submitted'] = '1'; |
|
| 41 |
$linkGP['submitted_ok'] = '1'; |
|
| 43 |
$params = $tempParams; |
|
| 42 | 44 |
} |
| 43 |
$linkGP['no_cache'] = 1; |
|
| 44 |
$linkGP['dontReset'] = 1; |
|
| 45 |
return $this->cObj->getTypolink('CSV', $GLOBALS['TSFE']->id, $linkGP);
|
|
| 45 |
return $params; |
|
| 46 | 46 |
} |
| 47 | ||
| 47 | 48 |
} |
| 48 | 49 | |
| 49 | 50 |
?> |
| Classes/Generator/FE/Tx_Formhandler_Generator_WebkitPdf.php (working copy) | ||
|---|---|---|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
public function getLink($linkGP) {
|
| 59 |
$params = array(); |
|
| 60 |
|
|
| 61 |
$url = Tx_Formhandler_StaticFuncs::getHostname() . $this->cObj->getTypolink_URL($GLOBALS['TSFE']->id, $linkGP); |
|
| 62 |
|
|
| 63 |
$config = $this->readWebkitPdfConf(); |
|
| 64 |
$text = 'Save as PDF'; |
|
| 65 |
if($config['linkText']) {
|
|
| 66 |
$text = Tx_Formhandler_StaticFuncs::getSingle($config, 'linkText'); |
|
| 59 |
$params = $this->getDefaultLinkParams(); |
|
| 60 |
$componentParams = $this->getComponentLinkParams($linkGP); |
|
| 61 |
if(is_array($componentParams)) {
|
|
| 62 |
$params = t3lib_div::array_merge_recursive_overrule($params, $componentParams); |
|
| 67 | 63 |
} |
| 68 |
|
|
| 64 |
$text = $this->getLinkText(); |
|
| 65 |
$url = Tx_Formhandler_StaticFuncs::getHostname() . $this->cObj->getTypolink_URL($GLOBALS['TSFE']->id, $params); |
|
| 69 | 66 |
$params = array( |
| 70 | 67 |
'tx_webkitpdf_pi1' => array( |
| 71 | 68 |
'urls' => array( |
| 72 | 69 |
$url |
| 73 | 70 |
) |
| 74 | 71 |
), |
| 75 |
'no_cache' => 1, |
|
| 76 |
'submitted_ok' => 1 |
|
| 72 |
'no_cache' => 1 |
|
| 77 | 73 |
); |
| 78 |
|
|
| 79 | 74 |
return $this->cObj->getTypolink($text, $this->settings['pid'], $params); |
| 80 | 75 |
} |
| 76 |
|
|
| 77 |
protected function getComponentLinkParams($linkGP) {
|
|
| 78 |
$prefix = Tx_Formhandler_Globals::$formValuesPrefix; |
|
| 79 |
$params = array(); |
|
| 80 |
if($prefix) {
|
|
| 81 |
$params[$prefix] = array( |
|
| 82 |
'submitted_ok' => 1 |
|
| 83 |
); |
|
| 84 |
} else {
|
|
| 85 |
$params['submitted_ok'] = 1; |
|
| 86 |
} |
|
| 87 |
return $params; |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
protected function getLinkText() {
|
|
| 91 |
$config = $this->readWebkitPdfConf(); |
|
| 92 |
$text = 'Save as PDF'; |
|
| 93 |
if($config['linkText']) {
|
|
| 94 |
$text = Tx_Formhandler_StaticFuncs::getSingle($config, 'linkText'); |
|
| 95 |
} |
|
| 96 |
return $text; |
|
| 97 |
} |
|
| 81 | 98 |
} |
| 82 | 99 | |
| 83 | 100 |
?> |
| Classes/Generator/FE/Tx_Formhandler_AbstractGenerator.php (working copy) | ||
|---|---|---|
| 1 | 1 |
<?php |
| 2 | 2 |
abstract class Tx_Formhandler_AbstractGenerator extends Tx_Formhandler_AbstractComponent {
|
| 3 | 3 |
|
| 4 |
abstract public function getLink($linkGP); |
|
| 4 |
public function getLink($linkGP) {
|
|
| 5 |
$text = $this->getLinkText(); |
|
| 6 |
|
|
| 7 |
$params = $this->getDefaultLinkParams(); |
|
| 8 |
$componentParams = $this->getComponentLinkParams($linkGP); |
|
| 9 |
if(is_array($componentParams)) {
|
|
| 10 |
$params = t3lib_div::array_merge_recursive_overrule($params, $componentParams); |
|
| 11 |
} |
|
| 12 |
|
|
| 13 |
return $this->cObj->getTypolink($text, $GLOBALS['TSFE']->id, $params, $this->getLinkTarget()); |
|
| 14 |
} |
|
| 15 |
|
|
| 16 |
protected function getDefaultLinkParams() {
|
|
| 17 |
$prefix = Tx_Formhandler_Globals::$formValuesPrefix; |
|
| 18 |
$tempParams = array( |
|
| 19 |
'tstamp' => Tx_Formhandler_Session::get('inserted_tstamp'),
|
|
| 20 |
'hash' => Tx_Formhandler_Session::get('key_hash')
|
|
| 21 |
); |
|
| 22 |
$params = array(); |
|
| 23 |
if($prefix) {
|
|
| 24 |
$params[$prefix] = $tempParams; |
|
| 25 |
} else {
|
|
| 26 |
$params = $tempParams; |
|
| 27 |
} |
|
| 28 |
return $params; |
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
abstract protected function getComponentLinkParams($linkGP); |
|
| 32 |
|
|
| 33 |
protected function getLinkText() {
|
|
| 34 |
$text = 'Save'; |
|
| 35 |
if($this->settings['linkText']) {
|
|
| 36 |
$text = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'linkText'); |
|
| 37 |
} |
|
| 38 |
return $text; |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
protected function getLinkTarget() {
|
|
| 42 |
$target = '_self'; |
|
| 43 |
if($this->settings['linkTarget']) {
|
|
| 44 |
$target = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'linkTarget'); |
|
| 45 |
} |
|
| 46 |
return $target; |
|
| 47 |
} |
|
| 5 | 48 |
} |
| 6 | 49 |
?> |