%s'; return sprintf ($formatter, $li_class,$href,$img_src,$img_alt,$img_alt); } else { $formatter = ''; return sprintf ($formatter, $li_class,$img_src_nolink,$img_alt,$img_alt); } } public function setURL() { parent::setURL(); $url = parse_url($_SERVER['REQUEST_URI']); if (isset($url['query'])) { parse_str($url['query'],$args); } else { $args=array(); } # Removing session information if (session_id()) { if (isset($args[session_name()])) unset($args[session_name()]); } if (isset($args[$this->var_page])) { unset($args[$this->var_page]); } if (isset($args['ok'])) { unset($args['ok']); } $this->form_hidden = ''; foreach ($args as $k=>$v) { $this->form_hidden .= form::hidden(array($k),$v); } $this->form_action = $url['path']; } /** * Pager Links * * Returns pager links * * @return string */ public function getLinks() { $this->setURL(); $htmlFirst = $this->getLink( "first", sprintf($this->page_url,1), "images/pagination/first.png", "images/pagination/no-first.png", __('First page'), ($this->env > 1) ); $htmlPrev = $this->getLink( "prev", sprintf($this->page_url,$this->env-1), "images/pagination/previous.png", "images/pagination/no-previous.png", __('Previous page'), ($this->env > 1) ); $htmlNext = $this->getLink( "next", sprintf($this->page_url,$this->env+1), "images/pagination/next.png", "images/pagination/no-next.png", __('Next page'), ($this->env < $this->nb_pages) ); $htmlLast = $this->getLink( "last", sprintf($this->page_url,$this->nb_pages), "images/pagination/last.png", "images/pagination/no-last.png", __('Last page'), ($this->env < $this->nb_pages) ); $htmlCurrent = '
  • '. sprintf(__('Page %s / %s'),$this->env,$this->nb_pages). '
  • '; $htmlDirect = sprintf('
  • '.__('Direct access page %s'), form::field(array('page'),3,10)). ''.$this->form_hidden.'
  • '; $res = '
    '. ''. '
    ' ; return $this->nb_elements > 0 ? $res : ''; } } class adminGenericList { protected $core; protected $rs; protected $rs_count; public function __construct($core,$rs,$rs_count) { $this->core =& $core; $this->rs =& $rs; $this->rs_count = $rs_count; $this->html_prev = __('« prev.'); $this->html_next = __('next »'); } } class adminPostList extends adminGenericList { public function display($page,$nb_per_page,$enclose_block='') { if ($this->rs->isEmpty()) { echo '

    '.__('No entry').'

    '; } else { $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); $entries = array(); if (isset($_REQUEST['entries'])) { foreach ($_REQUEST['entries'] as $v) { $entries[(integer)$v]=true; } } $html_block = ''. ''. ''. ''. ''. ''. ''. ''. '%s
    '.__('Title').''.__('Date').''.__('Category').''.__('Author').''.__('Comments').''.__('Trackbacks').''.__('Status').'
    '; if ($enclose_block) { $html_block = sprintf($enclose_block,$html_block); } echo $pager->getLinks(); $blocks = explode('%s',$html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->postLine(isset($entries[$this->rs->post_id])); } echo $blocks[1]; echo $pager->getLinks(); } } private function postLine($checked) { if ($this->core->auth->check('categories',$this->core->blog->id)) { $cat_link = '%s'; } else { $cat_link = '%2$s'; } if ($this->rs->cat_title) { $cat_title = sprintf($cat_link,$this->rs->cat_id, html::escapeHTML($this->rs->cat_title)); } else { $cat_title = __('(No cat)'); } $img = '%1$s'; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img,__('Published'),'check-on.png'); break; case 0: $img_status = sprintf($img,__('Unpublished'),'check-off.png'); break; case -1: $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); break; case -2: $img_status = sprintf($img,__('Pending'),'check-wrn.png'); break; } $protected = ''; if ($this->rs->post_password) { $protected = sprintf($img,__('Protected'),'locker.png'); } $selected = ''; if ($this->rs->post_selected) { $selected = sprintf($img,__('Selected'),'selected.png'); } $attach = ''; $nb_media = $this->rs->countMedia(); if ($nb_media > 0) { $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); } $res = ''; $res .= ''. form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable()).''. ''. html::escapeHTML($this->rs->post_title).''. ''.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).''. ''.$cat_title.''. ''.html::escapeHTML($this->rs->user_id).''. ''.$this->rs->nb_comment.''. ''.$this->rs->nb_trackback.''. ''.$img_status.' '.$selected.' '.$protected.' '.$attach.''. ''; return $res; } } class adminPostMiniList extends adminGenericList { public function display($page,$nb_per_page,$enclose_block='') { if ($this->rs->isEmpty()) { echo '

    '.__('No entry').'

    '; } else { $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); $html_block = ''. ''. ''. ''. ''. '%s
    '.__('Title').''.__('Date').''.__('Author').''.__('Status').'
    '; if ($enclose_block) { $html_block = sprintf($enclose_block,$html_block); } echo $pager->getLinks(); $blocks = explode('%s',$html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->postLine(); } echo $blocks[1]; echo $pager->getLinks(); } } private function postLine() { $img = '%1$s'; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img,__('Published'),'check-on.png'); break; case 0: $img_status = sprintf($img,__('Unpublished'),'check-off.png'); break; case -1: $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); break; case -2: $img_status = sprintf($img,__('Pending'),'check-wrn.png'); break; } $protected = ''; if ($this->rs->post_password) { $protected = sprintf($img,__('Protected'),'locker.png'); } $selected = ''; if ($this->rs->post_selected) { $selected = sprintf($img,__('Selected'),'selected.png'); } $attach = ''; $nb_media = $this->rs->countMedia(); if ($nb_media > 0) { $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); } $res = ''; $res .= ''. html::escapeHTML($this->rs->post_title).''. ''.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).''. ''.html::escapeHTML($this->rs->user_id).''. ''.$img_status.' '.$selected.' '.$protected.' '.$attach.''. ''; return $res; } } class adminCommentList extends adminGenericList { public function display($page,$nb_per_page,$enclose_block='') { if ($this->rs->isEmpty()) { echo '

    '.__('No comment').'

    '; } else { $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); $html_block = ''. ''. ''. ''. ''. ''. '%s
    '.__('Type').''.__('Author').''.__('Date').''.__('Status').''.__('Entry title').'
    '; if ($enclose_block) { $html_block = sprintf($enclose_block,$html_block); } echo $pager->getLinks(); $blocks = explode('%s',$html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->commentLine(); } echo $blocks[1]; echo $pager->getLinks(); } } private function commentLine() { global $author, $status, $sortby, $order, $nb_per_page; $author_url = 'comments.php?n='.$nb_per_page. '&status='.$status. '&sortby='.$sortby. '&order='.$order. '&author='.rawurlencode($this->rs->comment_author); $post_url = $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id); $comment_url = 'comment.php?id='.$this->rs->comment_id; $comment_dt = dt::dt2str($this->core->blog->settings->system->date_format.' - '. $this->core->blog->settings->system->time_format,$this->rs->comment_dt); $img = '%1$s'; switch ($this->rs->comment_status) { case 1: $img_status = sprintf($img,__('Published'),'check-on.png'); break; case 0: $img_status = sprintf($img,__('Unpublished'),'check-off.png'); break; case -1: $img_status = sprintf($img,__('Pending'),'check-wrn.png'); break; case -2: $img_status = sprintf($img,__('Junk'),'junk.png'); break; } $post_title = html::escapeHTML($this->rs->post_title); if (mb_strlen($post_title) > 60) { $post_title = mb_strcut($post_title,0,57).'...'; } $comment_title = sprintf(__('Edit the %1$s from %2$s'), $this->rs->comment_trackback ? __('trackback') : __('comment'), html::escapeHTML($this->rs->comment_author)); $res = ''; $res .= ''. form::checkbox(array('comments[]'),$this->rs->comment_id,'','','',0).''. ''. ''. ''.__('Edit').' '. ($this->rs->comment_trackback ? __('trackback') : __('comment')).' '.''. ''.html::escapeHTML($this->rs->comment_author).''. ''.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).''. ''.$img_status.''. ''. html::escapeHTML($post_title).''. ($this->rs->post_type != 'post' ? ' ('.html::escapeHTML($this->rs->post_type).')' : '').''; $res .= ''; return $res; } } class adminUserList extends adminGenericList { public function display($page,$nb_per_page,$enclose_block='') { if ($this->rs->isEmpty()) { echo '

    '.__('No user').'

    '; } else { $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); $html_block = ''. ''. ''. ''. ''. ''. '%s
    '.__('Username').''.__('First Name').''.__('Last Name').''.__('Display name').''.__('Entries (all types)').'
    '; if ($enclose_block) { $html_block = sprintf($enclose_block,$html_block); } echo $pager->getLinks(); $blocks = explode('%s',$html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->userLine(); } echo $blocks[1]; echo $pager->getLinks(); } } private function userLine() { $img = '%1$s'; $img_status = ''; $p = $this->core->getUserPermissions($this->rs->user_id); if (isset($p[$this->core->blog->id]['p']['admin'])) { $img_status = sprintf($img,__('admin'),'admin.png'); } if ($this->rs->user_super) { $img_status = sprintf($img,__('superadmin'),'superadmin.png'); } return ''. ''.form::hidden(array('nb_post[]'),(integer) $this->rs->nb_post). form::checkbox(array('users[]'),$this->rs->user_id).''. ''. $this->rs->user_id.' '.$img_status.''. ''.html::escapeHTML($this->rs->user_firstname).''. ''.html::escapeHTML($this->rs->user_name).''. ''.html::escapeHTML($this->rs->user_displayname).''. ''. $this->rs->nb_post.''. ''; } } ?>