Revize 932
Přidáno uživatelem Michal Kliment před více než 13 roky(ů)
freenetis/branches/testing/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'e-mail variables' => 'Proměnné e-mailu',
|
||
'e-mail variables have been successfully updated' => 'Proměnné e-mailu byly úspěšně aktualizovány.',
|
||
'e-mail variables havent been successfully updated' => 'Proměnné e-mailu nebyly úspěšně aktualizovány.',
|
||
'enable action logs' => 'Zapnout logy akcí',
|
||
'enable integrity test (all numbers in invoice has to be in extended statement)' => 'Povolit test na celistvost (každé číslo ve faktuře musí být v podrobném výpisu)',
|
||
'enable mysql event scheduler' => 'Povolit MySQL plánovač akcí',
|
||
'enable ulogd' => 'Zapnout ulogd',
|
||
'enabled' => 'Zapnuto',
|
||
'enable action logs' => 'Zapnout logy akcí',
|
||
'end membership' => 'Ukončit členství',
|
||
'end of month' => 'Konec měsíce',
|
||
'end of input' => 'Konec vstupu',
|
||
... | ... | |
'it is not possible vote this way about work on work report' => 'Není možné hlasovat tímto způsobem o práci na pracovním výkaze.',
|
||
'it is not possible vote about locked work' => 'Není možné hlasovat o zamčené práci.',
|
||
'it is possible to deduct fees only in one year' => 'Členské příspěvky je možné strhávat jen v rámci jednoho roku.',
|
||
'it requires already created functions for ulogd or mysql permission create routine for create them' => 'vyžaduje již vytvořené funkce pro ulogd nebo MySQL oprávnění CREATE ROUTINE pro jejich vytvoření',
|
||
'it\'s not possible to write your htacess file for clean urls' => 'Není možné zapsat váš soubor .htacess pro čistá URL.',
|
||
'item' => 'Položka',
|
||
'item number' => 'Položka č.',
|
freenetis/branches/testing/application/models/ulog2_ct.php | ||
---|---|---|
public static function create_functions ()
|
||
{
|
||
$db = new Database();
|
||
$db->query("DROP FUNCTION IF EXISTS `INSERT_CT`");
|
||
$db->query("
|
||
CREATE FUNCTION `INSERT_CT`(
|
||
`_orig_ip_saddr` int unsigned,
|
||
... | ... | |
RETURN LAST_INSERT_ID();
|
||
END
|
||
");
|
||
$db->query("DROP FUNCTION IF EXISTS `insert_rand`");
|
||
$db->query("
|
||
CREATE FUNCTION `insert_rand`() RETURNS bigint(20) unsigned
|
||
READS SQL DATA
|
||
... | ... | |
RETURN LAST_INSERT_ID();
|
||
END
|
||
");
|
||
$db->query("DROP FUNCTION IF EXISTS `ip2str`");
|
||
$db->query("
|
||
CREATE FUNCTION `ip2str`(ip INT UNSIGNED) RETURNS varchar(15) CHARSET latin1
|
||
DETERMINISTIC
|
||
RETURN concat(ip & 255, \".\", ip>>8 & 255, \".\", ip>>16 & 255, \".\", ip>>24)
|
||
");
|
||
$db->query("DROP FUNCTION IF EXISTS `swap_endian`");
|
||
$db->query("
|
||
CREATE FUNCTION `swap_endian`(ip INT UNSIGNED) RETURNS int(10) unsigned
|
||
DETERMINISTIC
|
||
RETURN ((ip & 255)<<24 | (ip & 65280)<<8 | (ip>>8 & 65280) | ip>>24)
|
||
");
|
||
}
|
||
|
||
/**
|
||
* Checks pre requirements for ulogd
|
||
*
|
||
* @author Michal Kliment
|
||
* @return <type>
|
||
*/
|
||
public function check_pre_requirements()
|
||
{
|
||
$user_model = new User_Model();
|
||
|
||
return ($user_model->function_exists('INSERT_CT') && $user_model->function_exists('insert_rand') && $user_model->function_exists('ip2str') && $user_model->function_exists('swap_endian'));
|
||
}
|
||
}
|
||
|
||
?>
|
freenetis/branches/testing/application/controllers/settings.php | ||
---|---|---|
if (!$this->acl_check_edit(get_class($this),'system'))
|
||
Controller::error(ACCESS);
|
||
|
||
// time of next update of ulogd
|
||
$ulogd_update_next = Settings::get('ulogd_update_last')+Settings::get('ulogd_update_interval');
|
||
if (Settings::get('ulogd_enabled'))
|
||
{
|
||
// time of next update of ulogd
|
||
$ulogd_update_next = Settings::get('ulogd_update_last')+Settings::get('ulogd_update_interval');
|
||
|
||
// remaining time to next update of ulogd
|
||
$remaining_time = $ulogd_update_next - time();
|
||
// remaining time to next update of ulogd
|
||
$remaining_time = $ulogd_update_next - time();
|
||
|
||
$additional_info = '<b>ulogd</b> - '.url_lang::lang('texts.info').':<br />';
|
||
$additional_info .= url_lang::lang('texts.last update').': <b>'.date('Y-m-d H:i:s',Settings::get('ulogd_update_last')).'</b>,<br />';
|
||
$additional_info .= '<span';
|
||
$additional_info = '<b>ulogd</b> - '.url_lang::lang('texts.info').':<br />';
|
||
$additional_info .= url_lang::lang('texts.last update').': <b>'.date('Y-m-d H:i:s',Settings::get('ulogd_update_last')).'</b>,<br />';
|
||
$additional_info .= '<span';
|
||
|
||
// remaining time is in past, print it red
|
||
if ($remaining_time < 0)
|
||
$additional_info .= ' style="color:red"';
|
||
// remaining time is in past, print it red
|
||
if ($remaining_time < 0)
|
||
$additional_info .= ' style="color:red"';
|
||
|
||
$additional_info .= '>'.url_lang::lang('texts.next update').': <b>'.date('Y-m-d H:i:s',$ulogd_update_next).'</b> ('.url_lang::lang('texts.Remaining time').': <b><span id="rest">'.date::counter($remaining_time).'</span></b>)</span>';
|
||
$additional_info .= '>'.url_lang::lang('texts.next update').': <b>'.date('Y-m-d H:i:s',$ulogd_update_next).'</b> ('.url_lang::lang('texts.Remaining time').': <b><span id="rest">'.date::counter($remaining_time).'</span></b>)</span>';
|
||
}
|
||
else
|
||
$additional_info = '';
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge(NULL, '', 'POST', array('id' => 'article_form'));
|
||
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$this->form->group('')->label(url_lang::lang('texts.Centralized logging'));
|
||
$this->form->group('')->label('ulogd '.help::hint('ulogd'))->message();
|
||
$this->form->checkbox('ulogd_enabled')->value('1')->label(url_lang::lang('texts.Enable ulogd'));
|
||
$this->form->input('ulogd_update_interval')->label(url_lang::lang('texts.Interval of update').':')->rules('required|valid_numeric')->value($this->settings->get('ulogd_update_interval'))->help(help::hint('ulogd_update_interval'));
|
||
$this->form->group('')->label(url_lang::lang('texts.Action logs') . ' ' . help::hint('action_logs_active'));
|
||
$this->form->checkbox('action_logs_active')->value('1')->label(url_lang::lang('texts.Enable action logs'));
|
||
$this->form->group('')->label(url_lang::lang('texts.Active members').' '.help::hint('ulogd_active'));
|
||
$this->form->input('ulogd_active_count')->label(url_lang::lang('texts.Count of active members').':')->rules('required|valid_ulogd_active_count')->value($this->settings->get('ulogd_active_count'))->help(help::hint('ulogd_active_count'));
|
||
$this->form->dropdown('ulogd_active_type')->label(url_lang::lang('texts.Type of traffic').':')->rules('required')->options(array(0 => '----- '.url_lang::lang('texts.Select type').' -----', 'upload' => url_lang::lang('texts.upload'), 'download' => url_lang::lang('texts.download'),'total' => url_lang::lang('texts.both').' ('.url_lang::lang('texts.upload').' + '.url_lang::lang('texts.download').')'))->selected($this->settings->get('ulogd_active_type'))->help(help::hint('ulogd_active_type'));
|
||
$this->form->group('')->label(url_lang::lang('texts.Action logs') . ' ' . help::hint('action_logs_active'));
|
||
$this->form->checkbox('action_logs_active')->value('1')->label(url_lang::lang('texts.Enable action logs'));
|
||
$this->form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
special::required_forge_style($this->form, ' *', 'required');
|
||
|
||
... | ... | |
$this->form->action_logs_active->checked('checked');
|
||
}
|
||
|
||
$ulog2_ct_model = new Ulog2_ct_Model();
|
||
if (!$ulog2_ct_model->check_pre_requirements() && !$user_model->check_permission('CREATE ROUTINE'))
|
||
{
|
||
$this->form->ulogd_enabled->label(url_lang::lang('texts.Enable ulogd').' - <span class="error">' . url_lang::lang('texts.it requires already created functions for ulogd or MySQL permission CREATE ROUTINE for create them') . '</span>');
|
||
$this->form->ulogd_enabled->disabled('disabled');
|
||
}
|
||
else if ($this->settings->get('ulogd_enabled') == 1)
|
||
{
|
||
$this->form->ulogd_enabled->checked('checked');
|
||
}
|
||
|
||
// form validate
|
||
if ($this->form->validate())
|
||
{
|
||
... | ... | |
|
||
// action logs value
|
||
$action_logs_active = (isset($form_data['action_logs_active']) && $form_data['action_logs_active'] == 1) ? '1' : '0';
|
||
|
||
// action logs value
|
||
$ulogd_enabled = (isset($form_data['ulogd_enabled']) && $form_data['ulogd_enabled'] == 1) ? '1' : '0';
|
||
|
||
// set logs checkbox value to db
|
||
$config_model->update_variable('action_logs_active', $action_logs_active);
|
||
$config_model->update_variable('ulogd_enabled', $ulogd_enabled);
|
||
|
||
// try to create log table if not exists
|
||
if ($action_logs_active == '1')
|
||
... | ... | |
Log_Model::create_table();
|
||
}
|
||
|
||
// try to create ulogd function if not exists
|
||
if ($ulogd_enabled == '1' && $user_model->check_permission('CREATE ROUTINE'))
|
||
{
|
||
Ulog2_ct_Model::create_functions();
|
||
}
|
||
|
||
$issaved = true;
|
||
foreach ($form_data as $name => $value)
|
||
{
|
||
if ($name == 'action_logs_active') continue;
|
||
if ($name == 'action_logs_active' OR $name == 'ulogd_enabled') continue;
|
||
// check if variable exists
|
||
if ($config_model->check_exist_variable($name))
|
||
// update of variable
|
freenetis/branches/testing/application/views/members_show.php | ||
---|---|---|
<td><?php echo $member->qos_rate ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ($this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Actual traffic').' '.help::hint('actual_traffic %s', date('Y/m/d H:i:s', Settings::get('ulogd_update_last'))) ?></th>
|
||
<td><?php echo network::size(($actual_traffic) ? $actual_traffic->upload : 0) ?> / <?php echo network::size(($actual_traffic)? $actual_traffic->download : 0) ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ($this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Active member').' '.help::hint('ulogd_active') ?></th>
|
||
<td><?php echo ($actual_traffic && $actual_traffic->active) ? url_lang::lang('texts.Yes') : url_lang::lang('texts.No') ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ($this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Total traffic').' '.help::hint('total_traffic') ?></th>
|
||
<td><?php echo network::size($total_traffic->upload) ?> / <?php echo network::size($total_traffic->download) ?></td>
|
freenetis/branches/testing/application/views/menu.php | ||
---|---|---|
<li><?php echo html::anchor(url_lang::base().'config_files', url_lang::lang('texts.Configuration files')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'monitoring', url_lang::lang('texts.Monitoring')) ?></li>
|
||
<li><?php echo html::anchor(url_lang::base().'tools', url_lang::lang('texts.Tools')) ?></li>
|
||
<?php if (Settings::get('ulogd_enabled') == 1): ?>
|
||
<li><?php echo html::anchor(url_lang::base().'ulogd', url_lang::lang('texts.Traffic')) ?></li>
|
||
<?php endif; ?>
|
||
</ul>
|
||
</li><?php } ?>
|
||
|
freenetis/branches/testing/system/libraries/ORM.php | ||
---|---|---|
return in_array (strtolower($permission), $permissions);
|
||
}
|
||
|
||
/**
|
||
* Checks if MySQL function exists
|
||
*
|
||
* @author Michal Kliment
|
||
* @staticvar array $functions
|
||
* @param <type> $function
|
||
* @return boolean
|
||
*/
|
||
public function function_exists ($function)
|
||
{
|
||
static $functions = array();
|
||
|
||
if (!isset ($functions[$function]))
|
||
{
|
||
$functions[$function] = FALSE;
|
||
foreach ($this->db->query ("SHOW FUNCTION STATUS LIKE '$function'") as $row)
|
||
{
|
||
if ($row->Db == Config::get('db_name') && $row->Name == $function)
|
||
{
|
||
$functions[$function] = TRUE;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
return $functions[$function];
|
||
}
|
||
|
||
} // End ORM
|
Také k dispozici: Unified diff
Vylepseno vypinani/zapinani ulogd. Nyni se pri vypnuti nezobrazuje odkaz v menu, ani info na profilu clena. Do ORM dopsana funkce function_exists, ktera testuje jestli MySQL funkce existuje.