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

Last change on this file since 30900 was 28851, checked in by mistic100, 10 years ago

use new maintain class

File size: 2.0 KB
RevLine 
[26139]1<?php
[12560]2/*
3Plugin Name: Subscribe To Comments
4Version: auto
[15641]5Description: This plugin allows to subscribe to comments by email.
[26139]6Plugin URI: auto
[12560]7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
[26139]11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
[12560]12
13global $prefixeTable;
14
[26139]15define('SUBSCRIBE_TO_ID',      basename(dirname(__FILE__)));
[21441]16define('SUBSCRIBE_TO_PATH' ,   PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/');
[21340]17define('SUBSCRIBE_TO_TABLE',   $prefixeTable . 'subscribe_to_comments');
[21608]18define('SUBSCRIBE_TO_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . SUBSCRIBE_TO_ID);
[12560]19
[17922]20
[12702]21add_event_handler('init', 'stc_init');
[12560]22
[17922]23
[12702]24function 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]70function 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}
Note: See TracBrowser for help on using the repository browser.