-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.inc.php
88 lines (69 loc) · 2.25 KB
/
main.inc.php
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
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/*
Plugin Name: Subscribe To Comments
Version: auto
Description: This plugin allows to subscribe to comments by email.
Plugin URI: auto
Author: Mistic
Author URI: http://www.strangeplanet.fr
Has Settings: false
*/
defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
if (basename(dirname(__FILE__)) != 'Subscribe_to_Comments')
{
add_event_handler('init', 'stc_error');
function stc_error()
{
global $page;
$page['errors'][] = 'Subscribe to Comments folder name is incorrect, uninstall the plugin and rename it to "Subscribe_to_Comments"';
}
return;
}
global $prefixeTable;
define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . 'Subscribe_to_Comments/');
define('SUBSCRIBE_TO_TABLE', $prefixeTable . 'subscribe_to_comments');
define('SUBSCRIBE_TO_ADMIN', get_root_url() . 'admin.php?page=plugin-Subscribe_to_Comments');
add_event_handler('init', 'stc_init');
function stc_init()
{
global $conf, $user;
// no comments on luciano
if ($user['theme'] == 'luciano')
{
return;
}
load_language('plugin.lang', SUBSCRIBE_TO_PATH);
$conf['Subscribe_to_Comments'] = safe_unserialize($conf['Subscribe_to_Comments']);
include_once(SUBSCRIBE_TO_PATH.'include/functions.inc.php');
include_once(SUBSCRIBE_TO_PATH.'include/events.inc.php');
if (!defined('IN_ADMIN'))
{
// subscribe
add_event_handler('loc_end_picture', 'stc_on_picture');
add_event_handler('loc_end_coa', 'stc_on_album');
// management
add_event_handler('loc_end_section_init', 'stc_detect_section');
add_event_handler('loc_begin_page_header', 'stc_load_section');
// profile link
add_event_handler('loc_begin_profile', 'stc_profile_link');
}
else
{
// config page
add_event_handler('get_admin_plugin_menu_links', 'stc_admin_menu');
}
// send mails
add_event_handler('user_comment_insertion', 'stc_comment_insertion');
add_event_handler('user_comment_validation', 'stc_comment_validation', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
// items deletion
add_event_handler('begin_delete_elements', 'stc_delete_elements');
add_event_handler('delete_categories', 'stc_delete_categories');
}
function stc_admin_menu($menu)
{
$menu[] = array(
'NAME' => 'Subscribe to Comments',
'URL' => SUBSCRIBE_TO_ADMIN,
);
return $menu;
}