aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2007-11-18 19:59:33 +0000
committervdigital <vdigital@piwigo.org>2007-11-18 19:59:33 +0000
commit51e3d211c85f413fbce8d78cbe172bf1e7f1829f (patch)
treec6192e4cb9543cbbcb827f3133df1fd193077036 /plugins
parentee4fbd7cec24f0b57a3924e9af7aed9ba2759cb7 (diff)
New: Language Switch plugin support
git-svn-id: http://piwigo.org/svn/trunk@2161 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins')
-rw-r--r--plugins/language_switch/icons/de_DE.gifbin0 -> 899 bytes
-rw-r--r--plugins/language_switch/icons/en_UK.gifbin0 -> 1161 bytes
-rw-r--r--plugins/language_switch/icons/es_AR.gifbin0 -> 1166 bytes
-rw-r--r--plugins/language_switch/icons/es_ES.gifbin0 -> 1025 bytes
-rw-r--r--plugins/language_switch/icons/fr_FR.gifbin0 -> 236 bytes
-rw-r--r--plugins/language_switch/icons/hu_HU.gifbin0 -> 1033 bytes
-rw-r--r--plugins/language_switch/icons/it_IT.gifbin0 -> 959 bytes
-rw-r--r--plugins/language_switch/icons/nl_NL.gifbin0 -> 103 bytes
-rw-r--r--plugins/language_switch/icons/pl_PL.gifbin0 -> 156 bytes
-rw-r--r--plugins/language_switch/index.htm0
-rw-r--r--plugins/language_switch/language_switch.inc.php106
-rw-r--r--plugins/language_switch/main.inc.php36
12 files changed, 142 insertions, 0 deletions
diff --git a/plugins/language_switch/icons/de_DE.gif b/plugins/language_switch/icons/de_DE.gif
new file mode 100644
index 000000000..9b3009565
--- /dev/null
+++ b/plugins/language_switch/icons/de_DE.gif
Binary files differ
diff --git a/plugins/language_switch/icons/en_UK.gif b/plugins/language_switch/icons/en_UK.gif
new file mode 100644
index 000000000..51b20e3c1
--- /dev/null
+++ b/plugins/language_switch/icons/en_UK.gif
Binary files differ
diff --git a/plugins/language_switch/icons/es_AR.gif b/plugins/language_switch/icons/es_AR.gif
new file mode 100644
index 000000000..677979bc5
--- /dev/null
+++ b/plugins/language_switch/icons/es_AR.gif
Binary files differ
diff --git a/plugins/language_switch/icons/es_ES.gif b/plugins/language_switch/icons/es_ES.gif
new file mode 100644
index 000000000..d0d5adbbb
--- /dev/null
+++ b/plugins/language_switch/icons/es_ES.gif
Binary files differ
diff --git a/plugins/language_switch/icons/fr_FR.gif b/plugins/language_switch/icons/fr_FR.gif
new file mode 100644
index 000000000..9080a66bf
--- /dev/null
+++ b/plugins/language_switch/icons/fr_FR.gif
Binary files differ
diff --git a/plugins/language_switch/icons/hu_HU.gif b/plugins/language_switch/icons/hu_HU.gif
new file mode 100644
index 000000000..4eb513589
--- /dev/null
+++ b/plugins/language_switch/icons/hu_HU.gif
Binary files differ
diff --git a/plugins/language_switch/icons/it_IT.gif b/plugins/language_switch/icons/it_IT.gif
new file mode 100644
index 000000000..0ee512d4c
--- /dev/null
+++ b/plugins/language_switch/icons/it_IT.gif
Binary files differ
diff --git a/plugins/language_switch/icons/nl_NL.gif b/plugins/language_switch/icons/nl_NL.gif
new file mode 100644
index 000000000..520e994b7
--- /dev/null
+++ b/plugins/language_switch/icons/nl_NL.gif
Binary files differ
diff --git a/plugins/language_switch/icons/pl_PL.gif b/plugins/language_switch/icons/pl_PL.gif
new file mode 100644
index 000000000..66f140606
--- /dev/null
+++ b/plugins/language_switch/icons/pl_PL.gif
Binary files differ
diff --git a/plugins/language_switch/index.htm b/plugins/language_switch/index.htm
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/plugins/language_switch/index.htm
diff --git a/plugins/language_switch/language_switch.inc.php b/plugins/language_switch/language_switch.inc.php
new file mode 100644
index 000000000..5ae57956f
--- /dev/null
+++ b/plugins/language_switch/language_switch.inc.php
@@ -0,0 +1,106 @@
+<?php /*
+Plugin Name: Language Switch
+Version: 1.0
+Description: Give you an advice on the administration page.
+Plugin URI: http://www.phpwebgallery.net
+Author: PhpWebGallery team
+Author URI: http://www.phpwebgallery.net
+*/
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+function language_switch()
+{
+global $user, $template, $conf, $lang;
+
+if (!isset($user['status']))
+{ die('You are not authorized to access this page'); };
+
+if ( isset( $_GET['lang']) )
+{
+ if ( !empty($_GET['lang'] ) and
+ file_exists( PHPWG_ROOT_PATH.'language/'.$_GET['lang'].'/common.lang.php') )
+ {
+ if ($user['is_the_guest'] or $user['status'] == 'generic')
+ {
+ setcookie( 'pwg_lang_switch', $_GET['lang'],
+ time()+60*60*24*30, cookie_path() );
+ }
+ else
+ {
+ $query = '
+ UPDATE '.USER_INFOS_TABLE.'
+ SET language = \''.$_GET['lang'].'\'
+ WHERE user_id = '.$user['id'].'
+ ;';
+ pwg_query($query);
+ }
+ $user['language'] = $_GET['lang'];
+ }
+}
+// Users have $user['language']
+// Guest or generic members will use their cookied language !
+
+if ((is_a_guest() or is_generic())
+ and isset( $_COOKIE['pwg_lang_switch'] ) )
+{ $user['language'] = $_COOKIE['pwg_lang_switch']; }
+
+load_language('common.lang', '', $user['language']);
+load_language('local.lang', '', $user['language']);
+if (defined('IN_ADMIN') and IN_ADMIN)
+{
+ load_language('admin.lang', '', $user['language']);
+}
+}
+//if ( isset( $_GET['lang']) ) { redirect( make_index_url() ); }
+
+
+
+
+
+function Lang_flags()
+{
+global $user, $template;
+$available_lang = get_languages();
+foreach ( $available_lang as $code => $displayname )
+{
+ $qlc_url = add_url_params( make_index_url(), array( 'lang' => $code ) );
+ $qlc_alt = ucwords( $displayname );
+ $qlc_title = $qlc_alt;
+ $qlc_img = PHPWG_PLUGINS_PATH.'language_switch/icons/'
+ . $code . '.gif';
+ // echo $code . ' '. $qlc_url .' // <br />';
+ // echo $user['language'] . ' '. $qlc_img .' /// <br />';
+
+ if ( $code !== $user['language'] and file_exists($qlc_img) )
+ {
+ $template -> concat_var( 'PLUGIN_INDEX_ACTIONS',
+ '<li><a href="' . $qlc_url . '" ><img src="' . $qlc_img . '" alt="'
+ . $qlc_alt . '" title="'
+ . $qlc_title . '" style="border: 1px solid #000000; '
+ . ' margin: 0px 2px;" /></a></li>');
+ }
+}
+}
+?> \ No newline at end of file
diff --git a/plugins/language_switch/main.inc.php b/plugins/language_switch/main.inc.php
new file mode 100644
index 000000000..8be206563
--- /dev/null
+++ b/plugins/language_switch/main.inc.php
@@ -0,0 +1,36 @@
+<?php /*
+Plugin Name: Language Switch
+Version: 1.0
+Description: Give you an advice on the administration page.
+Plugin URI: http://www.phpwebgallery.net
+Author: PhpWebGallery team
+Author URI: http://www.phpwebgallery.net
+*/
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+add_event_handler('loading_lang', 'language_switch' );
+include_once(PHPWG_PLUGINS_PATH.'language_switch/language_switch.inc.php');
+add_event_handler('loc_end_index', 'Lang_flags' );
+?> \ No newline at end of file