Update of /cvsroot/webnotes/webnotes/core
In directory usw-pr-cvs1:/tmp/cvs-serv19006/core
Modified Files:
config_inc.php page_api.php
Log Message:
- Added $g_table_title_color which was missing from config_inc.php
- Cleanup of page_api.php
- Additions to roadmap.
- Cleanup of admin_view_queue.php
- Fixed two undefined variables in logout.php.
Index: config_inc.php
===================================================================
RCS file: /cvsroot/webnotes/webnotes/core/config_inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- config_inc.php 5 Sep 2002 06:25:19 -0000 1.5
+++ config_inc.php 5 Sep 2002 14:13:00 -0000 1.6
@@ -71,6 +71,7 @@
### Colors
$g_table_border_color = '#aaaaaa';
+ $g_table_title_color = '#cccccc'; # temporary color, should be changed
$g_primary_dark_color = '#d8d8d8';
$g_primary_light_color = '#e8e8e8';
$g_white_color = '#ffffff';
Index: page_api.php
===================================================================
RCS file: /cvsroot/webnotes/webnotes/core/page_api.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- page_api.php 4 Sep 2002 13:36:58 -0000 1.2
+++ page_api.php 5 Sep 2002 14:13:00 -0000 1.3
@@ -11,39 +11,39 @@
### --------------------
function get_page_id( $p_file ) {
- global $g_hostname, $g_db_username, $g_db_password, $g_database_name,
- $g_phpWN_page_table;
+ global $g_phpWN_page_table;
- $c_file = string_safe ( $p_file );
+ $c_file = db_prepare_string( $p_file );
$query = "SELECT id
FROM $g_phpWN_page_table
- WHERE page='$c_file'";
+ WHERE page='$c_file'
+ LIMIT 1";
+
$result = db_query( $query );
if ( db_num_rows( $result) > 0 ) {
return db_result( $result, 0, 0 );
}
- else {
- return '';
- }
+
+ return false;
}
### --------------------
function get_page_name( $p_id ) {
- global $g_hostname, $g_db_username, $g_db_password, $g_database_name,
- $g_phpWN_page_table;
+ global $g_phpWN_page_table;
- $c_id = (integer)$p_id;
+ $c_id = db_prepare_int( $p_id );
$query = "SELECT page
FROM $g_phpWN_page_table
- WHERE id='$c_id'";
+ WHERE id='$c_id'
+ LIMIT 1";
+
$result = db_query( $query );
if ( db_num_rows( $result) > 0 ) {
return db_result( $result, 0, 0 );
}
- else {
- return '';
- }
+
+ return false;
}
### --------------------
### Allows for path navigation to choose base dir
@@ -66,39 +66,35 @@
}
### --------------------
function add_file( $p_page_name ) {
+ if ( get_page_id( $p_page_name ) === false ) {
+ return 0;
+ }
+
global $g_phpWN_page_table;
- $c_page_name = string_safe( $p_page_name );
-
- $query = "SELECT COUNT(*)
- FROM $g_phpWN_page_table
- WHERE page='$c_page_name'";
- $result = db_query( $query );
- $count = db_result( $result, 0, 0 );
- if ( $count == 1 ) {
- return 0;
- }
+ $c_page_name = db_prepare_string( $p_page_name );
$query = "INSERT INTO
$g_phpWN_page_table
( id, date_indexed, page )
VALUES
- (null, NOW(), '$c_page_name' )";
+ ( null, NOW(), '$c_page_name' )";
$result = db_query( $query );
+
return $result;
}
### --------------------
- function index_files( $path='' ) {
+ function index_files( $p_path='', $p_recursive=true ) {
$dirs = array();
$files = array();
- $handle = opendir( $path );
+ $handle = opendir( $p_path );
while ( $file = readdir( $handle ) ) {
if ( ( $file == '.' ) || ( $file == '..' ) ) {
continue;
}
- if ( is_dir( $path . $file ) ) {
+ if ( is_dir( $p_path . $file ) ) {
$dirs[] = $file;
} else {
$files[] = $file;
@@ -109,13 +105,19 @@
sort( $files );
foreach ( $files as $file ) {
- if ( add_file( $path . $file ) ) {
- echo "$path$file<br />";
+ $t_filename = $p_path . $file;
+ if ( add_file( $t_filename ) ) {
+ echo "$t_filename<br />";
}
}
+ # if not recursive return before processing sub-directories
+ if ( !$p_recursive ) {
+ return;
+ }
+
foreach ( $dirs as $dir ) {
- index_files( $path . $dir . DIRECTORY_SEPARATOR );
+ index_files( $p_path . $dir . DIRECTORY_SEPARATOR );
}
}
### --------------------
|