prefix . 'eci_results'; $eci_post_id = $post->ID; $eci_user_time=''; // post form if (isset($_POST['eci_submit_time']) && check_admin_referer('eci_submit_time_submit_random_string')) { $eci_error = ''; // we won't post if the error field has anything in it, so run through some checks and grab post data if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $eci_error = 'ERROR: Database connection not available. Please try again later. If problem persists, please contact the site owner.'; } if (function_exists('esc_html')) { // only posts with WordPress 2.8 and above if (esc_html($_POST['eci_user_name']) != '') { $eci_user_name = esc_html($_POST['eci_user_name']); } else { $eci_error = 'ERROR: You must enter your name.'; } } else { $eci_error = 'ERROR: Eclipse Crossword Integration does not work with this version of WordPress.'; } if (is_email($_POST['eci_user_email'])) { $eci_user_email = $_POST['eci_user_email']; } else { $eci_error = 'ERROR: You must enter a valid email address.'; } $eci_user_url = apply_filters('pre_comment_author_url', trim($_POST['eci_user_url'])); $eci_user_IP = addslashes($_SERVER['REMOTE_ADDR']); if (esc_html($_POST['eci_time']) != '' || esc_html($_POST['eci_time']) != '0:00:00' ) { $eci_user_time = esc_html($_POST['eci_time']); } else { $eci_error = 'ERROR: No time recorded'; } // check whether this user has posted this time, which would most likely be a duplicate submit $eci_this_time_posted = $wpdb->get_var("SELECT COUNT(*) FROM $table_name WHERE user_email = '$eci_user_email' AND time = '$eci_user_time'"); if ($eci_this_time_posted > 0) { $eci_error = 'ERROR: You have already posted an entry with this time.'; } // save only if we haven't had an error if ($eci_error != '') { echo '

'.$eci_error.'

'; } else { $wpdb->insert($table_name, array('postid'=>$eci_post_id, 'user_name'=>$eci_user_name, 'user_email'=>$eci_user_email, 'user_url'=>$eci_user_url, 'user_ip'=>$eci_user_IP, 'date'=>date("Y-m-d H:i:s"), 'time'=>$eci_user_time), array('%d','%s','%s','%s','%s','%s','%s')); } } // read file containing the crossword $url = $values['url']; $result = wp_remote_retrieve_body(wp_remote_get($url)); // strip out everything except what we want $start = strpos($result,'
'); $body = substr($result,$start,$end-$start); // move message section to the top. $start = strpos($body,'')+5; $welcome_message = substr($body,$start,$end-$start); $body = str_replace($welcome_message, '',$body); $body = str_replace('','
'.$welcome_message.'',$body); // add call to the eciSwitchKeys function $body = str_replace('CellAt(x + i, y).className = CellAt(x + i, y).className.replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel");', '{ CellAt(x + i, y).className = CellAt(x + i, y).className.replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel"); eciSwitchKeys(CellAt(x + i , y),IsSelected); }',$body); $body = str_replace('CellAt(x, y + i).className = CellAt(x, y + i).className.replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel");', '{ CellAt(x, y + i).className = CellAt(x, y + i).className.replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel"); eciSwitchKeys(CellAt(x, y + i),IsSelected); }',$body); // add link to plugin home page $body = str_replace("from Green Eclipse—it's free!", "from Green Eclipse—it's free!
WordPress Integration by Eclipse Crossword Integration.",$body); $body = str_replace("EclipseCrossword © 2000-2007", "EclipseCrossword © 2000-2007
WordPress Integration by Eclipse Crossword Integration
",$body); // add timer $body = str_replace('