post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
echo get_the_password_form();
} else {
if($_REQUEST['type'] == "content"){
if($inapall['use_fade'] == 1){
//this is for IE support only. Everybody Boooooooo IE
//It's not like they could make it easy for us...
$style = "zoom:1; background-color:$inapall[background_color];";
}
$content = $post->post_content;
inap_paginate();
// we remove the filter so the function doesn't call itself
if($inapall['simple_posts'] == 1){
remove_filter('the_content', 'inap_content_filter',-10);
add_filter('the_content','inap_break_content',99999);
}
if($_REQUEST['extra'] == 'embed'){
$output .= '
';
$output .= '
';
if(count($pages) > 1){
unset($pages[0]);}
$pages[0] = implode(' ',$pages);
$output .= '';
$output .= "\n".chr(13)."\n".$pages[0]."\n".chr(13)."\n";
$output .= '
';
}else{
$output .= '';
$output .= "\n".chr(13)."\n".$pages[0]."\n".chr(13)."\n";
$output .= '
';
unset($pages[0]);
$i = 2;
foreach($pages as $page){
$page = preg_replace("/\n*\n*/",'',$page);
$output .= '';
$output .= "\n".chr(13)."\n".$page."\n".chr(13)."\n";
$output .= '
';
$i++;
}
}
echo apply_filters('the_content',$output.'@$%@$$%##$%#$%#$');
// For compatibility with Statraq
global $p;
$p=$id;
//For compatibility with WP-PostViews
if(function_exists('process_postviews') && !is_page() && !is_single()) {
inap_process_postviews();
}
}elseif($_REQUEST['type'] == "paged"){
if($_REQUEST['what'] == "single"){
$id = (int) $_REQUEST['pagenum'];
unset($GLOBALS['wp_query']);
$GLOBALS['wp_query'] =& new WP_Query();
$GLOBALS['wp_query']->query('p='.$id);
$site_menu = file_get_contents(TEMPLATEPATH . '/single.php',1);
preg_match('@([\S\s]*)@',$site_menu,$match);
eval("?>$match[0]");
}else{
ob_start();
global $paged;
$paged = (int) $_REQUEST['pagenum'];
if($paged){
unset($GLOBALS['wp_query']);
$GLOBALS['wp_query'] =& new WP_Query();
$GLOBALS['wp_query']->query('paged='.$paged);
include(TEMPLATEPATH . '/index.php');
}
$buffer = ob_get_contents();
ob_end_clean();
//echo $buffer;
preg_match('@([\S\s]*)@',$buffer,$match);
echo str_replace('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'] ,get_settings('siteurl'),$match[0]);
}
}elseif($_REQUEST['type'] == "comments"){
include ("inap-comments.php");
}elseif($_REQUEST['type'] == "addcomment"){
// this line is WordPress' motor, do not delete it.
$comment_author = (isset($_COOKIE['comment_author_' . COOKIEHASH])) ? trim($_COOKIE['comment_author_'. COOKIEHASH]) : '';
$comment_author_email = (isset($_COOKIE['comment_author_email_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_email_'. COOKIEHASH]) : '';
$comment_author_url = (isset($_COOKIE['comment_author_url_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_url_'. COOKIEHASH]) : '';
echo '
';
if ('open' == $post->comment_status) {
if (! is_user_logged_in() && get_option('comment_registration')){
$link = '' . __('Login') . '';
if ( get_option('users_can_register') )
$link .= ' or ' . __('Register') . '';
die( __('Sorry, you must '.$link.' to post a comment.'));
}
include ("inap-add-comments.php");
}
}elseif($_REQUEST['type'] == "submit_form"){
inap_get_info_submit_form();
}
}
function inap_get_info_submit_form(){
global $wpdb, $post,$id,$inapall;
nocache_headers();
$comment_post_ID = (int) $_REQUEST['comment_post_ID'];
$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
if ( empty($status->comment_status) ) {
do_action('comment_id_not_found', $comment_post_ID);
exit;
} elseif ( 'closed' == $status->comment_status ) {
do_action('comment_closed', $comment_post_ID);
wp_die( __('Sorry, comments are closed for this item.') );
} elseif ( 'draft' == $status->post_status ) {
do_action('comment_on_draft', $comment_post_ID);
exit;
}
$comment_author = trim($_REQUEST['author']);
$comment_author_email = trim($_REQUEST['email']);
$comment_author_url = trim($_REQUEST['url']);
$comment_content = trim($_REQUEST['comment']);
$comment_parent = trim($_REQUEST['comment_post_parent']);
// If the user is logged in
$user = wp_get_current_user();
if ( $user->ID ) :
$comment_author = $wpdb->escape($user->display_name);
$comment_author_email = $wpdb->escape($user->user_email);
$comment_author_url = $wpdb->escape($user->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.') );
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID','comment_parent');
$comment_id = wp_new_comment( $commentdata );
if ( !$user->ID ) :
$comment = get_comment($comment_id);
setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
endif;
_e('Comment submitted','inap');
}
?>