check(1); include DC_BASE_DIR . '/ecrire/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'])) ? (integer)$_GET['cat_id'] : ''; $rsCat = $blog->getCat(); $post_actions = array( '' => ' ', 'status' => __('switch status'), 'category' => __('change category'), 'delete' => __('delete') ); if ($_SESSION['sess_user_level'] >= 9) { $post_actions['author'] = __('change author'); } $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 = ''; } # Sélecteurs particuliers $offline = (!empty($_GET['offline']))?true:false; $selected = (!empty($_GET['selected']))?true:false; $options = array(); $options['cat'] = $cat_id; # Les billets (et titre) if ($q != '') { $options['search'] = $q; unset($options['cat']); } elseif ($offline) { $blog->setPubMode(0); $subtitle = __('Offline entries.'); } elseif ($selected) { $options['selected'] = true; $subtitle = __('Selected entries.'); } elseif ($m == '' && $y == '') { $subtitle = __('Recent entries.'); } else { $options['month'] = $m; $options['year'] = $y; } $nb_per_page = 15; $nb_res = $blog->getPosts($options,true); if (!empty($q)) { 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).''); } } $max_pages = ceil($nb_res/$nb_per_page); $env = (!empty($_GET['env']) && (integer)$_GET['env'] <= $max_pages) ? (integer)$_GET['env'] : 1; $options['limit'] = (($env-1)*$nb_per_page).','.$nb_per_page; $options['order'] = 'post_dt DESC'; $posts = $blog->getPosts($options); # Fonction callback multipage pour les billets function ligne_post($data,$i) { global $blog; if ($data['post_pub'] == 0) { $post_cancel = __('set online'); $post_class = 'cancel'; $post_img = ''; } else { $post_cancel = __('set offline'); $post_class = 'published'; $post_img = ''; } if ($data['post_selected'] == 1) { $post_selected = ''; } else { $post_selected = ''; } if($data['user_pseudo'] != '') { $userCN = $data['user_pseudo']; } else { $userCN = trim($data['user_prenom'].' '.$data['user_nom']); } $nb_comments = (integer) $blog->getNbComments($data['post_id']); $nb_trackbacks = (integer) $blog->getNbTrackbacks($data['post_id']); $post_chk_disabled = true; if ($_SESSION['sess_user_level'] == 9 || $data['user_id'] == $_SESSION['sess_user_id']) { $post_chk_disabled = false; } $edit_links = '[ '; if ($_SESSION['sess_user_level'] == 9 || $data['user_id'] == $_SESSION['sess_user_id']) { $edit_links .= __('edit'); } else { $edit_links .= __('read'); } $edit_links .= ' ] '; # 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); } $res = '
'. '

'. $post_img.' '.$post_selected. form::checkbox('p_ids[]',$data['post_id'],'','','',$post_chk_disabled); if (dc_show_previews) { $res .= ''. '  '; } $res .= $data['post_titre'].'

'. '

'. ''.date('d/m/Y @ H:i:s',strtotime($data['post_dt'])).' '. $edit_links. ''. $str_comments. ' - '. ''. $str_trackbacks. '

'. '

'. sprintf(__('by %s - in %s'),''.$userCN.'',''.$data['cat_libelle'].''). '

'; $res .= '
'; return $res; } # Affichage de la page openPage( __('Entries'), '' ); 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 $lum = new multipage($env,'ligne_post',$posts->getData(),$nb_res,$nb_per_page); $js_openCloseAll = ''; if (dc_show_previews) { $js_openCloseAll = '

'; } $lum->setOption( 'html_block', $js_openCloseAll. '
'. '%s'. '
'. '

'. '

'.dcNonce::form(). form::hidden('selected',$selected). form::hidden('offline',$offline). form::hidden('cat_id',$cat_id). form::hidden('m',$m). form::hidden('y',$y). form::hidden('q',$q). form::hidden('env',$env). ' '. '

' ); $lum->setOption('html_row','%s'); $lum->setOption('html_cell','%s'); $lum->setOption('html_links','

'.__('Page(s)').' : %s

'); $lum->setOption('html_cur_page','%s'); $lum->setOption('html_prev','<'.__('prev. page')); $lum->setOption('html_next',__('next page').'>'); $lum->setOption('html_prev_grp','...'); $lum->setOption('html_next_grp','...'); $lum->setOption('html_empty','

'.__('No entry').'

'); if (!empty($err)) { echo '

'.__('Error(s)').' :

'. $err.'
'; } echo $lum->getLinks(); echo $lum->getPage(); echo $lum->getLinks(); 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(); ?>