Holds Configuration values, authentication state, etc (revived from session)
Ejemplo n.º 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')) {
         require_once $baseDir . 'lib/gettext/gettext.php';
         require_once $baseDir . 'lib/gettext/gettext.inc';
     }
     // set the locale
     if (!Pommo_Helper_L10n::_setLocale(LC_MESSAGES, $language, $baseDir)) {
         // *** SYSTEM LOCALE COULD NOT BE USED, USE EMULTATION ****
         require_once $baseDir . 'lib/gettext/gettext.php';
         require_once $baseDir . 'lib/gettext/gettext.inc';
         if (!Pommo_Helper_L10n::_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');
             }
         }
     }
 }
Ejemplo n.º 2
0
 function memorizeBaseURL()
 {
     if (!($handle = fopen(Pommo::$_workDir . '/maintenance.php', 'w'))) {
         Pommo::kill('Unable to prepare maintenance.php for writing');
     }
     $fileContent = "<?php die(); ?>\n[baseURL] = \"Pommo::{$_baseUrl}\"\n";
     if (!fwrite($handle, $fileContent)) {
         Pommo::kill('Unable to perform maintenance');
     }
     fclose($handle);
 }
Ejemplo n.º 3
0
 function __construct($toggleEscaping = true)
 {
     if ($toggleEscaping) {
         Pommo::logErrors();
         // PHP Errors are logged, turns display_errors off.
         Pommo::toggleEscaping();
         // Wraps _T and logger responses with htmlspecialchars()
     }
     $this->_output = array('success' => false, 'messages' => array(), 'errors' => array());
     $this->_successMsg = $this->_failMsg = false;
 }
Ejemplo n.º 4
0
 function __construct($args = array())
 {
     $defaults = array('username' => null, 'requiredLevel' => 0);
     $p = Pommo_Api::getParams($defaults, $args);
     if (empty(Pommo::$_session['username'])) {
         Pommo::$_session['username'] = $p['username'];
     }
     $this->_username =& Pommo::$_session['username'];
     $this->_permissionLevel = $this->getPermissionLevel($this->_username);
     if ($p['requiredLevel'] > $this->_permissionLevel) {
         Pommo::kill(sprintf(Pommo::_T('Denied access. You must %slogin%s to' . ' access this page...'), '<a href="' . Pommo::$_baseUrl . 'index.php?referer=' . $_SERVER['PHP_SELF'] . '">', '</a>'));
     }
 }
Ejemplo n.º 5
0
 function validate(&$in)
 {
     global $pommo;
     $invalid = array();
     if (empty($in['name'])) {
         $invalid[] = 'name';
     }
     if (empty($in['body']) && empty($in['altbody'])) {
         $invalid[] = Pommo::_T('Both HTML and Text cannot be empty');
     }
     if (!empty($invalid)) {
         Pommo::$_logger->addErr(implode(',', $invalid), 3);
         return false;
     }
     return true;
 }
Ejemplo n.º 6
0
 function PommoGroup($groupID = NULL, $status = 1, $filter = FALSE)
 {
     $this->_status = $status;
     if (!is_numeric($groupID)) {
         // exception if no group ID was passed -- group assumes "all subscribers".
         $GLOBALS['pommo']->requireOnce($GLOBALS['pommo']->_baseDir . 'inc/helpers/subscribers.php');
         $this->_group = array('rules' => array(), 'id' => 0);
         $this->_id = 0;
         $this->_name = Pommo::_T('All Subscribers');
         $this->_memberIDs = is_array($filter) ? PommoGroup::getMemberIDs($this->_group, $status, $filter) : null;
         $this->_tally = is_array($filter) ? count($this->_memberIDs) : PommoSubscriber::tally($status);
         return;
     }
     $this->_group = current(PommoGroup::get(array('id' => $groupID)));
     $this->_id = $groupID;
     $this->_name =& $this->_group['name'];
     $this->_memberIDs = PommoGroup::getMemberIDs($this->_group, $status, $filter);
     $this->_tally = count($this->_memberIDs);
     return;
 }
