Файл: vsime.com/comm/inc/act_comm.php
Строк: 197
<?
if (mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm` WHERE `id` = '".intval($_GET['id'])."'"))!=0) {
$comm = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `comm` WHERE `id` = '".intval($_GET['id'])."'"));
$cat = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `comm_cat` WHERE `id` = '$comm[id_cat]'"));
if (mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `activate` = '1' AND `invite` = '0'"))==0)$comm['id_user']=0;
$ank = profile($comm['id_user']); // sozdak
$navigation = "<a href='/index/comm'>Сообщества</a> / ".hsc($comm['name']);
$title .= ' - '.hsc($comm['name']); // Заголовок страницы
ex_head();
if ($comm['id_user']!=0 && isset($user)) {
if(isset($_GET['in'])) {
if (hsc(@$_GET['mdp'])==$mdp) {
if(!in_comm($user['id'])) {
if(mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_blist` WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]'"))!=0)$error[]="Вы не можете вступить в данное сообщество, так как находитесь в черном списке сообщества!";
else {
if (mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]' AND `invite` = '1'"))!=0) {
mysqli_query($dbi, "INSERT INTO `comm_journal` SET `id_comm` = '$comm[id]', `id_user` = '$user[id]', `type` = 'in_comm', `time` = '$time'");
mysqli_query($dbi, "UPDATE `comm_users` SET `activate` = '1', `invite` = '0', `time` = '$time' WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]' AND `invite` = '1'");
msg("Приглашение принято!");
} elseif($comm['join_rule']!=3) {
if($comm['join_rule']==2) {
if(mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]' AND `invite` = '0' AND `activate` = '0'"))==0) {
mysqli_query($dbi, "INSERT INTO `comm_users` (`id_comm`, `id_user`, `time`, `activate`) VALUES ('$comm[id]', '$user[id]', '".time()."', '0')");
$msg = "$user[nick] хочет вступить в сообщество [url=$config[http_site]/comm/?act=comm&id=$comm[id]]".($comm['name'])."[/url].";
write_mail(0, $ank['id'], $msg);
msg("Вы успешно подали заявку. Дождитесь пока создатель ее рассмотрит");
} else {
$error[]="Вы уже подали заявку!";
}
} else {
mysqli_query($dbi, "INSERT INTO `comm_journal` SET `id_comm` = '$comm[id]', `id_user` = '$user[id]', `type` = 'in_comm', `time` = '$time'");
mysqli_query($dbi, "INSERT INTO `comm_users` (`id_comm`, `id_user`, `time`, `activate`) VALUES ('$comm[id]', '$user[id]', '$time', '1')");
msg("Вы успешно вступили в сообщество!");
}
} else $error[]="Сообщество закрытого типа!";
}
} else $error[]="Вы уже являетесь участником сообщества!";
} else hacked_by_Killer();
} elseif(isset($_GET['out'])) {
if (hsc(@$_GET['mdp'])==$mdp) {
if(mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]' AND `activate` = '1'"))!=0) {
if($ank['id']==$user['id'] && isset($user) && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `activate` = '1'"))>1)$error[]="Вы создатель сообщества! Для начала удалите всех участников сообщества";
else {
if($ank['id']==$user['id'] && isset($user)) {
$comm['id_user']=0;
$ank=profile($comm['id_user']); // sozdak
}
mysqli_query($dbi, "INSERT INTO `comm_journal` SET `id_comm` = '$comm[id]', `id_user` = '$user[id]', `type` = 'out_comm', `time` = '$time'");
mysqli_query($dbi, "DELETE FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]' AND `activate` = '1'");
msg("Вы успешно покинули сообщество!");
}
} else $error[]="Вы не являетесь участником сообщества!";
} else hacked_by_Killer();
}
} elseif(isset($user) && isset($_GET['creator']) && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `activate` = '1' AND `invite` = '0'"))==0) {
if (hsc(@$_GET['mdp'])==$mdp) {
mysqli_query($dbi, "INSERT INTO `comm_journal` SET `id_comm` = '$comm[id]', `id_user` = '$user[id]', `id_ank` = '".mysqli_num_rows(mysqli_query($dbi, "SELECT `id_user` FROM `comm` WHERE `id` = '$comm[id]'"))."', `type` = 'access', `time` = '$time', `access` = 'creator'");
mysqli_query($dbi, "UPDATE `comm` SET `id_user` = '$user[id]' WHERE `id` = '$comm[id]'");
mysqli_query($dbi, "INSERT INTO `comm_users` (`id_comm`, `id_user`, `time`, `activate`, `access`) VALUES ('$comm[id]', '$user[id]', '".time()."', '1', 'creator')");
msg("Теперь вы создатель сообщества!");
$ank=profile($user['id']);
} else hacked_by_Killer();
}
show_errors();
echo "<div class='list'>n";
echo "<b>".hsc($comm['name'])."</b> ".($comm['adult']==1?" <span class='spared'>(+18)</span>":NULL)."<br/>n";
echo "<img src='/i/site/comm_".($comm['read_rule']==1?"open":"closed").".png' /> ".($comm['read_rule']==1?"Открыто":"Закрыто")." для чтения<br />n";
echo "</div>n";
echo "<div class='list'>n";
if (is_file(H."i/comm_avatar/comm.".$comm['id'].".".$comm['mdi'].".img.png"))echo "<img src='/i/comm_avatar/comm.".$comm['id'].".".$comm['mdi'].".img.png'/><br/>n";
else echo "<img src='/i/site/no_avatar_comm.png'/><br/>n";
if ($comm['id_user']!=0) {
echo "Создатель: ";
echo profile_icon($ank['id']).profile_nick($ank['id'], 1).profile_medal($ank['id']);
echo "</div><div class='list'><img src='/i/site/information.png'/> <a href='/index/comm?act=comm_info&id=$comm[id]'>Информация</a><br />n";
}
echo "</div>n";
if ($comm['forum']==1 || $comm['chat']==1 || $comm['files']==1)echo "<div class='list'>n";
if ($comm['forum']==1) {
$count_topics=mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum` WHERE `id_comm` = '$comm[id]' AND `type` = 'topic'"));
$count_topics_new=mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `forum` WHERE `id_comm` = '$comm[id]' AND `type` = 'topic' AND `time` > '".($time-(3600*24))."'"));
$count_topics_show=$count_topics.($count_topics_new>0?"/+$count_topics_new":NULL);
echo "<img src='/i/site/forum.png' /> <a href='/index/comm?act=forum&id=$comm[id]'>Форум ($count_topics_show)</a><br />n";
}
if ($comm['chat']==1) {
$count_people=mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `chat_comm_who` WHERE `id_comm` = '$comm[id]'"));
echo "<img src='/i/site/message.png' /> <a href='/index/comm?act=chat&id=$comm[id]'>Чат ($count_people)</a><br />n";
}
if ($comm['files']==1) {
$count_files = mysqli_result("SELECT COUNT(*) FROM `files_comm` WHERE (`type` = 'file' OR `type` = 'foto') AND `id_comm` = '$comm[id]'");
$count_files_new = mysqli_result("SELECT COUNT(*) FROM `files_comm` WHERE (`type` = 'file' OR `type` = 'foto') AND `time` > '".($time-(3600*24))."' AND `id_comm` = '$comm[id]'");
$count_files_show = $count_files.($count_files_new>0?"/+$count_files_new":NULL);
echo "<img src='/i/site/download.png' /> <a href='/index/comm?act=files&id=$comm[id]'>Файлы ($count_files_show)</a><br />n";
}
if ($comm['forum']==1 || $comm['chat']==1 || $comm['files']==1)echo "</div>n";
echo "<div class='list'>n";
echo "<img src='/i/site/users.png'/> <a href='/index/comm?act=comm_users&id=$comm[id]'>Участники (".mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `activate` = '1' AND `invite` = '0'")).")</a><br />n";
echo "<img src='/i/site/users_ban.png'/> <a href='/index/comm?act=comm_users_ban&id=$comm[id]'>Нарушители</a><br />n";
echo "<img src='/i/site/journal_comm.png'/> <a href='/index/comm?act=comm_journal&id=$comm[id]'>Журнал сообщества</a><br />n";
if($ank['id']==$user['id'] && isset($user) || $uinc['access']=='adm')echo "<img src='/i/site/blocked.png'/> <a href='/index/comm?act=blist&id=$comm[id]'>Черный список</a><br />n";
if($ank['id']==$user['id'] && isset($user))echo "<img src='/i/site/settings.png'/> <a href='/index/comm?act=comm_settings&id=$comm[id]'>Настройки</a><br />n";
echo "</div>n";
if(isset($user)) {
if (mysqli_result("SELECT COUNT(*) FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]' AND `activate` = '1'")) {
echo "<div class='list'>n";
echo "<img src='/i/site/add.png'/> <a href='/index/comm?act=invite&id=$comm[id]'>Пригласить в сообщество</a><br />n";
echo "$config[code_delete] <a href='/index/comm?act=comm&id=$comm[id]&out=1&mdp=$mdp'>Покинуть сообщество</a><br />n";
echo "</div>n";
} else {
echo "<div class='list'>n";
if($comm['id_user']==0) {
echo "Сообщество без создателя!<br/><img src='/i/site/okey.png'/> <a href='/comm/?act=comm&id=$comm[id]&creator=1&mdp=$mdp'>Стать создателем</a><br />n";
} else {
if(mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `id_user` = '$user[id]' AND `invite` = '1'"))!=0)echo "<img src='/i/site/okey.png'/> <a href='/comm/?act=comm&id=$comm[id]&in=1&mdp=$mdp'>Принять приглашение</a>n";
elseif($comm['join_rule']!=3) {
echo "<img src='/i/site/okey.png'/> <a href='/index/comm?act=comm&id=$comm[id]&in=1&mdp=$mdp'>Вступить в сообщество</a>n";
}
}
echo "</div>n";
}
}
?>
<div class="mod_grad">
<div>
Ссылка на сообщество (для отправки друзьям):<br />
<a href="http://<? echo $_SERVER['HTTP_HOST'].'/comm/'.$comm['id'];?>/"><span>http://<? echo $_SERVER['HTTP_HOST'].'/comm/'.$comm['id'];?>/</span></a>
</div>
<div id="sharing_buttons">
<div class='pluso pluso-theme-color pluso-small' style="padding-left:0;"><a class='pluso-vkontakte' style='margin-right:6px;'></a><a class='pluso-odnoklassniki' style='margin-right:6px;'></a><a class='pluso-facebook' style='margin-right:6px;'></a><a class='pluso-twitter' style='margin-right:6px;'></a><a class='pluso-moimir' style='margin-right:6px;'></a><a class='pluso-livejournal' style='margin-right:6px;'></a><a class='pluso-google' style='margin-right:6px;'></a><a class='pluso-email' style='margin-right:6px;'></a></div>
<script type='text/javascript'>if(!window.pluso){pluso={version:'0.9.1',url:'http://share.pluso.ru/'};h=document.getElementsByTagName('head')[0];l=document.createElement('link');l.href=pluso.url+'pluso.css';l.type='text/css';l.rel='stylesheet';s=document.createElement('script');s.src=pluso.url+'pluso.js';s.charset='UTF-8';h.appendChild(l);h.appendChild(s)}</script>
</div><!-- #sharing_buttons -->
</div>
<?
echo "<div class='foot'>n";
echo image_back()." <a href='/index/comm?act=cat&id=$cat[id]'>".hsc($cat['name'])."</a> / <a href='/index/comm'>Категории</a><br />n";
echo "</div>n";
}
else{locon("/index/comm");exit;}
?>