Example #1
0
 * GNU General Public License contained in the file GNU.txt for
 * more details.
 */
/**
 * $Id$
 */
# Ensure this file is being included by a parent file
defined('_RGDS_VALID') or die('Direct access to this file is not allowed.');
# process expected get/post variables
$g_indiv = isset($_GET['id']) ? $_GET['id'] : exit;
# get first person information
$o = new person($g_indiv);
$smarty->assign('indiv', $o);
# populate keyword array
keyword_push(gtc("Comments"));
keyword_push($o->full_name());
# assign other smarty variables
$smarty->assign('page_title', sprintf(gtc("Comments for %s"), $o->full_name()));
$smarty->assign('surname_title', sprintf(gtc("%s Surname"), $o->sname));
$content_title = $o->prefix . ' ' . $o->full_name();
if ($o->suffix) {
    $content_title .= ', ' . $o->suffix;
}
$smarty->assign('content_title', $content_title);
# grab all the comments
$comments = get_visible_comments($g_indiv);
for ($i = 0; $i < count($comments); $i++) {
    $comments[$i]['comment'] = stripslashes($comments[$i]['comment']);
    $comments[$i]['comment'] = rgds_parse_links($comments[$i]['comment']);
}
$smarty->assign('COMMENTS', $comments);
Example #2
0
$smarty->assign('indiv', $o);
# populate keyword array
keyword_push(gtc("Comments"));
keyword_push($o->full_name());
# assign other smarty variables
$smarty->assign('page_title', sprintf(gtc("Comments for %s"), $o->full_name()));
$smarty->assign('surname_title', sprintf(gtc("%s Surname"), $o->sname));
$content_title = $o->prefix . ' ' . $o->full_name();
if ($o->suffix) {
    $content_title .= ', ' . $o->suffix;
}
$smarty->assign('content_title', $content_title);
# If the form has been posted then let's validate the form variables
if (!empty($_POST)) {
    if (empty($_POST['email'])) {
        $form_errors['email'] = gtc("YOU MUST ENTER AN EMAIL ADDRESS");
    } elseif (!rgds_is_email(trim($_POST['email']))) {
        $form_errors['email'] = gtc("THE EMAIL ADDRESS YOU ENTERED IS NOT VALID");
    }
    if (empty($_POST['comment'])) {
        $form_errors['comment'] = gtc("PLEASE ENTER SOME TEXT");
    }
    $smarty->assign('form_errors', $form_errors);
    # The form validated ok, so now save the data
    if (!$form_errors) {
        insert_comment($g_indiv, $_POST['email'], $_POST['comment']);
        $comment_preview = rgds_parse_links($_POST['comment']);
        $smarty->assign('comment_preview', $comment_preview);
        $smarty->assign('SAVED', 1);
    }
}