You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

179 lines
6.2 KiB

<?php
function conv_date($od){
$tmp=explode("-",substr($od,0,10));
$stres = $tmp[2]."/".$tmp[1]."/".$tmp[0]."";
return $stres;
}
function conv_status($status){
$s = $status;
switch($status) {
case 'CREATED':
$s = 'Creato';
break;
case 'SHIPPED':
$s = 'Spedito';
break;
case 'PAID':
$s = 'Pagato';
break;
}
return $s;
}
function convert($stringa){
$strres = $stringa;
$strres = str_replace("'","&#039;",$strres);
return stripslashes(nl2br($strres));
}
function convert_mce($stringa){
$strres = $stringa;
$strres = str_replace("'","&#039;",$strres);
return stripslashes($strres);
}
function conv_url($text){
$entities = array('+','%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
$replacements = array('-','_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_',);
return str_replace($entities, $replacements, urlencode($text));
}
function save_photo($foto,$basepath,$id){
$filename = $foto;
// Get new sizes
list($width, $height) = getimagesize($filename);
$percent=800/$width;
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
switch(exif_imagetype($filename)){
case 1:
$source = imagecreatefromgif($filename);
break;
case 2:
$source = imagecreatefromjpeg($filename);
break;
case 3:
$source = imagecreatefrompng($filename);
break;
}
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thumb, $basepath."$id.jpg");
// echo $basepath."$id.jpg";
}
/*
function sendMail($SM_email,$SM_email2,$SM_email_CC,$SM_subject,$SM_message,$SM_showalert,$SM_append){
$host=$GLOBALS['BASE_URL']."";
$send_date=conv_date(date("Y-m-d"));
$top=<<<ttop
<html><head><style>
body{font-family: sans, Arial; margin: 0px; font-size: 10pt;}
td{font-family: sans-serif; font-size: 10pt;}
</style><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body bgcolor="#4e984a"><center>
<table border="0" width="720" cellspadding="20">
<tr><td align="center" colspan="2">
<img src="$host/images/logo-white.png" alt="Ordine dei Farmacisti di Salerno" width="150"><br><br></td></tr>
<tr><td align="left" style="padding:5px; color: white" ><b>$SM_subject</b></td>
<td align="right" style="padding:5px; color: white" >$send_date</td></tr>
<tr><td style="border-top: 8px solid #FFFFFF;border-left: 1px solid #FFFFFF;border-right: 1px solid #FFFFFF;border-bottom: 8px solid #FFFFFF;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px; padding:10px;line-height:23px" bgcolor="white" colspan="2">
ttop;
$bottom="</td></tr>";
$bottom.="<tr><td colspan=\"2\" align=\"center\" style=\"text-align:justify; font-size:8pt; color: white\"><br>".
"Questa e-mail contiene informazioni di propriet&agrave; e di natura confidenziale. Se non siete il destinatario corretto di questo messaggio, vi ricordiamo che ogni diffusione, distribuzione o copia di questo messaggio &egrave; severamente proibita. Se avete ricevuto questo messaggio per errore, siete pregati di cancellarlo immediatamente. Quanto precede ai fini del rispetto del D.L. n. 196/03 sulla tutela dei dati personali.<br>-<br>".
"This e-mail (and any attachments) is strictly confidential and for use only by intendend recipients. If you are not an intended recipients, we point you that any diffusion, distribution or copy of this message is severely forbidden. If you have received t his message by mistake please destroy it immediately (under the observance of D.L. n. 196/03 which protects personal data).".
"<br>Rispetta l'ambiente. Non stampare questa mail se non &egrave; necessaria.";
$bottom.="</td></tr></table></center></body></html>";
$headers = "From: \"Ordine dei Farmacisti di Salerno\" <info@ordinefarmacistisalerno.itt> \n";
$headers .= "MIME-Version: 1.0\n";
$msg="";
if($SM_append){
$append_name = basename($SM_append);
$append_type = mime_content_type($SM_append);
$data = chunk_split(base64_encode(file_get_contents($SM_append)));
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "Content-Type: multipart/mixed;\n";
$headers .= " boundary=\"{$mime_boundary}\"\n";
$headers .= "X-Mailer: PHP " . phpversion();
$msg .= "This is a multi-part message in MIME format.\n\n";
$msg .= "--{$mime_boundary}\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= $top.$SM_message.$bottom."\n\n";
$msg .= "--{$mime_boundary}\n";
$msg .= "Content-Type: {$append_type}; name=\"{$append_name}\"\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content-Disposition: attachment; filename=\"{$append_name}\"\n\n";
$msg .= $data."\n\n";
$msg .= "--{$mime_boundary}--\n";
}else{
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg = $top.$SM_message.$bottom."\n\n";
}
if(@mail(trim($SM_email),$SM_subject,$msg, $headers)){
if(@$SM_email2){
if($SM_email_CC){
$headers = "Bcc: $SM_email_CC \n".$headers;
}
@mail(trim($SM_email2),$SM_subject,$msg, $headers)or die("errore invio mail");
}
if($SM_showalert){
echo "<br><center><h1><i class=\"fa fa-check\"></i></h1><h2>E-mail inviata correttamente</h2><br></center>";
}
}else{
if($SM_showalert){
echo "<br><br><br><center><h1><i class=\"fa fa-exclamation-triangle\"></i></h1><h2>ERRORE:</h2><br>".
"Si &egrave; verificato un errore nell'invio della mail.<br>".
"Si prega contattare l'amministratore del sistema.</center>";
}
}
$of=fopen("../mailoutput.html","w");
fwrite($of, "Email:".$SM_email."\n<br>Email:".$SM_email2."\n<br>Email CC:".$SM_email_CC."\n<br>Subject:".$SM_subject."\n<br><br>CONTENT:\n".$msg);
fclose($of);
}
*/
?>