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