security updates

have to check views and entityreference for custom patches
This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 20:45:16 +02:00
parent 802ec0c6f3
commit b3221c71e2
516 changed files with 14267 additions and 7349 deletions

View File

@@ -4,9 +4,9 @@ dependencies[] = uc_payment
package = Ubercart - payment
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -1,113 +0,0 @@
<?php
/**
* @file
* Page callbacks for administrative recurring fee operation pages.
*/
/**
* Displays a form to update a subscriptions's CC info.
*
* @see uc_authorizenet_arb_admin_update_form_submit()
* @ingroup forms
*/
function uc_authorizenet_arb_admin_update_form($form, &$form_state, $rfid) {
$order = new stdClass();
$fee = uc_recurring_fee_load('user', $rfid);
$form['rfid'] = array(
'#type' => 'value',
'#value' => $rfid,
);
$form['description'] = array(
'#markup' => '<div>' . t('Subscription ID: @subscription_id', array('@subscription_id' => $fee['data'])) . '</div>',
);
$form['cc_data'] = array(
'#type' => 'fieldset',
'#title' => t('Credit card details'),
'#theme' => 'uc_payment_method_credit_form',
'#tree' => TRUE,
);
$form['cc_data'] += uc_payment_method_credit_form(array(), $order);
unset($form['cc_data']['cc_policy']);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
'#suffix' => l(t('Cancel'), 'admin/store/orders/recurring'),
);
return $form;
}
/**
* Form submission handler for uc_authorizenet_arb_admin_update_form().
*
* @see uc_authorizenet_arb_admin_update_form()
*/
function uc_authorizenet_arb_admin_update_form_submit($form, &$form_state) {
$fee = uc_recurring_fee_load('user', $form_state['values']['rfid']);
$updates = array(
'payment' => array(
'creditCard' => array(
'cardNumber' => $form_state['values']['cc_data']['cc_number'],
'expirationDate' => $form_state['values']['cc_data']['cc_exp_year'] . '-' . $form_state['values']['cc_data']['cc_exp_month'],
),
),
);
$result = uc_authorizenet_arb_update($fee['data'], $updates, $fee['order_id']);
// If the update was successful...
if ($result) {
drupal_set_message(t('Subscription data updated at Authorize.Net.'));
}
else {
drupal_set_message(t('Subscription update failed. See order admin comments for more details.'), 'error');
}
$form_state['redirect'] = 'admin/store/orders/recurring';
}
/**
* Displays a confirm form for canceling a subscription.
*
* @see uc_authorizenet_arb_admin_cancel_form_submit()
* @ingroup forms
*/
function uc_authorizenet_arb_admin_cancel_form($form, &$form_state, $rfid) {
$form['rfid'] = array(
'#type' => 'value',
'#value' => $rfid,
);
return confirm_form($form, t('Are you sure you wish to cancel this subscription?'), 'admin/store/orders/recurring', NULL, t('Confirm'), t('Cancel'));
}
/**
* Form submission handler for uc_authorizenet_arb_admin_cancel_form().
*
* @see uc_authorizenet_arb_admin_cancel_form()
*/
function uc_authorizenet_arb_admin_cancel_form_submit($form, &$form_state) {
$fee = uc_recurring_fee_load('user', $form_state['values']['rfid']);
$result = uc_authorizenet_arb_cancel($fee['data'], $fee['order_id'], $fee);
// If the cancellation was successful...
if ($result) {
drupal_set_message(t('Subscription canceled through Authorize.Net.'));
// Set the fee's recurring charges to 0.
uc_recurring_fee_cancel($fee['rfid']);
}
else {
drupal_set_message(t('Subscription cancellation failed. See order admin comments for more details.'), 'error');
}
$form_state['redirect'] = 'admin/store/orders/recurring';
}

View File

