Commit 9990ba82 authored by Feu's avatar Feu

de la cache dans le forum ?

parent 62d61d71
......@@ -427,17 +427,16 @@ class sujetforum extends stdcontents
$row['contenu_message'] = nosecret($row['contenu_message']);
if ( $row['syntaxengine_message'] == "bbcode" )
$this->buffer .= bbcode($row['contenu_message']);
// $this->buffer .= bbcode($row['contenu_message']);
{
$cts = cachedcontents::autocache("msg".$row['id_message'],new bbcontents("",$row['contenu_message'],false));
$this->buffer .= $cts->html_render();
}
elseif ( $row['syntaxengine_message'] == "doku" )
// $this->buffer .= doku2xhtml($row['contenu_message']);
{
$cts = new wikicontents("",$row['contenu_message'],false);
$cts = cachedcontents::autocache("msg".$row['id_message'],$cts);
$cts = cachedcontents::autocache("msg".$row['id_message'],new wikicontents("",$row['contenu_message'],false));
$this->buffer .= $cts->html_render();
//$this->buffer .= doku2xhtml($message->contenu);
}
elseif ( $row['syntaxengine_message'] == "plain" )
$this->buffer .= "<pre>".htmlentities($row['contenu_message'],ENT_NOQUOTES,"UTF-8")."</pre>";
......@@ -448,7 +447,9 @@ class sujetforum extends stdcontents
if ( !is_null($row['signature_utl']) )
{
$this->buffer .= "<div class=\"signature\">\n";
$this->buffer .= doku2xhtml($row['signature_utl']);
//$this->buffer .= doku2xhtml($row['signature_utl']);
$cts = cachedcontents::autocache("sig".$row['id_utilisateur'],new wikicontents("",$row['signature_utl'],false));
$this->buffer .= $cts->html_render();
$this->buffer .= "</div>\n";
}
......@@ -546,14 +547,8 @@ class simplemessageforum extends stdcontents
$this->buffer .= bbcode($message->contenu);
elseif ( $message->syntaxengine == "doku" )
{
$cts = new wikicontents("",$message->contenu,false);
$cts = cachedcontents::autocache("msg".$message->id,$cts);
$this->buffer .= $cts->html_render();
//$this->buffer .= doku2xhtml($message->contenu);
}
$this->buffer .= doku2xhtml($message->contenu);
elseif ( $message->syntaxengine == "plain" )
$this->buffer .= "<pre>".htmlentities($message->contenu,ENT_NOQUOTES,"UTF-8")."</pre>";
......
......@@ -134,9 +134,15 @@ class message extends stdentity
function update ( &$forum, &$sujet, $titre, $contenu, $syntaxengine )
{
global $topdir;
if ( $forum->id != $sujet->id_forum || $sujet->id != $this->id_sujet )
return;
require_once($topdir."include/cts/cached.inc.php");
$cache = new cachedcontents("msg".$this->id);
$cache->expire();
$this->titre = $titre;
$this->contenu = $contenu;
$this->syntaxengine = $syntaxengine;
......
......@@ -759,6 +759,10 @@ class utilisateur extends stdentity
if ( empty($this->alias) )
$this->alias = null;
require_once($topdir."include/cts/cached.inc.php");
$cache = new cachedcontents("sig".$this->id);
$cache->expire();
new update($this->dbrw,
"utilisateurs",
array('nom_utl' => $this->nom,
......@@ -778,6 +782,10 @@ class utilisateur extends stdentity
'signature_utl' =>$this->signature),
array('id_utilisateur' => $this->id));
if ( $this->etudiant || $this->ancien_etudiant )
{
new update($this->dbrw,
......
......@@ -183,4 +183,31 @@ function bbcode($text)
return $text;
}
class bbcontents extends contents
{
var $contents;
var $wiki;
/** Crée un stdcontents à partir d'un texte au format DokuWiki et de son titre
* @param $title Titre
* @param $contents Texte structuré
*/
function bbcontents($title,$contents,$rendernow=false)
{
$this->title = $title;
$this->contents = $contents;
if ( $rendernow )
$this->buffer = bbcode($this->contents);
}
function html_render()
{
if ( $this->buffer )
return $this->buffer;
return $this->buffer = bbcode($this->contents);
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment