This commit is contained in:
3err0
2019-05-18 13:46:03 +08:00
commit 55e0adfa17
707 changed files with 55878 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
if ($is_logged)
{
if ($_REQUEST['code'] == "01")
{
$db->query("UPDATE " . PREFIX . "_users SET forum_last = '$_TIME', forum_time = '$_TIME' WHERE name = '$member_id[name]'");
$db->query("DELETE FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$_SESSION['forum_last'] = $_TIME;
@header("Location: {$forum_url}");
}
if ($cstart)
{
$cstart = $cstart - 1;
$cstart = $cstart * $forum_config['topic_inpage'];
}
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$topic_views = array();
while ($row = $db->get_row($row_views))
{
$topic_views[$row['topic_id']] = '1';
}
$config_inpage = $forum_config['topic_inpage'];
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_topics WHERE UNIX_TIMESTAMP(last_date) > '$lasttime' and hidden = 0 LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
if (!$is_topics)
{
$msg_info = $f_lang['is_topics'];
}
$get_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE UNIX_TIMESTAMP(last_date) > '$lasttime' and hidden = 0");
$count_all = $get_count['count'];
$icat = $forum_url."/getnew/";
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
$tpl->load_template($tpl_dir.'forum.tpl');
$tpl->set('{banner}', '');
$tpl->set('{forum}', $f_lang['getnew_title']);
$tpl->set('{subforums}','');
$tpl->set('{topics}', $tpl->result['topics']);
$tpl->set('{info}', $msg_info);
$tpl->set('{navigation}', $tpl->result['navigation']);
$all_read_link = "<a href=\"{$a_forum_url}act=getnew&code=01\">{$f_lang['all_read_link']}</a>";
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si", $all_read_link);
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['f_msg'], $f_lang['page_deny'], 'user_group', $group_name);
}
$bbr_app = $f_lang['app_getnew'];
?>

View File

