1 | <?php |
---|
2 | if (! defined('MULTIVIEW_CONTROLLER') ) |
---|
3 | { |
---|
4 | global $user; |
---|
5 | $view_as = pwg_get_session_var( 'multiview_as', 0 ); |
---|
6 | if ($view_as) |
---|
7 | { |
---|
8 | $user = build_user( $view_as, true); |
---|
9 | } |
---|
10 | $theme = pwg_get_session_var( 'multiview_theme', '' ); |
---|
11 | if ( !empty($theme) ) |
---|
12 | { |
---|
13 | $user['theme'] = $theme; |
---|
14 | unset($user['admin_theme']); |
---|
15 | } |
---|
16 | $lang = pwg_get_session_var( 'multiview_lang', '' ); |
---|
17 | if ( !empty($lang) ) |
---|
18 | { |
---|
19 | $user['language'] = $lang; |
---|
20 | } |
---|
21 | global $conf; |
---|
22 | if (pwg_get_session_var( 'multiview_show_queries', 0 )) |
---|
23 | $conf['show_queries'] = true; |
---|
24 | if (pwg_get_session_var( 'multiview_debug_l10n', 0 )) |
---|
25 | $conf['debug_l10n'] = true; |
---|
26 | if (pwg_get_session_var( 'multiview_debug_template', 0 )) |
---|
27 | $conf['debug_template'] = true; |
---|
28 | if (!pwg_get_session_var( 'multiview_template_combine_files', 1 )) |
---|
29 | $conf['template_combine_files'] = false; |
---|
30 | if (pwg_get_session_var( 'multiview_no_history', 0 )) |
---|
31 | add_event_handler( 'pwg_log_allowed', create_function( '', 'return false;' ) ); |
---|
32 | } |
---|
33 | |
---|
34 | add_event_handler('loc_end_page_header', 'multiview_loc_end_page_header'); |
---|
35 | |
---|
36 | function multiview_loc_end_page_header() |
---|
37 | { |
---|
38 | global $template; |
---|
39 | $my_root_url = get_root_url().'plugins/'. basename(dirname(__FILE__)).'/'; |
---|
40 | $js = |
---|
41 | '<script type="text/javascript"> |
---|
42 | var theController = window.open("", "mview_controller", "alwaysRaised=yes,dependent=yes,toolbar=no,height=200,width=220,menubar=no,resizable=yes,scrollbars=yes,status=no"); |
---|
43 | if ( theController.location.toString()=="about:blank" || !theController.location.toString().match(/^(https?.*\/)controller\.php(\?.+)?$/)) |
---|
44 | { |
---|
45 | theController.location = "'.$my_root_url.'controller.php"; |
---|
46 | } |
---|
47 | </script>'; |
---|
48 | |
---|
49 | $template->append( 'head_elements', $js ); |
---|
50 | } |
---|
51 | ?> |
---|