Esempio n. 1
0
function delete_comments($comment_ids)
{
    global $site_db, $lang;
    if (empty($comment_ids)) {
        echo $lang['no_search_results'];
        return false;
    }
    $error_log = array();
    echo "<br />";
    $sql = "SELECT comment_id, image_id, user_id, user_name, comment_headline\n          FROM " . COMMENTS_TABLE . "\n          WHERE comment_id IN ({$comment_ids})";
    $comment_result = $site_db->query($sql);
    while ($comment_row = $site_db->fetch_array($comment_result)) {
        $sql = "DELETE FROM " . COMMENTS_TABLE . "\n          WHERE comment_id = " . $comment_row['comment_id'];
        $del_comment = $site_db->query($sql);
        if ($del_comment) {
            update_comment_count($comment_row['image_id'], $comment_row['user_id']);
            echo "<b>" . $lang['comment_delete_success'] . ":</b> " . format_text($comment_row['comment_headline'], 2) . " (" . $lang['user'] . ": " . format_text($comment_row['user_name'], 2) . ")<br />\n";
        } else {
            $error_log[] = "<b>" . $lang['comment_delete_error'] . ":</b> " . format_text($comment_row['comment_headline'], 2) . " (" . $lang['user'] . ": " . format_text($comment_row['user_name'], 2) . ")";
        }
        echo "<br />\n";
    }
    return $error_log;
}
Esempio n. 2
0
            $msg .= ($msg != "" ? "<br />" : "") . $lang['headline_required'];
            $error = 1;
        }
        if ($comment_text == "") {
            $msg .= ($msg != "" ? "<br />" : "") . $lang['comment_required'];
            $error = 1;
        }
        if ($captcha_enable_comments && !captcha_validate($captcha)) {
            $msg .= ($msg != "" ? "<br />" : "") . $lang['captcha_required'];
            $error = 1;
        }
        if (!$error) {
            $sql = "INSERT INTO " . COMMENTS_TABLE . "\n              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)\n              VALUES\n              ({$id}, " . $user_info['user_id'] . ", '{$user_name}', '{$comment_headline}', '{$comment_text}', '" . $session_info['session_ip'] . "', " . time() . ")";
            $site_db->query($sql);
            $commentid = $site_db->get_insert_id();
            update_comment_count($id, $user_info['user_id']);
            $msg = $lang['comment_success'];
            $site_sess->set_session_var("msgdetails", $msg);
            redirect(ROOT_PATH . "details.php?" . URL_IMAGE_ID . "=" . $image_id . (!empty($mode) ? "&mode=" . $mode : "") . ($page > 1 ? "&page=" . $page : ""));
        }
    }
    unset($row);
    unset($spam_row);
}
//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
if ($msgdetails = $site_sess->get_session_var("msgdetails")) {
    $msg .= ($msg !== "" ? "<br />" : "") . $msgdetails;
    unset($msgdetails);
    $site_sess->drop_session_var("msgdetails");
Esempio n. 3
0
 }
 if (empty($error)) {
     $additional_sql = "";
     if (!empty($additional_image_fields)) {
         $table_fields = $site_db->get_table_fields(IMAGES_TABLE);
         foreach ($additional_image_fields as $key => $val) {
             if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
                 $additional_sql .= ", {$key} = '" . un_htmlspecialchars(trim($HTTP_POST_VARS[$key])) . "'";
             }
         }
     }
     $sql = "UPDATE " . IMAGES_TABLE . "\n            SET cat_id = {$cat_id}, user_id = {$user_id}, image_name = '{$image_name}', image_description = '{$image_description}', image_keywords = '{$image_keywords}', image_date = {$image_date}, image_active = {$image_active}, image_media_file = '{$new_name}', image_thumb_file = '{$new_thumb_name}', image_download_url = '{$image_download_url}', image_allow_comments = {$image_allow_comments}, image_downloads = {$image_downloads}, image_votes = {$image_votes}, image_rating = '{$image_rating}', image_hits = {$image_hits}" . $additional_sql . "\n            WHERE image_id = {$image_id}";
     $result = $site_db->query($sql);
     @unlink(MEDIA_PATH . "/" . $old_cat_id . "/" . $old_file_name . ".bak");
     @unlink(THUMB_PATH . "/" . $old_cat_id . "/" . $old_thumb_file_name . ".bak");
     update_comment_count($image_id);
     if ($result) {
         $search_words = array();
         foreach ($search_match_fields as $image_column => $match_column) {
             if (isset($HTTP_POST_VARS[$image_column])) {
                 $search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column]);
             }
         }
         remove_searchwords($image_id);
         add_searchwords($image_id, $search_words);
         $msg = $lang['image_edit_success'];
     } else {
         $msg = $lang['image_edit_error'];
     }
 } else {
     $msg = sprintf("<span class=\"marktext\">%s</span>", $lang['lostfield_error']);