Exemple #1
0
 * @author    Perrick Penet   <*****@*****.**>
 * @author    Olivier Hoareau <*****@*****.**>
 * @copyright 2010 Association Française des Utilisateurs de PHP
 *
 * @category PlanetePHP
 * @package  PlanetePHP
 * @group    Batchs
 */
require_once dirname(__FILE__) . '/../../../sources/Afup/Bootstrap/Cli.php';
define('MAGPIE_CACHE_DIR', dirname(__FILE__) . '/../../cache/robots/planete');
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
require_once dirname(__FILE__) . '/../../../dependencies/magpierss/rss_fetch.inc';
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Planete_Flux.php';
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Planete_Billet.php';
$planete_flux = new AFUP_Planete_Flux($bdd);
$planete_billet = new AFUP_Planete_Billet($bdd);
$flux = $planete_flux->obtenirListeActifs();
$billets = $succes = 0;
foreach ($flux as $flux_simple) {
    echo $flux_simple['feed'] . " : début...<br />\n";
    $rss = fetch_rss($flux_simple['feed']);
    $rss->items = array_reverse($rss->items);
    foreach ($rss->items as $item) {
        if (empty($item['id'])) {
            $item['id'] = $item['link'];
        }
        if (empty($item['atom_content'])) {
            $item['atom_content'] = $item['summary'];
        }
        if (empty($item['atom_content'])) {
            $item['atom_content'] = $item['content'];
Exemple #2
0
<?php

// Impossible to access the file itself
if (!defined('PAGE_LOADED_USING_INDEX')) {
    trigger_error("Direct access forbidden.", E_USER_ERROR);
    exit;
}
$action = verifierAction(array('lister'));
$tris_valides = array('id', 'titre', 'contenu', 'etat');
$sens_valides = array('asc', 'desc');
$smarty->assign('action', $action);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Planete_Billet.php';
$planete_billet = new AFUP_Planete_Billet($bdd);
if ($action == 'lister') {
    $smarty->assign('pertinence', $conf->obtenir('planete|pertinence'));
    $smarty->assign('billets', $planete_billet->obtenirListe('*', 'maj DESC', false, false, 20));
}
Exemple #3
0
 function test_extraireOeuvresDepuisPlanete()
 {
     $oeuvres = new AFUP_Oeuvres($this->bdd);
     $this->assertTrue($oeuvres->extraireOeuvresDepuisPlanete());
     $flux = new AFUP_Planete_Flux($this->bdd);
     $flux->ajouter("Nom", "http://example.com", "http://example.com/atom", 1, 1);
     $premier_du_mois = mktime(0, 0, 0, date("m"), 1, date("Y"));
     $this->assertTrue($oeuvres->extraireOeuvresDepuisPlanete());
     $this->assertFalse(isset($oeuvres->details['planete'][1][$premier_du_mois]));
     $billet = new AFUP_Planete_Billet($this->bdd);
     $billet->ajouter(1, "key", "Titre", "http://example.com/billet", time(), "Auteur", "R�sum�", "Contenu", AFUP_PLANETE_BILLET_CREUX);
     $this->assertTrue($oeuvres->extraireOeuvresDepuisPlanete());
     $this->assertFalse(isset($oeuvres->details['planete'][1][$premier_du_mois]));
     $billet = new AFUP_Planete_Billet($this->bdd);
     $billet->ajouter(1, "key", "Titre bis", "http://example.com/billet", time(), "Auteur", "R�sum�", "Contenu", AFUP_PLANETE_BILLET_PERTINENT);
     $this->assertTrue($oeuvres->extraireOeuvresDepuisPlanete());
     $this->assertTrue(isset($oeuvres->details['planete'][1][$premier_du_mois]));
     $this->assertTrue($oeuvres->details['planete'][1][$premier_du_mois], 1);
 }
Exemple #4
0
<?php

require_once dirname(__FILE__) . '/../../../sources/Afup/Bootstrap/Http.php';
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Planete_Billet.php';
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Planete_Flux.php';
$billet = new AFUP_Planete_Billet($bdd);
$flux = new AFUP_Planete_Flux($bdd);
$page = isset($_GET['page']) ? abs((int) $_GET['page']) : 0;
$derniersBilletsComplets = $billet->obtenirDerniersBilletsTronques($page);
$listeFlux = $flux->obtenirTousParDateDuDernierBillet();
$smarty->assign('billets', $derniersBilletsComplets);
$smarty->assign('flux', $listeFlux);
$smarty->assign('suivant', count($derniersBilletsComplets) ? $page + 1 : -1);
$smarty->assign('precedant', $page - 1);
$smarty->display('index.html');
Exemple #5
0
<?php

/**
 * Fichier Feed RSS site 'PlanetePHP'
 * 
 * @author    Perrick Penet   <*****@*****.**>
 * @author    Olivier Hoareau <*****@*****.**>
 * @copyright 2010 Association Française des Utilisateurs de PHP
 * 
 * @category PlanetePHP
 * @package  PlanetePHP
 * @group    Pages
 */
require_once dirname(__FILE__) . '/../../../sources/Afup/Bootstrap/Http.php';
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Planete_Billet.php';
$feed = array('title' => 'planete php fr', 'url' => 'http://planete-php.fr/', 'link' => 'http://planete-php.fr/rss.php', 'email' => '*****@*****.**', 'author' => 'Perrick Penet / AFUP', 'date' => date(DATE_RSS));
$billet = new AFUP_Planete_Billet($bdd);
$derniersBilletsComplets = $billet->obtenirDerniersBilletsComplets(0, DATE_RSS, 20);
$smarty->assign('feed', $feed);
$smarty->assign('billets', $derniersBilletsComplets);
header('Content-Type: text/xml; charset=UTF-8');
$smarty->display('rss.xml');