Ejemplo n.º 7
0
 function __construct($groupID = NULL, $status = 1, $filter = FALSE)
 {
     $this->_status = $status;
     if (!is_numeric($groupID)) {
         // exception if no group ID was passed -- group assumes "all subscribers".
         require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
         $this->_group = array('rules' => array(), 'id' => 0);
         $this->_id = 0;
         $this->_name = Pommo::_T('All Subscribers');
         $this->_memberIDs = is_array($filter) ? Pommo_Groups::getMemberIDs($this->_group, $status, $filter) : null;
         $this->_tally = is_array($filter) ? count($this->_memberIDs) : Pommo_Subscribers::tally($status);
         return;
     }
     $this->_group = current(Pommo_Groups::get(array('id' => $groupID)));
     $this->_id = $groupID;
     $this->_name =& $this->_group['name'];
     $this->_memberIDs = Pommo_Groups::getMemberIDs($this->_group, $status, $filter);
     $this->_tally = count($this->_memberIDs);
     return;
 }
Ejemplo n.º 8
0
    function display($resource_name)
    {
        // attempt to load the theme's requested template
        if (!is_file($this->template_dir . '/' . $resource_name)) {
            // template file not existant in theme, fallback to "default" theme
            if (!is_file($this->_themeDir . 'default/' . $resource_name)) {
                // requested template file does not exist in "default" theme, die.
                Pommo::kill(sprintf(Pommo::_T('Template file (%s) not found in
						default or current theme'), $resource_name));
            } else {
                $resource_name = $this->_themeDir . 'default/' . $resource_name;
                $this->template_dir = $this->_themeDir . 'default';
            }
        }
        if (Pommo::$_logger->isMsg()) {
            $this->assign('messages', Pommo::$_logger->getMsg());
        }
        if (Pommo::$_logger->isErr()) {
            $this->assign('errors', Pommo::$_logger->getErr());
        }
        return parent::display($resource_name);
    }
Ejemplo n.º 9
0
/**********************************
	INITIALIZATION METHODS
 *********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
if (Pommo_Mailing::isCurrent()) {
    Pommo::kill(sprintf(Pommo::_T('A Mailing is currently processing. Visit the' . ' %sStatus%s page to check its progress.'), '<a href="mailing_status.php">', '</a>'));
}
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 . 'setup_configure.php#mailings">', '</a>'));
}
require_once 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');
}
$view->assign('wysiwygJS', $editor);
// translation assignments for dialg titles...
$view->assign('t_personalization', Pommo::_T('Personalization'));
$view->assign('t_testMailing', Pommo::_T('Test Mailing'));
$view->assign('t_saveTemplate', Pommo::_T('Save Template'));
$view->display('admin/mailings/mailings_start');
Ejemplo n.º 10
0
}
// ====== 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') . '"';
    if (!empty($_POST['registered'])) {
        $o .= ',"' . Pommo::_T('Date Registered') . '"';
    }
    if (!empty($_POST['ip'])) {
        $o .= ',"' . Pommo::_T('IP Address') . '"';
    }
    foreach ($fields as $f) {
        $o .= ",\"{$f['name']}\"";
    }
    $o .= "\r\n";
    function csvWrap(&$in)
    {
        $in = '"' . addslashes($in) . '"';
        return;
    }
    foreach ($subscribers as $sub) {
        $d = array();
        // normalize field order in export
        foreach (array_keys($fields) as $id) {
            if (array_key_exists($id, $sub['data'])) {
Ejemplo n.º 11
0
 * 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.
 */
//	TODO: Check that magic quotes is turned off
// 	While poMMo is in development state, we'll attempt to display PHP notices,
//	warnings, errors
ini_set('display_errors', '1');
//error_reporting(E_ALL); // [DEVELOPMENT]
error_reporting(E_ALL ^ E_NOTICE);
// [RELEASE]
// 	Include core components
require 'classes/Pommo_Helper.php';
require 'classes/Pommo_Api.php';
require 'classes/Pommo.php';
//	Instantiate pommo
Pommo::preinit(dirname(__FILE__) . '/');
Ejemplo n.º 12
0
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$emails = Pommo::get('emails');
$dupes = Pommo::get('dupes');
$fields = Pommo_Fields::get();
$flag = FALSE;
foreach ($fields as $field) {
    if ($field['required'] == 'on') {
        $flag = TRUE;
    }
}
if (isset($_GET['continue'])) {
    foreach ($emails as $email) {
        $subscriber = array('email' => $email, 'registered' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'status' => 1, 'data' => array());
        if ($flag) {
            $subscriber['flag'] = 9;
        }
        if (!Pommo_Subscribers::add($subscriber)) {
            die('Error importing subscriber');
        }
    }
    sleep(1);
    die(Pommo::_T('Complete!') . ' <a href="subscribers_import.php">' . Pommo::_T('Return to') . ' ' . Pommo::_T('Import') . '</a>');
}
$view->assign('flag', $flag);
$view->assign('tally', count($emails));
$view->assign('dupes', $dupes);
$view->display('admin/subscribers/import_txt');
Ejemplo n.º 13
0
<?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.
 */
require '../bootstrap.php';
Pommo::redirect('login.php');
Ejemplo n.º 14
0
    $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;
}
if (!is_numeric($state['group']) && $state['group'] != 'all') {
    $state['group'] = 'all';
}
if (isset($_REQUEST['searchClear'])) {
    $state['search'] = false;
} elseif (isset($_REQUEST['searchField']) && (is_numeric($_REQUEST['searchField']) || $_REQUEST['searchField'] == 'email' || $_REQUEST['searchField'] == 'ip' || $_REQUEST['searchField'] == 'time_registered' || $_REQUEST['searchField'] == 'time_touched')) {
    $_REQUEST['searchString'] = trim($_REQUEST['searchString']);
    $state['search'] = empty($_REQUEST['searchString']) ? false : array('field' => $_REQUEST['searchField'], 'string' => trim($_REQUEST['searchString']));
}
/**********************************
	DISPLAY METHODS
*********************************/
// Get the *empty* group [no member IDs. 3rd arg is set TRUE]
$group = new PommoGroup($state['group'], $state['status'], $state['search']);
// Calculate and Remember number of pages for this group/status combo
$state['pages'] = is_numeric($group->_tally) && $group->_tally > 0 ? ceil($group->_tally / $state['limit']) : 0;
$smarty->assign('state', $state);
$smarty->assign('tally', $group->_tally);
$smarty->assign('groups', PommoGroup::get());
$smarty->assign('fields', PommoField::get());
$smarty->display('admin/subscribers/subscribers_manage.tpl');
Pommo::kill();
Ejemplo n.º 15
0
 * 
 * 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';
require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
// Remember the Page State
$state = Pommo_Api::stateInit('subscribers_manage');
// Fetch group + member IDs
$group = new Pommo_Groups($state['group'], $state['status'], $state['search']);
/**********************************
	JSON OUTPUT INITIALIZATION
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
/**********************************
	PAGINATION AND ORDERING
*********************************/
// Get and Remember the requested number of rows
Ejemplo n.º 16
0
        $field = current(PommoField::get(array('id' => $_REQUEST['field_id'])));
        if ($field['id'] != $_REQUEST['field_id']) {
            die('bad field ID');
        }
        $affected = PommoField::subscribersAffected($field['id'], $_REQUEST['options']);
        if (count($affected) > 0 && empty($_REQUEST['confirmed'])) {
            $msg = sprintf(Pommo::_T('Deleting option %1$s will affect %2$s subscribers who have selected this choice. They will be flagged as needing to update their records.'), '<b>' . $_REQUEST['options'] . '</b>', '<em>' . count($affected) . '</em>');
            $msg .= "\n " . Pommo::_T('Are you sure?');
            $json->add('callbackFunction', 'confirm');
            $json->add('callbackParams', $msg);
            $json->serve();
        } else {
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
            $options = PommoField::optionDel($field, $_REQUEST['options']);
            if (!options) {
                $json->fail(Pommo::_T('Error with deletion.'));
            }
            // flag subscribers for update
            if (count($affected) > 0) {
                PommoSubscriber::flagByID($affected);
            }
            $json->add('callbackFunction', 'updateOptions');
            $json->add('callbackParams', $options);
            $json->serve();
        }
        break;
    default:
        die('invalid request passed to ' . __FILE__);
        break;
}
die;
Ejemplo n.º 17
0
        $mailing = current(Pommo_Mailing::get(array('id' => $_REQUEST['mailings'])));
        // change group name to ID
        $groups = Pommo_Groups::getNames();
        $gid = 'all';
        foreach ($groups as $group) {
            if ($group['name'] == $mailing['group']) {
                $gid = $group['id'];
            }
        }
        Pommo_Api::stateReset(array('mailing'));
        // if this is a plain text mailing, switch body + altbody.
        if ($mailing['ishtml'] == 'off') {
            $mailing['altbody'] = $mailing['body'];
            $mailing['body'] = null;
        }
        // Initialize page state with default values overriden by those held in $_REQUEST
        $state =& Pommo_Api::stateInit('mailing', array('fromname' => $mailing['fromname'], 'fromemail' => $mailing['fromemail'], 'frombounce' => $mailing['frombounce'], 'list_charset' => $mailing['charset'], 'mailgroup' => $gid, 'subject' => $mailing['subject'], 'body' => $mailing['body'], 'altbody' => $mailing['altbody']));
        Pommo::redirect(Pommo::$_baseUrl . 'mailings_start.php');
        break;
    case 'delete':
        $deleted = Pommo_Mailing::delete($mailingIDS);
        $logger->addMsg(Pommo::_T('Please Wait') . '...');
        $params = $json->encode(array('ids' => $mailingIDS));
        $view->assign('callbackFunction', 'deleteMailing');
        $view->assign('callbackParams', $params);
        break;
    default:
        $logger->AddErr('invalid call');
        break;
}
$view->display('admin/rpc');
Ejemplo n.º 18
0
 * 
 * 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";
