Changeset 11376 for extensions/SmartAlbums/include/functions.inc.php
- Timestamp:
- Jun 14, 2011, 6:41:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmartAlbums/include/functions.inc.php
r11334 r11376 30 30 } 31 31 32 if (!function_exists('set_rendom_representant')) 33 { 34 include(PHPWG_ROOT_PATH.'admin/include/functions.php'); 35 } 32 36 set_random_representant(array($cat_id)); 33 37 34 38 return $images; 39 } 40 41 42 /* 43 * Make associations for all SmartAlbums 44 * Called with invalidate_user_cache and/or on admin login 45 * @param string login (not mandatory) 46 */ 47 function smart_make_all_associations($login = false) 48 { 49 global $conf; 50 51 if (!is_array($conf['SmartAlbums'])) $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']); 52 53 if ( !$login AND !defined('SMART_NOT_UPDATE') AND $conf['SmartAlbums']['update_on_upload'] != 'false' ) 54 continue; 55 else if ( is_string($login) AND is_admin() AND $conf['SmartAlbums']['update_on_login'] != 'false' ) 56 continue; 57 else 58 return; 59 60 /* get categories with smart filters */ 61 $query = ' 62 SELECT DISTINCT id 63 FROM '.CATEGORIES_TABLE.' AS c 64 INNER JOIN '.CATEGORY_FILTERS_TABLE.' AS cf 65 ON c.id = cf.category_id 66 ;'; 67 68 /* regenerate photo list */ 69 $smart_cats = array_from_query($query, 'id'); 70 array_map('smart_make_associations', $smart_cats); 71 72 if (is_string($login)) 73 { 74 define('SMART_NOT_UPDATE', 1); 75 invalidate_user_cache(); 76 } 35 77 } 36 78
Note: See TracChangeset
for help on using the changeset viewer.