@@ -5,9 +5,9 @@ dependencies[] = uc_credit
package = Ubercart - payment
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -23,46 +23,6 @@ function uc_authorizenet_menu() {
'file' => 'uc_authorizenet.pages.inc',
);
// User operations menu items for ARB recurring fees.
$items['user/%user/recurring/%/arb-update'] = array(
'title' => 'Update your payment details',
'description' => 'Update the payment details for a recurring fee.',
'page callback' => 'drupal_get_form',
'page arguments' => array('uc_authorizenet_arb_user_update_form', 1, 3),
'access callback' => 'uc_recurring_user_access',
'access arguments' => array(1, 3),
'type' => MENU_CALLBACK,
'file' => 'uc_authorizenet.pages.inc',
);
$items['user/%user/recurring/%/arb-cancel'] = array(
'title' => 'Cancel the recurring fee?',
'description' => 'Cancel a recurring fee.',
'page callback' => 'drupal_get_form',
'page arguments' => array('uc_authorizenet_arb_user_cancel_form', 1, 3),
'access callback' => 'uc_recurring_user_access',
'access arguments' => array(1, 3),
'type' => MENU_CALLBACK,
'file' => 'uc_authorizenet.pages.inc',
);
// Admin operations menu items.
$items['admin/store/orders/recurring/%/arb-update'] = array(
'title' => 'Update ARB subscription',
'page callback' => 'drupal_get_form',
'page arguments' => array('uc_authorizenet_arb_admin_update_form', 4),
'access arguments' => array('administer recurring fees'),
'type' => MENU_CALLBACK,
'file' => 'uc_authorizenet.admin.inc',
);
$items['admin/store/orders/recurring/%/arb-cancel'] = array(
'title' => 'Cancel ARB subscription',
'page callback' => 'drupal_get_form',
'page arguments' => array('uc_authorizenet_arb_admin_cancel_form', 4),
'access arguments' => array('administer recurring fees'),
'type' => MENU_CALLBACK,
'file' => 'uc_authorizenet.admin.inc',
);
return $items;
}
@@ -639,45 +599,6 @@ function _uc_authorizenet_charge($order, $amount, $data) {
return $result;
}
/**
* Implements hook_recurring_fee().
*/
function uc_authorizenet_recurring_fee($order, $fee) {
// Don't process the fee if ARB is disabled in the gateway settings.
if (variable_get('uc_authnet_arb_mode', 'disabled') == 'disabled') {
return FALSE;
}
return uc_authorizenet_arb_create($order, $fee);
}
/**
* Implements hook_recurring_fee_ops().
*/
function uc_authorizenet_recurring_fee_ops($context, $fee) {
$ops = array();
switch ($context) {
case 'fee_admin':
if ($fee['remaining_intervals'] > 0) {
$ops[] = l(t('update'), 'admin/store/orders/recurring/' . $fee['rfid'] . '/arb-update');
$ops[] = l(t('cancel'), 'admin/store/orders/recurring/' . $fee['rfid'] . '/arb-cancel');
}
else {
$ops[] = l(t('delete'), 'admin/store/orders/recurring/' . $fee['rfid'] . '/delete');
}
break;
case 'user':
$ops[] = l(t('update'), 'user/' . $fee['uid'] . '/recurring/' . $fee['rfid'] . '/arb-update');
$ops[] = l(t('cancel'), 'user/' . $fee['uid'] . '/recurring/' . $fee['rfid'] . '/arb-cancel');
break;
}
return $ops;
}
/**
* Sends an XML API Request to Authorize.Net.
*
@@ -722,157 +643,6 @@ function uc_authorizenet_xml_api($server, $xml) {
return $response;
}
/**
* Sends an ARB Create request via the XML API.
*
* @param $order
* The order object containing billing and shipping information.
* @param $fee
* An array of data describing the recurring fee.
*
* @return
* TRUE or FALSE indicating the success of the request.
*/
function uc_authorizenet_arb_create($order, $fee) {
$server = variable_get('uc_authnet_arb_mode', 'disabled');
// Setup variables for the payment schedule.
list($length, $unit) = explode(' ', $fee->regular_interval);
list($trial_length, $trial_unit) = explode(' ', $fee->initial_charge);
// Convert weeks and years to days.
if ($unit == 'weeks') {
$length *= 7;
$unit = 'days';
}
elseif ($unit == 'years') {
$length *= 365;
$unit = 'days';
}
// Get a default SKU if none was supplied.
if (empty($fee->model)) {
$fee->model = db_query("SELECT model FROM {uc_products} WHERE nid = :nid", array(':nid' => $fee->nid))->fetchField();
}
// Make sure we have valid values for Authorize.Net.
if ($length <= 0 || $unit == 'days' && $length > 365 || $unit == 'months' && $length > 12) {
watchdog('uc_authorizenet', 'Product @sku has invalid interval settings for Authorize.Net - @length @unit', array('@sku' => $fee->model, '@length' => $length, '@unit' => $unit), WATCHDOG_ERROR);
return FALSE;
}
// Get the country data for the billing and shipping information.
$billing_country = uc_get_country_data(array('country_id' => $order->billing_country));
$delivery_country = uc_get_country_data(array('country_id' => $order->delivery_country));
// Build the data array for the request.
$data = array(
'refId' => substr($order->order_id . '-' . REQUEST_TIME, 0, 20),
'subscription' => array(
'name' => substr(t('Order @order_id', array('@order_id' => $order->order_id)), 0, 50),
'paymentSchedule' => array(
'interval' => array(
'length' => $length,
'unit' => $unit,
),
'startDate' => date('Y-m-d', strtotime('+ ' . $fee->initial_charge)),
'totalOccurrences' => $fee->number_intervals,
'trialOccurrences' => '0',
),
'amount' => round($fee->fee_amount, 2),
'trialAmount' => 0,
'payment' => array(), // Data inserted below based on payment method.
'order' => array(
'invoiceNumber' => substr($order->order_id, 0, 20),
'description' => substr(t('Order @order_id - @sku', array('@order_id' => $order->order_id, '@sku' => $fee->model)), 0, 255),
),
'customer' => array(
'id' => substr($order->uid, 0, 20),
'email' => substr($order->primary_email, 0, 255),
'phoneNumber' => substr($order->billing_phone, 0, 25),
// 'faxNumber' => '',
),
'billTo' => array(
'firstName' => substr($order->billing_first_name, 0, 50),
'lastName' => substr($order->billing_last_name, 0, 50),
'company' => substr($order->billing_company, 0, 50),
'address' => substr($order->billing_street1, 0, 60),
'city' => substr($order->billing_city, 0, 40),
'state' => substr(uc_get_zone_code($order->billing_zone), 0, 2),
'zip' => substr($order->billing_postal_code, 0, 20),
'country' => !$billing_country ? '' : $billing_country[0]['country_iso_code_2'],
),
'shipTo' => array(
'firstName' => substr($order->delivery_first_name, 0, 50),
'lastName' => substr($order->delivery_last_name, 0, 50),
'company' => substr($order->delivery_company, 0, 50),
'address' => substr($order->delivery_street1, 0, 60),
'city' => substr($order->delivery_city, 0, 40),
'state' => substr(uc_get_zone_code($order->delivery_zone), 0, 2),
'zip' => substr($order->delivery_postal_code, 0, 20),
'country' => !$delivery_country ? '' : $delivery_country[0]['country_iso_code_2'],
),
),
);
// Strip out the shipping info if it isn't necessary.
if (empty($data['subscription']['shipTo']['firstName'])) {
unset($data['subscription']['shipTo']);
}
// Add the payment information to the data array based on the payment method.
if ($order->payment_method == 'credit') {
if ($order->payment_details['cc_exp_month'] < 10) {
$order->payment_details['cc_exp_month'] = '0' . $order->payment_details['cc_exp_month'];
}
$data['subscription']['payment'] = array(
'creditCard' => array(
'cardNumber' => $order->payment_details['cc_number'],
'expirationDate' => $order->payment_details['cc_exp_year'] . '-' . $order->payment_details['cc_exp_month'],
),
);
}
// Build the XML string.
$xml = _uc_authorizenet_xml_api_wrapper('ARBCreateSubscriptionRequest', _uc_authorizenet_array_to_xml($data));
// Send the request off to the server and get the response.
$response = uc_authorizenet_xml_api($server, $xml);
// Fail if the response is empty or FALSE.
if (!$response) {
return FALSE;
}
// Parse the response into a data array.
$data = _uc_authorizenet_arb_parse_response($response);
if ($data['resultCode'] == 'Error') {
uc_order_comment_save($order->order_id, 0, t('Authorize.Net: Recurring fee for @model failed.<br />@error - @text', array('@model' => $fee->model, '@error' => $data['code'], '@text' => $data['text'])), 'admin');
return FALSE;
}
$user_fee = array(
'rfid' => 0,
'uid' => $order->uid,
'fee_handler' => 'uc_authorizenet',
'next_charge' => strtotime('+' . $fee->initial_charge),
'fee_amount' => $fee->fee_amount,
'regular_interval' => $fee->regular_interval,
'remaining_intervals' => $fee->number_intervals,
'charged_intervals' => 0,
'order_id' => $order->order_id,
'data' => $data['subscriptionId'],
);
uc_recurring_fee_save('user', $user_fee);
uc_order_comment_save($order->order_id, 0, t('Authorize.Net: Recurring fee setup for @model.<br />Subscription ID: @subscription_id', array('@model' => $fee->model, '@subscription_id' => $data['subscriptionId'])), 'admin');
return TRUE;
}
/**
* Updates an ARB subscription; for simplicity's sake, payment schedule
* information cannot be updated at this time.
@@ -894,7 +664,7 @@ function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL
// Build the data array for the request.
$data = array(
'refId' => substr($order->order_id . '-' . REQUEST_TIME, 0, 20),
'refId' => substr($order_id . '-' . REQUEST_TIME, 0, 20),
'subscriptionId' => $subscription_id,
'subscription' => $updates
);
@@ -925,59 +695,6 @@ function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL
return TRUE;
}
/**
* Cancels an ARB subscription.
*
* @param $subscription
* The ID of the subscription at Authorize.Net.
* @param $order_id
* Optional. The ID of the order the recurring fee was attached to.
* @param $fee
* Optional. The data array for the recurring fee being canceled.
*
* @return
* TRUE or FALSE indicating the success of the cancellation.
*/
function uc_authorizenet_arb_cancel($subscription_id, $order_id = NULL, $fee = array()) {
$server = variable_get('uc_authnet_arb_mode', 'disabled');
// Build the data array for the request.
$data = array(
'refId' => substr($order->order_id . '-' . REQUEST_TIME, 0, 20),
'subscriptionId' => $subscription_id,
);
// Build the XML string.
$xml = _uc_authorizenet_xml_api_wrapper('ARBCancelSubscriptionRequest', _uc_authorizenet_array_to_xml($data));
// Send the request off to the server and get the response.
$response = uc_authorizenet_xml_api($server, $xml);
// Fail if the response is empty or FALSE.
if (!$response) {
return FALSE;
}
// Parse the response into a data array.
$data = _uc_authorizenet_arb_parse_response($response);
if ($data['resultCode'] == 'Error') {
if (!empty($order_id)) {
uc_order_comment_save($order_id, 0, t('Authorize.Net: Subscription @subscription_id cancellation failed.<br />@error - @text', array('@subscription_id' => $subscription_id, '@error' => $data['code'], '@text' => $data['text'])), 'admin');
}
return FALSE;
}
uc_order_comment_save($order_id, 0, t('Authorize.Net: Subscription @subscription_id canceled.', array('@subscription_id' => $subscription_id)), 'admin');
// Let other modules act on the canceled fee.
if (!empty($fee)) {
module_invoke_all('uc_arb_cancel', $fee);
}
return TRUE;
}
/**
* Wraps XML API request child elements in the request element and includes
* the merchant authentication information.

View File

@@ -2,8 +2,7 @@
/**
* @file
* Page callbacks for Authorize.Net's Silent POST feature and user
* specific recurring fee operation pages.
* Page callback for Authorize.Net's Silent POST feature.
*/
@@ -47,116 +46,3 @@ function uc_authorizenet_silent_post() {
exit();
}
/**
* Displays a form for customers to update their CC info.
*
* @see uc_authorizenet_arb_user_update_form_submit()
* @ingroup forms
*/
function uc_authorizenet_arb_user_update_form($form, &$form_state, $user, $rfid) {
$fee = uc_recurring_fee_load('user', $rfid);
$form['uid'] = array(
'#type' => 'value',
'#value' => $user->uid,
);
$form['rfid'] = array(
'#type' => 'value',
'#value' => $rfid,
);
$form['description'] = array(
'#markup' => '<div>' . t('Recurring fee order ID: @order_id', array('@order_id' => $fee['order_id'])) . '</div>',
);
$form['cc_data'] = array(
'#type' => 'fieldset',
'#title' => t('Credit card details'),
'#theme' => 'uc_payment_method_credit_form',
'#tree' => TRUE,
);
$form['cc_data'] += uc_payment_method_credit_form(array(), $order);
unset($form['cc_data']['cc_policy']);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
'#suffix' => l(t('Cancel'), 'user/' . $user->uid),
);
return $form;
}
/**
* Form submission handler for uc_authorizenet_arb_user_update_form().
*
* @see uc_authorizenet_arb_user_update_form()
*/
function uc_authorizenet_arb_user_update_form_submit($form, &$form_state) {
$fee = uc_recurring_fee_load('user', $form_state['values']['rfid']);
$updates = array(
'payment' => array(
'creditCard' => array(
'cardNumber' => $form_state['values']['cc_data']['cc_number'],
'expirationDate' => $form_state['values']['cc_data']['cc_exp_year'] . '-' . $form_state['values']['cc_data']['cc_exp_month'],
),
),
);
$result = uc_authorizenet_arb_update($fee['data'], $updates, $fee['order_id']);
// If the update was successful...
if ($result) {
drupal_set_message(t('The payment details for that recurring fee have been updated.'));
}
else {
drupal_set_message(t('An error has occurred while updating your payment details. Please try again and contact us if you are unable to perform the update.'), 'error');
}
$form_state['redirect'] = 'user/' . $form_state['values']['uid'];
}
/**
* Displays a confirm form for customers to cancel their fees.
*
* @see uc_authorizenet_arb_user_cancel_form_submit()
* @ingroup forms
*/
function uc_authorizenet_arb_user_cancel_form($form, &$form_state, $user, $rfid) {
$form['uid'] = array(
'#type' => 'value',
'#value' => $user->uid,
);
$form['rfid'] = array(
'#type' => 'value',
'#value' => $rfid,
);
return confirm_form($form, t('Are you sure you wish to cancel this fee?'), 'user/' . $user->uid, t('This action cannot be undone and may result in the termination of subscription services.'), t('Confirm'), t('Cancel'));
}
/**
* Form submission handler for uc_authorizenet_arb_user_cancel_form().
*
* @see uc_authorizenet_arb_user_cancel_form()
*/
function uc_authorizenet_arb_user_cancel_form_submit($form, &$form_state) {
$fee = uc_recurring_fee_load('user', $form_state['values']['rfid']);
$result = uc_authorizenet_arb_cancel($fee['data'], $fee['order_id'], $fee);
// If the cancellation was successful...
if ($result) {
drupal_set_message(t('The recurring fee has been canceled.'));
// Set the fee's recurring charges to 0.
uc_recurring_fee_cancel($fee['rfid']);
}
else {
drupal_set_message(t('An error has occurred. Please try again and contact us if the problem persists.'), 'error');
}
$form_state['redirect'] = 'user/' . $form_state['values']['uid'];
}

