* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
- $mymail->addTo("telepaiement@polytechnique.org");
- $mymail->setFrom("webmaster@polytechnique.org");
- $mymail->setSubject("erreur lors d'un télépaiement (CyberPaiement)");
+ $mymail->addTo($globals->money->email);
+ $mymail->setFrom("webmaster@" . $globals->mail->domain);
+ $mymail->setSubject("erreur lors d'un télépaiement (CyberPaiement)");
$mymail->setTxtBody("\n\n".var_export($_REQUEST,true));
$mymail->send();
exit;
}
/* sort en affichant une erreur */
$mymail->setTxtBody("\n\n".var_export($_REQUEST,true));
$mymail->send();
exit;
}
/* sort en affichant une erreur */
-function paypal_erreur($text, $send=true) {
- global $page, $erreur;
+function paypal_erreur($text, $send=true)
+{
+ global $erreur, $globals;
- $mymail->addTo("telepaiement@polytechnique.org");
- $mymail->setFrom("webmaster@polytechnique.org");
- $mymail->setSubject("erreur lors d'un télépaiement (PayPal)");
+ $mymail->addTo($globals->money->email);
+ $mymail->setFrom("webmaster@" . $globals->mail->domain);
+ $mymail->setSubject("erreur lors d'un télépaiement (PayPal)");
function cle_accept($d1,$d2,$d3,$d4,$d5)
{
$m1 = luhn($d1.$d5);
function cle_accept($d1,$d2,$d3,$d4,$d5)
{
$m1 = luhn($d1.$d5);
+/* decode the comment */
+function comment_decode($comment) {
+ $comment = urldecode($comment);
+ if (is_utf8($comment)) {
+ return $comment;
+ } else {
+ return utf8_encode($comment);
+ }
+}
+
- 'payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUBLIC),
- 'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC),
+ 'payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUBLIC, 'user', NO_HTTPS),
+ 'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC, 'user', NO_HTTPS),
'%grp/paiement' => $this->make_hook('xnet_payment', AUTH_MDP),
'%grp/payment' => $this->make_hook('xnet_payment', AUTH_MDP),
'%grp/paiement' => $this->make_hook('xnet_payment', AUTH_MDP),
'%grp/payment' => $this->make_hook('xnet_payment', AUTH_MDP),
- '%grp/payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUBLIC),
- '%grp/payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC),
+ '%grp/payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUBLIC, 'user', NO_HTTPS),
+ '%grp/payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC, 'user', NO_HTTPS),
'admin/payments' => $this->make_hook('admin', AUTH_MDP, 'admin'),
'admin/payments' => $this->make_hook('admin', AUTH_MDP, 'admin'),
$pay = new Payment();
}
$val = Env::v('montant') != 0 ? Env::v('montant') : $pay->montant_def;
if (($e = $pay->check($val)) !== true) {
$pay = new Payment();
}
$val = Env::v('montant') != 0 ? Env::v('montant') : $pay->montant_def;
if (($e = $pay->check($val)) !== true) {
function handler_cyber_return(&$page, $uid = null)
{
/* reference banque (numero de transaction) */
function handler_cyber_return(&$page, $uid = null)
{
/* reference banque (numero de transaction) */
- SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme')
+ SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET('femme', a.flags)
FROM auth_user_md5 AS a
INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme')
WHERE a.user_id={?}", $uid);
FROM auth_user_md5 AS a
INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme')
WHERE a.user_id={?}", $uid);
/* on extrait la reference de la commande */
if (!ereg('-xorg-([0-9]+)$',$champ200,$matches)) {
/* on extrait la reference de la commande */
if (!ereg('-xorg-([0-9]+)$',$champ200,$matches)) {
WHERE rcb.id='$champ906'");
if (list($rcb_text, $c_id, $c_text) = $res->fetchOneRow()) {
cb_erreur("erreur lors du paiement : $c_text ($c_id)");
WHERE rcb.id='$champ906'");
if (list($rcb_text, $c_id, $c_text) = $res->fetchOneRow()) {
cb_erreur("erreur lors du paiement : $c_text ($c_id)");
$conf_text = str_replace("<nom>",$nom,$conf_text);
$conf_text = str_replace("<promo>",$promo,$conf_text);
$conf_text = str_replace("<montant>",$montant,$conf_text);
$conf_text = str_replace("<nom>",$nom,$conf_text);
$conf_text = str_replace("<promo>",$promo,$conf_text);
$conf_text = str_replace("<montant>",$montant,$conf_text);
- $conf_text = str_replace("<salutation>",$femme ? "Chère" : "Cher",$conf_text);
- $conf_text = str_replace("<cher>",$femme ? "Chère" : "Cher",$conf_text);
+ $conf_text = str_replace("<salutation>",$femme ? "Chère" : "Cher",$conf_text);
+ $conf_text = str_replace("<cher>",$femme ? "Chère" : "Cher",$conf_text);
- $mymail->setFrom("webmaster@polytechnique.org");
- $mymail->addTo("telepaiement@staff.polytechnique.org");
+ $mymail->setFrom("webmaster@" . $globals->mail->domain);
+ $mymail->addTo($globals->money->email);
$mymail->setSubject($conf_title);
$msg = "utilisateur : $prenom $nom ($uid)\n".
"mail : $forlife@polytechnique.org\n\n".
$mymail->setSubject($conf_title);
$msg = "utilisateur : $prenom $nom ($uid)\n".
"mail : $forlife@polytechnique.org\n\n".
- SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme')
+ SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET('femme', a.flags)
FROM auth_user_md5 AS a
INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme')
WHERE a.user_id={?}", $uid);
FROM auth_user_md5 AS a
INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme')
WHERE a.user_id={?}", $uid);
/* on extrait la reference de la commande */
if (!ereg('-xorg-([0-9]+)$',$fullref,$matches)) {
/* on extrait la reference de la commande */
if (!ereg('-xorg-([0-9]+)$',$fullref,$matches)) {
$conf_text = str_replace("<nom>",$nom,$conf_text);
$conf_text = str_replace("<promo>",$promo,$conf_text);
$conf_text = str_replace("<montant>",$montant,$conf_text);
$conf_text = str_replace("<nom>",$nom,$conf_text);
$conf_text = str_replace("<promo>",$promo,$conf_text);
$conf_text = str_replace("<montant>",$montant,$conf_text);
- $conf_text = str_replace("<salutation>",$femme ? "Chère" : "Cher",$conf_text);
- $conf_text = str_replace("<cher>",$femme ? "Chère" : "Cher",$conf_text);
+ $conf_text = str_replace("<salutation>",$femme ? "Chère" : "Cher",$conf_text);
+ $conf_text = str_replace("<cher>",$femme ? "Chère" : "Cher",$conf_text);
- $mymail->setFrom("webmaster@polytechnique.org");
- $mymail->addTo("telepaiement@polytechnique.org");
+ $mymail->setFrom("webmaster@" . $globals->mail->domain);
+ $mymail->addTo($globals->money->email);
$mymail->setSubject($conf_title);
$msg = "utilisateur : $prenom $nom ($uid)\n".
"mail : $forlife@polytechnique.org\n\n".
$mymail->setSubject($conf_title);
$msg = "utilisateur : $prenom $nom ($uid)\n".
"mail : $forlife@polytechnique.org\n\n".
+
+ $perms = S::v('perms');
+ if (!$perms->hasFlag('groupmember')) {
+ if (is_null($pid)) {
+ return PL_FORBIDDEN;
+ }
+ $res = XDB::query("SELECT 1
+ FROM groupex.evenements AS e
+ INNER JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND uid = {?})
+ WHERE e.paiement_id = {?} AND e.asso_id = {?}",
+ S::i('uid'), $pid, $globals->asso('id'));
+ if ($res->numRows() == 0) {
+ return PL_FORBIDDEN;
+ }
+ }
+
ORDER BY id DESC", $globals->asso('id'));
$tit = $res->fetchAllAssoc();
$page->assign('titres', $tit);
ORDER BY id DESC", $globals->asso('id'));
$tit = $res->fetchAllAssoc();
$page->assign('titres', $tit);
$sum = 0;
foreach ($trans[$pid] as $i => $t) {
$sum += strtr(substr($t['montant'], 0, strpos($t['montant'], 'EUR')), ',', '.');
$sum = 0;
foreach ($trans[$pid] as $i => $t) {
$sum += strtr(substr($t['montant'], 0, strpos($t['montant'], 'EUR')), ',', '.');
- 'montant' => strtr($sum, '.', ',').' ¤');
+ 'montant' => strtr($sum, '.', ',').' €');
}
$res = XDB::iterRow("SELECT e.eid, e.short_name, e.intitule, ep.nb, ei.montant, ep.paid
FROM groupex.evenements AS e
}
$res = XDB::iterRow("SELECT e.eid, e.short_name, e.intitule, ep.nb, ei.montant, ep.paid
FROM groupex.evenements AS e
$page->assign('trans', $trans);
$page->assign('event', $event);
}
$page->assign('trans', $trans);
$page->assign('event', $event);
}
- $page->assign('xorg_title','Polytechnique.org - Administration - Paiements');
- $page->assign('title', 'Gestion des télépaiements');
+ $page->setTitle('Administration - Paiements');
+ $page->assign('title', 'Gestion des télépaiements');
$table_editor = new PLTableEditor('admin/payments','paiement.paiements','id');
$table_editor->add_join_table('paiement.transactions','ref',true);
$table_editor->add_sort_field('flags');
$table_editor->add_sort_field('id', true, true);
$table_editor = new PLTableEditor('admin/payments','paiement.paiements','id');
$table_editor->add_join_table('paiement.transactions','ref',true);
$table_editor->add_sort_field('flags');
$table_editor->add_sort_field('id', true, true);
- $table_editor->on_delete("UPDATE paiement.paiements SET flags = 'old' WHERE id = {?}", "Le paiement a été archivé");
- $table_editor->describe('text','intitulé',true);
+ $table_editor->on_delete("UPDATE paiement.paiements SET flags = 'old' WHERE id = {?}", "Le paiement a été archivé");
+ $table_editor->describe('text','intitulé',true);
$table_editor->describe('montant_min','montant minimum',false);
$table_editor->describe('montant_max','montant maximum',false);
$table_editor->describe('mail','email contact',true);
$table_editor->describe('confirmation','message confirmation',false);
$table_editor->apply($page, $action, $id);
$table_editor->describe('montant_min','montant minimum',false);
$table_editor->describe('montant_max','montant maximum',false);
$table_editor->describe('mail','email contact',true);
$table_editor->describe('confirmation','message confirmation',false);
$table_editor->apply($page, $action, $id);