$desc = $_POST["descrizione"]; $titolo_ita = $_POST["titolo_ita"]; $desc_ita = $_POST["descrizione_ita"]; $titolo_ted = $_POST["titolo_ted"]; $desc_ted = $_POST["descrizione_ted"]; $nuovo = ""; if (isset($_POST["nuovo"]) and $_POST["nuovo"] == "t") { $nuovo = "t"; } if (isset($_POST["pubblicato_eur"]) and $_POST["pubblicato_eur"] == "t") { $pubblicato_eur = "t"; } if (isset($_POST["pubblicato_uk"]) and $_POST["pubblicato_uk"] == "t") { $pubblicato_uk = "t"; } $object = new Prodotti(); if (isset($_POST["insert"]) and $_POST["insert"] == "si") { $object->add($fk_cm, $fk_cat, $fk_sottocat, $code, $titolo, $titolo_ita, $titolo_ted, $desc, $desc_ita, $desc_ted, $prezzounita, $prezzounita_eur, $numpezzi, $prezzooff, $prezzooff_eur, $dimensione, $peso, $magazzino, $magazzino_eng, $pubblicato_eur, $pubblicato_uk, $nuovo); //recupero l'ultimo id inserito $db = new Db(); $id = $db->get_last_id(); } elseif (isset($_POST["update"]) and $_POST["update"] == "si") { $id = aggiusta_post($_GET["id"]); $object->update($id, $fk_cm, $fk_cat, $fk_sottocat, $code, $titolo, $titolo_ita, $titolo_ted, $desc, $desc_ita, $desc_ted, $prezzounita, $prezzounita_eur, $numpezzi, $prezzooff, $prezzooff_eur, $dimensione, $peso, $magazzino, $magazzino_eng, $pubblicato_eur, $pubblicato_uk, $nuovo); //upload dei file update_file("pr_prodotti", "prodotti_dettaglio.php?errore=file&id=" . $id, $id); } //gestione listini: cancello e reinserisco $objPrezzi->delete_byproduct($id); foreach ($arrListini as $list) { $sterline = $_POST["prezzo_" . $list["list_id"]];
function send_to_friend() { $db = new Db(); $idPr = $db->str($_POST["idPr"]); $nome = $db->str($_POST["nome"]); $mail = $db->str($_POST["mail"]); $nome_amico = $db->str($_POST["nome_amico"]); $mail_amico = $db->str($_POST["mail_amico"]); $messaggio = $db->str($_POST["messaggio"]); $lang = $_POST["lang"]; if ($lang == "eng") { $suffissoL = ""; require "../config/lingue/inglese.php"; } elseif ($lang == "ted") { $suffissoL = "_ted"; require "../config/lingue/tedesco.php"; } else { $suffissoL = "_ita"; require "../config/lingue/italiano.php"; } //recupero la foto $img = ""; $immagini = new File("pr_prodotti", "img", "anteprima"); $idTbl = $immagini->get_id_tabella(); $arrFoto = $immagini->get_file($idPr); $numTot = count($arrFoto); if ($numTot != 0) { $cartellaUp = $immagini->get_cartella(); $arrayFoto = explode(":", $arrFoto[0]["file"]); $nomeFileImg = dimminomefile($arrayFoto[1]); $tipoFile = tipo_file($arrayFoto[1]); $nomeThumb = $nomeFileImg . "_thumb." . $tipoFile; $img_thumb = UPLOAD_FILE . "/" . $cartellaUp . "/" . $nomeThumb; if (is_file($img_thumb)) { $img .= "<img src='" . LINK_ROOT . $img_thumb . "' width='180'>"; } } //dett prodotto $objProdotto = new Prodotti(); $arrPr = $objProdotto->getById($idPr); $dettPr = ""; if ($arrPr["pr_titolo"] != "") { $dettPr .= "<strong>" . $arrPr["pr_titolo" . $suffissoL] . "</strong><br />"; } $dettPr .= $arrPr["pr_desc" . $suffissoL]; //mando mail $bodyMsg = file_get_contents('../tpl_mail/' . $lang . '/send_friend.html'); $bodyMsg = str_replace("XX_URL_XX", LINK_ROOT, $bodyMsg); $bodyMsg = str_replace("XX_NOMEAMICO_XX", $nome_amico, $bodyMsg); $bodyMsg = str_replace("XX_NOME_XX", $nome, $bodyMsg); $bodyMsg = str_replace("XX_MAIL_XX", $mail, $bodyMsg); $bodyMsg = str_replace("XX_MESSAGGIO_XX", $messaggio, $bodyMsg); $bodyMsg = str_replace("XX_IMG_XX", $img, $bodyMsg); $bodyMsg = str_replace("XX_PRODOTTO_XX", $dettPr, $bodyMsg); $bodyMsg = str_replace("XX_LINK_XX", LINK_ROOT . "product_dett.php?idPr=" . $idPr, $bodyMsg); $mailer2 = new PHPMailer(); $mailer2->IsSMTP(); $mailer2->Port = 25; $mailer2->Host = "localhost"; $mailer2->CharSet = "UTF-8"; $mailer2->IsMail(); $mailer2->AddReplyTo($mail); $mailer2->From = $mail; $mailer2->FromName = $nome; $mailer2->AddAddress(trim($mail_amico)); //$mailer2->Subject = $nome." ".utf8_decode($lang_consigliaprodotto); $mailer2->Subject = "=?UTF-8?B?" . base64_encode($nome . " " . $lang_consigliaprodotto) . "?="; $mailer2->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mailer2->WordWrap = 80; $mailer2->MsgHTML($bodyMsg); $mailer2->IsHTML(true); if (!$mailer2->Send()) { $error = $mailer2->ErrorInfo . "\n"; print 0; } else { print 1; } unset($mailer2); }