<?
define("N_REMINDERS",0);
define("N_COMMENT",1);
define("N_MAIL",2);
define("N_FREQUEST",3);
define("N_NEWS",4);
define("N_SIZE",10);
$avatars[1] = "http://www.ubixonline.com/images/sb/none.gif";
$avatars[2] = "http://www.ubixonline.com/images/sb/female_icon.png";
$avatars[3] = "http://www.ubixonline.com/images/sb/male_icon.png";
function fixHTML($str) {
$str = preg_replace("/'/","'",$str);
$pattern = "/COLOR=\"(.*?)\"/i";
$str = preg_replace($pattern,"color:$1;",$str);
$pattern = "/SIZE=\"(.*?)\"/i";
$str = preg_replace($pattern, "font-size:$1px;",$str);
$pattern = "/FACE=\"(.*?)\"/i";
$str = preg_replace($pattern, "font-family:$1;",$str);
$pattern = "/ALIGN=\"(.*?)\"/i";
$str = preg_replace($pattern, "text-align:$1;",$str);
$pattern = "/<\/FONT.*?>/i";
$str = preg_replace($pattern, "</font>",$str);
$pattern = "/<\/P>/i";
$str = preg_replace($pattern, "</p>",$str);
$pattern= "/<LI>/i";
$str = preg_replace($pattern, "<li>",$str);
$pattern= "/<\/LI>/i";
$str = preg_replace($pattern, "</li>",$str);
$pattern= "/<UL>/i";
$str = preg_replace($pattern, "<ul>",$str);
$pattern = "/KERNING=\"(.*?)\"/i";
$str = preg_replace($pattern,"",$str);
$pattern = "/LETTERSPACING=\"(.*?)\"/i";
$str = preg_replace($pattern,"",$str);
$pattern = "/<P (.*?)>/i";
$str = preg_replace($pattern, "<p style=\"$1\">",$str);
$pattern = "/<FONT (.*?)>/i";
$str = preg_replace($pattern, "<font style=\"$1\">",$str);
return($str);
}
function send_mail($to, $body, $subject, $fromaddress, $fromname, $notification=0) {
$eol="\r\n";
$mime_boundary=md5(time());
$body = "$body\n<br><br>\n<p>If you wish to change how you receive future notifications, please <a href=\"http://www.tuve.tv/notification.php?data[notification]=$notification\">click here</a>.<br>\nIf you have any questions, please contact <a href=\"mailto:support@tuve.tv\">support@tuve.tv</a>.</p>\n<p style=\"width: 550px; margin: 3px auto; font: 10px arial, sans-serif; color: #999;\">© 2008, Ubix Media Group</p>";
# Common Headers
$headers .= "From: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
$headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol; // these two to set reply address
$headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters
# Boundry for marking the split & Multitype Headers
$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= "Content-Type: multipart/alternative; $eol boundary=------------$mime_boundary"; //$eol";
$msg = "This is a multi-part message in MIME format.$eol";
# Open the first part of the mail
# Text Version
$msg .= "--------------$mime_boundary$eol";
$msg .= "Content-Type: text/plain; charset=iso-8859-1; format=flowed".$eol;
$msg .= "Content-Transfer-Encoding: 7bit".$eol.$eol;
$msg .= strip_tags(str_ireplace("<br>", "\r\n",$body)) .$eol . $eol;
#$msg .= strip_tags(str_replace("<br>", "\r\n", substr($body, (strpos($body, "<body>")+6)))).$eol.$eol;
# HTML Version
$msg .= "--------------$mime_boundary$eol";
$msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 7bit".$eol.$eol;
$msg .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">$eol<html>$eol<head>$eol</head>$eol<body bgcolor=\"#ffffff\" text=\"#000000\">$eol";
$msg .= $body.$eol.$eol;
$msg .= "</body>$eol</html>$eol";
# SEND THE EMAIL
ini_set(sendmail_from,$fromaddress); // the INI lines are to force the From Address to be used !
$mail_sent = mail($to, $subject, $msg, $headers);
ini_restore(sendmail_from);
return $mail_sent;
}
function makeRating($rating) {
$ret = "<SELECT NAME=\"data[rating][$vid]\">\n";
$ret .= "<OPTION VALUE=\"1\">Y</OPTION>\n";
$ret .= "<OPTION VALUE=\"1\">Y7</OPTION>\n";
$ret .= "<OPTION VALUE=\"1\">G</OPTION>\n";
$ret .= "<OPTION VALUE=\"1\">PG</OPTION>\n";
$ret .= "<OPTION VALUE=\"1\">14</OPTION>\n";
$ret .= "<OPTION VALUE=\"1\">MA</OPTION>\n";
$ret .= "<OPTION VALUE=\"1\">AD</OPTION>\n";
$ret .= "</SELECT>\n";
return($ret);
}
?>