Update of /cvsroot/webnotes/webnotes/core
In directory usw-pr-cvs1:/tmp/cvs-serv2218/core
Modified Files:
config_defaults_inc.php link_api.php user_api.php
Log Message:
more updates for user management
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/webnotes/webnotes/core/config_defaults_inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- config_defaults_inc.php 30 Sep 2002 01:32:14 -0000 1.9
+++ config_defaults_inc.php 1 Oct 2002 00:17:56 -0000 1.10
@@ -93,7 +93,7 @@
### Customize this file for the add message page
$g_note_add_include = 'note_add_msg_inc.php';
-
+
### Replace :) with icons [ON] or leave as text [OFF]
$g_enable_smileys = ON;
@@ -106,7 +106,7 @@
$g_header_color = '#bbddff';
####################################
- # CACHING / OPTIMISATION SETTINGS
+ # CACHING / OPTIMISATION SETTINGS
####################################
# minutes to wait before document is stale (in minutes)
@@ -123,9 +123,9 @@
########################
$g_auto_accept_notes = OFF;
-
+
################################
- # SECURITY AND AUTHENTICATION
+ # SECURITY AND AUTHENTICATION
################################
# AUTH_MD5, AUTH_CRYPT, AUTH_PLAIN
@@ -217,4 +217,4 @@
# status from $g_status_index-1 to 79 are used for the onboard customization (if enabled)
# directly use Mantis to edit them.
$g_access_levels_enum_string = '10:anonymous,40:registered,70:moderator,90:administrator';
-?>
+?>
\ No newline at end of file
Index: link_api.php
===================================================================
RCS file: /cvsroot/webnotes/webnotes/core/link_api.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- link_api.php 21 Sep 2002 02:44:33 -0000 1.6
+++ link_api.php 1 Oct 2002 00:17:57 -0000 1.7
@@ -13,7 +13,7 @@
###########################################################################
### --------------------
- function link_create( $p_url, $p_caption, $p_link_active, $p_prefix = '[ ', $p_suffix = ' ]' ) {
+ function link_create( $p_url, $p_caption, $p_link_active=true, $p_prefix = '[ ', $p_suffix = ' ]' ) {
if ( !empty( $p_url ) || (false === p_link_active) ) {
return "$p_prefix<a href=\"$p_url\">$p_caption</a>$p_suffix";
} else {
Index: user_api.php
===================================================================
RCS file: /cvsroot/webnotes/webnotes/core/user_api.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- user_api.php 30 Sep 2002 02:34:34 -0000 1.11
+++ user_api.php 1 Oct 2002 00:17:57 -0000 1.12
@@ -28,9 +28,9 @@
$p_access_level = REGISTERED; # @@@@ Move to config.
}
- $c_username = db_prepare_string( $p_username );
- $c_email = db_prepare_string( $p_email );
- $c_encrypted_password = db_prepare_string( access_encrypt_password( $p_password ) );
+ $c_username = db_prepare_string( $p_username );
+ $c_email = db_prepare_string( $p_email );
+ $c_encrypted_password = db_prepare_string( access_encrypt_password( $p_password ) );
$t_seed = $p_email . $p_username;
$t_cookie_string = create_cookie_string( $t_seed );
@@ -151,7 +151,7 @@
return db_fetch_array( $result );
}
### --------------------
- # $p_where is constructed using user_where_*().
+ # $p_where is constructed using user_where_*().
function user_change_password( $p_where, $p_old_password, $p_new_password, $p_verify_password = null ) {
$t_user = user_get_info( $p_where );
if ( false === $t_user ) {
@@ -181,4 +181,38 @@
return true;
}
+ ### --------------------
+ # we assume that the password has been checked for accuracy
+ # we assume that the enabled value is 0 or 1
+ function user_update( $p_user_id, $p_email, $p_password, $p_access_level, $p_enabled ) {
+ global $g_phpWN_user_table;
+
+ if ( empty( $p_password ) ) {
+ $t_user_row = user_get_row( $p_user_id );
+ $c_password = $t_user_row['password'];
+ } else {
+ $c_password = db_prepare_string( access_encrypt_password( $p_password ) );
+ }
+
+ $c_email = db_prepare_string( $p_email );
+ $c_access_level = db_prepare_string( $p_access_level );
+ $c_enabled = db_prepare_string( $p_enabled );
+
+ $query = "UPDATE $g_phpWN_user_table
+ SET email='$c_email',
+ password='$c_password',
+ access_level='$c_access_level',
+ enabled='$p_enabled'
+ WHERE id='$c_enabled'";
+ return db_query( $query );
+ }
+ ### --------------------
+ function user_delete( $p_user_id ) {
+ global $g_phpWN_user_table;
+
+ $query = "DELETE FROM $g_phpWN_user_table
+ WHERE id='$p_user_id'";
+ return db_query( $query );
+ }
+ ### --------------------
?>
|