Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00037 if (is_object($this)) { 00038 if (is_array($this->newData["tt_board"]["NEW"])) { 00039 // Plain insert of record: 00040 $this->execNEWinsert("tt_board", $this->newData["tt_board"]["NEW"]); 00041 $newId = $GLOBALS['TYPO3_DB']->sql_insert_id(); 00042 $this->clear_cacheCmd(intval($this->newData["tt_board"]["NEW"]["pid"])); 00043 00044 $conf = $this->getConf("tt_board"); 00045 // Clear specific cache: 00046 if ($conf["clearCacheForPids"]) { 00047 $ccPids=t3lib_div::intExplode(",",$conf["clearCacheForPids"]); 00048 reset($ccPids); 00049 while(list(,$pid)=each($ccPids)) { 00050 if ($pid > 0) {$this->clear_cacheCmd($pid);} 00051 } 00052 } 00053 00054 //debug($conf); 00055 00056 // Send post to Mailing list ... 00057 if ($conf["sendToMailingList"] && $conf["sendToMailingList."]["email"]) { 00058 /* 00059 TypoScript for this section (was used for the TYPO3 mailing list. 00060 00061 sendToMailingList=1 00062 sendToMailingList { 00063 email = typo3@netfielders.de 00064 reply = submitmail@typo3.com 00065 namePrefix = Typo3Forum/ 00066 altSubject = Post from www.typo3.com 00067 } 00068 */ 00069 $mConf = $conf["sendToMailingList."]; 00070 $maillist_data = $this->newData["tt_board"]["NEW"]; 00071 $maillist_recip = $mConf["email"]; 00072 00073 $maillist_header='From: '.$mConf["namePrefix"].$maillist_data["author"].' <'.$mConf["reply"].'>'.chr(10); 00074 $maillist_header.='Reply-To: '.$mConf["reply"]; 00075 00076 00077 // Subject 00078 if ($maillist_data["parent"]) { // RE: 00079 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_board', 'uid='.intval($maillist_data['parent'])); 00080 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); 00081 $maillist_subject = "Re: ".$row["subject"]." [#".$maillist_data["parent"]."]"; 00082 } else { // New: 00083 $maillist_subject = (trim($maillist_data["subject"]) ? trim($maillist_data["subject"]) : $mConf["altSubject"])." [#".$newId."]"; 00084 } 00085 00086 // Message 00087 $maillist_msg = $maillist_data["subject"].chr(10).chr(10).$maillist_data["message"]." 00088 -- 00089 ".$maillist_data["author"]; 00090 // Send 00091 00092 if ($conf["debug"]) { 00093 debug($maillist_recip,1); 00094 debug($maillist_subject,1); 00095 echo nl2br($maillist_msg.chr(10)); 00096 debug($maillist_header,1); 00097 } else { 00098 mail ($maillist_recip, $maillist_subject, $maillist_msg, $maillist_header); 00099 } 00100 } 00101 00102 00103 // Notify me... 00104 if (t3lib_div::_GP("notify_me") && $conf["notify"]) { 00105 $notifyMe = t3lib_div::uniqueList(str_replace(",".$maillist_data["email"].",", ",", ",".t3lib_div::_GP("notify_me").",")); 00106 00107 $markersArray=array(); 00108 $markersArray["###AUTHOR###"] = trim($this->newData["tt_board"]["NEW"][author]); 00109 $markersArray["###AUTHOR_EMAIL###"] = trim($this->newData["tt_board"]["NEW"][email]); 00110 $markersArray["###HOST###"] = t3lib_div::getIndpEnv("HTTP_HOST"); 00111 $markersArray["###URL###"] = t3lib_div::getIndpEnv("TYPO3_REQUEST_SCRIPT").'?id='.$GLOBALS["TSFE"]->id.'&type='.$GLOBALS["TSFE"]->type.'&no_cache=1&tt_board_uid='.$newId; 00112 00113 if ($maillist_data["parent"]) { // If reply and not new thread: 00114 $msg = t3lib_div::getUrl($GLOBALS["TSFE"]->tmpl->getFileName($conf["newReply."]["msg"])); 00115 $markersArray["###DID_WHAT###"]= $conf["newReply."]["didWhat"]; 00116 $markersArray["###SUBJECT_PREFIX###"]=$conf["newReply."]["subjectPrefix"]; 00117 } else { // If new thread: 00118 $msg = t3lib_div::getUrl($GLOBALS["TSFE"]->tmpl->getFileName($conf["newThread."]["msg"])); 00119 $markersArray["###DID_WHAT###"]= $conf["newThread."]["didWhat"]; 00120 $markersArray["###SUBJECT_PREFIX###"]=$conf["newThread."]["subjectPrefix"]; 00121 } 00122 $markersArray["###SUBJECT###"] = strtoupper($this->newData["tt_board"]["NEW"][subject]); 00123 $markersArray["###BODY###"] = t3lib_div::fixed_lgd($this->newData["tt_board"]["NEW"][message],1000); 00124 00125 reset($markersArray); 00126 while(list($marker,$markContent)=each($markersArray)) { 00127 $msg=str_replace($marker,$markContent,$msg); 00128 } 00129 00130 $headers=array(); 00131 if ($conf["notify_from"]) {$headers[]="FROM: ".$conf["notify_from"];} 00132 00133 $msgParts = split(chr(10),$msg,2); 00134 if ($conf["debug"]) { 00135 debug($notifyMe,1); 00136 debug($headers,1); 00137 debug($msgParts); 00138 } else { 00139 mail ($notifyMe, $msgParts[0], $msgParts[1], implode($headers,chr(10))); 00140 } 00141 } 00142 } 00143 } 00144 00145 ?>