1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: rightClick |
---|
4 | Version: auto |
---|
5 | Description: rightClick deactivates the context menu on websized pictures and more. |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=401 |
---|
7 | Author: VDigital |
---|
8 | Author URI: http://piwigo.org/ |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
12 | define('RIGHTCK_DIR' , basename(dirname(__FILE__))); |
---|
13 | define('RIGHTCK_PATH' , PHPWG_PLUGINS_PATH . RIGHTCK_DIR . '/'); |
---|
14 | |
---|
15 | if ( !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 | ?> |
---|