Exemplo n.º 1
0
 public function testGetAdditionalItems() {
     $builders = $this->buildData();
     // Test that an item is added in the RSS feed when the crawler log is not writable
     $controller = new RSSController(true);
     $config = Config::getInstance();
     $config->setValue('log_location', '/something/that/doesnt/exits');
     $_GET['un'] = '*****@*****.**';
     $_GET['as'] = Session::getAPISecretFromPassword('XXX');
     $_SERVER['HTTP_HOST'] = 'http://localhost';
     $results = $controller->go();
     $this->assertPattern("/Error: crawler log is not writable/", $results);
 }
Exemplo n.º 2
0
 public function testPerOwnerRefreshRate()
 {
     // $THINKUP_CFG['rss_crawler_refresh_rate'] should apply per owner
     $builders = $this->buildData();
     $controller = new RSSController(true);
     $_GET['un'] = '*****@*****.**';
     $_GET['as'] = 'c9089f3c9adaf0186f6ffb1ee8d6501c';
     $results = $controller->go();
     $this->assertPattern("/ThinkUp crawl started/", $results);
     $instanceDAO = new InstanceMySQLDAO();
     $instanceDAO->updateLastRun(1);
     // the crawler should start for the second owner despite a recent last
     // run time for instance 1 owned by owner 1
     $controller = new RSSController(true);
     $_GET['un'] = '*****@*****.**';
     $_GET['as'] = 'a34e120dc6807e0dffc0d2b973b9d55b';
     $results = $controller->go();
     $this->assertPattern("/ThinkUp crawl started/", $results);
 }
Exemplo n.º 3
0
/**
 *
 * ThinkUp/webapp/crawler/rss.php
 *
 * Copyright (c) 2009-2015 Guillaume Boudreau
 *
 * LICENSE:
 *
 * This file is part of ThinkUp (http://thinkup.com).
 *
 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
 * later version.
 *
 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 *
 * @author Guillaume Boudreau <gboudreau[at]pommepause[dot]com>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2009-2015 Guillaume Boudreau
 */
chdir("..");
require_once 'init.php';
$controller = new RSSController();
echo $controller->go();
Exemplo n.º 4
0
require_once '../lib/class.fanzub.php';
require_once '../lib/class.render.php';
class RSSController extends Controller
{
    public function ActionDefault()
    {
        $template = new Template();
        $render = new RSSRender(static::$config['url']['rss']);
        // Title
        if (isset($_REQUEST['q']) && !empty($_REQUEST['q'])) {
            $template->title = SafeHTML(trim($_REQUEST['q']));
        } elseif (isset($_REQUEST['cat']) && !empty($_REQUEST['cat'])) {
            $cat = trim($_REQUEST['cat']);
            $template->title = SafeHTML($cat != 'dvd' ? ucfirst($cat) : strtoupper($cat));
        } else {
            $template->title = 'All';
        }
        $template->title .= ' :: ';
        // RSS
        $template->rss = 'http://' . static::$config['url']['domain'] . static::$config['url']['rss'];
        if (count($render->link) > 0) {
            $template->rss .= '?' . http_build_query($render->link, '', '&amp;');
        }
        // Result
        $template->items = $render->View();
        $template->Display('layout_rss', 'text/xml');
    }
}
// Display
$controller = new RSSController();
echo $controller->Run();
Exemplo n.º 5
0
 public function testInsightsInFeed()
 {
     $builders = $this->buildData();
     $builders_insights = $this->buildDataInsights();
     $controller = new RSSController(true);
     $_GET['un'] = '*****@*****.**';
     $_GET['as'] = 'c9089f3c9adaf0186f6ffb1ee8d6501c';
     $results = $controller->go();
     $this->debug($results);
     $this->assertNoPattern("/No insights exist/", $results);
     $this->assertPattern("/Hello/", $results);
     $this->assertPattern("/This is a test of a hello world insight/", $results);
 }
Exemplo n.º 6
0
 function print_rss($_forum_id, $_title, $_descr, $_off, $_n_entries)
 {
     include 'controllers/rss_controller.class.php';
     $this->content = '';
     $rss = new RSSController($this->api);
     $rss->set_base_url(cfg('site_url'));
     if (isset($_forum_id)) {
         $rss->set_title($_title . ' - ' . $this->get_current_forum()->get_name());
     } else {
         $rss->set_title($_title);
     }
     $rss->set_description($_descr);
     $rss->set_language(cfg('content_language'));
     $rss->show((int) $_forum_id, (int) $_off, (int) $_n_entries);
     print $this->content;
 }
Exemplo n.º 7
0
<?php

include_once dirname(__FILE__) . "/rss.controller.php";
$controller = new RSSController();
$vd = $controller->Execute();
print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<rss version="2.0">
   <channel>
      <title><?php 
print $vd["Title"];
?>
</title>
      <link><?php 
print Helper::GlobalPath("");
?>
</link>
      <description><?php 
print $vd["Description"];
?>
</description>
      <lastBuildDate><?php 
print $vd["LastCreatedTime"];
?>
</lastBuildDate>
      <generator>DOMA <?php 
print DOMA_VERSION;
?>
</generator>
      <image>
        <url>gfx/book.png</url>