Ejemplo n.º 19
0
 *  (at your option) 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 Pommo.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *  This fork is from https://github.com/soonick/poMMo
 *  Please see docs/contribs for Contributors
 *
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
if (Pommo_Mailing::isCurrent()) {
    Pommo::kill(sprintf(Pommo::_T('A Mailing is currently processing. Visit the' . ' %sStatus%s page to check its progress.'), '<a href="mailing_status.php">', '</a>'));
}
$view->display('admin/mailings/admin_mailings');
Ejemplo n.º 20
0
 * You should have received a copy of the GNU General Public License
 * along with program; see the file docs/LICENSE. If not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/**********************************
	INITIALIZATION METHODS
 *********************************/
define('_poMMo_support', TRUE);
require '../../bootstrap.php';
$pommo->init(array('install' => TRUE));
$logger =& $pommo->_logger;
// start error logging
$pommo->logErrors();
// ignore user abort
ignore_user_abort(true);
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
$code = empty($_GET['code']) ? null : $_GET['code'];
$spawn = !isset($_GET['spawn']) ? 0 : $_GET['spawn'] + 1;
trigger_error('Testing Log, Spawn #' . $spawn);
$fileContent = "<?php die(); ?>\n[code] = {$code}\n[spawn] = {$spawn}\n";
if (!($handle = fopen($pommo->_workDir . '/mailing.test.php', 'w'))) {
    die('Impossible d\'&eacute;crire dans le fichier de test');
}
if (fwrite($handle, $fileContent) === FALSE) {
    die('Impossible d\'&eacute;crire dans le fichier de test');
}
fclose($handle);
if ($spawn > 0) {
    die;
}
sleep(1);
Ejemplo n.º 21
0
 function subscriberData(&$in, $p = array())
 {
     $defaults = array('prune' => true, 'active' => true, 'log' => true, 'ignore' => false, 'ignoreInactive' => true, 'skipReq' => false);
     $p = Pommo_Api::getParams($defaults, $p);
     require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
     $logger = Pommo::$_logger;
     $fields = Pommo_Fields::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] = Pommo_Helper::timeToStr($in[$id]);
                 }
                 $in[$id] = Pommo_Helper::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 (' . Pommo_Helper::timeGetFormat() . ').'), $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 = Pommo_Helper::arrayIntersect($in, $fields);
     }
     return $valid;
 }
