Replaces deprecated method S::has_perms with S::admin.
authorVincent Zanotti <vincent.zanotti@m4x.org>
Mon, 15 Jun 2009 18:42:40 +0000 (20:42 +0200)
committerVincent Zanotti <vincent.zanotti@m4x.org>
Mon, 15 Jun 2009 18:42:40 +0000 (20:42 +0200)
Signed-off-by: Vincent Zanotti <vincent.zanotti@m4x.org>
17 files changed:
classes/user.php
classes/xnetpage.php
classes/xnetsession.php
core
include/banana/forum.inc.php
include/banana/hooks.inc.php
include/banana/ml.inc.php
include/banana/moderate.inc.php
include/emails.inc.php
include/security.inc.php
modules/auth/auth.inc.php
modules/axletter.php
modules/axletter/axletter.inc.php
modules/email.php
modules/search.php
modules/search/classes.inc.php
modules/xnetgrp.php

index f633e4e..eb8390d 100644 (file)
@@ -216,7 +216,7 @@ class User extends PlUser
     public static function _default_user_callback($login, $results)
     {
         $result_count = count($results);
-        if ($result_count == 0 || !S::has_perms()) {
+        if ($result_count == 0 || !S::admin()) {
             Platal::page()->trigError("Il n'y a pas d'utilisateur avec l'identifiant : $login");
         } else {
             Platal::page()->trigError("Il y a $result_count utilisateurs avec cet identifiant : " . join(', ', $results));
index 50d86bb..9f86aca 100644 (file)
@@ -114,12 +114,12 @@ class XnetPage extends PlPage
                 $sub['créer une liste']     = "$dim/lists/create";
                 $sub['créer un alias']      = "$dim/alias/create";
             }
-            if (S::has_perms()) {
+            if (S::admin()) {
                 $sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;');
                 $sub['clear cache'] = array('href' => 'purge_cache?token=' . S::v('xsrf_token'), 'style' => 'color: gray;');
             }
             $menu['Administrer'] = $sub;
-        } elseif (S::has_perms()) {
+        } elseif (S::admin()) {
             $sub = array();
             $sub['gérer les groupes'] = 'admin';
             $sub['clear cache'] = 'purge_cache?token=' . S::v('xsrf_token');
index 74648cf..e69e6eb 100644 (file)
@@ -162,7 +162,7 @@ function may_update($force = false, $lose = false)
         return false;
     } elseif ($lose) {
         $may_update[$asso_id] = false;
-    } elseif (S::has_perms() || (S::has('suid') && $force)) {
+    } elseif (S::admin() || (S::has('suid') && $force)) {
         $may_update[$asso_id] = true;
     } elseif (!isset($may_update[$asso_id]) || $force) {
         $res = XDB::query("SELECT  perms
diff --git a/core b/core
index a105f58..dd919c9 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit a105f588e354b59ff3bf2095e8e977533cd46220
+Subproject commit dd919c97a745363b0a9bfcb7c18d6c4b35ee8c11
index 0b1f2e5..7ccabd7 100644 (file)
@@ -24,7 +24,7 @@ require_once 'banana/hooks.inc.php';
 
 function hook_checkcancel($_headers)
 {
-    return ($_headers['x-org-id'] == S::v('hruid') or S::has_perms());
+    return ($_headers['x-org-id'] == S::v('hruid') or S::admin());
 }
 
 class ForumsBanana extends Banana
@@ -41,7 +41,7 @@ class ForumsBanana extends Banana
         array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail');
         Banana::$nntp_host = 'news://web_' . $user->login()
                            . ":{$globals->banana->password}@{$globals->banana->server}:{$globals->banana->port}/";
-        if (S::has_perms()) {
+        if (S::admin()) {
             Banana::$msgshow_mimeparts[] = 'source';
         }
         Banana::$debug_nntp = ($globals->debug & DEBUG_BT);
index d8cd9f1..6f9e8f0 100644 (file)
@@ -209,7 +209,7 @@ function make_Organization()
     global $globals;
     $perms = S::v('perms');
     $group = $globals->asso('nom');
-    if (S::has_perms()) {
+    if (S::admin()) {
         return "Administrateur de Polytechnique.org";
     } else if ($group && $perms->hasFlag('groupadmin')) {
         return "Animateur de $group";
index b78139c..1bf497a 100644 (file)
@@ -59,7 +59,7 @@ class MLBanana extends Banana
         Banana::$debug_smarty = ($globals->debug & DEBUG_SMARTY);
         Banana::$mbox_helper = $globals->banana->mbox_helper;
         Banana::$feed_updateOnDemand = true;
-        if (S::has_perms()) {
+        if (S::admin()) {
             Banana::$msgshow_mimeparts[] = 'source';
         }
         array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail');
index 753eb40..d789360 100644 (file)
@@ -25,7 +25,7 @@ require_once 'banana/hooks.inc.php';
 
 function hook_checkcancel($_headers)
 {
-    return ($_headers['x-org-id'] == S::v('hruid') or S::has_perms());
+    return ($_headers['x-org-id'] == S::v('hruid') or S::admin());
 }
 
 function hook_makeLink($params)
index ec7946d..73d539a 100644 (file)
@@ -252,7 +252,7 @@ class EmailRedirection extends Email
 
     public function clean_errors()
     {
-        if (!S::has_perms()) {
+        if (!S::admin()) {
             return false;
         }
         $this->panne       = 0;
@@ -328,7 +328,7 @@ class EmailStorage extends Email
 
         // IMAP storage is always visible to administrators, and is allowed for
         // everyone when the service is marked as 'active'.
-        if ($globals->mailstorage->imap_active || S::has_perms()) {
+        if ($globals->mailstorage->imap_active || S::admin()) {
             $storages[] = 'imap';
         }
 
index 9e9aa45..e5c0b19 100644 (file)
@@ -108,7 +108,7 @@ function send_warning_mail($title)
 
 function kill_sessions()
 {
-    assert(S::has_perms());
+    assert(S::admin());
     shell_exec('sudo -u root ' . dirname(dirname(__FILE__)) . '/bin/kill_sessions.sh');
 }
 
index aae0553..c2b5737 100644 (file)
@@ -43,7 +43,7 @@ function gpex_make($chlg, $privkey, $datafields, $charset)
     foreach ($fieldarr as $val) {
         // Determine the requested value, and add it to the answer.
         if ($val == 'perms') {
-            $params .= gpex_prepare_param($val, S::has_perms() ? 'admin' : 'user', $tohash, $charset);
+            $params .= gpex_prepare_param($val, S::admin() ? 'admin' : 'user', $tohash, $charset);
         } else if ($val == 'forlife') {
             $params .= gpex_prepare_param($val, S::v('hruid'), $tohash, $charset);
         } else if (S::has($val)) {
@@ -66,7 +66,7 @@ function gpex_make($chlg, $privkey, $datafields, $charset)
                 $perms = $res->fetchOneCell();
             } else {
                 // if no group asked, return main rights
-                $perms = S::has_perms() ? 'admin' : 'membre';
+                $perms = S::admin() ? 'admin' : 'membre';
             }
             $params .= gpex_prepare_param($val, $perms, $tohash, $charset);
         }
index c852ff4..ea4d2f4 100644 (file)
@@ -206,7 +206,7 @@ class AXLetterModule extends PLModule
         $page->assign('echeance_time', $echeance_time);
         $page->assign('saved', $saved);
         $page->assign('new', $new);
-        $page->assign('is_xorg', S::has_perms());
+        $page->assign('is_xorg', S::admin());
 
         if (!$saved) {
             $select = '';
index ef8d11a..924447a 100644 (file)
@@ -152,7 +152,7 @@ class AXLetter extends MassMailer
 
     static public function hasPerms()
     {
-        if (S::has_perms()) {
+        if (S::admin()) {
             return true;
         }
         $res = XDB::query("SELECT  COUNT(*)
index bf1d62c..489a364 100644 (file)
@@ -488,7 +488,7 @@ class EmailModule extends PLModule
         }
 
         // Retrieves the User object for the test email recipient.
-        if (S::has_perms() && $hruid) {
+        if (S::admin() && $hruid) {
             $user = User::getSilent($hruid);
         } else {
             $user = S::user();
index f700672..2912a49 100644 (file)
@@ -83,7 +83,7 @@ class SearchModule extends PLModule
                 S::logger()->log('search', 'quick=' . $quick);
             }
             $list = 'profile|prf|fiche|fic|referent|ref|mentor';
-            if (S::has_perms()) {
+            if (S::admin()) {
                 $list .= '|admin|adm|ax';
             }
             if (preg_match('/^(' . $list . '):([-a-z]+(\.[-a-z]+(\.\d{2,4})?)?)$/', replace_accent($quick), $matches)) {
index 8289da5..a9ae124 100644 (file)
@@ -239,9 +239,9 @@ class QuickSearch extends SField
         $s = replace_accent(trim($this->value));
         $r = $s = str_replace('*','%',$s);
 
-        if (S::has_perms() && strpos($s, '@') !== false) {
+        if (S::admin() && strpos($s, '@') !== false) {
             $this->email = $s;
-        } else if (S::has_perms() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
+        } else if (S::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
             $this->ip = $s;
         }
         if ($this->email || $this->ip) {
index 7bc12ae..cc40a29 100644 (file)
@@ -238,7 +238,7 @@ class XnetGrpModule extends PLModule
             } else {
                 $site = "";
             }
-            if (S::has_perms()) {
+            if (S::admin()) {
                 if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) {
                     $page->trigError("le domaine doit être un FQDN (aucune modif effectuée) !!!");
                     return;
@@ -290,7 +290,7 @@ class XnetGrpModule extends PLModule
             pl_redirect('../'.Post::v('diminutif', $globals->asso('diminutif')).'/edit');
         }
 
-        if (S::has_perms()) {
+        if (S::admin()) {
             $dom = XDB::iterator('SELECT * FROM groupex.dom ORDER BY nom');
             $page->assign('dom', $dom);
             $page->assign('super', true);