예제 #1
0
 static function getPerm($force = false)
 {
     // Return already calculated data
     static $permission = null;
     if ($permission && !$force) {
         return $permission;
     }
     $user_id = JFactory::getUser()->id;
     // Return cached data, for J2.5 or J1.5 without FLEXIaccess
     if ((FLEXI_J16GE || !FLEXI_ACCESS) && FLEXI_CACHE) {
         $catscache = JFactory::getCache('com_flexicontent_cats');
         // Get Joomla Cache of '...items' Caching Group
         $catscache->setCaching(1);
         // Force cache ON
         $catscache->setLifeTime(FLEXI_CACHE_TIME);
         // Set expire time (default is 1 hour)
         $permission = $catscache->call(array('FlexicontentHelperPerm', 'getUserPerms'), $user_id);
     } else {
         // Caching disabled or ... FLEXI_ACCESS installed
         $permission = FlexicontentHelperPerm::getUserPerms($user_id);
     }
     return $permission;
 }