From 7c8a4874cd0e972cee31d1a27b6b7279631f62af Mon Sep 17 00:00:00 2001
From: x2000habouzit
Date: Wed, 5 Jul 2006 22:28:51 +0000
Subject: [PATCH] remove old get arguments, use path args instead.
marketing is now clean
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@378 839d8a87-29fc-0310-9880-83ba4fa771e5
---
classes/Platal.php | 8 ++------
modules/marketing.php | 23 +++++++++++------------
templates/marketing/this_week.tpl | 4 ++--
templates/marketing/volontaire.tpl | 2 +-
4 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/classes/Platal.php b/classes/Platal.php
index cf888cc..767a11a 100644
--- a/classes/Platal.php
+++ b/classes/Platal.php
@@ -74,12 +74,8 @@ class Platal
return PL_NOT_FOUND;
}
- $args = explode('/', substr($this->path, strlen($p) + 1));
- if ($args[0] != '') {
- array_unshift($args, &$page);
- } else {
- $args = array(&$page);
- }
+ $args = explode('/', substr($this->path, strlen($p)));
+ $args[0] = &$page;
if ($hook['auth'] > Session::get('auth', AUTH_PUBLIC)) {
$_SESSION['session']->doAuth($page);
diff --git a/modules/marketing.php b/modules/marketing.php
index 3684e33..4ce614e 100644
--- a/modules/marketing.php
+++ b/modules/marketing.php
@@ -128,9 +128,8 @@ class MarketingModule extends PLModule
if ($action == 'relforce') {
require_once('marketing.inc.php');
- mark_send_mail($uid, $value, Env::get('from'),
- Env::get('to'), Env::get('title'),
- Env::get('message'));
+ mark_send_mail($uid, $value, Post::get('from'), Post::get('to'),
+ Post::get('title'), Post::get('message'));
$page->trig("Mail envoyé");
}
@@ -209,10 +208,10 @@ class MarketingModule extends PLModule
$page->assign('nom', $nom);
$page->assign('promo', $promo);
- if (Env::has('valide')) {
+ if (Post::has('valide')) {
require_once('xorg.misc.inc.php');
- $email = trim(Env::get('mail'));
+ $email = trim(Post::get('mail'));
$res = $globals->xdb->query('SELECT COUNT(*) FROM register_marketing
WHERE uid={?} AND email={?}', $uid, $email);
@@ -225,10 +224,10 @@ class MarketingModule extends PLModule
$globals->xdb->execute(
"INSERT INTO register_marketing (uid,sender,email,date,last,nb,type,hash)
VALUES ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')",
- $uid, Session::getInt('uid'), $email, Env::get('origine'));
+ $uid, Session::getInt('uid'), $email, Post::get('origine'));
require_once('validations.inc.php');
$req = new MarkReq(Session::getInt('uid'), $uid, $email,
- Env::get('origine')=='user');
+ Post::get('origine')=='user');
$req->submit();
}
}
@@ -237,13 +236,13 @@ class MarketingModule extends PLModule
return PL_OK;
}
- function handler_week(&$page)
+ function handler_week(&$page, $sorting = 'per_promo')
{
global $globals;
$page->changeTpl('marketing/this_week.tpl');
- $sort = Get::get('sort') == 'promo' ? 'promo' : 'date_ins';
+ $sort = $sorting == 'per_promo' ? 'promo' : 'date_ins';
$sql = "SELECT a.alias AS forlife, u.date_ins, u.promo, u.nom, u.prenom
FROM auth_user_md5 AS u
@@ -255,7 +254,7 @@ class MarketingModule extends PLModule
return PL_OK;
}
- function handler_volontaire(&$page)
+ function handler_volontaire(&$page, $promo = null)
{
global $globals;
@@ -270,14 +269,14 @@ class MarketingModule extends PLModule
$page->assign('promos', $res->fetchColumn());
- if (Env::has('promo')) {
+ if (!is_null($promo)) {
$sql = "SELECT a.nom, a.prenom, a.user_id,
m.email, sa.alias AS forlife
FROM register_marketing AS m
INNER JOIN auth_user_md5 AS a ON a.user_id = m.uid AND a.promo = {?}
INNER JOIN aliases AS sa ON (m.sender = sa.id AND sa.type='a_vie')
ORDER BY a.nom";
- $page->assign('addr', $globals->xdb->iterator($sql, Env::get('promo')));
+ $page->assign('addr', $globals->xdb->iterator($sql, $promo));
}
return PL_OK;
diff --git a/templates/marketing/this_week.tpl b/templates/marketing/this_week.tpl
index 637c1be..287edc5 100644
--- a/templates/marketing/this_week.tpl
+++ b/templates/marketing/this_week.tpl
@@ -53,8 +53,8 @@
diff --git a/templates/marketing/volontaire.tpl b/templates/marketing/volontaire.tpl
index 50ff7b7..f9f9958 100644
--- a/templates/marketing/volontaire.tpl
+++ b/templates/marketing/volontaire.tpl
@@ -27,7 +27,7 @@ Choix de la promo :
{foreach from=$promos item=p}
-{$p}
+{$p}
{cycle values=",,,,,,,,,,,,,,
"}
{/foreach}
--
2.1.4