Changeset 210557
- Timestamp:
- 02/26/2010 03:51:19 PM (16 years ago)
- Location:
- file-proxy/trunk/com/twothirdsdesign
- Files:
-
- 4 edited
-
core/data_model.php (modified) (1 diff)
-
core/gcp_options.php (modified) (1 diff)
-
core/ttd_plugin_class.php (modified) (1 diff)
-
file-proxy/TtdFileProxy.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
file-proxy/trunk/com/twothirdsdesign/core/data_model.php
r210147 r210557 1 1 <?php 2 2 /** 3 * 4 */ 5 class DataModel 3 * Pretend this is a file 4 * 5 * @package com.twothirdsdesign 6 * @subpackage core 7 * @author Geraint Palmer 8 * 9 */ 10 /** 11 * DataModel class is an abstract data model for wordpress table/data 12 * 13 * @package com.twothirdsdesign.core 14 * @version 1.0.0 15 * @author Geraint Palmer <gaz@twothirdsdesign.co.uk> 16 * @copyright Two Thirds Design Ltd 2010 17 * @abstract 18 */ 19 abstract class DataModel 6 20 { 21 const VERSION = '1.0.0'; 7 22 protected static $table_name; 8 23 protected static $db_exclude = array(); -
file-proxy/trunk/com/twothirdsdesign/core/gcp_options.php
r210147 r210557 1 1 <?php 2 2 /** 3 * Options Manager Class 4 */ 3 * Options Manager Class 4 * 5 * @author Geraint Palmer 6 * @version 1.0.0 7 */ 5 8 class GcpOptions 6 9 { 10 const VERSION = '1.0.0'; 7 11 protected $options_key = 'ttd_plugin_options'; 8 12 protected $_options = array( 9 ' day_format' => 'F jS',13 'key' => 'value', 10 14 ); 11 15 -
file-proxy/trunk/com/twothirdsdesign/core/ttd_plugin_class.php
r210147 r210557 1 1 <?php 2 /** 3 * TtdPluginClass 4 * 5 * @author Geraint Palmer 6 * @version 1.0.0 7 */ 2 8 class TtdPluginClass 3 9 { 10 const VERSION = '1.0.0'; 4 11 // variable 5 12 protected $options; -
file-proxy/trunk/com/twothirdsdesign/file-proxy/TtdFileProxy.php
r210180 r210557 37 37 // Add admin menu interface 38 38 if( is_admin() ){ 39 //include( TTDFP_ADMIN.DS."adminController.php" );39 include( TTDFP_ADMIN.DS."adminController.php" ); 40 40 //$adminCrtl = new GcpfAdminController( &$this ); 41 41 //add_action('admin_menu', array(&$adminCrtl, 'adminMenus')); … … 51 51 52 52 // adds proxy rewrite rule & query_var 53 //add_action('generate_rewrite_rules', array(&$this,'add_rewrite_rules'));53 add_action('generate_rewrite_rules', array(&$this,'add_rewrite_rules')); 54 54 add_filter('query_vars', array(&$this, 'query_vars')); 55 55 … … 183 183 $upload_folder = WP_CONTENT_DIR.DS.'uploads'.DS ; 184 184 185 $file_data = $wpdb->get_row( $wpdb->prepare("SELECT * FROM {$wpdb->prefix}posts WHERE id=%d", $id)); 186 $query = $wpdb->prepare("SELECT meta_value FROM {$wpdb->prefix}postmeta WHERE post_id=%d AND meta_key='_wp_attached_file'", $id); 187 188 $file_path = $upload_folder . $wpdb->get_var( $query ); 185 $file_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}posts WHERE id=%d", $id )); 186 $file_location = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM {$wpdb->prefix}postmeta WHERE post_id=%d AND meta_key='_wp_attached_file'", $id )); 187 188 $file_path = $upload_folder . $file_location; 189 190 $file_name = explode( DS , $file_location ); 191 $file_name = $file_name[( count($file_name)-1 )]; 189 192 190 193 if ( file_exists( $file_path ) && is_readable( $file_path ) && is_file( $file_path ) ) { 191 194 header( 'Content-type: '.$file_data->post_mime_type ); 192 header( "Content-Disposition: attachment; filename=\"" . $file_data->post_name .'.'.substr( $file_data->post_mime_type, -3 )."\""); 195 header( "HTTP/1.0 200 OK" ); 196 header( "Content-Disposition: attachment; filename=\"" . $file_name ."\""); 193 197 header( 'Content-length: '. (string)(filesize( $file_path )) ); 194 198 $file = @ fopen($file_path, 'rb');
Note: See TracChangeset
for help on using the changeset viewer.