From: Eric F. <wg...@us...> - 2004-08-09 22:14:52
|
Update of /cvsroot/phpliteadmin/phpLiteAdmin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5172 Modified Files: ChangeLog config.php5 Added Files: tbl.php5 Log Message: Added table browse, needs major css work --- NEW FILE: tbl.php5 --- <?php /** * @name phpLiteAdmin * @copyright 2004 phpLiteAdmin Team */ /** * $Id: tbl.php5,v 1.1 2004/08/09 22:14:42 wgeric Exp $ * Stucture for databases */ include_once( 'config.php5' ); if( isset( $_REQUEST['db'] ) ) { $db_path = $_REQUEST['db']; if ( !( preg_match( '#db/#i', $db_path ) ) ) { $db_path = 'db/' . $db_path; } if ( !( preg_match( '#\.sqlite#i', $db_path ) ) ) { $db_path .= '.sqlite'; } $db_name = preg_replace( '#db/(.*?)\.sqlite#i', '\\1', $db_path ); } else { header( 'Location: main.php5' ); exit; } if ( isset( $_REQUEST['tbl'] ) ) { $tbl = $_REQUEST['tbl']; } else { header( 'Location: db.php5?db=' . $db_name ); exit; } $mode = ( isset( $_REQUEST['mode'] ) ) ? $_REQUEST['mode'] : ''; header( 'Content-Type: text/xml; charset=UTF-8' ); include( 'lib/sqlite.php5' ); $Database = new Database( $db_path, 0777, &$sqlite_error ); print '<?xml version="1.0" encoding="UTF-8" ?>' . "\n"; switch( $mode ) { // Browse the table case 'browse': print '<?xml-stylesheet href="style/tbl_browse.xsl" type="text/xsl" ?>' . "\n"; print '<rows>' . "\n"; if ( $_REQUEST['order'] ) { $order = ( $_REQUEST['order'] == 'ASC' ) ? 'ASC' : 'DESC'; } else { $order = 'ASC'; } $order_by = ( $_REQUEST['order_by'] ) ? " ORDER BY " . $_REQUEST['order_by'] . " $order" : ''; $start = ( $_REQUEST['start'] ) ? settype( $_REQUEST['start'], 'integer' ) : 0; $end = ( $_REQUEST['end'] ) ? settype( $_REQUEST['end'], 'integer' ) : $config['default_rows']; $sql = "SELECT * FROM $tbl $order_by"; //LIMIT $start, $end"; $result = $Database->query( $sql ); $columns_array = array(); while( $row = $Database->fetch_array( $result ) ) { print "\t<row>\n"; foreach( $row as $key => $value ) { if ( !in_array( $key, $columns_array ) ) { $columns_array[] = $key; } print "\t\t" . '<column name="' . $key . '">' . $value . '</column>' . "\n"; print "\t\t<tbl>$tbl</tbl>\n"; print "\t\t<db>$db_name</db>\n"; } print "\t</row>\n"; } print "\t<columns>\n"; for( $i = 0; $i < count($columns_array); $i++ ) { print "\t\t<name>" . $columns_array[$i] . "</name>\n"; } print "\t</columns>\n"; print "</rows>\n"; break; // Execute an SQL query case 'sql': break; // Export the table case 'export': break; // Drop the table case 'drop': break; // List columns, the table's structure case 'structure': default: break; } ?> Index: config.php5 =================================================================== RCS file: /cvsroot/phpliteadmin/phpLiteAdmin/config.php5,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- config.php5 7 Aug 2004 10:19:10 -0000 1.1 +++ config.php5 9 Aug 2004 22:14:42 -0000 1.2 @@ -10,7 +10,7 @@ * Configuration and customization settings */ -error_reporting( E_ALL | E_STRICT ); // DO NOT CHANGE THIS! +//error_reporting( E_ALL | E_STRICT ); // DO NOT CHANGE THIS! @ini_set( 'display_errors', '1' ); // DO NOT CHANGE THIS! // Placeholder for customization options @@ -18,6 +18,8 @@ $config['navbar_width'] = '150'; // Default: 150 +$config['default_rows'] = '30'; // Default: 30 + /* DO NOT EDIT BELOW THIS LINE! */ $config['revision'] = '$Revision$'; Index: ChangeLog =================================================================== RCS file: /cvsroot/phpliteadmin/phpLiteAdmin/ChangeLog,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ChangeLog 9 Aug 2004 21:48:28 -0000 1.3 +++ ChangeLog 9 Aug 2004 22:14:42 -0000 1.4 @@ -12,6 +12,12 @@ style/db_structure.xsl: Fixed minor problems + * config.php5 + tbl.php5 + style/tbl_browse.xsl + style/tbl_browse.css + Added table browse, needs major css work + 2004-08-07 Gordon P. Hemsley <gph...@us...> * config.php5 index.php5 |