aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/admin_multi_view/controller.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/controller.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/controller.php')
-rw-r--r--plugins/admin_multi_view/controller.php113
1 files changed, 113 insertions, 0 deletions
diff --git a/plugins/admin_multi_view/controller.php b/plugins/admin_multi_view/controller.php
new file mode 100644
index 000000000..a4566ed69
--- /dev/null
+++ b/plugins/admin_multi_view/controller.php
@@ -0,0 +1,113 @@
+<?php
+define('MULTIVIEW_CONTROLLER', 1);
+define('PHPWG_ROOT_PATH','../../');
+include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+
+if (!is_admin() or !function_exists('multiview_user_init') )
+{
+ pwg_unset_session_var( 'multiview_as' );
+ pwg_unset_session_var( 'multiview_theme' );
+ pwg_unset_session_var( 'multiview_lang' );
+?>
+<script type="text/javascript">
+ window.close();
+</script>
+<?php
+ exit();
+}
+
+$refresh_main = false;
+
+if ( isset($_GET['view_guest']) )
+{
+ pwg_set_session_var( 'multiview_as', $conf['guest_id'] );
+ $refresh_main = true;
+}
+elseif ( isset($_GET['view_admin']) )
+{
+ pwg_unset_session_var('multiview_as');
+ $refresh_main = true;
+}
+$view_as = pwg_get_session_var( 'multiview_as', 0 );
+
+
+if ( isset($_GET['theme']) )
+{
+ pwg_set_session_var( 'multiview_theme', $_GET['theme'] );
+ $refresh_main = true;
+}
+
+if ( isset($_GET['lang']) )
+{
+ pwg_set_session_var( 'multiview_lang', $_GET['lang'] );
+ $refresh_main = true;
+}
+
+$my_url = get_root_url().'plugins/'.basename(dirname(__FILE__)).'/'.basename(__FILE__);
+
+$themes_html='Theme: <select onchange="document.location = this.options[this.selectedIndex].value;">';
+foreach (get_pwg_themes() as $pwg_template)
+{
+ $selected = $pwg_template == pwg_get_session_var( 'multiview_theme', $user['template'].'/'.$user['theme'] ) ? 'selected="selected"' : '';
+ $themes_html .=
+ '<option value="'
+ .$my_url.'?theme='.$pwg_template
+ .'" '.$selected.'>'
+ .$pwg_template
+ .'</option>';
+}
+$themes_html .= '</select>';
+
+$lang_html='Language: <select onchange="document.location = this.options[this.selectedIndex].value;">';
+foreach (get_languages() as $language_code => $language_name)
+{
+ $selected = $language_code == pwg_get_session_var( 'multiview_lang', $user['language'] ) ? 'selected="selected"' : '';
+ $lang_html .=
+ '<option value="'
+ .$my_url.'?lang='.$language_code
+ .'" '.$selected.'>'
+ .$language_name
+ .'</option>';
+}
+$lang_html .= '</select>';
+?>
+
+<html>
+<head>
+<title>Controller</title>
+</head>
+
+<body>
+
+<script type="text/javascript">
+if (window.opener==null) {
+ window.close();
+ document.write("<h2>How did you get here ???</h2>");
+}
+</script>
+
+View as:
+<?php
+ if ($view_as)
+ echo '<a href="'.$my_url.'?view_admin">admin</a>';
+ else
+ echo '<a href="'.$my_url.'?view_guest">guest</a>';
+?>
+
+<br />
+<?php echo $themes_html; ?>
+
+<br />
+<?php echo $lang_html; ?>
+
+
+<script type="text/javascript">
+<?php
+ if ($refresh_main) echo '
+window.opener.location = window.opener.location;';
+?>
+</script>
+
+</body>
+
+</html> \ No newline at end of file