function out() { $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 = 1; SupportUsers::updateUserSettings($values, $user_id); $assign = FSS_Input::getCmd('assign'); $handler = FSS_Input::getInt('handler'); $body = FSS_Input::getHTML('body'); if ($assign == "auto" || $assign == "handler") { $this->loadTicketList($user_id); foreach ($this->tickets->tickets as $ticket) { if ($assign == "auto") { $handler = FSS_Ticket_Helper::AssignHandler($ticket->prod_id, $ticket->ticket_dept_id, $ticket->ticket_cat_id, true); } if ($assign == "unassigned") { $handler = 0; } $ticket->assignHandler($handler); if ($body) { $ticket->addMessage($body, "", $user_id, TICKET_MESSAGE_PRIVATE); FSS_EMail::Admin_Forward($ticket, $ticket->title, $body); } } } JFactory::getApplication()->redirect(FSSRoute::_("index.php?option=com_fss&view=admin_support&layout=listhandlers", false)); }
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() { $db = JFactory::getDBO(); $this->item = array(); $this->item['id'] = FSS_Input::getInt('id', 0); $user = JFactory::getUser(); $userid = $user->get('id'); $this->errors = array(); $ok = true; foreach ($this->edit as $edit) { $field = $this->GetField($edit); $this->item[$field->field] = FSS_Input::getString($field->input_name, ''); if ($field->type == "text") { $this->item[$field->field] = FSS_Input::getHTML($field->input_name, ''); } if ($field->more) { if (strpos($this->item[$field->field], "system-readmore") > 0) { $pos = strpos($this->item[$field->field], "system-readmore"); $top = substr($this->item[$field->field], 0, $pos); $top = substr($top, 0, strrpos($top, "<")); $bottom = substr($this->item[$field->field], $pos); $bottom = substr($bottom, strpos($bottom, ">") + 1); $this->item[$field->field] = $top; $this->item[$field->more] = $bottom; } else { $this->item[$field->more] = ''; } } if ($field->required) { if ($this->item[$field->field] == "") { $ok = false; $this->errors[$field->field] = $field->required; } } } $now = FSS_Helper::CurDate(); // if errors if ($ok) { if ($this->item['id']) { $qry = "UPDATE " . $this->table . " SET "; $sets = array(); foreach ($this->edit as $edit) { $field = $this->GetField($edit); if ($field->type != "related" && $field->type != "tags") { $sets[] = $field->field . " = '" . FSSJ3Helper::getEscaped($db, $this->item[$field->field]) . "'"; } if ($field->more) { $sets[] = "`" . $field->more . "` = '" . FSSJ3Helper::getEscaped($db, $this->item[$field->more]) . "'"; } } if (FSS_Permission::auth("core.edit.state", $this->getAsset())) { $sets[] = "published = " . FSS_Input::getInt('published', 0); if ($this->has_author) { $sets[] = "author = " . FSS_Input::getInt('author', 0); } } if ($this->has_modified) { $sets[] = "modified = '{$now}'"; } $qry .= implode(", ", $sets); $qry .= " WHERE id = '" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "'"; } else { $fieldlist = array(); if ($this->has_author) { $fieldlist[] = "author"; } if ($this->has_added) { $fieldlist[] = "added"; } $setlist = array(); foreach ($this->edit as $edit) { $field = $this->GetField($edit); if ($field->type == "related" || $field->type == "tags") { continue; } $fieldlist[] = $field->field; $setlist[] = "'" . FSSJ3Helper::getEscaped($db, $this->item[$field->field]) . "'"; if ($field->more) { $fieldlist[] = "`" . $field->more . "`"; $setlist[] = "'" . FSSJ3Helper::getEscaped($db, $this->item[$field->more]) . "'"; } } if ($this->has_modified) { $fieldlist[] = "modified"; $setlist[] = "'{$now}'"; $fieldlist[] = "created"; $setlist[] = "'{$now}'"; } $fieldlist[] = "published"; if (FSS_Permission::auth("core.edit.state", $this->getAsset())) { $setlist[] = FSS_Input::getInt('published', 0); } else { $setlist[] = "0"; } if ($this->has_ordering) { // need to get ordering value $order = $this->GetOrderValue(); if ($order < 1) { $order = 1; } $fieldlist[] = "ordering"; $setlist[] = $order; } $qry = "INSERT INTO " . $this->table . " (" . implode(", ", $fieldlist) . ") VALUES ("; if ($this->has_author) { $qry .= "'{$userid}', "; } if ($this->has_added) { $qry .= "'{$now}', "; } $qry .= implode(", ", $setlist) . ")"; } $db->setQuery($qry); $db->query($qry); if (!$this->item['id']) { $this->item['id'] = $db->insertid(); } $this->articleid = $this->item['id']; foreach ($this->edit as $edit) { $field = $this->GetField($edit); // save any products fields if ($field->type == "products") { $this->GetProducts(); $qry = "DELETE FROM {$field->prod_table} WHERE {$field->prod_artid} = '" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "'"; $db->setQuery($qry); //echo $qry."<br>"; $db->query($qry); if (!$this->item[$field->field]) { foreach ($this->products as &$product) { $pid = $product->id; $name = $field->field . "_prod_" . $pid; $val = FSS_Input::getString($name); if ($val == "on") { $qry = "INSERT INTO {$field->prod_table} ({$field->prod_prodid}, {$field->prod_artid}) VALUES\n\t\t\t\t\t\t\t\t\t({$pid}, '" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "')"; $db->setQuery($qry); //echo $qry."<br>"; $db->query($qry); } } //echo "Saving products<br>"; } //echo "Prod Field"; } elseif ($field->type == "related") { // save related field $relids = explode(":", $this->item[$field->field]); $qry1 = "DELETE FROM {$field->rel_table} WHERE {$field->rel_id} = '" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "'"; $db->setQuery($qry1); //echo $qry1."<br>"; $db->query(); foreach ($relids as $id) { $id = FSSJ3Helper::getEscaped($db, $id); $qry1 = "REPLACE INTO {$field->rel_table} ({$field->rel_id}, {$field->rel_relid}) VALUES ('" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "', '{$id}')"; $db->setQuery($qry1); //echo $qry1."<br>"; $db->query(); } } else { if ($field->type == "tags") { //print_p($field); //print_p($this->item); $qry1 = "DELETE FROM {$field->tags_table} WHERE {$field->tags_key} = '" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "'"; //echo $qry1 . "<br>"; $db->setQuery($qry1); $db->query(); $tags = explode("\n", $this->item[$field->field]); foreach ($tags as $tag) { $tag = trim($tag); if (!$tag) { continue; } $qry1 = "REPLACE INTO {$field->tags_table} ({$field->tags_key}, tag, language) VALUES (\t'" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "', "; $qry1 .= "'" . FSSJ3Helper::getEscaped($db, $tag) . "', '" . FSSJ3Helper::getEscaped($db, $this->item['language']) . "')"; //echo $qry1 . "<br>"; $db->setQuery($qry1); $db->query(); } //exit; } } } // need to check for a redirect field here $mainframe = JFactory::getApplication(); if ($this->what == "apply") { $link = FSSRoute::_("index.php?option=com_fss&view=admin_content&type={$this->id}&what=edit&id={$this->articleid}", false); } elseif ($this->what == "savenew") { $link = FSSRoute::_("index.php?option=com_fss&view=admin_content&type={$this->id}&what=new", false); } else { $link = FSSRoute::_('index.php?option=com_fss&view=admin_content&type=' . $this->id, false); $return = FSS_Input::getString('return', ''); if ($return && $return != 1) { $link = $return; } } $mainframe->redirect($link, JText::_('ARTICLE_SAVED')); return; } else { // need to put onto the form the field stuff for related and products fields foreach ($this->edit as $edit) { $field = $this->GetField($edit); if ($field->type == "related") { $field->rel_ids = array(); $relids = FSS_Input::getString($field->field); $relateds = explode(":", $relids); foreach ($relateds as $related) { if ($related == 0) { continue; } $field->rel_ids[$related] = $related; } $field->rel_id_list = implode(":", $field->rel_ids); if (count($field->rel_ids) > 0) { $ids = array(); foreach ($field->rel_ids as $id) { $ids[] = FSSJ3Helper::getEscaped($db, $id); } $qry = "SELECT {$field->rel_lookup_id}, {$field->rel_display} FROM {$field->rel_lookup_table} WHERE {$field->rel_lookup_id} IN (" . implode(", ", $ids) . ")"; /// $qry = "SELECT {$field->rel_lookup_id}, {$field->rel_lookup_display} FROM {$field->rel_lookup_table} WHERE {$field->rel_lookup_id} IN (" . implode(", ", $field->rel_ids) . ")"; $db->setQuery($qry); $relateds = $db->loadAssocList($field->rel_lookup_id); foreach ($relateds as $id => &$related) { $field->rel_ids[$id] = $related[$field->rel_lookup_display]; } } if (!$this->added_related_js) { $this->AddRelatedJS(); } } else { if ($field->type == "products") { $this->GetProducts(); $field->products = array(); $prodcheck = ""; foreach ($this->products as $product) { $prodform = FSS_Input::getString($field->field . "_prod_" . $product->id); if ($prodform == "on") { $prodcheck .= '<label class="checkbox">'; $prodcheck .= "<input type='checkbox' name='{$field->field}_prod_" . $product->id . "' checked />" . $product->title; $prodcheck .= '</label>'; } else { $prodcheck .= '<label class="checkbox">'; $prodcheck .= "<input type='checkbox' name='{$field->field}_prod_" . $product->id . "' />" . $product->title; $prodcheck .= '</label>'; } } $field->products_check = $prodcheck; $field->products_yesno = JHTML::_('select.booleanlist', $field->field, array('class' => "inputbox", 'size' => "1", 'onclick' => "DoAllProdChange('{$field->field}');"), $this->item[$field->field]); } } } if (FSS_Permission::auth("core.edit.state", $this->getAsset())) { $this->item['published'] = FSS_Input::getInt('published', 0); $this->item['author'] = FSS_Input::getInt('author', 0); } if (FSS_Permission::auth("core.edit", $this->getAsset())) { $this->authorselect = $this->AuthorSelect($this->item); } $this->Output("form"); } // if no errors, forward to list return; }
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"); }
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 SaveSettings() { return FSS_Input::getHTML('plugin_html_output'); }