From 5a935f413dd6dff69df736b437073d343aa8a6ec Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Thu, 2 Jun 2011 01:45:46 +0200 Subject: news --- includes/pages/user_news.php | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 includes/pages/user_news.php (limited to 'includes/pages/user_news.php') diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php new file mode 100644 index 00000000..7012bb99 --- /dev/null +++ b/includes/pages/user_news.php @@ -0,0 +1,106 @@ +" . Get_Text(3) . "" . user_news_output(); +} + +function user_news_output() { + global $DISPLAY_NEWS, $privileges; + + if (isset ($_POST["text"]) && isset ($_POST["betreff"]) && IsSet ($_POST["date"])) { + if (!isset ($_POST["treffen"])) + $_POST["treffen"] = 0; + $SQL = "INSERT INTO `News` (`Datum`, `Betreff`, `Text`, `UID`, `Treffen`) " . + "VALUES ('" . sql_escape($_POST["date"]) . "', '" . sql_escape($_POST["betreff"]) . "', '" . sql_escape($_POST["text"]) . "', '" . sql_escape($_SESSION['uid']) . + "', '" . sql_escape($_POST["treffen"]) . "');"; + $Erg = sql_query($SQL); + if ($Erg == 1) + $html .= Get_Text(4); + } + + if (!IsSet ($_GET["news_begin"])) + $_GET["news_begin"] = 0; + + if (!IsSet ($_GET["DISPLAY_NEWS"])) + $_GET["DISPLAY_NEWS"] = 5; + + $SQL = "SELECT * FROM `News` ORDER BY `ID` DESC LIMIT " . intval($_GET["news_begin"]) . ", " . intval($_GET["DISPLAY_NEWS"]); + $Erg = sql_query($SQL); + + // anzahl zeilen + $news_rows = mysql_num_rows($Erg); + + for ($n = 0; $n < $news_rows; $n++) { + + if (mysql_result($Erg, $n, "Treffen") == 0) + $html .= "

"; + else + $html .= "

"; + + $html .= "" . ReplaceSmilies(mysql_result($Erg, $n, "Betreff")) . "\n"; + + // Schow Admin Page + if ($_SESSION['CVS']["admin/news.php"] == "Y") + $html .= " [edit]
\n\t\t"; + + $html .= "
   " . mysql_result($Erg, $n, "Datum") . ", "; + $html .= UID2Nick(mysql_result($Erg, $n, "UID")) . ""; + // avatar anzeigen? + $html .= DisplayAvatar(mysql_result($Erg, $n, "UID")); + $html .= "

\n"; + $html .= "

" . ReplaceSmilies(nl2br(mysql_result($Erg, $n, "Text"))) . "

\n"; + $RefID = mysql_result($Erg, $n, "ID"); + $countSQL = "SELECT COUNT(*) FROM `news_comments` WHERE `Refid`='$RefID'"; + $countErg = sql_query($countSQL); + $countcom = mysql_result($countErg, 0, "COUNT(*)"); + $html .= "

$countcom comments

\n\n"; + } + + $html .= "
\n\n"; + $rowerg = sql_query("SELECT * FROM `News`"); + $rows = mysql_num_rows($rowerg); + $dis_rows = round(($rows / $DISPLAY_NEWS) + 0.5); + + $html .= Get_Text(5); + + for ($i = 1; $i <= $dis_rows; $i++) { + if (!((($i * $DISPLAY_NEWS) - $_GET["news_begin"]) == $DISPLAY_NEWS)) { + $html .= "$i  "; + } else { + $html .= "$i  "; + } + } + $html .= '
+

+

' . Get_Text(6) . '

+   + +
+ + + + + + + + + + + '; + if (in_array('news_add_meeting', $privileges)) { + $html .= ' + + + '; + + } + $html .= '
' . Get_Text(7) . '
' . Get_Text(8) . '
' . Get_Text(9) . '
+
+ +
'; + return $html; +} +?> \ No newline at end of file -- cgit v1.2.3-54-g00ecf