I have mastered encodings! Now you can login with Polish as your language choice...
authorchriskl <chriskl>
Sat, 18 Jan 2003 09:07:50 +0000 (09:07 +0000)
committerchriskl <chriskl>
Sat, 18 Jan 2003 09:07:50 +0000 (09:07 +0000)
classes/database/Postgres.php
conf/config.inc.php-dist
lang/english.php
lang/recoded/english.php
libraries/lib.inc.php
login.php
tables.php
topbar.php

index c24150d5b3cb6f296dfb48a0415581f9e8b197d7..a86809ae2201e7eda48c9975d4ee5e1c000f59f1 100755 (executable)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres.php,v 1.43 2003/01/18 07:49:34 chriskl Exp $
+ * $Id: Postgres.php,v 1.44 2003/01/18 09:07:50 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -58,7 +58,8 @@ class Postgres extends BaseDB {
                'LATIN7' => 'ISO-8859-13',
                'LATIN8' => 'ISO-8859-14',
                'LATIN9' => 'ISO-8859-15',
-               'LATIN10' => 'ISO-8859-16'
+               'LATIN10' => 'ISO-8859-16',
+               'UNICODE' => 'UTF-8'
        );
 
        function Postgres($host, $port, $database, $user, $password) {
index a66b4d6312c6df1d3ea6d507dfdefeb1ffe66586..0d4af1e6eefe774fdb0e59b4ac96d3e889db362e 100644 (file)
@@ -4,7 +4,7 @@
         * Central WebDB configuration.  As a user you may modify the
         * settings here for your particular configuration.
         *
-        * $Id: config.inc.php-dist,v 1.8 2003/01/18 06:38:37 chriskl Exp $
+        * $Id: config.inc.php-dist,v 1.9 2003/01/18 09:07:51 chriskl Exp $
         */
 
        // Set error reporting level
        // Max rows to show
        $guiMaxRows = 30;
 
-       // Servers and types
+       // An example server.  Create as many of these as you wish,
+       // indexed from zero upwards.
        $confServers = array();
-       $confServers[0]['desc'] = 'Home-PG';
+       $confServers[0]['desc'] = 'PostgreSQL';
        $confServers[0]['host'] = 'localhost';
-       $confServers[0]['port'] = '5432';
-       $confServers[0]['type'] = 'Postgres71';
+       $confServers[0]['port'] = 5432;
+       $confServers[0]['type'] = 'Postgres73';
        $confServers[0]['default'] = 'template1';
        
        // Servers and types
-       $confServers[1]['desc'] = 'Dev-PG';
+       $confServers[1]['desc'] = 'Development';
        $confServers[1]['host'] = 'database-dev';
-       $confServers[1]['port'] = '5432';
-       $confServers[1]['type'] = 'Postgres71';
+       $confServers[1]['port'] = 5432;
+       $confServers[1]['type'] = 'Postgres73';
        $confServers[1]['default'] = 'template1';
        
-       // MySQL example
-       $confServers[2]['desc'] = 'Home-MySQL';
-       $confServers[2]['host'] = 'localhost';
-       $confServers[2]['port'] = 'xxx'; // Port isn't being used anywhere yet
-       $confServers[2]['type'] = 'MySQL';
-       $confServers[2]['default'] = '';
-       
        /*****************************************
         * Don't modify anything below this line *
         *****************************************/
index 175d3d415929860fca521e1bc25240c091aaf15b..b820d292ccf4320a122a67693385e73d413eb390 100755 (executable)
@@ -4,7 +4,7 @@
         * Language template file for WebDB.  Use this to base language
         * files.
         *
-        * $Id: english.php,v 1.43 2003/01/18 06:38:37 chriskl Exp $
+        * $Id: english.php,v 1.44 2003/01/18 09:07:51 chriskl Exp $
         */
 
        // Language and character set
@@ -64,6 +64,8 @@
        $strNoFrames = 'You need a frames-enabled browser to use this application.';
        $strBadConfig = 'Your config.inc.php is out of date.  You will need to regenerate it from the new config.inc.php-dist.';
        $strNotLoaded = 'You have not compiled proper database support into your PHP installation.';
+       $strBadSchema = 'Invalid schema specified.';
+       $strBadEncoding = 'Failed to set client encoding in database.';
        $strSQLError = 'SQL error:';
        $strInStatement = 'In statement:';
        $strInvalidParam = 'Invalid script parameters.';
index a2b79c8baac181d852fd7f50d16783cb5c5f39ee..e7a023e1cbb1e01efd8733bf80cd33ff606c211a 100644 (file)
@@ -4,7 +4,7 @@
         * Language template file for WebDB.  Use this to base language
         * files.
         *
-        * $Id: english.php,v 1.1 2003/01/18 08:23:24 chriskl Exp $
+        * $Id: english.php,v 1.2 2003/01/18 09:07:51 chriskl Exp $
         */
 
        // Language and character set
        $strConfDeleteRow = 'Are you sure you want to delete this row?';
        $strRowDeleted = 'Row deleted.';
        $strRowDeletedBad = 'Row deletion failed.';
-       $strSaveAndRepeat = 'Save &amp;amp; Repeat';
-       $strConfEmptyTable = 'Are you sure you want to empty the table &amp;quot;%s&amp;quot;?';
+       $strSaveAndRepeat = 'Save &amp; Repeat';
+       $strConfEmptyTable = 'Are you sure you want to empty the table &quot;%s&quot;?';
        $strTableEmptied = 'Table emptied.';
        $strTableEmptiedBad = 'Table empty failed.';
-       $strConfDropTable = 'Are you sure you want to drop the table &amp;quot;%s&amp;quot;?';
+       $strConfDropTable = 'Are you sure you want to drop the table &quot;%s&quot;?';
        $strTableDropped = 'Table dropped.';
        $strTableDroppedBad = 'Table drop failed.';
 
        $strGroupNeedsName = 'You must give a name for your group.';
        $strGroupCreated = 'Group created.';
        $strGroupCreatedBad = 'Group creation failed.'; 
-       $strConfDropGroup = 'Are you sure you want to drop the group &amp;quot;%s&amp;quot;?';
+       $strConfDropGroup = 'Are you sure you want to drop the group &quot;%s&quot;?';
        $strGroupDropped = 'Group dropped.';
        $strGroupDroppedBad = 'Group drop failed.';
        $strMembers = 'Members';
        $strIndexNeedsCols = 'You must give a valid number of columns.';
        $strIndexCreated = 'Index created';
        $strIndexCreatedBad = 'Index creation failed.';
-       $strConfDropIndex = 'Are you sure you want to drop the index &amp;quot;%s&amp;quot;?';
+       $strConfDropIndex = 'Are you sure you want to drop the index &quot;%s&quot;?';
        $strIndexDropped = 'Index dropped.';
        $strIndexDroppedBad = 'Index drop failed.';
 
        $strRule = 'Rule';
        $strNoRules = 'No rules found.';
        $strCreateRule = 'Create Rule';
-       $strConfDropRule = 'Are you sure you want to drop the rule &amp;quot;%s&amp;quot; on &amp;quot;%s&amp;quot;?';
+       $strConfDropRule = 'Are you sure you want to drop the rule &quot;%s&quot; on &quot;%s&quot;?';
        $strRuleDropped = 'Rule dropped.';
        $strRuleDroppedBad = 'Rule drop failed.';
 
        $strConstraints = 'Constraints';
        $strNoConstraints = 'No constraints found.';
        $strCreateConstraint = 'Create Constraint';
-       $strConfDropConstraint = 'Are you sure you want to drop the constraint &amp;quot;%s&amp;quot; on &amp;quot;%s&amp;quot;?';
+       $strConfDropConstraint = 'Are you sure you want to drop the constraint &quot;%s&quot; on &quot;%s&quot;?';
        $strConstraintDropped = 'Constraint dropped.';
        $strConstraintDroppedBad = 'Constraint drop failed.';
 
        $strTypes = 'Types';
        $strNoTypes = 'No types found.';
        $strCreateType = 'Create Type';
-       $strConfDropType = 'Are you sure you want to drop the type &amp;quot;%s&amp;quot;?';
+       $strConfDropType = 'Are you sure you want to drop the type &quot;%s&quot;?';
        $strTypeDropped = 'Type dropped.';
        $strTypeDroppedBad = 'Type drop failed.';
        $strTypeCreated = 'Type created';
        $strSchemas = 'Schemas';
        $strCreateSchema = 'Create Schema';
        $strNoSchemas = 'No schemas found.';
-       $strConfDropSchema = 'Are you sure you want to drop the schema &amp;quot;%s&amp;quot;?';
+       $strConfDropSchema = 'Are you sure you want to drop the schema &quot;%s&quot;?';
        $strSchemaDropped = 'Schema dropped.';
        $strSchemaDroppedBad = 'Schema drop failed.';
        $strSchemaCreated = 'Schema created';
        $strSchemaNeedsName = 'You must give a name for your schema.';
        
        // Miscellaneous
-       $strTopBar = '%s running on %s:%s -- You are logged in as user &amp;quot;%s&amp;quot;, %s';
+       $strTopBar = '%s running on %s:%s -- You are logged in as user &quot;%s&quot;, %s';
        $strTimeFmt = 'jS M, Y g:iA';
 
 ?>
index 2c352379b9b3a0271a0672d22bf13dbfa6950cc6..ee7b19d1ce922096e6625f91cf14225ca9fe6441 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Function library read in upon startup
         *
-        * $Id: lib.inc.php,v 1.13 2003/01/18 06:38:37 chriskl Exp $
+        * $Id: lib.inc.php,v 1.14 2003/01/18 09:07:51 chriskl Exp $
         */
 
        // Application name 
 
        // List of available language files
        $appLangFiles = array(
-               'chinese-tr-big5' => 'Chinese Trad. (Big5)',
-               'chinese-tr-utf8' => 'Chinese Trad. (UTF-8)',
-               'dutch' => 'Dutch',
+               'chinese-tr' => '&#32321;&#39636;&#20013;&#25991;&#65288;&#33836;&#22283;&#30908;&#65289;',
+               'dutch' => 'Nederlands',
                'english' => 'English',
-               'german' => 'German',
-               'italian' => 'Italian',
+               'german' => 'Deutsch',
+               'italian' => 'Italiano',
                'polish' => 'Polish',
-               'spanish' => 'Spanish'
+               'spanish' => 'Espa&ntilde;ol'
        );
 
        // Language settings.  Always include english.php, since it's the master
        // language file, and then overwrite it with the user-specified language.
        // Default language to English if it's not set.
        if (!isset($appDefaultLanguage)) $appDefaultLanguage = 'english';
-       include_once('lang/english.php');
+       include_once('lang/recoded/english.php');
 
        // Check for config file version mismatch
        if (!isset($appConfVersion) || $appBaseConfVersion > $appConfVersion) {
@@ -88,7 +87,7 @@
        }
        
        // Import language file
-       include("lang/" . strtolower($_SESSION['webdbLanguage']) . ".php");
+       include("lang/recoded/" . strtolower($_SESSION['webdbLanguage']) . ".php");
        
        // Create data accessor object, if valid
        if (isset($_SESSION['webdbServerID']) && isset($confServers[$_SESSION['webdbServerID']])) {
                if (isset($_REQUEST['schema']) && $localData->hasSchemas()) {
                        $status = $localData->setSchema($_REQUEST['schema']);
                        if ($status != 0) {
-                               echo "<p class=\"message\">Invalid schema specified.</p>\n";
+                               echo $strBadSchema;
+                               exit;
                        }
                }
+               
+               // Get database encoding
+               $dbEncoding = $localData->getDatabaseEncoding();
+               
+               // Set client encoding to database encoding
+               if ($dbEncoding != '') {
+                       $status = $localData->setClientEncoding($dbEncoding);
+                       if ($status != 0) {
+                               echo $strBadEncoding;
+                               exit;
+                       }
+               
+                       // Override $appCharset
+                       if (isset($localData->codemap[$dbEncoding]))
+                               $appCharset = $localData->codemap[$dbEncoding];
+                       else
+                               $appCharset = $dbEncoding;
+               }
        }
 
 ?>
index f2790cf657aa597fd176d8c954aae77bd27868b9..24cd1aaf6d69af1f17bd9f62a003f8d20d6e7227 100755 (executable)
--- a/login.php
+++ b/login.php
@@ -3,7 +3,7 @@
        /**
         * Login screen
         *
-        * $Id: login.php,v 1.1 2003/01/18 06:38:36 chriskl Exp $
+        * $Id: login.php,v 1.2 2003/01/18 09:07:50 chriskl Exp $
         */
 
        // Include application functions
                                                <td><?php echo $strLanguage ?>:</td>
                                                <td><select name="formLanguage">
                                                <?php
+                                                       // Language name already encoded
                                                        foreach ($appLangFiles as $k => $v) {
                                                                echo "<option value=\"{$k}\"",
                                                                        ($k == $_POST['formLanguage']) ? ' selected' : '',
-                                                                       ">", htmlspecialchars($v), "</option>\n";
+                                                                       ">{$v}</option>\n";
                                                        }
                                                ?>
                                                </select></td>
index a49f67292740166ba189edc95042f6b2fe6557df..e5ca5e96e6868218c86201b4253bc9edb52ed9d7 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tables.php,v 1.1 2003/01/18 06:38:36 chriskl Exp $
+        * $Id: tables.php,v 1.2 2003/01/18 09:07:50 chriskl Exp $
         */
 
        // Include application functions
                                $id = (($i % 2) == 0 ? '1' : '2');
                                echo "<tr><td class=data{$id}>", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "</td>\n";
                                echo "<td class=data{$id}>", htmlspecialchars($tables->f[$data->tbFields['tbowner']]), "</td>\n";
-                               echo "<td class=opbutton{$id}><a href=\"{$PHP_SELF}?action=browse&page=1&{$misc->href}&table=", 
+                               echo "<td class=opbutton{$id}><a href=\"{$PHP_SELF}?action=browse&page=1&{$misc->href}&table=",
                                        htmlspecialchars($tables->f[$data->tbFields['tbname']]), "\">{$strBrowse}</a></td>\n";
                                echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confselectrows&{$misc->href}&table=",
                                        urlencode($tables->f[$data->tbFields['tbname']]), "\">{$strSelect}</a></td>\n";
-                               echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confinsertrow&{$misc->href}&table=", 
+                               echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confinsertrow&{$misc->href}&table=",
                                        urlencode($tables->f[$data->tbFields['tbname']]), "\">{$strInsert}</a></td>\n";
-                               echo "<td class=opbutton{$id}><a href=\"tblproperties.php?{$misc->href}&table=", 
+                               echo "<td class=opbutton{$id}><a href=\"tblproperties.php?{$misc->href}&table=",
                                        htmlspecialchars($tables->f[$data->tbFields['tbname']]), "\">{$strProperties}</a></td>\n";
-                               echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_empty&{$misc->href}&table=", 
+                               echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_empty&{$misc->href}&table=",
                                        urlencode($tables->f[$data->tbFields['tbname']]), "\">{$strEmpty}</a></td>\n";
                                echo "<td class=opbutton{$id}><a href=\"$PHP_SELF?action=confirm_drop&{$misc->href}&table=",
                                        urlencode($tables->f[$data->tbFields['tbname']]), "\">{$strDrop}</a></td>\n";
index 3db114d02d54157d7c12562a6bf299fa7da8591f..66f3950c59d54f6419256d9035fcbb3e9c03eb1e 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Top menu for WebDB
         *
-        * $Id: topbar.php,v 1.1 2003/01/18 06:38:36 chriskl Exp $
+        * $Id: topbar.php,v 1.2 2003/01/18 09:07:50 chriskl Exp $
         */
 
        // Include application functions
        <tr>
                <td width="211" rowspan="2"><img src="images/themes/<?php echo $guiTheme ?>/title.gif" width="211" height="50" alt="<?php echo htmlspecialchars($appName) ?>" /></td>
                <td width="69%">
-               <?php echo htmlspecialchars(sprintf($strTopBar, $confServers[$_SESSION['webdbServerID']]['type'],
-                       $confServers[$_SESSION['webdbServerID']]['host'], $confServers[$_SESSION['webdbServerID']]['port'],
-                       $_SESSION['webdbUsername'], date($strTimeFmt))) ?></td>
+               <?php echo sprintf($strTopBar, htmlspecialchars($confServers[$_SESSION['webdbServerID']]['type']),
+                       htmlspecialchars($confServers[$_SESSION['webdbServerID']]['host']),
+                       htmlspecialchars($confServers[$_SESSION['webdbServerID']]['port']),
+                       htmlspecialchars($_SESSION['webdbUsername']), 
+                       htmlspecialchars(date($strTimeFmt))) ?></td>
        </tr>
        <tr>
                <td>