コード例 #1
0
ファイル: ps_communication.php プロジェクト: noikiy/owaspbwa
 /**
  */
 function mail_question(&$d)
 {
     global $vmLogger, $Itemid, $_SESSION, $VM_LANG, $mosConfig_live_site, $mosConfig_lang, $sess;
     $db = new ps_DB();
     $product_id = (int) $d["product_id"];
     $q = 'SELECT * FROM #__{vm}_product WHERE product_id=' . $product_id . ' AND product_publish=\'Y\'';
     $db->query($q);
     if (!$db->next_record()) {
         $vmLogger->err($VM_LANG->_('NOT_AUTH', false));
         return false;
     }
     if ($db->f("product_sku") != @$d["product_sku"]) {
         $vmLogger->err($VM_LANG->_('NOT_AUTH', false));
         return false;
     }
     $Itemid = $sess->getShopItemid();
     $flypage = vmGet($_REQUEST, "flypage", null);
     // product url
     $product_url = $mosConfig_live_site . "/index.php?option=com_virtuemart&page=shop.product_details&flypage=" . urlencode($flypage) . "&product_id={$product_id}&Itemid={$Itemid}";
     $dbv = new ps_DB();
     $qt = "SELECT * from #__{vm}_vendor ";
     $qt .= "WHERE vendor_id = '" . $_SESSION['ps_vendor_id'] . "'";
     $dbv->query($qt);
     $dbv->next_record();
     $vendor_email = $dbv->f("contact_email");
     $shopper_email = $d["email"];
     $shopper_name = $d["name"];
     $subject_msg = vmRequest::getVar('text', '', 'post');
     $shopper_subject = sprintf($VM_LANG->_('VM_ENQUIRY_SHOPPER_EMAIL_SUBJECT'), $dbv->f("vendor_name"));
     $shopper_msg = str_replace('{vendor_name}', $dbv->f("vendor_name"), $VM_LANG->_('VM_ENQUIRY_SHOPPER_EMAIL_MESSAGE'));
     $shopper_msg = str_replace('{product_name}', $db->f("product_name"), $shopper_msg);
     $shopper_msg = str_replace('{product_sku}', $db->f("product_sku"), $shopper_msg);
     $shopper_msg = str_replace('{product_url}', $product_url, $shopper_msg);
     $shopper_msg = vmHtmlEntityDecode($shopper_msg);
     //
     $vendor_subject = sprintf($VM_LANG->_('VM_ENQUIRY_VENDOR_EMAIL_SUBJECT'), $dbv->f("vendor_name"), $db->f("product_name"));
     $vendor_msg = str_replace('{shopper_name}', $shopper_name, $VM_LANG->_('VM_ENQUIRY_VENDOR_EMAIL_MESSAGE'));
     $vendor_msg = str_replace('{shopper_message}', $subject_msg, $vendor_msg);
     $vendor_msg = str_replace('{shopper_email}', $shopper_email, $vendor_msg);
     $vendor_msg = str_replace('{product_name}', $db->f("product_name"), $vendor_msg);
     $vendor_msg = str_replace('{product_sku}', $db->f("product_sku"), $vendor_msg);
     $vendor_msg = str_replace('{product_url}', $product_url, $vendor_msg);
     $vendor_msg = vmHtmlEntityDecode($vendor_msg);
     //END: set up text mail
     /////////////////////////////////////
     // Send text email
     //
     if (ORDER_MAIL_HTML == '0') {
         // Mail receipt to the shopper
         vmMail($vendor_email, $dbv->f("vendor_name"), $shopper_email, $shopper_subject, $shopper_msg, "");
         // Mail receipt to the vendor
         vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $vendor_msg, "");
     } elseif (ORDER_MAIL_HTML == '1') {
         // Mail receipt to the vendor
         $template = vmTemplate::getInstance();
         $template->set_vars(array('vendorname' => $dbv->f("vendor_name"), 'subject' => nl2br($subject_msg), 'contact_name' => $shopper_name, 'contact_email' => $shopper_email, 'product_name' => $db->f("product_name"), 'product_s_description' => $db->f("product_s_desc"), 'product_url' => $product_url, 'product_sku' => $db->f("product_sku")));
         if ($db->f("product_thumb_image")) {
             $imagefile = pathinfo($db->f("product_thumb_image"));
             $extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg";
             $EmbeddedImages[] = array('path' => IMAGEPATH . "product/" . $db->f("product_thumb_image"), 'name' => "product_image", 'filename' => $db->f("product_thumb_image"), 'encoding' => "base64", 'mimetype' => "image/" . $extension);
             $template->set('product_thumb', '<img src="cid:product_image" alt="product_image" border="0" />');
             $body = $template->fetch('order_emails/enquiry_email.tpl.php');
             $vendor_mail = vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $body, $vendor_msg, true, null, null, $EmbeddedImages);
         } else {
             $template->set('product_thumb', '');
             $body = $template->fetch('order_emails/enquiry_email.tpl.php');
             $vendor_mail = vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $body, $vendor_msg, true, null, null, null);
         }
         //Send sender confirmation email
         $sender_mail = vmMail($vendor_email, $dbv->f("vendor_name"), $shopper_email, $shopper_subject, $shopper_msg, "");
         if (!$vendor_mail || !$sender_mail) {
             $vmLogger->debug('Something went wrong while sending the enquiry email to ' . $vendor_email . ' and ' . $shopper_email);
             return false;
         }
     }
     return true;
 }
