static function resetDefault($section = 'all')
{
global $pommo;
$dbo =& Pommo::$_dbo;
$messages = array();
if ($section != 'all') {
$config = Pommo_Api::configGet(array('messages'));
$messages = unserialize($config['messages']);
}
if ($section == 'all' || $section == 'subscribe') {
$messages['subscribe'] = array();
$messages['subscribe']['msg'] = sprintf(Pommo::_T('Welcome to our mailing list. You can always login to update your records or unsubscribe by visiting: %s'), "\n " . Pommo::$_http . Pommo::$_baseUrl . 'login.php');
$messages['subscribe']['sub'] = sprintf(Pommo::_T('Welcome to %s'), Pommo::$_config['list_name']);
$messages['subscribe']['web'] = Pommo::_T('Welcome to our mailing list. Enjoy your stay.');
$messages['subscribe']['email'] = false;
}
if ($section == 'all' || $section == 'unsubscribe') {
$messages['unsubscribe'] = array();
$messages['unsubscribe']['sub'] = sprintf(Pommo::_T('Farewell from %s'), Pommo::$_config['list_name']);
$messages['unsubscribe']['msg'] = Pommo::_T('You have been unsubscribed and will not receive any more mailings from us. Feel free to come back anytime!');
$messages['unsubscribe']['web'] = Pommo::_T('You have successfully unsubscribed. Enjoy your travels.');
$messages['unsubscribe']['email'] = false;
}
if ($section == 'all' || $section == 'confirm') {
$messages['confirm'] = array();
$messages['confirm']['msg'] = sprintf(Pommo::_T('You have requested to subscribe to %s. We would like to validate your email address before adding you as a subscriber. Please click the link below to be added ->'), Pommo::$_config['list_name']) . "\r\n\t[[url]]\r\n\r\n" . Pommo::_T('If you have received this message in error, please ignore it.');
$messages['confirm']['sub'] = Pommo::_T('Subscription request');
}
if ($section == 'all' || $section == 'activate') {
$messages['activate'] = array();
$messages['activate']['msg'] = sprintf(Pommo::_T('Someone has requested to access to your records for %s.'), Pommo::$_config['list_name']) . ' ' . Pommo::_T('You may edit your information or unsubscribe by visiting the link below ->') . "\r\n\t[[url]]\r\n\r\n" . Pommo::_T('If you have received this message in error, please ignore it.');
$messages['activate']['sub'] = sprintf(Pommo::_T('%s: Account Access.'), Pommo::$_config['list_name']);
}
if ($section == 'all' || $section == 'password') {
$messages['password'] = array();
$messages['password']['msg'] = sprintf(Pommo::_T('You have requested to change your password for %s.'), Pommo::$_config['list_name']) . ' ' . Pommo::_T('Please validate this request by clicking the link below ->') . "\r\n\t[[url]]\r\n\r\n" . Pommo::_T('If you have received this message in error, please ignore it.');
$messages['password']['sub'] = Pommo::_T('Change Password request');
}
if ($section == 'all' || $section == 'update') {
$messages['update'] = array();
$messages['update']['msg'] = sprintf(Pommo::_T('You have requested to update your records for %s.'), Pommo::$_config['list_name']) . ' ' . Pommo::_T('Please validate this request by clicking the link below ->') . "\n\n\t[[url]]\n\n" . Pommo::_T('If you have received this message in error, please ignore it.');
$messages['update']['sub'] = Pommo::_T('Update Records request');
}
$input = array('messages' => serialize($messages));
Pommo_Api::configUpdate($input, TRUE);
return $messages;
}
SmartyValidate::register_validator('update_msg', 'update_msg:!\\[\\[URL\\]\\]!i', 'isRegExp', false, false, 'trim', 'messages'); SmartyValidate::register_validator('notify_email', 'notify_email', 'isMails', false, false, false, 'messages'); SmartyValidate::register_validator('notify_subscribe', 'notify_subscribe:!^(on|off)$!', 'isRegExp', false, false, false, 'messages'); SmartyValidate::register_validator('notify_unsubscribe', 'notify_unsubscribe:!^(on|off)$!', 'isRegExp', false, false, false, 'messages'); SmartyValidate::register_validator('notify_update', 'notify_update:!^(on|off)$!', 'isRegExp', false, false, false, 'messages'); SmartyValidate::register_validator('notify_pending', 'notify_pending:!^(on|off)$!', 'isRegExp', false, false, false, 'messages'); $vMsg = array(); $vMsg['subscribe_sub'] = $vMsg['subscribe_msg'] = $vMsg['subscribe_web'] = $vMsg['unsubscribe_sub'] = $vMsg['unsubscribe_msg'] = $vMsg['unsubscribe_web'] = $vMsg['confirm_sub'] = $vMsg['update_sub'] = $vMsg['activate_sub'] = Pommo::_T('Cannot be empty.'); $vMsg['confirm_msg'] = $vMsg['update_msg'] = $vMsg['activate_msg'] = Pommo::_T('You must include "[[URL]]" for the confirm link'); $smarty->assign('vMsg', $vMsg); // populate _POST with info from database (fills in form values...) $dbvalues = Pommo_Api::configGet(array('messages', 'notices')); $notices = unserialize($dbvalues['notices']); $messages = unserialize($dbvalues['messages']); if (empty($messages)) { $messages = Pommo_Helper_Messages::resetDefault('all'); } if (empty($notices)) { $notices = array('email' => Pommo::$_config['admin_email'], 'subject' => Pommo::_T('[poMMo Notice]'), 'subscribe' => 'off', 'unsubscribe' => 'off', 'update' => 'off', 'pending' => 'off'); } $p = array(); $p['notify_email'] = $notices['email']; $p['notify_subject'] = $notices['subject']; $p['notify_subscribe'] = $notices['subscribe']; $p['notify_unsubscribe'] = $notices['unsubscribe']; $p['notify_update'] = $notices['update']; $p['notify_pending'] = $notices['pending']; $p['subscribe_sub'] = $messages['subscribe']['sub']; $p['subscribe_msg'] = $messages['subscribe']['msg']; $p['subscribe_web'] = $messages['subscribe']['web']; $p['subscribe_email'] = $messages['subscribe']['email'];