Ejemplo n.º 22
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();
Ejemplo n.º 23
0
$notices = unserialize($config['notices']);
if (Pommo_Pending::perform($pending)) {
    require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
    // get subscriber info
    require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
    $subscriber = current(Pommo_Subscribers::get(array('id' => $pending['subscriber_id'])));
    switch ($pending['type']) {
        case "add":
            // send/print welcome message
            Pommo_Helper_Messages::sendMessage(array('to' => $subscriber['email'], 'type' => 'subscribe'));
            if (isset($notices['subscribe']) && $notices['subscribe'] == 'on') {
                Pommo_Helper_Messages::notify($notices, $subscriber, 'subscribe');
            }
            if (!empty($config['site_success'])) {
                Pommo::redirect($config['site_success']);
            }
            break;
        case "change":
            if (isset($notices['update']) && $notices['update'] == 'on') {
                Pommo_Helper_Messages::notify($notices, $subscriber, 'update');
            }
            $logger->addMsg(Pommo::_T('Your records have been updated.'));
            break;
        case "password":
            break;
        default:
            $logger->addMsg('Unknown Pending Type.');
            break;
    }
}
$view->display('user/confirm');
Ejemplo n.º 24
0
<?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.
 */
require '../bootstrap.php';
Pommo::redirect('/index.php');
Ejemplo n.º 25
0
                echo "<input type=\"text\" name=\"d[" . $field_id . "]\" id=\"field" . $field_id . "\" maxlength=\"60\" />\r\n";
            } else {
                echo "<input type=\"text\" name=\"d[" . $field_id . "]\" maxlength=\"60\" value=\"" . htmlspecialchars($field['normally']) . "\" />\r\n";
            }
            break;
        default:
            break;
    }
    echo "</div>\r\n\r\n";
}
?>
</fieldset>

