fix bug 6059: Static_country_zones Canada wrong ISO-Nr
authorfranzholz <franzholz@735d13b6-9817-0410-8766-e36946ffe9aa>
Sun, 16 Mar 2008 07:07:25 +0000 (07:07 +0000)
committerfranzholz <franzholz@735d13b6-9817-0410-8766-e36946ffe9aa>
Sun, 16 Mar 2008 07:07:25 +0000 (07:07 +0000)
set default country to DEU and contry zone to NRW because most persons using TYPO3 live here
set default language to EN because most persons using TYPO3 understand English
add a $conf parameter to the init routine. Other extensions may override the setup now.
fix bug with not set default country
fix bug with not getting rid of the div extension
replace $TYPO3_CONF_VARS by $GLOBALS[TYPO3_CONF_VARS] because some PHP5 versions loose its value

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/static_info_tables/trunk@8613 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
class.ext_update.php
class.tx_staticinfotables_div.php
class.tx_staticinfotables_encoding.php
class.tx_staticinfotables_syslanguage.php
doc/manual.sxw
ext_localconf.php
ext_tables_static+adt.sql
pi1/class.tx_staticinfotables_pi1.php

index b39b990..bf2a83f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-15  Franz Holzinger  <contact@fholzinger.com>
+       * fix bug 6059: Static_country_zones Canada wrong ISO-Nr
+       * set default country to DEU and contry zone to NRW because most persons using TYPO3 live here
+       * set default language to EN because most persons using TYPO3 understand English
+       * add a $conf parameter to the init routine. Other extensions may override the setup now.
+       * fix bug with not set default country
+       * fix bug with not getting rid of the div extension
+       * replace $TYPO3_CONF_VARS by $GLOBALS['TYPO3_CONF_VARS'] because some PHP5 versions loose its value
+
 2007-12-16  Franz Holzinger  <kontakt@fholzinger.com>
        * remove dependancy from div extension
        * new feature charset: extension setup for the character set of the tables
index df6167b..3ad67cd 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2005-2006 René Fritz (r.fritz@colorcube.de)
+*  (c) 2005-2008 René Fritz (r.fritz@colorcube.de)
 *  All rights reserved
 *
 *  This script is part of the Typo3 project. The Typo3 project is
@@ -23,7 +23,6 @@
 ***************************************************************/
 
 
-global $TYPO3_CONF_VARS;
 
 /**
  * Class for updating the db
@@ -87,8 +86,8 @@ class ext_update  {
 }
 
 // Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.ext_update.php'])    {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.ext_update.php']);
+if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.ext_update.php']) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.ext_update.php']);
 }
 
 
index b4f8bfc..43d20cf 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2004-2007 René Fritz (r.fritz@colorcube.de)
+*  (c) 2004-2008 René Fritz (r.fritz@colorcube.de)
 *  All rights reserved
 *
 *  This script is part of the Typo3 project. The Typo3 project is
@@ -55,8 +55,6 @@
  *
  */
 
