source: extensions/rightClick/rightClick_protect.php @ 7690

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

2.1.b fixes first release bugs:

  • Default user level is fixed
  • Default selectors review ( photoWidget could not be supported )
  • Lightbox, HD Shadowbox and akBookStyle are supported
  • Merge of selectors ( default and customized ) is fixed
  • jQuery generated has been reviewed and simplified
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'])) $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?>
Note: See TracBrowser for help on using the repository browser.