Ejemplo n.º 1
0
 /** Register a moderation decision.
  * @param $mlist MailingList: the mailing list being moderated
  * @param $mid int: the message being moderated
  */
 protected function moderate_mail($mlist, $mid)
 {
     if (Env::has('mok')) {
         $action = 'accept';
     } elseif (Env::has('mno')) {
         $action = 'refuse';
     } elseif (Env::has('mdel')) {
         $action = 'delete';
     } else {
         return false;
     }
     Get::kill('mid');
     return XDB::execute("INSERT IGNORE INTO  email_list_moderate\n                                         VALUES  ({?}, {?}, {?}, {?}, {?}, NOW(), {?}, NULL)", $mlist->mbox, $mlist->domain, $mid, S::i('uid'), $action, Post::v('reason'));
 }
Ejemplo n.º 2
0
 protected function startSessionAs($user, $level)
 {
     // The user must have 'groups' permission to access X.net
     if (!$user->checkPerms('groups')) {
         return false;
     }
     if ($level == AUTH_SUID) {
         S::set('auth', AUTH_PASSWD);
     }
     S::set('uid', $user->uid);
     S::set('hruid', $user->hruid);
     // XXX: Transition code, should not be in session anymore
     S::set('display_name', $user->display_name);
     S::set('full_name', $user->full_name);
     S::set('femme', $user->isFemale());
     S::set('email_format', $user->email_format);
     S::set('token', $user->token);
     S::set('perms', $user->perms);
     S::set('is_admin', $user->is_admin);
     // Add the 'user' perms to the user.
     $this->makePerms($user->perms, $user->is_admin);
     S::kill('challenge');
     S::kill('loginX');
     S::kill('may_update');
     S::kill('is_member');
     Get::kill('uid');
     Get::kill('PHPSESSID');
     $args = array();
     foreach ($_GET as $key => $val) {
         $args[] = urlencode($key) . '=' . urlencode($val);
     }
     return true;
 }
Ejemplo n.º 3
0
 function handler_admin($page)
 {
     $page->changeTpl('xnet/admin.tpl');
     if (Get::has('del')) {
         $res = XDB::query('SELECT id, nom, mail_domain
                                        FROM groups WHERE diminutif={?}', Get::v('del'));
         list($id, $nom, $domain) = $res->fetchOneRow();
         $page->assign('nom', $nom);
         if ($id && Post::has('del')) {
             S::assert_xsrf_token();
             XDB::query('DELETE FROM group_members WHERE asso_id={?}', $id);
             $page->trigSuccess('membres supprimés');
             if ($domain) {
                 XDB::execute('DELETE  v
                                 FROM  email_virtual         AS v
                           INNER JOIN  email_virtual_domains AS d ON (v.domain = d.id)
                                WHERE  d.name = {?}', $domain);
                 XDB::execute('DELETE FROM  email_virtual_domains
                                     WHERE  name = {?}', $domain);
                 $page->trigSuccess('suppression des alias mails');
                 $mmlist = new MMList(S::v('uid'), S::v('password'), $domain);
                 if ($listes = $mmlist->get_lists()) {
                     foreach ($listes as $l) {
                         $mmlist->delete_list($l['list'], true);
                     }
                     $page->trigSuccess('mail lists surpprimées');
                 }
             }
             XDB::query('DELETE FROM groups WHERE id={?}', $id);
             $page->trigSuccess("Groupe {$nom} supprimé");
             Get::kill('del');
         }
         if (!$id) {
             Get::kill('del');
         }
     }
     if (Post::has('diminutif') && Post::v('diminutif') != "") {
         S::assert_xsrf_token();
         $res = XDB::query('SELECT  COUNT(*)
                              FROM  groups
                             WHERE  diminutif = {?}', Post::v('diminutif'));
         if ($res->fetchOneCell() == 0) {
             XDB::execute('INSERT INTO  groups (id, diminutif)
                                VALUES  (NULL, {?})', Post::v('diminutif'));
             pl_redirect(Post::v('diminutif') . '/edit');
         } else {
             $page->trigError('Le diminutif demandé est déjà pris.');
         }
     }
     $res = XDB::query('SELECT  nom, diminutif
                          FROM  groups
                      ORDER BY  nom');
     $page->assign('assos', $res->fetchAllAssoc());
 }