post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
echo(get_the_password_form());
} else {
if($_POST['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:$background_color;";
}
if($inapall['paginate_mode'] != 0){
inap_paginate();
}else{
$pages[0] = $post->post_content;
}
// we remove the filter so the function doesn't call itself
if($inapall['simple_posts'] == 1){
remove_filter('the_content', 'inap_post',1);
remove_filter('the_excerpt', 'inap_post',1);
}
$link_hide = stripslashes(htmlentities($_POST['link_hide']));
if(count($pages)>2 || (count($pages) > 1 && $inapall['strip_excerpt'] == 1)){
$i = 1;
foreach($pages as $page){
$page = preg_replace("/\n*\n*/",'',$page);
echo '
';
echo apply_filters('the_content',$page);
echo '
';
$i++;
}
}else{
foreach($pages as $page){
echo apply_filters('the_content',$page);
}
}
}elseif($_POST['type'] == "paged"){
if($_POST['what'] == "single"){
$id = (int) $_POST['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) $_POST['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($_POST['type'] == "comments"){
include ("inap-comments.php");
}elseif($_POST['type'] == "addcomment"){?>
comment_status) {
include ("inap-add-comments.php");
}
}elseif($_POST['type'] == "submit_form"){
nocache_headers();
$comment_post_ID = (int) $_POST['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($_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
$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_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');
?>