本文整理汇总了PHP中Pommo::requireOnce方法的典型用法代码示例。如果您正苦于以下问题:PHP Pommo::requireOnce方法的具体用法?PHP Pommo::requireOnce怎么用?PHP Pommo::requireOnce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pommo
的用法示例。
在下文中一共展示了Pommo::requireOnce方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
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');
}
}
}
}
示例2: PommoJSON
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();
示例3:
* 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";
示例4: array
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.'));
示例5: update
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;
}
示例6: PommoTemplate
* 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
示例7: PommoUpgrade
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: ') . $pass);
$smarty->assign('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.');
示例8: PommoTemplate
$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');
示例9: addFieldRule
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);
}
示例10: timeFromStr
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);
}
示例11: PommoRevUpgrade
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")) {
//.........这里部分代码省略.........
示例12: define
<?php
/**
* Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <bhb@iceburg.net>
*
* 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?';
示例13: array_unique
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');
示例14: PommoTemplate
*********************************/
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();
示例15: array
$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'];