2012-12-17 Miguel de Dios <miguel.dedios@artica.es>

* godmode/alerts/alert_list.php,
	godmode/alerts/configure_alert_template.php,
	godmode/alerts/alert_templates.php,
	godmode/alerts/alert_list.builder.php,
	operation/messages/message_edit.php, include/functions_api.php,
	operation/reporting/reporting_xml.php,
	godmode/reporting/graph_builder.graph_editor.php: cleaned source
	code style.
	
	* include/functions_io.php: improved the function "__" for to hook
	the translations from metaconsole.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7292 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-12-17 16:50:38 +00:00
parent 9c8d0c052e
commit e2bb2d12de
10 changed files with 101 additions and 76 deletions

View File

@ -1,3 +1,17 @@
2012-12-17 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_templates.php,
godmode/alerts/alert_list.builder.php,
operation/messages/message_edit.php, include/functions_api.php,
operation/reporting/reporting_xml.php,
godmode/reporting/graph_builder.graph_editor.php: cleaned source
code style.
* include/functions_io.php: improved the function "__" for to hook
the translations from metaconsole.
2012-12-17 Miguel de Dios <miguel.dedios@artica.es>
* godmode/setup/file_manager.php, include/functions_filemanager.php:

View File

@ -79,7 +79,7 @@ else{
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$templates = alerts_get_alert_templates (array ('id_group IN (' . $filter_groups . ')'), array ('id', 'name'));
}
}
$table->data[1][1] = html_print_select (index_array ($templates, 'id', 'name'),
'template', '', '', __('Select'), 0, true);

View File

@ -278,15 +278,15 @@ else {
$buttons[$tab]['active'] = true;
if ($tab == 'list') {
ui_print_page_header(__('Alerts') . ' &raquo; ' . __('Manage alerts') . ' &raquo; ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons);
ui_print_page_header(__('Alerts') . ' &raquo; ' . __('Manage alerts') . ' &raquo; ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons);
}
else {
ui_print_page_header(__('Alerts') . ' &raquo; ' . __('Manage alerts') . ' &raquo; ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons);
}
}
}
else {
alerts_meta_print_header();
}

View File

@ -168,7 +168,7 @@ if ($delete_template) {
}
else {
ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/god2.png", false, "alert_template", true);
}
}
}
} // If user tries to delete a template of others groups
else {
@ -185,7 +185,7 @@ if ($delete_template) {
}
else {
ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/god2.png", false, "alert_template", true);
}
}
}
else {
db_pandora_audit("ACL Violation",
@ -201,7 +201,7 @@ if ($delete_template) {
}
else {
ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/god2.png", false, "alert_template", true);
}
}
}
$result = alerts_delete_alert_template ($id);

View File

