TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,985
  • Total Topics: 21,321
  • Online today: 677
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 422
  • Total: 422

Blocks permission

Started by NightOwl, March 24, 2005, 09:41:49 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

NightOwl

#10
Permission confusion fixed on 0.6 beta

With post-base out of permission range.

NightOwl

#11
Humm.. weird things happens.

Seems the block permission only works with one selected group. More groups selected result in opposite, that is every given permission groups are blocked.

case 1, with one group selected, the group with see the block.
case 2, with two group selected, both group can't see the block.

Bjørn


Bjørn

#13
Yes, it was not checking right..I ahve solved and it will go into the next release..but if you need the change, open up TPortal.php and find this:
        // get the blocks
        $blocktype=array('no','userbox','newsbox','statsbox','searchbox','html','onlinebox','themebox','shoutbox','catmenu','phpbox','scriptbox','recentbox');

        $request = db_query("SELECT * FROM tportal_blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
        $lcount=0; $rcount=0;
        if (mysql_num_rows($request) > 0)
        {
          $access=array();
          while($row = mysql_fetch_assoc($request)){
              $access=explode(',',$row['access']);
              foreach($access as $acc => $val){
                    $show=true;
                    if($val!='0' && $val!=''){
                       $show=false;
                       if(in_array($val,$context['TPortal']['membergroups']))
                          $show=true;
                    }
                    if($val=='-1' && $context['user']['is_guest'])
                       $show=false;
              }
              // admin sees all
              if($context['user']['is_admin'])
                 $show=true;

              if($show){
               if($row['bar']=='1'){
                       $context['TPortal']['leftblock']['blocks'][$lcount]=array('frame' => $row['frame'], 'title' => $row['title'], 'type' => $blocktype[$row['type']], 'body' => $row['body']);
                       $lcount++;
               }
               elseif($row['bar']=='2'){
                       $context['TPortal']['rightblock']['blocks'][$rcount]=array('frame' => $row['frame'], 'title' => $row['title'], 'type' => $blocktype[$row['type']], 'body' => $row['body']);
                       $rcount++;
               }
             }
          }
          mysql_free_result($request);
        }
        // is there any blocks at all shown?


and replace with:
        // get the blocks
        $blocktype=array('no','userbox','newsbox','statsbox','searchbox','html','onlinebox','themebox','shoutbox','catmenu','phpbox','scriptbox','recentbox');

        $request = db_query("SELECT * FROM tportal_blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
        $lcount=0; $rcount=0;
        if (mysql_num_rows($request) > 0)
        {
          $access=array();
          while($row = mysql_fetch_assoc($request)){
              $access=explode(',',$row['access']);
              $show=false;
              if($row['access']=='' || $row['access']=='0'){
                  $show=true;
              }
              elseif($row['access']=='-1' || $row['access']=='0,-1' || $row['access']=='-1,0'){
                  if($context['user']['is_logged'])
                     $show=true;
              }
              elseif($row['access']!='' && $row['access']!='0' && $row['access']!='-1'){
                   $acc=explode(',',$row['access']);
                   foreach($acc as $grp => $val){
                       if(in_array($val,$context['TPortal']['membergroups']))
                           $show=true;
                   }
             }
              // admin sees all
              if($context['user']['is_admin'])
                 $show=true;

              if($show){
               if($row['bar']=='1'){
                       $context['TPortal']['leftblock']['blocks'][$lcount]=array('frame' => $row['frame'], 'title' => $row['title'], 'type' => $blocktype[$row['type']], 'body' => $row['body']);
                       $lcount++;
               }
               elseif($row['bar']=='2'){
                       $context['TPortal']['rightblock']['blocks'][$rcount]=array('frame' => $row['frame'], 'title' => $row['title'], 'type' => $blocktype[$row['type']], 'body' => $row['body']);
                       $rcount++;
               }
             }
          }
          mysql_free_result($request);
        }
        // is there any blocks at all shown?

NightOwl


NightOwl

Seems that really fix the thing finally.

Bjørn


NightOwl

Bloc, bad news again

Seems ungroup members are not following the permission setting.

They can access everything even it is blocked.

This website is proudly hosted on Crocweb Cloud Website Hosting.