function AddRowsToTable() {
var tbl = document.getElementById('dateiupload');
var lastRow = tbl.rows.length;
var iteration = lastRow;
if (iteration < $wd) {
var row = tbl.insertRow(lastRow);
var cellRight = row.insertCell(0);
var el = document.createElement('input');
el.setAttribute('type', 'file');
el.setAttribute('name', 'attach[]');
el.setAttribute('class', 'textbox');
cellRight.setAttribute('id',iteration)
cellRight.appendChild(el);
var aa = document.createElement(\"a\");
aa.setAttribute('href', '#');
var clickName = new Function(\"DeleteRow(this)\");
aa.onclick = clickName;
aa.innerHTML = \" (Entfernen/Remove) \";
cellRight.appendChild(aa);
} else {
alert('No more than $wd; Files ...');
}
}
function DeleteRow(x)
{
while (x.tagName.toLowerCase() !='tr')
{
if(x.parentElement)
x=x.parentElement;
else if(x.parentNode)
x=x.parentNode;
else
return;
}
var rowNum=x.rowIndex;
while (x.tagName.toLowerCase() !='table')
{
if(x.parentElement)
x=x.parentElement;
else if(x.parentNode)
x=x.parentNode;
else
return;
}
x.deleteRow(rowNum);
}
";
$result = dbquery(
"SELECT f.*, f2.forum_name AS forum_cat_name
FROM ".$db_prefix."forums f
LEFT OUTER JOIN ".$db_prefix."forums f2 ON f.forum_cat=f2.forum_id
WHERE f.forum_id='".$forum_id."'"
);
if (dbrows($result)>0) { $fdata = dbarray($result);} else { fallback("index.php");
}
$can_view = forum_accesscontrol($userdata['user_id'],$fdata['forum_access'],$fdata['forum_id'], "auth_read");
if (!$can_view) fallback("index.php");
// rechte ermitteln
$can_post = $can_view && forum_accesscontrol($userdata['user_id'],$fdata['forum_posting'],$fdata['forum_id'], "auth_post") ? true : false;
$can_reply = $can_view && forum_accesscontrol($userdata['user_id'],$fdata['forum_reply'],$fdata['forum_id'], "auth_reply") ? true : false;
$can_edit = ($can_post || $can_reply) && $fdata['forum_edit']==1 ? true : false;
$can_delete = ($can_post || $can_reply) && $fdata['forum_delete']==1 ? true : false;
$can_download = $can_view && forum_accesscontrol($userdata['user_id'],$fdata['forum_download'],$fdata['forum_id'], "auth_download") ? true : false;
$can_mod = view_forum_mods($fdata['forum_id'],true) ? true : false;
$can_attach = ($can_post || $can_reply) && forum_accesscontrol($userdata['user_id'],$fdata['forum_attach'],$fdata['forum_id'], "auth_attach") ? true : false;
define ("iMOD", iMEMBER && $can_mod ? true : false);
$caption = $fdata['forum_cat_name']." | ".$fdata['forum_name'];
if ($action == "newthread" && ($can_post || iMOD || iSUPERADMIN)) {include "postnewthread.php";} elseif ($action == "reply" && ($can_reply || iMOD|| iSUPERADMIN)) {
if (!isset($thread_id) || !isNum($thread_id)) fallback("index.php");
$result = dbquery("SELECT * FROM ".$db_prefix."threads WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'");
if (dbrows($result)) { $tdata = dbarray($result); } else { fallback("index.php"); }
if (!$tdata['thread_locked'] && ($can_reply || iMOD || iSUPERADMIN)) { include "postreply.php"; } else { fallback("index.php"); }
} elseif ($action == "edit" || $action == "delete") {
if (!isset($thread_id) || !isNum($thread_id) || !isset($post_id) || !isNum($post_id)) { fallback("index.php"); exit; }
$result = dbquery("SELECT * FROM ".$db_prefix."threads WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'");
if (dbrows($result)) { $tdata = dbarray($result); } else { fallback("index.php"); }
$result = dbquery("SELECT p.*, u.user_level FROM ".$db_prefix."posts p, ".$db_prefix."users u WHERE p.post_id='".$post_id."' AND p.thread_id='".$tdata['thread_id']."' AND p.forum_id='".$fdata['forum_id']."' AND p.post_author = u.user_id");
if (dbrows($result)) { $pdata = dbarray($result); } else { fallback("index.php"); }
if ($userdata['user_id'] != $pdata['post_author'] && !iMOD && !iSUPERADMIN) fallback("index.php");
$can_delete = ( iMOD || iSUPERADMIN ) ? 1 : $fdata['forum_delete'];
if($action == "delete" && $can_delete)
{
if($pdata['user_level'] == '103')
{
$can_really_delete = iSUPERADMIN ? 1 : 0;
}
elseif($pdata['user_level'] == '102')
{
$can_really_delete = iADMIN ? 1 : 0;
}
else
{
$can_really_delete = 1;
}
if($can_really_delete)
{
$result = dbquery("DELETE FROM ".$db_prefix."posts WHERE post_id='$post_id' AND thread_id='$thread_id'");
$result = dbquery("SELECT * FROM ".$db_prefix."forum_attachments WHERE post_id='$post_id'");
if (dbrows($result) != 0) {
$attach = dbarray($result);
unlink(FORUM."attachments/".$attach['attach_name']);
$result2 = dbquery("DELETE FROM ".$db_prefix."forum_attachments WHERE post_id='$post_id'");
}
$posts = dbcount("(post_id)", "posts", "thread_id='$thread_id'");
if ($posts == 0) {
$result = dbquery("DELETE FROM ".$db_prefix."threads WHERE thread_id='$thread_id' AND forum_id='$forum_id'");
$result = dbquery("DELETE FROM ".$db_prefix."thread_notify WHERE thread_id='$thread_id'");
}
// update forum_lastpost and forum_lastuser if post_datestamp matches
fu_f_update_forum($forum_id);
fu_f_update_thread($thread_id);
opentable($locale['407']);
echo "
\n".$locale['445']."
\n";
if ($posts > 0) {
if (!empty($pdata2) && isset($pdata2['post_id'])) {$post_id="&pid=".$pdata2['post_id']."#post_".$pdata2['post_id'];}
else {$post_id="";}
// automatische Weiterleitung
echo"";
echo"
|
Een moment ".$userdata['user_name'].", Je word doorgestuurd ...
|
";
echo "".$locale['447']." | ".$locale['449']."
\n\n";
} else {
// automatische Weiterleitung
echo"";
echo"
|
Een moment ".$userdata['user_name'].", Je word doorgestuurd ...
|
";
echo "".$locale['448']." | ".$locale['449']."
\n\n";
}
closetable();
}
}
if($action == "edit")
{
if (!$fdata['forum_edit'] && !iMOD && !iSUPERADMIN) fallback("index.php");
if (!$tdata['thread_locked']) {
if($pdata['user_level'] == '103')
{
if(iSUPERADMIN) { include "postedit.php"; } else { fallback("index.php"); }
}
elseif($pdata['user_level'] == '102')
{
if(iADMIN) { include "postedit.php"; } else { fallback("index.php"); }
}
else
{
include "postedit.php";
}
} else {
if (iMOD || iSUPERADMIN)
{
if($pdata['user_level'] == '103')
{
if(iSUPERADMIN) { include "postedit.php"; } else { fallback("index.php"); }
}
elseif($pdata['user_level'] == '102')
{
if(iADMIN) {include "postedit.php"; } else { fallback("index.php"); }
}
else
{
include "postedit.php";
}
}
}
}
} else {
header("Location: index.php");
}
//require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
// File is correctly working (tested by silvermoon) \\
?>