# This program is distributed under the terms and conditions of the GPL
# See the files README and LICENSE for details
# --------------------------------------------------------
# $Id: note_add.php,v 1.20 2003/09/13 06:59:30 vboctor Exp $
# --------------------------------------------------------
require_once 'core' . DIRECTORY_SEPARATOR . 'api.php';
access_ensure_check_action(ACTION_NOTES_SUBMIT);
$f_page_id = gpc_get_int('f_page_id');
$f_note_id = gpc_get_int('f_note_id');
$f_email = stripslashes(gpc_get_string('f_email'));
$f_note = stripslashes(gpc_get_string('f_note'));
### insert note
if (0 == $f_note_id) {
    $result = note_add($f_page_id, $f_email, $REMOTE_ADDR, $f_note);
    if ($result !== false) {
        email_note_added($result);
    }
} else {
    $result = note_update($f_note_id, $f_email, $f_note);
    email_note_updated($f_note_id);
}
$t_page_info = page_get_info(page_where_id_equals($f_page_id));
if (false === $t_page_info) {
    echo "page not found";
    exit;
}
$t_url = $t_page_info['url'];
print_html_top();
print_head_top();
print_title($g_window_title);
print_css($g_css_inc_file);
function email_note_updated($p_note_id)
{
    email_note_added($p_note_id);
}