View File

@@ -5,9 +5,9 @@ dependencies[] = uc_credit
package = Ubercart - payment
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -8,9 +8,9 @@ core = 7.x
; Test cases
files[] = tests/uc_credit.test
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -7,9 +7,9 @@ core = 7.x
; Class definitions
files[] = uc_cybersource.soap.inc
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -6,9 +6,9 @@ dependencies[] = uc_quote
package = Ubercart - payment
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -10,9 +10,9 @@ files[] = tests/uc_payment.test
configure = admin/store/settings/payment
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -5,9 +5,9 @@ dependencies[] = uc_payment
package = Ubercart - payment
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -4,9 +4,9 @@ dependencies[] = uc_payment
package = Ubercart - payment
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -6,9 +6,9 @@ core = 7.x
configure = admin/store/settings/quotes/methods
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -9,9 +9,9 @@ configure = admin/store/settings/quotes
; Test cases
files[] = tests/uc_quote.test
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -162,6 +162,7 @@ function uc_quote_schema() {
'default' => 0,
),
),
'primary key' => array('order_id'),
'unique keys' => array(
'order_id_quote_method' => array('order_id', 'method'),
),

View File

@@ -563,6 +563,11 @@ function uc_checkout_pane_quotes($op, &$order, $form = NULL, &$form_state = NULL
'#weight' => 1,
);
// If this was an Ajax request, we reinvoke the 'prepare' op to ensure
// that we catch any changes in panes heavier than this one.
if (isset($form_state['triggering_element'])) {
uc_checkout_pane_quotes('prepare', $order, $form, $form_state);
}
$contents['quotes'] += $order->quote_form;
$form_state['uc_ajax']['uc_quote']['panes][quotes][quote_button'] = array(

View File

@@ -8,9 +8,9 @@ core = 7.x
files[] = views/uc_shipping_handler_field_shipment_id.inc
files[] = views/uc_shipping_handler_field_package_weight.inc
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -20,7 +20,7 @@ function uc_shipping_rules_data_info() {
'type' => 'integer',
'label' => t('Shipment ID'),
),
'order-id' => array(
'order_id' => array(
'type' => 'integer',
'label' => t('Order ID'),
),
@@ -42,7 +42,7 @@ function uc_shipping_rules_data_info() {
'setter permission' => 'fulfill orders',
'property info' => $address_info,
),
'shipping-method' => array(
'shipping_method' => array(
'type' => 'text',
'label' => t('Shipping method'),
'description' => t('The transportation method used to ship.'),
@@ -57,22 +57,22 @@ function uc_shipping_rules_data_info() {
'label' => t('Carrier'),
'description' > t('The company making the delivery.'),
),
'transaction-id' => array(
'transaction_id' => array(
'type' => 'text',
'label' => t('Transaction ID'),
'description' => t("The carrier's shipment identifier."),
),
'tracking-number' => array(
'tracking_number' => array(
'type' => 'text',
'label' => t('Tracking number'),
'description' => t('The number used by the carrier to locate the shipment while it is in transit.'),
),
'ship-date' => array(
'ship_date' => array(
'type' => 'date',
'label' => t('Ship date'),
'description' => t('The time the shipment was sent out.'),
),
'expected-delivery' => array(
'expected_delivery' => array(
'type' => 'date',
'label' => t('Expected delivery'),
'description' => t('The time the shipment is expected to be delivered'),
@@ -87,16 +87,16 @@ function uc_shipping_rules_data_info() {
'label' => t('Packages'),
'description' => t('The physical items being shipped.'),
'property info' => array(
'package-id' => array(
'package_id' => array(
'type' => 'integer',
'label' => t('Package ID'),
),
'shipping-type' => array(
'shipping_type' => array(
'type' => 'text',
'label' => t('Shipping type'),
'description' => t('The basic type of shipment, e.g.: small package, freight, etc.'),
),
'pkg-type' => array(
'pkg_type' => array(
'type' => 'text',
'label' => t('Package type'),
'description' => t('The type of packaging.'),
@@ -121,7 +121,7 @@ function uc_shipping_rules_data_info() {
'label' => t('Value'),
'description' => t('The monetary value of the package contents.'),
),
'tracking-number' => array(
'tracking_number' => array(
'type' => 'text',
'label' => t('Tracking number'),
'description' => t('The number used by the carrier to locate the shipment while it is in transit.'),
@@ -141,7 +141,7 @@ function uc_shipping_rules_data_info() {
'label' => t('Products'),
'description' => t('The package contents.'),
),
'label-image' => array(
'label_image' => array(
'type' => 'file',
'label' => t('Label image'),
'description' => t('An image of the shipping label.'),

View File

@@ -6,9 +6,9 @@ core = 7.x
configure = admin/store/settings/quotes/settings/ups
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -59,7 +59,6 @@ function uc_usps_country_map($code = NULL) {
654 => 'Saint Helena',
534 => 'Saint Maarten (Dutch) (Netherlands Antilles)',
663 => 'Saint Martin (French) (Guadeloupe)',
688 => 'Serbia-Montenegro',
703 => 'Slovak Republic',
158 => 'Taiwan',
834 => 'Tanzania',

View File

@@ -6,9 +6,9 @@ core = 7.x
configure = admin/store/settings/quotes/settings/usps
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -6,9 +6,9 @@ core = 7.x
configure = admin/store/settings/quotes/methods
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -215,7 +215,7 @@ function uc_weightquote_quote($products, $details, $method) {
$rate = $method->base_rate;
foreach ($products as $product) {
if (empty($product->weightquote) || is_null($product->weightquote[$mid])) {
if (!isset($product->weightquote[$mid])) {
// Add the method's default product rate.
$product_rate = $method->product_rate * $product->qty;
}

View File

@@ -4,9 +4,9 @@ dependencies[] = uc_cart
package = Ubercart - extra
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -8,9 +8,9 @@ core = 7.x
files[] = tests/uc_attribute.test
files[] = tests/uc_attribute_checkout.test
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -3,9 +3,9 @@ core = 7.x
dependencies[] = uc_cart
hidden = TRUE
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -16,9 +16,9 @@ files[] = uc_cart.controller.inc
configure = admin/store/settings/cart
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -256,6 +256,8 @@ function uc_checkout_pane_address($pane, $op, $order, &$form_state, $description
$contents['address']['#hidden'] = variable_get('uc_cart_default_same_address', FALSE);
}
// If this was an Ajax request, update form input values for the
// copy and select address features.
if (isset($form_state['triggering_element'])) {
$element = &$form_state['triggering_element'];
@@ -265,7 +267,6 @@ function uc_checkout_pane_address($pane, $op, $order, &$form_state, $description
if (substr($field, 0, strlen($source)) == $source) {
$field = str_replace($source, $pane, $field);
$form_state['input']['panes'][$pane][$field] = $value;
$order->$field = $value;
}
}
}
@@ -274,7 +275,6 @@ function uc_checkout_pane_address($pane, $op, $order, &$form_state, $description
$address = $addresses[$element['#value']];
foreach ($address as $field => $value) {
$form_state['input']['panes'][$pane][$pane . '_' . $field] = $value;
$order->{$pane . '_' . $field} = $value;
}
}
@@ -295,6 +295,13 @@ function uc_checkout_pane_address($pane, $op, $order, &$form_state, $description
$order->$field = $value;
}
}
if (isset($panes[$pane]['select_address']) && $panes[$pane]['select_address'] >= 0) {
$addresses = uc_select_addresses($user->uid, $pane);
$address = $addresses[$panes[$pane]['select_address']];
foreach ($address as $field => $value) {
$order->{$pane . '_' . $field} = $value;
}
}
return TRUE;
case 'review':

View File

@@ -9,9 +9,9 @@ files[] = tests/uc_cart_links.test
configure = admin/store/settings/cart-links
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -15,9 +15,9 @@ files[] = tests/uc_catalog.test
configure = admin/store/settings/catalog
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -8,9 +8,9 @@ core = 7.x
stylesheets[all][] = uc_file.css
scripts[] = uc_file.js
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -7,9 +7,9 @@ dependencies[] = uc_store
package = Ubercart - extra
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -25,6 +25,19 @@ function uc_googleanalytics_enable() {
->execute();
}
/**
* Check which version of google analytics code is used on the site.
*/
function uc_googleanalytics_flush_caches() {
$info = system_get_info('module', 'googleanalytics');
if (preg_match('|7\.x\-[2-9]\.[0-9x]+|', $info['version'])) {
variable_set('uc_googleanalytics_version', 'analytics.js');
}
else {
variable_set('uc_googleanalytics_version', 'ga.js');
}
}
/**
* Implements hook_page_alter().
*/
@@ -98,7 +111,13 @@ function uc_googleanalytics_display() {
* The JS that should be added to the page footer.
*/
function uc_googleanalytics_ecommerce_js($order) {
$script = '';
$analytics_version = variable_get('uc_googleanalytics_version', 'ga.js');
if ($analytics_version == 'analytics.js') {
$script = 'ga("require", "ecommerce", "ecommerce.js");';
}
else {
$script = '';
}
// Lookup the name of the country or default to the ID if it can't be found
// for some reason.
@@ -140,20 +159,28 @@ function uc_googleanalytics_ecommerce_js($order) {
// Allow modules to alter the transaction arguments.
drupal_alter('ucga_trans', $trans, $order);
// Put the arguments into an array that is safe to implode directly.
$args = array(
'"' . $trans['order_id'] . '"',
drupal_json_encode($trans['store']),
'"' . $trans['total'] . '"',
'"' . $trans['tax'] . '"',
'"' . $trans['shipping'] . '"',
drupal_json_encode($trans['city']),
drupal_json_encode($trans['state']),
drupal_json_encode($trans['country']),
// Create GA-friendly associative array.
$script_args = array(
'id' => $trans['order_id'],
'affiliation' => $trans['store'],
'revenue' => $trans['total'],
'tax' => $trans['tax'],
'shipping' => $trans['shipping'],
'city' => $trans['city'],
'region' => $trans['state'],
'country' => $trans['country'],
);
// Add the transaction line to the JS.
$script .= '_gaq.push(["_addTrans", ' . implode(', ', $args) . ']);';
if ($analytics_version == 'analytics.js') {
$script .= 'ga("ecommerce:addTransaction", ' . drupal_json_encode($script_args) . ');';
}
else {
foreach ($script_args as &$arg) {
$arg = drupal_json_encode($arg);
}
$script .= '_gaq.push(["_addTrans", ' . implode(', ', $script_args) . ']);';
}
// Loop through the products on the order.
foreach ($order->products as $product) {
@@ -186,22 +213,35 @@ function uc_googleanalytics_ecommerce_js($order) {
// Allow modules to alter the item arguments.
drupal_alter('ucga_item', $item, $product, $trans, $order);
// Put the arguments into an array that is safe to implode directly.
$args = array(
'"' . $item['order_id'] . '"',
drupal_json_encode($item['sku']),
drupal_json_encode($item['name']),
drupal_json_encode((string) $item['category']),
'"' . $item['price'] . '"',
'"' . $item['qty'] . '"',
// Create GA-friendly associative array.
$script_args = array(
'id' => $item['order_id'],
'sku' => $item['sku'],
'name' => $item['name'],
'category' => (string) $item['category'],
'price' => $item['price'],
'quantity' => $item['qty'],
);
// Add the item line to the JS.
$script .= '_gaq.push(["_addItem", ' . implode(', ', $args) . ']);';
if ($analytics_version == 'analytics.js') {
$script .= 'ga("ecommerce:addItem", ' . drupal_json_encode($script_args) . ');';
}
else {
foreach ($script_args as &$arg) {
$arg = drupal_json_encode($arg);
}
$script .= '_gaq.push(["_addItem", ' . implode(', ', $script_args) . ']);';
}
}
// Add the function to submit the transaction to GA.
$script .= '_gaq.push(["_trackTrans"]);';
if ($analytics_version == 'analytics.js') {
$script .= 'ga("ecommerce:send");';
}
else {
$script .= '_gaq.push(["_trackTrans"]);';
}
return $script;
}

View File

@@ -1255,12 +1255,6 @@ function uc_order_mail_invoice_form_validate($form, &$form_state) {
*/
function uc_order_mail_invoice_form_submit($form, &$form_state) {
$order = uc_order_load($form_state['values']['order_id']);
if ($order === FALSE) {
drupal_set_message(t('Order @order_id does not exist.', array('@order_id' => $order_id)));
drupal_goto('admin/store/orders');
}
$recipient = check_plain($form_state['values']['email']);
$params = array('order' => $order);

View File

@@ -30,7 +30,7 @@ files[] = views/uc_order_handler_filter_zone.inc
files[] = views/uc_order_handler_filter_total.inc
files[] = views/uc_order_handler_sort_total.inc
files[] = views/uc_order_plugin_argument_validate_user_perm.inc
files[] = views/uc_order_plugin_row_invoice_view.inc
files[] = views/uc_order_plugin_row_invoice.inc
; Classes
files[] = uc_order.controller.inc
@@ -39,9 +39,9 @@ files[] = uc_order.info.inc
configure = admin/store/settings/orders
stylesheets[all][] = uc_order.css
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -476,6 +476,36 @@ function uc_order_can_view_order($account, $order, $view_invoice = FALSE) {
return $access;
}
/**
* Implements hook_query_TAG_alter().
*/
function uc_order_query_uc_order_access_alter(QueryAlterableInterface $query) {
global $user;
// Read metadata from query, if provided.
if (!$account = $query->getMetaData('account')) {
$account = $user;
}
// If account can view all orders, we don't need to alter the query.
if (user_access('view all orders', $account)) {
return;
}
if (user_access('view own orders', $account)) {
// Only allow the user to see their own orders.
foreach ($query->getTables() as $table) {
if ($table['table'] === 'uc_orders') {
$query->condition($table['alias'] . '.uid', $account->uid);
}
}
}
else {
// Deny access to everything.
$query->where('1 = 0');
}
}
/**
* Implements hook_entity_info().
*/

View File

@@ -134,13 +134,11 @@ function uc_order_pane_customer($op, $order, &$form = NULL, &$form_state = NULL)
return $build;
case 'edit-form':
$form['customer'] = array();
$form['customer']['uid'] = array(
'#type' => 'hidden',
'#default_value' => $order->uid,
);
$form['customer']['text']['uid_text'] = array(
$form['customer']['uid_text'] = array(
'#type' => 'textfield',
'#title' => t('Customer number'),
'#default_value' => $order->uid,
@@ -149,16 +147,11 @@ function uc_order_pane_customer($op, $order, &$form = NULL, &$form_state = NULL)
'#disabled' => TRUE,
);
$form['customer']['primary_email'] = array(
'#type' => 'hidden',
'#default_value' => $order->primary_email,
);
$form['customer']['text']['primary_email_text'] = array(
'#type' => 'textfield',
'#title' => t('Primary e-mail'),
'#title' => t('E-mail address'),
'#default_value' => $order->primary_email,
'#maxlength' => 64,
'#size' => 32,
'#disabled' => TRUE,
);
return $form;
@@ -171,15 +164,8 @@ function uc_order_pane_customer($op, $order, &$form = NULL, &$form_state = NULL)
. '/images/menu_customers_small.gif" alt="' . t('Create a new customer.') . '" '
. 'title="' . t('Create a new customer.') . '" onclick="load_new_customer_form();" />';
$output .= '</div>';
$output .= '<div id="customer-select"></div><table class="order-edit-table">';
foreach (element_children($form['customer']['text']) as $field) {
$title = $form['customer']['text'][$field]['#title'];
$form['customer']['text'][$field]['#title'] = NULL;
$output .= '<tr><td class="oet-label">' . $title . ':</td><td>'
. drupal_render($form['customer']['text'][$field]) . '</td></tr>';
}
$output .= '</table>' . drupal_render($form['customer']['primary_email'])
. drupal_render($form['customer']['uid']);
$output .= '<div id="customer-select"></div>';
$output .= drupal_render($form['customer']);
return $output;
case 'edit-process':

View File

@@ -0,0 +1,12 @@
<?php
/**
* @file uc-order-view-row-invoice.tpl.php
*
* Default simple view template to display a single invoice.
*
* @ingroup views_templates
*/
?>
<?php print $invoice ?>

View File

@@ -15,6 +15,7 @@ function uc_order_views_data() {
'field' => 'order_id',
'title' => t('Orders'),
'help' => t('Orders placed in your Ubercart store.'),
'access query tag' => 'uc_order_access',
);
// Pull in user fields directly.
@@ -711,6 +712,17 @@ function uc_order_views_data() {
*/
function uc_order_views_plugins() {
return array(
'row' => array(
'uc_order_invoice' => array(
'title' => t('Invoice'),
'help' => t('Display the order with standard invoice view.'),
'handler' => 'uc_order_plugin_row_invoice',
'theme' => 'uc_order_view_row_invoice',
'theme path' => drupal_get_path('module', 'uc_order') . '/views',
'base' => array('uc_orders'), // only works with 'uc_orders' as base.
'type' => 'normal',
),
),
'argument validator' => array(
'user_or_permission' => array(
'title' => t('Current user or user has permission'),
@@ -719,3 +731,29 @@ function uc_order_views_plugins() {
),
);
}
/**
* Preprocesses a views row invoice plugin.
*
* @see uc_order-view-row-invoice.tpl.php
*/
function template_preprocess_uc_order_view_row_invoice(&$vars) {
$order_id = $vars['row']->{$vars['field_alias']};
if (module_exists('uc_credit')) {
// Clear credit cache, otherwise the load function below will return
// the same cached credit information for all the subsequent orders
// invoices
uc_credit_cache('clear');
}
$order = uc_order_load($order_id);
$build = array(
'#theme' => 'uc_order',
'#order' => $order,
'#op' => 'view',
'#template' => variable_get('uc_cust_order_invoice_template', 'customer'),
);
$vars['invoice'] = theme('uc_order_invoice_page', array('content' => drupal_render($build)));
}

View File

@@ -1046,6 +1046,7 @@ function uc_order_views_default_views() {
$handler->display->display_options['arguments']['uid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['uid']['exception']['value'] = '';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';

View File

@@ -10,7 +10,7 @@
*
* Most of the code on this object is in the theme function.
*/
class uc_order_plugin_row_invoice_view extends views_plugin_row {
class uc_order_plugin_row_invoice extends views_plugin_row {
// Basic properties that let the row style follow relationships.
var $base_table = 'uc_orders';

View File

@@ -20,9 +20,9 @@ files[] = views/uc_product_handler_filter_product.inc
configure = admin/store/settings/products
stylesheets[all][] = uc_product.css
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -1042,9 +1042,14 @@ function uc_product_uc_cart_display($item) {
$element['module'] = array('#type' => 'value', '#value' => 'uc_product');
$element['remove'] = array('#type' => 'submit', '#value' => t('Remove'));
$element['title'] = array(
'#markup' => node_access('view', $node) ? l($item->title, 'node/' . $node->nid) : check_plain($item->title),
);
if (node_access('view', $node) && $uri = entity_uri('node', $node)) {
$element['title'] = array(
'#markup' => l($item->title, $uri['path'], $uri['options']),
);
}
else {
$element['title'] = array('#markup' => $item->title);
}
$element['#total'] = $item->price * $item->qty;
$element['#suffixes'] = array();

View File

@@ -10,9 +10,9 @@ files[] = tests/uc_product_kit.test
files[] = views/uc_product_kit_handler_filter_product_kit.inc
files[] = views/uc_product_kit_handler_filter_product_kit_item.inc
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -7,9 +7,9 @@ core = 7.x
configure = admin/store/settings/store
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -92,7 +92,7 @@ function theme_uc_roles_expiration($variables) {
}
/**
* Form builder for role expirations.
* Form builder for role deletions.
*
* @see uc_roles_deletion_form_submit()
* @ingroup forms

View File

@@ -8,9 +8,9 @@ core = 7.x
; Test cases
files[] = tests/uc_roles.test
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -12,9 +12,9 @@ files[] = views/uc_stock_handler_filter_below_threshold.inc
configure = admin/store/settings/stock
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -8,7 +8,7 @@
/**
* Modifies the Drupal mail system to send HTML emails.
*/
class UbercartMailSystem implements MailSystemInterface {
class UbercartMailSystem extends DefaultMailSystem {
/**
* Concatenates and wraps the e-mail body for plain-text mails.
@@ -24,35 +24,4 @@ class UbercartMailSystem implements MailSystemInterface {
return $message;
}
/**
* Sends an e-mail message using Drupal variables and default settings.
*
* @param $message
* A message array, as described in hook_mail_alter().
*
* @return
* TRUE if the mail was successfully accepted, otherwise FALSE.
*
* @see http://php.net/manual/en/function.mail.php
* @see drupal_mail()
*/
public function mail(array $message) {
$mimeheaders = array();
foreach ($message['headers'] as $name => $value) {
$mimeheaders[] = $name . ': ' . mime_header_encode($value);
}
$line_endings = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
return mail(
$message['to'],
mime_header_encode($message['subject']),
// Note: e-mail uses CRLF for line-endings. PHP's API requires LF
// on Unix and CRLF on Windows. Drupal automatically guesses the
// line-ending format appropriate for your system. If you need to
// override this, adjust $conf['mail_line_endings'] in settings.php.
preg_replace('@\r?\n@', $line_endings, $message['body']),
// For headers, PHP's API suggests that we use CRLF normally,
// but some MTAs incorrectly replace LF with CRLF. See #234403.
implode("\n", $mimeheaders)
);
}
}

View File

@@ -47,8 +47,8 @@ function canada_install() {
"!first_name !last_name\r\n".
"!street1\r\n".
"!street2\r\n".
"!city, !postal_code\r\n".
"!zone_name, !country_name"
"!city !zone_code !postal_code\r\n".
"!country_name_if"
);
}

View File

@@ -13,7 +13,7 @@ function iran_install() {
'country_name' => 'Iran, Islamic Republic of',
'country_iso_code_2' => 'IR',
'country_iso_code_3' => 'IRN',
'version' => 2,
'version' => 3,
))
->execute();
@@ -23,6 +23,7 @@ function iran_install() {
array(364, 'AG', 'آذربایجان غربی'),
array(364, 'AR', 'اردبیل'),
array(364, 'ES', 'اصفهان'),
array(364, 'AL', 'البرز'),
array(364, 'IL', 'ایلام'),
array(364, 'BU', 'بوشهر'),
array(364, 'TH', 'تهران'),
@@ -80,6 +81,17 @@ function iran_update($version) {
->condition('country_id', 364)
->execute();
break;
case 3:
// Add the Alborz zone
db_insert('uc_zones')
->fields(array(
'zone_country_id' => 364,
'zone_code' => 'AL',
'zone_name' => 'البرز',
))
->execute();
break;
}
}

View File

@@ -1,246 +0,0 @@
DELETE FROM uc_countries;
INSERT INTO uc_countries VALUES (004,"AFGHANISTAN",'AF','AFG',1);
INSERT INTO uc_countries VALUES (248,"ALAND ISLANDS",'AX','ALA',1);
INSERT INTO uc_countries VALUES (008,"ALBANIA",'AL','ALB',1);
INSERT INTO uc_countries VALUES (012,"ALGERIA",'DZ','DZA',1);
INSERT INTO uc_countries VALUES (016,"AMERICAN SAMOA",'AS','ASM',1);
INSERT INTO uc_countries VALUES (020,"ANDORRA",'AD','AND',1);
INSERT INTO uc_countries VALUES (024,"ANGOLA",'AO','AGO',1);
INSERT INTO uc_countries VALUES (660,"ANGUILLA",'AI','AIA',1);
INSERT INTO uc_countries VALUES (010,"ANTARCTICA",'AQ','ATA',1);
INSERT INTO uc_countries VALUES (028,"ANTIGUA AND BARBUDA",'AG','ATG',1);
INSERT INTO uc_countries VALUES (032,"ARGENTINA",'AR','ARG',1);
INSERT INTO uc_countries VALUES (051,"ARMENIA",'AM','ARM',1);
INSERT INTO uc_countries VALUES (533,"ARUBA",'AW','ABW',1);
INSERT INTO uc_countries VALUES (036,"AUSTRALIA",'AU','AUS',1);
INSERT INTO uc_countries VALUES (040,"AUSTRIA",'AT','AUT',1);
INSERT INTO uc_countries VALUES (031,"AZERBAIJAN",'AZ','AZE',1);
INSERT INTO uc_countries VALUES (044,"BAHAMAS",'BS','BHS',1);
INSERT INTO uc_countries VALUES (048,"BAHRAIN",'BH','BHR',1);
INSERT INTO uc_countries VALUES (050,"BANGLADESH",'BD','BGD',1);
INSERT INTO uc_countries VALUES (052,"BARBADOS",'BB','BRB',1);
INSERT INTO uc_countries VALUES (112,"BELARUS",'BY','BLR',1);
INSERT INTO uc_countries VALUES (056,"BELGIUM",'BE','BEL',1);
INSERT INTO uc_countries VALUES (084,"BELIZE",'BZ','BLZ',1);
INSERT INTO uc_countries VALUES (204,"BENIN",'BJ','BEN',1);
INSERT INTO uc_countries VALUES (060,"BERMUDA",'BM','BMU',1);
INSERT INTO uc_countries VALUES (064,"BHUTAN",'BT','BTN',1);
INSERT INTO uc_countries VALUES (068,"BOLIVIA",'BO','BOL',1);
INSERT INTO uc_countries VALUES (070,"BOSNIA AND HERZEGOVINA",'BA','BIH',1);
INSERT INTO uc_countries VALUES (072,"BOTSWANA",'BW','BWA',1);
INSERT INTO uc_countries VALUES (074,"BOUVET ISLAND",'BV','BVT',1);
INSERT INTO uc_countries VALUES (076,"BRAZIL",'BR','BRA',1);
INSERT INTO uc_countries VALUES (086,"BRITISH INDIAN OCEAN TERRITORY",'IO','IOT',1);
INSERT INTO uc_countries VALUES (096,"BRUNEI DARUSSALAM",'BN','BRN',1);
INSERT INTO uc_countries VALUES (100,"BULGARIA",'BG','BGR',1);
INSERT INTO uc_countries VALUES (854,"BURKINA FASO",'BF','BFA',1);
INSERT INTO uc_countries VALUES (108,"BURUNDI",'BI','BDI',1);
INSERT INTO uc_countries VALUES (116,"CAMBODIA",'KH','KHM',1);
INSERT INTO uc_countries VALUES (120,"CAMEROON",'CM','CMR',1);
INSERT INTO uc_countries VALUES (124,"CANADA",'CA','CAN',1);
INSERT INTO uc_countries VALUES (132,"CAPE VERDE",'CV','CPV',1);
INSERT INTO uc_countries VALUES (136,"CAYMAN ISLANDS",'KY','CYM',1);
INSERT INTO uc_countries VALUES (140,"CENTRAL AFRICAN REPUBLIC",'CF','CAF',1);
INSERT INTO uc_countries VALUES (148,"CHAD",'TD','TCD',1);
INSERT INTO uc_countries VALUES (152,"CHILE",'CL','CHL',1);
INSERT INTO uc_countries VALUES (156,"CHINA",'CN','CHN',1);
INSERT INTO uc_countries VALUES (162,"CHRISTMAS ISLAND",'CX','CXR',1);
INSERT INTO uc_countries VALUES (166,"COCOS (KEELING) ISLANDS",'CC','CCK',1);
INSERT INTO uc_countries VALUES (170,"COLOMBIA",'CO','COL',1);
INSERT INTO uc_countries VALUES (174,"COMOROS",'KM','COM',1);
INSERT INTO uc_countries VALUES (178,"CONGO",'CG','COG',1);
INSERT INTO uc_countries VALUES (180,"CONGO, THE DEMOCRATIC REPUBLIC OF THE",'CD','COD',1);
INSERT INTO uc_countries VALUES (184,"COOK ISLANDS",'CK','COK',1);
INSERT INTO uc_countries VALUES (188,"COSTA RICA",'CR','CRI',1);
INSERT INTO uc_countries VALUES (384,"COTE D'IVOIRE",'CI','CIV',1);
INSERT INTO uc_countries VALUES (191,"CROATIA",'HR','HRV',1);
INSERT INTO uc_countries VALUES (192,"CUBA",'CU','CUB',1);
INSERT INTO uc_countries VALUES (196,"CYPRUS",'CY','CYP',1);
INSERT INTO uc_countries VALUES (203,"CZECH REPUBLIC",'CZ','CZE',1);
INSERT INTO uc_countries VALUES (208,"DENMARK",'DK','DNK',1);
INSERT INTO uc_countries VALUES (262,"DJIBOUTI",'DJ','DJI',1);
INSERT INTO uc_countries VALUES (212,"DOMINICA",'DM','DMA',1);
INSERT INTO uc_countries VALUES (214,"DOMINICAN REPUBLIC",'DO','DOM',1);
INSERT INTO uc_countries VALUES (218,"ECUADOR",'EC','ECU',1);
INSERT INTO uc_countries VALUES (818,"EGYPT",'EG','EGY',1);
INSERT INTO uc_countries VALUES (222,"EL SALVADOR",'SV','SLV',1);
INSERT INTO uc_countries VALUES (226,"EQUATORIAL GUINEA",'GQ','GNQ',1);
INSERT INTO uc_countries VALUES (232,"ERITREA",'ER','ERI',1);
INSERT INTO uc_countries VALUES (233,"ESTONIA",'EE','EST',1);
INSERT INTO uc_countries VALUES (231,"ETHIOPIA",'ET','ETH',1);
INSERT INTO uc_countries VALUES (238,"FALKLAND ISLANDS (MALVINAS)",'FK','FLK',1);
INSERT INTO uc_countries VALUES (234,"FAROE ISLANDS",'FO','FRO',1);
INSERT INTO uc_countries VALUES (242,"FIJI",'FJ','FJI',1);
INSERT INTO uc_countries VALUES (246,"FINLAND",'FI','FIN',1);
INSERT INTO uc_countries VALUES (250,"FRANCE",'FR','FRA',1);
INSERT INTO uc_countries VALUES (254,"FRENCH GUIANA",'GF','GUF',1);
INSERT INTO uc_countries VALUES (258,"FRENCH POLYNESIA",'PF','PYF',1);
INSERT INTO uc_countries VALUES (260,"FRENCH SOUTHERN TERRITORIES",'TF','ATF',1);
INSERT INTO uc_countries VALUES (266,"GABON",'GA','GAB',1);
INSERT INTO uc_countries VALUES (270,"GAMBIA",'GM','GMB',1);
INSERT INTO uc_countries VALUES (268,"GEORGIA",'GE','GEO',1);
INSERT INTO uc_countries VALUES (276,"GERMANY",'DE','DEU',1);
INSERT INTO uc_countries VALUES (288,"GHANA",'GH','GHA',1);
INSERT INTO uc_countries VALUES (292,"GIBRALTAR",'GI','GIB',1);
INSERT INTO uc_countries VALUES (300,"GREECE",'GR','GRC',1);
INSERT INTO uc_countries VALUES (304,"GREENLAND",'GL','GRL',1);
INSERT INTO uc_countries VALUES (308,"GRENADA",'GD','GRD',1);
INSERT INTO uc_countries VALUES (312,"GUADELOUPE",'GP','GLP',1);
INSERT INTO uc_countries VALUES (316,"GUAM",'GU','GUM',1);
INSERT INTO uc_countries VALUES (320,"GUATEMALA",'GT','GTM',1);
INSERT INTO uc_countries VALUES (831,"GUERNSEY",'GG','GGY',1);
INSERT INTO uc_countries VALUES (324,"GUINEA",'GN','GIN',1);
INSERT INTO uc_countries VALUES (624,"GUINEA-BISSAU",'GW','GNB',1);
INSERT INTO uc_countries VALUES (328,"GUYANA",'GY','GUY',1);
INSERT INTO uc_countries VALUES (332,"HAITI",'HT','HTI',1);
INSERT INTO uc_countries VALUES (334,"HEARD ISLAND AND MCDONALD ISLANDS",'HM','HMD',1);
INSERT INTO uc_countries VALUES (340,"HONDURAS",'HN','HND',1);
INSERT INTO uc_countries VALUES (344,"HONG KONG",'HK','HKG',1);
INSERT INTO uc_countries VALUES (348,"HUNGARY",'HU','HUN',1);
INSERT INTO uc_countries VALUES (352,"ICELAND",'IS','ISL',1);
INSERT INTO uc_countries VALUES (356,"INDIA",'IN','IND',1);
INSERT INTO uc_countries VALUES (360,"INDONESIA",'ID','IDN',1);
INSERT INTO uc_countries VALUES (364,"IRAN (ISLAMIC REPUBLIC OF)",'IR','IRN',1);
INSERT INTO uc_countries VALUES (368,"IRAQ",'IQ','IRQ',1);
INSERT INTO uc_countries VALUES (372,"IRELAND",'IE','IRL',1);
INSERT INTO uc_countries VALUES (833,"ISLE OF MAN",'IM','IMM',1);
INSERT INTO uc_countries VALUES (376,"ISRAEL",'IL','ISR',1);
INSERT INTO uc_countries VALUES (380,"ITALY",'IT','ITA',1);
INSERT INTO uc_countries VALUES (388,"JAMAICA",'JM','JAM',1);
INSERT INTO uc_countries VALUES (392,"JAPAN",'JP','JPN',1);
INSERT INTO uc_countries VALUES (832,"JERSEY",'JE','JEY',1);
INSERT INTO uc_countries VALUES (400,"JORDAN",'JO','JOR',1);
INSERT INTO uc_countries VALUES (398,"KAZAKHSTAN",'KZ','KAZ',1);
INSERT INTO uc_countries VALUES (404,"KENYA",'KE','KEN',1);
INSERT INTO uc_countries VALUES (296,"KIRIBATI",'KI','KIR',1);
INSERT INTO uc_countries VALUES (408,"KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF",'KP','PRK',1);
INSERT INTO uc_countries VALUES (410,"KOREA, REPUBLIC OF",'KR','KOR',1);
INSERT INTO uc_countries VALUES (414,"KUWAIT",'KW','KWT',1);
INSERT INTO uc_countries VALUES (417,"KYRGYZSTAN",'KG','KGZ',1);
INSERT INTO uc_countries VALUES (418,"LAO PEOPLE'S DEMOCRATIC REPUBLIC",'LA','LAO',1);
INSERT INTO uc_countries VALUES (428,"LATVIA",'LV','LVA',1);
INSERT INTO uc_countries VALUES (422,"LEBANON",'LB','LBN',1);
INSERT INTO uc_countries VALUES (426,"LESOTHO",'LS','LSO',1);
INSERT INTO uc_countries VALUES (430,"LIBERIA",'LR','LBR',1);
INSERT INTO uc_countries VALUES (434,"LIBYAN ARAB JAMAHIRIYA",'LY','LBY',1);
INSERT INTO uc_countries VALUES (438,"LIECHTENSTEIN",'LI','LIE',1);
INSERT INTO uc_countries VALUES (440,"LITHUANIA",'LT','LTU',1);
INSERT INTO uc_countries VALUES (442,"LUXEMBOURG",'LU','LUX',1);
INSERT INTO uc_countries VALUES (446,"MACAO",'MO','MAC',1);
INSERT INTO uc_countries VALUES (807,"MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF",'MK','MKD',1);
INSERT INTO uc_countries VALUES (450,"MADAGASCAR",'MG','MDG',1);
INSERT INTO uc_countries VALUES (454,"MALAWI",'MW','MWI',1);
INSERT INTO uc_countries VALUES (458,"MALAYSIA",'MY','MYS',1);
INSERT INTO uc_countries VALUES (462,"MALDIVES",'MV','MDV',1);
INSERT INTO uc_countries VALUES (466,"MALI",'ML','MLI',1);
INSERT INTO uc_countries VALUES (470,"MALTA",'MT','MLT',1);
INSERT INTO uc_countries VALUES (584,"MARSHALL ISLANDS",'MH','MHL',1);
INSERT INTO uc_countries VALUES (474,"MARTINIQUE",'MQ','MTQ',1);
INSERT INTO uc_countries VALUES (478,"MAURITANIA",'MR','MRT',1);
INSERT INTO uc_countries VALUES (480,"MAURITIUS",'MU','MUS',1);
INSERT INTO uc_countries VALUES (175,"MAYOTTE",'YT','MYT',1);
INSERT INTO uc_countries VALUES (484,"MEXICO",'MX','MEX',1);
INSERT INTO uc_countries VALUES (583,"MICRONESIA, FEDERATED STATES OF",'FM','FSM',1);
INSERT INTO uc_countries VALUES (498,"MOLDOVA, REPUBLIC OF",'MD','MDA',1);
INSERT INTO uc_countries VALUES (492,"MONACO",'MC','MCO',1);
INSERT INTO uc_countries VALUES (496,"MONGOLIA",'MN','MNG',1);
INSERT INTO uc_countries VALUES (499,"MONTENEGRO",'ME','MNE',1);
INSERT INTO uc_countries VALUES (500,"MONTSERRAT",'MS','MSR',1);
INSERT INTO uc_countries VALUES (504,"MOROCCO",'MA','MAR',1);
INSERT INTO uc_countries VALUES (508,"MOZAMBIQUE",'MZ','MOZ',1);
INSERT INTO uc_countries VALUES (104,"MYANMAR",'MM','MMR',1);
INSERT INTO uc_countries VALUES (516,"NAMIBIA",'NA','NAM',1);
INSERT INTO uc_countries VALUES (520,"NAURU",'NR','NRU',1);
INSERT INTO uc_countries VALUES (524,"NEPAL",'NP','NPL',1);
INSERT INTO uc_countries VALUES (528,"NETHERLANDS",'NL','NLD',1);
INSERT INTO uc_countries VALUES (530,"NETHERLANDS ANTILLES",'AN','ANT',1);
INSERT INTO uc_countries VALUES (540,"NEW CALEDONIA",'NC','NCL',1);
INSERT INTO uc_countries VALUES (554,"NEW ZEALAND",'NZ','NZL',1);
INSERT INTO uc_countries VALUES (558,"NICARAGUA",'NI','NIC',1);
INSERT INTO uc_countries VALUES (562,"NIGER",'NE','NER',1);
INSERT INTO uc_countries VALUES (566,"NIGERIA",'NG','NGA',1);
INSERT INTO uc_countries VALUES (570,"NIUE",'NU','NIU',1);
INSERT INTO uc_countries VALUES (574,"NORFOLK ISLAND",'NF','NFK',1);
INSERT INTO uc_countries VALUES (580,"NORTHERN MARIANA ISLANDS",'MP','MNP',1);
INSERT INTO uc_countries VALUES (578,"NORWAY",'NO','NOR',1);
INSERT INTO uc_countries VALUES (512,"OMAN",'OM','OMN',1);
INSERT INTO uc_countries VALUES (586,"PAKISTAN",'PK','PAK',1);
INSERT INTO uc_countries VALUES (585,"PALAU",'PW','PLW',1);
INSERT INTO uc_countries VALUES (275,"PALESTINIAN TERRITORY, OCCUPIED",'PS','PSE',1);
INSERT INTO uc_countries VALUES (591,"PANAMA",'PA','PAN',1);
INSERT INTO uc_countries VALUES (598,"PAPUA NEW GUINEA",'PG','PNG',1);
INSERT INTO uc_countries VALUES (600,"PARAGUAY",'PY','PRY',1);
INSERT INTO uc_countries VALUES (604,"PERU",'PE','PER',1);
INSERT INTO uc_countries VALUES (608,"PHILIPPINES",'PH','PHL',1);
INSERT INTO uc_countries VALUES (612,"PITCAIRN",'PN','PCN',1);
INSERT INTO uc_countries VALUES (616,"POLAND",'PL','POL',1);
INSERT INTO uc_countries VALUES (620,"PORTUGAL",'PT','PRT',1);
INSERT INTO uc_countries VALUES (630,"PUERTO RICO",'PR','PRI',1);
INSERT INTO uc_countries VALUES (634,"QATAR",'QA','QAT',1);
INSERT INTO uc_countries VALUES (638,"REUNION",'RE','REU',1);
INSERT INTO uc_countries VALUES (642,"ROMANIA",'RO','ROU',1);
INSERT INTO uc_countries VALUES (643,"RUSSIAN FEDERATION",'RU','RUS',1);
INSERT INTO uc_countries VALUES (646,"RWANDA",'RW','RWA',1);
INSERT INTO uc_countries VALUES (654,"SAINT HELENA",'SH','SHN',1);
INSERT INTO uc_countries VALUES (659,"SAINT KITTS AND NEVIS",'KN','KNA',1);
INSERT INTO uc_countries VALUES (662,"SAINT LUCIA",'LC','LCA',1);
INSERT INTO uc_countries VALUES (666,"SAINT PIERRE AND MIQUELON",'PM','SPM',1);
INSERT INTO uc_countries VALUES (670,"SAINT VINCENT AND THE GRENADINES",'VC','VCT',1);
INSERT INTO uc_countries VALUES (882,"SAMOA",'WS','WSM',1);
INSERT INTO uc_countries VALUES (674,"SAN MARINO",'SM','SMR',1);
INSERT INTO uc_countries VALUES (678,"SAO TOME AND PRINCIPE",'ST','STP',1);
INSERT INTO uc_countries VALUES (682,"SAUDI ARABIA",'SA','SAU',1);
INSERT INTO uc_countries VALUES (686,"SENEGAL",'SN','SEN',1);
INSERT INTO uc_countries VALUES (688,"SERBIA",'RS','SRB',1);
INSERT INTO uc_countries VALUES (690,"SEYCHELLES",'SC','SYC',1);
INSERT INTO uc_countries VALUES (694,"SIERRA LEONE",'SL','SLE',1);
INSERT INTO uc_countries VALUES (702,"SINGAPORE",'SG','SGP',1);
INSERT INTO uc_countries VALUES (703,"SLOVAKIA",'SK','SVK',1);
INSERT INTO uc_countries VALUES (705,"SLOVENIA",'SI','SVN',1);
INSERT INTO uc_countries VALUES (090,"SOLOMON ISLANDS",'SB','SLB',1);
INSERT INTO uc_countries VALUES (706,"SOMALIA",'SO','SOM',1);
INSERT INTO uc_countries VALUES (710,"SOUTH AFRICA",'ZA','ZAF',1);
INSERT INTO uc_countries VALUES (239,"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS",'GS','SGS',1);
INSERT INTO uc_countries VALUES (724,"SPAIN",'ES','ESP',1);
INSERT INTO uc_countries VALUES (144,"SRI LANKA",'LK','LKA',1);
INSERT INTO uc_countries VALUES (736,"SUDAN",'SD','SDN',1);
INSERT INTO uc_countries VALUES (740,"SURINAME",'SR','SUR',1);
INSERT INTO uc_countries VALUES (744,"SVALBARD AND JAN MAYEN",'SJ','SJM',1);
INSERT INTO uc_countries VALUES (748,"SWAZILAND",'SZ','SWZ',1);
INSERT INTO uc_countries VALUES (752,"SWEDEN",'SE','SWE',1);
INSERT INTO uc_countries VALUES (756,"SWITZERLAND",'CH','CHE',1);
INSERT INTO uc_countries VALUES (760,"SYRIAN ARAB REPUBLIC",'SY','SYR',1);
INSERT INTO uc_countries VALUES (158,"TAIWAN, PROVINCE OF CHINA",'TW','TWN',1);
INSERT INTO uc_countries VALUES (762,"TAJIKISTAN",'TJ','TJK',1);
INSERT INTO uc_countries VALUES (834,"TANZANIA, UNITED REPUBLIC OF",'TZ','TZA',1);
INSERT INTO uc_countries VALUES (764,"THAILAND",'TH','THA',1);
INSERT INTO uc_countries VALUES (626,"TIMOR-LESTE",'TL','TLS',1);
INSERT INTO uc_countries VALUES (768,"TOGO",'TG','TGO',1);
INSERT INTO uc_countries VALUES (772,"TOKELAU",'TK','TKL',1);
INSERT INTO uc_countries VALUES (776,"TONGA",'TO','TON',1);
INSERT INTO uc_countries VALUES (780,"TRINIDAD AND TOBAGO",'TT','TTO',1);
INSERT INTO uc_countries VALUES (788,"TUNISIA",'TN','TUN',1);
INSERT INTO uc_countries VALUES (792,"TURKEY",'TR','TUR',1);
INSERT INTO uc_countries VALUES (795,"TURKMENISTAN",'TM','TKM',1);
INSERT INTO uc_countries VALUES (796,"TURKS AND CAICOS ISLANDS",'TC','TCA',1);
INSERT INTO uc_countries VALUES (798,"TUVALU",'TV','TUV',1);
INSERT INTO uc_countries VALUES (800,"UGANDA",'UG','UGA',1);
INSERT INTO uc_countries VALUES (804,"UKRAINE",'UA','UKR',1);
INSERT INTO uc_countries VALUES (784,"UNITED ARAB EMIRATES",'AE','ARE',1);
INSERT INTO uc_countries VALUES (826,"UNITED KINGDOM",'GB','GBR',1);
INSERT INTO uc_countries VALUES (840,"UNITED STATES",'US','USA',1);
INSERT INTO uc_countries VALUES (581,"UNITED STATES MINOR OUTLYING ISLANDS",'UM','UMI',1);
INSERT INTO uc_countries VALUES (858,"URUGUAY",'UY','URY',1);
INSERT INTO uc_countries VALUES (860,"UZBEKISTAN",'UZ','UZB',1);
INSERT INTO uc_countries VALUES (548,"VANUATU",'VU','VUT',1);
INSERT INTO uc_countries VALUES (336,"VATICAN CITY STATE (HOLY SEE)",'VA','VAT',1);
INSERT INTO uc_countries VALUES (862,"VENEZUELA",'VE','VEN',1);
INSERT INTO uc_countries VALUES (704,"VIET NAM",'VN','VNM',1);
INSERT INTO uc_countries VALUES (092,"VIRGIN ISLANDS (BRITISH)",'VG','VGB',1);
INSERT INTO uc_countries VALUES (850,"VIRGIN ISLANDS (U.S.)",'VI','VIR',1);
INSERT INTO uc_countries VALUES (876,"WALLIS AND FUTUNA",'WF','WLF',1);
INSERT INTO uc_countries VALUES (732,"WESTERN SAHARA",'EH','ESH',1);
INSERT INTO uc_countries VALUES (887,"YEMEN",'YE','YEM',1);
INSERT INTO uc_countries VALUES (891,"YUGOSLAVIA",'YU','YUG',1);
INSERT INTO uc_countries VALUES (894,"ZAMBIA",'ZM','ZMB',1);
INSERT INTO uc_countries VALUES (716,"ZIMBABWE",'ZW','ZWE',1);

View File

@@ -23,6 +23,7 @@ function uc_country_import_form($form, &$form_state) {
$header = array(t('Country'), t('Code'), t('Version'), t('Operations'));
$rows = array();
if (is_array($countries)) {
$link_ops = array('query' => array('token' => drupal_get_token('uc_country_op_link')));
foreach ($countries as $country) {
$row = array(
t($country->country_name),
@@ -32,13 +33,13 @@ function uc_country_import_form($form, &$form_state) {
$ops = array();
if ($country->version < 0) {
$ops[] = l(t('enable'), 'admin/store/settings/countries/' . $country->country_id . '/enable');
$ops[] = l(t('enable'), 'admin/store/settings/countries/' . $country->country_id . '/enable', $link_ops);
}
else {
$ops[] = l(t('disable'), 'admin/store/settings/countries/' . $country->country_id . '/disable');
$ops[] = l(t('disable'), 'admin/store/settings/countries/' . $country->country_id . '/disable', $link_ops);
}
if ($country->version < $files[$country->country_id]['version'] && $country->version > 0) {
$ops[] = l(t('update'), 'admin/store/settings/countries/' . $country->country_id . '/update/' . $files[$country->country_id]['version']);
$ops[] = l(t('update'), 'admin/store/settings/countries/' . $country->country_id . '/update/' . $files[$country->country_id]['version'], $link_ops);
}
$ops[] = l(t('remove'), 'admin/store/settings/countries/' . $country->country_id . '/remove');
$row[] = implode(' ', $ops);
@@ -419,3 +420,22 @@ function _uc_country_import_include($country_id, $version) {
return FALSE;
}
/**
* Performs country actions after validating the CSRF-prevention token.
*
* @param $function
* The function name to run.
* @param $param
* Parameter to pass to the function specified.
* @param $param2
* (optional) Parameter to pass to the function specified.
*/
function _uc_country_perform_country_action($function, $param, $param2 = NULL) {
if (isset($_GET['token']) && drupal_valid_token($_GET['token'], 'uc_country_op_link')) {
call_user_func($function, $param, $param2);
}
else {
return MENU_ACCESS_DENIED;
}
}

View File

@@ -16,9 +16,9 @@ files[] = tests/uc_ajax.test
configure = admin/store/settings/store
stylesheets[all][] = uc_store.css
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -172,8 +172,8 @@ function uc_store_menu() {
$items['admin/store/settings/countries/%/disable'] = array(
'title' => 'Disable a country',
'description' => 'Disable a country from use.',
'page callback' => 'uc_country_disable',
'page arguments' => array(4),
'page callback' => '_uc_country_perform_country_action',
'page arguments' => array('uc_country_disable', 4),
'access arguments' => array('administer store'),
'type' => MENU_CALLBACK,
'file' => 'uc_store.countries.inc',
@@ -181,8 +181,8 @@ function uc_store_menu() {
$items['admin/store/settings/countries/%/enable'] = array(
'title' => 'Enable a country',
'description' => 'Enable a disabled country.',
'page callback' => 'uc_country_enable',
'page arguments' => array(4),
'page callback' => '_uc_country_perform_country_action',
'page arguments' => array('uc_country_enable', 4),
'access arguments' => array('administer store'),
'type' => MENU_CALLBACK,
'file' => 'uc_store.countries.inc',
@@ -198,8 +198,8 @@ function uc_store_menu() {
$items['admin/store/settings/countries/%/update/%'] = array(
'title' => 'Update a country',
'description' => 'Update an installed country.',
'page callback' => 'uc_country_update',
'page arguments' => array(4, 6),
'page callback' => '_uc_country_perform_country_action',
'page arguments' => array('uc_country_update', 4, 6),
'access arguments' => array('administer store'),
'type' => MENU_CALLBACK,
'file' => 'uc_store.countries.inc',

View File

@@ -5,9 +5,9 @@ dependencies[] = uc_taxes
package = Ubercart - core (optional)
core = 7.x
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"

View File

@@ -11,9 +11,9 @@ files[] = tests/uc_taxes.test
configure = admin/store/settings/taxes
; Information added by Drupal.org packaging script on 2013-12-17
version = "7.x-3.6"
; Information added by Drupal.org packaging script on 2014-10-22
version = "7.x-3.8"
core = "7.x"
project = "ubercart"
datestamp = "1387304010"
datestamp = "1413965350"