本文整理汇总了PHP中Pommo_Template::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Pommo_Template::assign方法的具体用法?PHP Pommo_Template::assign怎么用?PHP Pommo_Template::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pommo_Template
的用法示例。
在下文中一共展示了Pommo_Template::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: current
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// add field if requested, redirect to its edit page on success
if (!empty($_POST['field_name'])) {
$field = Pommo_Fields::make(array('name' => $_POST['field_name'], 'type' => $_POST['field_type'], 'prompt' => 'Field Prompt', 'required' => 'off', 'active' => 'off'));
$id = Pommo_Fields::add($field);
if ($id) {
$view->assign('added', $id);
} else {
$logger->addMsg(Pommo::_T('Error with addition.'));
}
}
// check for a deletion request
if (!empty($_GET['delete'])) {
$field = Pommo_Fields::get(array('id' => $_GET['field_id']));
$field =& current($field);
if (count($field) === 0) {
$logger->addMsg(Pommo::_T('Error with deletion.'));
} else {
$affected = Pommo_Fields::subscribersAffected($field['id']);
if (count($affected) > 0 && empty($_GET['dVal-force'])) {
$view->assign('confirm', array('title' => Pommo::_T('Confirm Action'), 'nourl' => $_SERVER['PHP_SELF'] . '?field_id=' . $_GET['field_id'], 'yesurl' => $_SERVER['PHP_SELF'] . '?field_id=' . $_GET['field_id'] . '&delete=TRUE&dVal-force=TRUE', 'msg' => sprintf(Pommo::_T('Currently, %1$s subscribers have a non empty value for %2$s. All Subscriber data relating to this field will be lost.'), '<b>' . count($affected) . '</b>', '<b>' . $field['name'] . '</b>')));
$view->display('admin/confirm');
示例2:
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (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';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
@($status = is_numeric($_REQUEST['status']) ? $_REQUEST['status'] : 1);
$view->assign('status', $status);
$view->display('admin/subscribers/ajax/subscriber_del');
示例3: current
$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');
示例4: current
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// validate field ID
$field = current(Pommo_Fields::get(array('id' => $_REQUEST['field_id'])));
if ($field['id'] != $_REQUEST['field_id']) {
die('bad field ID');
}
if (empty($_POST)) {
$vMsg = array();
$vMsg['field_name'] = $vMsg['field_prompt'] = Pommo::_T('Cannot be empty.');
$view->assign('vMsg', $vMsg);
} else {
// ___ USER HAS SENT FORM ___
/**********************************
JSON OUTPUT INITIALIZATION
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
$validator = new Pommo_Validate();
$validator->setPost($_POST);
$validator->addData('field_name', 'Other', false);
$validator->addData('field_prompt', 'Other', false);
$validator->addData('field_required', 'matchRegex', false, '!^(on|off)$!');
$validator->addData('field_active', 'matchRegex', false, '!^(on|off)$!');
if ($result = $validator->checkData()) {
示例5: elseif
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
/**********************************
JSON OUTPUT INITIALIZATION
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
$json = new Pommo_Json();
$success = false;
if (isset($_POST['skip']) || isset($_POST['template']) && !is_numeric($_POST['template'])) {
$success = true;
} elseif (isset($_POST['load'])) {
$template = current(Pommo_Mailing_Template::get(array('id' => $_POST['template'])));
Pommo::$_session['state']['mailing']['body'] = $template['body'];
Pommo::$_session['state']['mailing']['altbody'] = $template['altbody'];
$success = true;
} elseif (isset($_POST['delete'])) {
$msg = Pommo_Mailing_Template::delete($_POST['template']) ? Pommo::_T('Template Deleted') : Pommo::_T('Error with deletion.');
$json->add('callbackFunction', 'deleteTemplate');
$json->add('callbackParams', array('id' => $_POST['template'], 'msg' => $msg));
} else {
$view->assign('templates', Pommo_Mailing_Template::getNames());
$view->display('admin/mailings/mailing/templates');
Pommo::kill();
}
$json->serve($success);
示例6: urlencode
require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
Pommo::init(array('authLevel' => 0, 'noSession' => true));
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
// attempt to detect if referer was set
// TODO; enable HTTP_REFERER after stripping out ?input= tags. These will continually repeat
//$referer = (!empty($_POST['bmReferer'])) ? $_POST['bmReferer'] : $_SERVER['HTTP_REFERER'];
$referer = !empty($_POST['bmReferer']) ? $_POST['bmReferer'] : Pommo::$_http . Pommo::$_baseUrl . 'subscribe.php';
// append stored input
$smarty->assign('referer', $referer . '?input=' . urlencode(serialize($_POST)));
/**********************************
VALIDATE INPUT
*********************************/
if (empty($_POST['pommo_signup'])) {
Pommo::redirect('login.php');
}
$subscriber = array('email' => $_POST['Email'], 'registered' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'status' => 1, 'data' => @$_POST['d']);
// ** check for correct email syntax
if (!Pommo_Helper::isEmail($subscriber['email'])) {
$logger->addErr(Pommo::_T('Invalid Email Address'));
}
// ** check if email already exists in DB ("duplicates are bad..")
if (Pommo_Helper::isDupe($subscriber['email'])) {
$logger->addErr(Pommo::_T('Email address already exists. Duplicates are not allowed.'));
$smarty->assign('dupe', TRUE);
示例7: elseif
$msg = Pommo::_T('subscription request');
$pending['type'] = 'confirm';
// normalize for Pommo_Helper_Messages::sendMessage
break;
case "change":
$msg = Pommo::_T('record update request');
$pending['type'] = 'update';
// normalize for Pommo_Helper_Messages::sendMessage
break;
case "password":
$msg = Pommo::_T('password change request');
break;
default:
Pommo::redirect('login.php?badPendingType=TRUE');
}
// check if user wants to reconfirm or cancel their request
if (!empty($_POST)) {
if (isset($_POST['reconfirm'])) {
require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
Pommo_Helper_Messages::sendMessage(array('to' => $input['Email'], 'code' => $pending['code'], 'type' => $pending['type']));
} elseif (isset($_POST['cancel'])) {
if (Pommo_Pending::cancel($pending)) {
$logger->addMsg(sprintf(Pommo::_T('Your %s has been cancelled.'), $msg));
}
}
$smarty->assign('nodisplay', TRUE);
} else {
$logger->addMsg(sprintf(Pommo::_T('Your %s is still pending. To complete this request, please review the confirmation email sent to %s.'), $msg, $input['Email']));
}
$smarty->display('user/pending.tpl');
Pommo::kill();
示例8: array
*
*/
/**********************************
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();
$view->assign('returnStr', Pommo::_T('Mailings Page'));
/** SET PAGE STATE
* limit - # of mailings per page
* sort - Sorting of Mailings [subject, mailgroup, subscriberCount, started, etc.]
* order - Order Type (ascending - ASC /descending - DESC)
*/
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& Pommo_Api::stateInit('mailings_history', array('limit' => 10, 'sort' => 'end', 'order' => 'desc', 'page' => 1), $_REQUEST);
/**********************************
VALIDATION ROUTINES
*********************************/
if (!is_numeric($state['limit']) || $state['limit'] < 1 || $state['limit'] > 1000) {
$state['limit'] = 10;
}
if ($state['order'] != 'asc' && $state['order'] != 'desc') {
$state['order'] = 'asc';
示例9: array
INITIALIZATION METHODS
*********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Sql.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Groups.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Rules.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$view->assign('returnStr', _('Groups Page'));
// Initialize page state with default values overriden by those held in $_REQUEST
$state =& Pommo_Api::stateInit('groups_edit', array('group' => 0), $_REQUEST);
$groups = Pommo_Groups::get();
$fields = Pommo_Fields::get();
$group =& $groups[$state['group']];
if (empty($group)) {
Pommo::redirect('subscribers_groups.php');
}
$rules = Pommo_Sql::sortRules($group['rules']);
$rules['and'] = Pommo_Sql::sortLogic($rules['and']);
$rules['or'] = Pommo_Sql::sortLogic($rules['or']);
foreach ($rules as $key => $a) {
if ($key == 'include' || $key == 'exclude') {
foreach ($a as $k => $gid) {
$rules[$key][$k] = $groups[$gid]['name'];
示例10: current
} else {
$group = Pommo_Groups::make(array('name' => $_POST['group_name']));
$id = Pommo_Groups::add($group);
$id ? Pommo::redirect("groups_edit.php?group={$id}") : $logger->addMsg(Pommo::_T('Error with addition.'));
}
}
if (!empty($_GET['delete'])) {
// make sure it is a valid group
$group = current(Pommo_Groups::get(array('id' => $_GET['group_id'])));
if (empty($group)) {
Pommo::redirect($_SERVER['PHP_SELF']);
}
$affected = Pommo_Groups::rulesAffected($group['id']);
// See if this change will affect any subscribers, if so, confirm the change.
if ($affected > 1 && empty($_GET['dVal-force'])) {
$smarty->assign('confirm', array('title' => Pommo::_T('Confirm Action'), 'nourl' => $_SERVER['PHP_SELF'] . '?group_id=' . $_GET['group_id'], 'yesurl' => $_SERVER['PHP_SELF'] . '?group_id=' . $_GET['group_id'] . '&delete=TRUE&dVal-force=TRUE', 'msg' => sprintf(Pommo::_T('%1$s filters belong this group . Are you sure you want to remove %2$s?'), '<b>' . $affected . '</b>', '<b>' . $group['name'] . '</b>')));
$smarty->display('admin/confirm.tpl');
Pommo::kill();
} else {
// delete group
if (!Pommo_Groups::delete($group['id'])) {
$logger->addMsg(Pommo::_T('Group cannot be deleted.'));
} else {
$logger->addMsg(sprintf(Pommo::_T('%s deleted.'), $group['name']));
}
}
}
// Get array of mailing groups. Key is ID, value is name
$groups = Pommo_Groups::getNames();
$smarty->assign('groups', $groups);
$smarty->display('admin/subscribers/subscribers_groups.tpl');
示例11: count
*/
/**********************************
INITIALIZATION METHODS
*********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Csv_Stream.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
Pommo::init(array('keep' => TRUE));
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$view->assign('returnStr', _('Import'));
$preview = Pommo::get('preview');
// find the most columns in a row
$cols = 0;
foreach ($preview as $row) {
$c = count($row);
if ($c > $cols) {
$cols = $c;
}
}
$view->assign('excludeUnsubscribed', isset($_REQUEST['excludeUnsubscribed']) ? true : false);
$view->assign('preview', $preview);
$view->assign('colNum', $cols);
$view->assign('fields', Pommo_Fields::get());
$view->display('admin/subscribers/import_csv');
示例12: define
*
* 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
*********************************/
$lang = false;
if (isset($_POST['lang'])) {
define('_poMMo_lang', $_POST['lang']);
$lang = true;
}
require 'bootstrap.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$smarty->assign('header', array('main' => 'poMMo ' . Pommo::$_config['version'], 'sub' => sprintf(Pommo::_T('Powerful mailing list software for %s'), Pommo::$_config['list_name'])));
if ($lang) {
$logger->addErr(Pommo::_T('You have changed the language for this session.
To make this the default language, you must update your config.php
file.'));
}
$smarty->assign('lang', Pommo::$_slanguage ? Pommo::$_slanguage : Pommo::$_language);
$smarty->display('admin/admin.tpl');
Pommo::kill();
示例13: fopen
/**********************************
INITIALIZATION METHODS
*********************************/
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Csv_Stream.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
// Maximum File Size (in MB)
$max_file_size = 2;
$view->assign('maxSize', $max_file_size * 1024 * 1024);
// Filename (in $_FILES array)
$fname = 'csvfile';
if (isset($_POST['submit'])) {
// POST exists -- set pointer to content
$fp = false;
$box = false;
if (!empty($_FILES[$fname]['tmp_name'])) {
$fp =& fopen($_FILES[$fname]['tmp_name'], 'r');
} elseif (!empty($_POST['box'])) {
$str =& $_POST['box'];
// wrap $c as a file stream -- requires PHP 4.3.2
// for early versions investigate using tmpfile() -- efficient?
if (!stream_wrapper_register('pommoCSV', 'Pommo_Csv_Stream')) {
Pommo::kill('Failed to register pommoCSV');
}
示例14: die
*/
// Clears the entire database, resets auto increment values
/**********************************
INITIALIZATION METHODS
*********************************/
define('_poMMo_support', TRUE);
require 'bootstrap.php';
Pommo::init();
$dbo =& Pommo::$_dbo;
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('ERROR deleting ' . $id);
}
$query = "ALTER TABLE " . $table . " AUTO_INCREMENT = 1";
if (!$dbo->query($query)) {
die('ERROR setting AUTO_INCREMENT on ' . $id);
}
}
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$message[] = 'Database Reset.';
$smarty->assign('messages', $message);
$smarty->display('support/support.lib.tpl');
Pommo::kill();
示例15:
* the Free Software Foundation, either version 3 of the License, or
* (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_Template.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
Pommo::init();
$logger = Pommo::$_logger;
$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
$view->assign('fields', Pommo_Fields::get(array('byName' => true)));
$view->display('admin/mailings/mailing/ajax.personalize');