Public Member Functions | |
start ($data, $FEData) | |
Starting the processing of user input. | |
checkDoublePostExist ($table, $doublePostField, $key) | |
Checking if a "double-post" exists already. | |
calcDoublePostKey ($array) | |
Creates the double-post hash value from the input array. | |
includeScripts () | |
Includes the submit scripts found in ->extScripts (filled in by the start() function). | |
execNEWinsert ($table, $dataArr) | |
Method available to the submit scripts for creating insert queries. | |
clear_cacheCmd ($cacheCmd) | |
Clear cache for page id. | |
getConf ($table) | |
Return TypoScript configuration for a table name. | |
Public Attributes | |
$extScripts = array() | |
$extScriptsConf = array() | |
$newData = array() | |
$extraList = 'pid' |
|
Creates the double-post hash value from the input array.
Definition at line 200 of file class.tslib_fetce.php. Referenced by start(). 00200 { 00201 ksort($array); // Sorting by key 00202 $doublePostCheckKey = hexdec(substr(md5(serialize($array)),0,8)); // Making key 00203 return $doublePostCheckKey; 00204 }
|
|
Checking if a "double-post" exists already. "Double-posting" is if someone refreshes a page with a form for the message board or guestbook and thus submits the element twice. Checking for double-posting prevents the second submission from being stored. This is done by saving the first record with a MD5 hash of the content - if this hash exists already, the record cannot be saved.
Definition at line 187 of file class.tslib_fetce.php. References table(). Referenced by start(). 00187 { 00188 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, $doublePostField.'='.intval($key)); 00189 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); 00190 return $row[0]; 00191 }
|
|
Clear cache for page id. If the page id is the current page, then set_no_cache() is called (so page caching is disabled)
Definition at line 258 of file class.tslib_fetce.php. 00258 { 00259 $cacheCmd = intval($cacheCmd); 00260 if ($cacheCmd) { 00261 $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id='.intval($cacheCmd)); 00262 if ($cacheCmd == intval($GLOBALS['TSFE']->id)) { // Setting no_cache true if the cleared-cache page is the current page! 00263 $GLOBALS['TSFE']->set_no_cache(); 00264 } 00265 } 00266 }
|
|
Method available to the submit scripts for creating insert queries. Automatically adds tstamp, crdate, cruser_id field/value pairs. Will allow only field names which are either found in $TCA[...][columns] OR in the $this->extraList Executes an insert query!
Definition at line 232 of file class.tslib_fetce.php. 00232 { 00233 $extraList=$this->extraList; 00234 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {$field=$GLOBALS['TCA'][$table]['ctrl']['tstamp']; $dataArr[$field]=time(); $extraList.=','.$field;} 00235 if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) {$field=$GLOBALS['TCA'][$table]['ctrl']['crdate']; $dataArr[$field]=time(); $extraList.=','.$field;} 00236 if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['cruser_id']; $dataArr[$field]=0; $extraList.=','.$field;} 00237 00238 unset($dataArr['uid']); // uid can never be set 00239 $insertFields = array(); 00240 00241 foreach($dataArr as $f => $v) { 00242 if (t3lib_div::inList($extraList,$f) || isset($GLOBALS['TCA'][$table]['columns'][$f])) { 00243 $insertFields[$f] = $v; 00244 } 00245 } 00246 00247 $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields); 00248 }
|
|
Return TypoScript configuration for a table name.
Definition at line 274 of file class.tslib_fetce.php. 00274 {
00275 return $this->extScriptsConf[$table];
00276 }
|
|
Includes the submit scripts found in ->extScripts (filled in by the start() function).
Definition at line 212 of file class.tslib_fetce.php. 00212 { 00213 reset($this->extScripts); 00214 while(list($incFile_table,$incFile)=each($this->extScripts)) { 00215 if (@is_file($incFile) && $GLOBALS['TSFE']->checkFileInclude($incFile)) { 00216 include($incFile); // Always start the incFiles with a check of the object fe_tce. is_object($this); 00217 $GLOBALS['TT']->setTSlogMessage('Included '.$incFile,0); 00218 } else $GLOBALS['TT']->setTSlogMessage('"'.$incFile.'" was not found!',2); 00219 } 00220 }
|
|
Starting the processing of user input. Traverses the input data and fills in the array, $this->extScripts with references to files which are then included by includeScripts() (called AFTER start() in tslib_fe) These scripts will then put the content into the database.
Definition at line 100 of file class.tslib_fetce.php. References calcDoublePostKey(), checkDoublePostExist(), and table(). 00100 { 00101 reset($data); 00102 while(list($table,$id_arr)=each($data)) { 00103 t3lib_div::loadTCA($table); 00104 if (is_array($id_arr)) { 00105 $sep=$FEData[$table.'.']['separator']?$FEData[$table.'.']['separator']:chr(10); 00106 reset($id_arr); 00107 while(list($id,$field_arr)=each($id_arr)) { 00108 $this->newData[$table][$id]=Array(); 00109 if (strstr($id,'NEW')) { // NEW 00110 // Defaults: 00111 if ($FEData[$table.'.']['default.']) { 00112 $this->newData[$table][$id] = $FEData[$table.'.']['default.']; 00113 } 00114 if ($FEData[$table.'.']['autoInsertPID']) { 00115 $this->newData[$table][$id]['pid'] = intval($GLOBALS['TSFE']->page['uid']); 00116 } 00117 // Insert external data: 00118 if (is_array($field_arr)) { 00119 reset($field_arr); 00120 while(list($field,$value)=each($field_arr)) { 00121 if ($FEData[$table.'.']['allowNew.'][$field]) { 00122 if (is_array($value)) { 00123 $this->newData[$table][$id][$field] = implode($sep,$value); 00124 } else { 00125 $this->newData[$table][$id][$field] = $value; 00126 } 00127 } 00128 } 00129 } 00130 // Double post check 00131 $dPC_field = $FEData[$table.'.']['doublePostCheck']; 00132 if (is_array($this->newData[$table][$id]) && $dPC_field) { 00133 $doublePostCheckKey = $this->calcDoublePostKey($this->newData[$table][$id]); 00134 if ($this->checkDoublePostExist($table,$dPC_field,$doublePostCheckKey)) { 00135 unset($this->newData[$table][$id]); // Unsetting the whole thing, because it's not going to be saved. 00136 $GLOBALS['TT']->setTSlogMessage('"FEData": Submitted record to table $table was doublePosted (key: $doublePostCheckKey). Nothing saved.',2); 00137 } else { 00138 $this->newData[$table][$id][$dPC_field] = $doublePostCheckKey; // Setting key value 00139 $this->extraList.=','.$dPC_field; 00140 } 00141 } 00142 } else { // EDIT 00143 // Insert external data: 00144 if (is_array($field_arr)) { 00145 reset($field_arr); 00146 while(list($field,$value)=each($field_arr)) { 00147 if ($FEData[$table.'.']['allowEdit.'][$field]) { 00148 if (is_array($value)) { 00149 $this->newData[$table][$id][$field] = implode($sep,$value); 00150 } else { 00151 $this->newData[$table][$id][$field] = $value; 00152 } 00153 } 00154 } 00155 } 00156 // Internal Override 00157 if (is_array($FEData[$table.'.']['overrideEdit.'])) { 00158 reset($FEData[$table.'.']['overrideEdit.']); 00159 while(list($field,$value)=each($FEData[$table.'.']['overrideEdit.'])) { 00160 $this->newData[$table][$id][$field] = $value; 00161 } 00162 } 00163 } 00164 if ($FEData[$table.'.']['userIdColumn']) { 00165 $this->newData[$table][$id][$FEData[$table.'.']['userIdColumn']] = intval($GLOBALS['TSFE']->fe_user->user['uid']); 00166 } 00167 } 00168 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($FEData[$table.'.']['processScript']); 00169 if ($incFile) { 00170 $this->extScripts[$table]=$incFile; 00171 $this->extScriptsConf[$table]=$FEData[$table.'.']['processScript.']; 00172 } 00173 } 00174 } 00175 }
|
|
Definition at line 88 of file class.tslib_fetce.php. |
|
Definition at line 85 of file class.tslib_fetce.php. |
|
Definition at line 86 of file class.tslib_fetce.php. |
|
Definition at line 87 of file class.tslib_fetce.php. |