security update link,module_filters,search_api_solr,ubercart,views

This commit is contained in:
2019-04-24 16:39:12 +02:00
parent 0aea7a0db1
commit 514f3bd89e
497 changed files with 9038 additions and 3662 deletions

View File

@@ -23,12 +23,12 @@ class UbercartRolesTestCase extends UbercartTestHelper {
*/
protected function setUp($modules = array(), $permissions = array()) {
$modules = array('uc_payment', 'uc_payment_pack', 'uc_roles');
// Needed to see/modify roles on the /user/%/edit page
// Needed to see/modify roles on the /user/%/edit page.
$permissions = array('administer permissions', 'administer users', 'view all role expirations');
parent::setUp($modules, $permissions);
}
function testRolePurchaseCheckout() {
public function testRolePurchaseCheckout() {
// Add role assignment to the test product.
$rid = $this->drupalCreateRole(array('access content'));
$this->drupalLogin($this->adminUser);
@@ -61,7 +61,7 @@ class UbercartRolesTestCase extends UbercartTestHelper {
$this->cronRun();
}
function testRoleAdminDelete() {
public function testRoleAdminDelete() {
// Add role assignment to the test product.
$rid = $this->drupalCreateRole(array('access content'));
$this->drupalLogin($this->adminUser);
@@ -104,4 +104,5 @@ class UbercartRolesTestCase extends UbercartTestHelper {
$this->assertText('There are no pending expirations for roles this user.', 'User has no role expirations.');
}
}

View File

@@ -11,9 +11,8 @@ files[] = tests/uc_roles.test
; Views handlers
files[] = views/uc_roles_handler_field_rid.inc
; Information added by Drupal.org packaging script on 2016-07-16
version = "7.x-3.10"
; Information added by Drupal.org packaging script on 2019-03-06
version = "7.x-3.12"
core = "7.x"
project = "ubercart"
datestamp = "1468644909"
datestamp = "1551862392"

View File

@@ -62,7 +62,7 @@ function uc_roles_schema() {
'default' => 0,
),
// End of expiration period
// End of expiration period.
'end_override' => array(
'description' => 'Override the default end time? 1 => Yes. 0 => No.',
'type' => 'int',

View File

@@ -10,7 +10,6 @@
* expire/need to be renewed/etc.
*/
/**
* Implements hook_help().
*/
@@ -268,7 +267,7 @@ function uc_roles_user_validate($form, &$form_state) {
// Validate adjusted expirations.
if (isset($edit['table'])) {
foreach ((array)$edit['table'] as $rid => $value) {
foreach ((array) $edit['table'] as $rid => $value) {
// We don't validate if nothing was actually selected, the role, or the
// expiration is removed.
if ($value['qty'] == 0 || $value['remove'] == 1 || !$edit['roles'][$rid]) {
@@ -315,7 +314,7 @@ function uc_roles_user_presave(&$edit, $account, $category) {
// Check if any temporary role actions were taken.
if (isset($edit['table'])) {
foreach ((array)$edit['table'] as $rid => $value) {
foreach ((array) $edit['table'] as $rid => $value) {
// Remove this expiration.
if ($value['remove']) {
uc_roles_delete($account, $rid);
@@ -396,7 +395,7 @@ function uc_roles_user_view($account, $view_mode) {
function uc_roles_uc_order_product_can_ship($item) {
$roles = db_query("SELECT * FROM {uc_roles_products} WHERE nid = :nid", array(':nid' => $item->nid));
foreach ($roles as $role) {
// If the model is empty, keep looking. (Everyone needs a role model...)
// If the model is empty, keep looking. (Everyone needs a role model...).
if (empty($role->model)) {
continue;
}
@@ -472,6 +471,7 @@ function uc_roles_uc_message() {
*
* @see uc_roles_feature_form_validate()
* @see uc_roles_feature_form_submit()
*
* @ingroup forms
*/
function uc_roles_feature_form($form, &$form_state, $node, $feature) {
@@ -612,7 +612,7 @@ function uc_roles_feature_form($form, &$form_state, $node, $feature) {
'day' => t('day(s)'),
'week' => t('week(s)'),
'month' => t('month(s)'),
'year' => t('year(s)')
'year' => t('year(s)'),
),
'#default_value' => $default_granularity,
'#description' => t('From the time the role was purchased.'),
@@ -718,11 +718,11 @@ function uc_roles_feature_form_submit($form, &$form_state) {
// We should be setting NULL, but drupal_write_record() ...
'end_override' => $form_state['values']['end_override'],
'end_time' => $form_state['values']['expiration' ] === 'abs' ? $form_state['values']['uc_roles_expire_absolute'] : NULL,
'end_time' => $form_state['values']['expiration'] === 'abs' ? $form_state['values']['uc_roles_expire_absolute'] : NULL,
);
$description = empty($product_role['model']) ? t('<strong>SKU:</strong> Any<br />') : t('<strong>SKU:</strong> !sku<br />', array('!sku' => $product_role['model']));
$description .= t('<strong>Role:</strong> @role_name<br />', array('@role_name' => _uc_roles_get_name($product_role['rid'])));
$description .= t('<strong>Role:</strong> @role_name<br />', array('@role_name' => _uc_roles_get_name($product_role['rid'])));
if ($product_role['end_override']) {
if ($product_role['end_time']) {
@@ -733,18 +733,23 @@ function uc_roles_feature_form_submit($form, &$form_state) {
case 'never':
$description .= t('<strong>Expiration:</strong> never<br />');
break;
case 'day':
$description .= t('<strong>Expiration:</strong> !qty day(s)<br />', array('!qty' => $product_role['duration']));
break;
case 'week':
$description .= t('<strong>Expiration:</strong> !qty week(s)<br />', array('!qty' => $product_role['duration']));
break;
case 'month':
$description .= t('<strong>Expiration:</strong> !qty month(s)<br />', array('!qty' => $product_role['duration']));
break;
case 'year':
$description .= t('<strong>Expiration:</strong> !qty year(s)<br />', array('!qty' => $product_role['duration']));
break;
default:
break;
}
@@ -765,7 +770,8 @@ function uc_roles_feature_form_submit($form, &$form_state) {
$form_state['redirect'] = uc_product_feature_save($data);
$product_role['pfid'] = $data['pfid'];
// Updating the 'pfid' on $product_role and on $form_state for future use.
$form_state['values']['pfid'] = $product_role['pfid'] = $data['pfid'];
// Insert or update uc_file_product table.
uc_roles_product_write_record($product_role);
@@ -844,7 +850,7 @@ function uc_roles_feature_settings($form, &$form_state) {
'day' => t('day(s)'),
'week' => t('week(s)'),
'month' => t('month(s)'),
'year' => t('year(s)')
'year' => t('year(s)'),
),
'#description' => t('From the time the role was purchased.'),
'#prefix' => '<div class="expiration">',
@@ -894,7 +900,7 @@ function uc_roles_feature_settings($form, &$form_state) {
'day' => t('day(s)'),
'week' => t('week(s)'),
'month' => t('month(s)'),
'year' => t('year(s)')
'year' => t('year(s)'),
),
'#description' => t('The amount of time before a role expiration takes place that a customer is notified of its expiration.'),
'#prefix' => '<div class="expiration">',
@@ -912,10 +918,10 @@ function uc_roles_feature_settings($form, &$form_state) {
/**
* Gets role name.
*
* @param $rid
* @param int $rid
* The Drupal role id number.
*
* @return
* @return string|false
* A string containing the name of the role, returns FALSE if rid is invalid.
*/
function _uc_roles_get_name($rid) {
@@ -926,10 +932,10 @@ function _uc_roles_get_name($rid) {
/**
* Gets available roles for granting on product purchase.
*
* @param $exclude
* @param array $exclude
* A list of role ids to exclude from the list.
*
* @return
* @return array
* An assoc array with key = rid and value = role name.
*/
function _uc_roles_get_choices($exclude = array()) {
@@ -956,7 +962,7 @@ function _uc_roles_get_choices($exclude = array()) {
/**
* Deletes all role data associated with a given product feature.
*
* @param $pfid
* @param int $pfid
* An Ubercart product feature ID.
*/
function uc_roles_feature_delete($pfid) {
@@ -977,9 +983,9 @@ function uc_roles_feature_delete($pfid) {
*
* @param $account
* A Drupal user object.
* @param $rid
* @param int $rid
* A Drupal role ID.
* @param $silent
* @param bool $silent
* When set to TRUE will suppress any Drupal messages from this function.
*/
function uc_roles_delete($account, $rid = NULL, $silent = FALSE) {
@@ -1014,7 +1020,7 @@ function uc_roles_delete($account, $rid = NULL, $silent = FALSE) {
}
/**
* Revokes a role on a given user
* Revokes a role on a given user.
*
* This function deletes a given role from a user's list of roles, as
* well as removing any expiration data associated with the user/role.
@@ -1022,9 +1028,9 @@ function uc_roles_delete($account, $rid = NULL, $silent = FALSE) {
*
* @param $account
* A Drupal user object.
* @param $rid
* @param int $rid
* A Drupal role ID.
* @param $silent
* @param bool $silent
* When set to TRUE will suppress any Drupal messages from this function.
*/
function uc_roles_revoke(&$account, $rid, $silent = FALSE) {
@@ -1059,7 +1065,7 @@ function uc_roles_revoke(&$account, $rid, $silent = FALSE) {
}
/**
* Grants a role to a given user
* Grants a role to a given user.
*
* This function grants a given role to a user's list of roles. If there
* is a previous record of this user/role combination, it is first removed.
@@ -1070,14 +1076,14 @@ function uc_roles_revoke(&$account, $rid, $silent = FALSE) {
*
* @param $account
* A Drupal user object.
* @param $rid
* @param int $rid
* A Drupal role ID.
* @param $timestamp
* @param int $timestamp
* When this role will expire.
* @param $save_user
* Optimization to prevent unnecessary user saving when calling from
* uc_roles_user_presave().
* @param $silent
* @param bool $silent
* When set to TRUE will suppress any Drupal messages from this function.
*/
function uc_roles_grant(&$account, $rid, $timestamp, $save_user = TRUE, $silent = FALSE) {
@@ -1092,7 +1098,6 @@ function uc_roles_grant(&$account, $rid, $timestamp, $save_user = TRUE, $silent
$account = user_save($account, array('roles' => $roles_list));
}
// If the role expires, keep a record.
if (!is_null($timestamp)) {
db_insert('uc_roles_expirations')
@@ -1144,11 +1149,11 @@ function uc_roles_grant(&$account, $rid, $timestamp, $save_user = TRUE, $silent
*
* @param $account
* A Drupal user object.
* @param $rid
* @param int $rid
* A Drupal role ID.
* @param $timestamp
* @param int $timestamp
* When this role will expire.
* @param $silent
* @param bool $silent
* When set to TRUE will suppress any Drupal messages from this function.
*/
function uc_roles_renew($account, $rid, $timestamp, $silent = FALSE) {
@@ -1264,7 +1269,7 @@ function _uc_roles_product_get_expiration($role_product, $quantity, $time) {
* (optional) The starting date for when the role will last. Defaults to
* the current time.
*
* @return
* @return int|null
* A UNIX timestamp representing the second that expiration takes place,
* or NULL if the expiration should never occur.
*/

View File

@@ -127,7 +127,7 @@ function uc_roles_rules_action_info() {
),
);
// Send an email to an order with a role expiration
// Send an email to an order with a role expiration.
$actions['uc_roles_order_email'] = array(
'label' => t('Send an order email regarding roles.'),
'group' => t('Notification'),
@@ -140,7 +140,7 @@ function uc_roles_rules_action_info() {
) + $email_args,
);
// Send an email to a user with a role expiration
// Send an email to a user with a role expiration.
$actions['uc_roles_user_email'] = array(
'label' => t('Send a user an email regarding roles.'),
'group' => t('Notification'),
@@ -242,7 +242,7 @@ function uc_roles_action_order_email($order, $role_expiration, $from, $addresses
'message' => $message,
'format' => $format,
);
// Token replacements for the subject and body
// Token replacements for the subject and body.
$settings['replacements'] = array(
'uc_order' => $order,
'uc_role' => $role_expiration,
@@ -253,7 +253,7 @@ function uc_roles_action_order_email($order, $role_expiration, $from, $addresses
$addresses = token_replace($settings['addresses'], $settings['replacements']);
foreach (explode("\n", $addresses) as $address) {
$address = trim($address);
// Remove blank lines
// Remove blank lines.
if (!empty($address)) {
$recipients[] = $address;
}
@@ -284,7 +284,7 @@ function uc_roles_action_user_email($account, $role_expiration, $from, $addresse
'message' => $message,
'format' => $format,
);
// Token replacements for the subject and body
// Token replacements for the subject and body.
$settings['replacements'] = array(
'user' => $account,
'uc_role' => $role_expiration,
@@ -295,7 +295,7 @@ function uc_roles_action_user_email($account, $role_expiration, $from, $addresse
$addresses = token_replace($settings['addresses'], $settings['replacements']);
foreach (explode("\n", $addresses) as $address) {
$address = trim($address);
// Remove blank lines
// Remove blank lines.
if (!empty($address)) {
$recipients[] = $address;
}
@@ -322,9 +322,9 @@ function uc_roles_action_user_email($account, $role_expiration, $from, $addresse
* is notified in Drupal, as well as through the email address associated with
* the order.
*
* @param $order
* @param object $order
* An Ubercart order object.
* @param $message
* @param bool $message
* If TRUE, messages will be displayed to the user about the renewal.
*/
function uc_roles_action_order_renew($order, $message) {
@@ -365,7 +365,7 @@ function uc_roles_action_order_renew($order, $message) {
uc_roles_grant($account, $role->rid, $expiration, TRUE, !$message);
}
// Get the new expiration (if applicable)
// Get the new expiration (if applicable).
$new_expiration = db_query("SELECT * FROM {uc_roles_expirations} WHERE uid = :uid AND rid = :rid", array(':uid' => $account->uid, ':rid' => $role->rid))->fetchObject();
if (!$new_expiration) {
$new_expiration = new stdClass();

View File

@@ -6,7 +6,7 @@
*/
/**
* Implements hook_defualt_rules_configuration().
* Implements hook_default_rules_configuration().
*/
function uc_roles_default_rules_configuration() {
$configs = array();

View File

@@ -21,11 +21,11 @@ function theme_uc_roles_user_new($variables) {
$output = drupal_render($form['expirations']);
$output .= '<div class="expiration">';
$output .= drupal_render($form['new_role']);
$output .= drupal_render($form['new_role_add']);
$output .= drupal_render($form['new_role_add_for']);
$output .= drupal_render($form['new_role_add_qty']);
$output .= drupal_render($form['new_role_add_granularity']);
$output .= drupal_render($form['new_role']);
$output .= drupal_render($form['new_role_add']);
$output .= drupal_render($form['new_role_add_for']);
$output .= drupal_render($form['new_role_add_qty']);
$output .= drupal_render($form['new_role_add_granularity']);
$output .= '</div>';
return $output;
@@ -52,8 +52,8 @@ function theme_uc_roles_user_expiration($variables) {
$rows = array();
// The expiration table.
foreach ((array)$form['table'] as $rid => $expiration) {
// We only want numeric rid's
foreach ((array) $form['table'] as $rid => $expiration) {
// We only want numeric rids.
if (!is_numeric($rid)) {
continue;
}

View File

@@ -51,6 +51,7 @@ function uc_roles_tokens($type, $tokens, $data = array(), $options = array()) {
case 'expiration':
$replacements[$original] = format_date($object->expiration, 'medium');
break;
case 'name':
$replacements[$original] = $sanitize ? check_plain(_uc_roles_get_name($object->rid)) : _uc_roles_get_name($object->rid);
break;