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

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

compatibility with 'rv_tscroller' & comments revalidation

File size: 2.5 KB
Line 
1<?php
2/*
3Plugin Name: Comments on Albums
4Version: 1.1
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_NAME' , 'Comments on Albums');
19define('COA_VERSION', '1.0');
20define('COA_DIR' , basename(dirname(__FILE__)));
21define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
22define('COA_TABLE' , $prefixeTable . 'comments_categories');
23define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
24
25
26// +-----------------------------------------------------------------------+
27//                                      Triggers
28// +-----------------------------------------------------------------------+
29add_event_handler('loc_end_index', 'COA_index');
30add_event_handler('loc_after_page_header', 'COA_comments_page');
31add_event_handler('loc_end_admin', 'COA_admin');
32add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu');
33
34
35// +-----------------------------------------------------------------------+
36//                                      Functions
37// +-----------------------------------------------------------------------+
38
39function COA_index() {
40        global $template, $page, $conf, $pwg_loaded_plugins;
41       
42        if ($page['section'] == 'categories' AND isset($page['category']) 
43                AND (!isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0)) 
44        {       
45               
46                if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) set_bbcode_bar();
47                else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) set_smiliessupport();
48               
49                include(COA_PATH . 'include/coa_albums.php');
50        }
51}
52
53function COA_comments_page() {
54        global $template, $page, $conf;
55       
56        if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') {
57                include(COA_PATH . 'include/coa_comments_page.php');
58        }
59}
60
61function COA_admin() {
62        global $template, $page, $conf;
63       
64        if ($page['page'] == 'comments') {     
65                include(COA_PATH . 'include/coa_admin_comments.php');
66        } else if ($page['page'] == 'intro') { 
67                include(COA_PATH . 'include/coa_admin_intro.php');
68        } 
69}
70
71function COA_admin_menu($menu) {
72        array_push($menu, array(
73                'NAME' => COA_NAME,
74                'URL' => COA_ADMIN
75        ));
76        return $menu;
77}
78
79?>
Note: See TracBrowser for help on using the repository browser.