check(1); include dirname(__FILE__).'/inc/connexion.php'; if (!empty($_GET['logout'])) { $blog->tiggerLog('','','Logout'); $_SESSION = array(); session_unset(); session_destroy(); setcookie(session_name(),'',0,'/'); setcookie('dc_admin', NULL, strtotime('-1 hour'),dc_app_url); header('Location: index.php'); exit; } $q = (!empty($_GET['q'])) ? $_GET['q'] : ''; # Sous menu $mySubMenu->addItem( ''.__('New entry').'',array('poster.php','accesskey="n"'),'images/ico_edit.png',false); $mySubMenu->addItem( __('Manage images'),'images.php','images/ico_image.png',false); $mySubMenu->addItem( __('View blog'),dc_blog_url,'images/ico_goto.png',false); # Les catégories du blog $cat_id = (!empty($_GET['cat_id'])) ? $_GET['cat_id'] : ''; $rsCat = $blog->getCat(); $arry_cat[' '] = NULL; while (!$rsCat->EOF()) { $arry_cat[$rsCat->f('cat_libelle'). ' ['.$rsCat->f('nb_post').']'] = $rsCat->f('cat_id'); $rsCat->moveNext(); } # Tableau des mois du blog $arry_months = array(); foreach ($blog->getAllDates('m','','','',$cat_id) as $k => $v) { $arry_months[dt::str('%B %Y',$k)] = date('Ym',$k); } # Determiner $y et $m les dates de la page if (!empty($_GET['m']) && in_array($_GET['m'],$arry_months)) { $m = substr($_GET['m'],4); $y = substr($_GET['m'],0,4); } else { $my_dt = $blog->getEarlierDate($cat_id); $my_dt = (empty($my_dt)) ? time() : strtotime($my_dt); $m = $y = ''; } # Les billets (et titre) if ($q != '') { $posts = $blog->searchPost($q); $nb_res = $posts->nbRow(); if ($nb_res > 1) { $subtitle = sprintf(__('%1$d entries match your search of %2$s.'), $nb_res,''.htmlspecialchars($q).''); } else { $subtitle = sprintf(__('%1$d entrie matches search of %2$s.'), $nb_res,''.htmlspecialchars($q).''); } } elseif (isset($_GET['offline'])) { $blog->setPubMode(0); $posts = $blog->getLastNews(NULL,'','post_dt DESC'); $subtitle = __('Offline entries.'); } elseif (isset($_GET['selected'])) { $posts = $blog->getLastNews(NULL,'','post_dt DESC',true); $subtitle = __('Selected entries.'); } elseif ($m == '' && $y == '') { $posts = $blog->getLastNews(15,$cat_id,'post_dt DESC'); $subtitle = sprintf(__('Last %d entries.'),15); } else { $posts = $blog->getPostByDate($y,$m,'',$cat_id,'post_dt DESC'); } $h_script = ''; if (!$posts->isEmpty()) { $h_script = '\n"; } openPage(__('Entries'),$h_script); echo '

'.__('List of entries').'

'; # Formulaire avec les mois et les catégories echo '

'. ''. form::combo('m',array_merge(array(''=>''),$arry_months),$y.$m). ' '. form::combo('cat_id',$arry_cat,$cat_id). ' '. '

'; # Affichage des mois suivants et précédents if(!empty($arry_months) && $m != '' && $y != '') { $m_invert = array_flip($arry_months); $m_next = util::getNextPrev($m_invert,$y.$m,'prev'); $m_prev = util::getNextPrev($m_invert,$y.$m,'next'); echo '

'; if($m_next) { echo '« '. current($m_next).' - '; } echo ''.$m_invert[$y.$m].''; if($m_prev) { echo ' - '. current($m_prev).' »'; } echo '

'; } if (!empty($subtitle)) { echo '

'.$subtitle.'

'; } # Affichage des billets if ($posts->isEmpty()) { echo '

'.__('No entry').'.

'; } else { if (dc_show_previews) { echo '

'. __('show all').' - '.__('hide all').'

'; } while(!$posts->EOF()) { if ($posts->f('post_pub') == 0) { $post_cancel = __('set online'); $post_class = 'cancel'; $post_img = ''; } else { $post_cancel = __('set offline'); $post_class = 'published'; $post_img = ''; } if ($posts->f('post_selected') == 1) { $post_selected = ''; } else { $post_selected = ''; } $nb_comments = $posts->getNbComments(); $nb_trackbacks = $posts->getNbTrackbacks(); # Liens pour l'édition et mise hors ligne accesibles uniquement au # propriétaire du billet ou à un admin if ($_SESSION['sess_user_level'] == 9 || $posts->f('user_id') == $_SESSION['sess_user_id']) { $edit_links = '[ '. __('edit').' | '. ''. $post_cancel.' ] '; } else { $edit_links = '[ '. __('read').' ] '; } # Nombre de commentaires et trackbacks if ($nb_comments > 1) { $str_comments = sprintf(__('%d comments'),$nb_comments); } else { $str_comments = sprintf(__('%d comment'),$nb_comments); } if ($nb_trackbacks > 1) { $str_trackbacks= sprintf(__('%d trackbacks'),$nb_trackbacks); } else { $str_trackbacks= sprintf(__('%d trackback'),$nb_trackbacks); } echo '
'. '

'. $post_img.' '.$post_selected; if (dc_show_previews) { echo ''. '  '; } echo $posts->f('post_titre').'

'. '

'. ''.date('d/m/Y @ H:i:s',$posts->getTS()).' '. $edit_links. ''. $str_comments. ' - '. ''. $str_trackbacks. '

'. '

'. sprintf(__('by %s - in %s'),''.$posts->getUserCN().'', ''.$posts->f('cat_libelle').''). '

'. ''. '
'; $posts->moveNext(); } } echo '

'. ' '. form::field('q',20,'',htmlspecialchars($q)). '

'; if (count($_GET) == 0) { echo ''; echo '

'.__('Bookmarklet').'

'. '

'.__('You can drag the following link to your links bar or add it to your '. 'bookmarks and when you "Blog this!" it will open up a popup window with '. 'information and a link to the site you\'re currently browsing so you can make '. 'a quick post about it.').'

'; if (substr($_SERVER['REQUEST_URI'],-1) == '/') { $post_url = $_SERVER['REQUEST_URI'].'poster.php'; } else { $post_url = dirname($_SERVER['REQUEST_URI']).'/poster.php'; } $post_url = util::getHost().$post_url; $bkm1 = "javascript:if(navigator.userAgent.indexOf('Safari') >= 0){". "Q=getSelection();". "}else{". "Q=document.selection?document.selection.createRange().text:document.getSelection();". "}". "void(window.open(". "'".$post_url."?dcb=1'+'". "&ptext='+escape(Q)+'". "&purl='+escape(location.href)+'". "&ptitle='+escape(document.title),". "'DotClear bookmarklet',". "'resizable=yes,scrollbars=yes,width=700,height=460,left=100,top=150,status=yes'));"; echo '

Blog this! - '.dc_blog_name.'

'; } closePage(); ?>