Skip to content

Commit

Permalink
option save only errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Anisan committed Jul 12, 2023
1 parent 03fd4be commit fe27330
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions languages/telegram_default.php
Expand Up @@ -54,6 +54,7 @@
'TLG_PROXY_LOGIN'=>'Login proxy',
'TLG_PROXY_PASSWORD'=>'Password proxy',
'TLG_REG_USER'=>'Auto registration users',
'TLG_HISTORY_ONLY_ERRORS'=>'Save history only errors',
/* about */

/* help */
Expand Down
1 change: 1 addition & 0 deletions languages/telegram_ru.php
Expand Up @@ -55,6 +55,7 @@
'TLG_PROXY_LOGIN'=>'Логин прокси',
'TLG_PROXY_PASSWORD'=>'Пароль прокси',
'TLG_REG_USER'=>'Регистрация пользователей',
'TLG_HISTORY_ONLY_ERRORS'=>'В истории только ошибки',
/* about */

/* help */
Expand Down
11 changes: 9 additions & 2 deletions modules/telegram/telegram.class.php
Expand Up @@ -81,7 +81,8 @@ function getConfig() {
'TLG_COUNT_ROW',
'TLG_PLAYER',
'TLG_BOT_ID',
'TLG_BOT_NAME'
'TLG_BOT_NAME',
'TLG_HISTORY_ONLY_ERRORS'
);

foreach($setConfigKeys as $k) {
Expand Down Expand Up @@ -345,6 +346,7 @@ function admin(&$out) {
$out['BOT_JOIN_GROUP'] = $this->config['TLG_BOT_JOIN_GROUP'];
$out['BOT_READ_GROUP'] = $this->config['TLG_BOT_READ_GROUP'];
$out['BOT_SUPPORT_INLINE'] = $this->config['TLG_BOT_SUPPORT_INLINE'];

if(!$out['TLG_COUNT_ROW'])
$out['TLG_COUNT_ROW'] = 3;
if(!$out['TLG_TIMEOUT'])
Expand All @@ -367,6 +369,7 @@ function admin(&$out) {
$out['TLG_PROXY_LOGIN'] = $this->config['TLG_PROXY_LOGIN'];
$out['TLG_PROXY_PASSWORD'] = $this->config['TLG_PROXY_PASSWORD'];
$out['TLG_IPRESOLV'] = $this->config['TLG_IPRESOLV'];
$out['HISTORY_ONLY_ERRORS'] = $this->config['TLG_HISTORY_ONLY_ERRORS'];

if($this->data_source == 'telegram' || $this->data_source == '') {
if($this->view_mode == 'update_settings') {
Expand Down Expand Up @@ -402,6 +405,8 @@ function admin(&$out) {
$this->config['TLG_PROXY_LOGIN'] = $tlg_proxy_login;
global $tlg_proxy_password;
$this->config['TLG_PROXY_PASSWORD'] = $tlg_proxy_password;
global $tlg_history_only_errors;
$this->config['TLG_HISTORY_ONLY_ERRORS'] = $tlg_history_only_errors;
global $tlg_ipresolv;
if(preg_match("/^(any|ipv4|ipv6)$/", $tlg_ipresolv)) {
$this->config['TLG_IPRESOLV'] = $tlg_ipresolv;
Expand Down Expand Up @@ -1792,7 +1797,9 @@ function resendData(){

function saveData($data, $direction){

//if ($direction != 2) return; // save only send error
$this->getConfig();
if ($this->config['TLG_HISTORY_ONLY_ERRORS'])
if ($direction < 2) return; // save only send error

$rec=array();
$rec["DIRECTION"] = $direction;
Expand Down
5 changes: 5 additions & 0 deletions templates/telegram/search_admin.html
Expand Up @@ -107,6 +107,11 @@
</label>
<div class="controls"><input type="checkbox" name="tlg_reg_user" value="1"[#if TLG_REG_USER="1"#] checked[#endif#]></div>
</div>
<div class="form-group">
<label class="control-label"><#LANG_TLG_HISTORY_ONLY_ERRORS#>
</label>
<div class="controls"><input type="checkbox" name="tlg_history_only_errors" value="1"[#if HISTORY_ONLY_ERRORS="1"#] checked[#endif#]></div>
</div>
<script type="text/javascript">
function showInfo(){
var url="?webhookinfo=1";
Expand Down

0 comments on commit fe27330

Please sign in to comment.