0 ) { if ( @ is_uploaded_file( $_FILES['picture']['tmp_name'] ) ) { $old_file = $_FILES['picture']['name']; $old_file_ext = strtolower(strrchr($old_file,'.')); if ( strcmp ( $old_file_ext, '.jpg') === 0 || strcmp ( $old_file_ext, '.gif') === 0 || strcmp ( $old_file_ext, '.png') === 0 ) { $new_filename = date(YndHis) . $old_file_ext; $upload_path = ABSPATH . 'wap_uploads/'; if(!file_exists($upload_path)){ mkdir($upload_path); } $new_file = $upload_path . $new_filename; if ( true === @ move_uploaded_file( $_FILES['picture']['tmp_name'], $new_file ) ) $_POST['content'] = '

' . $_POST['content']; } } } $post_ID = 'post' == $action ? write_post() : edit_post(); // Redirect. if (!empty($_POST['mode'])) { switch($_POST['mode']) { case 'bookmarklet': $location = $_POST['referredby']; break; case 'sidebar': $location = 'sidebar.php?a=b'; break; default: $location = 'writer.php'; break; } } else { $location = "writer.php?posted=$post_ID"; } if ( isset($_POST['save']) ) $location = "post.php?action=edit&post=$post_ID"; if ( empty($post_ID) ) $location = 'writer.php'; wp_redirect($location); exit(); break; case 'edit': $title = __('Edit'); $editing = true; if ( empty( $_GET['post'] ) ) { wp_redirect("post.php"); exit(); } $post_ID = $p = (int) $_GET['post']; $post = get_post($post_ID); if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") ); if ( 'page' == $post->post_type ) { wp_redirect("page.php?action=edit&post=$post_ID"); exit(); } wp_enqueue_script('post'); if ( user_can_richedit() ) wp_enqueue_script('editor'); wp_enqueue_script('thickbox'); wp_enqueue_script('media-upload'); if ( !current_user_can('edit_post', $post_ID) ) die ( __('You are not allowed to edit this post.') ); $post = get_post_to_edit($post_ID); require_once('wap-config.php'); _wap_header(); include('edit-form-advanced.php'); _wap_footer(); break; case 'editpost': $post_ID = (int) $_POST['post_ID']; check_admin_referer('update-post_' . $post_ID); $post_ID = edit_post(); redirect_post($post_ID); // Send user on their way while we keep working exit(); break; case 'delete': $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']); _wap_check_admin_referer('delete-post_' . $post_id); $post = & get_post($post_id); if ( !current_user_can('delete_post', $post_id) ) wp_die( __('You are not allowed to delete this post.') ); if ( $post->post_type == 'attachment' ) { if ( ! wp_delete_attachment($post_id) ) wp_die( __('Error in deleting...') ); } else { if ( !wp_delete_post($post_id) ) wp_die( __('Error in deleting...') ); } $sendback = 'edit.php?tmp=' . md5(uniqid(time())); $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); wp_redirect($sendback); exit(); break; default: wp_redirect('writer.php'); exit(); break; } // end switch ?>