2010073101.php 737 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Populate image lists for current photo albums
  4. */
  5. $album_subtype_id = get_subtype_id('object', 'album');
  6. global $DB_QUERY_CACHE, $DB_PROFILE, $ENTITY_CACHE, $CONFIG;
  7. $album_guids = mysql_query("SELECT guid FROM {$CONFIG->dbprefix}entities WHERE subtype = $album_subtype_id");
  8. while ($guid_obj = mysql_fetch_object($album_guids)) {
  9. $DB_QUERY_CACHE = $DB_PROFILE = $ENTITY_CACHE = array();
  10. $album = get_entity($guid_obj->guid);
  11. $images = elgg_get_entities(array(
  12. "type" => "object",
  13. "subtype" => "image",
  14. "container_guid" => $album->guid,
  15. "limit" => ELGG_ENTITIES_NO_VALUE,
  16. ));
  17. $image_list = array();
  18. foreach ($images as $image) {
  19. $image_list[] = $image->guid;
  20. }
  21. $album->prependImageList($image_list);
  22. }