*** postie-0.9.9.2/postie-functions.php Thu Jan 19 04:38:41 2006 --- postie-rl-0.9.9.2/postie-functions.php Wed Feb 15 13:06:51 2006 *************** *** 259,275 **** * This function handles putting the actual entry into the database * @param array - categories to be posted to * @param array - details of the post */ function PostToDB($details) { $config = GetConfig(); if ($config["POST_TO_DB"]) { ! //generate sql for insertion ! $post_ID = wp_insert_post($details); ! do_action('publish_post', $post_ID); ! do_action('publish_phone', $post_ID); ! } } /** * This function determines if the mime attachment is on the BANNED_FILE_LIST * @param string --- 259,302 ---- * This function handles putting the actual entry into the database * @param array - categories to be posted to * @param array - details of the post */ function PostToDB($details) { + $days_back=21; + global $wpdb; $config = GetConfig(); if ($config["POST_TO_DB"]) { ! echo "Days back is $days_back\n"; ! if ($days_back>0) { ! $sql = "SELECT ID FROM $wpdb->posts where post_date>date_sub(now(),interval $days_back day) and post_title = '".preg_replace("/'/","\\'",($details["post_title"]))."' order by post_date desc LIMIT 1"; ! $post_ID=$wpdb->get_var($sql); ! if ($post_ID) { ! echo "Previous post $post_ID found\n"; ! $comment=array( 'comment_post_ID' => $post_ID, ! 'comment_author' => "A list member", ! 'comment_author_url' => "http://www.labtastic.org/weblog", ! 'comment_author_email' => "labhumour@labtastic.org", ! 'comment_author_IP' => "0.0.0.0", ! 'comment_date' => $details["post_date_gmt"], ! 'comment_content' => $details["post_content"], ! 'comment_approved' => 1); ! wp_insert_comment($comment); ! do_action('comment_post'); ! } else { ! echo "No previous post found; New article\n"; ! $post_ID = wp_insert_post($details); ! do_action('publish_post', $post_ID); ! do_action('publish_phone', $post_ID); ! } ! } else { ! echo "Days back = 0 - New article\n"; ! //generate sql for insertion ! $post_ID = wp_insert_post($details); ! do_action('publish_post', $post_ID); ! do_action('publish_phone', $post_ID); ! } ! } } /** * This function determines if the mime attachment is on the BANNED_FILE_LIST * @param string