Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v158' into smtpauth_newsletters
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcwilson committed Feb 25, 2022
2 parents b42c878 + f34865b commit 6471305
Show file tree
Hide file tree
Showing 29 changed files with 264 additions and 259 deletions.
124 changes: 62 additions & 62 deletions admin/coupon_restrict.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
//
$restrict_array = array(
array(
'id' => 'Deny',
'id' => 'Deny',
'text' => TEXT_PULLDOWN_DENY
),
array(
'id' => 'Allow',
'id' => 'Allow',
'text' => TEXT_PULLDOWN_ALLOW
)
);
Expand Down Expand Up @@ -98,7 +98,7 @@
);
}
break;

case 'add_category':
if (!isset($_POST['cPath'])) {
break;
Expand All @@ -107,7 +107,7 @@
$cPath = -1;
}
$test_query = $db->Execute(
"SELECT *
"SELECT *
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_id = $cid
AND category_id = $cPath"
Expand All @@ -129,19 +129,19 @@
$db->Execute(
"INSERT INTO " . TABLE_COUPON_RESTRICT . "
(coupon_id, category_id, coupon_restrict)
VALUES
VALUES
($cid, $cPath, '$status')"
);
}
break;

case 'add_product':
if (empty($_POST['pid']) || empty($_POST['restrict_status']) || (empty($_POST['prod_cat']) && empty($_POST['prod_man']))) {
break;
}
$pid = (int)$_POST['pid'];
$test_query = $db->Execute(
"SELECT *
"SELECT *
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_id = $cid
AND product_id = $pid"
Expand All @@ -150,10 +150,10 @@
$messageStack->add_session(ERROR_DISCOUNT_COUPON_DEFINED_PRODUCT . ' ' . $pid, 'caution');
} else {
$status = ($_POST['restrict_status'] == 'Deny') ? 'Y' : 'N';

$prod_cat = (!empty($_POST['prod_cat'])) ? (int)$_POST['prod_cat'] : 0;
$prod_man = (!empty($_POST['prod_man'])) ? (int)$_POST['prod_man'] : 0;

// -----
// Normal insert of product one-by-one allow/deny to coupon
//
Expand All @@ -172,13 +172,13 @@
if ($prod_cat > 0 && $pid == -1) {
// to insert new products from a given categories_id for a coupon_code that are not already in the table
// products in the table from the categories_id are skipped
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "
WHERE categories_id = $prod_cat
AND products_id NOT IN (
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_id = $cid
)";
$new_products = $db->Execute($new_products_query);
Expand All @@ -187,14 +187,14 @@
if ($prod_cat > 0 && $pid == -2) {
// to delete existing products from a given categories_id for a coupon_code that are already in the table,
// products in the table from the categories_id are skipped
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "
WHERE categories_id = $prod_cat
AND products_id IN (
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_restrict = '" . $status . "'
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_restrict = '" . $status . "'
AND coupon_id = $cid
)";
$new_products = $db->Execute($new_products_query);
Expand All @@ -203,13 +203,13 @@
if ($prod_man > 0 && $pid == -1) {
// to insert new products from a given manufacturers_id for a coupon_code that are not already in the table,
// products in the table from the manufacturers_id are skipped
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS . "
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS . "
WHERE manufacturers_id = $prod_man
AND products_id NOT IN (
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_id = $cid
)";
$new_products = $db->Execute($new_products_query);
Expand All @@ -218,14 +218,14 @@
if ($prod_man > 0 && $pid == -2) {
// to delete existing products from a given manufacturers_id for a coupon_code that are already in the table
// products in the table from the manufacturers_id are skipped
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS . "
$new_products_query =
"SELECT products_id
FROM " . TABLE_PRODUCTS . "
WHERE manufacturers_id = $prod_man
AND products_id IN (
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_restrict = '" . $status . "'
SELECT product_id
FROM " . TABLE_COUPON_RESTRICT . "
WHERE coupon_restrict = '" . $status . "'
AND coupon_id = $cid
)";
$new_products = $db->Execute($new_products_query);
Expand All @@ -242,7 +242,7 @@
$db->Execute(
"INSERT INTO " . TABLE_COUPON_RESTRICT . "
(coupon_id, product_id, coupon_restrict)
VALUES
VALUES
($cid, {$new_products->fields['products_id']}, '" . $status . "')"
);
} else {
Expand All @@ -259,16 +259,16 @@
}
}
break;

case 'remove':
$rid = (isset($_POST['rid'])) ? (int)$_POST['rid'] : 0;
$db->Execute(
"DELETE FROM " . TABLE_COUPON_RESTRICT . "
"DELETE FROM " . TABLE_COUPON_RESTRICT . "
WHERE restrict_id = $rid
LIMIT 1"
);
break;

default:
break;
}
Expand All @@ -281,12 +281,12 @@
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php require DIR_WS_INCLUDES . 'admin_html_head.php'; ?>
<link rel="stylesheet" type="text/css" media="print" href="includes/css/stylesheet_print.css">
<link rel="stylesheet" media="print" href="includes/css/stylesheet_print.css">
</head>
<body>
<!-- header //-->
<?php
require DIR_WS_INCLUDES . 'header.php';
<?php
require DIR_WS_INCLUDES . 'header.php';
?>
<!-- header_eof //-->
<!-- body //-->
Expand Down Expand Up @@ -351,7 +351,7 @@
<tr class="smallText text-center">
<td class="font-weight-bold"><?php echo TABLE_HEADING_CATEGORY_NAME; ?></td>
<td>
<?php echo
<?php echo
zen_draw_form('cat_cpath', FILENAME_COUPON_RESTRICT, zen_get_all_get_params(array('action')), 'get', 'id="cat-path-form"') .
zen_draw_pull_down_menu('cPath', zen_get_category_tree(), $cPath, 'id="cat-path"') .
zen_draw_hidden_field('cid', $cid) .
Expand Down Expand Up @@ -422,15 +422,15 @@

$manufacturers_array = array(
array(
'id' => '0',
'id' => '0',
'text' => TEXT_NONE
)
);

$manufacturers = $db->Execute(
"SELECT distinct m.manufacturers_id, m.manufacturers_name
FROM " . TABLE_MANUFACTURERS . " m
LEFT JOIN " . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_PRODUCTS . " p
ON m.manufacturers_id = p.manufacturers_id
WHERE p.manufacturers_id = m.manufacturers_id
AND p.products_status = 1
Expand All @@ -449,21 +449,21 @@

if ($current_manufacturers_id > 0) {
$products = $db->Execute(
"SELECT p.products_id, pd.products_name
"SELECT p.products_id, pd.products_name
FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m
WHERE p.products_id = pd.products_id
WHERE p.products_id = pd.products_id
AND pd.language_id = " . $_SESSION['languages_id'] . "
AND p.manufacturers_id = m.manufacturers_id
AND p.manufacturers_id = m.manufacturers_id
AND m.manufacturers_id = $current_manufacturers_id
ORDER BY pd.products_name, p.products_id"
);
} else {
$products = $db->Execute(
"SELECT p.products_id, pd.products_name
"SELECT p.products_id, pd.products_name
FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
WHERE p.products_id = pd.products_id
WHERE p.products_id = pd.products_id
AND pd.language_id = " . (int)$_SESSION['languages_id'] . "
AND p.products_id = p2c.products_id
AND p.products_id = p2c.products_id
AND p2c.categories_id = $cPath_prod
ORDER BY pd.products_name, p.products_id"
);
Expand Down Expand Up @@ -504,7 +504,7 @@
<tr class="smallText">
<td><?php echo TABLE_HEADING_CATEGORY_NAME . HEADER_MANUFACTURER_NAME; ?></td>
<td colspan="2">
<?php echo
<?php echo
zen_draw_form('prod-sel', FILENAME_COUPON_RESTRICT, zen_get_all_get_params(array('action')), 'get', 'id="prod-cat-man"') .
zen_draw_pull_down_menu('cPath_prod', zen_get_category_tree(), $cPath_prod, 'id="prod-path"') .
'<br><br>' .
Expand Down Expand Up @@ -535,34 +535,34 @@
<!-- body_eof //-->

<!-- footer //-->
<?php
require DIR_WS_INCLUDES . 'footer.php';
<?php
require DIR_WS_INCLUDES . 'footer.php';
?>
<!-- footer_eof //-->
<?php
// -----
// A collection of "helper" forms, used by the page's jQuery (see below).
//
echo
echo
zen_draw_form('new-cat', FILENAME_COUPON_RESTRICT, zen_get_all_get_params(array('action', 'page')) . '&action=add_category', 'post') .
zen_draw_hidden_field('cPath', $cPath) .
zen_draw_hidden_field('restrict_status', '', 'id="new-cat-restrict"') .
'</form>';
echo

echo
zen_draw_form('new-prod', FILENAME_COUPON_RESTRICT, zen_get_all_get_params(array('action', 'page')) . '&action=add_product', 'post') .
zen_draw_hidden_field('pid', '0', 'id="new-prod-id"') .
zen_draw_hidden_field('restrict_status', '', 'id="new-prod-restrict"') .
zen_draw_hidden_field('prod_cat', '0', 'id="new-prod-cat"') .
zen_draw_hidden_field('prod_man', '0', 'id="new-prod-man"') .
'</form>';

echo
zen_draw_form('toggle', FILENAME_COUPON_RESTRICT, zen_get_all_get_params(array('action', 'page')) . '&action=switch_status', 'post') .
zen_draw_hidden_field('rid', '0', 'id="switch-rid"') .
zen_draw_hidden_field('cid', $cid) .
'</form>';

echo
zen_draw_form('remove', FILENAME_COUPON_RESTRICT, zen_get_all_get_params(array('action', 'page')) . '&action=remove', 'post') .
zen_draw_hidden_field('rid', '0', 'id="remove-rid"') .
Expand All @@ -574,30 +574,30 @@
$('#cat-path').on('change', function(){
$('#cat-path-form').submit();
});

$('#cat-add-submit').on('click', function(){
$('#new-cat-restrict').val($('#cat-status :selected').val());
$('form[name="new-cat"]').submit();
});

$('.cr-remove').hover(function(){
$(this).css('cursor', 'pointer');
});

$('.cr-remove').on('click', function(){
$('#remove-rid').val($(this).closest('tr').data('rid'));
$('form[name="remove"]').submit();
});

$('.cr-toggle').on('click', function(){
$('#switch-rid').val($(this).closest('tr').data('rid'));
$('form[name="toggle"]').submit();
});

$('#prod-path, #prod-man').on('change', function(){
$('#prod-cat-man').submit();
});

$('#prod-add-submit').on('click', function(){
$('#new-prod-id').val($('#prod-pid :selected').val());
$('#new-prod-restrict').val($('#prod-status :selected').val());
Expand All @@ -609,5 +609,5 @@
</script>
</body>
</html>
<?php
<?php
require DIR_WS_INCLUDES . 'application_bottom.php';
10 changes: 5 additions & 5 deletions admin/includes/init_includes/init_errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
$messageStack->add(WARNING_EMAIL_SYSTEM_DISABLED, 'error');
}
// check if email sending has been disabled by developer switch
if (defined('DEVELOPER_OVERRIDE_EMAIL_STATUS') && DEVELOPER_OVERRIDE_EMAIL_STATUS == 'false') {
$messageStack->add(WARNING_EMAIL_SYSTEM_DEVELOPER_OVERRIDE, 'info');
if (defined('DEVELOPER_OVERRIDE_EMAIL_STATUS') && DEVELOPER_OVERRIDE_EMAIL_STATUS === 'false') {
$messageStack->add(WARNING_EMAIL_SYSTEM_DEVELOPER_OVERRIDE, 'info');
// check if email destinations have been diverted by developer switch
} elseif (defined('DEVELOPER_OVERRIDE_EMAIL_ADDRESS') && DEVELOPER_OVERRIDE_EMAIL_ADDRESS != '') {
$messageStack->add(sprintf(zen_output_string_protected(WARNING_EMAIL_SYSTEM_DEVELOPER_EMAIL), DEVELOPER_OVERRIDE_EMAIL_ADDRESS), 'info');
}
} elseif (defined('DEVELOPER_OVERRIDE_EMAIL_ADDRESS') && DEVELOPER_OVERRIDE_EMAIL_ADDRESS !== '') {
$messageStack->add(sprintf(WARNING_EMAIL_SYSTEM_DEVELOPER_EMAIL, DEVELOPER_OVERRIDE_EMAIL_ADDRESS, EMAIL_TRANSPORT), 'info');
}

// this will let the admin know that the website is DOWN FOR MAINTENANCE to the public
if (DOWN_FOR_MAINTENANCE == 'true') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

$define = [
'TEXT_COUNT_CUSTOMERS' => 'Customers receiving this Product Notification: %s',
'TEXT_NOTIFICATION_INFO_GLOBAL' => '<p><b>%%BUTTON_GLOBAL%%</b> button: the notification %s will be programmed to be sent to customers who chose to receive <strong>global</strong> product notifications.</p>',
'TEXT_NOTIFICATION_INFO_PRODUCTS' => '<p>Optionally, by selecting products and <b>%%BUTTON_SUBMIT%%</b>, the notification will <b>also</b> be sent to customers who chose to receive specific product notifications.</p>',
'TEXT_PRODUCTS' => 'Products',
'TEXT_SELECTED_PRODUCTS' => 'Selected Products',
'JS_PLEASE_SELECT_PRODUCTS' => 'Please select some products.',
Expand Down
2 changes: 1 addition & 1 deletion admin/includes/languages/lang.english.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@
'WARNING_COULD_NOT_LOCATE_LANG_FILE' => 'WARNING: Could not locate language file: ',
'WARNING_DATABASE_VERSION_OUT_OF_DATE' => 'Your database appears to need patching to a higher level. See Tools->' . '%%BOX_TOOLS_SERVER_INFO%%' . ' to review patch levels.',
'WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT' => 'Warning: The downloadable products directory does not exist: ' . DIR_FS_DOWNLOAD . '. Downloadable products will not work until this directory is valid.',
'WARNING_EMAIL_SYSTEM_DEVELOPER_EMAIL' => 'WARNING: ALL emails will be sent to %s (as defined in "DEVELOPER_OVERRIDE_EMAIL_ADDRESS").',
'WARNING_EMAIL_SYSTEM_DEVELOPER_EMAIL' => 'WARNING: ALL emails will be sent to %1$s (as defined in "DEVELOPER_OVERRIDE_EMAIL_ADDRESS") using EMAIL_TRANSPORT=%2$s.',
'WARNING_EMAIL_SYSTEM_DEVELOPER_OVERRIDE' => 'WARNING: The sending of emails has been disabled as developer switch "DEVELOPER_OVERRIDE_EMAIL_STATUS" is set to "false".',
'WARNING_EMAIL_SYSTEM_DISABLED' => 'WARNING: The email subsystem is disabled. No emails will be sent until it is re-enabled in Admin->Configuration->Email Options.',
'WARNING_FILE_UPLOADS_DISABLED' => 'Warning: File uploads are disabled in the php.ini configuration file.',
Expand Down

0 comments on commit 6471305

Please sign in to comment.