aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/admin_multi_view/is_admin.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-02-15 03:03:16 +0000
committerrvelices <rv-github@modusoptimus.com>2007-02-15 03:03:16 +0000
commitceb77253c30a0d0fb37d883685f0501d588caf78 (patch)
tree07cb5609ed2c7a075f0555ce7369e6d575a5ac1e /plugins/admin_multi_view/is_admin.inc.php
parent11714951b33d340f13400aa8fc9a2b971f8d8e8b (diff)
- plugins: added new action user_init
- put in a new admin_multi_view:allows admins to change on the fly language/theme and view gallery as guest (useful for developers and just to show a 'new' way of using plugins) - removed some warnings from history.php and increased table width to 99% - remove unused admin language strings git-svn-id: http://piwigo.org/svn/trunk@1821 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/admin_multi_view/is_admin.inc.php')
-rw-r--r--plugins/admin_multi_view/is_admin.inc.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/plugins/admin_multi_view/is_admin.inc.php b/plugins/admin_multi_view/is_admin.inc.php
new file mode 100644
index 000000000..7dbedf8f3
--- /dev/null
+++ b/plugins/admin_multi_view/is_admin.inc.php
@@ -0,0 +1,42 @@
+<?php
+if (! defined('MULTIVIEW_CONTROLLER') )
+{
+ global $user;
+ $view_as = pwg_get_session_var( 'multiview_as', 0 );
+ if ($view_as)
+ {
+ $user = build_user( $view_as, true);
+ }
+ $theme = pwg_get_session_var( 'multiview_theme', '' );
+ if ( !empty($theme) )
+ {
+ list($user['template'], $user['theme']) = explode('/', $theme);
+ }
+ $lang = pwg_get_session_var( 'multiview_lang', '' );
+ if ( !empty($theme) )
+ {
+ $user['language'] = $lang;
+ }
+}
+
+add_event_handler('loc_end_page_header', 'multiview_loc_end_page_header');
+
+function multiview_loc_end_page_header()
+{
+ global $template;
+ $my_root_url = get_root_url().'plugins/'. basename(dirname(__FILE__)).'/';
+ $js =
+'<script type="text/javascript">
+var theController = window.open("", "mview_controller", "alwaysRaised=yes,dependent=yes,toolbar=no,height=200,width=220,menubar=no,resizable=yes,scrollbars=yes,status=no");
+if ( theController.location.toString()=="about:blank" || !theController.location.toString().match(/^(https?.*\/)controller\.php(\?.+)?$/))
+{
+ theController.location = "'.$my_root_url.'controller.php";
+}
+</script>';
+
+ $template->assign_block_vars( 'head_element', array(
+ 'CONTENT' => $js
+ )
+ );
+}
+?>