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

Last change on this file since 12049 was 11327, checked in by mistic100, 13 years ago

correct link in notification mail, add album thumbnail on comments list (both public and admin side)

File size: 3.0 KB
Line 
1<?php
2/*
3Plugin Name: Comments on Albums
4Version: auto
5Description: Activate comments on albums pages
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// +-----------------------------------------------------------------------+
16//          Global variables
17// +-----------------------------------------------------------------------+
18define('COA_DIR' , basename(dirname(__FILE__)));
19define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
20define('COA_TABLE' , $prefixeTable . 'comments_categories');
21define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
22
23
24// +-----------------------------------------------------------------------+
25//          Triggers
26// +-----------------------------------------------------------------------+
27add_event_handler('loc_end_index', 'COA_albums');
28add_event_handler('loc_after_page_header', 'COA_comments_page');
29add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
30add_event_handler('loc_end_admin', 'COA_admin_comments');
31add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu');
32
33
34// +-----------------------------------------------------------------------+
35//          Functions
36// +-----------------------------------------------------------------------+
37
38function COA_albums() 
39{
40  global $template, $page, $conf, $pwg_loaded_plugins;
41 
42  if (
43    $page['section'] == 'categories' AND isset($page['category']) AND 
44    ( !isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0 )
45  ) {   
46    if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) 
47    {
48      set_bbcode_bar();
49      $template->set_prefilter('comments_on_albums', 'set_bbcode_bar_prefilter'); 
50      if (isset($pwg_loaded_plugins['SmiliesSupport']))
51      {
52        $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
53      }
54    }
55    else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) 
56    {
57      set_smiliessupport();
58      $template->set_prefilter('comments_on_albums', 'set_smiliessupport_prefilter');
59    }
60   
61    include(COA_PATH . 'include/coa_albums.php');
62  }
63}
64
65function COA_comments_page() 
66{
67  global $template, $page, $conf, $user;
68 
69  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 
70  {
71    include(COA_PATH . 'include/coa_comments_page.php');
72  }
73}
74
75function COA_admin_intro() 
76{
77  global $page;
78 
79  if ($page['page'] == 'intro') 
80  { 
81    include(COA_PATH . 'include/coa_admin_intro.php');
82  } 
83}
84
85function COA_admin_comments() 
86{
87  global $page;
88 
89  if ($page['page'] == 'comments') 
90  { 
91    include(COA_PATH . 'include/coa_admin_comments.php');
92  }
93}
94
95function COA_admin_menu($menu) 
96{
97  array_push($menu, array(
98    'NAME' => 'Comments on Albums',
99    'URL' => COA_ADMIN
100  ));
101  return $menu;
102}
103
104?>
Note: See TracBrowser for help on using the repository browser.