Revize 559
Přidáno uživatelem Michal Kliment před téměř 15 roky(ů)
freenetis/trunk/kohana/application/helpers/dns.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/**
|
||
* Dns helper class.
|
||
*
|
||
* $Id: dns.php
|
||
*
|
||
* @package Core
|
||
* @author Kliment Michal
|
||
* @copyright (c) 2009 Kliment Michal
|
||
*/
|
||
|
||
class dns_Core {
|
||
|
||
/**
|
||
* @author Michal Kliment
|
||
* Create reverse dns lookup from ip address
|
||
* @param string ip address
|
||
* @return string
|
||
*/
|
||
public static function create_reverse_dns_lookup_from_ip_address($ip_address)
|
||
{
|
||
if ($ip_address == '') return '';
|
||
|
||
$segments = explode('.', $ip_address);
|
||
$segments = array_reverse($segments);
|
||
|
||
return implode('.', $segments).'.IN-ADDR.ARPA.';
|
||
}
|
||
|
||
/**
|
||
* @author Michal Kliment
|
||
* Get ptr (reverse) record from ip address
|
||
* @param string ip address
|
||
* @return string
|
||
*/
|
||
public static function get_ptr_record($ip_address)
|
||
{
|
||
if (!valid::ip($ip_address)) return '';
|
||
|
||
$result = dns_get_record(dns::create_reverse_dns_lookup_from_ip_address($ip_address), DNS_PTR);
|
||
|
||
return $result[0]['target'];
|
||
}
|
||
|
||
} // End dns
|
freenetis/trunk/kohana/application/controllers/subnets.php | ||
---|---|---|
$sql_offset = 0;
|
||
//$query = $subnet_model->orderby($order_by,$order_by_direction)->limit($limit_results,$sql_offset)->find_all();
|
||
$query = $subnet_model->get_all_subnets($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
|
||
$grid = new Grid(url_lang::base().'subnets', null,array(
|
||
|
||
$grid = new Grid(url_lang::base().'devices', null, array(
|
||
//'separator' => '<br />-----------',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 200, // increace
|
||
'selector_min' => 200, // minimum where selector start
|
||
'selector_max_multiplier' => 100,
|
||
'base_url' => Config::item('locale.lang').'/devices/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_subnet' => 'page', // pass a string as uri_subnet to trigger former 'label' functionality
|
||
'total_items' => $total_subnets, // use db count query here of course
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 500, // increace
|
||
'selector_min' => 500, // minimum where selector start
|
||
'selector_max_multiplier' => 20,
|
||
'base_url' => Config::item('locale.lang').'/subnets/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_subnets, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'filter' => $filter->view,
|
||
'query_string' => $query_string
|
||
'query_string' => $query_string,
|
||
'filter' => $filter->view
|
||
));
|
||
|
||
if ($this->acl_check_new('Devices_Controller', 'subnet'))
|
freenetis/trunk/kohana/application/views/main.php | ||
---|---|---|
</tr>
|
||
<tr>
|
||
<td class="orange"><?php echo url_lang::lang('texts.IP address').':' ?></td>
|
||
<td class="bold"> <?php echo server::remote_addr() ?></td>
|
||
<td class="bold"> <?php echo server::remote_addr() ?><?php echo ($ptr_record = dns::get_ptr_record(server::remote_addr()))!='' ? ' <i>('.$ptr_record.')</i>' : '' ?></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
... | ... | |
<div id="footer">
|
||
<div id="footer-padd">
|
||
<?php
|
||
$footer_links[] = html::anchor("http://wiki.freenetis.slfree.net/", url_lang::lang('texts.Documentation'));
|
||
$footer_links[] = html::anchor("http://wiki.freenetis.org/", url_lang::lang('texts.Documentation'));
|
||
$footer_links[] = html::anchor("http://sourceforge.net/projects/freenetis/", url_lang::lang('texts.Project site'));
|
||
echo ' '.implode(' | ', $footer_links);
|
||
?>
|
Také k dispozici: Unified diff
Pridan novy helper pro praci s DNS. Opraveno strankovani u podsiti.