Changeset 11376 for extensions/SmartAlbums/include
- Timestamp:
- Jun 14, 2011, 6:41:10 PM (13 years ago)
- Location:
- extensions/SmartAlbums/include
- Files:
-
- 3 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 -
extensions/SmartAlbums/include/init_cat_list.php
r11334 r11376 9 9 { 10 10 global $template, $page, $smart_count; 11 include_once(SMART_PATH.'include/functions.inc.php'); 11 12 12 $self_url = get_root_url().'admin.php?page=cat_list'.(isset($_GET['parent_id']) ? '&parent_id='.$_GET['parent_id'] : null); 13 13 … … 70 70 } 71 71 72 invalidate_user_cache(true); 72 define('SMART_NOT_UPDATE', 1); 73 invalidate_user_cache(); 73 74 } 74 75 -
extensions/SmartAlbums/include/init_cat_modify.php
r11334 r11376 8 8 { 9 9 global $template, $page; 10 include_once(SMART_PATH.'include/functions.inc.php');11 10 12 11 $cat_id = $_GET['cat_id']; … … 62 61 63 62 $associated_images = smart_make_associations($cat_id); 64 invalidate_user_cache(true);65 63 $template->assign('IMAGE_COUNT', l10n_dec('%d photo', '%d photos', count($associated_images))); 64 65 define('SMART_NOT_UPDATE', 1); 66 invalidate_user_cache(); 66 67 } 67 68 }
Note: See TracChangeset
for help on using the changeset viewer.