X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetgrp.php;h=4fc69a4d4b157ac80112d8ad0c3b2177dd2ef62a;hb=b62be36bc636e303764792a36165be27d5802675;hp=bb1cda19a8c3851cb23fa6a8f6672627efd8e788;hpb=5b516e6be17378ace0e375b9da14a46051bf0f4e;p=platal.git
diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php
index bb1cda1..4fc69a4 100644
--- a/modules/xnetgrp.php
+++ b/modules/xnetgrp.php
@@ -1,6 +1,6 @@
= CURRENT_DATE()
- AND (promo_min = 0 OR promo_min <= {?})
- AND (promo_max = 0 OR promo_max >= {?})
- AND r.announce_id IS NULL
- ORDER BY a.peremption",
- S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
- $index = XDB::iterator("SELECT a.id, a.titre, r.user_id IS NULL AS nonlu
- FROM groupex.announces AS a
- LEFT JOIN groupex.announces_read AS r ON (a.id = r.announce_id AND r.user_id = {?})
- WHERE asso_id = {?} AND peremption >= CURRENT_DATE()
+ $arts = XDB::iterator("SELECT a.*, FIND_IN_SET('photo', a.flags) AS photo
+ FROM group_announces AS a
+ LEFT JOIN group_announces_read AS r ON (r.uid = {?} AND r.announce_id = a.id)
+ WHERE asso_id = {?} AND expiration >= CURRENT_DATE()
AND (promo_min = 0 OR promo_min <= {?})
AND (promo_max = 0 OR promo_max >= {?})
- ORDER BY a.peremption",
+ AND r.announce_id IS NULL
+ ORDER BY a.expiration",
+ S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
+ $index = XDB::iterator("SELECT a.id, a.titre, r.uid IS NULL AS nonlu
+ FROM group_announces AS a
+ LEFT JOIN group_announces_read AS r ON (a.id = r.announce_id AND r.uid = {?})
+ WHERE asso_id = {?} AND expiration >= CURRENT_DATE()
+ AND (promo_min = 0 OR promo_min <= {?})
+ AND (promo_max = 0 OR promo_max >= {?})
+ ORDER BY a.expiration",
S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
$page->assign('article_index', $index);
} else {
- $arts = XDB::iterator("SELECT a.*, FIND_IN_SET('photo', a.flags) AS photo
- FROM groupex.announces AS a
- WHERE asso_id = {?} AND peremption >= CURRENT_DATE()
- AND FIND_IN_SET('public', a.flags)",
+ $arts = XDB::iterator("SELECT *, FIND_IN_SET('photo', flags) AS photo
+ FROM group_announces
+ WHERE asso_id = {?} AND expiration >= CURRENT_DATE()
+ AND FIND_IN_SET('public', flags)",
$globals->asso('id'));
}
if (may_update()) {
$subs_valid = XDB::query("SELECT uid
- FROM groupex.membres_sub_requests
+ FROM group_member_sub_requests
WHERE asso_id = {?}",
$globals->asso('id'));
$page->assign('requests', $subs_valid->numRows());
@@ -129,25 +129,7 @@ class XnetGrpModule extends PLModule
function handler_logo(&$page)
{
global $globals;
-
- $logo = $globals->asso('logo');
- if (!empty($logo)) {
- header('Content-type: ' . $globals->asso('logo_mime'));
- header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
- header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Cache-Control: no-cache, must-revalidate');
- header('Pragma: no-cache');
- echo $logo;
- } else {
- header('Content-type: image/jpeg');
- header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
- header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Cache-Control: no-cache, must-revalidate');
- header('Pragma: no-cache');
- readfile(dirname(__FILE__).'/../htdocs/images/dflt_carre.jpg');
- }
-
- exit;
+ $globals->asso()->getLogo()->send();
}
function handler_site(&$page)
@@ -183,11 +165,11 @@ class XnetGrpModule extends PLModule
}
if (S::has_perms()) {
if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) {
- $page->trigError("Le domaine doit être un FQDN (aucune modification effectuée) !!!");
+ $page->trigError('Le domaine doit être un FQDN (aucune modification effectuée) !!!');
return;
}
XDB::execute(
- "UPDATE groupex.asso
+ "UPDATE groups
SET nom={?}, diminutif={?}, cat={?}, dom={?},
descr={?}, site={?}, mail={?}, resp={?},
forum={?}, mail_domain={?}, ax={?}, pub={?},
@@ -208,7 +190,7 @@ class XnetGrpModule extends PLModule
}
} else {
XDB::execute(
- "UPDATE groupex.asso
+ "UPDATE groups
SET descr={?}, site={?}, mail={?}, resp={?},
forum={?}, pub= {?}, sub_url={?},
unsub_url={?},flags={?}
@@ -224,11 +206,11 @@ class XnetGrpModule extends PLModule
if ($_FILES['logo']['name']) {
$upload = PlUpload::get($_FILES['logo'], $globals->asso('id'), 'asso.logo', true);
if (!$upload) {
- $page->trigError("Impossible de télécharger le logo");
+ $page->trigError("Impossible de télécharger le logo.");
} else {
- XDB::execute('UPDATE groupex.asso
- SET logo={?}, logo_mime={?}
- WHERE id={?}', $upload->getContents(), $upload->contentType(),
+ XDB::execute('UPDATE groups
+ SET logo = {?}, logo_mime = {?}
+ WHERE id = {?}', $upload->getContents(), $upload->contentType(),
$globals->asso('id'));
$upload->rm();
}
@@ -238,15 +220,10 @@ class XnetGrpModule extends PLModule
}
if (S::admin()) {
- $dom = XDB::iterator('SELECT * FROM groupex.dom ORDER BY nom');
+ $dom = XDB::iterator('SELECT * FROM group_dom ORDER BY nom');
$page->assign('dom', $dom);
$page->assign('super', true);
}
- if (!$globals->asso('wiki_desc') && $globals->asso('descr')) {
- $page->trigWarning("Attention, le format de la description a changé et utilise désormais la syntaxe wiki "
- . "intégrée au site. Il te faudra probablement adapter le formatage du texte actuel pour "
- . "qu'il s'affiche correctement avec cette nouvelle syntaxe.");
- }
}
function handler_mail(&$page)
@@ -283,7 +260,7 @@ class XnetGrpModule extends PLModule
if ($upload) {
$upload->rm();
}
- $page->killSuccess("Email envoyé !");
+ $page->killSuccess("Email envoyé !");
$page->assign('sent', true);
}
}
@@ -311,7 +288,8 @@ class XnetGrpModule extends PLModule
} else if ($action == 'geoloc' || $action == 'trombi') {
$view = new UserSet();
$view->addMod('trombi', 'Trombinoscope');
- $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'annuaire/search'));
+ // TODO: Reactivate when the new map is completed.
+ // $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'annuaire/search'));
$view->apply('annuaire', $page, $action, $subaction);
if ($action == 'geoloc' && $subaction) {
return;
@@ -334,11 +312,11 @@ class XnetGrpModule extends PLModule
}
if (Env::b('admin')) {
- $uf = $globals->asso()->getAdmins(null, $se);
+ $uf = $globals->asso()->getAdminsFilter(null, $se);
} else {
- $uf = $globals->asso()->getMembers(null, $se);
+ $uf = $globals->asso()->getMembersFilter(null, $se);
}
- $users = $uf->getUsers(NB_PER_PAGE, $ofs * NB_PER_PAGE);
+ $users = $uf->getUsers(new PlLimit(NB_PER_PAGE, $ofs * NB_PER_PAGE));
$count = $uf->getTotalCount();
$page->assign('pages', floor(($count + NB_PER_PAGE - 1) / NB_PER_PAGE));
@@ -362,7 +340,7 @@ class XnetGrpModule extends PLModule
{
global $globals;
$vcard = new VCard($photos == 'photos', 'Membre du groupe ' . $globals->asso('nom'));
- $vcard->addUsers($globals->asso()->getMembers()->getUIDs());
+ $vcard->addProfiles($globals->asso()->getMembersFilter()->getProfiles());
$vcard->show();
}
@@ -372,10 +350,11 @@ class XnetGrpModule extends PLModule
if (is_null($filename)) {
$filename = $globals->asso('diminutif') . '.csv';
}
- $users = $globals->asso()->getMembers(null, new UFO_Name('directory_name'))->getUsers();
+ $users = $globals->asso()->getMembersFilter(null, new UFO_Name('directory_name'))->getUsers();
header('Content-Type: text/x-csv; charset=utf-8;');
header('Pragma: ');
header('Cache-Control: ');
+ pl_content_headers("text/x-csv");
$page->changeTpl('xnetgrp/annuaire-csv.tpl', NO_SKIN);
$page->assign('users', $users);
}
@@ -383,7 +362,7 @@ class XnetGrpModule extends PLModule
private function removeSubscriptionRequest($uid)
{
global $globals;
- XDB::execute("DELETE FROM groupex.membres_sub_requests
+ XDB::execute("DELETE FROM group_member_sub_requests
WHERE asso_id = {?} AND uid = {?}",
$globals->asso('id'), $uid);
}
@@ -392,7 +371,7 @@ class XnetGrpModule extends PLModule
{
global $globals;
$this->removeSubscriptionRequest($user->id());
- XDB::execute("INSERT IGNORE INTO groupex.membres (asso_id, uid)
+ XDB::execute("INSERT IGNORE INTO group_members (asso_id, uid)
VALUES ({?}, {?})",
$globals->asso('id'), $user->id());
if (XDB::affectedRows() == 1) {
@@ -433,13 +412,13 @@ class XnetGrpModule extends PLModule
// Retrieves the subscription status, and the reason.
$res = XDB::query("SELECT reason
- FROM groupex.membres_sub_requests
+ FROM group_member_sub_requests
WHERE asso_id = {?} AND uid = {?}",
$globals->asso('id'), $user->id());
$reason = ($res->numRows() ? $res->fetchOneCell() : null);
$res = XDB::query("SELECT COUNT(*)
- FROM groupex.membres
+ FROM group_members
WHERE asso_id = {?} AND uid = {?}",
$globals->asso('id'), $user->id());
$already_member = ($res->fetchOneCell() > 0);
@@ -447,7 +426,7 @@ class XnetGrpModule extends PLModule
// Handles the membership request.
if ($already_member) {
$this->removeSubscriptionRequest($user->id());
- $page->kill($user->fullName() . " est déjà membre du groupe !");
+ $page->kill($user->fullName() . ' est déjà membre du groupe !');
} elseif (Env::has('accept')) {
S::assert_xsrf_token();
@@ -472,12 +451,12 @@ class XnetGrpModule extends PLModule
}
if (is_member()) {
- $page->kill("Tu es déjà membre !");
+ $page->kill("Tu es déjà membre !");
return;
}
$res = XDB::query("SELECT uid
- FROM groupex.membres_sub_requests
+ FROM group_member_sub_requests
WHERE uid = {?} AND asso_id = {?}",
S::i('uid'), $globals->asso('id'));
if ($res->numRows() != 0) {
@@ -488,15 +467,15 @@ class XnetGrpModule extends PLModule
if (Post::has('inscrire')) {
S::assert_xsrf_token();
- XDB::execute("INSERT INTO groupex.membres_sub_requests (asso_id, uid, ts, reason)
+ XDB::execute("INSERT INTO group_member_sub_requests (asso_id, uid, ts, reason)
VALUES ({?}, {?}, NOW(), {?})",
$globals->asso('id'), S::i('uid'), Post::v('message'));
$res = XDB::query('SELECT IF(m.email IS NULL,
CONCAT(al.alias,"@polytechnique.org"),
m.email)
- FROM groupex.membres AS m
- INNER JOIN aliases AS al ON (al.type = "a_vie"
- AND al.id = m.uid)
+ FROM group_members AS m
+ INNER JOIN aliases AS al ON (al.type = "a_vie"
+ AND al.uid = m.uid)
WHERE perms="admin" AND m.asso_id = {?}',
$globals->asso('id'));
$emails = $res->fetchColumn();
@@ -552,7 +531,7 @@ class XnetGrpModule extends PLModule
}
$it = XDB::iterator('SELECT s.uid, a.hruid, s.ts AS date
- FROM groupex.membres_sub_requests AS s
+ FROM group_member_sub_requests AS s
INNER JOIN accounts AS a ON(s.uid = a.uid)
WHERE s.asso_id = {?}
ORDER BY s.ts', $globals->asso('id'));
@@ -611,7 +590,7 @@ class XnetGrpModule extends PLModule
$not_in_group_ext = array();
foreach ($subscribers as $mail) {
- $uf = new UserFilter(new UFC_And(new UFC_Group($globals->asso('id')),
+ $uf = new UserFilter(new PFC_And(new UFC_Group($globals->asso('id')),
new UFC_Email($mail)));
if ($uf->getTotalCount() == 0) {
if (User::isForeignEmailAddress($mail)) {
@@ -643,7 +622,7 @@ class XnetGrpModule extends PLModule
if (!User::isForeignEmailAddress($email)) {
$user = User::get($email);
if ($user) {
- XDB::execute("REPLACE INTO groupex.membres (uid, asso_id, origine)
+ XDB::execute("REPLACE INTO group_members (uid, asso_id, origine)
VALUES ({?}, {?}, 'X')",
$user->id(), $globals->asso('id'));
pl_redirect("member/" . $user->login());
@@ -662,7 +641,7 @@ class XnetGrpModule extends PLModule
$market->add();
}
}
- XDB::execute('REPLACE INTO groupex.membres (uid, asso_id, origine, email)
+ XDB::execute('REPLACE INTO group_members (uid, asso_id, origine, email)
VALUES ({?}, {?}, "X", {?})',
$uid, $globals->asso('id'), $email);
$this->removeSubscriptionRequest($uid);
@@ -670,23 +649,23 @@ class XnetGrpModule extends PLModule
}
$page->trigError("Utilisateur invalide");
} else {
- $res = XDB::query('SELECT MAX(uid)+1 FROM groupex.membres');
+ $res = XDB::query('SELECT MAX(uid) + 1 FROM group_members');
$uid = max(intval($res->fetchOneCell()), 50001);
- XDB::execute('REPLACE INTO groupex.membres (uid, asso_id, origine, email)
+ XDB::execute('REPLACE INTO group_members (uid, asso_id, origine, email)
VALUES ({?}, {?}, "ext", {?})',
$uid, $globals->asso('id'), $email);
pl_redirect("member/$email");
}
} else {
- $page->trigError("« $email » n'est pas une adresse email valide.");
+ $page->trigError("« $email » n'est pas une adresse email valide.");
}
}
}
function handler_admin_member_new_ajax(&$page)
{
- header('Content-Type: text/html; charset="UTF-8"');
- $page->changeTpl('xnetgrp/membres-new-search.tpl', NO_SKIN);
+ pl_content_headers("text/html");
+ $page->changeTpl('xnetgrp/membres-new-search.tpl', NO_SKIN);
$users = array();
if (Env::has('login')) {
$user = User::getSilent(Env::t('login'));
@@ -696,18 +675,18 @@ class XnetGrpModule extends PLModule
}
if (empty($users)) {
list($nom, $prenom) = str_replace(array('-', ' ', "'"), '%', array(Env::t('nom'), Env::t('prenom')));
- $cond = new UFC_And(new UFC_Not(new UFC_Registered()));
+ $cond = new PFC_And(new PFC_Not(new UFC_Registered()));
if (!empty($nom)) {
- $cond->addChild(new UFC_Name(UserFilter::LASTNAME, $nom, UFC_Name::CONTAINS));
+ $cond->addChild(new UFC_Name(Profile::LASTNAME, $nom, UFC_Name::CONTAINS));
}
if (!empty($prenom)) {
- $cond->addChild(new UFC_Name(UserFilter::FIRSTNAME, $prenom, UFC_Name::CONTAINS));
+ $cond->addChild(new UFC_Name(Profile::FIRSTNAME, $prenom, UFC_Name::CONTAINS));
}
if (Env::i('promo')) {
$cond->addChild(new UFC_Promo('=', UserFilter::GRADE_ING, Env::i('promo')));
}
$uf = new UserFilter($cond);
- $users = $uf->getUsers(30);
+ $users = $uf->getUsers(new PlLimit(30));
if ($uf->getTotalCount() > 30) {
$page->assign('too_many', true);
$users = array();
@@ -719,14 +698,15 @@ class XnetGrpModule extends PLModule
function unsubscribe(PlUser &$user)
{
global $globals;
- XDB::execute("DELETE FROM groupex.membres
+ XDB::execute("DELETE FROM group_members
WHERE uid = {?} AND asso_id = {?}",
$user->id(), $globals->asso('id'));
if ($globals->asso('notif_unsub')) {
$mailer = new PlMailer('xnetgrp/unsubscription-notif.mail.tpl');
- foreach ($globals->asso()->getMembers()->getUsers() as $user) {
- $mailer->addTo($user);
+ $admins = $globals->asso()->iterAdmins();
+ while ($admin = $admins->next()) {
+ $mailer->addTo($admin);
}
$mailer->assign('group', $globals->asso('nom'));
$mailer->assign('user', $user);
@@ -807,22 +787,22 @@ class XnetGrpModule extends PLModule
}
if ($this->unsubscribe($user)) {
- $page->trigSuccess("{$user->fullName()} a été désinscrit du groupe !");
+ $page->trigSuccess("{$user->fullName()} a été désinscrit du groupe !");
} else {
- $page->trigWarning("{$user->fullName()} a été désinscrit du groupe, mais des erreurs subsistent !");
+ $page->trigWarning("{$user->fullName()} a été désinscrit du groupe, mais des erreurs subsistent !");
}
}
private function changeLogin(PlPage &$page, PlUser &$user, MMList &$mmlist, $login)
{
- require_once 'user.func.inc.php';
// Search the uid of the user...
- $res = XDB::query("SELECT f.id, f.alias
+ $res = XDB::query("SELECT f.uid, f.alias
FROM aliases AS a
- INNER JOIN aliases AS f ON (f.id = a.id AND f.type = 'a_vie')
+ INNER JOIN aliases AS f ON (f.uid = a.uid AND f.type = 'a_vie')
WHERE a.alias = {?}",
$login);
if ($res->numRows() == 0) {
+ // TODO: replace this call to a removed function.
$x = get_not_registered_user($login);
if (!$x) {
$page->trigError("Le login $login ne correspond à aucun X.");
@@ -831,7 +811,7 @@ class XnetGrpModule extends PLModule
$page->trigError("Le login $login correspond a plusieurs camarades.");
return false;
}
- $uid = $x[0]['user_id'];
+ $uid = $x[0]['uid'];
$sub = false;
} else {
list($uid, $login) = $res->fetchOneRow();
@@ -841,17 +821,17 @@ class XnetGrpModule extends PLModule
// Check if the user is already in the group
global $globals;
$res = XDB::query("SELECT uid, email
- FROM groupex.membres
+ FROM group_members
WHERE uid = {?} AND asso_id = {?}",
$uid, $globals->asso('id'));
if ($res->numRows()) {
list($uid, $email) = $res->fetchOneRow();
- XDB::execute("DELETE FROM groupex.membres
+ XDB::execute("DELETE FROM group_members
WHERE uid = {?}",
$user['uid']);
} else {
$email = $user['email'];
- XDB::execute("UPDATE groupex.membres
+ XDB::execute("UPDATE group_members
SET uid = {?}, origine = 'X'
WHERE uid = {?} AND asso_id = {?}",
$uid, $user['uid'], $globals->asso('id'));
@@ -915,9 +895,9 @@ class XnetGrpModule extends PLModule
$user['prenom'] = (Post::v('origine') == 'ext') ? Post::v('prenom') : '';
$user['sexe'] = (Post::v('origine') == 'ext') ? Post::v('sexe') : 0;
$user['origine'] = Post::v('origine');
- XDB::query('UPDATE groupex.membres
- SET prenom={?}, nom={?}, email={?}, sexe={?}, origine={?}
- WHERE uid={?} AND asso_id={?}',
+ XDB::query('UPDATE group_members
+ SET prenom = {?}, nom = {?}, email = {?}, sexe = {?}, origine = {?}
+ WHERE uid = {?} AND asso_id = {?}',
$user['prenom'], $user['nom'], Post::v('email'),
$user['sexe'], $user['origine'],
$user['uid'], $globals->asso('id'));
@@ -929,13 +909,13 @@ class XnetGrpModule extends PLModule
$perms = Post::i('is_admin');
$comm = Post::t('comm');
if ($user['perms'] != $perms || $user['comm'] != $comm) {
- XDB::query('UPDATE groupex.membres
- SET perms={?}, comm={?}
- WHERE uid={?} AND asso_id={?}',
+ XDB::query('UPDATE group_members
+ SET perms = {?}, comm = {?}
+ WHERE uid = {?} AND asso_id = {?}',
$perms ? 'admin' : 'membre', $comm,
$user['uid'], $globals->asso('id'));
if ($perms != $user['perms']) {
- $page->trigSuccess('Permissions modifiées !');
+ $page->trigSuccess('Permissions modifiées !');
}
if ($comm != $user['comm']) {
$page->trigSuccess('Commentaire mis à jour.');
@@ -1027,23 +1007,25 @@ class XnetGrpModule extends PLModule
function handler_photo_announce(&$page, $eid = null) {
if ($eid) {
- $res = XDB::query("SELECT * FROM groupex.announces_photo WHERE eid = {?}", $eid);
+ $res = XDB::query('SELECT *
+ FROM group_announces_photo
+ WHERE eid = {?}', $eid);
if ($res->numRows()) {
$photo = $res->fetchOneAssoc();
- header('Content-Type: image/' . $photo['attachmime']);
+ pl_cached_dynamic_content_headers("image/" . $photo['attachmime']);
echo $photo['attach'];
exit;
}
} else {
$upload = new PlUpload(S::user()->login(), 'xnetannounce');
if ($upload->exists() && $upload->isType('image')) {
- header('Content-Type: ' . $upload->contentType());
+ pl_cached_dynamic_content_headers($upload->contentType());
echo $upload->getContents();
exit;
}
}
global $globals;
- header('Content-Type: image/png');
+ pl_cached_dynamic_content_headers("image/png");
echo file_get_contents($globals->spoolroot . '/htdocs/images/logo.png');
exit;
}
@@ -1071,7 +1053,7 @@ class XnetGrpModule extends PLModule
$art['prenom'] = S::v('prenom');
$art['promo'] = S::v('promo');
$art['hruid'] = S::user()->login();
- $art['peremption'] = Post::v('peremption');
+ $art['expiration'] = Post::v('expiration');
$art['public'] = Post::has('public');
$art['xorg'] = Post::has('xorg');
$art['nl'] = Post::has('nl');
@@ -1104,7 +1086,8 @@ class XnetGrpModule extends PLModule
}
$art['photo'] = $upload->exists() || Post::i('photo');
if (Post::v('valid') == 'Pas d\'image' && !is_null($aid)) {
- XDB::query("DELETE FROM groupex.announces_photo WHERE eid = {?}", $aid);
+ XDB::query('DELETE FROM group_announces_photo
+ WHERE eid = {?}', $aid);
$upload->rm();
Post::kill('valid');
$art['photo'] = false;
@@ -1133,23 +1116,22 @@ class XnetGrpModule extends PLModule
$post = $banana->post($globals->asso('forum'), null,
$art['titre'], MiniWiki::wikiToText($fulltext, false, 0, 80));
}*/
- XDB::query("INSERT INTO groupex.announces
- (user_id, asso_id, create_date, titre, texte, contacts,
- peremption, promo_min, promo_max, flags, post_id)
- VALUES ({?}, {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
+ XDB::query('INSERT INTO group_announces (uid, asso_id, create_date, titre, texte, contacts,
+ expiration, promo_min, promo_max, flags, post_id)
+ VALUES ({?}, {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
S::i('uid'), $globals->asso('id'), $art['titre'], $art['texte'], $art['contact_html'],
- $art['peremption'], $promo_min, $promo_max, $flags, $post);
+ $art['expiration'], $promo_min, $promo_max, $flags, $post);
$aid = XDB::insertId();
if ($art['photo']) {
list($imgx, $imgy, $imgtype) = $upload->imageInfo();
- XDB::execute("INSERT INTO groupex.announces_photo
- SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
+ XDB::execute('INSERT INTO group_announces_photo
+ SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}',
$aid, $imgtype, $imgx, $imgy, $upload->getContents());
}
if ($art['xorg']) {
require_once('validations.inc.php');
$article = new EvtReq("[{$globals->asso('nom')}] " . $art['titre'], $fulltext,
- $art['promo_min'], $art['promo_max'], $art['peremption'], "", S::user(),
+ $art['promo_min'], $art['promo_max'], $art['expiration'], "", S::user(),
$upload);
$article->submit();
$page->trigWarning("L'affichage sur la page d'accueil de Polytechnique.org est en attente de validation.");
@@ -1164,17 +1146,17 @@ class XnetGrpModule extends PLModule
$page->trigWarning("La parution dans la Lettre Mensuelle est en attente de validation.");
}
} else {
- XDB::query("UPDATE groupex.announces
- SET titre={?}, texte={?}, contacts={?}, peremption={?},
- promo_min={?}, promo_max={?}, flags={?}
- WHERE id={?} AND asso_id={?}",
- $art['titre'], $art['texte'], $art['contacts'], $art['peremption'],
+ XDB::query('UPDATE group_announces
+ SET titre = {?}, texte = {?}, contacts = {?}, expiration = {?},
+ promo_min = {?}, promo_max = {?}, flags = {?}
+ WHERE id = {?} AND asso_id = {?}',
+ $art['titre'], $art['texte'], $art['contacts'], $art['expiration'],
$promo_min, $promo_max, $flags,
$art['id'], $globals->asso('id'));
if ($art['photo'] && $upload->exists()) {
list($imgx, $imgy, $imgtype) = $upload->imageInfo();
- XDB::execute("REPLACE INTO groupex.announces_photo
- SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
+ XDB::execute("REPLACE INTO group_announces_photo
+ SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
$aid, $imgtype, $imgx, $imgy, $upload->getContents());
$upload->rm();
}
@@ -1185,10 +1167,10 @@ class XnetGrpModule extends PLModule
}
if (empty($art) && !is_null($aid)) {
- $res = XDB::query("SELECT a.*, FIND_IN_SET('public', a.flags) AS public,
- FIND_IN_SET('photo', a.flags) AS photo
- FROM groupex.announces AS a
- WHERE asso_id = {?} AND a.id = {?}",
+ $res = XDB::query("SELECT *, FIND_IN_SET('public', flags) AS public,
+ FIND_IN_SET('photo', flags) AS photo
+ FROM group_announces
+ WHERE asso_id = {?} AND id = {?}",
$globals->asso('id'), $aid);
if ($res->numRows()) {
$art = $res->fetchOneAssoc();
@@ -1200,7 +1182,7 @@ class XnetGrpModule extends PLModule
if (is_null($aid)) {
$events = XDB::iterator("SELECT *
- FROM groupex.evenements
+ FROM group_events
WHERE asso_id = {?} AND archive = 0",
$globals->asso('id'));
if ($events->total()) {
@@ -1220,14 +1202,14 @@ class XnetGrpModule extends PLModule
if (Env::has('del')) {
S::assert_xsrf_token();
- XDB::execute("DELETE FROM groupex.announces
- WHERE id = {?} AND asso_id = {?}",
+ XDB::execute('DELETE FROM group_announces
+ WHERE id = {?} AND asso_id = {?}',
Env::i('del'), $globals->asso('id'));
}
- $res = XDB::iterator("SELECT a.id, a.titre, a.peremption, a.peremption < CURRENT_DATE() AS perime
- FROM groupex.announces AS a
- WHERE a.asso_id = {?}
- ORDER BY a.peremption DESC",
+ $res = XDB::iterator('SELECT id, titre, expiration, expiration < CURRENT_DATE() AS perime
+ FROM group_announces
+ WHERE asso_id = {?}
+ ORDER BY expiration DESC',
$globals->asso('id'));
$page->assign('articles', $res);
}