@ -102,20 +102,21 @@ if ($a_template !== false) {
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
}
}
}
// This prevents to duplicate the header in case duplicate/edit_template action is performed
} else {
}
else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
}
else {
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true);
}
}
@ -142,13 +143,13 @@ function print_alert_template_steps ($step, $id) {
echo '<ol class="steps">';
if (defined('METACONSOLE')) {
$sec = 'advanced';
}
else {
$sec = 'galertas';
}
}
$pure = get_parameter('pure', 0);
@ -217,21 +218,21 @@ function print_alert_template_steps ($step, $id) {
function update_template ($step) {
global $config;
$id = (int) get_parameter ('id');
if (empty ($id))
return false;
if (defined('METACONSOLE')) {
$sec = 'advanced';
}
else {
$sec = 'galertas';
}
}
if ($step == 1) {
$name = (string) get_parameter ('name');
$description = (string) get_parameter ('description');
@ -280,19 +281,19 @@ function update_template ($step) {
$default_action = NULL;
}
$values = array ('monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'special_day' => $special_day,
'time_threshold' => $threshold,
'id_alert_action' => $default_action,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts
);
$values = array (
'monday' => $monday,
'tuesday' => $tuesday,
'wednesday' => $wednesday,
'thursday' => $thursday,
'friday' => $friday,
'saturday' => $saturday,
'sunday' => $sunday,
'special_day' => $special_day,
'time_threshold' => $threshold,
'id_alert_action' => $default_action,
'max_alerts' => $max_alerts,
'min_alerts' => $min_alerts);
$fields = array();
for($i=1;$i<=10;$i++) {
@ -393,17 +394,17 @@ if ($create_template) {
$name_check = db_get_value ('name', 'talert_templates', 'name', $name);
$values = array ('description' => $description,
'value' => $value,
'max_value' => $max,
'min_value' => $min,
'id_group' => $id_group,
'matches_value' => $matches,
'priority' => $priority,
'wizard_level' => $wizard_level);
'value' => $value,
'max_value' => $max,
'min_value' => $min,
'id_group' => $id_group,
'matches_value' => $matches,
'priority' => $priority,
'wizard_level' => $wizard_level);
if($config['dbtype'] == "oracle") {
$values['field3'] = ' ';
$values['field3_recovery'] = ' ';
$values['field3'] = ' ';
$values['field3_recovery'] = ' ';
}
if (!$name_check) {

View File

@ -162,7 +162,7 @@ echo "</tr><tr>";
}
else {*/
echo "<td>".html_print_select (agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, 'width:300px;')."</td>";
//}
//}
echo "<td style='vertical-align: center; text-align: center;'>" . html_print_image("images/darrowright.png", true) . "</td>";
echo "<td>".html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:300px;')."</td>";
echo "</tr><tr>";

View File

@ -2660,31 +2660,31 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) {
foreach ($policy_alerts as $policy_alert){
$result_pol_alerts[] = $policy_alert['id'];
}
$id_pol_alerts = implode(',', $result_pol_alerts);
// If the policy has alerts
if (count($result_pol_alerts) != 0){
$sql = sprintf ("SELECT id
FROM talert_template_modules
WHERE id_policy_alerts IN (%s)",
$id_pol_alerts);
$id_alerts = db_get_all_rows_sql($sql);
$id_alerts = db_get_all_rows_sql($sql);
$result_alerts = array();
foreach ($id_alerts as $id_alert){
$result_alerts[] = $id_alert['id'];
}
}
// Validate alerts of these modules
foreach ($result_alerts as $result_alert){
$result = alerts_validate_alert_agent_module($result_alert, true);
if ($result){
if ($result) {
$count_results++;
}
}
}
}
}
@ -2693,7 +2693,7 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) {
if ($total_alerts > $count_results){
$errors = $total_alerts - $count_results;
returnError('error_validate_all_alerts', __('Error validate all policy alerts. Failed ' . $errors . '.'));
}
}
else {
returnData('string', array('type' => 'string', 'data' => __('Correct validating of all policy alerts.')));
}

View File

@ -363,42 +363,52 @@ function io_unsafe_string ($string) {
*/
function __ ($string /*, variable arguments */) {
global $l10n;
$extensions = extensions_get_extensions();
if (empty($extensions)) $extensions = array();
if (empty($extensions))
$extensions = array();
global $config;
if ($config['enterprise_installed'] &&
if (defined('METACONSOLE')) {
enterprise_include_once ('meta/include/functions_meta.php');
$tranlateString = meta_get_defined_translation($string);
if ($tranlateString !== false) {
return $tranlateString;
}
}
elseif ($config['enterprise_installed'] &&
isset($config['translate_string_extension_installed']) &&
$config['translate_string_extension_installed'] == 1 &&
array_key_exists('translate_string.php', $extensions)) {
enterprise_include_once('extensions/translate_string/functions.php');
$tranlateString = get_defined_translation($string);
if ($tranlateString !== false) {
return $tranlateString;
}
}
if ($string == '') {
return $string;
}
if (func_num_args () == 1) {
if (is_null ($l10n))
return $string;
return $l10n->translate ($string);
}
$args = func_get_args ();
$string = array_shift ($args);
if (is_null ($l10n))
return vsprintf ($string, $args);
return vsprintf ($string, $args);
return vsprintf ($l10n->translate ($string), $args);
}

View File

@ -141,7 +141,7 @@ if (($new_msg) && ($dst_group!='') && (!$reply)) {
ui_print_result_message ($return,
__('Message successfully sent'),
__('Error sending message to group %s', groups_get_name ($dst_group)));
}
}
//message creation form

View File

@ -1378,7 +1378,7 @@ foreach ($contents as $content) {
$result = fwrite($file, $content_report);
fclose($file);
}
}
$i++;
@ -1386,7 +1386,7 @@ foreach ($contents as $content) {
$content_report = " </object>\n";
$result = fwrite($file, $content_report);
fclose($file);
}
}
$file = fopen ($temp_file, 'a+');
$content_report = " </configuration_report_group>\n";
$result = fwrite($file, $content_report);
@ -1399,7 +1399,7 @@ foreach ($contents as $content) {
case 'netflow_data':
case 'netflow_statistics':
case 'netflow_summary':
// Read the report item
$report_id = $report['id_report'];
$content_id = $content['id_rc'];
@ -1422,7 +1422,7 @@ foreach ($contents as $content) {
// Build a unique id for the cache
$unique_id = $report_id . '_' . $content_id . '_' . ($end_date - $start_date);
$table->colspan[0][0] = 4;
if ($filter['aggregate'] != 'none') {
$data["title"] = $description . ' (' . __($filter['aggregate']) . '/' . __($filter['output']) . ')';
@ -1435,7 +1435,7 @@ foreach ($contents as $content) {
$buffer_file["objdata"] = $config['attachment_store'] . '/netflow_' . $time.'_'.$content['id_rc'] . '.tmp';
break;
}
xml_array ($data, $buffer_file);
echo '</object>';
$counter++;
@ -1443,7 +1443,7 @@ foreach ($contents as $content) {
if (($config ['metaconsole'] == 1) && defined('METACONSOLE') && $remote_connection == 1) {
//Restore db connection
metaconsole_restore_db();
}
}
}