Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Notices

Reply
  #1  
Old 6th February 2009, 00:23
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default helpdesk
any one know how to add bbcode to this pls
PHP Code:
<?php
/********************************************************************************\
 *                                                                              *
 * ---------------------------------------------------------------------------- *
 *                              H E L P   D E S K                               *
 *                               (for TB source)                                *
 * ---------------------------------------------------------------------------- *
 *                         written by nuerher[at]gmail.com                      *
\********************************************************************************/
 
ob_start("ob_gzhandler");

function 
round_time($ts)
{
    
$mins = floor($ts / 60);
  
$hours = floor($mins / 60);
  
$mins -= $hours * 60;
  
$days = floor($hours / 24);
  
$hours -= $days * 24;
  
$weeks = floor($days / 7);
  
$days -= $weeks * 7;
  
$t = "";
  if (
$weeks > 0)
    return 
"$weeks week" . ($weeks > 1 ? "s" : "");
  if (
$days > 0)
    return 
"$days day" . ($days > 1 ? "s" : "");
  if (
$hours > 0)
    return 
"$hours hour" . ($hours > 1 ? "s" : "");
  if (
$mins > 0)
    return 
"$mins min" . ($mins > 1 ? "s" : "");
  return 
"< 1 min";
}

require_once(
"include/bittorrent.php");
dbconn(false);
loggedinorreturn();

$msg_problem = trim($_POST["msg_problem"]);
$msg_answer = trim($_POST["msg_answer"]);
$id = $_POST["id"];
$addedbyid = $_POST["addedbyid"];
$title = trim($_POST["title"]);

$action = $_GET["action"];
$solve = $_GET["solve"];

// --- action: cleanuphd
if ($action == 'cleanuphd') {
  
mysql_query("DELETE FROM helpdesk WHERE solved='yes' OR solved='ignored'");
  
$action = 'problems';
}
// --- action: problems

