12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220 |
- <?php
- function dcInfo($name='name')
- {
- switch ($name)
- {
- case 'theme' : echo $GLOBALS['theme_uri'].$GLOBALS['__theme']; break;
- case 'img' : echo $GLOBALS['img_path']; break;
- case 'url' : echo dc_blog_url; break;
- case 'rss' : echo dc_blog_rss; break;
- case 'atom' : echo dc_blog_atom; break;
- case 'search' : echo dc_blog_url; break;
- case 'logo' : echo $GLOBALS['img_path'].'/dotclear_pw.png'; break;
- case 'encoding' : echo dc_encoding; break;
- case 'lang' : echo dc_default_lang; break;
- case 'desc' : echo dc_blog_desc; break;
- default : echo dc_blog_name;
- }
- }
- function dcDayDate($s='%s')
- {
- if ($GLOBALS['news']->firstPostOfDay())
- {
- printf($s,$GLOBALS['news']->getLDate());
- }
- }
- function dcCalendar($block='<div class="cal"><table summary="calendrier">%s</table></div>')
- {
- global $year,$month,$day,$cat_id,$lang;
-
- echo $GLOBALS['blog']->xCalendar($year,$month,$day,$cat_id,$lang,$block);
- }
- function dcHeadLinks()
- {
- global $blog, $cat_id, $rs_cat;
-
- echo dcPostNext(1,'<link rel="next" href="%3$s" title="%2$s" />'."\n");
- echo dcPostNext(-1,'<link rel="previous" href="%3$s" title="%2$s" />'."\n");
-
- if (!$rs_cat->isEmpty() && !$cat_id)
- {
- while (!$rs_cat->EOF())
- {
- if ($rs_cat->f('nb_post') > 0)
- {
- $id = $rs_cat->f('cat_libelle_url');
- $libelle = $rs_cat->f('cat_libelle');
- $lien = sprintf($blog->front_url['cat'],$id);
-
- echo '<link rel="section" href="'.$lien.'" title="'.$libelle.'" />'."\n";
- }
- $rs_cat->moveNext();
- }
- $rs_cat->moveStart();
- }
-
- $arry_months = $GLOBALS['arry_months'];
- $comp_url = '';
- if ($cat_id) {
- $comp_url = $cat_id.'/';
- }
- foreach ($arry_months as $ts => $d)
- {
- $titre = dt::str('%B %Y',$ts);
- $url = sprintf($blog->front_url['archive'],$comp_url.date('Y',$ts),date('m',$ts));
- echo '<link rel="archive" href="'.$url.'" title="'.$titre.'" />'."\n";
- }
-
- if ($GLOBALS['mode'] == 'home')
- {
- echo $GLOBALS['news']->getHeadLinks();
- }
- }
- function dcSinglePostTitle($s='%s - ')
- {
- if ($GLOBALS['mode'] == 'post') {
- printf($s,$GLOBALS['news']->f('post_titre'));
- }
- }
- function dcSingleCatTitle($s='%s - ')
- {
- if ($GLOBALS['cat_id'] != '') {
- printf($s,$GLOBALS['news']->f('cat_libelle'));
- }
- }
- function dcSingleMonthTitle($s='%s - ')
- {
- if ($GLOBALS['mode'] == 'month') {
- $ts = strtotime($GLOBALS['year'].'-'.$GLOBALS['month'].'-01 00:00');
- printf($s,dt::str('%B %Y',$ts));
- }
- }
- function dcCustomTitle($s='%s - ')
- {
- if (!empty($GLOBALS['dc_custom_title'])) {
- printf($s,$GLOBALS['dc_custom_title']);
- }
- }
- function dcLangList($block='<ul>%s</ul>',$item='<li>%s</li>')
- {
- global $rs_lang,$lang,$blog;
-
- if ($rs_lang->nbRow() > 1)
- {
- $res = '';
- while ($rs_lang->fetch())
- {
- $lien = '<a href="'.
- sprintf($blog->front_url['cat'],$rs_lang->f(0)).'">'.
- $rs_lang->f(0).'</a>';
-
- if ($lang == $rs_lang->f(0)) {
- $lien = '<strong>'.$lien.'</strong>';
- }
-
- $res .= sprintf($item,$lien);
- }
-
- printf($block,$res);
- }
- }
- function dcCatList($block='<ul>%s</ul>',$item='<li>%s</li>')
- {
- global $rs_cat, $cat_id, $lang, $blog;
-
- $comp_url = '';
-
- if ($lang) {
- $comp_url = $lang.'/';
- }
-
- if (!$rs_cat->isEmpty())
- {
- $res = '';
-
- while (!$rs_cat->EOF())
- {
- if ($rs_cat->f('nb_post') > 0)
- {
- $id = $rs_cat->f('cat_libelle_url');
- $libelle = $rs_cat->f('cat_libelle');
-
- $lien = '<a href="'.
- sprintf($blog->front_url['cat'],$comp_url.$id).
- '">'.$libelle.'</a>';
-
- if ($cat_id == $id) {
- $lien = '<strong>'.$lien.'</strong>';
- }
-
- $res .= sprintf($item,$lien);
- }
- $rs_cat->moveNext();
- }
- $rs_cat->moveStart();
-
- printf($block,$res);
- }
- }
- function dcMonthsList($block='<ul>%s</ul>',$item='<li>%s</li>')
- {
- global $arry_months, $month, $year, $cat_id, $lang, $blog;
-
- $comp_url = '';
-
- if ($lang) {
- $comp_url .= $lang.'/';
- }
-
- if($cat_id) {
- $comp_url .= $cat_id.'/';
- }
-
- $res = '';
-
- foreach($arry_months as $ts => $d)
- {
- $titre = dt::str('%B %Y',$ts);
-
- $url = sprintf($blog->front_url['archive'],$comp_url.date('Y',$ts),date('m',$ts));
- $lien = '<a href="'.$url.'">%s</a>';
-
- $liClass = '';
-
- if($year == date('Y',$ts) && $month == date('m',$ts)) {
- $lien = '<strong>'.$lien.'</strong>';
- }
-
- $res .= sprintf($item,sprintf($lien,$titre));
- }
-
- if (count($arry_months) > 0) {
- printf($block,$res);
- }
- }
- function dcSelection($block='<ul>%s</ul>',$item='<li><a href="%2$s">%1$s</a></li>',$limit=NULL)
- {
- global $blog;
-
- $rs = $blog->getLastNews($limit,'','post_dt DESC',true);
-
- if (!$rs->isEmpty()) {
- $res = '';
- while (!$rs->EOF()) {
- $res .= sprintf($item,$rs->f('post_titre'),$rs->getPermURL());
- $rs->moveNext();
- }
- printf($block,$res);
- }
- }
- function dcSearchString($s='%s')
- {
- if(!empty($_GET['q'])) {
- printf($s,htmlspecialchars(stripslashes($_GET['q'])));
- }
- }
- function dcAdminLink($s='<ul><li><a href="%s">admin</a></li></ul>')
- {
- if (isset($_SESSION['sess_user_id']) && defined('DC_ECRIRE')) {
- $url = dc_app_url.'/'.DC_ECRIRE.'/index.php';
- printf($s,$url);
- }
- }
- function dcPostURL()
- {
- echo $GLOBALS['news']->getPermURL();
- }
- function dcPostID()
- {
- echo $GLOBALS['news']->f('post_id');
- }
- function dcPostTitle($s='%s')
- {
- printf($s,$GLOBALS['news']->f('post_titre'));
- }
- function dcPostCatTitle()
- {
- echo $GLOBALS['news']->f('cat_libelle');
- }
- function dcPostCatURL()
- {
- echo $GLOBALS['news']->getCatURL();
- }
- function dcPostContent($part=0)
- {
- global $news;
-
- if ($part > 0) {
- echo $news->blog->getPart($news->f('post_content'),$part);
- } else {
- echo $news->getContent();
- }
- }
- function dcPostChapo($s='%s <hr />')
- {
- printf($s,$GLOBALS['news']->getChapo());
- }
- function dcPostAbstract($s='%s',$l='<p><a href="%s" title="Read %s">Read next</a></p>')
- {
- global $news;
-
- if ($news->f('post_chapo') != '') {
- printf($s,$news->getChapo());
- printf($l,$news->getPermURL(),$news->f('post_titre'));
- } else {
- echo $news->getContent();
- }
- }
- function dcPostAuthor()
- {
- echo $GLOBALS['news']->getUserCN();
- }
- function dcPostDate($format='')
- {
- if ($format) {
- echo dt::str($format,strtotime($GLOBALS['news']->f('post_dt')));
- } else {
- echo $GLOBALS['news']->getLDate();
- }
- }
- function dcPostTime($format='')
- {
- echo $GLOBALS['news']->getLTime();
- }
- function dcPostLang()
- {
- $lang = $GLOBALS['news']->f('post_lang');
- if ($lang != '') {
- echo 'lang="'.$lang.'"';
- }
- }
- function dcPostNbComments($zero,$one,$more)
- {
- $nb = $GLOBALS['news']->f('nb_comment');
-
- if($nb == 0) {
- echo $zero;
- } elseif($nb == 1) {
- echo $one;
- } elseif($nb > 1) {
- printf($more,$nb);
- }
- }
- function dcPostNbTrackbacks($zero,$one,$more)
- {
- $nb = $GLOBALS['news']->f('nb_trackback');
-
- if($nb == 0) {
- echo $zero;
- } elseif($nb == 1) {
- echo $one;
- } elseif($nb > 1) {
- printf($more,$nb);
- }
- }
- function dcPostNext($dir,$s='%1$s %2$s %3$s')
- {
- global $blog;
-
- if ($dir > 0 && (empty($GLOBALS['rs_next'])) || empty($GLOBALS['rs_prev'])) {
- return false;
- }
-
- $rs = ($dir > 0) ? $GLOBALS['rs_next'] : $GLOBALS['rs_prev'];
-
- if (!$rs->isEmpty())
- {
- $id = $rs->f('post_id');
- $titre = $rs->f('post_titre');
- $date = $rs->f('post_dt');
-
- $ts = strtotime($date);
-
- $url = sprintf($blog->front_url['post'],date('Y',$ts),
- date('m',$ts),date('d',$ts),$id,$blog->str2url($titre));
-
- printf($s,$id,$titre,$url);
- }
- }
- function dcPostOpenComments()
- {
- return (boolean) $GLOBALS['news']->openComment();
- }
- function dcPostOpenTrackbacks()
- {
- return (boolean) $GLOBALS['news']->openTb();
- }
- function dcPostTrackbackURI()
- {
- echo
- 'http://'.$_SERVER['HTTP_HOST'].
- dc_trackback_uri.'?id='.$GLOBALS['news']->f('post_id');
- }
- function dcPostTrackbackAutoDiscovery()
- {
- if ($GLOBALS['mode'] == 'post' && $GLOBALS['news']->openTb())
- {
- $tb_url = 'http://'.$_SERVER['HTTP_HOST'].
- dc_trackback_uri.'?id='.$GLOBALS['news']->f('post_id');
-
- echo '<!--'."\n".
- '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"'."\n".
- ' xmlns:dc="http://purl.org/dc/elements/1.1/"'."\n".
- ' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">'."\n".
- '<rdf:Description'."\n".
- ' rdf:about="http://'.$_SERVER['HTTP_HOST'].$GLOBALS['news']->getPermURL().'"'."\n".
- ' dc:identifier="http://'.$_SERVER['HTTP_HOST'].$GLOBALS['news']->getPermURL().'"'."\n".
- ' dc:title="'.$GLOBALS['news']->f('post_titre').'"'."\n".
- ' trackback:ping="'.$tb_url.'" />'."\n".
- '</rdf:RDF>'."\n".
- '-->'."\n";
- }
- }
- function dcCommentContent()
- {
- echo $GLOBALS['comments']->xGetContent();
- }
- function dcCommentContentTransform()
- {
- dcCommentContent();
- }
- function dcCommentDate($format='')
- {
- if ($format) {
- echo dt::str($format,strtotime($GLOBALS['comments']->f('comment_dt')));
- } else {
- echo $GLOBALS['comments']->getLDate();
- }
- }
- function dcCommentTime()
- {
- echo $GLOBALS['comments']->getLTime();
- }
- function dcCommentAuthor($s='<a href="%1$s">%2$s</a>')
- {
- if (($link = $GLOBALS['comments']->auteurSite()) !== false) {
- printf($s,$link,$GLOBALS['comments']->f('comment_auteur'));
- } else {
- echo $GLOBALS['comments']->f('comment_auteur');
- }
- }
- function dcCommentID()
- {
- echo $GLOBALS['comments']->f('comment_id');
- }
- function dcCommentAuthorLink($s='%s')
- {
- if (($link = $GLOBALS['comments']->auteurLink()) !== false) {
- printf($s,$link);
- }
- }
- function dcCommentAuthorSite($s='%s')
- {
- if (($link = $GLOBALS['comments']->auteurSite()) !== false) {
- printf($s,$link);
- }
- }
- function dcCommentPreview()
- {
- if (!empty($GLOBALS['in_content'])) {
- if (dc_use_smilies) {
- echo $GLOBALS['blog']->addSmilies($GLOBALS['in_content']);
- } else {
- echo $GLOBALS['in_content'];
- }
- }
- }
- function dcCommentFormError($s='%s')
- {
- if (!empty($GLOBALS['form_err'])) {
- printf($s,$GLOBALS['form_err']);
- }
- }
- function dcCommentFormMsg($s='%s')
- {
- if (!empty($GLOBALS['form_msg'])) {
- printf($s,$GLOBALS['form_msg']);
- }
- }
- function dcCommentFormValue($var)
- {
- echo htmlspecialchars($GLOBALS[$var]);
- }
- function dcCommentFormRedir()
- {
- echo util::getPageURL();
- }
- function dcCommentIsTrackBack()
- {
- return (boolean) $GLOBALS['comments']->f('comment_trackback');
- }
- function dcCommentTrackBackURL($s='%s')
- {
- if ($GLOBALS['comments']->f('comment_trackback') == 1)
- {
- printf($s,$GLOBALS['comments']->f('comment_site'));
- }
- }
- function dcTBContent()
- {
- $content = $GLOBALS['trackbacks']->xGetContent();
- $link = '<a href="'.$GLOBALS['trackbacks']->auteurSite().'" rel="nofollow">$2</a>';
-
- echo preg_replace('|(<p><strong>)(.*)(</strong></p>)|msU','$1'.$link.'$3',$content);
- }
- function dcTBDate($format='')
- {
- if ($format) {
- echo dt::str($format,strtotime($GLOBALS['trackbacks']->f('comment_dt')));
- } else {
- echo $GLOBALS['trackbacks']->getLDate();
- }
- }
- function dcTBTime()
- {
- echo $GLOBALS['trackbacks']->getLTime();
- }
- function dcTBAuthor()
- {
- echo $GLOBALS['trackbacks']->f('comment_auteur');
- }
- function dcTBID()
- {
- echo $GLOBALS['trackbacks']->f('comment_id');
- }
- ?>
|