[6502] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: rightClick |
---|
[6515] | 4 | Version: 2.1.b |
---|
[6502] | 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 . '/'); |
---|
[6515] | 14 | define('RIGHTCK_VER' , '2.1.b'); |
---|
[9982] | 15 | |
---|
| 16 | if ( !function_exists( 'rightClick_protect' ) ) |
---|
| 17 | { |
---|
| 18 | if ( defined('IN_ADMIN') and IN_ADMIN ) return false; |
---|
| 19 | |
---|
| 20 | add_event_handler('loc_after_page_header', 'rightClick_protect', 20); |
---|
| 21 | |
---|
| 22 | function rightClick_protect() |
---|
| 23 | { |
---|
| 24 | global $template, $user, $conf; |
---|
| 25 | if (!isset($conf['rightClick_level'])) |
---|
| 26 | $Maxlvl = max($conf['available_permission_levels']); |
---|
| 27 | else |
---|
| 28 | $Maxlvl = $conf['rightClick_level']; |
---|
| 29 | |
---|
| 30 | if ($user['level'] >= $Maxlvl) return; |
---|
| 31 | |
---|
[12789] | 32 | $default = array( '#theImage img', '#akPicture', '#colorbox', '#sb-container', '#prevnext', '#theMainImage',); |
---|
[9982] | 33 | if (!isset($conf['rightClick_selectors'])) |
---|
| 34 | $conf['rightClick_selectors'] = array(); |
---|
| 35 | |
---|
| 36 | $conf['rightClick_selectors'] = array_unique( array_merge($default, $conf['rightClick_selectors']) ); |
---|
| 37 | |
---|
| 38 | $template->set_filenames(array( |
---|
| 39 | 'rightClick_protect' => dirname(__FILE__) . '/template/rightClick_protect.tpl', |
---|
| 40 | )); |
---|
| 41 | $Path = embellish_url($template->get_template_vars('ROOT_URL').RIGHTCK_PATH); |
---|
| 42 | $protect = array( |
---|
| 43 | 'Dir' => RIGHTCK_DIR, |
---|
| 44 | 'Path' => $Path, |
---|
| 45 | 'Version' => RIGHTCK_VER, |
---|
| 46 | 'Selectors' => $conf['rightClick_selectors'], |
---|
| 47 | ); |
---|
| 48 | $template->assign( array( 'RIGHTCK' => $protect ) ); |
---|
| 49 | $template->parse('rightClick_protect'); |
---|
| 50 | } |
---|
| 51 | } |
---|
[6502] | 52 | ?> |
---|