if ($action == 'problems') {

if (
get_user_class() < UC_MODERATOR)
{
  
stdmsg("Sorry...", "You are not authorized to enter this site.");
  
stdfoot();
  exit;
}

// Standard HD Replies
// English
$hd_reply['1'] = array("Read FAQ","First read the [url=faq.php][b]FAQ[/b][/url] and then start asking questions!");
$hd_reply['2'] = array("Search forums","Search the [url=forums.php][b]FORUMS[/b][/url] please.");
$hd_reply['3'] = array("Die n00b","Die n00b! Such a thing knows even my grandma!");

// POST & GET
$id = $_GET["id"];
$hd_answer=$_POST["hd_answer"];
if (
$hd_answer) {
        
$body = $hd_reply[$hd_answer][1];
 }

stdhead("HELP DESK - Problems");
begin_main_frame();
begin_frame("Problems");

// VIEW PROBLEM DETAILS
if ($id != 0) {

$res = mysql_query("SELECT * FROM helpdesk WHERE id = $id");
$arr = mysql_fetch_array($res);

$zap = mysql_query("SELECT username FROM users WHERE id = $arr[added_by]");
$wyn = mysql_fetch_array($zap);

$added_by_name = $wyn["username"];

$zap_s = mysql_query("SELECT username FROM users WHERE id = $arr[solved_by]");
$wyn_s = mysql_fetch_array($zap_s);

$solved_by_name = $wyn_s["username"];

print(
"<table align=center border=1 cellpadding=5 cellspacing=0>".
      
"<tr><td align=center colspan=2 class=colhead>".$arr["title"]."</td></tr>".
      
"<tr><td align=right><b>Added</b></td><td align=left>On&nbsp;<b>".$arr["added"]."</b>&nbsp;by&nbsp;<a href=userdetails.php?id=".$arr["added_by"]."><b>".$added_by_name."</b></a></td></tr>");

if (
$arr["solved"] == 'yes') {

  print(
"<tr><td align=right><b>Problem</b></td><td align=left><textarea name=msg_problem cols=80 rows=15>".$arr["msg_problem"]."</textarea></td></tr>".
        
"<tr><td align=right><b>Solved</b></td><td align=left><font color=green><b>Yes</b></font>&nbsp;on&nbsp;<b>".$arr["solved_date"]."</b>&nbsp;by&nbsp;<a href=userdetails.php?id=".$arr["solved_by"]."><b>".$solved_by_name."</b></a></td></tr>".
        
"<tr><td align=right><b>Answer</b></td><td align=left><textarea name=msg_answer cols=80 rows=15>".$arr["msg_answer"]."</textarea></td></tr></table>");

}
else if (
$arr["solved"] == 'ignored') {

  print(
"<tr><td align=right><b>Problem</b></td><td align=left><textarea name=msg_problem cols=80 rows=15>".$arr["msg_problem"]."</textarea></td></tr>".
        
"<tr><td align=right><b>Solved</b></td><td align=left><font color=orange><b>Ignored</b></font>&nbsp;on&nbsp;<b>".$arr["solved_date"]."</b>&nbsp;by&nbsp;<a href=userdetails.php?id=".$arr["solved_by"]."><b>".$solved_by_name."</b></a></td></tr>".
        
"</table>");

}
else if (
$arr["solved"] == 'no') {

$addedbyid = $arr["added_by"];

print(
"<form method=post action=helpdesk.php><tr><td><tr><td align=right><b>Problem</b></td><td align=left><textarea name=msg_problem cols=80 rows=15>".$arr["msg_problem"]."</textarea></td></tr>".
      
"<tr><td align=right><b>Solved</b></td><td align=center><font color=red><b>No</b></font>".
      
"<tr><td align=right><b>Answer</b></td><td><textarea name=msg_answer cols=80 rows=15>$body</textarea><br/>(<a href=tags.php><b>BB code</b></a> is allowed.)<input type=hidden name=id value=$id><input type=hidden name=addedbyid value=$addedbyid></td></tr>".
      
"<tr><td colspan=2 align=center><input type=submit value=Answer! class=btn> <b>||</b> <a href=helpdesk.php?action=solve&pid=$id&solved=ignored><font color=red><b>IGNORE</b></font></a></td></tr></form></table>");

}
}


// VIEW PROBLEMS
else {

print(
"<table align=center border=1 cellpadding=5 cellspacing=0><td class=colhead align=center>Added</td><td class=colhead align=center>Added by</td><td class=colhead align=center>Problem</td><td class=colhead align=center>Solved - by</td><td class=colhead align=center>Solved in*</td></tr>");

$res = mysql_query("SELECT * FROM helpdesk ORDER BY added DESC");
while(
$arr = mysql_fetch_array($res)) {

$zap = mysql_query("SELECT username FROM users WHERE id = $arr[added_by]");
$wyn = mysql_fetch_array($zap);

$added_by_name = $wyn["username"];

$zap_s = mysql_query("SELECT username FROM users WHERE id = $arr[solved_by]");
$wyn_s = mysql_fetch_array($zap_s);

$solved_by_name = $wyn_s["username"];

// SOLVED IN
$added = $arr["added"];
$solved_date = $arr["solved_date"];

if (
$solved_date == "0000-00-00 00:00:00") {
  
$solved_in = "&nbsp;[N/A]";
  
$solved_color = "black";
  }
else
{
  
$solved_in_wtf = sql_timestamp_to_unix_timestamp($arr["solved_date"]) - sql_timestamp_to_unix_timestamp($arr["added"]);
  
$solved_in = "&nbsp;[".round_time($solved_in_wtf)."]";

  if (
$solved_in_wtf > 2*3600) {
    
$solved_color = "red";
  }
  else if (
$solved_in_wtf > 3600) {
    
$solved_color = "black";
  }
  else if (
$solved_in_wtf <= 1800) {
    
$solved_color = "green";
  }

}


  print(
"<tr><td>".$arr["added"]."</td>".
        
"<td><a href=userdetails.php?id=".$arr["added_by"].">".$added_by_name."</a></td>".
        
"<td><a href=helpdesk.php?action=problems&id=".$arr["id"]."><b>".$arr["title"]."</b></a></td>");

        if (
$arr["solved"] == 'no') {
          
$solved_by = "N/A";
          print(
"<td><font color=red><b>No</b></font>&nbsp;-&nbsp;".$solved_by."</td>");
        }
        else if (
$arr["solved"] == 'yes') {
          
$solved_by = "<a href=userdetails.php?id=".$arr["solved_by"].">".$solved_by_name."</a>";
          print(
"<td><font color=green><b>Yes</b></font>&nbsp;-&nbsp;".$solved_by."</td>");
        }
        else if (
$arr["solved"] == 'ignored') {
          
$solved_by = "<a href=userdetails.php?id=".$arr["solved_by"].">".$solved_by_name."</a>";
          print(
"<td><font color=orange><b>Ignored</b></font>&nbsp;-&nbsp;".$solved_by."</td>");
        }

  print(
"<td><font color=".$solved_color.">".$solved_in."</font></td></tr>");

}

print(
"<tr><td align=center class=colhead colspan=5><form method=get action=?><input type=hidden name=action value=cleanuphd><input type=submit value='Delete solved or ignored problems' style='height:20;align:center;'></form></tr></table>");
print(
"<br><br>".
      
"<font color=green>[ xx ]</font> - great, ".
      
"<font color=black>[ xx ]</font> - ok, ".
      
"<font color=red>[ xx ]</font> - bad");
}

end_frame();
end_main_frame();

if (
$arr["solved"] == 'no') {


      print(
"<br><br>".
            
"<form method=post action=helpdesk.php?action=problems&id=$id>");
      
?>
      <table align="center"  border="1" cellspacing="0" cellpadding="5">
      <tr><td>
      <b>HD Replies:</b>
      <select name="hd_answer"><?
      
for ($i = 1; $i <= count($hd_reply); $i++)
      {
        echo 
"<option value=$i ".($hd_answer == $i?"selected":"").
          
">".$hd_reply[$i][0]."</option>\n";
      }
?>
      </select>
      <input type="submit" value="Use" class="btn">
      </td></tr></table></form>
    <?

}

print(
"</table>");
stdfoot();
exit;

}

