function display_edit() { $editid = FSS_Input::getInt('sigid'); if ($editid > 0) { $db = JFactory::getDBO(); $qry = "SELECT * FROM #__fss_ticket_fragments WHERE id = " . FSSJ3Helper::getEscaped($db, $editid); $db->setQuery($qry); $this->sig_item = $db->loadObject(); $this->sig_item->params = json_decode($this->sig_item->params, true); if (is_string($this->sig_item->params)) { $this->sig_item->params = array(); } $this->sig_item->personal = 0; $userid = JFactory::getUser()->id; if (isset($this->sig_item->params['userid'])) { if ($this->sig_item->params['userid'] > 0 && $userid != $this->sig_item->params['userid']) { $mainframe = JFactory::getApplication(); $link = JRoute::_('index.php?option=com_fss&view=admin_support&layout=signature&tmpl=component'); $mainframe->redirect($link); } $this->sig_item->personal = 1; } } else { $this->sig_item = new stdClass(); $this->sig_item->id = 0; $this->sig_item->description = ""; $this->sig_item->content = ""; $this->sig_item->personal = 1; } return $this->_display("edit"); }
static function HandleTasks($view) { $task = strtolower(FSS_Input::getCmd('task')); $task = str_replace("-", "_", $task); $bits = explode(".", $task); if (count($bits) != 2) { return false; } $task_class = preg_replace("/[^a-z0-9\\_]/", '', $bits[0]); $task_ident = preg_replace("/[^a-z0-9\\_]/", '', $bits[1]); $task_file = JPATH_SITE . DS . 'components' . DS . FSS_Input::getCmd('option') . DS . 'views' . DS . FSS_Input::getCmd('view') . DS . 'task.' . $task_class . '.php'; if (!file_exists($task_file)) { //echo "No file : $task_file<br>"; return false; } require_once $task_file; $task_class_name = "Task_" . $task_class; if (!class_exists($task_class_name)) { echo "No class : {$task_class}<br>"; return false; } $task_obj = new $task_class_name(); $task_obj->view = $view; return $task_obj->execute($task_ident); }
function display($tpl = null) { $db = JFactory::getDBO(); $test = FSS_Input::getInt('test'); if ($test > 0) { error_reporting(E_ALL); ini_set('display_errors', 1); $qry = "SELECT * FROM #__fss_cron WHERE id = " . FSSJ3Helper::getEscaped($db, $test); } else { $qry = "SELECT * FROM #__fss_cron WHERE published = 1 AND ((UNIX_TIMESTAMP() - lastrun) - (`interval` * 60)) > 0"; } $db->setQuery($qry); $rows = $db->loadObjectList(); if (!$rows) { exit; } foreach ($rows as $row) { $db->setQuery("UPDATE #__fss_cron SET lastrun=UNIX_TIMESTAMP() WHERE id='{$row->id}' LIMIT 1"); $db->query(); $class = "FSSCron" . $row->class; $file = strtolower($row->class) . ".php"; $path = JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'cron' . DS; if (file_exists($path . $file)) { require_once $path . $file; $inst = new $class(); $inst->Execute($this->ParseParams($row->params)); if ($test > 0) { echo "<pre>" . $inst->_log . "</pre>"; } else { $inst->SaveLog(); } } } exit; }
function &getAnnounce() { $db = JFactory::getDBO(); $announceid = FSS_Input::getInt('announceid', 0); $query = "SELECT * FROM #__fss_announce"; $where = array(); $where[] = "id = '" . FSSJ3Helper::getEscaped($db, $announceid) . "'"; if (FSS_Permission::auth("core.edit", "com_fss.announce")) { } else { if (FSS_Permission::auth("core.edit.own", "com_fss.announce")) { $where[] = " ( published = 1 OR author = {$this->content->userid} ) "; } else { $where[] = "published = 1"; } } $db = JFactory::getDBO(); $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')'; $user = JFactory::getUser(); $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')'; if (count($where) > 0) { $query .= " WHERE " . implode(" AND ", $where); } $db->setQuery($query); $rows = $db->loadAssoc(); return $rows; }
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 display($tpl = null) { $type = FSS_Input::getCmd('type'); if ($type) { return parent::display($type); } parent::display(); }
function &getProduct() { $db = JFactory::getDBO(); $prodid = FSS_Input::getInt('prodid'); $query = "SELECT * FROM #__fss_prod WHERE id = '" . FSSJ3Helper::getEscaped($db, $prodid) . "'"; $db->setQuery($query); $rows = $db->loadAssoc(); return $rows; }
function getLimits() { $mainframe = JFactory::getApplication(); $limit = $mainframe->getUserStateFromRequest('global.list.limit_ticket', 'limit', SupportUsers::getSetting('per_page'), 'int'); $limitstart = FSS_Input::getInt('limitstart'); $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->limit = $limit; $this->limitstart = $limitstart; }
public function onContentPrepare($context, &$row, &$params, $page = 0) { if (is_object($row)) { if (property_exists($row, "id")) { $context .= "." . $row->id; } } else { if (is_array($row)) { if (array_key_exists("id", $row)) { $context .= "." . $row['id']; } } } FSS_Glossary::$context = $context; $ignore = FSS_Settings::Get('glossary_ignore'); $option = FSS_Input::getCmd('option'); if (trim($ignore) != "") { $ignore = explode("\n", $ignore); foreach ($ignore as $ign) { $ign = trim($ign); if ($ign == "") { continue; } if (stripos($context, $ign) !== FALSE) { return true; } if ($option) { if (stripos($option, $ign) !== FALSE) { return true; } } } } // skip plugin on freestyle components if (strpos($context, "_fss") > 0) { return true; } // Don't run this plugin when the content is being indexed if (strpos($context, 'finder.indexer') > 0) { return true; } if (is_object($row)) { if (!empty($row->noglossary)) { // skip glossary plugin on fss content return true; } //$row->text .= "\n\n\n<div style='display:none;' id='fss_glossary_context'>$context</div>\n\n\n"; return $this->_glossary($row->text, $params); } else { if (is_array($row)) { //$row['text'] .= "\n\n\n<div style='display:none;' id='fss_glossary_context'>$context</div>\n\n\n"; return $this->_glossary($row['text'], $params); } } //$row .= "<div style='display:none;' id='fss_glossary_context'>$context</div>"; return $this->_glossary($row, $params); }
function parseRequest() { $this->prodid = FSS_Input::getInt('prodid'); $this->deptid = FSS_Input::getInt('deptid'); $this->catid = FSS_Input::getInt('catid'); $this->mode = FSS_Input::getInt('mode'); $def_open = FSS_Ticket_Helper::GetStatusID("def_open"); $this->status = FSS_Input::getCmd('status', $def_open); }
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 HandleRefresh() { $this->do_refresh = FSS_Settings::Get('support_admin_refresh'); if (FSS_Input::getInt("refresh") > 0) { $output = array(); $output['count'] = $this->count; header("Content-Type: application/json"); echo json_encode($output); exit; } }
function preview() { $this->ticketid = FSS_Input::getInt('ticketid'); $this->sigid = FSS_Input::getInt('sigid'); $ticket = new SupportTicket(); $ticket->load($this->ticketid); $ticket->loadAll(); $this->ticket = $ticket; $this->signature = SupportCanned::AppendSig($this->sigid, $this->ticket); include $this->view->snippet(JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'views' . DS . 'admin_support' . DS . 'snippet' . DS . '_signature_preview.php'); return true; }
function Save($id, $params) { $params = $this->parseParams($params); $value = FSS_Input::getInt("custom_{$id}"); if ($value < $params->min) { $value = $params->min; } if ($value > $params->max) { $value = $params->max; } 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(); } } }
function display($tpl = null) { $this->layout = FSS_Input::getCmd('layout', FSS_Input::getCmd('_layout', '')); $this->view = FSS_Input::getCmd('view', FSS_Input::getCmd('_view', '')); if (!FSS_Permission::PermAnyContent()) { return FSS_Admin_Helper::NoPerm(); } $this->type = FSS_Input::getCmd('type', ''); if ($this->type != "") { return $this->displayType(); } $this->artcounts = FSS_ContentEdit::getArticleCounts(); parent::display(); }
function in() { $current_user = JFactory::getUser()->id; $manager = FSS_Permission::auth("fss.ticket_admin.ooo", "com_fss.support_admin", JFactory::getUser()->id); $user_id = FSS_Input::getInt('user_id'); if (!$manager && $current_user != $user_id) { return $this->cancel(); } // update the current users setting $values = SupportUsers::getAllSettings($user_id); $values->out_of_office = 0; SupportUsers::updateUserSettings($values, $user_id); JFactory::getApplication()->redirect(FSSRoute::_("index.php?option=com_fss&view=admin_support&layout=listhandlers", false)); }
function display($tpl = null) { $layout = FSS_Input::getCmd('layout'); if ($layout == "support") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_support', false)); } if ($layout == "content") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_content', false)); } if ($layout == "moderate") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_moderate', false)); } if ($layout == "shortcut") { return JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_shortcut', false)); } $can_view = false; $view = array(); if (FSS_Permission::PermAnyContent()) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_content', false); $can_view = true; } if (FSS_Permission::AdminGroups()) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_groups', false); $can_view = true; } if (FSS_Permission::auth("fss.reports", "com_fss.reports")) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_report', false); $can_view = true; } if (FSS_Permission::auth("fss.handler", "com_fss.support_admin")) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_support', false); $can_view = true; } if (FSS_Permission::CanModerate()) { $view[] = FSSRoute::_('index.php?option=com_fss&view=admin_moderate', false); $can_view = true; } if (!$can_view) { return FSS_Admin_Helper::NoPerm(); } // if only 1 section visible, then view that section only if (count($view) == 1) { $mainframe = JFactory::getApplication(); $link = reset($view); $mainframe->redirect($link); } $this->comments = new FSS_Comments(null, null); $this->artcounts = FSS_ContentEdit::getArticleCounts(); parent::display(); }
/** * 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 delete() { if (!$this->view->can_EditTicket()) { return; } // load in tickets to do $ticketid = FSS_Input::getInt('ticketid'); $fileid = FSS_Input::getInt('fileid'); $ticket = new SupportTicket(); if ($ticket->load($ticketid)) { $ticket->deleteAttach($fileid); } JFactory::getApplication()->redirect(FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticketid, false)); exit; }
function display($tpl = null) { $sc = FSS_Input::getCmd('shortcut'); $status = FSS_Input::getCmd('status'); $link = "index.php?option=com_fss&view=admin"; switch ($sc) { case "create.registered": $link = "index.php?option=com_fss&view=admin_support&layout=new&type=registered"; break; case "create.unregistered": $link = "index.php?option=com_fss&view=admin_support&layout=new&type=unregistered"; break; // Lookup status from advanced tab for these! // Lookup status from advanced tab for these! case "tickets.mine": $link = "index.php?option=com_fss&view=admin_support&tickets=-1&what=search&searchtype=advanced&showbasic=1&handler=-1&status={$status}"; break; case "tickets.other": $link = "index.php?option=com_fss&view=admin_support&tickets=-1&what=search&searchtype=advanced&showbasic=1&handler=-2&status={$status}"; break; case "tickets.unassigned": $link = "index.php?option=com_fss&view=admin_support&tickets=-1&what=search&searchtype=advanced&showbasic=1&handler=-3&status={$status}"; break; case "tickets.status": $link = "index.php?option=com_fss&view=admin_support&tickets={$status}"; break; case "myadminsettings": $link = "index.php?option=com_fss&view=admin_support&layout=settings"; break; case "content.announcements": $link = "index.php?option=com_fss&view=admin_content&type=announce"; break; case "content.faqs": $link = "index.php?option=com_fss&view=admin_content&type=faqs"; break; case "content.kb": $link = "index.php?option=com_fss&view=admin_content&type=kb"; break; case "content.glossary": $link = "index.php?option=com_fss&view=admin_content&type=glossary"; break; } $link = FSSRoute::_($link, false); //$link = JRoute::_($link, false); $mainframe = JFactory::getApplication(); $mainframe->redirect($link); }
function display($tpl = null) { $fileid = FSS_Input::getInt('fileid'); $key = FSS_Input::getCmd('key'); $decoded = FSS_Helper::decrypt(FSS_Helper::base64url_decode($key), FSS_Helper::getEncKey("file")); if ($fileid != $decoded) { exit; } $db = JFactory::getDBO(); $sql = "SELECT * FROM #__fss_ticket_attach WHERE id = " . $fileid; $db->setQuery($sql); $attach = $db->loadObject(); $image = in_array(strtolower(pathinfo($attach->filename, PATHINFO_EXTENSION)), array('jpg', 'jpeg', 'png', 'gif')); $image_file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "support" . DS . $attach->diskfile; require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'files.php'; FSS_File_Helper::OutputImage($image_file, pathinfo($attach->filename, PATHINFO_EXTENSION)); }
function display($tpl = NULL) { $this->current_userid = JFactory::getUser()->id; $this->userid = FSS_Input::getInt('user_id', $this->current_userid); if (!FSS_Permission::auth("fss.ticket_admin.ooo", "com_fss.support_admin", JFactory::getUser()->id)) { $this->userid = $this->current_userid; } $this->user = JFactory::getUser($this->userid); $this->loadTicketList(); $values = SupportUsers::getAllSettings($this->userid); if ($values->out_of_office) { return $this->showUserOut(); } else { return $this->showUserIn(); } // }
function display($tpl = NULL) { $type = FSS_Input::getCmd('type'); $session = JFactory::getSession(); $session->clear('admin_create'); $session->clear('admin_create_user_id'); $session->clear('ticket_email'); $session->clear('ticket_name'); $session->clear('ticket_reference'); if ($type == "registered") { return $this->displayRegistered(); } if ($type == "unregistered") { return $this->displayUnRegistered(); } $this->_display(); }
function init() { $user = JFactory::getUser(); $this->userid = $user->get('id'); $this->model = $this->getModel("admin_support"); if (!FSS_Permission::auth("fss.handler", "com_fss.support_admin")) { return FSS_Admin_Helper::NoPerm(); } $this->def_open = FSS_Ticket_Helper::GetStatusID('def_open'); $this->ticket_view = FSS_Input::getCmd('tickets', $this->def_open); $this->count = SupportTickets::getTicketCount(); FSS_Helper::StylesAndJS(array('calendar', 'base64')); if (Task_Helper::HandleTasks($this)) { return false; } return true; }
static function NoPerm() { if (array_key_exists('REQUEST_URI', $_SERVER)) { $url = $_SERVER['REQUEST_URI']; //JURI::current() . "?" . $_SERVER['QUERY_STRING']; } else { $option = FSS_Input::getCmd('option', ''); $view = FSS_Input::getCmd('view', ''); $layout = FSS_Input::getCmd('layout', ''); $Itemid = FSS_Input::getInt('Itemid', 0); $url = FSSRoute::_("index.php?option=" . $option . "&view=" . $view . "&layout=" . $layout . "&Itemid=" . $Itemid); } $url = str_replace("&what=find", "", $url); $url = base64_encode($url); $return = $url; require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'views' . DS . 'admin' . DS . 'tmpl' . DS . 'noperm.php'; return false; }
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(); }
function getTabs() { $db = JFactory::getDBO(); if (!self::$tab_result) { $qry = "SELECT count(*) as cnt FROM #__fss_ticket_ticket WHERE source = 'email'"; $db->setQuery($qry); $cnt = $db->loadObject(); if ($cnt->cnt > 0 || FSS_Input::getCmd('layout') == "emails") { $tab = new Ticket_Source_Data(); $tab->tabname = JText::sprintf("SUP_SRC_EMAILS", $cnt->cnt); $tab->name = JText::_("SUP_SRC_EMAIL"); $tab->count = $cnt->cnt; $tab->link = "index.php?option=com_fss&view=admin_support&layout=emails"; if (FSS_Input::getCmd('layout') == "emails") { $tab->active = true; } self::$tab_result = array($tab); } else { self::$tab_result = array(); } } return self::$tab_result; }