* 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???
'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) {
* 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 *
*****************************************/
* 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
$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.';
* 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 & Repeat';
- $strConfEmptyTable = 'Are you sure you want to empty the table "%s"?';
+ $strSaveAndRepeat = 'Save & Repeat';
+ $strConfEmptyTable = 'Are you sure you want to empty the table "%s"?';
$strTableEmptied = 'Table emptied.';
$strTableEmptiedBad = 'Table empty failed.';
- $strConfDropTable = 'Are you sure you want to drop the table "%s"?';
+ $strConfDropTable = 'Are you sure you want to drop the table "%s"?';
$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 "%s"?';
+ $strConfDropGroup = 'Are you sure you want to drop the group "%s"?';
$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 "%s"?';
+ $strConfDropIndex = 'Are you sure you want to drop the index "%s"?';
$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 "%s" on "%s"?';
+ $strConfDropRule = 'Are you sure you want to drop the rule "%s" on "%s"?';
$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 "%s" on "%s"?';
+ $strConfDropConstraint = 'Are you sure you want to drop the constraint "%s" on "%s"?';
$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 "%s"?';
+ $strConfDropType = 'Are you sure you want to drop the type "%s"?';
$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 "%s"?';
+ $strConfDropSchema = 'Are you sure you want to drop the schema "%s"?';
$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 "%s", %s';
+ $strTopBar = '%s running on %s:%s -- You are logged in as user "%s", %s';
$strTimeFmt = 'jS M, Y g:iA';
?>
/**
* 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' => '繁體中文(萬國碼)',
+ 'dutch' => 'Nederlands',
'english' => 'English',
- 'german' => 'German',
- 'italian' => 'Italian',
+ 'german' => 'Deutsch',
+ 'italian' => 'Italiano',
'polish' => 'Polish',
- 'spanish' => 'Spanish'
+ 'spanish' => 'Españ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) {
}
// 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;
+ }
}
?>
/**
* 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>
/**
* 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";
/**
* 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>