<?php
defined (
'main'
)
or
die
(
'no direct access'
);
check_forum_failure(
$forum_failure
);
$title
=
$allgAr
[
'title'
] .
' :: Forum :: '
. aktForumCats(
$aktForumRow
[
'kat'
],
'title'
) .
' :: '
.
$aktForumRow
[
'name'
];
$hmenu
=
$extented_forum_menu
.
'<a class="smalfont" href="index.php?forum">Forum</a><b> » </b>'
. aktForumCats(
$aktForumRow
[
'kat'
]) .
'<b> » </b>'
.
$aktForumRow
[
'name'
] .
$extented_forum_menu_sufix
;
$design
=
new
design (
$title
,
$hmenu
, 1);
$design
->header();
$limit
=
$allgAr
[
'Ftanz'
];
$page
= (
$menu
->getA(3) ==
'p'
?
$menu
->getE(3) : 1);
$MPL
= db_make_sites (
$page
,
"WHERE fid = '$fid'"
,
$limit
,
'?forum-showtopics-'
.
$fid
,
'topics'
);
$anfang
= (
$page
- 1) *
$limit
;
$tpl
=
new
tpl (
'forum/showtopic'
);
if
(is_siteadmin()
and
$menu
->getA(3) !=
''
) {
$tid
=
$menu
->getE(3);
$qry
= db_query(
"SELECT a.id, a.pos FROM prefix_topics a LEFT JOIN prefix_posts b ON a.last_post_id = b.id WHERE a.fid = {$fid} AND a.art = 1 ORDER BY a.art DESC, a.pos, b.time"
);
$topics
=
array
();
$pos
= 0;
$oldpos
= -1;
while
(
$r
= db_fetch_assoc(
$qry
)){
$topics
[
$pos
] =
$r
;
if
(
$r
[
'id'
] ==
$tid
) {
$oldpos
=
$pos
;
}
$pos
++;
}
if
(
$menu
->getA(3) ==
'u'
) {
if
(
$oldpos
> 0) {
$tmp
=
$topics
[
$oldpos
-1];
$topics
[
$oldpos
-1] =
$topics
[
$oldpos
];
$topics
[
$oldpos
] =
$tmp
;
}
}
elseif
(
$menu
->getA(3) ==
'd'
) {
if
(
$oldpos
<
count
(
$topics
) - 1) {
$tmp
=
$topics
[
$oldpos
+1];
$topics
[
$oldpos
+1] =
$topics
[
$oldpos
];
$topics
[
$oldpos
] =
$tmp
;
}
}
$i
= 0;
foreach
(
$topics
as
$newpos
=>
$r
) {
if
(
$newpos
!=
$r
[
'pos'
]) {
db_query(
"UPDATE prefix_topics SET pos = {$newpos} WHERE id = "
.
$r
[
'id'
]);
$i
++;
}
}
}
if
(
$forum_rights
[
'start'
] == true) {
$tpl
->set(
'NEWTOPIC'
,
'<b>[ <a href="index.php?forum-newtopic-'
.
$fid
.
'">'
.
$lang
[
'newtopic'
] .
'</a> ]</b>'
);
}
else
{
$tpl
->set(
'NEWTOPIC'
,
''
);
}
$tpl
->set(
'MPL'
,
$MPL
);
$tpl
->set_out(
'FID'
,
$fid
, 0);
$q
= "SELECT a.id, a.name, a.icon, a.rep, a.erst, a.hit, a.art, a.stat, b.time, b.erst
as
last, b.id
as
pid
FROM prefix_topics a
LEFT JOIN prefix_posts b ON a.last_post_id = b.id
WHERE a.fid = {
$fid
}
ORDER BY a.art DESC, b.time DESC
LIMIT
".$anfang."
,".
$limit
;
$erg
= db_query(
$q
);
$oldart
= 0;
if
(db_num_rows(
$erg
) > 0) {
while
(
$row
= db_fetch_assoc(
$erg
)) {
if
(
$row
[
'stat'
] == 0) {
$row
[
'ORD'
] =
'cord'
;
}
else
{
$row
[
'ORD'
] = forum_get_ordner(
$row
[
'time'
],
$row
[
'id'
],
$fid
);
}
$row
[
'date'
] =
date
(
'd.m.y - H:i'
,
$row
[
'time'
]);
$row
[
'icon'
] =
'<img src="include/images/forum/themenicon/'
.
$row
[
'icon'
].
'.gif">'
;
$row
[
'page'
] =
ceil
((
$row
[
'rep'
] + 1) /
$allgAr
[
'Fpanz'
]);
$row
[
'VORT'
] =
''
;
if
(
$row
[
'art'
] == 1) {
$row
[
'VORT'
] =
'Fest: '
;
if
(is_siteadmin()) {
$row
[
'VORT'
] =
'<a href="index.php?forum-showtopics-'
.
$fid
.
'-u'
.
$row
[
'id'
].
'"><img src="include/images/icons/pfeilo.gif" border="0" /></a> '
.
'<a href="index.php?forum-showtopics-'
.
$fid
.
'-d'
.
$row
[
'id'
].
'"><img src="include/images/icons/pfeilu.gif" border="0" /></a> '
.
$row
[
'VORT'
];
}
}
if
(
$oldart
== 1
and
$row
[
'art'
] == 0) {
echo
'<tr><td colspan="5" style="height:10px; background-color: white;"></td></tr>'
;
}
$tpl
->set_ar_out(
$row
, 1);
$oldart
=
$row
[
'art'
];
}
}
else
{
echo
'<tr><td colspan="6" class="Cnorm"><b>keine Einträge vorhanden</b></td></tr>'
;
}
$tpl
->out(2);
if
(
$forum_rights
[
'mods'
] == true) {
$tpl
->set(
'id'
,
$fid
);
$tpl
->out(3);
}
$design
->footer();
?>