Example #1
0
 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";
     }
 }
Example #2
0
 function PommoMTA($args = array())
 {
     $defaults = array('queueSize' => 100, 'maxRunTime' => 80, 'skipSecurity' => false, 'start' => time(), 'serial' => false, 'spawn' => 1);
     $p = PommoAPI::getParams($defaults, $args);
     foreach ($p as $k => $v) {
         $this->{'_' . $k} = $v;
     }
     // protect against safe mode timeouts
     if (ini_get('safe_mode')) {
         $this->_maxRunTime = ini_get('max_execution_time') - 10;
     } else {
         set_time_limit(0);
     }
     // protect against user (client) abort
     ignore_user_abort(true);
     // register shutdown method
     register_shutdown_function(array(&$this, "shutdown"));
     // set parameters from URL
     $this->_code = empty($_GET['code']) ? 'invalid' : $_GET['code'];
     $this->_test = isset($_GET['test']);
     $this->_id = isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : false;
     // verify and initialize the current mailing
     $p = array('active' => true, 'code' => $this->_skipSecurity ? null : $this->_code, 'id' => $this->_id ? $this->_id : null);
     $this->_mailing = current(PommoMailing::get($p));
     if (!is_numeric($this->_mailing['id'])) {
         $this->shutdown('Unable to initialize mailing.');
     }
     $this->_id = $this->_mailing['id'];
     // make sure the $_GET global holds the mailing id (used in personalizations, etc.)
     $_GET['id'] = $this->_id;
     // security routines
     if ($this->_mailing['end'] > 0) {
         $this->shutdown(Pommo::_T('Mailing Complete.'));
     }
     if (empty($this->_mailing['serial'])) {
         if (!PommoMailCtl::mark($this->_serial, $this->_id)) {
             $this->shutdown('Unable to serialize mailing (ID: ' . $this->_id . ' SERIAL: ' . $this->_serial . ')');
         }
     }
     if ($this->_maxRunTime < 15) {
         $this->shutdown('Max Runtime must be at least 15 seconds!');
     }
     $this->_queue = $this->_sent = $this->_failed = array();
     return;
 }
Example #3
0
    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;
        }
 * 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.
 */
require '../../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/groups.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
$pommo->toggleEscaping(TRUE);
$state =& PommoAPI::stateInit('subscribers_manage');
$fields = PommoField::get();
$ids = FALSE;
if (!empty($_POST['ids'])) {
    $ids = explode(',', $_POST['ids']);
}
// ====== CSV EXPORT ======
if ($_POST['type'] == 'csv') {
    if (!$ids) {
        $group = new PommoGroup($state['group'], $state['status']);
        $subscribers = $group->members();
    } else {
        $subscribers = PommoSubscriber::get(array('id' => $ids));
    }
    // supply headers
    $o = '"' . Pommo::_T('Email') . '"';
Example #5
0
        $messages['confirm']['sub'] = $_POST['confirm_sub'];
        $messages['confirm']['msg'] = $_POST['confirm_msg'];
        $messages['activate'] = array();
        $messages['activate']['sub'] = $_POST['activate_sub'];
        $messages['activate']['msg'] = $_POST['activate_msg'];
        $messages['update'] = array();
        $messages['update']['sub'] = $_POST['update_sub'];
        $messages['update']['msg'] = $_POST['update_msg'];
        $notices = array();
        $notices['email'] = $_POST['notify_email'];
        $notices['subject'] = $_POST['notify_subject'];
        $notices['subscribe'] = $_POST['notify_subscribe'];
        $notices['unsubscribe'] = $_POST['notify_unsubscribe'];
        $notices['update'] = $_POST['notify_update'];
        $notices['pending'] = $_POST['notify_pending'];
        $input = array('messages' => serialize($messages), 'notices' => serialize($notices));
        PommoAPI::configUpdate($input, TRUE);
        $json->success(Pommo::_T('Configuration Updated.'));
    } else {
        // __ FORM NOT VALID
        $json->add('fieldErrors', $smarty->getInvalidFields('messages'));
        $json->fail(Pommo::_T('Please review and correct errors with your submission.'));
    }
}
$smarty->assign('t_subscribe', Pommo::_T('Subscription'));
$smarty->assign('t_unsubscribe', Pommo::_T('Unsubscription'));
$smarty->assign('t_pending', Pommo::_T('Pending'));
$smarty->assign('t_update', Pommo::_T('Update'));
$smarty->assign($_POST);
$smarty->display('admin/setup/config/messages.tpl');
Pommo::kill();
 * 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
    	 *********************************/
