X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Flists.php;h=6dcef3472679bb371bf6321c28559d721ee7754d;hb=247ca43bd087a71c05bb700085dd3ac483349192;hp=eec6fa24f52ba86bf8043ffe567caebd08dd642a;hpb=8a70ca6fac73380af967fdd9271a834be25b021e;p=platal.git diff --git a/modules/lists.php b/modules/lists.php index eec6fa2..6dcef34 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -26,25 +26,25 @@ class ListsModule extends PLModule function handlers() { return array( - 'lists' => $this->make_hook('lists', AUTH_MDP), - 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP, 'user', NO_AUTH), - 'lists/create' => $this->make_hook('create', AUTH_MDP, 'lists'), - - 'lists/members' => $this->make_hook('members', AUTH_COOKIE), - 'lists/csv' => $this->make_hook('csv', AUTH_COOKIE), - 'lists/annu' => $this->make_hook('annu', AUTH_COOKIE), - 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE), + 'lists' => $this->make_hook('lists', AUTH_PASSWD, 'user'), + 'lists/ajax' => $this->make_hook('ajax', AUTH_PASSWD, 'user', NO_AUTH), + 'lists/create' => $this->make_hook('create', AUTH_PASSWD, 'lists'), + + 'lists/members' => $this->make_hook('members', AUTH_COOKIE, 'user'), + 'lists/csv' => $this->make_hook('csv', AUTH_COOKIE, 'user'), + 'lists/annu' => $this->make_hook('annu', AUTH_COOKIE, 'user'), + 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE, 'user'), 'lists/archives/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS), - 'lists/moderate' => $this->make_hook('moderate', AUTH_MDP), - 'lists/admin' => $this->make_hook('admin', AUTH_MDP), - 'lists/options' => $this->make_hook('options', AUTH_MDP), - 'lists/delete' => $this->make_hook('delete', AUTH_MDP), + 'lists/moderate' => $this->make_hook('moderate', AUTH_PASSWD, 'user'), + 'lists/admin' => $this->make_hook('admin', AUTH_PASSWD, 'user'), + 'lists/options' => $this->make_hook('options', AUTH_PASSWD, 'user'), + 'lists/delete' => $this->make_hook('delete', AUTH_PASSWD, 'user'), - 'lists/soptions' => $this->make_hook('soptions', AUTH_MDP), - 'lists/check' => $this->make_hook('check', AUTH_MDP), - 'admin/lists' => $this->make_hook('admin_all', AUTH_MDP, 'admin'), - 'admin/aliases' => $this->make_hook('aaliases', AUTH_MDP, 'admin') + 'lists/soptions' => $this->make_hook('soptions', AUTH_PASSWD, 'user'), + 'lists/check' => $this->make_hook('check', AUTH_PASSWD, 'user'), + 'admin/lists' => $this->make_hook('admin_all', AUTH_PASSWD, 'admin'), + 'admin/aliases' => $this->make_hook('aaliases', AUTH_PASSWD, 'admin') ); } @@ -346,11 +346,11 @@ class ListsModule extends PLModule $this->prepare_client($page); $members = $this->client->get_members($liste); $list = list_fetch_basic_info(list_extract_members($members[1])); - pl_cached_content_headers('text/x-csv', 1); + pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1); - echo "email,nom,promo\n"; - echo implode("\n", $list); - exit; + echo utf8_decode("Nom;Prénom;Promotion\n"); + echo utf8_decode(implode("\n", $list)); + exit(); } function handler_annu($page, $liste = null, $action = null, $subaction = null) @@ -377,29 +377,34 @@ class ListsModule extends PLModule $page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails."); } - global $platal; list(,$members) = $this->client->get_members($liste); - $users = array(); - foreach ($members as $m) { - $users[] = $m[1]; + + if ($action == 'moderators') { + $users = $owners; + $show_moderators = true; + $action = $subaction; + $subaction = ''; + } else { + $show_moderators = false; + $users = array(); + foreach ($members as $m) { + $users[] = $m[1]; + } } + require_once 'userset.inc.php'; - $view = new ArraySet($users); - $view->addMod('trombi', 'Trombinoscope', true, array('with_promo' => true)); + $view = new UserArraySet($users); + $view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true)); + $view->addMod('listmember', 'Annuaire', true); if (empty($GLOBALS['IS_XNET_SITE'])) { $view->addMod('minifiche', 'Mini-fiches', false); } - // TODO: Reactivate when the new map is completed. - // $view->addMod('geoloc', 'Planisphère'); + $view->addMod('map', 'Planisphère'); $view->apply("lists/annu/$liste", $page, $action, $subaction); - if ($action == 'geoloc' && $subaction) { - return; - } $page->changeTpl('lists/annu.tpl'); - $moderos = list_sort_owners($owners[1]); $page->assign_by_ref('details', $owners[0]); - $page->assign_by_ref('owners', $moderos); + $page->assign('show_moderators', $show_moderators); } function handler_archives($page, $liste = null, $action = null, $artid = null) @@ -613,8 +618,9 @@ class ListsModule extends PLModule case 'marketu': case 'markets': require_once 'emails.inc.php'; + $user = User::get($uids[$key]); $mail = valide_email($mails[$key]); - if (isvalid_email_redirection($mail)) { + if (isvalid_email_redirection($mail, $user)) { $from = ($action == 'marketu') ? 'user' : 'staff'; $market = Marketing::get($uids[$key], $mail); if (!$market) { @@ -638,6 +644,10 @@ class ListsModule extends PLModule $members = User::getBulkForlifeEmails(Env::v('add_member'), true, array('ListsModule', 'no_login_callback')); + // Make sure we send a list (array_values) of unique (array_unique) + // emails. + $members = array_values(array_unique($members)); + $arr = $this->client->mass_subscribe($liste, $members); if (is_array($arr)) { foreach($arr as $addr) { @@ -656,6 +666,10 @@ class ListsModule extends PLModule $members = User::getBulkForlifeEmails($upload->getContents(), true, array('ListsModule', 'no_login_callback')); + // Make sure we send a list (array_values) of unique (array_unique) + // emails. + $members = array_values(array_unique($members)); + $arr = $this->client->mass_subscribe($liste, $members); if (is_array($arr)) { foreach($arr as $addr) {