コード例 #1
0
ファイル: Purchase.php プロジェクト: robbiespire/paQui
	function notification ($addressee,$address,$subject,$template="order.php",$receipt="receipt.php") {
		global $Ecart;
		global $is_IIS;

		if ($template == "order.php" && file_exists(ECART_TEMPLATES."/order.html")) $template = ECART_TEMPLATES."/order.html";
		else $template = trailingslashit(ECART_TEMPLATES).$template;
		if (!file_exists($template))
			return new EcartError(__('A purchase notification could not be sent because the template for it does not exist.','purchase_notification_template',ECART_ADMIN_ERR));

		// Send the e-mail receipt
		$email = array();
		$email['from'] = '"'.wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ).'"';
		if ($Ecart->Settings->get('merchant_email'))
			$email['from'] .= ' <'.$Ecart->Settings->get('merchant_email').'>';
		if($is_IIS) $email['to'] = $address;
		else $email['to'] = '"'.html_entity_decode($addressee,ENT_QUOTES).'" <'.$address.'>';
		$email['subject'] = $subject;
		$email['receipt'] = $this->receipt($receipt);
		$email['url'] = get_bloginfo('siteurl');
		$email['sitename'] = get_bloginfo('name');
		$email['orderid'] = $this->id;

		$email = apply_filters('ecart_email_receipt_data',$email);

		if (ecart_email($template,$email)) {
			if (ECART_DEBUG) new EcartError('A purchase notification was sent to: '.$email['to'],false,ECART_DEBUG_ERR);
			return true;
		}

		if (ECART_DEBUG) new EcartError('A purchase notification FAILED to be sent to: '.$email['to'],false,ECART_DEBUG_ERR);
		return false;
	}
コード例 #2
0
ファイル: Service.php プロジェクト: robbiespire/paQui
	/**
	 * Interface processor for the order manager
	 *	 
	 * @return void
	 **/
	function manager () {
		global $Ecart,$UI,$Notes;
		global $is_IIS;

		if ( !(is_ecart_userlevel() || current_user_can('ecart_orders')) )
			wp_die(__('You do not have sufficient permissions to access this page.','Ecart'));

		$Purchase = $Ecart->Purchase;
		$Purchase->Customer = new Customer($Purchase->customer);

		// Handle Order note processing
		if (!empty($_POST['note'])) {
			$user = wp_get_current_user();
			$Note = new MetaObject();
			$Note->parent = $Purchase->id;
			$Note->context = 'purchase';
			$Note->type = 'order_note';
			$Note->name = 'note';
			$Note->value = new stdClass();
			$Note->value->author = $user->ID;
			$Note->value->message = $_POST['note'];
			$Note->save();
		}
		if (!empty($_POST['delete-note'])) {
			$noteid = key($_POST['delete-note']);
			$Note = new MetaObject($noteid);
			$Note->delete();
		}
		if (!empty($_POST['edit-note'])) {
			$noteid = key($_POST['note-editor']);
			$Note = new MetaObject($noteid);
			$Note->value->message = $_POST['note-editor'][$noteid];
			$Note->save();
		}
		$Notes = new ObjectMeta($Purchase->id,'purchase','order_note');

		if (!empty($_POST['update'])) {
			check_admin_referer('ecart-save-order');

			if ($_POST['txnstatus'] != $Purchase->txnstatus)
				do_action_ref_array('ecart_order_txnstatus_update',array(&$_POST['txnstatus'],&$Purchase));


			$Purchase->updates($_POST);

			$mailstatus = false;
			if ($_POST['notify'] == "yes") {
				$labels = $this->Settings->get('order_status');
				// Save a reference to this purchase in Ecart
				// so the Template API works when generating the receipt
				$Ecart->Purchase =& $Purchase;

				// Send the e-mail notification
				$addressee = "$Purchase->firstname $Purchase->lastname";
				$address = "$Purchase->email";

				$email = array();
				$email['from'] = '"'.get_bloginfo("name").'"';
				if ($Ecart->Settings->get('merchant_email'))
					$email['from'] .= ' <'.$Ecart->Settings->get('merchant_email').'>';
				if($is_IIS) $email['to'] = $address;
				else $email['to'] = '"'.html_entity_decode($addressee,ENT_QUOTES).'" <'.$address.'>';
				$email['subject'] = __('Order Updated','Ecart');
				$email['url'] = get_bloginfo('siteurl');
				$email['sitename'] = get_bloginfo('name');

				if ($_POST['receipt'] == "yes")
					$email['receipt'] = $Purchase->receipt();

				$email['status'] = strtoupper($labels[$Purchase->status]);
				$email['message'] = wpautop(stripslashes($_POST['message']));

				if (file_exists(ECART_TEMPLATES."/notification.html")) $template = ECART_TEMPLATES."/notification.html";
				if (file_exists(ECART_TEMPLATES."/notify.php")) $template = ECART_TEMPLATES."/notify.php";

				if (ecart_email($template,$email)) $mailsent = true;

			}

			$Purchase->save();
			if ($mailsent) $updated = __('Order status updated & notification email sent.','Ecart');
			else $updated = __('Order status updated.','Ecart');
		}

		$targets = $this->Settings->get('target_markets');
		$UI->txnStatusLabels = Lookup::payment_status_labels();
		$UI->statusLabels = $this->Settings->get('order_status');
		if (empty($statusLabels)) $statusLabels = array('');

		include(ECART_ADMIN_PATH."/orders/order.php");
	}
