upgrade browser to match new TreeMenu. add start time to process view. sort out...
authorchriskl <chriskl>
Mon, 2 Feb 2004 12:15:57 +0000 (12:15 +0000)
committerchriskl <chriskl>
Mon, 2 Feb 2004 12:15:57 +0000 (12:15 +0000)
BUGS
browser.php
classes/Misc.php
classes/database/BaseDB.php
classes/database/Postgres.php
classes/database/Postgres72.php
classes/database/Postgres73.php
database.php
lang/english.php
lang/recoded/english.php

diff --git a/BUGS b/BUGS
index 38da6525d4d78c6bcfd1c2b7817b68f5f02ad7de..d6336220ea0fd1a9e16a4aad95cb1281fbc63c33 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -11,15 +11,13 @@ need icons and Find for Casts and Conversions, Languages, Aggs and OpClasses
 submit changes to HTML_TreeMenu maintainer
 test < 7.3 Find feature for all new objects
 fix constraint search to get domain and table constraints?
-exclude system triggers from Find
 dump sequences when dumping tables
 fix dumping clustering info
 can't edit SELECT results by oid
 
 Need to fix:
-* Variables and processes views for < 7.3
 * The getType function needs to be ported to 7.2 and 7.3 classes to add
   pretty type name and schema support
-* Add query start time to processes view for 7.4+
 * Report login errors
+* Edit Query
 
index 824c95b6357388e9999a73ee0bf87f81aaefdd75..0d447a22df198b64d87cfa0d6496290bd396c38c 100644 (file)
@@ -5,7 +5,7 @@
         * if you click on a database it shows a list of database objects in that
         * database.
         *
-        * $Id: browser.php,v 1.35 2004/01/04 08:13:41 chriskl Exp $
+        * $Id: browser.php,v 1.36 2004/02/02 12:15:57 chriskl Exp $
         */
 
        // Include application functions
