source: extensions/Comments_on_Albums/main.inc.php @ 15995

Last change on this file since 15995 was 15995, checked in by mistic100, 12 years ago

improve anti-spam system (Piwigo 2.5 feature)

File size: 3.5 KB
RevLine 
[9624]1<?php
2/*
[9641]3Plugin Name: Comments on Albums
[14528]4Version: auto
[9641]5Description: Activate comments on albums pages
[9624]6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512
7Author: Mistic
8Author URI: http://www.strangeplanet.fr
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13global $prefixeTable;
14
15// +-----------------------------------------------------------------------+
[10984]16//          Global variables
[9624]17// +-----------------------------------------------------------------------+
18define('COA_DIR' , basename(dirname(__FILE__)));
19define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
20define('COA_TABLE' , $prefixeTable . 'comments_categories');
[9641]21define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
[9624]22
23
24// +-----------------------------------------------------------------------+
[10984]25//          Triggers
[9624]26// +-----------------------------------------------------------------------+
[12618]27add_event_handler('init', 'coa_init');
28function coa_init()
29{
30  global $user;
[14528]31 
32  // luciano doesn't use comments
33  // incompatible with dynamic display of Stripped & Collumns
[12618]34  if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return;
35 
[14528]36  add_event_handler('loc_begin_page_header', 'COA_albums');
[12618]37  add_event_handler('loc_after_page_header', 'COA_comments_page');
38  add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
39  add_event_handler('loc_end_admin', 'COA_admin_comments');
40  add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module');
41}
[9624]42
43
44// +-----------------------------------------------------------------------+
[10984]45//          Functions
[9624]46// +-----------------------------------------------------------------------+
47
[11267]48function COA_albums() 
49{
[10984]50  global $template, $page, $conf, $pwg_loaded_plugins;
51 
[14528]52  if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' )
53  {
[11267]54    if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) 
55    {
56      set_bbcode_bar();
[11291]57      $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); 
58      if (isset($pwg_loaded_plugins['SmiliesSupport']))
59      {
60        $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
61      }
[11267]62    }
63    else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) 
64    {
65      set_smiliessupport();
[11291]66      $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
[11267]67    }
[10984]68   
[15640]69    trigger_action('loc_begin_coa');
[10984]70    include(COA_PATH . 'include/coa_albums.php');
71  }
[9624]72}
73
[11267]74function COA_comments_page() 
75{
[11327]76  global $template, $page, $conf, $user;
[10984]77 
[11267]78  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 
79  {
[10984]80    include(COA_PATH . 'include/coa_comments_page.php');
81  }
[9634]82}
83
[11267]84function COA_admin_intro() 
85{
86  global $page;
[10984]87 
[11267]88  if ($page['page'] == 'intro') 
89  { 
[10984]90    include(COA_PATH . 'include/coa_admin_intro.php');
91  } 
[9624]92}
93
[11267]94function COA_admin_comments() 
95{
96  global $page;
97 
98  if ($page['page'] == 'comments') 
99  { 
100    include(COA_PATH . 'include/coa_admin_comments.php');
101  }
102}
103
[12381]104function COA_register_stuffs_module($modules) 
105{
106  load_language('plugin.lang', COA_PATH);
107 
108  array_push($modules, array(
109    'path' => COA_PATH . '/stuffs_module',
110    'name' => l10n('Last comments on albums'),
111    'description' => l10n('Display last posted comments on albums'),
112  ));
113
114  return $modules;
115}
116
[9624]117?>
Note: See TracBrowser for help on using the repository browser.