VPN-Management-GUI 2.0.3 porting start
This commit is contained in:
65
Modules/Forum/include/addtopic.php
Executable file
65
Modules/Forum/include/addtopic.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
include($_SERVER["DOCUMENT_ROOT"]."/Site/checkuser.php");
|
||||
|
||||
$moduleurl = $moduleurl1;
|
||||
|
||||
echo "<br>
|
||||
<table width=\"400\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
|
||||
<tr>
|
||||
<form id=\"form1\" name=\"form1\" method=\"post\" action=\"/Modules/Forum/add_topic.php\">
|
||||
<input name=\"path\" type=\"hidden\" id=\"path\" size=\"50\" value=\"".$moduleurl."\"/>
|
||||
<td>
|
||||
<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#FFFFFF\">
|
||||
<tr>
|
||||
<td colspan=\"3\" bgcolor=\"#E6E6E6\"><strong>Create New Topic</strong> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"14%\"><strong>Topic</strong></td>
|
||||
<td width=\"2%\">:</td>
|
||||
<td width=\"84%\"><input name=\"topic\" type=\"text\" id=\"topic\" size=\"50\" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=\"top\"><strong>Text</strong></td>
|
||||
<td valign=\"top\">:</td>
|
||||
<td><textarea name=\"detail\" cols=\"50\" rows=\"3\" id=\"detail\"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Write permissions:
|
||||
</td>
|
||||
<td>
|
||||
<select name=\"writeperm\" size=1>
|
||||
<option value=\"any\">Any</option>
|
||||
<option value=\"admin\">Admin</option>
|
||||
<option value=\"user\">User</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Read permissions:
|
||||
</td>
|
||||
<td>
|
||||
<select name=\"readperm\" size=1>
|
||||
<option value=\"any\">Any</option>
|
||||
<option value=\"admin\">Admin</option>
|
||||
<option value=\"user\">User</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td><input type=\"submit\" name=\"Submit\" value=\"Submit\" /> <input type=\"reset\"
|
||||
name=\"Submit2\" value=\"Reset\" />
|
||||
</td>
|
||||
<a href=\"".$moduleurl."&uebergabe=0&uebergabe2=0&uebergabe3=0&uebergabe4=0\"><b> - Back - </b></a>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
</table>
|
||||
<br>";
|
||||
?>
|
69
Modules/Forum/include/dislike.php
Executable file
69
Modules/Forum/include/dislike.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include($_SERVER["DOCUMENT_ROOT"]."/Site/checkuser.php");
|
||||
$tbl_name="forum_like"; // Table name
|
||||
// Connect to server and select database.
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
|
||||
$moduleurl = $_REQUEST['path'];
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
die ("Keine Verbindung zur Datenbank! [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
// get data that sent from form
|
||||
$topic=mysql_real_escape_string($_REQUEST['topic']);
|
||||
$answer=mysql_real_escape_string($_REQUEST['answer']);
|
||||
$user=mysql_real_escape_string($_REQUEST['user']);
|
||||
|
||||
$datetime=date("d/m/y H:i:s"); //create date time
|
||||
if($user != $_SESSION["user_nickname"])
|
||||
die("THIS IS NOT ALLOWED!");
|
||||
|
||||
if($topic != "")
|
||||
{
|
||||
if($answer=="0")
|
||||
{
|
||||
$sql = "SELECT `dislike` FROM forum_question WHERE `id` = '".$topic."'";
|
||||
$result2 = mysql_query ($sql);
|
||||
$like=mysql_fetch_array ($result2);
|
||||
|
||||
if($like[0] == "")
|
||||
$like[0] = 0;
|
||||
$sql="UPDATE forum_question SET `dislike`='".($like[0]+1)."' WHERE `id` = '".$topic."'";
|
||||
mysql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT `a_dislike` FROM forum_answer WHERE `question_id` = '".$topic."' AND `a_id` = '".$answer."'";
|
||||
$result2 = mysql_query ($sql);
|
||||
$like=mysql_fetch_array ($result2);
|
||||
if($like[0] == "")
|
||||
$like[0] = 0;
|
||||
$sql="UPDATE forum_answer SET `a_dislike`='".($like[0]+1)."' WHERE `question_id`= '".$topic."' AND `a_id` = '".$answer."'";
|
||||
mysql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
$sql="INSERT INTO $tbl_name (`question`, `answer`, `nickname`, `datetime`, `like`) VALUES ('$topic', '$answer', '$user', '$datetime', 'dislike');";
|
||||
//echo $sql;
|
||||
$result=mysql_query($sql);
|
||||
|
||||
if($result)
|
||||
{
|
||||
header ("Location: ".$moduleurl."&uebergabe=1&uebergabe2=".$topic);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ERROR: ".$sql;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header ("Location: ".$moduleurl."&uebergabe=1&uebergabe2=".$topic);
|
||||
}
|
||||
mysql_close();
|
||||
?>
|
68
Modules/Forum/include/like.php
Executable file
68
Modules/Forum/include/like.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include($_SERVER["DOCUMENT_ROOT"]."/Site/checkuser.php");
|
||||
$tbl_name="forum_like"; // Table name
|
||||
// Connect to server and select database.
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
|
||||
$moduleurl = $_REQUEST['path'];
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
die ("Keine Verbindung zur Datenbank! [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
// get data that sent from form
|
||||
$topic=mysql_real_escape_string($_REQUEST['topic']);
|
||||
$answer=mysql_real_escape_string($_REQUEST['answer']);
|
||||
$user=mysql_real_escape_string($_REQUEST['user']);
|
||||
|
||||
$datetime=date("d/m/y H:i:s"); //create date time
|
||||
if($user != $_SESSION["user_nickname"])
|
||||
die("THIS IS NOT ALLOWED!");
|
||||
|
||||
if($topic != "")
|
||||
{
|
||||
if($answer=="0")
|
||||
{
|
||||
|
||||
$sql = "SELECT `like` FROM forum_question WHERE id = '".$topic."'";
|
||||
$result2 = mysql_query ($sql);
|
||||
$like=mysql_fetch_array ($result2);
|
||||
if($like[0] == "")
|
||||
$like[0] = 0;
|
||||
$sql="UPDATE forum_question SET `like`='".($like[0]+1)."' WHERE `id` = '".$topic."'";
|
||||
mysql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT `a_like` FROM forum_answer WHERE `question_id` = '".$topic."' AND `a_id` = '".$answer."'";
|
||||
$result2 = mysql_query ($sql);
|
||||
$like=mysql_fetch_array ($result2);
|
||||
if($like[0] == "")
|
||||
$like[0] = 0;
|
||||
$sql="UPDATE forum_answer SET `a_like`='".($like[0]+1)."' WHERE `question_id`= '".$topic."' AND `a_id` = '".$answer."'";
|
||||
mysql_query($sql);
|
||||
}
|
||||
|
||||
$sql="INSERT INTO $tbl_name(`question`, `answer`, `nickname`, `datetime`, `like`)VALUES('$topic', '$answer', '$user', '$datetime', 'like')";
|
||||
//echo $sql;
|
||||
$result=mysql_query($sql);
|
||||
|
||||
if($result)
|
||||
{
|
||||
header ("Location: ".$moduleurl."&uebergabe=1&uebergabe2=".$topic);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ERROR";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header ("Location: ".$moduleurl."&uebergabe=1&uebergabe2=".$topic);
|
||||
}
|
||||
mysql_close();
|
||||
?>
|
221
Modules/Forum/include/viewforum.php
Executable file
221
Modules/Forum/include/viewforum.php
Executable file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
// Connect to server and select databse.
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
die ("Keine Verbindung zur Datenbank! [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
switch($uebergabe2)
|
||||
{
|
||||
case 1:
|
||||
echo "<table align=center><tr><td><b>Topic successfully closed!</b></td></tr></table>";
|
||||
break;
|
||||
case 2:
|
||||
echo "<table align=center><tr><td><b>Topic successfully deleted!</b></td></tr></table>";
|
||||
break;
|
||||
case 3:
|
||||
echo "<table align=center><tr><td><b>Topic successfully reopened!</b></td></tr></table>";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if($uebergabe3 == "1")
|
||||
{
|
||||
echo "<table align=center><font color=red><tr><td><b>Admin Mode!</font></b></td></tr></table>";
|
||||
$admin = 1;
|
||||
}
|
||||
|
||||
if(preg_match("/[A-Z | a-z]+/",$_POST["search"]))
|
||||
{
|
||||
$search = mysql_real_escape_string($_POST["search"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = "";
|
||||
}
|
||||
if(preg_match("/[A-Z | a-z]+/",$_POST["sort"]))
|
||||
{
|
||||
$sort = mysql_real_escape_string($_POST["sort"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sort = "lastupdate";
|
||||
}
|
||||
|
||||
echo "<br />
|
||||
<table width=\"90%\" align=\"center\">
|
||||
<tr>
|
||||
<td>
|
||||
<form action=\"".$PHP_SELF."\" method=\"post\">
|
||||
<table align=left>
|
||||
<tr>
|
||||
<td>
|
||||
<b>Sort:
|
||||
<select name=\"sort\" size=1>
|
||||
<option "; if($sort=="lastupdate") echo "selected"; echo" value=\"lastupdate\">Last Update</option>
|
||||
<option "; if($sort=="id") echo "selected"; echo" value=\"id\">Thread Number</option>
|
||||
<option "; if($sort=="datetime") echo "selected"; echo" value=\"datetime\">Created</option>
|
||||
</select>
|
||||
<input type=\"submit\" value=\"Sort\" />
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form action=\"".$PHP_SELF."\" method=\"post\">
|
||||
<table align=center>
|
||||
<tr>
|
||||
<td>
|
||||
<b>Search:<input type=\"text\" name=\"search\" size=\"20\" "; if($search !="") echo "value=".$search; echo " />
|
||||
<input type=\"submit\" value=\"go!\" />
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />";
|
||||
|
||||
$tbl_name="forum_question"; // Table name
|
||||
|
||||
$sql="SELECT * FROM $tbl_name WHERE topic LIKE '%".$search."%' ORDER BY ".$sort." DESC";
|
||||
// OREDER BY id DESC is order result by descending
|
||||
$result=mysql_query($sql);
|
||||
|
||||
echo "<table width=\"90%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
|
||||
<tr>
|
||||
<td width=\"6%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>#</strong></td>
|
||||
<td width=\"58%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Topic</strong></td>
|
||||
<td width=\"15%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Views</strong></td>
|
||||
<td width=\"13%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Replies</strong></td>
|
||||
<td width=\"13%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Like</strong></td>
|
||||
<td width=\"13%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Date/Time</strong></td>
|
||||
<td width=\"13%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Last change</strong></td>";
|
||||
|
||||
if($admin=="1" && $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
echo "<td width=\"10%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Delete</strong></td>";
|
||||
}
|
||||
if($admin=="1" && $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
echo "<td width=\"10%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Close</strong></td>";
|
||||
}
|
||||
if($admin=="1" && $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
echo "<td width=\"10%\" align=\"center\" bgcolor=\"#E6E6E6\"><strong>Open</strong></td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
|
||||
while($rows=mysql_fetch_array($result))
|
||||
{
|
||||
if (($_SESSION["user_admin"]=="1" && $rows["r_adminonly"] == "1") ||
|
||||
$rows["r_guest"] == "1" ||
|
||||
($rows["r_adminonly"] == "0" &&(isset ($_SESSION["user_id"]))))
|
||||
{
|
||||
echo "<tr bgcolor=\"#FFFFFF\">
|
||||
<td bgcolor=\"#FFFFFF\">".$rows['id']."</td>
|
||||
<td bgcolor=\"#FFFFFF\">";
|
||||
if($rows['closed']==1)
|
||||
echo "[CLOSED]";
|
||||
|
||||
echo "<a href=\"".$moduleurl."&uebergabe=1&uebergabe2=".$rows['id']."\">".$rows['topic']."</a>
|
||||
</td>
|
||||
<td align=\"center\" bgcolor=\"#FFFFFF\">".$rows['view']."</td>
|
||||
<td align=\"center\" bgcolor=\"#FFFFFF\">".$rows['reply']."</td>
|
||||
<td align=\"center\" bgcolor=\"#FFFFFF\">";
|
||||
if($rows["like"] > $rows["dislike"])
|
||||
{
|
||||
echo "<img src=/Modules/Forum/img/likekl.png />";
|
||||
}
|
||||
if($rows["like"] < $rows["dislike"])
|
||||
{
|
||||
echo "<img src=/Modules/Forum/img/dislikekl.png />";
|
||||
}
|
||||
if($rows["like"] == $rows["dislike"])
|
||||
{
|
||||
echo "<img src=/Modules/Forum/img/undecidedkl.png />";
|
||||
}
|
||||
echo "</td>
|
||||
<td align=\"center\" bgcolor=\"#FFFFFF\">".$rows['datetime']."</td>
|
||||
<td align=\"center\" bgcolor=\"#FFFFFF\">".$rows['lastupdate']."</td>";
|
||||
if($admin=="1" && $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
echo "<form action=\"/Modules/Forum/delete_topic.php\" method=post>",
|
||||
"<input type=hidden name=topicid value=".$rows['id']." size=20 bgcolor=\"#FFFFFF\"><input type=hidden name=path value=".$moduleurl." size=50>
|
||||
<td bgcolor=#FA5858>",
|
||||
"<input type=submit value=X>",
|
||||
"</form></td>";
|
||||
}
|
||||
if($admin=="1" && $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
if($rows['closed']!=1)
|
||||
{
|
||||
echo "<form action=\"/Modules/Forum/close_topic.php\" method=post>",
|
||||
"<input type=hidden name=topicid value=".$rows['id']." size=20 bgcolor=\"#FFFFFF\"><input type=hidden name=path value=".$moduleurl." size=50><td>",
|
||||
"<input type=submit value=X>",
|
||||
"</form></td>";
|
||||
}
|
||||
else
|
||||
echo "<td></td>";
|
||||
}
|
||||
if($admin=="1" && $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
if($rows['closed']==1)
|
||||
{
|
||||
echo "<form action=\"/Modules/Forum/reopen_topic.php\" method=post>",
|
||||
"<input type=hidden name=topicid value=".$rows['id']." size=20 bgcolor=\"#FFFFFF\"><input type=hidden name=path value=".$moduleurl." size=50><td>",
|
||||
"<input type=submit value=X>",
|
||||
"</form></td>";
|
||||
}
|
||||
else
|
||||
echo "<td></td>";
|
||||
}
|
||||
|
||||
echo "</tr>";
|
||||
|
||||
// Exit looping and close connection
|
||||
}
|
||||
}
|
||||
mysql_close();
|
||||
|
||||
echo "<tr>";
|
||||
|
||||
if (isset ($_SESSION["user_admin"])&& $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
if($admin != 1)
|
||||
{
|
||||
echo "<td colspan=\"3\"align=\"left\" bgcolor=\"#E6E6E6\">
|
||||
<a href=\"".$moduleurl."&uebergabe=0&uebergabe3=1\"><strong>Go Admin!</strong> </a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<td colspan=\"4\"align=\"left\" bgcolor=\"#E6E6E6\">
|
||||
<a href=\"".$moduleurl."&uebergabe=0\"><strong>Leave Admin Mode!</strong> </a></td>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<td colspan=\"3\"align=\"left\" bgcolor=\"#E6E6E6\"></td>";
|
||||
}
|
||||
|
||||
if (isset ($_SESSION["user_id"]))
|
||||
{
|
||||
echo "<td colspan=\"6\" align=\"right\" bgcolor=\"#E6E6E6\">
|
||||
<a href=\"".$moduleurl."&uebergabe=2\"><strong>Create New Topic</strong> </a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<td colspan=\"4\"align=\"left\" bgcolor=\"#E6E6E6\"></td>";
|
||||
}
|
||||
|
||||
echo "</tr> </table> <br />";
|
||||
?>
|
305
Modules/Forum/include/viewtopic.php
Executable file
305
Modules/Forum/include/viewtopic.php
Executable file
@@ -0,0 +1,305 @@
|
||||
<?php
|
||||
switch($uebergabe3)
|
||||
{
|
||||
case 1:
|
||||
echo "<table align=center><tr><td><b>Answer deleted!</b></td></tr></table>";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
$tbl_name="forum_question"; // Table name
|
||||
|
||||
// Connect to server and select database.
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
die ("Keine Verbindung zur Datenbank! [<b><font color=red>FAIL</b></font>]<br />");
|
||||
}
|
||||
// get value of id that sent from address bar
|
||||
$id=mysql_real_escape_string($uebergabe2);
|
||||
|
||||
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
|
||||
$result=mysql_query($sql);
|
||||
|
||||
$rows=mysql_fetch_array($result);
|
||||
$settings = $rows;
|
||||
if (($_SESSION["user_admin"]=="1" && $rows["r_adminonly"] == "1") ||
|
||||
$rows["r_guest"] == "1" ||
|
||||
($rows["r_adminonly"] == "0" &&(isset ($_SESSION["user_id"]))))
|
||||
{
|
||||
if($rows["like"] == "")
|
||||
{
|
||||
$rows["like"] = "0";
|
||||
}
|
||||
if($rows["dislike"] == "")
|
||||
{
|
||||
$rows["dislike"] = "0";
|
||||
}
|
||||
|
||||
if(isset($_GET['success']))
|
||||
{
|
||||
echo "<table align=center><tr><td><b>Answer successfully created!</b></td></tr></table>";
|
||||
}
|
||||
echo "<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\">
|
||||
<tr>
|
||||
<td valgin=top height=\"100%\">
|
||||
<table style=\"width: 100%; height: 100%;\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bordercolor=\"1\">
|
||||
<tr>
|
||||
<td valign=\"top\">
|
||||
<a href=".$moduleurl."&uebergabe=0&uebergabe2=0&uebergabe3=0&uebergabe4=0><b># Forum Home</b></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=\"bottom\">
|
||||
<a href=".$moduleurl."&uebergabe=0&uebergabe2=0&uebergabe3=0&uebergabe4=0><b># Forum Home</b></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table width=\"500\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\">
|
||||
<tr>
|
||||
<td width=\"90\">";
|
||||
$sql = "SELECT Avatar FROM userdata WHERE Nickname = '".$rows["name"]."'";
|
||||
$result = mysql_query ($sql);
|
||||
$Avatar=mysql_fetch_array ($result);
|
||||
echo"<img src=/Modules/Forum/avatar/".$Avatar[0].".png width=\"90\" height=\"90\"></img>\n";
|
||||
echo " </td>
|
||||
<td>
|
||||
<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bordercolor=\"1\" bgcolor=\"grey\">
|
||||
<tr>
|
||||
<td bgcolor=\"lightgrey\"><strong>".$rows['topic']."</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor=\"lightgrey\"><font color=green>". $rows['detail'] ."</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor=\"lightgrey\">
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>By:</strong>".$rows['name']."<strong> Date: </strong>".$rows['datetime']."
|
||||
</td>
|
||||
<td align=\"right\">
|
||||
<strong>";
|
||||
if(isset($_SESSION["user_id"]))
|
||||
{
|
||||
$sql = "SELECT * FROM forum_like WHERE question = '".$id."' AND answer = '0'";
|
||||
$result = mysql_query ($sql);
|
||||
$liked = false;
|
||||
$disliked = false;
|
||||
while($Like=mysql_fetch_array($result))
|
||||
{
|
||||
if($Like[2]==$_SESSION["user_nickname"])
|
||||
{
|
||||
$liked = true;
|
||||
$disliked = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$liked)
|
||||
echo $rows['like']."<a href=\"/Modules/Forum/include/like.php?user=".$_SESSION["user_nickname"]."&path=".$moduleurl."&topic=".$id."&answer=0\"><img src=/Modules/Forum/img/likekl.png width=20 height=20 border=0 /></a>";
|
||||
else
|
||||
echo $rows['like']."<img src=/Modules/Forum/img/likegreykl.png width=20 height=20 border=0 />";
|
||||
if(!$disliked)
|
||||
echo $rows['dislike']."<a href=\"/Modules/Forum/include/dislike.php?user=".$_SESSION["user_nickname"]."&path=".$moduleurl."&topic=".$id."&answer=0\"><img src=/Modules/Forum/img/dislikekl.png width=20 height=20 border=0 /></a>";
|
||||
else
|
||||
echo $rows['dislike']."<img src=/Modules/Forum/img/dislikegreykl.png width=20 height=20 border=0 />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $rows['like']."<img src=/Modules/Forum/img/likegreykl.png width=20 height=20 border=0 />".
|
||||
$rows['dislike']."<img src=/Modules/Forum/img/dislikegreykl.png width=20 height=20 border=0 />";
|
||||
}
|
||||
echo "</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />";
|
||||
$tbl_name2="forum_answer"; // Switch to table "forum_answer"
|
||||
$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id' ORDER BY a_id ASC";
|
||||
$result2=mysql_query($sql2);
|
||||
|
||||
while($rows=mysql_fetch_array($result2))
|
||||
{
|
||||
echo "
|
||||
<table width=\"500\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\">
|
||||
<tr>
|
||||
<td width=\"90\">";
|
||||
|
||||
$sql = "SELECT Avatar FROM userdata WHERE Nickname = '".$rows["a_name"]."'";
|
||||
$result = mysql_query ($sql);
|
||||
$Avatar=mysql_fetch_array ($result);
|
||||
if($rows["a_name"] == "")
|
||||
{
|
||||
$rows["a_name"] = "guest";
|
||||
}
|
||||
|
||||
if($rows["a_like"] == "")
|
||||
{
|
||||
$rows["a_like"] = "0";
|
||||
}
|
||||
if($rows["a_dislike"] == "")
|
||||
{
|
||||
$rows["a_dislike"] = "0";
|
||||
}
|
||||
|
||||
echo" <img src=/Modules/Forum/avatar/".$Avatar[0].".png width=\"90\" height=\"90\"></img>\n
|
||||
</td>
|
||||
<td>
|
||||
<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"lightgrey\">
|
||||
<tr>
|
||||
<td bgcolor=\"#F8F7F1\"><strong>#". $rows['a_id']."</strong> , <strong>by:</strong>".$rows['a_name'];
|
||||
|
||||
if(($_SESSION["user_nickname"] == $rows["a_name"] && $settings["closed"] != 1)|| $_SESSION["user_admin"]=="1")
|
||||
{
|
||||
echo "<table align=\"right\"><td>";
|
||||
echo "<a href=\"/Modules/Forum/delete_answer.php?topic=".$id."&answer=".$rows['a_id']."&path=".$moduleurl."\"><font color=\"red\">X</font></a>";
|
||||
echo "</td></table>";
|
||||
}
|
||||
echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor=\"#F8F7F1\"><font color=green>". $rows['a_answer']. "</font></td>
|
||||
</tr>";
|
||||
|
||||
if($rows['a_attachment'] != "")
|
||||
{
|
||||
$pos1 = strpos($rows['a_attachment'], "-");
|
||||
$pos2 = strpos($rows['a_attachment'], "-",$pos1+1);
|
||||
$attname = substr($rows['a_attachment'], $pos2+1);
|
||||
echo "
|
||||
<tr>
|
||||
<td bgcolor=\"#F8F7F1\"><strong>Attachment:</strong>
|
||||
<a href=\"/Modules/Forum/getattachment.php?download=".$rows['a_attachment']. "\">".$attname."</a></font></td>
|
||||
</tr>";
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td bgcolor=\"#F8F7F1\">
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Date:</strong> ".$rows['a_datetime']."
|
||||
</td>
|
||||
<td align=\"right\">
|
||||
<strong>";
|
||||
if(isset($_SESSION["user_id"]))
|
||||
{
|
||||
$sql = "SELECT * FROM forum_like WHERE question = '".$id."' AND answer = '".$rows["a_id"]."'";
|
||||
$result = mysql_query ($sql);
|
||||
$liked = false;
|
||||
$disliked = false;
|
||||
while($Like=mysql_fetch_array($result))
|
||||
{
|
||||
if($Like[2]==$_SESSION["user_nickname"])
|
||||
{
|
||||
$liked = true;
|
||||
$disliked = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$liked)
|
||||
echo $rows['a_like']."<a href=\"/Modules/Forum/include/like.php?user=".$_SESSION["user_nickname"]."&path=".$moduleurl."&topic=".$id."&answer=".$rows["a_id"]."\"><img src=/Modules/Forum/img/likekl.png width=20 height=20 border=0 /></a>";
|
||||
else
|
||||
echo $rows['a_like']."<img src=/Modules/Forum/img/likegreykl.png width=20 height=20 border=0 />";
|
||||
if(!$disliked)
|
||||
echo $rows['a_dislike']."<a href=\"/Modules/Forum/include/dislike.php?user=".$_SESSION["user_nickname"]."&path=".$moduleurl."&topic=".$id."&answer=".$rows["a_id"]."\"><img src=/Modules/Forum/img/dislikekl.png width=20 height=20 border=0 /></a>";
|
||||
else
|
||||
echo $rows['a_dislike']."<img src=/Modules/Forum/img/dislikegreykl.png width=20 height=20 border=0 />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $rows['a_like']."<img src=/Modules/Forum/img/likegreykl.png width=20 height=20 border=0 />".
|
||||
$rows['a_dislike']."<img src=/Modules/Forum/img/dislikegreykl.png width=20 height=20 border=0 />";
|
||||
}
|
||||
echo "
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />";
|
||||
}
|
||||
|
||||
$sql3="SELECT view FROM $tbl_name WHERE id='$id'";
|
||||
$result3=mysql_query($sql3);
|
||||
|
||||
$rows=mysql_fetch_array($result3);
|
||||
$view=$rows['view'];
|
||||
|
||||
// if have no counter value set counter = 1
|
||||
if(empty($view))
|
||||
{
|
||||
$view=1;
|
||||
$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";
|
||||
$result4=mysql_query($sql4);
|
||||
}
|
||||
|
||||
// count more value
|
||||
$addview=$view+1;
|
||||
$sql5="update $tbl_name set view='$addview' WHERE id='$id'";
|
||||
$result5=mysql_query($sql5);
|
||||
|
||||
mysql_close();
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />";
|
||||
|
||||
if (((isset ($_SESSION["user_id"]) && $settings["w_adminonly"]== "0") ||
|
||||
$settings["w_guest"]=="1" ||
|
||||
($_SESSION["user_admin"]=="1"&&$settings["w_adminonly"]== "1"))
|
||||
&& $settings["closed"] != "1")
|
||||
{
|
||||
echo"
|
||||
<table style=\"width: 400\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
|
||||
<tr>
|
||||
<td>
|
||||
<form name=\"form1\" method=\"post\" action=\"/Modules/Forum/add_answer.php\" enctype=\"multipart/form-data\">
|
||||
<table style=\"width: 100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#FFFFFF\">
|
||||
<tr>
|
||||
<td valign=\"top\"><strong>Answer</strong></td>
|
||||
<td valign=\"top\">:</td>
|
||||
<td><textarea name=\"a_answer\" cols=\"45\" rows=\"3\" id=\"a_answer\"></textarea></td>
|
||||
</tr>";
|
||||
if (isset ($_SESSION["user_id"]))
|
||||
{
|
||||
echo "
|
||||
<tr>
|
||||
<td valign=\"top\"><strong>Attachment</strong></td>
|
||||
<td valign=\"top\">:</td>
|
||||
<td><input type=\"file\" name=\"datei\" /></td>
|
||||
</tr>";
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input name=\"id\" type=\"hidden\" value=".$id." /><input name=\"path\" type=\"hidden\" value=".$moduleurl." /></td>
|
||||
<td><input type=\"submit\" name=\"Submit\" value=\"Submit\" /> <input type=\"reset\" name=\"Submit2\" value=\"Reset\" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>";
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user