コード例 #2
0
ファイル: ps_shopper.php プロジェクト: albertobraschi/Hab
 /**
  * Sends new/updated user notification emails 
  *
  * @param string $name - The name of the newly created/updated user
  * @param string $email - The email address of the newly created/updated user
  * @param string $username - The username of the newly created/updated user
  * @param string $password - The plain text password of the newly created/updated user
  */
 function _sendMail($name, $email, $username, $pwd, $activation_link = '')
 {
     global $database, $acl, $VM_LANG;
     global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_useractivation;
     global $mosConfig_mailfrom, $mosConfig_fromname;
     $subject = sprintf($VM_LANG->_('SEND_SUB', false), $name, $mosConfig_sitename);
     $subject = vmHtmlEntityDecode($subject, ENT_QUOTES);
     if ($mosConfig_useractivation == "1") {
         $message = sprintf($VM_LANG->_('USEND_MSG_ACTIVATE', false), $name, $mosConfig_sitename, $activation_link, $mosConfig_live_site, $username, $pwd);
     } else {
         $message = sprintf($VM_LANG->_('PHPSHOP_USER_SEND_REGISTRATION_DETAILS', false), $name, $mosConfig_sitename, $mosConfig_live_site, $username, $pwd);
     }
     $message = vmHtmlEntityDecode($message, ENT_QUOTES);
     // Send email to user
     if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
         $adminName2 = $mosConfig_fromname;
         $adminEmail2 = $mosConfig_mailfrom;
     } else {
         $query = "SELECT name, email" . "\n FROM #__users" . "\n WHERE LOWER( usertype ) = 'superadministrator'" . "\n OR LOWER( usertype ) = 'super administrator'";
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         $row2 = $rows[0];
         $adminName2 = $row2->name;
         $adminEmail2 = $row2->email;
     }
     if (VM_REGISTRATION_TYPE != 'NO_REGISTRATION' || VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION' && !empty($d['register_account'])) {
         vmMail($adminEmail2, $adminName2, $email, $subject, $message);
     }
     // Send notification to all administrators
     $subject2 = sprintf($VM_LANG->_('SEND_SUB', false), $name, $mosConfig_sitename);
     $message2 = sprintf($VM_LANG->_('ASEND_MSG', false), $adminName2, $mosConfig_sitename, $name, $email, $username);
     $subject2 = vmHtmlEntityDecode($subject2, ENT_QUOTES);
     $message2 = vmHtmlEntityDecode($message2, ENT_QUOTES);
     // get superadministrators id
     $admins = $acl->get_group_objects(25, 'ARO');
     if (empty($admins['users'])) {
         return;
     }
     foreach ($admins['users'] as $id) {
         $query = "SELECT email, sendEmail" . "\n FROM #__users" . "\n WHERE id = {$id}";
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         $row = $rows[0];
         if ($row->sendEmail) {
             vmMail($adminEmail2, $adminName2, $row->email, $subject2, $message2);
         }
     }
 }
