Для Invision Power Board 2.3.x
./sources/action_public/messenger.php
Найти
Ниже добавить
/*
* Проверяем на флуд в приват
* Настройки зависят от флуда на Е-маил в настройках группы.
*/
function _allow_to_pm($member_id, $spam_limit)
{
$member_id = intval($member_id);
list( $limit, $flood ) = explode( ':', $spam_limit );
if ( ! $limit and ! $flood )
{
return FALSE;
}
//------
// Get some stuff from the DB!
// 1) FLOOD?
//------
if ( $flood )
{
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'message_topics',
'where' => "mt_owner_id={$member_id}",
'order' => 'mt_date DESC',
'limit' => array(0,1) ) );
$this->ipsclass->DB->simple_exec();
$last_pm = $this->ipsclass->DB->fetch_row();
if ( $last_pm['mt_date'] + ($flood * 60) > time() )
{
return array('key' => 'error', 'lang' => 'pm_flood', 'extra' => "{$flood}");
}
}
if ( $limit )
{
$time_range = time() - 86400;
$this->ipsclass->DB->simple_construct( array( 'select' => 'count(mt_id) as cnt',
'from' => 'message_topics',
'where' => "mt_owner_id={$member_id} AND mt_date > {$time_range}",
) );
$this->ipsclass->DB->simple_exec();
$quota_sent = $this->ipsclass->DB->fetch_row();
if ( $quota_sent['cnt'] + 1 > $limit )
{
return array('key' => 'error', 'lang' => 'pm_flood_max', 'extra' => "{$limit}");
}
}
return FALSE;
}
Найти
Ниже добавить
//------
// Check for spam / delays
//------
$pm_flood_check = $this->_allow_to_pm( $this->ipsclass->member['id'], $this->ipsclass->member['g_email_limit'] );
//print_r($pm_flood_check);exit();
if ( is_array($pm_flood_check) AND $pm_flood_check['key'] == 'error' )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => $pm_flood_check['lang'], 'EXTRA' => $pm_flood_check['extra'] ) );
exit();
}
./cache/lang_cache/*/lang_error.php
Найти
Ниже добавить
Найти
CODE
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->CP_end();
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->forum_jump($fj);
$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'NAV' => $this->nav ) );
}
$this->output .= $this->ipsclass->compiled_templates['skin_msg']->forum_jump($fj);
$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'NAV' => $this->nav ) );
}
Ниже добавить
CODE
/*
* Проверяем на флуд в приват
* Настройки зависят от флуда на Е-маил в настройках группы.
*/
function _allow_to_pm($member_id, $spam_limit)
{
$member_id = intval($member_id);
list( $limit, $flood ) = explode( ':', $spam_limit );
if ( ! $limit and ! $flood )
{
return FALSE;
}
//------
// Get some stuff from the DB!
// 1) FLOOD?
//------
if ( $flood )
{
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'message_topics',
'where' => "mt_owner_id={$member_id}",
'order' => 'mt_date DESC',
'limit' => array(0,1) ) );
$this->ipsclass->DB->simple_exec();
$last_pm = $this->ipsclass->DB->fetch_row();
if ( $last_pm['mt_date'] + ($flood * 60) > time() )
{
return array('key' => 'error', 'lang' => 'pm_flood', 'extra' => "{$flood}");
}
}
if ( $limit )
{
$time_range = time() - 86400;
$this->ipsclass->DB->simple_construct( array( 'select' => 'count(mt_id) as cnt',
'from' => 'message_topics',
'where' => "mt_owner_id={$member_id} AND mt_date > {$time_range}",
) );
$this->ipsclass->DB->simple_exec();
$quota_sent = $this->ipsclass->DB->fetch_row();
if ( $quota_sent['cnt'] + 1 > $limit )
{
return array('key' => 'error', 'lang' => 'pm_flood_max', 'extra' => "{$limit}");
}
}
return FALSE;
}
Найти
Code
if ($this->ipsclass->input['from_contact'] == '-' and $this->ipsclass->input['entered_name'] == "")
{
$this->msglib->send_form( 0, $this->ipsclass->lang['err_no_chosen_member'] );
$this->output .= $this->msglib->output;
return;
}
{
$this->msglib->send_form( 0, $this->ipsclass->lang['err_no_chosen_member'] );
$this->output .= $this->msglib->output;
return;
}
Ниже добавить
CODE
//------
// Check for spam / delays
//------
$pm_flood_check = $this->_allow_to_pm( $this->ipsclass->member['id'], $this->ipsclass->member['g_email_limit'] );
//print_r($pm_flood_check);exit();
if ( is_array($pm_flood_check) AND $pm_flood_check['key'] == 'error' )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => $pm_flood_check['lang'], 'EXTRA' => $pm_flood_check['extra'] ) );
exit();
}
./cache/lang_cache/*/lang_error.php
Найти
Code
<?php
$lang = array (
$lang = array (
Ниже добавить
Code
'pm_flood_max' => "Письмо не было отправлено, так как лимит отправляемых вами писем в сутки исчерпан. В сутки можно отправить не более, чем <#EXTRA#> писем.",
'pm_flood' => "Вы посылаете письма слишком часто. Вы можете посылать письма не чаще чем раз в <#EXTRA#> минут(ы).",
'pm_flood' => "Вы посылаете письма слишком часто. Вы можете посылать письма не чаще чем раз в <#EXTRA#> минут(ы).",
Для Invision Power Board 2.0.x (Моя переделка ..)
./sources/messenger.php
Найти
Ниже добавить
/*
* Проверяем на флуд в приват
* Настройки зависят от флуда на Е-маил в настройках группы.
*/
function _allow_to_pm($member_id, $spam_limit)
{
global $ibforums, $std, $DB;
$member_id = intval($member_id);
list( $limit, $flood ) = explode( ':', $spam_limit );
if ( ! $limit and ! $flood )
{
return FALSE;
}
//------
// Get some stuff from the DB!
// 1) FLOOD?
//------
if ( $flood )
{
$DB->simple_construct( array( 'select' => '*',
'from' => 'message_topics',
'where' => "mt_from_id={$member_id}",
'order' => 'mt_date DESC',
'limit' => array(0,1) ) );
$DB->simple_exec();
$last_pm = $DB->fetch_row();
if ( $last_pm['mt_date'] + ($flood * 60) > time() )
{
return array('key' => 'error', 'lang' => 'pm_flood', 'extra' => "{$flood}");
}
}
if ( $limit )
{
$time_range = time() - 86400;
$DB->simple_construct( array( 'select' => 'count(mt_id) as cnt',
'from' => 'message_topics',
'where' => "mt_from_id={$member_id} AND mt_date > {$time_range}",
) );
$DB->simple_exec();
$quota_sent = $DB->fetch_row();
if ( $quota_sent['cnt'] + 1 > $limit )
{
return array('key' => 'error', 'lang' => 'pm_flood_max', 'extra' => "{$limit}");
}
}
return FALSE;
}
Найти
Ниже добавить
//------
// Check for spam / delays
//------
$pm_flood_check = $this->_allow_to_pm( $ibforums->member['id'], $ibforums->member['g_email_limit'] );
// print_r($pm_flood_check);exit();
if ( is_array($pm_flood_check) AND $pm_flood_check['key'] == 'error' )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => $pm_flood_check['lang'], 'EXTRA' => $pm_flood_check['extra'] ) );
exit();
}
./lang/*/lang_error.php
Найти
Ниже добавить
Найти
CODE
$fj = $std->build_forum_jump();
$fj = preg_replace( "!#Forum Jump#!", $ibforums->lang['forum_jump'], $fj);
$this->output .= $this->cp_html->CP_end();
$this->output .= $this->cp_html->forum_jump($fj);
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
$fj = preg_replace( "!#Forum Jump#!", $ibforums->lang['forum_jump'], $fj);
$this->output .= $this->cp_html->CP_end();
$this->output .= $this->cp_html->forum_jump($fj);
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
Ниже добавить
CODE
/*
* Проверяем на флуд в приват
* Настройки зависят от флуда на Е-маил в настройках группы.
*/
function _allow_to_pm($member_id, $spam_limit)
{
global $ibforums, $std, $DB;
$member_id = intval($member_id);
list( $limit, $flood ) = explode( ':', $spam_limit );
if ( ! $limit and ! $flood )
{
return FALSE;
}
//------
// Get some stuff from the DB!
// 1) FLOOD?
//------
if ( $flood )
{
$DB->simple_construct( array( 'select' => '*',
'from' => 'message_topics',
'where' => "mt_from_id={$member_id}",
'order' => 'mt_date DESC',
'limit' => array(0,1) ) );
$DB->simple_exec();
$last_pm = $DB->fetch_row();
if ( $last_pm['mt_date'] + ($flood * 60) > time() )
{
return array('key' => 'error', 'lang' => 'pm_flood', 'extra' => "{$flood}");
}
}
if ( $limit )
{
$time_range = time() - 86400;
$DB->simple_construct( array( 'select' => 'count(mt_id) as cnt',
'from' => 'message_topics',
'where' => "mt_from_id={$member_id} AND mt_date > {$time_range}",
) );
$DB->simple_exec();
$quota_sent = $DB->fetch_row();
if ( $quota_sent['cnt'] + 1 > $limit )
{
return array('key' => 'error', 'lang' => 'pm_flood_max', 'extra' => "{$limit}");
}
}
return FALSE;
}
Найти
Code
if ($ibforums->input['from_contact'] == '-' and $ibforums->input['entered_name'] == "")
{
$this->lib->send_form( 0, $ibforums->lang['err_no_chosen_member'] );
$this->output .= $this->lib->output;
return;
}
{
$this->lib->send_form( 0, $ibforums->lang['err_no_chosen_member'] );
$this->output .= $this->lib->output;
return;
}
Ниже добавить
CODE
//------
// Check for spam / delays
//------
$pm_flood_check = $this->_allow_to_pm( $ibforums->member['id'], $ibforums->member['g_email_limit'] );
// print_r($pm_flood_check);exit();
if ( is_array($pm_flood_check) AND $pm_flood_check['key'] == 'error' )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => $pm_flood_check['lang'], 'EXTRA' => $pm_flood_check['extra'] ) );
exit();
}
./lang/*/lang_error.php
Найти
Code
<?php
$lang = array (
$lang = array (
Ниже добавить
Code
'pm_flood_max' => "Письмо не было отправлено, так как лимит отправляемых вами писем в сутки исчерпан. В сутки можно отправить не более, чем <#EXTRA#> писем.",
'pm_flood' => "Вы посылаете письма слишком часто. Вы можете посылать письма не чаще чем раз в <#EXTRA#> минут(ы).",
'pm_flood' => "Вы посылаете письма слишком часто. Вы можете посылать письма не чаще чем раз в <#EXTRA#> минут(ы).",