Example #1
0
    }
}
$creator_uid = links_get_creator_uid($lid);
$user_perm_links_moderate = session::check_perm(USER_PERM_LINKS_MODERATE, 0);
if (!($link = links_get_single($lid, !$user_perm_links_moderate))) {
    html_draw_error(gettext("Invalid link ID!"));
}
if (isset($_POST['cancel'])) {
    header_redirect("links.php?webtag={$webtag}");
    exit;
}
if (session::logged_in()) {
    $valid = true;
    if (isset($_POST['addvote'])) {
        if (isset($_POST['vote']) && is_numeric($_POST['vote'])) {
            links_vote($lid, $_POST['vote'], $_SESSION['UID']);
            $success_msg = gettext("Your vote has been recorded");
        } else {
            $error_msg_array[] = gettext("You must choose a rating!");
            $valid = false;
        }
    } else {
        if (isset($_POST['clearvote'])) {
            links_clear_vote($lid, $_SESSION['UID']);
            $success_msg = gettext("Your vote has been cleared");
        }
    }
    if (isset($_POST['addcomment'])) {
        if (isset($_POST['comment']) && strlen(trim($_POST['comment'])) > 0) {
            $comment = trim($_POST['comment']);
            links_add_comment($lid, $_SESSION['UID'], $comment);
Example #2
0
$creator_uid = links_get_creator_uid($lid);
$user_perm_links_moderate = session::check_perm(USER_PERM_LINKS_MODERATE, 0);
if (!($link = links_get_single($lid, !$user_perm_links_moderate))) {
    html_draw_error(gettext("Invalid link ID!"));
}
$error_msg_array = array();
$success_msg = "";
if (isset($_POST['cancel'])) {
    header_redirect("links.php?webtag={$webtag}");
    exit;
}
if (session::logged_in()) {
    $valid = true;
    if (isset($_POST['addvote'])) {
        if (isset($_POST['vote']) && is_numeric($_POST['vote'])) {
            links_vote($lid, $_POST['vote'], $uid);
            $success_msg = gettext("Your vote has been recorded");
        } else {
            $error_msg_array[] = gettext("You must choose a rating!");
            $valid = false;
        }
    } else {
        if (isset($_POST['clearvote'])) {
            links_clear_vote($lid, $uid);
            $success_msg = gettext("Your vote has been cleared");
        }
    }
    if (isset($_POST['addcomment'])) {
        if (isset($_POST['comment']) && strlen(trim($_POST['comment'])) > 0) {
            $comment = trim($_POST['comment']);
            links_add_comment($lid, $uid, $comment);