Changeset 11376
- Timestamp:
- Jun 14, 2011, 6:41:10 PM (13 years ago)
- Location:
- extensions/SmartAlbums
- Files:
-
- 2 added
- 1 deleted
- 7 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 } -
extensions/SmartAlbums/language/en_UK/plugin.lang.php
r11334 r11376 23 23 $lang['Regenerate photos list of this SmartAlbum'] = 'Regenerate photos list of this SmartAlbum'; 24 24 $lang['Regenerate photos list of all SmartAlbums'] = 'Regenerate photos list of all SmartAlbums'; 25 $lang['Update albums on file upload'] = 'Update albums on file upload'; 26 $lang['Update albums when an admin logins'] = 'Update albums when an admin logins'; 25 27 26 28 ?> -
extensions/SmartAlbums/language/fr_FR/plugin.lang.php
r11334 r11376 23 23 $lang['Regenerate photos list of this SmartAlbum'] = 'Régénérer les photos de ce SmartAlbum'; 24 24 $lang['Regenerate photos list of all SmartAlbums'] = 'Régénérer les photos de tous les SmartAlbums'; 25 $lang['Update albums on file upload'] = 'Mettre à jour les albums après la mise en ligne d\'un fichier'; 26 $lang['Update albums when an admin logins'] = 'Mettre à jour les albums quand un admin se connecte'; 25 27 26 28 ?> -
extensions/SmartAlbums/main.inc.php
r11334 r11376 16 16 define('CATEGORY_FILTERS_TABLE', $prefixeTable.'category_filters'); 17 17 18 add_event_handler('invalidate_user_cache', 'smart_make_all_associations'); 19 add_event_handler('login_success', 'smart_make_all_associations'); 20 include_once(SMART_PATH.'include/functions.inc.php'); 21 18 22 if (script_basename() == 'index') 19 23 { … … 30 34 add_event_handler('loc_begin_cat_list', 'smart_cat_list'); 31 35 include_once(SMART_PATH.'include/init_cat_list.php'); 36 37 add_event_handler('get_admin_plugin_menu_links', 'smart_admin_menu'); 38 function smart_admin_menu($menu) 39 { 40 array_push($menu, array( 41 'NAME' => 'SmartAlbums', 42 'URL' => get_root_url().'admin.php?page=plugin-' . SMART_DIR)); 43 return $menu; 44 } 32 45 } 33 46 -
extensions/SmartAlbums/maintain.inc.php
r11333 r11376 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 function plugin_install() { 4 function plugin_install() 5 { 5 6 global $prefixeTable; 6 7 … … 16 17 17 18 /* add a collumn to image_category_table */ 18 pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` ADD `smart` ENUM( "true", "false") NOT NULL DEFAULT "false";');19 pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` ADD `smart` ENUM(\'true\', \'false\') NOT NULL DEFAULT \'false\';'); 19 20 20 21 /* config parameter */ 21 // pwg_query("INSERT INTO `" . CONFIG_TABLE . "` 22 // VALUES ('SmartAlbums', '', 'Configuration for SmartAlbums plugin');"); 22 pwg_query(' 23 INSERT INTO `' . CONFIG_TABLE . '` 24 VALUES ( 25 \'SmartAlbums\', 26 \''.serialize(array( 27 'update_on_upload' => false, 28 'update_on_login' => false, 29 ) 30 ).'\', 31 \'Configuration for SmartAlbums plugin\' 32 ) 33 ;'); 34 23 35 } 24 36 25 function plugin_uninstall() { 37 function plugin_activate() 38 { 39 global $conf; 40 41 if (!isset($conf['SmartAlbums'])) 42 { 43 pwg_query(' 44 INSERT INTO `' . CONFIG_TABLE . '` 45 VALUES ( 46 \'SmartAlbums\', 47 \''.serialize(array( 48 'update_on_upload' => false, 49 'update_on_login' => false, 50 ) 51 ).'\', 52 \'Configuration for SmartAlbums plugin\' 53 ) 54 ;'); 55 } 56 57 } 58 59 function plugin_uninstall() 60 { 26 61 global $prefixeTable; 27 62 28 63 pwg_query('DROP TABLE `' . $prefixeTable . 'category_filters`;'); 29 64 pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` DROP `smart`;'); 30 pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = "SmartAlbums";');65 pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\';'); 31 66 } 32 67 ?>
Note: See TracChangeset
for help on using the changeset viewer.