$qfrom = ' FROM ' . TICKET_TABLE . ' ticket ' . ' LEFT JOIN ' . DEPT_TABLE . ' dept ON ticket.dept_id=dept.dept_id '; if ($search && $deep_search) { $qfrom .= ' LEFT JOIN ' . TICKET_MESSAGE_TABLE . ' message ON (ticket.ticket_id=message.ticket_id )'; $qfrom .= ' LEFT JOIN ' . TICKET_EVENTS_TABLE . ' note ON (ticket.ticket_id=note.ticket_id )'; } $qgroup = ' GROUP BY ticket.ticket_id'; //get ticket count based on the query so far.. $total = db_count("SELECT count(DISTINCT ticket.ticket_id) {$qfrom} {$qwhere}"); //pagenate $pageNav = new PageNate($total, $page, $pagelimit); $pageNav->setURL('tickets.php', $qstr . '&sort=' . urlencode($_REQUEST['sort']) . '&order=' . urlencode($_REQUEST['order'])); //Ok..lets roll...create the actual query //ADD attachment,priorities and lock crap $qselect .= ' , IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date'; $qfrom .= ' LEFT JOIN ' . PRIORITY_TABLE . ' pri ON ticket.priority_id=pri.priority_id ' . ' LEFT JOIN ' . TICKET_LOCK_TABLE . ' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ' . ' LEFT JOIN ' . TICKET_ATTACHMENT_TABLE . ' attach ON ticket.ticket_id=attach.ticket_id ' . ' LEFT JOIN ' . STAFF_TABLE . ' staff ON ticket.staff_id=staff.staff_id '; $query = "{$qselect} {$qfrom} {$qwhere} {$qgroup} ORDER BY {$order_by} {$order} LIMIT " . $pageNav->getStart() . "," . $pageNav->getLimit(); // echo $query; $tickets_res = db_query($query); $showing = db_num_rows($tickets_res) ? $pageNav->showing() : ""; if (!$results_type) { $results_type = $search ? 'Search Results' : ucfirst($status) . ' Tickets'; } $negorder = $order == 'DESC' ? 'ASC' : 'DESC'; //Negate the sorting.. //Permission setting we are going to reuse. $canDelete = $canClose = false; $canDelete = $thisuser->canDeleteTickets(); $canClose = $thisuser->canCloseTickets(); $basic_display = !isset($_REQUEST['advance_search']) ? true : false; //YOU BREAK IT YOU FIX IT. ?>
} if ($_REQUEST['order']) { $order = $orderWays[$_REQUEST['order']]; } $order_column = $order_column ? $order_column : 'stdreply.title'; $order = $order ? $order : 'DESC'; $order_by = $search ? '' : " ORDER BY {$order_column} {$order} "; $total = db_count('SELECT count(*) ' . $from . ' ' . $where); $pagelimit = $thisuser->getPageLimit(); $pagelimit = $pagelimit ? $pagelimit : PAGE_LIMIT; //true default...if all fails. $page = $_GET['p'] && is_numeric($_GET['p']) ? $_GET['p'] : 1; $pageNav = new PageNate($total, $page, $pagelimit); $pageNav->setURL('stdreply.php', $qstr . '&sort=' . urlencode($_REQUEST['sort']) . '&order=' . urlencode($_REQUEST['order'])); //Ok..lets roll...create the actual query $query = "{$select} {$from} {$where} {$order_by} LIMIT " . $pageNav->getStart() . "," . $pageNav->getLimit(); //echo $query; $replies = db_query($query); $showing = db_num_rows($replies) ? $pageNav->showing() : ''; $results_type = $search ? _('Search Results') : _('Standard/Canned Replies'); $negorder = $order == 'DESC' ? 'ASC' : 'DESC'; //Negate the sorting.. ?> <div> <?php if ($errors['err']) { ?> <p align="center" id="errormessage"><?php echo $errors['err']; ?> </p>
} if ($endTime) { $qwhere .= ' AND created<=FROM_UNIXTIME(' . $endTime . ')'; $qstr .= '&endDate=' . urlencode($_REQUEST['endDate']); } } $qselect = 'SELECT log.* '; $qfrom = ' FROM ' . SYSLOG_TABLE . ' log '; //get log count based on the query so far.. $total = db_count("SELECT count(*) {$qfrom} {$qwhere}"); $pagelimit = 30; $page = $_GET['p'] && is_numeric($_GET['p']) ? $_GET['p'] : 1; //pagenate $pageNav = new PageNate($total, $page, $pagelimit); $pageNav->setURL('admin.php', $qstr); $query = "{$qselect} {$qfrom} {$qwhere} ORDER BY log.created DESC LIMIT " . $pageNav->getStart() . "," . $pageNav->getLimit(); //echo $query; $result = db_query($query); $showing = db_num_rows($resp) ? $pageNav->showing() : ""; ?> <div class="msg"><?php echo _('System Logs'); ?> </div> <div id='filter' style="margin-bottom:8px;"> <form action="admin.php?t=syslog" method="get"> <input type="hidden" name="t" value="syslog" /> <div style="padding-left:15px;"> <?php echo _('Date Span:'); ?>