Exemplo n.º 1
0
 function isEventDeletor($strict = false)
 {
     static $isEventDeletor;
     if (!isset($isEventDeletor)) {
         $isEventDeletor = array();
     }
     $type = $strict ? "strict" : "notstrict";
     if (!isset($isEventDeletor[$type])) {
         $isEventDeletor[$type] = false;
         $user =& JEVHelper::getAuthorisedUser();
         if (is_null($user)) {
             $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
             $authorisedonly = $params->get("authorisedonly", 0);
             if (!$authorisedonly) {
                 if (JVersion::isCompatible("1.6.0")) {
                     $juser = JFactory::getUser();
                     $isEventDeletor[$type] = $juser->authorise('core.deleteall', 'com_jevents');
                 } else {
                     $publishlevel = $params->get("jevpublish_level", 20);
                     $juser = JFactory::getUser();
                     if (JEVHelper::getGid($user) >= $publishlevel) {
                         $isEventDeletor[$type] = true;
                     }
                 }
             }
         } else {
             if ($user->candeleteall) {
                 $isEventDeletor[$type] = true;
             } else {
                 if (!$strict && $user->candeleteown) {
                     $isEventDeletor[$type] = true;
                 }
             }
         }
     }
     return $isEventDeletor[$type];
 }