2013-01-18 18:41:00 +01:00
< ? php
2019-03-04 13:12:01 +01:00
/**
2019-07-02 14:17:53 +02:00
* General setup .
*
* @ category Setup
* @ package Pandora FMS
* @ subpackage Opensource
* @ version 1.0 . 0
* @ license See below
*
2019-03-04 13:12:01 +01:00
* ______ ___ _______ _______ ________
* | __ \ .-----.--.--.--| |.-----.----.-----. | ___ | | | __ |
* | __ /| _ | | _ || _ | _ | _ | | ___ | | __ |
* | ___ | | ___ . _ | __ | __ | _____ || _____ | __ | | ___ . _ | | ___ | | __ | _ | __ | _______ |
*
* ============================================================================
2023-06-08 11:53:13 +02:00
* Copyright ( c ) 2005 - 2023 Pandora FMS
2019-03-04 13:12:01 +01:00
* Please see http :// pandorafms . org for full contribution list
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
* ============================================================================
*/
2013-01-18 18:41:00 +01:00
2023-03-15 17:43:35 +01:00
use function PHPSTORM_META\map ;
2019-07-02 14:17:53 +02:00
// File begin.
2013-01-18 18:41:00 +01:00
global $config ;
2019-07-02 14:17:53 +02:00
2019-01-30 16:18:44 +01:00
check_login ();
2013-01-18 18:41:00 +01:00
2019-09-12 15:37:16 +02:00
if ( is_ajax ()) {
$test_address = get_parameter ( 'test_address' , '' );
2022-09-14 16:20:13 +02:00
$params = io_safe_output ( get_parameter ( 'params' , '' ));
2019-09-12 15:37:16 +02:00
2020-10-06 11:07:46 +02:00
$res = send_test_email (
2021-04-29 16:04:51 +02:00
$test_address ,
$params
2019-10-21 17:36:26 +02:00
);
2019-09-12 15:37:16 +02:00
echo $res ;
2019-10-21 17:36:26 +02:00
// Exit after ajax response.
exit ();
2019-09-12 15:37:16 +02:00
}
2021-03-11 15:40:23 +01:00
echo " <div id='dialog' title=' " . __ ( 'Enforce https Information' ) . " ' class='invisible'> " ;
echo " <p class='center'> " . __ ( 'If SSL is not properly configured you will lose access to ' ) . get_product_name () . __ ( ' Console' ) . '</p>' ;
2019-02-06 16:11:46 +01:00
echo '</div>' ;
2013-01-18 18:41:00 +01:00
2023-03-15 17:43:35 +01:00
$performance_variables_control = ( array ) json_decode ( io_safe_output ( $config [ 'performance_variables_control' ]));
$sources = [];
$sources [ 'system' ] = __ ( 'System' );
$sources [ 'sql' ] = __ ( 'Database' );
2013-01-18 18:41:00 +01:00
2023-03-15 17:43:35 +01:00
// ACL Ips for API.
if ( isset ( $_POST [ 'list_ACL_IPs_for_API' ]) === true ) {
2019-01-30 16:18:44 +01:00
$list_ACL_IPs_for_API = get_parameter_post ( 'list_ACL_IPs_for_API' );
} else {
2021-02-03 11:09:38 +01:00
$list_ACL_IPs_for_API = get_parameter_get (
'list_ACL_IPs_for_API' ,
implode ( " \n " , $config [ 'list_ACL_IPs_for_API' ])
);
2013-01-18 18:41:00 +01:00
}
2019-01-30 16:18:44 +01:00
2023-03-15 17:43:35 +01:00
// Enable Netflow.
2014-06-05 14:06:03 +02:00
if ( strtoupper ( substr ( PHP_OS , 0 , 3 )) == 'WIN' ) {
2019-01-30 16:18:44 +01:00
$rbt_disabled = true ;
2023-03-15 17:43:35 +01:00
} else {
$rbt_disabled = false ;
2014-06-04 19:09:30 +02:00
}
2013-05-06 18:39:41 +02:00
2023-03-15 17:43:35 +01:00
// Zone names.
2019-01-30 16:18:44 +01:00
$zone_name = [
'Africa' => __ ( 'Africa' ),
'America' => __ ( 'America' ),
'Antarctica' => __ ( 'Antarctica' ),
'Arctic' => __ ( 'Arctic' ),
'Asia' => __ ( 'Asia' ),
'Atlantic' => __ ( 'Atlantic' ),
'Australia' => __ ( 'Australia' ),
'Europe' => __ ( 'Europe' ),
'Indian' => __ ( 'Indian' ),
'Pacific' => __ ( 'Pacific' ),
'UTC' => __ ( 'UTC' ),
];
2013-01-18 18:41:00 +01:00
$zone_selected = get_parameter ( 'zone' );
2019-01-30 16:18:44 +01:00
if ( $zone_selected == '' ) {
if ( $config [ 'timezone' ] != '' ) {
$zone_array = explode ( '/' , $config [ 'timezone' ]);
$zone_selected = $zone_array [ 0 ];
} else {
$zone_selected = 'Europe' ;
}
2013-01-18 18:41:00 +01:00
}
$timezones = timezone_identifiers_list ();
foreach ( $timezones as $timezone ) {
2019-01-30 16:18:44 +01:00
if ( strpos ( $timezone , $zone_selected ) !== false ) {
$timezone_n [ $timezone ] = $timezone ;
}
2013-01-18 18:41:00 +01:00
}
2023-03-15 17:43:35 +01:00
// Force Public URL Dialog.
html_print_div (
2021-03-11 15:40:23 +01:00
[
2023-03-15 17:43:35 +01:00
'id' => 'force_public_url_dialog' ,
'class' => 'invisible' ,
'content' => __ ( 'If public URL is not properly configured you will lose access to ' ) . get_product_name () . __ ( ' Console' ),
2021-03-11 15:40:23 +01:00
]
2021-02-03 11:09:38 +01:00
);
2013-01-18 18:41:00 +01:00
2023-03-15 17:43:35 +01:00
// Inventory blacklist.
2022-12-27 13:02:03 +01:00
$inventory_changes_blacklist_id = get_parameter (
'inventory_changes_blacklist' ,
$config [ 'inventory_changes_blacklist' ]
);
if ( ! is_array ( $inventory_changes_blacklist_id )) {
$inventory_changes_blacklist_id = explode (
',' ,
$inventory_changes_blacklist_id
);
}
$inventory_modules = db_get_all_rows_sql (
' SELECT mi . id_module_inventory , mi . name module_inventory_name , os . name os_name
FROM tmodule_inventory mi , tconfig_os os
WHERE os . id_os = mi . id_os '
);
$inventory_changes_blacklist = [];
$inventory_changes_blacklist_out = [];
foreach ( $inventory_modules as $inventory_module ) {
if ( in_array ( $inventory_module [ 'id_module_inventory' ], $inventory_changes_blacklist_id )) {
$inventory_changes_blacklist [ $inventory_module [ 'id_module_inventory' ]] = $inventory_module [ 'module_inventory_name' ] . ' (' . $inventory_module [ 'os_name' ] . ')' ;
} else {
$inventory_changes_blacklist_out [ $inventory_module [ 'id_module_inventory' ]] = $inventory_module [ 'module_inventory_name' ] . ' (' . $inventory_module [ 'os_name' ] . ')' ;
}
}
$select_out = html_print_select (
$inventory_changes_blacklist_out ,
'inventory_changes_blacklist_out[]' ,
'' ,
'' ,
'' ,
'' ,
true ,
true ,
true ,
'' ,
false ,
'width:200px'
);
$arrows = ' ' ;
$select_in = html_print_select (
$inventory_changes_blacklist ,
'inventory_changes_blacklist[]' ,
'' ,
'' ,
'' ,
'' ,
true ,
true ,
true ,
'' ,
false ,
'width:200px'
);
$table_ichanges = ' < table >
< tr >
2023-03-16 11:58:35 +01:00
< td style = " width: 45% " > '.__(' Out of black list ').' </ td >
< td style = " width: 10% " ></ td >
< td style = " width: 45% " > '.__(' In black list ').' </ td >
2022-12-27 13:02:03 +01:00
</ tr >
< tr >
2023-03-16 11:58:35 +01:00
< td style = " width: 45% " > '.$select_out.' </ td >
< td style = " width: 10% " >
2023-03-09 23:31:40 +01:00
< a href = " javascript: " > '.html_print_image(' images / arrow @ svg . svg ', true, [' style ' => ' rotate : 180 deg ; ', ' id ' => ' right_iblacklist ', ' alt ' => __(' Push selected modules into blacklist '), ' title ' => __(' Push selected modules into blacklist '), ' class ' => ' main_menu_icon invert_filter ']).' </ a >
2022-12-27 13:02:03 +01:00
< br >< br >
2023-03-09 23:31:40 +01:00
< a href = " javascript: " > '.html_print_image(' images / arrow @ svg . svg ', true, [' style ' => ' rotate : 0 ', ' id ' => ' left_iblacklist ', ' alt ' => __(' Pop selected modules out of blacklist '), ' title ' => __(' Pop selected modules out of blacklist '), ' class ' => ' main_menu_icon invert_filter ']).' </ a >
2022-12-27 13:02:03 +01:00
</ td >
2023-03-16 11:58:35 +01:00
< td style = " width: 45% " > '.$select_in.' </ td >
2022-12-27 13:02:03 +01:00
</ tr >
</ table > ' ;
2023-03-15 17:43:35 +01:00
$modes_tutorial = [
'full' => __ ( 'Full mode' ),
'on_demand' => __ ( 'On demand' ),
'expert' => __ ( 'Expert' ),
];
2022-12-27 13:02:03 +01:00
2023-03-15 17:43:35 +01:00
$config [ 'past_planned_downtimes' ] = isset (
$config [ 'past_planned_downtimes' ]
) ? $config [ 'past_planned_downtimes' ] : 1 ;
$table = new stdClass ();
$table -> class = 'filter-table-adv' ;
$table -> id = 'setup_general' ;
$table -> width = '100%' ;
$table -> data = [];
$table -> size = [];
$table -> size [ 0 ] = '50%' ;
$table -> size [ 1 ] = '50%' ;
2022-12-27 13:02:03 +01:00
2023-03-15 17:43:35 +01:00
// Current config["language"] could be set by user, not taken from global setup !
$current_system_lang = db_get_sql (
'SELECT `value` FROM tconfig WHERE `token` = "language"'
2021-02-03 11:09:38 +01:00
);
2019-01-30 16:18:44 +01:00
2023-03-15 17:43:35 +01:00
if ( $current_system_lang === '' ) {
$current_system_lang = 'en' ;
}
$i = 0 ;
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Language code' ),
html_print_select_from_sql (
'SELECT id_language, name FROM tlanguage' ,
'language' ,
$current_system_lang ,
'' ,
'' ,
'' ,
true ,
false ,
true ,
false ,
'width:100%'
)
2021-02-03 11:09:38 +01:00
);
2019-01-30 16:18:44 +01:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Remote config directory' ),
html_print_input_text (
'remote_config' ,
io_safe_output ( $config [ 'remote_config' ]),
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-01-30 16:18:44 +01:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Chromium path' ),
html_print_input_text (
'chromium_path' ,
io_safe_output (
$config [ 'chromium_path' ]
),
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-01-30 16:18:44 +01:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Auto login (hash) password' ),
html_print_input_password (
'loginhash_pwd' ,
io_output_password ( $config [ 'loginhash_pwd' ]),
'' ,
15 ,
15 ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-07-02 14:17:53 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Time source' ),
html_print_select (
$sources ,
'timesource' ,
$config [ 'timesource' ],
'' ,
'' ,
'' ,
true
)
2021-02-03 11:09:38 +01:00
);
2020-06-23 09:21:15 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Attachment store' ),
html_print_input_text (
'attachment_store' ,
io_safe_output ( $config [ 'attachment_store' ]),
'' ,
50 ,
255 ,
true
)
2019-01-30 16:18:44 +01:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Enforce https' ),
html_print_checkbox_switch_extended (
'https' ,
1 ,
$config [ 'https' ],
false ,
'' ,
'' ,
true
)
2019-01-30 16:18:44 +01:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Automatic check for updates' ),
html_print_checkbox_switch (
'autoupdate' ,
1 ,
$config [ 'autoupdate' ],
true
)
2019-01-30 16:18:44 +01:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Use cert of SSL' ),
html_print_checkbox_switch_extended (
'use_cert' ,
1 ,
$config [ 'use_cert' ],
false ,
'' ,
'' ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-01-30 16:18:44 +01:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Path of SSL Cert.' ),
html_print_input_text (
'cert_path' ,
io_safe_output ( $config [ 'cert_path' ]),
'' ,
50 ,
255 ,
true
),
2023-02-06 09:06:34 +01:00
[
2023-03-15 17:43:35 +01:00
'div_id' => 'ssl-path-tr' ,
'div_style' => 'display: none' ,
2023-02-06 09:06:34 +01:00
]
2019-01-30 16:18:44 +01:00
);
2015-02-04 11:18:34 +01:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'API password' ),
html_print_input_password (
'api_password' ,
io_output_password ( $config [ 'api_password' ]),
'' ,
25 ,
255 ,
true
)
2021-02-03 11:09:38 +01:00
);
2016-07-04 15:46:56 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'IP list with API access' ),
html_print_textarea (
'list_ACL_IPs_for_API' ,
2 ,
25 ,
$list_ACL_IPs_for_API ,
'class="height_130px"' ,
true
)
2021-02-03 11:09:38 +01:00
);
2016-07-04 15:46:56 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Enable GIS features' ),
html_print_checkbox_switch (
'activate_gis' ,
1 ,
$config [ 'activate_gis' ],
true
)
2021-02-03 11:09:38 +01:00
);
2016-07-04 15:46:56 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Enable Netflow' ),
html_print_checkbox_switch_extended (
'activate_netflow' ,
1 ,
$config [ 'activate_netflow' ],
$rbt_disabled ,
'' ,
'' ,
true
)
2021-02-03 11:09:38 +01:00
);
2017-09-08 12:11:15 +02:00
2023-03-21 09:38:56 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Enable Sflow' ),
html_print_checkbox_switch_extended (
'activate_sflow' ,
1 ,
$config [ 'activate_sflow' ],
$rbt_disabled ,
'' ,
'' ,
true
),
2021-02-03 11:09:38 +01:00
);
2019-01-09 16:20:24 +01:00
2023-03-21 09:38:56 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'General network path' ),
html_print_input_text (
'general_network_path' ,
$config [ 'general_network_path' ],
'' ,
40 ,
255 ,
true
)
2021-02-03 11:09:38 +01:00
);
2023-03-21 09:38:56 +01:00
2023-03-15 17:43:35 +01:00
$table -> colspan [ $i ][] = 2 ;
$table -> data [ $i ++ ][] = html_print_label_input_block (
2023-04-13 12:25:18 +02:00
__ ( 'Server timezone setup' ),
2023-03-15 17:43:35 +01:00
html_print_div (
[
'class' => '' ,
'content' => html_print_input_text_extended (
'timezone_text' ,
$config [ 'timezone' ],
'text-timezone_text' ,
'' ,
25 ,
25 ,
false ,
'' ,
'readonly' ,
true
) . html_print_image (
'images/edit.svg' ,
true ,
[
'id' => 'change_timezone' ,
'title' => __ ( 'Change timezone' ),
'class' => 'main_menu_icon invert_filter' ,
]
) . html_print_select (
$zone_name ,
'zone' ,
$zone_selected ,
'show_timezone();' ,
'' ,
'' ,
true
) . html_print_select (
$timezone_n ,
'timezone' ,
$config [ 'timezone' ],
'' ,
'' ,
'' ,
true
),
],
true
)
2021-02-03 11:09:38 +01:00
);
2020-06-08 10:48:48 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Public URL' ),
html_print_input_text (
'public_url' ,
$config [ 'public_url' ],
'' ,
40 ,
255 ,
true
)
2021-02-03 11:09:38 +01:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Force use Public URL' ),
html_print_switch (
[
'name' => 'force_public_url' ,
'value' => $config [ 'force_public_url' ],
]
)
2021-02-03 11:09:38 +01:00
);
2020-06-08 10:48:48 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Public URL host exclusions' ),
html_print_textarea (
'public_url_exclusions' ,
2 ,
25 ,
$config [ 'public_url_exclusions' ],
'class="height_50px w300px"' ,
true
)
2021-02-03 11:09:38 +01:00
);
2023-03-15 17:43:35 +01:00
// Inventory changes blacklist.
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Inventory changes blacklist' ),
$table_ichanges
2021-02-03 11:09:38 +01:00
);
2020-09-17 14:38:01 +02:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Server logs directory' ),
html_print_input_text (
'server_log_dir' ,
$config [ 'server_log_dir' ],
'' ,
50 ,
255 ,
true
)
2022-07-08 13:40:20 +02:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Event storm protection' ),
html_print_checkbox_switch (
'event_storm_protection' ,
1 ,
$config [ 'event_storm_protection' ],
true
)
2022-07-08 13:40:20 +02:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Command Snapshot' ),
html_print_checkbox_switch (
'command_snapshot' ,
1 ,
$config [ 'command_snapshot' ],
true
)
2023-03-14 13:16:58 +01:00
);
2013-01-18 18:41:00 +01:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Change remote config encoding' ),
html_print_checkbox_switch (
'use_custom_encoding' ,
1 ,
$config [ 'use_custom_encoding' ],
true
)
);
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Referer security' ),
html_print_checkbox_switch (
'referer_security' ,
1 ,
$config [ 'referer_security' ],
true
)
);
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Log size limit in system logs viewer extension' ),
html_print_div (
[
'class' => '' ,
'content' => html_print_input_text (
'max_log_size' ,
$config [ 'max_log_size' ],
'' ,
20 ,
255 ,
true
) . html_print_label (
' x1000' ,
'max_log_size' ,
true
),
],
true
)
);
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Tutorial mode' ),
html_print_select (
$modes_tutorial ,
'tutorial_mode' ,
$config [ 'tutorial_mode' ],
'' ,
'' ,
0 ,
true
)
);
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Allow create scheduled downtimes in the past' ),
html_print_checkbox_switch (
'past_planned_downtimes' ,
1 ,
$config [ 'past_planned_downtimes' ],
true
)
);
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Limit for bulk operations' ),
html_print_input (
[
'type' => 'number' ,
'size' => 5 ,
'max' => $performance_variables_control [ 'limit_parameters_massive' ] -> max ,
'name' => 'limit_parameters_massive' ,
'value' => $config [ 'limit_parameters_massive' ],
'return' => true ,
'min' => $performance_variables_control [ 'limit_parameters_massive' ] -> min ,
'style' => 'width:50%' ,
]
)
);
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Include agents manually disabled' ),
html_print_checkbox_switch (
'include_agents' ,
1 ,
$config [ 'include_agents' ],
true
)
);
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Set alias as name by default in agent creation' ),
html_print_checkbox_switch (
'alias_as_name' ,
1 ,
$config [ 'alias_as_name' ],
true
)
2022-07-08 13:40:20 +02:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Unique IP' ),
html_print_checkbox_switch (
'unique_ip' ,
1 ,
$config [ 'unique_ip' ],
true
)
2022-07-08 13:40:20 +02:00
);
2023-03-15 17:43:35 +01:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Module custom ID readonly' ),
html_print_checkbox_switch (
'module_custom_id_ro' ,
1 ,
$config [ 'module_custom_id_ro' ],
true
) . ui_print_input_placeholder (
__ ( 'Useful for integrations' ),
true
)
);
2013-01-18 18:41:00 +01:00
2023-03-15 17:43:35 +01:00
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Enable console log' ),
html_print_checkbox_switch (
'console_log_enabled' ,
1 ,
$config [ 'console_log_enabled' ],
true
) . ui_print_input_placeholder (
__ ( 'Log location' ) . ': pandora_console/log/console.log' ,
true
)
);
$table -> data [ $i ++ ][] = html_print_label_input_block (
__ ( 'Enable audit log' ),
html_print_checkbox_switch (
'audit_log_enabled' ,
1 ,
$config [ 'audit_log_enabled' ],
true
) . ui_print_input_placeholder (
__ ( 'Log location' ) . ': pandora_console/log/audit.log' ,
true
)
);
$table -> data [ $i ][] = html_print_label_input_block (
__ ( 'Enable console report' ),
html_print_checkbox_switch (
'reporting_console_enable' ,
1 ,
$config [ 'reporting_console_enable' ],
true
)
);
2023-04-12 17:32:52 +02:00
$table -> data [ $i ++ ][] = html_print_label_input_block (
2023-03-30 09:15:10 +02:00
__ ( 'Check conexion interval' ),
html_print_input_number (
[
'name' => 'check_conexion_interval' ,
'min' => 90 ,
'value' => $config [ 'check_conexion_interval' ],
]
)
);
2023-04-12 17:46:10 +02:00
$help_tip = ui_print_help_tip (
__ ( 'If there are any "In process" events with a specific Extra ID and a New event with that Extra ID is received, it will be created as "In process" instead.' ),
true
);
2023-04-12 17:32:52 +02:00
$table -> data [ $i ][] = html_print_label_input_block (
2023-04-12 17:46:10 +02:00
__ ( 'Keep In process status for new events with extra ID' ) . $help_tip ,
2023-04-12 17:32:52 +02:00
html_print_checkbox_switch (
'keep_in_process_status_extra_id' ,
1 ,
$config [ 'keep_in_process_status_extra_id' ],
true
)
);
2023-03-15 17:43:35 +01:00
echo '<form class="max_floating_element_size" id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure=' . $config [ 'pure' ] . '">' ;
2013-01-18 18:41:00 +01:00
2023-03-16 13:11:11 +01:00
echo '<fieldset class="margin-bottom-10">' ;
2019-01-30 16:18:44 +01:00
echo '<legend>' . __ ( 'General options' ) . '</legend>' ;
2013-01-18 18:41:00 +01:00
2019-01-30 16:18:44 +01:00
html_print_input_hidden ( 'update_config' , 1 );
html_print_table ( $table );
2013-01-18 18:41:00 +01:00
2019-06-10 09:43:27 +02:00
$encryption = [
2021-02-03 11:09:38 +01:00
'ssl' => 'SSL' ,
2019-06-10 09:43:27 +02:00
'sslv2' => 'SSLv2' ,
'sslv3' => 'SSLv3' ,
'tls' => 'STARTTLS' ,
];
echo '</fieldset>' ;
2023-03-16 13:11:11 +01:00
echo '<fieldset class="margin-bottom-10">' ;
2019-06-10 09:43:27 +02:00
echo '<legend>' . __ ( 'Mail configuration' ) . '</legend>' ;
2023-03-15 17:43:35 +01:00
ui_print_warning_message (
2021-02-03 11:09:38 +01:00
__ (
' Please notice that some providers like Gmail or Office365 need to setup / enable manually external connections using SMTP and you need to use STARTTLS on port 587.
2019-06-10 09:43:27 +02:00
2021-02-03 11:09:38 +01:00
If you have manual settings in your pandora_server . conf , please note these settings will ignore this console setup . '
)
);
2019-09-12 15:37:16 +02:00
2023-03-15 17:43:35 +01:00
$table_mail_conf = new stdClass ();
$table_mail_conf -> width = '100%' ;
$table_mail_conf -> class = 'databox filter-table-adv' ;
$table_mail_conf -> size = [];
$table_mail_conf -> size [ 0 ] = '50%' ;
$table_mail_conf -> size [ 1 ] = '50%' ;
$table_mail_conf -> data = [];
$table_mail_conf -> data [ 0 ][] = html_print_label_input_block (
__ ( 'From address' ),
html_print_input_text (
'email_from_dir' ,
$config [ 'email_from_dir' ],
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-09-12 15:37:16 +02:00
2023-03-15 17:43:35 +01:00
$table_mail_conf -> data [ 0 ][] = html_print_label_input_block (
__ ( 'From name' ),
html_print_input_text (
'email_from_name' ,
$config [ 'email_from_name' ],
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-06-10 09:43:27 +02:00
2023-03-15 17:43:35 +01:00
$table_mail_conf -> data [ 1 ][] = html_print_label_input_block (
__ ( 'SMTP Server' ),
html_print_input_text (
'email_smtpServer' ,
$config [ 'email_smtpServer' ],
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-09-12 15:37:16 +02:00
2023-03-15 17:43:35 +01:00
$table_mail_conf -> data [ 1 ][] = html_print_label_input_block (
__ ( 'SMTP Port' ),
html_print_input_text (
'email_smtpPort' ,
$config [ 'email_smtpPort' ],
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2019-10-21 17:36:26 +02:00
2023-03-15 17:43:35 +01:00
$table_mail_conf -> data [ 2 ][] = html_print_label_input_block (
__ ( 'Email user' ),
html_print_input_text (
'email_username' ,
$config [ 'email_username' ],
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2023-03-15 17:43:35 +01:00
$table_mail_conf -> data [ 2 ][] = html_print_label_input_block (
__ ( 'Email password' ),
html_print_input_password (
'email_password' ,
io_output_password (
$config [ 'email_password' ]
),
'' ,
30 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2013-01-18 18:41:00 +01:00
2023-03-15 17:43:35 +01:00
$table_mail_conf -> data [ 3 ][] = html_print_label_input_block (
__ ( 'Encryption' ),
html_print_select (
$encryption ,
'email_encryption' ,
$config [ 'email_encryption' ],
'' ,
__ ( 'none' ),
0 ,
true
)
2021-02-03 11:09:38 +01:00
);
2020-09-17 14:38:01 +02:00
2021-02-03 11:09:38 +01:00
$uniqid = uniqid ();
2019-09-12 15:37:16 +02:00
2021-02-03 11:09:38 +01:00
print_email_test_modal_window ( $uniqid );
2019-09-12 15:37:16 +02:00
2021-02-03 11:09:38 +01:00
html_print_input_hidden ( 'update_config' , 1 );
html_print_table ( $table_mail_conf );
echo '</fieldset>' ;
2023-03-15 17:43:35 +01:00
html_print_action_buttons (
html_print_submit_button (
__ ( 'Update' ),
'update_button' ,
false ,
[ 'icon' => 'update' ],
true
) . html_print_button (
__ ( 'Email test' ),
'email_test_dialog' ,
false ,
'show_email_test("' . $uniqid . '");' ,
[
'icon' => 'mail' ,
'mode' => 'secondary' ,
],
true
)
2022-10-26 10:51:12 +02:00
);
2021-02-03 11:09:38 +01:00
echo '</form>' ;
/**
* Print the modal window for the summary of each alerts group
*
* @ param string $id Id .
*
* @ return void
*/
function print_email_test_modal_window ( $id )
{
// Email config table.
$table_mail_test = new stdClass ();
$table_mail_test -> width = '100%' ;
2023-03-15 17:43:35 +01:00
$table_mail_test -> class = 'filter-table-adv' ;
2021-02-03 11:09:38 +01:00
$table_mail_test -> data = [];
2023-03-15 17:43:35 +01:00
$table_mail_test -> data [ 0 ][] = html_print_label_input_block (
__ ( 'Address' ),
html_print_input_text (
'email_test_address' ,
'' ,
'' ,
35 ,
100 ,
true
)
2021-02-03 11:09:38 +01:00
);
2023-03-15 17:43:35 +01:00
$table_mail_test -> data [ 1 ][] = '  <span id="email_test_sent_message" class="invisible"><b>Email sent</b></span><span id="email_test_failure_message" class=invisible"><b>Email could not be sent</b></span>' ;
2022-10-26 10:51:12 +02:00
2023-03-15 17:43:35 +01:00
// $table_mail_test->colspan[2][0] = 2;
$submitButton = html_print_div (
2022-10-26 10:51:12 +02:00
[
2023-03-15 17:43:35 +01:00
'class' => 'action-buttons-right-forced' ,
2022-10-26 10:51:12 +02:00
'content' => html_print_button (
__ ( 'Send' ),
'email_test' ,
false ,
'' ,
[
'icon' => 'cog' ,
'mode' => 'mini' ,
],
true
),
],
2021-02-03 11:09:38 +01:00
true
2021-05-11 15:48:09 +02:00
);
2023-03-15 17:43:35 +01:00
echo '<div id="email_test_' . $id . '" title="' . __ ( 'Check mail configuration' ) . '" class="invisible">' . html_print_table ( $table_mail_test , true ) . $submitButton . '</div>' ;
2021-02-03 11:09:38 +01:00
}
2019-09-12 15:37:16 +02:00
2013-01-18 18:41:00 +01:00
2021-02-03 11:09:38 +01:00
?>
2013-01-18 18:41:00 +01:00
< script type = " text/javascript " >
function show_timezone () {
2019-01-30 16:18:44 +01:00
zone = $ ( " #zone " ) . val ();
$ . ajax ({
type : " POST " ,
url : " ajax.php " ,
data : " page=<?php echo $_GET['sec2'] ; ?>&select_timezone=1&zone= " + zone ,
dataType : " json " ,
success : function ( data ) {
$ ( " #timezone " ) . empty ();
jQuery . each ( data , function ( id , value ) {
timezone = value ;
$ ( " select[name='timezone'] " ) . append ( $ ( " <option> " ) . val ( timezone ) . html ( timezone ));
});
}
});
2013-01-18 18:41:00 +01:00
}
2019-09-12 15:37:16 +02:00
function show_email_test ( id ) {
$ ( '#email_test_sent_message' ) . hide ();
$ ( '#email_test_failure_message' ) . hide ();
$ ( " #email_test_ " + id ) . dialog ({
resizable : true ,
draggable : true ,
modal : true ,
width : 450 ,
overlay : {
opacity : 0.5 ,
background : " black "
}
});
}
function perform_email_test () {
2021-05-11 15:48:09 +02:00
$ ( '#email_test_sent_message' ) . hide ();
$ ( '#email_test_failure_message' ) . hide ();
2019-09-12 15:37:16 +02:00
var test_address = $ ( '#text-email_test_address' ) . val ();
2021-04-29 16:04:51 +02:00
params = {
email_smtpServer : $ ( '#text-email_smtpServer' ) . val (),
email_smtpPort : $ ( '#text-email_smtpPort' ) . val (),
email_username : $ ( '#text-email_username' ) . val (),
email_password : $ ( '#password-email_password' ) . val (),
email_encryption : $ ( " #email_encryption option:selected " ) . val (),
email_from_dir : $ ( '#text-email_from_dir' ) . val (),
email_from_name : $ ( '#text-email_from_name' ) . val ()
};
2019-09-12 15:37:16 +02:00
$ . ajax ({
type : " POST " ,
url : " ajax.php " ,
2021-04-29 16:04:51 +02:00
data : {
page : " godmode/setup/setup_general " ,
test_address : test_address ,
params : params
},
dataType : " json " ,
2019-09-12 15:37:16 +02:00
success : function ( data ) {
2020-10-06 11:07:46 +02:00
if ( parseInt ( data ) === 1 ) {
$ ( '#email_test_sent_message' ) . show ();
2021-05-11 15:48:09 +02:00
$ ( '#email_test_failure_message' ) . hide ();
2020-10-06 11:07:46 +02:00
} else {
$ ( '#email_test_failure_message' ) . show ();
2021-05-11 15:48:09 +02:00
$ ( '#email_test_sent_message' ) . hide ();
2020-10-06 11:07:46 +02:00
}
2019-09-12 15:37:16 +02:00
},
error : function () {
$ ( '#email_test_failure_message' ) . show ();
2021-05-11 15:48:09 +02:00
$ ( '#email_test_sent_message' ) . hide ();
2019-09-12 15:37:16 +02:00
},
});
}
2013-01-18 18:41:00 +01:00
$ ( document ) . ready ( function () {
2018-05-09 13:12:03 +02:00
2019-01-30 16:18:44 +01:00
$ ( " #zone " ) . attr ( " hidden " , true );
$ ( " #timezone " ) . attr ( " hidden " , true );
2018-05-09 13:12:03 +02:00
2019-01-30 16:18:44 +01:00
$ ( " #change_timezone " ) . click ( function () {
$ ( " #zone " ) . attr ( " hidden " , false );
$ ( " #timezone " ) . attr ( " hidden " , false );
});
2018-12-07 15:12:09 +01:00
2019-02-26 12:04:18 +01:00
if ( $ ( " input[name=use_cert] " ) . is ( ':checked' )) {
2019-07-02 14:17:53 +02:00
$ ( '#ssl-path-tr' ) . show ();
2019-02-26 12:04:18 +01:00
}
2019-02-15 14:56:20 +01:00
2019-01-30 16:18:44 +01:00
$ ( " input[name=use_cert] " ) . change ( function () {
2019-02-06 16:11:46 +01:00
if ( $ ( this ) . is ( " :checked " ) )
2019-07-02 14:17:53 +02:00
$ ( '#ssl-path-tr' ) . show ();
2019-01-30 16:18:44 +01:00
else
2019-07-02 14:17:53 +02:00
$ ( '#ssl-path-tr' ) . hide ();
2019-01-17 17:28:23 +01:00
2019-01-30 16:18:44 +01:00
});
2019-02-06 16:11:46 +01:00
$ ( " input[name=https] " ) . change ( function (){
if ( $ ( " input[name=https] " ) . prop ( 'checked' )) {
2019-07-02 14:17:53 +02:00
$ ( " #dialog " ) . dialog ({
2019-02-06 16:11:46 +01:00
modal : true ,
2019-07-02 14:17:53 +02:00
width : 500 ,
buttons : [
{
class : 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next' ,
text : " <?php echo __('OK'); ?> " ,
click : function (){
$ ( this ) . dialog ( " close " );
}
2019-02-06 16:11:46 +01:00
}
2019-07-02 14:17:53 +02:00
]
2019-02-06 16:11:46 +01:00
});
}
})
2013-01-18 18:41:00 +01:00
2019-07-02 14:17:53 +02:00
$ ( " input[name=force_public_url] " ) . change ( function (){
if ( $ ( " input[name=force_public_url] " ) . prop ( 'checked' )) {
$ ( " #force_public_url_dialog " ) . dialog ({
modal : true ,
width : 500 ,
buttons : [
{
class : 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next' ,
text : " <?php echo __('OK'); ?> " ,
click : function (){
$ ( this ) . dialog ( " close " );
}
}
]
});
2019-01-30 16:18:44 +01:00
}
2019-07-02 14:17:53 +02:00
})
2019-09-12 15:37:16 +02:00
2022-10-26 10:51:12 +02:00
$ ( '#button-email_test' ) . click ( perform_email_test );
2022-12-28 18:28:03 +01:00
$ ( " #right_iblacklist " ) . click ( function () {
jQuery . each ( $ ( " select[name='inventory_changes_blacklist_out[]'] option:selected " ), function ( key , value ) {
imodule_name = $ ( value ) . html ();
if ( imodule_name != < ? php echo " ' " . __ ( 'None' ) . " ' " ; ?> ) {
id_imodule = $ ( value ) . attr ( 'value' );
$ ( " select[name='inventory_changes_blacklist[]'] " )
. append (
$ ( " <option></option> " )
. val ( id_imodule )
. html ( '<i>' + imodule_name + '</i>' )
);
$ ( " #inventory_changes_blacklist_out " )
. find ( " option[value=' " + id_imodule + " '] " ) . remove ();
$ ( " #inventory_changes_blacklist " )
. find ( " option[value=''] " ) . remove ();
if ( $ ( " #inventory_changes_blacklist_out option " ) . length == 0 ) {
$ ( " select[name='inventory_changes_blacklist_out[]'] " )
. append (
$ ( " <option></option> " )
. val ( '' )
. html ( '<i><?php echo __(' None '); ?></i>' )
);
}
}
});
});
$ ( " #left_iblacklist " ) . click ( function () {
jQuery . each ( $ ( " select[name='inventory_changes_blacklist[]'] option:selected " ), function ( key , value ) {
imodule_name = $ ( value ) . html ();
if ( imodule_name != < ? php echo " ' " . __ ( 'None' ) . " ' " ; ?> ) {
id_imodule = $ ( value ) . attr ( 'value' );
$ ( " select[name='inventory_changes_blacklist_out[]'] " )
. append (
2022-12-30 15:04:07 +01:00
$ ( " <option></option> " )
2022-12-28 18:28:03 +01:00
. val ( id_imodule )
. html ( '<i>' + imodule_name + '</i>' )
);
$ ( " #inventory_changes_blacklist " )
. find ( " option[value=' " + id_imodule + " '] " ) . remove ();
$ ( " #inventory_changes_blacklist_out " )
. find ( " option[value=''] " ) . remove ();
if ( $ ( " #inventory_changes_blacklist option " ) . length == 0 ) {
$ ( " select[name='inventory_changes_blacklist[]'] " )
. append (
$ ( " <option></option> " )
. val ( '' )
. html ( '<i><?php echo __(' None '); ?></i>' )
);
}
}
});
});
2022-12-29 18:14:43 +01:00
$ ( " #submit-update_button " ) . click ( function () {
$ ( '#inventory_changes_blacklist option' ) . map ( function (){
$ ( this ) . prop ( 'selected' , true );
});
});
2013-01-18 18:41:00 +01:00
});
</ script >