Просмотр файла forum/forum_files.php

Размер файла: 12.32Kb
<?php
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
$shcmsengine['title'] = Lang::get('Форум - Файлы форума');
include_once'../template/head.php';


switch($act):

default:
?>
<style>
.text {
background-color: #FCFCFC;
border-left: 1px solid #D9D9FF;
border-radius: 2px;
margin: 8px;
overflow-wrap: break-word;
padding: 6px;
}
</style>
<?
echo '<div class="maintitle mainrazd">'.Lang::get('Файлы форума').'</div>';
echo '<div class="maintext">';

echo '<div class="posts">
<img src="../download/icons/zip.png">&nbsp;'.Lang::get('Архивы').'&nbsp;&nbsp;<span class="text"></span> 
<a href="?act=arhive&zip"><strong>.zip</strong></a> , 
<a href="?act=arhive&rar"><strong>.rar</strong></a>
</div>';


echo '<div class="posts">
<img src="../download/icons/mp4.png">&nbsp;'.Lang::get('Видео').'&nbsp;&nbsp;&nbsp;<span class="text"></span> 
<a href="?act=video&mp4"><strong>.mp4</strong></a> , 
<a href="?act=video&avi"><strong>.avi</strong></a>
</div>';


echo '<div class="posts">
<img src="../download/icons/mp3.png">&nbsp;'.Lang::get('Музыка').'&nbsp;&nbsp;<span class="text"></span> 
<a href="?act=music&mp3"><strong>.mp3</strong></a> , 
<a href="?act=music&midi"><strong>.midi</strong></a>
</div>';


echo '<div class="posts">
<img src="../download/icons/txt.png">&nbsp;'.Lang::get('Тексты').'&nbsp;&nbsp;&nbsp;<span class="text"></span> 
<a href="?act=text&txt"><strong>.txt</strong></a> , 
<a href="?act=text&php"><strong>.php</strong></a>
</div>';

echo '<div class="posts">
<img src="../download/icons/txt.png">&nbsp;'.Lang::get('Изображение').'&nbsp;&nbsp;&nbsp;<span class="text"></span> 
<a href="?act=photo&all"><strong>'.Lang::get('*.все').'</strong></a>
</div>';


echo '</div>';
break;


	case 'arhive':
		if(isset($_GET['zip'])) {
			$zip = $_GET['zip'];
		}
				$forum_them = mysql_query("SELECT * FROM `forum_them` ORDER BY `id` DESC");
			while($forum_themes = mysql_fetch_array($forum_them)) { 
		if(isset($zip)) {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'zip' and `them_id` = '$forum_themes[id]'"),0);
		}else {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'rar' and `them_id` = '$forum_themes[id]'"),0);
		}
	if($count_files != 0) {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов:').' '.$count_files .'</span></div>';
	}else {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов: 0').'</span></div>';
	}
	echo '<div class="maintext">';
		if(isset($zip)) {
			$forum_arhiv = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'zip' and `them_id` = '$forum_themes[id]' ");
		}else {
			$forum_arhiv = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'rar' and `them_id` = '$forum_themes[id]' ");
		}
if(mysql_num_rows($forum_arhiv) != 0) {
	while($forum_arhive = mysql_fetch_array($forum_arhiv)) {

		if($forum_arhive['type'] == 'zip') {
			echo '<div class="posts"><img src="../download/icons/zip.png"> ' .$forum_arhive['text'].' <span class="mainforum">'.size($forum_arhive['size']).'</span></div>';
		}else {
			echo '<div class="posts"><img src="../download/icons/zip.png"> ' .$forum_arhive['text'].' <span class="mainforum">'.size($forum_arhive['size']).'</span></div>';
		}
	}
}else {
	echo '<div class="posts"><img src="../template/icon/empty.png"> '.Lang::get('В данной теме не найдено файлов!').'</div>';
}
	echo '</div>';

			}
	break;
	
	case 'video':
		if(isset($_GET['avi'])) {
			$avi = $_GET['avi'];
		}
				$forum_them = mysql_query("SELECT * FROM `forum_them` ORDER BY `id` DESC");
			while($forum_themes = mysql_fetch_array($forum_them)) { 
		if(isset($avi)) {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'avi' and `them_id` = '$forum_themes[id]'"),0);
		}else {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'mp4' and `them_id` = '$forum_themes[id]'"),0);
		}
	if($count_files != 0) {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов:').$count_files .'</span></div>';
	}else {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов: 0').'</span></div>';
	}
	echo '<div class="maintext">';
		if(isset($avi)) {
			$forum_video = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'avi' and `them_id` = '$forum_themes[id]' ");
		}else {
			$forum_video = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'mp4' and `them_id` = '$forum_themes[id]' ");
		}
if(mysql_num_rows($forum_video) != 0) {
	while($forum_videos = mysql_fetch_array($forum_video)) {

		if($forum_videos['type'] == 'mp4') {
			echo '<div class="posts"><img src="../download/icons/mp4.png"> ' .$forum_videos['text'].' <span class="mainforum">'.size($forum_videos['size']).'</span></div>';
		}else {
			echo '<div class="posts"><img src="../download/icons/mp4.png"> ' .$forum_videos['text'].' <span class="mainforum">'.size($forum_videos['size']).'</span></div>';
		}
	}
}else {
	echo '<div class="posts"><img src="../template/icon/empty.png"> '.Lang::get('В данной теме не найдено файлов!').'</div>';
}
	echo '</div>';

			}
	break;
	
	
