Changeset 1085 in ExiteCMS


Ignore:
Timestamp:
11/08/07 00:06:27 (4 years ago)
Author:
hverton
Message:

added the site location country selection (also the explicit country for user_id 1)
added some missing country codes to rev01079.php
birthday in the profile is displayed using the date format and months names of the locale set
forced maintenance mode if uninstalled updates are detected
updated the dbsetup_include.php file to reflect the latest database changes
removed the country name from the GeoIP table, now uses the country name from the locales table

Location:
trunk
Files:
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/settings_languages.php

    r1071 r1085  
    6565        $result = dbquery("UPDATE ".$db_prefix."admin SET admin_title='".$locale['236']."' WHERE admin_link='settings_languages.php'"); 
    6666    } 
     67    if (empty($_POST['old_country'])) { 
     68        $result = dbquery("INSERT INTO ".$db_prefix."CMSconfig (cfg_name, cfg_value) VALUES ('country', '".$_POST['country']."')"); 
     69    } else { 
     70        $result = dbquery("UPDATE ".$db_prefix."CMSconfig SET cfg_value = '".$_POST['country']."' WHERE cfg_name = 'country'"); 
     71    } 
    6772    redirect(FUSION_SELF.$aidlink); 
    6873} 
     
    8186} 
    8287 
     88$variables['countries'] = array(); 
     89$result = dbquery("SELECT locales_key, locales_value FROM ".$db_prefix."locales WHERE locales_locale = '".$settings['locale']."' AND locales_name = 'countrycode' ORDER BY locales_value"); 
     90if (!dbrows($result)) { 
     91    // no translated country names found, load the english set instead 
     92    $result = dbquery("SELECT locales_key, locales_value FROM ".$db_prefix."locales WHERE locales_locale = 'English' AND locales_name = 'countrycode' ORDER BY locales_value"); 
     93} 
     94while ($data = dbarray($result)) { 
     95    $variables['countries'][$data['locales_key']] = $data['locales_value']; 
     96} 
     97 
    8398// define the admin body panel 
    8499$template_panels[] = array('type' => 'body', 'name' => 'admin.settings_languages', 'template' => 'admin.settings_languages.tpl', 'locale' => "admin.settings"); 
  • trunk/administration/tools/update_geoip_database.php

    r1068 r1085  
    8989            display("* Imported ".$row." records into the GeoIP_import table."); 
    9090            fclose($handle); 
     91            // delete the ip_name field, to make the table more compact 
     92            display("* Remove the country name from the GeoIP table."); 
     93            $result = dbquery("ALTER TABLE ".$db_prefix."GeoIP_import DROP ip_name");    
    9194            // delete the GeoIP table, rename the temp table 
    9295            display("* Rename the old GeoIP table to GeoIP_backup, and the new GeoIP_import table to GeoIP."); 
  • trunk/administration/upgrade/rev01079.php

    r1078 r1085  
    268268$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'zm', 'Zambia', '1194378860')"); 
    269269$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'zw', 'Zimbabwe', '1194378860')"); 
     270$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'tz', 'United Republic of Tanzania', '1194378860')"); 
     271$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'eu', 'Europe', '1194378860')"); 
     272$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'ap', 'Asia/Pacific Region', '1194378860')"); 
     273$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'rs', 'Serbia', '1194378860')"); 
     274$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'mo', 'Macau', '1194378860')"); 
     275$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 're', 'Reunion', '1194378860')"); 
     276$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'la', 'Lao People\'s Democratic Republic', '1194378860')"); 
     277$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'me', 'Montenegro', '1194378860')"); 
     278$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'ps', 'Occupied Palestinian Territory', '1194378860')"); 
     279$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'aq', 'Antarctica', '1194378860')"); 
     280$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countrycode', 'st', 'Sao Tome and Principe', '1194378860')"); 
    270281 
    271282// add country codes to the locales table 
     
    525536$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'vietnam', 'vn', '1194378981')"); 
    526537$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'undefined', '--', '1194378981')"); 
     538$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'United Republic of Tanzania', 'tz', '1194378981')"); 
     539$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Europe', 'eu', '1194378981')"); 
     540$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Asia/Pacific Region', 'ap', '1194378981')"); 
     541$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Serbia', 'rs', '1194378981')"); 
     542$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Macau', 'mo', '1194378981')"); 
     543$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Reunion', 're', '1194378981')"); 
     544$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Lao People\'s Democratic Republic', 'la', '1194378981')"); 
     545$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Montenegro', 'me', '1194378981')"); 
     546$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Occupied Palestinian Territory', '1194378981')"); 
     547$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Antarctica', 'aq', '1194378981')"); 
     548$commands[] = array('type' => 'db', 'value' => "INSERT INTO ##PREFIX##locales (locales_locale, locales_name, locales_key, locales_value, locales_datestamp) VALUES ('English', 'countryname', 'Sao Tome and Principe', 'st', '1194378981')"); 
    527549 
    528550// add currencycode codes to the locales table 
  • trunk/files/locales/English.admin.settings.php

    r1080 r1085  
    55$locale['402'] = "Site name:"; 
    66$locale['403'] = "Site root directory:"; 
    7 $locale['404'] = ""; 
     7$locale['404'] = "Site located in:"; 
    88$locale['405'] = "Site e-mail address:"; 
    99$locale['406'] = "Your name or nickname:"; 
  • trunk/includes/core_functions.php

    r1079 r1085  
    178178// check for upgrades in progress. 
    179179if (!eregi("upgrade.php", $_SERVER['PHP_SELF'])) { 
     180 
    180181    include PATH_ADMIN."upgrade.php"; 
    181182    //  If so, force a switch to maintenance mode 
    182183    if (UPGRADES) $settings['maintenance'] = 2; 
    183 } 
    184  
    185 // if not called from the maintenance mode module! (to prevent a loop, endless ;-) 
    186 // check if we need to redirect to maintenance mode (for users) or upgrade (for webmasters) 
    187 if ($settings['maintenance'] && !eregi("maintenance.php", $_SERVER['PHP_SELF'])) { 
    188     if (!iSUPERADMIN) { 
    189         redirect('maintenance.php?reason='.$settings['maintenance']); 
    190     } else { 
    191         redirect(ADMIN.'upgrade.php'.$aidlink); 
     184 
     185    // if not called from the maintenance mode module! (to prevent a loop, endless ;-) 
     186    // check if we need to redirect to maintenance mode (for users) or upgrade (for webmasters) 
     187    if ($settings['maintenance'] && !eregi("maintenance.php", $_SERVER['PHP_SELF'])) { 
     188        if (!iSUPERADMIN) { 
     189            // deny all non-webmasters access to the site 
     190            redirect('maintenance.php?reason='.$settings['maintenance']); 
     191        } else { 
     192            // force webmasters to the upgrade module 
     193            redirect(ADMIN.'upgrade.php'.$aidlink); 
     194        } 
    192195    } 
    193196} 
  • trunk/includes/dbsetup_include.php

    r954 r1085  
    22//---------------------------------------------------------- 
    33// ExiteCMS file : dbsetup_include.php 
    4 // Date generated  : `18/10/2007 21:27` 
     4// Date generated  : `07/11/2007 23:50` 
    55//---------------------------------------------------------- 
    66 
    77define('CMS_VERSION', '7.00'); 
    8 define('CMS_REVISION', '954'); 
     8define('CMS_REVISION', '1082'); 
    99 
    1010if ($step == 1) { 
     
    3737  `ip_start_num` int(10) unsigned NOT NULL default '0', 
    3838  `ip_end_num` int(10) unsigned NOT NULL default '0', 
    39   `ip_code` char(2) NOT NULL default '', 
    40   `ip_name` varchar(50) NOT NULL default '' 
     39  `ip_code` char(2) NOT NULL default '' 
    4140) ENGINE=MYISAM;"); 
    4241if (!$result) { 
     
    6564$result = dbquery("CREATE TABLE IF NOT EXISTS ".$db_prefix."admin ( 
    6665  `admin_id` tinyint(2) unsigned NOT NULL auto_increment, 
    67   `admin_rights` varchar(2) NOT NULL default '', 
     66  `admin_rights` char(2) NOT NULL default '', 
    6867  `admin_image` varchar(50) NOT NULL default '', 
    6968  `admin_title` varchar(50) NOT NULL default '', 
     
    7877 
    7978// 
    80 // Code to create table `adverts` 
    81 // 
    82 $result = dbquery("DROP TABLE IF EXISTS ".$db_prefix."adverts"); 
    83 $result = dbquery("CREATE TABLE IF NOT EXISTS ".$db_prefix."adverts ( 
     79// Code to create table `advertising` 
     80// 
     81$result = dbquery("DROP TABLE IF EXISTS ".$db_prefix."advertising"); 
     82$result = dbquery("CREATE TABLE IF NOT EXISTS ".$db_prefix."advertising ( 
    8483  `adverts_id` smallint(5) NOT NULL auto_increment, 
    8584  `adverts_userid` smallint(5) NOT NULL default '0', 
     
    101100if (!$result) { 
    102101    $fail = "1"; 
    103     $failed[] = "adverts : ".mysql_error(); 
     102    $failed[] = "advertising : ".mysql_error(); 
    104103} 
    105104 
     
    455454  `locale_code` varchar(8) NOT NULL default '', 
    456455  `locale_name` varchar(50) NOT NULL default '', 
     456  `locale_locale` varchar(25) NOT NULL default '', 
     457  `locale_charset` varchar(25) NOT NULL default '', 
    457458  `locale_active` tinyint(1) NOT NULL default '0', 
    458459  PRIMARY KEY  (`locale_id`) 
     
    461462    $fail = "1"; 
    462463    $failed[] = "locale : ".mysql_error(); 
     464} 
     465 
     466// 
     467// Code to create table `locales` 
     468// 
     469$result = dbquery("DROP TABLE IF EXISTS ".$db_prefix."locales"); 
     470$result = dbquery("CREATE TABLE IF NOT EXISTS ".$db_prefix."locales ( 
     471  `locales_id` int(10) unsigned NOT NULL auto_increment, 
     472  `locales_locale` varchar(50) NOT NULL default '', 
     473  `locales_name` varchar(50) NOT NULL default '', 
     474  `locales_key` varchar(25) NOT NULL default '', 
     475  `locales_value` text NOT NULL, 
     476  `locales_datestamp` int(10) unsigned NOT NULL default '0', 
     477  PRIMARY KEY  (`locales_id`) 
     478) ENGINE=MYISAM;"); 
     479if (!$result) { 
     480    $fail = "1"; 
     481    $failed[] = "locales : ".mysql_error(); 
    463482} 
    464483 
     
    849868  `user_webmaster` tinyint(1) unsigned NOT NULL default '0', 
    850869  `user_email` varchar(100) NOT NULL default '', 
     870  `user_bad_email` int(10) unsigned NOT NULL default '0', 
    851871  `user_hide_email` tinyint(1) unsigned NOT NULL default '1', 
    852872  `user_location` varchar(50) NOT NULL default '', 
  • trunk/includes/geoip_include.php

    r863 r1085  
    7171        } 
    7272        $_GeoIP_result['ip_addr'] = $ip_addr; 
    73         return $_GeoIP_result['ip_name']; 
     73        return GeoIP_Code2Name($_GeoIP_result['ip_code']); 
    7474    } 
    7575} 
    7676 
    7777function GeoIP_Code2Name($ip_code) { 
    78     global $db_prefix; 
     78    global $db_prefix, $settings; 
    7979 
    80     $result = dbquery("SELECT * FROM ".$db_prefix."GeoIP WHERE ip_code ='".$ip_code."' LIMIT 1"); 
     80    $result = dbquery("SELECT locales_value FROM ".$db_prefix."locales WHERE locales_locale = '".$settings['locale']."' AND locales_name = 'countrycode' AND locales_key = '".$ip_code."' LIMIT 1"); 
     81    if (!dbrows($result)) { 
     82        // no translated country names found, load the english set instead 
     83        $result = dbquery("SELECT locales_value FROM ".$db_prefix."locales WHERE locales_locale = 'English' AND locales_name = 'countrycode' AND locales_key = '".$ip_code."' LIMIT 1"); 
     84    } 
    8185    if (dbrows($result) == 0) { 
    8286        return ""; 
    8387    } 
    8488    $data = dbarray($result); 
    85     return $data['ip_name']; 
     89    return $data['locales_value']; 
    8690} 
    8791 
     
    113117    $data = dbarray($result); 
    114118    $geoip_flag = strtolower($data['ip_code']); 
    115     $geoip_name = $data['ip_name']; 
     119    $geoip_name = GeoIP_Code2Name($data['ip_code']); 
    116120    if (!is_file(PATH_IMAGES."flags/".$geoip_flag.".gif")) { 
    117121        if ($tag) { 
  • trunk/includes/locale_functions.php

    r1082 r1085  
    6767        $data = dbarray($result); 
    6868        $settings['locale_code'] = $data['locale_code']; 
    69         $settings['charset'] = $data['locale_charset']; 
    70         $settings['locales'] = $data['locale_locale']; 
     69        if (isset($data['locale_charset'])) $settings['charset'] = $data['locale_charset']; 
     70        if (isset($data['locale_locale'])) $settings['locales'] = $data['locale_locale']; 
    7171    } 
    7272} 
  • trunk/includes/templates/admin.settings_languages.tpl

    r864 r1085  
    3232        </tr> 
    3333        <tr> 
     34            <td width='50%' class='tbl'> 
     35                {$locale.404} 
     36            </td> 
     37            <td width='50%' class='tbl'> 
     38                {html_options name="country" options=$countries selected=$settings2.country|default:"--" class="textbox"} 
     39            </td> 
     40        </tr> 
     41        <tr> 
    3442            <td align='center' colspan='2' class='tbl'> 
    3543                <br /> 
    3644                <input type='hidden' name='old_localeset' value='{$settings2.locale}' /> 
     45                <input type='hidden' name='old_country' value='{$settings2.country|default:""}' /> 
    3746                <input type='submit' name='savesettings' value='{$locale.750}' class='button' /> 
    3847            </td> 
  • trunk/profile.php

    r1082 r1085  
    7070    if ($data['user_birthdate'] != "0000-00-00") { 
    7171        $birthdate = explode("-", $data['user_birthdate']); 
    72         $data['user_birthdate'] = strftime(nl_langinfo(D_FMT), mktime(1,0,0,$birthdate[1],$birthdate[2],$birthdate[0])) 
    73         } 
     72        $data['user_birthdate'] = strftime(str_replace("%m", "%B", preg_replace("/[^a-z%]/i", " ", nl_langinfo(D_FMT))), mktime(1,0,0,$birthdate[1],$birthdate[2],$birthdate[0])); 
    7473    } else { 
    7574        $data['user_birthdate'] = $locale['u048']; 
Note: See TracChangeset for help on using the changeset viewer.