stateInit() static public method

* stateInit initializes a page state
static public stateInit ( $name = 'default', $defaults = [], $source = [] )
Ejemplo n.º 1
0
        $mailing = current(Pommo_Mailing::get(array('id' => $_REQUEST['mailings'])));
        // change group name to ID
        $groups = Pommo_Groups::getNames();
        $gid = 'all';
        foreach ($groups as $group) {
            if ($group['name'] == $mailing['group']) {
                $gid = $group['id'];
            }
        }
        Pommo_Api::stateReset(array('mailing'));
        // if this is a plain text mailing, switch body + altbody.
        if ($mailing['ishtml'] == 'off') {
            $mailing['altbody'] = $mailing['body'];
            $mailing['body'] = null;
        }
        // Initialize page state with default values overriden by those held in $_REQUEST
        $state =& Pommo_Api::stateInit('mailing', array('fromname' => $mailing['fromname'], 'fromemail' => $mailing['fromemail'], 'frombounce' => $mailing['frombounce'], 'list_charset' => $mailing['charset'], 'mailgroup' => $gid, 'subject' => $mailing['subject'], 'body' => $mailing['body'], 'altbody' => $mailing['altbody']));
        Pommo::redirect(Pommo::$_baseUrl . 'mailings_start.php');
        break;
    case 'delete':
        $deleted = Pommo_Mailing::delete($mailingIDS);
        $logger->addMsg(Pommo::_T('Please Wait') . '...');
        $params = $json->encode(array('ids' => $mailingIDS));
        $view->assign('callbackFunction', 'deleteMailing');
        $view->assign('callbackParams', $params);
        break;
    default:
        $logger->AddErr('invalid call');
        break;
}
$view->display('admin/rpc');
Ejemplo n.º 2
0
 * 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_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
Ejemplo n.º 3
0
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');
    SmartyValidate::register_validator('fromemail', 'fromemail', 'isEmail', false, false, 'trim');
    SmartyValidate::register_validator('frombounce', 'frombounce', 'isEmail', false, false, 'trim');
Ejemplo n.º 4
0
 * 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';
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'];
Ejemplo n.º 5
0
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Sql.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;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$view->assign('returnStr', _('Groups Page'));
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& Pommo_Api::stateInit('groups_edit', array('group' => 0), $_REQUEST);
$groups = Pommo_Groups::get();
$fields = Pommo_Fields::get();
$group =& $groups[$state['group']];
if (empty($group)) {
    Pommo::redirect('subscribers_groups.php');
}
$rules = Pommo_Sql::sortRules($group['rules']);
$rules['and'] = Pommo_Sql::sortLogic($rules['and']);
$rules['or'] = Pommo_Sql::sortLogic($rules['or']);
foreach ($rules as $key => $a) {
    if ($key == 'include' || $key == 'exclude') {
        foreach ($a as $k => $gid) {
            $rules[$key][$k] = $groups[$gid]['name'];
        }
    }
Ejemplo n.º 6
0
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$view->assign('returnStr', Pommo::_T('Mailings Page'));
/** SET PAGE STATE
 * limit	- # of mailings per page
 * sort		- Sorting of Mailings [subject, mailgroup, subscriberCount, started, etc.]
 * order	- Order Type (ascending - ASC /descending - DESC)
 */
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& Pommo_Api::stateInit('mailings_history', array('limit' => 10, 'sort' => 'end', 'order' => 'desc', 'page' => 1), $_REQUEST);
/**********************************
	VALIDATION ROUTINES
*********************************/
if (!is_numeric($state['limit']) || $state['limit'] < 1 || $state['limit'] > 1000) {
    $state['limit'] = 10;
}
if ($state['order'] != 'asc' && $state['order'] != 'desc') {
    $state['order'] = 'asc';
}
if ($state['sort'] != 'start' && $state['sort'] != 'end' && $state['sort'] != 'subject' && $state['sort'] != 'sent' && $state['sort'] != 'status' && $state['sort'] != 'group') {
    $state['sort'] = 'end';
}
/**********************************
	DISPLAY METHODS
*********************************/
Ejemplo n.º 7
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') {
            $field = current(Pommo_Fields::get(array('id' => $_REQUEST['fieldID'])));
            $logic = isset($_REQUEST['logic']) && $_REQUEST['logic'] != "0" ? $_REQUEST['logic'] : false;