}
// }}}
-// {{{ function new_group_page()
+// {{{ function new_group_open_page()
-function new_group_page($tpl_name)
+function new_group_open_page($tpl_name, $refuse_access = false)
{
global $page, $globals;
$page->assign('asso', $globals->asso());
$page->setType($globals->asso('cat'));
- if (!is_member() && !S::has_perms()) {
+ if ($refuse_access) {
$page->kill("Vous n'avez pas les droits suffisants pour accéder à cette page");
}
}
// }}}
-// {{{ function new_groupadmin_page()
+// {{{ function new_group_page()
-function new_groupadmin_page($tpl_name)
+function new_group_page($tpl_name)
{
- global $page, $globals;
-
- new_page($tpl_name);
-
- $page->useMenu();
- $page->assign('asso', $globals->asso());
- $page->setType($globals->asso('cat'));
+ new_group_open_page($tpl_name, !is_member() && !S::has_perms());
+}
+// }}}
+// {{{ function new_groupadmin_page()
- if (!may_update()) {
- $page->kill("Vous n'avez pas les droits suffisants pour accéder à cette page");
- }
+function new_groupadmin_page($tpl_name)
+{
+ new_group_open_page($tpl_name, !may_update());
}
// }}}
$sub['liste des groupes'] = 'plan';
$sub['documentation'] = 'Xnet';
$menu["Menu Principal"] = $sub;
-
- if (S::logged() && (is_member() || may_update())) {
+
+ if (S::logged()) {
$sub = array();
$dim = $globals->asso('diminutif');
$sub['présentation'] = "$dim/";
- if (may_update() || $globals->asso('pub') == 'public') {
+ if (may_update() || (is_member() && $globals->asso('pub') == 'public')) {
$sub['annuaire du groupe'] = "$dim/annuaire";
$sub['carte'] = "$dim/geoloc";
}
- if ($globals->asso('mail_domain')) {
+ if ((is_member() || may_update()) && $globals->asso('mail_domain')) {
$sub['listes de diffusion'] = "$dim/lists";
- $sub['envoyer un mail'] = "$dim/mail";
}
$sub['événement'] = "$dim/events";
- $sub['télépaiement'] = "$dim/paiement";
+ if (may_update() || is_member()) {
+ $sub['télépaiement'] = "$dim/paiement";
+ }
$menu[$globals->asso('nom')] = $sub;
}
$sub = array();
$sub['modifier l\'accueil'] = "$dim/edit";
if ($globals->asso('mail_domain')) {
+ $sub['envoyer un mail'] = "$dim/mail";
$sub['créer une liste'] = "$dim/lists/create";
$sub['créer un alias'] = "$dim/alias/create";
}
{
global $globals;
- new_group_page('xnetevents/index.tpl');
+ new_group_open_page('xnetevents/index.tpl');
if (Post::has('del')) {
if (!may_update()) {
$eid = Post::v('del');
$res = XDB::query("SELECT asso_id, short_name FROM groupex.evenements
- WHERE eid = {?} AND asso_id = {?}",
- $eid, $globals->asso('id'));
+ WHERE eid = {?} AND asso_id = {?}",
+ $eid, $globals->asso('id'));
$tmp = $res->fetchOneRow();
if (!$tmp) {
INNER JOIN x4dat.auth_user_md5 AS u ON u.user_id = e.organisateur_uid
INNER JOIN x4dat.aliases AS a ON (a.type = 'a_vie' AND a.id = u.user_id)
LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
- WHERE asso_id = {?}
- GROUP BY e.eid
+ WHERE asso_id = {?}"
+ . (is_member() || may_update() ? "" : " AND accept_nonmembre != 0 ")
+ . "GROUP BY e.eid
ORDER BY debut", S::v('uid'), $globals->asso('id'));
$evts = array();
while ($e = $evenements->next()) {
+ $e['show_participants'] = ($e['show_participants'] && (is_member() || may_update()));
$res = XDB::query(
"SELECT titre, details, montant, ei.item_id, nb
FROM groupex.evenements_items AS ei
{
require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
- new_group_page('xnetevents/subscribe.tpl');
+ new_group_open_page('xnetevents/subscribe.tpl');
$evt = get_event_detail($eid);
if (!$evt) {
if (!$evt['inscr_open']) {
$page->kill('Les inscriptions pour cet événement sont closes');
}
+ if (!$evt['accept_nonmembre'] && !is_member() && !may_update()) {
+ $page->kill('Cet événement est fermé aux non-membres du groupe');
+ }
$page->assign('event', $evt);
);
$trivial = array('intitule', 'descriptif', 'noinvite',
- 'show_participants');
+ 'show_participants', 'accept_nonmembre');
foreach ($trivial as $k) {
$evt[$k] = Post::v($k);
}
SET eid={?}, asso_id={?}, organisateur_uid={?}, intitule={?},
paiement_id = {?}, descriptif = {?}, debut = {?},
fin = {?}, show_participants = {?}, short_name = {?},
- deadline_inscription = {?}, noinvite = {?}',
+ deadline_inscription = {?}, noinvite = {?},
+ accept_nonmembre = {?}',
$evt['eid'], $evt['asso_id'], $evt['organisateur_uid'],
$evt['intitule'], $evt['paiement_id'], $evt['descriptif'],
$evt['debut'], $evt['fin'], $evt['show_participants'],
$evt['short_name'], $evt['deadline_inscription'],
- $evt['noinvite']);
+ $evt['noinvite'], $evt['accept_nonmembre']);
// if new event, get its id
if (!$eid) {
$res = XDB::query(
"SELECT eid, intitule, descriptif, debut, fin,
show_participants, paiement_id, short_name,
- deadline_inscription, noinvite
+ deadline_inscription, noinvite, accept_nonmembre
FROM groupex.evenements
WHERE eid = {?}", $eid);
$evt = $res->fetchOneAssoc();