// Main FILE

stdhead("Help Desk");
begin_main_frame();

if (
$action == 'solve') {

  
$pid = $_GET["pid"];
 
  if (
$solve = 'ignored') {
  
    
$dt = sqlesc(get_date_time());
    
mysql_query("UPDATE helpdesk SET solved='ignored', solved_by=$CURUSER[id], solved_date = $dt WHERE id=$pid");
    
  }
 
}

if ((
$msg_answer != "") && ($id != 0)){

$zap_usr = mysql_query("SELECT username FROM users WHERE id = $addedbyid");
$wyn_usr = mysql_fetch_array($zap_usr);

$addedby_name = $wyn_usr["username"];


$msg = sqlesc("[color=blue][b]==[ HELP DESK ]==[/b][/color]\n\n[quote=".$addedby_name."]".$msg_problem."[/quote]\n".$msg_answer."\n\nregards");

$dt = sqlesc(get_date_time());
mysql_query("UPDATE helpdesk SET solved='yes', solved_by=$CURUSER[id], solved_date = $dt, msg_answer = ".sqlesc($msg_answer)." WHERE id=$id");
// mysql_query("INSERT INTO messages (
mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster,unread) VALUES($CURUSER[id], $addedbyid, $dt, $msg, $CURUSER[id],'yes')");

  
stdmsg("Help desk","<b>Problem ID:</b> $id<br>Answer:<textarea name=msg_answer cols=80 rows=15>$msg</textarea><br><b>Solved by: ".$CURUSER["id"]."</b><br>STATUS: <b>SOLVED</b><br>");
  
end_main_frame();
  
stdfoot();
  exit;

}


if ((
$msg_problem != "") && ($title != "")){

  
$dt = sqlesc(get_date_time());
  
mysql_query("INSERT INTO helpdesk (title, msg_problem, added, added_by) VALUES (".sqlesc($title).", ".sqlesc($msg_problem).", $dt, $CURUSER[id])") or sqlerr();

// mysql_query("INSERT INTO helpdesk (added) VALUES ($dt)") or sqlerr();

  
stdmsg("Help desk", "Message sent! Await for reply.");
  
end_main_frame();
  
stdfoot();
  exit;
}



// ----- MAIN HELP DESK ---------

