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