Beispiel #1
0
 function init($language, $baseDir)
 {
     if (!is_file($baseDir . 'language/' . $language . '/LC_MESSAGES/pommo.mo')) {
         Pommo::kill('Unknown Language (' . $language . ')');
     }
     // if LC_MESSAGES is not available.. make it (helpful for win32)
     if (!defined('LC_MESSAGES')) {
         define('LC_MESSAGES', 6);
     }
     // load gettext emulation layer if PHP is not compiled w/ gettext support
     if (!function_exists('gettext')) {
         Pommo::requireOnce($baseDir . 'inc/lib/gettext/gettext.php');
         Pommo::requireOnce($baseDir . 'inc/lib/gettext/gettext.inc');
     }
     // set the locale
     if (!PommoHelperL10n::_setLocale(LC_MESSAGES, $language, $baseDir)) {
         // *** SYSTEM LOCALE COULD NOT BE USED, USE EMULTATION ****
         Pommo::requireOnce($baseDir . 'inc/lib/gettext/gettext.php');
         Pommo::requireOnce($baseDir . 'inc/lib/gettext/gettext.inc');
         if (!PommoHelperL10n::_setLocaleEmu(LC_MESSAGES, $language, $baseDir)) {
             Pommo::kill('Error setting up language translation!');
         }
     } else {
         // *** SYSTEM LOCALE WAS USED ***
         if (!defined('_poMMo_gettext')) {
             // set gettext environment
             $domain = 'pommo';
             bindtextdomain($domain, $baseDir . 'language');
             textdomain($domain);
             if (function_exists('bind_textdomain_codeset')) {
                 bind_textdomain_codeset($domain, 'UTF-8');
             }
         }
     }
 }
Beispiel #2
0
	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);
    default:
        $json->fail();
        break;
}
$json->success();
 * 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.
 */
/**********************************
	INITIALIZATION METHODS
*********************************/
require '../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
// URL which processes the form input + adds (or warns) subscriber to pending table.
$signup_url = "http://" . $_SERVER['HTTP_HOST'] . $pommo->_baseUrl . "user/process.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Sample form</title>
</head>

