From dd70cd28fffe091f214ddc385272fff65b7afa4f Mon Sep 17 00:00:00 2001 From: Vincent Zanotti Date: Mon, 15 Jun 2009 20:42:40 +0200 Subject: [PATCH] Replaces deprecated method S::has_perms with S::admin. Signed-off-by: Vincent Zanotti --- classes/user.php | 2 +- classes/xnetpage.php | 4 ++-- classes/xnetsession.php | 2 +- core | 2 +- include/banana/forum.inc.php | 4 ++-- include/banana/hooks.inc.php | 2 +- include/banana/ml.inc.php | 2 +- include/banana/moderate.inc.php | 2 +- include/emails.inc.php | 4 ++-- include/security.inc.php | 2 +- modules/auth/auth.inc.php | 4 ++-- modules/axletter.php | 2 +- modules/axletter/axletter.inc.php | 2 +- modules/email.php | 2 +- modules/search.php | 2 +- modules/search/classes.inc.php | 4 ++-- modules/xnetgrp.php | 4 ++-- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/classes/user.php b/classes/user.php index f633e4e..eb8390d 100644 --- a/classes/user.php +++ b/classes/user.php @@ -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)); diff --git a/classes/xnetpage.php b/classes/xnetpage.php index 50d86bb..9f86aca 100644 --- a/classes/xnetpage.php +++ b/classes/xnetpage.php @@ -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'); diff --git a/classes/xnetsession.php b/classes/xnetsession.php index 74648cf..e69e6eb 100644 --- a/classes/xnetsession.php +++ b/classes/xnetsession.php @@ -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 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit a105f588e354b59ff3bf2095e8e977533cd46220 +Subproject commit dd919c97a745363b0a9bfcb7c18d6c4b35ee8c11 diff --git a/include/banana/forum.inc.php b/include/banana/forum.inc.php index 0b1f2e5..7ccabd7 100644 --- a/include/banana/forum.inc.php +++ b/include/banana/forum.inc.php @@ -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); diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index d8cd9f1..6f9e8f0 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -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"; diff --git a/include/banana/ml.inc.php b/include/banana/ml.inc.php index b78139c..1bf497a 100644 --- a/include/banana/ml.inc.php +++ b/include/banana/ml.inc.php @@ -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'); diff --git a/include/banana/moderate.inc.php b/include/banana/moderate.inc.php index 753eb40..d789360 100644 --- a/include/banana/moderate.inc.php +++ b/include/banana/moderate.inc.php @@ -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) diff --git a/include/emails.inc.php b/include/emails.inc.php index ec7946d..73d539a 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -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'; } diff --git a/include/security.inc.php b/include/security.inc.php index 9e9aa45..e5c0b19 100644 --- a/include/security.inc.php +++ b/include/security.inc.php @@ -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'); } diff --git a/modules/auth/auth.inc.php b/modules/auth/auth.inc.php index aae0553..c2b5737 100644 --- a/modules/auth/auth.inc.php +++ b/modules/auth/auth.inc.php @@ -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); } diff --git a/modules/axletter.php b/modules/axletter.php index c852ff4..ea4d2f4 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -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 = ''; diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php index ef8d11a..924447a 100644 --- a/modules/axletter/axletter.inc.php +++ b/modules/axletter/axletter.inc.php @@ -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(*) diff --git a/modules/email.php b/modules/email.php index bf1d62c..489a364 100644 --- a/modules/email.php +++ b/modules/email.php @@ -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(); diff --git a/modules/search.php b/modules/search.php index f700672..2912a49 100644 --- a/modules/search.php +++ b/modules/search.php @@ -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)) { diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index 8289da5..a9ae124 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -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) { diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 7bc12ae..cc40a29 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -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); -- 2.1.4