New Bug: Version 1.2 will cause a fatal PHP error if build_user_subscription() is called more then due to redefined functions.
A few suggestions
PHP Code:
foreach($_POST as $key => $value){
$ds[$key] = $value;
}
$vbulletin->input->clean_array($ds, array(
'send_pm_global' => TYPE_NOHTML,
'send_em_global' => TYPE_NOHTML,
'pm_from_global' => TYPE_NOHTML,
'send_pm_paidsub' => TYPE_NOHTML,
'pm_title_paidsub' => TYPE_NOHTML,
'pm_message_paidsub' => TYPE_NOHTML,
'send_em_paidsub' => TYPE_NOHTML,
'em_subject_paidsub' => TYPE_NOHTML,
'em_body_paidsub' => TYPE_NOHTML
));
Why not just
PHP Code:
$vbulletin->input->clean_array_gpc('p', array(
'send_pm_global' => TYPE_NOHTML,
'send_em_global' => TYPE_NOHTML,
'pm_from_global' => TYPE_NOHTML,
'send_pm_paidsub' => TYPE_NOHTML,
'pm_title_paidsub' => TYPE_NOHTML,
'pm_message_paidsub' => TYPE_NOHTML,
'send_em_paidsub' => TYPE_NOHTML,
'em_subject_paidsub' => TYPE_NOHTML,
'em_body_paidsub' => TYPE_NOHTML
));
PHP Code:
$db->query_write("UPDATE " . TABLE_PREFIX . "datastore SET data='" . $db->escape_string(slw_serial($ds)) . "' WHERE title='pmnotify'");
You should never UPDATE table datastore directly, as the user might use a datastore cache - and thus your updated data will not be in the cache (until it gets cleared).
Use build_datastore() instead.
PHP Code:
$current_dt = strtotime("now");
The current timestamp is available as constant TIMENOW - seems unnecessary overhead to create it again.