rn7.net/wiki

HandlerBacklinksrss

PagePrincipale :: rn7.net :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes 38.107.179.227
http://overcrowded.anoptique.org/HandlerBacklinksrss


Génère un fichier RSS des dernières modifications des pages qui ont un lien vers la page courante.

Usage : http://overcrowded.anoptique.org/NomDeLaPage/backlinksrss
exemple: http://overcrowded.anoptique.org/PagePrincipale/backlinksrss

Code source

Fichier à placer dans le dossier handlers/page/ de wikini.

<?php
/*
Exemple de handler pour WikiNi version WikiNi 0.4.1rc et 0.4.1.
Développé par Charles Népote.
Version 0.02 du 03/07/2004.
Licence GPL.
modification par ActionsReseauxNumeriques
24/05/2006
Genere un flux RSS des modifications des backlinks d'une page
Licence GPL.
*/
// On teste si le script n'est pas appelé en direct
if (!defined("WIKINI_VERSION"))
{
  die (
"accès direct interdit");
}
// On teste si l'utilisateur peut lire la page
if (!$this->HasAccess("read"))
{
    return;
}
else
{
    
// On teste si la page existe
    
if (!$this->page)
    {
        return;
    }
    else
    {
        
//header("Content-Type: application/rss+xml");
        
header("Content-Type: text/xml");
        
$output "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
        
        
//backlinks
        //"select from_tag as tag from ".$this->config["table_prefix"]."links where to_tag = '".mysql_escape_string($tag)."' order by tag"

        
$tpage $this->config["table_prefix"]."pages";
        
$tlink $this->config["table_prefix"]."links";
        
        
//if ($pages = $this->LoadRevisions($this->tag))
        
if ($pages $this->LoadAll("select ".$tpage.".tag as tag, ".$tpage.".time as time, ".$tpage.".user as user, ".$tpage.".owner as owner, ".$tpage.".body_r as body_r from $tpage, $tlink where ".$tpage.".comment_on = '' and ".$tpage.".body_r not like '-%' and ".$tlink.".from_tag = ".$tpage.".tag and ".$tlink.".to_tag='".$this->tag."'  order by time desc limit 50"))
        {
            
$output .= "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
            
$output .= "  <channel>\n";
            
$output .= "      <title>".$this->config["wakka_name"].": ".$this->tag."</title>\n";
            
$output .= "      <link>".$this->config["base_url"].$this->tag."</link>\n";
            
$output .= "      <description></description>\n";
            
$output .= "      <language>fr</language>\n";

            foreach (
$pages as $page)
            {
                
//$url = $this->href("show")."&amp;time=".urlencode($page["time"]);
                
$url $this->config["base_url"] . $page['tag'] . "/show&amp;time=" urlencode($page["time"]);

                
$output .= "      <item>\r\n";
                
$output .= "          <title>".$page["tag"]  ." by ".$page["user"]. "</title>\r\n";
                
$output .= "          <link>" $url "</link>\r\n";
                
$output .= "          <description>".$page["body_r"]."</description>\r\n";
                
$output .= "          <dc:creator>".$page["user"]."</dc:creator>\r\n"
                
$output .= "          <dc:date>".ereg_replace(" ","T",$page["time"])."-01:00</dc:date>\r\n"
                
$output .= "      </item>\r\n";

            }
            
$output .= "  </channel>\r\n";
            
$output .= "</rss>";
            print(
$output);
        }
    }
}
?>

Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]