Mercurial > defr > DualBlog
comparison includes/class.skeleton.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 |
comparison
equal
deleted
inserted
replaced
| 60:46be148257ae | 61:25c6e59f019e |
|---|---|
| 51 while($row = $db->GetRow()) { | 51 while($row = $db->GetRow()) { |
| 52 $curArchiveTpl = new Template('archive.xml'); | 52 $curArchiveTpl = new Template('archive.xml'); |
| 53 $monthName = TextUtils::getMonthName($row['Month']); | 53 $monthName = TextUtils::getMonthName($row['Month']); |
| 54 $curArchiveTpl->setParams(array( | 54 $curArchiveTpl->setParams(array( |
| 55 'a' => $monthName . ' ' . $row['Year'], | 55 'a' => $monthName . ' ' . $row['Year'], |
| 56 'a@href' => "http://defr.org/blog/posts/{$row['Year']}/{$row['Month']}", | 56 'a@href' => BLOG_URL . "/posts/{$row['Year']}/{$row['Month']}", |
| 57 'postCount' => '(' . $row['Nb'] . ')' | 57 'postCount' => '(' . $row['Nb'] . ')' |
| 58 )); | 58 )); |
| 59 $archives[] = array('li' => $curArchiveTpl); | 59 $archives[] = array('li' => $curArchiveTpl); |
| 60 } | 60 } |
| 61 // 2. Récupération des derniers commentaires | 61 // 2. Récupération des derniers commentaires |
| 69 while($row = $db->GetRow()) { | 69 while($row = $db->GetRow()) { |
| 70 $curCommentTpl = new Template('commentIndex.xml'); | 70 $curCommentTpl = new Template('commentIndex.xml'); |
| 71 // On récupère une version filtrée du titre du post ... | 71 // On récupère une version filtrée du titre du post ... |
| 72 $tf = TextUtils::StripTitle($row['Titre']); | 72 $tf = TextUtils::StripTitle($row['Titre']); |
| 73 // ... Qui nous permet d'obtenir l'adresse du commentaire sur le post | 73 // ... Qui nous permet d'obtenir l'adresse du commentaire sur le post |
| 74 $c_url = "/blog/posts/{$row['MessId']}-$tf#c{$row['num_comm']}"; | 74 $c_url = BLOG_URL . "/posts/{$row['MessId']}-$tf#c{$row['num_comm']}"; |
| 75 // Si jamais on a une adresse mail, on rajoute un mailto: | 75 // Si jamais on a une adresse mail, on rajoute un mailto: |
| 76 if(strpos($row['Adresse'], '@') !== false) | 76 if(strpos($row['Adresse'], '@') !== false) |
| 77 $row['Adresse'] = 'mailto:' . $row['Adresse']; | 77 $row['Adresse'] = 'mailto:' . $row['Adresse']; |
| 78 // On commence par définir les paramètres généraux | 78 // On commence par définir les paramètres généraux |
| 79 $params = array( | 79 $params = array( |
| 80 '#CommentAuthor' => $row['Auteur'], | 80 '#CommentAuthor' => $row['Auteur'], |
| 81 '#CommentAuthor@href' => urlencode($row['Adresse']), | 81 '#CommentAuthor@href' => $row['Adresse'], |
| 82 '#Post' => $row['Titre'], | 82 '#Post' => $row['Titre'], |
| 83 '#Post@href' => $c_url | 83 '#Post@href' => $c_url |
| 84 ); | 84 ); |
| 85 // On affiche les 5 commentaires les plus récents en version complète | 85 // On affiche les 5 commentaires les plus récents en version complète |
| 86 // puis les 15 autres en versions résumées | 86 // puis les 15 autres en versions résumées |
| 126 $prevMonth = 12; | 126 $prevMonth = 12; |
| 127 $prevYear = ($prevMonth == 12) ? $cYear - 1 : $cYear; | 127 $prevYear = ($prevMonth == 12) ? $cYear - 1 : $cYear; |
| 128 $retVal = new Template('calendar.xml'); | 128 $retVal = new Template('calendar.xml'); |
| 129 $retVal->setParams(array( | 129 $retVal->setParams(array( |
| 130 '#calPrev' => TextUtils::getMonthName($prevMonth) . ' ' . $prevYear, | 130 '#calPrev' => TextUtils::getMonthName($prevMonth) . ' ' . $prevYear, |
| 131 '#calPrev@href' => '/blog/posts/' . $prevYear . '/' . $prevMonth, | 131 '#calPrev@href' => BLOG_URL . '/posts/' . $prevYear . '/' . $prevMonth, |
| 132 '#calNext' => TextUtils::getMonthName($nextMonth) . ' ' . $nextYear, | 132 '#calNext' => TextUtils::getMonthName($nextMonth) . ' ' . $nextYear, |
| 133 '#calNext@href' => '/blog/posts/' . $nextYear . '/' . $nextMonth, | 133 '#calNext@href' => BLOG_URL . '/posts/' . $nextYear . '/' . $nextMonth, |
| 134 'currentMonth' => TextUtils::getMonthName($cMonth) . ' ' . $cYear | 134 'currentMonth' => TextUtils::getMonthName($cMonth) . ' ' . $cYear |
| 135 )); | 135 )); |
| 136 } else { | 136 } else { |
| 137 $retVal = ''; | 137 $retVal = ''; |
| 138 } | 138 } |
| 199 $params['possibleStyleSheets'] = array(); | 199 $params['possibleStyleSheets'] = array(); |
| 200 foreach($this->styleSheets as $styleSheet) { | 200 foreach($this->styleSheets as $styleSheet) { |
| 201 $type = ($styleSheet->enabled) ? "" : "Alternate "; | 201 $type = ($styleSheet->enabled) ? "" : "Alternate "; |
| 202 $type .= "StyleSheet"; | 202 $type .= "StyleSheet"; |
| 203 $params['possibleStyleSheets'][] = array( | 203 $params['possibleStyleSheets'][] = array( |
| 204 'link@href' => '/blog/css/' . $styleSheet->CSSFile, | 204 'link@href' => BLOG_URL . '/css/' . $styleSheet->CSSFile, |
| 205 'link@rel' => $type, | 205 'link@rel' => $type, |
| 206 'link@title' => $styleSheet->name | 206 'link@title' => $styleSheet->name |
| 207 ); | 207 ); |
| 208 } | 208 } |
| 209 | 209 |
