1 | <?php |
---|
2 | /* rightClick */ |
---|
3 | if (!defined('PHPWG_ROOT_PATH') or !defined('RIGHTCK_DIR')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | if ( !function_exists( 'rightClick_protect' ) ) { |
---|
6 | if ( defined('IN_ADMIN') and IN_ADMIN ) return false; |
---|
7 | add_event_handler('loc_after_page_header', 'rightClick_protect', 20); |
---|
8 | |
---|
9 | function rightClick_protect() { |
---|
10 | global $template, $user, $conf; |
---|
11 | if (!isset($conf['rightClick_level'])) $Maxlvl = max($conf['available_permission_levels']); |
---|
12 | else $Maxlvl = $conf['rightClick_level']; |
---|
13 | if ($user['level'] >= $Maxlvl) return; |
---|
14 | $default = array( '#theImage img', '#akPicture', '#colorbox', '#sb-container', ); |
---|
15 | if (!isset($conf['rightClick_selectors'])) $conf['rightClick_selectors'] = array(); |
---|
16 | $conf['rightClick_selectors'] = array_unique( array_merge($default, $conf['rightClick_selectors']) ); |
---|
17 | |
---|
18 | $template->set_filenames(array( |
---|
19 | 'rightClick_protect' => dirname(__FILE__) . '/template/rightClick_protect.tpl', |
---|
20 | )); |
---|
21 | $Path = embellish_url($template->get_template_vars('ROOT_URL').RIGHTCK_PATH); |
---|
22 | $protect = array( |
---|
23 | 'Dir' => RIGHTCK_DIR, |
---|
24 | 'Path' => $Path, |
---|
25 | 'Version' => RIGHTCK_VER, |
---|
26 | 'Selectors' => $conf['rightClick_selectors'], |
---|
27 | ); |
---|
28 | $template->assign( array( 'RIGHTCK' => $protect ) ); |
---|
29 | $template->parse('rightClick_protect'); |
---|
30 | } |
---|
31 | } |
---|
32 | ?> |
---|