@@ -0,0 +1,250 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if (isset($_REQUEST['search_text']))
{
$search_text = substr ( strip_data( $_REQUEST['search_text'] ), 0, 90 );
$search_text_explode = explode (' ', $search_text);
if (count($search_text_explode))
{
foreach ($search_text_explode as $key => $value)
{
$value = trim ($value);
if ($value !== "" and strlen($value) > 3)
{
$search_text_array[] = $value;
}
}
if (count($search_text_array))
{
$search_list = implode('|', $search_text_array);
}
}
}
$search_fid = $_REQUEST['search_fid'];
$count_all = intval($_REQUEST['count_all']);
if ($forum_config['search_captcha'])
{
$search_captcha = check_access($forum_config['search_captcha']);
}
if ($search_captcha)
{
if ($_REQUEST['sec_code'])
{
$_SESSION['captcha_search'] = $_REQUEST['sec_code'];
}
if ($_SESSION['captcha_search'] == $_SESSION['sec_code_session'])
{
$search_captcha_true = TRUE;
}
}
else
{
$search_captcha_true = TRUE;
}
if ($search_list AND $search_captcha_true)
{
if ($search_fid)
{
$_SESSION['search_fid'] = $search_fid;
}
if ($is_logged)
{
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$topic_views = array();
while ($row = $db->get_row($row_views))
{
$topic_views[$row['topic_id']] = '1';
}
}
else
{
$row_views = explode(",", $_COOKIE['dle_forum_views']);
foreach ($row_views as $value)
{
$topic_views[$value] = '1';
}
}
if ($cstart){
$cstart = $cstart - 1;
$cstart = $cstart * $forum_config['topic_inpage'];
}
$config_inpage = $forum_config['topic_inpage'];
if ($search_fid)
{
if (is_array($search_fid))
{
$hole_arr = array();
foreach ($search_fid as $hole)
{
$hole_arr[] = intval($hole);
}
$fid_list = implode(',', $hole_arr);
}
else
{
$fid_list = intval($search_fid);
}
}
$fid_q = $fid_list ? "and forum_id IN ({$fid_list}) " : "";
if ($_REQUEST['search_in'] == "titles")
{
$mysql_query = "SELECT * FROM " . PREFIX . "_forum_topics
WHERE title REGEXP ('$search_list') ".$fid_q."and hidden = 0
OR topic_descr REGEXP ('$search_list') ".$fid_q."and hidden = 0";
$count_query = "SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics
WHERE title REGEXP ('$search_list') ".$fid_q."and hidden = 0
OR topic_descr REGEXP ('$search_list') ".$fid_q."and hidden = 0";
}
else
{
$mysql_query = "SELECT p.*, t.* FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . PREFIX . "_forum_topics AS t ON t.tid = p.topic_id
WHERE p.post_text REGEXP ('$search_list') ".$fid_q."and p.hidden = 0 GROUP BY t.tid";
$count_query = "SELECT SQL_CALC_FOUND_ROWS * FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . PREFIX . "_forum_topics AS t
ON t.tid = p.topic_id
WHERE p.post_text REGEXP ('$search_list') ".$fid_q."and p.hidden = 0 GROUP BY t.tid";
}
$result_topics = $db->query("" . $mysql_query . " LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
if (!$count_all)
{
if ($_REQUEST['search_in'] == "titles")
{
$count_get = $db->super_query ($count_query);
$count_all = $count_get['count'];
}
else
{
$count_all = $db->num_rows($db->query($count_query));
}
}
if ($count_all){
if ($forum_config['mod_rewrite'])
{
$icat = $forum_url . "/search/" . $count_all . "-" . urlencode($search_text) ."/";
}
else
{
$icat = $forum_url."act=search&count_all=".$count_all."&search_text=".urlencode($search_text)."&cstart=";
}
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
$tpl->load_template($tpl_dir.'forum.tpl');
$tpl->set('{forum}', $f_lang['search_result']);
$tpl->set('{subforums}','');
$tpl->set('{topics}', $tpl->result['topics']);
$tpl->set('{info}', $msg_info);
$tpl->set('{navigation}', $tpl->result['navigation']);
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si", '');
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
$tpl->compile('dle_forum');
$tpl->clear();
}
else
{
forum_msg($f_lang['f_msg'], $f_lang['search_nresult']);
}
}
elseif ($_REQUEST['search_text'] and $search_maxlen)
{
forum_msg($f_lang['f_msg'], $f_lang['search_error']);
}
else
{
$_SESSION['search_fid'] = "";
$tpl->load_template($tpl_dir.'search.tpl');
$tpl->copy_template = "<form method=\"post\" action=\"\">".$tpl->copy_template."</form>";
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_category LEFT JOIN ". PREFIX ."_forum_forums ON ". PREFIX ."_forum_category.sid=". PREFIX ."_forum_forums.main_id ORDER BY posi, position");
$select_list = "<select name='search_fid[]' size='10' multiple='multiple'>";
$select_list .= "<option value='0' selected='selected'>&raquo; Âñå ôîðóìû</option>";
for ($i = 0, $totalcount = 0; $row = $db->get_row($result); $i = $row['sid'], $chcount++)
{
if ($row['sid'] != $i)
{
$row['cat_name'] = stripslashes($row['cat_name']);
$select_list .= "<optgroup label=\"{$row['cat_name']}\">";
}
if ($row['name'])
{
$row['name'] = stripslashes($row['name']);
$select_list .= "<option value=\"{$row['id']}\"> -- {$row['name']}</option>";
}
}
$select_list .= "</select>";
$tpl->set('{forum_select}',$select_list);
$tpl->compile('dle_forum');
$tpl->clear();
}
$bbr_app = $f_lang['app_search'];
?>

View File

@@ -0,0 +1,113 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$act = $_REQUEST['act'];
if ($forum_config['stats'] AND !$act)
{
$stats_array = array();
$today_date = date('d');;
$stats_array = $fcache->get('stats');
if (!$stats_array OR $stats_array['date'] != $today_date)
{
$stats_array = FALSE;
$stats_array = array();
$row_post = $db->super_query("SELECT COUNT(pid) as count FROM " . PREFIX . "_forum_posts");
$stats_array['posts'] = $row_post['count'];
$row_topic = $db->super_query("SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics");
$stats_array['topics'] = $row_topic['count'];
$row_users_reg = $db->super_query("SELECT COUNT(user_id) as count FROM " . PREFIX . "_users");
$stats_array['users_reg'] = $row_users_reg['count'];
$row_users = $db->super_query("SELECT COUNT(user_id) as count FROM " . PREFIX . "_users WHERE forum_post");
$stats_array['users'] = $row_users['count'];
$result_users = $db->query("SELECT * FROM " . PREFIX . "_users WHERE forum_post ORDER BY forum_post DESC LIMIT 10");
while ($row = $db->get_row($result_users))
{
$top_count++;
if ($top_count > 1)
{
$symbol = ", ";
}
$group_span = $user_group[$row['user_group']]['colour'];
$a_top_users = "{$config['http_home_url']}user/".urlencode($row['name'])."/";
$stats_array['top_users'] .= $symbol."<a href=\"{$a_top_users}\"><span style=\"color:{$group_span}\">$row[name]</span></a>";
}
if (!$stats_array['top_users'])
{
$stats_array['top_users'] = "--";
}
$stats_array['date'] = $today_date;
$last_user_row = $db->super_query("SELECT * FROM " . PREFIX . "_users ORDER BY user_id DESC LIMIT 1");
$stats_array['last_user'] = link_user($last_user_row['name']);
$stats_array['max_online'] = $max_online['count'];
$stats_array['max_online_time'] = langdate('j F Y, H:i', $max_online['time']);
$fcache->set('stats', $stats_array);
}
// tpl compile //
$tpl->load_template($tpl_dir.'stats.tpl');
if ($forum_config['online'] and $forum_config['sessions_log'])
{
get_forum_online();
$tpl->set('[online-stats]','');
$tpl->set('[/online-stats]','');
}
else
{
$tpl->set_block("'\\[online-stats\\](.*?)\\[/online-stats\\]'si","");
}
$tpl->set('{post-num}', $stats_array['posts']);
$tpl->set('{topic-num}', $stats_array['topics']);
$tpl->set('{all-users}', $stats_array['users_reg']);
$tpl->set('{forum-users}', $stats_array['users']);
$tpl->set('{top-users}', $stats_array['top_users']);
$tpl->set('{online-num}', $forum_online['all_count']);
$tpl->set('{member_count}', $forum_online['member_count']);
$tpl->set('{guest_count}', $forum_online['guest_count']);
$tpl->set('{online_time}', $forum_config['session_time']);
if (!$forum_online['member_list'])
{
$forum_online['member_list'] = ""; // default value: --
}
$tpl->set('{member_online}', $forum_online['member_list']);
$tpl->set('{last_user}', $stats_array['last_user']);
$tpl->set('{max_online}', $stats_array['max_online']);
$tpl->set('{max_online_time}', $stats_array['max_online_time']);
$tpl->compile('forum_stats');
$tpl->clear();
}
?>

View File

@@ -0,0 +1,154 @@
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$code = $_REQUEST['code'];
$tid = intval($_REQUEST['tid']);
$selected_id = $_REQUEST['selected_id'];
if ($is_logged)
{
switch ($code)
{
// ********************************************************************************
// ADD
// ********************************************************************************
case "add":
$db->query("SELECT * FROM " . PREFIX . "_forum_subscription WHERE topic_id = '$tid' and user_id = '{$member_id['user_id']}'");
if (!$db->num_rows() and $tid)
{
$db->query("INSERT INTO " . PREFIX . "_forum_subscription (user_id, topic_id) values ('{$member_id['user_id']}', '$tid')");
}
header("Location: $_SERVER[HTTP_REFERER]");
break;
// ********************************************************************************
// DEL
// ********************************************************************************
case "del":
if ($selected_id)
{
$selected_id = explode(",", $selected_id);
foreach ($selected_id as $topic_id)
{
$db->query("DELETE FROM " . PREFIX . "_forum_subscription WHERE topic_id = '$topic_id' and user_id = '{$member_id['user_id']}'");
}
}
header("Location: $_SERVER[HTTP_REFERER]");
break;
// ********************************************************************************
// SUBSCRIPTION
// ********************************************************************************
default:
if ($cstart)
{
$cstart = $cstart - 1;
$cstart = $cstart * $forum_config['topic_inpage'];
}
if ($forum_config['topic_sort'])
{
$sort_type = "last_date";
}
else
{
$sort_type = "tid";
}
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
$topic_views = array();
while ($row = $db->get_row($row_views))
{
$topic_views[$row['topic_id']] = '1';
}
$config_inpage = $forum_config['topic_inpage'];
$result_count = $db->super_query("SELECT count(*) as count FROM " . PREFIX . "_forum_subscription LEFT JOIN " . PREFIX . "_forum_topics ON " . PREFIX . "_forum_subscription.topic_id = " . PREFIX . "_forum_topics.tid WHERE " . PREFIX . "_forum_subscription.user_id = '{$member_id['user_id']}'");
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_subscription LEFT JOIN " . PREFIX . "_forum_topics ON " . PREFIX . "_forum_subscription.topic_id = " . PREFIX . "_forum_topics.tid WHERE " . PREFIX . "_forum_subscription.user_id = '{$member_id['user_id']}'");
$mass_prune = true;
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
if (!$is_topics)
{
$msg_info = $f_lang['subscr_not'];
}
$tpl->load_template($tpl_dir.'forum.tpl');
$tpl->set('{banner}', '');
$tpl->set('{forum}', $f_lang['app_subscr']);
$tpl->set('{subforums}','');
$tpl->set('{topics}', $tpl->result['topics']);
$tpl->set('{info}', $msg_info);
$tpl->set('{navigation}', $tpl->result['navigation']);
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si","");
$tpl->set('[selected]',"");
$tpl->set('[/selected]',"");
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
$tpl->set('[moderation]',"<form name=\"modform\" method=\"post\" action=\"\">"); //{$a_forum_url}act=subscription
$moderation = "<select name=\"code\">";
$moderation .= "<option value=\"del\">Îòïèñàòüñÿ</option>";
$moderation .= "</select>";
$tpl->set('{moderation}', $moderation);
$tpl->set('[/moderation]',"<input type=\"hidden\" value=\"\" name=\"selected_id\" /></form>");
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
$tpl->compile('dle_forum');
$tpl->clear();
break;
}
}
else
{
$group_name = $user_group[$member_id['user_group']]['group_name'];
forum_msg($f_lang['f_msg'], $f_lang['page_deny'], 'user_group', $group_name);
}
if ($forum_config['forum_bar'])
{
$bbr_app = $f_lang['app_subscr'];
}
?>

View File

@@ -0,0 +1,375 @@
<?php
@session_start();
error_reporting(7);
ini_set('display_errors', true);
ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define('ROOT_DIR', '../../../..');
define('SYSTEM_DIR', ROOT_DIR.'/system');
define('UPLOAD_DIR', ROOT_DIR."/uploads/forum/");
require SYSTEM_DIR."/data/config.php";
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR."/data/dbconfig.php";
require_once SYSTEM_DIR."/modules/functions.php";
require_once SYSTEM_DIR.'/data/forum_config.php';
$allowed_video = array("avi", "mp4", "wmv", "mpg", "flv");
// ********************************************************************************
// File Type
// ********************************************************************************
function file_type($name){
$type = explode ('.', $name);
$type = end ($type);
return ($type);
}
check_xss ();
$area = $_REQUEST['area'];
$do = $_REQUEST['do'];
$fid = intval($_REQUEST['fid']);
$tid = intval($_REQUEST['tid']);
$pid = intval($_REQUEST['pid']);
$del = $_REQUEST['del'];
$user_group = $cache->get ("usergroup");
if (!$user_group) {
$user_group = array ();
$db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
while($row = $db->get_row()){
$user_group[$row['id']] = array ();
foreach ($row as $key => $value)
{
$user_group[$row['id']][$key] = $value;
}
}
$cache->set ("usergroup", $user_group);
$db->free();
}
include_once SYSTEM_DIR.'/modules/sitelogin.php';
$result = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = '$fid'");
$access_upload = $result['access_upload'];
$access_upload = explode(":", $access_upload);
if (!in_array($member_id['user_group'], $access_upload)){die("Hacking attempt!");}
$access_mod = $result['access_mod'];
$access_mod = explode(":", $access_mod);
if (!in_array($member_id['user_group'], $access_mod))
{
$db_file_author = " AND file_author = '{$member_id['name']}'";
}
else
{
$db_file_author = "";
}
$forum_config['tools_upload'] = explode (':', $forum_config['tools_upload']);
if ($forum_config['tools_upload'])
{
if (in_array($member_id['user_group'], $forum_config['tools_upload']))
{
$upload_file_access = TRUE;
} else
{
$upload_file_access = FALSE;
}
}
// TPL //
echo <<<HTML
<html>
<head>
<title>Uploads</title>
</head>
<style type="text/css" media="all">
.dle_forum {
background-color: #FFF;
font-family: verdana;
font-size: 11px;
color: #222;
}
.dle_forum a:link, .dle_forum a:active, .dle_forum a:visited {
color: #222;
text-decoration: underline;
}
.dle_forum a:hover {
color: #34498B;
}
.button {
background-color: #fff;
border: 1px solid #B4B4B4;
color: #000;
font-family: verdana;
font-size: 11px;
padding: 1px;
}
.forum_input {
background-color: #fff;
border: 1px solid #B4B4B4;
color: #000;
font-family: verdana;
font-size: 11px;
}
</style>
<body class="dle_forum">
HTML;
echo <<<HTML
<script language="javascript" type="text/javascript">
function insertfile(selected_id)
{
attachment = "[attachment=" + selected_id + "]";
parent.doInsert(attachment, '', false); window.focus();
};
function insertaudio(onserver)
{
audio = "[audio=" + onserver + "]";
parent.doInsert(audio, '', false); window.focus();
};
function insertvideo(onserver)
{
video = "[video=" + onserver + "]";
parent.doInsert(video, '', false); window.focus();
};
</script>
HTML;
$DIR = 0;
$is_file = 0;
$is_image = 0;
$send_link = "?area=$area&fid=$fid&tid=$tid&pid=$pid";
$maxupload = mksize($forum_config['img_size']*1024);
if ($do == "add")
{
$allowed_images = array("gif", "jpg", "png", "jpe", "jpeg");
$allowed_files = explode(',', $forum_config['upload_type']);
$file_name = totranslit($_FILES['attachment']['name']);
$file_explode = explode(".",$file_name);
$file_type = strtolower(end($file_explode));
$attachment_size = $_FILES['attachment']['size'];
if (in_array($file_type, $allowed_images) AND $forum_config['img_upload']){
if ($attachment_size < ($forum_config['img_size']*1024)){
$is_image = TRUE;
$DIR = "images/";
}else{
$image_size_error = true;
}
}
if (in_array($file_type, $allowed_files) AND $upload_file_access){
$is_file = TRUE;
$DIR = "files/";
}
if ($is_file OR $is_image){
$uploadfile = UPLOAD_DIR.$DIR.basename($file_name);
if (move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile)){
$file_name = totranslit($_FILES['attachment']['name']);
$file_size = $_FILES['attachment']['size'];
}
if (file_exists(UPLOAD_DIR . $DIR . $file_name)){
if ($is_file){
$ftype = 'file';
$file_rename = time()."_".totranslit($file_name);
}else{
$ftype = 'image';
$file_rename = time().".".$file_type;
}
rename(UPLOAD_DIR . $DIR . $file_name, UPLOAD_DIR . $DIR . $file_rename);
if ($is_image)
{
include_once SYSTEM_DIR.'/classes/thumb.class.php';
$thumb = new thumbnail(UPLOAD_DIR.$DIR.$file_rename);
if ($thumb->size_auto($forum_config['thumb_size']))
{
$thumb->jpeg_quality($forum_config['jpeg_quality']);
$thumb->save(UPLOAD_DIR."thumbs/".$file_rename);
$ftype = 'thumb';
@chmod (UPLOAD_DIR."thumbs/".$file_rename, 0666);
}
}
$db->query("INSERT INTO " . PREFIX . "_forum_files (file_type, forum_id, topic_id, post_id, file_name, onserver, file_author, file_date, file_size) values ('$ftype', '$fid', '$tid', '$pid', '$file_name', '$file_rename', '$member_id[name]' , '".time()."', '$file_size')");
@chmod (UPLOAD_DIR.$DIR.$file_rename, 0666);
$upload_info = "<font color=\"green\">Ôàéë <b>$file_name</b> çàãðóæåí.</font>";
}
else
{
$upload_info = "<font color=\"red\">Íåâîçìîæíî çàãðóçèòü ôàéë íà ñåðâåð!</font>";
}
}
else
{
if ($image_size_error)
{
$upload_info = "<font color=\"red\">Ñëèøêîì áîëüøîå èçîáðàæåíèå!</font>";
}
else
{
$upload_info = "<font color=\"red\">Íå äîïóñòèìûé ôîðìàò ôàéëà!</font>";
}
}
}
if ($do == "del" and $del)
{
foreach ($del as $file_id)
{
$file_id = intval($file_id);
if ($file_id) $del_id[$file_id] = $file_id;
}
$del_list = implode(',', $del_id);
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE file_id IN ({$del_list})".$db_file_author);
while ($row = $db->get_row($result))
{
if ($row['file_type'] == "file")
{
unlink(UPLOAD_DIR."files/".$row['onserver']);
}
elseif ($row['file_type'] == "thumb")
{
unlink(UPLOAD_DIR."thumbs/".$row['onserver']);
unlink(UPLOAD_DIR."images/".$row['onserver']);
}
else
{
unlink(UPLOAD_DIR."images/".$row['onserver']);
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE file_id = '$row[file_id]' LIMIT 1");
}
}
echo "<fieldset>";
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"$send_link&do=add\"><br />";
echo "<input class=\"forum_input\" name=\"attachment\" type=\"file\" style=\"width:200px\" />";
echo "&nbsp;";
echo "<input class=\"button\" value=\"Çàãðóçèòü\" type=\"submit\" style=\"background-color:#53E490;\" />";
echo "</form>";
if (!$upload_info) $upload_info = "Ìàêñèìàëüíûé ðàçìåð äëÿ îäíîãî ôàéëà: <b>$maxupload</b>";
echo "<p>$upload_info</p>";
echo "</fieldset><br />";
echo "<fieldset><legend><strong>Çàãðóæåííûå ôàéëû</strong></legend>";
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"$send_link&do=del\">";
echo "<table class=\"dle_forum\" width=\"100%\">";
$db->query("SELECT * FROM " . PREFIX . "_forum_files
WHERE topic_id = '$tid' AND file_attach = '0'".$db_file_author." OR post_id = '$pid'".$db_file_author);
while ($row = $db->get_row())
{
$file_title = mksize($row['file_size'])." (Çàãðóçèë: {$row['file_author']})";
$on_server = $config['http_home_url'].'uploads/forum/files/'.$row['onserver'];
$type = file_type($row['onserver']);
if ($type == 'mp3')
{
$insert_ob = " <a OnClick=\"insertaudio('".$on_server."')\" href=\"#\">[audio]</a>";
}
elseif(in_array($type, $allowed_video))
{
$insert_ob = " <a OnClick=\"insertvideo('".$on_server."')\" href=\"#\">[video]</a>";
}
else
{
$insert_ob = "";
}
echo "<tr>
<td width=\"85%\"><a title=\"$file_title\" OnClick=\"insertfile('".$row['file_id']."')\" href=\"#\">$row[file_name]</a>{$insert_ob}</td>
<td width=\"10%\">&nbsp;</td>
<td width=\"5%\"><input type=checkbox name=\"del[".$row['file_id']."]\" value=\"".$row['file_id']."\"></td>
</tr>";
$row_count++;
}
echo "</table>";
if ($row_count){
echo "<hr /><div align=\"right\"><input class=\"button\" value=\"Óäàëèòü\" type=\"submit\" style=\"background-color:#FF9999;\" /></div>";
}
else
{
echo "<br />Íè îäíîãî ôàéëà íå çàãðóæåíî.";
}
echo "</form>";
echo "</fieldset>";
echo <<<HTML
</body>
</html>
HTML;
?>