Plugin Directory

Changeset 210557


Ignore:
Timestamp:
02/26/2010 03:51:19 PM (16 years ago)
Author:
geraint
Message:
 
Location:
file-proxy/trunk/com/twothirdsdesign
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • file-proxy/trunk/com/twothirdsdesign/core/data_model.php

    r210147 r210557  
    11<?php
    22/**
    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 */
     19abstract class DataModel
    620{
     21        const VERSION = '1.0.0';
    722        protected static $table_name;
    823        protected static $db_exclude = array();
  • file-proxy/trunk/com/twothirdsdesign/core/gcp_options.php

    r210147 r210557  
    11<?php
    22/**
    3 * Options Manager Class
    4 */
     3 * Options Manager Class
     4 *
     5 * @author      Geraint Palmer
     6 * @version     1.0.0     
     7 */
    58class GcpOptions
    69{
     10    const VERSION = '1.0.0';
    711    protected $options_key = 'ttd_plugin_options';
    812    protected $_options = array(
    9         'day_format'            => 'F jS',
     13        'key'   => 'value',
    1014    );
    1115   
  • file-proxy/trunk/com/twothirdsdesign/core/ttd_plugin_class.php

    r210147 r210557  
    11<?php
     2/**
     3 * TtdPluginClass
     4 *
     5 * @author      Geraint Palmer
     6 * @version     1.0.0     
     7 */
    28    class TtdPluginClass
    39    {
     10        const VERSION = '1.0.0';
    411        // variable
    512        protected $options;
  • file-proxy/trunk/com/twothirdsdesign/file-proxy/TtdFileProxy.php

    r210180 r210557  
    3737        // Add admin menu interface
    3838        if( is_admin() ){
    39             //include( TTDFP_ADMIN.DS."adminController.php" );
     39            include( TTDFP_ADMIN.DS."adminController.php" );
    4040            //$adminCrtl = new GcpfAdminController( &$this );
    4141            //add_action('admin_menu', array(&$adminCrtl, 'adminMenus'));
     
    5151       
    5252        // 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'));
    5454        add_filter('query_vars', array(&$this, 'query_vars'));
    5555       
     
    183183        $upload_folder = WP_CONTENT_DIR.DS.'uploads'.DS ;
    184184       
    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 )];
    189192               
    190193        if ( file_exists( $file_path ) && is_readable( $file_path ) && is_file( $file_path ) ) {
    191194            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 ."\"");
    193197            header( 'Content-length: '. (string)(filesize( $file_path )) );
    194198            $file = @ fopen($file_path, 'rb');
Note: See TracChangeset for help on using the changeset viewer.