-global $TYPO3_CONF_VARS;
-
 
 class tx_staticinfotables_div {
 
@@ -70,7 +68,7 @@ class tx_staticinfotables_div {
         * @return      string          field name
         */
        function getTCAlabelField($table, $loadTCA=TRUE, $lang='', $local=FALSE) {
-               global $TYPO3_CONF_VARS, $TCA, $LANG, $TSFE;
+               global $TCA, $LANG, $TSFE;
 
                if (is_object($LANG)) {
                        $csConvObj = $LANG->csConvObj;
@@ -85,22 +83,19 @@ class tx_staticinfotables_div {
                }
 
                $labelFields = array();
-               if($table && is_array($TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'][$table]['label_fields'])) {
+               if($table && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'][$table]['label_fields'])) {
                        if ($loadTCA)   {
                                t3lib_div::loadTCA($table);
-                               if (defined ('DIV_EXTkey') && t3lib_extMgm::isLoaded(DIV_EXTkey)) {
-                                       include_once(PATH_BE_div.'class.tx_div.php');
 
-                                               // get all extending TCAs
-                                       if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['extendingTCA']))        {
-                                               tx_staticinfotables_div::loadTcaAdditions($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['extendingTCA']);
-                                       }
+                                       // get all extending TCAs
+                               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['extendingTCA']))        {
+                                       tx_staticinfotables_div::loadTcaAdditions($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['extendingTCA']);
                                }
                        }
 
                        $lang = $lang ? $lang : tx_staticinfotables_div::getCurrentLanguage();
 
-                       foreach ($TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'][$table]['label_fields'] as $field) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'][$table]['label_fields'] as $field) {
                                if ($local) {
                                        $labelField = str_replace ('##', 'local', $field);
                                } else {
@@ -144,9 +139,9 @@ class tx_staticinfotables_div {
         * @return      string          field name
         */
        function getIsoCodeField($table, $isoCode, $loadTCA=TRUE, $index=0) {
-               global $TYPO3_CONF_VARS, $TCA;
+               global $TCA;
 
-               if ($isoCode && $table && ($isoCodeField = $TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'][$table]['isocode_field'][$index])) {
+               if ($isoCode && $table && ($isoCodeField = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'][$table]['isocode_field'][$index])) {
                        if ($loadTCA) {
                                t3lib_div::loadTCA($table);
                        }
@@ -316,7 +311,7 @@ class tx_staticinfotables_div {
                                $fields,
                                $table,
                                $whereClause.$enableFields
-                               );
+                       );
                        if ($row = $TYPO3_DB->sql_fetch_assoc($res))    {
                                foreach ($titleFields as $titleField) {
                                        if ($row[$titleField]) {
@@ -633,7 +628,7 @@ class tx_staticinfotables_div {
 }
 
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_div.php'])    {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_div.php']);
+if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_div.php'])    {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_div.php']);
 }
 ?>
\ No newline at end of file
index abeee1b..e6123c1 100644 (file)
@@ -186,7 +186,7 @@ class tx_staticinfotables_encoding {
 
 }
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_encoding.php'])  {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_encoding.php']);
+if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_encoding.php'])       {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_encoding.php']);
 }
 ?>
\ No newline at end of file
index 28788dc..02fde83 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2004-2005 René Fritz (r.fritz@colorcube.de)
+*  (c) 2004-2008 René Fritz (r.fritz@colorcube.de)
 *  All rights reserved
 *
 *  This script is part of the Typo3 project. The Typo3 project is
@@ -31,8 +31,6 @@
  */
 
 
-global $TYPO3_CONF_VARS;
-
 
 /**
  * example for using the hotlist functionality with the sys_language table
@@ -51,7 +49,7 @@ class tx_staticinfotables_syslanguage {
 }
 
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_syslanguage.php'])    {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_syslanguage.php']);
+if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_syslanguage.php'])    {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/class.tx_staticinfotables_syslanguage.php']);
 }
 ?>
\ No newline at end of file
index d99bec4..11c1a40 100644 (file)
Binary files a/doc/manual.sxw and b/doc/manual.sxw differ
index 7dcd3b0..62fa87e 100644 (file)
@@ -26,11 +26,11 @@ if (t3lib_extMgm::isLoaded(DIV_EXTkey)) {
 
 $_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here:
 
-if (!isset($TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['charset'])) {
-       $TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['charset'] = $_EXTCONF['charset'] ? $_EXTCONF['charset'] : 'utf-8';
+if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['charset']))      {
+       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['charset'] = $_EXTCONF['charset'] ? $_EXTCONF['charset'] : 'utf-8';
 }
 
-$TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'] = array(
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['tables'] = array(
        'static_territories' => array(
                'label_fields' => array(        // possible label fields for different languages. Default as last.
                        'tr_name_##', 'tr_name_en',
index 5cf1328..e273af7 100644 (file)
@@ -1,5 +1,6 @@
 # TYPO3 Extension Manager dump 1.1
 #
+# Host: localhost    Database: TYPO3
 #--------------------------------------------------------
 
 
@@ -47,9 +48,9 @@ INSERT INTO static_territories VALUES ('28', '0', '61', '9', 'Polynesia');
 INSERT INTO static_territories VALUES ('30', '0', '34', '142', 'Southern Asia');
 
 
-
 # TYPO3 Extension Manager dump 1.1
 #
+# Host: localhost    Database: TYPO3
 #--------------------------------------------------------
 
 
@@ -324,9 +325,9 @@ INSERT INTO static_countries VALUES ('240', '0', 'AX', 'ALA', '248', '154', 'Ål
 INSERT INTO static_countries VALUES ('241', '0', 'HM', 'HMD', '334', '53', 'Heard Island and McDonald Islands', 'Heard Island and McDonald Islands', '', '', 'AUD', '36', '0', '0', '0', '0', 'Heard Island and McDonald Islands', 'Heard Island and McDonald Islands', '0');
 
 
-
 # TYPO3 Extension Manager dump 1.1
 #
+# Host: localhost    Database: TYPO3
 #--------------------------------------------------------
 
 
@@ -819,9 +820,9 @@ INSERT INTO static_country_zones VALUES ('481', '0', 'BR', 'BRA', '76', 'SP', 'S
 INSERT INTO static_country_zones VALUES ('482', '0', 'BR', 'BRA', '76', 'TO', 'Tocantins', '');
 
 
-
 # TYPO3 Extension Manager dump 1.1
 #
+# Host: localhost    Database: TYPO3
 #--------------------------------------------------------
 
 
@@ -1015,9 +1016,9 @@ INSERT INTO static_currencies VALUES ('174', '0', 'SRD', '968', 'Suriname dollar
 INSERT INTO static_currencies VALUES ('175', '0', 'TRY', '949', 'Turkish new lira', 'YTL', '', '.', ',', '2', 'new kuruş', '100', '', '');
 
 
-
 # TYPO3 Extension Manager dump 1.1
 #
+# Host: localhost    Database: TYPO3
 #--------------------------------------------------------
 
 
@@ -1231,9 +1232,9 @@ INSERT INTO static_languages VALUES ('160', '0', 'IO', 'Ido', '', '', '', 'Ido',
 INSERT INTO static_languages VALUES ('182', '0', 'PI', 'Pali', '', '', '', 'Pāli', '1', '0');
 
 
-
 # TYPO3 Extension Manager dump 1.1
 #
+# Host: localhost    Database: TYPO3
 #--------------------------------------------------------
 
 
@@ -1277,7 +1278,7 @@ INSERT INTO static_taxes VALUES ('10', '0', '1078631800', '0', '0', '0', '0', '1
 INSERT INTO static_taxes VALUES ('11', '0', '1078671742', '0', '0', '0', '0', '56', 'BE', 'BEL', '', 'Belgium VAT', '1', 'VAT', '3', '0.21', '1');
 INSERT INTO static_taxes VALUES ('12', '0', '1078672536', '0', '0', '0', '0', '203', 'CZ', 'CZE', '', 'Czech Republic VAT', '1', 'GST', '3', '0.22', '1');
 INSERT INTO static_taxes VALUES ('13', '0', '1078672881', '0', '0', '0', '0', '208', 'DK', 'DNK', '', 'Denmark VAT', '1', 'VAT', '3', '0.25', '1');
-INSERT INTO static_taxes VALUES ('14', '0', '1078673059', '0', '0', '0', '0', '276', 'DE', 'DEU', '', 'Germany VAT', '1', 'VAT', '3', '0.16', '1');
+INSERT INTO static_taxes VALUES ('14', '0', '1078673059', '0', '0', '0', '0', '276', 'DE', 'DEU', '', 'Germany VAT', '1', 'VAT', '3', '0.19', '1');
 INSERT INTO static_taxes VALUES ('15', '0', '1078673324', '0', '0', '0', '0', '233', 'EE', 'EST', '', 'Estonia VAT', '1', 'VAT', '3', '0.18', '1');
 INSERT INTO static_taxes VALUES ('16', '0', '1078673460', '0', '0', '0', '0', '300', 'GR', 'GRC', '', 'Greece VAT', '1', 'VAT', '3', '0.18', '1');
 INSERT INTO static_taxes VALUES ('17', '0', '1078673622', '0', '0', '0', '0', '724', 'ES', 'ESP', '', 'Spain VAT', '1', 'VAT', '3', '0.16', '1');
@@ -1301,9 +1302,9 @@ INSERT INTO static_taxes VALUES ('34', '0', '1078676577', '0', '0', '0', '0', '8
 INSERT INTO static_taxes VALUES ('35', '0', '1078709361', '0', '0', '0', '0', '484', 'MX', 'MEX', '', 'Mexico VAT', '1', 'IVA', '3', '0.15', '1');
 
 
-
 # TYPO3 Extension Manager dump 1.1
 #
+# Host: localhost    Database: TYPO3
 #--------------------------------------------------------
 
 
index 7dab7cf..d26cfff 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2004-2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the Typo3 project. The Typo3 project is
  *
  *
  *   67: class tx_staticinfotables_pi1 extends tslib_pibase
- *   95:     function init()
- *  134:     function getStaticInfoName($type='COUNTRIES', $code, $country='', $countrySubdivision='', $self=0)
- *  198:     function buildStaticInfoSelector($type='COUNTRIES', $name='', $class='', $selectedArray=array(), $country='', $submit=0, $id='', $title='', $addWhere='', $lang='', $local=FALSE, $mergeArray=array(), $size=1)
- *  282:     function initCountries($param='UN', $lang='', $local=FALSE, $addWhere='')
- *  339:     function initCountrySubdivisions($param, $addWhere='')
- *  385:     function initCurrencies($addWhere='')
- *  425:     function initLanguages($addWhere='')
- *  465:     function optionsConstructor($nameArray, $selectedArray=array())
- *  486:     function loadCurrencyInfo($currencyCode)
- *  531:     function formatAmount($amount, $displayCurrencyCode='')
- *  559:     function formatAddress($delim, $streetAddress, $city, $zip, $subdivisionCode='', $countryCode='')
- *  608:     function applyConsumerTaxes($amount, $taxClass=0, $shopCountryCode, $shopCountrySubdivisionCode, $buyerCountryCode, $buyerCountrySubdivisionCode, $EUThreshold=0)
- *  732:     function getCurrentLanguage()
+ *   96:     function init($conf=array())
+ *  149:     function getStaticInfoName($type='COUNTRIES', $code, $country='', $countrySubdivision='', $self=0)
+ *  213:     function buildStaticInfoSelector($type='COUNTRIES', $name='', $class='', $selectedArray=array(), $country='', $submit=0, $id='', $title='', $addWhere='', $lang='', $local=FALSE, $mergeArray=array(), $size=1)
+ *  297:     function initCountries($param='UN', $lang='', $local=FALSE, $addWhere='')
+ *  354:     function initCountrySubdivisions($param, $addWhere='')
+ *  400:     function initCurrencies($addWhere='')
+ *  440:     function initLanguages($addWhere='')
+ *  480:     function optionsConstructor($nameArray, $selectedArray=array())
+ *  501:     function loadCurrencyInfo($currencyCode)
+ *  546:     function formatAmount($amount, $displayCurrencyCode='')
+ *  574:     function formatAddress($delim, $streetAddress, $city, $zip, $subdivisionCode='', $countryCode='')
+ *  623:     function applyConsumerTaxes($amount, $taxClass=0, $shopCountryCode, $shopCountrySubdivisionCode, $buyerCountryCode, $buyerCountrySubdivisionCode, $EUThreshold=0)
+ *  747:     function getCurrentLanguage()
  *
  * TOTAL FUNCTIONS: 13
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
 
-global $TYPO3_CONF_VARS;
 
 
 require_once(PATH_tslib.'class.tslib_pibase.php');
@@ -85,37 +84,52 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                'LANGUAGES'     => 'static_languages',
                'TAXES'         => 'static_taxes',
                'SUBTAXES'      => 'static_taxes'
-               );
+       );
 
        /**
         * Initializing the class: sets the language based on the TS configuration language property
         *
+        * @param       array           $conf ... overwriting setup of extension
         * @return      boolean         Always returns true
         */
-       function init() {
+       function init($conf=array())    {
                global $TSFE;
 
                $this->conf = $TSFE->tmpl->setup['plugin.'][$this->prefixId.'.'];
 
                        //Get the default currency and make sure it does exist in table static_currencies
-               $this->currency = (trim($this->conf['currencyCode'])) ? trim($this->conf['currencyCode']) : 'EUR';
+               $this->currency = $conf['currencyCode'];
+               if (!$this->currency)   {
+                       $this->currency = (trim($this->conf['currencyCode'])) ? trim($this->conf['currencyCode']) : 'EUR';
+               }
                        //If not set, we use the Euro
                if (!$this->getStaticInfoName('CURRENCIES', $this->currency)) {
                        $this->currency = 'EUR';
                }
                $this->currencyInfo = $this->loadCurrencyInfo($this->currency);
 
-               $this->defaultCountry = trim($this->conf['countryCode']);
+               $this->defaultCountry = $conf['countryCode'];
+               if (!$this->defaultCountry)     {
+                       $this->defaultCountry = trim($this->conf['countryCode']);
+               }
                if (!$this->getStaticInfoName('COUNTRIES', $this->defaultCountry)) {
-                       $this->defaultCountry = '';
+                       $this->defaultCountry = 'DEU';
+               }
+
+               $this->defaultCountryZone = $conf['countryZoneCode'];
+               if (!$this->defaultCountryZone) {
+                       $this->defaultCountryZone = trim($this->conf['countryZoneCode']);
                }
-               $this->defaultCountryZone = trim($this->conf['countryZoneCode']);
                if (!$this->getStaticInfoName('SUBDIVISIONS', $this->defaultCountryZone, $this->defaultCountry)) {
-                       $this->defaultCountryZone = '';
+                       $this->defaultCountryZone = 'NRW';
+               }
+
+               $this->defaultLanguage = $conf['languageCode'];
+               if (!$this->defaultLanguage)    {
+                       $this->defaultLanguage = trim($this->conf['languageCode']);
                }
-               $this->defaultLanguage = trim($this->conf['languageCode']);
                if (!$this->getStaticInfoName('LANGUAGES', $this->defaultLanguage)) {
-                       $this->defaultLanguage = '';
+                       $this->defaultLanguage = 'EN';
                }
                return true;
        }
@@ -132,7 +146,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
         * @return      string          The name of the object in the current language
         */
        function getStaticInfoName($type='COUNTRIES', $code, $country='', $countrySubdivision='', $self=0) {
-               global $TYPO3_DB, $TSFE, $TYPO3_CONF_VARS;
+               global $TYPO3_DB, $TSFE;
 
                if (in_array($type, $this->types) && trim($code)) {
                        $codeArray = t3lib_div::trimExplode(',',($code));
@@ -168,7 +182,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                                                $name = tx_staticinfotables_div::getTitleFromIsoCode($table, $isoCodeArray, $lang, $self);
                                                break;
                                }
-                               $nameArray[] = $TSFE->csConv($name, $TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['charset']);
+                               $nameArray[] = $TSFE->csConv($name, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['charset']);
                        }
                        $rc = implode(',',$nameArray);
                } else {
@@ -204,8 +218,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                } else {
                        $multiple="";
                }
-
-               if (!is_array($selectedArray)) {
+               if (isset($selectedArray) && !is_array($selectedArray)) {
                        $selectedArray = t3lib_div::trimExplode (',',$selectedArray);
                }
 
@@ -253,7 +266,8 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                        reset($nameArray);
                        $defaultSelectedArray = array(key($nameArray));
                }
-               $selectedArray = ((!empty($selectedArray) || count($mergeArray)) ? $selectedArray : $defaultSelectedArray);
+               $bEmptySelected = (empty($selectedArray) || ((count($selectedArray) == 1) && empty($selectedArray[0])));
+               $selectedArray = ((!$bEmptySelected || count($mergeArray)) ? $selectedArray : $defaultSelectedArray);
 
                if (count($mergeArray)) {
                        $nameArray = array_merge($nameArray, $mergeArray);
@@ -280,7 +294,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
         * @return      array           An array of names of countries
         */
        function initCountries($param='UN', $lang='', $local=FALSE, $addWhere='') {
-               global $TYPO3_DB, $TSFE, $TYPO3_CONF_VARS;
+               global $TYPO3_DB, $TSFE;
 
                $table = $this->tables['COUNTRIES'];
                if (!$lang)     {
@@ -316,7 +330,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                while ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
                        foreach ($titleFields as $titleField) {
                                if ($row[$titleField]) {
-                                       $nameArray[$row['cn_iso_3']] = $TSFE->csConv($row[$titleField], $TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['charset']);
+                                       $nameArray[$row['cn_iso_3']] = $TSFE->csConv($row[$titleField], $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['charset']);
                                        break;
                                }
                        }
@@ -337,7 +351,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
         * @return      array           An array of names of country subdivisions
         */
        function initCountrySubdivisions($param, $addWhere='')  {
-               global $TYPO3_DB, $TSFE, $TYPO3_CONF_VARS;
+               global $TYPO3_DB, $TSFE;
 
                $table = $this->tables['SUBDIVISIONS'];
                if (strlen($param) == 3)        {
@@ -364,7 +378,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                while ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
                        foreach ($titleFields as $titleField) {
                                if ($row[$titleField]) {
-                                       $nameArray[$row['zn_code']] = $TSFE->csConv($row[$titleField], $TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['charset']);
+                                       $nameArray[$row['zn_code']] = $TSFE->csConv($row[$titleField], $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['charset']);
                                        break;
                                }
                        }
@@ -383,7 +397,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
         * @return      array           An array of names of currencies
         */
        function initCurrencies($addWhere='') {
-               global $TYPO3_DB, $TSFE, $TYPO3_CONF_VARS;
+               global $TYPO3_DB, $TSFE;
 
                $where = '1=1'.($addWhere ? ' AND '.$addWhere : '');
                $table = $this->tables['CURRENCIES'];
@@ -403,7 +417,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                while ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
                        foreach ($titleFields as $titleField) {
                                if ($row[$titleField]) {
-                                       $nameArray[$row['cu_iso_3']] = $TSFE->csConv($row[$titleField], $TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['charset']);
+                                       $nameArray[$row['cu_iso_3']] = $TSFE->csConv($row[$titleField], $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['charset']);
                                        break;
                                }
                        }
@@ -423,7 +437,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
         * @return      array           An array of names of languages
         */
        function initLanguages($addWhere='') {
-               global $TYPO3_DB, $TSFE, $TYPO3_CONF_VARS;
+               global $TYPO3_DB, $TSFE;
 
                $where = '1=1'.($addWhere ? ' AND '.$addWhere : '');
                $table = $this->tables['LANGUAGES'];
@@ -445,7 +459,7 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                        $code = $row['lg_iso_2'].($row['lg_country_iso_2']?'_'.$row['lg_country_iso_2']:'');
                        foreach ($titleFields as $titleField) {
                                if ($row[$titleField]) {
-                                       $nameArray[$code] = $TSFE->csConv($row[$titleField], $TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['charset']);
+                                       $nameArray[$code] = $TSFE->csConv($row[$titleField], $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['charset']);
                                        break;
                                }
                        }
@@ -735,11 +749,10 @@ class tx_staticinfotables_pi1 extends tslib_pibase {
                $rc = tx_staticinfotables_div::getCurrentLanguage();
                return $rc;
        }
-
 }
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/pi1/class.tx_staticinfotables_pi1.php'])   {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/static_info_tables/pi1/class.tx_staticinfotables_pi1.php']);
+if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/pi1/class.tx_staticinfotables_pi1.php'])        {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/static_info_tables/pi1/class.tx_staticinfotables_pi1.php']);
 }
 
 ?>
\ No newline at end of file