Файл: groups/forum/new.php
Строк: 120
<?php
require_once '../../incfiles/core.php';
require_once '../../incfiles/func.php';
require_once '../../incfiles/auth.php';
require_once '../../incfiles/user.php';
if (empty($user_id)) go(URL);
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `groups` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true) $arr_group = mysql_fetch_array($result);
else go(URL);
if ($arr_group['access_forum'] == 1 && in_array($user_id, explode("||", substr($arr_group['admins'], 1, -1))) || $arr_group['access_forum'] == 0 && in_array($user_id, explode("||", substr($arr_group['users'], 1, -1)))) {} else go(URL.'/groups/?id='.$id);
}
else go(URL);
$title = checkout($arr_group['name']).' :: '.lang('Новая тема','Нова тема');
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;}
echo '<div class="title"><a href="'.URL.'/groups/?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Сообщество','Спільнота').'</a>
<a href="'.URL.'/groups/forum/?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Обсуждения','Обговорення').'</a> ';
if (!empty($user_id)) echo '<a class="title_a_hover" href="'.URL.'/groups/forum/new.php?id='.$id.'" onclick="Page.Go(this.href); return false;">'.lang('Новая тема','Нова тема').'</a>';
echo '</div>';
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){
Page.Go("/groups/forum/?id=<?echo $id;?>");
}
}
});
});
});
$('input:file').remove();
$(document).ready(function() {
new AjaxUpload('upload', {
action: "/groups/wall/upload.php?from=<?echo $id;?>",
name: "file",
data: {ajax: "yes"},
onSubmit: function(file, ext) {
if(! (ext && /^(jpg|gif|png|jpeg)$/.test(ext))) {
return false;
}
$('#cache_photos').append('<img id="preview_loading" src="/design/img/preview_loading.gif" style="width:48px;height:48px;"/>');
},
onComplete: function(file, res) {
$('#preview_loading').remove();
if(res)
$("#cache_photos").append(res);
}
});
});
</script>
<?
}
$arr_wall_cache = false;
if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `wall_cache` WHERE `user_id` = '".$user_id."' LIMIT 1"),0) == true) $arr_wall_cache = mysql_fetch_array(mysql_query("SELECT * FROM `wall_cache` WHERE `user_id` = '".$user_id."' LIMIT 1"));
echo '<form id="form" action="'.URL.'/groups/forum/?id='.$id.'" method="post">
<div class="block2">
'.lang('Название','Назва').':<br/>
<input class="input" type="text" name="title" value="">
</div><div class="block2">
Текст:<br/>
<textarea id="textarea" class="input" name="text" rows="4"></textarea>
<p><div id="cache_photos">';
if ($arr_wall_cache == true && !empty($arr_wall_cache['photos']))
{
$q = explode("||", substr($arr_wall_cache['photos'], 1, -1));
$count = count($q);
for ($i = 0; $i < $count; $i++)
{
echo '<a id="'.($i+1).'" class="del_cache" href="'.URL.'/groups/wall/upload.php?del_photo='.$q[$i].'&from='.$id.'" onclick="FormContent.DelCache(this.id,this.href); return false"><img class="preview_icons" src="'.URL.'/files/wall/'.$user_id.'/photos/icons/'.$q[$i].'"/></a>';
}
}
echo '</div></p><div id="cache_audio">';
if ($arr_wall_cache == true && !empty($arr_wall_cache['audio']))
{
$q = explode("||", substr($arr_wall_cache['audio'], 1, -1));
$count = count($q);
for ($i = 0; $i < $count; $i++)
{
echo '<div id="'.($i+1).'"><p>';
echo track($q[$i]);
echo ' <a id="'.($i+1).'" href="'.URL.'/groups/wall/upload.php?del_audio='.$q[$i].'&from='.$id.'" onclick="FormContent.DelCache(this.id,this.href); return false"> <img src="'.URL.'/design/img/closed.png"/></a>
</p></div>';
}
}
echo '</div>
<input type="hidden" name="form_forum" value="1">
<input class="button2" type="submit" value="'.lang('Создать','Створити').'">
<div class="button3 for_pc" id="upload" style="float: right; cursor: pointer;"><img src="'.URL.'/design/img/photo.png"/></div>
<a class="button3" href="'.URL.'/ajax/smiles.php" onclick="FormContent.Smiles(this.href); return false"><img src="'.URL.'/design/img/smile.png"/></a>
<a class="button3" href="'.URL.'/groups/wall/upload.php?from='.$id.'&target=group_forum" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/scrp.png"/></a>
</div></form>
<div id="form_content"></div>';
require_once '../../incfiles/foot.php';
?>