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

Last change on this file since 27726 was 19289, checked in by plg, 11 years ago

more "img" protected, including homepage photo, thumbnails, Gthumb+ and Stripped specific images.

File size: 2.1 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(
32                  '#theImage img',
33                  '#theImage area',
34                  '#akPicture',
35                  '#colorbox',
36                  '#sb-container',
37                  '#prevnext',
38                  '#theMainImage',
39                  '#theImgHigh', // Stripped, zoom on HD
40                  '.thumbnailCategory img',
41                  '.thumbnails img',
42                  '#thumbnails img', // specific on Stripped
43                  '#myHomePage img', // Homepage with Additional Pages
44                  );
45                if (!isset($conf['rightClick_selectors']))
46      $conf['rightClick_selectors'] = array();
47
48                $conf['rightClick_selectors'] = array_unique( array_merge($default, $conf['rightClick_selectors']) );
49               
50                $template->set_filenames(array(
51                'rightClick_protect' => dirname(__FILE__) . '/template/rightClick_protect.tpl',
52                ));
53                $Path = embellish_url($template->get_template_vars('ROOT_URL').RIGHTCK_PATH);
54                $protect = array(
55                        'Dir'                           => RIGHTCK_DIR,
56                        'Path'                          => $Path,
57                        'Selectors'                     => $conf['rightClick_selectors'],
58                        );
59                $template->assign( array( 'RIGHTCK' => $protect ) );
60                $template->parse('rightClick_protect');
61        }
62}
63?>
Note: See TracBrowser for help on using the repository browser.