2008-08-19 Esteban Sanchez <estebans@artica.es>

* include/locale.class.php: Fixes in Translate_Locale() to work
        properly. Tab style correction in all the file, use tabs instead of
        blankspaces.

        * godmode/setup/setup.php: Added locale configuration option.

        * pandoradb_data.sql: Added locale to tconfig.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1013 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2008-08-20 09:19:27 +00:00
parent 85a10ec9ab
commit b1c689f17b
4 changed files with 497 additions and 474 deletions

View File

@ -1,3 +1,13 @@
2008-08-19 Esteban Sanchez <estebans@artica.es>
* include/locale.class.php: Fixes in Translate_Locale() to work
properly. Tab style correction in all the file, use tabs instead of
blankspaces.
* godmode/setup/setup.php: Added locale configuration option.
* pandoradb_data.sql: Added locale to tconfig.
2008-08-19 Esteban Sanchez <estebans@artica.es> 2008-08-19 Esteban Sanchez <estebans@artica.es>
* include/locale.class.php: Check $ENV["TMPDIR"] existance to avoid * include/locale.class.php: Check $ENV["TMPDIR"] existance to avoid

View File

@ -45,7 +45,8 @@ if ($update_settings) {
$config["graph_color2"] = (string) get_parameter ('graph_color2'); $config["graph_color2"] = (string) get_parameter ('graph_color2');
$config["graph_color3"] = (string) get_parameter ('graph_color3'); $config["graph_color3"] = (string) get_parameter ('graph_color3');
$config["sla_period"] = (int) get_parameter ("sla_period"); $config["sla_period"] = (int) get_parameter ("sla_period");
$config["locale"] = (string) get_parameter ("locale");
$config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4); $config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4);
process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'"); process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'");
process_sql ("UPDATE tconfig SET VALUE='".$config["block_size"]."' WHERE token = 'block_size'"); process_sql ("UPDATE tconfig SET VALUE='".$config["block_size"]."' WHERE token = 'block_size'");
@ -61,6 +62,7 @@ if ($update_settings) {
process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token = 'graph_color2'"); process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token = 'graph_color2'");
process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color3"]."' WHERE token = 'graph_color3'"); process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color3"]."' WHERE token = 'graph_color3'");
process_sql ("UPDATE tconfig SET VALUE='".$config["sla_period"]."' WHERE token = 'sla_period'"); process_sql ("UPDATE tconfig SET VALUE='".$config["sla_period"]."' WHERE token = 'sla_period'");
process_sql ("UPDATE tconfig SET VALUE='".$config["locale"]."' WHERE token = 'locale'");
} }
echo "<h2>".__('Pandora Setup')." &gt; "; echo "<h2>".__('Pandora Setup')." &gt; ";
@ -72,32 +74,40 @@ $table->width = '500px';
$table->data = array (); $table->data = array ();
$table->data[0][0] = __('Language Code for Pandora'); $table->data[0][0] = __('Language Code for Pandora');
$table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlanguage', 'language_code', $config["language"], '', '', '', true); $table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlanguage', 'language_code', $config["language"], '', '', '', true);
$table->data[1][0] = __('Remote config directory'); if (isset ($LOCALE)) {
$table->data[1][1] = print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true); $locales = array ();
$table->data[2][0] = __('Graph color (min)'); foreach ($LOCALE->Get_Locales_Array () as $locale) {
$table->data[2][1] = print_input_text ('graph_color1', $config["graph_color1"], '', 8, 8, true); $locales[$locale] = $LOCALE->Translate_Locale ($locale);
$table->data[3][0] = __('Graph color (avg)'); }
$table->data[3][1] = print_input_text ('graph_color2', $config["graph_color2"], '', 8, 8, true); $table->data[1][0] = __('Locale');
$table->data[4][0] = __('Graph color (max)'); $table->data[1][1] = print_select ($locales, 'locale', $config["locale"], '', '', '', true);
$table->data[4][1] = print_input_text ('graph_color3', $config["graph_color3"], '', 8, 8, true); }
$table->data[5][0] = __('SLA period'); $table->data[2][0] = __('Remote config directory');
$table->data[5][1] = print_input_text ('sla_period', $config["sla_period"], '', 5, 5, true); $table->data[2][1] = print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true);
$table->data[5][0] = __('Max. days before compact data'); $table->data[3][0] = __('Graph color (min)');
$table->data[5][1] = print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true); $table->data[3][1] = print_input_text ('graph_color1', $config["graph_color1"], '', 8, 8, true);
$table->data[6][0] = __('Max. days before purge'); $table->data[4][0] = __('Graph color (avg)');
$table->data[6][1] = print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true); $table->data[4][1] = print_input_text ('graph_color2', $config["graph_color2"], '', 8, 8, true);
$table->data[7][0] = __('Graphic resolution (1-low, 5-high)'); $table->data[5][0] = __('Graph color (max)');
$table->data[7][1] = print_input_text ('graph_res', $config["graph_res"], '', 5, 5, true); $table->data[5][1] = print_input_text ('graph_color3', $config["graph_color3"], '', 8, 8, true);
$table->data[8][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); $table->data[6][0] = __('SLA period');
$table->data[8][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true); $table->data[6][1] = print_input_text ('sla_period', $config["sla_period"], '', 5, 5, true);
$table->data[9][0] = __('Show unknown modules in global view'); $table->data[6][0] = __('Max. days before compact data');
$table->data[9][1] = print_checkbox ('show_unknown', 1, $config["show_unknown"], true); $table->data[6][1] = print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true);
$table->data[10][0] = __('Show last fired alerts in global view'); $table->data[7][0] = __('Max. days before purge');
$table->data[10][1] = print_checkbox ('show_lastalerts', 1, $config["show_lastalerts"], true); $table->data[7][1] = print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true);
$table->data[11][0] = __('Style template'); $table->data[8][0] = __('Graphic resolution (1-low, 5-high)');
$table->data[11][1] = print_select ($file_styles, 'style', $config["style"], '', '', '', true); $table->data[8][1] = print_input_text ('graph_res', $config["graph_res"], '', 5, 5, true);
$table->data[12][0] = __('Block size for pagination'); $table->data[9][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
$table->data[12][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true); $table->data[9][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true);
$table->data[10][0] = __('Show unknown modules in global view');
$table->data[10][1] = print_checkbox ('show_unknown', 1, $config["show_unknown"], true);
$table->data[11][0] = __('Show last fired alerts in global view');
$table->data[11][1] = print_checkbox ('show_lastalerts', 1, $config["show_lastalerts"], true);
$table->data[12][0] = __('Style template');
$table->data[12][1] = print_select ($file_styles, 'style', $config["style"], '', '', '', true);
$table->data[13][0] = __('Block size for pagination');
$table->data[13][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true);
echo '<form id="form_setup" method="POST" action="index.php?sec=gsetup&amp;sec2=godmode/setup/setup">'; echo '<form id="form_setup" method="POST" action="index.php?sec=gsetup&amp;sec2=godmode/setup/setup">';
print_input_hidden ('update_settings', 1); print_input_hidden ('update_settings', 1);

View File

@ -1,23 +1,23 @@
<?php <?php
// Locale Class - Working number, date and monetary converter // Locale Class - Working number, date and monetary converter
// ------------------------------------------------------------ // ------------------------------------------------------------
// Copyright (c) 2008 Evi Vanoost (vanooste@rcbi.rochester.edu) // Copyright (c) 2008 Evi Vanoost (vanooste@rcbi.rochester.edu)
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2. // as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA. // USA.
// This class should only be used for output, not for the parsing of input nor // This class should only be used for output, not for the parsing of input nor
// database storage. This class might output UTF-8 codes that might not be // database storage. This class might output UTF-8 codes that might not be
// supported by all output formats. Please format these strings accordingly. // supported by all output formats. Please format these strings accordingly.
class Set_Locale { class Set_Locale {
public $localedir = ""; //can be set from outside or you should set it here if it's in an unusual location public $localedir = ""; //can be set from outside or you should set it here if it's in an unusual location
@ -29,386 +29,386 @@ class Set_Locale {
private $TIMEFORMAT; private $TIMEFORMAT;
public $lang_codes = array( public $lang_codes = array(
'aa' => 'Afar', 'aa' => 'Afar',
'ab' => 'Abkhazian', 'ab' => 'Abkhazian',
'af' => 'Afrikaans', 'af' => 'Afrikaans',
'am' => 'Amharic', 'am' => 'Amharic',
'ar' => 'Arabic', 'ar' => 'Arabic',
'as' => 'Assamese', 'as' => 'Assamese',
'ay' => 'Aymara', 'ay' => 'Aymara',
'az' => 'Azerbaijani', 'az' => 'Azerbaijani',
'ba' => 'Bashkir', 'ba' => 'Bashkir',
'be' => 'Byelorussian', 'be' => 'Byelorussian',
'bg' => 'Bulgarian', 'bg' => 'Bulgarian',
'bh' => 'Bihari', 'bh' => 'Bihari',
'bi' => 'Bislama', 'bi' => 'Bislama',
'bn' => 'Bengali; Bangla', 'bn' => 'Bengali; Bangla',
'bo' => 'Tibetan', 'bo' => 'Tibetan',
'br' => 'Breton', 'br' => 'Breton',
'ca' => 'Catalan', 'ca' => 'Catalan',
'co' => 'Corsican', 'co' => 'Corsican',
'cs' => 'Czech', 'cs' => 'Czech',
'cy' => 'Welsh', 'cy' => 'Welsh',
'da' => 'Danish', 'da' => 'Danish',
'de' => 'German', 'de' => 'German',
'dz' => 'Bhutani', 'dz' => 'Bhutani',
'el' => 'Greek', 'el' => 'Greek',
'en' => 'English', 'en' => 'English',
'eo' => 'Esperanto', 'eo' => 'Esperanto',
'es' => 'Spanish', 'es' => 'Spanish',
'et' => 'Estonian', 'et' => 'Estonian',
'eu' => 'Basque', 'eu' => 'Basque',
'fa' => 'Persian', 'fa' => 'Persian',
'fi' => 'Finnish', 'fi' => 'Finnish',
'fj' => 'Fiji', 'fj' => 'Fiji',
'fo' => 'Faeroese', 'fo' => 'Faeroese',
'fr' => 'French', 'fr' => 'French',
'fy' => 'Frisian', 'fy' => 'Frisian',
'ga' => 'Irish', 'ga' => 'Irish',
'gd' => 'Scots Gaelic', 'gd' => 'Scots Gaelic',
'gl' => 'Galician', 'gl' => 'Galician',
'gn' => 'Guarani', 'gn' => 'Guarani',
'gu' => 'Gujarati', 'gu' => 'Gujarati',
'ha' => 'Hausa', 'ha' => 'Hausa',
'hi' => 'Hindi', 'hi' => 'Hindi',
'hr' => 'Croatian', 'hr' => 'Croatian',
'hu' => 'Hungarian', 'hu' => 'Hungarian',
'hy' => 'Armenian', 'hy' => 'Armenian',
'ia' => 'Interlingua', 'ia' => 'Interlingua',
'ie' => 'Interlingue', 'ie' => 'Interlingue',
'ik' => 'Inupiak', 'ik' => 'Inupiak',
'in' => 'Indonesian', 'in' => 'Indonesian',
'is' => 'Icelandic', 'is' => 'Icelandic',
'it' => 'Italian', 'it' => 'Italian',
'iw' => 'Hebrew', 'iw' => 'Hebrew',
'ja' => 'Japanese', 'ja' => 'Japanese',
'ji' => 'Yiddish', 'ji' => 'Yiddish',
'jw' => 'Javanese', 'jw' => 'Javanese',
'ka' => 'Georgian', 'ka' => 'Georgian',
'kk' => 'Kazakh', 'kk' => 'Kazakh',
'kl' => 'Greenlandic', 'kl' => 'Greenlandic',
'km' => 'Cambodian', 'km' => 'Cambodian',
'kn' => 'Kannada', 'kn' => 'Kannada',
'ko' => 'Korean', 'ko' => 'Korean',
'ks' => 'Kashmiri', 'ks' => 'Kashmiri',
'ku' => 'Kurdish', 'ku' => 'Kurdish',
'ky' => 'Kirghiz', 'ky' => 'Kirghiz',
'la' => 'Latin', 'la' => 'Latin',
'ln' => 'Lingala', 'ln' => 'Lingala',
'lo' => 'Laothian', 'lo' => 'Laothian',
'lt' => 'Lithuanian', 'lt' => 'Lithuanian',
'lv' => 'Latvian, Lettish', 'lv' => 'Latvian, Lettish',
'mg' => 'Malagasy', 'mg' => 'Malagasy',
'mi' => 'Maori', 'mi' => 'Maori',
'mk' => 'Macedonian', 'mk' => 'Macedonian',
'ml' => 'Malayalam', 'ml' => 'Malayalam',
'mn' => 'Mongolian', 'mn' => 'Mongolian',
'mo' => 'Moldavian', 'mo' => 'Moldavian',
'mr' => 'Marathi', 'mr' => 'Marathi',
'ms' => 'Malay', 'ms' => 'Malay',
'mt' => 'Maltese', 'mt' => 'Maltese',
'my' => 'Burmese', 'my' => 'Burmese',
'na' => 'Nauru', 'na' => 'Nauru',
'ne' => 'Nepali', 'ne' => 'Nepali',
'nl' => 'Dutch', 'nl' => 'Dutch',
'no' => 'Norwegian', 'no' => 'Norwegian',
'oc' => 'Occitan', 'oc' => 'Occitan',
'om' => '(Afan) Oromo', 'om' => '(Afan) Oromo',
'or' => 'Oriya', 'or' => 'Oriya',
'pa' => 'Punjabi', 'pa' => 'Punjabi',
'pl' => 'Polish', 'pl' => 'Polish',
'ps' => 'Pashto, Pushto', 'ps' => 'Pashto, Pushto',
'pt' => 'Portuguese', 'pt' => 'Portuguese',
'qu' => 'Quechua', 'qu' => 'Quechua',
'rm' => 'Rhaeto-Romance', 'rm' => 'Rhaeto-Romance',
'rn' => 'Kirundi', 'rn' => 'Kirundi',
'ro' => 'Romanian', 'ro' => 'Romanian',
'ru' => 'Russian', 'ru' => 'Russian',
'rw' => 'Kinyarwanda', 'rw' => 'Kinyarwanda',
'sa' => 'Sanskrit', 'sa' => 'Sanskrit',
'sd' => 'Sindhi', 'sd' => 'Sindhi',
'sg' => 'Sangro', 'sg' => 'Sangro',
'sh' => 'Serbo-Croatian', 'sh' => 'Serbo-Croatian',
'si' => 'Singhalese', 'si' => 'Singhalese',
'sk' => 'Slovak', 'sk' => 'Slovak',
'sl' => 'Slovenian', 'sl' => 'Slovenian',
'sm' => 'Samoan', 'sm' => 'Samoan',
'sn' => 'Shona', 'sn' => 'Shona',
'so' => 'Somali', 'so' => 'Somali',
'sq' => 'Albanian', 'sq' => 'Albanian',
'sr' => 'Serbian', 'sr' => 'Serbian',
'ss' => 'Siswati', 'ss' => 'Siswati',
'st' => 'Sesotho', 'st' => 'Sesotho',
'su' => 'Sundanese', 'su' => 'Sundanese',
'sv' => 'Swedish', 'sv' => 'Swedish',
'sw' => 'Swahili', 'sw' => 'Swahili',
'ta' => 'Tamil', 'ta' => 'Tamil',
'te' => 'Tegulu', 'te' => 'Tegulu',
'tg' => 'Tajik', 'tg' => 'Tajik',
'th' => 'Thai', 'th' => 'Thai',
'ti' => 'Tigrinya', 'ti' => 'Tigrinya',
'tk' => 'Turkmen', 'tk' => 'Turkmen',
'tl' => 'Tagalog', 'tl' => 'Tagalog',
'tn' => 'Setswana', 'tn' => 'Setswana',
'to' => 'Tonga', 'to' => 'Tonga',
'tr' => 'Turkish', 'tr' => 'Turkish',
'ts' => 'Tsonga', 'ts' => 'Tsonga',
'tt' => 'Tatar', 'tt' => 'Tatar',
'tw' => 'Twi', 'tw' => 'Twi',
'uk' => 'Ukrainian', 'uk' => 'Ukrainian',
'ur' => 'Urdu', 'ur' => 'Urdu',
'uz' => 'Uzbek', 'uz' => 'Uzbek',
'vi' => 'Vietnamese', 'vi' => 'Vietnamese',
'vo' => 'Volapuk', 'vo' => 'Volapuk',
'wo' => 'Wolof', 'wo' => 'Wolof',
'xh' => 'Xhosa', 'xh' => 'Xhosa',
'yo' => 'Yoruba', 'yo' => 'Yoruba',
'zh' => 'Chinese', 'zh' => 'Chinese',
'zu' => 'Zulu' 'zu' => 'Zulu'
); );
public $country_codes = array( public $country_codes = array(
'AF' => 'AFGHANISTAN', 'AF' => 'AFGHANISTAN',
'AL' => 'ALBANIA', 'AL' => 'ALBANIA',
'DZ' => 'ALGERIA', 'DZ' => 'ALGERIA',
'AS' => 'AMERICAN SAMOA', 'AS' => 'AMERICAN SAMOA',
'AD' => 'ANDORRA', 'AD' => 'ANDORRA',
'AO' => 'ANGOLA', 'AO' => 'ANGOLA',
'AI' => 'ANGUILLA', 'AI' => 'ANGUILLA',
'AQ' => 'ANTARCTICA', 'AQ' => 'ANTARCTICA',
'AG' => 'ANTIGUA AND BARBUDA', 'AG' => 'ANTIGUA AND BARBUDA',
'AR' => 'ARGENTINA', 'AR' => 'ARGENTINA',
'AM' => 'ARMENIA', 'AM' => 'ARMENIA',
'AW' => 'ARUBA', 'AW' => 'ARUBA',
'AU' => 'AUSTRALIA', 'AU' => 'AUSTRALIA',
'AT' => 'AUSTRIA', 'AT' => 'AUSTRIA',
'AZ' => 'AZERBAIJAN', 'AZ' => 'AZERBAIJAN',
'BS' => 'BAHAMAS', 'BS' => 'BAHAMAS',
'BH' => 'BAHRAIN', 'BH' => 'BAHRAIN',
'BD' => 'BANGLADESH', 'BD' => 'BANGLADESH',
'BB' => 'BARBADOS', 'BB' => 'BARBADOS',
'BY' => 'BELARUS', 'BY' => 'BELARUS',
'BE' => 'BELGIUM', 'BE' => 'BELGIUM',
'BZ' => 'BELIZE', 'BZ' => 'BELIZE',
'BJ' => 'BENIN', 'BJ' => 'BENIN',
'BM' => 'BERMUDA', 'BM' => 'BERMUDA',
'BT' => 'BHUTAN', 'BT' => 'BHUTAN',
'BO' => 'BOLIVIA', 'BO' => 'BOLIVIA',
'BA' => 'BOSNIA AND HERZEGOWINA', 'BA' => 'BOSNIA AND HERZEGOWINA',
'BW' => 'BOTSWANA', 'BW' => 'BOTSWANA',
'BV' => 'BOUVET ISLAND', 'BV' => 'BOUVET ISLAND',
'BR' => 'BRAZIL', 'BR' => 'BRAZIL',
'IO' => 'BRITISH INDIAN OCEAN TERRITORY', 'IO' => 'BRITISH INDIAN OCEAN TERRITORY',
'BN' => 'BRUNEI DARUSSALAM', 'BN' => 'BRUNEI DARUSSALAM',
'BG' => 'BULGARIA', 'BG' => 'BULGARIA',
'BF' => 'BURKINA FASO', 'BF' => 'BURKINA FASO',
'BI' => 'BURUNDI', 'BI' => 'BURUNDI',
'KH' => 'CAMBODIA', 'KH' => 'CAMBODIA',
'CM' => 'CAMEROON', 'CM' => 'CAMEROON',
'CA' => 'CANADA', 'CA' => 'CANADA',
'CV' => 'CAPE VERDE', 'CV' => 'CAPE VERDE',
'KY' => 'CAYMAN ISLANDS', 'KY' => 'CAYMAN ISLANDS',
'CF' => 'CENTRAL AFRICAN REPUBLIC', 'CF' => 'CENTRAL AFRICAN REPUBLIC',
'TD' => 'CHAD', 'TD' => 'CHAD',
'CL' => 'CHILE', 'CL' => 'CHILE',
'CN' => 'CHINA', 'CN' => 'CHINA',
'CX' => 'CHRISTMAS ISLAND', 'CX' => 'CHRISTMAS ISLAND',
'CC' => 'COCOS (KEELING) ISLANDS', 'CC' => 'COCOS (KEELING) ISLANDS',
'CO' => 'COLOMBIA', 'CO' => 'COLOMBIA',
'KM' => 'COMOROS', 'KM' => 'COMOROS',
'CG' => 'CONGO', 'CG' => 'CONGO',
'CD' => 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'CD' => 'CONGO, THE DEMOCRATIC REPUBLIC OF THE',
'CK' => 'COOK ISLANDS', 'CK' => 'COOK ISLANDS',
'CR' => 'COSTA RICA', 'CR' => 'COSTA RICA',
'CI' => 'COTE D\'IVOIRE', 'CI' => 'COTE D\'IVOIRE',
'HR' => 'CROATIA (local name: Hrvatska)', 'HR' => 'CROATIA (local name: Hrvatska)',
'CU' => 'CUBA', 'CU' => 'CUBA',
'CY' => 'CYPRUS', 'CY' => 'CYPRUS',
'CZ' => 'CZECH REPUBLIC', 'CZ' => 'CZECH REPUBLIC',
'DK' => 'DENMARK', 'DK' => 'DENMARK',
'DJ' => 'DJIBOUTI', 'DJ' => 'DJIBOUTI',
'DM' => 'DOMINICA', 'DM' => 'DOMINICA',
'DO' => 'DOMINICAN REPUBLIC', 'DO' => 'DOMINICAN REPUBLIC',
'TP' => 'EAST TIMOR', 'TP' => 'EAST TIMOR',
'EC' => 'ECUADOR', 'EC' => 'ECUADOR',
'EG' => 'EGYPT', 'EG' => 'EGYPT',
'SV' => 'EL SALVADOR', 'SV' => 'EL SALVADOR',
'GQ' => 'EQUATORIAL GUINEA', 'GQ' => 'EQUATORIAL GUINEA',
'ER' => 'ERITREA', 'ER' => 'ERITREA',
'EE' => 'ESTONIA', 'EE' => 'ESTONIA',
'ET' => 'ETHIOPIA', 'ET' => 'ETHIOPIA',
'FK' => 'FALKLAND ISLANDS (MALVINAS)', 'FK' => 'FALKLAND ISLANDS (MALVINAS)',
'FO' => 'FAROE ISLANDS', 'FO' => 'FAROE ISLANDS',
'FJ' => 'FIJI', 'FJ' => 'FIJI',
'FI' => 'FINLAND', 'FI' => 'FINLAND',
'FR' => 'FRANCE', 'FR' => 'FRANCE',
'FX' => 'FRANCE, METROPOLITAN', 'FX' => 'FRANCE, METROPOLITAN',
'GF' => 'FRENCH GUIANA', 'GF' => 'FRENCH GUIANA',
'PF' => 'FRENCH POLYNESIA', 'PF' => 'FRENCH POLYNESIA',
'TF' => 'FRENCH SOUTHERN TERRITORIES', 'TF' => 'FRENCH SOUTHERN TERRITORIES',
'GA' => 'GABON', 'GA' => 'GABON',
'GM' => 'GAMBIA', 'GM' => 'GAMBIA',
'GE' => 'GEORGIA', 'GE' => 'GEORGIA',
'DE' => 'GERMANY', 'DE' => 'GERMANY',
'GH' => 'GHANA', 'GH' => 'GHANA',
'GI' => 'GIBRALTAR', 'GI' => 'GIBRALTAR',
'GR' => 'GREECE', 'GR' => 'GREECE',
'GL' => 'GREENLAND', 'GL' => 'GREENLAND',
'GD' => 'GRENADA', 'GD' => 'GRENADA',
'GP' => 'GUADELOUPE', 'GP' => 'GUADELOUPE',
'GU' => 'GUAM', 'GU' => 'GUAM',
'GT' => 'GUATEMALA', 'GT' => 'GUATEMALA',
'GN' => 'GUINEA', 'GN' => 'GUINEA',
'GW' => 'GUINEA-BISSAU', 'GW' => 'GUINEA-BISSAU',
'GY' => 'GUYANA', 'GY' => 'GUYANA',
'HT' => 'HAITI', 'HT' => 'HAITI',
'HM' => 'HEARD AND MC DONALD ISLANDS', 'HM' => 'HEARD AND MC DONALD ISLANDS',
'VA' => 'HOLY SEE (VATICAN CITY STATE)', 'VA' => 'HOLY SEE (VATICAN CITY STATE)',
'HN' => 'HONDURAS', 'HN' => 'HONDURAS',
'HK' => 'HONG KONG', 'HK' => 'HONG KONG',
'HU' => 'HUNGARY', 'HU' => 'HUNGARY',
'IS' => 'ICELAND', 'IS' => 'ICELAND',
'IN' => 'INDIA', 'IN' => 'INDIA',
'ID' => 'INDONESIA', 'ID' => 'INDONESIA',
'IR' => 'IRAN (ISLAMIC REPUBLIC OF)', 'IR' => 'IRAN (ISLAMIC REPUBLIC OF)',
'IQ' => 'IRAQ', 'IQ' => 'IRAQ',
'IE' => 'IRELAND', 'IE' => 'IRELAND',
'IL' => 'ISRAEL', 'IL' => 'ISRAEL',
'IT' => 'ITALY', 'IT' => 'ITALY',
'JM' => 'JAMAICA', 'JM' => 'JAMAICA',
'JP' => 'JAPAN', 'JP' => 'JAPAN',
'JO' => 'JORDAN', 'JO' => 'JORDAN',
'KZ' => 'KAZAKHSTAN', 'KZ' => 'KAZAKHSTAN',
'KE' => 'KENYA', 'KE' => 'KENYA',
'KI' => 'KIRIBATI', 'KI' => 'KIRIBATI',
'KP' => 'KOREA, DEMOCRATIC PEOPLE\'S REPUBLIC OF', 'KP' => 'KOREA, DEMOCRATIC PEOPLE\'S REPUBLIC OF',
'KR' => 'KOREA, REPUBLIC OF', 'KR' => 'KOREA, REPUBLIC OF',
'KW' => 'KUWAIT', 'KW' => 'KUWAIT',
'KG' => 'KYRGYZSTAN', 'KG' => 'KYRGYZSTAN',
'LA' => 'LAO PEOPLE\'S DEMOCRATIC REPUBLIC', 'LA' => 'LAO PEOPLE\'S DEMOCRATIC REPUBLIC',
'LV' => 'LATVIA', 'LV' => 'LATVIA',
'LB' => 'LEBANON', 'LB' => 'LEBANON',
'LS' => 'LESOTHO', 'LS' => 'LESOTHO',
'LR' => 'LIBERIA', 'LR' => 'LIBERIA',
'LY' => 'LIBYAN ARAB JAMAHIRIYA', 'LY' => 'LIBYAN ARAB JAMAHIRIYA',
'LI' => 'LIECHTENSTEIN', 'LI' => 'LIECHTENSTEIN',
'LT' => 'LITHUANIA', 'LT' => 'LITHUANIA',
'LU' => 'LUXEMBOURG', 'LU' => 'LUXEMBOURG',
'MO' => 'MACAU', 'MO' => 'MACAU',
'MK' => 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'MK' => 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF',
'MG' => 'MADAGASCAR', 'MG' => 'MADAGASCAR',
'MW' => 'MALAWI', 'MW' => 'MALAWI',
'MY' => 'MALAYSIA', 'MY' => 'MALAYSIA',
'MV' => 'MALDIVES', 'MV' => 'MALDIVES',
'ML' => 'MALI', 'ML' => 'MALI',
'MT' => 'MALTA', 'MT' => 'MALTA',
'MH' => 'MARSHALL ISLANDS', 'MH' => 'MARSHALL ISLANDS',
'MQ' => 'MARTINIQUE', 'MQ' => 'MARTINIQUE',
'MR' => 'MAURITANIA', 'MR' => 'MAURITANIA',
'MU' => 'MAURITIUS', 'MU' => 'MAURITIUS',
'YT' => 'MAYOTTE', 'YT' => 'MAYOTTE',
'MX' => 'MEXICO', 'MX' => 'MEXICO',
'FM' => 'MICRONESIA, FEDERATED STATES OF', 'FM' => 'MICRONESIA, FEDERATED STATES OF',
'MD' => 'MOLDOVA, REPUBLIC OF', 'MD' => 'MOLDOVA, REPUBLIC OF',
'MC' => 'MONACO', 'MC' => 'MONACO',
'MN' => 'MONGOLIA', 'MN' => 'MONGOLIA',
'MS' => 'MONTSERRAT', 'MS' => 'MONTSERRAT',
'MA' => 'MOROCCO', 'MA' => 'MOROCCO',
'MZ' => 'MOZAMBIQUE', 'MZ' => 'MOZAMBIQUE',
'MM' => 'MYANMAR', 'MM' => 'MYANMAR',
'NA' => 'NAMIBIA', 'NA' => 'NAMIBIA',
'NR' => 'NAURU', 'NR' => 'NAURU',
'NP' => 'NEPAL', 'NP' => 'NEPAL',
'NL' => 'NETHERLANDS', 'NL' => 'NETHERLANDS',
'AN' => 'NETHERLANDS ANTILLES', 'AN' => 'NETHERLANDS ANTILLES',
'NC' => 'NEW CALEDONIA', 'NC' => 'NEW CALEDONIA',
'NZ' => 'NEW ZEALAND', 'NZ' => 'NEW ZEALAND',
'NI' => 'NICARAGUA', 'NI' => 'NICARAGUA',
'NE' => 'NIGER', 'NE' => 'NIGER',
'NG' => 'NIGERIA', 'NG' => 'NIGERIA',
'NU' => 'NIUE', 'NU' => 'NIUE',
'NF' => 'NORFOLK ISLAND', 'NF' => 'NORFOLK ISLAND',
'MP' => 'NORTHERN MARIANA ISLANDS', 'MP' => 'NORTHERN MARIANA ISLANDS',
'NO' => 'NORWAY', 'NO' => 'NORWAY',
'OM' => 'OMAN', 'OM' => 'OMAN',
'PK' => 'PAKISTAN', 'PK' => 'PAKISTAN',
'PW' => 'PALAU', 'PW' => 'PALAU',
'PS' => 'PALESTINIAN TERRITORY, OCCUPIED', 'PS' => 'PALESTINIAN TERRITORY, OCCUPIED',
'PA' => 'PANAMA', 'PA' => 'PANAMA',
'PG' => 'PAPUA NEW GUINEA', 'PG' => 'PAPUA NEW GUINEA',
'PY' => 'PARAGUAY', 'PY' => 'PARAGUAY',
'PE' => 'PERU', 'PE' => 'PERU',
'PH' => 'PHILIPPINES', 'PH' => 'PHILIPPINES',
'PN' => 'PITCAIRN', 'PN' => 'PITCAIRN',
'PL' => 'POLAND', 'PL' => 'POLAND',
'PT' => 'PORTUGAL', 'PT' => 'PORTUGAL',
'PR' => 'PUERTO RICO', 'PR' => 'PUERTO RICO',
'QA' => 'QATAR', 'QA' => 'QATAR',
'RE' => 'REUNION', 'RE' => 'REUNION',
'RO' => 'ROMANIA', 'RO' => 'ROMANIA',
'RU' => 'RUSSIAN FEDERATION', 'RU' => 'RUSSIAN FEDERATION',
'RW' => 'RWANDA', 'RW' => 'RWANDA',
'KN' => 'SAINT KITTS AND NEVIS', 'KN' => 'SAINT KITTS AND NEVIS',
'LC' => 'SAINT LUCIA', 'LC' => 'SAINT LUCIA',
'VC' => 'SAINT VINCENT AND THE GRENADINES', 'VC' => 'SAINT VINCENT AND THE GRENADINES',
'WS' => 'SAMOA', 'WS' => 'SAMOA',
'SM' => 'SAN MARINO', 'SM' => 'SAN MARINO',
'ST' => 'SAO TOME AND PRINCIPE', 'ST' => 'SAO TOME AND PRINCIPE',
'SA' => 'SAUDI ARABIA', 'SA' => 'SAUDI ARABIA',
'SN' => 'SENEGAL', 'SN' => 'SENEGAL',
'SC' => 'SEYCHELLES', 'SC' => 'SEYCHELLES',
'SL' => 'SIERRA LEONE', 'SL' => 'SIERRA LEONE',
'SG' => 'SINGAPORE', 'SG' => 'SINGAPORE',
'SK' => 'SLOVAKIA (Slovak Republic)', 'SK' => 'SLOVAKIA (Slovak Republic)',
'SI' => 'SLOVENIA', 'SI' => 'SLOVENIA',
'SB' => 'SOLOMON ISLANDS', 'SB' => 'SOLOMON ISLANDS',
'SO' => 'SOMALIA', 'SO' => 'SOMALIA',
'ZA' => 'SOUTH AFRICA', 'ZA' => 'SOUTH AFRICA',
'GS' => 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'GS' => 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS',
'ES' => 'SPAIN', 'ES' => 'SPAIN',
'LK' => 'SRI LANKA', 'LK' => 'SRI LANKA',
'SH' => 'ST. HELENA', 'SH' => 'ST. HELENA',
'PM' => 'ST. PIERRE AND MIQUELON', 'PM' => 'ST. PIERRE AND MIQUELON',
'SD' => 'SUDAN', 'SD' => 'SUDAN',
'SR' => 'SURINAME', 'SR' => 'SURINAME',
'SJ' => 'SVALBARD AND JAN MAYEN ISLANDS', 'SJ' => 'SVALBARD AND JAN MAYEN ISLANDS',
'SZ' => 'SWAZILAND', 'SZ' => 'SWAZILAND',
'SE' => 'SWEDEN', 'SE' => 'SWEDEN',
'CH' => 'SWITZERLAND', 'CH' => 'SWITZERLAND',
'SY' => 'SYRIAN ARAB REPUBLIC', 'SY' => 'SYRIAN ARAB REPUBLIC',
'TW' => 'TAIWAN, PROVINCE OF CHINA', 'TW' => 'TAIWAN, PROVINCE OF CHINA',
'TJ' => 'TAJIKISTAN', 'TJ' => 'TAJIKISTAN',
'TZ' => 'TANZANIA, UNITED REPUBLIC OF', 'TZ' => 'TANZANIA, UNITED REPUBLIC OF',
'TH' => 'THAILAND', 'TH' => 'THAILAND',
'TG' => 'TOGO', 'TG' => 'TOGO',
'TK' => 'TOKELAU', 'TK' => 'TOKELAU',
'TO' => 'TONGA', 'TO' => 'TONGA',
'TT' => 'TRINIDAD AND TOBAGO', 'TT' => 'TRINIDAD AND TOBAGO',
'TN' => 'TUNISIA', 'TN' => 'TUNISIA',
'TR' => 'TURKEY', 'TR' => 'TURKEY',
'TM' => 'TURKMENISTAN', 'TM' => 'TURKMENISTAN',
'TC' => 'TURKS AND CAICOS ISLANDS', 'TC' => 'TURKS AND CAICOS ISLANDS',
'TV' => 'TUVALU', 'TV' => 'TUVALU',
'UG' => 'UGANDA', 'UG' => 'UGANDA',
'UA' => 'UKRAINE', 'UA' => 'UKRAINE',
'AE' => 'UNITED ARAB EMIRATES', 'AE' => 'UNITED ARAB EMIRATES',
'GB' => 'UNITED KINGDOM', 'GB' => 'UNITED KINGDOM',
'US' => 'UNITED STATES', 'US' => 'UNITED STATES',
'UM' => 'UNITED STATES MINOR OUTLYING ISLANDS', 'UM' => 'UNITED STATES MINOR OUTLYING ISLANDS',
'UY' => 'URUGUAY', 'UY' => 'URUGUAY',
'UZ' => 'UZBEKISTAN', 'UZ' => 'UZBEKISTAN',
'VU' => 'VANUATU', 'VU' => 'VANUATU',
'VE' => 'VENEZUELA', 'VE' => 'VENEZUELA',
'VN' => 'VIET NAM', 'VN' => 'VIET NAM',
'VG' => 'VIRGIN ISLANDS (BRITISH)', 'VG' => 'VIRGIN ISLANDS (BRITISH)',
'VI' => 'VIRGIN ISLANDS (U.S.)', 'VI' => 'VIRGIN ISLANDS (U.S.)',
'WF' => 'WALLIS AND FUTUNA ISLANDS', 'WF' => 'WALLIS AND FUTUNA ISLANDS',
'EH' => 'WESTERN SAHARA', 'EH' => 'WESTERN SAHARA',
'YE' => 'YEMEN', 'YE' => 'YEMEN',
'YU' => 'YUGOSLAVIA', 'YU' => 'YUGOSLAVIA',
'ZM' => 'ZAMBIA', 'ZM' => 'ZAMBIA',
'ZW' => 'ZIMBABWE' 'ZW' => 'ZIMBABWE'
); );
//ISO-4217 currency codes //ISO-4217 currency codes
public $currency_codes = array ( public $currency_codes = array (
@ -616,7 +616,7 @@ class Set_Locale {
'ZMK' => 'Kwacha', 'ZMK' => 'Kwacha',
'ZRN' => 'New Zaire', 'ZRN' => 'New Zaire',
'ZWD' => 'Zimbabwe Dollar' 'ZWD' => 'Zimbabwe Dollar'
); );
//When initializing this and the locale specified cannot be found, the //When initializing this and the locale specified cannot be found, the
//system default will be used //system default will be used
@ -662,9 +662,9 @@ class Set_Locale {
$this->TIMEFORMAT = $glob["TIMEFORMAT"]; $this->TIMEFORMAT = $glob["TIMEFORMAT"];
if(!empty($this->NUMFORMAT) && !empty($this->MONFORMAT) && !empty($this->TIMEFORMAT)) if(!empty($this->NUMFORMAT) && !empty($this->MONFORMAT) && !empty($this->TIMEFORMAT))
return true; return true;
//If any of these is empty, we'll have //If any of these is empty, we'll have
//to fill it with something so tthe //to fill it with something so tthe
//functions goes on //functions goes on
} }
} }
@ -704,11 +704,11 @@ class Set_Locale {
} }
} }
foreach ($time as $value) { foreach ($time as $value) {
$value = split('=',$value); $value = split('=',$value);
if(!empty($value[1])) { if(!empty($value[1])) {
$this->TIMEFORMAT[$value[0]] = str_replace('"','',$value[1]); $this->TIMEFORMAT[$value[0]] = str_replace('"','',$value[1]);
} }
} }
if($cache !== false) { if($cache !== false) {
@ -740,12 +740,14 @@ class Set_Locale {
if($locale == "UTF-8" || $locale == "C" || $locale == "POSIX") { if($locale == "UTF-8" || $locale == "C" || $locale == "POSIX") {
return $locale; //Pure UTF-8, C or POSIX is not localized to a country return $locale; //Pure UTF-8, C or POSIX is not localized to a country
} }
$lang_cntr = split("_",$langcntr_char[0]);
$lang = $lang_cntr[0]; $lang_country = split ("_",$locale);
$cntr = $lang_cntr[1]; $lang = $lang_country[0];
$char = $langcntr_char[1]; $country_char = split ("\.",$lang_country[1]);
unset ($langcntr_char, $lang_cntr); $cntr = isset($country_char[0]) ? $country_char[0] : "";
$char = isset($country_char[1]) ? $country_char[1] : "";
unset ($lang_country, $country_char);
if (in_array($lang,array_keys($this->lang_codes))) { if (in_array($lang,array_keys($this->lang_codes))) {
$lang = $this->lang_codes[$lang]; $lang = $this->lang_codes[$lang];
} else { } else {
@ -807,16 +809,16 @@ class Set_Locale {
return $precision; return $precision;
} }
// This function should get values as a non-formatted numeric string // This function should get values as a non-formatted numeric string
// This can accept scientific notation and other forms // This can accept scientific notation and other forms
// Example: Correct - 1000.00 // Example: Correct - 1000.00
// Correct - 0.1e16 // Correct - 0.1e16
// Incorrect - 1,000.00 // Incorrect - 1,000.00
// Returns false if string is not numeric // Returns false if string is not numeric
// //
// @value = Value to be formatted // @value = Value to be formatted
// @precision = Optional - Precision (numbers after the comma). The function will // @precision = Optional - Precision (numbers after the comma). The function will
// automatically figure this out but if you want to force it, set it // automatically figure this out but if you want to force it, set it
function fmt_number ($value, $precision = false) { function fmt_number ($value, $precision = false) {
if($precision === false) { if($precision === false) {
@ -834,8 +836,8 @@ class Set_Locale {
// This function should get values as a non formatted numeric string // This function should get values as a non formatted numeric string
// This cannot reliably accept scientific notations and other forms // This cannot reliably accept scientific notations and other forms
// Example: Correct - 1000.00 // Example: Correct - 1000.00
// Incorrect - 1,000.00 // Incorrect - 1,000.00
// Undefined - 1e-15 // Undefined - 1e-15
// Returns false if string is not numeric // Returns false if string is not numeric
// //
// @value = Value to be formatted // @value = Value to be formatted
@ -907,9 +909,9 @@ class Set_Locale {
// be defined across all locales and all systems // be defined across all locales and all systems
// @type: Specify the INPUT. Can be // @type: Specify the INPUT. Can be
// UNIXTIME for integer unix timeformat (default) // UNIXTIME for integer unix timeformat (default)
// MYSQL for MySQL format (2000-07-01 00:00) // MYSQL for MySQL format (2000-07-01 00:00)
// ATOM for strings like 2000-07-01T00:00:00+00:00 // ATOM for strings like 2000-07-01T00:00:00+00:00
// RFC822 for RFC822 formatted strings // RFC822 for RFC822 formatted strings
// ENGLISH A US English time string understood by strtotime() // ENGLISH A US English time string understood by strtotime()
// If an integer is sent as value, it will default to UNIXTIME // If an integer is sent as value, it will default to UNIXTIME
@ -921,12 +923,12 @@ class Set_Locale {
function fmt_time ($value, $type = "UNIXTIME", $out = "DATETIME", $utc = 0) { function fmt_time ($value, $type = "UNIXTIME", $out = "DATETIME", $utc = 0) {
if(!is_int($value) && $type != "UNIXTIME") { if(!is_int($value) && $type != "UNIXTIME") {
switch ($type) { switch ($type) {
case "MYSQL": case "MYSQL":
$value = preg_split('/[-:\s]+/i',$value); $value = preg_split('/[-:\s]+/i',$value);
$value = mktime($value[3],$value[4],$value[5],$value[1],$value[2],$value[0]); $value = mktime($value[3],$value[4],$value[5],$value[1],$value[2],$value[0]);
break; break;
default: default:
$value = strtotime($value); $value = strtotime($value);
} }
} elseif (!is_numeric($value)) { } elseif (!is_numeric($value)) {
trigger_error("Value given to fmt_time is not Unix Timestamp although it is specified"); trigger_error("Value given to fmt_time is not Unix Timestamp although it is specified");
@ -941,24 +943,24 @@ class Set_Locale {
//Command line processing is the safest //Command line processing is the safest
switch ($out) { switch ($out) {
case "DATETIME": case "DATETIME":
$output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['d_t_fmt'].'"; LANG=\$LANGTEMP'); $output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['d_t_fmt'].'"; LANG=\$LANGTEMP');
break; break;
case "LONGTIME": case "LONGTIME":
$output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['t_fmt_ampm'].'"; LANG=\$LANGTEMP'); $output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['t_fmt_ampm'].'"; LANG=\$LANGTEMP');
break; break;
case "DATE": case "DATE":
$output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['d_fmt'].'"; LANG=\$LANGTEMP'); $output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['d_fmt'].'"; LANG=\$LANGTEMP');
break; break;
case "TIME": case "TIME":
$output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['t_fmt'].'"; LANG=\$LANGTEMP'); $output = exec('LANGTEMP=\$LANG; LANG='.$this->locale.'; date '.$utc.' -r '.$value.' +"'.$this->TIMEFORMAT['t_fmt'].'"; LANG=\$LANGTEMP');
break; break;
default: default:
//This part cannot be safely localized (see //This part cannot be safely localized (see
//warning with setlocale) //warning with setlocale)
$output = date($out,$value); $output = date($out,$value);
} }
return $output; return $output;
} }
} }
?> ?>

View File

@ -59,7 +59,8 @@ INSERT INTO `tconfig` VALUES
(17, 'graph_color1', '#38B800'), (17, 'graph_color1', '#38B800'),
(18, 'graph_color2', '#42D100'), (18, 'graph_color2', '#42D100'),
(19, 'graph_color3', '#89FF09'), (19, 'graph_color3', '#89FF09'),
(20, 'sla_period', '604800'); (20, 'sla_period', '604800'),
(21, 'locale', 'C'),;
UNLOCK TABLES; UNLOCK TABLES;
-- --