コード例 #1
0
function DispCustHT($Val2Af) {
   // si dans la chaine il y a un @, pas d'espaces ni de retour chariot, alors c'est une adressemail 
   if (VerifAdMail($Val2Af))
      {
      $Val2Af="<A HREF=\"mailto:".$Val2Af."\">".$Val2Af."</a>";
      }
  else if (strstr($Val2Af,"http://")  && !strstr($Val2Af,"\n"))
      {
      $Val2Af="<A HREF=\"".$Val2Af."\" target=\"_blank\">".$Val2Af."</a>";
      }
  else if (strstr($Val2Af,"www.")  && !strstr($Val2Af," ") && !strstr($Val2Af,"\n"))
      {
      $Val2Af="<A HREF=\"http://".$Val2Af."\" target=\"_blank\">".$Val2Af."</a>";
      }
  else {  // sinon traitement divers
      $Val2Af=ereg_replace("\n","<br>", $Val2Af);
      $Val2Af=ereg_replace("<","&lt;", $Val2Af);
      $Val2Af=ereg_replace(">","&gt;", $Val2Af);
      $Val2Af=($Val2Af=="" ? "&nbsp;" : $Val2Af);
      }
return ($Val2Af);
}
コード例 #2
0
    /**
     * mode vue unique (1 seul doc)
     */
    function singleView($content)
    {
        $this->getPersInfos();
        // sert si le gonze veut recommander à un ami... a recuperer son nom et ses coordonn�s
        // This sets the title of the page for use in indexed search results:
        if ($this->internal["currentRow"]["title"]) {
            $GLOBALS["TSFE"]->indexedDocTitle = $this->internal["currentRow"]["title"];
        }
        //print_r($_SESSION['art_table']);
        if (is_array($_SESSION['art_table'])) {
            foreach ($_SESSION['art_table'] as $i => $v) {
                if ($v == $this->getFieldContent("uid")) {
                    $ci = $i;
                    break;
                }
            }
        }
        //echo $ci;
        $this->ImgMwidth = $this->conf["Img2MaxWidth"];
        $this->cHash = md5(time() . $this->internal["currentRow"]["title"]);
        $content = '<A name="Anc' . $this->getFieldContent("uid") . '></A>';
        $content .= '<DIV class="txvm19docs_single">';
        $content .= $this->RetEntete($this->internal["currentRow"]["title"]);
        //	<H2><img src="'.$this->conf["iconDir"].'picto_documents.gif" align="middle">&nbsp;&nbsp;'.$this->internal["currentRow"]["title"].'</H2>
        $content .= '<p>' . $this->getFieldLine("img2") . $this->getFieldLine("descdetail") . '</p><p>&nbsp;</p><div class="cartouche">' . $this->getFieldLine("ref") . $this->getFieldLine("price") . $this->getFieldLine("auteur") . $this->getFieldLine("editor") . $this->getFieldLine("technicaldegree") . $this->getFieldLine("parut") . $this->getFieldLine("support") . $this->getFieldLine("nbpages") . $this->getFieldLine("file") . '</div>' . '<br/>';
        $content .= '<p align="center">';
        $content .= '<span class="picto">' . str_replace('"><img', "#Anc" . $this->getFieldContent("uid") . '"><img', $this->pi_list_linkSingle($this->pi_getLL("go_back", "[go_back]"), 0)) . '</span> &nbsp;&nbsp;&nbsp;&nbsp;';
        if ($_SESSION['art_table'][$ci - 1] != "") {
            $content .= $this->pi_list_linkSingle($this->pi_getLL("art_prec", "[art_prec]"), $_SESSION['art_table'][$ci - 1]);
        }
        $content .= "&nbsp; &nbsp;";
        if ($_SESSION['art_table'][$ci + 1] != "") {
            $content .= $this->pi_list_linkSingle($this->pi_getLL("art_suiv", "[art_suiv]"), $_SESSION['art_table'][$ci + 1]);
        }
        $content .= '<br/>';
        $content .= $this->vklink();
        // lien vers cariole
        $urlParameters['cHash'] = $this->cHash;
        $urlParameters['hnkart_mode'] = "true";
        $urlParameters['add_art'] = $this->internal["currentRow"]["uid"];
        $content .= ' &nbsp;&nbsp;&nbsp;&nbsp;<A href="#sendaf" onclick="document.getElementById(\'sendafriend\').style.display=\'block\'">' . $this->pi_getLL("recomm", "[recomm]") . '</a>';
        if ($this->internal["currentRow"]['price'] > 0) {
            $content .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . $this->pi_getPageLink($GLOBALS["TSFE"]->id, '', $urlParameters) . '" title="' . $this->pi_getLL("add2kart", "[add2kart]") . '"><img src="' . $this->conf["iconDir"] . 'cariole.gif"/></a>';
        }
        //print_r($_REQUEST[$this->prefixId]);
        $content .= '</p></DIV>' . $this->pi_getEditPanel();
        $content .= '<p><FORM action="' . $this->pi_getPageLink($GLOBALS["TSFE"]->id, '', $urlParameters) . '#sendaf" name="' . $this->prefixId . 'fname" method="GET">';
        // calcul des valeurs des champs, et test validite
        $error = false;
        $yourname = $_REQUEST[$this->prefixId]['yourname'] != "" ? $_REQUEST[$this->prefixId]['yourname'] : $this->personne->prenom . " " . $this->personne->nom;
        if ($_REQUEST[$this->prefixId]['fsent'] && $yourname == "") {
            $error = $this->pi_getLL("errnom");
        }
        $yourmail = $_REQUEST[$this->prefixId]['yourmail'] != "" ? $_REQUEST[$this->prefixId]['yourmail'] : $this->personne->coordonnees->email;
        if ($_REQUEST[$this->prefixId]['fsent'] && (!VerifAdMail($yourmail) || $yourmail == "")) {
            $error .= "<br/> " . $this->pi_getLL("errmail");
        }
        if ($_REQUEST[$this->prefixId]['fsent'] && (!VerifAdMail($_REQUEST[$this->prefixId]['mail2send']) || $_REQUEST[$this->prefixId]['mail2send'] == "")) {
            $error .= "<br/>" . $this->pi_getLL("errmail2send");
        }
        $content .= '<p><a name="sendaf"></a><div id="sendafriend" style="display:' . ($_REQUEST[$this->prefixId]['fsent'] ? "block" : "none") . '"><H3>' . $this->pi_getLL("recomm", "[recomm]") . ' : </h3>';
        if ($error) {
            $content .= '<div style="color:red">' . $error . '</div>';
        }
        if ($_REQUEST[$this->prefixId]['fsent'] == "" || $error) {
            $content .= '<input type="hidden" name="' . $this->prefixId . '[fsent]" value="true">
			<input type="hidden" name="' . $this->prefixId . '[showUid]" value="' . $this->getFieldContent("uid") . '">
			<input type="hidden" name="' . $this->prefixId . '[ttc_uid]" value="' . $this->uid . '">
			<input type="hidden" name="' . $this->prefixId . '[pointer]" value="' . $_REQUEST[$this->prefixId . '[pointer]'] . '">
			<input type="hidden" name="cHash" value="' . $this->cHash . '">
			<table><tr><td>' . $this->pi_getLL("yourname", "[yourname]") . ' *</td><td><input type="text" name="' . $this->prefixId . '[yourname]" size="30" value="' . $yourname . '"/></td></tr>
			<tr><td>' . $this->pi_getLL("yourmail", "[yourmail]") . ' *</td><td><input type="text" name="' . $this->prefixId . '[yourmail]" size="30" value="' . $yourmail . '"/></td></tr>
			<tr><td>' . $this->pi_getLL("mail2send", "[mail2send]") . ' *<br/><small>' . $this->pi_getLL("mail2sendcomm", "[mail2sendcomm]") . '</small></td><td> <input type="text" name="' . $this->prefixId . '[mail2send]" size="30" value="' . $_REQUEST[$this->prefixId]['mail2send'] . '"/></td></tr>
			<tr><td>' . $this->pi_getLL("comment", "[comment]") . '</td><td><textarea name="' . $this->prefixId . '[comment]" cols="30" rows="5">' . $_REQUEST[$this->prefixId]['comment'] . '</textarea></td></tr><tr><td>
			* <span class="smallred">' . $this->pi_getLL("obligchp", "[obligchp]") . '</span>
			</td><td><INPUT class="fxButton" type="submit" name="' . $this->prefixId . '[submit_button]" value="' . $this->pi_getLL("envoyer", "Envoyer") . '"></td></tr></table>';
        } else {
            // marche pas car trimballe TOUS les variables GET !!
            //$mylink=$this->pi_list_linkSingle("produit suivant",$this->getFieldContent("uid"));
            $params[$this->prefixId . '[showUid]'] = $this->getFieldContent("uid");
            $params[$this->prefixId . '[ttc_uid]'] = $this->uid;
            $mylink = "http://" . $_SERVER['SERVER_NAME'] . str_replace("index.php", "", $_SERVER['PHP_SELF']);
            $mylink = str_replace('href="', 'href="' . $mylink, $this->pi_linkTP("produit suivant", $params));
            $mailcont = 'Bonjour,<br/><br/>

	Un de vos amis, ' . $_REQUEST[$this->prefixId]['yourname'] . ' (' . $_REQUEST[$this->prefixId]['yourmail'] . '), vous a transmis ce message pour vous recommander le ' . $mylink . ' sur le site des Haras nationaux, <a href="http://www.haras-nationaux.fr">www.haras-nationaux.fr</a>.';
            if ($_REQUEST[$this->prefixId]['comment'] != "") {
                $mailcont .= '
				
				<br/><br/>Il a ajoute ce commentaire : <br/>
	' . $_REQUEST[$this->prefixId]['comment'];
            }
            $content .= 'Le message suivant a &eacute;t&eacute; envoy&eacute;' . $_REQUEST[$this->prefixId]['mail2send'] . ":<br/><i>";
            $content .= $mailcont;
            $content .= '</i>';
            mail_html($_REQUEST[$this->prefixId]['mail2send'], "Message de " . $_REQUEST[$this->prefixId]['yourname'], $mailcont, $_REQUEST[$this->prefixId]['yourmail']);
        }
        $content .= '</div></form></p>';
        return $content;
    }