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.
Ejemplo n.º 1
0
$logger = Pommo::$_logger;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// fetch the mailing IDs
$mailingIDS = $_REQUEST['mailings'];
if (!is_array($mailingIDS)) {
    $mailingIDS = array($mailingIDS);
}
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json(false);
// do not toggle escaping
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'notice':
        foreach ($mailingIDS as $id) {
            $logger->AddMsg('<br /><br />###' . sprintf(Pommo::_T('Displaying notices for mailing %s'), Pommo_Mailing::getSubject($id)) . ' ###<br /><br />');
            $notices = Pommo_Mailing::getNotices($id);
            $logger->AddMsg($notices);
        }
        break;
    case 'reload':
        require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
        $mailing = current(Pommo_Mailing::get(array('id' => $_REQUEST['mailings'])));
        // change group name to ID
        $groups = Pommo_Groups::getNames();
Ejemplo n.º 2
0
*********************************/
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();
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
// Check if user requested to restore defaults
if (isset($_POST['restore'])) {
    require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
    switch (key($_POST['restore'])) {
        case 'subscribe':
            $messages = Pommo_Helper_Messages::ResetDefault('subscribe');
            break;
        case 'activate':
            $messages = Pommo_Helper_Messages::resetDefault('activate');
            break;
        case 'unsubscribe':
            $messages = Pommo_Helper_Messages::resetDefault('unsubscribe');
            break;
        case 'confirm':
            $messages = Pommo_Helper_Messages::resetDefault('confirm');
Ejemplo n.º 3
0
 * 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_Mail_Ctl.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
Pommo::init();
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
$mailing = current(Pommo_Mailing::get(array('active' => TRUE)));
switch ($_GET['cmd']) {
    case 'cancel':
        // cancel a mailing
    // cancel a mailing
    case 'restart':
        // restart mailing
    // restart mailing
    case 'stop':
        // pause mailing
        $query = "\n\t\t\tUPDATE " . $dbo->table['mailing_current'] . "\n\t\t\tSET command='" . $_GET['cmd'] . "'\n\t\t\tWHERE current_id=%i";
        $query = $dbo->prepare($query, array($mailing['id']));
        if (!$dbo->query($query)) {
            $json->fail();
        }
Ejemplo n.º 4
0
 */
/**********************************
	INITIALIZATION METHODS
*********************************/
require '../bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
Pommo::init();
$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();
/**********************************
	PAGINATION AND ORDERING
*********************************/
// Get and Remember the requested number of rows
if (!empty($_REQUEST['page']) && (is_numeric($_REQUEST['rows']) && ($_REQUEST['rows'] > 0 && $_REQUEST['rows'] <= 1000))) {
    $state['limit'] = $_REQUEST['rows'];
}
// Get and Remember the requested page
if (!empty($_REQUEST['page']) && (is_numeric($_REQUEST['page']) && $_REQUEST['page'] <= $state['pages'])) {
    $state['page'] = $_REQUEST['page'];
}
// Get and Remember the sort column
if (!empty($_REQUEST['sidx']) && ($_REQUEST['sidx'] == 'start' || $_REQUEST['sidx'] == 'end' || $_REQUEST['sidx'] == 'subject' || $_REQUEST['sidx'] == 'sent' || $_REQUEST['sidx'] == 'status' || $_REQUEST['sidx'] == 'group')) {
    $state['sort'] = $_REQUEST['sidx'];
}
Ejemplo n.º 5
0
	INITIALIZATION METHODS
*********************************/
require '../bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
// Remember the Page State
$state = Pommo_Api::stateInit('subscribers_manage');
// Fetch group + member IDs
$group = new Pommo_Groups($state['group'], $state['status'], $state['search']);
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
/**********************************
	PAGINATION AND ORDERING
*********************************/
// Get and Remember the requested number of rows
if (!empty($_REQUEST['page']) && (is_numeric($_REQUEST['rows']) && ($_REQUEST['rows'] > 0 && $_REQUEST['rows'] <= 1000))) {
    $state['limit'] = $_REQUEST['rows'];
}
// Get and Remember the requested page
if (!empty($_REQUEST['page']) && (is_numeric($_REQUEST['page']) && $_REQUEST['page'] <= $state['pages'])) {
    $state['page'] = $_REQUEST['page'];
}
// Get and Remember the sort column
if (!empty($_REQUEST['sidx']) && (preg_match('/d\\d+/', $_REQUEST['sidx']) || $_REQUEST['sidx'] == 'email' || $_REQUEST['sidx'] == 'ip' || $_REQUEST['sidx'] == 'registered' || $_REQUEST['sidx'] == 'touched')) {
    $state['sort'] = $_REQUEST['sidx'];
}
Ejemplo n.º 6
0
 */
/**********************************
	INITIALIZATION METHODS
*********************************/
require '../bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Rules.php';
Pommo::init();
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
// Remember the Page State
$state =& Pommo_Api::stateInit('groups_edit');
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'displayRule':
        /**********************************
        			SETUP TEMPLATE, PAGE
        		 *********************************/
        require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
        $smarty = new Pommo_Template();
        $group = current(Pommo_Groups::get(array('id' => $state['group'])));
        if (empty($group)) {
            die('invalid input');
        }
        if ($_REQUEST['ruleType'] == 'field') {
Ejemplo n.º 7
0
 *  You should have received a copy of the GNU General Public License
 *  along with Pommo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  This fork is from https://github.com/soonick/poMMo
 *  Please see docs/contribs for Contributors
 *
 */
/**********************************
 INITIALIZATION METHODS
*********************************/
require '../bootstrap.php';
Pommo::init();
if ($_POST['bounces_submit']) {
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    require_once Pommo::$_baseDir . 'classes/Pommo_Setup.php';
    $json = new Pommo_Json();
    $setup = new Pommo_Setup();
    if (!$setup->saveBouncesForm()) {
        $fieldErrors = array();
        $errors = $setup->error['message'];
        foreach ($errors as $key => $val) {
            $fieldErrors[$key] = $val;
        }
        $json->add('fieldErrors', $fieldErrors);
        $json->fail(_('Save failed'));
    } else {
        $json->success(_('Hello'));
    }
    return;
}
/**********************************
Ejemplo n.º 8
0
$logger = Pommo::$_logger;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// fetch the mailing IDs
$mailingIDS = $_REQUEST['mailings'];
if (!is_array($mailingIDS)) {
    $mailingIDS = array($mailingIDS);
}
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json(false);
// do not toggle escaping
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'notice':
        foreach ($mailingIDS as $id) {
            $logger->AddMsg('<br /><br />###' . sprintf(Pommo::_T('Displaying notices for mailing %s'), Pommo_Mailing::getSubject($id)) . ' ###<br /><br />');
            $notices = Pommo_Mailing::getNotices($id);
            $logger->AddMsg($notices);
        }
        break;
    case 'reload':
        require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
        $mailing = current(Pommo_Mailing::get(array('id' => $_REQUEST['mailings'])));
        // change group name to ID
        $groups = Pommo_Groups::getNames();
Ejemplo n.º 9
0
}
//If a user is in more than one group we don't want to send them the same email twice
$memberIDs = array_unique($memberIDs);
$num_members = sizeof($memberIDs);
//If the size of $num_members is greater than 0 then we're not sending to 'All Subscribers'
$state['tally'] = $num_members ? $num_members : $tally;
$state['group'] = implode(', ', $names);
// determine html status
$state['ishtml'] = empty($tempbody) ? 'off' : 'on';
// processs send request
if (!empty($_REQUEST['sendaway'])) {
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if ($state['tally'] > 0) {
        if ($state['ishtml'] == 'off') {
            $state['body'] = $state['altbody'];
            $state['altbody'] = '';
        }
        $mailing = Pommo_Mailing::make(array(), TRUE);
        $state['status'] = 1;
        $state['current_status'] = 'stopped';
        $state['command'] = 'restart';
        $mailing = Pommo_Helper::arrayIntersect($state, $mailing);
        $code = Pommo_Mailing::add($mailing);
        if (!Pommo_Mail_Ctl::queueMake($memberIDs)) {
            $json->fail('Unable to populate queue');
        }
        if (!Pommo_Mail_Ctl::spawn(Pommo::$_baseUrl . 'ajax/mailings_send4.php?code=' . $code)) {
Ejemplo n.º 10
0
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/** SET PAGE STATE
 * touched - remember last time the mailing was touched
 * timestamp - updated whenever the mailing touched time changes
 */
// Initialize page state with default values overriden by those held in $_REQUEST
$state = Pommo_Api::stateInit('subscribers_manage', array('touched' => null, 'timestamp' => time(), 'notices' => array()));
if (!empty($_GET['resetNotices'])) {
    $state['notices'] = array();
}
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
$output = array('percent' => null, 'status' => null, 'statusText' => null, 'sent' => null, 'notices' => FALSE);
$statusText = array(1 => Pommo::_T('Processing'), 2 => Pommo::_T('Stopped'), 3 => Pommo::_T('Frozen'), 4 => Pommo::_T('Finished'));
$mailing = isset($_GET['id']) ? current(Pommo_Mailing::get(array('id' => $_GET['id']))) : current(Pommo_Mailing::get(array('active' => TRUE)));
// status >> 1: Processing  2: Stopped  3: Frozen  4: Finished
if ($mailing['status'] != 1) {
    $output['status'] = 4;
} elseif ($mailing['current_status'] == 'stopped') {
    $output['status'] = 2;
} else {
    $output['status'] = 1;
}
// check for frozen mailing
if ($output['status'] != 4) {
    if ($state['touched'] != $mailing['touched']) {
        $state['touched'] = $mailing['touched'];
Ejemplo n.º 11
0
    $vMsg = array();
    $vMsg['email'] = Pommo::_T('Invalid email address');
    $view->assign('vMsg', $vMsg);
    $dbvals = array('exchanger' => $exchanger, 'email' => Pommo::$_config['admin_email']);
    $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('email', 'Email', false);
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if ($result = $validator->checkData()) {
        // __ FORM IS VALID
        require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
        $msg = Pommo_Helper_Messages::testExchanger($_POST['email'], $exchanger) ? Pommo::_T('Mail Sent.') : Pommo::_T('Error Sending Mail');
        $json->success($msg);
    } else {
        // __ FORM NOT VALID
        $fieldErrors = array();
        $errors = $validator->getErrors();
        foreach ($errors as $key => $val) {
            $fieldErrors[] = array('field' => $key, 'message' => $val);
        }
        $json->add('fieldErrors', $fieldErrors);
        $json->fail(Pommo::_T('Please review and correct errors with your submission.'));
    }
Ejemplo n.º 12
0
    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 = 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';
    $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, 'mailings')) {
        // __ FORM IS VALID
        Pommo_Api::configUpdate($_POST);
        Pommo::reloadConfig();
        $json->success(Pommo::_T('Configuration Updated.'));
    } else {
        // __ FORM NOT VALID
        $json->add('fieldErrors', $smarty->getInvalidFields('mailings'));
        $json->fail(Pommo::_T('Please review and correct errors with your submission.'));
    }
}
$smarty->assign($_POST);
$smarty->display('admin/setup/config/mailings.tpl');
Pommo::kill();
Ejemplo n.º 13
0
	INITIALIZATION METHODS
 *********************************/
require '../bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
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>'));
}
// TODO -- fix stateInit so we don't NEED to supply the defaults that have already been defined
if (isset($_REQUEST['compose'])) {
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    $json->success();
}
$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' => '', 'track' => '', 'attachments' => ''), $_POST);
$view->assign($state);
// assign language (for wysiwyg)
$view->assign('lang', Pommo::$_slanguage ? Pommo::$_slanguage : Pommo::$_language);
$view->display('admin/mailings/mailing/compose');
Ejemplo n.º 14
0
// validate field ID
$field = current(Pommo_Fields::get(array('id' => $_REQUEST['field_id'])));
if ($field['id'] != $_REQUEST['field_id']) {
    die('bad field ID');
}
if (empty($_POST)) {
    $vMsg = array();
    $vMsg['field_name'] = $vMsg['field_prompt'] = Pommo::_T('Cannot be empty.');
    $view->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
    $validator = new Pommo_Validate();
    $validator->setPost($_POST);
    $validator->addData('field_name', 'Other', false);
    $validator->addData('field_prompt', 'Other', false);
    $validator->addData('field_required', 'matchRegex', false, '!^(on|off)$!');
    $validator->addData('field_active', 'matchRegex', false, '!^(on|off)$!');
    if ($result = $validator->checkData()) {
        // __ FORM IS VALID
        // TODO -> Which below logic is better? the computed diff, or send all fields for update?
        /*
        // make a difference between updated & original field
        $update = array_diff_assoc(Pommo_Fields::makeDB($_POST),$field);
        // restore the ID
        $update['id'] = $field['id'];
Ejemplo n.º 15
0
 * 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_Fields.php';
Pommo::init();
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'updateOrdering':
        $when = '';
        foreach ($_REQUEST['order'] as $order => $fieldID) {
            if (is_numeric($order)) {
                $when .= $dbo->prepare("WHEN %i THEN %i", array($fieldID, $order)) . ' ';
            }
        }
        $query = "\n\t\t\tUPDATE " . $dbo->table['fields'] . "\n\t\t\tSET field_ordering = \n\t\t\t\tCASE field_id " . $when . " ELSE field_ordering END";
        if (!$dbo->query($dbo->prepare($query))) {
            $json->fail('Error Updating Order');
        }
        $json->add('query', $query);
        $json->success(Pommo::_T('Order Updated.'));
Ejemplo n.º 16
0
 *********************************/
require '../bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing_Template.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
$success = false;
if (isset($_POST['skip']) || isset($_POST['template']) && !is_numeric($_POST['template'])) {
    $success = true;
} elseif (isset($_POST['load'])) {
    $template = current(Pommo_Mailing_Template::get(array('id' => $_POST['template'])));
    Pommo::$_session['state']['mailing']['body'] = $template['body'];
    Pommo::$_session['state']['mailing']['altbody'] = $template['altbody'];
    $success = true;
} elseif (isset($_POST['delete'])) {
    $msg = Pommo_Mailing_Template::delete($_POST['template']) ? Pommo::_T('Template Deleted') : Pommo::_T('Error with deletion.');
    $json->add('callbackFunction', 'deleteTemplate');
    $json->add('callbackParams', array('id' => $_POST['template'], 'msg' => $msg));
} else {
    $view->assign('templates', Pommo_Mailing_Template::getNames());
    $view->display('admin/mailings/mailing/templates');
Ejemplo n.º 17
0
 * 
 * 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::init();
$dbo =& Pommo::$_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'wysiwyg':
        // update wysiwyg ++ state
        $wysiwyg = isset($_REQUEST['enable']) ? 'on' : 'off';
        Pommo::$_session['state']['mailing']['wysiwyg'] = $wysiwyg;
        Pommo_Api::configUpdate(array('list_wysiwyg' => $wysiwyg), true);
        break;
    case 'savebody':
        Pommo::$_session['state']['mailing']['body'] = $_REQUEST['body'];
        Pommo::$_session['state']['mailing']['altbody'] = $_REQUEST['altbody'];
        break;
    case 'altbody':
        require_once Pommo::$_baseDir . 'lib/lib.html2txt.php';
        $h2t =& new html2text($_REQUEST['body']);
Ejemplo n.º 18
0
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
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if (SmartyValidate::is_valid($_POST, 'exchanger')) {
        // __ FORM IS VALID
        require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
        $msg = Pommo_Helper_Messages::testExchanger($_POST['email'], $exchanger) ? Pommo::_T('Mail Sent.') : Pommo::_T('Error Sending Mail');
        $json->success($msg);
    } else {
        // __ FORM NOT VALID
        $json->addMsg(Pommo::_T('Please review and correct errors with your submission.'));
        $json->add('fieldErrors', $smarty->getInvalidFields('exchanger'));
        $json->fail();
    }
}
$smarty->assign($_POST);
$smarty->display('admin/setup/config/ajax.testexchanger.tpl');
Pommo::kill();
Ejemplo n.º 19
0
 * 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_Subscribers.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'addSubscriber':
        $json->setFailMsg(Pommo::_T('Error adding subscriber.'));
        // check if email is valid
        if (!Pommo_Helper::isEmail($_REQUEST['Email'])) {
            echo 1;
            $json->fail(Pommo::_T('Invalid email.'));
        }
        // check if email has unsubscribed
        if (!isset($_REQUEST['force'])) {
            $unsubscribed = Pommo_Subscribers::GetIDByEmail($_REQUEST['Email'], 0);
            if (!empty($unsubscribed)) {
                $json->fail(sprintf(Pommo::_T('%s has already unsubscribed. To
						add the subscriber anyway, check the box to force the
Ejemplo n.º 20
0
 // ___ 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)$!');
 $validator->addData('list_exchanger', 'matchRegex', false, '!^(sendmail|mail|smtp)$!');
 /**********************************
 		JSON OUTPUT INITIALIZATION
 	 *********************************/
 require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
 $json = new Pommo_Json();
 if ($result = $validator->checkData()) {
     // __ FORM IS VALID
     Pommo_Api::configUpdate($_POST);
     Pommo::reloadConfig();
     $json->success(Pommo::_T('Configuration Updated.'));
 } else {
     // __ FORM NOT VALID
     $fieldErrors = array();
     $errors = $validator->getErrors();
     foreach ($errors as $key => $val) {
         $fieldErrors[] = array('field' => $key, 'message' => $val);
     }
     $json->add('fieldErrors', $fieldErrors);
     $json->fail(Pommo::_T('Please review and correct errors with your submission.'));
 }
Ejemplo n.º 21
0
$dbo = Pommo::$_dbo;
/**********************************
  SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
if (empty($_POST)) {
    //Initiate Page
    //populate _POST with info from database (fills in form values...)
    $dbVals = Pommo_Api::configGet(array('admin_username'));
    $dbVals['admin_email'] = Pommo::$_config['admin_email'];
    $view->assign($dbVals);
} else {
    // ___ USER HAS SENT FORM ___
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if (isset($_POST['admin_email'])) {
        //Do inline validation
        require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
        $errors = array();
        $validator = new Pommo_Validate();
        $validator->setPost($_POST);
        $validator->addData('admin_email', 'Email', false);
        $result = $validator->checkData();
        $errors = $validator->getErrors();
        //Is result ok?
        if ($result) {
            Pommo_Api::configUpdate($_POST);
            Pommo::reloadConfig();
            $json->success(Pommo::_T('Configuration Updated.'));
        } else {