source: extensions/rightClick/main.inc.php @ 14218

Last change on this file since 14218 was 14218, checked in by Gotcha, 12 years ago

'auto' version

File size: 1.6 KB
Line 
1<?php
2/*
3Plugin Name: rightClick
4Version: auto
5Description: rightClick deactivates the context menu on websized pictures and more.
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=401
7Author: VDigital
8Author URI: http://piwigo.org/
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12define('RIGHTCK_DIR' , basename(dirname(__FILE__)));
13define('RIGHTCK_PATH' , PHPWG_PLUGINS_PATH . RIGHTCK_DIR . '/');
14
15if ( !function_exists( 'rightClick_protect' ) )
16{
17        if ( defined('IN_ADMIN') and IN_ADMIN ) return false;
18
19        add_event_handler('loc_after_page_header', 'rightClick_protect', 20);
20
21        function  rightClick_protect()
22  {
23                global $template, $user, $conf;
24                if (!isset($conf['rightClick_level']))
25      $Maxlvl = max($conf['available_permission_levels']);
26                else
27      $Maxlvl = $conf['rightClick_level'];
28
29                if ($user['level'] >= $Maxlvl) return;
30
31                $default = array( '#theImage img', '#akPicture', '#colorbox', '#sb-container', '#prevnext', '#theMainImage',);
32                if (!isset($conf['rightClick_selectors']))
33      $conf['rightClick_selectors'] = array();
34
35                $conf['rightClick_selectors'] = array_unique( array_merge($default, $conf['rightClick_selectors']) );
36               
37                $template->set_filenames(array(
38                'rightClick_protect' => dirname(__FILE__) . '/template/rightClick_protect.tpl',
39                ));
40                $Path = embellish_url($template->get_template_vars('ROOT_URL').RIGHTCK_PATH);
41                $protect = array(
42                        'Dir'                           => RIGHTCK_DIR,
43                        'Path'                          => $Path,
44                        'Selectors'                     => $conf['rightClick_selectors'],
45                        );
46                $template->assign( array( 'RIGHTCK' => $protect ) );
47                $template->parse('rightClick_protect');
48        }
49}
50?>
Note: See TracBrowser for help on using the repository browser.