Plugin Directory

Changeset 993828


Ignore:
Timestamp:
09/20/2014 11:22:23 AM (12 years ago)
Author:
vthierry
Message:

change method foro sites with protected subdirectories

Location:
http-syndication/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • http-syndication/trunk/http_syndication.php

    r993824 r993828  
    3030  }
    3131 
    32   // Captures the http request if corresponding to a http_syndication and output the related content
    3332  function http_syndication_request($request) {
    3433    if (isset($_REQUEST['httpsyndication']) && (isset($request['p']) || isset($request['page_id']))) {
     34      // Captures the http request if corresponding to a http_syndication and output the related content
    3535      $id = isset($request['p']) ? $request['p'] : $request['page_id'];
    3636      $post = get_post($id);
    3737      $content = str_replace(']]>', ']]>', apply_filters('the_content', $post->post_content));
    3838      echo "<h1>".$post->post_title."</h1>\n".$content;
     39      exit(0);
     40    } else if (isset($_REQUEST['httpsyndicationwrap'])) {
     41      include_once plugin_dir_path( __FILE__ ).'/wrap.php';
    3942      exit(0);
    4043    } else
     
    5255    $style = urlencode(isset($atts['style']) ? $atts['style'] : "border: none;");
    5356    $newtab = (isset($atts['newtab']) && $atts['newtab'] == 1) ? " target='_blank'" : "";
    54     return "<a href='".site_url()."/wp-content/plugins/http_syndication/wrap.php?banner=$banner&url=$url&height=$height&style=$style'$newtab>$content</a>";
     57    return "<a href='".site_url()."?httpsyndicationwrap&banner=$banner&url=$url&height=$height&style=$style'$newtab>$content</a>";
    5558      } else
    5659    return "[import error='a `banner` is specified but without any external `url`, thus nothing to import']";
  • http-syndication/trunk/wrap.php

    r993824 r993828  
    11<?php
    2   // Loads the WP PHP functions
    3   require_once("../../../wp-load.php");
    4   // Protects the page from spurious access
    5   if ((!isset($_SERVER['HTTP_REFERER'])) || $_SERVER['HTTP_REFERER'] == "" || strncmp($_SERVER['HTTP_REFERER'], site_url(), strlen(site_url())) != 0) {
    6     echo "Sorry ".$_SERVER['HTTP_REFERER'].", not allowed to acces this page<hr>\n";
    7     exit(-1);
    8   }
    92  // Gets the used parameters
    103  $banner = $_REQUEST['banner'];
Note: See TracChangeset for help on using the changeset viewer.