@@ -21,8 +21,8 @@
        // Construct expanding tree
        $menu  = new HTML_TreeMenu(null, array('usePersistence' => false));
        $root = new HTML_TreeNode(array(
-                                               'text' => addslashes($misc->printVal(($conf['servers'][$_SESSION['webdbServerID']]['desc']))), 
-                                               'link' => 'all_db.php?' . SID
+                                               'text' => $misc->printVal(($conf['servers'][$_SESSION['webdbServerID']]['desc'])), 
+                                               'link' => addslashes('all_db.php?' . SID)
                                                'icon' => 'folder.gif', 
                                                'expandedIcon' => 'folder-expanded.gif',
                                                'expanded' => true,
@@ -41,7 +41,7 @@
                // Tables
                if ($data->hasTables()) {
                        $table_node = &new HTML_TreeNode(array(
-                                                       'text' => addslashes($lang['strtables'])
+                                                       'text' => $lang['strtables']
                                                        'link' => addslashes(htmlspecialchars("tables.php?{$querystr}")), 
                                                        'icon' => "../../../images/themes/{$conf['theme']}/tables.png", 
                                                        'expandedIcon' => "../../../images/themes/{$conf['theme']}/tables.png",
@@ -55,7 +55,7 @@
                        while (!$tables->EOF) {
                                $return_url = urlencode("tblproperties.php?table=" . urlencode($tables->f[$data->tbFields['tbname']]) . "&{$querystr}");
                                $item_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($misc->printVal($tables->f[$data->tbFields['tbname']])), 
+                                                               'text' => $misc->printVal($tables->f[$data->tbFields['tbname']]), 
                                                                'link' => addslashes(htmlspecialchars("tblproperties.php?{$querystr}&table=" .
                                                                        urlencode($tables->f[$data->tbFields['tbname']]))), 
                                                                'icon' => "../../../images/themes/{$conf['theme']}/tables.png", 
@@ -75,7 +75,7 @@
                // Views
                if ($data->hasViews()) {
                        $view_node = &new HTML_TreeNode(array(
-                                                       'text' => addslashes($lang['strviews'])
+                                                       'text' => $lang['strviews']
                                                        'link' => addslashes(htmlspecialchars("views.php?{$querystr}")), 
                                                        'icon' => "../../../images/themes/{$conf['theme']}/views.png", 
                                                        'expandedIcon' => "../../../images/themes/{$conf['theme']}/views.png",
@@ -88,7 +88,7 @@
                // Sequences
                if ($data->hasSequences()) {
                        $seq_node = &new HTML_TreeNode(array(
-                                                       'text' => addslashes($lang['strsequences'])
+                                                       'text' => $lang['strsequences']
                                                        'link' => addslashes(htmlspecialchars("sequences.php?{$querystr}")), 
                                                        'icon' => "../../../images/themes/{$conf['theme']}/sequences.png", 
                                                        'expandedIcon' => "../../../images/themes/{$conf['theme']}/sequences.png",
                // Functions
                if ($data->hasFunctions()) {
                        $func_node = &new HTML_TreeNode(array(
-                                                       'text' => addslashes($lang['strfunctions'])
+                                                       'text' => $lang['strfunctions']
                                                        'link' => addslashes(htmlspecialchars("functions.php?{$querystr}")), 
                                                        'icon' => "../../../images/themes/{$conf['theme']}/functions.png", 
                                                        'expandedIcon' => "../../../images/themes/{$conf['theme']}/functions.png",
                // Domains
                if ($data->hasDomains()) {
                        $dom_node = &new HTML_TreeNode(array(
-                                                       'text' => addslashes($lang['strdomains'])
+                                                       'text' => $lang['strdomains']
                                                        'link' => addslashes(htmlspecialchars("domains.php?{$querystr}")), 
                                                        'icon' => "../../../images/themes/{$conf['theme']}/domains.png", 
                                                        'expandedIcon' => "../../../images/themes/{$conf['theme']}/domains.png",
                        // Aggregates
                        if ($data->hasAggregates()) {
                                $agg_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($lang['straggregates'])
+                                                               'text' => $lang['straggregates']
                                                                'link' => addslashes(htmlspecialchars("aggregates.php?{$querystr}")), 
                                                                'icon' => "../../../images/themes/{$conf['theme']}/types.png", 
                                                                'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
                        // Types
                        if ($data->hasTypes()) {
                                $type_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($lang['strtypes'])
+                                                               'text' => $lang['strtypes']
                                                                'link' => addslashes(htmlspecialchars("types.php?{$querystr}")), 
                                                                'icon' => "../../../images/themes/{$conf['theme']}/types.png", 
                                                                'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
                        // Operators
                        if ($data->hasOperators()) {
                                $opr_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($lang['stroperators'])
+                                                               'text' => $lang['stroperators']
                                                                'link' => addslashes(htmlspecialchars("operators.php?{$querystr}")), 
                                                                'icon' => "../../../images/themes/{$conf['theme']}/operators.png", 
                                                                'expandedIcon' => "../../../images/themes/{$conf['theme']}/operators.png",
                        // Operator Classes
                        if ($data->hasOpClasses()) {
                                $opc_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($lang['stropclasses'])
+                                                               'text' => $lang['stropclasses']
                                                                'link' => addslashes(htmlspecialchars("opclasses.php?{$querystr}")), 
                                                                'icon' => "../../../images/themes/{$conf['theme']}/operators.png", 
                                                                'expandedIcon' => "../../../images/themes/{$conf['theme']}/operators.png",
                        // Conversions
                        if ($data->hasConversions()) {
                                $con_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($lang['strconversions'])
+                                                               'text' => $lang['strconversions']
                                                                'link' => addslashes(htmlspecialchars("conversions.php?{$querystr}")), 
-                                                                       'icon' => "../../../images/themes/{$conf['theme']}/types.png", 
-                                                                       'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
+                                                               'icon' => "../../../images/themes/{$conf['theme']}/types.png", 
+                                                               'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
                                                                'expanded' => false,
                                                                'linkTarget' => 'detail'));
 
                        // apostrophes create the get string we need to append
                        $querystr = 'database=' . urlencode($databases->f[$data->dbFields['dbname']]) . '&' . SID;
                        $db_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($misc->printVal($databases->f[$data->dbFields['dbname']])), 
+                                                               'text' => $misc->printVal($databases->f[$data->dbFields['dbname']]), 
                                                                'link' => addslashes(htmlspecialchars("database.php?{$querystr}")),
                                                                'icon' => "../../../images/themes/{$conf['theme']}/database.png", 
                                                                'expandedIcon' => "../../../images/themes/{$conf['theme']}/database.png",
                                        $querystr = 'database=' . urlencode($databases->f[$data->dbFields['dbname']]). '&schema=' .
                                                        urlencode($schemas->f[$data->nspFields['nspname']]) . '&' . SID;
                                        $schemanode = &new HTML_TreeNode(array(
-                                                                       'text' => addslashes($misc->printVal($schemas->f[$data->nspFields['nspname']])), 
+                                                                       'text' => $misc->printVal($schemas->f[$data->nspFields['nspname']]), 
                                                                        'link' => addslashes(htmlspecialchars("schema.php?{$querystr}")), 
                                                                        'icon' => 'folder.gif', 
                                                                        'expandedIcon' => 'folder-expanded.gif',
                        if ($conf['show_advanced']) {
                                if ($data->hasLanguages()) {            
                                        $lang_node = &new HTML_TreeNode(array(
-                                                                       'text' => addslashes($lang['strlanguages'])
+                                                                       'text' => $lang['strlanguages']
                                                                        'link' => addslashes(htmlspecialchars("languages.php?{$querystr}")), 
                                                                        'icon' => "../../../images/themes/{$conf['theme']}/types.png", 
                                                                        'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
                                // Casts
                                if ($data->hasCasts()) {                
                                        $cast_node = &new HTML_TreeNode(array(
-                                                                       'text' => addslashes($lang['strcasts'])
+                                                                       'text' => $lang['strcasts']
                                                                        'link' => addslashes(htmlspecialchars("casts.php?{$querystr}")), 
                                                                        'icon' => "../../../images/themes/{$conf['theme']}/types.png", 
                                                                        'expandedIcon' => "../../../images/themes/{$conf['theme']}/types.png",
                        $jsLink = '?database=' . addslashes(htmlspecialchars(urlencode($databases->f[$data->dbFields['dbname']]) . '&' . SID));
                        $jsLink = "javascript:updateLinks(' + \"'{$jsLink}'\" + ')";
                        $db_node = &new HTML_TreeNode(array(
-                                                               'text' => addslashes($misc->printVal($databases->f[$data->dbFields['dbname']])), 
-                                                               'link' => $jsLink,
-                                                               'icon' => "../../../images/themes/{$conf['theme']}/database.png", 
-                                                               'expandedIcon' => "../../../images/themes/{$conf['theme']}/database.png",
-                                                               'expanded' => false,
-                                                               'linkTarget' => '_self'));
+                                                                       'text' => $misc->printVal($databases->f[$data->dbFields['dbname']]), 
+                                                                       'link' => $jsLink,
+                                                                       'icon' => "../../../images/themes/{$conf['theme']}/database.png", 
+                                                                       'expandedIcon' => "../../../images/themes/{$conf['theme']}/database.png",
+                                                                       'expanded' => false,
+                                                                       'linkTarget' => '_self'));
                
                        // Add node to menu
                        $root->addItem($db_node);
index 761956100f18c1fa4f9aac6e1fbb97da99e811e6..e08dd8403837ea8c1b29003324ea7b7ab6da31c2 100644 (file)
@@ -2,7 +2,7 @@
        /**
         * Class to hold various commonly used functions
         *
-        * $Id: Misc.php,v 1.57 2004/01/29 07:30:12 chriskl Exp $
+        * $Id: Misc.php,v 1.58 2004/02/02 12:15:57 chriskl Exp $
         */
         
        class Misc {
                        }
                        echo "<td width=\"12%\"><a href=\"database.php?{$vars}&amp;action=sql\">{$lang['strsql']}</a></td>\n";
                        echo "<td width=\"13%\"><a href=\"database.php?{$vars}&amp;action=find\">{$lang['strfind']}</a></td>\n";
-                       echo "<td width=\"12%\"><a href=\"database.php?{$vars}&amp;action=variables\">{$lang['strvariables']}</a></td>\n";
-                       echo "<td width=\"13%\"><a href=\"database.php?{$vars}&amp;action=processes\">{$lang['strprocesses']}</a></td>\n";
+                       if ($data->hasVariables()) {
+                               echo "<td width=\"12%\"><a href=\"database.php?{$vars}&amp;action=variables\">{$lang['strvariables']}</a></td>\n";
+                       }
+                       if ($data->hasProcesses()) {
+                               echo "<td width=\"13%\"><a href=\"database.php?{$vars}&amp;action=processes\">{$lang['strprocesses']}</a></td>\n";
+                       }
                        echo "<td width=\"12%\"><a href=\"database.php?{$vars}&amp;action=admin\">{$lang['stradmin']}</a></td>\n";
                        // Only show database privs if available
                        if (isset($data->privlist['database'])) {
index be5f45470c121bee83849ea523d93e4f578f5d90..610a5effabb0f9f196d9ac1fe48f62079f9c6392 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: BaseDB.php,v 1.37 2003/12/24 11:12:20 chriskl Exp $
+ * $Id: BaseDB.php,v 1.38 2004/02/02 12:15:58 chriskl Exp $
  */
 
 include_once('./classes/database/ADODB_base.php');
@@ -260,6 +260,8 @@ class BaseDB extends ADODB_base {
        function hasFullSubqueries() { return false; }
        function hasPrepare() { return false; }
        function hasOpClasses() { return false; }
+       function hasProcesses() { return false; }
+       function hasVariables() { return false; }
 }
 
 ?>
index 9d270ab0a8a861d6e13cfe982ab6593f867ac696..98d3bceb46fa2dcaedec30f3ed848547898912fa 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.179 2004/01/30 05:58:44 chriskl Exp $
+ * $Id: Postgres.php,v 1.180 2004/02/02 12:15:58 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -229,32 +229,6 @@ class Postgres extends BaseDB {
                return $this->selectSet($sql);
        }
 
-       /**
-        * Returns all available variable information.
-        * @return A recordset
-        */
-       function &getVariables() {
-               $sql = "SHOW ALL";
-               
-               return $this->selectSet($sql);
-       }
-       
-       /**
-        * Returns all available process information.
-        * @param $database (optional) Find only connections to specified database
-        * @return A recordset
-        */
-       function &getProcesses($database = null) {
-               if ($database === null)
-                       $sql = "SELECT * FROM pg_stat_activity ORDER BY datname, usename, procpid";
-               else {
-                       $this->clean($database);
-                       $sql = "SELECT * FROM pg_stat_activity WHERE datname='{$database}' ORDER BY usename, procpid";
-               }
-               
-               return $this->selectSet($sql);
-       }
-       
        /**
         * Returns the current database encoding
         * @return The encoding.  eg. SQL_ASCII, UTF-8, etc.
index 23cf5bebc239d2ce601ad83d45320936fb748dfc..93a85e5dc89f184ac9a78485053503e0fd76a569 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres72.php,v 1.56 2004/01/14 02:14:28 chriskl Exp $
+ * $Id: Postgres72.php,v 1.57 2004/02/02 12:15:58 chriskl Exp $
  */
 
 
@@ -38,6 +38,22 @@ class Postgres72 extends Postgres71 {
                $this->codemap['LATIN5'] = 'ISO-8859-9';
        }
 
+       /**
+        * Returns all available process information.
+        * @param $database (optional) Find only connections to specified database
+        * @return A recordset
+        */
+       function &getProcesses($database = null) {
+               if ($database === null)
+                       $sql = "SELECT * FROM pg_stat_activity ORDER BY datname, usename, procpid";
+               else {
+                       $this->clean($database);
+                       $sql = "SELECT * FROM pg_stat_activity WHERE datname='{$database}' ORDER BY usename, procpid";
+               }
+               
+               return $this->selectSet($sql);
+       }
+       
        // Table functions
 
        /**
@@ -300,6 +316,7 @@ class Postgres72 extends Postgres71 {
        // Capabilities
        function hasWithoutOIDs() { return true; }
        function hasPartialIndexes() { return true; }
+       function hasProcesses() { return true; }
 
 }
 
index 8dcb7e834096187dbf7e253107e74071b7b5222f..26f13c3ff852fe91f86ce9758015a738fddbdced 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres73.php,v 1.88 2004/01/30 05:58:45 chriskl Exp $
+ * $Id: Postgres73.php,v 1.89 2004/02/02 12:15:58 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -150,6 +150,32 @@ class Postgres73 extends Postgres72 {
                return $this->execute($sql);
        }
 
+       /**
+        * Returns all available variable information.
+        * @return A recordset
+        */
+       function &getVariables() {
+               $sql = "SHOW ALL";
+               
+               return $this->selectSet($sql);
+       }
+       
+       /**
+        * Returns all available process information.
+        * @param $database (optional) Find only connections to specified database
+        * @return A recordset
+        */
+       function &getProcesses($database = null) {
+               if ($database === null)
+                       $sql = "SELECT * FROM pg_catalog.pg_stat_activity ORDER BY datname, usename, procpid";
+               else {
+                       $this->clean($database);
+                       $sql = "SELECT * FROM pg_catalog.pg_stat_activity WHERE datname='{$database}' ORDER BY usename, procpid";
+               }
+               
+               return $this->selectSet($sql);
+       }
+       
        // Table functions
 
        /**
@@ -1477,6 +1503,7 @@ class Postgres73 extends Postgres72 {
        function hasCasts() { return true; }
        function hasPrepare() { return true; }
        function hasUserSessionDefaults() { return true; }
+       function hasVariables() { return true; }
 
 }
 
index cab5097469a70f8d9a48d6dbd1fbf13499a2928f..c6d0c5c349d5db26c77054427d11761e6509eeb5 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage schemas within a database
         *
-        * $Id: database.php,v 1.33 2004/01/30 05:58:44 chriskl Exp $
+        * $Id: database.php,v 1.34 2004/02/02 12:15:57 chriskl Exp $
         */
 
        // Include application functions
                if ($processes->recordCount() > 0) {
                        echo "<table>\n";
                        echo "<tr><th class=\"data\">{$lang['strusername']}</th><th class=\"data\">{$lang['strprocess']}</th>";
-                       echo "<th class=\"data\">{$lang['strsql']}</th></tr>\n";
+                       echo "<th class=\"data\">{$lang['strsql']}</th>";
+                       // Show query start time for 7.4+
+                       if (isset($processes->f['query_start'])) echo "<th class=\"data\">{$lang['strstarttime']}</th>";
+                       echo "</tr>\n";
+                       
                        $i = 0;
                        while (!$processes->EOF) {
                                $id = (($i % 2) == 0 ? '1' : '2');
                                echo "<td class=\"data{$id}\">", $misc->printVal($processes->f['usename']), "</td>";
                                echo "<td class=\"data{$id}\">", $misc->printVal($processes->f['procpid'], false, 'int4'), "</td>";
                                echo "<td class=\"data{$id}\">", $misc->printVal($processes->f['current_query']), "</td>";
+                               // Show query start time for 7.4+
+                               if (isset($processes->f['query_start'])) {
+                                       echo "<td class=\"data{$id}\">", $misc->printVal($processes->f['query_start']), "</td>";                                
+                               }
                                echo "</tr>\n";
                                $processes->moveNext();
                                $i++;
index 242c5a5f379f818bff1ea28af23b847549f655d1..bb9352b049f4b5860753dfd6d6f4f56cf81ccdf4 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.130 2004/01/18 16:03:11 soranzo Exp $
+        * $Id: english.php,v 1.131 2004/02/02 12:15:58 chriskl Exp $
         */
 
        // Language and character set
        $lang['strprocesses'] = 'Processes';
        $lang['strsetting'] = 'Setting';
        $lang['strparameters'] = 'Parameters';
+       $lang['streditquery'] = 'Edit query';
+       $lang['strstarttime'] = 'Start Time';
 
        // Error handling
        $lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';
index f43f94ae8240ec766e119d5d472d0432f59dd60e..1309ca3904ad983da9d1e06a4cc65e603970d4aa 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.82 2004/01/18 16:03:11 soranzo Exp $
+        * $Id: english.php,v 1.83 2004/02/02 12:15:58 chriskl Exp $
         */
 
        // Language and character set
        $lang['strprocesses'] = 'Processes';
        $lang['strsetting'] = 'Setting';
        $lang['strparameters'] = 'Parameters';
+       $lang['streditquery'] = 'Edit query';
+       $lang['strstarttime'] = 'Start Time';
 
        // Error handling
        $lang['strnoframes'] = 'You need a frames-enabled browser to use this application.';