PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Helpers/AutomationHelper.php +11 -2 10.10.2 → 11.1.0 View file →
@@ -51,10 +51,15 @@
51 51 return min($result, $this->limit);
52 52 }
53 53 }
54 54
55 + /**
56 + * The main point is to simplify the queries executed on automation actions.
57 + * It also avoids issues when an action modifies the matching users and they don't match anymore (so following actions won't be executed)
58 + */
55 59 public function addFlag(int $id, bool $reset = false): void
56 60 {
61 + // In MySQL, the ORDER BY and LIMIT are not supported with "IN" or in UPDATE queries... If you know how to optimize it, feel free to do so
57 62 if (!empty($this->orderBy) || !empty($this->limit)) {
58 63 $flagQuery = 'UPDATE #__acym_user';
59 64 $flagQuery .= ' SET automation = CONCAT(automation, "a'.intval($id).'a")';
60 65 $flagQuery .= ' WHERE id IN (
@@ -91,8 +96,9 @@
91 96 }
92 97
93 98 public function convertQuery(string $table, string $column, string $operator, $value, string $type = ''): string
94 99 {
100 + //Fix operator issue...
95 101 $operator = str_replace(['&lt;', '&gt;'], ['<', '>'], $operator);
96 102
97 103 if ($operator === 'CONTAINS' || ($type === self::TYPE_PHONE && $operator === '=')) {
98 104 $operator = 'LIKE';
@@ -114,18 +120,21 @@
114 120 if ($value === '') {
115 121 return '0 = 1';
116 122 }
117 123 } elseif (!in_array($operator, ['IS NULL', 'IS NOT NULL', 'NOT LIKE', 'LIKE', '=', '!=', '>', '<', '>=', '<='])) {
118 - die(acym_translationSprintf('ACYM_UNKNOWN_OPERATOR', $operator));
124 + die(esc_html(acym_translationSprintf('ACYM_UNKNOWN_OPERATOR', $operator)));
119 125 }
120 126
127 + //Is the value a time field?
128 + //If so, we replace it properly and we convert it into the right time field
121 129 if (strpos($value, '[time]') !== false) {
122 130 $value = acym_replaceDate($value);
123 - $value = date('Y-m-d H:i:s', $value);
131 + $value = gmdate('Y-m-d H:i:s', $value);
124 132 }
125 133
126 134 $value = acym_replaceDateTags($value);
127 135
136 + //If it's a number, it does not bother us to db quote if we use = or !=, but if we use < or >=, it could make '20' > '100' as it begins by '2' and 100 begins by '1'...
128 137 if (!is_numeric($value) || in_array($operator, ['REGEXP', 'NOT REGEXP', 'NOT LIKE', 'LIKE', '=', '!='])) {
129 138 $value = acym_escapeDB($value);
130 139 }
131 140