Beispiel #1
0
 function checkResult(&$item)
 {
     $ok = (SecurityUtil::checkPermission('News::', "$item[cr_uid]::$item[sid]", ACCESS_OVERVIEW));
     if ($this->enablecategorization && $this->enablecategorybasedpermissions) {
         ObjectUtil::expandObjectWithCategories($item, 'news', 'sid');
         $ok = $ok && CategoryUtil::hasCategoryAccess($item['__CATEGORIES__'], 'News');
     }
     return $ok;
 }
Beispiel #2
0
 function checkResult(&$item)
 {
     $ok = SecurityUtil::checkPermission('Pages::', "$item[title]::$item[pageid]", ACCESS_OVERVIEW);
     if ($this->enablecategorization)
     {
         ObjectUtil::expandObjectWithCategories($item, 'pages', 'pageid');
         $ok = $ok && CategoryUtil::hasCategoryAccess($item['__CATEGORIES__'], 'Pages');
     }
     return $ok;
 }
Beispiel #3
0
 /**
  * Post-processing for selected objects.
  *
  * This routine is responsible for reading the 'extra' data
  * (attributes, categories, and meta data) from the database and inserting the relevant sub-objects into the object.
  *
  * @param array   $objects     The object-array or the object we just selected.
  * @param string  $table       The treated table reference.
  * @param integer $idFieldName The id column for the object/table combination.
  *
  * @return array the object with it's relevant sub-objects set.
  *
  * @deprecated
  * @see    CategorisableListener, AttributableListener, MetaDataListener
  */
 public static function _selectPostProcess($objects, $table, $idFieldName)
 {
     // nothing to do if objects is empty
     if (is_array($objects) && count($objects) == 0) {
         return $objects;
     }
     $tables = self::getTables();
     $enableAllServices = isset($tables["{$table}_db_extra_enable_all"]) && $tables["{$table}_db_extra_enable_all"];
     if (($enableAllServices || isset($tables["{$table}_db_extra_enable_categorization"]) && $tables["{$table}_db_extra_enable_categorization"]) && System::getVar('Z_CONFIG_USE_OBJECT_CATEGORIZATION') && strcmp($table, 'categories_') !== 0 && strcmp($table, 'objectdata_attributes') !== 0 && strcmp($table, 'objectdata_log') !== 0 && ModUtil::available('ZikulaCategoriesModule')) {
         if (is_array($objects)) {
             $ak = array_keys($objects);
             if ($ak && is_array($objects[$ak[0]])) {
                 ObjectUtil::expandObjectArrayWithCategories($objects, $table, $idFieldName);
             } else {
                 ObjectUtil::expandObjectWithCategories($objects, $table, $idFieldName);
             }
         }
     }
     // temporary hack to prevent recursive loop because available() calls selectObjectArray again (Guite)
     if ($table == 'modules') {
         return $objects;
     }
     if (($enableAllServices || isset($tables["{$table}_db_extra_enable_attribution"]) && $tables["{$table}_db_extra_enable_attribution"] || System::getVar('Z_CONFIG_USE_OBJECT_ATTRIBUTION')) && strcmp($table, 'objectdata_attributes') !== 0 && strcmp($table, 'objectdata_log') !== 0) {
         if (is_array($objects)) {
             $ak = array_keys($objects);
             if ($ak && is_array($objects[$ak[0]])) {
                 foreach ($ak as $k) {
                     ObjectUtil::expandObjectWithAttributes($objects[$k], $table, $idFieldName);
                 }
             } else {
                 ObjectUtil::expandObjectWithAttributes($objects, $table, $idFieldName);
             }
         }
     }
     if (($enableAllServices || isset($tables["{$table}_db_extra_enable_meta"]) && $tables["{$table}_db_extra_enable_meta"] || System::getVar('Z_CONFIG_USE_OBJECT_META')) && strcmp($table, 'objectdata_attributes') !== 0 && strcmp($table, 'objectdata_meta') !== 0 && strcmp($table, 'objectdata_log') !== 0) {
         if (is_array($objects)) {
             $ak = array_keys($objects);
             if ($ak && is_array($objects[$ak[0]])) {
                 foreach ($ak as $k) {
                     ObjectUtil::expandObjectWithMeta($objects[$k], $table, $idFieldName);
                 }
             } else {
                 ObjectUtil::expandObjectWithMeta($objects, $table, $idFieldName);
             }
         }
     }
     return $objects;
 }
Beispiel #4
0
 function checkResult(&$item)
 {
     $ok = SecurityUtil::checkPermission('AddressBook::', "::", ACCESS_OVERVIEW);
     if ($this->enablecategorization) {
         ObjectUtil::expandObjectWithCategories($item, 'AddressBook', 'id');
         $ok = $ok && CategoryUtil::hasCategoryAccess($item['__CATEGORIES__'], 'AddressBook');
     }
     return $ok;
 }