[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); |
---|
[21340] | 19 | define('SUBSCRIBE_TO_VERSION', 'auto'); |
---|
[12560] | 20 | |
---|
[17922] | 21 | |
---|
[12702] | 22 | add_event_handler('init', 'stc_init'); |
---|
[12560] | 23 | |
---|
[17922] | 24 | |
---|
[12702] | 25 | function stc_init() |
---|
| 26 | { |
---|
[26139] | 27 | global $conf, $user; |
---|
| 28 | |
---|
[15641] | 29 | // no comments on luciano |
---|
[26139] | 30 | if ($user['theme'] == 'luciano') |
---|
[17922] | 31 | { |
---|
[26139] | 32 | return; |
---|
[17922] | 33 | } |
---|
[26139] | 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 | |
---|
[15641] | 40 | load_language('plugin.lang', SUBSCRIBE_TO_PATH); |
---|
| 41 | $conf['Subscribe_to_Comments'] = unserialize($conf['Subscribe_to_Comments']); |
---|
[26139] | 42 | |
---|
| 43 | |
---|
[12702] | 44 | include_once(SUBSCRIBE_TO_PATH.'include/functions.inc.php'); |
---|
[26139] | 45 | include_once(SUBSCRIBE_TO_PATH.'include/events.inc.php'); |
---|
[12561] | 46 | |
---|
[26139] | 47 | |
---|
| 48 | if (!defined('IN_ADMIN')) |
---|
| 49 | { |
---|
| 50 | // subscribe |
---|
| 51 | add_event_handler('loc_end_picture', 'stc_on_picture'); |
---|
[26144] | 52 | add_event_handler('loc_end_coa', 'stc_on_album'); |
---|
[26139] | 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 | |
---|
[12702] | 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); |
---|
[12561] | 70 | |
---|
[16105] | 71 | // items deletion |
---|
| 72 | add_event_handler('begin_delete_elements', 'stc_delete_elements'); |
---|
[16106] | 73 | add_event_handler('delete_categories', 'stc_delete_categories'); |
---|
[12702] | 74 | } |
---|
[15641] | 75 | |
---|
[17922] | 76 | |
---|
[26139] | 77 | function stc_admin_menu($menu) |
---|
[15641] | 78 | { |
---|
[26139] | 79 | $menu[] = array( |
---|
[15641] | 80 | 'NAME' => 'Subscribe to Comments', |
---|
[21608] | 81 | 'URL' => SUBSCRIBE_TO_ADMIN, |
---|
[26139] | 82 | ); |
---|
[15641] | 83 | return $menu; |
---|
| 84 | } |
---|