rs->isEmpty()) echo '

'.__('No short link').'

'; else { $pager = new pager($page,$this->rs_count,$nb_per_page,10); $pager->base_url = $url; $html_block = ''. ''. ''. ''. ''. ''. ''. ''. ''. '%s'. '
'.__('Hash').''.__('Link').''.__('Date').''.__('Service').'
'; echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; $blocks = explode('%s',$html_block); echo $blocks[0]; $this->rs->index(((integer)$page - 1) * $nb_per_page); $iter = 0; while ($iter < $nb_per_page) { echo $this->line($url,$iter); if ($this->rs->isEnd()) break; else $this->rs->moveNext(); $iter++; } echo $blocks[1]; echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; } } private function line($url,$loop) { $type = $this->rs->kut_type; $hash = $this->rs->kut_hash; if (null !== ($o = kutrl::quickService($this->rs->kut_type))) { $type = ''.$o->name.''; $hash = ''.$hash.''; } return ''."\n". ''. form::checkbox(array('entries['.$loop.']'),$this->rs->kut_id,0). ''. ''. $hash. "\n". ''. ''.$this->rs->kut_url.''. "\n". ''. dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->kut_dt,$this->core->auth->getInfo('user_tz')). "\n". ''. $type. "\n". ''."\n"; } } # Logs class $log = new kutrlLog($core); # Filters $show_filters = false; $urlsrv = !empty($_GET['urlsrv']) ? $_GET['urlsrv'] : ''; $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'kut_dt'; $order = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; $nb_per_page = 30; if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { if ($nb_per_page != $_GET['nb']) $show_filters = true; $nb_per_page = (integer) $_GET['nb']; } # Combos $sortby_combo = array( __('Date') => 'kut_dt', __('Long link') => 'kut_url', __('Short link') => 'kut_hash' ); $order_combo = array( __('Descending') => 'desc', __('Ascending') => 'asc' ); $services_combo = array(); foreach(kutrl::getServices($core) as $service_id => $service) { $o = new $service($core); $services_combo[__($o->name)] = $o->id; } $ext_services_combo = array_merge(array(__('Disabled')=>''),$services_combo); $lst_services_combo = array_merge(array('-'=>''),$services_combo); # Params for list $params = array(); $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); if ($sortby != '' && in_array($sortby,$sortby_combo)) { if ($urlsrv != '' && in_array($urlsrv,$lst_services_combo)) $params['kut_type'] = $urlsrv; if ($order != '' && in_array($order,$order_combo)) $params['order'] = $sortby.' '.$order; if ($sortby != 'kut_dt' || $order != 'desc' || $urlsrv != '') $show_filters = true; } $pager_base_url = $p_url. '&tab=list'. '&urlsrv='.$urlsrv. '&sortby='.$sortby. '&order='.$order. '&nb='.$nb_per_page. '&page=%s'; # Delete links from list if ($action == 'deletelinks') { try { foreach($_POST['entries'] as $k => $id) { $rs = $log->getLogs(array('kut_id'=>$id)); if ($rs->isEmpty()) continue; if (null === ($o = kutrl::quickService($rs->kut_type))) continue; $o->remove($rs->kut_url); } $core->blog->triggerBlog(); http::redirect($p_url.'&part=links&urlsrv='.$urlsrv.'&sortby='.$sortby.'&order='.$order.'&nb='.$nb_per_page.'&page='.$page.'&msg='.$action); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Get links and pager try { $list_all = $log->getLogs($params); $list_counter = $log->getLogs($params,true)->f(0); $list_current = new kutrlLinksList($core,$list_all,$list_counter,$pager_base_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } if (!$show_filters) { $header .= dcPage::jsLoad('js/filter-controls.js'); } echo ' kUtRL, '.__('Links shortener').''. "\n\n". $header.'

kUtRL'. ' › '.__('Links'). ' - '.__('New link').''. '

'.$msg; if (!$show_filters) { echo '

'. __('Filters').'

'; } echo '
'.__('Filters').'

'. form::hidden(array('p'),'kUtRL'). form::hidden(array('part'),'links').'


'; $list_current->display($page,$nb_per_page,$pager_base_url); echo '

'. form::hidden(array('action'),'deletelinks'). form::hidden(array('urlsrv'),$urlsrv). form::hidden(array('sortby'),$sortby). form::hidden(array('order'),$order). form::hidden(array('page'),$page). form::hidden(array('nb'),$nb_per_page). form::hidden(array('p'),'kUtRL'). form::hidden(array('part'),'links'). $core->formNonce().'

'; dcPage::helpBlock('kUtRL'); echo $footer.''; ?>