Plugin Directory

Changeset 1097331


Ignore:
Timestamp:
02/23/2015 04:07:29 PM (11 years ago)
Author:
geraint
Message:

Add: Direct php execution protection
Update: Readme

Location:
file-proxy/trunk
Files:
9 edited

Legend:

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

    r210557 r1097331  
    1 <?php
    2 /**
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
     2/** 
    33 * Pretend this is a file
    44 *
  • file-proxy/trunk/com/twothirdsdesign/core/gcp_options.php

    r1097328 r1097331  
    1 <?php
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    22/**
    33 * Options Manager Class
  • file-proxy/trunk/com/twothirdsdesign/core/ttd_plugin_admin_class.php

    r221247 r1097331  
    1 <?php
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    22/**
    33 * TtdPluginClass
  • file-proxy/trunk/com/twothirdsdesign/core/ttd_plugin_class.php

    r216667 r1097331  
    1 <?php
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    22/**
    33 * TtdPluginClass
  • file-proxy/trunk/com/twothirdsdesign/file-proxy/admin/admin.php

    r221247 r1097331  
    1 <?php
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    22require_once( TTDFP_CORE.DS.'ttd_plugin_admin_class.php' );
    33/**
  • file-proxy/trunk/com/twothirdsdesign/file-proxy/ttd_file_proxy.php

    r1097328 r1097331  
    1 <?php
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    22/**
    33 * Ttd File Proxy - Plugin Class File
     
    77 */
    88
    9 class TtdFileProxy extends TtdPluginClass
     9class TTDFileProxy extends TtdPluginClass
    1010{   
    1111    protected $plugin_domain = 'TtdFileProxy';
     
    2525        'redirect-target'   => 'file',
    2626    );
     27
     28    // pages where our plugin needs translation
     29    protected $local_pages = array('plugins.php');
    2730   
    2831    function __construct()
    2932    {
    3033        parent::__construct();
    31        
    32         // pages where our plugin needs translation
    33         $local_pages = array('plugins.php');
    3434           
    3535        // init options manager
    3636        $this->options = new GcpOptions($this->options_key, $this->_options);
    37            
    38         // load localisation
    39         // $screen = get_current_screen();
    40 
    41         // if( in_array( $screen, $local_pages ) )
    42         //  $this->handle_load_domain();
    43        
    44         // Add admin menu interface
     37       
     38        // Add admin interfaces
    4539        $this->admin();
    4640
    47         //add_action('template_redirect', array(&$this,'uri_detect'));
     41        //add_action('template_redirect', array($this,'uri_detect'));
    4842                   
    4943        // add activation hooks
    5044        register_activation_hook   ( TTDFP_PLUGIN_FILE , array($this, 'activate'  ));
    5145        register_deactivation_hook ( TTDFP_PLUGIN_FILE , array($this, 'deactivate'));
    52         register_uninstall_hook    ( TTDFP_PLUGIN_FILE , array("TtdFileProxy", 'uninstall'));
     46        register_uninstall_hook    ( TTDFP_PLUGIN_FILE , "TTDFileProxy::uninstall" );
    5347       
    5448        // shortcodes
    5549        add_shortcode('file-proxy', array($this, 'return_proxy_link'));
    56         add_shortcode('ttdfp-url', array($this, 'return_proxy_url'));
     50        //add_shortcode('ttdfp-url', array($this, 'return_proxy_url'));
    5751       
    5852        // adds proxy rewrite rule & query_var
     53        add_filter('query_vars', array($this, 'query_vars'));
    5954        //add_filter('generate_rewrite_rules', array(&$this,'add_rewrite_rules'));
    60         add_filter('query_vars', array($this, 'query_vars'));
    6155        //add_filter('wp_redirect', array(&$this, 'test'), 0, 2);
    6256       
     
    6559       
    6660    }
    67    
    68    
    69 /*  function test($location, $status){
    70         echo $status . " - " . $location;
    71     }   */
    72    
    73     function admin(){
    74         if( is_admin() ){
     61
     62    /**
     63     * Loads the Options Panel in the dashboard if required.
     64     *
     65     * @return void
     66     * @author Geraint Palmer
     67     * @since 0.6
     68     **/
     69    function admin()
     70    {
     71        if( is_admin() )
     72        {
     73            // load localisation
     74            global $pagenow;
     75
     76            if( in_array( $pagenow, $this->local_pages ) )
     77                $this->handle_load_domain();
     78
     79            // load Menus & Controller
    7580            require_once( TTDFP_ADMIN.DS.'admin.php' );
    7681            $ttd_file_proxy_admin = new TtdFileProxyAdmin( $this );
     
    232237        global $wp_query, $wp_rewrite;
    233238        $this->flush_rules();
    234         $id = isset( $_GET['file'] ) ? absint( $_GET['file'] ) : null; //$this->get_option('url-key') ];
    235 
    236         echo $id;
    237        
    238         //print_r($_GET['file']);
     239        $id = isset( $_GET['file'] ) ? intval( $_GET['file'] ) : null;
     240       
    239241        if ( isset( $id )) {
    240             echo '<pre>';print_r($wp_rewrite->wp_rewrite_rules() ); echo '</pre>';
    241            
     242
    242243            // Sanatize url var.
    243             $id = intval( $id );
    244             if( $id <= 0 ){ return; }
    245            
    246             if(!is_user_logged_in()){
    247                
     244            if( $id < 0 ){ return; }
     245           
     246            if(!is_user_logged_in())
     247            {   
    248248                wp_redirect( $this->get_option('login-url') );
    249249                auth_redirect();
     
    251251            }
    252252
    253             //$this->return_file( $id );
     253            $this->return_file( $id );
    254254            exit;
    255255        }
  • file-proxy/trunk/index.php

    r1097022 r1097331  
    1 <?php exit("File Not Found")  ?>
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
  • file-proxy/trunk/init.php

    r1097328 r1097331  
    1 <?php
     1<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    22    /*
    33    Plugin Name: File Proxy
     
    6161    {
    6262        // Create Plugin Instance
    63         $ttd_file_proxy = new TtdFileProxy();
     63        $ttd_file_proxy = new TTDFileProxy();
    6464    }   
    6565?>
  • file-proxy/trunk/readme.txt

    r1097328 r1097331  
    7979* This version requires WordPress 4.1 or later
    8080* Update Compatibility with WordPress 4.1
     81* Plugin Reboot.
     82* Moved to http://github.com/geraintp/file-proxy
    8183
    8284= 0.5 =
Note: See TracChangeset for help on using the changeset viewer.