From: <vb...@us...> - 2003-09-12 10:58:20
|
Update of /cvsroot/webnotes/webnotes/core In directory sc8-pr-cvs1:/tmp/cvs-serv19810/core Modified Files: database_api.php email_api.php note_api.php Log Message: M note_add.php - Call the email notification function. M core/database_api.php - Added support for getting the id of the inserted record. M core/email_api.php - Email sending function. M core/note_api.php - Change note_add() to return the id of the inserted record. Index: database_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/database_api.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- database_api.php 11 Sep 2002 09:49:54 -0000 1.3 +++ database_api.php 12 Sep 2003 10:58:16 -0000 1.4 @@ -79,6 +79,15 @@ return false; } } + # -------------------- + # return the last inserted id + function db_insert_id() { + if ( mysql_affected_rows() > 0 ) { + return mysql_insert_id(); + } else { + return false; + } + } ### -------------------- function db_close() { $t_result = mysql_close(); Index: email_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/email_api.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- email_api.php 12 Sep 2003 06:56:27 -0000 1.6 +++ email_api.php 12 Sep 2003 10:58:16 -0000 1.7 @@ -33,7 +33,8 @@ # this function sends the actual email function email_send( $p_recipient, $p_subject, $p_message, $p_header='' ) { global $g_from_email, $g_enable_email_notification, - $g_return_path_email, $g_use_x_priority; + $g_return_path_email, $g_use_x_priority, + $g_phpWebNotes_version; # short-circuit if no emails should be sent if ( OFF == $g_enable_email_notification ) { @@ -94,26 +95,26 @@ } extract( $note, EXTR_PREFIX_ALL, 'note' ); - $page = page_get_info( page_where_id_equals( $v_page_id ) ); + $page = page_get_info( page_where_id_equals( $note_page_id ) ); if ( $page === false ) { return false; } extract( $page, EXTR_PREFIX_ALL, 'page' ); - $subject = '[$page_page] $note_email'; + $subject = "[$page_page] $note_email"; $content = ''; - $content .= str_pad( '', 70, '=' ); - $content .= $page_url; - $content .= str_pad( '', 70, '-' ); + $content .= str_pad( '', 70, '=' ) . "\n"; + $content .= 'http://' . $_SERVER['SERVER_ADDR'] . $page_url . "\n"; + $content .= str_pad( '', 70, '-' ) . "\n"; $content .= "Note Id: $note_id\n"; $content .= "Email: $note_email\n"; $content .= "IP: $note_ip\n"; $content .= "Date Submitted: " . date( 'd-M-Y', $note_date_submitted ) . "\n"; - $content .= "Visible: " . ( $note_visible ? "Yes" : "No" ); - $content .= str_pad( '', 70, '-' ); - $content .= $v_note_note; - $content .= str_pad( '', 70, '=' ); + $content .= "Visible: " . ( $note_visible ? "Yes" : "No" ) . "\n"; + $content .= str_pad( '', 70, '-' ) . "\n"; + $content .= $note_note . "\n"; + $content .= str_pad( '', 70, '=' ) . "\n"; return true; } Index: note_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/note_api.php,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- note_api.php 3 Oct 2002 05:26:31 -0000 1.30 +++ note_api.php 12 Sep 2003 10:58:16 -0000 1.31 @@ -77,6 +77,7 @@ VALUES ( null, $c_page_id, '$c_email', '$c_remote_address', NOW(), '$c_note', $t_visible )"; $result = db_query( $query ); + $result = db_insert_id(); page_touch( $p_page_id ); |