1
0
mirror of https://github.com/e107inc/e107.git synced 2025-02-12 10:40:20 +01:00
php-e107/e107_plugins/forum/forum_uploads.php

122 lines
2.7 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
2009-11-17 10:46:35 +00:00
* e107 website system
*
2013-04-15 12:44:56 +02:00
* Copyright (C) 2008-2013 e107 Inc (e107.org)
2009-11-17 10:46:35 +00:00
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
2006-12-02 04:36:16 +00:00
require_once("../../class2.php");
2011-03-13 14:15:51 +00:00
$e107 = e107::getInstance();
if (!$e107->isInstalled('forum'))
{
header('Location: '.e_BASE.'index.php');
exit;
}
2006-12-02 04:36:16 +00:00
if(!USER)
{
2015-02-15 16:07:27 -08:00
header("location:".e_PLUGIN."forum/forum.php");
2006-12-02 04:36:16 +00:00
exit;
}
2009-11-19 09:52:35 +00:00
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_uploads.php');
2006-12-02 04:36:16 +00:00
2015-01-30 18:14:06 -08:00
e107::lan('forum','front');
2006-12-02 04:36:16 +00:00
if(is_array($_POST['delete']))
{
foreach(array_keys($_POST['delete']) as $fname)
{
$f = explode("_", $fname);
if($f[1] == USERID)
{
$path = e_UPLOAD.$fname;
2006-12-02 04:36:16 +00:00
if(unlink($path) == TRUE)
{
2015-02-02 15:19:13 -08:00
$msg = LAN_FORUM_7002.": $path";
2006-12-02 04:36:16 +00:00
}
else
{
2015-02-02 15:19:13 -08:00
$msg = LAN_FORUM_7003.": $path";
2006-12-02 04:36:16 +00:00
}
}
}
}
include_once(e_HANDLER."file_class.php");
include_once(HEADERF);
if($msg)
{
2015-02-02 15:19:13 -08:00
$ns->tablerender(LAN_FORUM_7004, $msg);
2006-12-02 04:36:16 +00:00
}
$fi = new e_file;
$mask = ".*_".USERID."_FT.*";
$fileList = $fi->get_files(e_UPLOAD, $mask);
if($sql->db_Select('forum_thread','thread_id, thread_thread, thread_parent', "thread_thread REGEXP '.*_".USERID."_FT.*'")) // FIXME new forum db structure
2006-12-02 04:36:16 +00:00
{
$threadList = $sql->db_getList();
}
$filecount = 0;
if(is_array($fileList))
{
$txt = "
<form method='post' action='".e_SELF."'>
<table style='width:98%'>
<tr>
<td class='fcaption'>".FRMUP_5."</td>
2015-02-02 15:19:13 -08:00
<td class='fcaption'>".LAN_FORUM_7006."</td>
2006-12-02 04:36:16 +00:00
</tr>";
foreach($fileList as $finfo)
{
if($finfo['fname'])
{
$filecount++;
$txt .= "<tr><td class='forumheader3'><a href='".e_UPLOAD.$finfo['fname']."'>{$finfo['fname']}</a></td>";
2006-12-02 04:36:16 +00:00
$found = FALSE;
if(is_array($threadList))
{
foreach($threadList as $tinfo)
{
if(strpos($tinfo['thread_thread'], $finfo['fname']) != FALSE)
{
$found = $tinfo;
break;
}
}
}
if($found != FALSE)
{
if($tinfo['thread_parent'])
{
2015-02-02 15:19:13 -08:00
$txt .= "<td class='forumheader3'>".LAN_FORUM_7007.": <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$tinfo['thread_id']}.post'>{$tinfo['thread_parent']}</a></td>";
2006-12-02 04:36:16 +00:00
}
else
{
2015-02-02 15:19:13 -08:00
$txt .= "<td class='forumheader3'>".LAN_FORUM_7007.": <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$tinfo['thread_id']}'>{$tinfo['thread_id']}</a></td>";
}
2006-12-02 04:36:16 +00:00
}
else
{
2015-02-02 15:19:13 -08:00
$txt .= "<td class='forumheader3'>".LAN_FORUM_7008." <input class='btn btn-default button' type='submit' name='delete[{$finfo['fname']}]' value='".LAN_DELETE."' /></td>";
2006-12-02 04:36:16 +00:00
}
$txt .= "</tr>";
}
}
$txt .= "</table>";
}
if(!$filecount) {
2015-02-02 15:19:13 -08:00
$ns->tablerender(LAN_FORUM_7001,LAN_FORUM_7009);
2006-12-02 04:36:16 +00:00
include_once(FOOTERF);
exit;
}
2015-02-02 15:19:13 -08:00
$ns->tablerender(LAN_FORUM_7001, $txt);
2006-12-02 04:36:16 +00:00
include_once(FOOTERF);
2007-01-17 20:47:41 +00:00
?>