if (get_user_class() >= UC_MODERATOR)
{
print(
"<center><a href=helpdesk.php?action=problems><h1>PROBLEMS</h1></a></center><br/>");
}
?>
<!-- ENGLISH -->
<center><font color=red size=2><blockquote>Before using <b>Help Desk</b> make sure to read <a href=faq.php><b>FAQ</b></a> and search <a href=forums.php><b>Forums</b></a> first.</blockquote></font><br/></center>
<center><h1>HELP DESK</h1></center>
<center><font color="red" size="2"><b>( -- BETA -- )</b></font></center><br/>

<form method="post" action="helpdesk.php">
<table border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td align="right">&nbsp;<b>TITLE:</b></td>
    <td align="left"><input type="text" size="73" maxlength="60" name="title"></td>
  </tr>
<!--
  <tr>
    <td align="left" colspan="2"></td>
  </tr>
-->
  <tr>
    <td colspan="2"><textarea name="msg_problem" cols="80" rows="15"><?php print($msg_problem);?></textarea><!--<br>(<a href=tags.php class=altlink>BB</a> tags are <b>allowed</b>.)--></td>
  </tr>
  <tr>
    <td align="center" colspan="2"><input type="submit" value="Help me!" class="btn"></td>
  </tr>
</table>
</form>


<?php
end_main_frame
();
stdfoot();
?>
Reply With Quote
  #2  
Old 8th February 2009, 13:08
hack346's Avatar
hack346 hack346 is offline
Senior Member
 
Join Date: Mar 2008
Turkey
Posts: 80
Default
replace this:

Code:
<textarea name="msg_problem" cols="80" rows="15"><?php print($msg_problem);?></textarea>
with this:

Code:
<?php textbbcode("msg", "msg_problem"); ?>
Must work
__________________
https://t.me/pump_upp
Reply With Quote
  #3  
Old 8th February 2009, 14:38
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
ok shows up but the smilies dont go in the description box
also it doesnt send a ticket
Reply With Quote
  #4  
Old 8th February 2009, 18:21
hack346's Avatar
hack346 hack346 is offline
Senior Member
 
Join Date: Mar 2008
Turkey
Posts: 80
Default
try
Code:
<?php textbbcode("msg_problem", "msg_problem"); ?>
also change first "msg_problem" with "title"
__________________
https://t.me/pump_upp

Last edited by hack346; 8th February 2009 at 18:24.
Reply With Quote
  #5  
Old 8th February 2009, 20:24
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
nope now nowt works no ticket or smilies in box
Reply With Quote
  #6  
Old 10th February 2009, 10:25
hack346's Avatar
hack346 hack346 is offline
Senior Member
 
Join Date: Mar 2008
Turkey
Posts: 80
Smile
find"
Code:
<form method="post" action="helpdesk.php">
<table border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td align="right">&nbsp;<b>TITLE:</b></td>
    <td align="left"><input type="text" size="73" maxlength="60" name="title"></td>
  </tr>
<!--
  <tr>
    <td align="left" colspan="2"></td>
  </tr>
-->
  <tr>
    <td colspan="2"><?php textbbcode("msg", "msg_problem"); ?><!--<br>(<a href=tags.php class=altlink>BB</a> tags are <b>allowed</b>.)--></td>
  </tr>
  <tr>
    <td align="center" colspan="2"><input type="submit" value="Help me!" class="btn"></td>
  </tr>
</table>
</form>

replace with:

Code:
<form method="post" name="msg" action="helpdesk.php"><input type=hidden name=action value=report readonly='readonly' />
<table border="0" align="center" cellpadding="5" cellspacing="0" width="100%">
<tr><td class="ttable_col1">Title:</td><td align="left" class=ttable_col2><input type="text" style="width:100%" maxlength="60" name="title"></td></tr>
<tr><td class="ttable_col1">Body</td><td align="left" class=ttable_col2><?php textbbcode("msg", "msg_problem"); ?></td></tr>
<tr><td align="center" colspan="2"><input type="submit" value="Help me!"></td></tr>
</table>
</form>

must work 100%
__________________
https://t.me/pump_upp
Reply With Quote
Reply

Tags
helpdesk

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 00:55. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2026, vBulletin Solutions Inc.