-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.inc.php
More file actions
75 lines (61 loc) · 2.11 KB
/
main.inc.php
File metadata and controls
75 lines (61 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
Plugin Name: SmartAlbums
Version: auto
Description: Easily create dynamic albums with tags, date and other criteria
Plugin URI: auto
Author: Mistic
Author URI: http://www.strangeplanet.fr
Has Settings: true
*/
defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
if (basename(dirname(__FILE__)) != 'SmartAlbums')
{
add_event_handler('init', 'smartalbums_error');
function smartalbums_error()
{
global $page;
$page['errors'][] = 'SmartAlbums folder name is incorrect, uninstall the plugin and rename it to "SmartAlbums"';
}
return;
}
global $prefixeTable;
define('SMART_PATH', PHPWG_PLUGINS_PATH . 'SmartAlbums/');
define('SMART_ADMIN', get_root_url() . 'admin.php?page=plugin-SmartAlbums');
// define('SMART_DEBUG', true);
define('CATEGORY_FILTERS_TABLE', $prefixeTable . 'category_filters');
add_event_handler('init', 'smart_init');
add_event_handler('init', 'smart_periodic_update');
add_event_handler('delete_categories', 'smart_delete_categories');
add_event_handler('delete_tags', 'smart_delete_tags');
add_event_handler('merge_tags', 'smart_merge_tags');
$ws_functions = SMART_PATH.'include/ws_functions.inc.php';
add_event_handler('ws_add_methods', 'smart_add_methods', EVENT_HANDLER_PRIORITY_NEUTRAL, $ws_functions);
if (defined('IN_ADMIN'))
{
include_once(SMART_PATH.'include/events_admin.inc.php');
add_event_handler('loc_begin_cat_list', 'smart_cat_list');
add_event_handler('tabsheet_before_select','smart_tab', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
}
include_once(SMART_PATH.'include/events.inc.php');
include_once(SMART_PATH.'include/functions.inc.php');
/**
* update plugin & unserialize conf & load language
*/
function smart_init()
{
global $conf;
if (defined('IN_ADMIN'))
{
load_language('plugin.lang', SMART_PATH);
}
$conf['SmartAlbums'] = safe_unserialize($conf['SmartAlbums']);
if (script_basename() == 'index' and $conf['SmartAlbums']['smart_is_forbidden'])
{
add_event_handler('loc_end_section_init', 'smart_init_page_items');
}
if ($conf['SmartAlbums']['update_on_upload'])
{
add_event_handler('invalidate_user_cache', 'smart_make_all_associations');
}
}