protected function _mail_ps($isok) { $maildate = make_datetime($this->expiration)->format('d / m / Y'); return "\nPS : pour rappel, en voici le contenu :" . "\n--------------------------------------------------------------------------\n" . $this->titre . "\n--------------------------------------------------------------------------\n" . $this->texte . "\n\nPour les promotions de " . $this->pmin . " à " . $this->pmax . ", avec expiration le " . $maildate . ".\n"; }
function handler_edit($page) { global $globals; $page->changeTpl('xnetgrp/edit.tpl'); $error = false; if (S::admin()) { $domains = XDB::iterator('SELECT * FROM group_dom ORDER BY nom'); $page->assign('domains', $domains); $page->assign('super', true); } if (Post::has('submit')) { S::assert_xsrf_token(); $flags = new PlFlagSet('wiki_desc'); $flags->addFlag('notif_unsub', Post::i('notif_unsub') == 1); $site = Post::t('site'); if ($site && $site != "http://") { $scheme = parse_url($site, PHP_URL_SCHEME); if (!$scheme) { $site = "http://" . $site; } } else { $site = ""; } $notify_all = Post::v('notify_all') ? true : false; if (!$notify_all) { $to_notify = array(); $uf = new UserFilter(new UFC_Group($globals->asso('id'), true)); $uids = $uf->getIds(); foreach ($uids as $uid) { if (Post::b('to_notify_' . $uid)) { $to_notify[] = $uid; } } if (count($to_notify) == 0) { $notify_all = true; $page->trigWarning("Aucun animateur n'ayant été selectionné pour recevoir les demandes d'inscriptions, tous le seront."); } } $flags->addFlag('notify_all', $notify_all); if (S::admin()) { $page->assign('super', true); if (Post::v('mail_domain') && strstr(Post::v('mail_domain'), '.') === false) { $page->trigError('Le domaine doit être un FQDN (aucune modification effectuée) !!!'); $error = true; } if (Post::t('nom') == '' || Post::t('diminutif') == '') { $page->trigError('Ni le nom ni le diminutif du groupe ne peuvent être vide.'); $error = true; } if ($error) { $page->assign('nom', Post::t('nom')); $page->assign('diminutif', Post::t('diminutif')); $page->assign('mail_domain', Post::t('mail_domain')); $page->assign('cat', Post::v('cat')); $page->assign('dom', Post::v('dom')); $page->assign('ax', Post::v('ax')); $page->assign('axDate', Post::t('axDate')); $page->assign('site', $site); $page->assign('resp', Post::t('resp')); $page->assign('mail', Post::t('mail')); $page->assign('phone', Post::t('phone')); $page->assign('fax', Post::t('fax')); $page->assign('address', Post::t('address')); $page->assign('forum', Post::t('forum')); $page->assign('inscriptible', Post::v('inscriptible')); $page->assign('sub_url', Post::t('sub_url')); $page->assign('unsub_url', Post::t('unsub_url')); $page->assign('welcome_msg', Post::t('welcome_msg')); $page->assign('pub', Post::v('pub')); $page->assign('notif_unsub', Post::i('notif_unsub')); $page->assign('descr', Post::t('descr')); $page->assign('disable_mails', Post::b('disable_mails')); $page->assign('status', Post::v('status')); $page->assign('error', $error); return; } $axDate = make_datetime(Post::v('axDate')); if (Post::t('axDate') != '') { $axDate = make_datetime(Post::v('axDate'))->format('Y-m-d'); } else { $axDate = null; } XDB::execute("UPDATE groups\n SET nom={?}, diminutif={?}, cat={?}, dom={?},\n descr={?}, site={?}, mail={?}, resp={?},\n forum={?}, mail_domain={?}, ax={?}, axDate = {?}, pub={?},\n sub_url={?}, inscriptible={?}, unsub_url={?},\n flags = {?}, welcome_msg = {?}, disable_mails = {?},\n status = {?}\n WHERE id={?}", Post::v('nom'), Post::v('diminutif'), Post::v('cat'), Post::i('dom') == 0 ? null : Post::i('dom'), Post::v('descr'), $site, Post::v('mail'), Post::v('resp'), Post::v('forum'), Post::v('mail_domain'), Post::has('ax'), $axDate, Post::v('pub'), Post::v('sub_url'), Post::v('inscriptible'), Post::v('unsub_url'), $flags, Post::t('welcome_msg'), Post::b('disable_mails'), Post::v('status'), $globals->asso('id')); if (Post::v('mail_domain')) { XDB::execute('INSERT IGNORE INTO email_virtual_domains (name) VALUES ({?})', Post::t('mail_domain')); XDB::execute('UPDATE email_virtual_domains SET aliasing = id WHERE name = {?}', Post::t('mail_domain')); } } else { XDB::execute("UPDATE groups\n SET descr={?}, site={?}, mail={?}, resp={?},\n forum={?}, pub= {?}, sub_url={?},\n unsub_url = {?}, flags = {?}, welcome_msg = {?},\n status = {?}\n WHERE id={?}", Post::v('descr'), $site, Post::v('mail'), Post::v('resp'), Post::v('forum'), Post::v('pub'), Post::v('sub_url'), Post::v('unsub_url'), $flags, Post::t('welcome_msg'), Post::v('status'), $globals->asso('id')); } Phone::deletePhones(0, Phone::LINK_GROUP, $globals->asso('id')); $phone = new Phone(array('link_type' => 'group', 'link_id' => $globals->asso('id'), 'id' => 0, 'type' => 'fixed', 'display' => Post::v('phone'), 'pub' => 'public')); $fax = new Phone(array('link_type' => 'group', 'link_id' => $globals->asso('id'), 'id' => 1, 'type' => 'fax', 'display' => Post::v('fax'), 'pub' => 'public')); $phone->save(); $fax->save(); Address::deleteAddresses(null, Address::LINK_GROUP, null, $globals->asso('id')); $address = new Address(array('groupid' => $globals->asso('id'), 'type' => Address::LINK_GROUP, 'text' => Post::v('address'))); $address->save(); 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."); } else { XDB::execute('UPDATE groups SET logo = {?}, logo_mime = {?} WHERE id = {?}', $upload->getContents(), $upload->contentType(), $globals->asso('id')); $upload->rm(); } } XDB::execute("UPDATE group_members\n SET flags = ''\n WHERE asso_id = {?}", $globals->asso('id')); if (!$notify_all) { XDB::execute("UPDATE group_members\n SET flags = 'notify'\n WHERE asso_id = {?} AND uid IN {?}", $globals->asso('id'), $to_notify); } pl_redirect('../' . Post::v('diminutif', $globals->asso('diminutif')) . '/edit'); } $uf = new UserFilter(new UFC_Group($globals->asso('id'), true, UFC_Group::NOTIFIED)); $page->assign('notified', $uf->getUsers()); $uf = new UserFilter(new UFC_Group($globals->asso('id'), true, UFC_Group::UNNOTIFIED)); $page->assign('unnotified', $uf->getUsers()); $page->assign('error', $error); $page->assign('cat', $globals->asso('cat')); $page->assign('dom', $globals->asso('dom')); $page->assign('ax', $globals->asso('ax')); $page->assign('inscriptible', $globals->asso('inscriptible')); $page->assign('pub', $globals->asso('pub')); $page->assign('notif_unsub', $globals->asso('notif_unsub')); $page->assign('notify_all', $globals->asso('notify_all')); $page->assign('disable_mails', $globals->asso('disable_mails')); $page->assign('status', $globals->asso('status')); }
public function __construct($active = false, $comparison = null, $date = null) { $this->active = $active; $this->comparison = $comparison; $this->date = make_datetime($date); }