コード例 #3
0
ファイル: ps_checkout.php プロジェクト: noikiy/owaspbwa
 /**
  * Create a receipt for the current order and email it to
  * the customer and the vendor.
  * @author gday
  * @author soeren
  * @param int $order_id
  * @return boolean True on success, false on failure
  */
 function email_receipt($order_id)
 {
     global $sess, $ps_product, $VM_LANG, $CURRENCY_DISPLAY, $vmLogger, $mosConfig_fromname, $mosConfig_lang, $database;
     $ps_vendor_id = vmGet($_SESSION, 'ps_vendor_id', 1);
     $auth = $_SESSION["auth"];
     require_once CLASSPATH . 'ps_order_status.php';
     require_once CLASSPATH . 'ps_userfield.php';
     require_once CLASSPATH . 'ps_product.php';
     $ps_product = new ps_product();
     // Connect to database and gather appropriate order information
     $db = new ps_DB();
     $q = "SELECT * FROM #__{vm}_orders WHERE order_id='{$order_id}'";
     $db->query($q);
     $db->next_record();
     $user_id = $db->f("user_id");
     $customer_note = $db->f("customer_note");
     $order_status = ps_order_status::getOrderStatusName($db->f("order_status"));
     $dbbt = new ps_DB();
     $dbst = new ps_DB();
     $qt = "SELECT * FROM #__{vm}_user_info WHERE user_id='" . $user_id . "' AND address_type='BT'";
     $dbbt->query($qt);
     $dbbt->next_record();
     $qt = "SELECT * FROM #__{vm}_user_info WHERE user_info_id='" . $db->f("user_info_id") . "'";
     $dbst->query($qt);
     $dbst->next_record();
     $dbv = new ps_DB();
     $qt = "SELECT * from #__{vm}_vendor ";
     /* Need to decide on vendor_id <=> order relationship */
     $qt .= "WHERE vendor_id = '" . $ps_vendor_id . "'";
     $dbv->query($qt);
     $dbv->next_record();
     $dboi = new ps_DB();
     $q_oi = "SELECT * FROM #__{vm}_product, #__{vm}_order_item, #__{vm}_orders ";
     $q_oi .= "WHERE #__{vm}_product.product_id=#__{vm}_order_item.product_id ";
     $q_oi .= "AND #__{vm}_order_item.order_id='{$order_id}' ";
     $q_oi .= "AND #__{vm}_orders.order_id=#__{vm}_order_item.order_id";
     $dboi->query($q_oi);
     $db_payment = new ps_DB();
     $q = "SELECT op.payment_method_id, pm.payment_method_name FROM #__{vm}_order_payment as op, #__{vm}_payment_method as pm\n              WHERE order_id='{$order_id}' AND op.payment_method_id=pm.payment_method_id";
     $db_payment->query($q);
     $db_payment->next_record();
     if ($auth["show_price_including_tax"] == 1) {
         $order_shipping = $db->f("order_shipping");
         $order_shipping += $db->f("order_shipping_tax");
         $order_shipping_tax = 0;
         $order_tax = $db->f("order_tax") + $db->f("order_shipping_tax");
     } else {
         $order_shipping = $db->f("order_shipping");
         $order_shipping_tax = $db->f("order_shipping_tax");
         $order_tax = $db->f("order_tax");
     }
     $order_total = $db->f("order_total");
     $order_discount = $db->f("order_discount");
     $coupon_discount = $db->f("coupon_discount");
     // Email Addresses for shopper and vendor
     // **************************************
     $shopper_email = $dbbt->f("user_email");
     $shopper_name = $dbbt->f("first_name") . " " . $dbbt->f("last_name");
     $from_email = $dbv->f("contact_email");
     $shopper_subject = $dbv->f("vendor_name") . " " . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL', false) . " - " . $db->f("order_id");
     $vendor_subject = $dbv->f("vendor_name") . " " . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL', false) . " - " . $db->f("order_id");
     $shopper_order_link = $sess->url(SECUREURL . "index.php?page=account.order_details&order_id={$order_id}", true, false);
     $vendor_order_link = $sess->url(SECUREURL . "index2.php?page=order.order_print&order_id={$order_id}&pshop_mode=admin", true, false);
     /**
      * Prepare the payment information, including Credit Card information when not empty
      */
     $payment_info_details = $db_payment->f("payment_method_name");
     if (!empty($_SESSION['ccdata']['order_payment_name']) && !empty($_SESSION['ccdata']['order_payment_number'])) {
         $payment_info_details .= '<br />' . $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_NAMECARD', false) . ': ' . $_SESSION['ccdata']['order_payment_name'] . '<br />';
         $payment_info_details .= $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_CCNUM', false) . ': ' . $this->asterisk_pad($_SESSION['ccdata']['order_payment_number'], 4) . '<br />';
         $payment_info_details .= $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_EXDATE', false) . ': ' . $_SESSION['ccdata']['order_payment_expire_month'] . ' / ' . $_SESSION['ccdata']['order_payment_expire_year'] . '<br />';
         if (!empty($_SESSION['ccdata']['credit_card_code'])) {
             $payment_info_details .= 'CVV code: ' . $_SESSION['ccdata']['credit_card_code'] . '<br />';
         }
     }
     // Convert HTML into Text
     $payment_info_details_text = str_replace('<br />', "\n", $payment_info_details);
     // Get the Shipping Details
     $shipping_arr = explode("|", urldecode(vmGet($_REQUEST, "shipping_rate_id")));
     // Headers and Footers
     // ******************************
     // Shopper Header
     $shopper_header = $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER1', false) . "\n";
     $legal_info_title = '';
     $legal_info_html = '';
     // Get the legal information about the returns/order cancellation policy
     if (@VM_ONCHECKOUT_SHOW_LEGALINFO == '1') {
         $article = intval(@VM_ONCHECKOUT_LEGALINFO_LINK);
         if ($article > 0) {
             $db_legal = new ps_DB();
             // Get the content article, which contains the Legal Info
             $db_legal->query('SELECT id, title, introtext FROM #__content WHERE id=' . $article);
             $db_legal->next_record();
             if ($db_legal->f('introtext')) {
                 $legal_info_title = $db_legal->f('title');
                 $legal_info_text = strip_tags(str_replace('<br />', "\n", $db_legal->f('introtext')));
                 $legal_info_html = $db_legal->f('introtext');
             }
         }
     }
     //Shopper Footer
     $shopper_footer = "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER2', false) . "\n";
     if (VM_REGISTRATION_TYPE != 'NO_REGISTRATION') {
         $shopper_footer .= "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5', false) . "\n";
         $shopper_footer .= $shopper_order_link;
     }
     $shopper_footer .= "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER3', false) . "\n";
     $shopper_footer .= "Email: " . $from_email;
     // New in version 1.0.5
     if (@VM_ONCHECKOUT_SHOW_LEGALINFO == '1' && !empty($legal_info_title)) {
         $shopper_footer .= "\n\n____________________________________________\n";
         $shopper_footer .= $legal_info_title . "\n";
         $shopper_footer .= $legal_info_text . "\n";
     }
     // Vendor Header
     $vendor_header = $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER4', false) . "\n";
     // Vendor Footer
     $vendor_footer = "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5', false) . "\n";
     $vendor_footer .= $vendor_order_link;
     $vendor_email = $from_email;
     /////////////////////////////////////
     // set up text mail
     //
     // Main Email Message Purchase Order
     // *********************************
     $shopper_message = "\n" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL', false) . "\n";
     $shopper_message .= "------------------------------------------------------------------------\n";
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER', false) . ": " . $db->f("order_id") . "\n";
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_DATE', false) . ":   ";
     $shopper_message .= strftime($VM_LANG->_('DATE_FORMAT_LC'), $db->f("cdate")) . "\n";
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_STATUS', false) . ": ";
     $shopper_message .= $order_status . "\n\n";
     // BillTo Fields
     $registrationfields = ps_userfield::getUserFields('registration', false, '', false, true);
     foreach ($registrationfields as $field) {
         if ($field->name == 'email') {
             $field->name = 'user_email';
         }
         if ($field->name == 'delimiter_sendregistration' || $field->type == 'captcha') {
             continue;
         }
         if ($field->type == 'delimiter') {
             $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . "\n";
             $shopper_message .= "--------------------\n\n";
         } else {
             $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . ':    ';
             $shopper_message .= $dbbt->f($field->name) . "\n";
         }
     }
     // Shipping Fields
     $shopper_message .= "\n\n";
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIP_TO_LBL') . "\n";
     $shopper_message .= "-------\n\n";
     $shippingfields = ps_userfield::getUserFields('shipping', false, '', false, true);
     foreach ($shippingfields as $field) {
         if ($field->type == 'delimiter') {
             $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . "\n";
             $shopper_message .= "--------------------\n\n";
         } else {
             $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . ':    ';
             $shopper_message .= $dbst->f($field->name) . "\n";
         }
     }
     $shopper_message .= "\n\n";
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_ITEMS_LBL', false) . "\n";
     $shopper_message .= "-----------";
     $sub_total = 0.0;
     while ($dboi->next_record()) {
         $shopper_message .= "\n\n";
         $shopper_message .= $VM_LANG->_('PHPSHOP_PRODUCT', false) . "  = ";
         if ($dboi->f("product_parent_id")) {
             $shopper_message .= $dboi->f("order_item_name") . "\n";
             $shopper_message .= "SERVICE  = ";
         }
         $shopper_message .= $dboi->f("product_name") . "; " . $dboi->f("product_attribute") . "\n";
         $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_QUANTITY', false) . " = ";
         $shopper_message .= $dboi->f("product_quantity") . "\n";
         $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SKU', false) . "      = ";
         $shopper_message .= $dboi->f("order_item_sku") . "\n";
         $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PRICE', false) . "    = ";
         if ($auth["show_price_including_tax"] == 1) {
             $sub_total += $dboi->f("product_quantity") * $dboi->f("product_final_price");
             $shopper_message .= $CURRENCY_DISPLAY->getFullValue($dboi->f("product_final_price"), '', $db->f('order_currency'));
         } else {
             $sub_total += $dboi->f("product_quantity") * $dboi->f("product_final_price");
             $shopper_message .= $CURRENCY_DISPLAY->getFullValue($dboi->f("product_item_price"), '', $db->f('order_currency'));
         }
     }
     $shopper_message .= "\n\n";
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SUBTOTAL', false) . " = ";
     $shopper_message .= $CURRENCY_DISPLAY->getFullValue($sub_total, '', $db->f('order_currency')) . "\n";
     if (PAYMENT_DISCOUNT_BEFORE == '1') {
         if (!empty($order_discount)) {
             if ($order_discount > 0) {
                 $shopper_message .= $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT', false) . " = ";
                 $shopper_message .= "- " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n";
             } else {
                 $shopper_message .= $VM_LANG->_('PHPSHOP_FEE', false) . " = ";
                 $shopper_message .= "+ " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n";
             }
         }
         if (!empty($coupon_discount)) {
             /* following 2 lines added by Erich for coupon hack */
             $shopper_message .= $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT', false) . ": ";
             $shopper_message .= $CURRENCY_DISPLAY->getFullValue($coupon_discount, '', $db->f('order_currency')) . "\n";
         }
     }
     if ($auth["show_price_including_tax"] != 1) {
         $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX', false) . "      = ";
         $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . "\n";
     }
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING', false) . " = ";
     $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_shipping, '', $db->f('order_currency')) . "\n";
     if (!empty($order_shipping_tax)) {
         $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_TAX', false) . "   = ";
         $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_shipping_tax, '', $db->f('order_currency'));
     }
     $shopper_message .= "\n\n";
     if (PAYMENT_DISCOUNT_BEFORE != '1') {
         if (!empty($order_discount)) {
             if ($order_discount > 0) {
                 $shopper_message .= $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT', false) . " = ";
                 $shopper_message .= "- " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n";
             } else {
                 $shopper_message .= $VM_LANG->_('PHPSHOP_FEE', false) . " = ";
                 $shopper_message .= "+ " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n";
             }
         }
         if (!empty($coupon_discount)) {
             /* following 2 lines added by Erich for coupon hack */
             $shopper_message .= $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT', false) . ": ";
             $shopper_message .= $CURRENCY_DISPLAY->getFullValue($coupon_discount, '', $db->f('order_currency')) . "\n";
         }
     }
     $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL', false) . "    = ";
     $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_total, '', $db->f('order_currency'));
     if ($auth["show_price_including_tax"] == 1) {
         $shopper_message .= "\n---------------";
         $shopper_message .= "\n";
         $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX', false) . "      = ";
         $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . "\n";
     }
     if ($db->f('order_tax_details')) {
         $shopper_message .= str_replace('<br />', "\n", ps_checkout::show_tax_details($db->f('order_tax_details'), $db->f('order_currency')));
     }
     // Payment Details
     $shopper_message .= "\n\n------------------------------------------------------------------------\n";
     $shopper_message .= $payment_info_details_text;
     // Shipping Details
     if (is_object($this->_SHIPPING)) {
         $shopper_message .= "\n\n------------------------------------------------------------------------\n";
         $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_LBL', false) . ":\n";
         $shopper_message .= $shipping_arr[1] . " (" . $shipping_arr[2] . ")";
     }
     // Customer Note
     $shopper_message .= "\n\n------------------------------------------------------------------------\n";
     $shopper_message .= "\n" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUSTOMER_NOTE', false) . "\n";
     $shopper_message .= "---------------";
     $shopper_message .= "\n";
     if (!empty($customer_note)) {
         $shopper_message .= $customer_note . "\n";
     } else {
         $shopper_message .= " ./. \n";
     }
     $shopper_message .= "------------------------------------------------------------------------\n";
     // Decode things like &euro; => €
     $shopper_message = vmHtmlEntityDecode($shopper_message);
     // End of Purchase Order
     // *********************
     //
     //END: set up text mail
     /////////////////////////////////////
     // Send text email
     //
     if (ORDER_MAIL_HTML == '0') {
         $msg = $shopper_header . $shopper_message . $shopper_footer;
         // Mail receipt to the shopper
         vmMail($from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $msg, "");
         $msg = $vendor_header . $shopper_message . $vendor_footer;
         // Mail receipt to the vendor
         vmMail($from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $msg, "");
     } elseif (ORDER_MAIL_HTML == '1') {
         $dboi->query($q_oi);
         // Create Template Object
         $template = vmTemplate::getInstance();
         if ($order_discount > 0) {
             $order_discount_lbl = $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT');
             $order_discount_plusminus = '-';
         } else {
             $order_discount_lbl = $VM_LANG->_('PHPSHOP_FEE');
             $order_discount_plusminus = '+';
         }
         if ($coupon_discount > 0) {
             $coupon_discount_lbl = $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT');
             $coupon_discount_plusminus = '-';
         } else {
             $coupon_discount_lbl = $VM_LANG->_('PHPSHOP_FEE');
             $coupon_discount_plusminus = '+';
         }
         if (is_object($this->_SHIPPING)) {
             $shipping_info_details = stripslashes($shipping_arr[1]) . " (" . stripslashes($shipping_arr[2]) . ")";
         } else {
             $shipping_info_details = ' ./. ';
         }
         // These are a lot of vars to import for the email confirmation
         $template->set_vars(array('is_email_to_shopper' => true, 'db' => $db, 'dboi' => $dboi, 'dbbt' => $dbbt, 'dbst' => $dbst, 'ps_product' => $ps_product, 'shippingfields' => $shippingfields, 'registrationfields' => $registrationfields, 'order_id' => $order_id, 'order_discount' => $order_discount, 'order_discount_lbl' => $order_discount_lbl, 'order_discount_plusminus' => $order_discount_plusminus, 'coupon_discount' => $coupon_discount, 'coupon_discount_lbl' => $coupon_discount_lbl, 'coupon_discount_plusminus' => $coupon_discount_plusminus, 'order_date' => $VM_LANG->convert(vmFormatDate($db->f("cdate"), $VM_LANG->_('DATE_FORMAT_LC'))), 'order_status' => $order_status, 'legal_info_title' => $legal_info_title, 'legal_info_html' => $legal_info_html, 'order_link' => $shopper_order_link, 'payment_info_lbl' => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYINFO_LBL'), 'payment_info_details' => $payment_info_details, 'shipping_info_lbl' => $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_LBL'), 'shipping_info_details' => $shipping_info_details, 'from_email' => $from_email, 'customer_note' => nl2br($customer_note), 'order_header_msg' => $shopper_header, 'order_subtotal' => $CURRENCY_DISPLAY->getFullValue($sub_total, '', $db->f('order_currency')), 'order_shipping' => $CURRENCY_DISPLAY->getFullValue($order_shipping, '', $db->f('order_currency')), 'order_tax' => $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . ps_checkout::show_tax_details($db->f('order_tax_details'), $db->f('order_currency')), 'order_total' => $CURRENCY_DISPLAY->getFullValue($order_total, '', $db->f('order_currency'))));
         $shopper_html = $template->fetch('order_emails/confirmation_email.tpl.php');
         // Reset the list of order items for use in the vendor email
         $dboi->reset();
         // Override some vars for the vendor email, so we can use the same template
         $template->set_vars(array('order_header_msg' => $vendor_header, 'order_link' => $vendor_order_link, 'is_email_to_shopper' => false));
         $vendor_html = $template->fetch('order_emails/confirmation_email.tpl.php');
         /*
          * Add the text, html and embedded images.
          * The name of the image should match exactly
          * (case-sensitive) to the name in the html.
          */
         $shopper_mail_Body = $shopper_html;
         $shopper_mail_AltBody = $shopper_header . $shopper_message . $shopper_footer;
         $vendor_mail_Body = $vendor_html;
         $vendor_mail_AltBody = $vendor_header . $shopper_message . $vendor_footer;
         $imagefile = pathinfo($dbv->f("vendor_full_image"));
         $extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg";
         $EmbeddedImages[] = array('path' => IMAGEPATH . "vendor/" . $dbv->f("vendor_full_image"), 'name' => "vendor_image", 'filename' => $dbv->f("vendor_full_image"), 'encoding' => "base64", 'mimetype' => "image/" . $extension);
         $shopper_mail = vmMail($from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $shopper_mail_Body, $shopper_mail_AltBody, true, null, null, $EmbeddedImages);
         $vendor_mail = vmMail($from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $vendor_mail_Body, $vendor_mail_AltBody, true, null, null, $EmbeddedImages, null, $shopper_email);
         if (!$shopper_mail || !$vendor_mail) {
             $vmLogger->debug('Something went wrong while sending the order confirmation email to ' . $from_email . ' and ' . $shopper_email);
             return false;
         }
         //
         // END: set up and send the HTML email
         ////////////////////////////////////////
     }
     return true;
 }
