function notification($addressee, $address, $subject, $template = "order.html", $receipt = "receipt.php") { global $Shopp; global $is_IIS; $template = trailingslashit(SHOPP_TEMPLATES) . $template; if (!file_exists($template)) { return new ShoppError(__('A purchase notification could not be sent because the template for it does not exist.', 'purchase_notification_template', SHOPP_ADMIN_ERR)); } // // Send the e-mail receipt $email = array(); $email['from'] = '"' . get_bloginfo("name") . '"'; if ($Shopp->Settings->get('merchant_email')) { $email['from'] .= ' <' . $Shopp->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'] = $Shopp->Flow->order_receipt($receipt); $email['url'] = get_bloginfo('siteurl'); $email['sitename'] = get_bloginfo('name'); $email['orderid'] = $this->id; $email = apply_filters('shopp_email_receipt_data', $email); if (shopp_email($template, $email)) { if (SHOPP_DEBUG) { new ShoppError('A purchase notification was sent to "' . $addressee . '" <' . $address . '>', false, SHOPP_DEBUG_ERR); } return true; } if (SHOPP_DEBUG) { new ShoppError('A purchase notification FAILED to be sent to "' . $addressee . '" <' . $address . '>', false, SHOPP_DEBUG_ERR); } return false; }
function order_manager() { global $Shopp; global $is_IIS; if (!current_user_can(SHOPP_USERLEVEL)) { wp_die(__('You do not have sufficient permissions to access this page.', 'Shopp')); } if (preg_match("/\\d+/", $_GET['id'])) { $Shopp->Cart->data->Purchase = new Purchase($_GET['id']); $Shopp->Cart->data->Purchase->load_purchased(); } else { $Shopp->Cart->data->Purchase = new Purchase(); } $Purchase = $Shopp->Cart->data->Purchase; $Customer = new Customer($Purchase->customer); if (!empty($_POST['update'])) { check_admin_referer('shopp-save-order'); if ($_POST['transtatus'] != $Purchase->transtatus) { do_action_ref_array('shopp_order_txnstatus_update', array(&$_POST['transtatus'], &$Purchase)); } $Purchase->updates($_POST); if ($_POST['notify'] == "yes") { $labels = $this->Settings->get('order_status'); // Send the e-mail notification $notification = array(); $notification['from'] = $Shopp->Settings->get('merchant_email'); if ($is_IIS) { $notification['to'] = $Purchase->email; } else { $notification['to'] = "\"{$Purchase->firstname} {$Purchase->lastname}\" <{$Purchase->email}>"; } $notification['subject'] = __('Order Updated', 'Shopp'); $notification['url'] = get_bloginfo('siteurl'); $notification['sitename'] = get_bloginfo('name'); if ($_POST['receipt'] == "yes") { $notification['receipt'] = $this->order_receipt(); } $notification['status'] = strtoupper($labels[$Purchase->status]); $notification['message'] = wpautop($_POST['message']); shopp_email(SHOPP_TEMPLATES . "/notification.html", $notification); } $Purchase->save(); $updated = __('Order status updated.', 'Shopp'); } $targets = $this->Settings->get('target_markets'); $txnStatusLabels = array('PENDING' => __('Pending', 'Shopp'), 'CHARGED' => __('Charged', 'Shopp'), 'REFUNDED' => __('Refunded', 'Shopp'), 'VOID' => __('Void', 'Shopp')); $statusLabels = $this->Settings->get('order_status'); if (empty($statusLabels)) { $statusLabels = array(''); } $taxrate = 0; $base = $Shopp->Settings->get('base_operations'); if ($base['vat']) { $taxrate = $Shopp->Cart->taxrate(); } include "{$this->basepath}/core/ui/orders/order.php"; }
function notify(&$error) { if (!($error->level & $this->types)) { return; } $url = parse_url(get_bloginfo('url')); $_ = array(); $_[] = 'From: "' . get_bloginfo('sitename') . '" <shopp@' . $url['host'] . '>'; $_[] = 'To: ' . $this->recipients; $_[] = 'Subject: ' . __('Shopp Notification', 'Shopp'); $_[] = ''; $_[] = __('This is an automated message notification generated when the Shopp installation at ' . get_bloginfo('url') . ' encountered the following:', 'Shopp'); $_[] = ''; $_[] = $error->message(); $_[] = ''; if (isset($error->debug['file']) && defined('WP_DEBUG')) { $_[] = 'DEBUG: ' . basename($error->debug['file']) . ', line ' . $error->debug['line'] . ''; } shopp_email(join("\r\n", $_)); }
function reset_password($activation) { global $Shopp; $authentication = $Shopp->Settings->get('account_system'); $user_data = false; $activation = preg_replace('/[^a-z0-9]/i', '', $activation); $errors = array(); if (empty($activation) || !is_string($activation)) { $errors[] = new ShoppError(__('Invalid key')); } $RecoveryCustomer = new Customer($activation, 'activation'); if (empty($RecoveryCustomer->id)) { $errors[] = new ShoppError(__('Invalid key')); } if (!empty($errors)) { return false; } // Generate a new random password $password = wp_generate_password(); do_action_ref_array('password_reset', array(&$RecoveryCustomer, $password)); $RecoveryCustomer->password = wp_hash_password($password); if ($authentication == "wordpress") { $user_data = get_userdata($RecoveryCustomer->wpuser); wp_set_password($password, $user_data->ID); } $RecoveryCustomer->activation = ''; $RecoveryCustomer->save(); $subject = apply_filters('shopp_reset_password_subject', sprintf(__('[%s] New Password', 'Shopp'), get_option('blogname'))); $_ = array(); $_[] = 'From: "' . get_option('blogname') . '" <' . $Shopp->Settings->get('merchant_email') . '>'; $_[] = 'To: ' . $RecoveryCustomer->email; $_[] = 'Subject: ' . $subject; $_[] = ''; $_[] = sprintf(__('Your new password for %s:', 'Shopp'), get_option('siteurl')); $_[] = ''; if ($user_data) { $_[] = sprintf(__('Login name: %s', 'Shopp'), $user_data->user_login); } $_[] = sprintf(__('Password: %s'), $password) . "\r\n"; $_[] = ''; $_[] = __('Click here to login:'******' ' . $Shopp->link('account'); $message = apply_filters('shopp_reset_password_message', join("\r\n", $_)); if (!shopp_email($message)) { new ShoppError(__('The e-mail could not be sent.'), 'password_reset_email', SHOPP_ERR); shopp_redirect(add_query_arg('acct', 'recover', $Shopp->link('account'))); } else { new ShoppError(__('Check your email address for your new password.', 'Shopp'), 'password_reset_email', SHOPP_ERR); } unset($_GET['acct']); }