echo $aInt->lang("fields", "firstname"); echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"firstname\" size=\"30\" value=\""; echo $firstname; echo "\"></td></tr>\n<tr><td class=\"fieldlabel\">"; echo $aInt->lang("fields", "lastname"); echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"lastname\" size=\"30\" value=\""; echo $lastname; echo "\"></td></tr>\n<tr><td class=\"fieldlabel\">"; echo $aInt->lang("fields", "email"); echo "</td><td class=\"fieldarea\"><input type=\"text\" name=\"email\" size=\"50\" value=\""; echo $email; echo "\"></td></tr>\n<tr><td class=\"fieldlabel\">"; echo $aInt->lang("administrators", "ticketnotifications"); echo "</td><td class=\"fieldarea\">"; $nodepartments = true; $supportdepts = getAdminDepartmentAssignments(); foreach ($supportdepts as $deptid) { $deptname = get_query_val("tblticketdepartments", "name", array("id" => $deptid)); if ($deptname) { echo "<label><input type=\"checkbox\" name=\"ticketnotify[]\" value=\"" . $deptid . "\"" . (in_array($deptid, $ticketnotify) ? " checked" : "") . " /> " . $deptname . "</label><br />"; $nodepartments = false; continue; } } if ($nodepartments) { echo $aInt->lang("administrators", "nosupportdeptsassigned"); } echo "</td></tr>\n<tr><td class=\"fieldlabel\">"; echo $aInt->lang("administrators", "supportsig"); echo "</td><td class=\"fieldarea\"><textarea name=\"signature\" cols=80 rows=4>"; echo $signature;
function validateAdminTicketAccess($ticketid) { $data = get_query_vals("tbltickets", "id,did,flag", array("id" => $ticketid)); $id = $data['id']; $deptid = $data['did']; $flag = $data['flag']; if (!$id) { return "invalidid"; } if (!in_array($deptid, getAdminDepartmentAssignments()) && !checkPermission("Access All Tickets Directly", true)) { return "deptblocked"; } if ($flag && $flag != $_SESSION['adminid'] && !checkPermission("View Flagged Tickets", true) && !checkPermission("Access All Tickets Directly", true)) { return "flagged"; } return false; }
if ($deptfilter) { $filters[] = "did IN (" . db_build_in_array(getAdminDepartmentAssignments()) . ")"; } $query .= implode(" AND ", $filters) . (" ORDER BY tbltickets." . $orderby . " " . $order); $numresultsquery = "SELECT COUNT(tbltickets.id)" . $query; $result = full_query($numresultsquery); $data = mysql_fetch_array($result); $numrows = $data[0]; $query = "SELECT tbltickets.*,tblclients.firstname,tblclients.lastname,tblclients.companyname,tblclients.groupid" . $query . " LIMIT " . (int) $page * $limit . "," . (int) $limit; $result = full_query($query); buildAdminTicketListArray($result); echo $aInt->sortableTable(array("checkall", "", $aInt->lang("support", "department"), array("title", $aInt->lang("fields", "subject")), $aInt->lang("support", "submitter"), array("status", $aInt->lang("fields", "status")), array("lastreply", $aInt->lang("support", "lastreply"))), $tabledata, $tableformurl, $tableformbuttons, true); $smartyvalues['tagcloud'] = $tickets->buildTagCloud(); } if ($action == "search") { $where = "tid='" . db_escape_string($ticketid) . "' AND did IN (" . db_build_in_array(db_escape_numarray(getAdminDepartmentAssignments())) . ")"; $result = select_query("tbltickets", "", $where); $data = mysql_fetch_array($result); $id = $data['id']; if (!$id) { echo "<p>" . $aInt->lang("support", "ticketnotfound") . " <a href=\"javascript:history.go(-1)\">" . $aInt->lang("support", "pleasetryagain") . "</a>.</p>"; } else { $action = "viewticket"; } } if ($action == "viewticket") { releaseSession(); $aInt->template = "viewticket"; $smartyvalues['inticket'] = true; $ticket = new WHMCS_Tickets(); $ticket->setID($id);