<?php
/**
* onArcade 2.1.0
* Copyright © 2006-2007 Hans Mäesalu & Eveterm OÜ, All Rights Reserved
**
* ONARCADE IS NOT FREE SOFTWARE!
* onArcade - Weren't you suppose to buy onArcade license?
**/
session_start();
require ('includes/config.php');
require ('templates/'. $settings['template'] .'/file.template.php');
require ('languages/'. $settings['language'] .'/file.lang.php');
$file_id = $_GET['f'];
if (!is_numeric($file_id) && strlen($file_id))
die('Bad hacker!!!');
switch ($_GET['a']) {
case 'rate':
if ($settings['rate'] == '1' || $settings['rate'] == '2' && $user['status'] == '1') {
$file_rating = $_GET['r'];
if (strlen($file_rating) == 1 && is_numeric($file_rating) && $file_rating >= 1 && $file_rating <= 5) {
$session_file = $_SESSION['rate_file'];
// Let's try to stop people from voting more than once
if ($session_file != $file_id) {
// And let's rate
$update_rating_query = mysql_query("UPDATE ". $tbl_prefix ."files SET totalvotes = totalvotes + 1, totalvotepoints = totalvotepoints + '". $file_rating ."', rating = totalvotepoints / totalvotes WHERE fileid = '". $file_id ."' LIMIT 1");
$_SESSION['rate_file'] = $file_id;
}
}
// Get the new value of rating
$file_rating_query = mysql_query("SELECT rating FROM ". $tbl_prefix ."files WHERE fileid = '". $file_id ."' && status = '1' LIMIT 1");
$file_rating_row = mysql_fetch_assoc($file_rating_query);
echo stars($file_rating_row['rating']);
}
break;
case 'report_broken':
if ($settings['report_broken'] == '0' || empty($file_id)) {
exit();
}
$report_comment = nohtml($_POST['comment']);
if (strlen($report_comment) > '100') {
$report_comment = substr($report_comment , 0, 100);
}
// Use sessions make sure that report isn't submited more than once
$session_file = $_SESSION['report_file'];
if ($session_file != $file_id) {
// Insert report to database
$report_add_query = mysql_query("INSERT INTO ". $tbl_prefix ."report_broken SET file_id = '". $file_id ."', comment = '". $report_comment ."', ip = '". $user['ip'] ."', date_reported = '". time() ."'");
$_SESSION['report_file'] = $file_id;
}
echo utf8_encode($lang['thanks_for_reporting']);
break;
case 'tellafriend':
if ($settings['tellfriend'] == '0') {
die('Tell a friend offline!!!');
}
$file_query = mysql_query("SELECT title FROM ". $tbl_prefix ."files WHERE fileid = '". $file_id ."' LIMIT 1");
if (mysql_num_rows($file_query) == 0)
no_page();
$file_row = mysql_fetch_assoc($file_query);
$file = array (
'id' => $file_id,
'title' => $file_row['title']
);
// Send email to friend
if (isset($_POST['submit'])) {
$tf_yourname = $_POST['yourname'];
$tf_youremail = $_POST['youremail'];
$tf_friendemail = $_POST['friendemail'];
$tf_verification_code = strtoupper($_POST['verification_code']);
// check image verification code
if ($settings['image_verification'] == '1') {
$verification_check_query = mysql_query("SELECT verification_code FROM ". $tbl_prefix ."online WHERE ip = '". $user['ip'] ."' && verification_code = '". $tf_verification_code ."'");
$verification_rows_number = mysql_num_rows($verification_check_query);
}
if ($verification_rows_number == '0' && $settings['image_verification'] == '1' || empty($tf_verification_code) && $settings['image_verification'] == '1') {
$file['error'] = $lang['invalid_verification_code'];
} else {
if (strlen($tf_yourname) && strlen($tf_youremail) && strlen($tf_friendemail)) {
if (preg_match(' /[\r\n,;\'"]/ ', $tf_youremail) || preg_match(' /[\r\n,;\'"]/ ', $tf_friendemail)) {
$file['error'] = $lang['invalid_email'];
} else {
$session_friend_email = $_SESSION['session_friend_email'];
if ($session_friend_email != $tf_friendemail) {
$email_header = 'Return-Path: '. $tf_youremail .'
From: '. $tf_yourname .' <'. $tf_youremail .'>
MIME-Version: 1.0
Content-type: text/plain';
// Lets send email to friend
include ('languages/'. $settings['language'] .'/email.lang.php');
@mail($tf_friendemail, $lang['check_out'], $lang['tell_a_friend_message'], $email_header);
$_SESSION['session_friend_email'] = $tf_friendemail;
}
// Load template
template_tellafriend2();
exit();
}
} else {
$file['error'] = $lang['all_fields_required'];
}
}
}
$page_title = $lang['tell_a_friend'];
// Load template
template_tellafriend();
break;
case 'comments':
if ($settings['comments'] == '0') {
exit();
}
// Comments page number
$comments_page = $_GET['p'];
if (empty($comments_page) || !is_numeric($comments_page) || $comments_page == 0) {
$comments_page = 1;
}
$comments_number_query = mysql_query("SELECT count(*) FROM ". $tbl_prefix ."comments WHERE fileid = '". $file_id ."' && status = '1'");
$comments_number_row = mysql_fetch_assoc($comments_number_query);
$pages_count = ceil($comments_number_row['count(fileid)'] / $settings['max_comments']);
$navigation = NULL;
for ($pagen = 1; $pagen <= $pages_count; $pagen++) {
if ($pagen == $comments_page) {
$navigation .= ' <b>'. $pagen .'</b>';
} else {
$navigation .= ' <a href="" onclick="display_comments('. $file_id .', '. $pagen .'); return false;">'. $pagen .'</a>';
}
}
$start_here = ($comments_page - 1) * $settings['max_comments'];
$comments_query = mysql_query("SELECT * FROM ". $tbl_prefix ."comments WHERE fileid = '". $file_id ."' && status = '1' ORDER BY commentid DESC LIMIT ". $start_here .", ". $settings['max_comments']);
while ($comments_row = mysql_fetch_assoc($comments_query)) {
if ($comments_row['userid'] == '0' || empty($comments_row['username'])) {
$poster_username = $lang['guest'];
} else {
$poster_username = '<a href="'. profileurl($comments_row['userid'], $comments_row['username']) .'">'. $comments_row['username'] .'</a>';
}
$comments[] = array (
'comment' => utf8_encode(word_filter(bbcode(nl2br(nohtml($comments_row['comment']))))),
'date' => mod_date($comments_row['dateadded']),
'user' => $poster_username
);
}
// Load template
template_display_comments();
break;
case 'make_favourite':
// Do nothing if user not logged in
if ($user['status'] != '1') {
exit();
}
$user_favourites = NULL;
if (strlen($user_row['favourites'])) {
$user_favourites = unserialize($user_row['favourites']);
$user_favourites[$file_id] = $file_id;
$update_favourite_query = mysql_query("UPDATE ". $tbl_prefix ."users SET favourites = '". serialize($user_favourites) ."' WHERE userid = '". $user['id'] ."' LIMIT 1");
} else {
$user_favourites[$file_id] = $file_id;
$update_favourite_query = mysql_query("UPDATE ". $tbl_prefix ."users SET favourites = '". serialize($user_favourites) ."' WHERE userid = '". $user['id'] ."' LIMIT 1");
}
echo utf8_encode($lang['file_added_favourites']);
break;
case 'remove_favourite':
// Do nothing if user not logged in
if ($user['status'] != '1') {
exit();
}
$user_favourites = NULL;
if (strlen($user_row['favourites'])) {
$user_favourites = unserialize($user_row['favourites']);
unset($user_favourites[$file_id]);
$update_favourite_query = mysql_query("UPDATE ". $tbl_prefix ."users SET favourites = '". serialize($user_favourites) ."' WHERE userid = '". $user['id'] ."' LIMIT 1");
}
echo utf8_encode($lang['file_removed_favourites']);
break;
case 'popup':
if ($user['plays_left'] <= 0 && $user['status'] == 0 && $settings['guestcredits'] == 1) {
$blank_page = array (
'title' => $settings['sitename'],
'content' => $lang['you_no_more_plays_left']
);
$page_title = $lang['you_no_more_plays_left'];
// Load template
template_blank_page($blank_page);
exit();
}
$file_query = mysql_query("
SELECT
file.title, file.file, file.filelocation, file.filetype, file.width, file.height, cat.permissions, cat.status
FROM
". $tbl_prefix ."files AS file
LEFT JOIN ". $tbl_prefix ."categories AS cat ON (cat.catid = file.category)
WHERE
file.fileid = '". $file_id ."' && file.status = '1' LIMIT 1");
$file_row = mysql_fetch_assoc($file_query);
if (empty($file_row))
no_page();
// Some category related stuff
if ($file_row['status'] == 0)
no_page();
if ($file_row['permissions'] == 2 && $user['status'] != '1')
please_log_in();
// Direct URL to file
if ($file_row['filelocation'] == '1') {
$file_url = $settings['siteurl'] .'/files/'. $settings['filesdir'] .'/'. $file_row['file'];
} else {
$file_url = $file_row['file'];
}
// Load player for file
$play_file = file_get_contents('includes/file_type/'. $file_row['filetype'] .'.php');
// Replace variables
$play_file = str_replace('{$width}', $file_row['width'], $play_file);
$play_file = str_replace('{$height}', $file_row['height'], $play_file);
$play_file = str_replace('{$file_url}', $file_url, $play_file);
$play_file = str_replace('{$siteurl}', $settings['siteurl'], $play_file);
$file = array (
'play_file' => $play_file
);
$page_title = $file_row['title'];
// Load template
template_new_window();
break;
case 'submit_comment':
if ($user['plays_left'] <= 0 && $user['status'] == 0 && $settings['guestcredits'] == 1 || $settings['comments'] == '0') {
exit();
}
$file_query = mysql_query("SELECT fileid FROM ". $tbl_prefix ."files WHERE fileid = '". $file_id ."' && status = '1' LIMIT 1");
if (mysql_num_rows($file_query) == 0) {
exit();
}
// Add comment
if ($settings['comments_who'] == '1' || $settings['comments_who'] == '2' && $user['status'] == '1') {
$comment_text = $_POST['message'];
if (empty($comment_text)) {
echo utf8_encode($lang['comment_empty']);
} else {
$banned_ips = explode(' ', $settings['comments_banned_ip']);
if (in_array($user['ip'], $banned_ips)) {
echo utf8_encode($lang['ip_has_been_banned']);
} else {
$last_comment_sql = mysql_query("SELECT dateadded FROM ". $tbl_prefix ."comments WHERE ip = '". $user['ip'] ."' ORDER BY commentid DESC LIMIT 1");
$last_comment_row = mysql_fetch_assoc($last_comment_sql);
$categoryname = $last_comment_row['dateadded'];
// Flood protection
if (time() - $last_comment_row['dateadded'] > $settings['comments_flood_time']) {
if ($settings['comments_approval'] == '0' || $settings['comments_approval'] == '1' && $user['status'] == '1') {
$comment_error = $lang['comment_added'];
$comment_query = mysql_query("INSERT INTO ". $tbl_prefix ."comments SET fileid = '". $file_id ."', userid = '". $user['id'] ."', username = '". $user['username'] ."', comment = '". $comment_text ."', ip = '". $user['ip'] ."', dateadded = '". time() ."', status = '1'");
} else {
$comment_error = $lang['comment_awaiting_approval'];
$comment_query = mysql_query("INSERT INTO ". $tbl_prefix ."comments SET fileid = '". $file_id ."', userid = '". $user['id'] ."', username = '". $user['username'] ."', comment = '". $comment_text ."', ip = '". $user['ip'] ."', dateadded = '". time() ."', status = '0'");
}
// Update comments
if ($user['status'] == '1') {
$user['comments'] = $user['comments'] + 1;
$update_user_comments = mysql_query("UPDATE ". $tbl_prefix ."users SET comments = '". $user['comments'] ."' WHERE userid = '". $user['id'] ."'");
}
echo utf8_encode($comment_error);
} else {
echo utf8_encode($lang['comment_flood_text']);
}
}
}
}
break;
default:
if ($user['plays_left'] <= 0 && $user['status'] == 0 && $settings['guestcredits'] == '1') {
$blank_page = array(
'title' => $settings['sitename'],
'content' => $lang['you_no_more_plays_left']
);
$page_title = $lang['you_no_more_plays_left'];
// Load template
template_blank_page($blank_page);
exit();
}
// Show ad before file
if (($settings['before_file_ad'] == '1' || ($settings['before_file_ad'] == '2' && $user['status'] == 0)) && $_SESSION['ad_before'] != TRUE) {
$ad_query = mysql_query("SELECT ad_code FROM ". $tbl_prefix ."ads WHERE status = '1' && ad_zone = '4' ORDER BY rand() LIMIT 1");
$ad = mysql_fetch_assoc($ad_query);
$blank_page = array(
'title' => $lang['sponsor'],
'content' => $ad['ad_code'] .'
<br /><br /><a href="" onclick="window.location.reload(true);">Click here if you do not wish to wait...</a>
<script type=text/javascript>
setTimeout("window.location.reload(true);", 10000);
</script>'
);
// Make it so that ad isn't showed too often
$_SESSION['ad_before'] = TRUE;
// Load template
template_blank_page($blank_page);
exit();
}
// Get file information from database
$file_sql = "
SELECT
file.*, cat.name AS category_name, cat.permissions, cat.status AS category_status";
if ($settings['added_by'] == '1')
$file_sql .= ", ad.username AS adder_username";
if ($settings['sponsor'] == '1')
$file_sql .= ", sponsor.sponsor_title, sponsor.sponsor_url";
$file_sql .= "
FROM
". $tbl_prefix ."files AS file
LEFT JOIN ". $tbl_prefix ."categories AS cat ON (cat.catid = file.category)";
if ($settings['added_by'] == '1')
$file_sql .= " LEFT JOIN ". $tbl_prefix ."users AS ad ON (ad.userid = file.added_by)";
if ($settings['sponsor'] == '1')
$file_sql .= " LEFT JOIN ". $tbl_prefix ."sponsors AS sponsor ON (sponsor.file_id = file.fileid)";
$file_sql .= "
WHERE file.fileid = '". $file_id ."' && file.status = '1'
LIMIT 1";
$file_query = mysql_query($file_sql);
$file_row = mysql_fetch_assoc($file_query);
// Show 404 if no file
if (empty($file_row))
no_page();
// Show 404 if category disabled
if ($file_row['category_status'] == 0)
no_page();
// Show login if guest now allowed
if ($file_row['permissions'] == 2 && $user['status'] != '1')
please_log_in();
// So the user is *****...
if ($_GET['a'] == '*****') {
$update_*****_query = mysql_query("UPDATE ". $tbl_prefix ."online SET ***** = '1' WHERE ip = '". $user['ip'] ."' && isonline = '1'");
$_SESSION['*****'] = '1';
}
// ***** verification for ***** games
if ($file_row['*****'] == '1' && $_SESSION['*****'] != '1') {
$*****_verification_query = mysql_query("SELECT ***** FROM ". $tbl_prefix ."online WHERE ip = '". $user['ip'] ."' && isonline = '1' && ***** = '1' LIMIT 1");
$*****_verification_row = mysql_fetch_assoc($*****_verification_query);
if ($*****_verification_row['*****'] == '1') {
// So the user is *****, there is no need to ask him the question again
$_SESSION['*****'] = '1';
} else {
$lang['warning_*****_content'] = str_replace('{$file_id}', $file_id, $lang['warning_*****_content']);
$blank_page = array (
'title' => $settings['sitename'],
'content' => $lang['warning_*****_content']
);
$page_title = $lang['*****_verification'];
// Load template
template_blank_page($blank_page);
exit();
}
}
// Update statistics
$times_played = $file_row['timesplayed'] + 1;
$stats['played_today'] = $stats['played_today'] + 1;
$stats['total_played'] = $stats['total_played'] + 1;
if ($user['status'] == '1') {
$user['played'] = $user['played'] + 1;
$update_played_query = mysql_query("
UPDATE
". $tbl_prefix ."files, ". $tbl_prefix ."statistics, ". $tbl_prefix ."users
SET
". $tbl_prefix ."files.timesplayed = '". $times_played ."', ". $tbl_prefix ."statistics.played_today = '". $stats['played_today'] ."', ". $tbl_prefix ."statistics.total_played = '". $stats['total_played'] ."', ". $tbl_prefix ."users.played = '". $user['played'] ."'
WHERE
". $tbl_prefix ."files.fileid = '". $file_row['fileid'] ."' && ". $tbl_prefix ."statistics.stats_id = '". $stats['id'] ."' && ". $tbl_prefix ."users.userid = '". $user['id'] ."'
");
} elseif ($user['status'] == '0' && $settings['guestcredits'] == '1') {
$update_played_query = mysql_query("
UPDATE
". $tbl_prefix ."files, ". $tbl_prefix ."statistics, ". $tbl_prefix ."online
SET
". $tbl_prefix ."files.timesplayed = '". $times_played ."', ". $tbl_prefix ."statistics.played_today = '". $stats['played_today'] ."', ". $tbl_prefix ."statistics.total_played = '". $stats['total_played'] ."', ". $tbl_prefix ."online.played = ". $tbl_prefix ."online.played + 1
WHERE
". $tbl_prefix ."files.fileid = '". $file_row['fileid'] ."' && ". $tbl_prefix ."statistics.stats_id = '". $stats['id'] ."' && ". $tbl_prefix ."online.ip = '". $user['ip'] ."'
");
} else {
$update_played_query = mysql_query("
UPDATE
". $tbl_prefix ."files, ". $tbl_prefix ."statistics
SET
". $tbl_prefix ."files.timesplayed = '". $times_played ."', ". $tbl_prefix ."statistics.played_today = '". $stats['played_today'] ."', ". $tbl_prefix ."statistics.total_played = '". $stats['total_played'] ."'
WHERE
". $tbl_prefix ."files.fileid = '". $file_row['fileid'] ."' && ". $tbl_prefix ."statistics.stats_id = '". $stats['id'] ."'
");
}
// Get adder
if ($settings['added_by'] == '1') {
if (!empty($file_row['added_by'])) {
$added_by_username = '<a href="'. profileurl($file_row['added_by'], nohtml($file_row['adder_username'])) .'">'. nohtml($file_row['adder_username']) .'</a>';
}
}
// Check if file is favourite
if (isset($user_row['favourites']) && strlen($user_row['favourites'])) {
$user_favourites = unserialize($user_row['favourites']);
if (in_array($file_row['fileid'], $user_favourites)) {
$is_favourite = TRUE;
} else {
$is_favourite = FALSE;
}
} else {
$is_favourite = FALSE;
}
// If file is framed then lets frame it
if ($file_row['filelocation'] == '3') {
$file = array (
'id' => $file_row['fileid'],
'title' => $file_row['title'],
'description' => $file_row['description'],
'file' => $file_row['file'],
'played' => number_format($times_played),
'rating' => $file_row['rating'],
'favourite' => $is_favourite
);
$settings['sitedescription'] = $file['description'];
if (strlen($file_row['keywords'])) {
$settings['sitekeywords'] = $settings['sitekeywords'] .', '. $file_row['keywords'];
}
$page_title = $file['title'];
// Load template
template_frame();
exit();
}
// Find best score
if ($file_row['scores'] == '1') {
$best_score_query = mysql_query("SELECT user_id, username, score FROM ". $tbl_prefix ."scores WHERE is_high = '1' && file_id = '". $file_row['fileid'] ."'");
if (mysql_num_rows($best_score_query) == 0) {
$best_score_user = $lang['no_one'];
$best_score = '0';
} else {
$best_score_row = mysql_fetch_assoc($best_score_query);
$best_score_user = '<a href="'. profileurl($best_score_row['user_id'], $best_score_row['username']) .'">'. $best_score_row['username'] .'</a>';
$best_score = number_format($best_score_row['score'], 1);
}
// Replace some variables
$lang['is_champion_with_score'] = str_replace('{$best_score_user}', $best_score_user, $lang['is_champion_with_score']);
$lang['is_champion_with_score'] = str_replace('{$file_title}', $file_row['title'], $lang['is_champion_with_score']);
$lang['is_champion_with_score'] = str_replace('{$best_score}', $best_score, $lang['is_champion_with_score']);
}
// Direct URL to file
if ($file_row['filelocation'] == '1') {
$file_url = $settings['siteurl'] .'/files/'. $settings['filesdir'] .'/'. $file_row['file'];
} else {
$file_url = $file_row['file'];
}
// Direct URL to image
if ($file_row['iconlocation'] == '1') {
$image_url = $settings['siteurl'] .'/files/image/'. $file_row['icon'];
} else {
$image_url = $file_row['icon'];
}
// Add to your website text
$add_your_website = '<img src = "'. $image_url .'" border="0" alt="'. $file_row['title'] .'" title="'. $file_row['title'] .'" /><br /><a href="'. fileurl($file_row['fileid'],$file_row['title']) .'">'. $file_row['title'] .'</a>';
// Get the file displaying code
if ($file_row['width'] > $settings['max_file_width'] && $settings['auto_resize'] == '0' || $file_row['height'] > $settings['max_file_height'] && $settings['auto_resize'] == '0') {
$play_file = '<a href="" onclick="window.open(\''. $settings['siteurl'] .'/file.php?f='. $file_row['fileid'] .'&a=popup\', \'\', \'width='. $file_row['width'] .',height='. $file_row['height'] .',menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0\'); return false;">'. $lang['open_file_in_new_window'] .'</a>';
} elseif ($file_row['filetype'] == 'code') {
$play_file = $file_row['customcode'];
} else {
// Resize if file is too big
if ($file_row['width'] > $settings['max_file_width']) {
$size_change = $file_row['width'] / $settings['max_file_width'];
$file_row['width'] = $settings['max_file_width'];
$file_row['height'] = round($file_row['height'] / $size_change);
}
if ($file_row['height'] > $settings['max_file_height']) {
$size_change = ($file_row['height'] / $settings['max_file_height']);
$file_row['height'] = $settings['max_file_height'];
$file_row['width'] = round($file_row['width'] / $size_change);
}
// Load player for file
$play_file = file_get_contents('includes/file_type/'. $file_row['filetype'] .'.php');
// Replace variables
$play_file = str_replace('{$width}', $file_row['width'], $play_file);
$play_file = str_replace('{$height}', $file_row['height'], $play_file);
$play_file = str_replace('{$file_url}', $file_url, $play_file);
$play_file = str_replace('{$siteurl}', $settings['siteurl'], $play_file);
}
// Set session for v3 games
$_SESSION['file_id'] = $file_row['fileid'];
$file = array (
'id' => $file_row['fileid'],
'title' => $file_row['title'],
'description' => $file_row['description'],
'played' => number_format($times_played),
'added' => mod_date($file_row['dateadded']),
'rating' => $file_row['rating'],
'added_by' => $added_by_username,
'play_file' => $play_file,
'scores' => $file_row['scores'],
'add_your_website' => $add_your_website,
'cat_title' => $file_row['category_name'],
'cat_url' => categoryurl($file_row['category'], $file_row['category_name'], 1),
'favourite' => $is_favourite,
'sponsor' => (strlen($file_row['sponsor_title']) ? '<a href="'. $file_row['sponsor_url'] .'" target="_blank">'. $file_row['sponsor_title'] .'</a>' : '<a href="'. $settings['siteurl'] .'/sponsor.php?f='. $file_row['fileid'] .'">'. $lang['your_link_here'] .'</a>'),
'comment_error' => $comment_error
);
if ($settings['comments'] == '1') {
// Build navigation menu
$comments_number_query = mysql_query("SELECT count(*) FROM ". $tbl_prefix ."comments WHERE fileid = '". $file_id ."' && status = '1'");
$comments_number_row = mysql_fetch_assoc($comments_number_query);
$pages_count = ceil($comments_number_row['count(fileid)'] / $settings['max_comments']);
$navigation = NULL;
for ($pagen = 1; $pagen <= $pages_count; $pagen++) {
if ($pagen == 1) {
$navigation .= ' <b>'. $pagen .'</b>';
} else {
$navigation .= ' <a href="" onclick="display_comments('. $file_id .', '. $pagen .'); return false;">'. $pagen .'</a>';
}
}
// Get comments
$comments_query = mysql_query("SELECT * FROM ". $tbl_prefix ."comments WHERE fileid = '". $file_id ."' && status = '1' ORDER BY commentid DESC LIMIT 0, ". $settings['max_comments']);
while ($comments_row = mysql_fetch_assoc($comments_query)) {
if ($comments_row['userid'] == '0' || empty($comments_row['username'])) {
$poster_username = $lang['guest'];
} else {
$poster_username = '<a href="'. profileurl($comments_row['userid'], $comments_row['username']) .'">'. $comments_row['username'] .'</a>';
}
$comments[] = array (
'comment' => word_filter(bbcode(nl2br(nohtml($comments_row['comment'])))),
'date' => mod_date($comments_row['dateadded']),
'user' => $poster_username
);
}
}
if ($settings['related_files'] == '1') {
$related_query = mysql_query("SELECT fileid, title, description, icon, iconlocation, timesplayed FROM ". $tbl_prefix ."files WHERE category = '". $file_row['category'] ."' && status ='1' && fileid != '". $file_row['fileid'] ."' ORDER BY RAND() LIMIT ". $settings['max_related_files']);
while ($related_row = mysql_fetch_assoc($related_query)) {
if ($related_row['iconlocation'] == '1') {
$image_url = $settings['siteurl'] .'/files/image/'. $related_row['icon'];
} else {
$image_url = $related_row['icon'];
}
$related_files[] = array (
'title' => $related_row['title'],
'url' => fileurl($related_row['fileid'],$related_row['title'],1),
'description' => $related_row['description'],
'image' => $image_url
);
}
}
// Get ad
if ($settings['file_ad'] == '1') {
$ad_query = mysql_query("SELECT ad_code FROM ". $tbl_prefix ."ads WHERE status = '1' && ad_zone = '3' ORDER BY rand() LIMIT 1");
$ad = mysql_fetch_assoc($ad_query);
$ads['file'] = $ad['ad_code'];
}
$settings['sitedescription'] = $file['description'];
if (strlen($file_row['keywords'])) {
$settings['sitekeywords'] = $settings['sitekeywords'] .', '. $file_row['keywords'];
}
$page_title = $file['title'];
// Load template
template_file();
}
?>file.php Kodlar