* redirect
Redirect to pommo page
public static redirect ( $url, $msg = NULL, $kill = true ) | ||
$url | ||
$msg | ||
$kill |
<?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');
<?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');
// TODO -- visit this function later // Check if a reset password request has been received // check that captcha matched if (!isset($_POST['captcha'])) { // generate captcha $captcha = substr(md5(rand()), 0, 4); $view->assign('captcha', $captcha); } elseif ($_POST['captcha'] == $_POST['realdeal']) { // user inputted captcha matched. Reset password require_once Pommo::$_baseDir . 'classes/Pommo_Pending.php'; require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php'; // see if there is already a pending request for the administrator // [subscriber id == 0] if (Pommo_Pending::isPending(0)) { $input = urlencode(serialize(array('adminID' => TRUE, 'Email' => Pommo::$_config['admin_email']))); Pommo::redirect(Pommo::$_http . Pommo::$_baseUrl . 'pending.php?input=' . $input); } // create a password change request, send confirmation mail $subscriber = array('id' => 0); $code = Pommo_Pending::add($subscriber, 'password'); Pommo_Helper_Messages::sendMessage(array('to' => Pommo::$_config['admin_email'], 'code' => $code, 'type' => 'password')); $view->assign('captcha', FALSE); } else { // captcha did not match $logger->addMsg(Pommo::_T('Captcha did not match. Try again.')); } } elseif (!Pommo::$_hasConfigFile && $_POST['configure']) { // Try to connect to database with data entered from the user. // I am not using /inc/classes/db.php because it kills the proccess when // connection is not possible // TODO: db.php shouldnt kill the process
switch ($pending['type']) { case "add": $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'])); }
$id = PommoField::add($field); if ($id) { $smarty->assign('added', $id); } else { $logger->addMsg(Pommo::_T('Error with addition.')); } } // check for a deletion request if (!empty($_GET['delete'])) { $field = PommoField::get(array('id' => $_GET['field_id'])); $field =& current($field); if (count($field) === 0) { $logger->addMsg(Pommo::_T('Error with deletion.')); } else { $affected = PommoField::subscribersAffected($field['id']); if (count($affected) > 0 && empty($_GET['dVal-force'])) { $smarty->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>'))); $smarty->display('admin/confirm.tpl'); Pommo::kill(); } else { PommoField::delete($field['id']) ? Pommo::redirect($_SERVER['PHP_SELF']) : $logger->addMsg(Pommo::_T('Error with deletion.')); } } } // Get array of fields. Key is ID, value is an array of the demo's info $fields = PommoField::get(array('byName' => FALSE)); if (!empty($fields)) { $smarty->assign('fields', $fields); } $smarty->display('admin/setup/setup_fields.tpl'); Pommo::kill();
<?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('/admin/admin.php');
$pommo->init(); $logger =& $pommo->_logger; $dbo =& $pommo->_dbo; /********************************** SETUP TEMPLATE, PAGE *********************************/ Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php'); $smarty = new PommoTemplate(); $smarty->assign('returnStr', Pommo::_T('Groups Page')); // Initialize page state with default values overriden by those held in $_REQUEST $state =& PommoAPI::stateInit('groups_edit', array('group' => 0), $_REQUEST); $groups =& PommoGroup::get(); $fields =& PommoField::get(); $group =& $groups[$state['group']]; if (empty($group)) { Pommo::redirect('subscribers_groups.php'); } $rules = PommoSQL::sortRules($group['rules']); $rules['and'] = PommoSQL::sortLogic($rules['and']); $rules['or'] = PommoSQL::sortLogic($rules['or']); foreach ($rules as $key => $a) { if ($key == 'include' || $key == 'exclude') { foreach ($a as $k => $gid) { $rules[$key][$k] = $groups[$gid]['name']; } } } $smarty->assign('fields', $fields); $smarty->assign('legalFieldIDs', PommoRules::getLegal($group, $fields)); $smarty->assign('legalGroups', PommoRules::getLegalGroups($group, $groups)); $smarty->assign('group', $group);
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php'; $view = new Pommo_Template(); // Prepare for subscriber form -- load in fields + POST/Saved Subscribe Form $view->prepareForSubscribeForm(); // fetch the subscriber, validate code $subscriber = current(Pommo_Subscribers::get(array('email' => empty($_REQUEST['email']) ? '0' : $_REQUEST['email'], 'status' => 1))); if (empty($subscriber)) { Pommo::redirect('login.php'); } if ($_REQUEST['code'] != Pommo_Subscribers::getActCode($subscriber)) { Pommo::kill(Pommo::_T('Invalid activation code.')); } // check if we have pending request if (Pommo_Pending::isPending($subscriber['id'])) { $input = urlencode(serialize(array('Email' => $_POST['Email']))); Pommo::redirect('pending.php?input=' . $input); } $config = Pommo_Api::configGet(array('notices')); $notices = unserialize($config['notices']); if (!isset($_POST['d'])) { $view->assign('d', $subscriber['data']); } // check for an update + validate new subscriber info (also converts dates to ints) if (!empty($_POST['update']) && Pommo_Validate::subscriberData($_POST['d'])) { $newsub = array('id' => $subscriber['id'], 'email' => $subscriber['email'], 'data' => $_POST['d']); if (!empty($_POST['newemail'])) { // if change in email, validate and send confirmation of update if ($_POST['newemail'] != $_POST['newemail2']) { $logger->addErr(Pommo::_T('Emails must match.')); } elseif (!Pommo_Helper::isEmail($_POST['newemail'])) { $logger->addErr(Pommo::_T('Invalid Email Address'));
$mailing = current(PommoMailing::get(array('id' => $_REQUEST['mailings']))); // change group name to ID $groups = PommoGroup::getNames(); $gid = 'all'; foreach ($groups as $group) { if ($group['name'] == $mailing['group']) { $gid = $group['id']; } } PommoAPI::stateReset(array('mailing')); // if this is a plain text mailing, switch body + altbody. if ($mailing['ishtml'] == 'off') { $mailing['altbody'] = $mailing['body']; $mailing['body'] = null; } // Initialize page state with default values overriden by those held in $_REQUEST $state =& PommoAPI::stateInit('mailing', array('fromname' => $mailing['fromname'], 'fromemail' => $mailing['fromemail'], 'frombounce' => $mailing['frombounce'], 'list_charset' => $mailing['charset'], 'mailgroup' => $gid, 'subject' => $mailing['subject'], 'body' => $mailing['body'], 'altbody' => $mailing['altbody'])); Pommo::redirect($pommo->_baseUrl . 'admin/mailings/mailings_start.php'); break; case 'delete': $deleted = PommoMailing::delete($mailingIDS); $logger->addMsg(Pommo::_T('Please Wait') . '...'); $params = $json->encode(array('ids' => $mailingIDS)); $smarty->assign('callbackFunction', 'deleteMailing'); $smarty->assign('callbackParams', $params); break; default: $logger->AddErr('invalid call'); break; } $smarty->display('admin/rpc.tpl');
$smarty->prepareForForm(); // add group if requested if (!empty($_POST['group_name'])) { if (Pommo_Groups::nameExists($_POST['group_name'])) { $logger->addMsg(sprintf(Pommo::_T('Group name (%s) already exists'), $_POST['group_name'])); } 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'])); } }
if (!move_uploaded_file($_FILES[$fname]['tmp_name'], Pommo::$_workDir . '/import.csv')) { Pommo::kill('Could not write to temp CSV file (' . Pommo::$_workDir . '/import.csv)'); } } Pommo::set(array('preview' => $a)); Pommo::redirect('import_csv.php' . (isset($_REQUEST['excludeUnsubscribed']) ? '?excludeUnsubscribed=true' : '')); } else { // Saves all parsed E-mails in an array $a = array(); while (($data = fgetcsv($fp, 2048, ',', '"')) !== false) { foreach ($data as $email) { if (Pommo_Helper::isEmail($email)) { $email = strtolower($email); $a[$email] = $email; } } } // Removes from the array E-mails that are already on the database $includeUnsubscribed = isset($_REQUEST['excludeUnsubscribed']) ? false : true; $dupes = Pommo_Helper::isDupe($a, $includeUnsubscribed); if (!$dupes) { $dupes = array(); } $emails = array_diff($a, $dupes); // Saves emails in session and redirects to confirmation page Pommo::set(array('emails' => $emails, 'dupes' => count($dupes))); Pommo::redirect('import_txt.php'); } } } $view->display('admin/subscribers/subscribers_import');
$i = 1; while (($data = fgetcsv($fp, 2048, ',', '"')) !== FALSE) { array_push($a, $data); if ($i > 9) { // only get first 10 lines -- move file break; } $i++; } // save file for access after assignments if ($box) { // when PHP5 is widespread, switch to file_put_contents() && use the $fp stream if (!($handle = fopen($pommo->_workDir . '/import.csv', 'w'))) { Pommo::kill('Could not write to temp CSV file (' . $pommo->_workDir . '/import.csv)'); } if (fwrite($handle, $_POST['box']) === FALSE) { Pommo::kill('Could not write to temp CSV file (' . $pommo->_workDir . '/import.csv)'); } fclose($handle); } else { move_uploaded_file($_FILES[$fname]['tmp_name'], $pommo->_workDir . '/import.csv') or Pommo::kill('Could not write to temp CSV file (' . $pommo->_workDir . '/import.csv)'); } $pommo->set(array('preview' => $a)); Pommo::redirect('import_csv.php' . (isset($_REQUEST['excludeUnsubscribed']) ? '?excludeUnsubscribed=true' : '')); } else { $logger->addErr('Unknown Import Type'); } } } $smarty->display('admin/subscribers/subscribers_import.tpl'); Pommo::kill();
} elseif (!empty($_POST['resetPassword'])) { // TODO -- visit this function later // Check if a reset password request has been received // check that captcha matched if (!isset($_POST['captcha'])) { // generate captcha $captcha = substr(md5(rand()), 0, 4); $smarty->assign('captcha', $captcha); } elseif ($_POST['captcha'] == $_POST['realdeal']) { // user inputted captcha matched. Reset password Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/pending.php'); Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php'); // see if there is already a pending request for the administrator [subscriber id == 0] if (PommoPending::isPending(0)) { $input = urlencode(serialize(array('adminID' => TRUE, 'Email' => $pommo->_config['admin_email']))); Pommo::redirect($pommo->_http . $pommo->_baseUrl . 'user/pending.php?input=' . $input); } // create a password change request, send confirmation mail $subscriber = array('id' => 0); $code = PommoPending::add($subscriber, 'password'); PommoHelperMessages::sendMessage(array('to' => $pommo->_config['admin_email'], 'code' => $code, 'type' => 'password')); $smarty->assign('captcha', FALSE); } else { // captcha did not match $logger->addMsg(Pommo::_T('Captcha did not match. Try again.')); } } // referer (used to return user to requested page upon login success) $smarty->assign('referer', isset($_REQUEST['referer']) ? $_REQUEST['referer'] : $pommo->_baseUrl . 'admin/admin.php'); $smarty->display('index.tpl'); die;
$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');
// Assign email to form if pre-provided if (isset($_REQUEST['Email'])) { $smarty->assign('Email', $_REQUEST['Email']); } elseif (isset($_REQUEST['email'])) { $smarty->assign('Email', $_REQUEST['email']); } } else { // ___ USER HAS SENT FORM ___ SmartyValidate::connect($smarty); if (SmartyValidate::is_valid($_POST)) { // __ FORM IS VALID __ if (PommoHelper::isDupe($_POST['Email'])) { if (PommoPending::isEmailPending($_POST['Email'])) { $input = urlencode(serialize(array('Email' => $_POST['Email']))); SmartyValidate::disconnect(); Pommo::redirect('pending.php?input=' . $input); } else { // __ EMAIL IN SUBSCRIBERS TABLE, REDIRECT SmartyValidate::disconnect(); Pommo::redirect('activate.php?email=' . $_POST['Email']); } } else { // __ REPORT STATUS $logger->addMsg(Pommo::_T('Email address not found! Please try again.')); $logger->addMsg(sprintf(Pommo::_T('To subscribe, %sclick here%s'), '<a href="' . $pommo->_baseUrl . 'user/subscribe.php?Email=' . $_POST['Email'] . '">', '</a>')); } } $smarty->assign($_POST); } $smarty->display('user/login.tpl'); Pommo::kill();
$messages = unserialize($config['messages']); $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; } }
<?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('/support/support.php');