<?php 
$form_name = "signup";
Beispiel #4
0
    SmartyValidate::register_validator('admin_email', 'admin_email', 'isEmail', false, false, false, 'users');
    $vMsg = array();
    $vMsg['admin_username'] = Pommo::_T('Cannot be empty.');
    $vMsg['admin_email'] = Pommo::_T('Invalid email address');
    $vMsg['admin_password2'] = Pommo::_T('Passwords must match.');
    $smarty->assign('vMsg', $vMsg);
    // populate _POST with info from database (fills in form values...)
    $dbVals = 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.'));
 function update(&$in, $mode = 'REPLACE_PASSED')
 {
     global $pommo;
     $dbo =& $pommo->_dbo;
     $query = "\n\t\t\tUPDATE " . $dbo->table['subscribers'] . "\n\t\t\tSET\n\t\t\t[email='%S',]\n\t\t\t[time_registered='%S',]\n\t\t\t[ip=INET_ATON('%S'),]\n\t\t\t[status=%I,]\n\t\t\t[flag=%I,]\n\t\t\ttime_touched=CURRENT_TIMESTAMP\n\t\t\tWHERE subscriber_id=%i";
     $query = $dbo->prepare($query, @array($in['email'], $in['registered'], $in['ip'], $in['status'], $in['flag'], $in['id']));
     if (!$dbo->query($query) || $dbo->affected() != 1) {
         return false;
     }
     if (!empty($in['data']) || $mode == 'REPLACE_ALL') {
         switch ($mode) {
             case "REPLACE_ACTIVE":
                 Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
                 $fields = PommoField::get(array('active' => TRUE));
                 $select = array_keys($fields);
                 break;
             case "REPLACE_ALL":
                 $select = NULL;
                 break;
             case "REPLACE_PASSED":
             default:
                 $select = array_keys($in['data']);
                 break;
         }
         $query = "\n\t\t\t\tDELETE\n\t\t\t\tFROM " . $dbo->table['subscriber_data'] . "\n\t\t\t\tWHERE subscriber_id=%i\n\t\t\t\t[AND field_id IN (%C)]";
         $query = $dbo->prepare($query, array($in['id'], $select));
         if (!$dbo->query($query)) {
             return false;
         }
     }
     $values = array();
     foreach ($in['data'] as $field_id => $value) {
         if (!empty($value)) {
             $values[] = $dbo->prepare("(%i,%i,'%s')", array($field_id, $in['id'], $value));
         }
     }
     if (!empty($values)) {
         $query = "\n\t\t\tINSERT INTO " . $dbo->table['subscriber_data'] . "\n\t\t\t(field_id, subscriber_id, value)\n\t\t\tVALUES " . implode(',', $values);
         if (!$dbo->query($query)) {
             return false;
         }
     }
     return true;
 }
 * 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/groups.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.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('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
Beispiel #7
0
     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');
     $logger->addMsg(Pommo::_T('Login Password: '******'installed', TRUE);
 } else {
     // INSTALL FAILED
     $dbo->debug(FALSE);
     // drop existing poMMo tables
     foreach (array_keys($dbo->table) as $key) {
         $table = $dbo->table[$key];
         $sql = 'DROP TABLE IF EXISTS ' . $table;
         $dbo->query($sql);
     }
     $logger->addErr('Installation failed! Enable debbuging to expose the problem.');
Beispiel #8
0
$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');
            break;
        case 'update':
            $messages = PommoHelperMessages::resetDefault('update');
Beispiel #9
0
 function addFieldRule(&$group, &$field, &$logic, &$values, $type = 0)
 {
     global $pommo;
     $dbo =& $pommo->_dbo;
     $type = $type == 'or' ? 1 : 0;
     // remove previous filters
     PommoRules::deleteRule($group, $field, $logic);
     // get the field
     Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
     $field = current(PommoField::get(array('id' => $field)));
     foreach ($values as $value) {
         // if this is a date type field, convert the values from human readable date
         //  strings to timestamps appropriate for matching
         if ($field['type'] == 'date') {
             $value = PommoHelper::timeFromStr($value);
         }
         $v[] = $dbo->prepare("(%i,%i,'%s','%s',%i)", array($group, $field['id'], $logic, $value, $type));
     }
     $query = "\n\t\t\tINSERT INTO " . $dbo->table['group_rules'] . "\n\t\t\t(group_id, field_id, logic, value, type)\n\t\t\tVALUES " . implode(',', $v);
     return $dbo->affected($query);
 }
Beispiel #10
0
 function timeFromStr($str)
 {
     global $pommo;
     if (!defined('ADODB_DATE_VERSION')) {
         // safely load ADODB date library
         Pommo::requireOnce($pommo->_baseDir . 'inc/lib/adodb/adodb-time.inc.php');
     }
     // normalize delimiter
     str_replace('-', '/', $str);
     // Extract Year, Month, and Day from a string like "2007/08/03"
     $a = explode("/", $str);
     // Validate the string
     if (count($a) != 3 || !is_numeric($a[0]) || !is_numeric($a[1]) || !is_numeric($a[2])) {
         return false;
     }
     switch ($pommo->_dateformat) {
         case 1:
             $year = substr($a[0], 0, 4);
             $month = substr($a[1], 0, 2);
             $day = substr($a[2], 0, 2);
             break;
         case 2:
             $year = substr($a[2], 0, 4);
             $month = substr($a[0], 0, 2);
             $day = substr($a[1], 0, 2);
             break;
         case 3:
             $year = substr($a[2], 0, 4);
             $month = substr($a[1], 0, 2);
             $day = substr($a[0], 0, 2);
             break;
         default:
             Pommo::kill('Unknown date_format', TRUE);
     }
     // Y-M-D validation
     if ($month < 1 || $month > 12) {
         return false;
     }
     if ($day < 1 || $day > 31) {
         return false;
     }
     // correction heuristic for short year @ end of century...
     if (strlen($year) == 2) {
         $year = $year < 50 ? '20' . $year : '19' . $year;
     }
     return adodb_mktime(0, 0, 0, $month, $day, $year);
 }
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;
}
<?php

/**
 * Copyright (C) 2005, 2006, 2007, 2008  Brice Burgess <*****@*****.**>
 * 
 * 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.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init();
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/maintenance.php');
echo PommoHelperMaintenance::delDir($pommo->_workDir) ? 'Work Directory Cleared' : 'Unable to Clear Work Directory -- Does it exist?';
Beispiel #13
0
             break;
         case 'is':
         case 'not':
         case 'less':
         case 'greater':
             $values = array_unique($_REQUEST['match']);
             $type = $_REQUEST['type'] == 'or' ? 'or' : 'and';
             PommoRules::addFieldRule($state['group'], $_REQUEST['field'], $_REQUEST['logic'], $values, $type);
             break;
     }
     $json->add('callbackFunction', 'redirect');
     $json->add('callbackParams', $pommo->_baseUrl . 'admin/subscribers/groups_edit.php');
     $json->serve();
     break;
 case 'updateRule':
     Pommo::requireOnce($pommo->_baseDir . 'inc/classes/sql.gen.php');
     $group =& current(PommoGroup::get(array('id' => $state['group'])));
     $rules = PommoSQL::sortRules($group['rules']);
     switch ($_REQUEST['request']) {
         case 'update':
             if ($_REQUEST['type'] == 'or' && count($rules['and']) < 2) {
                 $json->add('callbackFunction', 'resume');
                 $json->success(Pommo::_T('At least 1 "and" rule must exist before an "or" rule takes effect.'));
             }
             PommoRules::changeType($group['id'], $_REQUEST['fieldID'], $_REQUEST['logic'], $_REQUEST['type']);
             break;
         case 'delete':
             PommoRules::deleteRule($group['id'], $_REQUEST['fieldID'], $_REQUEST['logic']);
             break;
     }
     $json->add('callbackFunction', 'redirect');
 *********************************/
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();
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>'));
}
if ($pommo->_config['demo_mode'] == 'on') {
    $logger->addMsg(sprintf(Pommo::_T('%sDemonstration Mode%s is on -- no Emails will actually be sent. This is good for testing settings.'), '<a href="' . $pommo->_baseUrl . 'admin/setup/setup_configure.php#mailings">', '</a>'));
}
// WYSIWYG JavaScript Includes
Pommo::requireOnce($pommo->_baseDir . 'themes/wysiwyg/editors.php');
$editors = new PommoWYSIWYG();
$editor = $editors->loadEditor();
if (!$editor) {
    die('Could not find requested WYSIWYG editor (' . $editor . ') in editors.php');
}
$smarty->assign('wysiwygJS', $editor);
// translation assignments for dialg titles...
$smarty->assign('t_personalization', Pommo::_T('Personalization'));
$smarty->assign('t_testMailing', Pommo::_T('Test Mailing'));
$smarty->assign('t_saveTemplate', Pommo::_T('Save Template'));
$smarty->display('admin/mailings/mailings_start.tpl');
Pommo::kill();
$current = PommoMailing::isCurrent();
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('email', 'email', 'isEmail', false, false, 'trim');
    $vMsg = array();
    $vMsg['email'] = Pommo::_T('Invalid email address');
    $smarty->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST) && !$current) {
        // __ FORM IS VALID
        Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/validate.php');
        // get a copy of the message state
        // composition is valid (via preview.php)
        $state = $pommo->_session['state']['mailing'];
        // create temp subscriber
        $subscriber = array('email' => $_POST['email'], 'registered' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'status' => 0, 'data' => $_POST['d']);
        PommoValidate::subscriberData($subscriber['data'], array('active' => FALSE, 'ignore' => TRUE, 'log' => false));
        $key = PommoSubscriber::add($subscriber);
        if (!$key) {
            $logger->addErr('Unable to Add Subscriber');
        } else {
            // temp subscriber created
            $state['tally'] = 1;
            $state['group'] = Pommo::_T('Test Mailing');
            if ($state['ishtml'] == 'off') {
                $state['body'] = $state['altbody'];
Beispiel #16
0
 function prepareForSubscribeForm()
 {
     global $pommo;
     $dbo =& $pommo->_dbo;
     Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
     // Get array of fields. Key is ID, value is an array of the demo's info
     $fields = PommoField::get(array('active' => TRUE, 'byName' => FALSE));
     if (!empty($fields)) {
         $this->assign('fields', $fields);
     }
     foreach ($fields as $field) {
         if ($field['type'] == 'date') {
             $this->assign('datePicker', TRUE);
         }
     }
     // process.php appends serialized values to _GET['input']
     // TODO --> look into this behavior... necessary?
     if (isset($_GET['input'])) {
         $this->assign(unserialize($_GET['input']));
     } elseif (isset($_GET['Email'])) {
         $this->assign(array('Email' => $_GET['Email']));
     }
     $this->assign($_POST);
 }
Beispiel #17
0
 function kill($msg = NULL, $backtrace = FALSE)
 {
     global $pommo;
     // output passed message
     if ($msg || !ob_get_length()) {
         if (empty($pommo->_workDir)) {
             echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">';
             echo '<title>poMMo - Erreur</title>';
             // Very basics added for valid output
             echo '<div><img src="' . $pommo->_baseUrl . 'themes/shared/images/icons/alert.png" alt="alert icon" style="vertical-align: middle; margin-right: 20px;"/> ' . $msg . '</div>';
         } else {
             $logger =& $pommo->_logger;
             $logger->addErr($msg);
             Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
             $smarty = new PommoTemplate();
             $smarty->assign('fatalMsg', TRUE);
             $smarty->display('message.tpl');
         }
     }
     // output debugging info if enabled (in config.php)
     if ($pommo->_debug) {
         if (is_object($pommo)) {
             Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/debug.php');
             $debug = new PommoHelperDebug();
             $debug->bmDebug();
         }
     }
     if ($backtrace) {
         $backtrace = debug_backtrace();
         echo @'<h2>BACKTRACE</h2>' . '<p>' . @str_ireplace($pommo->_baseDir, '', $backtrace[1]['file']) . ':' . $backtrace[1]['line'] . ' ' . $backtrace[1]['function'] . '()</p>' . '<p>' . @str_ireplace($pommo->_baseDir, '', $backtrace[2]['file']) . ' ' . $backtrace[2]['function'] . '()</p>' . '<p>' . @str_ireplace($pommo->_baseDir, '', $backtrace[3]['file']) . ' ' . $backtrace[3]['function'] . '()</p>';
     }
     // print and clear output buffer
     ob_end_flush();
     // kill script
     die;
 }
 * 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.
 */
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();
Beispiel #19
0
 * 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.
 */
// Clears the entire database, resets auto increment values
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init();
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/install.php');
$dbo =& $pommo->_dbo;
// reset DB
foreach ($dbo->table as $id => $table) {
    if ($id == 'config' || $id == 'updates' || $id == 'group_criteria' || $id == 'templates' || $id == 'subscriber_update') {
        continue;
    }
    $query = "DELETE FROM " . $table;
    if (!$dbo->query($query)) {
        die('ERREUR &agrave; la suppression de ' . $id);
    }
    $query = "ALTER TABLE " . $table . " AUTO_INCREMENT = 1";
    if (!$dbo->query($query)) {
        die('ERREUR au param&eacute;trage de AUTO_INCREMENT sur ' . $id);
    }
}
 * 
 * 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.
 */
require '../../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
$map = array('sent' => 1, 'unsent' => 0, 'error' => 2);
$nameMap = array(0 => 'Unsent_Subscribers', 1 => 'Sent_Subscribers', 2 => 'Failed_Subscribers');
$i = isset($map[$_GET['type']]) ? $map[$_GET['type']] : false;
if ($i === false) {
    die;
}
$query = "\n\tSELECT s.email \n\tFROM " . $dbo->table['subscribers'] . " s\n\tJOIN " . $dbo->table['queue'] . " q ON (s.subscriber_id = q.subscriber_id)\n\tWHERE q.status = %i";
$query = $dbo->prepare($query, array($i));
$emails = $dbo->getAll($query, 'assoc', 'email');
$o = '';
foreach ($emails as $e) {
    $o .= "{$e}\r\n";
/**********************************
 * 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
// personalizations are cached in session
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalize.php');
// require once here so that mailer can use
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalizetitle.php');
// require once here so that mailer can use
if (!isset($pommo->_session['personalization'])) {
    $pommo->_session['personalization'] = FALSE;
    $matches1 = array();
    $matches2 = array();
    $matches3 = array();
    preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['body'], $matches1);
    preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['altbody'], $matches2);
    preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['subject'], $matches3);
    if (!empty($matches1) || !empty($matches2) || !empty($matches3)) {
        $pommo->_session['personalization'] = TRUE;
    }
    // cache personalizations in session
    if ($pommo->_session['personalization']) {
        $pommo->_session['personalization_body'] = PommoHelperPersonalize::search($mailing->_mailing['body']);
 * 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
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init();
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
echo 'Merci de patienter quelques secondes...';
ob_flush();
flush();
$code = PommoHelper::makeCode();
if (!PommoMailCtl::spawn($pommo->_baseUrl . 'support/tests/mailing.test2.php?code=' . $code, true)) {
    Pommo::kill('Echec du d&eacute;clenchement du m&eacute;canisme. Vous devez corriger ce probl&egrave;me pour que poMMo puisse envoyer des e-mails.');
}
sleep(6);
if (!is_file($pommo->_workDir . '/mailing.test.php')) {
    // make sure we can write to the file
    if (!($handle = fopen($pommo->_workDir . '/mailing.test.php', 'w'))) {
        die('Impossible d\'&eacute;crire dans le fichier de test.');
    }
    fclose($handle);
    unlink($pommo->_workDir . '/mailing.test.php');
Beispiel #23
0
 function notify(&$notices, &$sub, $type, $comments = false)
 {
     global $pommo;
     Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailer.php');
     $mails = PommoHelper::trimArray(explode(',', $notices['email']));
     if (empty($mails[0])) {
         $mails = array($pommo->_config['admin_email']);
     }
     $subject = $notices['subject'] . ' ';
     $body = sprintf(Pommo::_T('poMMo %s Notice'), $type);
     $body .= "  [" . date("F j, Y, g:i a") . "]\n\n";
     $body .= "EMAIL: " . $sub['email'] . "\n";
     $body .= "IP: " . $sub['ip'] . "\n";
     $body .= "REGISTERED: " . $sub['registered'] . "\n\n";
     if ($comments) {
         $body .= "COMMENTS: {$comments} \n\n";
     }
     $body .= "DATA:\n";
     Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
     $fields = PommoField::getNames();
     foreach ($sub['data'] as $fid => $v) {
         $body .= "\t" . $fields[$fid] . ": {$v}\n";
     }
     switch ($type) {
         case 'subscribe':
             $subject .= Pommo::_T('new subscriber!');
             break;
         case 'unsubscribe':
             $subject .= Pommo::_T('user unsubscribed.');
             break;
         case 'pending':
             $subject .= Pommo::_T('new pending!');
             break;
         case 'update':
             $subject .= Pommo::_T('subscriber updated.');
             break;
     }
     $mail = new PommoMailer();
     // allow mail to be sent, even if demo mode is on
     $mail->toggleDemoMode("off");
     // send the confirmation mail
     $mail->prepareMail($subject, $body);
     foreach ($mails as $to) {
         $mail->bmSendmail($to);
     }
     // reset demo mode to default
     $mail->toggleDemoMode();
     return;
 }