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