Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 716

Přidáno uživatelem Jiří Sviták před asi 14 roky(ů)

Prace na presmerovani, dodelam doma.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'but i can\'t write the htaccess file' => 'Ale nemůžu zapisovat do souboru <code>.htaccess</code>.',
'buy date' => 'Datum koupě',
'cancel' => 'Zrušit',
'cancel whitelist' => 'Zrušit whitelist',
'caller' => 'Volající',
'callcon' => 'Volaný',
'canceling of message for redirection' => 'Rušení zprávy pro přesměrování',
......
'name of the association' => 'Název sdružení',
'name of organization' => 'Název organizace',
'native' => 'Nativní',
'near number %s wasnt fond data for testing in group: %s' => 'U čísla %s nebyly nalezena data pro kontrolu služeb ve skupině: %s',
'near number %s wasnt fond data for testing in group: %s' => 'U čísla %s nebyly nalezena data pro kontrolu služeb ve skupině: %s',
'near number %s differs from price of services: %s\ncalculated price: %s\ninvoiced price: %s' => 'Poblíž čísla %s se odlišují ceny služeb: %s\nVypočtená cena: %s\nFakturovaná cena: %s',
'netmask' => 'Maska',
'netmask' => 'Maska',
'network address' => 'Síťová adresa',
'network address does not match the mask' => 'Síťová adresa neodpovídá zadané masce.',
'networks' => 'Síť',
......
'next step' => 'Další krok',
'nineth-degree certified engineers' => 'Certifikování technici devátého stupně',
'no' => 'ne',
'no member fee set!' => 'Členský příspěvek nenastaven!',
'no redirection is possible to set for this ip address' => 'Žádné přesměrování není možné nastavit pro tuto IP adresu.',
'no sms message has been added' => 'Žádná SMS zpráva nebyla přidána.',
'no member fee set!' => 'Členský příspěvek nenastaven!',
'no whitelist' => 'Žádný whitelist',
'nonactive' => 'Neaktivní',
'none' => 'žádný',
'non-member' => 'Nečlen',
......
'percent for majority must be number' => 'Procent pro většinu musí být číslo.',
'percent for majority must be in interval 51 - 100' => 'Procent pro většinu musí být v intervalu 51 - 100.',
'permanent' => 'Trvalé',
'permanent whitelist' => 'Trvalý whitelist',
'permit extensions' => 'Povolená předčíslí',
'personal comment from administrator' => 'Osobní komentář od administrátora',
'phone' => 'Telefon',
......
'sent message' => 'Odeslaná zpráva',
'september' => 'Září',
'service' => 'Služba',
'set permanent whitelist' => 'Nastavit trvalý whitelist',
'set temporary whitelist' => 'Nastavit dočasný whitelist',
'settings' => 'Nastavení',
'settings for configuration files has been successfully updated' => 'Nastavení pro kofigurační soubory bylo úspěšně upraveno',
'setup config' => 'Nastavení konfigurace',
......
'tag_802_1q' => 'tag 802.1Q',
'target website' => 'Cílový web pro přesměrování',
'technology' => 'Technologie',
'temporary whitelist' => 'Dočasný whitelist',
'template' => 'Šablona',
'template has been successfully added' => 'Šablona byla úspěšně přidána.',
'template has been successfully updated' => 'Šablona byla úspěšně upravena.',
freenetis/trunk/kohana/application/models/ip_address.php
// be redirected, but he has to pay using internet banking
public static $temporary_whitelist = 2;
protected $belongs_to = array('iface','subnet','vlan_iface');
/**
......
}
/**
* Gets counts of IP addresses with no whitelist, permanent whitelist and temporary whitelist.
* @author Jiri Svitak
*/
function get_whitelist_info_of_member($member_id)
{
$ips = self::get_ip_addresses_of_member($member_id);
$info = array();
$info[self::$no_whitelist] = 0;
$info[self::$permanent_whitelist] = 0;
$info[self::$temporary_whitelist] = 0;
foreach ($ips as $ip)
{
if ($ip->whitelisted == self::$permanent_whitelist)
$info[self::$permanent_whitelist]++;
elseif ($ip->whitelisted == self::$temporary_whitelist)
$info[self::$temporary_whitelist]++;
else
$info[self::$no_whitelist]++;
}
return $info;
}
/**
* Gets all ip addresses of device.
* @author Jiri Svitak
* @param $device_id
......
");
}
/**
* Old redirection.
* @todo remove
* @author Jiri Svitak
*/
public function get_allowed_member_ips()
{
return self::$db->query("SELECT
......
*/
public function get_ip_addresses_of_subnet($subnet_id)
{
// old version without support of ip address of vlan ifaces
/*return self::$db->query("SELECT
ip.id, ip.ip_address, m.name, m.id AS mid
FROM ip_addresses ip
JOIN ifaces i ON i.id = ip.iface_id
JOIN devices d ON d.id = i.device_id
JOIN users u ON u.id = d.user_id
JOIN members m ON m.id = u.member_id
WHERE ip.subnet_id = $subnet_id
ORDER BY inet_aton(ip.ip_address)
"); */
return self::$db->query("SELECT
q.ip_address_id, q.ip_address, q.gateway,
d.name AS device_name, d.id AS device_id,
......
ORDER BY inet_aton(q.ip_address)
");
}
/**
* Gets all IP addresses of member who have currently interrupted membership.
* These IP addresses are redirected.
* @author Jiri Svitak
*/
function get_ip_addresses_with_interrupted_membership()
{
return self::$db->query("
SELECT ip.id, ip.ip_address, ip.whitelisted
FROM ip_addresses ip
JOIN ifaces i ON i.id = ip.iface_id
JOIN devices d ON d.id = i.device_id
JOIN users u ON u.id = d.user_id
JOIN members m ON m.id = u.member_id
JOIN membership_interrupts mi ON mi.member_id = m.id
WHERE mi.from <= CURDATE() AND CURDATE() <= mi.to
");
}
/**
* Gets all IP addresses
* @author Jiri Svitak
* @param $debtor_boundary
*/
function get_ip_addresses_of_debtors($debtor_boundary)
{
return self::$db->query("
SELECT ip.id, ip.ip_address, ip.whitelisted
FROM ip_addresses ip
JOIN ifaces i ON i.id = ip.iface_id
JOIN devices d ON d.id = i.device_id
JOIN users u ON u.id = d.user_id
JOIN members m ON m.id = u.member_id
JOIN account_balances ab ON ab.member_id = m.id AND m.id <> 1
WHERE ab.balance < $debtor_boundary
");
}
/**
* @author Lubomir Buben
* Function tries to find IP adress in database
* @param $ip_address
freenetis/trunk/kohana/application/controllers/ip_addresses.php
$member = new Member_Model($member_id);
$device = new Device_Model($device_id);
$iface = new Iface_Model($iface_id);
// whitelist types
$whitelist_types = array(Ip_address_Model::$no_whitelist => url_lang::lang('texts.No whitelist'),
Ip_address_Model::$permanent_whitelist => url_lang::lang('texts.Permanent whitelist'), Ip_address_Model::$temporary_whitelist => url_lang::lang('texts.Temporary whitelist'));
// active redirections for this IP address
$db = new Database();
$messages = $db->query("
SELECT m.id, m.name, mip.ip_address_id, mip.message_id
FROM messages m
JOIN messages_ip_addresses mip ON mip.message_id = m.id
JOIN ip_addresses ip ON mip.ip_address_id = ip.id
WHERE ip.ip_address = '$ip_address->ip_address'
");
$mip_model = new Messages_ip_addresses_Model();
$messages = $mip_model->get_redirections_of_ip_address($ip_address_id);
$grid = new Grid(url_lang::base().'ip_addresses', url_lang::lang('texts.Active redirections'),array(
'use_paginator' => false,
'use_selector' => false
......
$view->content->device = $device;
$view->content->iface = $iface;
$view->content->vlan_iface = $vlan_iface;
$view->content->whitelist_types = $whitelist_types;
$view->content->grid = $grid;
$view->content->headline = url_lang::lang('texts.IP address detail').' - '.$ip_address->ip_address;
$view->render(TRUE);
freenetis/trunk/kohana/application/controllers/members.php
$mi_grid->action_field('id') ->label(url_lang::lang('texts.Membership interrupts'))->url(url_lang::base().'membership_interrupts/delete')->action(url_lang::lang('texts.Delete'));
$mi_grid->datasource($mis);
// active redirections of member
$db = new Database();
$messages = $db->query("
SELECT ip.ip_address, m.id, m.name, mip.ip_address_id, mip.message_id, $member_id AS member_id
FROM messages m
JOIN messages_ip_addresses mip ON mip.message_id = m.id
JOIN ip_addresses ip ON mip.ip_address_id = ip.id
JOIN ifaces i ON ip.iface_id = i.id
JOIN devices d ON i.device_id = d.id
JOIN users u ON d.user_id = u.id
WHERE u.member_id = '$member_id'
");
// active redirections of member, including short statistic of whitelisted IP addresses
$ip_model = new Ip_address_Model();
$info = $ip_model->get_whitelist_info_of_member($member_id);
$whitelist_info = url_lang::lang('texts.IP addresses').': '.url_lang::lang('texts.No whitelist').' ('.$info[Ip_address_Model::$no_whitelist].'), '.
url_lang::lang('texts.Permanent whitelist').' ('.$info[Ip_address_Model::$permanent_whitelist].'), '.url_lang::lang('texts.Temporary whitelist').' ('.$info[Ip_address_Model::$temporary_whitelist].')';
$mip_model = new Messages_ip_addresses_Model();
$messages = $mip_model->get_redirections_of_member($member_id);
$redir_grid = new Grid(url_lang::base().'members', null, array(
'use_paginator' => false,
'use_selector' => false
......
if ($this->acl_check_new('Messages_Controller', 'member'))
{
$redir_grid->add_new_button(url_lang::base().'redirect/add_to_member/'.$member_id, url_lang::lang('texts.Add redirection to all ip addresses of member'));
$redir_grid->add_new_button(url_lang::base().'redirect/set_whitelist/'.$member_id.'/'.Ip_address_Model::$no_whitelist, url_lang::lang('texts.Cancel whitelist'));
$redir_grid->add_new_button(url_lang::base().'redirect/set_whitelist/'.$member_id.'/'.Ip_address_Model::$permanent_whitelist, url_lang::lang('texts.Set permanent whitelist'));
$redir_grid->add_new_button(url_lang::base().'redirect/set_whitelist/'.$member_id.'/'.Ip_address_Model::$temporary_whitelist, url_lang::lang('texts.Set temporary whitelist'));
}
$redir_grid->field('ip_address')->label(url_lang::lang('texts.IP address'));
$redir_grid->callback_field('ip_address')->label(url_lang::lang('texts.IP address'))->callback('Ip_addresses_Controller::ip_address_field');
$redir_grid->field('name')->label(url_lang::lang('texts.Message'));
if ($this->acl_check_delete('Messages_Controller', 'ip_address'))
$redir_grid->callback_field('redirection')->label(url_lang::lang('texts.Canceling of message for redirection'))->callback("Members_Controller::cancel_redirection");
......
$view->content->billing_has_driver = $has_driver;
$view->content->billing_account = $b_account;
$view->content->mis = $mi_grid;
$view->content->whitelist_info = $whitelist_info;
$view->content->redir_grid = $redir_grid;
foreach($member_data as $key=>$val)
{
freenetis/trunk/kohana/application/controllers/messages.php
}
$message->text = $form_data['text'];
unset($form_data);
// saving message and refreshing all static pages with this message
if ($message->save())
{
$this->session->set_flash('message', url_lang::lang('texts.Message has been successfully updated.'));
......
function update($message_id)
{
$message = new Message_Model($message_id);
$db = new Database();
$ip_model = new Ip_address_Model();
// boundary credit status
$debtor_boundary = $this->settings->get('debtor_boundary');
// boundary credit status
$payment_notice_boundary = $this->settings->get('payment_notice_boundary');
if ($message->type == Message_Model::$interrupted_membership_message)
{
// find IP addresses with interrupted membership
$ips = $db->query("
SELECT ip.id, ip.ip_address, ip.whitelisted
FROM ip_addresses ip
JOIN ifaces i ON i.id = ip.iface_id
JOIN devices d ON d.id = i.device_id
JOIN users u ON u.id = d.user_id
JOIN members m ON m.id = u.member_id
JOIN membership_interrupts mi ON mi.member_id = m.id
WHERE mi.from <= CURDATE() AND CURDATE() <= mi.to
");
$ips = $ip_model->get_ip_addresses_with_interrupted_membership();
// delete old redirections
$db->delete('messages_ip_addresses', array('message_id' => $message_id));
// set new redirections in junction table
......
}
elseif ($message->type == Message_Model::$debtor_message)
{
// boundary credit status
$debtor_boundary = $this->settings->get('debtor_boundary');
if (empty($debtor_boundary))
{
$this->session->set_flash('message', url_lang::lang('texts.Error - debtor credit boundary has not been set.'));
url::redirect(url_lang::base().'messages/show_all');
}
// finding IP addresses to redirect to debtor message
$ips = $db->query("
SELECT ip.id, ip.ip_address, ip.whitelisted
FROM ip_addresses ip
JOIN ifaces i ON i.id = ip.iface_id
JOIN devices d ON d.id = i.device_id
JOIN users u ON u.id = d.user_id
JOIN members m ON m.id = u.member_id
JOIN account_balances ab ON ab.member_id = m.id AND m.id <> 1
WHERE ab.balance < $debtor_boundary
");
$ips = $ip_model->get_ip_addresses_of_debtors($debtor_boundary);
// delete old redirections
$db->delete('messages_ip_addresses', array('message_id' => $message_id));
// set new redirections in junction table
......
}
elseif ($message->type == Message_Model::$payment_notice_message)
{
// boundary credit status
$payment_notice_boundary = $this->settings->get('payment_notice_boundary');
if (empty($payment_notice_boundary))
{
$this->session->set_flash('message', url_lang::lang('texts.Error - payment notice credit boundary has not been set.'));
......
JOIN users u ON u.id = d.user_id
JOIN members m ON m.id = u.member_id
JOIN account_balances ab ON ab.member_id = m.id AND m.id <> 1
WHERE ab.balance < $payment_notice_boundary
WHERE ab.balance < $payment_notice_boundary AND ab.balance >= $debtor_boundary
");
// delete old redirections
$db->delete('messages_ip_addresses', array('message_id' => $message_id));
freenetis/trunk/kohana/application/views/ip_addresses_show.php
$links[] = html::anchor(url_lang::base().'ip_addresses/edit/'.$ip_address->id, url_lang::lang('texts.Edit'));
if ($this->acl_check_delete('Devices_Controller', 'ip_address'))
$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/add/'.$ip_address->id, url_lang::lang('texts.Redirect'));
// @todo access rights
$links[] = html::anchor(url_lang::base().'redirect/add/'.$ip_address->id, url_lang::lang('texts.Redirect'));
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.Never redirect') ?></th>
<td><?php echo $ip_address->whitelisted ? url_lang::lang('texts.Yes') : url_lang::lang('texts.No') ?></td>
<th><?php echo url_lang::lang('texts.Whitelist') ?></th>
<td><?php echo $whitelist_types[$ip_address->whitelisted] ?></td>
</tr>
freenetis/trunk/kohana/application/views/members_show.php
<br />
<h3><?php echo url_lang::lang('texts.Active redirections')?></h3>
<?php echo $whitelist_info ?>
<br />
<?php echo $redir_grid ?>
<br />

Také k dispozici: Unified diff