Example #1
0
*********************************/
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();
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
// Check if user requested to restore defaults
if (isset($_POST['restore'])) {
    Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');
    switch (key($_POST['restore'])) {
        case 'subscribe':
            $messages = PommoHelperMessages::ResetDefault('subscribe');
            break;
        case 'activate':
            $messages = PommoHelperMessages::resetDefault('activate');
            break;
        case 'unsubscribe':
            $messages = PommoHelperMessages::resetDefault('unsubscribe');
            break;
        case 'confirm':
            $messages = PommoHelperMessages::resetDefault('confirm');
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
    	 *********************************/
    Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
    $json = new PommoJSON();
    if (SmartyValidate::is_valid($_POST, 'exchanger')) {
        // __ FORM IS VALID
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');
        $msg = PommoHelperMessages::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();
Example #3
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
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'wysiwyg':
        // update wysiwyg ++ state
        $wysiwyg = isset($_REQUEST['enable']) ? 'on' : 'off';
        $pommo->_session['state']['mailing']['wysiwyg'] = $wysiwyg;
        PommoAPI::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':
        Pommo::requireOnce($pommo->_baseDir . 'inc/lib/lib.html2txt.php');
        $h2t =& new html2text($_REQUEST['body']);
Example #4
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';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
// 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.'));
Example #5
0
    $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']);
        }
        PommoAPI::configUpdate($_POST);
        unset($_POST['admin_password'], $_POST['admin_password2']);
        $pommo->reloadConfig();
        $json->success(Pommo::_T('Configuration Updated.'));
    } else {
        // __ FORM NOT VALID
        $json->add('fieldErrors', $smarty->getInvalidFields('users'));
        $json->fail(Pommo::_T('Please review and correct errors with your submission.'));
    }
Example #6
0
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('field_name', 'field_name', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('field_prompt', 'field_prompt', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('field_required', 'field_required:!^(on|off)$!', 'isRegExp');
    SmartyValidate::register_validator('field_active', 'field_active:!^(on|off)$!', 'isRegExp');
    $vMsg = array();
    $vMsg['field_name'] = $vMsg['field_prompt'] = Pommo::_T('Cannot be empty.');
    $smarty->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
    $json = new PommoJSON();
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
        // __ 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(PommoField::makeDB($_POST),$field);
        // restore the ID
        $update['id'] = $field['id'];
        */
        // let MySQL do the difference processing
        $update = PommoField::makeDB($_POST);
        if (!PommoField::update($update)) {
            $json->fail('error updating field');
        }
Example #7
0
    $smarty->display('admin/mailings/mailing/preview.tpl');
    Pommo::kill();
}
// get the group
$group = new PommoGroup($state['mailgroup'], 1);
$state['tally'] = $group->_tally;
$state['group'] = $group->_name;
// determine html status
$state['ishtml'] = empty($tempbody) ? 'off' : 'on';
// processs send request
if (!empty($_REQUEST['sendaway'])) {
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
    $json = new PommoJSON();
    if ($state['tally'] > 0) {
        if ($state['ishtml'] == 'off') {
            $state['body'] = $state['altbody'];
            $state['altbody'] = '';
        }
        $mailing = PommoMailing::make(array(), TRUE);
        $state['status'] = 1;
        $state['current_status'] = 'stopped';
        $state['command'] = 'restart';
        $mailing = PommoHelper::arrayIntersect($state, $mailing);
        $code = PommoMailing::add($mailing);
        if (!PommoMailCtl::queueMake($group->_memberIDs)) {
            $json->fail('Unable to populate queue');
        }
        if (!PommoMailCtl::spawn($pommo->_baseUrl . 'admin/mailings/mailings_send4.php?code=' . $code)) {
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;
// Remember the Page State
$state =& PommoAPI::stateInit('mailings_history');
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
/**********************************
	PAGINATION AND ORDERING
*********************************/
// 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'] == 'subject')) {
    $state['sort'] = $_REQUEST['sidx'];
}
// Get and Remember the sort order
if (!empty($_REQUEST['sord']) && ($_REQUEST['sord'] == 'asc' || $_REQUEST['sord'] == 'desc')) {
    $state['order'] = $_REQUEST['sord'];
}
Example #9
0
require '../../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/templates.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();
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
$success = false;
if (isset($_POST['skip']) || isset($_POST['template']) && !is_numeric($_POST['template'])) {
    $success = true;
} elseif (isset($_POST['load'])) {
    $template = current(PommoMailingTemplate::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 = PommoMailingTemplate::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 {
    $smarty->assign('templates', PommoMailingTemplate::getNames());
    $smarty->display('admin/mailings/mailing/templates.tpl');
Example #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 =& PommoAPI::stateInit('subscribers_manage', array('touched' => null, 'timestamp' => time(), 'notices' => array()));
if (!empty($_GET['resetNotices'])) {
    $state['notices'] = array();
}
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
$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(PommoMailing::get(array('id' => $_GET['id']))) : current(PommoMailing::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'];
Example #11
0
$logger =& $pommo->_logger;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
// fetch the mailing IDs
$mailingIDS = $_REQUEST['mailings'];
if (!is_array($mailingIDS)) {
    $mailingIDS = array($mailingIDS);
}
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON(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'), PommoMailing::getSubject($id)) . ' ###<br /><br />');
            $notices = PommoMailing::getNotices($id);
            $logger->AddMsg($notices);
        }
        break;
    case 'reload':
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/groups.php');
        $mailing = current(PommoMailing::get(array('id' => $_REQUEST['mailings'])));
        // change group name to ID
        $groups = PommoGroup::getNames();
Example #12
0
require '../../../bootstrap.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
if (isset($_REQUEST['compose'])) {
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
    $json = new PommoJSON();
    $json->success();
}
$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);
$smarty->assign($state);
// assign language (for wysiwyg)
$smarty->assign('lang', $pommo->_slanguage ? $pommo->_slanguage : $pommo->_language);
$smarty->display('admin/mailings/mailing/compose.tpl');
Pommo::kill();
Example #13
0
 * 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/subscribers.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/validate.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'addSubscriber':
        $json->setFailMsg(Pommo::_T('Error adding subscriber.'));
        // check if email is valid
        if (!PommoHelper::isEmail($_REQUEST['Email'])) {
            $json->fail(Pommo::_T('Invalid email.'));
        }
        // check if email has unsubscribed
        if (!isset($_REQUEST['force'])) {
            $unsubscribed = PommoSubscriber::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 addition.'), '<strong>' . $_REQUEST['Email'] . '</strong>'));
            }
        }
Example #14
0
 */
/**********************************
	INITIALIZATION METHODS
*********************************/
require '../../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/groups.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/rules.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
// Remember the Page State
$state =& PommoAPI::stateInit('groups_edit');
// EXAMINE CALL
switch ($_REQUEST['call']) {
    case 'displayRule':
        /**********************************
        			SETUP TEMPLATE, PAGE
        		 *********************************/
        Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
        $smarty = new PommoTemplate();
        $group = current(PommoGroup::get(array('id' => $state['group'])));
        if (empty($group)) {
            die('invalid input');
        }
        if ($_REQUEST['ruleType'] == 'field') {
Example #15
0
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
require '../../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/mailings.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
$mailing = current(PommoMailing::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();
        }
Example #16
0
	INITIALIZATION METHODS
*********************************/
require '../../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/groups.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
// Remember the Page State
$state =& PommoAPI::stateInit('subscribers_manage');
// Fetch group + member IDs
$group = new PommoGroup($state['group'], $state['status'], $state['search']);
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
$json = new PommoJSON();
/**********************************
	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'];
}