source: extensions/rightClick/rightClick_protect.php @ 6502

Last change on this file since 6502 was 6502, checked in by vdigital, 14 years ago

rightClick deactivates the context menu on websized pictures and more.

File size: 1.3 KB
Line 
1<?php
2/* rightClick */
3if (!defined('PHPWG_ROOT_PATH') or !defined('RIGHTCK_DIR')) die('Hacking attempt!');
4
5if ( !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'])) list ($Maxlvl) = array_slice($conf['available_permission_levels'],-1);
12                else $Maxlvl = $conf['rightClick_level'];
13                if ($user['level'] >= $Maxlvl) return;
14                $default = array( '#theImage img', '#photoWidget', 'img#akPicture', 'img#cboxPhoto', 'img#sb-body-inner', );
15                if (!isset($conf['rightClick_selectors'])) $conf['rightClick_selectors'] = array();
16                $conf['rightClick_selectors'] = array_unique( $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?>
Note: See TracBrowser for help on using the repository browser.