case 'music':
		if(isset($_GET['midi'])) {
			$midi = $_GET['midi'];
		}
				$forum_them = mysql_query("SELECT * FROM `forum_them` ORDER BY `id` DESC");
			while($forum_themes = mysql_fetch_array($forum_them)) { 
		if(isset($midi)) {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'midi' and `them_id` = '$forum_themes[id]'"),0);
		}else {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'mp3' and `them_id` = '$forum_themes[id]'"),0);
		}
	if($count_files != 0) {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы  с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов:').$count_files .'</span></div>';
	}else {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы  с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов: 0').'</span></div>';
	}
	echo '<div class="maintext">';
		if(isset($midi)) {
			$forum_music = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'midi' and `them_id` = '$forum_themes[id]' ");
		}else {
			$forum_music = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'mp3' and `them_id` = '$forum_themes[id]' ");
		}
if(mysql_num_rows($forum_music) != 0) {
	while($forum_musics = mysql_fetch_array($forum_music)) {

		if($forum_musics['type'] == 'mp3') {
			echo '<div class="posts"><img src="../download/icons/mp3.png"> ' .$forum_musics['text'].' <span class="mainforum">'.size($forum_musics['size']).'</span></div>';
		}else {
			echo '<div class="posts"><img src="../download/icons/mp3.png"> ' .$forum_musics['text'].' <span class="mainforum">'.size($forum_musics['size']).'</span></div>';
		}
	}
}else {
	echo '<div class="posts"><img src="../template/icon/empty.png"> '.Lang::get('В данной теме не найдено файлов!').'</div>';
}
	echo '</div>';

			}
	break;	
	
case 'text':
		if(isset($_GET['php'])) {
			$php = $_GET['php'];
		}
				$forum_them = mysql_query("SELECT * FROM `forum_them` ORDER BY `id` DESC");
			while($forum_themes = mysql_fetch_array($forum_them)) { 
		if(isset($php)) {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'php' and `them_id` = '$forum_themes[id]'"),0);
		}else {
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE `type` = 'txt' and `them_id` = '$forum_themes[id]'"),0);
		}
	if($count_files != 0) {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы  с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов:').$count_files .'</span></div>';
	}else {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы  с темы').' - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов: 0').'</span></div>';
	}
	echo '<div class="maintext">';
		if(isset($php)) {
			$forum_text = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'php' and `them_id` = '$forum_themes[id]' ");
		}else {
			$forum_text = mysql_query("SELECT * FROM `forum_files` WHERE `type` = 'txt' and `them_id` = '$forum_themes[id]' ");
		}
if(mysql_num_rows($forum_text) != 0) {
	while($forum_texts = mysql_fetch_array($forum_text)) {

		if($forum_texts['type'] == 'txt') {
			echo '<div class="posts"><img src="../download/icons/txt.png"> ' .$forum_texts['text'].' <span class="mainforum">'.size($forum_texts['size']).'</span></div>';
		}else {
			echo '<div class="posts"><img src="../download/icons/php.png"> ' .$forum_texts['text'].' <span class="mainforum">'.size($forum_texts['size']).'</span></div>';
		}
	}
}else {
	echo '<div class="posts"><img src="../template/icon/empty.png"> '.Lang::get('В данной теме не найдено файлов!').' </div>';
}
	echo '</div>';

			}
	break;		
	case 'photo':
				$forum_them = mysql_query("SELECT * FROM `forum_them` ORDER BY `id` DESC");
			while($forum_themes = mysql_fetch_array($forum_them)) { 
			$count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_files` WHERE (`type` = 'jpg' or `type` = 'png' or `type` = 'jpeg' or `type` = 'gif')   and (`them_id` = '$forum_themes[id]')"),0);
	if($count_files != 0) {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы с темы').'  - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов:').'  '.$count_files .'</span></div>';
	}else {
		echo '<div class="maintitle mainrazd">'.Lang::get('Файлы с темы').'  - <a href="message.php?id='.$forum_themes['id'].'">'.$forum_themes['name'].'</a> <span class="maintime">'.Lang::get('файлов: 0').' </span></div>';
	}
	echo '<div class="maintext">';
			$forum_photo = mysql_query("SELECT * FROM `forum_files` WHERE (`type` = 'jpg' or `type` = 'png' or `type` = 'jpeg' or `type` = 'gif')  and (`them_id` = '$forum_themes[id]') ");
if(mysql_num_rows($forum_photo) != 0) {
	while($forum_photos = mysql_fetch_array($forum_photo)) {

		if($forum_photos['type'] == 'png') {
			echo '<div class="posts"><img src="../download/icons/png.png"> ' .$forum_photos['text'].' <span class="mainforum">'.size($forum_photos['size']).'</span></div>';
		}elseif($forum_photos['type'] == 'gif') {
			echo '<div class="posts"><img src="../download/icons/gif.png"> ' .$forum_photos['text'].' <span class="mainforum">'.size($forum_photos['size']).'</span></div>';
		}elseif($forum_photos['type'] == 'jpeg') {
			echo '<div class="posts"><img src="../download/icons/jpg.png"> ' .$forum_photos['text'].' <span class="mainforum">'.size($forum_photos['size']).'</span></div>';
		}elseif($forum_photos['type'] == 'jpg') {
			echo '<div class="posts"><img src="../download/icons/jpg.png"> ' .$forum_photos['text'].' <span class="mainforum">'.size($forum_photos['size']).'</span></div>';
		}
	}
}else {
	echo '<div class="posts"><img src="../template/icon/empty.png"> '.Lang::get('В данной теме не найдено файлов!').' </div>';
}
	echo '</div>';

			}
	break;	
	
	

endswitch;

if($act == false) {
echo '<a class="link_str" href="/forum">'.Lang::get('В форум').' </a>';
}else {
echo '<a class="link_str" href="/forum/forum_files.php">'.Lang::get('Назад').' </a>';
}

	include_once'../template/foot.php';
?>