示例#1
0
     if (!isset($row) || $row[notnull] == "t") {
         $field_null .= "<option value=\" NOT NULL\">NOT NULL</option><option value=\"\">NULL</option>";
     } else {
         $field_null .= "<option value=\"\">NULL</option><option value=\" NOT NULL\">NOT NULL</option>";
     }
     $field_null .= "</select>";
     if (isset($row) && isset($rowdefault)) {
         $strThisDefault = $rowdefault;
     } else {
         unset($strThisDefault);
     }
     $field_default = "<input type=\"text\" name=\"field_default[]\" size=\"20\" value=\"{$strThisDefault}\">";
 } else {
     $field_type = $row[type];
     $field_len = $Length;
     $field_null = bool_YesNo($row[notnull]);
     if ($version >= 7.0) {
         if (isset($row) && isset($rowdefault)) {
             $strThisDefault = $rowdefault;
         } else {
             unset($strThisDefault);
         }
         if (strstr($field_type, "text")) {
             $field_default = "<textarea wrap=\"virtual\" name=\"field_default[]\" style=\"width:{$cfgMaxInputsize};\" rows=5>{$strThisDefault}</textarea>\n";
         } elseif (strstr($field_type, "varchar") && $field_len > 50) {
             $field_default = "<textarea wrap=\"virtual\" name=\"field_default[]\" style=\"width:{$cfgMaxInputsize};\" rows=5>{$strThisDefault}</textarea>\n";
         } else {
             $field_default = "<input type=text name=\"field_default[]\" size=20 value=\"{$strThisDefault}\">";
         }
     }
 }
