<?php
/*---------------------------------------------------+
| <span style="border-bottom: 1px dotted black;">PHP</span>-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| <a href='http://www.php-fusion.co.uk/' target='_blank'><span style='color:005C5B'>http://www.php-fusion.co.uk/</span></a>
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit <a href='http://gnu.org' target='_blank'><span style='color:005C5B'>http://gnu.org</span></a>
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
if (file_exists(INFUSIONS."suggestion_box/locale/".$settings['locale'].".php")) {
include INFUSIONS."suggestion_box/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."suggestion_box/locale/English.php";
}
error_reporting(E_ALL ^ E_NOTICE);
if (iMEMBER) {
if (!isset($step)) $step = "";
if (isset($_POST['submit_suggestion'])) {
$suggestion_summary = stripinput($_POST['suggestion_summary']);
$suggestion_version = stripinput($_POST['suggestion_version']);
$suggestion_description = stripinput($_POST['suggestion_description']);
if ($suggestion_summary != "" && $suggestion_description != "") {
$result = dbquery("INSERT INTO ".$db_prefix."suggestion_box VALUES('', '".$userdata['user_id']."', '$suggestion_summary', '$suggestion_version', '$suggestion_description', '', '".$locale['err142']."', '".time()."')");
}
redirect(FUSION_SELF);
}
if ($step == "view") {
include INCLUDES."comments_include.php";
if (!$suggestion_id || !isNum($suggestion_id)) redirect(FUSION_SELF);
opentable($locale['err110']);
$data = dbarray(dbquery(
"SELECT ter.*, user_id,user_name FROM ".$db_prefix."suggestion_box ter
LEFT JOIN ".$db_prefix."users tusr ON ter.suggestion_user=tusr.user_id
WHERE suggestion_id='".$suggestion_id."'"
));
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>
<tr>
<td class='tbl2'><b>".$data['suggestion_summary']."</b></td>
</tr>
<tr>
<td width='125' class='tbl2'>".$locale['err111']."</td>
<td class='tbl1'><a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a> -
".strftime($settings['longdate'], $data['suggestion_datestamp']+($settings['timeoffset']*3600))."</td>
</tr>
<tr>
<td width='125' class='tbl2'>".$locale['err112']."</td>
<td class='tbl1'>".$data['suggestion_version']."</td>
</tr>
<tr>
<td width='125' class='tbl2'>".$locale['err113']."</td>
<td class='tbl1'>".nl2br($data['suggestion_description'])."</td>
</tr>\n";
if ($data['suggestion_response']) {
echo "<tr>
<td width='125' class='tbl2'>".$locale['err114']."</td>
<td class='tbl1'>".nl2br($data['suggestion_response'])."</td>
</tr>\n";
}
echo "<tr>
<td width='125' class='tbl2'>".$locale['err115']."</td>
<td class='tbl1'>".$data['suggestion_status']."</td>
</tr>
</table>\n";
closetable();
showcomments("E","".$db_prefix."suggestion_box","suggestion_id",$suggestion_id,FUSION_SELF."?step=view&suggestion_id=$suggestion_id","");
tablebreak();
}
opentable($locale['err120']);
$result = dbquery(
"SELECT ter.*, user_id,user_name, COUNT(comment_item_id) AS suggestion_comments
FROM ".$db_prefix."suggestion_box ter
LEFT JOIN ".$db_prefix."users tusr ON ter.suggestion_user=tusr.user_id
LEFT JOIN ".$db_prefix."comments ON ter.suggestion_id=comment_item_id AND comment_type='E'
GROUP BY suggestion_id ORDER BY suggestion_datestamp DESC"
);
if (dbrows($result)) {
$i = 0;
echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>
<tr>
<td align='center' width='125' class='tbl2'>".$locale['err121']."</td>
<td align='center' width='150' class='tbl2'>".$locale['err122']."</td>
<td align='center' width='125' class='tbl2'>".$locale['err111']."</td>
<td align='center' width='150' class='tbl2'>".$locale['err115']."</td>
<td align='center' width='125' class='tbl2'>".$locale['err116']."</td>
</tr>\n";
while ($data = dbarray($result)) {
$i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2";
echo "<tr>
<td align='center' class='$tclass'>".$data['suggestion_id']."</td>
<td align='center' class='$tclass'><a href='".BASEDIR."infusions/suggestion_box/info.php?step=view&suggestion_id=".$data['suggestion_id']."'>".$data['suggestion_summary']."</a></td>
<td align='center' class='$tclass'><a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td>
<td align='center' class='$tclass'>".$data['suggestion_status']."</td>
<td align='center' class='$tclass'><a href='".BASEDIR."infusions/suggestion_box/info.php?step=view&suggestion_id=".$data['suggestion_id']."'>".$locale['err151']."</a></td>
</tr>\n";
}
echo "</table>\n";
} else {
echo "<center><br>\n".$locale['err123']."<br><br>\n</center>\n";
}
closetable();
tablebreak();
opentable($locale['err130']);
echo "<form name='reportform' method='post' action='".FUSION_SELF."'>
".$locale['err135']."
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td>".$locale['err131']."</td>
<td><input type='text' name='suggestion_summary' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td valign='top'>".$locale['err134']."</td>
<td><textarea name='suggestion_description' rows='5' class='textbox' style='width:300px;'></textarea></td>
</tr>
<tr>
<td align='center' colspan='2'>
<input type='submit' name='submit_suggestion' value='".$locale['err130']."' class='button'></td>
</tr>
</table>
<hr>
<table><table border='1'>
<tr>
<td> <B><center>".$locale['err170']."</b></td>
<td> <B> <center>".$locale['err171']."</b></td>
</tr>
<rt>
<td> <center>".$locale['err172']."</td>
<td> <center>".$locale['err173']."</td>
</tr>
<tr>
<td> <center>".$locale['err174']."</td>
<td> <center>".$locale['err175']."</td>
</table>
</form>\n";
closetable();
} else {
opentable($locale['err120']);
echo "<center><br>\n".$locale['err124']."<br><br>\n</center>\n";
closetable();
}
require_once THEMES."templates/footer.php";
?>