".obt_translate("Share this post")."\n"; echo "
\n"; echo "
\n"; $obt_total_comments = $obt_total_trackbacks = 0; $obt_comments = $obt_trackbacks = array(); $obt_comment_where = "comment_post_ID = '{$post->ID}' AND "; IF ($obt_can_moderate_comments) $obt_comment_where .= "comment_approved = '1'"; ELSEIF ($user_ID) $obt_comment_where .= "(comment_approved = '1' OR (user_id = '{$user_ID}' AND comment_approved = '0'))"; ELSEIF (strlen($comment_author)) $obt_comment_where .= "(comment_approved = '1' OR (comment_author_email = '".$wpdb->escape($comment_author_email)."' AND comment_approved = '0'))"; ELSE $obt_comment_where .= "comment_approved = '1'"; flush(); IF (is_single() || is_page()){ $obt_comments_query_order = ($obt_comments_order == "newer")? " DESC" : ""; IF ($obt_comments_per_page > 0){ $obt_total_comments = $wpdb->get_var("SELECT COUNT(comment_post_ID) AS total_comments FROM {$wpdb->comments} WHERE {$obt_comment_where} AND comment_type IN ('','comment')"); $obt_comments_total_pages = ceil($obt_total_comments / $obt_comments_per_page); IF ($obt_comments_this_page <= $obt_comments_total_pages){ $obt_comments_uncomplete_first_page = ($obt_comments_order == "newer" && !$obt_comments_post_full); $obt_comments_first_comments = $obt_total_comments % $obt_comments_per_page; IF ($obt_comments_this_page < 1) $obt_comments_this_page = ($obt_comments_order == "newer")? $obt_comments_total_pages : 1; $obt_comments_query_length = $obt_comments_per_page; $obt_comments_start = ($obt_comments_order == "newer")? ($obt_comments_total_pages - $obt_comments_this_page) * $obt_comments_query_length: ($obt_comments_this_page - 1) * $obt_comments_query_length; IF ($obt_comments_uncomplete_first_page && $obt_comments_first_comments > 0){ IF ($obt_comments_this_page == $obt_comments_total_pages){ $obt_comments_start = 0; $obt_comments_query_length = $obt_comments_first_comments; }ELSE $obt_comments_start = $obt_total_comments - ($obt_comments_this_page * $obt_comments_query_length); }; $obt_comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE {$obt_comment_where} AND comment_type IN ('','comment') ORDER BY comment_date_gmt{$obt_comments_query_order} LIMIT {$obt_comments_start},{$obt_comments_query_length}"); }; $obt_trackbacks = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE {$obt_comment_where} AND comment_type NOT IN ('','comment') ORDER BY comment_date_gmt"); $obt_total_trackbacks = count($obt_trackbacks); }ELSE{ $obt_comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE {$obt_comment_where} AND comment_type IN ('','comment') ORDER BY comment_date_gmt{$obt_comments_query_order}"); $obt_total_comments = count($obt_comments); $obt_trackbacks = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE {$obt_comment_where} AND comment_type NOT IN ('','comment') ORDER BY comment_date_gmt"); $obt_total_trackbacks = count($obt_trackbacks); }; }ELSE{ IF ($obt_check_trackbacks){ $obt_total_comments = $wpdb->get_var("SELECT COUNT(comment_post_ID) AS total_comments FROM {$wpdb->comments} WHERE {$obt_comment_where} AND comment_type IN ('','comment')"); $obt_trackbacks = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE {$obt_comment_where} AND comment_type NOT IN ('','comment')"); $obt_total_trackbacks = count($obt_trackbacks); }ELSE{ $obt_comments = $wpdb->get_results("SELECT comment_type IN ('','comment') AS comment_type, COUNT(*) as comment_count FROM {$wpdb->comments} WHERE {$obt_comment_where} GROUP BY comment_type"); IF (is_array($obt_comments)) FOREACH ($obt_comments as $obt_comment){ IF ($obt_comment->comment_type == 1) $obt_total_comments = $obt_comment->comment_count; IF ($obt_comment->comment_type == 0) $obt_total_trackbacks = $obt_comment->comment_count; }; }; }; IF (!is_array($obt_comments)) $obt_comments = array(); IF (!is_array($obt_trackbacks)) $obt_trackbacks = array(); IF ($obt_check_trackbacks){ $obt_social_urls = array(); FOREACH ($obt_trackbacks as $obt_trackback){ $obt_domain = parse_url($obt_trackback->comment_author_url); $obt_domain = $obt_domain["host"]; IF ($obt_social_domains[$obt_domain]) IF (!$obt_social_urls[$obt_social_domains[$obt_domain]]) $obt_social_urls[$obt_social_domains[$obt_domain]] = $obt_trackback->comment_author_url; }; }; $wpdb->comment_count = $obt_total_comments; IF ($obt_pending_comments && $obt_comments) $obt_comments = array_merge($obt_pending_comments,$obt_comments); ELSEIF ($obt_pending_comments) $obt_comments = $obt_pending_comments; unset($obt_pending_comments); echo "
ID}\">
\n"; echo "\n"; echo "
ID}\">\n"; echo "

".obt_translate("In order to send this post to a friend, enter his/her email and also your data").":

\n"; include(TEMPLATEPATH."/send-form.php"); echo "
\n"; echo "\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "
\n"; echo "
\n"; echo "
\n"; include(TEMPLATEPATH."/ads/after-post-share-buttons.php"); ?>