"`\$Top Level`0", 4=>"`^Escalated`0", 0=>"`bUnhandled`b", 1=>"In-Progress", 6=>"`%Bug`0", 7=>"`#Awaiting Points`0", 3=>"`!Informational`0", 2=>"`iClosed`i", ); //$statuses = modulehook("petition-status", $status); $statuses=translate_inline($statuses); $op = httpget("op"); $id = httpget("id"); if (trim(httppost('insertcommentary'))!="") { /* Update the bug if someone adds comments as well */ $sql = "UPDATE " . db_prefix("petitions") . " SET closeuserid='{$session['user']['acctid']}',closedate='".date("Y-m-d H:i:s")."' WHERE petitionid='$id'"; db_query($sql); } // Eric decide he didn't want petitions to be manually deleted // //if ($op=="del"){ // $sql = "DELETE FROM " . db_prefix("petitions") . " WHERE petitionid='$id'"; // db_query($sql); // $sql = "DELETE FROM " . db_prefix("commentary") . " WHERE section='pet-$id'"; // db_query($sql); // invalidatedatacache("petition_counts"); // $op=""; //} page_header("Petition Viewer"); require_once("lib/superusernav.php"); superusernav(); if ($op==""){ $sql = "DELETE FROM " . db_prefix("petitions") . " WHERE status=2 AND closedate<'".date("Y-m-d H:i:s",strtotime("-7 days"))."'"; db_query($sql); if(db_affected_rows()) { invalidatedatacache("petition_counts"); } $setstat = httpget("setstat"); if ($setstat!=""){ $sql = "SELECT status FROM " . db_prefix("petitions") . " WHERE petitionid='$id'"; $result = db_query($sql); $row = db_fetch_assoc($result); if ($row['status']!=$setstat){ $sql = "UPDATE " . db_prefix("petitions") . " SET status='$setstat',closeuserid='{$session['user']['acctid']}',closedate='".date("Y-m-d H:i:s")."' WHERE petitionid='$id'"; db_query($sql); invalidatedatacache("petition_counts"); } } reset($statuses); $sort = ""; $pos = 0; while (list($key,$val)=each($statuses)){ $sort.=" WHEN $key THEN $pos"; $pos++; } $petitionsperpage = 50; $sql = "SELECT count(petitionid) AS c from ".db_prefix("petitions"); $result = db_query($sql); $row = db_fetch_assoc($result); $totalpages = ceil($row['c']/$petitionsperpage); $page = httpget("page"); if ($page == "") { if (isset($session['petitionPage'])){ $page = (int)$session['petitionPage']; }else{ $page = 1; } } if ($page < 1) $page = 1; if ($page > $totalpages) $page = $totalpages; $session['petitionPage'] = $page; // No need to show the pages if there is only one. if ($totalpages != 1) { addnav("Page"); for ($x=1; $x <= $totalpages; $x++){ if ($page == $x){ addnav(array("`b`#Page %s`0`b", $x),"viewpetition.php?page=$x"); }else{ addnav(array("Page %s", $x),"viewpetition.php?page=$x"); } } } if ($page > 1){ $limit = (($page-1) * $petitionsperpage) . "," . $petitionsperpage; }else{ $limit = "$petitionsperpage"; } $sql = "SELECT petitionid, ".db_prefix("accounts").".name, ".db_prefix("petitions").".date, ".db_prefix("petitions").".status, ".db_prefix("petitions").".body, ".db_prefix("petitions").".closedate, accts.name AS closer, CASE status $sort END AS sortorder FROM ".db_prefix("petitions")." LEFT JOIN ".db_prefix("accounts")." ON ".db_prefix("accounts").".acctid=".db_prefix("petitions").".author LEFT JOIN ".db_prefix("accounts")." AS accts ON accts.acctid=".db_prefix("petitions").".closeuserid ORDER BY sortorder ASC, date ASC LIMIT $limit"; $result = db_query($sql); addnav("Petitions"); addnav("Refresh","viewpetition.php"); $num = translate_inline("Num"); $ops = translate_inline("Ops"); $from = translate_inline("From"); $sent = translate_inline("Sent"); $com = translate_inline("Com"); $last = translate_inline("Last Updater"); $when = translate_inline("Updated"); $view = translate_inline("View"); $close = translate_inline("Close"); $mark = translate_inline("Mark"); rawoutput("
$num | $ops | $from | $sent | $com | $last | $when |
"); output_notl("%s", $statuses[$row['status']]); rawoutput(" | ||||||
"); output_notl("%s", $row['petitionid']); rawoutput(" | "); rawoutput("[ "); rawoutput("$view",true); rawoutput(" | $close"); output_notl(" | %s: ", $mark); output_notl("`b`&U`0`b/",true); output_notl("`7P`0/",true); //output_notl("`!I`0/",true); output_notl("`^E`0",true); //output_notl("`\$T`0/",true); //output_notl("`%B`0/",true); //output_notl("`#A`0",true); rawoutput(" ] | "); addnav("","viewpetition.php?op=view&id={$row['petitionid']}"); addnav("","viewpetition.php?setstat=2&id={$row['petitionid']}"); addnav("","viewpetition.php?setstat=0&id={$row['petitionid']}"); addnav("","viewpetition.php?setstat=1&id={$row['petitionid']}"); //addnav("","viewpetition.php?setstat=3&id={$row['petitionid']}"); addnav("","viewpetition.php?setstat=4&id={$row['petitionid']}"); //addnav("","viewpetition.php?setstat=5&id={$row['petitionid']}"); //addnav("","viewpetition.php?setstat=6&id={$row['petitionid']}"); //addnav("","viewpetition.php?setstat=7&id={$row['petitionid']}"); rawoutput(""); if ($row['name']==""){ $v = substr($row['body'],0,strpos($row['body'],"[email")); $v = preg_replace("'\\[PHPSESSID\\] = .*'", "", $v); $v = preg_replace("'[^a-zA-Z0-91234567890\\[\\]= @.!,?-]'","", $v); // Make sure we don't get something too large.. 50 chars max $v = substr($v, 0, 50); output_notl("`\$%s`0", $v); }else{ output_notl("`&%s`0", $row['name']); } rawoutput(" | "); rawoutput(""); output_notl("`7%s`0", reltime(strtotime($row['date']))); rawoutput(" | "); rawoutput(""); output_notl("`#%s`0", $counter['c']); rawoutput(" | "); rawoutput(""); output_notl("`^%s`0", $row['closer']); rawoutput(" | "); rawoutput(""); if ($row['closedate'] != 0) output_notl("`7%s`0", reltime(strtotime($row['closedate']))); rawoutput(" | "); rawoutput("