コード例 #4
0
 /**
  * Creates the category pathway array
  *
  * @param	array  $category_list	List of category IDs and names
  * @return	array	$pathway_items	Array of objects ($name, $link)
  * @access   public
  */
 function getPathway($category_list)
 {
     global $sess;
     $pathway_items = array();
     foreach ($category_list as $category) {
         $item = new stdClass();
         $item->name = vmHtmlEntityDecode($category['category_name']);
         $item->link = $sess->url($_SERVER['PHP_SELF'] . "?page=shop.browse&category_id={$category['category_id']}", false, false);
         $pathway_items[] = $item;
     }
     return $pathway_items;
 }
コード例 #5
0
ファイル: ps_user.php プロジェクト: noikiy/owaspbwa
 /**
  * Saves a user into Joomla! 1.5 
  *
  * @return int An integer user_id if the user was saved successfully, false if not
  */
 function save()
 {
     global $mainframe, $vmLogger, $VM_LANG;
     $option = JRequest::getCmd('option');
     // Initialize some variables
     $db =& JFactory::getDBO();
     $me =& JFactory::getUser();
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $SiteName = $mainframe->getCfg('sitename');
     // Create a new JUser object
     $user = new JUser(JRequest::getVar('id', 0, 'post', 'int'));
     $original_gid = $user->get('gid');
     $post = JRequest::get('post');
     $post['username'] = JRequest::getVar('username', '', 'post', 'username');
     $post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW);
     if (!$user->bind($post)) {
         echo "<script type=\"text/javascript\"> alert('" . vmHtmlEntityDecode($user->getError()) . "');</script>\n";
         return false;
     }
     // Are we dealing with a new user which we need to create?
     $isNew = $user->get('id') < 1;
     if (!$isNew) {
         // if group has been changed and where original group was a Super Admin
         if ($user->get('gid') != $original_gid && $original_gid == 25) {
             // count number of active super admins
             $query = 'SELECT COUNT( id )' . ' FROM #__users' . ' WHERE gid = 25' . ' AND block = 0';
             $db->setQuery($query);
             $count = $db->loadResult();
             if ($count <= 1) {
                 // disallow change if only one Super Admin exists
                 $vmLogger->err($VM_LANG->_('VM_USER_ERR_ONLYSUPERADMIN'));
                 return false;
             }
         }
     }
     /*
      * Lets save the JUser object
      */
     if (!$user->save()) {
         echo "<script type=\"text/javascript\"> alert('" . vmHtmlEntityDecode($user->getError()) . "');</script>\n";
         return false;
     }
     // For new users, email username and password
     if ($isNew) {
         $name = $user->get('name');
         $email = $user->get('email');
         $username = $user->get('username');
         $password = $user->password_clear;
         $this->_sendMail($name, $email, $username, $password);
     }
     // Capture the new user id
     if ($isNew) {
         $newUserId = $user->get('id');
     } else {
         $newUserId = false;
     }
     return $newUserId;
 }
