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 | list($user['template'], $user['theme']) = explode('/', $theme); |
---|
14 | unset( $user['admin_template'], $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 | } |
---|
29 | |
---|
30 | add_event_handler('loc_end_page_header', 'multiview_loc_end_page_header'); |
---|
31 | |
---|
32 | function multiview_loc_end_page_header() |
---|
33 | { |
---|
34 | global $template; |
---|
35 | $my_root_url = get_root_url().'plugins/'. basename(dirname(__FILE__)).'/'; |
---|
36 | $js = |
---|
37 | '<script type="text/javascript"> |
---|
38 | var theController = window.open("", "mview_controller", "alwaysRaised=yes,dependent=yes,toolbar=no,height=200,width=220,menubar=no,resizable=yes,scrollbars=yes,status=no"); |
---|
39 | if ( theController.location.toString()=="about:blank" || !theController.location.toString().match(/^(https?.*\/)controller\.php(\?.+)?$/)) |
---|
40 | { |
---|
41 | theController.location = "'.$my_root_url.'controller.php"; |
---|
42 | } |
---|
43 | </script>'; |
---|
44 | |
---|
45 | $template->append( 'head_elements', $js ); |
---|
46 | } |
---|
47 | ?> |
---|