[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; |
---|
[2566] | 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) { |
---|
[3087] | 54 | $this->form_hidden .= form::hidden(array($k.'[]'),html::escapeHTML($v2)); |
---|
[1998] | 55 | } |
---|
| 56 | } else { |
---|
[3087] | 57 | $this->form_hidden .= form::hidden(array($k),html::escapeHTML($v)); |
---|
[1998] | 58 | } |
---|
[1926] | 59 | } |
---|
| 60 | $this->form_action = $url['path']; |
---|
| 61 | } |
---|
[2566] | 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 | ); |
---|
[2566] | 105 | $htmlCurrent = |
---|
[1909] | 106 | '<li class="active"><strong>'. |
---|
| 107 | sprintf(__('Page %s / %s'),$this->env,$this->nb_pages). |
---|
| 108 | '</strong></li>'; |
---|
[2566] | 109 | |
---|
| 110 | $htmlDirect = |
---|
[1931] | 111 | ($this->nb_pages > 1 ? |
---|
| 112 | sprintf('<li class="direct-access">'.__('Direct access page %s'), |
---|
[2323] | 113 | form::field(array($this->var_page),3,10)). |
---|
[1931] | 114 | '<input type="submit" value="'.__('ok').'" class="reset" '. |
---|
| 115 | 'name="ok" />'.$this->form_hidden.'</li>' : ''); |
---|
[2566] | 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 | ; |
---|
[2566] | 130 | |
---|
[1909] | 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; |
---|
[2566] | 140 | |
---|
[0] | 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 | } |
---|
[3265] | 149 | |
---|
| 150 | public function userColumns($type,$cols) |
---|
| 151 | { |
---|
| 152 | $cols_user = @$this->core->auth->user_prefs->interface->cols; |
---|
| 153 | if (is_array($cols_user)) { |
---|
| 154 | if (isset($cols_user[$type])) { |
---|
| 155 | foreach ($cols_user[$type] as $cn => $cd) { |
---|
| 156 | if (!$cd && isset($cols[$cn])) { |
---|
| 157 | unset($cols[$cn]); |
---|
| 158 | } |
---|
| 159 | } |
---|
| 160 | } |
---|
| 161 | } |
---|
| 162 | } |
---|
[0] | 163 | } |
---|
| 164 | |
---|
| 165 | class adminPostList extends adminGenericList |
---|
| 166 | { |
---|
[2128] | 167 | public function display($page,$nb_per_page,$enclose_block='',$filter=false) |
---|
[0] | 168 | { |
---|
| 169 | if ($this->rs->isEmpty()) |
---|
| 170 | { |
---|
[2128] | 171 | if( $filter ) { |
---|
| 172 | echo '<p><strong>'.__('No entry matches the filter').'</strong></p>'; |
---|
| 173 | } else { |
---|
| 174 | echo '<p><strong>'.__('No entry').'</strong></p>'; |
---|
| 175 | } |
---|
[0] | 176 | } |
---|
| 177 | else |
---|
| 178 | { |
---|
[1909] | 179 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
---|
[1476] | 180 | $entries = array(); |
---|
| 181 | if (isset($_REQUEST['entries'])) { |
---|
| 182 | foreach ($_REQUEST['entries'] as $v) { |
---|
| 183 | $entries[(integer)$v]=true; |
---|
| 184 | } |
---|
| 185 | } |
---|
[0] | 186 | $html_block = |
---|
[2002] | 187 | '<div class="table-outer">'. |
---|
[2135] | 188 | '<table>'; |
---|
[2566] | 189 | |
---|
[2131] | 190 | if( $filter ) { |
---|
[3239] | 191 | $html_block .= '<caption>'.sprintf(__('List of %s entries matching the filter.'), $this->rs_count).'</caption>'; |
---|
[2128] | 192 | } else { |
---|
[3239] | 193 | $nb_published = $this->core->blog->getPosts(array('post_status' => 1),true)->f(0); |
---|
| 194 | $nb_pending = $this->core->blog->getPosts(array('post_status' => -2),true)->f(0); |
---|
| 195 | $nb_programmed = $this->core->blog->getPosts(array('post_status' => -1),true)->f(0); |
---|
| 196 | $nb_unpublished = $this->core->blog->getPosts(array('post_status' => 0),true)->f(0); |
---|
| 197 | $html_block .= '<caption>'. |
---|
| 198 | sprintf(__('List of entries (%s)'),$this->rs_count). |
---|
| 199 | ($nb_published ? |
---|
| 200 | sprintf( |
---|
| 201 | __(', <a href="%s">published</a> (1)',', <a href="%s">published</a> (%s)',$nb_published), |
---|
| 202 | $this->core->adminurl->get('admin.posts',array('status' => 1)), |
---|
| 203 | $nb_published) : ''). |
---|
| 204 | ($nb_pending ? |
---|
| 205 | sprintf( |
---|
| 206 | __(', <a href="%s">pending</a> (1)',', <a href="%s">pending</a> (%s)',$nb_pending), |
---|
| 207 | $this->core->adminurl->get('admin.posts',array('status' => -2)), |
---|
| 208 | $nb_pending) : ''). |
---|
| 209 | ($nb_programmed ? |
---|
| 210 | sprintf(__(', <a href="%s">programmed</a> (1)',', <a href="%s">programmed</a> (%s)',$nb_programmed), |
---|
| 211 | $this->core->adminurl->get('admin.posts',array('status' => -1)), |
---|
| 212 | $nb_programmed) : ''). |
---|
| 213 | ($nb_unpublished ? |
---|
| 214 | sprintf(__(', <a href="%s">unpublished</a> (1)',', <a href="%s">unpublished</a> (%s)',$nb_unpublished), |
---|
| 215 | $this->core->adminurl->get('admin.posts',array('status' => 0)), |
---|
| 216 | $nb_unpublished) : ''). |
---|
| 217 | '</caption>'; |
---|
[2128] | 218 | } |
---|
[2566] | 219 | |
---|
[3089] | 220 | $cols = array( |
---|
| 221 | 'title' => '<th colspan="2" class="first">'.__('Title').'</th>', |
---|
| 222 | 'date' => '<th scope="col">'.__('Date').'</th>', |
---|
| 223 | 'category' => '<th scope="col">'.__('Category').'</th>', |
---|
| 224 | 'author' => '<th scope="col">'.__('Author').'</th>', |
---|
| 225 | 'comments' => '<th scope="col"><img src="images/comments.png" alt="" title="'.__('Comments'). |
---|
| 226 | '" /><span class="hidden">'.__('Comments').'</span></th>', |
---|
| 227 | 'trackbacks' => '<th scope="col"><img src="images/trackbacks.png" alt="" title="'.__('Trackbacks'). |
---|
| 228 | '" /><span class="hidden">'.__('Trackbacks').'</span></th>', |
---|
| 229 | 'status' => '<th scope="col">'.__('Status').'</th>' |
---|
| 230 | ); |
---|
| 231 | $cols = new ArrayObject($cols); |
---|
| 232 | $this->core->callBehavior('adminPostListHeader',$this->core,$this->rs,$cols); |
---|
[2566] | 233 | |
---|
[3265] | 234 | // Cope with optional columns |
---|
| 235 | $this->userColumns('posts',$cols); |
---|
| 236 | |
---|
[3089] | 237 | $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; |
---|
[0] | 238 | if ($enclose_block) { |
---|
| 239 | $html_block = sprintf($enclose_block,$html_block); |
---|
| 240 | } |
---|
[2566] | 241 | |
---|
[1909] | 242 | echo $pager->getLinks(); |
---|
[2566] | 243 | |
---|
[0] | 244 | $blocks = explode('%s',$html_block); |
---|
[2566] | 245 | |
---|
[0] | 246 | echo $blocks[0]; |
---|
[2566] | 247 | |
---|
[0] | 248 | while ($this->rs->fetch()) |
---|
| 249 | { |
---|
[1476] | 250 | echo $this->postLine(isset($entries[$this->rs->post_id])); |
---|
[0] | 251 | } |
---|
[2566] | 252 | |
---|
[0] | 253 | echo $blocks[1]; |
---|
[2566] | 254 | |
---|
[1909] | 255 | echo $pager->getLinks(); |
---|
[0] | 256 | } |
---|
| 257 | } |
---|
[2566] | 258 | |
---|
[1476] | 259 | private function postLine($checked) |
---|
[0] | 260 | { |
---|
| 261 | if ($this->core->auth->check('categories',$this->core->blog->id)) { |
---|
[2858] | 262 | $cat_link = '<a href="'.$this->core->adminurl->get('admin.category',array('id' => '%s'),'&',true).'">%s</a>'; |
---|
[0] | 263 | } else { |
---|
| 264 | $cat_link = '%2$s'; |
---|
| 265 | } |
---|
[2566] | 266 | |
---|
[0] | 267 | if ($this->rs->cat_title) { |
---|
| 268 | $cat_title = sprintf($cat_link,$this->rs->cat_id, |
---|
| 269 | html::escapeHTML($this->rs->cat_title)); |
---|
| 270 | } else { |
---|
[1364] | 271 | $cat_title = __('(No cat)'); |
---|
[0] | 272 | } |
---|
[2566] | 273 | |
---|
[0] | 274 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
[3118] | 275 | $sts_class = ''; |
---|
[0] | 276 | switch ($this->rs->post_status) { |
---|
| 277 | case 1: |
---|
[1353] | 278 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
---|
[3118] | 279 | $sts_class = 'sts-online'; |
---|
[0] | 280 | break; |
---|
| 281 | case 0: |
---|
[1353] | 282 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
---|
[3118] | 283 | $sts_class = 'sts-offline'; |
---|
[0] | 284 | break; |
---|
| 285 | case -1: |
---|
[1353] | 286 | $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); |
---|
[3118] | 287 | $sts_class = 'sts-scheduled'; |
---|
[0] | 288 | break; |
---|
| 289 | case -2: |
---|
[1353] | 290 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
---|
[3118] | 291 | $sts_class = 'sts-pending'; |
---|
[0] | 292 | break; |
---|
| 293 | } |
---|
[2566] | 294 | |
---|
[0] | 295 | $protected = ''; |
---|
| 296 | if ($this->rs->post_password) { |
---|
[1353] | 297 | $protected = sprintf($img,__('Protected'),'locker.png'); |
---|
[0] | 298 | } |
---|
[2566] | 299 | |
---|
[0] | 300 | $selected = ''; |
---|
| 301 | if ($this->rs->post_selected) { |
---|
[1353] | 302 | $selected = sprintf($img,__('Selected'),'selected.png'); |
---|
[0] | 303 | } |
---|
[2566] | 304 | |
---|
[0] | 305 | $attach = ''; |
---|
| 306 | $nb_media = $this->rs->countMedia(); |
---|
| 307 | if ($nb_media > 0) { |
---|
| 308 | $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); |
---|
| 309 | $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); |
---|
| 310 | } |
---|
[2566] | 311 | |
---|
[3118] | 312 | $res = '<tr class="line '.($this->rs->post_status != 1 ? 'offline ' : '').$sts_class.'"'. |
---|
[0] | 313 | ' id="p'.$this->rs->post_id.'">'; |
---|
[2566] | 314 | |
---|
[3089] | 315 | $cols = array( |
---|
| 316 | 'check' => '<td class="nowrap">'. |
---|
| 317 | form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable()). |
---|
| 318 | '</td>', |
---|
| 319 | 'title' => '<td class="maximal" scope="row"><a href="'. |
---|
| 320 | $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'. |
---|
| 321 | html::escapeHTML($this->rs->post_title).'</a></td>', |
---|
| 322 | 'date' => '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>', |
---|
| 323 | 'category' => '<td class="nowrap">'.$cat_title.'</td>', |
---|
| 324 | 'author' => '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>', |
---|
| 325 | 'comments' => '<td class="nowrap count">'.$this->rs->nb_comment.'</td>', |
---|
| 326 | 'trackbacks' => '<td class="nowrap count">'.$this->rs->nb_trackback.'</td>', |
---|
| 327 | 'status' => '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>' |
---|
| 328 | ); |
---|
| 329 | $cols = new ArrayObject($cols); |
---|
| 330 | $this->core->callBehavior('adminPostListValue',$this->core,$this->rs,$cols); |
---|
| 331 | |
---|
[3265] | 332 | // Cope with optional columns |
---|
| 333 | $this->userColumns('posts',$cols); |
---|
| 334 | |
---|
[3089] | 335 | $res .= implode(iterator_to_array($cols)); |
---|
| 336 | $res .= '</tr>'; |
---|
[2566] | 337 | |
---|
[0] | 338 | return $res; |
---|
| 339 | } |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | class adminPostMiniList extends adminGenericList |
---|
| 343 | { |
---|
| 344 | public function display($page,$nb_per_page,$enclose_block='') |
---|
| 345 | { |
---|
| 346 | if ($this->rs->isEmpty()) |
---|
| 347 | { |
---|
| 348 | echo '<p><strong>'.__('No entry').'</strong></p>'; |
---|
| 349 | } |
---|
| 350 | else |
---|
| 351 | { |
---|
[1910] | 352 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
---|
[2566] | 353 | |
---|
[0] | 354 | $html_block = |
---|
[2002] | 355 | '<div class="table-outer clear">'. |
---|
[3089] | 356 | '<table><caption class="hidden">'.__('Entries list').'</caption><tr>'; |
---|
[2566] | 357 | |
---|
[3089] | 358 | $cols = array( |
---|
| 359 | 'title' => '<th scope="col">'.__('Title').'</th>', |
---|
| 360 | 'date' => '<th scope="col">'.__('Date').'</th>', |
---|
| 361 | 'author' => '<th scope="col">'.__('Author').'</th>', |
---|
| 362 | 'status' => '<th scope="col">'.__('Status').'</th>' |
---|
| 363 | ); |
---|
| 364 | |
---|
| 365 | $cols = new ArrayObject($cols); |
---|
| 366 | $this->core->callBehavior('adminPostMiniListHeader',$this->core,$this->rs,$cols); |
---|
| 367 | |
---|
[3265] | 368 | // Cope with optional columns |
---|
| 369 | $this->userColumns('posts',$cols); |
---|
| 370 | |
---|
[3089] | 371 | $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; |
---|
[0] | 372 | if ($enclose_block) { |
---|
| 373 | $html_block = sprintf($enclose_block,$html_block); |
---|
| 374 | } |
---|
[2566] | 375 | |
---|
[1909] | 376 | echo $pager->getLinks(); |
---|
[2566] | 377 | |
---|
[0] | 378 | $blocks = explode('%s',$html_block); |
---|
[2566] | 379 | |
---|
[0] | 380 | echo $blocks[0]; |
---|
[2566] | 381 | |
---|
[0] | 382 | while ($this->rs->fetch()) |
---|
| 383 | { |
---|
| 384 | echo $this->postLine(); |
---|
| 385 | } |
---|
[2566] | 386 | |
---|
[0] | 387 | echo $blocks[1]; |
---|
[2566] | 388 | |
---|
[1909] | 389 | echo $pager->getLinks(); |
---|
[0] | 390 | } |
---|
| 391 | } |
---|
[2566] | 392 | |
---|
[0] | 393 | private function postLine() |
---|
| 394 | { |
---|
| 395 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
[3118] | 396 | $sts_class = ''; |
---|
[0] | 397 | switch ($this->rs->post_status) { |
---|
| 398 | case 1: |
---|
[1353] | 399 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
---|
[3118] | 400 | $sts_class = 'sts-online'; |
---|
[0] | 401 | break; |
---|
| 402 | case 0: |
---|
[1353] | 403 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
---|
[3118] | 404 | $sts_class = 'sts-offline'; |
---|
[0] | 405 | break; |
---|
| 406 | case -1: |
---|
[1353] | 407 | $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); |
---|
[3118] | 408 | $sts_class = 'sts-scheduled'; |
---|
[0] | 409 | break; |
---|
| 410 | case -2: |
---|
[1353] | 411 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
---|
[3118] | 412 | $sts_class = 'sts-pending'; |
---|
[0] | 413 | break; |
---|
| 414 | } |
---|
[2566] | 415 | |
---|
[0] | 416 | $protected = ''; |
---|
| 417 | if ($this->rs->post_password) { |
---|
[1353] | 418 | $protected = sprintf($img,__('Protected'),'locker.png'); |
---|
[0] | 419 | } |
---|
[2566] | 420 | |
---|
[0] | 421 | $selected = ''; |
---|
| 422 | if ($this->rs->post_selected) { |
---|
[1353] | 423 | $selected = sprintf($img,__('Selected'),'selected.png'); |
---|
[0] | 424 | } |
---|
[2566] | 425 | |
---|
[0] | 426 | $attach = ''; |
---|
| 427 | $nb_media = $this->rs->countMedia(); |
---|
| 428 | if ($nb_media > 0) { |
---|
| 429 | $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); |
---|
| 430 | $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); |
---|
| 431 | } |
---|
[2566] | 432 | |
---|
[3118] | 433 | $res = '<tr class="line '.($this->rs->post_status != 1 ? 'offline ' : '').$sts_class.'"'. |
---|
[0] | 434 | ' id="p'.$this->rs->post_id.'">'; |
---|
[2566] | 435 | |
---|
[3089] | 436 | $cols = array( |
---|
| 437 | 'title' => '<td scope="row" class="maximal"><a href="'. |
---|
| 438 | $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'" '. |
---|
| 439 | 'title="'.html::escapeHTML($this->rs->getURL()).'">'. |
---|
| 440 | html::escapeHTML($this->rs->post_title).'</a></td>', |
---|
| 441 | 'date' => '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>', |
---|
| 442 | 'author' => '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>', |
---|
| 443 | 'status' => '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>' |
---|
| 444 | ); |
---|
| 445 | |
---|
| 446 | $cols = new ArrayObject($cols); |
---|
| 447 | $this->core->callBehavior('adminPostMiniListValue',$this->core,$this->rs,$cols); |
---|
| 448 | |
---|
[3265] | 449 | // Cope with optional columns |
---|
| 450 | $this->userColumns('posts',$cols); |
---|
| 451 | |
---|
[3089] | 452 | $res .= implode(iterator_to_array($cols)); |
---|
| 453 | $res .= '</tr>'; |
---|
[2566] | 454 | |
---|
[0] | 455 | return $res; |
---|
| 456 | } |
---|
| 457 | } |
---|
| 458 | |
---|
| 459 | class adminCommentList extends adminGenericList |
---|
| 460 | { |
---|
[3044] | 461 | public function display($page,$nb_per_page,$enclose_block='',$filter=false,$spam=false) |
---|
[0] | 462 | { |
---|
| 463 | if ($this->rs->isEmpty()) |
---|
| 464 | { |
---|
[2135] | 465 | if( $filter ) { |
---|
| 466 | echo '<p><strong>'.__('No comments or trackbacks matches the filter').'</strong></p>'; |
---|
| 467 | } else { |
---|
[2666] | 468 | echo '<p><strong>'.__('No comments').'</strong></p>'; |
---|
[2135] | 469 | } |
---|
[0] | 470 | } |
---|
| 471 | else |
---|
| 472 | { |
---|
[3044] | 473 | // Get antispam filters' name |
---|
| 474 | $filters = array(); |
---|
| 475 | if ($spam) { |
---|
[3048] | 476 | if (class_exists('dcAntispam')) { |
---|
[3044] | 477 | dcAntispam::initFilters(); |
---|
| 478 | $fs = dcAntispam::$filters->getFilters(); |
---|
| 479 | foreach ($fs as $fid => $f) |
---|
| 480 | { |
---|
| 481 | $filters[$fid] = $f->name; |
---|
| 482 | } |
---|
| 483 | } |
---|
| 484 | } |
---|
| 485 | |
---|
[1910] | 486 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
---|
[2566] | 487 | |
---|
[1905] | 488 | $comments = array(); |
---|
| 489 | if (isset($_REQUEST['comments'])) { |
---|
| 490 | foreach ($_REQUEST['comments'] as $v) { |
---|
| 491 | $comments[(integer)$v]=true; |
---|
| 492 | } |
---|
[2566] | 493 | } |
---|
[0] | 494 | $html_block = |
---|
[2002] | 495 | '<div class="table-outer">'. |
---|
[2135] | 496 | '<table>'; |
---|
[2566] | 497 | |
---|
[2135] | 498 | if( $filter ) { |
---|
[2386] | 499 | $html_block .= '<caption>'. |
---|
| 500 | sprintf(__( |
---|
| 501 | 'Comment or trackback matching the filter.', |
---|
| 502 | 'List of %s comments or trackbacks matching the filter.', |
---|
| 503 | $this->rs_count), $this->rs_count). |
---|
| 504 | '</caption>'; |
---|
[2135] | 505 | } else { |
---|
[3239] | 506 | $nb_published = $this->core->blog->getComments(array('comment_status' => 1),true)->f(0); |
---|
| 507 | $nb_spam = $this->core->blog->getComments(array('comment_status' => -2),true)->f(0); |
---|
| 508 | $nb_pending = $this->core->blog->getComments(array('comment_status' => -1),true)->f(0); |
---|
| 509 | $nb_unpublished = $this->core->blog->getComments(array('comment_status' => 0),true)->f(0); |
---|
| 510 | $html_block .= '<caption>'. |
---|
| 511 | sprintf(__('List of comments and trackbacks (%s)'),$this->rs_count). |
---|
| 512 | ($nb_published ? |
---|
| 513 | sprintf( |
---|
| 514 | __(', <a href="%s">published</a> (1)',', <a href="%s">published</a> (%s)',$nb_published), |
---|
| 515 | $this->core->adminurl->get('admin.comments',array('status' => 1)), |
---|
| 516 | $nb_published) : ''). |
---|
| 517 | ($nb_spam ? |
---|
| 518 | sprintf( |
---|
| 519 | __(', <a href="%s">spam</a> (1)',', <a href="%s">spam</a> (%s)',$nb_spam), |
---|
| 520 | $this->core->adminurl->get('admin.comments',array('status' => -2)), |
---|
| 521 | $nb_spam) : ''). |
---|
| 522 | ($nb_pending ? |
---|
| 523 | sprintf(__(', <a href="%s">pending</a> (1)',', <a href="%s">pending</a> (%s)',$nb_pending), |
---|
| 524 | $this->core->adminurl->get('admin.comments',array('status' => -1)), |
---|
| 525 | $nb_pending) : ''). |
---|
| 526 | ($nb_unpublished ? |
---|
| 527 | sprintf(__(', <a href="%s">unpublished</a> (1)',', <a href="%s">unpublished</a> (%s)',$nb_unpublished), |
---|
| 528 | $this->core->adminurl->get('admin.comments',array('status' => 0)), |
---|
| 529 | $nb_unpublished) : ''). |
---|
| 530 | '</caption>'; |
---|
[2135] | 531 | } |
---|
[2566] | 532 | |
---|
[3089] | 533 | $cols = array( |
---|
| 534 | 'type' => '<th colspan="2" scope="col" abbr="comm" class="first">'.__('Type').'</th>', |
---|
| 535 | 'author' => '<th scope="col">'.__('Author').'</th>', |
---|
| 536 | 'date' => '<th scope="col">'.__('Date').'</th>', |
---|
| 537 | 'status' => '<th scope="col" class="txt-center">'.__('Status').'</th>' |
---|
| 538 | ); |
---|
[3044] | 539 | if ($spam) { |
---|
[3089] | 540 | $cols['ip'] = '<th scope="col">'.__('IP').'</th>'; |
---|
| 541 | $cols['spam_filter'] = '<th scope="col">'.__('Spam filter').'</th>'; |
---|
[3044] | 542 | } |
---|
[3089] | 543 | $cols['entry'] = '<th scope="col" abbr="entry">'.__('Entry').'</th>'; |
---|
| 544 | |
---|
| 545 | $cols = new ArrayObject($cols); |
---|
| 546 | $this->core->callBehavior('adminCommentListHeader',$this->core,$this->rs,$cols); |
---|
| 547 | |
---|
| 548 | $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; |
---|
[1587] | 549 | |
---|
[0] | 550 | if ($enclose_block) { |
---|
| 551 | $html_block = sprintf($enclose_block,$html_block); |
---|
| 552 | } |
---|
[2566] | 553 | |
---|
[1909] | 554 | echo $pager->getLinks(); |
---|
[2566] | 555 | |
---|
[0] | 556 | $blocks = explode('%s',$html_block); |
---|
[2566] | 557 | |
---|
[0] | 558 | echo $blocks[0]; |
---|
[2566] | 559 | |
---|
[0] | 560 | while ($this->rs->fetch()) |
---|
| 561 | { |
---|
[3044] | 562 | echo $this->commentLine(isset($comments[$this->rs->comment_id]),$spam,$filters); |
---|
[0] | 563 | } |
---|
[2566] | 564 | |
---|
[0] | 565 | echo $blocks[1]; |
---|
[2566] | 566 | |
---|
[1909] | 567 | echo $pager->getLinks(); |
---|
[0] | 568 | } |
---|
| 569 | } |
---|
[2566] | 570 | |
---|
[3044] | 571 | private function commentLine($checked=false,$spam=false,$filters=array()) |
---|
[0] | 572 | { |
---|
[3044] | 573 | global $core, $author, $status, $sortby, $order, $nb_per_page; |
---|
[2566] | 574 | |
---|
[0] | 575 | $author_url = |
---|
[2817] | 576 | $this->core->adminurl->get('admin.comments',array( |
---|
| 577 | 'n' => $nb_per_page, |
---|
| 578 | 'status' => $status, |
---|
| 579 | 'sortby' => $sortby, |
---|
| 580 | 'order' => $order, |
---|
| 581 | 'author' => $this->rs->comment_author |
---|
| 582 | )); |
---|
[2566] | 583 | |
---|
[0] | 584 | $post_url = $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id); |
---|
[2566] | 585 | |
---|
[2817] | 586 | $comment_url = $this->core->adminurl->get('admin.comment',array('id' => $this->rs->comment_id)); |
---|
[2566] | 587 | |
---|
[0] | 588 | $comment_dt = |
---|
| 589 | dt::dt2str($this->core->blog->settings->system->date_format.' - '. |
---|
| 590 | $this->core->blog->settings->system->time_format,$this->rs->comment_dt); |
---|
[2566] | 591 | |
---|
[0] | 592 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
[3118] | 593 | $sts_class = ''; |
---|
[0] | 594 | switch ($this->rs->comment_status) { |
---|
| 595 | case 1: |
---|
[1353] | 596 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
---|
[3118] | 597 | $sts_class = 'sts-online'; |
---|
[0] | 598 | break; |
---|
| 599 | case 0: |
---|
[1353] | 600 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
---|
[3118] | 601 | $sts_class = 'sts-offline'; |
---|
[0] | 602 | break; |
---|
| 603 | case -1: |
---|
[1353] | 604 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
---|
[3118] | 605 | $sts_class = 'sts-pending'; |
---|
[0] | 606 | break; |
---|
| 607 | case -2: |
---|
[1353] | 608 | $img_status = sprintf($img,__('Junk'),'junk.png'); |
---|
[3118] | 609 | $sts_class = 'sts-junk'; |
---|
[0] | 610 | break; |
---|
| 611 | } |
---|
[2566] | 612 | |
---|
[1508] | 613 | $post_title = html::escapeHTML($this->rs->post_title); |
---|
[2152] | 614 | if (mb_strlen($post_title) > 70) { |
---|
| 615 | $post_title = mb_strcut($post_title,0,67).'...'; |
---|
[0] | 616 | } |
---|
[1668] | 617 | $comment_title = sprintf(__('Edit the %1$s from %2$s'), |
---|
| 618 | $this->rs->comment_trackback ? __('trackback') : __('comment'), |
---|
| 619 | html::escapeHTML($this->rs->comment_author)); |
---|
[2566] | 620 | |
---|
[3118] | 621 | $res = '<tr class="line '.($this->rs->comment_status != 1 ? 'offline ' : '').$sts_class.'"'. |
---|
[0] | 622 | ' id="c'.$this->rs->comment_id.'">'; |
---|
[2566] | 623 | |
---|
[3089] | 624 | $cols = array( |
---|
| 625 | 'check' => '<td class="nowrap">'. |
---|
| 626 | form::checkbox(array('comments[]'),$this->rs->comment_id,$checked,'','',0).'</td>', |
---|
| 627 | 'type' => '<td class="nowrap" abbr="'.__('Type and author').'" scope="row">'. |
---|
| 628 | '<a href="'.$comment_url.'" title="'.$comment_title.'">'. |
---|
| 629 | '<img src="images/edit-mini.png" alt="'.__('Edit').'"/> '. |
---|
| 630 | ($this->rs->comment_trackback ? __('trackback') : __('comment')).' '.'</a></td>', |
---|
| 631 | 'author' => '<td class="nowrap maximal"><a href="'.$author_url.'">'. |
---|
| 632 | html::escapeHTML($this->rs->comment_author).'</a></td>', |
---|
| 633 | 'date' => '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).'</td>', |
---|
| 634 | 'status' => '<td class="nowrap status txt-center">'.$img_status.'</td>' |
---|
| 635 | ); |
---|
| 636 | |
---|
[3044] | 637 | if ($spam) { |
---|
| 638 | $filter_name = ''; |
---|
| 639 | if ($this->rs->comment_spam_filter) { |
---|
| 640 | if (isset($filters[$this->rs->comment_spam_filter])) { |
---|
| 641 | $filter_name = $filters[$this->rs->comment_spam_filter]; |
---|
| 642 | } else { |
---|
| 643 | $filter_name = $this->rs->comment_spam_filter; |
---|
| 644 | } |
---|
| 645 | } |
---|
[3089] | 646 | $cols['ip'] = '<td class="nowrap"><a href="'. |
---|
| 647 | $core->adminurl->get("admin.comments",array('ip' => $this->rs->comment_ip)).'">'. |
---|
| 648 | $this->rs->comment_ip.'</a></td>'; |
---|
| 649 | $cols['spam_filter'] = '<td class="nowrap">'.$filter_name.'</td>'; |
---|
[3044] | 650 | } |
---|
[3089] | 651 | $cols['entry'] = '<td class="nowrap discrete"><a href="'.$post_url.'">'.$post_title.'</a>'. |
---|
| 652 | ($this->rs->post_type != 'post' ? ' ('.html::escapeHTML($this->rs->post_type).')' : '').'</td>'; |
---|
[2566] | 653 | |
---|
[3089] | 654 | $cols = new ArrayObject($cols); |
---|
| 655 | $this->core->callBehavior('adminCommentListValue',$this->core,$this->rs,$cols); |
---|
| 656 | |
---|
| 657 | $res .= implode(iterator_to_array($cols)); |
---|
[0] | 658 | $res .= '</tr>'; |
---|
[2566] | 659 | |
---|
[0] | 660 | return $res; |
---|
| 661 | } |
---|
| 662 | } |
---|
| 663 | |
---|
[3402] | 664 | class adminBlogList extends adminGenericList |
---|
| 665 | { |
---|
| 666 | public function display($page,$nb_per_page,$enclose_block='',$filter=false) |
---|
| 667 | { |
---|
| 668 | if ($this->rs->isEmpty()) |
---|
| 669 | { |
---|
| 670 | if($filter) { |
---|
| 671 | echo '<p><strong>'.__('No blog matches the filter').'</strong></p>'; |
---|
| 672 | } else { |
---|
| 673 | echo '<p><strong>'.__('No blog').'</strong></p>'; |
---|
| 674 | } |
---|
| 675 | } |
---|
| 676 | else |
---|
| 677 | { |
---|
| 678 | $blogs = array(); |
---|
| 679 | if (isset($_REQUEST['blogs'])) { |
---|
| 680 | foreach ($_REQUEST['blogs'] as $v) { |
---|
| 681 | $blogs[$v]=true; |
---|
| 682 | } |
---|
| 683 | } |
---|
| 684 | |
---|
| 685 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
---|
| 686 | |
---|
| 687 | $cols = array( |
---|
[3522] | 688 | 'blog' => '<th'. |
---|
| 689 | ($this->core->auth->isSuperAdmin() ? ' colspan="2"' : ''). |
---|
| 690 | ' scope="col" abbr="comm" class="first nowrap">'.__('Blog id').'</th>', |
---|
[3402] | 691 | 'name' => '<th scope="col" abbr="name">'.__('Blog name').'</th>', |
---|
| 692 | 'url' => '<th scope="col" class="nowrap">'.__('URL').'</th>', |
---|
| 693 | 'posts' => '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>', |
---|
| 694 | 'upddt' => '<th scope="col" class="nowrap">'.__('Last update').'</th>', |
---|
| 695 | 'status' => '<th scope="col" class="txt-center">'.__('Status').'</th>' |
---|
| 696 | ); |
---|
| 697 | |
---|
| 698 | $cols = new ArrayObject($cols); |
---|
| 699 | $this->core->callBehavior('adminBlogListHeader',$this->core,$this->rs,$cols); |
---|
| 700 | |
---|
| 701 | $html_block = |
---|
| 702 | '<div class="table-outer"><table>'. |
---|
| 703 | ($filter ? |
---|
| 704 | '<caption>'. |
---|
| 705 | sprintf(__('%d blog matches the filter.','%d blogs match the filter.',$this->rs_count),$this->rs_count). |
---|
| 706 | '</caption>' |
---|
| 707 | : |
---|
| 708 | '<caption class="hidden">'.__('Blogs list').'</caption>' |
---|
| 709 | ). |
---|
| 710 | '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; |
---|
| 711 | |
---|
| 712 | if ($enclose_block) { |
---|
| 713 | $html_block = sprintf($enclose_block,$html_block); |
---|
| 714 | } |
---|
| 715 | |
---|
| 716 | $blocks = explode('%s',$html_block); |
---|
| 717 | |
---|
| 718 | echo $pager->getLinks(); |
---|
| 719 | |
---|
| 720 | echo $blocks[0]; |
---|
| 721 | |
---|
| 722 | while ($this->rs->fetch()) { |
---|
| 723 | echo $this->blogLine(isset($blogs[$this->rs->blog_id])); |
---|
| 724 | } |
---|
| 725 | |
---|
| 726 | echo $blocks[1]; |
---|
| 727 | |
---|
| 728 | echo $pager->getLinks(); |
---|
| 729 | } |
---|
| 730 | } |
---|
| 731 | |
---|
| 732 | private function blogLine($checked=false) |
---|
| 733 | { |
---|
| 734 | $blog_id = html::escapeHTML($this->rs->blog_id); |
---|
| 735 | |
---|
| 736 | $cols = array( |
---|
[3403] | 737 | 'check' => |
---|
[3522] | 738 | ($this->core->auth->isSuperAdmin() ? |
---|
[3402] | 739 | '<td class="nowrap">'. |
---|
| 740 | form::checkbox(array('blogs[]'),$this->rs->blog_id,$checked,'','',0). |
---|
[3522] | 741 | '</td>' : ''), |
---|
[3403] | 742 | 'blog' => |
---|
[3402] | 743 | '<td class="nowrap">'. |
---|
[3522] | 744 | ($this->core->auth->isSuperAdmin() ? |
---|
| 745 | '<a href="'.$this->core->adminurl->get("admin.blog",array('id' => $blog_id)).'" '. |
---|
| 746 | 'title="'.sprintf(__('Edit blog settings for %s'),$blog_id).'">'. |
---|
| 747 | '<img src="images/edit-mini.png" alt="'.__('Edit blog settings').'" /> '.$blog_id.'</a> ' : |
---|
| 748 | $blog_id.' '). |
---|
[3402] | 749 | '</td>', |
---|
[3403] | 750 | 'name' => |
---|
[3402] | 751 | '<td class="maximal">'. |
---|
| 752 | '<a href="'.$this->core->adminurl->get("admin.home",array('switchblog' => $this->rs->blog_id)).'" '. |
---|
| 753 | 'title="'.sprintf(__('Switch to blog %s'),$this->rs->blog_id).'">'. |
---|
| 754 | html::escapeHTML($this->rs->blog_name).'</a>'. |
---|
| 755 | '</td>', |
---|
| 756 | 'url' => |
---|
| 757 | '<td class="nowrap">'. |
---|
| 758 | '<a class="outgoing" href="'. |
---|
| 759 | html::escapeHTML($this->rs->blog_url).'">'.html::escapeHTML($this->rs->blog_url). |
---|
| 760 | ' <img src="images/outgoing-blue.png" alt="" /></a></td>', |
---|
[3403] | 761 | 'posts' => |
---|
[3402] | 762 | '<td class="nowrap count">'. |
---|
| 763 | $this->core->countBlogPosts($this->rs->blog_id). |
---|
| 764 | '</td>', |
---|
[3403] | 765 | 'upddt' => |
---|
[3402] | 766 | '<td class="nowrap count">'. |
---|
| 767 | dt::str(__('%Y-%m-%d %H:%M'),strtotime($this->rs->blog_upddt) + dt::getTimeOffset($this->core->auth->getInfo('user_tz'))). |
---|
| 768 | '</td>', |
---|
[3403] | 769 | 'status' => |
---|
[3402] | 770 | '<td class="nowrap status txt-center">'. |
---|
| 771 | sprintf( |
---|
| 772 | '<img src="images/%1$s.png" alt="%2$s" title="%2$s" />', |
---|
| 773 | ($this->rs->blog_status == 1 ? 'check-on' : ($this->rs->blog_status == 0 ? 'check-off' : 'check-wrn')), |
---|
| 774 | $this->core->getBlogStatus($this->rs->blog_status) |
---|
| 775 | ). |
---|
| 776 | '</td>' |
---|
| 777 | ); |
---|
| 778 | |
---|
| 779 | $cols = new ArrayObject($cols); |
---|
| 780 | $this->core->callBehavior('adminBlogListValue',$this->core,$this->rs,$cols); |
---|
| 781 | |
---|
[3403] | 782 | return |
---|
[3402] | 783 | '<tr class="line" id="b'.$blog_id.'">'. |
---|
| 784 | implode(iterator_to_array($cols)). |
---|
| 785 | '</tr>'; |
---|
| 786 | } |
---|
| 787 | } |
---|
| 788 | |
---|
[0] | 789 | class adminUserList extends adminGenericList |
---|
| 790 | { |
---|
[2135] | 791 | public function display($page,$nb_per_page,$enclose_block='',$filter=false) |
---|
[0] | 792 | { |
---|
| 793 | if ($this->rs->isEmpty()) |
---|
| 794 | { |
---|
[2135] | 795 | if( $filter ) { |
---|
| 796 | echo '<p><strong>'.__('No user matches the filter').'</strong></p>'; |
---|
| 797 | } else { |
---|
| 798 | echo '<p><strong>'.__('No user').'</strong></p>'; |
---|
| 799 | } |
---|
[0] | 800 | } |
---|
| 801 | else |
---|
| 802 | { |
---|
[1910] | 803 | $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); |
---|
[2566] | 804 | |
---|
[0] | 805 | $html_block = |
---|
[2002] | 806 | '<div class="table-outer clear">'. |
---|
[2135] | 807 | '<table>'; |
---|
[2566] | 808 | |
---|
[2135] | 809 | if( $filter ) { |
---|
| 810 | $html_block .= '<caption>'.sprintf(__('List of %s users match the filter.'), $this->rs_count).'</caption>'; |
---|
| 811 | } else { |
---|
| 812 | $html_block .= '<caption class="hidden">'.__('Users list').'</caption>'; |
---|
| 813 | } |
---|
[2566] | 814 | |
---|
[3089] | 815 | $cols = array( |
---|
| 816 | 'username' => '<th colspan="2" scope="col" class="first">'.__('Username').'</th>', |
---|
| 817 | 'first_name' => '<th scope="col">'.__('First Name').'</th>', |
---|
| 818 | 'last_name' => '<th scope="col">'.__('Last Name').'</th>', |
---|
| 819 | 'display_name' => '<th scope="col">'.__('Display name').'</th>', |
---|
| 820 | 'entries' => '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>' |
---|
| 821 | ); |
---|
[2566] | 822 | |
---|
[3089] | 823 | $cols = new ArrayObject($cols); |
---|
| 824 | $this->core->callBehavior('adminUserListHeader',$this->core,$this->rs,$cols); |
---|
| 825 | |
---|
| 826 | $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; |
---|
[0] | 827 | if ($enclose_block) { |
---|
| 828 | $html_block = sprintf($enclose_block,$html_block); |
---|
| 829 | } |
---|
[2566] | 830 | |
---|
[1909] | 831 | echo $pager->getLinks(); |
---|
[2566] | 832 | |
---|
[0] | 833 | $blocks = explode('%s',$html_block); |
---|
[2566] | 834 | |
---|
[0] | 835 | echo $blocks[0]; |
---|
[2566] | 836 | |
---|
[0] | 837 | while ($this->rs->fetch()) |
---|
| 838 | { |
---|
| 839 | echo $this->userLine(); |
---|
| 840 | } |
---|
[2566] | 841 | |
---|
[0] | 842 | echo $blocks[1]; |
---|
[2566] | 843 | |
---|
[1909] | 844 | echo $pager->getLinks(); |
---|
[0] | 845 | } |
---|
| 846 | } |
---|
[2566] | 847 | |
---|
[0] | 848 | private function userLine() |
---|
| 849 | { |
---|
| 850 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
| 851 | $img_status = ''; |
---|
[2566] | 852 | |
---|
[0] | 853 | $p = $this->core->getUserPermissions($this->rs->user_id); |
---|
[2566] | 854 | |
---|
[0] | 855 | if (isset($p[$this->core->blog->id]['p']['admin'])) { |
---|
| 856 | $img_status = sprintf($img,__('admin'),'admin.png'); |
---|
| 857 | } |
---|
| 858 | if ($this->rs->user_super) { |
---|
| 859 | $img_status = sprintf($img,__('superadmin'),'superadmin.png'); |
---|
| 860 | } |
---|
[3089] | 861 | |
---|
| 862 | $res = '<tr class="line">'; |
---|
| 863 | |
---|
| 864 | $cols = array( |
---|
| 865 | 'check' => '<td class="nowrap">'.form::hidden(array('nb_post[]'),(integer) $this->rs->nb_post). |
---|
| 866 | form::checkbox(array('users[]'),$this->rs->user_id).'</td>', |
---|
| 867 | 'username' => '<td class="maximal" scope="row"><a href="'. |
---|
| 868 | $this->core->adminurl->get('admin.user',array('id' => $this->rs->user_id)).'">'. |
---|
| 869 | $this->rs->user_id.'</a> '.$img_status.'</td>', |
---|
| 870 | 'first_name' => '<td class="nowrap">'.html::escapeHTML($this->rs->user_firstname).'</td>', |
---|
| 871 | 'last_name' => '<td class="nowrap">'.html::escapeHTML($this->rs->user_name).'</td>', |
---|
| 872 | 'display_name' => '<td class="nowrap">'.html::escapeHTML($this->rs->user_displayname).'</td>', |
---|
| 873 | 'entries' => '<td class="nowrap count"><a href="'. |
---|
| 874 | $this->core->adminurl->get('admin.posts',array('user_id' => $this->rs->user_id)).'">'. |
---|
| 875 | $this->rs->nb_post.'</a></td>' |
---|
| 876 | ); |
---|
| 877 | |
---|
| 878 | $cols = new ArrayObject($cols); |
---|
| 879 | $this->core->callBehavior('adminUserListValue',$this->core,$this->rs,$cols); |
---|
| 880 | |
---|
| 881 | $res .= implode(iterator_to_array($cols)); |
---|
| 882 | $res .= '</tr>'; |
---|
| 883 | |
---|
| 884 | return $res; |
---|
[0] | 885 | } |
---|
| 886 | } |
---|