Mercurial > defr > DualBlog
comparison includes/class.post.php @ 61:25c6e59f019e
Suppression des urls en dur présentes dans le code.
Le code ne présuppose plus qu'il est hébergé directement sur
http://defr.org/blog. Ce n'est par contre pas vrai pour les différents
templates pour le moment, et les fichiers CSS pensent toujours qu'on est
hébergé dans le repertoire /blog, mais ca reste des présupposés à mon avis
moins ennuyeux.
Accessoirement, le code suppose que les trois constantes supplémentaires
suivantes ait été définie dans le fichier config.php:
BLOG_URL, l'adresse du blog, sans / à la fin
BLOG_DEFAULT_GRAVATAR, l'image par défaut pour les personnes laissant des
commentaires
ADMIN_MAIl, l'adresse mail ou sont envoyé les informations sur les
commentaires autorisés.
| author | Franck Deroche <webmaster@defr.org> |
|---|---|
| date | Tue, 11 Mar 2008 15:53:15 +0100 |
| parents | ded2849cf38c |
| children | 55582b82c43d |
comparison
equal
deleted
inserted
replaced
| 60:46be148257ae | 61:25c6e59f019e |
|---|---|
| 28 $this->dateFormatee['human'] = strftime("%A %d %B %Y, %Hh%M", $time); | 28 $this->dateFormatee['human'] = strftime("%A %d %B %Y, %Hh%M", $time); |
| 29 $this->dateFormatee['iso'] = date("c", $time); | 29 $this->dateFormatee['iso'] = date("c", $time); |
| 30 | 30 |
| 31 // On détermine l'url de ce post | 31 // On détermine l'url de ce post |
| 32 $strippedTitle = TextUtils::StripTitle($infos['Titre']); | 32 $strippedTitle = TextUtils::StripTitle($infos['Titre']); |
| 33 $this->url = '/blog/posts/' . $infos['num_mess'] . '-' . $strippedTitle; | 33 $this->url = '/posts/' . $infos['num_mess'] . '-' . $strippedTitle; |
| 34 | 34 |
| 35 // On détermine le label du lien vers les commentaires | 35 // On détermine le label du lien vers les commentaires |
| 36 $this->commentLabel = "Un p'tit commentaire ?"; | 36 $this->commentLabel = "Un p'tit commentaire ?"; |
| 37 if($infos['NbCommentaires'] > 0) | 37 if($infos['NbCommentaires'] > 0) |
| 38 $this->commentLabel .= " (" . $infos['NbCommentaires'] . ")"; | 38 $this->commentLabel .= " (" . $infos['NbCommentaires'] . ")"; |
| 39 | 39 |
| 40 // On s'occupe de l'indicateur d'humeur | 40 // On s'occupe de l'indicateur d'humeur |
| 41 if(!empty($infos['Emot'])) { | 41 if(!empty($infos['Emot'])) { |
| 42 $mood = array('src' => "/blog/mood/{$infos['Emot']}.png", | 42 $mood = array('src' => BLOG_URL . "/mood/{$infos['Emot']}.png", |
| 43 'alt' => 'Mood: ' . $infos['Emot']); | 43 'alt' => 'Mood: ' . $infos['Emot']); |
| 44 $this->mood = (object)$mood; | 44 $this->mood = (object)$mood; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // On détermine les tags du post | 47 // On détermine les tags du post |
| 56 if($nbTags > 0) | 56 if($nbTags > 0) |
| 57 { | 57 { |
| 58 while(0 !== ($tag = $db->GetRow(2))) | 58 while(0 !== ($tag = $db->GetRow(2))) |
| 59 { | 59 { |
| 60 $tags .= sprintf("<a href='%s'>%s</a> |", | 60 $tags .= sprintf("<a href='%s'>%s</a> |", |
| 61 '/blog/tags/' . urlencode($tag['Tag']), | 61 BLOG_URL . '/tags/' . urlencode($tag['Tag']), |
| 62 $tag['Tag']); | 62 $tag['Tag']); |
| 63 } | 63 } |
| 64 $tags = substr($tags, 0, -1); | 64 $tags = substr($tags, 0, -1); |
| 65 $this->tags = $this->tpl->getDocumentFragment(); | 65 $this->tags = $this->tpl->getDocumentFragment(); |
| 66 $this->tags->appendXML($tags); | 66 $this->tags->appendXML($tags); |
| 82 'postDate' => $this->dateFormatee['human'], | 82 'postDate' => $this->dateFormatee['human'], |
| 83 'postDateISO' => $this->dateFormatee['iso'], | 83 'postDateISO' => $this->dateFormatee['iso'], |
| 84 'postContent' => $this->mess, | 84 'postContent' => $this->mess, |
| 85 'postNumber' => $this->infos->num_mess, | 85 'postNumber' => $this->infos->num_mess, |
| 86 'postComments' => $this->commentLabel, | 86 'postComments' => $this->commentLabel, |
| 87 '#linkPostNumber@href' => $this->url, | 87 '#linkPostNumber@href' => $this->getURL(true), |
| 88 '#linkPostComments@href' => $this->url, | 88 '#linkPostComments@href' => $this->getURL(true), |
| 89 'postTags' => $this->tags | 89 'postTags' => $this->tags |
| 90 ); | 90 ); |
| 91 if(!empty($this->mood->src)) { | 91 if(!empty($this->mood->src)) { |
| 92 $params['#mood@src'] = $this->mood->src; | 92 $params['#mood@src'] = $this->mood->src; |
| 93 $params['#mood@alt'] = $this->mood->alt; | 93 $params['#mood@alt'] = $this->mood->alt; |
| 95 } | 95 } |
| 96 return $params; | 96 return $params; |
| 97 } | 97 } |
| 98 | 98 |
| 99 public function getURL() { | 99 public function getURL() { |
| 100 return $this->url; | 100 return BLOG_URL . $this->url; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 ?> | 103 ?> |
