Exemple #1
0
 /**
  * determine if you can use a thing
  * uses JACL if available
  * @param int access id
  * @param string access object identifier
  * @param string acl direction (inclusive or exclusive - not tested for JACL integration )
  * @return bool truye if access granted
  */
 function getACL($a, $key, $cond = '>=')
 {
     $user =& JFactory::getUser();
     $acl =& JFactory::getACL();
     //everyone
     if ($a == 0) {
         return true;
     }
     //nobody
     if ($a == '26') {
         return false;
     }
     //public front end
     // $$$ rob: for below commented out if statement
     // if prefilter set to 'Apply filter on or beneath: public front end/29'
     // then it was still applying the prefilter to registered users
     // $$$ rob 07/04/2011 however we do need a check if cont = '>=' for 'Public front end / $a = 29
     if ($a == 29 && $cond == '>=') {
         return true;
     }
     //if ($a == '29' || $a == '') {
     if ($a == '') {
         if ($cond == '>=') {
             return true;
             //jacl
         } else {
             return false;
         }
     }
     if (defined('_JACL')) {
         $inacl = in_array($a, explode(',', $user->get('jaclplus', '0')));
         if ($cond == '<=') {
             return !$inacl;
         } else {
             return $inacl;
         }
     } else {
         $groupNames =& FabrikWorker::getACLGroups($a, $cond);
         foreach ($groupNames as $name) {
             FabrikWorker::setACL('action', $key, 'fabrik', $name, 'components', null);
         }
         //if not logged in set the usertype to ROOT (ie public front end)
         $utype = $user->get('usertype') == '' ? 'ROOT' : $user->get('usertype');
         return $acl->acl_check('action', $key, 'fabrik', $utype, 'components', null);
     }
 }