public function commit() { if (!$this->warning) { Platal::load('admin', 'homonyms.inc.php'); fix_homonym($this->user, $this->email); } return true; }
function smarty_function_poison($params, $smarty) { if (S::logged()) { return ''; } $count = isset($params['count']) ? $params['count'] : 20; $seed = isset($params['seed']) ? $params['seed'] : date('r'); Platal::load('poison', 'poison.inc.php'); $emails = get_poison_emails($seed, $count); $str = "<textarea>"; foreach ($emails as $email) { $str .= "<a href=\"mailto:{$email}\">{$email}</a> "; } return $str . '</textarea>'; }
function handler_ig_events($page) { require_once 'gadgets/gadgets.inc.php'; init_igoogle_html('gadgets/ig-events.tpl', AUTH_COOKIE); $events = XDB::iterator("SELECT SQL_CALC_FOUND_ROWS\n e.id, e.titre, UNIX_TIMESTAMP(e.creation_date) AS creation_date,\n ev.uid IS NULL AS nonlu, e.uid\n FROM announces AS e\n LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})\n WHERE FIND_IN_SET('valide', e.flags) AND expiration >= NOW()\n ORDER BY e.creation_date DESC", S::i('uid')); $page->assign('event_count', XDB::query("SELECT FOUND_ROWS()")->fetchOneCell()); Platal::load('events', 'feed.inc.php'); $user = S::user(); $data = array(); while ($e = PlFeed::nextEvent($events, $user)) { $data[] = $e; if (count($data) == 5) { break; } } $page->assign('events', $data); }
* This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ Platal::load('newsletter'); class FXLetterModule extends NewsletterModule { function handlers() { return array('fxletter' => $this->make_hook('nl', AUTH_COOKIE, 'user'), 'fxletter/out' => $this->make_hook('out', AUTH_COOKIE, 'user'), 'fxletter/show' => $this->make_hook('nl_show', AUTH_COOKIE, 'user'), 'fxletter/search' => $this->make_hook('nl_search', AUTH_COOKIE, 'user'), 'fxletter/admin' => $this->make_hook('admin_nl', AUTH_PASSWD, 'user'), 'fxletter/admin/edit' => $this->make_hook('admin_nl_edit', AUTH_PASSWD, 'user'), 'fxletter/admin/edit/valid' => $this->make_hook('admin_nl_valid', AUTH_PASSWD, 'user'), 'fxletter/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_PASSWD, 'user'), 'fxletter/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_PASSWD, 'user'), 'fxletter/admin/categories' => $this->make_hook('admin_nl_cat', AUTH_PASSWD, 'user'), 'fxletter/stat' => $this->make_hook('stat_nl', AUTH_PASSWD, 'user')); } protected function getNl() { require_once 'newsletter.inc.php'; return NewsLetter::forGroup(NewsLetter::GROUP_FX); } function handler_out($page, $hash = null, $issue_id = null) { $hash = $hash == 'nohash' ? null : $hash; if (!$hash) {
/** Prepare a MailingList from its mailbox */ protected function prepare_list($mbox) { // Required: modules/xnetlists.php uses it too. Platal::load('lists', 'lists.inc.php'); return new MailingList($mbox, $this->get_lists_domain()); }
public function apply(PlPage $page) { Platal::load('geoloc'); if (Get::b('ajax')) { $uids = $this->set->getIds(new PlLimit()); $pids = Profile::getPIDsFromUIDs($uids); GeolocModule::assign_json_to_map($page, $pids); $page->runJSON(); exit; } else { GeolocModule::prepare_map($page); return 'geoloc/index.tpl'; } }
function handler_directory_sync($page) { global $globals; require_once 'emails.inc.php'; $page->changeTpl('xnetgrp/sync.tpl'); Platal::load('lists', 'lists.inc.php'); if (Env::has('add_users')) { S::assert_xsrf_token(); $users = array_keys(Env::v('add_users')); $former_users = XDB::fetchColumn('SELECT uid FROM group_former_members WHERE remember = TRUE AND asso_id = {?} AND uid IN {?}', $globals->asso('id'), $users); $new_users = array_diff($users, $former_users); foreach ($former_users as $uid) { $user = User::getSilentWithUID($uid); $page->trigWarning($user->fullName() . ' est un ancien membre du groupe qui ne souhaite pas y revenir.'); } if (count($former_users) > 1) { $page->trigWarning('S\'ils souhaitent revenir dans le groupe, il faut qu\'ils en fassent la demande sur la page d\'accueil du groupe.'); } elseif (count($former_users)) { $page->trigWarning('S\'il souhaite revenir dans le groupe, il faut qu\'il en fasse la demande sur la page d\'accueil du groupe.'); } $data = array(); foreach ($new_users as $uid) { Group::subscribe($globals->asso('id'), $uid); } } if (Env::has('add_nonusers')) { S::assert_xsrf_token(); $nonusers = array_keys(Env::v('add_nonusers')); foreach ($nonusers as $email) { if ($user = User::getSilent($email) || !isvalid_email($email)) { continue; } list($local_part, $domain) = explode('@', strtolower($email)); $hruid = User::makeHrid($local_part, $domain, 'ext'); if ($user = User::getSilent($hruid)) { continue; } require_once 'name.func.inc.php'; $parts = explode('.', $local_part); if (count($parts) == 1) { $lastname = $display_name = capitalize_name($mbox); $firstname = ''; } else { $display_name = $firstname = capitalize_name($parts[0]); $lastname = capitalize_name(implode(' ', array_slice($parts, 1))); } $full_name = build_full_name($firstname, $lastname); $directory_name = build_directory_name($firstname, $lastname); $sort_name = build_sort_name($firstname, $lastname); XDB::execute('INSERT INTO accounts (hruid, display_name, full_name, directory_name, sort_name, firstname, lastname, email, type, state) VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, \'xnet\', \'disabled\')', $hruid, $display_name, $full_name, $directory_name, $sort_name, $firstname, $lastname, $email); $uid = XDB::insertId(); Group::subscribe($globals->asso('id'), $uid); } } if (Env::has('add_users') || Env::has('add_nonusers')) { $page->trigSuccess('Ajouts réalisés avec succès.'); } $user = S::user(); $client = new MMList($user, $globals->asso('mail_domain')); $lists = $client->get_lists(); $members = array(); foreach ($lists as $list) { $details = $client->get_members($list['list']); $members = array_merge($members, list_extract_members($details[1])); } $members = array_unique($members); $uids = array(); $users = array(); $nonusers = array(); foreach ($members as $email) { if ($user = User::getSilent($email)) { $uids[] = $user->id(); } else { $nonusers[] = $email; } } $aliases = iterate_list_alias($globals->asso('mail_domain')); foreach ($aliases as $alias) { list($local_part, $domain) = explode('@', $alias); $aliases_members = list_alias_members($local_part, $domain); $users = array_merge($users, $aliases_members['users']); $nonusers = array_merge($nonusers, $aliases_members['nonusers']); } foreach ($users as $user) { $uids[] = $user->id(); } $nonusers = array_unique($nonusers); $uids = array_unique($uids); if (count($uids)) { $uids = XDB::fetchColumn('SELECT a.uid FROM accounts AS a WHERE a.uid IN {?} AND NOT EXISTS (SELECT * FROM group_members AS g WHERE a.uid = g.uid AND g.asso_id = {?})', $uids, $globals->asso('id')); $users = User::getBulkUsersWithUIDs($uids); usort($users, 'User::compareDirectoryName'); } else { $users = array(); } sort($nonusers); $page->assign('users', $users); $page->assign('nonusers', $nonusers); }
* This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ Platal::load('lists'); class XnetListsModule extends ListsModule { function handlers() { return array('%grp/lists' => $this->make_hook('lists', AUTH_PASSWD, 'groupmember'), '%grp/lists/create' => $this->make_hook('create', AUTH_PASSWD, 'groupmember'), '%grp/lists/members' => $this->make_hook('members', AUTH_COOKIE, 'groups'), '%grp/lists/csv' => $this->make_hook('csv', AUTH_COOKIE, 'groups'), '%grp/lists/annu' => $this->make_hook('annu', AUTH_COOKIE, 'groups'), '%grp/lists/archives' => $this->make_hook('archives', AUTH_COOKIE, 'groups'), '%grp/lists/archives/rss' => $this->make_hook('rss', AUTH_PUBLIC), '%grp/lists/moderate' => $this->make_hook('moderate', AUTH_PASSWD, 'groups'), '%grp/lists/admin' => $this->make_hook('admin', AUTH_PASSWD, 'groups'), '%grp/lists/options' => $this->make_hook('options', AUTH_PASSWD, 'groups'), '%grp/lists/delete' => $this->make_hook('delete', AUTH_PASSWD, 'groups'), '%grp/lists/soptions' => $this->make_hook('soptions', AUTH_PASSWD, 'groups'), '%grp/lists/check' => $this->make_hook('check', AUTH_PASSWD, 'groups'), '%grp/lists/sync' => $this->make_hook('sync', AUTH_PASSWD, 'groups'), '%grp/alias/admin' => $this->make_hook('aadmin', AUTH_PASSWD, 'groupadmin'), '%grp/alias/create' => $this->make_hook('acreate', AUTH_PASSWD, 'groupadmin'), 'profile' => $this->make_hook('profile', AUTH_PUBLIC)); } protected function get_lists_domain() { global $globals; return $globals->asso('mail_domain'); } function handler_lists($page, $order_by = null, $order = null) { require_once 'emails.inc.php'; if (!$this->get_lists_domain()) {