function bmDebug() { global $pommo; echo "\n\n<br><br><b>BASIC DEBUG</b><hr><br>\n\n"; echo "\n\nPHP: " . phpversion() . "<br><br>\n\n"; echo "\n\nMYSQL CLIENT: " . mysql_get_client_info() . "<br><br>\n\n"; echo "\n\nMYSQL HOST: " . mysql_get_host_info() . "<br><br>\n\n"; echo "\n\nMYSQL SERVER: " . mysql_get_server_info() . "<br><br>\n\n"; echo "\n\nBACKTRACE: " . $this->bmBacktrace() . "<br><br>\n\n"; echo "\nBaseURL:" . $pommo->_baseUrl . "<br>\n"; echo "\n HTTP:" . $pommo->_http . "<br>\n"; echo "\nBaseDir: " . $pommo->_baseDir . "<br>\n"; echo "\nWorkDir:" . $pommo->_workDir . "<br>\n"; echo "\nLang:" . $pommo->_lang . "<br>\n"; echo "\nVerbosity:" . $pommo->_verbosity . "<br>\n"; echo "\nRevision: " . $pommo->_revision . "<br>\n"; echo "\nSection: " . $pommo->_section . "<br>\n"; echo "\n\n<br><br><b>CONFIG DEBUG</b><hr><br>\n\n"; $config = PommoAPI::configGet('all'); if (!empty($config)) { echo "\n\n<br>CONFIG:<br>\n\n"; foreach ($config as $name => $value) { if ($name == 'admin_username' || $name == 'admin_password') { $value = '**CENSOR** - ' . strlen($value); } elseif ($name == 'messages') { continue; } echo "\n{$name}: {$value} <br>\n"; } } else { echo "\n\n<br>CONFIG: could not load\n\n"; } }
/** * Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <*****@*****.**> * * This file is part of poMMo (http://www.pommo.org) * * poMMo is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2, or any later version. * * poMMo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with program; see the file docs/LICENSE. If not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ function PommoUpgrade() { global $pommo; $dbo =& $pommo->_dbo; // fetch the current/old revision $revision = $pommo->_config['revision']; // halts upgrade on failed query $GLOBALS['pommoLooseUpgrade'] = FALSE; // if forced upgrade was requested, fake an earlier version, // disable die on failed queries if ($revision == $pommo->_revision) { $revision--; $GLOBALS['pommoLooseUpgrade'] = TRUE; $dbo->dieOnQuery(false); } while ($revision < $pommo->_revision) { if (!PommoRevUpgrade(intval($revision))) { return false; } $revision = PommoAPI::configGet('revision'); } $dbo->dieOnQuery(true); return true; }
SmartyValidate::register_validator('confirm_msg', 'confirm_msg:!\\[\\[URL\\]\\]!i', 'isRegExp', false, false, 'trim', 'messages'); SmartyValidate::register_validator('activate_sub', 'activate_sub', 'notEmpty', false, false, 'trim', 'messages'); SmartyValidate::register_validator('activate_msg', 'activate_msg:!\\[\\[URL\\]\\]!i', 'isRegExp', false, false, 'trim', 'messages'); SmartyValidate::register_validator('update_sub', 'update_sub', 'notEmpty', false, false, 'trim', '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 = PommoAPI::configGet(array('messages', 'notices')); $notices = unserialize($dbvalues['notices']); $messages = unserialize($dbvalues['messages']); if (empty($messages)) { $messages = PommoHelperMessages::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'];
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ /********************************** INITIALIZATION METHODS *********************************/ require '../../../bootstrap.php'; $pommo->init(); $logger =& $pommo->_logger; $dbo =& $pommo->_dbo; /********************************** SETUP TEMPLATE, PAGE *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php'); $smarty = new PommoTemplate(); $smarty->prepareForForm(); $exchanger = current(PommoAPI::configGet(array('list_exchanger'))); SmartyValidate::connect($smarty); if (!SmartyValidate::is_registered_form('exchanger') || empty($_POST)) { // ___ USER HAS NOT SENT FORM ___ SmartyValidate::register_form('exchanger', true); SmartyValidate::register_validator('email', 'email', 'isEmail', false, false, false, 'exchanger'); $vMsg = array(); $vMsg['email'] = Pommo::_T('Invalid email address'); $smarty->assign('vMsg', $vMsg); $dbvals = array('exchanger' => $exchanger, 'email' => $pommo->_config['admin_email']); $smarty->assign($dbvals); } else { // ___ USER HAS SENT FORM ___ /********************************** JSON OUTPUT INITIALIZATION *********************************/
$smarty->prepareForForm(); SmartyValidate::connect($smarty); if (!SmartyValidate::is_registered_form('users') || empty($_POST)) { // ___ USER HAS NOT SENT FORM ___ SmartyValidate::register_form('users', true); // register custom criteria SmartyValidate::register_validator('admin_username', 'admin_username', 'notEmpty', false, false, 'trim', 'users'); SmartyValidate::register_validator('admin_password2', 'admin_password:admin_password2', 'isEqual', TRUE, false, false, 'users'); SmartyValidate::register_validator('admin_email', 'admin_email', 'isEmail', false, false, false, 'users'); $vMsg = array(); $vMsg['admin_username'] = Pommo::_T('Cannot be empty.'); $vMsg['admin_email'] = Pommo::_T('Invalid email address'); $vMsg['admin_password2'] = Pommo::_T('Passwords must match.'); $smarty->assign('vMsg', $vMsg); // populate _POST with info from database (fills in form values...) $dbVals = PommoAPI::configGet(array('admin_username')); $dbVals['admin_email'] = $pommo->_config['admin_email']; $smarty->assign($dbVals); } else { // ___ USER HAS SENT FORM ___ /********************************** JSON OUTPUT INITIALIZATION *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php'); $json = new PommoJSON(); if (SmartyValidate::is_valid($_POST, 'users')) { // __ FORM IS VALID // convert password to MD5 if given... if (!empty($_POST['admin_password'])) { $_POST['admin_password'] = md5($_POST['admin_password']); }
$pommo->init(array('sessionID' => $serial, 'keep' => TRUE, 'authLevel' => 0)); $logger =& $pommo->_logger; $dbo =& $pommo->_dbo; // don't die on query so we can capture logs' // NOTE: Be extra careful to check the success of queries/methods! $dbo->dieOnQuery(FALSE); // turn logging off unless verbosity is 1 if ($pommo->_verbosity > 1) { $dbo->debug(FALSE); } // start error logging $pommo->logErrors(); /********************************** STARTUP ROUTINES *********************************/ $config = PommoAPI::configGet(array('list_exchanger', 'maxRuntime', 'smtp_1', 'smtp_2', 'smtp_3', 'smtp_4', 'throttle_SMTP', 'throttle_MPS', 'throttle_BPS', 'throttle_DP', 'throttle_DMPP', 'throttle_DBPP')); $p = array('queueSize' => 100, 'maxRunTime' => $config['maxRuntime'], 'serial' => $serial); // NOTE: PR15 removed multimode (simultaneous SMTP relays) variables + functionality! // we will be migrating to swiftmailer, and its multi-SMTP support/balancing in PR16-ish. /********************************** * MAILING INITIALIZATION *********************************/ // calculate spawn # (number of times this MTA has spawned under this serial) $pommo->_session['spawn'] = isset($pommo->_session['spawn']) ? $pommo->_session['spawn'] + 1 : 1; $p['spawn'] = $pommo->_session['spawn']; // initialize MTA $mailing = new PommoMTA($p); $logger->addMsg(sprintf(Pommo::_T('Started Mailing MTA. Spawn #%s.'), $p['spawn']), 3, TRUE); // poll mailing status $mailing->poll(); // check if message body or title contains personalizations
* * poMMo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with program; see the file docs/LICENSE. If not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ /********************************** INITIALIZATION METHODS *********************************/ require '../../bootstrap.php'; Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/mailings.php'); $config = PommoAPI::configGet('public_history'); if ($config['public_history'] == 'on') { $pommo->init(array('authLevel' => 0)); } else { Pommo::redirect('login.php'); } $logger =& $pommo->_logger; $dbo =& $pommo->_dbo; if (isset($_REQUEST['mailings'])) { if (is_array($_REQUEST['mailings'])) { $_REQUEST['mailings'] = $_REQUEST['mailings'][0]; } $mailing = current(PommoMailing::get(array('id' => $_REQUEST['mailings']))); } else { die; }
function prepareMail($subject = NULL, $body = NULL, $HTML = FALSE, $altbody = NULL) { $this->_subject = $subject; $this->_body = $body; $this->_altbody = $altbody; // ** Set PHPMailer class parameters if ($this->_validated == FALSE) { // Validate mail parameters if (!$this->validate()) { return false; } // TODO -> should I just set PHPMailer parameters in the 1st place & skip $this->_paramName ? // TODO -> pass these by reference ?? // set the character set $this->CharSet = $this->_charset; $this->FromName = $this->_fromname; $this->From = $this->_fromemail; $this->Subject = $this->_subject; // set Sender (bounce address) $this->Sender = $this->_frombounce; // if safe mode is on && using sendmail, force php mail() as excahnger [sendmail will not send w/ safe mode on] if (ini_get('safe_mode') && $this->_exchanger == 'sendmail') { $this->_exchanger = 'mail'; } // make sure exchanger is valid, DEFAULT to PHP Mail if ($this->_exchanger != "mail" && $this->_exchanger != "sendmail" && $this->_exchanger != "smtp") { $this->_exchanger = "mail"; } $this->Mailer = $this->_exchanger; if ($this->Mailer == 'smtp') { // loads the default relay (#1) -- use setRelay() to change. $config = PommoAPI::configGet('smtp_1'); $smtp = unserialize($config['smtp_1']); if (!empty($smtp['host'])) { $this->Host = $smtp['host']; } if (!empty($smtp['port'])) { $this->Port = $smtp['port']; } if (!empty($smtp['auth']) && $smtp['auth'] == 'on') { $this->SMTPAuth = TRUE; if (!empty($smtp['user'])) { $this->Username = $smtp['user']; } if (!empty($smtp['pass'])) { $this->Password = $smtp['pass']; } } } // if altbody exists, set message type to HTML + add alt body if ($HTML) { $this->IsHTML(TRUE); if (!empty($this->_altbody)) { $this->AltBody = $this->_altbody; } } $this->Body = $this->_body; // passed all sanity checks... $this->_validated = TRUE; } return TRUE; }
function perform(&$in) { global $pommo; $dbo =& $pommo->_dbo; $logger =& $pommo->_logger; if (!is_numeric($in['id']) || !is_numeric($in['subscriber_id'])) { $logger->addErr('PommoPending::perform() -> invalid pending object sent.'); return false; } switch ($in['type']) { case 'add': // subscribe $query = "\n\t\t\t\t\tUPDATE " . $dbo->table['subscribers'] . "\n\t\t\t\t\tSET status=1\n\t\t\t\t\tWHERE subscriber_id=%i"; $query = $dbo->prepare($query, array($in['subscriber_id'])); if (!$dbo->query($query)) { $logger->addErr('PommoPending::perform() -> Error updating subscriber.'); return false; } break; case 'change': // update $pommo->requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php'); $subscriber =& $in['array']; if (!PommoSubscriber::update($subscriber, 'REPLACE_ACTIVE')) { $logger->addErr('PommoPending::perform() -> Error updating subscriber.'); return false; } break; case 'password': // change (admin) password $pommo->requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php'); $password = PommoHelper::makePassword(); $config = PommoAPI::configGet(array('admin_username', 'admin_email')); if (!PommoAPI::configUpdate(array('admin_password' => md5($password)), TRUE)) { $logger->addMsg('Error updating password.'); return false; } $logger->addErr(sprintf(Pommo::_T('You may now %1$s login %2$s with username: %3$s and password: %4$s '), '<a href="' . $pommo->_baseUrl . 'index.php">', '</a>', '<span style="font-size: 130%">' . $config['admin_username'] . '</span>', '<span style="font-size: 130%">' . $password . '</span>')); break; } $query = "\n\t\t\tDELETE FROM " . $dbo->table['subscriber_pending'] . "\n\t\t\tWHERE pending_id=%i"; $query = $dbo->prepare($query, array($in['id'])); if (!$dbo->query($query)) { $logger->addErr('PommoPending::perform() -> Error removing pending entry.'); return false; } return true; }
SmartyValidate::register_criteria('isCharSet', 'check_charset', 'mailings'); SmartyValidate::register_validator('list_fromname', 'list_fromname', 'notEmpty', false, false, 'trim', 'mailings'); SmartyValidate::register_validator('list_fromemail', 'list_fromemail', 'isEmail', false, false, false, 'mailings'); SmartyValidate::register_validator('list_frombounce', 'list_frombounce', 'isEmail', false, false, false, 'mailings'); SmartyValidate::register_validator('list_charset', 'list_charset', 'isCharSet', false, false, 'trim', 'mailings'); SmartyValidate::register_validator('public_history', 'public_history:!^(on|off)$!', 'isRegExp', false, false, false, 'mailings'); SmartyValidate::register_validator('demo_mode', 'demo_mode:!^(on|off)$!', 'isRegExp', false, false, false, 'mailings'); SmartyValidate::register_validator('list_fromname', 'list_fromname', 'notEmpty', false, false, 'trim', 'mailings'); SmartyValidate::register_validator('maxRuntime', 'maxRuntime', 'isInt', false, false, 'trim', 'mailings'); $vMsg = array(); $vMsg['maxRuntime'] = Pommo::_T('Enter a number.'); $vMsg['list_fromname'] = Pommo::_T('Cannot be empty.'); $vMsg['list_fromemail'] = $vMsg['list_frombounce'] = Pommo::_T('Invalid email address'); $smarty->assign('vMsg', $vMsg); // populate _POST with info from database (fills in form values...) $dbVals = PommoAPI::configGet(array('list_fromname', 'list_fromemail', 'list_frombounce', 'list_charset', 'public_history', 'maxRuntime')); $dbVals['demo_mode'] = !empty($pommo->_config['demo_mode']) && $pommo->_config['demo_mode'] == "on" ? 'on' : 'off'; $smarty->assign($dbVals); } else { // ___ USER HAS SENT FORM ___ /********************************** JSON OUTPUT INITIALIZATION *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php'); $json = new PommoJSON(); if (SmartyValidate::is_valid($_POST, 'mailings')) { // __ FORM IS VALID PommoAPI::configUpdate($_POST); $pommo->reloadConfig(); $json->success(Pommo::_T('Configuration Updated.')); } else {
/********************************** SETUP TEMPLATE, PAGE *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php'); $smarty = new PommoTemplate(); // log the user out if requested if (isset($_GET['logout'])) { $pommo->_auth->logout(); header('Location: ' . $pommo->_http . $pommo->_baseUrl . 'index.php'); } // check if user is already logged in if ($pommo->_auth->isAuthenticated()) { // If user is authenticated (has logged in), redirect to admin.php Pommo::redirect($pommo->_http . $pommo->_baseUrl . 'admin/admin.php'); } elseif (isset($_POST['submit']) && !empty($_POST['username']) && !empty($_POST['password'])) { $auth = PommoAPI::configGet(array('admin_username', 'admin_password')); if ($_POST['username'] == $auth['admin_username'] && md5($_POST['password']) == $auth['admin_password']) { // don't perform maintenance if accessing support area if (!isset($_GET['referer']) || !basename($_GET['referer']) == 'support.php') { // LOGIN SUCCESS -- PERFORM MAINTENANCE, SET AUTH, REDIRECT TO REFERER Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/maintenance.php'); PommoHelperMaintenance::perform(); } $pommo->_auth->login($_POST['username']); Pommo::redirect($pommo->_http . $_POST['referer']); } else { $logger->addMsg(Pommo::_T('Failed login attempt. Try again.')); } } elseif (!empty($_POST['resetPassword'])) { // TODO -- visit this function later // Check if a reset password request has been received
// ** check if email already exists in DB ("duplicates are bad..") if (PommoHelper::isDupe($subscriber['email'])) { $logger->addErr(Pommo::_T('Email address already exists. Duplicates are not allowed.')); $smarty->assign('dupe', TRUE); } // check if errors exist with data, if so print results and die. if ($logger->isErr() || !PommoValidate::subscriberData($subscriber['data'], array('active' => FALSE))) { $smarty->assign('back', TRUE); $smarty->display('user/process.tpl'); Pommo::kill(); } $comments = isset($_POST['comments']) ? substr($_POST['comments'], 0, 255) : false; /********************************** ADD SUBSCRIBER *********************************/ $config = PommoAPI::configGet(array('site_success', 'site_confirm', 'list_confirm', 'notices')); $notices = unserialize($config['notices']); Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php'); if ($config['list_confirm'] == 'on') { // email confirmation required. // add user as "pending" $subscriber['pending_code'] = PommoHelper::makeCode(); $subscriber['pending_type'] = 'add'; $subscriber['status'] = 2; $id = PommoSubscriber::add($subscriber); if (!$id) { $logger->addErr('Error adding subscriber! Please contact the administrator.'); $smarty->assign('back', TRUE); } else { $logger->addMsg(Pommo::_T('Subscription request received.')); // send confirmation message.
// ___ USER HAS NOT SENT FORM ___ SmartyValidate::register_form('general', true); SmartyValidate::register_validator('list_name', 'list_name', 'notEmpty', false, false, 'trim', 'general'); SmartyValidate::register_validator('site_name', 'site_name', 'notEmpty', false, false, 'trim', 'general'); SmartyValidate::register_validator('site_url', 'site_url', 'isURL', false, false, 'trim', 'general'); SmartyValidate::register_validator('site_success', 'site_success', 'isURL', TRUE, false, false, 'general'); SmartyValidate::register_validator('site_confirm', 'site_confirm', 'isURL', TRUE, false, false, 'general'); SmartyValidate::register_validator('list_confirm', 'list_confirm:!^(on|off)$!', 'isRegExp', false, false, false, 'general'); SmartyValidate::register_validator('list_exchanger', 'list_exchanger:!^(sendmail|mail|smtp)$!', 'isRegExp', false, false, false, 'general'); // no validation for exchanger $vMsg = array(); $vMsg['site_url'] = $vMsg['site_success'] = $vMsg['site_confirm'] = Pommo::_T('Must be a valid URL'); $vMsg['list_name'] = $vMsg['site_name'] = Pommo::_T('Cannot be empty.'); $smarty->assign('vMsg', $vMsg); // populate _POST with info from database (fills in form values...) $dbVals = PommoAPI::configGet(array('site_success', 'site_confirm', 'list_exchanger', 'list_confirm')); $dbVals['site_url'] = $pommo->_config['site_url']; $dbVals['site_name'] = $pommo->_config['site_name']; $dbVals['list_name'] = $pommo->_config['list_name']; $smarty->assign($dbVals); } else { // ___ USER HAS SENT FORM ___ /********************************** JSON OUTPUT INITIALIZATION *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php'); $json = new PommoJSON(); if (SmartyValidate::is_valid($_POST, 'general')) { // __ FORM IS VALID PommoAPI::configUpdate($_POST); $pommo->reloadConfig();
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php'); $smarty = new PommoTemplate(); if (empty($_GET['code'])) { $logger->addMsg(Pommo::_T('No code given.')); $smarty->display('user/confirm.tpl'); Pommo::kill(); } // lookup code $pending = PommoPending::get($_GET['code']); if (!$pending) { $logger->addMsg(Pommo::_T('Invalid code! Make sure you copied it correctly from the email.')); $smarty->display('user/confirm.tpl'); Pommo::kill(); } // Load success messages and redirection URL from config $config = PommoAPI::configGet(array('site_success', 'messages', 'notices')); $messages = unserialize($config['messages']); $notices = unserialize($config['notices']); if (PommoPending::perform($pending)) { Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php'); // get subscriber info Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php'); $subscriber = current(PommoSubscriber::get(array('id' => $pending['subscriber_id']))); switch ($pending['type']) { case "add": // send/print welcome message PommoHelperMessages::sendMessage(array('to' => $subscriber['email'], 'type' => 'subscribe')); if (isset($notices['subscribe']) && $notices['subscribe'] == 'on') { PommoHelperMessages::notify($notices, $subscriber, 'subscribe'); } if (!empty($config['site_success'])) {
SETUP TEMPLATE, PAGE *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php'); $smarty = new PommoTemplate(); // Read user requested changes if (!empty($_POST['throttle_restore'])) { $input = array('throttle_MPS' => 3, 'throttle_BPS' => 0, 'throttle_DP' => 10, 'throttle_DBPP' => 0, 'throttle_DMPP' => 0); PommoAPI::configUpdate($input, TRUE); $smarty->assign('output', Pommo::_T('Configuration Updated.')); } elseif (!empty($_POST['throttle-submit'])) { $input = array(); $input['throttle_MPS'] = is_numeric($_POST['mps']) && $_POST['mps'] >= 0 && $_POST['mps'] <= 5 ? $_POST['mps'] : 3; $input['throttle_BPS'] = is_numeric($_POST['bps']) && $_POST['bps'] >= 0 && $_POST['bps'] <= 400 ? $_POST['bps'] * 1024 : 0; $input['throttle_DP'] = is_numeric($_POST['dp']) && $_POST['dp'] >= 5 && $_POST['dp'] <= 20 ? $_POST['dp'] : 10; $input['throttle_DMPP'] = is_numeric($_POST['dmpp']) && $_POST['dmpp'] >= 0 && $_POST['dmpp'] <= 5 ? $_POST['dmpp'] : 0; $input['throttle_DBPP'] = is_numeric($_POST['dbpp']) && $_POST['dbpp'] >= 0 && $_POST['dbpp'] <= 200 ? $_POST['dbpp'] * 1024 : 0; if (!empty($input)) { PommoAPI::configUpdate($input, TRUE); $smarty->assign('output', Pommo::_T('Configuration Updated.')); } else { $smarty->assign('output', Pommo::_T('Please review and correct errors with your submission.')); } } $config = PommoAPI::configGet(array('throttle_MPS', 'throttle_BPS', 'throttle_DP', 'throttle_DBPP', 'throttle_DMPP')); $smarty->assign('mps', $config['throttle_MPS'] * 60); $smarty->assign('bps', $config['throttle_BPS'] / 1024); $smarty->assign('dp', $config['throttle_DP']); $smarty->assign('dmpp', $config['throttle_DMPP']); $smarty->assign('dbpp', $config['throttle_DBPP'] / 1024); $smarty->display('admin/setup/config/ajax.throttle.tpl'); Pommo::kill();
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php'); Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/mailings.php'); $pommo->init(); $logger =& $pommo->_logger; $dbo =& $pommo->_dbo; /********************************** SETUP TEMPLATE, PAGE *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php'); $smarty = new PommoTemplate(); $smarty->prepareForForm(); if (PommoMailing::isCurrent()) { Pommo::kill(sprintf(Pommo::_T('A Mailing is currently processing. Visit the %sStatus%s page to check its progress.'), '<a href="mailing_status.php">', '</a>')); } // TODO -- fix stateInit so we don't NEED to supply the defaults that have already been defined $dbvalues = PommoAPI::configGet(array('list_fromname', 'list_fromemail', 'list_frombounce', 'list_charset', 'list_wysiwyg')); // Initialize page state with default values overriden by those held in $_REQUEST $state =& PommoAPI::stateInit('mailing', array('fromname' => $dbvalues['list_fromname'], 'fromemail' => $dbvalues['list_fromemail'], 'frombounce' => $dbvalues['list_frombounce'], 'list_charset' => $dbvalues['list_charset'], 'wysiwyg' => $dbvalues['list_wysiwyg'], 'mailgroup' => 'all', 'subject' => '', 'body' => '', 'altbody' => ''), $_POST); $state['charset'] = $state['list_charset']; // validate composition $tempbody = trim($state['body']); $tempalt = trim($state['altbody']); if (empty($tempbody) && empty($tempalt) || empty($state['subject'])) { $logger->addErr(Pommo::_T('Subject or Message cannot be empty!')); $smarty->assign($state); $smarty->display('admin/mailings/mailing/preview.tpl'); Pommo::kill(); } // get the group $group = new PommoGroup($state['mailgroup'], 1); $state['tally'] = $group->_tally;
PommoAPI::configUpdate($input, TRUE); $update = true; } elseif (!empty($_POST['deleteSmtpServer'])) { $input['smtp_' . key($_POST['deleteSmtpServer'])] = ''; PommoAPI::configUpdate($input, TRUE); $update = true; } elseif (!empty($_POST['throttle_SMTP'])) { $input['throttle_SMTP'] = $_POST['throttle_SMTP']; PommoAPI::configUpdate($input); $update = true; } if (isset($update)) { $smarty->assign('output', $update ? Pommo::_T('Configuration Updated.') : Pommo::_T('Please review and correct errors with your submission.')); } // Get the SMTP settings from DB $smtpConfig = PommoAPI::configGet(array('smtp_1', 'smtp_2', 'smtp_3', 'smtp_4', 'throttle_SMTP')); $smtp[1] = unserialize($smtpConfig['smtp_1']); $smtp[2] = unserialize($smtpConfig['smtp_2']); $smtp[3] = unserialize($smtpConfig['smtp_3']); $smtp[4] = unserialize($smtpConfig['smtp_4']); if (empty($smtp[1])) { $smtp[1] = array('host' => 'mail.localhost', 'port' => '25', 'auth' => 'off', 'user' => '', 'pass' => ''); } // Test the servers $addServer = FALSE; $smtpStatus = array(); for ($i = 1; $i < 5; $i++) { if (empty($smtp[$i])) { if (!$addServer) { $addServer = $i; }
function resetDefault($section = 'all') { global $pommo; $dbo =& $pommo->_dbo; $messages = array(); if ($section != 'all') { $config = PommoAPI::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 . 'user/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)); PommoAPI::configUpdate($input, TRUE); return $messages; }