Файл: groups/forum/theme.php
Строк: 178
<?php
require_once '../../incfiles/core.php';
require_once '../../incfiles/func.php';
require_once '../../incfiles/auth.php';
require_once '../../incfiles/user.php';
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `groups_forum` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true)
{
$arr_theme = mysql_fetch_array(mysql_query("SELECT * FROM `groups_forum` WHERE `id` = '".$id."' LIMIT 1"));
$arr_group = mysql_fetch_array(mysql_query("SELECT * FROM `groups` WHERE `id` = '".$arr_theme['group_id']."' LIMIT 1"));
if (!empty($user_id) && in_array($user_id, explode("||", substr($arr_group['blacklist'], 1, -1)))) {go(URL.'/groups/?id='.$arr_group['id']);}
}
else go(URL.'/');
}
else go(URL.'/');
$title = checkout($arr_group['name']).' :: '.checkout($arr_theme['title']);
if ($window==false) require_once '../../incfiles/head.php';
echo group_access($arr_group);
if ($arr_group['access_forum'] == 2) {echo err(lang('Страница не найдена','Сторінка не знайдена')); if ($ajax_query == false) require_once HOME.'/incfiles/foot.php'; exit;}
if (!empty($user_id) && !in_array($user_id, explode("||", substr($arr_group['banlist'], 1, -1))))
{
require_once 'handler/theme.php';
require_once 'handler/del_post.php';
if ($arr_theme['type']==0) require_once 'handler/post.php';
}
if ($window==false) echo '<div class="title"><a href="'.URL.'/groups/?id='.$arr_group['id'].'" onclick="Page.Go(this.href); return false">'.lang('Сообщество','Спільнота').'</a>
<a href="'.URL.'/groups/forum/?id='.$arr_group['id'].'" onclick="Page.Go(this.href); return false">'.lang('Обсуждения','Обговорення').'</a></div>';
echo '<div class="title">'.($window==true?'<div class="right"><a href="" onclick="Window.Close(); return false"><img src="'.URL.'/design/img/del.png"/></a></div>':'').''.$arr_theme['title'].'</div>';
if ($arr_theme['type']==1) echo err(lang('Тема закрыта для обсуждения','Тема закрита для обговорення'));
echo '<div class="block">';
echo ($arr_theme['from_group']>0?group_name($arr_theme['group_id'],1):user_name($arr_theme['user_id'])).'<br/>'.vtime($arr_theme['time']).'<div class="clear"></div>';
echo '<p>'.links(smiles(($_GET['text']=='full'?$arr_theme['text']:cut($arr_theme['text'],URL.'/groups/forum/theme.php?id='.$id.'&text=full',1000)))).'</p>';
if (!empty($arr_theme['photos']))
{
echo '<p>';
$q = explode("||", substr($arr_theme['photos'], 1, -1));
$count = count($q);
if ($count == 1)
{
if (file_exists(HOME .'/files/'.($arr_theme['from_group']>0?'groups/wall/'.$arr_theme['group_id']:'wall/'.$arr_theme['user_id']).'/photos/'.$q[0])) echo '<center><a href="'.URL.'/files/'.($arr_theme['from_group']>0?'groups/wall/'.$arr_theme['group_id']:'wall/'.$arr_theme['user_id']).'/photos/'.$q[0].'"><img class="preview" src="'.URL.'/files/'.($arr_theme['from_group']>0?'groups/wall/'.$arr_theme['group_id']:'wall/'.$arr_theme['user_id']).'/photos/preview/'.$q[0].'"/></a></center>'; else echo '<center><img class="preview_mini" src="'.URL.'/design/img/image_not_found.png"/></center>';
}
else if ($count > 1)
{
echo '<center>';
for ($i = 0; $i < $count; $i++) if (file_exists(HOME .'/files/'.($arr_theme['from_group']>0?'groups/wall/'.$arr_theme['wall_id']:'wall/'.$arr_theme['user_id']).'/photos/'.$q[$i])) echo '<a href="'.URL.'/files/'.($arr_theme['from_group']>0?'groups/wall/'.$arr_theme['group_id']:'wall/'.$arr_theme['user_id']).'/photos/'.$q[$i].'"><img class="preview_mini" src="'.URL.'/files/'.($arr_theme['from_group']>0?'groups/wall/'.$arr_theme['wall_id']:'wall/'.$arr_theme['user_id']).'/photos/mini/'.$q[$i].'"/></a>'; else echo '<img class="preview_mini" src="'.URL.'/design/img/image_not_found.png"/>';
echo '</center>';
}
echo '</p>';
}
if (!empty($arr_theme['audio']))
{
echo '<p>';
$q = explode("||", substr($arr_theme['audio'], 1, -1));
$count = count($q);
for ($i = 0; $i < $count; $i++)
{
echo '<p>'.track($q[$i]).'</p>';
}
echo '</p>';
}
echo '</div>';
if ($window==true) exit;
echo '<div class="block3">';
if (!empty($user_id))
{
if ($user_id == $arr_theme['user_id'] || in_array($user_id, explode("||", substr($arr_group['admins'], 1, -1))) || $arr_theme['from_group']==0 && in_array($user_id, explode("||", substr($arr_group['moders'], 1, -1))))
{
echo '<a class="title_a_hover" href="'.URL.'/groups/forum/edit_theme.php?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Редактировать','Редагувати').'</a> ';
if (in_array($user_id, explode("||", substr($arr_group['admins'], 1, -1))) || in_array($user_id, explode("||", substr($arr_group['moders'], 1, -1)))) echo ($arr_theme['fix']==0?'<a class="title_a_hover" id="bg_orange" href="'.URL.'/groups/forum/theme.php?id='.$id.'&fix=1" onclick="Page.Go(this.href); return false">'.lang('Прикрепить','Закріпити').'</a>':'<a class="title_a_hover" href="'.URL.'/groups/forum/theme.php?id='.$id.'&fix=2" onclick="Page.Go(this.href); return false">'.lang('Открепить','Відкріпити').'</a>').' '.($arr_theme['type']==0?'<a class="title_a_hover" id="bg_red" href="'.URL.'/groups/forum/theme.php?id='.$id.'&type=close" onclick="Page.Go(this.href); return false">'.lang('Закрыть','Закрити').'</a>':'<a class="title_a_hover" href="'.URL.'/groups/forum/theme.php?id='.$id.'&type=open" onclick="Page.Go(this.href); return false">'.lang('Открыть','Відкрити').'</a>');
}
}
echo '</div><div id="content_comm"><div class="comm">';
if ($arr_theme['cpost'] > 0)
{
$cp = ceil($arr_theme['cpost']/10);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
if (!empty($user_id) && in_array($user_id, explode("||", substr($arr_group['admins'], 1, -1)))) $access_user = 1;
else if (!empty($user_id) && in_array($user_id, explode("||", substr($arr_group['moders'], 1, -1)))) $access_user = 2;
$arr_post = mysql_query("SELECT * FROM `groups_forum_post` WHERE `tid` = '".$id."' ORDER by `time` ASC LIMIT $start,10");
while ($arr = mysql_fetch_array($arr_post))
{
echo '<div class="block">';
echo user_name($arr['user_id']).'<br/>'.vtime($arr['time']).'<div class="clear"></div>';
if (!empty($arr['quote_id'])) echo '<ul><div class="quote">'.user_name($arr['quote_id']).'<br/>'.lang('пишет','пише').':<ul>'.smiles(text($arr['quote'])).'</ul></div></ul>';
echo '<p>'.smiles(text($arr['text'])).'</p>';
if (!empty($user_id) && $user_id != $arr['user_id'] && $arr_theme['type'] == 0 && in_array($user_id, explode("||", substr($arr_group['users'], 1, -1))))
{
echo '<div class="right"><a href="'.URL.'/groups/forum/re_post.php?id='.$arr['id'].'" onclick="Page.Go(this.href); return false">'.lang('Ответить','Відповісти').'</a></div>';
}
echo '<a id="block_menu_'.$arr['id'].'" href="" onclick="BlockMenu.Open('.$arr['id'].'); return false"><img id="block_menu_'.$arr['id'].'" src="'.URL.'/design/img/menu_show.png"/></a></div>';
if (!empty($user_id)) if ($access_user > 0 || $user_id == $arr['user_id'])
{
echo '<div id="block_menu_'.$arr['id'].'" class="title display_none">';
if ($user_id == $arr['user_id']) echo ' <a class="title_a_hover" href="'.URL.'/groups/forum/edit_post.php?id='.$arr['id'].'" onclick="Page.Go(this.href); return false">'.lang('Редактировать','Редагувати').'</a> ';
if ($access_user > 0) echo '<a class="title_a_hover" id="bg_orange" href="'.URL.'/groups/forum/theme.php?id='.$id.'&del_post='.$arr['id'].'" onclick="Form.delPost(this.href); return false">'.lang('Удалить','Видалити').'</a> ';
if ($access_user > 0 && $user_id != $arr['user_id']) echo '<a class="title_a_hover" id="bg_red" href="'.URL.'/groups/adm/ban.php?id='.$arr_group['id'].'&ban_id='.$arr['user_id'].'" onclick="Page.Go(this.href); return false">'.lang('Заблокировать','Заблокувати').'</a> ';
if ($access_user == 1 && $user_id != $arr['user_id']) echo '<a class="title_a_hover" id="bg_black" href="'.URL.'/groups/adm/users.php?id='.$arr_group['id'].'&blacklist='.$arr['user_id'].'" onclick="Page.Go(this.href); return false">'.lang('Черный список','Чорний список').'</a>';
echo '</div>';
}
}
navi($p,$cp,''.URL.'/groups/forum/theme.php?id='.$id.'&');
}
echo '</div></div>';
if (!empty($user_id))
{
if ($site_version == 'default')
{
?>
<script type="text/javascript">
$(function(){
$('#form').on('submit', function(e){
e.preventDefault();
var $that = $(this),
formData = new FormData($that.get(0));
$.ajax({
url: $that.attr('action'),
type: $that.attr('method'),
contentType: false,
processData: false,
data: formData,
success: function(response){
if(response){
$('#content_comm').load($that.attr('action')+ '#content_comm .comm');
$('#textarea').val('');
}
}
});
});
});
</script>
<?
}
if (in_array($user_id, explode("||", substr($arr_group['users'], 1, -1))) && $arr_theme['type']==0) echo '<div class="block2">
<form id="form" method="post" action="'.URL.'/groups/forum/theme.php?id='.$id.'&p='.($cp==0?1:$cp).'">
<textarea id="textarea" class="input" name="post" rows="4"></textarea>
<input class="button2" type="submit" value="'.lang('Написать','Написати').'"/>
<a class="button3" href="'.URL.'/ajax/smiles.php" onclick="FormContent.Smiles(this.href); return false"><img src="'.URL.'/design/img/smile.png"/></a>
</form>
</div>
<div id="form_content"></div>';
}
require_once '../../incfiles/foot.php';
?>