示例#2
0
        for ($i = 0; $i < $num_keys; $i++) {
            $row = pg_fetch_array($pri_result, $i);
            echo "<tr>";
            $sql_query = urlencode("DROP INDEX {$cfgQuotes}" . $row[index_name] . "{$cfgQuotes}");
            $zero_rows = urlencode("");
            ?>
			<td><?php 
            echo $row[index_name];
            ?>
</td>
			<td><?php 
            echo bool_YesNo($row[unique_key]);
            ?>
</td>
			<td><?php 
            echo bool_YesNo($row[primary_key]);
            ?>
</td>
			<td><?php 
            echo $row[column_name];
            ?>
</td>
			<?php 
            if (!$printview) {
                ?>
			<td><?php 
                echo "<a href=\"sql.php?{$query}&sql_query={$sql_query}&zero_rows={$zero_rows}\">{$strDrop}</a>";
                ?>
</td>
			<?php 
            }
示例#3
0
文件: lib.inc.php 项目: ColBT/php_tut
 function display_table($qry_res, $limited = false)
 {
     global $cfgBorder, $cfgBgcolorOne, $cfgBgcolorTwo, $cfgMaxRows, $pos, $server, $link, $db, $table, $sql_query, $sql_order, $cfgOrder, $cfgShowBlob;
     global $strShowingRecords, $strTotal, $strEdit, $strPrevious, $strNext, $strAction, $strDelete, $strDeleted, $strPos1, $strEnd, $pri_keys, $goto;
     global $cfgQuotes, $cfgMaxPages, $strMore, $cfgMaxText, $link;
     if (!isset($pos)) {
         $pos = 0;
     }
     $pos_next = $pos + $cfgMaxRows;
     $pos_prev = $pos - $cfgMaxRows;
     if (!$limited) {
         $dt_result = $qry_res;
         $num_rows = @pg_numrows($dt_result);
         $num_fields = @pg_numfields($dt_result);
         $iNumRows = $num_rows;
     } else {
         if (!($cnt_result = @pg_exec($link, pre_query($qry_res)))) {
             include "header.inc.php";
             pg_die(pg_errormessage($link), $cnt_result, __FILE__, __LINE__);
         } else {
             $num_rows = pg_numrows($cnt_result);
             $full_query = $qry_res . " LIMIT {$pos}, {$cfgMaxRows}";
             if (!($dt_result = @pg_exec($link, pre_query($full_query)))) {
                 include "header.inc.php";
                 pg_die(pg_errormessage($link), $full_query, __FILE__, __LINE__);
             }
         }
         $iNumRows = $cgMaxRows;
     }
     if ($num_rows < $pos_next) {
         $pos_next = $num_rows;
     }
     $strNavigation .= "<table border=0>\n";
     $strNavigation .= "<td align=left>";
     if ($pos >= $cfgMaxRows) {
         //doj added link to beginning of results
         $strNavigation .= "<a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos=0&goto={$goto}\">&lt;&lt; {$strPos1} </a> | ";
         $strNavigation .= "\t<a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$pos_prev}&goto={$goto}\">&lt; {$strPrevious} </a> | ";
     } else {
         $strNavigation .= "&nbsp;";
     }
     $strNavigation .= "</td>\n";
     $strNavigation .= "<td align=center>\n";
     //doj now only the previous and next $cfgMaxPages pages will be shown
     if (empty($cfgMaxPages)) {
         $cfgMaxPages = 9;
     }
     $iCount = $pos - $cfgMaxRows * $cfgMaxPages;
     if ($iCount < 0) {
         $iCount = 0;
     }
     $iPageCnt = (int) ($iCount / $cfgMaxRows);
     $iPageStop = $pos + $cfgMaxRows * ($cfgMaxPages + 1);
     for (; $iCount < $iNumRows && $iCount < $iPageStop; $iCount += $cfgMaxRows) {
         //doj until here
         $iPageCnt++;
         if ($iCount != $pos) {
             $strPages .= "<a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$iCount}&goto={$goto}\">{$iPageCnt}</a> | ";
         } else {
             if ($iNumRows > $cfgMaxRows) {
                 $strPages .= "{$iPageCnt} | ";
             }
         }
     }
     $strNavigation .= ereg_replace(" \\| \$", "", $strPages);
     $strNavigation .= "</td>\n";
     $strNavigation .= "<td align=right>";
     if ($pos_next < $num_rows) {
         $strNavigation .= " | <a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$pos_next}&goto={$goto}\"> {$strNext} &gt;</a>";
         //doj link to end of results
         $pos_end = $num_rows - $cfgMaxRows;
         $strNavigation .= " | <a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$pos_end}&goto={$goto}\"> {$strEnd} &gt;&gt;</a>";
     } else {
         $strNavigation .= "&nbsp;";
     }
     $strNavigation .= "</td>\n";
     $strNavigation .= "</table>\n";
     if ($num_rows > 1) {
         echo "{$strShowingRecords} {$pos} - {$pos_next} ({$num_rows} {$strTotal})";
     }
     echo $strNavigation;
     echo "<table border={$cfgBorder}><tr>";
     for ($i_field = 0; $i_field < $num_fields; $i_field++) {
         $field_name = pg_fieldname($dt_result, $i_field);
         if (@pg_numrows($dt_result) > 1) {
             $sort_order = urlencode(" ORDER BY {$cfgQuotes}{$field_name}{$cfgQuotes} {$cfgOrder}");
             echo "<th><A HREF=\"sql.php?server={$server}&db={$db}&pos={$pos}&sql_query=" . urlencode($sql_query) . "&sql_order={$sort_order}&table={$table}&goto={$goto}\">{$field_name}</a></th>\n";
         } else {
             echo "<th>{$field_name}</th>";
         }
     }
     $priCnt = count($pri_keys);
     if ($priCnt > 0) {
         // echo "<th colspan=\"2\">$strAction : $priCnt</th>";
     }
     echo "</tr>\n";
     for ($i_row = $pos; $i_row < $pos_next; $i_row++) {
         $row = pg_fetch_row($dt_result, $i_row);
         unset($primary_key);
         $bgcolor = $cfgBgcolorOne;
         $i_row % 2 ? 0 : ($bgcolor = $cfgBgcolorTwo);
         echo "<tr bgcolor={$bgcolor}>";
         for ($i_field = 0; $i_field < pg_numfields($dt_result); $i_field++) {
             if (!isset($row[$i_field])) {
                 unset($row[$i_field]);
             }
             $field_type = pg_fieldtype($dt_result, $i_field);
             $field_name = pg_fieldname($dt_result, $i_field);
             if (eregi("int|numeric", $field_type)) {
                 echo "<td align=right valign=top>&nbsp;{$row[$i_field]}&nbsp;</td>\n";
             } elseif ($cfgShowBlob == false && eregi("BLOB", $field_type)) {
                 echo "<td align=right valign=top>&nbsp;[BLOB]&nbsp;</td>\n";
             } elseif (eregi("text|char", $field_type)) {
                 // If the text is longer than $cfgMaxText characters, let's cut it short
                 if (strlen($row[$i_field]) > $cfgMaxText && !empty($cfgMaxText)) {
                     $strLgText = nl2br(htmlspecialchars(substr($row[$i_field], 0, $cfgMaxText))) . " <br/><b>... {$strMore} ...</b>";
                 } else {
                     $strLgText = nl2br(htmlspecialchars($row[$i_field]));
                 }
                 echo "<td valign=top>&nbsp;{$strLgText}</td>\n";
             } elseif ($field_type == "bool") {
                 echo "<td valign=top>&nbsp;", bool_YesNo($row[$i_field]), "&nbsp;</td>\n";
             } else {
                 echo "<td valign=top>&nbsp;", nl2br(htmlspecialchars($row[$i_field])), "&nbsp;</td>\n";
             }
             for ($i_pri_keys = 0; $i_pri_keys < count($pri_keys); $i_pri_keys++) {
                 if ($field_name == $pri_keys[$i_pri_keys]) {
                     if (eregi("text|name|char|inet|bool", $field_type)) {
                         $strQuote = "'";
                         $add_null = empty($row[$i_field]) ? true : false;
                     } elseif (eregi("date|time", $field_type)) {
                         if (empty($row[$i_field])) {
                             $strQuote = "";
                             $row[$i_field] = "NULL";
                         } else {
                             $strQuote = "'";
                         }
                     } else {
                         unset($strQuotes);
                     }
                     if ($add_null) {
                         $primary_key .= " (";
                     }
                     $primary_key .= "{$cfgQuotes}{$field_name}{$cfgQuotes} = ";
                     $primary_key .= $strQuote . $row[$i_field] . $strQuote;
                     if ($add_null) {
                         $primary_key .= " OR {$cfgQuotes}{$field_name}{$cfgQuotes} = NULL)";
                     }
                     $primary_key .= " AND ";
                     break;
                     // This breaks us out in case the primary key column also has a seperate unique key index created on it
                 }
             }
         }
         if (!empty($primary_key)) {
             if (!empty($GLOBALS[QUERY_STRING])) {
                 $extras = $GLOBALS[QUERY_STRING];
             } else {
                 $extras = "server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&goto={$goto}";
             }
             $primary_key = urlencode(ereg_replace("AND \$", "", $primary_key));
             $query = "&server={$server}&db={$db}&table={$table}&goto=" . urlencode("sql.php?" . $extras);
             $query_vars = explode("&", $query);
             reset($query_vars);
             while (list(, $qr_var) = each($query_vars)) {
                 $var_parts = explode("=", $qr_var);
                 $strHiddens .= "\n<input type=\"hidden\" name=\"{$var_parts['0']}\" value=\"{$var_parts['1']}\">";
             }
             $strHiddens .= "\n<input type=\"hidden\" name=\"edit\" value=\"1\">";
             $strHiddens .= "\n<input type=\"hidden\" name=\"primary_key\" value=\"{$primary_key}\">";
             echo "\n\t\t\t\t<form action=\"tbl_change.php\" method=\"POST\">\n\t\t\t\t<td>\n\t\t\t\t\t{$strHiddens}\n\t\t\t\t\t<input type=\"submit\" name=\"edit_action\" value=\"{$strEdit}\">\n\t\t\t\t</td>\n\t\t\t\t</form>\n\t\t\t";
             $strHiddens .= "\n<input type=\"hidden\" name=\"sql_query\" value=\"" . urlencode("DELETE FROM {$cfgQuotes}{$table}{$cfgQuotes} WHERE ") . $primary_key . "\">";
             $strHiddens .= "\n<input type=\"hidden\" name=\"zero_rows\" value=\"" . urlencode($strDeleted) . "\">";
             echo "\n\t\t\t\t<form action=\"sql.php\" method=\"POST\">\n\t\t\t\t<td>\n\t\t\t\t\t{$strHiddens}\n\t\t\t\t\t<input type=\"submit\" name=\"edit_action\" value=\"{$strDelete}\">\n\t\t\t\t</td>\n\t\t\t\t</form>\n\t\t\t\t</td>\n\t\t\t";
             unset($strHiddens);
         }
     }
     echo "</table>\n";
     echo $strNavigation;
     return $query;
 }
示例#4
0
    unset($action);
}
// Display all users
if (empty($action)) {
    $qrUsers = "SELECT * FROM pg_user WHERE usename NOT IN ('root', '{$cfgSuperUser}') ORDER BY usesysid";
    $rsUsers = pg_exec($link, pre_query($qrUsers));
    $iNumUsers = pg_numrows($rsUsers);
    if ($iNumUsers > 0) {
        echo "\n\t\t\t\t<table border=\"{$cfgBorder}\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>{$strUserName}</th>\n\t\t\t\t\t\t<th>{$strSysID}</th>\n\t\t\t\t\t\t<th>{$strCreateDB}</th>\n\t\t\t\t\t\t<th>{$strSuperUser}</th>\n\t\t\t\t\t\t<!--th>{$strCatUpd}</th-->\n\t\t\t\t\t\t<th>{$strExpires}</th>\n\t\t\t\t\t\t<th>{$strAction}</th>\n\t\t\t\t\t</tr>\n\t\t\t";
        for ($iUsers = 0; $iUsers < $iNumUsers; $iUsers++) {
            $aryUsers = pg_fetch_array($rsUsers, $iUsers);
            $strBGcolor = $cfgBgcolorOne;
            $iRows++ % 2 ? 0 : ($strBGcolor = $cfgBgcolorTwo);
            $qrDel = urlencode("DROP USER {$cfgQuotes}{$aryUsers['usename']}{$cfgQuotes}");
            $strDelZR = urlencode("User {$aryUsers['usename']} deleted successfully.");
            echo "\n\t\t\t\t\t<tr bgcolor=\"{$strBGcolor}\">\n\t\t\t\t\t\t<td>{$aryUsers['usename']}</td>\n\t\t\t\t\t\t<td>{$aryUsers['usesysid']}</td>\n\t\t\t\t\t\t<td>" . bool_YesNo($aryUsers[usecreatedb]) . "</td>\n\t\t\t\t\t\t<td>" . bool_YesNo($aryUsers[usesuper]) . "</td>\n\t\t\t\t\t\t<!--td>" . bool_YesNo($aryUsers[usecatupd]) . "</td-->\n\t\t\t\t\t\t<td>{$aryUsers['valuntil']}</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<a href=\"sql.php?server={$server}&sql_query={$qrDel}&goto=user_admin.php&zero_rows={$strDelZR}\">{$strDelete}</a> |\n\t\t\t\t\t\t\t<a href=\"user_admin.php?server={$server}&action=edit&usr={$aryUsers['usename']}\">{$strEdit}</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
        }
        echo "</table>";
    }
} elseif ($action == "edit" || $action == "new_user") {
    $qrUserInfo = "SELECT * FROM pg_shadow WHERE usename = '{$usr}'";
    $rsUserInfo = @pg_exec($link, pre_query($qrUserInfo));
    $aryUser = @pg_fetch_array($rsUserInfo, 0);
    if ($aryUser[usecreatedb] == "t") {
        $strSelCreateDB = "checked";
    } else {
        unset($strSelCreateDB);
    }
    if ($aryUser[usesuper] == "t") {
        $strSelSuper = "checked";
    } else {
示例#5
0
 function display_table($dt_result)
 {
     global $cfgBorder, $cfgBgcolorOne, $cfgBgcolorTwo, $cfgMaxRows, $pos, $server, $link, $db, $table, $sql_query, $sql_order, $cfgOrder, $cfgShowBlob;
     global $strShowingRecords, $strTotal, $strEdit, $strPrevious, $strNext, $strAction, $strDelete, $strDeleted, $strPos1, $strEnd, $pri_keys, $goto;
     global $cfgQuotes, $cfgMaxPages, $strMore, $cfgMaxText;
     if (!isset($pos)) {
         $pos = 0;
     }
     $pos_next = $pos + $cfgMaxRows;
     $pos_prev = $pos - $cfgMaxRows;
     $num_rows = @pg_numrows($dt_result);
     $num_fields = @pg_numfields($dt_result);
     $iNumRows = $num_rows;
     if ($num_rows < $pos_next) {
         $pos_next = $num_rows;
     }
     $strNavigation .= "<table border=0>\n";
     $strNavigation .= "<td align=left>";
     if ($pos >= $cfgMaxRows) {
         //doj added link to beginning of results
         $strNavigation .= "<a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos=0&goto={$goto}\">&lt;&lt; {$strPos1} </a> | ";
         $strNavigation .= "\t<a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$pos_prev}&goto={$goto}\">&lt; {$strPrevious} </a> | ";
     } else {
         $strNavigation .= "&nbsp;";
     }
     $strNavigation .= "</td>\n";
     $strNavigation .= "<td align=center>\n";
     //doj now only the previous and next $cfgMaxPages pages will be shown
     if (empty($cfgMaxPages)) {
         $cfgMaxPages = 9;
     }
     $iCount = $pos - $cfgMaxRows * $cfgMaxPages;
     if ($iCount < 0) {
         $iCount = 0;
     }
     $iPageCnt = (int) ($iCount / $cfgMaxRows);
     $iPageStop = $pos + $cfgMaxRows * ($cfgMaxPages + 1);
     for (; $iCount < $iNumRows && $iCount < $iPageStop; $iCount += $cfgMaxRows) {
         //doj until here
         $iPageCnt++;
         if ($iCount != $pos) {
             $strPages .= "<a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$iCount}&goto={$goto}\">{$iPageCnt}</a> | ";
         } else {
             if ($iNumRows > $cfgMaxRows) {
                 $strPages .= "{$iPageCnt} | ";
             }
         }
     }
     $strNavigation .= ereg_replace(" \\| \$", "", $strPages);
     $strNavigation .= "</td>\n";
     $strNavigation .= "<td align=right>";
     if ($pos_next < $num_rows) {
         $strNavigation .= " | <a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$pos_next}&goto={$goto}\"> {$strNext} &gt;</a>";
         //doj link to end of results
         $pos_end = $num_rows - $cfgMaxRows;
         $strNavigation .= " | <a href=\"sql.php?server={$server}&db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&sql_order=" . urlencode($sql_order) . "&pos={$pos_end}&goto={$goto}\"> {$strEnd} &gt;&gt;</a>";
     } else {
         $strNavigation .= "&nbsp;";
     }
     $strNavigation .= "</td>\n";
     $strNavigation .= "</table>\n";
     if ($num_rows > 1) {
         echo "{$strShowingRecords} {$pos} - {$pos_next} ({$num_rows} {$strTotal})";
     }
     echo $strNavigation;
     echo "<table border={$cfgBorder}><tr>";
     for ($i_field = 0; $i_field < $num_fields; $i_field++) {
         $field_name = pg_fieldname($dt_result, $i_field);
         if (@pg_numrows($dt_result) > 1) {
             $sort_order = urlencode(" ORDER BY {$cfgQuotes}{$field_name}{$cfgQuotes} {$cfgOrder}");
             echo "<th><A HREF=\"sql.php?server={$server}&db={$db}&pos={$pos}&sql_query=" . urlencode($sql_query) . "&sql_order={$sort_order}&table={$table}&goto={$goto}\">{$field_name}</a></th>\n";
         } else {
             echo "<th>{$field_name}</th>";
         }
     }
     $priCnt = count($pri_keys);
     if ($priCnt > 0) {
         // echo "<th colspan=\"2\">$strAction : $priCnt</th>";
     }
     echo "</tr>\n";
     for ($i_row = $pos; $i_row < $pos_next; $i_row++) {
         $row = pg_fetch_row($dt_result, $i_row);
         unset($primary_key);
         $bgcolor = $cfgBgcolorOne;
         $i_row % 2 ? 0 : ($bgcolor = $cfgBgcolorTwo);
         echo "<tr bgcolor={$bgcolor}>";
         for ($i_field = 0; $i_field < pg_numfields($dt_result); $i_field++) {
             if (!isset($row[$i_field])) {
                 unset($row[$i_field]);
             }
             $field_type = pg_fieldtype($dt_result, $i_field);
             $field_name = pg_fieldname($dt_result, $i_field);
             if (eregi("int|numeric", $field_type)) {
                 echo "<td align=right valign=top>&nbsp;{$row[$i_field]}&nbsp;</td>\n";
             } elseif ($cfgShowBlob == false && eregi("BLOB", $field_type)) {
                 echo "<td align=right valign=top>&nbsp;[BLOB]&nbsp;</td>\n";
             } elseif (eregi("text|char", $field_type)) {
                 // If the text is longer than $cfgMaxText characters, let's cut it short
                 if (strlen($row[$i_field]) > $cfgMaxText && !empty($cfgMaxText)) {
                     $strLgText = nl2br(htmlspecialchars(substr($row[$i_field], 0, $cfgMaxText))) . " <br><b>... {$strMore} ...</b>";
                 } else {
                     $strLgText = nl2br(htmlspecialchars($row[$i_field]));
                 }
                 echo "<td valign=top>&nbsp;{$strLgText}</td>\n";
             } elseif ($field_type == "bool") {
                 echo "<td valign=top>&nbsp;", bool_YesNo($row[$i_field]), "&nbsp;</td>\n";
             } else {
                 echo "<td valign=top>&nbsp;", nl2br(htmlspecialchars($row[$i_field])), "&nbsp;</td>\n";
             }
             for ($i_pri_keys = 0; $i_pri_keys < count($pri_keys); $i_pri_keys++) {
                 // echo $field_name;
                 if ($field_name == $pri_keys[$i_pri_keys]) {
                     $primary_key .= "{$cfgQuotes}{$field_name}{$cfgQuotes} = ";
                     if (eregi("text|name|char|bool", $field_type)) {
                         $strQuote = "'";
                     } elseif (eregi("date|timestamp", $field_type)) {
                         if (empty($row[$i_field])) {
                             $strQuote = "";
                             $row[$i_field] = "NULL";
                         } else {
                             $strQuote = "'";
                         }
                     } else {
                         unset($strQuotes);
                         // $primary_key .= "$row[$i_field]";
                     }
                     $primary_key .= $strQuote . $row[$i_field] . $strQuote;
                     $primary_key .= " AND ";
                     break;
                     // This breaks us out in case the primary key column also has a seperate unique key index created on it
                 }
             }
         }
         if (!empty($primary_key)) {
             if (!empty($GLOBALS[QUERY_STRING])) {
                 $extras = $GLOBALS[QUERY_STRING];
             } else {
                 $extras = "db={$db}&table={$table}&sql_query=" . urlencode($sql_query) . "&goto={$goto}";
             }
             $primary_key = urlencode(ereg_replace("AND \$", "", $primary_key));
             $query = "&server={$server}&db={$db}&table={$table}&goto=" . urlencode("sql.php?" . $extras);
             echo "<td><a href=\"tbl_change.php?edit=1&primary_key={$primary_key}{$query}\">" . $strEdit . "</a></td>";
             echo "<td><a href=\"sql.php?sql_query=" . urlencode("DELETE FROM {$cfgQuotes}{$table}{$cfgQuotes} WHERE ") . $primary_key . "{$query}&zero_rows=" . urlencode($strDeleted) . "\">" . $strDelete . "</a></td>";
         }
     }
     echo "</table>\n";
     echo $strNavigation;
     return $query;
 }
示例#6
0
            $sql_get_trig = "\n\t\t\t\tSELECT ptr.*, pt.typname as result, pc.relname as relname\n\t\t\t\tFROM pg_trigger ptr, pg_type pt, pg_class pc\n\t\t\t\tWHERE ptr.tgtype = pt.oid \n\t\t\t\tAND ptr.tgrelid = pc.oid\n\t\t\t\tAND tgname !~ 'pg_.*' \n\t\t\t\tORDER BY tgname\n\t\t\t";
            $triggers = @pg_exec($link, pre_query($sql_get_trig)) or pg_die(pg_errormessage(), $sql_get_trig, __FILE__, __LINE__);
            $num_triggers = @pg_numrows($triggers);
            if ($num_triggers == 0) {
                echo "<br/><b>{$strNo} {$strTriggers} {$strFound}</b><br/>";
                echo "<li><a href=\"trig_create.php?server={$server}&db={$db}&goto=main.php\">{$strCreateNew} {$strTrigger}</a><br/>";
            } else {
                echo "<table border={$cfgBorder}>\n<tr bgcolor=lightgrey><th align=center>{$strRetType}</th><th align=center>{$strTrigger}</th>";
                echo "<th align=center>{$strTable}</th><th align=center>{$strIsConstraint}</th><th colspan=2>{$strAction}</th></tr>\n";
                for ($i = 0; $i < $num_triggers; $i++) {
                    $trig_ary = pg_fetch_array($triggers, $i);
                    $bgcolor = $cfgBgcolorOne;
                    $i % 2 ? 0 : ($bgcolor = $cfgBgcolorTwo);
                    $classname = $trig_ary[relname];
                    $trig_disp = "{$trig_ary['tgname']}";
                    $trig_is_const = bool_YesNo($trig_ary[tgisconstraint]);
                    // $trig_is_const = ($trig_ary[tgisconstraint]) == 't') ? 'Y' : 'N';
                    $trig_sql = "{$cfgQuotes}{$trig_ary['tgname']}{$cfgQuotes}";
                    $query = "?db={$db}&server={$server}&rel_type={$rel_type}&trigger=" . urlencode($trig_ary[tgname]);
                    ?>
					<tr bgcolor=<?php 
                    echo $bgcolor;
                    ?>
>
					<td class=data><?php 
                    echo $trig_ary[result];
                    ?>
</td>
					<td class=data><b><?php 
                    echo $trig_disp;
                    ?>