Permalink
Browse files

Removed smarty from all end-user facing pages

  • Loading branch information...
1 parent 05ad753 commit e179937c2f0802c10e812958448ceb76c0e8983b @soonick committed Dec 4, 2011
View
@@ -1,51 +1,61 @@
<?php
/**
- * Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <bhb@iceburg.net>
+ * Original Code Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <bhb@iceburg.net>
+ * released originally under GPLV2
*
- * This file is part of poMMo (http://www.pommo.org)
+ * This file is part of poMMo.
+ *
+ * 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 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/>.
*
- * 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.
+ * 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_Subscribers.php');
-require_once(Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php');
+require 'bootstrap.php';
+require_once Pommo::$_baseDir.'classes/Pommo_Subscribers.php';
+require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
Pommo::init(array('authLevel' => 0,'noSession' => true));
-$logger = & Pommo::$_logger;
-$dbo = & Pommo::$_dbo;
+$logger = Pommo::$_logger;
+$dbo = Pommo::$_dbo;
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
-require_once(Pommo::$_baseDir.'classes/Pommo_Template.php');
-$smarty = new Pommo_Template();
+require_once Pommo::$_baseDir.'classes/Pommo_Template.php';
+$view = new Pommo_Template();
// make sure email/login is valid
-$subscriber = current(Pommo_Subscribers::get(array('email' => (empty($_REQUEST['email'])) ? '0' : $_REQUEST['email'], 'status' => 1)));
+$subscriber = current(Pommo_Subscribers::get(array (
+ 'email' => (empty($_REQUEST['email'])) ? '0' : $_REQUEST['email'], 'status' => 1
+)));
+
if (empty($subscriber))
+{
Pommo::redirect('login.php');
+}
-// see if an anctivation email was sent to this subscriber in the last 2 minutes;
-$query = "
- SELECT
+// see if an activation email was sent to this subscriber in the last 2 minutes;
+$query =
+ 'SELECT
*
FROM
- ".$dbo->table['scratch']."
+ '.$dbo->table['scratch']."
WHERE
`type`=1
AND `int`=%i
@@ -55,11 +65,15 @@
$test = $dbo->query($query,0);
// attempt to send activation code if once has not recently been sent
-if (empty($test)) {
+if (empty($test))
+{
$code = Pommo_Subscribers::getActCode($subscriber);
- if (Pommo_Helper_Messages::sendMessage(array('to' => $subscriber['email'], 'code' => $code, 'type' => 'activate'))) {
-
- $smarty->assign('sent', true);
+ if (Pommo_Helper_Messages::sendMessage(array (
+ 'to' => $subscriber['email'],
+ 'code' => $code,
+ 'type' => 'activate')))
+ {
+ $view->assign('sent', true);
// timestamp this activation email
$query = "
@@ -82,11 +96,10 @@
}
}
else {
- $smarty->assign('sent', false);
+ $view->assign('sent', false);
}
-$smarty->assign('email', $subscriber['email']);
-$smarty->display('user/activate.tpl');
-Pommo::kill();
-?>
+$view->assign('email', $subscriber['email']);
+$view->display('user/activate');
+
View
@@ -39,7 +39,7 @@
if (empty($_GET['code'])) {
$logger->addMsg(Pommo::_T('No code given.'));
- $smarty->display('user/confirm.tpl');
+ $smarty->display('user/confirm');
Pommo::kill();
}
@@ -48,7 +48,7 @@
if (!$pending) {
$logger->addMsg(Pommo::_T('Invalid code! Make sure you copied it correctly from the email.'));
- $smarty->display('user/confirm.tpl');
+ $smarty->display('user/confirm');
Pommo::kill();
}
@@ -98,6 +98,5 @@
break;
}
}
-$smarty->display('user/confirm.tpl');
-Pommo::kill();
-?>
+$smarty->display('user/confirm');
+
View
@@ -1,65 +1,69 @@
<?php
/**
- * Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <bhb@iceburg.net>
+ * Original Code Copyright (C) 2005, 2006, 2007, 2008 Brice Burgess <bhb@iceburg.net>
+ * released originally under GPLV2
*
- * This file is part of poMMo (http://www.pommo.org)
+ * This file is part of poMMo.
+ *
+ * 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 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/>.
*
- * 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.
+ * 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_Pending.php');
+require 'bootstrap.php';
+require_once Pommo::$_baseDir.'classes/Pommo_Pending.php';
Pommo::init(array('authLevel' => 0, 'noSession' => true));
-$logger = & Pommo::$_logger;
-$dbo = & Pommo::$_dbo;
+$logger = Pommo::$_logger;
+$dbo = Pommo::$_dbo;
session_start(); // required by smartyValidate. TODO -> move to prepareForForm() ??
/**********************************
SETUP TEMPLATE, PAGE
*********************************/
-require_once(Pommo::$_baseDir.'classes/Pommo_Template.php');
-$smarty = new Pommo_Template();
-$smarty->assign('title', Pommo::$_config['site_name'] . ' - ' . Pommo::_T('subscriber logon'));
+require_once Pommo::$_baseDir.'classes/Pommo_Template.php';
+$view = new Pommo_Template();
+$view->assign('title', Pommo::$_config['site_name'] . ' - ' . Pommo::_T('subscriber logon'));
-$smarty->prepareForForm();
+$view->prepareForForm();
-if (!SmartyValidate :: is_registered_form() || empty($_POST)) {
+if (empty($_POST)) {
// ___ USER HAS NOT SENT FORM ___
- SmartyValidate :: connect($smarty, true);
- SmartyValidate :: register_validator('email', 'Email', 'isEmail', false, false, 'trim');
- $formError = array ();
- $formError['email'] = Pommo::_T('Invalid email address');
- $smarty->assign('formError', $formError);
-
// Assign email to form if pre-provided
if (isset($_REQUEST['Email']))
- $smarty->assign('Email',$_REQUEST['Email']);
+ $view->assign('Email',$_REQUEST['Email']);
elseif (isset($_REQUEST['email']))
- $smarty->assign('Email',$_REQUEST['email']);
+ $view->assign('Email',$_REQUEST['email']);
} else {
// ___ USER HAS SENT FORM ___
- SmartyValidate :: connect($smarty);
- if (SmartyValidate :: is_valid($_POST)) {
- // __ FORM IS VALID __
- if (Pommo_Helper::isDupe($_POST['Email'])) {
+ require_once Pommo::$_baseDir.'classes/Pommo_Validate.php';
+ $validator = new Pommo_Validate();
+ $validator->setPost($_POST);
+ $validator->addData('Email', 'Email', false);
+
+ if ($result = $validator->checkData())
+ {
+ if (Pommo_Helper::isDupe($_POST['Email']))
+ {
if (Pommo_Pending::isEmailPending($_POST['Email'])) {
$input = urlencode(serialize(array('Email' => $_POST['Email'])));
SmartyValidate :: disconnect();
@@ -71,14 +75,16 @@
Pommo::redirect('activate.php?email='.$_POST['Email']);
}
}
- else {
+ 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.'subscribe.php?Email='.$_POST['Email'].'">','</a>'));
}
}
- $smarty->assign($_POST);
+
+ $view->assign($_POST);
}
-$smarty->display('user/login.tpl');
-Pommo::kill();
-?>
+
+$view->display('user/login');
+
View
@@ -38,8 +38,8 @@
SETUP TEMPLATE, PAGE
*********************************/
require_once(Pommo::$_baseDir.'classes/Pommo_Template.php');
-$smarty = new Pommo_Template();
-$smarty->assign('title', Pommo::$_config['site_name'] . ' - ' . Pommo::_T('Mailing History'));
+$view = new Pommo_Template();
+$view->assign('title', Pommo::$_config['site_name'] . ' - ' . Pommo::_T('Mailing History'));
/** SET PAGE STATE
* limit - # of mailings per page
@@ -82,8 +82,8 @@
}
- $smarty->assign($input);
- $smarty->display('inc/mailing.tpl');
+ $view->assign($input);
+ $view->display('inc/mailing');
Pommo::kill();
}
@@ -113,10 +113,9 @@
ceil($tally/$state['limit']) :
0;
-$smarty->assign('state',$state);
-$smarty->assign('tally',$tally);
-$smarty->assign('mailings', $mailings);
+$view->assign('state',$state);
+$view->assign('tally',$tally);
+$view->assign('mailings', $mailings);
+
+$view->display('user/mailings');
-$smarty->display('user/mailings.tpl');
-Pommo::kill();
-?>
View
@@ -32,14 +32,15 @@
SETUP TEMPLATE, PAGE
*********************************/
require_once(Pommo::$_baseDir.'classes/Pommo_Template.php');
-$smarty = new Pommo_Template();
+$view = new Pommo_Template();
$input = (isset($_GET['input'])) ?
unserialize($_GET['input']) : array('Email' => NULL);
$pending = (isset($input['adminID'])) ? // check to see if we're resetting admin password
Pommo_Pending::getBySubID(0) :
Pommo_Pending::getByEmail($input['Email']);
+
if (!$pending)
Pommo::redirect('login.php');
@@ -69,10 +70,9 @@
if (Pommo_Pending::cancel($pending))
$logger->addMsg(sprintf(Pommo::_T('Your %s has been cancelled.'),$msg));
}
- $smarty->assign('nodisplay',TRUE);
+ $view->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();
-?>
+$view->display('user/pending');
+
Oops, something went wrong.

0 comments on commit e179937

Please sign in to comment.