Revize 585
Přidáno uživatelem harryhk před více než 14 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'back to interfaces list' => 'Zpět na seznam rozhraní',
|
||
'back to ip addresses list' => 'Zpět na seznam IP adres',
|
||
'back to list of all address points' => 'Zpět na seznam všech adresních bodů',
|
||
'back to list of all backups' => 'Zpět na seznam všech záloh',
|
||
'back to list of all confirmed works' => 'Zpět na seznam všech potvrzených prací',
|
||
'back to list of all devices' => 'Zpět na seznam všech zařízení',
|
||
'back to list of all fees' => 'Zpět na seznam všech poplatků',
|
||
... | ... | |
'back to vlan interfaces list' => 'Zpět na seznam VLAN rozhraní',
|
||
'back to vlans list' => 'Zpět na seznam VLANů',
|
||
'backup' => 'Zálohování',
|
||
'backup name' => 'Jméno zálohy',
|
||
'bad entrance date' => 'Chybný datum vstupu.',
|
||
'bad phone format' => 'Špatný formát telefonu',
|
||
'bad variable symbol format' => 'Špatný formát variabilního symbolu.',
|
||
... | ... | |
'license' => 'Licence',
|
||
'linenr' => 'Počet řádků',
|
||
'list of all address points' => 'Seznam všech adresních bodů',
|
||
'list of all backups' => 'Seznam všech záloh konfigurací',
|
||
'list of all confirmed works' => 'Seznam všech potvrzených prací',
|
||
'list of all invoices' => 'Seznam všech faktur',
|
||
'list of all members' => 'Seznam všech členů',
|
||
... | ... | |
'mac address' => 'MAC adresa',
|
||
'mac restriction' => 'MAC restrikce',
|
||
'mac restriction file was successfully generated' => 'Soubor s MAC restrikcemi byl úspěšně vygenerován',
|
||
'magic switch :-)' => 'Kůzelné tlačítko :-)',
|
||
'main' => 'Hlavní',
|
||
'make backup' => 'Vytvořit zálohu',
|
||
'map' => 'Mapa',
|
||
'magic switch :-)' => 'Kůzelné tlačítko :-)',
|
||
'medium' => 'Médium',
|
||
'member' => 'Člen',
|
||
'member adopted on' => 'Člen přijat ke dni',
|
||
... | ... | |
'monthly member fee' => 'Měsíční členský příspěvek',
|
||
'must be logged in' => 'Musíte se přihlásit.',
|
||
'must pay regular fee' => 'Platí pravidelný příspěvek',
|
||
'my backups' => 'Moje zálohy',
|
||
'my devices' => 'Moje zařízení',
|
||
'my ip address' => 'Moje IP adresa',
|
||
'my profile' => 'Můj profil',
|
||
... | ... | |
'permanent' => 'Trvalé',
|
||
'phone' => 'Telefon',
|
||
'phone already exists in database' => 'Telefon je již v databázi',
|
||
'platform' => 'Platforma',
|
||
'please contact administrator' => 'Prosím kontaktujte administrátora.',
|
||
'please fill in the form with information about your association' => 'Prosím, vyplňte formulář údaji u vašem sdružení.',
|
||
'polarization' => 'Polarizace',
|
||
... | ... | |
'select vlan interface' => 'Vyber VLAN rozhraní',
|
||
'select only one subnet' => 'Vyberte jen jednu podsíť.',
|
||
'select only one type of iface' => 'Vyberte jen jeden typ rozhraní.',
|
||
'select platform' => 'Vyber platformu',
|
||
'select port' => 'Vyber port',
|
||
'select segment' => 'Vyber segment',
|
||
'select street' => 'Vyber ulici',
|
freenetis/trunk/kohana/application/models/backup.php | ||
---|---|---|
|
||
class Backup_Model extends ORM {
|
||
//protected $belongs_to = array('user','confirmed_by' => 'user');
|
||
public $arr_sql = array('id' => 'b.id', 'user_id' => 'b.user_id', 'locksign' => 'b.locksign', 'platform' => 'b.platform', 'name'=>'b.name');
|
||
public $arr_sql = array('id' => 'b.id', 'admin' => 'b.admin', 'name' => 'b.name', 'platform' => 'b.platform', 'locksign' => 'b.locksign');
|
||
|
||
public function get_all_backups($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'ASC', $user_id = null, $filters = array())
|
||
{
|
||
... | ... | |
}
|
||
|
||
return self::$db->query("SELECT
|
||
b.id, b.user_id, b.name
|
||
b.id, b.admin, b.name,
|
||
IFNULL(f.translated_term, e.value) AS platform,
|
||
IF(strcmp(b.locksign,0),'●','-') AS locksign,
|
||
FROM backup b
|
||
IF(strcmp(b.locksign,0),'?','-') AS locksign
|
||
FROM backups b
|
||
LEFT JOIN enum_types e on b.platform = e.id
|
||
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::item('locale.lang')."') f ON e.value = f.original_term
|
||
$where
|
||
... | ... | |
}
|
||
|
||
|
||
public function count_all_backups($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'ASC', $user_id = null, $filters = array())
|
||
public function count_all_backups($filters = array())
|
||
{
|
||
if (in_array($order_by, $this->arr_sql))
|
||
$order_by = $this->arr_sql[$order_by];
|
||
$where = '';
|
||
if(count($filters) > 0)
|
||
$where .= 'WHERE ';
|
||
... | ... | |
}
|
||
|
||
$backups = self::$db->query("SELECT
|
||
b.id, b.user_id, b.name
|
||
IFNULL(f.translated_term, e.value) AS platform,
|
||
IF(strcmp(b.locksign,0),'●','-') AS locksign,
|
||
FROM backup b
|
||
LEFT JOIN enum_types e on b.platform = e.id
|
||
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::item('locale.lang')."') f ON e.value = f.original_term
|
||
b.id
|
||
FROM backups b
|
||
$where");
|
||
return count($backups);
|
||
}
|
||
|
||
|
||
|
||
}
|
||
?>
|
freenetis/trunk/kohana/application/controllers/redirection.php | ||
---|---|---|
*/
|
||
class Redirection_Controller extends Controller{
|
||
function index(){
|
||
exit;
|
||
url::redirect(url_lang::base().'redirection/show_all');
|
||
}
|
||
|
||
function addip(){
|
||
exit;
|
||
if (!$this->acl_check_new(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
//duration type
|
||
$enum_type_model = new Enum_type_Model();
|
||
$types_duration = $enum_type_model->get_values(Enum_type_Model::$redirect_duration_id);
|
||
... | ... | |
}
|
||
|
||
function addrange(){
|
||
exit;
|
||
if (!$this->acl_check_new(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
//duration type
|
||
$enum_type_model = new Enum_type_Model();
|
||
$types_duration = $enum_type_model->get_values(Enum_type_Model::$redirect_duration_id);
|
||
... | ... | |
}
|
||
|
||
function addsubnet($member_id=null){
|
||
exit;
|
||
if (!$this->acl_check_new(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
//duration type
|
||
$enum_type_model = new Enum_type_Model();
|
||
$types_duration = $enum_type_model->get_values(Enum_type_Model::$redirect_duration_id);
|
||
... | ... | |
}
|
||
|
||
function adduser($member_id=null){
|
||
exit;
|
||
if (!$this->acl_check_new(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
//duration type
|
||
$enum_type_model = new Enum_type_Model();
|
||
$types_duration = $enum_type_model->get_values(Enum_type_Model::$redirect_duration_id);
|
||
... | ... | |
}
|
||
|
||
function show_all($limit_results = 20, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1){
|
||
exit;
|
||
//if (!$this->acl_check_view(get_class($this),'devices'))
|
||
// Controller::error(ACCESS);
|
||
if (!$this->acl_check_view(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
//duration type
|
||
$enum_type_model = new Enum_type_Model();
|
||
... | ... | |
}
|
||
|
||
function show($redirection_id = NULL){
|
||
exit;
|
||
if (!$this->acl_check_view(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
$redirection = new Redirection_Model($redirection_id);
|
||
if (!$redirection_id || !$redirection->id){
|
||
Controller::error(RECORD);
|
||
//url::redirect(url_lang::base().'redirection');
|
||
url::redirect(url_lang::base().'redirection/show_all');
|
||
}
|
||
$enum_type_model = new Enum_type_Model();
|
||
$duration = $enum_type_model->get_value($redirection->duration);
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
|
||
function edit($redirection_id = null)
|
||
{
|
||
exit;
|
||
function edit($redirection_id = null) {
|
||
if (!$this->acl_check_edit(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
if (!isset($redirection_id))
|
||
Controller::warning(PARAMETER);
|
||
$redirection = new Redirection_Model($redirection_id);
|
||
... | ... | |
$view->render(TRUE);
|
||
} // end of function edit
|
||
|
||
function delete($redirection_id = NULL)
|
||
{
|
||
exit;
|
||
function delete($redirection_id = NULL){
|
||
if (!$this->acl_check_delete(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
if (!isset($redirection_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
... | ... | |
}
|
||
|
||
function delete_list($limit_results=20, $ip_address=0, $admin=0, $duration=0, $destination=0){
|
||
exit;
|
||
//if (!$this->acl_check_view(get_class($this),'devices'))
|
||
// Controller::error(ACCESS);
|
||
if (!$this->acl_check_delete(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
//username
|
||
$user_id=$this->session->get('member_id');
|
||
... | ... | |
|
||
function callback_valid_ip($input)
|
||
{
|
||
exit;
|
||
|
||
// $ip_subnet_mask = $_REQUEST["ip_subnet_mask"];
|
||
|
||
if (isset($_REQUEST["ip_address"])){
|
||
... | ... | |
|
||
function callback_valid_ip2($input)
|
||
{
|
||
exit;
|
||
$ip = $_REQUEST["ip_range2"];
|
||
|
||
if ($ip!=""){
|
||
... | ... | |
|
||
function callback_valid_mask($input)
|
||
{
|
||
exit;
|
||
$subnet_mask = $_REQUEST["ip_subnet_mask"];
|
||
|
||
if ($subnet_mask!=""){
|
||
... | ... | |
} // end of valid_ip
|
||
|
||
function administration($order_by = 'admin_id', $order_by_direction = 'ASC'){
|
||
exit;
|
||
//if (!$this->acl_check_view(get_class($this),'devices'))
|
||
// Controller::error(ACCESS);
|
||
if (!$this->acl_check_view(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
$redirection_setting_model = new Redirection_setting_Model();
|
||
$total_rules = $redirection_setting_model->count_all_rules();
|
||
... | ... | |
}
|
||
|
||
function autoadmins(){
|
||
exit;
|
||
//if (!$this->acl_check_view(get_class($this),'devices'))
|
||
// Controller::error(ACCESS);
|
||
if (!$this->acl_check_new(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
$redirection_setting_model = new Redirection_setting_Model();
|
||
$redirection_setting_model->import_admins();
|
||
... | ... | |
}
|
||
|
||
function addadmin(){
|
||
exit;
|
||
if (!$this->acl_check_new(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
$this->form = new Forge(url_lang::base()."redirection/addadmin", '', 'POST', array('id' => 'article_form'));
|
||
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
|
||
function deleteadmin($admin_id = NULL)
|
||
{
|
||
exit;
|
||
function deleteadmin($admin_id = NULL){
|
||
if (!$this->acl_check_delete(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
if (!isset($admin_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
... | ... | |
}
|
||
|
||
function log($limit_results = 50, $order_by = 'id', $order_by_direction = 'DESC', $page_word = null, $page = 1){
|
||
exit;
|
||
//if (!$this->acl_check_view(get_class($this),'devices'))
|
||
// Controller::error(ACCESS);
|
||
|
||
if (!$this->acl_check_view(get_class($this),'redirection'))
|
||
Controller::error(ACCESS);
|
||
|
||
//action type
|
||
$enum_type_model = new Enum_type_Model();
|
||
$types_action = $enum_type_model->get_values(Enum_type_Model::$redirect_action_id);
|
freenetis/trunk/kohana/application/controllers/backup.php | ||
---|---|---|
*/
|
||
class Backup_Controller extends Controller{
|
||
function index(){
|
||
exit;
|
||
url::redirect(url_lang::base().'backup/show_all');
|
||
}
|
||
|
||
function show_all($limit_results = 20, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1){
|
||
exit;
|
||
//if (!$this->acl_check_view(get_class($this),'devices'))
|
||
// Controller::error(ACCESS);
|
||
if (!$this->acl_check_view(get_class($this),'backup'))
|
||
Controller::error(ACCESS);
|
||
|
||
//backup type
|
||
$enum_type_model = new Enum_type_Model();
|
||
... | ... | |
|
||
$filter=new Table_Form(url_lang::base()."backup", "get", array(
|
||
new Table_Form_Item('select','platform','Platform',$backup_types),
|
||
new Table_Form_Item('text','name','Name'),
|
||
"tr",
|
||
new Table_Form_Item('text','admin','Admin'),
|
||
|
||
"td",
|
||
new Table_Form_Item('submit','submit','Filter')
|
||
)
|
||
);
|
||
... | ... | |
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$redirection_model = new Redirection_Model();
|
||
$total_backups = $redirection_model->count_all_records($filter_values);
|
||
$backup_model = new Backup_Model();
|
||
$total_backups = $backup_model->count_all_backups($filter_values);
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_backups)
|
||
$sql_offset = 0;
|
||
$query = $redirection_model->get_all_redirections($sql_offset, (int)$limit_results, $order_by, $order_by_direction, NULL, $filter_values);
|
||
|
||
$query = $backup_model->get_all_backups($sql_offset, (int)$limit_results, $order_by, $order_by_direction, NULL, $filter_values);
|
||
|
||
|
||
$grid = new Grid(url_lang::base().'backup', null,array(
|
||
... | ... | |
'use_paginator' => true,
|
||
'use_selector' => true,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 20, // increace
|
||
'selector_min' => 20, // minimum where selector start
|
||
'selector_increace' => 50, // increace
|
||
'selector_min' => 50, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/redirection/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_vlan' => 'page', // pass a string as uri_vlan to trigger former 'label' functionality
|
||
'base_url' => Config::item('locale.lang').'/backup/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_vlan' => 'page', // pass a string as uri_vlan to trigger former 'label' functionality
|
||
'total_items' => $total_backups, // 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',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
//'query_string' => $query_string,
|
||
//'query_string' => $query_string,
|
||
'filter' => $filter->view
|
||
));
|
||
|
||
//if ($this->acl_check_new('Devices_Controller','vlan')){
|
||
$grid->add_new_button(url_lang::base().'redirection/addip', url_lang::lang('texts.Redirect IP address'));
|
||
$grid->add_new_button(url_lang::base().'redirection/addrange', url_lang::lang('texts.Redirect range of IP addresses'));
|
||
$grid->add_new_button(url_lang::base().'redirection/addsubnet', url_lang::lang('texts.Redirect IP subnet'));
|
||
$grid->add_new_button(url_lang::base().'redirection/adduser', url_lang::lang('texts.Redirect the user'));
|
||
//$grid->add_new_button(url_lang::base().'redirection/addip', url_lang::lang('texts.Redirect IP address'));
|
||
//}
|
||
|
||
//$grid->order_field('id')->label('ID')->class('center');
|
||
$grid->order_field('ip_address')->label(url_lang::lang('texts.IP address'));
|
||
$grid->order_field('dur')->label(url_lang::lang('texts.Duration'))->class('center');
|
||
$grid->order_field('dest')->label(url_lang::lang('texts.Destination website'))->class('center');
|
||
$grid->order_field('id')->label(url_lang::lang('texts.ID'))->class('center');
|
||
$grid->order_field('admin')->label(url_lang::lang('texts.Admin'))->class('center');
|
||
$grid->order_field('message')->label(url_lang::lang('texts.Message'))->class('center');
|
||
$grid->order_field('note')->label(url_lang::lang('texts.Comment'))->class('center');
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Name'))->class('center');
|
||
$grid->order_field('platform')->label(url_lang::lang('texts.Platform'))->class('center');
|
||
$grid->order_field('locksign')->label(url_lang::lang('texts.Lock'))->class('center');
|
||
//if ($this->acl_check_view('Devices_Controller','vlan'))
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'redirection/show') ->action(url_lang::lang('texts.Show'))->class('center');
|
||
//if ($this->acl_check_edit('Devices_Controller','vlan'))
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'redirection/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
|
||
//if ($this->acl_check_edit('Devices_Controller','vlan'))
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'redirection/delete')->action(url_lang::lang('texts.Delete'))->class('center')->script('onclick="return potvrd(\''.url_lang::lang('texts.Do you want to cancel this redirection').'\');"');
|
||
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'redirection/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.Do you want to delete this user').'\');"');
|
||
|
||
$grid->datasource( $query );
|
||
$this->template->content = $grid;
|
||
|
||
... | ... | |
|
||
}
|
||
|
||
function make_backup(){
|
||
if (!$this->acl_check_new(get_class($this),'backup'))
|
||
Controller::error(ACCESS);
|
||
|
||
//backup type
|
||
$enum_type_model = new Enum_type_Model();
|
||
$backup_types = $enum_type_model->get_values(Enum_type_Model::$backup_id);
|
||
$backup_types[0] = '----- '.url_lang::lang('texts.Select platform').' -----';
|
||
asort($backup_types);
|
||
|
||
//username + email
|
||
$user_id=$this->session->get('member_id');
|
||
$user_model = new User_Model();
|
||
$user_model->find($user_id);
|
||
if ($user_model->id == 0)
|
||
Controller::error(RECORD);
|
||
|
||
$this->form = new Forge(url_lang::base()."backup/make_backup", '', 'POST', array('id' => 'article_form'));
|
||
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
$this->form->group('')->label(url_lang::lang('texts.Basic information'));
|
||
$this->form->input('ip_address')->label(url_lang::lang('texts.IP address').':')->rules('required|length[7,15]')->callback(array($this, 'callback_valid_ip'));
|
||
$this->form->input('username')->label(url_lang::lang('texts.Username').':')->rules('required');
|
||
$this->form->input('password')->label(url_lang::lang('texts.Password').':');
|
||
$this->form->dropdown('platform')->label(url_lang::lang('texts.Platform').':')->options($backup_types)->rules('required');
|
||
$this->form->input('name')->label(url_lang::lang('texts.Backup name'))->rules('required|length[0,40]')->value('');
|
||
$this->form->checkbox('lock')->label(url_lang::lang('texts.Lock for others'))->value('1')->checked(FALSE);
|
||
$this->form->submit('submit')->value(url_lang::lang('texts.Import'));
|
||
special::required_forge_style($this->form, ' *', 'required');
|
||
|
||
//----- validate form and save data -----------------------------------
|
||
if($this->form->validate()){
|
||
$form_data = $this->form->as_array();
|
||
foreach($form_data as $key => $value){
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
|
||
$ip_address = $form_data['ip_address'];
|
||
$username = $form_data['username'];
|
||
$password = $form_data['password'];
|
||
|
||
$backup = new Backup_Model();
|
||
$backup->name = $form_data['name'];
|
||
$backup->platform = $form_data['platform'];
|
||
$backup->admin = $user_model->login;
|
||
//LOCK
|
||
if($form_data['lock']==1)
|
||
$backup->locksign = '1';
|
||
else
|
||
$backup->locksign = '0';
|
||
$backup->id = 10;
|
||
|
||
$xx = $user_model->login;
|
||
|
||
$text = "$ip_address \n $username \n $password \n $xx \n ";
|
||
|
||
$fp = FOpen ('media/download/mikrotik.txt',"w");
|
||
if ($fp){
|
||
FWrite ($fp, $text);
|
||
FClose ($fp);
|
||
}
|
||
|
||
|
||
//TOTO FUNGUJE!! ALE NE TADY
|
||
//system("/var/www/sites/freenetis/freenetis/kohana/media/download/backup.sh 10.107.237.3 admin malta");
|
||
|
||
|
||
|
||
//system("media/download/backup.sh $ip_address $username $password > media/download/mikrotik.txt");
|
||
|
||
//$backup_model->save();
|
||
|
||
unset($form_data);
|
||
if (true) {
|
||
$this->session->set_flash('message', url_lang::lang('texts.Backup has been successfully imported.'));
|
||
//url::redirect(url_lang::base().'backup/show_all/');
|
||
url::redirect(url_lang::base().'../media/download/download.php?file=mikrotik.txt');
|
||
//url::redirect(url_lang::base().'media/download/backup.sh');
|
||
exit;
|
||
}
|
||
}
|
||
//----- end validate --------------------------------------------------
|
||
|
||
$view = new View('main');
|
||
$view->title = url_lang::lang('texts.Make backup');
|
||
$view->content = new View('form');
|
||
$view->content->link_back = html::anchor(url_lang::base().'backup/show_all', url_lang::lang('texts.Back to list of all backups'));
|
||
$view->content->headline = url_lang::lang('texts.Make backup');
|
||
$view->content->form = $this->form->html();
|
||
$view->render(TRUE);
|
||
|
||
}
|
||
|
||
function callback_valid_ip($input){
|
||
if (isset($_REQUEST["ip_address"])){
|
||
$ip = $_REQUEST["ip_address"];
|
||
} else if (isset($_REQUEST["ip_range1"])){
|
||
$ip = $_REQUEST["ip_range1"];
|
||
} else if (isset($_REQUEST["ip_subnet"])){
|
||
$ip = $_REQUEST["ip_subnet"];
|
||
}
|
||
if ($ip!=""){
|
||
if(!ereg("^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$", $ip)){
|
||
$input->add_error('required', url_lang::lang('texts.Invalid IP address'));
|
||
return false;
|
||
}
|
||
}else {
|
||
return false;
|
||
}
|
||
} // end of valid_ip
|
||
|
||
}
|
||
|
||
|
freenetis/trunk/kohana/application/controllers/config_files.php | ||
---|---|---|
|
||
function __construct()
|
||
{
|
||
exit;
|
||
parent::__construct();
|
||
$array[] = html::anchor(url_lang::base().'config_files/dhcp', url_lang::lang('texts.DHCP'));
|
||
$array[] = html::anchor(url_lang::base().'config_files/dns_reverse', url_lang::lang('texts.Reverse DNS'));
|
||
... | ... | |
}
|
||
|
||
function index(){
|
||
exit;
|
||
url::redirect(url_lang::base().'config_files/dhcp');
|
||
}
|
||
|
||
function dhcp(){
|
||
exit;
|
||
$this->form = new Forge(url_lang::base()."config_files/dhcp", '', 'POST', array('id' => 'article_form'));
|
||
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
... | ... | |
}
|
||
|
||
function dns_reverse(){
|
||
exit;
|
||
$area_model = new Area_Model();
|
||
$areas = $area_model->get_area_prefixes();
|
||
$arr_area_prefixes[] = '----- '.url_lang::lang('texts.select area prefix').' -----';
|
||
... | ... | |
}
|
||
|
||
function dns_forward(){
|
||
exit;
|
||
$area_model = new Area_Model();
|
||
$areas = $area_model->get_areas();
|
||
$arr_areas[] = '----- '.url_lang::lang('texts.select area').' -----';
|
||
... | ... | |
}
|
||
|
||
function mac_restriction(){
|
||
exit;
|
||
$this->form = new Forge(url_lang::base()."config_files/mac_restriction", '', 'POST', array('id' => 'article_form'));
|
||
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
... | ... | |
}
|
||
|
||
function settings(){
|
||
exit;
|
||
// access control
|
||
//if (!$this->acl_check_edit('Settings_Controller','system'))
|
||
// Controller::error(ACCESS);
|
||
... | ... | |
}
|
||
|
||
function generate_dhcp($primary_dns, $secondary_dns, $tertiary_dns, $lease_time, $max_lease_time, $subnet_id, $routers_ip_address, $subnet_id2, $routers_ip_address2, $subnet_id3, $routers_ip_address3){
|
||
exit;
|
||
$settings = new Config_file_Model(1);
|
||
$subnet = new Subnet_Model($subnet_id);
|
||
|
||
... | ... | |
}
|
||
|
||
function time_conversion($time){
|
||
exit;
|
||
$hours = round($time/3600);
|
||
$days = round($hours/24);
|
||
$weeks = round($days/7);
|
||
... | ... | |
}
|
||
|
||
function generate_dns_reverse($area_prefix = 0, $refresh = 28800, $retry = 7200, $expire = 604800, $minimum = 86400, $time_to_live = 86400, $name_server = null, $name_server2 = null, $mail_exchange = null, $soa_record = null, $dns_admin = null){
|
||
exit;
|
||
$settings = new Config_file_Model(1);
|
||
$area_model = new Area_Model();
|
||
$result = $area_model->get_records_by_prefix($area_prefix);
|
||
... | ... | |
|
||
|
||
function generate_dns_forward($area = 0, $refresh = 28800, $retry = 7200, $expire = 604800, $minimum = 86400, $time_to_live = 86400, $name_server = null, $name_server2 = null, $mail_exchange = null, $soa_record = null, $dns_admin = null){
|
||
exit;
|
||
$settings = new Config_file_Model(1);
|
||
$area_model = new Area_Model();
|
||
$result = $area_model->get_records_by_area($area);
|
||
... | ... | |
}
|
||
|
||
function generate_mac_restriction($subnet_id = 0, $routers_ip_address = null){
|
||
exit;
|
||
$settings = new Config_file_Model(1);
|
||
$subnet = new Subnet_Model($subnet_id);
|
||
|
||
... | ... | |
}
|
||
|
||
function callback_valid_ip($input)
|
||
{
|
||
exit;
|
||
{
|
||
if (isset($_REQUEST["primary_dns"])){
|
||
$ip = $_REQUEST["primary_dns"];
|
||
} else if (isset($_REQUEST["secondary_dns"])){
|
||
... | ... | |
* @return unknown_type
|
||
*/
|
||
function valid_ip($input){
|
||
exit;
|
||
$ip = ip2long($this->input->post('routers_ip_address')); // Submitted values
|
||
$subnet_id = $this->input->post('subnet_id');
|
||
|
||
... | ... | |
* @return unknown_type
|
||
*/
|
||
function valid_ip2($input){
|
||
exit;
|
||
$ip = ip2long($this->input->post('routers_ip_address2')); // Submitted values
|
||
$subnet_id = $this->input->post('subnet_id2');
|
||
|
||
... | ... | |
* @return unknown_type
|
||
*/
|
||
function valid_ip3($input){
|
||
exit;
|
||
$ip = ip2long($this->input->post('routers_ip_address3')); // Submitted values
|
||
$subnet_id = $this->input->post('subnet_id3');
|
||
|
||
... | ... | |
*/
|
||
function check_ip($ip, $net, $mask, $input)
|
||
{
|
||
exit;
|
||
$mask=0xffffffff<<(32-$mask) & 0xffffffff;
|
||
//printf(" ip=%lx, net=%lx, mask=%lx, AND=%lx", $ip, $net, $mask, $ip & $mask);
|
||
if (($ip & $mask) != $net)
|
freenetis/trunk/kohana/application/upgrade_sql/upgrade_sql.php | ||
---|---|---|
|
||
// array of sql queries that upgrade database
|
||
$upgrade_sql[get_SVN_rev()] = array(
|
||
//zatim tu nic neni
|
||
"INSERT INTO `freenetis`.`aco` (id,section_value, value, order_value, name, hidden) values (39, 'menu', 'redirection', 0, 'Redirection', 0);",
|
||
|
||
"INSERT INTO `freenetis`.`aco` (id,section_value, value, order_value, name, hidden) values (40, 'menu', 'backup', 0, 'Backup', 0);",
|
||
|
||
"UPDATE `freenetis`.`acl` set note='Certifikovani technici vidi v menu Sit, Cleny, Presmerovani a Zalohovani.' WHERE id=48;",
|
||
|
||
"INSERT INTO `freenetis`.`aco_map` (acl_id, section_value, value) values (48, 'menu', 'redirection'),(48, 'menu', 'backup');",
|
||
|
||
"INSERT INTO `freenetis`.`aco_map` (acl_id, section_value, value) values (37, 'menu', 'redirection'),(37, 'menu', 'backup');",
|
||
|
||
"UPDATE `freenetis`.`acl` set note='Certifikovani technici mohou editovat a pridavat vsechna zarizeni, spravovat presmerovani a zalohovani.' WHERE id=49;",
|
||
|
||
"UPDATE `freenetis`.`acl` set note='Adminstratori mohou spravovat vsechny cleny a uzivatele, presmerovani a zalohovani.' WHERE id=38;",
|
||
|
||
"INSERT INTO `freenetis`.`axo` (id, section_value, value, order_value, name, hidden) values (151,'Redirection_Controller', 'redirection', 0, 'Redirection', 0),(152,'Backup_Controller', 'backup', 0, 'Backup', 0);",
|
||
|
||
"INSERT INTO `freenetis`.`axo_map` (acl_id, section_value, value) values (38, 'Redirection_Controller', 'redirection'),(49, 'Redirection_Controller', 'redirection'),(38, 'Backup_Controller', 'backup'),(49, 'Backup_Controller', 'backup');"
|
||
);
|
||
?>
|
freenetis/trunk/kohana/application/views/menu.php | ||
---|---|---|
</ul>
|
||
</li>
|
||
|
||
<?php //zakomentovano dokud nebudou navrzena prava ....Boner ?>
|
||
<?php if (false){ ?>
|
||
|
||
<?/**
|
||
* @author Lubomir Buben
|
||
* Menu for Redirection module
|
||
*/?>
|
||
<?php //if ($this->acl_check_2D('menu', 'administration')) { ?>
|
||
<?php if ($this->acl_check_2D('menu', 'redirection')) { ?>
|
||
<li class="redirection"><h2><?php echo url_lang::lang('texts.Redirection') ?></h2>
|
||
<ul>
|
||
<li><?php echo html::anchor(url_lang::base().'redirection/show_all', url_lang::lang('texts.Redirection')) ?></li>
|
||
<?php //if ($this->acl_check_2D('menu', 'administration')) { ?>
|
||
<?php if ($this->acl_check_2D('menu', 'administration')) { ?>
|
||
<li><?php echo html::anchor(url_lang::base().'redirection/administration', url_lang::lang('texts.Administration')) ?></li>
|
||
<?php //} ?>
|
||
<?php } ?>
|
||
<li><?php echo html::anchor(url_lang::base().'redirection/log', url_lang::lang('texts.Redirection logs')) ?></li>
|
||
</ul>
|
||
</li><?php //} ?>
|
||
</li><?php } ?>
|
||
|
||
|
||
<?/**
|
||
* @author Lubomir Buben
|
||
* Menu for Backup module
|
||
*/?>
|
||
<?php //if ($this->acl_check_2D('menu', 'administration')) { ?>
|
||
<?php if ($this->acl_check_2D('menu', 'backup')) { ?>
|
||
<li class="backup"><h2><?php echo url_lang::lang('texts.Backup') ?></h2>
|
||
<ul>
|
||
<li><?php echo html::anchor(url_lang::base().'backup/show_all', url_lang::lang('texts.Backup')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'backup/my_backups', url_lang::lang('texts.My backups')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'backup/make_backup', url_lang::lang('texts.Make backup')) ?></li>
|
||
</ul>
|
||
</li><?php //} ?>
|
||
<?php } ?>
|
||
</li><?php } ?>
|
||
|
||
|
||
<?php if ($this->acl_check_2D('menu', 'accounts') || $this->acl_check_2D('menu', 'unidentified_transfers')) { ?>
|
||
<li class="transfer"><h2><?php echo url_lang::lang('texts.Finances') ?></h2>
|
||
<ul>
|
Také k dispozici: Unified diff