Пример #1
0
                    if ($perform_redirect) {
                        redirect($url_self);
                    }
                    unset($_POST['content']);
                } else {
                    $edit_comment = $_GET['comment_to_edit'];
                }
            }
            break;
        case 'delete_comment':
            check_pwg_token();
            include_once GUESTBOOK_PATH . 'include/functions_comment.inc.php';
            check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID);
            $author_id = get_comment_author_id_guestbook($_GET['comment_to_delete']);
            if (can_manage_comment('delete', $author_id)) {
                delete_user_comment_guestbook($_GET['comment_to_delete']);
            }
            redirect($url_self);
        case 'validate_comment':
            check_pwg_token();
            include_once GUESTBOOK_PATH . 'include/functions_comment.inc.php';
            check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID);
            $author_id = get_comment_author_id_guestbook($_GET['comment_to_validate']);
            if (can_manage_comment('validate', $author_id)) {
                validate_user_comment_guestbook($_GET['comment_to_validate']);
            }
            redirect($url_self);
    }
}
// +-----------------------------------------------------------------------+
// |                                add comment                            |
Пример #2
0
include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
// +-----------------------------------------------------------------------+
// |                                actions                                |
// +-----------------------------------------------------------------------+
if (!empty($_POST)) {
    if (empty($_POST['comments'])) {
        $page['errors'][] = l10n('Select at least one comment');
    } else {
        include_once GUESTBOOK_PATH . 'include/functions_comment.inc.php';
        check_input_parameter('comments', $_POST, true, PATTERN_ID);
        if (isset($_POST['validate'])) {
            validate_user_comment_guestbook($_POST['comments']);
            $page['infos'][] = l10n_dec('%d user comment validated', '%d user comments validated', count($_POST['comments']));
        }
        if (isset($_POST['reject'])) {
            delete_user_comment_guestbook($_POST['comments']);
            $page['infos'][] = l10n_dec('%d user comment rejected', '%d user comments rejected', count($_POST['comments']));
        }
    }
}
// +-----------------------------------------------------------------------+
// |                           comments display                            |
// +-----------------------------------------------------------------------+
include GUESTBOOK_PATH . 'include/functions.inc.php';
$list = array();
$query = '
SELECT 
    c.id, 
    c.date, 
    c.author, 
    ' . $conf['user_fields']['username'] . ' AS username,