Example #7
0
 function subscriberData(&$in, $p = array())
 {
     $defaults = array('prune' => true, 'active' => true, 'log' => true, 'ignore' => false, 'ignoreInactive' => true, 'skipReq' => false);
     $p = PommoAPI::getParams($defaults, $p);
     global $pommo;
     $pommo->requireOnce($GLOBALS['pommo']->_baseDir . 'inc/helpers/fields.php');
     $logger =& $pommo->_logger;
     $fields = PommoField::get(array('active' => $p['active']));
     $valid = true;
     foreach ($fields as $id => $field) {
         $inactive = $field['active'] == 'on' ? false : true;
         if (!isset($in[$id]) && $p['skipReq']) {
             continue;
         }
         $in[$id] = @trim($in[$id]);
         if (empty($in[$id])) {
             unset($in[$id]);
             // don't include blank values
             if ($field['required'] == 'on') {
                 if ($p['log']) {
                     $logger->addErr(sprintf(Pommo::_T('%s is a required field.'), $field['prompt']));
                 }
                 $valid = false;
             }
             continue;
         }
         // shorten
         $in[$id] = substr($in[$id], 0, 255);
         switch ($field['type']) {
             case "checkbox":
                 if (strtolower($in[$id]) == 'true') {
                     $in[$id] = 'on';
                 }
                 if (strtolower($in[$id]) == 'false') {
                     $in[$id] = '';
                 }
                 if ($in[$id] != 'on' && $in[$id] != '') {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
             case "multiple":
                 if (is_array($in[$id])) {
                     foreach ($in[$id] as $key => $val) {
                         if (!in_array($val, $field['array'])) {
                             if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                                 unset($in[$id]);
                                 break;
                             }
                             if ($p['log']) {
                                 $logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
                             }
                             $valid = false;
                         }
                     }
                 } elseif (!in_array($in[$id], $field['array'])) {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
             case "date":
                 // convert date to timestamp [float; using adodb time library]
                 if (is_numeric($in[$id])) {
                     $in[$id] = PommoHelper::timeToStr($in[$id]);
                 }
                 $in[$id] = PommoHelper::timeFromStr($in[$id]);
                 if (!$in[$id]) {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Field (%s) must be a date ('), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
             case "number":
                 if (!is_numeric($in[$id])) {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Field (%s) must be a number.'), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
         }
     }
     // prune
     if ($p['prune']) {
         $in = PommoHelper::arrayIntersect($in, $fields);
     }
     return $valid;
 }
 * 
 * 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;
}
Example #9
0
        $mailing = current(PommoMailing::get(array('id' => $_REQUEST['mailings'])));
        // change group name to ID
        $groups = PommoGroup::getNames();
        $gid = 'all';
        foreach ($groups as $group) {
            if ($group['name'] == $mailing['group']) {
                $gid = $group['id'];
            }
        }
        PommoAPI::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 =& PommoAPI::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 . 'admin/mailings/mailings_start.php');
        break;
    case 'delete':
        $deleted = PommoMailing::delete($mailingIDS);
        $logger->addMsg(Pommo::_T('Please Wait') . '...');
        $params = $json->encode(array('ids' => $mailingIDS));
        $smarty->assign('callbackFunction', 'deleteMailing');
        $smarty->assign('callbackParams', $params);
        break;
    default:
        $logger->AddErr('invalid call');
        break;
}
$smarty->display('admin/rpc.tpl');
function PommoRevUpgrade($rev)
{
    global $pommo;
    $logger =& $pommo->_logger;
    $dbo =& $pommo->_dbo;
    switch ($rev) {
        case 26:
            // Aardvark PR14
            // manually add the serial column
            $query = "ALTER TABLE " . $dbo->table['updates'] . " ADD `serial` INT UNSIGNED NOT NULL";
            if (!$dbo->query($query)) {
                Pommo::kill('Could not add serial column');
            }
            if (!PommoInstall::incUpdate(1, "ALTER TABLE {$dbo->table['updates']} DROP `update_id` , DROP `update_serial`", "Dropping old Update columns")) {
                return false;
            }
            if (!PommoInstall::incUpdate(2, "ALTER TABLE {$dbo->table['updates']} ADD PRIMARY KEY ( `serial` )", "Adding Key to Updates Table")) {
                return false;
            }
            if (!PommoInstall::incUpdate(3, "CREATE TABLE {$dbo->table['mailing_notices']} (\n\t\t\t\t`mailing_id` int(10) unsigned NOT NULL,\n\t\t\t\t`notice` varchar(255) NOT NULL,\n\t\t\t\t`touched` timestamp NOT NULL,\n\t\t\t\tKEY `mailing_id` (`mailing_id`)\n\t\t\t)", "Adding Mailing Notice Table")) {
                return false;
            }
            if (!PommoInstall::incUpdate(4, "ALTER TABLE {$dbo->table['mailing_current']} DROP `notices`", "Dropping old Notice column")) {
                return false;
            }
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 27), true)) {
                return false;
            }
        case 27:
            // Aardvark PR14.1
            if (!PommoInstall::incUpdate(5, "CREATE TABLE {$dbo->table['subscriber_update']} (\n\t\t\t\t`email` varchar(60) NOT NULL,\n  \t\t\t\t`code` char(32) NOT NULL ,\n  \t\t\t\t`activated` datetime NULL default NULL ,\n  \t\t\t\t`touched` timestamp(14) NOT NULL,\n\t\t\t\tPRIMARY KEY ( `email` )\n\t\t\t)", "Adding Update Activation Table")) {
                return false;
            }
            if (!PommoInstall::incUpdate(6, "INSERT INTO {$dbo->table['config']} VALUES ('public_history', 'off', 'Public Mailing History', 'off', 'on')", "Adding configuration of Public Mailings")) {
                return false;
            }
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');
            PommoHelperMessages::resetDefault();
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 28, 'version' => 'Aardvark PR14.2'), true)) {
                return false;
            }
        case 28:
            // Aardvark PR14.2
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 29, 'version' => 'Aardvark PR14.3'), true)) {
                return false;
            }
        case 29:
            // Aardvark PR14.3
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 30, 'version' => 'Aardvark PR14.3.1'), true)) {
                return false;
            }
        case 30:
            // Aardvark PR14.3.1
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 31, 'version' => 'Aardvark PR14.4'), true)) {
                return false;
            }
            break;
        case 31:
            // Aardvark PR14.4
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 32, 'version' => 'Aardvark PR14.4.1'), true)) {
                return false;
            }
        case 32:
            // Aardvark PR14.4.1
            if (!PommoInstall::incUpdate(7, "RENAME TABLE {$dbo->table['group_criteria']} TO {$dbo->table['group_rules']}", "Renaming Group Rules Table")) {
                return false;
            }
            if (!PommoInstall::incUpdate(8, "ALTER TABLE {$dbo->table['group_rules']} CHANGE `criteria_id` `rule_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT", "Renaming key column")) {
                return false;
            }
            if (!PommoAPI::configUpdate(array('revision' => 33, 'version' => 'Aardvark SVN'), true)) {
                return false;
            }
        case 33:
            // (svn development) -> Aardvark PR15
            if (!PommoInstall::incUpdate(9, "ALTER TABLE {$dbo->table['group_rules']} ADD `type` TINYINT( 1 ) NOT NULL DEFAULT '0'", "Adding OR support to Group Rules")) {
                return false;
            }
            if (!PommoInstall::incUpdate(10, "INSERT INTO {$dbo->table['config']} (`config_name`, `config_value`, `config_description`, `autoload`, `user_change`) VALUES ('notices', '', '', 'off', 'off')", "Enabling Notification of Subscriber List Changes")) {
                return false;
            }
            if (!PommoInstall::incUpdate(11, "ALTER TABLE {$dbo->table['fields']} CHANGE `field_type` `field_type` ENUM( 'checkbox', 'multiple', 'text', 'date', 'number', 'comment' ) DEFAULT NULL", "Adding 'comments' field type")) {
                return false;
            }
            if (!PommoInstall::incUpdate(12, "ALTER TABLE {$dbo->table['mailing_notices']} ADD `id` SMALLINT UNSIGNED NULL", "Adding id to mailing notices")) {
                return false;
            }
            if (!PommoInstall::incUpdate(13, "ALTER TABLE {$dbo->table['mailing_current']} CHANGE `command` `command` ENUM( 'none', 'restart', 'stop', 'cancel' ) NOT NULL DEFAULT 'none'", "Adding cancel type to mailing commands")) {
                return false;
            }
            if (!PommoInstall::incUpdate(14, "INSERT INTO {$dbo->table['config']} (`config_name`, `config_value`, `config_description`, `autoload`, `user_change`) VALUES ('maxRuntime', '80', '', 'off', 'on')", "Enabling Mailing Runtime to be set in Config")) {
                return false;
            }
            if (!PommoInstall::incUpdate(15, "INSERT INTO {$dbo->table['config']} (`config_name`, `config_value`, `config_description`, `autoload`, `user_change`) VALUES ('list_wysiwyg', 'on', '', 'off', 'off')", "Persisting State of WYSIWYG Editor Toggle")) {
                return false;
            }
            if (!PommoInstall::incUpdate(16, "ALTER TABLE {$dbo->table['subscriber_data']} CHANGE `value` `value` CHAR( 60 ) NOT NULL", "Tuning Subscriber Data Table")) {
                return false;
            }
            if (!PommoInstall::incUpdate(17, "ALTER TABLE {$dbo->table['subscribers']} CHANGE `email` `email` CHAR( 60 ) NOT NULL", "Tuning Subscribers Table")) {
                return false;
            }
            if (!PommoInstall::incUpdate(18, "DROP TABLE {$dbo->table['subscriber_update']}", "Dropping previous activate routines")) {
                return false;
            }
            if (!PommoInstall::incUpdate(19, "CREATE TABLE {$dbo->table['templates']} (`template_id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR( 60 ) NOT NULL DEFAULT 'name',`description` VARCHAR( 255 ) NULL ,`body` MEDIUMTEXT NULL ,`altbody` MEDIUMTEXT NULL, PRIMARY KEY(`template_id`))", "Adding mailing template support")) {
                return false;
            }
            // custom update 20, install default template
            $query = "\n\t\t\tSELECT serial FROM " . $dbo->table['updates'] . " \n\t\t\tWHERE serial=%i";
            $query = $dbo->prepare($query, array('20'));
            if (!$dbo->records($query)) {
                $file = $pommo->_baseDir . "install/sql.templates.php";
                if (PommoInstall::parseSQL(false, $file)) {
                    $query = "INSERT INTO " . $dbo->table['updates'] . "(serial) VALUES(%i)";
                    $query = $dbo->prepare($query, array('20'));
                    $dbo->query($query);
                }
            }
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 34, 'version' => 'Aardvark PR15'), true)) {
                return false;
            }
        case 34:
            // Changes >=  Aardvark PR15
            $file = $pommo->_baseDir . "install/sql.templates.php";
            if (!PommoInstall::parseSQL(false, $file)) {
                $logger->addErr('Error Loading Default Mailing Templates.');
            }
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 35, 'version' => 'Aardvark PR15.1'), true)) {
                return false;
            }
        case 35:
            // Aardvark PR15.1
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 36, 'version' => 'Aardvark SVN'), true)) {
                return false;
            }
        case 36:
            // SVN revision (applied to PR15.1, for next revision)
            if (!PommoInstall::incUpdate(21, "UPDATE {$dbo->table['config']} SET autoload='on' WHERE config_name='revision'", "Flagging Revision Autoloading")) {
                return false;
            }
            if (!PommoInstall::incUpdate(22, "DROP TABLE IF EXISTS {$dbo->table['subscriber_update']}", "Dropping previous activate routines")) {
                return false;
            }
            if (!PommoInstall::incUpdate(23, "CREATE TABLE {$dbo->table['scratch']} (\n\t\t\t\t`scratch_id` int(10) unsigned NOT NULL auto_increment,\n\t\t\t\t`time` TIMESTAMP NOT NULL,\n\t\t\t\t`type` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Used to identify row type. 0 = undifined, 1 = ',\n\t\t\t\t`int` BIGINT NULL,\n\t\t\t\t`str` TEXT NULL,\n\t\t\t\tPRIMARY KEY (`scratch_id`),\n\t\t\t\tKEY `type`(`type`)\n\t\t\t\t) COMMENT = 'General Purpose Table for caches, counts, etc.'", "Adding Scratch Table")) {
                return false;
            }
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 37, 'version' => 'Aardvark PR16rc1'), true)) {
                return false;
            }
        case 37:
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 38, 'version' => 'Aardvark PR16rc2'), true)) {
                return false;
            }
        case 38:
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 39, 'version' => 'Aardvark PR16rc3'), true)) {
                return false;
            }
        case 39:
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 40, 'version' => 'Aardvark PR16rc4'), true)) {
                return false;
            }
        case 40:
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 41, 'version' => 'Aardvark PR16'), true)) {
                return false;
            }
        case 41:
            $sql = 'Pommo::requireOnce($pommo->_baseDir . \'inc/helpers/messages.php\');PommoHelperMessages::resetDefault();';
            if (!PommoInstall::incUpdate(24, $sql, "Resetting all Messages to Default", true)) {
                return false;
            }
            // bump revision
            if (!PommoAPI::configUpdate(array('revision' => 42, 'version' => 'Aardvark PR16.1'), true)) {
                return false;
            }
        case 42:
            // end of upgrade (break), no revision bump.
            break;
        default:
            return false;
    }
    return true;
}
Example #11
0
}
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->assign('title', $pommo->_config['site_name'] . ' - ' . Pommo::_T('Mailing History'));
/** SET PAGE STATE
 * limit	- # of mailings per page
 * sort		- Sorting of Mailings [subject, started]
 * order	- Order Type (ascending - ASC /descending - DESC)
 */
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& PommoAPI::stateInit('mailings_history', array('limit' => 100, 'sort' => 'finished', 'order' => 'asc', 'page' => 1), $_REQUEST);
// if mail_id is passed, display the mailing.
if (isset($_GET['mail_id']) && is_numeric($_GET['mail_id'])) {
    $input = current(PommoMailing::get(array('id' => $_GET['mail_id'])));
    // attempt personalizations of body/subject
    if (isset($_GET['email']) && isset($_GET['code'])) {
        $subscriber = current(PommoSubscriber::get(array('email' => $_GET['email'], 'status' => 1)));
        if ($_GET['code'] == PommoSubscriber::getActCode($subscriber)) {
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalize.php');
            // require once here so that mailer can use
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalizetitle.php');
            // title personalization
            $matches1 = array();
            preg_match('/\\[\\[[^\\]]+]]/', $input['body'], $matches1);
            if (!empty($matches1)) {
                $pBody = PommoHelperPersonalize::search($input['body']);
Example #12
0
/**********************************
	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
Example #13
0
 function &get($p = array())
 {
     $defaults = array('active' => false, 'noBody' => false, 'id' => null, 'code' => null, 'sort' => null, 'order' => null, 'limit' => null, 'offset' => null);
     $p = PommoAPI::getParams($defaults, $p);
     global $pommo;
     $dbo =& $pommo->_dbo;
     $p['active'] = $p['active'] ? 1 : null;
     if (is_numeric($p['limit']) && !is_numeric($p['offset'])) {
         $p['offset'] = 0;
     }
     $o = array();
     $select = "mailing_id, fromname, fromemail, frombounce, subject, ishtml, mailgroup, subscriberCount, started, finished, sent, charset, status, c.*";
     if (!$p['noBody']) {
         $select .= ", body, altbody";
     }
     $query = "\n\t\t\tSELECT {$select}\n\t\t\tFROM \n\t\t\t\t" . $dbo->table['mailings'] . " m\n\t\t\t\tLEFT JOIN " . $dbo->table['mailing_current'] . " c ON (m.mailing_id = c.current_id)\n\t\t\tWHERE\n\t\t\t\t1\n\t\t\t\t[AND m.status=%I]\n\t\t\t\t[AND m.mailing_id IN(%C)]\n\t\t\t\t[AND c.securityCode='%S'] \n\t\t\t\t[ORDER BY %S] [%S] \n\t\t\t\t[LIMIT %I, %I]";
     $query = $dbo->prepare($query, array($p['active'], $p['id'], $p['code'], $p['sort'], $p['order'], $p['offset'], $p['limit']));
     while ($row = $dbo->getRows($query)) {
         $o[$row['mailing_id']] = PommoMailing::makeDB($row);
     }
     return $o;
 }
Example #14
0
// ** 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.
Example #15
0
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'])) {
Example #16
0
 function &get($p = array())
 {
     $defaults = array('id' => null);
     $p = PommoAPI::getParams($defaults, $p);
     global $pommo;
     $dbo =& $pommo->_dbo;
     $o = array();
     $query = "\n\t\t\tSELECT g.group_id, g.group_name, c.rule_id, c.field_id, c.logic, c.value, c.type\n\t\t\tFROM " . $dbo->table['groups'] . " g\n\t\t\tLEFT JOIN " . $dbo->table['group_rules'] . " c \n\t\t\t\tON (g.group_id = c.group_id)\n\t\t\tWHERE\n\t\t\t\t1\n\t\t\t\t[AND g.group_id IN(%C)]\n\t\t\tORDER BY g.group_name";
     $query = $dbo->prepare($query, array($p['id']));
     while ($row = $dbo->getRows($query)) {
         if (empty($o[$row['group_id']])) {
             $o[$row['group_id']] = PommoGroup::makeDB($row);
         }
         if (!empty($row['rule_id'])) {
             $c = array('field_id' => $row['field_id'], 'logic' => $row['logic'], 'value' => $row['value'], 'or' => $row['type'] == 0 ? false : true);
             $o[$row['group_id']]['rules'][$row['rule_id']] = $c;
         }
     }
     return $o;
 }
Example #17
0
 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;
 }
Example #18
0
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/groups.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>'));
}
$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);
// 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');
$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
Example #20
0
 function &get($p = array())
 {
     $defaults = array('active' => false, 'id' => null, 'byName' => true);
     $p = PommoAPI::getParams($defaults, $p);
     global $pommo;
     $dbo =& $pommo->_dbo;
     $p['active'] = $p['active'] ? 'on' : null;
     $p['byName'] = $p['byName'] ? 'field_name' : 'field_ordering';
     $o = array();
     $query = "\n\t\t\tSELECT *\n\t\t\tFROM " . $dbo->table['fields'] . "\n\t\t\tWHERE\n\t\t\t\t1\n\t\t\t\t[AND field_active='%S']\n\t\t\t\t[AND field_id IN(%C)]\n\t\t\tORDER BY " . $p['byName'];
     $query = $dbo->prepare($query, array($p['active'], $p['id']));
     while ($row = $dbo->getRows($query)) {
         $o[$row['field_id']] = PommoField::makeDB($row);
     }
     return $o;
 }
Example #21
0
    $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.'));
    }
}
$smarty->assign($_POST);
$smarty->display('admin/setup/config/users.tpl');
Pommo::kill();
Example #22
0
 */
/**********************************
	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;
// 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'];
Example #23
0
 *********************************/
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']);
        $json->add('altbody', $h2t->get_text());
        break;
    case 'getTemplateDescription':
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/templates.php');
        $template = PommoMailingTemplate::getDescriptions(array('id' => $_REQUEST['id']));
        $msg = empty($template[$_REQUEST['id']]) ? 'Aucune' : $template[$_REQUEST['id']];
        die($msg);
Example #24
0
 function reloadConfig()
 {
     return $this->_config = PommoAPI::configGetBase(TRUE);
 }
	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();
Example #26
0
 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;
 }
Example #27
0
     $sql = 'DROP TABLE IF EXISTS ' . $table;
     $dbo->query($sql);
 }
 if (isset($_REQUEST['debugInstall'])) {
     $dbo->debug(TRUE);
 }
 $install = PommoInstall::parseSQL();
 if ($install) {
     // installation of DB went OK, set configuration values to user supplied ones
     $pass = $_POST['admin_password'];
     // install configuration
     $_POST['admin_password'] = md5($_POST['admin_password']);
     PommoAPI::configUpdate($_POST);
     // generate key to uniquely identify this installation
     $key = PommoHelper::makeCode(6);
     PommoAPI::configUpdate(array('key' => $key), TRUE);
     $pommo->reloadConfig();
     // load configuration [depricated?], set message defaults, load templates
     Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');
     PommoHelperMessages::resetDefault('all');
     // install templates
     $file = $pommo->_baseDir . "install/sql.templates.php";
     if (!PommoInstall::parseSQL(false, $file)) {
         $logger->addErr('Error Loading Default Mailing Templates.');
     }
     // serialize the latest updates
     $GLOBALS['pommoFakeUpgrade'] = true;
     Pommo::requireOnce($pommo->_baseDir . 'install/helper.upgrade.php');
     PommoUpgrade();
     $logger->addMsg(Pommo::_T('Installation Complete! You may now login and setup poMMo.'));
     $logger->addMsg(Pommo::_T('Login Username: '******'admin');
Example #28
0
require '../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/sql.gen.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;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->assign('returnStr', Pommo::_T('Groups Page'));
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& PommoAPI::stateInit('groups_edit', array('group' => 0), $_REQUEST);
$groups =& PommoGroup::get();
$fields =& PommoField::get();
$group =& $groups[$state['group']];
if (empty($group)) {
    Pommo::redirect('subscribers_groups.php');
}
$rules = PommoSQL::sortRules($group['rules']);
$rules['and'] = PommoSQL::sortLogic($rules['and']);
$rules['or'] = PommoSQL::sortLogic($rules['or']);
foreach ($rules as $key => $a) {
    if ($key == 'include' || $key == 'exclude') {
        foreach ($a as $k => $gid) {
            $rules[$key][$k] = $groups[$gid]['name'];
        }
    }
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->assign('returnStr', Pommo::_T('Subscribers Page'));
/** SET PAGE STATE
 * limit	- The Maximum # of subscribers to show per page
 * sort		- The subscriber field to sort by (email, ip, time_registered, time_touched, status, or field_id)
 * order	- Order Type (ascending - ASC /descending - DESC)
 * info		- (hide/show) Time Registered/Updated, IP address
 * 
 * status	- Filter by subscriber status (active, inactive, pending, all)
 * group	- Filter by group members (groupID or 'all')
 */
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& PommoAPI::stateInit('subscribers_manage', array('limit' => 150, 'sort' => $pommo->_default_subscriber_sort, 'order' => 'asc', 'status' => 1, 'group' => 'all', 'page' => 1, 'search' => false), $_REQUEST);
/**********************************
	VALIDATION ROUTINES
*********************************/
if (!is_numeric($state['limit']) || $state['limit'] < 1 || $state['limit'] > 1000) {
    $state['limit'] = 150;
}
if ($state['order'] != 'asc' && $state['order'] != 'desc') {
    $state['order'] = 'asc';
}
if (!is_numeric($state['sort']) && $state['sort'] != 'email' && $state['sort'] != 'ip' && $state['sort'] != 'time_registered' && $state['sort'] != 'time_touched') {
    $state['sort'] = 'email';
}
if (!is_numeric($state['status'])) {
    $state['status'] = 1;
}
Example #30
0
    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)) {
            $json->fail('Unable to spawn background mailer');
        }
        // clear mailing composistion data from session
        PommoAPI::stateReset(array('mailing'));
        $json->add('callbackFunction', 'redirect');
        $json->add('callbackParams', $pommo->_baseUrl . 'admin/mailings/mailing_status.php');
    } else {
        $json->fail(Pommo::_T('Cannot send a mailing to 0 subscribers!'));
    }
    $json->serve();
}
$smarty->assign($state);
$smarty->display('admin/mailings/mailing/preview.tpl');
Pommo::kill();