| 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| 4 | # This file is part of Dotclear 2. |
|---|
| 5 | # |
|---|
| 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
|---|
| 7 | # Licensed under the GPL version 2.0 license. |
|---|
| 8 | # See LICENSE file or |
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 10 | # |
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
|---|
| 12 | if (!defined('DC_RC_PATH')) { return; } |
|---|
| 13 | |
|---|
| 14 | class dcPager extends pager |
|---|
| 15 | { |
|---|
| 16 | protected $form_action; |
|---|
| 17 | protected $form_hidden; |
|---|
| 18 | |
|---|
| 19 | protected function getLink($li_class,$href,$img_src,$img_src_nolink,$img_alt,$enable_link) { |
|---|
| 20 | if ($enable_link) { |
|---|
| 21 | $formatter = '<li class="%s btn"><a href="%s"><img src="%s" alt="%s"/></a><span class="hidden">%s</span></li>'; |
|---|
| 22 | return sprintf ($formatter, |
|---|
| 23 | $li_class,$href,$img_src,$img_alt,$img_alt); |
|---|
| 24 | } else { |
|---|
| 25 | $formatter = '<li class="%s no-link btn"><img src="%s" alt="%s"/></li>'; |
|---|
| 26 | return sprintf ($formatter, |
|---|
| 27 | $li_class,$img_src_nolink,$img_alt,$img_alt); |
|---|
| 28 | } |
|---|
| 29 | } |
|---|
| 30 | public function setURL() { |
|---|
| 31 | parent::setURL(); |
|---|
| 32 | $url = parse_url($_SERVER['REQUEST_URI']); |
|---|
| 33 | if (isset($url['query'])) { |
|---|
| 34 | parse_str($url['query'],$args); |
|---|
| 35 | } else { |
|---|
| 36 | $args=array(); |
|---|
| 37 | } |
|---|
| 38 | # Removing session information |
|---|
| 39 | if (session_id()) |
|---|
| 40 | { |
|---|
| 41 | if (isset($args[session_name()])) |
|---|
| 42 | unset($args[session_name()]); |
|---|
| 43 | } |
|---|
| 44 | if (isset($args[$this->var_page])) { |
|---|
| 45 | unset($args[$this->var_page]); |
|---|
| 46 | } |
|---|
| 47 | if (isset($args['ok'])) { |
|---|
| 48 | unset($args['ok']); |
|---|
| 49 | } |
|---|
| 50 | $this->form_hidden = ''; |
|---|
| 51 | foreach ($args as $k=>$v) { |
|---|
| 52 | $this->form_hidden .= form::hidden(array($k),$v); |
|---|
| 53 | } |
|---|
| 54 | $this->form_action = $url['path']; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | /** |
|---|
| 58 | * Pager Links |
|---|
| 59 | * |
|---|
| 60 | * Returns pager links |
|---|
| 61 | * |
|---|
| 62 | * @return string |
|---|
| 63 | */ |
|---|
| 64 | public function getLinks() |
|---|
| 65 | { |
|---|
| 66 | $this->setURL(); |
|---|
| 67 | $htmlFirst = $this->getLink( |
|---|
| 68 | "first", |
|---|
| 69 | sprintf($this->page_url,1), |
|---|
| 70 | "images/pagination/first.png", |
|---|
| 71 | "images/pagination/no-first.png", |
|---|
| 72 | __('First page'), |
|---|
| 73 | ($this->env > 1) |
|---|
| 74 | ); |
|---|
| 75 | $htmlPrev = $this->getLink( |
|---|
| 76 | "prev", |
|---|
| 77 | sprintf($this->page_url,$this->env-1), |
|---|
| 78 | "images/pagination/previous.png", |
|---|
| 79 | "images/pagination/no-previous.png", |
|---|
| 80 | __('Previous page'), |
|---|
| 81 | ($this->env > 1) |
|---|
| 82 | ); |
|---|
| 83 | $htmlNext = $this->getLink( |
|---|
| 84 | "next", |
|---|
| 85 | sprintf($this->page_url,$this->env+1), |
|---|
| 86 | "images/pagination/next.png", |
|---|
| 87 | "images/pagination/no-next.png", |
|---|
| 88 | __('Next page'), |
|---|
| 89 | ($this->env < $this->nb_pages) |
|---|
| 90 | ); |
|---|
| 91 | $htmlLast = $this->getLink( |
|---|
| 92 | "last", |
|---|
| 93 | sprintf($this->page_url,$this->nb_pages), |
|---|
| 94 | "images/pagination/last.png", |
|---|
| 95 | "images/pagination/no-last.png", |
|---|
| 96 | __('Last page'), |
|---|
| 97 | ($this->env < $this->nb_pages) |
|---|
| 98 | ); |
|---|
| 99 | $htmlCurrent = |
|---|
| 100 | '<li class="active"><strong>'. |
|---|
| 101 | sprintf(__('Page %s / %s'),$this->env,$this->nb_pages). |
|---|
| 102 | '</strong></li>'; |
|---|
| 103 | |
|---|
| 104 | $htmlDirect = |
|---|
| 105 | ($this->nb_pages > 1 ? |
|---|
| 106 | sprintf('<li class="direct-access">'.__('Direct access page %s'), |
|---|
| 107 | form::field(array('page'),3,10)). |
|---|
| 108 | '<input type="submit" value="'.__('ok').'" class="reset" '. |
|---|
| 109 | 'name="ok" />'.$this->form_hidden.'</li>' : ''); |
|---|
| 110 | |
|---|
| 111 | $res = |
|---|
| 112 | '<form action="'.$this->form_action.'" method="get">'. |
|---|
| 113 | '<div class="pager"><ul>'. |
|---|
| 114 | $htmlFirst. |
|---|
| 115 | $htmlPrev. |
|---|
| 116 | $htmlCurrent. |
|---|
| 117 | $htmlNext. |
|---|
| 118 | $htmlLast. |
|---|
| 119 | $htmlDirect. |
|---|
| 120 | '</ul>'. |
|---|
| 121 | '</div>'. |
|---|
| 122 | '</form>' |
|---|
| 123 | ; |
|---|
| 124 | |
|---|
| 125 | return $this->nb_elements > 0 ? $res : ''; |
|---|
| 126 | } |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | class adminGenericList |
|---|
| 130 | { |
|---|
| 131 | protected $core; |
|---|
| 132 | protected $rs; |
|---|
| 133 | protected $rs_count; |
|---|
| 134 | |
|---|
| 135 | public function __construct($core,$rs,$rs_count) |
|---|
| 136 | { |
|---|
| 137 | $this->core =& $core; |
|---|
| 138 | $this->rs =& $rs; |
|---|
| 139 | $this->rs_count = $rs_count; |
|---|
| 140 | $this->html_prev = __('« prev.'); |
|---|
| 141 | $this->html_next = __('next »'); |
|---|
| 142 | } |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | class adminPostList extends adminGenericList |
|---|
| 146 | { |
|---|
| 147 | public function display($page,$nb_per_page,$enclose_block='') |
|---|
| 148 | { |
|---|
| 149 | if ($this->rs->isEmpty()) |
|---|
| 150 | { |
|---|
| 151 | echo '<p><strong>'.__('No entry').'</strong></p>'; |
|---|
| 152 | } |
|---|
| 153 | else |
|---|
| 154 | { |
|---|
| 155 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
|---|
| 156 | $entries = array(); |
|---|
| 157 | if (isset($_REQUEST['entries'])) { |
|---|
| 158 | foreach ($_REQUEST['entries'] as $v) { |
|---|
| 159 | $entries[(integer)$v]=true; |
|---|
| 160 | } |
|---|
| 161 | } |
|---|
| 162 | $html_block = |
|---|
| 163 | '<table class="clear"><caption class="hidden">'.__('Entries list').'</caption><tr>'. |
|---|
| 164 | '<th colspan="2" class="first">'.__('Title').'</th>'. |
|---|
| 165 | '<th scope="col">'.__('Date').'</th>'. |
|---|
| 166 | '<th scope="col">'.__('Category').'</th>'. |
|---|
| 167 | '<th scope="col">'.__('Author').'</th>'. |
|---|
| 168 | '<th scope="col">'.__('Comments').'</th>'. |
|---|
| 169 | '<th scope="col">'.__('Trackbacks').'</th>'. |
|---|
| 170 | '<th scope="col">'.__('Status').'</th>'. |
|---|
| 171 | '</tr>%s</table>'; |
|---|
| 172 | |
|---|
| 173 | if ($enclose_block) { |
|---|
| 174 | $html_block = sprintf($enclose_block,$html_block); |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | echo $pager->getLinks(); |
|---|
| 178 | |
|---|
| 179 | $blocks = explode('%s',$html_block); |
|---|
| 180 | |
|---|
| 181 | echo $blocks[0]; |
|---|
| 182 | |
|---|
| 183 | while ($this->rs->fetch()) |
|---|
| 184 | { |
|---|
| 185 | echo $this->postLine(isset($entries[$this->rs->post_id])); |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | echo $blocks[1]; |
|---|
| 189 | |
|---|
| 190 | echo $pager->getLinks(); |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | private function postLine($checked) |
|---|
| 195 | { |
|---|
| 196 | if ($this->core->auth->check('categories',$this->core->blog->id)) { |
|---|
| 197 | $cat_link = '<a href="category.php?id=%s">%s</a>'; |
|---|
| 198 | } else { |
|---|
| 199 | $cat_link = '%2$s'; |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | if ($this->rs->cat_title) { |
|---|
| 203 | $cat_title = sprintf($cat_link,$this->rs->cat_id, |
|---|
| 204 | html::escapeHTML($this->rs->cat_title)); |
|---|
| 205 | } else { |
|---|
| 206 | $cat_title = __('(No cat)'); |
|---|
| 207 | } |
|---|
| 208 | |
|---|
| 209 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
|---|
| 210 | switch ($this->rs->post_status) { |
|---|
| 211 | case 1: |
|---|
| 212 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
|---|
| 213 | break; |
|---|
| 214 | case 0: |
|---|
| 215 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
|---|
| 216 | break; |
|---|
| 217 | case -1: |
|---|
| 218 | $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); |
|---|
| 219 | break; |
|---|
| 220 | case -2: |
|---|
| 221 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
|---|
| 222 | break; |
|---|
| 223 | } |
|---|
| 224 | |
|---|
| 225 | $protected = ''; |
|---|
| 226 | if ($this->rs->post_password) { |
|---|
| 227 | $protected = sprintf($img,__('Protected'),'locker.png'); |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | $selected = ''; |
|---|
| 231 | if ($this->rs->post_selected) { |
|---|
| 232 | $selected = sprintf($img,__('Selected'),'selected.png'); |
|---|
| 233 | } |
|---|
| 234 | |
|---|
| 235 | $attach = ''; |
|---|
| 236 | $nb_media = $this->rs->countMedia(); |
|---|
| 237 | if ($nb_media > 0) { |
|---|
| 238 | $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); |
|---|
| 239 | $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); |
|---|
| 240 | } |
|---|
| 241 | |
|---|
| 242 | $res = '<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'. |
|---|
| 243 | ' id="p'.$this->rs->post_id.'">'; |
|---|
| 244 | |
|---|
| 245 | $res .= |
|---|
| 246 | '<td class="nowrap">'. |
|---|
| 247 | form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable()).'</td>'. |
|---|
| 248 | '<td class="maximal" scope="row"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'. |
|---|
| 249 | html::escapeHTML($this->rs->post_title).'</a></td>'. |
|---|
| 250 | '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. |
|---|
| 251 | '<td class="nowrap">'.$cat_title.'</td>'. |
|---|
| 252 | '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>'. |
|---|
| 253 | '<td class="nowrap count">'.$this->rs->nb_comment.'</td>'. |
|---|
| 254 | '<td class="nowrap count">'.$this->rs->nb_trackback.'</td>'. |
|---|
| 255 | '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'. |
|---|
| 256 | '</tr>'; |
|---|
| 257 | |
|---|
| 258 | return $res; |
|---|
| 259 | } |
|---|
| 260 | } |
|---|
| 261 | |
|---|
| 262 | class adminPostMiniList extends adminGenericList |
|---|
| 263 | { |
|---|
| 264 | public function display($page,$nb_per_page,$enclose_block='') |
|---|
| 265 | { |
|---|
| 266 | if ($this->rs->isEmpty()) |
|---|
| 267 | { |
|---|
| 268 | echo '<p><strong>'.__('No entry').'</strong></p>'; |
|---|
| 269 | } |
|---|
| 270 | else |
|---|
| 271 | { |
|---|
| 272 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
|---|
| 273 | |
|---|
| 274 | $html_block = |
|---|
| 275 | '<table class="clear"><caption class="hidden">'.__('Entries list').'</caption><tr>'. |
|---|
| 276 | '<th scope="col">'.__('Title').'</th>'. |
|---|
| 277 | '<th scope="col">'.__('Date').'</th>'. |
|---|
| 278 | '<th scope="col">'.__('Author').'</th>'. |
|---|
| 279 | '<th scope="col">'.__('Status').'</th>'. |
|---|
| 280 | '</tr>%s</table>'; |
|---|
| 281 | |
|---|
| 282 | if ($enclose_block) { |
|---|
| 283 | $html_block = sprintf($enclose_block,$html_block); |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | echo $pager->getLinks(); |
|---|
| 287 | |
|---|
| 288 | $blocks = explode('%s',$html_block); |
|---|
| 289 | |
|---|
| 290 | echo $blocks[0]; |
|---|
| 291 | |
|---|
| 292 | while ($this->rs->fetch()) |
|---|
| 293 | { |
|---|
| 294 | echo $this->postLine(); |
|---|
| 295 | } |
|---|
| 296 | |
|---|
| 297 | echo $blocks[1]; |
|---|
| 298 | |
|---|
| 299 | echo $pager->getLinks(); |
|---|
| 300 | } |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | private function postLine() |
|---|
| 304 | { |
|---|
| 305 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
|---|
| 306 | switch ($this->rs->post_status) { |
|---|
| 307 | case 1: |
|---|
| 308 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
|---|
| 309 | break; |
|---|
| 310 | case 0: |
|---|
| 311 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
|---|
| 312 | break; |
|---|
| 313 | case -1: |
|---|
| 314 | $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); |
|---|
| 315 | break; |
|---|
| 316 | case -2: |
|---|
| 317 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
|---|
| 318 | break; |
|---|
| 319 | } |
|---|
| 320 | |
|---|
| 321 | $protected = ''; |
|---|
| 322 | if ($this->rs->post_password) { |
|---|
| 323 | $protected = sprintf($img,__('Protected'),'locker.png'); |
|---|
| 324 | } |
|---|
| 325 | |
|---|
| 326 | $selected = ''; |
|---|
| 327 | if ($this->rs->post_selected) { |
|---|
| 328 | $selected = sprintf($img,__('Selected'),'selected.png'); |
|---|
| 329 | } |
|---|
| 330 | |
|---|
| 331 | $attach = ''; |
|---|
| 332 | $nb_media = $this->rs->countMedia(); |
|---|
| 333 | if ($nb_media > 0) { |
|---|
| 334 | $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); |
|---|
| 335 | $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); |
|---|
| 336 | } |
|---|
| 337 | |
|---|
| 338 | $res = '<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'. |
|---|
| 339 | ' id="p'.$this->rs->post_id.'">'; |
|---|
| 340 | |
|---|
| 341 | $res .= |
|---|
| 342 | '<td scope="row" class="maximal"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'" '. |
|---|
| 343 | 'title="'.html::escapeHTML($this->rs->getURL()).'">'. |
|---|
| 344 | html::escapeHTML($this->rs->post_title).'</a></td>'. |
|---|
| 345 | '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. |
|---|
| 346 | '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>'. |
|---|
| 347 | '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'. |
|---|
| 348 | '</tr>'; |
|---|
| 349 | |
|---|
| 350 | return $res; |
|---|
| 351 | } |
|---|
| 352 | } |
|---|
| 353 | |
|---|
| 354 | class adminCommentList extends adminGenericList |
|---|
| 355 | { |
|---|
| 356 | public function display($page,$nb_per_page,$enclose_block='') |
|---|
| 357 | { |
|---|
| 358 | if ($this->rs->isEmpty()) |
|---|
| 359 | { |
|---|
| 360 | echo '<p><strong>'.__('No comment').'</strong></p>'; |
|---|
| 361 | } |
|---|
| 362 | else |
|---|
| 363 | { |
|---|
| 364 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
|---|
| 365 | |
|---|
| 366 | $html_block = |
|---|
| 367 | '<table><caption class="hidden">'.__('Comments and trackbacks list').'</caption><tr>'. |
|---|
| 368 | '<th colspan="2" scope="col" abbr="comm" class="first">'.__('Type').'</th>'. |
|---|
| 369 | '<th scope="col">'.__('Author').'</th>'. |
|---|
| 370 | '<th scope="col">'.__('Date').'</th>'. |
|---|
| 371 | '<th scope="col" class="txt-center">'.__('Status').'</th>'. |
|---|
| 372 | '<th scope="col" abbr="entry">'.__('Entry title').'</th>'. |
|---|
| 373 | '</tr>%s</table>'; |
|---|
| 374 | |
|---|
| 375 | if ($enclose_block) { |
|---|
| 376 | $html_block = sprintf($enclose_block,$html_block); |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | echo $pager->getLinks(); |
|---|
| 380 | |
|---|
| 381 | $blocks = explode('%s',$html_block); |
|---|
| 382 | |
|---|
| 383 | echo $blocks[0]; |
|---|
| 384 | |
|---|
| 385 | while ($this->rs->fetch()) |
|---|
| 386 | { |
|---|
| 387 | echo $this->commentLine(); |
|---|
| 388 | } |
|---|
| 389 | |
|---|
| 390 | echo $blocks[1]; |
|---|
| 391 | |
|---|
| 392 | echo $pager->getLinks(); |
|---|
| 393 | } |
|---|
| 394 | } |
|---|
| 395 | |
|---|
| 396 | private function commentLine() |
|---|
| 397 | { |
|---|
| 398 | global $author, $status, $sortby, $order, $nb_per_page; |
|---|
| 399 | |
|---|
| 400 | $author_url = |
|---|
| 401 | 'comments.php?n='.$nb_per_page. |
|---|
| 402 | '&status='.$status. |
|---|
| 403 | '&sortby='.$sortby. |
|---|
| 404 | '&order='.$order. |
|---|
| 405 | '&author='.rawurlencode($this->rs->comment_author); |
|---|
| 406 | |
|---|
| 407 | $post_url = $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id); |
|---|
| 408 | |
|---|
| 409 | $comment_url = 'comment.php?id='.$this->rs->comment_id; |
|---|
| 410 | |
|---|
| 411 | $comment_dt = |
|---|
| 412 | dt::dt2str($this->core->blog->settings->system->date_format.' - '. |
|---|
| 413 | $this->core->blog->settings->system->time_format,$this->rs->comment_dt); |
|---|
| 414 | |
|---|
| 415 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
|---|
| 416 | switch ($this->rs->comment_status) { |
|---|
| 417 | case 1: |
|---|
| 418 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
|---|
| 419 | break; |
|---|
| 420 | case 0: |
|---|
| 421 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
|---|
| 422 | break; |
|---|
| 423 | case -1: |
|---|
| 424 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
|---|
| 425 | break; |
|---|
| 426 | case -2: |
|---|
| 427 | $img_status = sprintf($img,__('Junk'),'junk.png'); |
|---|
| 428 | break; |
|---|
| 429 | } |
|---|
| 430 | |
|---|
| 431 | $post_title = html::escapeHTML($this->rs->post_title); |
|---|
| 432 | if (mb_strlen($post_title) > 60) { |
|---|
| 433 | $post_title = mb_strcut($post_title,0,57).'...'; |
|---|
| 434 | } |
|---|
| 435 | $comment_title = sprintf(__('Edit the %1$s from %2$s'), |
|---|
| 436 | $this->rs->comment_trackback ? __('trackback') : __('comment'), |
|---|
| 437 | html::escapeHTML($this->rs->comment_author)); |
|---|
| 438 | |
|---|
| 439 | $res = '<tr class="line'.($this->rs->comment_status != 1 ? ' offline' : '').'"'. |
|---|
| 440 | ' id="c'.$this->rs->comment_id.'">'; |
|---|
| 441 | |
|---|
| 442 | $res .= |
|---|
| 443 | '<td class="nowrap">'. |
|---|
| 444 | form::checkbox(array('comments[]'),$this->rs->comment_id,'','','',0).'</td>'. |
|---|
| 445 | '<td class="nowrap" abbr="'.__('Type and author').'" scope="row">'. |
|---|
| 446 | '<a href="'.$comment_url.'" title="'.$comment_title.'">'. |
|---|
| 447 | '<img src="images/edit-mini.png" alt="'.__('Edit').'"/> '. |
|---|
| 448 | ($this->rs->comment_trackback ? __('trackback') : __('comment')).' '.'</a></td>'. |
|---|
| 449 | '<td class="nowrap maximal"><a href="'.$author_url.'">'.html::escapeHTML($this->rs->comment_author).'</a></td>'. |
|---|
| 450 | '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).'</td>'. |
|---|
| 451 | '<td class="nowrap status txt-center">'.$img_status.'</td>'. |
|---|
| 452 | '<td class="nowrap"><a href="'.$post_url.'">'. |
|---|
| 453 | html::escapeHTML($post_title).'</a>'. |
|---|
| 454 | ($this->rs->post_type != 'post' ? ' ('.html::escapeHTML($this->rs->post_type).')' : '').'</td>'; |
|---|
| 455 | |
|---|
| 456 | $res .= '</tr>'; |
|---|
| 457 | |
|---|
| 458 | return $res; |
|---|
| 459 | } |
|---|
| 460 | } |
|---|
| 461 | |
|---|
| 462 | class adminUserList extends adminGenericList |
|---|
| 463 | { |
|---|
| 464 | public function display($page,$nb_per_page,$enclose_block='') |
|---|
| 465 | { |
|---|
| 466 | if ($this->rs->isEmpty()) |
|---|
| 467 | { |
|---|
| 468 | echo '<p><strong>'.__('No user').'</strong></p>'; |
|---|
| 469 | } |
|---|
| 470 | else |
|---|
| 471 | { |
|---|
| 472 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
|---|
| 473 | |
|---|
| 474 | $html_block = |
|---|
| 475 | '<table class="clear"><caption class="hidden">'.__('Users list').'</caption><tr>'. |
|---|
| 476 | '<th colspan="2" scope="col" class="first">'.__('Username').'</th>'. |
|---|
| 477 | '<th scope="col">'.__('First Name').'</th>'. |
|---|
| 478 | '<th scope="col">'.__('Last Name').'</th>'. |
|---|
| 479 | '<th scope="col">'.__('Display name').'</th>'. |
|---|
| 480 | '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>'. |
|---|
| 481 | '</tr>%s</table>'; |
|---|
| 482 | |
|---|
| 483 | if ($enclose_block) { |
|---|
| 484 | $html_block = sprintf($enclose_block,$html_block); |
|---|
| 485 | } |
|---|
| 486 | |
|---|
| 487 | echo $pager->getLinks(); |
|---|
| 488 | |
|---|
| 489 | $blocks = explode('%s',$html_block); |
|---|
| 490 | |
|---|
| 491 | echo $blocks[0]; |
|---|
| 492 | |
|---|
| 493 | while ($this->rs->fetch()) |
|---|
| 494 | { |
|---|
| 495 | echo $this->userLine(); |
|---|
| 496 | } |
|---|
| 497 | |
|---|
| 498 | echo $blocks[1]; |
|---|
| 499 | |
|---|
| 500 | echo $pager->getLinks(); |
|---|
| 501 | } |
|---|
| 502 | } |
|---|
| 503 | |
|---|
| 504 | private function userLine() |
|---|
| 505 | { |
|---|
| 506 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
|---|
| 507 | $img_status = ''; |
|---|
| 508 | |
|---|
| 509 | $p = $this->core->getUserPermissions($this->rs->user_id); |
|---|
| 510 | |
|---|
| 511 | if (isset($p[$this->core->blog->id]['p']['admin'])) { |
|---|
| 512 | $img_status = sprintf($img,__('admin'),'admin.png'); |
|---|
| 513 | } |
|---|
| 514 | if ($this->rs->user_super) { |
|---|
| 515 | $img_status = sprintf($img,__('superadmin'),'superadmin.png'); |
|---|
| 516 | } |
|---|
| 517 | return |
|---|
| 518 | '<tr class="line">'. |
|---|
| 519 | '<td class="nowrap">'.form::hidden(array('nb_post[]'),(integer) $this->rs->nb_post). |
|---|
| 520 | form::checkbox(array('users[]'),$this->rs->user_id).'</td>'. |
|---|
| 521 | '<td class="maximal" scope="row"><a href="user.php?id='.$this->rs->user_id.'">'. |
|---|
| 522 | $this->rs->user_id.'</a> '.$img_status.'</td>'. |
|---|
| 523 | '<td class="nowrap">'.html::escapeHTML($this->rs->user_firstname).'</td>'. |
|---|
| 524 | '<td class="nowrap">'.html::escapeHTML($this->rs->user_name).'</td>'. |
|---|
| 525 | '<td class="nowrap">'.html::escapeHTML($this->rs->user_displayname).'</td>'. |
|---|
| 526 | '<td class="nowrap count"><a href="posts.php?user_id='.$this->rs->user_id.'">'. |
|---|
| 527 | $this->rs->nb_post.'</a></td>'. |
|---|
| 528 | '</tr>'; |
|---|
| 529 | } |
|---|
| 530 | } |
|---|
| 531 | ?> |
|---|