source: extensions/Subscribe_to_comments/main.inc.php @ 28017

Last change on this file since 28017 was 26144, checked in by mistic100, 11 years ago

change layout of form (use colorbox for standalone) + cleaning of subscriptions page

File size: 2.2 KB
Line 
1<?php
2/*
3Plugin Name: Subscribe To Comments
4Version: auto
5Description: This plugin allows to subscribe to comments by email.
6Plugin URI: auto
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
12
13global $prefixeTable;
14
15define('SUBSCRIBE_TO_ID',      basename(dirname(__FILE__)));
16define('SUBSCRIBE_TO_PATH' ,   PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/');
17define('SUBSCRIBE_TO_TABLE',   $prefixeTable . 'subscribe_to_comments');
18define('SUBSCRIBE_TO_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . SUBSCRIBE_TO_ID);
19define('SUBSCRIBE_TO_VERSION', 'auto');
20
21
22add_event_handler('init', 'stc_init');
23
24
25function stc_init()
26{
27  global $conf, $user;
28
29  // no comments on luciano
30  if ($user['theme'] == 'luciano')
31  {
32    return;
33  }
34
35  include_once(SUBSCRIBE_TO_PATH . 'maintain.inc.php');
36  $maintain = new Subscribe_to_Comments_maintain(SUBSCRIBE_TO_ID);
37  $maintain->autoUpdate(SUBSCRIBE_TO_VERSION, 'install');
38
39
40  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
41  $conf['Subscribe_to_Comments'] = unserialize($conf['Subscribe_to_Comments']);
42
43
44  include_once(SUBSCRIBE_TO_PATH.'include/functions.inc.php');
45  include_once(SUBSCRIBE_TO_PATH.'include/events.inc.php');
46
47
48  if (!defined('IN_ADMIN'))
49  {
50    // subscribe
51    add_event_handler('loc_end_picture', 'stc_on_picture');
52    add_event_handler('loc_end_coa', 'stc_on_album');
53
54    // management
55    add_event_handler('loc_end_section_init', 'stc_detect_section');
56    add_event_handler('loc_begin_page_header', 'stc_load_section');
57
58    // profile link
59    add_event_handler('loc_begin_profile', 'stc_profile_link');
60  }
61  else
62  {
63    // config page
64    add_event_handler('get_admin_plugin_menu_links', 'stc_admin_menu');
65  }
66
67  // send mails
68  add_event_handler('user_comment_insertion', 'stc_comment_insertion');
69  add_event_handler('user_comment_validation', 'stc_comment_validation', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
70
71  // items deletion
72  add_event_handler('begin_delete_elements', 'stc_delete_elements');
73  add_event_handler('delete_categories', 'stc_delete_categories');
74}
75
76
77function stc_admin_menu($menu)
78{
79  $menu[] = array(
80    'NAME' => 'Subscribe to Comments',
81    'URL' => SUBSCRIBE_TO_ADMIN,
82    );
83  return $menu;
84}
Note: See TracBrowser for help on using the repository browser.