Example #1
0
    }
    file_put_contents('./!hub.json', json_encode($hubJson));
    exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
}
if ($ORIGINAL_INPUT == '') {
    header('HTTP/1.1 422 Unprocessable Entity');
    die('Missing XML payload!');
}
Minz_Configuration::register('system', DATA_PATH . '/config.php', DATA_PATH . '/config.default.php');
$system_conf = Minz_Configuration::get('system');
$system_conf->auth_type = 'none';
// avoid necessity to be logged in (not saved!)
Minz_Translate::init('en');
Minz_Request::_param('ajax', true);
$feedController = new FreshRSS_feed_Controller();
$simplePie = customSimplePie();
$simplePie->set_raw_data($ORIGINAL_INPUT);
$simplePie->init();
unset($ORIGINAL_INPUT);
$links = $simplePie->get_links('self');
$self = isset($links[0]) ? $links[0] : null;
if ($self !== base64url_decode($canonical64)) {
    //header('HTTP/1.1 422 Unprocessable Entity');
    logMe('Warning: Self URL [' . $self . '] does not match registered canonical URL!: ' . base64url_decode($canonical64));
    //die('Self URL does not match registered canonical URL!');
    $self = base64url_decode($canonical64);
}
Minz_Request::_param('url', $self);
$nb = 0;
foreach ($users as $userFilename) {
    $username = basename($userFilename, '.txt');
Example #2
0
 public function load($loadDetails = false)
 {
     if ($this->url !== null) {
         if (CACHE_PATH === false) {
             throw new Minz_FileNotExistException('CACHE_PATH', Minz_Exception::ERROR);
         } else {
             $url = htmlspecialchars_decode($this->url, ENT_QUOTES);
             if ($this->httpAuth != '') {
                 $url = preg_replace('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url);
             }
             $feed = customSimplePie();
             if (substr($url, -11) === '#force_feed') {
                 $feed->force_feed(true);
                 $url = substr($url, 0, -11);
             }
             $feed->set_feed_url($url);
             if (!$loadDetails) {
                 //Only activates auto-discovery when adding a new feed
                 $feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
             }
             $mtime = $feed->init();
             if (!$mtime || $feed->error()) {
                 $errorMessage = $feed->error();
                 throw new FreshRSS_Feed_Exception(($errorMessage == '' ? 'Feed error' : $errorMessage) . ' [' . $url . ']');
             }
             $links = $feed->get_links('self');
             $this->selfUrl = isset($links[0]) ? $links[0] : null;
             $links = $feed->get_links('hub');
             $this->hubUrl = isset($links[0]) ? $links[0] : null;
             if ($loadDetails) {
                 // si on a utilisé l'auto-discover, notre url va avoir changé
                 $subscribe_url = $feed->subscribe_url(false);
                 $title = strtr(html_only_entity_decode($feed->get_title()), array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;'));
                 //HTML to HTML-PRE	//ENT_COMPAT except &
                 $this->_name($title == '' ? $url : $title);
                 $this->_website(html_only_entity_decode($feed->get_link()));
                 $this->_description(html_only_entity_decode($feed->get_description()));
             } else {
                 //The case of HTTP 301 Moved Permanently
                 $subscribe_url = $feed->subscribe_url(true);
             }
             $clean_url = SimplePie_Misc::url_remove_credentials($subscribe_url);
             if ($subscribe_url !== null && $subscribe_url !== $url) {
                 $this->_url($clean_url);
             }
             if ($mtime === true || $mtime > $this->lastUpdate) {
                 //Minz_Log::debug('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url);
                 $this->loadEntries($feed);
                 // et on charge les articles du flux
             } else {
                 //Minz_Log::debug('FreshRSS use cache for ' . $clean_url);
                 $this->entries = array();
             }
             $feed->__destruct();
             //http://simplepie.org/wiki/faq/i_m_getting_memory_leaks
             unset($feed);
         }
     }
 }
Example #3
0
function sanitizeHTML($data, $base = '')
{
    static $simplePie = null;
    if ($simplePie == null) {
        $simplePie = customSimplePie();
        $simplePie->init();
    }
    return html_only_entity_decode($simplePie->sanitize->sanitize($data, SIMPLEPIE_CONSTRUCT_HTML, $base));
}
Example #4
0
 public function load($loadDetails = false)
 {
     if ($this->url !== null) {
         if (CACHE_PATH === false) {
             throw new Minz_FileNotExistException('CACHE_PATH', Minz_Exception::ERROR);
         } else {
             $url = htmlspecialchars_decode($this->url, ENT_QUOTES);
             if ($this->httpAuth != '') {
                 $url = preg_replace('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url);
             }
             $feed = customSimplePie();
             $feed->set_feed_url($url);
             $mtime = $feed->init();
             if (!$mtime || $feed->error()) {
                 throw new FreshRSS_Feed_Exception($feed->error() . ' [' . $url . ']');
             }
             // si on a utilisé l'auto-discover, notre url va avoir changé
             $subscribe_url = $feed->subscribe_url();
             if ($subscribe_url !== null && $subscribe_url !== $this->url) {
                 if ($this->httpAuth != '') {
                     // on enlève les id si authentification HTTP
                     $subscribe_url = preg_replace('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url);
                 }
                 $this->_url($subscribe_url);
             }
             if ($loadDetails) {
                 $title = htmlspecialchars(html_only_entity_decode($feed->get_title()), ENT_COMPAT, 'UTF-8');
                 $this->_name($title === null ? $this->url : $title);
                 $this->_website(html_only_entity_decode($feed->get_link()));
                 $this->_description(html_only_entity_decode($feed->get_description()));
             }
             if ($mtime === true || $mtime > $this->lastUpdate) {
                 syslog(LOG_DEBUG, 'FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url);
                 $this->loadEntries($feed);
                 // et on charge les articles du flux
             } else {
                 syslog(LOG_DEBUG, 'FreshRSS use cache for ' . $subscribe_url);
                 $this->entries = array();
             }
             $feed->__destruct();
             //http://simplepie.org/wiki/faq/i_m_getting_memory_leaks
             unset($feed);
         }
     }
 }