tipp a friend fehler beim 2 ten mal benutzen
| Autor | Nachricht |
|---|---|
|
Verfasst am: 01. 12. 2006 [09:31]
|
|
|
swingtra
Themenersteller
Dabei seit: 07.12.2004
Beiträge: 164
|
Hallo beim 2ten aufruf von tip a friend wird die vorherige URL "zum empfehlen" mit übernommen . das ist das problem einfach einmal probieren, dann sieht man was ich meine. Irgentwie wird die erste URL gecacht: http://www.hengstparade.nrw.de/cpt/index.php?id=53 hier das TS : TYPOSCRIPT temp.tipafriend = TEXT temp.tipafriend { userFunc = tx_tipafriend->main_tipafriend #code = TIPLINK templateFile = {$plugin.tipafriend.file.templateFile} params = <span class="empfehlen-generator"> | </span> lang.de = Seite weiter empfehlen lang.en = Tip a friend typolink.target = _self typolink.parameter = 103 typolink.ATagBeforeWrap = 1 typolink.additionalParams.wrap = &no_cache=1&tipUrl=|&no_cache=1 typolink.additionalParams.rawUrlEncode = 1 typolink.additionalParams.data = getIndpEnv:TYPO3_REQUEST_URL #typolink.additionalParams.data = getIndpEnv:HTTP_REFERER ###und hier ist der Fehler : eine einfache Lücke () #typolink.additionalParams.data = getIndpEnv: TYPO3_REQUEST_URL } Erst backup dann probieren - denn umgekehrt kriecht man auf allen vieren. |
|
Verfasst am: 01. 12. 2006 [09:55]
|
|
|
jenses
Dabei seit: 12.08.2004
Beiträge: 2165
|
Da wird nichts gecached Es ist einfach nur ein Denkfehler in tipafriend, der sich einfach beheben läßt. In class.tx_tipafriend.php suchst du nach dieser Zeile: PHP $tConf['additionalParams'].= '&tipUrl='.rawurlencode($url); und ersetzt sie hiermit: PHP if($tConf['parameter']== $GLOBALS['TSFE']->id)
$tConf['additionalParams'].= '&tipUrl='.rawurlencode(t3lib_div::_GET('tipUrl'));
else
$tConf['additionalParams'].= '&tipUrl='.rawurlencode($url);( Entferne Zeile 11 bis 18 aus deinem TS, ist überflüssig. ) ( Meldung an bugtracker, diff attached ) [Dieser Beitrag wurde 1mal bearbeitet, zuletzt am 01.12.2006 um 10:17.] www.smedja.com - Webentwicklung( CMS TYPO3, PHP)
|
|
Verfasst am: 01. 12. 2006 [17:41]
|
|
|
swingtra
Themenersteller
Dabei seit: 07.12.2004
Beiträge: 164
|
Hallo jensens ich habe jetzt die Zeilen geändert, es passierte noch nichts, ich hatte vergessen zu erähnen, dass es es sich un eine 2te externe mysql-db handelt. ich dachte parameter wie TYPOSCRIPT getIndpEnv:HTTP_REFERER getIndpEnv:QUERY_STRING könnten weiterhelfen anstatt typolink.additionalParams.data = getIndpEnv:TYPO3_REQUEST_URL ... nur wie hänge ich o.G. werte aneinander ? gruß Heiko Erst backup dann probieren - denn umgekehrt kriecht man auf allen vieren. |
|
Verfasst am: 01. 12. 2006 [18:10]
|
|
|
jenses
Dabei seit: 12.08.2004
Beiträge: 2165
|
jenses schrieb: ( Entferne Zeile 11 bis 18 aus deinem TS, ist überflüssig. ) www.smedja.com - Webentwicklung( CMS TYPO3, PHP)
|
|
Verfasst am: 01. 12. 2006 [23:28]
|
|
|
swingtra
Themenersteller
Dabei seit: 07.12.2004
Beiträge: 164
|
Hallo jensens also : ich habe folgendes gelöscht : TYPOSCRIPT Es geht zwar ... aber ... nun ... das alte Problem bleibt bestehen, daß bei einem weiterem Aufruf von http://www.hengstparade.nrw.de/cpt/index.php?id=53 die falsche url, von vorher, mit übernommen wird (aber meist nur bei den Pferden mit"&hengstid_..." Aber gut ich sende jetzt noch einmal den modifizierten Code : TYPOSCRIPT temp.tipafriend = TEXT temp.tipafriend { userFunc = tx_tipafriend->main_tipafriend code = TIPLINK templateFile = {$plugin.tipafriend.file.templateFile} params = <span class="empfehlen-generator"> | </span> lang.de = Seite weiter empfehlen lang.en = Tip a friend typolink { target = _self parameter = 103 additionalParams.wrap = &no_cache=1&tipUrl=| additionalParams.rawUrlEncode = 1 additionalParams.data = getIndpEnv:TYPO3_REQUEST_URL } } gruß Heiko Erst backup dann probieren - denn umgekehrt kriecht man auf allen vieren. |
|
Verfasst am: 02. 12. 2006 [01:06]
|
|
|
jenses
Dabei seit: 12.08.2004
Beiträge: 2165
|
Also nochmal, schmeiß alles raus, was überflüssig ist, das sind beim jetzigen Stand des TS die Zeilen 12 - 14 www.smedja.com - Webentwicklung( CMS TYPO3, PHP)
|
|
Verfasst am: 02. 12. 2006 [10:11]
|
|
|
swingtra
Themenersteller
Dabei seit: 07.12.2004
Beiträge: 164
|
jenses schrieb: Also nochmal, schmeiß alles raus, was überflüssig ist, das sind beim jetzigen Stand des TS die Zeilen 12 - 14 ...nun ... ich habe das jetzt s gemacht und das führt zu folgender Fehlermeldung : ERROR: malformed or missing URL detected! ... und das ist der heilige Code dazu ( es wird keine Url mehr übergeben,da die TS-Parameter ja auch nicht mehr vorhanden sind, deswegen habe ich mich entschieden den php-code von der class.tx_tipafriend.php, den ich verändert habe gleich mitzusenden . TYPOSCRIPT temp.tipafriend = TEXT temp.tipafriend { userFunc = tx_tipafriend->main_tipafriend code = TIPLINK templateFile = {$plugin.tipafriend.file.templateFile} params = <span class="empfehlen-generator"> | </span> lang.de = Seite weiter empfehlen lang.en = Tip a friend typolink { target = _self parameter = 103 } } class.tx_tipafriend.php PHP <?php /*************************************************************** * Copyright notice * * (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * A copy is found in the textfile GPL.txt and important notices to the license * from the author is found in LICENSE.txt distributed with these scripts. * * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ /** * Creates a Tip-a-Friend form. * * @author Kasper Skårhøj <kasperYYYY@typo3.com> */ /** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 61: class tx_tipafriend extends tslib_pibase * 72: function main_tipafriend($content,$conf) * 131: function tipform() * 216: function validateUrl($url) * 241: function validate($tipData,$captchaStr='') * 258: function getRecipients($emails) * 278: function sendTip($tipData,$url) * 338: function tiplink() * 364: function getCaptchaElements() * * TOTAL FUNCTIONS: 8 * (This index is automatically created/updated by the extension "extdeveval"<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" /> * */ require_once(PATH_tslib.'class.tslib_pibase.php'); /** * Creates a Tip-a-friend form based on an HTML template. * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage tx_tipafriend */ class tx_tipafriend extends tslib_pibase { var $cObj; // The backReference to the parent cObj object set at call time /** * Main news function. * * @param [type] $content: ... * @param [type] $conf: ... * @return [type] ... */ function main_tipafriend($content,$conf) { $this->conf = $conf; $this->config['code'] = $this->cObj->stdWrap($this->conf['code'],$this->conf['code.']); // template is read. $this->templateCode = $this->cObj->fileResource($this->conf['templateFile']); // globally substituted markers, fonts and colors. $splitMark = md5(microtime()); $globalMarkerArray=array(); list($globalMarkerArray['###GW1B###'],$globalMarkerArray['###GW1E###']) = explode($splitMark,$this->cObj->stdWrap($splitMark,$conf['wrap1.'])); list($globalMarkerArray['###GW2B###'],$globalMarkerArray['###GW2E###']) = explode($splitMark,$this->cObj->stdWrap($splitMark,$conf['wrap2.'])); $globalMarkerArray['###GC1###'] = $this->cObj->stdWrap($conf['color1'],$conf['color1.']); $globalMarkerArray['###GC2###'] = $this->cObj->stdWrap($conf['color2'],$conf['color2.']); $globalMarkerArray['###GC3###'] = $this->cObj->stdWrap($conf['color3'],$conf['color3.']); // Substitute Global Marker Array $this->templateCode= $this->cObj->substituteMarkerArray($this->templateCode, $globalMarkerArray); // TYpoLink $this->typolink_conf = $this->conf['typolink.']; $this->typolink_conf['additionalParams'] = $this->cObj->stdWrap($this->typolink_conf['additionalParams'],$this->typolink_conf['additionalParams.']); unset($this->typolink_conf['additionalParams.']); $codes=t3lib_div::trimExplode(',', $this->config['code']?$this->config['code']:$this->conf['defaultCode'],1); if (!count($codes)) $codes=array(''); while(list(,$theCode)=each($codes)) { $theCode = (string)strtoupper(trim($theCode)); $this->theCode = $theCode; switch($theCode) { case 'TIPFORM': $content=$this->tipform(); break; case 'TIPLINK': $content=$this->tiplink(); break; default: $langKey = strtoupper($GLOBALS['TSFE']->config['config']['language']); $helpTemplate = $this->cObj->fileResource('EXT:tipafriend/pi/tipafriend_help.tmpl'); // Get language version $helpTemplate_lang=''; if ($langKey) {$helpTemplate_lang = $this->cObj->getSubpart($helpTemplate,'###TEMPLATE_'.$langKey.'###');} $helpTemplate = $helpTemplate_lang ? $helpTemplate_lang : $this->cObj->getSubpart($helpTemplate,'###TEMPLATE_DEFAULT###'); // Markers and substitution: $markerArray['###CODE###'] = $this->theCode; $markerArray['###PATH_HELP_IMAGE###'] = t3lib_extMgm::siteRelPath('tipafriend').'pi/tipafriend_help.gif'; $content.=$this->cObj->substituteMarkerArray($helpTemplate,$markerArray); break; } } return $content; } /** * [Describe function...] * * @return [type] ... */ function tipform() { $GLOBALS['TSFE']->set_no_cache(); $tipData = t3lib_div::_GP('TIPFORM'); $tipData['recipient'] = $this->getRecipients($tipData['recipient']); list($tipData['email']) = explode(',',$this->getRecipients($tipData['email'])); $url = $this->validateUrl(t3lib_div::_GP('tipUrl')); // Preparing markers $wrappedSubpartArray=array(); $subpartArray=array(); $markerArray=array(); $markerArray['###FORM_URL###']=t3lib_div::getIndpEnv('REQUEST_URI'); $markerArray['###URL###']=$url; $markerArray['###URL_ENCODED###']=rawurlencode($url); $markerArray['###URL_SPECIALCHARS###']=htmlspecialchars($url); if ($url) { $markerArray['###URL_DISPLAY###']=htmlspecialchars(strlen($url)>70 ? t3lib_div::fixed_lgd($url,30).t3lib_div::fixed_lgd($url,-30) : $url); } else { // display an error if the URL was unset or if it is missing $markerArray['###URL_DISPLAY###'] = '<strong style="color:red;">ERROR: malformed or missing URL detected!</strong>'; } $wrappedSubpartArray['###LINK###']=array('<a href="'.htmlspecialchars($url).'">','</a>'); // validation $error=0; $sent=0; if (t3lib_div::_GP('sendTip') && $url) { if (t3lib_extMgm::isLoaded('captcha')) { session_start(); $captchaStr = $_SESSION['tx_captcha_string']; $_SESSION['tx_captcha_string'] = ''; } else { $captchaStr = -1; } if ($this->validate($tipData,$captchaStr)) { $this->sendTip($tipData,$url); $sent=1; } else { $error=1; } } // Display form if ($sent) { $subpart = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_TIPFORM_SENT###'); $markerArray['###RECIPIENT###']=htmlspecialchars($tipData['recipient']); $content= $this->cObj->substituteMarkerArrayCached($subpart,$markerArray,$subpartArray,$wrappedSubpartArray); } else { $captchaHTMLoutput = t3lib_extMgm::isLoaded('captcha') ? '<img src="'.t3lib_extMgm::siteRelPath('captcha').'captcha/captcha.php" alt="" />' : ''; // Generate Captcha data and store string in session: $subpart = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_TIPFORM###'); $markerArray['###MESSAGE###']=htmlspecialchars($tipData['message']); $markerArray['###RECIPIENT###']=htmlspecialchars($tipData['recipient']); $markerArray['###YOUR_EMAIL###']=htmlspecialchars($tipData['email']); $markerArray['###YOUR_NAME###']=htmlspecialchars($tipData['name']); $markerArray['###HTML_MESSAGE###']=$tipData['html_message'] ? 'checked' : ''; $markerArray['###CAPTCHA_HTML###']=$captchaHTMLoutput; if (!$error) { $subpartArray['###ERROR_MSG###']=''; } // Substitute $content= $this->cObj->substituteMarkerArrayCached($subpart,$markerArray,$subpartArray,$wrappedSubpartArray); } return $content; } /** * [Describe function...] * * @param [type] $url: ... * @return [type] ... */ function validateUrl($url) { // remove hmtl tags from url $url = strip_tags($url); // If the URL contains a '"', unset $url (suspecting XSS code) if (strstr($url,'"')) { $url = false; } // check if the first part of the url is actually the server where tip-a-friend is installed. If not, unset $url. if(!preg_match('#\A'.t3lib_div::getIndpEnv('TYPO3_SITE_URL').'#',$url)) { $url = false; } return $url; } /** * [Describe function...] * * @param [type] $tipData: ... * @param [type] $captchaStr: ... * @return [type] ... */ function validate($tipData,$captchaStr='') { if ( trim($tipData['name']) && $tipData['email'] && $tipData['recipient'] && ($captchaStr===-1 || ($captchaStr && $tipData['captchaResponse']===$captchaStr)) ) { return 1; } } /** * [Describe function...] * * @param [type] $emails: ... * @return [type] ... */ function getRecipients($emails) { $emailArr = split('[, ;]',$emails); reset($emailArr); $listArr=array(); while(list(,$email)=each($emailArr)) { $email = trim($email); if ($email && t3lib_div::validEmail($email)) { $listArr[] = $email; } } return implode(',',$listArr); } /** * [Describe function...] * * @param [type] $tipData: ... * @param [type] $url: ... * @return [type] ... */ function sendTip($tipData,$url) { // Get template $subpart = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_EMAIL###'); // Set markers $markerArray['###MESSAGE###']=htmlspecialchars($tipData['message']); $markerArray['###RECIPIENT###']=htmlspecialchars($tipData['recipient']); $markerArray['###YOUR_EMAIL###']=htmlspecialchars($tipData['email']); $markerArray['###YOUR_NAME###']=htmlspecialchars($tipData['name']); $markerArray['###URL###']=$url; // Substitute in template $content= $this->cObj->substituteMarkerArrayCached($subpart,$markerArray,$subpartArray,$wrappedSubpartArray); // Set subject, conten and headers $headers=array(); $headers[]='FROM: '.$tipData['name'].' <'.$tipData['email'].'>'; list($subject,$plain_message) = explode(chr(10),trim($content),2); // HTML $cls=t3lib_div::makeInstanceClassName('t3lib_htmlmail'); if (class_exists($cls) && $this->conf['htmlmail'] && $tipData['html_message']) { // If htmlmail lib is included, then generate a nice HTML-email $Typo3_htmlmail = t3lib_div::makeInstance('t3lib_htmlmail'); $Typo3_htmlmail->start(); $Typo3_htmlmail->useBase64(); $Typo3_htmlmail->subject = $subject; $Typo3_htmlmail->from_email = $tipData['email']; $Typo3_htmlmail->from_name = $tipData['name']; $Typo3_htmlmail->replyto_email = $tipData['email']; $Typo3_htmlmail->replyto_name = $tipData['name']; $Typo3_htmlmail->organisation = ''; $Typo3_htmlmail->priority = 3; // debug($url); // this will fail if the url is password protected! $Typo3_htmlmail->addHTML($url); $Typo3_htmlmail->addPlain($plain_message); $Typo3_htmlmail->setHeaders(); $Typo3_htmlmail->setContent(); $Typo3_htmlmail->setRecipient($tipData['recipient']); // debug($Typo3_htmlmail->theParts); $Typo3_htmlmail->sendtheMail(); } else { // Plain mail: // Sending mail: # $GLOBALS['TSFE']->plainMailEncoded(, $subject, , implode($headers,chr(10))); $this->cObj->sendNotifyEmail($plain_message, $tipData['recipient'], '', $tipData['email'], $tipData['name']); } } /** * [Describe function...] * * @return [type] ... */ function tiplink() { $url=t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'); $subpart = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_TIPLINK###'); $wrappedSubpartArray=array(); $tConf = $this->typolink_conf; if($tConf['parameter']== $GLOBALS['TSFE']->id) $tConf['additionalParams'].= '&tipUrl='.rawurlencode(t3lib_div::_GET('tipUrl')); else $tConf['additionalParams'].= '&tipUrl='.rawurlencode($url); // debug($tConf); $wrappedSubpartArray['###LINK###']= $this->cObj->typolinkWrap($tConf); $markerArray=array(); $markerArray['###URL###']=$url; $markerArray['###URL_ENCODED###']=rawurlencode($url); $markerArray['###URL_SPECIALCHARS###']=htmlspecialchars($url); // Substitute $content= $this->cObj->substituteMarkerArrayCached($subpart,$markerArray,array(),$wrappedSubpartArray); return $content; } /** * [Describe function...] * * @return [type] ... */ function getCaptchaElements() { $code = substr(md5(uniqid()),0,10); return array($code,$code); } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tipafriend/pi/class.tx_tipafriend.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tipafriend/pi/class.tx_tipafriend.php']); } ?> Erst backup dann probieren - denn umgekehrt kriecht man auf allen vieren. |
|
Verfasst am: 02. 12. 2006 [11:13]
|
|
|
jenses
Dabei seit: 12.08.2004
Beiträge: 2165
|
1. Lege in irgendeinem SysOrdner "Data Storage Folder", ein neues ContentElement an, Typ Plugin, Erweiterung: "Tip geben", CODE: TIPLINK, Ausgangspunkt: deine Rootpage, notiere dir die UID dieses ContentElements 2. In deinem Template wird dem entsprechenden Marker dieses ContentElement zugewiesen: TYPOSCRIPT temp.tipafriend = RECORDS temp.tipafriend { tables = tt_content # im "Data Storage Folder", UID dieses ContentElements : source = 186 wrap = <span class="empfehlen-generator"> | </span> } Das von dir verwandte TS ist uralt, hat mit einer aktuellen tipafriend-Version nichts mehr zu tun. www.smedja.com - Webentwicklung( CMS TYPO3, PHP)
|
|
Verfasst am: 05. 12. 2006 [01:07]
|
|
|
swingtra
Themenersteller
Dabei seit: 07.12.2004
Beiträge: 164
|
nun ... "innerhalb" von Typo3 geht die Extension, d.h. die alte und die neue Variante geht, aber nicht, wenn diese (fremdkonfigurierte) 2te Datenbankgeschichte mit diesen url-schnipseln ...&hengstid=* usw., daherkommt. ich habe jetzt die eingefügten php-seiten abgeschaltet mit page.10.subparts.EMPFEHLEN-Generator > und schaue mal was es so für tip-a-friend -phpscripte (für die paar seiten) so gibt . Erst backup dann probieren - denn umgekehrt kriecht man auf allen vieren. |
|
Verfasst am: 07. 08. 2007 [02:36]
|
|
|
swingtra
Themenersteller
Dabei seit: 07.12.2004
Beiträge: 164
|
Also die Lösung ist mir jetzt gekommen. Der Grund Warum Der alte Link "beim 2ten Aufruf vom Tip-Link angezeigt wird" ist ganz einfach ! Es ist ein Caching-Problem, der Link-Aufruf wird von der Extension tipafriend gecached - thats it ! Lösungsansatz hier: http://www.typo3.net/index.php?id=13&action=list_post&tid=60891 also das hier bei der Seite oder +ext.Template eingeben: TYPOSCRIPT config.no_cache=1Erst backup dann probieren - denn umgekehrt kriecht man auf allen vieren. |