<div id="buttons">

<!--  *** DO NOT CHANGE name="pommo_signup" ! ***
	  If you'd like to change the button text change the "value=" text. -->
	  
<input type="hidden" name="pommo_signup" value="true" />
<input type="submit" value="<?php 
echo Pommo::_T('Subscribe');
?>
" />

</div>

</form>

</body>
</html>
Ejemplo n.º 26
0
 * 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(array('install' => TRUE));
$logger =& Pommo::$_logger;
// start error logging
Pommo::logErrors();
// ignore user abort
ignore_user_abort(true);
require_once Pommo::$_baseDir . 'classes/Pommo_Mail_Ctl.php';
$code = empty($_GET['code']) ? null : $_GET['code'];
$spawn = !isset($_GET['spawn']) ? 0 : $_GET['spawn'] + 1;
trigger_error('Testing Log, Spawn #' . $spawn);
$fileContent = "<?php die(); ?>\n[code] = {$code}\n[spawn] = {$spawn}\n";
if (!($handle = fopen(Pommo::$_workDir . '/mailing.test.php', 'w'))) {
    die('Unable to write to test file');
}
if (fwrite($handle, $fileContent) === FALSE) {
    die('Unable to write to test file');
}
fclose($handle);
if ($spawn > 0) {
Ejemplo n.º 27
0
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');
    Pommo::kill('Echec du d&eacute;clenchement du m&eacute;canisme (probl&egrave;me d\'&eacute;criture au niveau du fichier de test). Vous devez corriger ce probl&egrave;me pour que poMMo puisse envoyer des e-mails.');
}
$o = PommoHelper::parseConfig($pommo->_workDir . '/mailing.test.php');
unlink($pommo->_workDir . '/mailing.test.php') or die('impossible de supprimer mailing.test.php');
if (isset($o['error'])) {
    Pommo::kill('UNE ERREUR A ETE TROUVEE. MERCI DE VERIFIER LE RESULTAT DE \'MAILING_TEST\' DANS LE REPERTOIRE DE TRAVAIL');
}
if (!isset($o['code']) || $o['code'] != $code) {
    Pommo::kill('Le test a &eacute;chou&eacute;. Certains codes ne correspondent pas.');
}
if (!isset($o['spawn']) || $o['spawn'] == 0) {
    Pommo::kill('D&eacute;clenchement r&eacute;ussi mais &eacute;chec des envois &agrave; r&eacute;p&eacute;tition.');
}
Pommo::kill('D&eacute;clenchement r&eacute;ussi. Envois &agrave; r&eacute;p&eacute;tition r&eacute;ussis. La fonction d\'envoi massif est op&eacute;rationnelle.');
Ejemplo n.º 28
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);
 }
