Révision 950416da
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/rules/modules/system.eval.inc | ||
---|---|---|
5 | 5 |
* Contains rules integration for the system module needed during evaluation. |
6 | 6 |
* |
7 | 7 |
* @addtogroup rules |
8 |
* |
|
8 | 9 |
* @{ |
9 | 10 |
*/ |
10 | 11 |
|
... | ... | |
42 | 43 |
if ($force && isset($_GET['destination'])) { |
43 | 44 |
unset($_GET['destination']); |
44 | 45 |
} |
45 |
// We don't invoke drupal_goto() right now, as this would end the the current
|
|
46 |
// page execution unpredictly for modules. So we'll take over drupal_goto() |
|
46 |
// We don't invoke drupal_goto() right now, as this would end the current |
|
47 |
// page execution unpredictably for modules. So we'll take over drupal_goto()
|
|
47 | 48 |
// calls from somewhere else via hook_drupal_goto_alter() and make sure |
48 | 49 |
// a drupal_goto() is invoked before the page is output with |
49 | 50 |
// rules_page_build(). |
... | ... | |
106 | 107 |
$result = db_query('SELECT mail FROM {users} WHERE uid > 0'); |
107 | 108 |
} |
108 | 109 |
else { |
109 |
$rids = implode(',', $roles); |
|
110 | 110 |
// Avoid sending emails to members of two or more target role groups. |
111 |
$result = db_query('SELECT DISTINCT u.mail FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid WHERE r.rid IN ('. $rids .')');
|
|
111 |
$result = db_query('SELECT DISTINCT u.mail FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid WHERE r.rid IN (:rids)', array(':rids' => $roles));
|
|
112 | 112 |
} |
113 | 113 |
|
114 | 114 |
// Now, actually send the mails. |
... | ... | |
125 | 125 |
$message = drupal_mail('rules', $key, $row->mail, language_default(), $params, $from); |
126 | 126 |
// If $message['result'] is FALSE, then it's likely that email sending is |
127 | 127 |
// failing at the moment, and we should just abort sending any more. If |
128 |
// however, $mesage['result'] is NULL, then it's likely that a module has |
|
128 |
// however, $message['result'] is NULL, then it's likely that a module has
|
|
129 | 129 |
// aborted sending this particular email to this particular user, and we |
130 | 130 |
// should just keep on sending emails to the other users. |
131 | 131 |
// For more information on the result value, see drupal_mail(). |
... | ... | |
142 | 142 |
/** |
143 | 143 |
* Implements hook_mail(). |
144 | 144 |
* |
145 |
* Set's the message subject and body as configured.
|
|
145 |
* Sets the message subject and body as configured. |
|
146 | 146 |
*/ |
147 | 147 |
function rules_mail($key, &$message, $params) { |
148 | 148 |
|
... | ... | |
166 | 166 |
*/ |
167 | 167 |
class RulesTokenEvaluator extends RulesDataInputEvaluator { |
168 | 168 |
|
169 |
/** |
|
170 |
* Overrides RulesDataInputEvaluator::prepare(). |
|
171 |
*/ |
|
169 | 172 |
public function prepare($text, $var_info) { |
170 | 173 |
$text = is_array($text) ? implode('', $text) : $text; |
171 | 174 |
// Skip this evaluator if there are no tokens. |
... | ... | |
173 | 176 |
} |
174 | 177 |
|
175 | 178 |
/** |
179 |
* Evaluate tokens. |
|
180 |
* |
|
176 | 181 |
* We replace the tokens on our own as we cannot use token_replace(), because |
177 | 182 |
* token usually assumes that $data['node'] is a of type node, which doesn't |
178 | 183 |
* hold in general in our case. |
... | ... | |
262 | 267 |
} |
263 | 268 |
return $render; |
264 | 269 |
} |
270 |
|
|
265 | 271 |
} |
266 | 272 |
|
267 | 273 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules