sibtracker/system/modules/banned.php
2019-05-18 13:46:03 +08:00

56 lines
2.1 KiB
PHP

<?php
if( ! defined( 'DATALIFEENGINE' ) ) {die( "Hacking attempt!" );}
$this_time = time() + ($config['date_adjust'] * 60);
$sel_banned = $db->query( "SELECT users_id FROM " . USERPREFIX . "_banned WHERE days != '0' AND date < '$this_time'" );
$del = false;
$blocked = false;
while ( $row = $db->get_row( $sel_banned ) ) {
$del = true;
if( $row['users_id'] ){
if ($repa_cf['repa_ban']){
$db->query( "UPDATE " . USERPREFIX . "_users SET banned='', repa='0' WHERE user_id = '{$row['users_id']}'" );
$row2 = $db->super_query("SELECT user_id, name, repa FROM " . USERPREFIX . "_users where user_id = '{$row['users_id']}'");
$db->query( "DELETE FROM " . USERPREFIX . "_reputation WHERE komu = '$row2[name]'" );
} else
$db->query( "UPDATE " . USERPREFIX . "_users SET banned='' WHERE user_id = '{$row['users_id']}'" );
}
}
$db->free( $sel_banned );
if( $del ) {
$db->query( "DELETE FROM " . USERPREFIX . "_banned WHERE days != '0' AND date < '$this_time'" );
$cache->delete('banned.php' );
}
if( $blockip ) {
$blocked = true;
if( $banned_info['ip'][$blockip]['date'] ) {
if( $banned_info['ip'][$blockip]['date'] > $this_time ) $endban = langdate( "j M Y H:i", $banned_info['ip'][$blockip]['date'] );
else $blocked = false;
} else $endban = $lang['banned_info'];
$descr = $lang['ip_block'] . "<br /><br />" . $banned_info['ip'][$blockip]['descr'];
} elseif( $banned_info['users_id'][$member_id['user_id']]['users_id'] ) {
$blocked = true;
if( $banned_info['users_id'][$member_id['user_id']]['date'] ) {
if( $banned_info['users_id'][$member_id['user_id']]['date'] > $this_time ) $endban = langdate( "j M Y H:i", $banned_info['users_id'][$member_id['user_id']]['date'] );
else $blocked = false;
} else $endban = $lang['banned_info'];
$descr = $banned_info['users_id'][$member_id['user_id']]['descr'];
}
if( $blocked ) {
$tpl->dir = ROOT_DIR . '/templates';
$tpl->load_template( 'banned.tpl' );
$tpl->set('{title}', $config['short_title']);
$tpl->set( '{description}', $descr );
$tpl->set( '{end}', $endban );
$tpl->compile( 'content' );
echo $tpl->result['content'];
die();
}
?>