Skip to content

Commit

Permalink
Add token to clone link
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnopek committed Mar 6, 2019
1 parent 690fe4a commit 6c32d0d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion uc_taxes/uc_taxes.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
function uc_taxes_admin_settings() {
$rows = array();

$options = array('query' => array('token' => drupal_get_token('uc_taxes_clone')));

$header = array(t('Name'), t('Rate'), t('Taxed products'), t('Taxed product types'), t('Taxed line items'), t('Weight'), 'data' => t('Operations'));

// Loop through all the defined tax rates.
Expand All @@ -19,7 +21,7 @@ function uc_taxes_admin_settings() {
$ops = array(
l(t('edit'), 'admin/store/settings/taxes/'. $rate_id .'/edit'),
l(t('conditions'), CA_UI_PATH .'/uc_taxes_'. $rate_id .'/edit/conditions'),
l(t('clone'), 'admin/store/settings/taxes/'. $rate_id .'/clone'),
l(t('clone'), 'admin/store/settings/taxes/' . $rate_id .'/clone', $options),
l(t('delete'), 'admin/store/settings/taxes/'. $rate_id .'/delete'),
);

Expand Down Expand Up @@ -199,6 +201,10 @@ function uc_taxes_form_submit($form, &$form_state) {
* Clones a tax rate.
*/
function uc_taxes_clone($rate_id) {
if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'uc_taxes_clone')) {
return MENU_ACCESS_DENIED;
}

// Load the source rate object.
$rate = uc_taxes_rate_load($rate_id);
$name = $rate->name;
Expand Down

0 comments on commit 6c32d0d

Please sign in to comment.