Ejemplo n.º 29
0
    $validator->setPost($_POST);
    $validator->addData('list_name', 'Other', false);
    $validator->addData('site_name', 'Other', false);
    $validator->addData('site_url', 'Url', false);
    $validator->addData('site_success', 'Url', true);
    $validator->addData('site_confirm', 'Url', true);
    $validator->addData('list_confirm', 'matchRegex', false, '!^(on|off)$!');
    $validator->addData('list_exchanger', 'matchRegex', false, '!^(sendmail|mail|smtp)$!');
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if ($result = $validator->checkData()) {
        // __ FORM IS VALID
        Pommo_Api::configUpdate($_POST);
        Pommo::reloadConfig();
        $json->success(Pommo::_T('Configuration Updated.'));
    } else {
        // __ FORM NOT VALID
        $fieldErrors = array();
        $errors = $validator->getErrors();
        foreach ($errors as $key => $val) {
            $fieldErrors[] = array('field' => $key, 'message' => $val);
        }
        $json->add('fieldErrors', $fieldErrors);
        $json->fail(Pommo::_T('Please review and correct errors with your submission.'));
    }
}
$view->assign($_POST);
$view->display('admin/setup/config/general');
Ejemplo n.º 30
0
    // make sure we can write to the file
    if (!($handle = fopen(Pommo::$_workDir . '/mailing.test.php', 'w'))) {
        Pommo::kill('Unable to write to test file!');
    }
    fclose($handle);
    unlink(Pommo::$_workDir . '/mailing.test.php');
    Pommo::kill('Initial Spawn Failed (test file not written to)! Test the mail processor.');
}
$die = false;
$time = 0;
while (!$die) {
    sleep(10);
    $o = Pommo_Helper::parseConfig(Pommo::$_workDir . '/mailing.test.php');
    if (!isset($o['code']) || $o['code'] != $code) {
        unlink(Pommo::$_workDir . '/mailing.test.php');
        Pommo::kill('Spawning Failed. Codes did not match.');
    }
    if (!isset($o['time']) || $time >= $o['time'] || $o['time'] == 90) {
        $die = true;
    }
    $time = $o['time'];
    echo "{$time} seconds <br />";
    ob_flush();
    flush();
}
unlink(Pommo::$_workDir . '/mailing.test.php');
if ($time == 90) {
    Pommo::kill('SUCCESS');
}
Pommo::kill('FAILED -- Your webserver or a 3rd party tool is force terminating PHP. Mailings may freeze. If you are having problems with frozen mailings, try setting the Mailing Runtime Value to ' . ($time - 10) . ' or below');