Дополнение создавалась для версии ExBB FM 1.0 Final, однако с большой вероятностью подойдёт и для ExBB FM 1.0 RC1.01
Внимание!!! Перед установкой и тестированием данного мода следует сделать резервную копию форума дабы застраховаться от разного рода неожиданностей.
Часть 1.
Открываем файл modules/memcontrol/language/russian/lang.php в котором ищем строку
CODE:
$this->LANG['UsersDeleteOk'] = 'Выбранные пользователи успешно удалены!';
перед которой вставляем строку
CODE:
$this->LANG['DelUsersOld'] = 'Удалить мёртвые учетные записи';
Затем открываем файл modules/memcontrol/admintemplates/memblist.tpl в котором ищем строки
CODE:
<input name="mode" type="submit" value="{$fm->LANG['DelNotify']}">
перед которой вставляем строку
CODE:
<input name="clear" type="submit" value="{$fm->LANG['DelUsersOld']}">
(Добавление)
Часть 2.
Открываем файл modules/memcontrol/index.php в котором ищем функцию deletemember() которую целиком заменяем кодом
Спойлер (Отобразить)
CODE:
function deletuserold() {
global $fm;
$deletedTotal = 0;
$users = $fm->_Read2Write($fp_users,FM_USERS);
$users_id = array_keys($users);
$nowtime = $fm->_Nowtime;
foreach ($users_id as $user_id)
{
$user = $fm->_Getmember($user_id);
if ($user['posts'] == 0 && ($nowtime - $user['last_visit']) > 31536000)
{
if (file_exists('members/'.$user_id.'.php')) unlink('members/'.$user_id.'.php');
if (file_exists('messages/'.$user_id.'-out.php')) {unlink('messages/'.$user_id.'-out.php');}
if (file_exists('messages/'.$user_id.'-msg.php')) {unlink('messages/'.$user_id.'-msg.php');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar')) {unlink('im/avatars/personal/'.$user_id.'-avatar');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.png')) {unlink('im/avatars/personal/'.$user_id.'-avatar.png');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.jpg')) {unlink('im/avatars/personal/'.$user_id.'-avatar.jpg');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.gif')) {unlink('im/avatars/personal/'.$user_id.'-avatar.gif');}
if (file_exists('modules/belong/data/'.$user_id.'.db')) {unlink('modules/belong/data/'.$user_id.'.db');}
if (file_exists('modules/reputation/data/'.$user_id.'.php')) {unlink('modules/reputation/data/'.$user_id.'.php');}
if (file_exists('modules/watches/data/db2_member'.$user_id.'.db')) {unlink('modules/watches/data/db2_member'.$user_id.'.db');}
if (file_exists('modules/watches/data/db3_member'.$user_id.'.db')) {unlink('modules/watches/data/db3_member'.$user_id.'.db');}
if (file_exists('modules/birstday/data/birstday_data.php'))
{
$birstdays = $fm->_Read2Write($fp_birst, 'modules/birstday/data/birstday_data.php', false);
$SaveFlag = false;
foreach ($birstdays as $day => $users) {
foreach ($users as $id => $info) {
if ($id == $user_id) {unset($birstdays[$day][$user_id]); $SaveFlag = true;}
}
if (count($birstdays[$day]) == 0) {unset($birstdays[$day]); $SaveFlag = true;}
}
($SaveFlag === true) ? $fm->_Write($fp_birst, $birstdays) : $fm->_Fclose($fp_birst);
}
if (file_exists('modules/loginza/data/member'.$user_id.'.php'))
{
$loginza = $fm->_Read('modules/loginza/data/member'.$user_id.'.php');
$id_keys = array_keys ($loginza);
$url = $id_keys[0];
$hash = $loginza[$url]['hash'];
if (file_exists('modules/loginza/data/'.$hash.'.php')) {unlink('modules/loginza/data/'.$hash.'.php');}
unlink('modules/loginza/data/member'.$user_id.'.php');
}
if (isset($users[$user_id])) unset($users[$user_id]);
$deletedTotal++;
}
}
ksort($users);
end($users);
$last_id = key($users);
$totalusers = count($users);
reset($users);
$last_name = GetName($last_id);
$fm->_SAVE_STATS(array( "lastreg" => array( $last_name, 0 ), "last_id" => array( $last_id, 0 ), "totalmembers" => array( $totalusers, 0 ) ));
$fm->_Write($fp_users,$users);
$redir = '';
if ($fm->_String('s')) $redir .= '&s='.$fm->input['s'];
if ($fm->_String('order')) $redir .= '&order='.$fm->input['order'];
if ($fm->_Intval('p')) $redir .= '&p='.$fm->input['p'];
if ($fm->_Intval('pg')) $redir .= '&pg='.$fm->input['pg'];
$fm->_Message($fm->LANG['MainMsg'],$fm->LANG['UsersDeleteOk'],'setmodule.php?module=memcontrol',1);
}
function deletemember() {
global $fm;
if ($fm->_String('clear') !== '') deletuserold();
if (count($del_ids = $fm->_Array('del')) === 0) {
$fm->_Message($fm->LANG['MainMsg'],$fm->LANG['UsersNotSelected'],'',1);
}
if ($fm->_String('mode') !== '') delet_mail();
$deletedTotal = 0;
$users = $fm->_Read2Write($fp_users,FM_USERS);
foreach ($del_ids as $user_id) {
if (file_exists('members/'.$user_id.'.php')) unlink('members/'.$user_id.'.php');
if (file_exists('messages/'.$user_id.'-out.php')) {unlink('messages/'.$user_id.'-out.php');}
if (file_exists('messages/'.$user_id.'-msg.php')) {unlink('messages/'.$user_id.'-msg.php');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar')) {unlink('im/avatars/personal/'.$user_id.'-avatar');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.png')) {unlink('im/avatars/personal/'.$user_id.'-avatar.png');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.jpg')) {unlink('im/avatars/personal/'.$user_id.'-avatar.jpg');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.gif')) {unlink('im/avatars/personal/'.$user_id.'-avatar.gif');}
if (file_exists('modules/belong/data/'.$user_id.'.db')) {unlink('modules/belong/data/'.$user_id.'.db');}
if (file_exists('modules/reputation/data/'.$user_id.'.php')) {unlink('modules/reputation/data/'.$user_id.'.php');}
if (file_exists('modules/watches/data/db2_member'.$user_id.'.db')) {unlink('modules/watches/data/db2_member'.$user_id.'.db');}
if (file_exists('modules/watches/data/db3_member'.$user_id.'.db')) {unlink('modules/watches/data/db3_member'.$user_id.'.db');}
if (file_exists('modules/birstday/data/birstday_data.php')) {
$birstdays = $fm->_Read2Write($fp_birst, 'modules/birstday/data/birstday_data.php', false);
$SaveFlag = false;
foreach ($birstdays as $day => $users) {
foreach ($users as $id => $info) {
if ($id == $userid) {unset($birstdays[$day][$user_id]); $SaveFlag = true;}
}
if (count($birstdays[$day]) == 0) {unset($birstdays[$day]); $SaveFlag = true;}
}
($SaveFlag === true) ? $fm->_Write($fp_birst, $birstdays) : $fm->_Fclose($fp_birst);
}
if (file_exists('modules/loginza/data/member'.$user_id.'.php'))
{
$loginza = $fm->_Read('modules/loginza/data/member'.$user_id.'.php');
$id_keys = array_keys ($loginza);
$url = $id_keys[0];
$hash = $loginza[$url]['hash'];
if (file_exists('modules/loginza/data/'.$hash.'.php')) {unlink('modules/loginza/data/'.$hash.'.php');}
unlink('modules/loginza/data/member'.$user_id.'.php');
}
if (isset($users[$user_id])) unset($users[$user_id]);
$deletedTotal++;
}
ksort($users);
end($users);
$last_id = key($users);
$totalusers = count($users);
reset($users);
$last_name = GetName($last_id);
$fm->_SAVE_STATS(array( "lastreg" => array( $last_name, 0 ), "last_id" => array( $last_id, 0 ), "totalmembers" => array( $totalusers, 0 ) ));
$fm->_Write($fp_users,$users);
$redir = '';
if ($fm->_String('s')) $redir .= '&s='.$fm->input['s'];
if ($fm->_String('order')) $redir .= '&order='.$fm->input['order'];
if ($fm->_Intval('p')) $redir .= '&p='.$fm->input['p'];
if ($fm->_Intval('pg')) $redir .= '&pg='.$fm->input['pg'];
$fm->_Message($fm->LANG['MainMsg'],$fm->LANG['UsersDeleteOk'],'setmodule.php?module=memcontrol'.$redir,1);
}
global $fm;
$deletedTotal = 0;
$users = $fm->_Read2Write($fp_users,FM_USERS);
$users_id = array_keys($users);
$nowtime = $fm->_Nowtime;
foreach ($users_id as $user_id)
{
$user = $fm->_Getmember($user_id);
if ($user['posts'] == 0 && ($nowtime - $user['last_visit']) > 31536000)
{
if (file_exists('members/'.$user_id.'.php')) unlink('members/'.$user_id.'.php');
if (file_exists('messages/'.$user_id.'-out.php')) {unlink('messages/'.$user_id.'-out.php');}
if (file_exists('messages/'.$user_id.'-msg.php')) {unlink('messages/'.$user_id.'-msg.php');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar')) {unlink('im/avatars/personal/'.$user_id.'-avatar');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.png')) {unlink('im/avatars/personal/'.$user_id.'-avatar.png');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.jpg')) {unlink('im/avatars/personal/'.$user_id.'-avatar.jpg');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.gif')) {unlink('im/avatars/personal/'.$user_id.'-avatar.gif');}
if (file_exists('modules/belong/data/'.$user_id.'.db')) {unlink('modules/belong/data/'.$user_id.'.db');}
if (file_exists('modules/reputation/data/'.$user_id.'.php')) {unlink('modules/reputation/data/'.$user_id.'.php');}
if (file_exists('modules/watches/data/db2_member'.$user_id.'.db')) {unlink('modules/watches/data/db2_member'.$user_id.'.db');}
if (file_exists('modules/watches/data/db3_member'.$user_id.'.db')) {unlink('modules/watches/data/db3_member'.$user_id.'.db');}
if (file_exists('modules/birstday/data/birstday_data.php'))
{
$birstdays = $fm->_Read2Write($fp_birst, 'modules/birstday/data/birstday_data.php', false);
$SaveFlag = false;
foreach ($birstdays as $day => $users) {
foreach ($users as $id => $info) {
if ($id == $user_id) {unset($birstdays[$day][$user_id]); $SaveFlag = true;}
}
if (count($birstdays[$day]) == 0) {unset($birstdays[$day]); $SaveFlag = true;}
}
($SaveFlag === true) ? $fm->_Write($fp_birst, $birstdays) : $fm->_Fclose($fp_birst);
}
if (file_exists('modules/loginza/data/member'.$user_id.'.php'))
{
$loginza = $fm->_Read('modules/loginza/data/member'.$user_id.'.php');
$id_keys = array_keys ($loginza);
$url = $id_keys[0];
$hash = $loginza[$url]['hash'];
if (file_exists('modules/loginza/data/'.$hash.'.php')) {unlink('modules/loginza/data/'.$hash.'.php');}
unlink('modules/loginza/data/member'.$user_id.'.php');
}
if (isset($users[$user_id])) unset($users[$user_id]);
$deletedTotal++;
}
}
ksort($users);
end($users);
$last_id = key($users);
$totalusers = count($users);
reset($users);
$last_name = GetName($last_id);
$fm->_SAVE_STATS(array( "lastreg" => array( $last_name, 0 ), "last_id" => array( $last_id, 0 ), "totalmembers" => array( $totalusers, 0 ) ));
$fm->_Write($fp_users,$users);
$redir = '';
if ($fm->_String('s')) $redir .= '&s='.$fm->input['s'];
if ($fm->_String('order')) $redir .= '&order='.$fm->input['order'];
if ($fm->_Intval('p')) $redir .= '&p='.$fm->input['p'];
if ($fm->_Intval('pg')) $redir .= '&pg='.$fm->input['pg'];
$fm->_Message($fm->LANG['MainMsg'],$fm->LANG['UsersDeleteOk'],'setmodule.php?module=memcontrol',1);
}
function deletemember() {
global $fm;
if ($fm->_String('clear') !== '') deletuserold();
if (count($del_ids = $fm->_Array('del')) === 0) {
$fm->_Message($fm->LANG['MainMsg'],$fm->LANG['UsersNotSelected'],'',1);
}
if ($fm->_String('mode') !== '') delet_mail();
$deletedTotal = 0;
$users = $fm->_Read2Write($fp_users,FM_USERS);
foreach ($del_ids as $user_id) {
if (file_exists('members/'.$user_id.'.php')) unlink('members/'.$user_id.'.php');
if (file_exists('messages/'.$user_id.'-out.php')) {unlink('messages/'.$user_id.'-out.php');}
if (file_exists('messages/'.$user_id.'-msg.php')) {unlink('messages/'.$user_id.'-msg.php');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar')) {unlink('im/avatars/personal/'.$user_id.'-avatar');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.png')) {unlink('im/avatars/personal/'.$user_id.'-avatar.png');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.jpg')) {unlink('im/avatars/personal/'.$user_id.'-avatar.jpg');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.gif')) {unlink('im/avatars/personal/'.$user_id.'-avatar.gif');}
if (file_exists('modules/belong/data/'.$user_id.'.db')) {unlink('modules/belong/data/'.$user_id.'.db');}
if (file_exists('modules/reputation/data/'.$user_id.'.php')) {unlink('modules/reputation/data/'.$user_id.'.php');}
if (file_exists('modules/watches/data/db2_member'.$user_id.'.db')) {unlink('modules/watches/data/db2_member'.$user_id.'.db');}
if (file_exists('modules/watches/data/db3_member'.$user_id.'.db')) {unlink('modules/watches/data/db3_member'.$user_id.'.db');}
if (file_exists('modules/birstday/data/birstday_data.php')) {
$birstdays = $fm->_Read2Write($fp_birst, 'modules/birstday/data/birstday_data.php', false);
$SaveFlag = false;
foreach ($birstdays as $day => $users) {
foreach ($users as $id => $info) {
if ($id == $userid) {unset($birstdays[$day][$user_id]); $SaveFlag = true;}
}
if (count($birstdays[$day]) == 0) {unset($birstdays[$day]); $SaveFlag = true;}
}
($SaveFlag === true) ? $fm->_Write($fp_birst, $birstdays) : $fm->_Fclose($fp_birst);
}
if (file_exists('modules/loginza/data/member'.$user_id.'.php'))
{
$loginza = $fm->_Read('modules/loginza/data/member'.$user_id.'.php');
$id_keys = array_keys ($loginza);
$url = $id_keys[0];
$hash = $loginza[$url]['hash'];
if (file_exists('modules/loginza/data/'.$hash.'.php')) {unlink('modules/loginza/data/'.$hash.'.php');}
unlink('modules/loginza/data/member'.$user_id.'.php');
}
if (isset($users[$user_id])) unset($users[$user_id]);
$deletedTotal++;
}
ksort($users);
end($users);
$last_id = key($users);
$totalusers = count($users);
reset($users);
$last_name = GetName($last_id);
$fm->_SAVE_STATS(array( "lastreg" => array( $last_name, 0 ), "last_id" => array( $last_id, 0 ), "totalmembers" => array( $totalusers, 0 ) ));
$fm->_Write($fp_users,$users);
$redir = '';
if ($fm->_String('s')) $redir .= '&s='.$fm->input['s'];
if ($fm->_String('order')) $redir .= '&order='.$fm->input['order'];
if ($fm->_Intval('p')) $redir .= '&p='.$fm->input['p'];
if ($fm->_Intval('pg')) $redir .= '&pg='.$fm->input['pg'];
$fm->_Message($fm->LANG['MainMsg'],$fm->LANG['UsersDeleteOk'],'setmodule.php?module=memcontrol'.$redir,1);
}
(Добавление)
Часть 3.
Открываем файл setmembers.php в котором ищем функцию deletemember() которую целиком заменяем кодом
Спойлер (Отобразить)
CODE:
function deletemember() {
global $fm;
if (($user_id = $fm->_Intval('userid')) === 0 || !file_exists('members/'.$user_id.'.php')) {
$fm->_Message($fm->LANG['UserAdmin'],$fm->LANG['UserNotFound'],'',1);
}
if (unlink('members/' . $user_id . '.php')) {
if (file_exists('messages/'.$user_id.'-out.php')) {unlink('messages/'.$user_id.'-out.php');}
if (file_exists('messages/'.$user_id.'-msg.php')) {unlink('messages/'.$user_id.'-msg.php');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar')) {unlink('im/avatars/personal/'.$user_id.'-avatar');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.png')) {unlink('im/avatars/personal/'.$user_id.'-avatar.png');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.jpg')) {unlink('im/avatars/personal/'.$user_id.'-avatar.jpg');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.gif')) {unlink('im/avatars/personal/'.$user_id.'-avatar.gif');}
if (file_exists('modules/belong/data/'.$user_id.'.db')) {unlink('modules/belong/data/'.$user_id.'.db');}
if (file_exists('modules/reputation/data/'.$user_id.'.php')) {unlink('modules/reputation/data/'.$user_id.'.php');}
if (file_exists('modules/watches/data/db2_member'.$user_id.'.db')) {unlink('modules/watches/data/db2_member'.$user_id.'.db');}
if (file_exists('modules/watches/data/db3_member'.$user_id.'.db')) {unlink('modules/watches/data/db3_member'.$user_id.'.db');}
/*start clear birstday data file */
if (file_exists('modules/birstday/data/birstday_data.php')) {
$birstdays = $fm->_Read2Write($fp_birst, 'modules/birstday/data/birstday_data.php', false);
$SaveFlag = false;
foreach ($birstdays as $day => $users) {
foreach ($users as $id => $info) {
if ($id == $user_id) {
unset( $birstdays[$day][$user_id] );
$SaveFlag = true;
}
}
if (count($birstdays[$day]) == 0) {
unset( $birstdays[$day] );
$SaveFlag = true;
}
}
($SaveFlag === true) ? $fm->_Write($fp_birst, $birstdays) : $fm->_Fclose($fp_birst);
}
/*end clear birstday data file */
if (file_exists('modules/loginza/data/member'.$userid.'.php'))
{
$loginza = $fm->_Read('modules/loginza/data/member'.$user_id.'.php');
$id_keys = array_keys ($loginza);
$url = $id_keys[0];
$hash = $loginza[$url]['hash'];
if (file_exists('modules/loginza/data/'.$hash.'.php')) {unlink('modules/loginza/data/'.$hash.'.php');}
unlink('modules/loginza/data/member'.$user_id.'.php');
}
UpdateAllusersInfo();
$fm->_Message($fm->LANG['UserAdmin'], $fm->LANG['UserDeleted'], 'setmodule.php?module=memcontrol', 1);
}
else {$fm->_Message($fm->LANG['UserAdmin'],$fm->LANG['UserNotDeleted'],'',1);}
}
global $fm;
if (($user_id = $fm->_Intval('userid')) === 0 || !file_exists('members/'.$user_id.'.php')) {
$fm->_Message($fm->LANG['UserAdmin'],$fm->LANG['UserNotFound'],'',1);
}
if (unlink('members/' . $user_id . '.php')) {
if (file_exists('messages/'.$user_id.'-out.php')) {unlink('messages/'.$user_id.'-out.php');}
if (file_exists('messages/'.$user_id.'-msg.php')) {unlink('messages/'.$user_id.'-msg.php');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar')) {unlink('im/avatars/personal/'.$user_id.'-avatar');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.png')) {unlink('im/avatars/personal/'.$user_id.'-avatar.png');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.jpg')) {unlink('im/avatars/personal/'.$user_id.'-avatar.jpg');}
if (file_exists('im/avatars/personal/'.$user_id.'-avatar.gif')) {unlink('im/avatars/personal/'.$user_id.'-avatar.gif');}
if (file_exists('modules/belong/data/'.$user_id.'.db')) {unlink('modules/belong/data/'.$user_id.'.db');}
if (file_exists('modules/reputation/data/'.$user_id.'.php')) {unlink('modules/reputation/data/'.$user_id.'.php');}
if (file_exists('modules/watches/data/db2_member'.$user_id.'.db')) {unlink('modules/watches/data/db2_member'.$user_id.'.db');}
if (file_exists('modules/watches/data/db3_member'.$user_id.'.db')) {unlink('modules/watches/data/db3_member'.$user_id.'.db');}
/*start clear birstday data file */
if (file_exists('modules/birstday/data/birstday_data.php')) {
$birstdays = $fm->_Read2Write($fp_birst, 'modules/birstday/data/birstday_data.php', false);
$SaveFlag = false;
foreach ($birstdays as $day => $users) {
foreach ($users as $id => $info) {
if ($id == $user_id) {
unset( $birstdays[$day][$user_id] );
$SaveFlag = true;
}
}
if (count($birstdays[$day]) == 0) {
unset( $birstdays[$day] );
$SaveFlag = true;
}
}
($SaveFlag === true) ? $fm->_Write($fp_birst, $birstdays) : $fm->_Fclose($fp_birst);
}
/*end clear birstday data file */
if (file_exists('modules/loginza/data/member'.$userid.'.php'))
{
$loginza = $fm->_Read('modules/loginza/data/member'.$user_id.'.php');
$id_keys = array_keys ($loginza);
$url = $id_keys[0];
$hash = $loginza[$url]['hash'];
if (file_exists('modules/loginza/data/'.$hash.'.php')) {unlink('modules/loginza/data/'.$hash.'.php');}
unlink('modules/loginza/data/member'.$user_id.'.php');
}
UpdateAllusersInfo();
$fm->_Message($fm->LANG['UserAdmin'], $fm->LANG['UserDeleted'], 'setmodule.php?module=memcontrol', 1);
}
else {$fm->_Message($fm->LANG['UserAdmin'],$fm->LANG['UserNotDeleted'],'',1);}
}