configGet() static public method

Pass a single or array of config_names, returns array name->value.
static public configGet ( $arg )
 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 = Pommo_Api::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";
     }
 }
 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;
 }
Beispiel #3
0
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
if (empty($_GET['code'])) {
    $logger->addMsg(Pommo::_T('No code given.'));
    $view->display('user/confirm');
    Pommo::kill();
}
// lookup code
$pending = Pommo_Pending::get($_GET['code']);
if (!$pending) {
    $logger->addMsg(Pommo::_T('Invalid code! Make sure you copied it correctly from the email.'));
    $view->display('user/confirm');
    Pommo::kill();
}
// Load success messages and redirection URL from config
$config = Pommo_Api::configGet(array('site_success', 'messages', 'notices'));
$messages = unserialize($config['messages']);
$notices = unserialize($config['notices']);
if (Pommo_Pending::perform($pending)) {
    require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
    // get subscriber info
    require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
    $subscriber = current(Pommo_Subscribers::get(array('id' => $pending['subscriber_id'])));
    switch ($pending['type']) {
        case "add":
            // send/print welcome message
            Pommo_Helper_Messages::sendMessage(array('to' => $subscriber['email'], 'type' => 'subscribe'));
            if (isset($notices['subscribe']) && $notices['subscribe'] == 'on') {
                Pommo_Helper_Messages::notify($notices, $subscriber, 'subscribe');
            }
            if (!empty($config['site_success'])) {
Beispiel #4
0
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
Pommo::init();
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$smarty->prepareForForm();
if (Pommo_Mailing::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>'));
}
$dbvalues = Pommo_Api::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 = Pommo_Api::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);
// SmartyValidate Custom Validation Function
function check_charset($value, $empty, &$params, &$formvars)
{
    $validCharsets = array('UTF-8', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-7', 'ISO-8859-15', 'cp1251', 'KOI8-R', 'GB2312', 'EUC-JP', 'ISO-2022-JP');
    return in_array($value, $validCharsets);
}
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    // register custom criteria
    SmartyValidate::register_criteria('isCharSet', 'check_charset');
    SmartyValidate::register_validator('fromname', 'fromname', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('subject', 'subject', 'notEmpty', false, false, 'trim');
Beispiel #5
0
// ** check if email already exists in DB ("duplicates are bad..")
if (Pommo_Helper::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() || !Pommo_Validate::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 = Pommo_Api::configGet(array('site_success', 'site_confirm', 'list_confirm', 'notices'));
$notices = unserialize($config['notices']);
require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
if ($config['list_confirm'] == 'on') {
    // email confirmation required.
    // add user as "pending"
    $subscriber['pending_code'] = Pommo_Helper::makeCode();
    $subscriber['pending_type'] = 'add';
    $subscriber['status'] = 2;
    $id = Pommo_Subscribers::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.
Beispiel #6
0
 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 = 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'];
Beispiel #7
0
 function prepareMail($subject = NULL, $body = NULL, $HTML = FALSE, $altbody = NULL, $attachments = NULL)
 {
     $this->_subject = $subject;
     $this->_body = $body;
     $this->_altbody = $altbody;
     $this->_attachments = $attachments;
     // ** 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 = Pommo_Api::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;
                 $this->SMTPSecure = $smtp['security'];
                 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;
 }
Beispiel #8
0
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 = Pommo_Api::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'));
// 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;
// initialize MTA
$pommoMtaConfig = array('queueSize' => 100, 'maxRunTime' => $config['maxRuntime'], 'serial' => $serial, 'spawn' => Pommo::$_session['spawn']);
$mailing = new Pommo_Mta($pommoMtaConfig);
$logger->addMsg(sprintf(Pommo::_T('Started Mailing MTA. Spawn #%s.'), $pommoMtaConfig['spawn']), 3, TRUE);
// poll mailing status
$mailing->poll();
// check if message body contains personalizations
// personalizations are cached in session
Beispiel #9
0
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// ADD CUSTOM VALIDATOR FOR CHARSET
function check_charset($value, $empty, &$params, &$formvars)
{
    $validCharsets = array('UTF-8', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-7', 'ISO-8859-15', 'cp1251', 'KOI8-R', 'GB2312', 'EUC-JP', 'ISO-2022-JP');
    return in_array($value, $validCharsets);
}
if (empty($_POST)) {
    $vMsg = array();
    $vMsg['maxRuntime'] = _('Enter a number.');
    $vMsg['list_fromname'] = _('Cannot be empty.');
    $vMsg['list_fromemail'] = $vMsg['list_frombounce'] = _('Invalid email address');
    $view->assign('vMsg', $vMsg);
    // populate _POST with info from database (fills in form values...)
    $dbVals = Pommo_Api::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';
    $view->assign($dbVals);
} else {
    // ___ USER HAS SENT FORM ___
    require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
    $validator = new Pommo_Validate();
    $validator->setPost($_POST);
    $validator->addData('list_fromname', 'Other', false);
    $validator->addData('list_fromemail', 'Email', false);
    $validator->addData('list_frombounce', 'Email', false);
    $validator->addData('public_history', 'matchRegex', false, '!^(on|off)$!');
    $validator->addData('demo_mode', 'matchRegex', false, '!^(on|off)$!');
    $validator->addData('list_fromname', 'Other', false);
    $_POST['maxRunTime'] = (int) $_POST['maxRunTime'];
    /**********************************
Beispiel #10
0
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
//	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::$_hasConfigFile && Pommo::$_auth->isAuthenticated()) {
    // If user is authenticated (has logged in), redirect to admin.php
    Pommo::redirect(Pommo::$_http . Pommo::$_baseUrl . 'admin.php');
} elseif (isset($_POST['submit']) && !empty($_POST['username']) && !empty($_POST['password'])) {
    $auth = Pommo_Api::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
            require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Maintenance.php';
            Pommo_Helper_Maintenance::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
Beispiel #11
0
 * 
 * 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';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
$config = Pommo_Api::configGet('public_history');
if ($config['public_history'] == 'on') {
    Pommo::init(array('authLevel' => 0));
} else {
    Pommo::redirect('login.php');
}
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
// Remember the Page State
$state =& Pommo_Api::stateInit('mailings_history');
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
/**********************************
Beispiel #12
0
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// 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);
    Pommo_Api::configUpdate($input, TRUE);
    $view->assign('output', _('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)) {
        Pommo_Api::configUpdate($input, TRUE);
        $view->assign('output', _('Configuration Updated.'));
    } else {
        $view->assign('output', _('Please review and correct errors with your submission.'));
    }
}
$config = Pommo_Api::configGet(array('throttle_MPS', 'throttle_BPS', 'throttle_DP', 'throttle_DBPP', 'throttle_DMPP'));
$view->assign('mps', $config['throttle_MPS'] * 60);
$view->assign('bps', $config['throttle_BPS'] / 1024);
$view->assign('dp', $config['throttle_DP']);
$view->assign('dmpp', $config['throttle_DMPP']);
$view->assign('dbpp', $config['throttle_DBPP'] / 1024);
$view->display('admin/setup/config/ajax.throttle');
Beispiel #13
0
    Pommo_Api::configUpdate($input, TRUE);
    $update = true;
} elseif (!empty($_POST['deleteSmtpServer'])) {
    $input['smtp_' . key($_POST['deleteSmtpServer'])] = '';
    Pommo_Api::configUpdate($input, TRUE);
    $update = true;
} elseif (!empty($_POST['throttle_SMTP'])) {
    $input['throttle_SMTP'] = $_POST['throttle_SMTP'];
    Pommo_Api::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 = Pommo_Api::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;
        }
 * 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
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$smarty->prepareForForm();
$exchanger = current(Pommo_Api::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
    	 *********************************/
Beispiel #15
0
 function perform(&$in)
 {
     global $pommo;
     $dbo =& Pommo::$_dbo;
     $logger =& Pommo::$_logger;
     if (!is_numeric($in['id']) || !is_numeric($in['subscriber_id'])) {
         $logger->addErr('Pommo_Pending::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('Pommo_Pending::perform() -> Error updating subscriber.');
                 return false;
             }
             break;
         case 'change':
             // update
             require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
             $subscriber =& $in['array'];
             if (!Pommo_Subscribers::update($subscriber, 'REPLACE_ACTIVE')) {
                 $logger->addErr('Pommo_Pending::perform() -> Error updating subscriber.');
                 return false;
             }
             break;
         case 'password':
             // change (admin) password
             require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
             $password = Pommo_Helper::makePassword();
             $config = Pommo_Api::configGet(array('admin_username', 'admin_email'));
             if (!Pommo_Api::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('Pommo_Pending::perform() -> Error removing pending entry.');
         return false;
     }
     return true;
 }
Beispiel #16
0
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
if (empty($_POST)) {
    // 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.');
    $view->assign('vMsg', $vMsg);
    // populate _POST with info from database (fills in form values...)
    $dbVals = Pommo_Api::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'];
    $view->assign($dbVals);
} else {
    // ___ USER HAS SENT FORM ___
    require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
    $validator = new Pommo_Validate();
    $validator->setPost($_POST);
    $validator->addData('list_name', 'Other', false);
    $validator->addData('site_name', 'Other', false);
    $validator->addData('site_url', 'Url', false);
    $validator->addData('site_success', 'Url', true);
    $validator->addData('site_confirm', 'Url', true);
    $validator->addData('list_confirm', 'matchRegex', false, '!^(on|off)$!');
Beispiel #17
0
$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 = Pommo_Api::configGet(array('admin_username'));
    $dbVals['admin_email'] = Pommo::$_config['admin_email'];
    $smarty->assign($dbVals);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    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']);
        }