технарь
Профессионал
Сообщений: 1825
Регистрация: 12.2011
|
Часть 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 == $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'.$redir,1);
} |