function display($tpl = NULL) { $action = FSS_Input::getCmd('action'); if ($action == "cancel") { $mainframe = JFactory::getApplication(); $link = FSSRoute::_('index.php?option=com_fss&view=admin_support', false); $mainframe->redirect($link); return; } if ($action == "save" || $action == "apply") { $all = array('per_page', 'group_products', 'group_departments', 'group_cats', 'group_group', 'group_pri', 'return_on_reply', 'return_on_close', 'reverse_order', 'reports_separator'); $values = array(); $values = SupportUsers::getAllSettings(); foreach ($all as $setting) { $new = FSS_Input::getString($setting, 0); $values->{$setting} = $new; } SupportUsers::updateUserSettings($values); if ($action == "save") { $link = FSSRoute::_('index.php?option=com_fss&view=admin_support', false); } else { $link = FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=settings', false); } $mainframe = JFactory::getApplication(); $mainframe->redirect($link, JText::_('SETTINGS_SAVED')); return; } $this->_display(); }
function save() { // if we are saving, then save $saveid = FSS_Input::getInt('saveid', -1); if ($saveid != -1) { $description = FSS_Input::getString('description'); $is_personal = FSS_Input::getInt('personal'); $content = FSS_Input::getHTML('content'); $params = array(); if ($is_personal) { $params['userid'] = JFactory::getUser()->id; } $params = json_encode($params); if ($saveid == 0) { $qry = "INSERT INTO #__fss_ticket_fragments (description, params, content, type) VALUES ("; $qry .= "'" . FSSJ3Helper::getEscaped($db, $description) . "',"; $qry .= "'" . FSSJ3Helper::getEscaped($db, $params) . "',"; $qry .= "'" . FSSJ3Helper::getEscaped($db, $content) . "', 1)"; $db = JFactory::getDBO(); $db->setQuery($qry); $db->Query(); } else { $qry = "UPDATE #__fss_ticket_fragments SET description = '" . FSSJ3Helper::getEscaped($db, $description) . "', "; $qry .= "params = '" . FSSJ3Helper::getEscaped($db, $params) . "', "; $qry .= "content = '" . FSSJ3Helper::getEscaped($db, $content) . "' WHERE id = " . FSSJ3Helper::getEscaped($db, $saveid); $db = JFactory::getDBO(); $db->setQuery($qry); $db->Query(); } } $mainframe = JFactory::getApplication(); $link = JRoute::_('index.php?option=com_fss&view=admin_support&layout=signature&tmpl=component', false); $mainframe->redirect($link); }
function Save($id, $params) { $params = $this->parseParams($params); $value = FSS_Input::getString("custom_{$id}"); if ($value == "xxxotherxxx") { $value = FSS_Input::getString("custom_{$id}_other"); } return $value; }
function Save($id, $params) { $checked = array(); $posted = FSS_Input::getInt("custom_{$id}_count"); if ($posted) { for ($i = 1; $i <= $posted; $i++) { $val = FSS_Input::getString("custom_{$id}_{$i}"); if ($val) { $checked[] = $val; } } } return json_encode($checked); }
function process() { $posted = JRequest::get('post'); $ticket_ids = array(); foreach ($posted as $var => $value) { if (substr($var, 0, 7) == "ticket_") { $ticket_id = (int) substr($var, 7); if ($ticket_id > 0) { $ticket_ids[$ticket_id] = $ticket_id; } } } if (count($ticket_ids) == 0) { return; } $db = JFactory::getDBO(); $tickets = array(); foreach ($ticket_ids as $ticketid) { $ticket = new SupportTicket(); if ($ticket->Load($ticketid)) { $ticket->is_batch = true; $tickets[$ticketid] = $ticket; } else { unset($ticket_ids[$ticket_id]); } } $new_pri = FSS_Input::getInt('batch_priority'); if ($new_pri > 0) { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->updatePriority($new_pri); } } $new_status = FSS_Input::getInt('batch_status'); if ($new_status > 0) { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->updateStatus($new_status); } } if (FSS_Input::getString('batch_handler') != "") { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->assignHandler(FSS_Input::getInt('batch_handler')); } } $should_delete = FSS_Input::getCmd('batch_status'); if ($should_delete == "delete") { foreach ($ticket_ids as $ticketid) { $tickets[$ticketid]->delete(); } } }
/** * Updates the category for a ticket */ function search() { $q = FSS_Input::getString('q'); $db = JFactory::getDBO(); $qry = "SELECT username, name FROM #__users WHERE username LIKE '%" . $db->escape($q) . "%' OR name LIKE '%" . $db->escape($q) . "%' ORDER BY username LIMIT 10"; $db->setQuery($qry); $users = $db->loadObjectList(); $output = array(); foreach ($users as $user) { $output[$user->username] = $user->name; } header("Content-Type: application/json"); echo json_encode($output); exit; }
function display($tpl = NULL) { $this->ticket_ids = FSS_Input::getString("ticketids"); $this->ticket_ids = explode(":", trim($this->ticket_ids)); $this->tickets = array(); foreach ($this->ticket_ids as $ticketid) { $ticket = new SupportTicket(); if ($ticket->load($ticketid)) { $ticket->loadAll(); $this->tickets[] = $ticket; } } $this->print = FSS_Input::getCmd('print'); $this->_display(); }
function removecc() { $this->loadTicket(); if ($this->ticket) { $ids = FSS_Input::getString('ids'); $is_admin = FSS_Input::getInt('is_admin'); $ids = explode(",", $ids); $this->ticket->removeCC($ids, $is_admin); } if (FSS_Input::getInt('nr') != 1) { $link = FSSRoute::_("index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=" . $this->ticket->id, false); JFactory::getApplication()->redirect($link); } else { exit; } }
function display($tpl = null) { if (FSS_Settings::Get('support_only_admin_open')) { return $this->noPermission("Access Denied", "CREATING_NEW_TICKETS_BY_USERS_IS_CURRENTLY_DISABLED"); } if (!FSS_Permission::auth("fss.ticket.open", "com_fss.support_user")) { return FSS_Helper::NoPerm(); } $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $userid = $user->get('id'); $this->assign('userid', $userid); $this->assign('email', ''); // defaults for blank ticket $this->ticket = new stdClass(); $this->ticket->prodid = FSS_Input::getInt('prodid'); $this->ticket->deptid = FSS_Input::getInt('deptid'); $this->ticket->catid = FSS_Input::getInt('catid'); $this->ticket->priid = FSS_Input::getInt('priid'); $this->ticket->subject = FSS_Input::getString('subject'); $this->ticket->body = FSS_Input::getBBCode('body'); $this->errors['subject'] = ''; $this->errors['body'] = ''; $this->errors['cat'] = ''; $what = FSS_Input::getCmd('what'); // done with ticket, try and save, if not, display any errors if ($what == "add") { if ($this->saveTicket()) { echo "Saved OK!"; exit; $link = 'index.php?option=com_fss&view=ticket&layout=view&Itemid=' . FSS_Input::getInt('Itemid') . '&ticketid=' . $this->ticketid; $mainframe->redirect($link); return; } } $this->product = $this->get('Product'); $this->dept = $this->get('Department'); $this->cats = SupportHelper::getCategories(); $this->pris = SupportHelper::getPriorities(); $this->support_user_attach = FSS_Settings::get('support_user_attach'); $this->fields = FSSCF::GetCustomFields(0, $prodid, $deptid); parent::display(); }
echo JText::_('VIEW'); ?> </a> <?php } ?> </p> <div class="clearfix"></div> <div id="system"> <form id="fss_form" action="<?php echo FSSRoute::_('index.php?option=com_fss&view=admin_content&type=' . $this->id); ?> " method='post' class='form-horizontal form-condensed'> <input type="hidden" name="return" value="<?php echo FSS_Input::getString("return", ""); ?> " /> <input type="hidden" name="id" value="<?php echo $this->item['id']; ?> " /> <input type="hidden" name="what" value="" /> <?php if (FSS_Permission::auth("core.edit.state", $this->getAsset())) { ?> <div class="control-group"> <label class="control-label"><?php echo JText::_('PUBLISHED'); ?>
private function searchFields(&$wherebits) { // search custom fields that are set to be searched $fields = FSSCF::GetAllCustomFields(true); foreach ($fields as $field) { if (!$field['basicsearch']) { continue; } if (!$field['peruser']) { continue; } $fieldid = $field['id']; $search = FSS_Input::getString('search'); if ($field['type'] == "checkbox") { if ($search == "1") { $search = "on"; } else { $search = ""; } } if ($field['type'] == "plugin") { // try to do a plugin based search $data = array(); foreach ($field['values'] as $item) { list($key, $value) = explode("=", $item, 2); $data[$key] = $value; } if (array_key_exists("plugin", $data)) { $plugins = FSSCF::get_plugins(); if (array_key_exists($data['plugin'], $plugins)) { $po = $plugins[$data['plugin']]; if (method_exists($po, "Search")) { $res = $po->Search($data['plugindata'], $search, true); if ($res !== false) { $wherebits[] = $this->IDsToWhere($res, "id", "user_id") . " /* Per User Plugin - " . $field['id'] . " */"; continue; } } } } } $qry = "SELECT user_id FROM #__fss_ticket_user_field WHERE field_id = '" . FSSJ3Helper::getEscaped($db, $fieldid) . "' AND value LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%'"; $db->setQuery($qry); $res = $db->loadObjectList(); $wherebits[] = $this->IDsToWhere($res, "id", "user_id") . " /* Per User CF - " . $field['id'] . " */"; } }
function &getTickets() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $userid = $user->get('id'); $uidlist = $this->getUIDS($userid); $tidlist = $this->getTIDS($userid); $query = "SELECT t.*, s.title as status, s.color, u.name, au.name as assigned, u.email as useremail, u.username as username, au.email as handleremail, au.username as handlerusername, "; $query .= " dept.title as department, cat.title as category, prod.title as product, pri.title as priority, pri.color as pricolor, "; $query .= " grp.groupname as groupname, grp.id as group_id "; $query .= " , pri.translation as ptl, dept.translation as dtr, s.translation as str, cat.translation as ctr, prod.translation as prtr"; $query .= " FROM #__fss_ticket_ticket as t "; $query .= " LEFT JOIN #__fss_ticket_status as s ON t.ticket_status_id = s.id "; $query .= " LEFT JOIN #__users as u ON t.user_id = u.id "; $query .= " LEFT JOIN #__users as au ON t.admin_id = au.id "; $query .= " LEFT JOIN #__fss_ticket_dept as dept ON t.ticket_dept_id = dept.id "; $query .= " LEFT JOIN #__fss_ticket_cat as cat ON t.ticket_cat_id = cat.id "; $query .= " LEFT JOIN #__fss_prod as prod ON t.prod_id = prod.id "; $query .= " LEFT JOIN #__fss_ticket_pri as pri ON t.ticket_pri_id = pri.id "; $query .= " LEFT JOIN (SELECT group_id, user_id FROM #__fss_ticket_group_members GROUP BY user_id) as mem ON t.user_id = mem.user_id "; $query .= " LEFT JOIN #__fss_ticket_group as grp ON grp.id = mem.group_id "; // add product, department and category $query .= " WHERE ( t.user_id IN (" . implode(", ", $uidlist) . ") OR t.id IN (" . implode(", ", $tidlist) . ") ) "; $query .= " AND " . SupportSource::user_list_sql(); $tickets = FSS_Input::getCmd('tickets', 'open'); if (FSS_Settings::get('support_simple_userlist_tabs')) { $tickets = "all"; } if (FSS_Input::getCmd('search_all')) { $tickets = ""; } if ($tickets == 'open') { $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed", true); // tickets that arent closed $query .= " AND ticket_status_id IN ( " . implode(", ", $allopen) . ") "; } if ($tickets == 'closed') { $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed"); // remove the archived tickets from the list to deal with $def_archive = FSS_Ticket_Helper::GetStatusID('def_archive'); foreach ($allopen as $offset => $value) { if ($value == $def_archive) { unset($allopen[$offset]); } } // tickets that are closed $query .= " AND ticket_status_id IN ( " . implode(", ", $allopen) . ") "; } else { if ($tickets > 0) { $statuss = SupportHelper::getStatuss(false); $status_list = array(); $status_list[] = (int) $tickets; foreach ($statuss as $status) { if ($status->combine_with == (int) $tickets) { $status_list[] = $status->id; } } $query .= " AND ticket_status_id IN (" . implode(", ", $status_list) . ")"; } } $search = FSS_Input::getString('search'); if ($search != "") { FSS_Helper::AllowCache(); // We have the nearly full query here, so use it to get a list of ticket ids $db->setQuery($query); $recs = $db->loadObjectList(); $ids = array(); $ids[] = 0; foreach ($recs as $rec) { $ids[] = $rec->id; } $mode = ""; if (FSS_Helper::contains($search, array('*', '+', '-', '<', '>', '(', ')', '~', '"'))) { $mode = "IN BOOLEAN MODE"; } $msgsrch = "SELECT ticket_ticket_id FROM #__fss_ticket_messages WHERE ticket_ticket_id IN (" . implode(", ", $ids) . ") AND admin < 3 AND "; $msgsrch .= " MATCH (body) AGAINST ('" . $db->escape($search) . "' {$mode}) "; $db->setQuery($msgsrch); $results = $db->loadObjectList(); $ids = array(); $ids[] = 0; foreach ($results as $rec) { $ids[] = $rec->ticket_ticket_id; } // search custom fields that are set to be searched $fields = FSSCF::GetAllCustomFields(true); foreach ($fields as $field) { if (!$field["basicsearch"]) { continue; } if ($field['permissions'] > 1 && $field['permissions'] < 5) { continue; } $fieldid = $field['id']; if ($field['type'] == "checkbox") { if ($search == "1") { $search = "on"; } else { $search = ""; } } if ($field['peruser']) { continue; } if ($field['type'] == "plugin") { // try to do a plugin based search $data = array(); foreach ($field['values'] as $item) { list($key, $value) = explode("=", $item, 2); $data[$key] = $value; } if (array_key_exists("plugin", $data)) { $plugins = FSSCF::get_plugins(); if (array_key_exists($data['plugin'], $plugins)) { $po = $plugins[$data['plugin']]; if (method_exists($po, "Search")) { $res = $po->Search($data['plugindata'], $search, false, false); if ($res !== false) { foreach ($res as $item) { $ids[] = (int) $item->ticket_id; } continue; } } } } } $qry = "SELECT ticket_id FROM #__fss_ticket_field WHERE field_id = '" . FSSJ3Helper::getEscaped($db, $fieldid) . "' AND value LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%'"; $db->setQuery($qry); $data = $db->loadObjectList(); foreach ($data as $item) { $id = (int) $item->ticket_id; if ($id > 0) { $ids[] = $id; } } } //"MATCH (question, answer) AGAINST ('" . $db->escape($search) . "')" $query .= " AND ( t.id IN (" . implode(", ", $ids) . ") OR MATCH (t.title) AGAINST ('" . $db->escape($search) . "' {$mode}) OR t.reference LIKE '%" . $db->escape($search) . "%' ) "; } $order = FSS_Input::getCmd('order'); $order_dir = FSS_Input::getCmd('order_dir', 'asc'); $order_dir_allowed = array('asc', 'desc'); if (!in_array($order_dir, $order_dir_allowed)) { $order_dir = 'asc'; } $order_allowed = array('t.title', 'lastupdate', 'status', 'assigned', 'lastupdate', 'u.name'); if (!in_array($order, $order_allowed)) { $order = ''; } if ($order != "") { $query .= " ORDER BY {$order} {$order_dir}"; } else { $query .= " ORDER BY lastupdate DESC "; } $mainframe = JFactory::getApplication(); $limit = $mainframe->getUserStateFromRequest('global.list.limit_ticket', 'limit', FSS_Settings::Get('ticket_per_page'), 'int'); $limitstart = FSS_Input::getInt('limitstart'); $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $db->setQuery($query); $db->query(); //echo $query . "<br>"; $count = $db->getNumRows(); $result['pagination'] = new JPaginationJs($count, $limitstart, $limit); $db->setQuery($query, $limitstart, $limit); $result['tickets'] = $db->loadObjectList(); foreach ($result['tickets'] as &$ticket) { $fields = FSSCF::GetCustomFields($ticket->id, $ticket->prod_id, $ticket->ticket_dept_id); $values = FSSCF::GetTicketValues($ticket->id, $ticket); $ticket->fields = array(); foreach ($fields as &$field) { $ticket->fields[$field['id']] = array(); $ticket->fields[$field['id']]['name'] = $field['description']; $ticket->fields[$field['id']]['value'] = ''; if (isset($values[$field['id']])) { $ticket->fields[$field['id']]['value'] = $values[$field['id']]['value']; } } } return $result; }
function LoadData() { if (!$this->xml) { return; } $qry = (string) $this->xml->sql; $where = array(); if ($this->xml->where) { foreach ($this->xml->where as $w) { $where[] = (string) $w; } } if ($this->xml->addbtntext) { $this->addbtntext = (string) $this->xml->addbtntext; } if ($this->xml->use_auth) { // sort out which articles the user can view here, based on published, access, author // sort published out here $published = (string) $this->xml->use_auth->attributes()->published; $access = (string) $this->xml->use_auth->attributes()->access; $author = (string) $this->xml->use_auth->attributes()->author; $where[] = "{$published} = 1"; } $this->search = FSS_Input::getString('search'); if ($this->search != "") { foreach ($this->xml->filters->search->field as $field) { $field = (string) $field; $where[] = "{$field} LIKE '%" . FSSJ3Helper::getEscaped($db, $this->search) . "%'"; } } foreach ($this->xml->filters->filter as $filter) { $type = (string) $filter->attributes()->type; $field = (string) $filter->attributes()->field; $filter_id = (string) $filter->attributes()->id; if ($type == "lookup") { $key = (string) $filter->key; $display = (string) $filter->display; $var = "filter_" . $filter_id; $value = trim(FSS_Input::getString($var)); $this->{$var} = FSS_Input::getString($var); if ($value != "") { $where[] = "{$field} = '" . FSSJ3Helper::getEscaped($db, $value) . "'"; } } } if (count($where) > 0) { $qry .= " WHERE " . implode(" AND ", $where); } $this->order = FSS_Input::getCmd('filter_order'); $this->orderdir = FSS_Input::getCmd('filter_order_Dir', 'ASC'); if ($this->order == "" && $this->xml->ordering) { $this->order = (string) $this->xml->ordering; } if ($this->order) { $qry .= " ORDER\tBY {$this->order} {$this->orderdir} "; } $db = JFactory::getDBO(); $db->setQuery($qry); //echo "Qry : $qry<br>"; $db->query(); $this->num_rows = $db->getNumRows(); $mainframe = JFactory::getApplication(); $this->limit = $mainframe->getUserStateFromRequest('global.list.limitpick', 'limit', 10, 'int'); $this->limitstart = FSS_Input::getInt('limitstart'); $this->limitstart = $this->limit != 0 ? floor($this->limitstart / $this->limit) * $this->limit : 0; $this->pagination = new JPaginationEx($this->num_rows, $this->limitstart, $this->limit); $db->setQuery($qry, $this->limitstart, $this->limit); $this->data = $db->loadObjectList(); //echo $qry."<br>"; //print_p($this->data); }
function showWord() { $db = JFactory::getDBO(); $word_id = FSS_Input::getString('word'); if (is_numeric($word_id)) { $qry = "SELECT * FROM #__fss_glossary WHERE id = '" . $db->escape($word_id) . "'"; } else { $word = FSS_Input::getString('word'); $word = urldecode($word); $qry = "SELECT * FROM #__fss_glossary WHERE word = '" . $word . "'"; } $db->setQuery($qry); $this->glossary = $db->loadObject(); if (FSS_Input::getCmd('tmpl') == 'component') { parent::display('modal'); } else { parent::display(); } }
<div class="controls"> <input type="text" name="admin_create_email" class="inputbox" value="<?php echo FSS_Helper::escape(FSS_Input::getString('admin_create_email')); ?> "> </div> </div> <div class="control-group"> <label class="control-label"><?php echo JText::_("NAME"); ?> </label> <div class="controls"> <input type="text" name="admin_create_name" class="inputbox" value="<?php echo FSS_Helper::escape(FSS_Input::getString('admin_create_name')); ?> "> </div> </div> <div class="control-group"> <label class="control-label"></label> <div class="controls"> <input class='btn btn-primary' type="submit" id="new_ticket" value="<?php echo JText::_("OPEN_TICKET_FOR_USER"); ?> "> <a class='btn btn-default' href="<?php echo FSSRoute::_('index.php?option=com_fss&view=admin_support'); ?>
function SaveGroup($what) { $db = JFactory::getDBO(); //echo "Saving Group<br>"; //print_p($_POST); //exit; $groupid = FSS_Input::getInt('groupid'); $groupname = FSS_Input::getString('groupname'); $description = FSS_Input::getString('description'); $allemail = FSS_Input::getInt('allemail'); $allsee = FSS_Input::getInt('allsee'); $allprods = FSS_Input::getInt('allprods'); $ccexclude = FSS_Input::getInt('ccexclude'); if (!$this->canAdminGroup($groupid)) { return; } $msg = ""; if ($groupid > 0) { $msg = JText::_("GROUP_SAVED"); // saving existing group $qry = "UPDATE #__fss_ticket_group SET "; $qry .= " groupname = '" . FSSJ3Helper::getEscaped($db, $groupname) . "', "; $qry .= " description = '" . FSSJ3Helper::getEscaped($db, $description) . "', "; $qry .= " allsee = '" . FSSJ3Helper::getEscaped($db, $allsee) . "', "; $qry .= " allprods = '" . FSSJ3Helper::getEscaped($db, $allprods) . "', "; $qry .= " allemail = '" . FSSJ3Helper::getEscaped($db, $allemail) . "', "; $qry .= " ccexclude = '" . FSSJ3Helper::getEscaped($db, $ccexclude) . "' "; $qry .= " WHERE id = '" . FSSJ3Helper::getEscaped($db, $groupid) . "'"; $db->setQuery($qry); //echo $qry."<br>"; $db->Query(); // save products } else { $msg = JText::_("GROUP_CREATED"); // creating new group $qry = "INSERT INTO #__fss_ticket_group (groupname, description, allsee, allprods, allemail, ccexclude) VALUES ("; $qry .= " '" . FSSJ3Helper::getEscaped($db, $groupname) . "', "; $qry .= " '" . FSSJ3Helper::getEscaped($db, $description) . "', "; $qry .= " '" . FSSJ3Helper::getEscaped($db, $allsee) . "', "; $qry .= " '" . FSSJ3Helper::getEscaped($db, $allprods) . "', "; $qry .= " '" . FSSJ3Helper::getEscaped($db, $allemail) . "', "; $qry .= " '" . FSSJ3Helper::getEscaped($db, $ccexclude) . "') "; $db->setQuery($qry); $db->Query(); //echo $qry."<br>"; $groupid = $db->insertid(); //echo "New ID : $groupid<br>"; } // save products if ($groupid > 0) { $qry = "DELETE FROM #__fss_ticket_group_prod WHERE group_id = '" . FSSJ3Helper::getEscaped($db, $groupid) . "'"; //echo $qry."<br>"; $db->setQuery($qry); $db->Query(); if (!$allprods) { // get a product list $products = $this->get('Products'); foreach ($products as &$product) { $id = $product->id; $field = "prod_" . $id; $value = FSS_Input::getString($field, ''); if ($value == "on") { $qry = "REPLACE INTO #__fss_ticket_group_prod (group_id, prod_id) VALUES ('" . FSSJ3Helper::getEscaped($db, $groupid) . "', '" . FSSJ3Helper::getEscaped($db, $id) . "')"; //echo $qry."<br>"; $db->setQuery($qry); $db->Query(); } } } } //exit; $mainframe = JFactory::getApplication(); if ($what == "saveclose") { $link = FSSRoute::_('index.php?option=com_fss&view=admin_groups', false); } else { $link = FSSRoute::_('index.php?option=com_fss&view=admin_groups&groupid=' . $groupid, false); } $mainframe->redirect($link, $msg); }
**/ defined('_JEXEC') or die; if ($this->ticket_view == "open") { $cst = null; } else { $cst = FSS_Ticket_Helper::GetStatusByID($this->ticket_view); } FSS_Translate_Helper::TrSingle($cst); $tabs = FSS_Ticket_Helper::GetStatuss("own_tab"); FSS_Translate_Helper::Tr($tabs); ?> <ul class="nav nav-tabs"> <?php if (FSS_Input::getString('search') != "") { ?> <li class="active"> <a href='#' onclick="return false;"> Search </a> </li> <?php } ?> <?php if (!FSS_Settings::Get('support_only_admin_open')) { ?> <li class='<?php if (FSS_Input::getCmd('layout') == 'open') {
<?php if (FSS_Input::getCmd('tmpl') == "component" && !FSS_Input::getString('print')) { ?> <?php echo FSS_Helper::PageStylePopupEnd(); } else { ?> <?php echo FSS_Helper::PageStyleEnd(); } ?> <script> <?php include JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'assets' . DS . 'js' . DS . 'content_edit.js'; ?> </script> <?php if (FSS_Input::getString('print')) { ?> <script> jQuery(document).ready( function () { window.print(); }); </script> <?php } ?>
static function Comm_StoreFields(&$fields) { $result = array(); if (count($fields) > 0) { foreach ($fields as &$field) { $value = FSS_Input::getString("custom_" . $field['id'], "XX--XX--XX"); if ($value != "XX--XX--XX") { $result[$field['id']] = $value; } } } return $result; }
function DoSaveComment() { $this->post['name'] = FSS_Input::getString('name', ''); $this->post['commentid'] = FSS_Input::getInt('commentid', 0); $this->post['email'] = FSS_Input::getEMail('email', ''); $this->post['website'] = FSS_Input::getURL('website', ''); $this->post['body'] = FSS_Input::getString('body', ''); $db = JFactory::getDBO(); $custom = FSSCF::Comm_StoreFields($this->customfields); $custom = serialize($custom); $qry = "UPDATE {$this->table} SET name = '" . FSSJ3Helper::getEscaped($db, $this->post['name']) . "', email = '" . FSSJ3Helper::getEscaped($db, $this->post['email']) . "', "; $qry .= "website = '" . FSSJ3Helper::getEscaped($db, $this->post['website']) . "', body = '" . FSSJ3Helper::getEscaped($db, $this->post['body']) . "', "; $qry .= "custom = '" . FSSJ3Helper::getEscaped($db, $custom) . "' WHERE id = " . FSSJ3Helper::getEscaped($db, $this->post['commentid']); $db->SetQuery($qry); $db->Query(); $this->DoShowComment(); exit; }
function searchArticles() { $mainframe = JFactory::getApplication(); $aparams = FSS_Settings::GetViewSettingsObj('kb'); $search = FSS_Input::getString('kbsearch', ''); $prodid = FSS_Input::getInt('prodid'); $catid = FSS_Input::getInt('catid'); $this->assign('cat_art_pages', $aparams->get('cat_art_pages', 0)); $search = FSS_Input::getString('kbsearch'); $this->assign('view_mode', $aparams->get('cat_cat_arts')); $document = JFactory::getDocument(); $document->setTitle(JText::_("KNOWLEDGE_BASE") . ' - ' . JText::_("SEARCH_RESULTS")); $pagination = $this->get('ArtPaginationSearch'); $this->pagination = $pagination; $this->assign('limit', $this->get("ArtLimit")); $this->product = $this->get("Product"); $this->cat = $this->get("Cat"); $this->results = $this->get("ArtsWhat"); $this->search = $search; $pathway = $mainframe->getPathway(); if (FSS_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'kb'))) { $pathway->addItem(JText::_('KNOWLEDGE_BASE'), FSSRoute::_('index.php?option=com_fss&view=kb')); } $pathway->addItem(JText::_("SEARCH_RESULTS")); FSS_Helper::AllowCache(); parent::display("kbsearch"); }
function display($tpl = NULL) { FSS_Helper::AddSCEditor(); $editid = FSS_Input::getInt('cannedid', -2); if ($editid != -2) { if ($editid > 0) { $db = JFactory::getDBO(); $qry = "SELECT * FROM #__fss_ticket_fragments WHERE id = " . FSSJ3Helper::getEscaped($db, $editid); $db->setQuery($qry); $this->canned_item = $db->loadObject(); } else { $this->canned_item = new stdClass(); $this->canned_item->id = 0; $this->canned_item->description = ""; $this->canned_item->grouping = ""; $this->canned_item->content = ""; } return $this->_display("edit"); } // if we are saving, then save $saveid = FSS_Input::getInt('saveid', -2); if ($saveid != -2) { $description = FSS_Input::getString('description'); $grouping = FSS_Input::getString('grouping'); $content = FSS_Input::getHTML('content'); if ($saveid == 0) { $qry = "INSERT INTO #__fss_ticket_fragments (description, grouping, content, type) VALUES ("; $qry .= "'" . FSSJ3Helper::getEscaped($db, $description) . "',"; $qry .= "'" . FSSJ3Helper::getEscaped($db, $grouping) . "',"; $qry .= "'" . FSSJ3Helper::getEscaped($db, $content) . "', 0)"; $db = JFactory::getDBO(); $db->setQuery($qry); $db->Query(); } else { $qry = "UPDATE #__fss_ticket_fragments SET description = '" . FSSJ3Helper::getEscaped($db, $description) . "', "; $qry .= "grouping = '" . FSSJ3Helper::getEscaped($db, $grouping) . "', "; $qry .= "content = '" . FSSJ3Helper::getEscaped($db, $content) . "' WHERE id = " . FSSJ3Helper::getEscaped($db, $saveid); $db = JFactory::getDBO(); $db->setQuery($qry); $db->Query(); } $mainframe = JFactory::getApplication(); $link = JRoute::_('index.php?option=com_fss&view=admin_support&layout=canned&tmpl=component', false); $mainframe->redirect($link); } // if we are editing then show edit // otherwise show list $deleteid = FSS_Input::getInt('deleteid'); if ($deleteid > 0) { $qry = "DELETE FROM #__fss_ticket_fragments WHERE id = " . FSSJ3Helper::getEscaped($db, $deleteid); $db = JFactory::getDBO(); $db->setQuery($qry); $db->Query(); } $search = FSS_Input::getString('search'); if ($search) { $db = JFactory::getDBO(); $qry = "SELECT * FROM #__fss_ticket_fragments WHERE type = 0 AND (description LIKE '%" . $db->escape($search) . "%' OR content LIKE '%" . $db->escape($search) . "%')"; $db->setQuery($qry); $this->canned = $db->loadObjectList(); } else { $this->canned = SupportCanned::GetCannedReplies(); } $this->_display("list"); }
$has_message_details = true; ?> <?php } ?> <?php if (!FSS_Settings::get('support_hide_tags') && $this->admin_create > 0) { ?> <div class="control-group cg-tags <?php echo $this->errors['subject'] ? 'error' : ''; ?> "> <?php $tags_input = FSS_Input::getString('tags'); $parts = explode("|", $tags_input); $tags = array(); foreach ($parts as $part) { $tag = trim($part); if (!$tag || $tag == "") { continue; } $tags[] = $tag; } ?> <label class="control-label"><?php echo JText::_("TAGS"); ?> </label> <input name="tags" type='hidden' id="tags_input" value="<?php
function HandlePick() { $db = JFactory::getDBO(); $mainframe = JFactory::getApplication(); $f = FSS_Input::getString('field'); $field = $this->GetField($f); $this->HandlePickFilter($field); $this->pick_field = $field->field; //print_p($field); // get data for form $qry = "SELECT "; $fields = array(); foreach ($field->rel_lookup_display as $fieldname => $finfo) { $fields[] = $fieldname . " as " . $finfo['alias']; } $fields[] = $field->rel_lookup_table_alias . '.' . $field->rel_lookup_id; $qry .= implode(", ", $fields); $qry .= " FROM " . $field->rel_lookup_table . " AS " . $field->rel_lookup_table_alias; foreach ($field->rel_lookup_join as $join) { $qry .= " LEFT JOIN {$join['table']} AS {$join['alias']} ON {$field->rel_lookup_table_alias}.{$join['source']} = {$join['alias']}.{$join['dest']} "; } $where = array(); if ($this->filter_values['published'] > 0) { $where[] = "a.published = " . FSSJ3Helper::getEscaped($db, $this->filter_values['published'] - 1); } if ($this->filter_values['userid'] > 0) { $where[] = "a.author = " . FSSJ3Helper::getEscaped($db, $this->filter_values['userid']); } if ($this->filter_values['search'] != "") { $search = array(); foreach ($field->rel_lookup_search as $searchfield) { $search[] = "{$searchfield} LIKE '%" . FSSJ3Helper::getEscaped($db, $this->filter_values['search']) . "%'"; } if (count($search) > 0) { $where[] = "( " . implode(" OR ", $search) . " )"; } } foreach ($this->filters as $filter) { $value = FSS_Input::getString($filter->field); if ($value > 0) { $where[] = "a.{$filter->field} = " . FSSJ3Helper::getEscaped($db, $value); } } if (count($where) > 0) { $qry .= "WHERE " . implode(" AND ", $where); } if ($this->filter_values['order']) { $qry .= " ORDER BY " . FSSJ3Helper::getEscaped($db, $this->filter_values['order']) . " " . FSSJ3Helper::getEscaped($db, $this->filter_values['order_dir']); } else { $qry .= " ORDER BY " . $this->order; } //echo $qry."<br>"; $this->filter_values['limitstart'] = FSS_Input::getInt("limit_start", 0); $this->filter_values['limit'] = $mainframe->getUserStateFromRequest($field->field . "limit_base", "limit_base", "10"); $this->_pagination = new JPaginationAjax($this->_getListCount($qry), $this->filter_values['limitstart'], $this->filter_values['limit']); $db->setQuery($qry, $this->filter_values['limitstart'], $this->filter_values['limit']); $this->pick_data = $db->loadAssocList(); $this->field = $field; include $this->tmplpath . DS . "related.php"; }
function enablePreview() { $session = JFactory::getSession(); $session->Set('preview', 1); $this->layoutpreview = 1; echo "<div class='fss_layout_preview'><a href='" . FSSRoute::_('&preview=-1', false) . "'>List Preview - Click to close</a></div>"; // FIX LINK $list_template = FSS_Input::getString('list_template'); $list_head = FSS_Input::getHTML('list_head'); $list_row = FSS_Input::getHTML('list_row'); $db = JFactory::getDBO(); if ($list_template) { if ($list_template == "custom") { $qry = "REPLACE INTO #__fss_templates (template, tpltype, value) VALUES ('preview',0,'" . FSSJ3Helper::getEscaped($db, $list_row) . "')"; $db->setQuery($qry); $db->Query(); $qry = "REPLACE INTO #__fss_templates (template, tpltype, value) VALUES ('preview',1,'" . FSSJ3Helper::getEscaped($db, $list_head) . "')"; $db->setQuery($qry); $db->Query(); } else { $qry = "SELECT tpltype, value FROM #__fss_templates WHERE template = '" . FSSJ3Helper::getEscaped($db, $list_template) . "'"; $db->setQuery($qry); $rows = $db->loadAssocList(); foreach ($rows as $row) { $qry = "REPLACE INTO #__fss_templates (template, tpltype, value) VALUES ('preview'," . FSSJ3Helper::getEscaped($db, $row['tpltype']) . ",'" . FSSJ3Helper::getEscaped($db, $row['value']) . "')"; $db->setQuery($qry); $db->Query(); } } } }
function saveReply() { $this->removeDraft(FSS_Input::getInt('draft')); // get posted data $ticketid = FSS_Input::getInt('ticketid'); $reply_type = FSS_Input::getCmd('reply_type'); $user_message = FSS_Input::getBBCode('body'); $handler_message = FSS_Input::getBBCode('body2'); $subject = FSS_Input::getString('subject'); // load ticket $ticket = new SupportTicket(); if (!$ticket->load($ticketid)) { exit; } // set up some variables $user_id = JFactory::getUser()->id; $handler_id = $user_id; $old_st = $ticket->getStatus(); $action_name = ""; $action_params = array(); $message_id = 0; $files_private = 0; // add signatures to messages if (FSS_Input::getInt('signature')) { if ($user_message) { $user_message .= SupportCanned::AppendSig(FSS_Input::getInt('signature'), $ticket); } if ($handler_message) { $handler_message .= SupportCanned::AppendSig(FSS_Input::getInt('signature'), $ticket); } } $extra_time = 0; $timestart = 0; $timeend = 0; if (FSS_Settings::Get('time_tracking') != "") { if (FSS_Settings::get('time_tracking_type') == 'se') { $timestart = strtotime("1970-01-01 " . FSS_Input::getString('timetaken_start')); $timeend = strtotime("1970-01-01 " . FSS_Input::getString('timetaken_end')); $extra_time = (int) (($timeend - $timestart) / 60); } elseif (FSS_Settings::get('time_tracking_type') == 'tm') { $timestart = strtotime(FSS_Input::getString('timetaken_start')); $timeend = strtotime(FSS_Input::getString('timetaken_end')); $extra_time = (int) (($timeend - $timestart) / 60); } else { $extra_time = (int) (FSS_Input::getInt('timetaken_hours') * 60 + FSS_Input::getInt('timetaken_mins')); } } // different reply types switch ($reply_type) { case 'reply': // post reply to user if ($user_message) { $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend); $ticket->addTime($extra_time); } elseif ($extra_time > 0) { // no message, add time if needed $ticket->addTime($extra_time, "", true, $timestart, $timeend); } // update status $new_status = FSS_Input::getInt('reply_status'); $ticket->updateStatus($new_status); // reassign ticket if needed if (FSS_Settings::get('support_assign_reply') == 1 && FSS_Input::getInt('dontassign') == 0) { $ticket->assignHandler($handler_id, TICKET_ASSIGN_TOOK_OWNER); } elseif (FSS_Settings::get('support_autoassign') == 3 && $ticket->admin_id == 0 && FSS_Input::getInt('dontassign') == 0) { $ticket->assignHandler($handler_id, TICKET_ASSIGN_ASSIGNED); } // call SupportActions handler for admin reply $action_name = "Admin_Reply"; $action_params = array('subject' => $subject, 'user_message' => $user_message, 'status' => $new_status); break; case 'private': // add message to ticket if ($handler_message) { $message_id = $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend); $ticket->addTime($extra_time); } else { if ($extra_time > 0) { $ticket->addTime($extra_time, "", true, $timestart, $timeend); } } $files_private = 1; // call support actions for private comment $action_name = "Admin_Private"; $action_params = array('subject' => $subject, 'handler_message' => $handler_message); break; case 'user': // update user on ticket $new_user_id = FSS_Input::getInt("user_id"); $ticket->updateUser($new_user_id); if ($user_message) { $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend); $ticket->addTime($extra_time); } else { if ($extra_time > 0) { $ticket->addTime($extra_time, "", true, $timestart, $timeend); $extra_time = 0; } } $action_name = "Admin_ForwardUser"; $action_params = array('subject' => $subject, 'user_message' => $user_message, 'user_id' => $new_user_id); // break; case 'product': $new_handler_id = FSS_Input::getInt('new_handler'); // update product and department $new_product_id = FSS_Input::getInt("new_product_id"); $new_department_id = FSS_Input::getInt("new_department_id"); $ticket->updateProduct($new_product_id); $ticket->updateDepartment($new_department_id); /** * -2 - Auto Assign * -1 - Unchanged * 0 - Unassigned * X - Hander **/ if ($new_handler_id == -1) { //$ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD); } else { if ($new_handler_id == 0) { $ticket->assignHandler(0, -1); } else { if ($new_handler_id > 0) { $ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD); } else { if ($new_handler_id == -2) { // auto assign new handler $admin_id = FSS_Ticket_Helper::AssignHandler($new_product_id, $new_department_id, $ticket->ticket_cat_id, true); $ticket->assignHandler($admin_id, TICKET_ASSIGN_FORWARD); } } } } if ($user_message) { $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend); $ticket->addTime($extra_time); $extra_time = 0; } if ($handler_message) { $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend); $ticket->addTime($extra_time); $extra_time = 0; } if ($extra_time > 0) { $ticket->addTime($extra_time, "", true, $timestart, $timeend); } $action_name = "Admin_ForwardProduct"; $action_params = array('subject' => $subject, 'user_message' => $user_message, 'handler_message' => $handler_message, 'product_id' => $new_product_id, 'department_id' => $new_department_id); break; case 'handler': $new_handler_id = FSS_Input::getInt('new_handler'); if ($new_handler_id == -2) { // auto assign new handler $admin_id = FSS_Ticket_Helper::AssignHandler($ticket->prod_id, $ticket->ticket_dept_id, $ticket->ticket_cat_id, true); $ticket->assignHandler($admin_id, TICKET_ASSIGN_FORWARD); } else { if ($new_handler_id != -1) { $ticket->assignHandler($new_handler_id, TICKET_ASSIGN_FORWARD); } } // update status $new_status = FSS_Input::getCmd('reply_status'); $ticket->updateStatus($new_status); if ($user_message) { $message_id = $ticket->addMessage($user_message, $subject, $user_id, TICKET_MESSAGE_ADMIN, $extra_time, $timestart, $timeend); $ticket->addTime($extra_time); $extra_time = 0; } if ($handler_message) { $ticket->addMessage($handler_message, $subject, $user_id, TICKET_MESSAGE_PRIVATE, $extra_time, $timestart, $timeend); $ticket->addTime($extra_time); $extra_time = 0; } if ($extra_time > 0) { $ticket->addTime($extra_time, "", true, $timestart, $timeend); } $action_name = "Admin_ForwardHandler"; $action_params = array('subject' => $subject, 'user_message' => $user_message, 'handler_message' => $handler_message, 'handler_id' => $new_handler_id); break; } // add posted files $files = $ticket->addFilesFromPost($message_id, -1, $files_private); $ticket->stripImagesFromMessage($message_id); $action_params['files'] = $files; // call action handler SupportActions::DoAction($action_name, $ticket, $action_params); // Redirect to new page $link = FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticket->id, false); $new_st = $ticket->getStatus(); if ($reply_type == "reply") { if ($new_st->is_closed && SupportUsers::getSetting("return_on_close")) { $link = SupportHelper::parseRedirectType($old_st->id, SupportUsers::getSetting("return_on_close")); } else { if (SupportUsers::getSetting("return_on_reply")) { $link = SupportHelper::parseRedirectType($old_st->id, SupportUsers::getSetting("return_on_reply")); } } } JFactory::getApplication()->redirect($link); }
function Save($id, $params) { return FSS_Input::getString("custom_{$id}"); }
function PickCCUser() { $db = JFactory::getDBO(); // build query // get list of possible user ids $user = JFactory::getUser(); $userid = $user->get('id'); $qry = "SELECT g.id, g.ccexclude FROM #__fss_ticket_group_members AS gm LEFT JOIN #__fss_ticket_group AS g ON gm.group_id = g.id WHERE user_id = " . FSSJ3Helper::getEscaped($db, $userid); $db->setQuery($qry); $gids = array(); $rows = $db->loadObjectList(); foreach ($rows as $row) { if ($row->ccexclude == 0) { $gids[$row->id] = $row->id; } } if (count($gids) == 0) { return; } $qry = "SELECT user_id FROM #__fss_ticket_group_members WHERE group_id IN (" . implode(", ", $gids) . ")"; $db->setquery($qry); $user_ids = $db->loadObjectList('user_id'); $uids = array(); foreach ($user_ids as $uid => &$group) { $uids[$uid] = $uid; } unset($uids[$userid]); $ticketid = FSS_Input::getInt('ticketid'); $this->GetTicket(); $this->getCCInfo(); if (array_key_exists("cc", $this->ticket)) { foreach ($this->ticket['cc'] as $ccuser) { $userid = $ccuser['id']; unset($uids[$userid]); } } $qry = "SELECT * FROM #__users "; $where = array(); $limitstart = FSS_Input::getInt('limitstart'); $mainframe = JFactory::getApplication(); $limit = $mainframe->getUserStateFromRequest('users.limit', 'limit', 10, 'int'); $search = FSS_Input::getString('search'); if ($search != "") { $where[] = "(username LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' OR name LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' OR email LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%')"; } if (count($uids) > 0) { $where[] = "id IN (" . implode(", ", $uids) . ")"; } else { $where[] = "id = 0"; } if (count($where) > 0) { $qry .= " WHERE " . implode(" AND ", $where); } // Sort ordering $qry .= " ORDER BY name "; // get max items $db->setQuery($qry); $db->query(); $maxitems = $db->getNumRows(); //echo $qry . "<br>"; // select picked items $db->setQuery($qry, $limitstart, $limit); $this->users = $db->loadObjectList(); // build pagination $this->pagination = new JPaginationEx($maxitems, $limitstart, $limit); $this->search = $search; parent::display("users"); }
static function CheckTicketLink() { $ticket_id = FSS_Input::getInt('t'); $ticket_pass = FSS_Input::getString('p'); if ($ticket_pass && $ticket_id > 0) { $db = JFactory::getDBO(); $qry = "SELECT * FROM #__fss_ticket_ticket WHERE id = " . $db->escape($ticket_id) . " AND password = '******'"; $db->setQuery($qry); $ticket = $db->loadObject(); if ($ticket) { $session = JFactory::getSession(); $session->Set('ticket_pass', $ticket_pass); $session->Set('ticket_email', $ticket->email); $link = FSSRoute::_("index.php?option=com_fss&view=ticket&layout=view&ticketid=" . $ticket_id, false); JFactory::getApplication()->redirect($link); } } }
function listFilterValues() { $html = array(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $html[] = "<dl class='dl-horizontal margin-none'>"; foreach ($this->filter as $filter) { if (isset($filter->type) && $filter->type == "daterange") { FSS_Helper::StylesAndJS(array('calendar')); $to = FSS_Input::getString("{$filter->name}_to", $this->getDateRangeTo($filter)); $from = FSS_Input::getString("{$filter->name}_from", $this->getDateRangeFrom($filter)); $html[] = "<dt>" . JText::_('FSS_FROM') . "</dt>"; $html[] = "<dd>" . $from . "</dd>"; $html[] = "<dt>" . JText::_('FSS_TILL') . "</dt>"; $html[] = "<dd>" . $to . "</dd>"; } else { if ($filter->type == "lookup") { // need to lookup the values from the db $qry = "SELECT {$filter->key} as `key`, {$filter->display} as display FROM {$filter->table}"; if (isset($filter->published) && $filter->published) { $qry .= " WHERE published = 1 "; } $qry .= " GROUP BY {$filter->order}"; $db->setQuery($qry); $values = array(); $values[] = JHTML::_('select.option', '', JText::_($filter->header), 'key', 'display'); $values = array_merge($values, $db->loadObjectList()); $value = FSS_Input::getString('filter_' . $filter->name, isset($filter->default) ? $filter->default : ''); foreach ($values as $temp) { if ($temp->key == $value && $value != "") { $value = $temp->display; break; } } if ($value == "") { $value = "-"; } $html[] = "<dt>" . JText::_($filter->title) . "</dt>"; $html[] = "<dd>" . $value . " </dd>"; } else { if ($filter->type == "datepresets") { } else { $value = FSS_Input::getString('filter_' . $filter->name, isset($filter->default) ? $filter->default : ''); if (isset($filter->options[$value])) { $value = $filter->options[$value]->display; } $html[] = "<dt>" . JText::_($filter->title) . "</dt>"; $html[] = "<dd>" . $value . " </dd>"; } } } } $html[] = "</dl>"; return implode($html); }