function dcl_error_handler($errno, $errstr, $errfile, $errline) { global $g_oPage, $g_oSec; if (!($errno & error_reporting())) { return; } $aBacktrace = array(); if (function_exists('debug_backtrace')) { $aBacktrace = debug_backtrace(); } switch ($errno) { case E_COMPILE_ERROR: case E_PARSE: case E_CORE_ERROR: case E_USER_ERROR: case E_ERROR: ShowError($errstr, $errfile, $errline, $aBacktrace); break; case E_CORE_WARNING: case E_USER_WARNING: case E_WARNING: ShowWarning($errstr, $errfile, $errline, $aBacktrace); break; case E_NOTICE: case E_USER_NOTICE: ShowInfo($errstr, $errfile, $errline, $aBacktrace); break; } if ($errno == E_COMPILE_ERROR || $errno == E_PARSE) { $g_oPage->EndPage(); exit(255); } }
if (isset($_POST["save"])) { $password = $_POST["password"]; $password_confirm = $_POST["password_confirm"]; $name = $_POST["name"]; $email = CleanString($_POST["email"]); $phone_number = CleanString($_POST["phone_number"]); if (empty($name) || empty($email) || empty($phone_number)) { ShowError("One or more fields were empty!"); } elseif ($password != $password_confirm) { ShowError("Passwords did not match! Go back and try again."); } else { if (strlen($password) > 0) { $me->SetPassword(EncryptPassword($password)); } $me->Edit($name, $me->GetType(), $me->GetBuilding(), $email, $phone_number); ShowInfo("Saved Settings"); } } ?> <div class="container"> <div class="row"> <div class="col-sm-4"> <form class="form-horizontal" role="form" method="post"> <div class="form-group"> <label for="password">Password</label> <input type="password" class="form-control" id="password" name="password" placeholder="Password"> <p class="help-block">Leave blank to keep the current password.</p> </div> <div class="form-group"> <label for="password_confirm">Confirm Password</label>
<label for="username">Building Name</label> <input type="text" class="form-control" id="name" name="name" placeholder="Enter building name"> </div> <div class="form-group"> <label for="password">Building Community</label> <input type="text" class="form-control" id="parent" name="parent" placeholder="Enter building community"> </div> <div class="form-group"> <button type="submit" name="add" class="btn btn-default">Add Building</button> </div> </form> <?php } elseif (isset($_GET["name"]) && isset($_GET["delete"])) { if (Building::Exists($_GET["name"])) { Building::Remove($_GET["name"]); ShowInfo("Removed Building Successfully"); RedirectTimer("admin&buildings", 0); } else { ShowError("Invalid building name."); } } else { ?> <p> <a href="index.php?p=admin&buildings&add"><button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Add Building</button></a> </p> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <th>Name</th>
function RedirectTimer($page, $seconds) { echo "<meta http-equiv=\"refresh\" content=\"{$seconds};url=index.php?p={$page}\">"; ShowInfo("You will be redirected in {$seconds} seconds..."); }
function prioritize() { global $g_oSec; commonHeader(); if (!$g_oSec->HasPerm(DCL_ENTITY_HOTLIST, DCL_PERM_MODIFY)) { return PrintPermissionDenied(); } $hotlistId = @DCL_Sanitize::ToInt($_REQUEST['hotlist_id']); if ($hotlistId === null || $hotlistId < 1) { return PrintPermissionDenied(); } $dbHotlist = CreateObject('dcl.dbHotlist'); if ($dbHotlist->Load($hotlistId) === -1) { return PrintPermissionDenied(); } $db = CreateObject('dcl.dbEntityHotlist'); $rs = $db->listById($hotlistId); if ($rs === -1) { ShowInfo('No items found in hot list.', __FILE__, __LINE__, null); return -1; } $t = CreateSmarty(); $items = $db->FetchAllRows(); $t->assign_by_ref('items', $items); $t->assign('VAL_HOTLIST_ID', $hotlistId); $t->assign('VAL_HOTLIST_NAME', $dbHotlist->hotlist_tag); SmartyDisplay($t, 'htmlHotlistPrioritize.tpl'); }
if (isset($_POST["ticket"])) { $clientid = CleanString($_POST["clientid"]); $description = $_POST["description"]; if (!isset($_POST["tags"])) { ShowError("You must specify at least one tag!"); } else { $tags = $_POST["tags"]; $client = Client::GetByUsername($clientid); if (empty($clientid) || empty($description) || empty($tags)) { ShowError("One or more fields were empty!"); } elseif (!$client->IsValid()) { ShowError("Invalid Client ID."); } else { $ticket = Ticket::Add($client->GetID(), $me->GetID(), $description, STATUS_OPENED, $tags, $client->GetBuilding(), Building::GetCommunity($client->GetBuilding())); $me->IncrementPoints(5); ShowInfo("Created Ticket Successfully"); RedirectTimer("ticket&id=" . $ticket->GetID(), 0); } } } else { ?> <form class="form-horizontal" role="form" method="post"> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> Client Information </div> <div class="panel-body"> <div class="form-group">
function searchTickets($searchText) { global $g_oSec; commonHeader(); if ($g_oSec->IsPublicUser() && !$g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_SEARCH)) { ShowInfo('You must provide a ticket ID.', __FILE__, __LINE__, null); return; } $this->oView->title = STR_TCK_TICKETSEARCHRESULTS; $this->oView->table = 'tickets'; $this->oView->AddDef('filterlike', 'issue', $searchText); $this->oView->AddDef('filterlike', 'summary', $searchText); if ($g_oSec->IsPublicUser()) { $this->oView->AddDef('filter', 'is_public', "'Y'"); $this->oView->AddDef('filter', 'products.is_public', "'Y'"); } if ($_REQUEST['which'] == 'opentickets') { $this->oView->AddDef('filternot', 'statuses.dcl_status_type', '2'); } $this->oView->AddDef('columns', '', array('ticketid', 'responsible.short', 'products.name', 'dcl_org.name', 'statuses.name', 'dcl_contact.last_name', 'dcl_contact.first_name', 'dcl_contact_phone.phone_number', 'dcl_tag.tag_desc', 'summary')); $this->oView->AddDef('order', '', array('ticketid')); $this->oView->AddDef('columnhdrs', '', array(STR_TCK_TICKET, STR_TCK_RESPONSIBLE, STR_TCK_PRODUCT, STR_TCK_ACCOUNT, STR_TCK_STATUS, 'Last Name', 'First Name', STR_TCK_CONTACTPHONE, STR_CMMN_TAGS, STR_TCK_SUMMARY)); $objHV = CreateViewObject($this->oView->table); $objHV->Render($this->oView); }
ShowError("You can not reassign a ticket to the same person!", true); } else { $body = $me->GetName() . " (" . $me->GetUsername() . ") has assigned you a ticket!"; $staff->SendTextMessage($body . " Reply for more information."); $body .= $ticket->GetEmailBody($clientid, $name, $community, $building, $room); $staff->SendEmail("Ticket Assignment", $body); $ticket->SetStaffID($staff->GetID()); ShowInfo("Reassigned Successfully"); } } else { ShowError("Invalid staff member username", true); } } elseif (isset($_GET["status"])) { $status = $_GET["status"]; if (($status == STATUS_OPENED || $status == STATUS_CLOSED) && $status != $ticket->GetStatus()) { ShowInfo("The ticket has been " . ($status == STATUS_OPENED ? "Opened" : "Closed") . "."); $ticket->SetStatus($status); } } $staff = Staff::Load($ticket->GetStaffID()); $opened = $ticket->GetStatus() == STATUS_OPENED; $assignedTo = $staff->GetUsername(); $assignedToMe = $staff->GetID() === $me->GetID(); ?> <div class="row" style="padding-bottom: 10px;"> <div class="col-lg-12"> <a href="index.php?p=tickets" class="btn btn-default"><i class="fa fa-arrow-left"></i> View all Tickets</a> <span style="float: right;"> <?php