Esempio n. 1
0
 /**
  * Validates the Input Parameters onBeforeVendorUpdate
  *
  * @param array $d
  * @return boolean
  */
 function validate_update(&$d)
 {
     global $vmLogger;
     require_once CLASSPATH . 'imageTools.class.php';
     if (!vmImageTools::validate_image($d, "vendor_thumb_image", "vendor")) {
         return false;
     }
     if (!vmImageTools::validate_image($d, "vendor_full_image", "vendor")) {
         return false;
     }
     // convert all "," in prices to decimal points.
     if (stristr($d["vendor_min_pov"], ",")) {
         $d["vendor_min_pov"] = str_replace(',', '.', $d["vendor_min_pov"]);
     }
     if (!$d["vendor_name"]) {
         $vmLogger->err('You must enter a name for the vendor.');
         return False;
     }
     if (!$d["contact_email"]) {
         $vmLogger->err('You must enter an email address for the vendor contact.');
         return False;
     }
     if (!vmValidateEmail($d["contact_email"])) {
         $vmLogger->err('Please provide a valide email address for the vendor contact.');
         return False;
     }
     return True;
 }
Esempio n. 2
0
 function validate_delete($d)
 {
     global $vmLogger, $VM_LANG;
     if (!$d["notify_email"]) {
         $vmLogger->err($VM_LANG->_('VM_WAITING_LIST_DELETE_SELECT'));
         return False;
     }
     if (!vmValidateEmail($d["notify_email"])) {
         $vmLogger->err($VM_LANG->_('VM_WAITING_LIST_ERR_EMAIL_ENTER'));
         return False;
     }
     if (!$d["product_id"]) {
         $vmLogger->err($VM_LANG->_('VM_WAITING_LIST_DELETE_ERR_PRODUCT'));
         return False;
     }
     return True;
 }
Esempio n. 3
0
/**
* Mail function (uses phpMailer)
* @param string From e-mail address
* @param string From name
* @param string/array Recipient e-mail address(es)
* @param string E-mail subject
* @param string Message body
* @param boolean false = plain text, true = HTML
* @param string/array CC e-mail address(es)
* @param string/array BCC e-mail address(es)
* @param array Images path,cid,name,filename,encoding,mimetype
* @param string/array Attachment file name(s)
* @return boolean Mail send success
*/
function vmMail($from, $fromname, $recipient, $subject, $body, $Altbody = '', $mode = false, $cc = NULL, $bcc = NULL, $images = null, $attachment = null, $replyto = null)
{
    global $mosConfig_debug;
    // Filter from, fromname and subject
    if (!vmValidateEmail($from) || !vmValidateName($fromname) || !vmValidateName($subject)) {
        return false;
    }
    $mail = vmCreateMail($from, $fromname, $subject, $body);
    if ($Altbody != "") {
        // In this section we take care for utf-8 encoded mails
        $mail->AltBody = vmAbstractLanguage::safe_utf8_encode($Altbody, $mail->CharSet);
    }
    // activate HTML formatted emails
    if ($mode) {
        $mail->IsHTML(true);
    }
    if ($mail->ContentType == "text/plain") {
        $mail->Body = vmAbstractLanguage::safe_utf8_encode($mail->Body, $mail->CharSet);
    }
    if (is_array($recipient)) {
        foreach ($recipient as $to) {
            if (vmValidateEmail($to)) {
                $mail->AddAddress($to);
            }
        }
    } else {
        if (vmValidateEmail($recipient)) {
            $mail->AddAddress($recipient);
        }
    }
    if (isset($cc)) {
        if (is_array($cc)) {
            foreach ($cc as $to) {
                if (vmValidateEmail($to)) {
                    $mail->AddCC($to);
                }
            }
        } else {
            if (vmValidateEmail($cc)) {
                $mail->AddCC($cc);
            }
        }
    }
    if (isset($bcc)) {
        if (is_array($bcc)) {
            foreach ($bcc as $to) {
                if (vmValidateEmail($to)) {
                    $mail->AddBCC($to);
                }
            }
        } else {
            if (vmValidateEmail($bcc)) {
                $mail->AddBCC($bcc);
            }
        }
    }
    if (!empty($replyto) && vmValidateEmail($replyto)) {
        $mail->AddReplyTo($replyto);
    }
    if ($images) {
        foreach ($images as $image) {
            $mail->AddEmbeddedImage($image['path'], $image['name'], $image['filename'], $image['encoding'], $image['mimetype']);
        }
    }
    if ($attachment) {
        if (is_array($attachment)) {
            foreach ($attachment as $fname) {
                $mail->AddAttachment($fname);
            }
        } else {
            $mail->AddAttachment($attachment);
        }
    }
    $mailssend = $mail->Send();
    if ($mosConfig_debug) {
        //$mosDebug->message( "Mails send: $mailssend");
    }
    if ($mail->error_count > 0) {
        //$mosDebug->message( "The mail message $fromname <$from> about $subject to $recipient <b>failed</b><br /><pre>$body</pre>", false );
        //$mosDebug->message( "Mailer Error: " . $mail->ErrorInfo . "" );
    }
    return $mailssend;
}