コード例 #3
0
ファイル: Customer.php プロジェクト: robbiespire/paQui
	function notification () {
		global $Ecart;
		$Settings =& EcartSettings();
		// The blogname option is escaped with esc_html on the way into the database in sanitize_option
		// we want to reverse this for the plain text arena of emails.
		$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

		$_ = array();
		$_[] = 'From: "'.get_option('blogname').'" <'.$Settings->get('merchant_email').'>';
		$_[] = 'To: '.$Settings->get('merchant_email');
		$_[] = 'Subject: '.sprintf(__('[%s] New Customer Registration','Ecart'),$blogname);
		$_[] = '';
		$_[] = sprintf(__('New customer registration on your "%s" store:','Ecart'), $blogname);
		$_[] = sprintf(__('E-mail: %s','Ecart'), stripslashes($this->email));

		if (!ecart_email(join("\r\n",$_)))
			new EcartError('The new account notification e-mail could not be sent.','new_account_email',ECART_ADMIN_ERR);
		elseif (ECART_DEBUG) new EcartError('A new account notification e-mail was sent to the merchant.','new_account_email',ECART_DEBUG_ERR);
		if (empty($this->password)) return;

		$_ = array();
		$_[] = 'From: "'.get_option('blogname').'" <'.$Settings->get('merchant_email').'>';
		$_[] = 'To: '.$this->email;
		$_[] = 'Subject: '.sprintf(__('[%s] New Customer Registration','Ecart'),$blogname);
		$_[] = '';
		$_[] = sprintf(__('New customer registration on your "%s" store:','Ecart'), $blogname);
		$_[] = sprintf(__('E-mail: %s','Ecart'), stripslashes($this->email));
		$_[] = sprintf(__('Password: %s'), $this->password);
		$_[] = '';
		$_[] = ecarturl(false,'account',$Ecart->Gateways->secure);

		if (!ecart_email(join("\r\n",$_)))
			new EcartError('The customer\'s account notification e-mail could not be sent.','new_account_email',ECART_ADMIN_ERR);
		elseif (ECART_DEBUG) new EcartError('A new account notification e-mail was sent to the customer.','new_account_email',ECART_DEBUG_ERR);
	}
コード例 #4
0
ファイル: Error.php プロジェクト: robbiespire/paQui
	/**
	 * Generates and sends an email of an error to the recipient list
	 *
	 * @since 1.0
	 *
	 * @param EcartError $error The error object
	 * @return void
	 **/
	function notify ($error) {
		if (!($error->level & $this->types)) return;
		$url = parse_url(get_bloginfo('url'));
		$_ = array();
		$_[] = 'From: "'.get_bloginfo('sitename').'" <ecart@'.$url['host'].'>';
		$_[] = 'To: '.$this->recipients;
		$_[] = 'Subject: '.__('Ecart Notification','Ecart');
		$_[] = '';
		$_[] = __('This is an automated message notification generated when the Ecart installation at '.get_bloginfo('url').' encountered the following:','Ecart');
		$_[] = '';
		$_[] = $error->message();
		$_[] = '';
		if (isset($error->debug['file']) && defined('WP_DEBUG'))
			$_[] = 'DEBUG: '.basename($error->debug['file']).', line '.$error->debug['line'].'';

		ecart_email(join("\r\n",$_));
	}