$v) { $_POST[$k] = urldecode($v); } $comment_post_ID = (int) $_POST['comment_post_ID']; $zhuangb_ID = (int) $_POST['zhuangb_ID']; if (empty ($zhuangb_ID)) wp_die('Sorry,you must be have a zhuangBID.'); $post_status = $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'"); if (empty ($post_status)) { do_action('comment_id_not_found', $comment_post_ID); wp_die('The post you are trying to comment on does not curently exist in the database.'); } elseif ('closed' == $post_status) { do_action('comment_closed', $comment_post_ID); wp_die(__('Sorry, comments are closed for this item.')); } $comment_author = trim($_POST['author']); $comment_author_email = trim($_POST['email']); $comment_author_url = trim($_POST['url']); $comment_content = trim($_POST['comment']); // If the user is logged in get_currentuserinfo(); if ($user_ID) : $comment_author = addslashes($user_identity); $comment_author_email = addslashes($user_email); $comment_author_url = addslashes($user_url); else : if (get_option('comment_registration')) wp_die(__('Sorry, you must be logged in to post a comment.')); endif; $comment_type = ''; if (get_settings('require_name_email') && !$user_ID) { if (6 > strlen($comment_author_email) || '' == $comment_author) wp_die(__('Error: please fill the required fields (name, email).')); elseif (!is_email($comment_author_email)) wp_die(__('Error: please enter a valid email address.')); } if ('' == $comment_content) wp_die(__('Error: please type a comment.')); $comment_content = "
This comment in post-".$comment_post_ID."-".$zhuangb_ID."
".$comment_content; $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID'); //insert comment $zhuangb_new_comment_ID = wp_new_comment($commentdata); if (!$user_ID) : setcookie('comment_author_' . COOKIEHASH, stripslashes($comment_author), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); setcookie('comment_author_email_' . COOKIEHASH, stripslashes($comment_author_email), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); setcookie('comment_author_url_' . COOKIEHASH, stripslashes($comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); endif; if (!empty ($zhuangb_new_comment_ID)) { wp_insert_zhuangb($zhuangb_new_comment_ID, $zhuangb_ID, $comment_post_ID, $table_prefix); } } /* insert table zhuangb_comments */ function wp_insert_zhuangb($zhuangb_new_comment_ID, $zhuangb_ID, $comment_post_ID, $wptable) { global $wpdb; $query = "INSERT INTO " . $wptable . "zhuangb_comments (commentid, postid, zhuangbid) VALUES (" . $zhuangb_new_comment_ID . ", " . $comment_post_ID . ", " . $zhuangb_ID . ")"; $wpdb->query($query); } ?> "; } else { echo "
"; } ?>
get_var($sqlcount); $relax_comment_count = 1; echo "

  Comment List:

"; echo "
    "; echo ""; if ($zhuangbcount == 0) { echo "
  1. "; echo "
    0_0
    "; $randNum = rand(0, 14); if (@ file_exists(TEMPLATEPATH . '/comments-ajax-zhuangb.php')) { echo zhuangb_get_avatar($zhuangb_list_email, 40, $default = get_stylesheet_directory_uri() . '/nomail/nomail' . $randNum . '.gif'); } else { echo zhuangb_get_avatar($zhuangb_list_email, 40, $default = WP_PLUGIN_URL . '/zhuangb/nomail/nomail' . $randNum . '.gif'); } echo "Admin"; echo "No Comment"; echo "
    "; echo "No comments at the moment~"; echo "
    "; echo "
  2. "; } else { $content = $wpdb->get_results($sql); global $comment; foreach ($content as $comment) : $liclass = "
  3. comment_author_email == $zhuangb_list_email) { $liclass = "
  4. comment_post_ID . "-" . $comment->comment_ID; echo " id=\"zhuangb-" . $zhuangbPCId . "\">"; $countclass = "
    "; if ($comment->comment_author_email == $zhuangb_list_email) { $countclass = "
    "; } echo $countclass; echo $relax_comment_count; echo "
    "; $randNum = rand(0, 14); if (@ file_exists(TEMPLATEPATH . '/comments-ajax-zhuangb.php')) { echo zhuangb_get_avatar($comment->comment_author_email, 40, $default = get_stylesheet_directory_uri() . '/nomail/nomail' . $randNum . '.gif'); } else { echo zhuangb_get_avatar($comment->comment_author_email, 40, $default = WP_PLUGIN_URL . '/zhuangb/nomail/nomail' . $randNum . '.gif'); } echo ""; if (empty ($comment->comment_author_url)) { echo $comment->comment_author; } else { echo "comment_author_url . "\">" . $comment->comment_author . ""; } echo ""; echo ""; $zhuangbdata = ($comment->comment_date) . " : " . $zhuangbPCId; echo $zhuangbdata; echo ""; echo "
    "; $apply_filters_comment_text = apply_filters('comment_text', $comment->comment_content); if (empty ($apply_filters_comment_text)) $apply_filters_comment_text = $comment->comment_content; echo zhuangb_comment_callback($apply_filters_comment_text); echo "
    "; $relax_comment_count++; echo "
  5. "; endforeach; } echo "
"; } /* get gravatar */ function zhuangb_get_avatar($email, $size = '40', $default = '') { if (!is_numeric($size)) $size = '40'; if (empty ($email)) $default = "http://www.gravatar.com/avatar/?d=$default&s={$size}"; if (!empty ($email)) { $out = 'http://www.gravatar.com/avatar/'; $out .= md5(strtolower($email)); $out .= '?s=' . $size; $out .= '&d=' . urlencode($default); $avatar = ""; } else { $avatar = ""; } return $avatar; } function fail($s) { header('HTTP/1.0 500 Internal Server Error'); echo $s; exit; } function zhuangb_comment_callback($content) { preg_match_all("/(.+)<\/em\><\/b\><\/p\><\/blockquote\>/siU", $content, $results, PREG_SET_ORDER); if ($results) { foreach ($results as $item) { $content = str_replace($item[0], "", $content); } } return $content; } function wp_zhuangb_delete($table_prefix) { global $wpdb; $zhuangb_delete_sql = "DELETE FROM `".$table_prefix."zhuangb_comments` WHERE `".$table_prefix."zhuangb_comments`.`commentid` not in (SELECT `comment_ID` FROM `".$table_prefix."comments`)"; $zhuangb_delete_back = $wpdb->query($zhuangb_delete_sql); echo ("DELETE ROWS:

".$zhuangb_delete_back."

DELETE COMPLETE."); } ?>