- Jean-Michel Poure
 - Rafal Slubowski
 - Brett Toolin
+- Mark Gibson (Pop-up SQL window)
 
 
 * Support for domains in 7.3 and domain constraints in 7.4
 * Add/drop users to/from groups
 * Alter (rename) triggers
+* Pop-up SQL window from Mark Gibson
 
 Version 3.0
 -----------
 
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.88 2003/07/30 07:02:30 chriskl Exp $
+        * $Id: english.php,v 1.89 2003/07/31 08:39:03 chriskl Exp $
         */
 
        // Language and character set
        $lang['strcascade'] = 'CASCADE';
 
        // Users
-       $lang['struseradmin'] = 'User Admin';
        $lang['struser'] = 'User';
        $lang['strusers'] = 'Users';
        $lang['strusername'] = 'Username';
        $lang['strpasswordconfirm'] = 'Password does not match confirmation.';
        
        // Groups
-       $lang['strgroupadmin'] = 'Group Admin';
        $lang['strgroup'] = 'Group';
        $lang['strgroups'] = 'Groups';
        $lang['strnogroup'] = 'Group not found.';
        $lang['strtopbar'] = '%s running on %s:%s -- You are logged in as user "%s", %s';
        $lang['strtimefmt'] = 'jS M, Y g:iA';
 
-       // SQL Editor
-       $lang['strsqleditor'] = 'SQL Editor';
-
 ?>
 
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.40 2003/07/30 07:02:31 chriskl Exp $
+        * $Id: english.php,v 1.41 2003/07/31 08:39:03 chriskl Exp $
         */
 
        // Language and character set
        $lang['strcascade'] = 'CASCADE';
 
        // Users
-       $lang['struseradmin'] = 'User Admin';
        $lang['struser'] = 'User';
        $lang['strusers'] = 'Users';
        $lang['strusername'] = 'Username';
        $lang['strpasswordconfirm'] = 'Password does not match confirmation.';
        
        // Groups
-       $lang['strgroupadmin'] = 'Group Admin';
        $lang['strgroup'] = 'Group';
        $lang['strgroups'] = 'Groups';
        $lang['strnogroup'] = 'Group not found.';
        $lang['strtopbar'] = '%s running on %s:%s -- You are logged in as user "%s", %s';
        $lang['strtimefmt'] = 'jS M, Y g:iA';
 
-       // SQL Editor
-       $lang['strsqleditor'] = 'SQL Editor';
-
 ?>
 
         * @param $return_url The return URL
         * @param $return_desc The return link name
         *
