diff --git a/www/config/config.inc.php b/www/config/config.inc.php index 5361ecf9..0de971d8 100644 --- a/www/config/config.inc.php +++ b/www/config/config.inc.php @@ -225,6 +225,9 @@ // Start the session handler (this calls a function defined in functions_general) startSession(); +// Include internationalization code (should be top of any .php file with strings to be translated). +include $base . '/config/internationalization.inc.php'; + // Set session inactivity threshold ini_set("session.gc_maxlifetime", $conf['cookie_life']); diff --git a/www/config/internationalization.inc.php b/www/config/internationalization.inc.php new file mode 100644 index 00000000..ce879632 --- /dev/null +++ b/www/config/internationalization.inc.php @@ -0,0 +1,42 @@ + 'de_DE.UTF-8', + 'en' => 'en_US.UTF8', + 'ja' => 'ja_JP.UTF-8', + 'fr' => 'fr_FR.UTF-8' +); + +$hal = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : ''; +$langs = explode(',', $hal); +foreach($langs as $lang){ + $lang_prefix = substr($lang, 0, 2); + if (isset($supported_langs[$lang_prefix])) { + $lc=$supported_langs[$lang_prefix]; + //echo 'LC='.$lc; + break; + } + $lc=$supported_langs[$default_lang]; + //echo 'LC(default)='.$lc; +} + +$folder = "locale"; +$directory = str_replace(DIRECTORY_SEPARATOR,'/',realpath(dirname(__FILE__)))."/$folder"; +$domain = "messages"; +setlocale(LC_MESSAGES, $lc); +setlocale(LC_ALL, $lc); +bindtextdomain($domain, $directory); +bind_textdomain_codeset($domain, 'UTF-8'); +textdomain($domain); + +/* For test purposes */ +//echo " directory=".$directory."/".setlocale(LC_MESSAGES,0)."/LC_MESSAGES/".$domain.".po
"; +//echo _("HELLO_WORLD")."
"; +//echo _("Password"); + +?> diff --git a/www/config/locale/en_US.UTF8/LC_MESSAGES/messages.mo b/www/config/locale/en_US.UTF8/LC_MESSAGES/messages.mo new file mode 100644 index 00000000..a54fb6a4 Binary files /dev/null and b/www/config/locale/en_US.UTF8/LC_MESSAGES/messages.mo differ diff --git a/www/config/locale/en_US.UTF8/LC_MESSAGES/messages.po b/www/config/locale/en_US.UTF8/LC_MESSAGES/messages.po new file mode 100644 index 00000000..8450165a --- /dev/null +++ b/www/config/locale/en_US.UTF8/LC_MESSAGES/messages.po @@ -0,0 +1,20 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-14 22:03+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#Test token 1 +msgid "HELLO_WORLD" +msgstr "Hello World!" + +#Test token 2 +msgid "TEST_TRANSLATION" +msgstr "Testing translation..." diff --git a/www/config/locale/fr_FR.UTF-8/LC_MESSAGES/messages.mo b/www/config/locale/fr_FR.UTF-8/LC_MESSAGES/messages.mo new file mode 100644 index 00000000..66e43a43 Binary files /dev/null and b/www/config/locale/fr_FR.UTF-8/LC_MESSAGES/messages.mo differ diff --git a/www/config/locale/fr_FR.UTF-8/LC_MESSAGES/messages.po b/www/config/locale/fr_FR.UTF-8/LC_MESSAGES/messages.po new file mode 100644 index 00000000..7ebbca6b --- /dev/null +++ b/www/config/locale/fr_FR.UTF-8/LC_MESSAGES/messages.po @@ -0,0 +1,67 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#: index.php:4 +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-14 22:03+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#Test token 1 +msgid "HELLO_WORLD" +msgstr "Bonjour le monde!" + +#: index.php:10 login.php:6 +msgid "ERROR => Couldn't find include folder!\n" +msgstr "ERREUR => impossible de trouver le dossier include!\n" + +#: index.php:55 +msgid "0wn Your Network" +msgstr "Administration réseau IP du Groupe Hospitalier Universitaire Paris Sud (BCT, ABC, PBR, UCSA, CPA, CMP)" + +#: login.php:21 +msgid "Redirecting you to: " +msgstr "Redirection vers: " + +#: login.php:50 +msgid "Standalone Login" +msgstr "Authentification" + +#: login.php:63 +msgid "OpenNetAdmin Login" +msgstr "OpenNetAdmin
Merci de vous identifier" + +#: login.php:75 +msgid "Username" +msgstr "Utilisateur" + +#: login.php:91 +msgid "Password" +msgstr "Mot de passe" + +#: login.php:107 +msgid "Login" +msgstr "Valider" + +###### logout.php ####### +msgid "has logged out" +msgstr "déconnecté" + +###### config_dnld.php ###### +msgid "Configuration record doesn't exist!" +msgstr "Pas d'enregistrement de configuration !" + +msgid "ERROR: You are unauthorized for this page!" +msgstr "ERREUR: Vous n'êtes pas autorisé à visualiser cette page !" + diff --git a/www/config/locale/ja_JP.UTF-8/LC_MESSAGES/messages.mo b/www/config/locale/ja_JP.UTF-8/LC_MESSAGES/messages.mo new file mode 100644 index 00000000..8f02e9ff Binary files /dev/null and b/www/config/locale/ja_JP.UTF-8/LC_MESSAGES/messages.mo differ diff --git a/www/config/locale/ja_JP.UTF-8/LC_MESSAGES/messages.po b/www/config/locale/ja_JP.UTF-8/LC_MESSAGES/messages.po new file mode 100644 index 00000000..f6fd3835 --- /dev/null +++ b/www/config/locale/ja_JP.UTF-8/LC_MESSAGES/messages.po @@ -0,0 +1,79 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#: index.php:4 +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-14 22:03+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#Test token 1 +msgid "HELLO_WORLD" +msgstr "ハローワールド" + +#: index.php:10 login.php:6 +msgid "ERROR => Couldn't find include folder!\n" +msgstr "エラー:[include]フォルダを見つけることができませんでした。\n" + +#: index.php:55 +msgid "0wn Your Network" +msgstr "オープンネット管理" + +#: login.php:21 +msgid "Redirecting you to: " +msgstr "リダイレクト:" + +#: login.php:50 +msgid "Standalone Login" +msgstr "認証" + +#: login.php:63 +msgid "OpenNetAdmin Login" +msgstr "あなたのログイン情報を入力してください" + +#: login.php:75 +msgid "Username" +msgstr "ユーザー名" + +# +#msgid "Wrong username" +#msgstr "不正なユーザー名" +#msgid "Invalid username" +#msgstr "ユーザー名が無効です" + +#: login.php:91 +msgid "Password" +msgstr "パスワード" + +#: login.php:107 +msgid "Login" +msgstr "検証" + +# Authentication validation +# 認証の検証 + +###### logout.php ####### +msgid "has logged out" +msgstr "ログアウトしました。" + +# You have been logged out. Reconnect? +# ログアウトしました。再接続しますか? + +###### config_dnld.php ###### +msgid "Configuration record doesn't exist!" +msgstr "Pas d'enregistrement de configuration !" + +msgid "ERROR: You are unauthorized for this page!" +msgstr "エラー:認可" + diff --git a/www/modules/ona/dns_record.inc.php b/www/modules/ona/dns_record.inc.php index 544b3837..62a9c54f 100644 --- a/www/modules/ona/dns_record.inc.php +++ b/www/modules/ona/dns_record.inc.php @@ -1122,6 +1122,14 @@ function dns_record_modify($options="") { $self['error'] = "ERROR => There is already an A record with that name!{$viewmsg}"; return(array(7, $self['error'] . "\n")); } + // FX: needed to add control over CNAMES modifications. This check was done in dns_add function but not here. + // Validate that there are no CNAMES already with this fqdn + list($c_status, $c_rows, $c_record) = ona_get_dns_record(array('name' => $hostname, 'domain_id' => $domain['id'],'type' => 'CNAME','dns_view_id' => $check_dns_view_id)); + if ($c_rows or $c_status) { + printmsg("ERROR => Another DNS CNAME record named {$hostname}.{$domain['fqdn']} already exists!{$viewmsg}",3); + $self['error'] = "ERROR => Another DNS CNAME record named {$hostname}.{$domain['fqdn']} already exists!{$viewmsg}"; + return(array(5, $self['error'] . "\n")); + } } // lets try and determine the interface record using the name passed in. Only works if we get one record back diff --git a/www/winc/list_hosts.inc.php b/www/winc/list_hosts.inc.php index 4a9b9cbe..665f3f7c 100644 --- a/www/winc/list_hosts.inc.php +++ b/www/winc/list_hosts.inc.php @@ -237,9 +237,12 @@ function ws_display_list($window_name, $form='') { $form['mac'] = preg_replace('/[^%0-9A-F]/', '', $form['mac']); // We do a sub-select to find interface id's that match - $where .= $and . "h.id IN ( SELECT host_id " . + $from = 'hosts h LEFT JOIN interfaces i ON i.host_id = h.id'; + $where .= $and . " WHERE i.mac_addr LIKE " . $onadb->qstr($wildcard.$form['mac'].$wildcard) . " ) "; +/* $where .= $and . "h.id IN ( SELECT host_id " . " FROM interfaces " . " WHERE mac_addr LIKE " . $onadb->qstr($wildcard.$form['mac'].$wildcard) . " ) "; +*/ $and = " AND "; }