[10871] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: SmartAlbums |
---|
| 4 | Version: auto |
---|
[10980] | 5 | Description: Easily create dynamic albums with tags, date and other criteria |
---|
[26442] | 6 | Plugin URI: auto |
---|
[10871] | 7 | Author: Mistic |
---|
| 8 | Author URI: http://www.strangeplanet.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
[26442] | 11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
| 12 | |
---|
[10871] | 13 | global $prefixeTable; |
---|
| 14 | |
---|
[26442] | 15 | define('SMART_ID', 'SmartAlbums'); |
---|
| 16 | define('SMART_PATH', PHPWG_PLUGINS_PATH . SMART_ID . '/'); |
---|
[16104] | 17 | define('CATEGORY_FILTERS_TABLE', $prefixeTable . 'category_filters'); |
---|
[26442] | 18 | define('SMART_ADMIN', get_root_url() . 'admin.php?page=plugin-' . SMART_ID); |
---|
| 19 | define('SMART_VERSION', 'auto'); |
---|
| 20 | // define('SMART_DEBUG', true); |
---|
[10871] | 21 | |
---|
[17716] | 22 | |
---|
[19446] | 23 | add_event_handler('init', 'smart_init'); |
---|
| 24 | add_event_handler('init', 'smart_periodic_update'); |
---|
[26442] | 25 | add_event_handler('delete_categories', 'smart_delete_categories'); |
---|
[16126] | 26 | |
---|
[17716] | 27 | if (defined('IN_ADMIN')) |
---|
| 28 | { |
---|
[26442] | 29 | include_once(SMART_PATH.'include/events_admin.inc.php'); |
---|
[17716] | 30 | add_event_handler('loc_begin_cat_list', 'smart_cat_list'); |
---|
[26442] | 31 | add_event_handler('tabsheet_before_select','smart_tab', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); |
---|
[17716] | 32 | add_event_handler('get_admin_plugin_menu_links', 'smart_admin_menu'); |
---|
| 33 | } |
---|
| 34 | |
---|
[26442] | 35 | include_once(SMART_PATH.'include/events.inc.php'); |
---|
[11376] | 36 | include_once(SMART_PATH.'include/functions.inc.php'); |
---|
| 37 | |
---|
[17716] | 38 | |
---|
| 39 | /** |
---|
| 40 | * update plugin & unserialize conf & load language |
---|
| 41 | */ |
---|
[16126] | 42 | function smart_init() |
---|
| 43 | { |
---|
[26442] | 44 | global $conf; |
---|
| 45 | |
---|
| 46 | include_once(SMART_PATH . 'maintain.inc.php'); |
---|
| 47 | $maintain = new SmartAlbums_maintain(SMART_ID); |
---|
| 48 | $maintain->autoUpdate(SMART_VERSION, 'install'); |
---|
| 49 | |
---|
[17716] | 50 | if (defined('IN_ADMIN')) |
---|
| 51 | { |
---|
| 52 | load_language('plugin.lang', SMART_PATH); |
---|
| 53 | } |
---|
[16104] | 54 | $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']); |
---|
[26442] | 55 | |
---|
| 56 | if (script_basename() == 'index' and $conf['SmartAlbums']['smart_is_forbidden']) |
---|
[16939] | 57 | { |
---|
| 58 | add_event_handler('loc_end_section_init', 'smart_init_page_items'); |
---|
| 59 | } |
---|
[10871] | 60 | |
---|
[26442] | 61 | if ($conf['SmartAlbums']['update_on_upload']) |
---|
[16938] | 62 | { |
---|
[26442] | 63 | add_event_handler('invalidate_user_cache', 'smart_make_all_associations'); |
---|
[16938] | 64 | } |
---|
| 65 | } |
---|