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