function ad_notify_notifications_submit in Advertisement 5
File
- notify/
ad_notify.module, line 571 - Receive email notifications regarding ads.
Code
function ad_notify_notifications_submit($form_id, $form_values) {
if ($form_values['notid']) {
db_query("UPDATE {ad_notify} SET aid = %d, oid = %d, event = '%s', delay = %d, expire = %d, locked = %d, status = %d, address = '%s', subject = '%s', body = '%s' WHERE notid = %d", $form_values['aid'], $form_values['oid'], $form_values['event'], $form_values['delay'], $form_values['expire'], $form_values['locked'], AD_NOTIFY_ENABLED, $form_values['address'], $form_values['subject'], $form_values['body'], $form_values['notid']);
drupal_set_message('Notification updated.');
}
else {
// Retrieve the default mail subject and body.
$mail = module_invoke_all('adnotifyapi', 'mail_text', $form_values['event']);
if ($mail == array()) {
// Default message text.
$mail = array(
'subject' => t('[%sitename ad] %event notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification about your advertisement \"%title\" that is being displayed on the %sitename website.\n\n Your advertisement has been viewed %today_views times and clicked %today_clicks times today. It was viewed %yesterday_views times and clicked %yesterday_clicks times yesterday. It has been viewed %global_views times and clicked %global_clicks times since it was activated on %activated_large.\n\n You will receive this %frequency You can view additional statistics about this advertisement or update this notification at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
}
db_query("INSERT INTO {ad_notify} (aid, oid, event, delay, expire, locked, status, address, subject, body) VALUES(%d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s')", $form_values['aid'], $form_values['oid'], $form_values['event'], $form_values['delay'], $form_values['expire'], $form_values['locked'], AD_NOTIFY_ENABLED, $form_values['address'], $mail['subject'], $mail['body']);
drupal_set_message('Notification created.');
}
}