$file ) { $upload_filepath = $_POST[$meta_name . '_filepath']; if ($upload_filepath != ""){ $oldfilename = $upload_filepath; $path = get_bloginfo('url') . '/wp-content/plugins/fresh-page/files/'; $filename = time().substr($oldfilename, 10); //rename the file to avoid image caching rename(dirname(__FILE__) . '/files/'.$oldfilename, dirname(__FILE__) . '/files/'.$filename); $_POST[$meta_name] = $path . $filename; } else{ $_POST[$meta_name] = $_POST[$meta_name . '_last']; continue; } /*if( file_exists( $file['tmp_name'] ) ) { //Old Upload code: $filename = time() . $file['name']; $path = get_bloginfo('url') . '/wp-content/plugins/fresh-page/files/'; $_POST[$meta_name] = $path . $filename; move_uploaded_file( $file['tmp_name'], dirname(__FILE__) . '/files/' . $filename ); */ /*else // try to get web file { $url = $_REQUEST[$meta_name . '_url']; if ($fp_source = @fopen($url, 'rb')) { //Get target filename $exploded_url = explode( '.', $url ); $ext = array_pop( $exploded_url ); $filename = time() . '_' . str_replace( 'rc_cwp_meta_', '', $meta_name ) . '.' . $ext; $path = get_bloginfo('url') . '/wp-content/plugins/fresh-page/files/'; $_POST[$meta_name] = $path . $filename; $directory = dirname(__FILE__) . '/files/'; $fp_dest = @fopen($directory . $filename,"wb"); if ($fp_dest == false) return; while(!feof($fp_source)) { set_time_limit(30); if (connection_status()!=0) return; $readData = fread($fp_source, 1024*8); if ($readData == false) return; if (fwrite($fp_dest,$readData) == false) return; } if (fclose($fp_source) == false) return; if (fclose($fp_dest) == false) return; } else{ $_POST[$meta_name] = $_POST[$meta_name . '_last']; continue; } if( ! $file_string = file_get_contents( $url ) ) // if we fail to get web file, use old value { $_POST[$meta_name] = $_POST[$meta_name . '_last']; continue; } $exploded_url = explode( '.', $url ); $ext = array_pop( $exploded_url ); $filename = time() . '_' . str_replace( 'rc_cwp_meta_', '', $meta_name ) . '.' . $ext; $path = get_bloginfo('url') . '/wp-content/plugins/fresh-page/files/'; $_POST[$meta_name] = $path . $filename; $directory = dirname(__FILE__) . '/files/'; file_put_contents( $directory . $filename, $file_string ); }*/ } ### ADD THUMBNAILER PATH AND PARAMS TO THE PHOTO FILE NAME ### if( isset( $_REQUEST['rc_cwp_meta_photos'] ) ) { foreach( $_REQUEST['rc_cwp_meta_photos'] as $meta_name ) { // if photo is new, add thumbnailer path if( $_POST[ $meta_name ] != $_POST[ $meta_name . '_last' ] ) { $path = get_bloginfo('url') . '/wp-content/plugins/fresh-page/phpThumb.php?src='; $_POST[ $meta_name ] = $path . $_POST[ $meta_name ]; } // if photo is new, add params if( isset( $_REQUEST[ $meta_name . '_params' ] ) && $_REQUEST[ $meta_name . '_params' ] ) { if( ! strpos( $_POST[$meta_name], $_REQUEST[ $meta_name . '_params' ] ) ) { $_POST[$meta_name] .= $_REQUEST[$meta_name . '_params']; } } } } } function GetCustomWritePanel() { if (isset($_GET['post'])) { $customWritePanelId = get_post_meta((int)$_GET['post'], RC_CWP_POST_WRITE_PANEL_ID_META_KEY, true); if (empty($customWritePanelId)) { $customWritePanelId = (int)$_REQUEST['custom-write-panel-id']; } } else if (isset($_REQUEST['custom-write-panel-id'])) { $customWritePanelId = (int)$_REQUEST['custom-write-panel-id']; } if (isset($customWritePanelId)) { include_once('RCCWP_Application.php'); $customWritePanel = RCCWP_Application::GetCustomWritePanels($customWritePanelId); } return $customWritePanel; } function SetCustomWritePanel($postId) { if(!wp_verify_nonce($_REQUEST['rc-custom-write-panel-verify-key'], 'rc-custom-write-panel')) return $postId; if (!current_user_can('edit_post', $postId)) return $postId; $customWritePanelId = $_POST['rc-cwp-custom-write-panel-id']; if (isset($customWritePanelId)) { if (!empty($customWritePanelId)) { if (!update_post_meta($postId, RC_CWP_POST_WRITE_PANEL_ID_META_KEY, $customWritePanelId)) { add_post_meta($postId, RC_CWP_POST_WRITE_PANEL_ID_META_KEY, $customWritePanelId); } } else { delete_post_meta($postId, RC_CWP_POST_WRITE_PANEL_ID_META_KEY); } } } function SetMetaValue($postId) { global $wpdb; if(!wp_verify_nonce($_REQUEST['rc-custom-write-panel-verify-key'], 'rc-custom-write-panel')) return $postId; if (!current_user_can('edit_post', $postId)) return $postId; $customWritePanelId = $_POST['rc-cwp-custom-write-panel-id']; if (isset($customWritePanelId)) { if (!empty($customWritePanelId)) { $customFieldCount = count($customFieldKeys); $customFieldKeys = (array)$_POST['rc_cwp_meta_keys']; foreach ($customFieldKeys as $key) { $rawCustomFieldName = $key; if (isset($rawCustomFieldName)) { if (!empty($rawCustomFieldName)) { $customFieldName = $wpdb->escape(stripslashes(trim(RC_Format::GetFieldName($rawCustomFieldName)))); $customFieldValue = $_POST[$rawCustomFieldName]; $audioExt = substr($customFieldValue, -4); /*if($audioExt == '.mp3' || $audioExt == '.MP3' || $audioExt == '.avg' || $audioExt == '.AVG' || $audioExt == 'mpeg' || $audioExt == 'MPEG') { $customFieldValue = "\