* Support zero column tables
* Add first & last links to nav. Double number of pages shown.
* German update from Markus Bertheau
+* Display new PostgreSQL 7.4 grant options and grantor in privileges
Version 3.0
-----------
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.48 2003/06/21 09:54:37 chriskl Exp $
+ * $Id: Postgres73.php,v 1.49 2003/07/28 07:14:08 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
list ($entity, $chars) = explode('=', $v);
// New row to be added to $temp
- // (type, grantee, privilegs, grantor, grant option
- $row = array($atype, $entity, array(), '', false);
+ // (type, grantee, privileges, grantor, grant option?
+ $row = array($atype, $entity, array(), '', array());
// Loop over chars and add privs to $row
for ($i = 0; $i < strlen($chars); $i++) {
// the privilege
$char = substr($chars, $i, 1);
if ($char == '*')
- $row[4] = true;
+ $row[4][] = $this->privmap[substr($chars, $i - 1, 1)];
elseif ($char == '/') {
- $row[5] = substr($chars, $i + 1);
+ $row[3] = substr($chars, $i + 1);
break;
}
- if (!isset($this->privmap[$char]))
- return -3;
- else
- $row[2][] = $this->privmap[$char];
+ else {
+ if (!isset($this->privmap[$char]))
+ return -3;
+ else
+ $row[2][] = $this->privmap[$char];
+ }
}
// Append row to temp
return $temp;
}
+ // Find object functions
+
+ /**
+ * Searches all system catalogs to find objects that match a certain name.
+ * @param $term The search term
+ * @return A recordset
+ */
+ function findObject($term) {
+ // Escape search term for LIKE match
+ $term = str_replace('_', '\\_', $term);
+ $term = str_replace('%', '\\%', $term);
+ $this->clean($term);
+
+ $sql = "
+ SELECT 'SCHEMA' AS type, NULL AS schemaname, nspname AS name FROM pg_catalog.pg_namespace WHERE nspname ILIKE '%{$term}%'
+ UNION ALL
+ SELECT CASE WHEN relkind='r' THEN 'TABLE' WHEN relkind='v' THEN 'VIEW' WHEN relkind='S' THEN 'SEQUENCE' END,
+ pn.nspname, pc.relname FROM pg_catalog.pg_class pc, pg_catalog.pg_namespace pn
+ WHERE pc.relnamespace=pn.oid AND relkind IN ('r', 'v', 'S') AND relname ILIKE '%{$term}%'
+ ORDER BY type, name";
+
+ return $this->selectSet($sql);
+ }
+
// Capabilities
function hasSchemas() { return true; }
function hasConversions() { return true; }
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.83 2003/07/25 08:39:25 chriskl Exp $
+ * $Id: english.php,v 1.84 2003/07/28 07:14:08 chriskl Exp $
*/
// Language and character set
$lang['strexpand'] = 'Expand';
$lang['strcollapse'] = 'Collapse';
$lang['strexplain'] = 'Explain';
+ $lang['strfind'] = 'Find';
// Error handling
$lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';
$lang['strgroupdroppedbad'] = 'Group drop failed.';
$lang['strmembers'] = 'Members';
- // Privilges
+ // Privileges
$lang['strprivilege'] = 'Privilege';
$lang['strprivileges'] = 'Privileges';
$lang['strnoprivileges'] = 'This object has default owner privileges.';
$lang['strgrantfailed'] = 'Failed to change privileges.';
$lang['strgrantbad'] = 'You must specify at least one user or group and at least one privilege.';
$lang['stralterprivs'] = 'Alter Privileges';
+ $lang['strgrantor'] = 'Grantor';
+ $lang['strasterisk'] = '*';
// Databases
$lang['strdatabase'] = 'Database';
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.35 2003/07/25 08:39:25 chriskl Exp $
+ * $Id: english.php,v 1.36 2003/07/28 07:14:08 chriskl Exp $
*/
// Language and character set
$lang['strexpand'] = 'Expand';
$lang['strcollapse'] = 'Collapse';
$lang['strexplain'] = 'Explain';
+ $lang['strfind'] = 'Find';
// Error handling
$lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';
$lang['strgroupdroppedbad'] = 'Group drop failed.';
$lang['strmembers'] = 'Members';
- // Privilges
+ // Privileges
$lang['strprivilege'] = 'Privilege';
$lang['strprivileges'] = 'Privileges';
$lang['strnoprivileges'] = 'This object has default owner privileges.';
$lang['strgrantfailed'] = 'Failed to change privileges.';
$lang['strgrantbad'] = 'You must specify at least one user or group and at least one privilege.';
$lang['stralterprivs'] = 'Alter Privileges';
+ $lang['strgrantor'] = 'Grantor';
+ $lang['strasterisk'] = '*';
// Databases
$lang['strdatabase'] = 'Database';
/**
* Manage privileges in a database
*
- * $Id: privileges.php,v 1.15 2003/06/01 11:53:45 chriskl Exp $
+ * $Id: privileges.php,v 1.16 2003/07/28 07:14:08 chriskl Exp $
*/
// Include application functions
echo "<th class=\"data\">{$v2}</th>\n";
}
if ($data->hasGrantOption()) {
- echo "<th class=\"data\">Grant Option?</th><th class=\"data\">Grantor</th>";
+ echo "<th class=\"data\">{$lang['strgrantor']}</th>";
}
echo "</tr>\n";
foreach ($data->privlist[$_REQUEST['type']] as $v2) {
// Skip over ALL PRIVILEGES
if ($v2 == 'ALL PRIVILEGES') continue;
+ echo "<td class=\"data{$id}\">";
if (in_array($v2, $v[2]))
- echo "<td class=\"data{$id}\">{$lang['stryes']}</td>\n";
+ echo $lang['stryes'];
else
- echo "<td class=\"data{$id}\">{$lang['strno']}</td>\n";
+ echo $lang['strno'];
+ // If we have grant option for this, end mark
+ if ($data->hasGrantOption() && in_array($v2, $v[4])) echo $lang['strasterisk'];
+ echo "</td>\n";
}
if ($data->hasGrantOption()) {
- echo "<td class=\"data{$id}\">", ($v[3]) ? $lang['stryes'] : $lang['strno'], "</td>\n";
- echo "<td class=\"data{$id}\">", $misc->printVal($v[4]), "</td>\n";
+ echo "<td class=\"data{$id}\">", $misc->printVal($v[3]), "</td>\n";
}
echo "</tr>\n";
$i++;