Файл: groups/wall/add.php
Строк: 164
<?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 (!in_array($user_id, explode("||", substr($arr_group['users'], 1, -1)))) go(URL);
}
else go(URL);
$title = lang('Предложить новость','Запропонувати новину');
require_once '../../incfiles/head.php';
echo '<div class="title"><a class="title_a_hover" href="'.URL.'/groups/?id='.$id.'" onclick="Page.Go(this.href); return false">'.$arr_group['name'].'</a></div>
<div class="title">'.$title.'</div>';
echo group_access($arr_group);
require_once 'handler/add.php';
if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `groups_wall_moder` WHERE `group_id` = '".$id."' AND `user_id` = '".$user_id."' LIMIT 1"),0) < 10)
{
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('<?echo URL.'/groups/wall/add.php?id='.$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 '<div class="block2">
<form id="form" method="post" action="'.URL.'/groups/wall/add.php?id='.$id.'">
<textarea id="textarea" class="input" name="wall_post" 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>';
}
}
if ($arr_wall_cache == true && !empty($arr_wall_cache['video']))
{
$q = explode("||", substr($arr_wall_cache['video'], 1, -1));
$count = count($q);
for ($i = 0; $i < $count; $i++)
{
$arr_video = mysql_fetch_array(mysql_query("SELECT * FROM `video` WHERE `id` = '".($q[$i])."' LIMIT 1"));
echo '<div id="'.($i+1).'"><p>';
//echo track($q[$i]);
if($arr_video['type']==0 || $arr_video['type']==2)
{
if(is_file(HOME .''.$arr_video['img'].''))$img =''.URL.''.$arr_video['img'].'';
else
$img =''.URL.'/design/img/video404.jpg';
}
elseif($arr_video['type']==1)
{
$img ='https://i.ytimg.com/vi/'.$arr_video['file'].'/mqdefault.jpg';
}
echo '<div class="video_mini"><div class="video_block_mini"><img src="'.$img.'"/></div></div>';
echo ' <a id="'.($i+1).'" href="'.URL.'/wall/upload.php?del_video='.$q[$i].'" onclick="FormContent.DelCache(this.id,this.href); return false"> <img src="'.URL.'/design/img/closed.png"/><div class ="clear"></div></a>
</p></div>';
}
}
echo '</div><input type="hidden" name="form_wall" 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.'" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/scrp.png"/></a>
</form>
</div>
<div id="form_content"></div>';
}
if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `groups_wall_moder` WHERE `group_id` = '".$id."' AND `user_id` = '".$user_id."' LIMIT 1"),0) == true)
{
$res = mysql_query("SELECT * FROM `groups_wall_moder` WHERE `group_id` = '".$id."' AND `user_id` = '".$user_id."' ORDER by `time` DESC LIMIT 10");
while ($arr = mysql_fetch_array($res))
{
echo '<div class="block">';
echo user_name($user_id).'<br/>'.vtime($arr['time']).'<div class="clear"></div>';
if (!empty($arr['text'])) echo '<p>'.links(smiles($arr['text'])).'</p>';
if (!empty($arr['photos']))
{
$q = explode("||", substr($arr['photos'], 1, -1));
$count = count($q);
echo '<p><center>';
for ($i = 0; $i < $count; $i++)
{
if (file_exists(HOME .'/files/wall/'.$user_id.'/photos/'.$q[$i])) echo '<a href="'.URL.'/files/wall/'.$user_id.'/photos/'.$q[$i].'"><img class="preview_mini" src="'.URL.'/files/wall/'.$user_id.'/photos/mini/'.$q[$i].'"/></a>'; else echo '<img class="preview_mini" src="'.URL.'/design/img/image_not_found.png"/>';
}
echo '</center></p>';
}
if (!empty($arr['video']))
{
echo '<p>';
$q = explode("||", substr($arr['video'], 1, -1));
$count = count($q);
for ($i = 0; $i < $count; $i++)
{
$arr_video = mysql_fetch_array(mysql_query("SELECT * FROM `video` WHERE `id` = '".($q[$i])."' LIMIT 1"));
if($arr_video['type']==0 || $arr_video['type']==2)
{
$img =''.URL.''.$arr_video['img'].'';
}
elseif($arr_video['type']==1)
{
$img ='https://i.ytimg.com/vi/'.$arr_video['file'].'/mqdefault.jpg';
}
$url = ''.URL.'/video/'.$arr_video['id'].'';
//echo '<a href="'.URL.'/video/'.$arr['id'].'" onclick="Page.Go(this.href); return false;"><img class="preview_mini" src="'.$img.'"></a>';
if($count==1){
if (empty($_COOKIE['site_version']) || $_COOKIE['site_version'] == 'default')echo '<div class="video_one"><a href="'.$url.'" onclick="Page.Go(this.href); return false;"><div class="video_block_one"><img src="'.$img.'"/><div class="video_title_one">'.$arr_video['name'].'</div></div></a></div>';
else
echo '<a href="'.$url.'" onclick="Page.Go(this.href); return false;"><img class="preview_mini" src="'.$img.'"></a>';
}else{
if (empty($_COOKIE['site_version']) || $_COOKIE['site_version'] == 'default')echo '<div class="video"><a href="'.$url.'" onclick="Page.Go(this.href); return false;"><div class="video_block"><img src="'.$img.'"/><div class="video_title">'.$arr_video['name'].'</div></div></a></div>';
else
echo '<a href="'.$url.'" onclick="Page.Go(this.href); return false;"><img class="preview_mini" src="'.$img.'"></a>';
}
}
echo '</p><div class ="clear"></div>';
}
if (!empty($arr['audio']))
{
echo '<p>';
$q = explode("||", substr($arr['audio'], 1, -1));
$count = count($q);
for ($i = 0; $i < $count; $i++)
{
echo '<p>'.track($q[$i]).'</p>';
}
echo '</p>';
}
echo '</div><div class ="clear"></div></div><div class="block3"><a class="title_a_hover" id="bg_orange"href="'.URL.'/groups/wall/add.php?id='.$id.'&del_post='.$arr['id'].'" onclick="Page.Go(this.href); return false">'.lang('Удалить','Видалити').'</a></div>';
}
}
require_once '../../incfiles/foot.php';
?>