From: <vb...@us...> - 2002-10-03 05:26:33
|
Update of /cvsroot/webnotes/webnotes/core In directory usw-pr-cvs1:/tmp/cvs-serv8655/core Modified Files: note_api.php Log Message: - Fixed 0000064: Email / Note should be mandatory. Index: note_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/note_api.php,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- note_api.php 26 Sep 2002 06:55:05 -0000 1.29 +++ note_api.php 3 Oct 2002 05:26:31 -0000 1.30 @@ -57,6 +57,8 @@ } ### -------------------- function note_add( $p_page_id, $p_email, $p_remote_addr, $p_note ) { + note_ensure_mandatory_fields( $p_email, $p_note ); + if ( ON == config_get('auto_accept_notes') ) { $t_visible = NOTE_VISIBLE_ACCEPTED; } else { @@ -137,7 +139,24 @@ $result = db_query( $query ); } ### -------------------- + function note_ensure_mandatory_fields( $p_email, $p_note ) { + if ( trim( $p_email ) == '' ) + { + echo sprintf( 'Mandatory field "%s" missing.', 'email'); + exit; + } + + if ( trim( $p_note ) == '' ) + { + echo sprintf( 'Mandatory field "%s" missing.', 'note'); + exit; + } + + } + ### -------------------- function note_update( $p_id, $p_email, $p_note ) { + note_ensure_mandatory_fields( $p_email, $p_note ); + $c_id = db_prepare_int( $p_id ); $c_email = db_prepare_string( $p_email ); $c_note = db_prepare_string( $p_note ); |