-        * $Id: sql.php,v 1.6 2003/05/31 07:23:24 chriskl Exp $
+        * $Id: sql.php,v 1.7 2003/07/31 08:39:03 chriskl Exp $
         */
 
        // Include application functions
 
        $_POST['query'] = trim($_POST['query']);
        if ($_POST['query'] != '') {
+               \r
+               // NOTE: This is a quick hack!\r
+               if (isset($_POST['explain'])) {\r
+                       // TODO: Is there a generic (non PostgreSQL specific) way to do this\r
+                       $_POST['query'] = 'EXPLAIN '.$_POST['query'];\r
+               }\r
+               
                // Set fetch mode to NUM so that duplicate field names are properly returned
                $localData->conn->setFetchMode(ADODB_FETCH_NUM);
                // Execute the query
 
--- /dev/null
+<?php\r
+\r
+       /**\r
+        * Alternative SQL editing window\r
+        *\r
+        * $Id: sqledit.php,v 1.1 2003/07/31 08:39:03 chriskl Exp $\r
+        */\r
+\r
+       // Include application functions\r
+       include_once('libraries/lib.inc.php');\r
+\r
+       $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';\r
+       if (!isset($msg)) $msg = '';\r
+       $PHP_SELF = $_SERVER['PHP_SELF'];\r
+\r
+       /**\r
+        * Allow execution of arbitrary SQL statements on a database\r
+        */\r
+       function doDefault() {\r
+               global $PHP_SELF, $data, $localData, $misc;\r
+               global $lang;\r
+\r
+               if (!isset($_POST['query'])) $_POST['query'] = '';\r
+\r
+               echo "<h2>{$lang['strsql']}</h2>\n";\r
+\r
+               echo "<form action=\"sql.php\" method=\"post\" target=\"detail\">\n";\r
+\r
+               echo "<p>{$lang['strdatabase']}: <select name=\"database\">\n";\r
+               $databases = &$data->getDatabases();\r
+               while (!$databases->EOF) {\r
+                       $dbname = $databases->f[$data->dbFields['dbname']];\r
+                       echo "<option value=\"", htmlspecialchars($dbname), "\"",\r
+                       (isset($_REQUEST['database']) && $dbname == $_REQUEST['database']) ? ' selected' : '', ">",\r
+                               htmlspecialchars($dbname), "</option>\n";\r
+                       $databases->moveNext();\r
+               }\r
+               echo "</select>\n";\r
+               echo "<input type=\"submit\" value=\"{$lang['strgo']}\" />\n";\r
+               echo "<input type=\"submit\" name=\"explain\" value=\"{$lang['strexplain']}\" />\n";\r
+               echo "<input type=\"reset\" value=\"{$lang['strreset']}\" />\n";\r
+               echo "<input type=\"button\" value=\"Taller\" onclick=\"document.forms[0].query.rows += 2;\" />\n";\r
+               echo "<input type=\"button\" value=\"Shorter\" onclick=\"document.forms[0].query.rows -= 2;\" />\n";\r
+\r
+               $rows = isset($_REQUEST['rows']) ? $_REQUEST['rows'] : 20;\r
+\r
+               echo "<textarea style=\"width:100%; height:auto;\" rows=\"{$rows}\" cols=\"50\" name=\"query\" id=\"query\">",\r
+                       htmlspecialchars($_POST['query']), "</textarea></p>\n";\r
+\r
+               echo $misc->form;\r
+\r
+//             HMMM: Not sure what the back link could do in this situation, any ideas?\r
+\r
+//             echo "<input type=\"hidden\" name=\"return_url\" value=\"database.php?database=",\r
+//                     urlencode($_REQUEST['database']), " />\n";\r
+//             echo "<input type=\"hidden\" name=\"return_desc\" value=\"{$lang['strback']}\" />\n";\r
+               echo "</form>\n";\r
+       }\r
+\r
+       $misc->printHeader($lang['strsql']);\r
+       // Bring to the front always\r
+       echo "<body onLoad=\"window.focus();\">\n";\r
+       \r
+       switch ($action) {\r
+               default:\r
+                       doDefault();\r
+                       break;\r
+       }\r
+       \r
+       $misc->printFooter();\r
+       \r
+?>\r
 
        /**
         * Top menu for phpPgAdmin
         *
-        * $Id: topbar.php,v 1.13 2003/05/28 03:08:45 chriskl Exp $
+        * $Id: topbar.php,v 1.14 2003/07/31 08:39:03 chriskl Exp $
         */
 
        // Include application functions
        // For superuser, show user and group admin.  For normal user, show change password.
        if ($data->isSuperUser($_SESSION['webdbUsername'])) :
 ?>
-                       <a class="toplink" href="users.php" target="detail"><?php echo $lang['struseradmin'] ?></a> | 
-                       <a class="toplink" href="groups.php" target="detail"><?php echo $lang['strgroupadmin'] ?></a> |
+                       <a class="toplink" href="users.php" target="detail"><?php echo $lang['strusers'] ?></a> | 
+                       <a class="toplink" href="groups.php" target="detail"><?php echo $lang['strgroups'] ?></a> |
 <?php
        endif;
 ?>
 <?php if ($conf['show_reports']) : ?>
                        <a class="toplink" href="reports.php" target="detail"><?php echo $lang['strreports'] ?></a> |
 <?php endif; ?>
+                       <a class="toplink" href="sqledit" target="sqledit"                                      
+                               onclick="window.open('sqledit.php','sqledit','toobar=no,width=700,height=420,resizable=yes,scrollbars=yes').focus(); return false;"><?php echo $lang['strsql'] ?></a> |
                        <a class="toplink" href="logout.php" target="_parent"><?php echo $lang['strlogout'] ?></a>
                </td>
        </tr>
 
        /**
         * Manage users in a database cluster
         *
-        * $Id: users.php,v 1.14 2003/06/26 02:50:30 chriskl Exp $
+        * $Id: users.php,v 1.15 2003/07/31 08:39:03 chriskl Exp $
         */
 
        // Include application functions
        $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
        if (!isset($msg)) $msg = '';
        $PHP_SELF = $_SERVER['PHP_SELF'];
+
+       /**
+        * Show access privileges that a user posesses
+        */
+       function doPrivileges($msg = '') {
+               global $data, $misc;
+               global $PHP_SELF, $lang;
        
+               echo "<h2>{$lang['strusers']}: ", $misc->printVal($_REQUEST['username']), ": {$lang['strprivileges']}</h2>\n";
+               $misc->printMsg($msg);
+               
+               $userdata = &$data->getUserPrivileges($_REQUEST['username']);
+               
+               if ($userdata->recordCount() > 0) {
+                       $userdata->f[$data->uFields['usuper']] = $data->phpBool($userdata->f[$data->uFields['usuper']]);
+                       $userdata->f[$data->uFields['ucreatedb']] = $data->phpBool($userdata->f[$data->uFields['ucreatedb']]);
+                       echo "<table>\n";
+                       echo "<tr><th class=\"data\">{$lang['strusername']}</th><th class=\"data\">{$lang['strsuper']}</th><th class=\"data\">{$lang['strcreatedb']}</th><th class=\"data\">{$lang['strexpires']}</th></tr>\n";
+                       echo "<tr><td class=\"data1\">", $misc->printVal($userdata->f[$data->uFields['uname']]), "</td>\n";
+                       echo "<td class=\"data1\">", (($userdata->f[$data->uFields['usuper']]) ? $lang['stryes'] : $lang['strno']), "</td>\n";
+                       echo "<td class=\"data1\">", (($userdata->f[$data->uFields['ucreatedb']]) ? $lang['stryes'] : $lang['strno']), "</td>\n";
+                       echo "<td class=\"data1\">", $misc->printVal($userdata->f[$data->uFields['uexpires']]), "</td></tr>\n";
+                       echo "</table>\n";
+               }
+               else echo "<p>{$lang['strnodata']}</p>\n";
+               
+               echo "<p><a class=\"navlink\" href=\"$PHP_SELF\">{$lang['strshowallusers']}</a> |\n";
+               echo "<a class=\"navlink\" href=\"$PHP_SELF?action=edit&username=", 
+                       urlencode($_REQUEST['username']), "\">{$lang['stredit']}</a></p>\n";
+       }
+               
        /**
         * If a user is not a superuser, then we have an 'account management' page
         * where they can change their password, etc.  We don't prevent them from