|
17 | 17 |
|
18 | 18 | form_security_validate( 'config' ); |
19 | 19 |
|
20 | | -$f_bot_name = gpc_get_string( 'bot_name' ); |
21 | | -$f_api_key = gpc_get_string( 'api_key' ); |
| 20 | +global $g_tg; |
| 21 | + |
| 22 | +$f_bot_name = gpc_get_string( 'bot_name' ); |
| 23 | +$f_api_key = gpc_get_string( 'api_key' ); |
| 24 | +$f_proxy_address = gpc_get_string( 'proxy_address', '' ); |
| 25 | +$f_time_out_server_response = gpc_get_int( 'time_out_server_response' ); |
22 | 26 |
|
23 | 27 | if( plugin_config_get( 'bot_name' ) != $f_bot_name ) { |
24 | 28 | plugin_config_set( 'bot_name', $f_bot_name ); |
|
28 | 32 | plugin_config_set( 'api_key', $f_api_key ); |
29 | 33 | } |
30 | 34 |
|
| 35 | +if( plugin_config_get( 'proxy_address' ) != $f_proxy_address ) { |
| 36 | + plugin_config_set( 'proxy_address', $f_proxy_address ); |
| 37 | +} |
| 38 | + |
| 39 | +if( plugin_config_get( 'time_out_server_response' ) != $f_time_out_server_response ) { |
| 40 | + plugin_config_set( 'time_out_server_response', $f_time_out_server_response ); |
| 41 | +} |
| 42 | + |
31 | 43 | form_security_purge( plugin_page( 'config', true ) ); |
32 | 44 |
|
33 | 45 | $t_redirect_url = plugin_page( 'config_page', true ); |
34 | 46 | layout_page_header( null, $t_redirect_url ); |
35 | 47 | layout_page_begin( $t_redirect_url ); |
36 | 48 |
|
37 | 49 | try { |
38 | | - $t_tg = new \Longman\TelegramBot\Telegram( plugin_config_get( 'api_key' ), plugin_config_get( 'bot_name' ) ); |
39 | | - $t_result = $t_tg->setWebhook( config_get_global( 'path' ) . plugin_page( 'hook', TRUE ) . '&token=' . plugin_config_get( 'api_key' ) ); |
40 | | - |
41 | | -//$t_logo_path = config_get( 'absolute_path' ) . config_get( 'logo_image' ); |
42 | | -//if( file_exists( $t_logo_path ) ) { |
43 | | -// $t_file_content = file_get_contents( $t_logo_path ); |
44 | | -// |
45 | | -//// $t_chat_photo = new \Longman\TelegramBot\Entities\InputMedia\InputMediaPhoto( $t_file_content ); |
46 | | -// $t_data = []; |
47 | | -// $t_data['chat_id'] = get_telegram_user_id_from_mantis_user_id( auth_get_current_user_id() ); |
48 | | -// |
49 | | -// $t_result = Longman\TelegramBot\Request::setChatPhoto( $t_data, $t_logo_path ); |
50 | | -////$t_result_icon = $t_tg-> |
51 | | -//} |
52 | | - |
53 | | - html_operation_successful( $t_redirect_url, plugin_lang_get( 'response_from_telegram' ) . $t_result->getDescription() ); |
| 50 | + html_operation_successful( $t_redirect_url, plugin_lang_get( 'response_from_telegram' ) . telegram_set_webhook()->getDescription() ); |
54 | 51 | } catch( Longman\TelegramBot\Exception\TelegramException $t_errors ) { |
55 | | - html_operation_failure( $t_redirect_url, $t_errors->getMessage() ); |
| 52 | + html_operation_failure( $t_redirect_url, $t_errors->getMessage() ); |
56 | 53 | } |
57 | 54 | layout_page_end(); |
0 commit comments