コード例 #6
0
ファイル: language.class.php プロジェクト: noikiy/owaspbwa
 /**
  * This safely converts an iso-8859 string into an utf-8 encoded
  * string. It does not convert when the string is already utf-8 encoded
  *
  * @param string $text iso-8859 encoded text
  * @param string $charset This is a k.o.-Argument. If it is NOT equal to 'utf-8', no conversion will take place
  * @return string
  */
 function safe_utf8_encode($text, $charset)
 {
     if (strtolower($charset) == 'utf-8' && !vmAbstractLanguage::seems_utf8($text)) {
         // safely decode and reencode the string
         $text = utf8_encode($text);
     }
     // This converts the currency symbol from HTML entity to the utf-8 symbol
     // example:  &euro; => €
     $text = vmHtmlEntityDecode($text, null, vmGetCharset());
     return $text;
 }
コード例 #7
0
ファイル: mainframe.class.php プロジェクト: noikiy/owaspbwa
 /**
  * Returns a pathway item
  *
  * @param	string	$name
  * @param	string	$link
  * @access   public
  * @return	object	A pathway item object
  */
 function vmPathwayItem($name, $link = '')
 {
     $item = new stdClass();
     $item->name = vmHtmlEntityDecode($name);
     $item->link = $link;
     return $item;
 }
