[ Index ] |
|
Code source de Dotclear 1.2.5 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2004 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 require dirname(__FILE__).'/inc/prepend.php'; 24 25 $auth->check(1); 26 27 include dirname(__FILE__).'/inc/connexion.php'; 28 29 if (!empty($_GET['logout'])) { 30 $blog->tiggerLog('','','Logout'); 31 $_SESSION = array(); 32 session_unset(); 33 session_destroy(); 34 setcookie(session_name(),'',0,'/'); 35 setcookie('dc_admin', NULL, strtotime('-1 hour'),dc_app_url); 36 header('Location: index.php'); 37 exit; 38 } 39 40 $q = (!empty($_GET['q'])) ? $_GET['q'] : ''; 41 42 # Sous menu 43 $mySubMenu->addItem( 44 '<strong>'.__('New entry').'</strong>',array('poster.php','accesskey="n"'),'images/ico_edit.png',false); 45 $mySubMenu->addItem( 46 __('Manage images'),'images.php','images/ico_image.png',false); 47 $mySubMenu->addItem( 48 __('View blog'),dc_blog_url,'images/ico_goto.png',false); 49 50 # Les catégories du blog 51 $cat_id = (!empty($_GET['cat_id'])) ? $_GET['cat_id'] : ''; 52 53 $rsCat = $blog->getCat(); 54 55 $arry_cat[' '] = NULL; 56 while (!$rsCat->EOF()) 57 { 58 $arry_cat[$rsCat->f('cat_libelle'). 59 ' ['.$rsCat->f('nb_post').']'] = $rsCat->f('cat_id'); 60 $rsCat->moveNext(); 61 } 62 63 # Tableau des mois du blog 64 $arry_months = array(); 65 foreach ($blog->getAllDates('m','','','',$cat_id) as $k => $v) { 66 $arry_months[dt::str('%B %Y',$k)] = date('Ym',$k); 67 } 68 69 # Determiner $y et $m les dates de la page 70 if (!empty($_GET['m']) && in_array($_GET['m'],$arry_months)) { 71 $m = substr($_GET['m'],4); 72 $y = substr($_GET['m'],0,4); 73 } else { 74 $my_dt = $blog->getEarlierDate($cat_id); 75 $my_dt = (empty($my_dt)) ? time() : strtotime($my_dt); 76 $m = $y = ''; 77 } 78 79 # Les billets (et titre) 80 if ($q != '') 81 { 82 $posts = $blog->searchPost($q); 83 $nb_res = $posts->nbRow(); 84 85 if ($nb_res > 1) { 86 $subtitle = sprintf(__('%1$d entries match your search of %2$s.'), 87 $nb_res,'<em>'.htmlspecialchars($q).'</em>'); 88 } else { 89 $subtitle = sprintf(__('%1$d entrie matches search of %2$s.'), 90 $nb_res,'<em>'.htmlspecialchars($q).'</em>'); 91 } 92 } 93 elseif (isset($_GET['offline'])) { 94 $blog->setPubMode(0); 95 $posts = $blog->getLastNews(NULL,'','post_dt DESC'); 96 $subtitle = __('Offline entries.'); 97 } 98 elseif (isset($_GET['selected'])) { 99 $posts = $blog->getLastNews(NULL,'','post_dt DESC',true); 100 $subtitle = __('Selected entries.'); 101 } 102 elseif ($m == '' && $y == '') 103 { 104 $posts = $blog->getLastNews(15,$cat_id,'post_dt DESC'); 105 $subtitle = sprintf(__('Last %d entries.'),15); 106 } 107 else 108 { 109 $posts = $blog->getPostByDate($y,$m,'',$cat_id,'post_dt DESC'); 110 } 111 112 $h_script = ''; 113 if (!$posts->isEmpty()) { 114 $h_script = 115 '<script type="text/javascript">'."\n". 116 "var js_post_ids = new Array('".implode("','",$posts->getIDs('content'))."');\n". 117 //"window.onload = function() { mOpenClose(js_post_ids,-1); }\n". 118 "</script>\n"; 119 } 120 121 openPage(__('Entries'),$h_script); 122 123 echo '<h2>'.__('List of entries').'</h2>'; 124 125 # Formulaire avec les mois et les catégories 126 echo 127 '<form action="index.php" class="clear"><p>'. 128 '<label for="m" style="display:inline;"><strong>'.__('Month').' : </strong></label>'. 129 form::combo('m',array_merge(array(''=>''),$arry_months),$y.$m). 130 ' <label for="cat_id" style="display:inline;"><strong>'.__('Category').' : </strong></label>'. 131 form::combo('cat_id',$arry_cat,$cat_id). 132 ' <input class="submit" type="submit" value="'.__('ok').'" />'. 133 '</p></form>'; 134 135 # Affichage des mois suivants et précédents 136 if(!empty($arry_months) && $m != '' && $y != '') 137 { 138 $m_invert = array_flip($arry_months); 139 $m_next = util::getNextPrev($m_invert,$y.$m,'prev'); 140 $m_prev = util::getNextPrev($m_invert,$y.$m,'next'); 141 echo '<p>'; 142 if($m_next) { 143 echo '<a href="index.php?m='.key($m_next).'&cat_id='.$cat_id.'">« '. 144 current($m_next).'</a> - '; 145 } 146 147 echo '<strong>'.$m_invert[$y.$m].'</strong>'; 148 if($m_prev) { 149 echo ' - <a href="index.php?m='.key($m_prev).'&cat_id='.$cat_id.'">'. 150 current($m_prev).' »</a>'; 151 } 152 echo '</p>'; 153 } 154 155 if (!empty($subtitle)) { 156 echo '<p>'.$subtitle.'</p>'; 157 } 158 159 # Affichage des billets 160 if ($posts->isEmpty()) 161 { 162 echo '<p>'.__('No entry').'.</p>'; 163 } 164 else 165 { 166 if (dc_show_previews) 167 { 168 echo 169 '<p class="small"><a href="#" onclick="mOpenClose(js_post_ids,1); return false;">'. 170 __('show all').'</a> - <a href="#" onclick="mOpenClose(js_post_ids,-1); '. 171 'return false;">'.__('hide all').'</a></p>'; 172 } 173 174 while(!$posts->EOF()) 175 { 176 if ($posts->f('post_pub') == 0) { 177 $post_cancel = __('set online'); 178 $post_class = 'cancel'; 179 $post_img = '<img src="images/check_off.png" '. 180 'alt="'.__('This entry is offline').'" class="status" />'; 181 } else { 182 $post_cancel = __('set offline'); 183 $post_class = 'published'; 184 $post_img = '<img src="images/check_on.png" '. 185 'alt="'.__('This entry is online').'" class="status" />'; 186 } 187 188 if ($posts->f('post_selected') == 1) { 189 $post_selected = '<img src="images/selected.png" '. 190 'alt="'.__('This entry is selected').'" class="status" />'; 191 } else { 192 $post_selected = ''; 193 } 194 195 $nb_comments = $posts->getNbComments(); 196 $nb_trackbacks = $posts->getNbTrackbacks(); 197 198 # Liens pour l'édition et mise hors ligne accesibles uniquement au 199 # propriétaire du billet ou à un admin 200 if ($_SESSION['sess_user_level'] == 9 || $posts->f('user_id') == $_SESSION['sess_user_id']) { 201 $edit_links = '[ <strong><a href="poster.php?post_id='.$posts->f('post_id').'">'. 202 __('edit').'</a></strong> | '. 203 '<a href="poster.php?post_id='.$posts->f('post_id').'&cancel=1">'. 204 $post_cancel.'</a> ] '; 205 } else { 206 $edit_links = '[ <strong><a href="poster.php?post_id='.$posts->f('post_id').'">'. 207 __('read').'</a></strong> ] '; 208 } 209 210 # Nombre de commentaires et trackbacks 211 if ($nb_comments > 1) { 212 $str_comments = sprintf(__('%d comments'),$nb_comments); 213 } else { 214 $str_comments = sprintf(__('%d comment'),$nb_comments); 215 } 216 217 if ($nb_trackbacks > 1) { 218 $str_trackbacks= sprintf(__('%d trackbacks'),$nb_trackbacks); 219 } else { 220 $str_trackbacks= sprintf(__('%d trackback'),$nb_trackbacks); 221 } 222 223 echo 224 '<div class="ligne '.$post_class.'" id="p'.$posts->f('post_id').'">'. 225 '<h3 class="ligneTitre">'. 226 $post_img.' '.$post_selected; 227 228 if (dc_show_previews) 229 { 230 echo 231 '<a href="#" onclick="openClose(\'content'.$posts->f('post_id'). 232 '\',0); return false;"><img src="images/plus.png" '. 233 'id="img_content'.$posts->f('post_id').'" '. 234 'alt="'.__('show/hide').'" title="'.__('show/hide').'" /></a>'. 235 ' '; 236 } 237 238 echo 239 $posts->f('post_titre').'</h3>'. 240 241 '<p class="ligneInfo">'. 242 '<strong>'.date('d/m/Y @ H:i:s',$posts->getTS()).'</strong> '. 243 $edit_links. 244 '<a href="poster.php?post_id='.$posts->f('post_id').'#comments">'. 245 $str_comments. 246 '</a> - '. 247 '<a href="poster.php?post_id='.$posts->f('post_id').'#trackbacks">'. 248 $str_trackbacks. 249 '</a></p>'. 250 '<p class="ligneInfo">'. 251 sprintf(__('by %s - in %s'),'<strong>'.$posts->getUserCN().'</strong>', 252 '<strong>'.$posts->f('cat_libelle').'</strong>'). 253 '</p>'. 254 255 '<div id="content'.$posts->f('post_id').'" class="preview" style="display:none">'; 256 257 if (dc_show_previews) { 258 echo 259 (($posts->f('post_chapo')!='') ? $posts->f('post_chapo').'<hr class="thin" />' : ''). 260 $posts->f('post_content'); 261 } 262 263 echo '</div>'. 264 '</div>'; 265 266 $posts->moveNext(); 267 } 268 } 269 270 echo 271 '<form action="index.php"><p>'. 272 '<label for="q" style="display:inline;">'.__('Search').' : </label> '. 273 form::field('q',20,'',htmlspecialchars($q)). 274 ' <input class="submit" type="submit" value="'.__('ok').'" /></p></form>'; 275 276 if (count($_GET) == 0) 277 { 278 echo 279 '<ul>'. 280 '<li><a href="index.php?offline=1">'.__('View all offline entries').'</a></li>'. 281 '<li><a href="index.php?selected=1">'.__('View all selected entries').'</a></li>'. 282 '</ul>'; 283 284 echo 285 '<h3>'.__('Bookmarklet').'</h3>'. 286 '<p>'.__('You can drag the following link to your links bar or add it to your '. 287 'bookmarks and when you "Blog this!" it will open up a popup window with '. 288 'information and a link to the site you\'re currently browsing so you can make '. 289 'a quick post about it.').'</p>'; 290 291 if (substr($_SERVER['REQUEST_URI'],-1) == '/') { 292 $post_url = $_SERVER['REQUEST_URI'].'poster.php'; 293 } else { 294 $post_url = dirname($_SERVER['REQUEST_URI']).'/poster.php'; 295 } 296 $post_url = util::getHost().$post_url; 297 298 $bkm1 = 299 "javascript:if(navigator.userAgent.indexOf('Safari') >= 0){". 300 "Q=getSelection();". 301 "}else{". 302 "Q=document.selection?document.selection.createRange().text:document.getSelection();". 303 "}". 304 "void(window.open(". 305 "'".$post_url."?dcb=1'+'". 306 "&ptext='+escape(Q)+'". 307 "&purl='+escape(location.href)+'". 308 "&ptitle='+escape(document.title),". 309 "'DotClear bookmarklet',". 310 "'resizable=yes,scrollbars=yes,width=700,height=460,left=100,top=150,status=yes'));"; 311 312 echo '<p><a href="'.$bkm1.'">Blog this! - '.dc_blog_name.'</a></p>'; 313 } 314 315 closePage(); 316 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 21:40:15 2007 | par Balluche grâce à PHPXref 0.7 |