Revize 1127
Přidáno uživatelem Jiří Sviták před asi 13 roky(ů)
freenetis/branches/testing/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'redirection logs' => 'Logy přesměrování',
|
||
'redirection "%s" for %d ip addresses have been activated' => 'Přesměrování "%s" pro %d IP adres bylo aktivováno.',
|
||
'redirection of ip address' => 'Přesměrování IP adresy',
|
||
'redirection preview' => 'Náhled přesměrování',
|
||
'redirection records' => 'Záznamy přesměrování',
|
||
'redirection settings' => 'Nastavení přesměrování',
|
||
'redirection settings have been successfully updated' => 'Nastavení přesměrování bylo úspěšně upraveno.',
|
freenetis/branches/testing/application/controllers/ip_addresses.php | ||
---|---|---|
'0'=> url_lang::lang('texts.No'),
|
||
'1'=> url_lang::lang('texts.Yes')
|
||
);
|
||
|
||
$whitelist_array[Ip_address_Model::$no_whitelist] = url_lang::lang('texts.No whitelist');
|
||
$whitelist_array[Ip_address_Model::$permanent_whitelist] = url_lang::lang('texts.Permanent whitelist');
|
||
$whitelist_array[Ip_address_Model::$temporary_whitelist] = url_lang::lang('texts.Temporary whitelist');
|
||
|
||
if (count($arr_ifaces))
|
||
{
|
||
... | ... | |
->add_button('subnets');
|
||
|
||
$this->form->dropdown('gateway')
|
||
->label(url_lang::lang('texts.Gateway'))
|
||
->label(url_lang::lang('texts.Gateway').': '.help::hint('gateway'))
|
||
->options($arr_bool)
|
||
->selected($ip_address->gateway);
|
||
|
||
$this->form->dropdown('service')
|
||
->label(url_lang::lang('texts.Service'))
|
||
->label(url_lang::lang('texts.Service').': '.help::hint('service'))
|
||
->options($arr_bool)
|
||
->selected($ip_address->service);
|
||
|
||
$this->form->dropdown('whitelisted')
|
||
->label(url_lang::lang('texts.Never redirect'))
|
||
->options($arr_bool)
|
||
->label(url_lang::lang('texts.Whitelist').': '.help::hint('whitelist'))
|
||
->options($whitelist_array)
|
||
->selected($ip_address->whitelisted);
|
||
|
||
$this->form->submit('submit')
|
freenetis/branches/testing/application/controllers/settings.php | ||
---|---|---|
'approval' => url_lang::lang('texts.Approval'),
|
||
'voip' => url_lang::lang('texts.VoIP'),
|
||
'sms' => url_lang::lang('texts.SMS'),
|
||
'redirection' => url_lang::lang('texts.Redirection'),
|
||
'logging' => url_lang::lang('texts.Logování'),
|
||
'map' => url_lang::lang('texts.Map'),
|
||
'registration_export' => url_lang::lang('texts.Export of registration')
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
|
||
|
||
function redirection()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit(get_class($this),'system'))
|
||
Controller::error(ACCESS);
|
||
// creating of new forge
|
||
$this->form = new Forge(url_lang::base()."settings/redirection", '', 'POST', array('id' => 'article_form'));
|
||
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$this->form->group('')->label(url_lang::lang('texts.Gateway'));
|
||
$this->form->input('gateway')->label(url_lang::lang('texts.Gateway IP address').':')->value($this->settings->get('gateway'));
|
||
$this->form->html_textarea('website_after_redirection')->label(url_lang::lang('texts.Website after redirection').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('website_after_redirection')));
|
||
$this->form->html_textarea('contact')->label(url_lang::lang('texts.Contact list on redirect page').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('contact')));
|
||
$this->form->html_textarea('info')->label(url_lang::lang('texts.Information for members (how to log in)').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('info')));
|
||
$this->form->html_textarea('unknown_device')->label(url_lang::lang('texts.Unknown device text').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('unknown_device')));
|
||
$this->form->html_textarea('interrupt')->label(url_lang::lang('texts.Membership interrupt text').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('interrupt')));
|
||
$this->form->html_textarea('debtor')->label(url_lang::lang('texts.Debtor text').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('debtor')));
|
||
$this->form->html_textarea('payment_notice')->label(url_lang::lang('texts.Payment notice text').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('payment_notice')));
|
||
$this->form->html_textarea('optional_message')->label(url_lang::lang('texts.Optional message text').':')->rows(5)->cols(100)->value(stripslashes($this->settings->get('optional_message')));
|
||
$this->form->group('')->label(url_lang::lang('texts.Allowed subnets').' '.help::hint('allowed_subnets'));
|
||
$this->form->checkbox('allowed_subnets_enabled')->label(url_lang::lang('texts.Enabled'))->value(1)->checked(Settings::get('allowed_subnets_enabled'));
|
||
$this->form->input('allowed_subnets_update_interval')->label(url_lang::lang('texts.Interval of update').': '.help::hint('allowed_subnets_update_interval'))->value(Settings::get('allowed_subnets_update_interval'));
|
||
$this->form->input('allowed_subnets_default_count')->label(url_lang::lang('texts.Default count').': '.help::hint('allowed_subnets_default_count'))->value(Settings::get('allowed_subnets_default_count'));
|
||
$this->form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
special::required_forge_style($this->form, ' *', 'required');
|
||
// form validate
|
||
if ($this->form->validate())
|
||
{
|
||
$form_data = $this->form->as_array();
|
||
$config_model = new Config_Model();
|
||
|
||
$allowed_subnets_enabled = (isset($form_data['allowed_subnets_enabled']) && $form_data['allowed_subnets_enabled'] == 1) ? '1' : '0';
|
||
$config_model->update_variable('allowed_subnets_enabled', $allowed_subnets_enabled);
|
||
|
||
// clears redirections after turning off
|
||
if (!$allowed_subnets_enabled)
|
||
{
|
||
ORM::factory('ip_address')->clear_disable_ips ();
|
||
ORM::factory('subnets_owner')->clear_disable_subnets ();
|
||
}
|
||
|
||
$issaved = true;
|
||
foreach ($form_data as $name => $value)
|
||
{
|
||
if ($name == 'allowed_subnets_enabled') continue;
|
||
$value = addslashes($value);
|
||
// check if variable exists
|
||
if ($config_model->check_exist_variable($name))
|
||
// update of variable
|
||
$issaved = $issaved && $config_model->update_variable($name,$value);
|
||
else
|
||
// insert new variable
|
||
$issaved = $issaved && $config_model->insert_variable($name,$value);
|
||
}
|
||
if ($issaved)
|
||
// if all action were succesfull
|
||
$this->session->set_flash('message', url_lang::lang('texts.System variables have been successfully updated').'.');
|
||
else
|
||
// if not
|
||
$this->session->set_flash('message', url_lang::lang('texts.System variables havent been successfully updated').'.');
|
||
url::redirect(url_lang::base().'settings/redirection');
|
||
}
|
||
// create view for this template
|
||
$view = new View('main');
|
||
$view->title = url_lang::lang('texts.Settings').' - '.url_lang::lang('texts.Redirection');
|
||
$view->content = new View('settings');
|
||
$view->content->current = 'redirection';
|
||
$view->content->content = $this->form->html();
|
||
$view->content->headline = url_lang::lang('texts.Redirection');
|
||
$view->content->link_back = $this->links;
|
||
$message = $this->session->get_once('message');
|
||
if (!empty($message))
|
||
$view->content->message = $message;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Settings for logging
|
||
*
|
freenetis/branches/testing/application/controllers/redirect.php | ||
---|---|---|
'url_array_ofset' => 1,
|
||
));
|
||
|
||
/*
|
||
$grid->add_new_button(url_lang::base().'messages/show_all', url_lang::lang('texts.Messages for redirection'));
|
||
$grid->add_new_button(url_lang::base().'redirect/show_all', url_lang::lang('texts.Activated Redirections'));
|
||
$grid->add_new_button(url_lang::base().'redirect/settings', url_lang::lang('texts.Settings'));
|
||
*/
|
||
$grid->order_callback_field('ip_address')->label(url_lang::lang('texts.IP address'))->callback('callback::ip_address_field');
|
||
$grid->order_callback_field('message')->label(url_lang::lang('texts.Activated redirection').' '.help::hint('activated_redirection'))->callback('callback::message_field');
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
... | ... | |
// access rights
|
||
if (!$this->acl_check_view('Messages_controller','message'))
|
||
Controller::error(ACCESS);
|
||
/*
|
||
$enum_type_model = new Enum_type_Model();
|
||
$filter_form = new Filter_form('m');
|
||
$filter_form->add('name')->callback('json/member_name');
|
||
$filter_form->add('id')->type('number');
|
||
|
||
$filter_form->add('type')->type('combo')->values($enum_type_model->get_values(Enum_type_Model::$member_type_id))
|
||
->default(Filter_form::OPER_IS_NOT, $enum_type_model->get_value(Member_Model::TYPE_FORMER))
|
||
->default(Filter_form::OPER_IS_NOT, $enum_type_model->get_value(Member_Model::TYPE_NON))
|
||
->default(Filter_form::OPER_IS_NOT, $enum_type_model->get_value(Member_Model::TYPE_HONORARY))
|
||
->default(Filter_form::OPER_IS_NOT, $enum_type_model->get_value(Member_Model::TYPE_SYMPATHIZING))
|
||
->default(Filter_form::OPER_IS_NOT, $enum_type_model->get_value(Member_Model::TYPE_APPLICANT));
|
||
|
||
$filter_form->add('membership_interrupt')->type('combo')->values(array(url_lang::lang('texts.Yes'), url_lang::lang('texts.No')));
|
||
$filter_form->add('balance')->table('a')->type('number');
|
||
$filter_form->add('redirect')->label(url_lang::lang('texts.Redirection'))->type('bit')->values(array("~16" => array(11 => url_lang::lang('texts.any'), 12 => url_lang::lang('texts.nonei')), 1 => url_lang::lang('texts.Membership interrupt'), 2 => url_lang::lang('texts.Debtor'), 4 => url_lang::lang('texts.Payment notice'), 8 => url_lang::lang('texts.Optional message')));
|
||
$filter_form->add('variable_symbol')->callback('json/variable_symbol');
|
||
$filter_form->add('comment');
|
||
$filter_form->add('registration')->type('combo')->values(array(url_lang::lang('texts.Yes'), url_lang::lang('texts.No')));
|
||
$filter_form->add('organization_identifier')->callback('json/organization_identifier');;
|
||
$filter_form->add('town')->type('combo')->table('t')->callback('json/town_name');
|
||
$filter_form->add('street')->type('combo')->table('s')->callback('json/street_name');
|
||
$filter_form->add('street_number')->type('number')->table('ap');
|
||
*/
|
||
|
||
// gets new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
freenetis/branches/testing/application/views/ip_addresses_show.php | ||
---|---|---|
$links[] = html::anchor(url_lang::base().'ip_addresses/delete/'.$ip_address->id, url_lang::lang('texts.Delete'));
|
||
if ($this->acl_check_new('Messages_Controller', 'ip_address'))
|
||
$links[] = html::anchor(url_lang::base().'redirect/activate_to_ip_address/'.$ip_address->id, url_lang::lang('texts.Activate redirection'));
|
||
|
||
if ($this->acl_check_view('Messages_Controller', 'ip_address'))
|
||
$links[] = html::anchor(url::base().'redirection/?ip_address='.$ip_address->ip_address, url_lang::lang('texts.Redirection preview'));
|
||
echo implode(' | ', $links);
|
||
?>
|
||
<br /><br />
|
||
... | ... | |
<td><?php echo $ip_address->service ? url_lang::lang('texts.Yes') : url_lang::lang('texts.No') ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Whitelist') ?></th>
|
||
<th><?php echo url_lang::lang('texts.Whitelist').' '.help::hint('whitelist') ?></th>
|
||
<td><?php echo $whitelist_types[($ip_address->whitelisted === null) ? 0 : $ip_address->whitelisted] ?></td>
|
||
</tr>
|
||
|
freenetis/branches/testing/redirection/cancel.php | ||
---|---|---|
// no redirection found - perhaps visiting this page by mistake?
|
||
if (!$message)
|
||
{
|
||
echo 'No redirection found, so there is nothing to be canceled.';
|
||
echo 'No redirection found for this IP address, so there is nothing to be canceled.';
|
||
die();
|
||
}
|
||
// cannot be canceled
|
||
if ($message['self_cancel'] == 0)
|
||
{
|
||
echo 'This redirection cannot be canceled by user.';
|
||
echo 'This redirection cannot be canceled by user himself.';
|
||
die();
|
||
}
|
||
// canceling of redirection
|
||
... | ... | |
{
|
||
$ip_id_array[] = $item['ip_address_id'];
|
||
}
|
||
//print_r($ip_id_array);
|
||
//echo '<br>';
|
||
//print_r($message);
|
||
$d_query = "DELETE FROM messages_ip_addresses WHERE ip_address_id IN (".implode(",",$ip_id_array).")
|
||
AND message_id = ".$message['message_id'];
|
||
//echo '<br>'.$d_query;
|
||
mysql_query($d_query, $link);
|
||
//echo 'Redirection has been canceled to all ip addresses of member.';
|
||
}
|
||
else
|
||
{
|
||
$d_query = "DELETE FROM messages_ip_addresses WHERE ip_address_id = ".$message['ip_address_id'].
|
||
" AND message_id = ".$message['message_id'];
|
||
mysql_query($d_query, $link);
|
||
//echo 'Redirection has been canceled just to this ip address.';
|
||
}
|
||
// message after redirection
|
||
$message_query = "SELECT * FROM messages WHERE ID = 2";
|
||
$message_result = mysql_query($message_query, $link) or die(mysql_error());
|
||
$message = mysql_fetch_array($message_result);
|
||
$content = $message['text'];
|
||
// contact information
|
||
|
||
|
||
// logo redirection url
|
||
$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 url has not been set, configure your redirection settings.';
|
||
die();
|
||
}
|
||
$logo = $logo_array['value'];
|
||
?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
... | ... | |
</style>
|
||
</head>
|
||
<body>
|
||
<?php echo $content ?>
|
||
<div style="position:relative;width:1000px;margin:auto;">
|
||
<div id="header">
|
||
<h1 style="position:absolute;
|
||
top:24px;
|
||
left:18px;
|
||
background:url(<?php echo $logo ?>);
|
||
width:212px;
|
||
height:49px;
|
||
background-repeat:no-repeat;
|
||
"></h1>
|
||
<div class="status">
|
||
|
||
</div>
|
||
<div class="map"></div>
|
||
</div>
|
||
<div style="margin-top:10px;">
|
||
<?php echo $content; ?>
|
||
</div>
|
||
</div>
|
||
<span style="display:none;"><?php echo number_format(memory_get_usage() / 1024 / 1024, 2).' MB'; ?></span>
|
||
</body>
|
||
</html>
|
freenetis/branches/testing/redirection/index.php | ||
---|---|---|
$content = $message['text'];
|
||
}
|
||
// if no message found for given ip address, than it is unknown page
|
||
// or no redirection has been set for this ip address
|
||
else
|
||
{
|
||
// 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'];
|
||
$ip_query = "
|
||
SELECT id
|
||
FROM ip_addresses
|
||
WHERE ip_address = '$ip_address'
|
||
";
|
||
$ip_result = mysql_query($ip_query, $link) or die(mysql_error());
|
||
$ip = mysql_fetch_array($ip_result);
|
||
// ip address has been found, but no redirection found for it, so empty page will be displayed
|
||
if ($ip && count($ip) > 0)
|
||
{
|
||
$content = "No redirection has been found for this IP address.";
|
||
}
|
||
// no ip address in database found
|
||
else
|
||
{
|
||
// 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'];
|
||
}
|
||
}
|
||
// text in left contact panel,
|
||
// it asssumed that after installation, there is always contact message with ID 1
|
||
... | ... | |
<?php echo $contact ?>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="content">
|
||
<div id="content-padd" style="margin:10px">
|
||
<?php echo $content; ?>
|
Také k dispozici: Unified diff
opravy chyb, upravy, dodelavky v presmerovani