View file modules/pages/file.php

File size: 17.77Kb
<?php

$id = abs(intval($_GET['id']));
$file = $db->query('SELECT * FROM `file` WHERE `id` = '.$id)->fetch_assoc();
if ($file['del'] != 0) {
	$avto = $file['del'] * 86400;
} else {
	$avto = $set['del'] * 86400;
}

if ($file == 0) {
	header('HTTP/2.0 410 Gone');
	$title_main = 'Error 410 Gone';
	require_once SYS.'/head.php';

echo '

		<div class="error">

			<div class="error-logo"></div>

			<div class="error-text">
				<div class="error-title">410</div>
				<div class="error-message">'.$lang['error_410'].'</div>

				<div>
					<a href="/">'.$lang['go_home'].'</a>
				</div>
			</div>

		</div>

		</section>

	</body>
</html>
';
	exit;
}

$title_main = $lang['download'].' '.$file['name'].' - GOload '.$lang['title'];
require_once SYS.'/header.php';

if ($file['pass'] == 0 or @$_COOKIE['filepass'] == $file['pass']) {

if (!isset($_SESSION['file'.$id]) and $guest['ua'] != 'NULLED_USER_AGENT') {
$db->query('UPDATE `file` SET `views` = `views` +1 WHERE `id` = '.$id);
}
$_SESSION['file'.$id] = true;

echo '
		<div class="block col-md-8">
			<h6 class="round_title">
				<a class="left" onclick="window.history.back();">
					<img src="/assets/img/left.svg" alt="back">
				</a>
				<div class="title back"><a href="/">'.$title.'</a> | '.$file['name'].'</div>
			</h6>
';

if ($file['format'] == 'mp3' or $file['format'] == 'ogg') {
echo '
			<div class="prev media">
				<script src="/assets/js/jplayer.js"></script>
				<script type="text/javascript">
					$(document).ready(() => {
						$("#track").jPlayer({
							ready: function() {
								$(this).jPlayer("setMedia", {
									mp3: "/files/'.$file['file'].'"
								})
							},
							supplied: "mp3",
							play: function() {
								$(this).jPlayer("pauseOthers")
							},
							wmode: "window",
							smoothPlayBar: true,
							keyEnabled: true
						})
					});
				</script>

				<div id="track" class="jp-jplayer"></div>
				<div id="jp_container_1" class="jp-audio">
					<div class="jp-type-single">
						<div class="jp-title">
							<ul>
								<li><span class="jp-muz-name">'.$file['name'].'</span></li>
							</ul>
						</div>
						<div class="jp-gui jp-interface">
							<ul class="jp-controls">
								<li><span class="jp-play">
									<img width="42px" height="42px" src="/assets/img/play.png"/>
								</span></li>
								<li><span class="jp-pause">
									<img width="42px" height="42px" src="/assets/img/pause.png"/>
								</span></li>
							</ul>
							<div class="jp-progress">
								<div class="jp-seek-bar">
									<div class="jp-play-bar"></div>
								</div>
							</div>
							<div class="jp-time-holder">
								<div class="jp-current-time"></div>
							</div>
						</div>
					</div>
				</div>
			</div>

';
} elseif ($file['format'] == 'mp4' or $file['format'] == 'webm' or $file['format'] == '3gp') {
echo '
			<div id="playtube-player_'.$file['id'].'">
				<script src="/assets/js/video/loader.min.js"></script>
				<script>
					let page_params = {};
					xlll.initLoader({
						deviceType: "mobile"
					});

					page_params.video_player_setup = {
						playerDiv_'.$file['id'].': {
							basicPlayerSkin: {
								qualitySelector_class: "js_toggle_quality",
								playWrapper: "js_poster_wrapper"
							},
							createPlayerSetup: {
								startOffset: 0,
								mainRoll: {
									mediaDefinition: [{
										"defaultQuality": true,
										"quality": "auto",
										"videoUrl": "/files/'.$file['file'].'"
									}],
									poster: "/modules/viewer/video.php?file='.$file['file'].'",
									timing: "main"
								},
								autoPlayVideo: {
									enabled: false
								},
							}
						}
					};
				</script>

				<div class="player_wrap">
					<div id="playerDiv_'.$file['id'].'" class="playerDiv"></div>
				</div>
				<script src="/assets/js/video/video_player_setup.js"></script>
			</div>

';
} elseif ($file['format'] == 'jpeg' or $file['format'] == 'jpg' or $file['format'] == 'png' or $file['format'] == 'ico' or $file['format'] == 'bmp' or $file['format'] == 'svg') {
echo '
			<div class="prev">
				<a href="/up'.$id.'" target="_blank">
					<img '; if ($file['nsfw'] == 'true') { echo 'class="nsfw" ';} echo 'src="/files/'.$file['file'].'" alt="" style="max-width:100%;">
				</a>
			</div>
';
} elseif ($file['format'] == 'gif') {
echo '
			<div class="prev">
				<img src="/modules/viewer/gif.php?image='.$file['file'].'" class="gifview" data-gif="/files/'.$file['file'].'" alt="" style="max-width:100%;">
			</div>
			<script src="/assets/js/gifview.js"></script>
			<script>
				const gif = new gifview($(".gifview")[0]);
			</script>
';
} elseif ($file['format'] == 'psd') {
echo '
			<div class="prev">
				<a href="/up'.$id.'" target="_blank">
					<img src="/modules/viewer/psd.php?file='.$file['file'].'" alt="" style="max-width:100%;">
				</a>
			</div>
';
} elseif ($file['format'] == 'zip') {
echo '
			<div class="link">
				<a href="/modules/viewer/zip.php?arh='.$file['id'].'">'.$lang['archive_view'].'</a>
			</div>
';
}

echo '
			<div style="position: relative;">
				<div class="view file_title menu">';

if ($file['format'] == 'apk') {
echo '
					<img src="/modules/viewer/apk.php?file='.$file['file'].'" style="width: 32px;height: 32px;margin-right: 4px;" alt="app icon">';
}

echo '
					<b>'.$file['name'].'</b>
					<div style="top: 15px;" class="file_more">
						<img style="width: 20px;" src="/assets/img/more.svg" alt="more">
						<div style="top: 28px;" class="more_links">'; if (isset($admin)) echo '
							<a onclick="delalert()">'.$lang['delete_btn'].'</a>'; echo '
							<a href="/report'.$file['id'].'">'.$lang['report'].'</a>
						</div>
					</div>
				</div>
			</div>';

if (isset($admin)) echo '
			<div id="del" class="delete-alert">
				<div class="delete-alert-body">
					<div class="delete-alert-question">'.$lang['delete_file'].'?</div>
					<div class="delete-alert-option-body">
						<button type="button" class="del-but">
							<a class="del-but-opt" onclick="delalert()">'.$lang['cancel_btn'].'</a>
						</button>
						<button type="button" class="del-but">
							<a href="/delete'.$id.'?da" class="del-but-opt">'.$lang['delete_btn'].'</a>
						</button>
					</div>
				</div>
			</div>

			<script>
				function delalert() {
					$("#del").toggleClass("vis")
				}
			</script>';

if ($file['user'] != 0) {
	if (file_exists(H.'/modules/users/photos/'.$file['user'].'.png')) {
		$photo = '<img class="letter" src="/modules/users/photos/'.$file['user'].'.png" alt="">';
	} else {
		$photo = '<img class="letter" src="/assets/img/user.png" alt="">';
	}
} else {
	$photo = '<span class="letter">'.mb_substr($file['avtor'], 0, 1).'</span>';
}

echo '
			<div class="view line menu">
				<div class="author">
					<div style="float: left;">
						'.$photo.'
					</div>
					<div style="margin-left: 52px;position: relative;top: 1px;">
						<div class="name_b">'.$file['avtor'].'</div>
						<span class="load_date">'.vremya($file['time']-$avto).'</span>
					</div>
				</div>
			</div>
			<div class="view line menu" style="padding-bottom: 24px;font-size: 13px;">';

if (@$_COOKIE['like'.$id] == 'false' or @$_COOKIE['like'.$id] == null) {
echo '
				<a id="like" class="like_toggle" style="cursor: pointer;padding: 8px 10px;border: 1px solid rgba(0, 0, 0, .1);border-radius: 50px;">
					<img src="/assets/img/like.svg" alt="like" style="margin-top: -3px;margin-right: 5px;">
					<b id="like_count">'.count_round($file['like']).'</b>
				</a>';
} else {
echo '
				<a id="like" class="like_toggle like_dis" style="cursor: pointer;padding: 8px 10px;border: 1px solid rgba(0, 0, 0, .1);border-radius: 50px;">
					<img src="/assets/img/like.svg" alt="like" style="margin-top: -3px;margin-right: 5px;">
					<b id="like_count">'.count_round($file['like']).'</b>
				</a>';
}
echo '
				<script>
					$("#like").on("click", (e) => {
						e.preventDefault();
						$.get("/like'.$id.'", (data) => {
							$("#like_count").text(data["count"]),
							$("#like").toggleClass("like_dis")
						})
					});
				</script>';
echo '

				<a href="/up'.$id.'" target="_blank" style="padding: 8px 10px;border: 1px solid rgba(0, 0, 0, .1);border-radius: 50px;margin-left:8px;">
					<img src="/assets/img/downb.svg" alt="load" style="margin-top: -3px;margin-right: 5px;">
					<b>'.$file['up'].'</b>
				</a>

				<a href="/komm'.$id.'" style="padding: 5px 12px;border: 1px solid rgba(0, 0, 0, .1);border-radius: 50px;float: right;margin-top: -6px;">
					<span class="comm_butt_title" style="margin-right: 5px;">'.$lang['comments'].'</span>
					<img class="comm_butt_icon" src="/assets/img/comm.svg" alt="comments" style="margin-top: -3px;margin-right: 5px;">
					<b>'.$db->query('SELECT COUNT(*) FROM `komm` WHERE `file` = '.$id)->fetch_row()[0].'</b>
				</a>
			</div>
			<div class="view line menu">'.$lang['auto_del_time'].': <b>'.vremya($file['time']).'</b></div>';
if ($file['opis'] != null) { echo'
			<div class="view line menu">'.$lang['description_file'].': <b style="word-break: break-word;">'.$file['opis'].'</b></div>';} echo '
			<div class="view line menu">'.$lang['file_size'].': <b>'.sizer(filesize('files/'.$file['file'])).'</b></div>
			<div class="view line menu">'.$lang['file_views'].': <b>'.$file['views'].'</b></div>
			<div class="view line menu">'.$lang['file_format'].': <b>'.$file['format'].'</b></div>
			<div class="view line menu">'.$lang['qr'].':<b><br> <img class="qr" src="https://chart.apis.google.com/chart?cht=qr&chs=200x200&chl=https://'.$_SERVER['HTTP_HOST'].'/file'.$id.'"></b></div>
			<div class="view line menu">'.$lang['md5_hash'].': <b>'.md5_file('files/'.$file['file']).'</b></div>
			<div class="view line share">
				<span>'.$lang['share'].':</span>
				<ul>
					<li>
						<a class="twitter" href="https://twitter.com/intent/tweet?text='.$lang['file'].' - '.$file['name'].'&url=https://'.$_SERVER['HTTP_HOST'].'/file'.$id.'%3Futm_source=twitter%26utm_medium=social&hashtags=goload,'.$file['format'].'" onclick="window.open(this.href, \''.$lang['share_in'].' Twitter\', \'toolbar=0,status=0\'); return false">
							<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z"/></svg>
						</a>
					</li>
					<li>
						<a class="telegram" href="https://t.me/share/url?url=https://'.$_SERVER['HTTP_HOST'].'/file'.$id.'%3Futm_source=telegram%26utm_medium=messenger&text='.$lang['file'].' - '.$file['name'].'" onclick="window.open(this.href, \''.$lang['share_in'].' Telegram\', \'toolbar=0,status=0\'); return false">
							<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.028 20.837c-.714 0-.593-.271-.839-.949l-2.103-6.92L22.263 3.37"/><path d="M9.028 20.837c.552 0 .795-.252 1.105-.553l2.941-2.857-3.671-2.214"/><path d="M9.403 15.213l8.89 6.568c1.015.56 1.748.271 2-.942l3.62-17.053c.372-1.487-.564-2.159-1.534-1.72L1.125 10.263c-1.45.582-1.443 1.392-.264 1.753l5.455 1.7L18.94 5.753c.595-.36 1.143-.167.694.232"/></svg>
						</a>
					</li>
					<li>
						<a class="vk" href="https://vk.com/share.php?url=https://'.$_SERVER['HTTP_HOST'].'/file'.$id.'%3Futm_source=vkontakte%26utm_medium=social&title='.$lang['file'].' - '.$file['name'].'" onclick="window.open(this.href, \''.$lang['share_in'].' VK\', \'toolbar=0,status=0\'); return false">
							<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11.701 18.771h1.437s.433-.047.654-.284c.21-.221.21-.63.21-.63s-.031-1.927.869-2.21c.887-.281 2.012 1.86 3.211 2.683.916.629 1.605.494 1.605.494l3.211-.044s1.682-.105.887-1.426c-.061-.105-.451-.975-2.371-2.76-2.012-1.861-1.742-1.561.676-4.787 1.469-1.965 2.07-3.166 1.875-3.676-.166-.48-1.26-.361-1.26-.361l-3.602.031s-.27-.031-.465.09c-.195.119-.314.391-.314.391s-.572 1.529-1.336 2.82c-1.623 2.729-2.268 2.879-2.523 2.699-.604-.391-.449-1.58-.449-2.432 0-2.641.404-3.75-.781-4.035-.39-.091-.681-.15-1.685-.166-1.29-.014-2.378.01-2.995.311-.405.203-.72.652-.539.675.24.03.779.146 1.064.537.375.506.359 1.636.359 1.636s.211 3.116-.494 3.503c-.495.262-1.155-.28-2.595-2.756-.735-1.26-1.291-2.67-1.291-2.67s-.105-.256-.299-.406c-.227-.165-.557-.225-.557-.225l-3.435.03s-.51.016-.689.24c-.166.195-.016.615-.016.615s2.686 6.287 5.732 9.453c2.79 2.902 5.956 2.715 5.956 2.715l-.05-.055z"/></svg>
						</a>
					</li>
					<li>
						<a class="facebook" href="https://facebook.com/sharer/sharer.php?u=https://'.$_SERVER['HTTP_HOST'].'/file'.$id.'%3Futm_source=facebook%26utm_medium=social&title='.$lang['file'].' - '.$file['name'].'" onclick="window.open(this.href, \''.$lang['share_in'].' Facebook\', \'toolbar=0,status=0\'); return false">
							<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M8.21 9.25L8.21 12.06L9.93 12.06L9.93 20.3L13.24 20.3L13.24 12.02L15.54 12.02L15.79 9.25C14.26 9.25 13.41 9.25 13.24 9.25C13.24 9.25 13.24 8.22 13.24 7.67C13.24 7.02 13.37 6.76 14 6.76C14.51 6.76 15.79 6.76 15.79 6.76C15.79 6.47 15.79 4.17 15.79 3.89C15.79 3.89 13.91 3.89 13.5 3.89C11.04 3.89 9.94 4.97 9.94 7.04C9.93 8.85 9.93 9.25 9.93 9.25C9.7 9.25 9.13 9.25 8.21 9.25Z"/></svg>
						</a>
					</li>
					<li>
						<a class="reddit" href="https://www.reddit.com/submit?url=https://'.$_SERVER['HTTP_HOST'].'/file'.$id.'%3Futm_source=reddit%26utm_medium=social&title='.$lang['file'].' - '.$file['name'].'" onclick="window.open(this.href, \''.$lang['share_in'].' Reddit\', \'toolbar=0,status=0\'); return false">
							<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M24 11.779c0-1.459-1.192-2.645-2.657-2.645-.715 0-1.363.286-1.84.746-1.81-1.191-4.259-1.949-6.971-2.046l1.483-4.669 4.016.941-.006.058c0 1.193.975 2.163 2.174 2.163 1.198 0 2.172-.97 2.172-2.163s-.975-2.164-2.172-2.164c-.92 0-1.704.574-2.021 1.379l-4.329-1.015c-.189-.046-.381.063-.44.249l-1.654 5.207c-2.838.034-5.409.798-7.3 2.025-.474-.438-1.103-.712-1.799-.712-1.465 0-2.656 1.187-2.656 2.646 0 .97.533 1.811 1.317 2.271-.052.282-.086.567-.086.857 0 3.911 4.808 7.093 10.719 7.093s10.72-3.182 10.72-7.093c0-.274-.029-.544-.075-.81.832-.447 1.405-1.312 1.405-2.318zm-17.224 1.816c0-.868.71-1.575 1.582-1.575.872 0 1.581.707 1.581 1.575s-.709 1.574-1.581 1.574-1.582-.706-1.582-1.574zm9.061 4.669c-.797.793-2.048 1.179-3.824 1.179l-.013-.003-.013.003c-1.777 0-3.028-.386-3.824-1.179-.145-.144-.145-.379 0-.523.145-.145.381-.145.526 0 .65.647 1.729.961 3.298.961l.013.003.013-.003c1.569 0 2.648-.315 3.298-.962.145-.145.381-.144.526 0 .145.145.145.379 0 .524zm-.189-3.095c-.872 0-1.581-.706-1.581-1.574 0-.868.709-1.575 1.581-1.575s1.581.707 1.581 1.575-.709 1.574-1.581 1.574z"/></svg>
						</a>
					</li>
				</ul>
			</div>
			<div class="view line menu">'.$lang['link_page'].':<br>
				<input type="text" id="copy1" value="https://'.$_SERVER['HTTP_HOST'].'/file'.$id.'">
				<a class="copybtn" data-clipboard-target="#copy1">
					<span style="font-size: 13px;position: relative;top: -4px;left: 4px;cursor: pointer;font-style: normal;">'.$lang['copy_link'].'</span>
				</a>
			</div>
			<div class="view line menu">'.$lang['link_file'].':<br>
				<input type="text" id="copy2" value="https://'.$_SERVER['HTTP_HOST'].'/files/'.$file['file'].'">
				<a class="copybtn" data-clipboard-target="#copy2">
					<span style="font-size: 13px;position: relative;top: -4px;left: 4px;cursor: pointer;font-style: normal;">'.$lang['copy_link'].'</span>
				</a>
			</div>
			<div class="copied"><span>'.$lang['copied'].'.</span></div>
			<script src="/assets/js/clipboard.min.js"></script>
			<script>
				const clip = new Clipboard(".copybtn");
				clip.on("success", () => {
					$(".copied").fadeIn(800).fadeOut(2000);
				});
				const clipSelect = new Clipboard("[data-clipboard-target]");
				clipSelect.on("success", (e) => {
					e.clearSelection()
				});
			</script>
			<div class="menu view line">
				<div style="margin-bottom: 16px; font-size: 15px;">'.$lang['donate_text'].'</div>
				<a class="donate" href="https://yoomoney.ru/to/4100115868129347" target="_blank">
					<i class="material-icons">attach_money</i>
					<span>'.$lang['donate'].'</span>
				</a>
			</div>
			<div class="link dload">
				<a href="/up'.$id.'" target="_blank" style="text-align: center;" download><b>'.$lang['download'].'</b></a>
			</div>
		</div>
';

} else {
echo '
		<div class="block col-md-8">
			<h6 class="round_title">
				<a class="left" onclick="window.history.back();">
					<img src="/assets/img/left.svg" alt="back">
				</a>
				<div class="title back"><a href="/">'.$title.'</a> | '.$lang['enter_pass'].'</div>
			</h6>';

if (isset($_REQUEST['submit'])) {
	$pass = guard($_POST['pass']);
	if ($pass != $file['pass']) {
		error($lang['wrong_pass']);
	}
	setcookie('filepass', $file['pass'], time()+86400*365);
	go('/file'.$id);
}
echo '
			<div class="menu" style="position: relative;height: 158px;">
				<div class="empty pass">
					<div class="empty_words">'.$lang['enter_pass_for'].'!</div>
				</div>
			</div>
			<form action="" enctype="multipart/form-data" method="POST">

				<div class="menu" style="text-align: center;">
					<input type="number" name="pass" placeholder="'.$lang['password'].'" value="';
					if (isset($admin)) echo $file['pass'];
					echo '">
				</div>
				<div class="menu" style="text-align: center;padding-bottom: 16px;">
					<input class="btn" type="submit" name="submit" value="'.$lang['next'].'">
				</div>
			</form>
		</div>
';
echo '
		<div class="block col-md-8">
			<div class="title">'.$lang['nav'].'</div>
			<div class="link">
				<a href="/">'.$lang['go_home'].'</a>
			</div>
		</div>
';
}

?>