Use the 'groups' perm instead of 'user' on X.net
[platal.git] / modules / xnetevents.php
index d2d8390..f345f13 100644 (file)
@@ -26,10 +26,10 @@ class XnetEventsModule extends PLModule
     function handlers()
     {
         return array(
-            '%grp/events'       => $this->make_hook('events', AUTH_MDP),
-            '%grp/events/sub'   => $this->make_hook('sub',    AUTH_MDP),
-            '%grp/events/csv'   => $this->make_hook('csv',    AUTH_MDP, 'user', NO_HTTPS),
-            '%grp/events/ical'  => $this->make_hook('ical',   AUTH_MDP, 'user', NO_HTTPS),
+            '%grp/events'       => $this->make_hook('events', AUTH_MDP, 'groups'),
+            '%grp/events/sub'   => $this->make_hook('sub',    AUTH_MDP, 'groups'),
+            '%grp/events/csv'   => $this->make_hook('csv',    AUTH_MDP, 'groups', NO_HTTPS),
+            '%grp/events/ical'  => $this->make_hook('ical',   AUTH_MDP, 'groups', NO_HTTPS),
             '%grp/events/edit'  => $this->make_hook('edit',   AUTH_MDP, 'groupadmin'),
             '%grp/events/admin' => $this->make_hook('admin',  AUTH_MDP, 'groupmember'),
         );
@@ -630,8 +630,7 @@ class XnetEventsModule extends PLModule
                                            GROUP BY  p.uid', $evt['eid']);
 
         $ofs = Env::i('offset');
-        $tot = (is_null($evt['nb_tot']) ? $evt['nb'] : $evt['nb_tot']);
-        $nbp = ceil($tot / NB_PER_PAGE);
+        $nbp = ceil($evt['user_count'] / NB_PER_PAGE);
         if ($nbp > 1) {
             $links = array();
             if ($ofs) {