Hi!
Ich habe folgendes Problem mit dem Code:
Alles anzeigen
Also:
Es wird nur ein ungelesenes Thema angezeigt. Egal welches Forum.
Aber der Themenstatus: Ankündigung, Wichtig oder Normal wird angezeigt.
Hat jemand eine lösung?
Ich habe folgendes Problem mit dem Code:
Quellcode
- <?php
- $sql2 = "SELECT * FROM ".$praefix."_board WHERE board_cat_id = ".$row['cat_id']." ORDER BY board_order ASC";
- $result2 = new Query($sql2) or die(mysql_error());
- $numrows = $result2->numRows();
- if ($numrows == 0) {
- $nothing = 0;
- }
- else {
- while($row2 = $result2->fetch()) {
- if (!isset($_SESSION["user_id"])) {
- $see_board = 0;
- }
- else {
- $use2_sql = "SELECT * FROM ".$praefix."_user WHERE user_id = ".$_SESSION["user_id"];
- $use2_query = new Query($use2_sql);
- $usw2_row = $use2_query->fetch();
- $user_rank = "SELECT * FROM ".$praefix."_rank WHERE rank_id = ".$usw2_row["user_rank"];
- $user_query = new Query($user_rank);
- $user_row = $user_query->fetch();
- $see_board = $user_row["rank_see_board"];
- }
- if ($row2["board_status"] == 1 or $see_board == 1) {
- $sql3 = "SELECT
- a.`thread_title`,
- a.`thread_date`,
- a.`thread_autor`,
- a.`thread_status`,
- a.`thread_id`,
- b.`user_name`,
- b.`user_id`,
- (SELECT c.`post_date` FROM `".$praefix."_post` AS c WHERE c.`post_thread_id` = a.`thread_id` ORDER BY c.`post_date` DESC LIMIT 1) AS `date`
- FROM
- `".$praefix."_thread` AS a
- LEFT JOIN
- `".$praefix."_user` AS b
- ON
- a.`thread_autor` = b.`user_name`
- WHERE
- a.`thread_board_id` = '".mysql_real_escape_string($row2['board_id'])."'
- ORDER BY
- `date` DESC,
- a.`thread_date` DESC
- LIMIT
- 1";
- $result3 = new Query($sql3);
- $row3 = $result3->fetch();
- $sql5 = "SELECT * FROM ".$praefix."_post WHERE post_thread_id = ".$row3['thread_id'];
- $result5 = new Query($sql5);
- $num5 = $result5->numRows();
- if ($num5 != 0) {
- if (strlen($row3['thread_title']) > 25) {
- $thread_post = "SELECT * FROM ".$praefix."_post WHERE post_thread_id = ".$row3["thread_id"]." ORDER BY `post_date` DESC LIMIT 1";
- $thread_query = new Query($thread_post);
- $thread_row = $thread_query->fetch();
- $post_autor = "SELECT * FROM ".$praefix."_user WHERE user_name = '".$thread_row["post_autor"]."'";
- $post_query = new Query($post_autor);
- $post_row = $post_query->fetch();
- $smarty->assign("userid",$post_row["user_id"]);
- $smarty->assign("boardautor",$post_row["user_name"]);
- $threadtitel = "Re: ".substr($row3['thread_title'],0,17)."...";
- }
- else {
- $sql6 = "SELECT * FROM ".$praefix."_thread WHERE thread_board_id = ".$row2['board_id'];
- $result6 = new Query($sql6) or die(mysql_error());
- $numRow6 = $result6->numRows();
- if ($numRow6 == 0) {
- $threadtitel = "";
- $smarty->assign("userid" ,'');
- $smarty->assign("boardautor",'');
- }
- else {
- $thread_post = "SELECT * FROM ".$praefix."_post WHERE post_thread_id = ".$row3["thread_id"]." ORDER BY `post_date` DESC LIMIT 1";
- $thread_query = new Query($thread_post);
- $thread_row = $thread_query->fetch();
- $post_autor = "SELECT * FROM ".$praefix."_user WHERE user_name = '".$thread_row["post_autor"]."'";
- $post_query = new Query($post_autor);
- $post_row = $post_query->fetch();
- $smarty->assign("userid",$post_row["user_id"]);
- $smarty->assign("boardautor",$post_row["user_name"]);
- $threadtitel = "Re: ".$row3['thread_title'];
- }
- }
- }
- else {
- $smarty->assign("userid",$row3["user_id"]);
- $smarty->assign("boardautor",$row3["user_name"]);
- if (strlen($row3['thread_title']) > 25) {
- $threadtitel = substr($row3['thread_title'],0,18)."...";
- }
- else {
- $threadtitel = $row3['thread_title'];
- }
- }
- $sql_100 = "SELECT * FROM ".$praefix."_thread WHERE thread_board_id = ".$row2['board_id'];
- $result_100 = new Query($sql_100) or die(mysql_error());
- $num_rows10 = $result_100->numRows();
- if ($num_rows10 == 0) {
- $smarty->assign("on_closed_off",'<img src="images/nopost.gif" alt="Nichts neues" />');
- }
- else {
- if ($row3['thread_status'] == 1) {
- $smarty->assign("on_closed_off",'<img src="images/closed.gif" alt="Gesperrt" />');
- }
- else {
- if (!isset($_SESSION["user_id"])) {
- $smarty->assign("on_closed_off",'<img src="images/off.gif" alt="Nichts neues" />');
- }
- else {
- $sql4 = "SELECT * FROM ".$praefix."_unread_topic WHERE unread_user_id = ".$_SESSION["user_id"];
- $result4 = new Query($sql4) or die(mysql_error());
- $row4 = $result4->fetch();
- $numRow4 = $result4->numRows();
- if ($row4["unread_thread_id"] != $row3["thread_id"]) {
- if ($row3['thread_status'] == 2) {
- $smarty->assign("on_closed_off",'<img src="images/thread_offAlert.gif" alt="Wichtiges Thema" />');
- }
- elseif ($row3['thread_status'] == 3) {
- $smarty->assign("on_closed_off",'<img src="images/thread_offAttachment.gif" alt="Ankündigung" />');
- }
- elseif ($row3['thread_status'] == 4) {
- $smarty->assign("on_closed_off",'<img src="images/off.gif" alt="Nichts neues" />');
- }
- }
- else {
- if ($row3['thread_status'] == 2) {
- $smarty->assign("on_closed_off",'<img src="images/thread_onAlert.gif" alt="Wichtiges Thema" />');
- }
- elseif ($row3['thread_status'] == 4) {
- $smarty->assign("on_closed_off",'<img src="images/on.gif" alt="Neu" />');
- }
- elseif ($row3['thread_status'] == 3) {
- $smarty->assign("on_closed_off",'<img src="images/thread_onAttachment.gif" alt="Ankündigung" />');
- }
- }
- }
- }
- }
- // und so weiter
- ?>
Also:
Es wird nur ein ungelesenes Thema angezeigt. Egal welches Forum.
Aber der Themenstatus: Ankündigung, Wichtig oder Normal wird angezeigt.
Hat jemand eine lösung?