This is a TNG mod directive file
%name:Submit Photo/Document-$31%
%version:v13.0.2.0%
%description:This mod allows multiple submissions of a photo or document via email.
Mod developer is Jeff Robison.
Original code for submit_photo.php by G. T. 'Joe' Proctor
%
%wikipage:Submit_Photo/Document_Form_Mod%
// Mod by Jeff Robison 05/September/15
// Update for TNG 13 by Ron Krzmarzick 12/January/20
%target:languages/English/cust_text.php%
%location:%
?>
%end:%
%insert:before%
// Added for Submit Photo/Document Link and Other Various Links
$text['enteratt'] = "Please select a file to attach";
$text['enteraccept'] = "Accepted file types: ";
$text['enterdescr'] = "File description missing.";
$text['submitphotofor'] = "Photo/Document Submission: ";
$text['submitphotohdr'] = "Submit Photo / Document";
$text['optional'] = "Optional";
$text['sharephoto'] = "Submit Photo / Doc";
$text['submitphotocredit'] = "Credit / Source";
$text['submitphotodescription'] = "Description";
$text['submitphotoattachment'] = "Attachment";
$text['submitphotorequiredfield'] = "Required Field";
$text['submitremove'] = "Remove";
$text['submitaddattachment'] = "Add another attachment";
$text['submitphotoprivacy'] = "We respect your privacy - your name and email address will not be publicly displayed or released.";
$text['submitphotobutton'] = "Submit Attachment(s)";
$text['submitmessage1'] = "Thank you xxx (yyy).";
$text['submitmessage2'] = "File(s) submitted for review to ";
$text['submitsendcopy'] = "You should receive a copy soon.";
$text['submitregards'] = "Best Regards,";
$text['submitentercode'] = "Enter Security Code";
$text['submitsecurity'] = "Security code";
$text['submitentercodealert'] = "Please enter the security code";
$text['submitenterrightcode'] = "Incorrect security code! Please try again.";
$text['submitmailnotsent'] = "We're sorry, but your submission could not be delivered.";
%end:%
%target:languages/English-UTF8/cust_text.php%
%location:%
?>
%end:%
%insert:before%
//$31 Added for Submit Photo/Document Link and Other Various Links
$text['enteratt'] = "Please select a file to attach";
$text['enteraccept'] = "Accepted file types: ";
$text['enterdescr'] = "File description missing.";
$text['submitphotofor'] = "Photo/Document Submission: ";
$text['submitphotohdr'] = "Submit Photo / Document";
$text['optional'] = "Optional";
$text['sharephoto'] = "Submit Photo / Doc";
$text['submitphotocredit'] = "Credit / Source";
$text['submitphotodescription'] = "Description";
$text['submitphotoattachment'] = "Attachment";
$text['submitphotorequiredfield'] = "Required Field";
$text['submitremove'] = "Remove";
$text['submitaddattachment'] = "Add another attachment";
$text['submitphotoprivacy'] = "We respect your privacy - your name and email address will not be publicly displayed or released.";
$text['submitphotobutton'] = "Submit Attachment(s)";
$text['submitmessage1'] = "Thank you xxx (yyy).";
$text['submitmessage2'] = "File(s) submitted for review to ";
$text['submitsendcopy'] = "You should receive a copy soon.";
$text['submitregards'] = "Best Regards,";
$text['submitentercode'] = "Enter Security Code";
$text['submitsecurity'] = "Security code";
$text['submitentercodealert'] = "Please enter the security code";
$text['submitenterrightcode'] = "Incorrect security code! Please try again.";
$text['submitmailnotsent'] = "We're sorry, but your submission could not be delivered.";
%end:%
%target:languages/German-UTF8/cust_text.php%
%location:%
?>
%end:%
%insert:before%
//$31 Added for Submit Photo/Document Link and Other Various Links
$text['enteratt'] = "Bitte wählen Sie eine Datei zum Anhängen aus";
$text['enteraccept'] = "Akzeptierte Dateitypen:";
$text['enterdescr'] = "Dateibeschreibung fehlt.";
$text['submitphotofor'] = "Einreichung von Fotos / Dokumenten:";
$text['submitphotohdr'] = "Foto / Dokument senden";
$text['optional'] = "Optional";
$text['sharephoto'] = "Foto / Dokument senden";
$text['submitphotocredit'] = "Kredit / Quelle";
$text['submitphotodescription'] = "Beschreibung";
$text['submitphotoattachment'] = "Anhang";
$text['submitphotorequiredfield'] = "Erforderliches Feld";
$text['submitremove'] = "Entfernen";
$text['submitaddattachment'] = "Einen weiteren Anhang hinzufügen";
$text['submitphotoprivacy'] = "Wir respektieren Ihre Privatsphäre - Ihr Name und Ihre E-Mail-Adresse werden nicht öffentlich angezeigt oder veröffentlicht.";
$text['submitphotobutton'] = "Anhang (e) senden";
$text['submitmessage1'] = "Danke xxx (yyy).";
$text['submitmessage2'] = "Datei (en) zur Überprüfung eingereicht an";
$text['submitsendcopy'] = "Sie sollten bald eine Kopie erhalten.";
$text['submitregards'] = "Mit freundlichen Grüßen";
$text['submitentercode'] = "Sicherheitscode eingeben";
$text['submitsecurity'] = "Sicherheitscode";
$text['submitentercodealert'] = "Bitte geben Sie den Sicherheitscode ein";
$text['submitenterrightcode'] = "Falscher Sicherheitscode! Bitte versuchen Sie es erneut.";
$text['submitmailnotsent'] = "Es tut uns leid, aber Ihre Einreichung konnte nicht zugestellt werden.";
%end:%
%target:languages/Czech-UTF8/cust_text.php%
%location:%
?>
%end:%
%insert:before%
// Added for Submit Photo/Document Link and Other Various Links
$text['enteratt'] = "Vyberte soubor, který chcete připojit";
$text['enteraccept'] = "Přijímané typy souborů:";
$text['enterdescr'] = "Chybí popis souboru.";
$text['submitphotofor'] = "Odeslání fotografie / dokumentu:";
$text['submitphotohdr'] = "Odeslat fotografii / dokument";
$text['optional'] = "Volitelné";
$text['sharephoto'] = "Odeslat fotografii / dokument";
$text['submitphotocredit'] = "Kredit / zdroj";
$text['submitphotodescription'] = "Popis";
$text['submitphotoattachment'] = "Příloha";
$text['submitphotorequiredfield'] = "Povinné pole";
$text['submitremove'] = "Odebrat";
$text['submitaddattachment'] = "Přidat další přílohu";
$text['submitphotoprivacy'] = "Respektujeme vaše soukromí - vaše jméno a e-mailová adresa nebudou veřejně zobrazeny ani zveřejněny.";
$text['submitphotobutton'] = "Odeslat přílohy";
$text['submitmessage1'] = "Děkuji xxx (rrr).";
$text['submitmessage2'] = "Soubory odeslané ke kontrole do";
$text['submitsendcopy'] = "Brzy byste měli obdržet kopii.";
$text['submitregards'] = "S pozdravem,";
$text['submitentercode'] = "Zadejte bezpečnostní kód";
$text['submitsecurity'] = "Bezpečnostní kód";
$text['submitentercodealert'] = "Zadejte bezpečnostní kód";
$text['submitenterrightcode'] = "Nesprávný bezpečnostní kód! Zkuste to prosím znovu.";
$text['submitmailnotsent'] = "Je nám líto, ale váš příspěvek nemohl být doručen.";
%end:%
%target:getperson.php%
//$31 location changed from :$namestr = getName( $row );
%location:%
$treeResult = getTreeSimple($tree);
%end:%
//$31 insert changed from :after
%insert:before%
// Added for Submit Photo/Document
$submittree = $tree;
$subpersonID = $personID;
$subentyp = "I";
%end:%
%target:familygroup.php%
%location:%
$photostr = showSmallPhoto
%end:%
%insert:before%
// Added for Submit Photo/Document
$submittree = $tree;
$subpersonID = $familyID;
$subentyp = "F";
%end:%
//NEW FILE
%newfile:submit_photo.php%
%fileversion:13.0.2.0%
\n";
echo "$submithdr \n";
//********************* MOD MANAGER PARAMETERS *********************
$numatts = "1";
$captcha_option = "1";
$captcha_file = "TNG_captcha.php";
$acceptexts = "jpg,jpeg,gif,png,pdf,doc,docx,odt,txt";
//******************* END MOD MANAGER PARAMETERS *******************
$captcha_filetouse = $captcha_option ? $captcha_file : "no_captcha";
$is_CSI = strstr($captcha_filetouse, "CaptchaSecurityImages") ? "true" : "";
$captcha_filetouse .= $is_CSI ? "?width=100&height=30&characters=5" : "";
$text['enteraccept'] .= str_replace (",", ", ", $acceptexts);
$file = array();
$description = array();
$attachment = array();
$attachment_name = array();
$moreatts = array();
if( !isset($_POST['submitatt']) ) @include($cms['tngpath'] . $captcha_filetouse);
else {
//************************ EMAIL ************************
//CUSTOMIZE $to_name
//Change $to_name = $dbowner; to anything you like
//Example: $to_name = "J. Robison";
$to_name = $dbowner; // from default config.php
//CUSTOMIZE $to_email
//Change $emailaddr to anything you like
//Example: $to_email = "uniquename@mailserver.com";
$to_email = $emailaddr; // from default config.php;
$from_name = stripslashes($_POST['txtName']);
$from_email = stripslashes($_POST['txtEmail']);
$subject = stripslashes($_POST['submithdr']);
$i = 1;
$prebody = '';
$filelist = '';
while ($i<=$numatts){
$description[$i] = stripslashes($_POST['mtxMessage'.$i]);
$attachment[$i] = $_FILES['attachment'.$i]['tmp_name'];
$attachment_name[$i] = $_FILES['attachment'.$i]['name'];
if( $attachment_name[$i] ) {
$prebody .= "\n".$text['submitphotoattachment'].": ".$attachment_name[$i]."\n";
$prebody .= $text['description'].": ".$description[$i]."\n";
$filelist .= $attachment_name[$i]." ";
}
$i++;
}
$txtcredit = stripslashes($_POST['txtCredit']);
if (!$txtcredit) $txtcredit = 'n/a';
$body = $_POST['submithdr']."\n";
if( $_POST['email_link'] ) $body .= "{$text['link']}: ".$_POST['email_link']."\n\n";
$body .= $admtext['personsname'].": ".$from_name."\n";
$body .= "E-mail: ".$_POST['txtEmail']."\n";
$body .= "IP ".$text['address'].": (".$_SERVER['REMOTE_ADDR'].")\n";
$body .= $prebody;
$body .= "\n".$text['submitphotocredit'].": ".$txtcredit."\n";
//Mail It
require_once("class.phpmailer.php");
if($tngconfig['usesmtp']) require_once("class.smtp.php");
$mail = new PHPMailer\PHPMailer\PHPMailer($options); //tng13 required change
if($tngconfig['usesmtp']) {
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = $tngconfig['mailhost']; // specify main and backup server or localhost
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = $tngconfig['mailuser']; // SMTP username
$mail->Password = $tngconfig['mailpass']; // SMTP password
if($tngconfig['mailenc'])
$mail->SMTPSecure = $tngconfig['mailenc']; // SMTP encryption
$mail->Port = $tngconfig['mailport'];
}
$emailtouse = $tngconfig['fromadmin'] == 1 ? $emailaddr : $from_email;
$mail->From = $emailtouse;
$mail->FromName = $from_name;
$mail->AddAddress($to_email, $to_name);
$mail->AddReplyTo($from_email, $from_name);
if ($_POST['mailme']) $mail->AddCC($emailtouse, $from_name);
$mail->CharSet = strtolower($session_charset);
if($session_charset && strtoupper($session_charset) != "ISO-8859-1") {
$mail->IsHTML(true);
$body = nl2br($body);
}
$mail->Subject = $subject;
$mail->Body = $body;
$i = 1;
while ($i<=$numatts){
if (isset($_FILES['attachment'.$i]) && $_FILES['attachment'.$i]['error'] == UPLOAD_ERR_OK) {
$mail->AddAttachment($attachment[$i], $attachment_name[$i]);
}
$i++;
}
$sendit = $mail->Send();
// *************** ACKNOWLEDGMENT MESSAGE ***************
if($sendit) {
$mailsent1 = "" . $text['submitmessage1'];
$fcolor = "black";
$mailsent1 = preg_replace( "/xxx/", $from_name, $mailsent1 );
$mailsent1 = preg_replace( "/yyy/", $_POST['txtEmail'], $mailsent1 );
$message = $mailsent1 . "
";
// *************** END ACKNOWLEDGMENT MESSAGE *************
?>
%fileend:%
%target:submit_photo.php%
%fileoptional:%
// Captcha option
%parameter:$numatts:1%
%desc:Max attachments Do not use quotes! Default is(1)%
%end:%
%parameter:$captcha_option:0%
%desc:Captcha option 0 = No captcha 1 = Use captcha Do not use quotes! Default is(0)%
%end:%
%parameter:$captcha_file:TNG_captcha.php%
%desc:Captcha file name Do not use quotes! Default is(TNG_captcha.php)%
%end:%
%parameter:$acceptexts:jpg,jpeg,gif,png,pdf,doc,docx,odt,txt%
%desc:Accepted extensions Separate with a comma only! Change or add extensions. Do not use quotes! Default is(jpg,jpeg,gif,png,pdf,doc,docx,odt,txt)%
%end:%