Файл: 2/3020.ru/modules/communities/plugins/users.php
Строк: 62
<?php
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] == 1 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
$delete = DB::GET_STRING("SELECT `ID`,`USER_ID` FROM `COMMUNITIES_PAR` WHERE `ADMINISTRATION` != '1' AND `ACT` = '1' AND `ID` = '".INTVAL(GET('delete'))."' LIMIT 1");
IF (GET('delete') && ISSET($delete['ID'])){
CSRF::GET_CHECK_VALID(GET('delete'));
$message = "Вы были удалены из сообщества [b][a href=/modules/?path=communities§ion=show&id=".$comm['ID']."]".ADSL($comm['NAME'])."[/a][/b].";
DB::GET_ADD("INSERT INTO `MAIL_MESSAGE` (`USER_ID`, `MY_ID`, `TIME`, `MESSAGE`, `USER`) VALUES ('".CONFIG('SYSTEM')."', '".$delete['USER_ID']."', '".TIME()."', '".$message."', '".CONFIG('SYSTEM')."'),('".$delete['USER_ID']."', '".CONFIG('SYSTEM')."', '".TIME()."', '".$message."', '".$delete['USER_ID']."')");
DB::GET_SET("DELETE FROM `COMMUNITIES_PAR` WHERE `ID` = '".$delete['ID']."' LIMIT 1");
REDIRECT('/modules/?path=communities§ion=show&id='.$comm['ID'].'&get=users');
}
$edit_user = DB::GET_STRING("SELECT `ID`,`USER_ID`,`ADMINISTRATION` FROM `COMMUNITIES_PAR` WHERE `ADMINISTRATION` != '1' AND `ACT` = '1' AND `ID` = '".INTVAL(GET('edit_user'))."' LIMIT 1");
IF (GET('edit_user') && ISSET($edit_user['ID'])){
$account = DB::GET_STRING("SELECT `ID`,`LOGIN` FROM `USERS` WHERE `ID` = '".$edit_user['USER_ID']."' LIMIT 1");
IF (!ISSET($account['ID'])){
ERROR('Такого пользователя не существует', 'session');
REDIRECT('/modules/?path=communities§ion=show&id='.$comm['ID'].'&get=users');
}
IF ($user['ID'] == $account['ID']){
ERROR('Неизвестная ошибка', 'session');
REDIRECT('/modules/?path=communities§ion=show&id='.$comm['ID'].'&get=users');
}
IF (POST('ok')){
DB_FILTER();
$err_data = 0;
$access = INTVAL(POST('access'));
DB::GET_SET("UPDATE `COMMUNITIES_PAR` SET `ADMINISTRATION` = '".$access."' WHERE `ID` = '".$edit_user['ID']."' LIMIT 1");
SUCCESS('Изменения успешно приняты', 'session');
REDIRECT('/modules/?path=communities§ion=show&id='.$comm['ID'].'&get=users');
}
ECHO "<div class='list'>";
ECHO "<form method='post' class='form' action='/modules/?path=communities§ion=show&id=".$comm['ID']."&get=users&edit_user=".$edit_user['ID']."'>";
ECHO "<b>".LG('Права пользователя')." ".$account['LOGIN']."</b>:<br />";
ECHO "<select name='access' class='form-control-select'>";
ECHO "<option value='0' ".($edit_user['ADMINISTRATION'] == 0 ?" selected='selected'":NULL)."> ".LG('Обычный участник')."</option>";
ECHO "<option value='2' ".($edit_user['ADMINISTRATION'] == 2 ?" selected='selected'":NULL)."> ".LG('Администратор')."</option>";
ECHO "<option value='3' ".($edit_user['ADMINISTRATION'] == 3 ?" selected='selected'":NULL)."> ".LG('Модератор')."</option>";
ECHO "</select><br /><br />";
HTML::BUTTON('btn-big ajax-button', 'ok', 'save', 'Сохранить изменения');
ECHO "</form>";
ECHO "</div>";
}
}
$column = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `COMMUNITIES_PAR` WHERE `COMMUNITY_ID` = '".$comm['ID']."' AND `ACT` = '1'");
$spage = SPAGE($column, $page_settings);
$page = PAGE($spage);
$limit = $page_settings * $page - $page_settings;
IF ($column == 0){
HTML::EMPTY();
}ELSE{
ECHO "<div class='list-body'>";
}
$data = DB::GET_STRING_ALL("SELECT * FROM `COMMUNITIES_PAR` WHERE `COMMUNITY_ID` = '".$comm['ID']."' AND `ACT` = '1' ORDER BY `ID` DESC LIMIT ".$limit.", ".$page_settings."");
WHILE ($list = $data->FETCH()){
ECHO "<div class='list-menu'>";
ECHO "<a href='/id".$list['USER_ID']."'><table style='width: 100%;'><tr>";
ECHO "<td class='us-avatar'>";
ECHO USER::AVATAR($list['USER_ID'], 50, 0, 1)."";
ECHO "</td>";
ECHO "<td class='us-info'>";
ECHO "".USER::LOGIN($list['USER_ID'])."<br />";
IF ($list['ADMINISTRATION'] == 1){
ECHO LG('Создатель');
}ELSEIF ($list['ADMINISTRATION'] == 2){
ECHO LG('Администратор');
}ELSEIF ($list['ADMINISTRATION'] == 3){
ECHO LG('Модератор');
}
ECHO "</td>";
ECHO "</tr></table></a>";
IF ($comm['USER_ID'] != $list['USER_ID']){
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] == 1 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
ECHO "<a class='btn' href='/modules/?path=communities§ion=show&id=".$comm['ID']."&get=users&edit_user=".$list['ID']."'>".ICONS('lock', 15, 'fa-fw')." ".LG('Права')."</a>";
ECHO "<a class='btn' href='/modules/?path=communities§ion=show&id=".$comm['ID']."&get=users&delete=".$list['ID']."&".$token_url."'>".ICONS('times', 15, 'fa-fw')." ".LG('Удалить')."</a>";
}
}
ECHO "</div>";
}
IF ($column > 0){
ECHO "</div>";
}
IF ($spage > 1){ ECHO STR_PAGE('/modules/?path=communities§ion=show&id='.$comm['ID'].'&get=users&', $spage, $page); }
ECHO "<div class='list'>";
ECHO "<a href='/modules/?path=communities§ion=show&id=".$comm['ID']."'>".ICONS('arrow-left', 15, 'fa-fw')." ".LG('Назад')."</a>";
ECHO "</div>";
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities'>".LG('Сообщества')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".TEXT_ABSOLUTE($comm['NAME'])."";
ECHO "</div>";
REQUIRE (ROOT.'/system/connections/footer.php');
EXIT;
?>