Revize 1126
Přidáno uživatelem Jiří Sviták před více než 13 roky(ů)
freenetis/branches/testing/application/models/subnet.php | ||
---|---|---|
", $subnet_id);
|
||
}
|
||
|
||
/**
|
||
* Function gets subnets with slash notation like 192.168.0.0/24. Gateway redirect rules are applied
|
||
* to these ip address range. These ranges are downloaded by main gateway on address redirect/ipset/ranges.
|
||
*
|
||
* @return unknown_type
|
||
*/
|
||
public function get_subnets_to_redirect()
|
||
{
|
||
return $this->db->query("
|
||
SELECT CONCAT(network_address, '/', 32-log2((~inet_aton(netmask) & 0xffffffff) + 1)) AS network_range
|
||
FROM subnets
|
||
WHERE redirect = 1
|
||
");
|
||
}
|
||
|
||
/**
|
||
* Function finds subnet to which given ip address belongs to.
|
freenetis/branches/testing/application/controllers/ip_addresses.php | ||
---|---|---|
->options($arr_bool)
|
||
->selected('0');
|
||
|
||
$this->form->dropdown('whitelisted')
|
||
->label(url_lang::lang('texts.Never redirect').': '.help::hint('never_redirect'))
|
||
->options($arr_bool)
|
||
->selected('0');
|
||
|
||
$this->form->submit('submit')
|
||
->value(url_lang::lang('texts.Save'));
|
||
|
||
... | ... | |
$ip->subnet_id = $form_data['subnet_id'];
|
||
$ip->gateway = $form_data['gateway'];
|
||
$ip->service = $form_data['service'];
|
||
$ip->whitelisted = $form_data['whitelisted'];
|
||
$ip->whitelisted = Ip_address_Model::$no_whitelist;
|
||
unset($form_data);
|
||
|
||
if ($ip->save())
|
||
... | ... | |
$ip->subnet_id = $form_data['subnet_id'];
|
||
$ip->gateway = $form_data['gateway'];
|
||
$ip->service = $form_data['service'];
|
||
$ip->whitelisted = Ip_address_Model::$no_whitelist;
|
||
unset($form_data);
|
||
|
||
if ($ip->save())
|
||
... | ... | |
$ip->subnet_id = $form_data['subnet_id'];
|
||
$ip->gateway = $form_data['gateway'];
|
||
$ip->service = $form_data['service'];
|
||
|
||
$ip->whitelisted = Ip_address_Model::$no_whitelist;
|
||
unset($form_data);
|
||
|
||
if ($ip->save())
|
freenetis/branches/testing/application/views/main.php | ||
---|---|---|
<script language="javascript" type="text/javascript">
|
||
tinyMCE.init({
|
||
// General options
|
||
entity_encoding : "raw",
|
||
mode : "textareas",
|
||
theme : "advanced",
|
||
editor_selector : "wysiwyg",
|
freenetis/branches/testing/redirection/index.php | ||
---|---|---|
LIMIT 1";
|
||
$message_result = mysql_query($message_query, $link) or die(mysql_error());
|
||
$message = mysql_fetch_array($message_result);
|
||
if ($message !== false)
|
||
if ($message && count($message) > 0)
|
||
{
|
||
$content = $message['text'];
|
||
}
|
||
// if no message found for given ip address, than redirection cancelled message will appear
|
||
// if no message found for given ip address, than it is unknown page
|
||
else
|
||
{
|
||
$message_query = "SELECT * FROM messages WHERE ID = 2";
|
||
// unknown device message, we assume that this message is always installed with id 3
|
||
$message_query = "
|
||
SELECT ms.text,
|
||
(
|
||
SELECT name
|
||
FROM subnets s
|
||
WHERE inet_aton(netmask) & inet_aton('$ip_address') = inet_aton(network_address)
|
||
) AS subnet_name,
|
||
'$ip_address' AS ip_address,
|
||
'???' AS member_name,
|
||
'???' AS member_id,
|
||
'???' AS balance,
|
||
'???' AS variable_symbol,
|
||
'???' AS comment
|
||
FROM messages ms
|
||
WHERE ms.id = 3";
|
||
$message_result = mysql_query($message_query, $link) or die(mysql_error());
|
||
$message = mysql_fetch_array($message_result);
|
||
$content = $message['text'];
|
||
... | ... | |
$logo_query = "SELECT name, value FROM config WHERE name = 'redirection_logo_url'";
|
||
$logo_result = mysql_query($logo_query, $link) or die(mysql_error());
|
||
$logo_array = mysql_fetch_array($logo_result);
|
||
if (!$logo_array) { echo 'logo not set'; die(mysql_error()); }
|
||
if (!$logo_array)
|
||
{
|
||
echo 'Logo url has not been set, configure your redirection settings.';
|
||
die();
|
||
}
|
||
$logo = $logo_array['value'];
|
||
// self cancelable messages have additional anchor for self canceling placed in footer
|
||
/*
|
||
... | ... | |
$sct_query = "SELECT name, value FROM config WHERE name = 'self_cancel_text'";
|
||
$sct_result = mysql_query($sct_query, $link) or die(mysql_error());
|
||
$sct_array = mysql_fetch_array($sct_result);
|
||
if (!$sct_array) { echo 'self_cancel_text not set'; die(mysql_error()); }
|
||
if (!$sct_array)
|
||
{
|
||
echo 'self_cancel_text has not been set, configure your redirection settings.';
|
||
die();
|
||
}
|
||
$sct = $sct_array['value'];
|
||
if ($message['self_cancel'] > 0)
|
||
//$footer = '<a href="'.$scu.'">'.$sct.'</a>';
|
||
... | ... | |
<body>
|
||
<div id="main">
|
||
<div id="header">
|
||
<?php//<h1 id="logo"><span>Freenetis</span></h1>?>
|
||
<h1 style="position:absolute;
|
||
top:24px;
|
||
left:18px;
|
||
background:url(<?php echo $logo ?>);
|
||
width:212px;
|
||
height:49px;
|
||
background-repeat:no-repeat;
|
||
"></h1>
|
||
<!--<img src="<?php echo $logo ?>" />-->
|
||
<div class="status">
|
||
|
||
</div>
|
||
... | ... | |
</div>
|
||
<div id="footer">
|
||
<div id="footer-padd" style="text-align:center;">
|
||
<?php //echo number_format(memory_get_usage() / 1024 / 1024, 2).' MB'; ?>
|
||
<?php echo $footer ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<span style="display:none;"><?php echo number_format(memory_get_usage() / 1024 / 1024, 2).' MB'; ?></span>
|
||
</body>
|
||
</html>
|
Také k dispozici: Unified diff
oprava chyby, nezobrazovala se spravne zprava pro nezname zarizeni, oprava html editoru pro zpravy