コード例 #8
0
ファイル: shop.feed.php プロジェクト: noikiy/owaspbwa
function cached_feed($feed_info)
{
    global $sess, $mosConfig_cachepath;
    // load feed creator class
    require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/feedcreator.class.php';
    $products = getProducts($feed_info);
    if (empty($products)) {
        return;
    }
    $mosConfig_cachepath = empty($mosConfig_cachepath) ? $GLOBALS['mosConfig_absolute_path'] . '/cache' : $mosConfig_cachepath;
    $filename = $mosConfig_cachepath . "/productfeed_" . $feed_info['feed'] . "_catid{$feed_info['category_id']}.xml";
    // load feed creator class
    $rss = new UniversalFeedCreator();
    // load image creator class
    $image = new FeedImage();
    // loads cache file
    if ($feed_info['cache']) {
        $rss->useCached($feed_info['feed'], $filename, $feed_info['cache_time']);
    }
    $rss->title = $feed_info['title'];
    $rss->description = $feed_info['feed_description'];
    $rss->link = htmlspecialchars($feed_info['link']);
    $rss->cssStyleSheet = NULL;
    $rss->encoding = $feed_info['encoding'];
    $feed_image = $feed_info['image_file'];
    if ($feed_image) {
        $image->url = $feed_image;
        $image->link = $rss->link;
        $image->title = $feed_info['image_alt'];
        $image->description = $rss->description;
        // loads image info into rss array
        $rss->image = $image;
    }
    // parameter intilization
    $feed_date = date('r');
    $feed_year = date('Y');
    $limit = min($feed_info['product_number'], 200);
    $limit_text = $feed_info['limit_desc'];
    $text_length = $feed_info['text_length'];
    foreach ($products as $product) {
        // load individual item creator class
        $item = new FeedItem();
        // item info
        $product_link = $sess->url($GLOBALS['mosConfig_live_site'] . '/index.php?product_id=' . $product['id'] . '&page=shop.product_details&category_id=' . $product['category_id'] . '&flypage=' . $product['category_flypage'], true);
        $item->title = htmlspecialchars($product['name']);
        $item->link = vmHtmlEntityDecode($product_link);
        $item->source = $product_link;
        $item->description = getProductDescription($product, $feed_info);
        $item->date = date('r', $product['cdate']);
        $item->category = htmlspecialchars($product['category_name']);
        // loads item info into rss array
        $rss->addItem($item);
    }
    while (@ob_end_clean()) {
    }
    // save feed file
    $rss->saveFeed($feed_info['feed'], $filename);
}