Ejemplo n.º 1
0
 function TicketMonitor()
 {
     require_once INCLUDE_DIR . 'class.ticket.php';
     require_once INCLUDE_DIR . 'class.lock.php';
     //Ticket::checkOverdue(); //Make stale tickets overdue
     TicketLock::cleanup();
     //Remove expired locks
 }
Ejemplo n.º 2
0
     if (!$errors && $ticket->isAssigned()) {
         //Re assigning.
         //Already assigned to the user?
         if ($_POST['staffId'] == $ticket->getStaffId()) {
             $errors['staffId'] = _('Ticket already assigned to the staff.');
         }
         //Admin, Dept manager (any) or current assigneee ONLY can reassign
         if (!$thisuser->isadmin() && !$thisuser->isManager() && $thisuser->getId() != $ticket->getStaffId()) {
             $errors['err'] = _('Ticket already assigned. You do not have permission to re-assign assigned tickets');
         }
     }
     if (!$errors && $ticket->assignStaff($_POST['staffId'], $thisuser->getId(), $_POST['assign_message'], TRUE)) {
         $staff = $ticket->getStaff();
         $msg = _('Ticket Assigned to') . ' ' . ($staff ? $staff->getName() : _('staff'));
         //Remove all the locks and go back to index page.
         TicketLock::removeStaffLocks($thisuser->getId(), $ticket->getId());
         $page = 'tickets.inc.php';
         $ticket = null;
     } elseif (!$errors['err']) {
         $errors['err'] = _('Unable to assign the ticket');
     }
     break;
 case 'postnote':
     $fields = array();
     $fields['title'] = array('type' => 'string', 'required' => 1, 'error' => _('Title required'));
     $fields['note'] = array('type' => 'string', 'required' => 1, 'error' => _('Note message required'));
     $params = new Validator($fields);
     if (!$params->validate($_POST)) {
         $errors = array_merge($errors, $params->errors());
     }
     if (!$errors && $ticket->postNote($_POST['title'], $_POST['note'])) {
Ejemplo n.º 3
0
 function lookup($id, $tid)
 {
     return $id && ($lock = new TicketLock($id, $tid)) && $lock->getId() == $id ? $lock : null;
 }
Ejemplo n.º 4
0
    Copyright (c)  2006-2013 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require('staff.inc.php');

//Check token: Make sure the user actually clicked on the link to logout.
if(!$_GET['auth'] || !$ost->validateLinkToken($_GET['auth']))
    @header('Location: index.php');

$thisstaff->logOut();

//Clear any ticket locks the staff has.
TicketLock::removeStaffLocks($thisstaff->getId());

//Destroy session on logout.
// TODO: Stop doing this starting with 1.9 - separate session data per
// app/panel.
session_unset();
session_destroy();

osTicketSession::destroyCookie();

@header('Location: login.php');
require('login.php');
?>
Ejemplo n.º 5
0
 function acquireLock()
 {
     global $thisuser, $cfg;
     if (!$thisuser or !$cfg->getLockTime()) {
         //Lockig disabled?
         return null;
     }
     //Check if the ticket is already locked.
     if (($lock = $this->getLock()) && !$lock->isExpired()) {
         if ($lock->getStaffId() != $thisuser->getId()) {
             //someone else locked the ticket.
             return null;
         }
         //Lock already exits...renew it
         $lock->renew();
         //New clock baby.
         return $lock;
     }
     //No lock on the ticket or it is expired
     $this->tlock = null;
     //clear crap
     $this->lock_id = TicketLock::acquire($this->getId(), $thisuser->getId());
     //Create a new lock..
     //load and return the newly created lock if any!
     return $this->getLock();
 }
Ejemplo n.º 6
0
 function releaseLock($tid, $id = 0)
 {
     global $thisstaff;
     if ($id && is_numeric($id)) {
         //Lock Id provided!
         $lock = TicketLock::lookup($id, $tid);
         //Already gone?
         if (!$lock || !$lock->getStaffId() || $lock->isExpired()) {
             //Said lock doesn't exist or is is expired
             return 1;
         }
         //make sure the user actually owns the lock before releasing it.
         return $lock->getStaffId() == $thisstaff->getId() && $lock->release() ? 1 : 0;
     } elseif ($tid) {
         //release all the locks the user owns on the ticket.
         return TicketLock::removeStaffLocks($thisstaff->getId(), $tid) ? 1 : 0;
     }
     return 0;
 }
Ejemplo n.º 7
0
 function releaseLock($params)
 {
     global $thisuser;
     if ($params['id'] && is_numeric($params['id'])) {
         //Lock Id provided!
         $lock = new TicketLock($params['id']);
         //Already gone?
         if (!$lock->load() || !$lock->getStaffId() || $lock->isExpired()) {
             //Said lock doesn't exist or is is expired
             return 1;
         }
         //make sure the user actually owns the lock before releasing it.
         return $lock->getStaffId() == $thisuser->getId() && $lock->release() ? 1 : 0;
     } elseif ($params['tid']) {
         //release all the locks the user owns on the ticket.
         return TicketLock::removeStaffLocks($thisuser->getId(), $params['tid']) ? 1 : 0;
     }
     return 0;
 }
Ejemplo n.º 8
0
 function renewLock($params)
 {
     global $thisuser;
     if (!$params['id'] or !is_numeric($params['id'])) {
         return '{"id":0, "retry":true}';
     }
     $lock = new TicketLock($params['id']);
     if (!$lock->load() || !$lock->getStaffId() || $lock->isExpired()) {
         //Said lock doesn't exist or is is expired
         return TicketsAjaxAPI::acquireLock($params);
     }
     //acquire the lock
     if ($lock->getStaffId() != $thisuser->getId()) {
         //user doesn't own the lock anymore??? sorry...try to next time.
         return '{"id":0, "retry":false}';
     }
     //Give up...
     //Renew the lock.
     $lock->renew();
     //Failure here is not an issue since the lock is not expired yet..
     return '{"id":' . $lock->getId() . ', "time":' . $lock->getTime() . '}';
 }