コード例 #1
0
ファイル: users.php プロジェクト: atikahmed/joomla-probid
 function __construct()
 {
     parent::__construct();
     $mainframe =& JFactory::getApplication();
     $option = 'com_rsticketspro';
     $user = JFactory::getUser();
     if ($user->get('guest')) {
         $link = JRequest::getURI();
         $link = base64_encode($link);
         $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user';
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false));
     }
     if (!RSTicketsProHelper::isStaff()) {
         JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     $this->_permissions = RSTicketsProHelper::getCurrentPermissions();
     if (!$this->_permissions->add_ticket_customers && !$this->_permissions->add_ticket_staff) {
         JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     $this->_db = JFactory::getDBO();
     // Get pagination request variables
     $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState($option . '.users.limit', $limit);
     $this->setState($option . '.users.limitstart', $limitstart);
     $this->_query = $this->_buildQuery();
 }
コード例 #2
0
ファイル: html.php プロジェクト: atikahmed/joomla-probid
 function deletemessage($message, $is_staff, $permissions, $attribs = null)
 {
     // only staff members can delete replies
     if (!$is_staff) {
         return;
     }
     $user = JFactory::getUser();
     // can delete his own replies
     if (!$permissions->delete_ticket_replies && $message->user_id == $user->get('id')) {
         return;
     }
     // can delete customer replies
     $is_customer = !RSTicketsProHelper::isStaff($message->user_id);
     if (!$permissions->delete_ticket_replies_customers && $is_customer) {
         return;
     }
     // can delete staff replies
     $is_other_staff = !$is_customer && $message->user_id != $user->get('id');
     if (!$permissions->delete_ticket_replies_staff && $is_other_staff) {
         return;
     }
     $url = RSTicketsProHelper::route('index.php?option=com_rsticketspro&task=deletemessage&cid=' . $message->id);
     $img = JHTML::_('image.site', 'delete.png', '/components/com_rsticketspro/assets/images/', null, null, JText::_('RST_TICKET_DELETE_MESSAGE'));
     $return = '<span class="hasTip" title="' . JText::_('RST_TICKET_DELETE_MESSAGE_DESC') . '" ' . $attribs . '><a href="' . $url . '" onclick="return confirm(\'' . JText::_('RST_DELETE_TICKET_MESSAGE_CONFIRM', true) . '\')">' . $img . '</a></span>';
     return $return;
 }
コード例 #3
0
ファイル: history.php プロジェクト: atikahmed/joomla-probid
 function __construct()
 {
     parent::__construct();
     $mainframe =& JFactory::getApplication();
     $option = 'com_rsticketspro';
     $user = JFactory::getUser();
     if ($user->get('guest')) {
         $link = JRequest::getURI();
         $link = base64_encode($link);
         $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user';
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false));
     }
     $ticket_viewing_history = RSTicketsProHelper::getConfig('ticket_viewing_history');
     if (!$ticket_viewing_history) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_HISTORY'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     if ($ticket_viewing_history == 1 && !RSTicketsProHelper::isStaff()) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_HISTORY'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     $this->_db = JFactory::getDBO();
     // Get pagination request variables
     $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // In case limit has been changed, adjust it
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState($option . '.history.limit', $limit);
     $this->setState($option . '.history.limitstart', $limitstart);
     $this->_query = $this->_buildQuery();
     $document =& JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css');
     $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css');
 }
コード例 #4
0
ファイル: searches.php プロジェクト: atikahmed/joomla-probid
 function __construct()
 {
     parent::__construct();
     $mainframe =& JFactory::getApplication();
     $option = 'com_rsticketspro';
     $user = JFactory::getUser();
     if ($user->get('guest')) {
         $link = JRequest::getURI();
         $link = base64_encode($link);
         $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user';
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false));
     }
     if (!RSTicketsProHelper::isStaff()) {
         JError::raiseWarning(500, JText::_('RST_CUSTOMER_CANNOT_VIEW_SEARCHES'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     $task = JRequest::getVar('task');
     if ($task == 'edit' || $task == 'save' || $task == 'search') {
         $this->_getSearch();
     }
     $filter_order = $mainframe->getUserStateFromRequest($option . '.searches.filter_order', 'filter_order', 'ordering');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.searches.filter_order_Dir', 'filter_order_Dir', 'ASC');
     $this->setState($option . '.searches.filter_order', $filter_order);
     $this->setState($option . '.searches.filter_order_Dir', $filter_order_Dir);
     $this->_query = $this->_buildQuery();
 }
コード例 #5
0
ファイル: signature.php プロジェクト: atikahmed/joomla-probid
 function __construct()
 {
     parent::__construct();
     $mainframe =& JFactory::getApplication();
     $option = 'com_rsticketspro';
     $user = JFactory::getUser();
     if ($user->get('guest')) {
         $link = JRequest::getURI();
         $link = base64_encode($link);
         $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user';
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false));
     }
     if (!RSTicketsProHelper::isStaff()) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_CHANGE_SIGNATURE'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     $this->_db = JFactory::getDBO();
     $this->_db->setQuery("SELECT id FROM #__rsticketspro_staff WHERE user_id='" . (int) $user->get('id') . "' LIMIT 1");
     if (!$this->_db->loadResult()) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_CHANGE_SIGNATURE_MUST_BE_STAFF'));
         $referer = @$_SERVER['HTTP_REFERER'];
         if (empty($referer)) {
             $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
         } else {
             $mainframe->redirect($referer);
         }
     }
 }
コード例 #6
0
ファイル: search.php プロジェクト: atikahmed/joomla-probid
 function getItemId()
 {
     if (RSTicketsProHelper::isStaff() && $this->params->get('staff_itemid')) {
         return '&Itemid=' . (int) $this->params->get('staff_itemid');
     }
     if (!RSTicketsProHelper::isStaff() && $this->params->get('customer_itemid')) {
         return '&Itemid=' . (int) $this->params->get('customer_itemid');
     }
     return '';
 }
コード例 #7
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     if (!$mainframe->isAdmin()) {
         $params = $mainframe->getParams('com_rsticketspro');
         $this->assignRef('params', $params);
     }
     $data = $this->get('data');
     $this->assignRef('data', $data);
     $this->assignRef('custom_fields', $this->get('customfields'));
     $user = JFactory::getUser();
     $this->assign('is_logged', !$user->get('guest'));
     $this->assign('is_staff', RSTicketsProHelper::isStaff());
     $this->assign('permissions', RSTicketsProHelper::getCurrentPermissions());
     $this->assignRef('user', $user);
     $this->assign('use_editor', RSTicketsProHelper::getConfig('allow_rich_editor'));
     $this->assignRef('editor', JFactory::getEditor());
     $show_please_select = true;
     $lists['priorities'] = JHTML::_('select.genericlist', RSTicketsProHelper::getPriorities($show_please_select), 'priority_id', '', 'value', 'text', @$data['priority_id'], 'submit_priority');
     $lists['departments'] = JHTML::_('select.genericlist', RSTicketsProHelper::getDepartments($show_please_select), 'department_id', 'onchange="rst_show_custom_fields(this.value); rst_show_priority(this.value); rst_show_upload(this.value); rst_show_subject(this.value);"', 'value', 'text', @$data['department_id']);
     $lists['subject'] = JHTML::_('select.genericlist', RSTicketsProHelper::getSubjects(@$data['department_id'], $show_please_select), 'subject', '', 'value', 'text', @$data['subject'], 'submit_subject');
     $this->assignRef('lists', $lists);
     $this->assignRef('departments', $this->get('departments'));
     $this->assign('can_upload', $this->get('canupload'));
     $this->assign('use_captcha', $this->get('usecaptcha'));
     $this->assign('use_builtin', $this->get('usebuiltin'));
     $this->assign('use_recaptcha', $this->get('userecaptcha'));
     if ($this->get('userecaptcha') && $mainframe->isSite()) {
         $this->assign('show_recaptcha', JReCAPTCHA::getHTML($this->get('recaptchaerror')));
     }
     $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link'));
     $this->assign('footer', RSTicketsProHelper::getFooter());
     $this->assign('use_predefined_subjects', RSTicketsProHelper::getConfig('allow_predefined_subjects'));
     if ($mainframe->isAdmin()) {
         $this->assign('checked_create_new_user', JRequest::getVar('submit_type', 1) == 1);
         $this->assign('checked_existing_user', JRequest::getVar('submit_type', 1) == 2);
     }
     if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) {
         // Description
         if ($params->get('menu-meta_description')) {
             $this->document->setDescription($params->get('menu-meta_description'));
         }
         // Keywords
         if ($params->get('menu-meta_keywords')) {
             $this->document->setMetadata('keywords', $params->get('menu-meta_keywords'));
         }
         // Robots
         if ($params->get('robots')) {
             $this->document->setMetadata('robots', $params->get('robots'));
         }
     }
     parent::display();
 }
コード例 #8
0
ファイル: article.php プロジェクト: atikahmed/joomla-probid
 function __construct()
 {
     parent::__construct();
     $this->_db = JFactory::getDBO();
     $mainframe =& JFactory::getApplication();
     $option = 'com_rsticketspro';
     $this->is_staff = RSTicketsProHelper::isStaff();
     $this->_getArticle();
     $pathway =& $mainframe->getPathway();
     $path = $this->getPath();
     foreach ($path as $item) {
         $pathway->addItem($item->name, $item->link);
     }
 }
コード例 #9
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     if ($mainframe->isSite()) {
         $params = $mainframe->getParams('com_rsticketspro');
         $this->assignRef('params', $params);
     }
     $departments = RSTicketsProHelper::getDepartments();
     $lists['departments'] = JHTML::_('select.genericlist', $departments, 'department_id[]', 'size="5" multiple="multiple"', 'value', 'text', $departments);
     $lists['statuses'] = JHTML::_('select.genericlist', RSTicketsProHelper::getStatuses(), 'status_id[]', 'size="5" multiple="multiple"', 'value', 'text', RSTicketsProHelper::getStatuses());
     $lists['priorities'] = JHTML::_('select.genericlist', RSTicketsProHelper::getPriorities(), 'priority_id[]', 'size="5" multiple="multiple"', 'value', 'text', RSTicketsProHelper::getPriorities());
     $ordering = array();
     $ordering[] = JHTML::_('select.option', 'date', JText::_('Default'));
     $ordering[] = JHTML::_('select.option', 'last_reply', JText::_('RST_TICKET_LAST_REPLY'));
     $ordering[] = JHTML::_('select.option', 'subject', JText::_('RST_TICKET_SUBJECT'));
     $ordering[] = JHTML::_('select.option', 'status', JText::_('RST_TICKET_STATUS'));
     $ordering[] = JHTML::_('select.option', 'priority', JText::_('RST_TICKET_PRIORITY'));
     $ordering[] = JHTML::_('select.option', 'replies', JText::_('RST_TICKET_REPLIES'));
     $lists['ordering'] = JHTML::_('select.genericlist', $ordering, 'filter_order', '', 'value', 'text');
     $ordering_dir = array();
     $ordering_dir[] = JHTML::_('select.option', 'DESC', JText::_('DESC'));
     $ordering_dir[] = JHTML::_('select.option', 'ASC', JText::_('ASC'));
     $lists['ordering_dir'] = JHTML::_('select.genericlist', $ordering_dir, 'filter_order_Dir', '', 'value', 'text');
     $this->assign('is_staff', RSTicketsProHelper::isStaff());
     $this->assign('permissions', RSTicketsProHelper::getCurrentPermissions());
     $this->assign('is_advanced', JRequest::getVar('advanced', false));
     $this->assignRef('lists', $lists);
     $this->assign('itemid', $this->get('itemid'));
     $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link'));
     $this->assign('footer', RSTicketsProHelper::getFooter());
     if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) {
         // Description
         if ($params->get('menu-meta_description')) {
             $this->document->setDescription($params->get('menu-meta_description'));
         }
         // Keywords
         if ($params->get('menu-meta_keywords')) {
             $this->document->setMetadata('keywords', $params->get('menu-meta_keywords'));
         }
         // Robots
         if ($params->get('robots')) {
             $this->document->setMetadata('robots', $params->get('robots'));
         }
     }
     parent::display();
 }
コード例 #10
0
ファイル: dashboard.php プロジェクト: atikahmed/joomla-probid
 function getSearchResults()
 {
     if (!($value = JRequest::getVar('filter'))) {
         return array();
     }
     $escvalue = $this->_db->getEscaped($value);
     $escvalue = str_replace('%', '\\%', $escvalue);
     $escvalue = str_replace(' ', '%', $escvalue);
     $is_staff = RSTicketsProHelper::isStaff();
     if (!$is_staff) {
         $this->_db->setQuery("SELECT id FROM #__rsticketspro_kb_categories c WHERE c.private='0' AND c.published='1'");
     } else {
         $this->_db->setQuery("SELECT id FROM #__rsticketspro_kb_categories c WHERE c.published='1'");
     }
     $cat_ids = $this->_db->loadResultArray();
     $results = $this->_getList("SELECT c.* FROM #__rsticketspro_kb_content c LEFT JOIN #__rsticketspro_kb_categories cat ON (c.category_id=cat.id) WHERE (c.name LIKE '%" . $escvalue . "%' OR c.text LIKE '%" . $escvalue . "%') " . ($is_staff ? "" : " AND c.`private`='0'") . " AND c.published=1 " . ($cat_ids ? " AND c.category_id IN (" . implode(",", $cat_ids) . ")" : "") . " ORDER BY cat.ordering, c.ordering LIMIT 5");
     if ($results) {
         $this->_highlight($results, $value);
     }
     return $results;
 }
コード例 #11
0
 function __construct()
 {
     parent::__construct();
     $mainframe =& JFactory::getApplication();
     $user = JFactory::getUser();
     if ($user->get('guest')) {
         $link = JRequest::getURI();
         $link = base64_encode($link);
         $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user';
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false));
     }
     $this->is_staff = RSTicketsProHelper::isStaff();
     if (!$this->is_staff) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     $permissions = RSTicketsProHelper::getCurrentPermissions();
     $message = $this->getRow();
     // can update his own replies
     if (!$permissions->update_ticket_replies && $message->user_id == $user->get('id')) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     // can update customer replies
     $is_customer = !RSTicketsProHelper::isStaff($message->user_id);
     if (!$permissions->update_ticket_replies_customers && $is_customer) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     // can update staff replies
     $is_other_staff = !$is_customer && $message->user_id != $user->get('id');
     if (!$permissions->update_ticket_replies_staff && $is_other_staff) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE'));
         $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false));
     }
     $this->_db = JFactory::getDBO();
     $document =& JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css');
     $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css');
 }
コード例 #12
0
 function _buildQuery()
 {
     $mainframe =& JFactory::getApplication();
     $option = 'com_rsticketspro';
     $this->_db->setQuery("SELECT VERSION()");
     $mysql_version = $this->_db->loadResult();
     $what = RSTicketsProHelper::getConfig('show_user_info');
     $cusername = $what == 'username' ? 'c.username AS customer' : 'c.username';
     $cname = $what == 'name' ? 'c.name AS customer' : 'c.name';
     $cemail = $what == 'email' ? 'c.email AS customer' : 'c.email';
     $susername = $what == 'username' ? 's.username AS staff' : 's.username';
     $sname = $what == 'name' ? 's.name AS staff' : 's.name';
     $semail = $what == 'email' ? 's.email AS staff' : 's.email';
     $query = "SELECT t.*, {$cusername}, {$cname}, {$cemail}, {$susername}, {$sname}, {$semail}, st.name AS status, pr.name AS priority FROM #__rsticketspro_tickets t LEFT JOIN #__users c ON (t.customer_id = c.id) LEFT JOIN #__users s ON (t.staff_id = s.id) LEFT JOIN #__rsticketspro_statuses st ON (st.id = t.status_id) LEFT JOIN #__rsticketspro_priorities pr ON (pr.id = t.priority_id) WHERE 1";
     $user = JFactory::getUser();
     // staff member ?
     $this->is_staff = RSTicketsProHelper::isStaff();
     if ($this->is_staff) {
         $departments = RSTicketsProHelper::getCurrentDepartments();
         // do we have a filter set ?
         $show_filter = $this->params->get('show_filter');
         if ($show_filter) {
             switch ($show_filter) {
                 case 'show_assigned':
                     $query .= " AND staff_id = '" . (int) $user->get('id') . "'";
                     break;
                 case 'show_submitted':
                     $query .= " AND customer_id = '" . (int) $user->get('id') . "'";
                     break;
                 case 'show_both':
                     $query .= " AND (staff_id = '" . (int) $user->get('id') . "' OR customer_id = '" . (int) $user->get('id') . "')";
                     break;
                 case 'show_unassigned':
                     $query .= " AND staff_id = 0";
                     break;
             }
         }
         // detect current permissions
         $this->_permissions = RSTicketsProHelper::getCurrentPermissions();
         // can see unassigned tickets ?
         if (!$this->_permissions->see_unassigned_tickets) {
             $query .= " AND staff_id > 0";
         }
         // can see other (assigned) tickets ?
         if (!$this->_permissions->see_other_tickets) {
             $query .= " AND staff_id IN (0," . (int) $user->get('id') . ")";
         }
         $flagged = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.flagged', 'flagged', 0, 'int');
         if ($flagged) {
             $query .= " AND flagged='1'";
         }
     } else {
         $query .= " AND customer_id = '" . (int) $user->get('id') . "'";
     }
     $priority_id = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.priority_id', 'priority_id', array(0), 'array');
     JArrayHelper::toInteger($priority_id, array(0));
     if ($this->params->get('default_priority') && $priority_id[0] == 0) {
         $default_priority = $this->params->get('default_priority');
         if (is_array($default_priority)) {
             $default_priority = implode(',', $default_priority);
         }
         $query .= " AND priority_id IN (" . $default_priority . ")";
     }
     $status_id = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.status_id', 'status_id', array(0), 'array');
     JArrayHelper::toInteger($status_id, array(0));
     if ($this->params->get('default_status') && $status_id[0] == 0) {
         $default_status = $this->params->get('default_status');
         if (is_array($default_status)) {
             $default_status = implode(',', $default_status);
         }
         $query .= " AND status_id IN (" . $default_status . ")";
     }
     // are we searching ?
     //$task = $mainframe->getUserStateFromRequest($option.'.ticketsfilter.rsticketspro_search', 'task', '', 'int');
     $task = JRequest::getCmd('task');
     if ($task == 'search') {
         $session = JFactory::getSession();
         $session->set($option . '.ticketsfilter.rsticketspro_search', 1);
     }
     $filter_word = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.filter_word', 'filter_word', '');
     if ($filter_word) {
         $this->setState($option . '.ticketsfilter.filter_word', $filter_word);
         $filter_word = str_replace('%', '\\%', $filter_word);
         $filter_word = str_replace(' ', '%', $filter_word);
         $filter_word = $this->_db->getEscaped($filter_word);
         if (version_compare($mysql_version, '4.1', '<')) {
             $this->_db->setQuery("SELECT ticket_id FROM #__rsticketspro_ticket_messages WHERE message LIKE '%" . $filter_word . "%'");
             $ticket_ids = $this->_db->loadResultArray();
             if (empty($ticket_ids)) {
                 $ticket_ids = array(0);
             }
             $query .= " AND (code LIKE '%" . $filter_word . "%' OR subject LIKE '%" . $filter_word . "%' OR t.id IN (" . implode(',', $ticket_ids) . "))";
         } else {
             $query .= " AND (code LIKE '%" . $filter_word . "%' OR subject LIKE '%" . $filter_word . "%' OR t.id IN (SELECT ticket_id FROM #__rsticketspro_ticket_messages WHERE message LIKE '%" . $filter_word . "%'))";
         }
     }
     $customer = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.customer', 'customer', '', 'string');
     if ($customer && is_string($customer)) {
         $this->setState($option . '.ticketsfilter.customer', $customer);
         $customer = str_replace('%', '\\%', $customer);
         $customer = str_replace(' ', '%', $customer);
         $customer = $this->_db->getEscaped($customer);
         $query .= " AND (c.username LIKE '%" . $customer . "%' OR c.name LIKE '%" . $customer . "%' OR c.email LIKE '%" . $customer . "%')";
     }
     $staff = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.staff', 'staff', '');
     if (($staff || $staff === '0') && !is_object($staff) && !is_array($staff)) {
         $this->setState($option . '.ticketsfilter.staff', $staff);
         $staff = str_replace('%', '\\%', $staff);
         $staff = str_replace(' ', '%', $staff);
         $staff = $this->_db->getEscaped($staff);
         if ($staff === '0') {
             $query .= " AND staff_id = 0";
         } else {
             $query .= " AND (s.username LIKE '%" . $staff . "%' OR s.name LIKE '%" . $staff . "%' OR s.email LIKE '%" . $staff . "%')";
         }
     }
     $department_id = $mainframe->getUserStateFromRequest($option . '.ticketsfilter.department_id', 'department_id', array(0), 'array');
     JArrayHelper::toInteger($department_id, array(0));
     if (@$department_id[0] != 0) {
         $query .= " AND department_id IN (" . implode(',', $department_id) . ")";
     }
     if ($this->is_staff && !empty($departments)) {
         if ($show_filter != 'show_assigned' && $show_filter != 'show_unassigned') {
             $query .= " AND (department_id IN (" . implode(',', $departments) . ") OR customer_id='" . $user->get('id') . "')";
         } else {
             $query .= " AND department_id IN (" . implode(',', $departments) . ")";
         }
     }
     $this->setState($option . '.ticketsfilter.department_id', $department_id);
     if ($priority_id) {
         if ($priority_id[0] != 0) {
             $query .= " AND priority_id IN (" . implode(',', $priority_id) . ")";
         }
         $this->setState($option . '.ticketsfilter.priority_id', $priority_id);
     }
     if ($status_id) {
         if ($status_id[0] != 0) {
             $query .= " AND status_id IN (" . implode(',', $status_id) . ")";
         }
         $this->setState($option . '.ticketsfilter.status_id', $status_id);
     }
     // end search check
     $sortColumn = $this->_db->getEscaped($this->getSortColumn());
     $sortOrder = $this->_db->getEscaped($this->getSortOrder());
     $query .= " ORDER BY " . $sortColumn . " " . $sortOrder;
     return $query;
 }
コード例 #13
0
ファイル: submit.php プロジェクト: atikahmed/joomla-probid
 function getUseCaptcha()
 {
     $captcha_enabled = RSTicketsProHelper::getConfig('captcha_enabled');
     if (!$captcha_enabled) {
         return false;
     }
     $captcha_enabled_for = RSTicketsProHelper::getConfig('captcha_enabled_for');
     $captcha_enabled_for = explode(',', $captcha_enabled_for);
     $user = JFactory::getUser();
     $enabled_for_unregistered = $captcha_enabled_for[0];
     $enabled_for_customers = $captcha_enabled_for[1];
     $enabled_for_staff = $captcha_enabled_for[2];
     $is_logged = !$user->get('guest');
     $is_staff = RSTicketsProHelper::isStaff();
     if (!$is_logged && $enabled_for_unregistered) {
         return true;
     }
     if ($is_logged && !$is_staff && $enabled_for_customers) {
         return true;
     }
     if ($is_logged && $is_staff && $enabled_for_staff) {
         return true;
     }
     return false;
 }
コード例 #14
0
/**
 * Content Search method
 * The sql must return the following fields that are used in a common display
 * routine: href, title, section, created, text, browsernav
 * @param string Target search string
 * @param string mathcing option, exact|any|all
 * @param string ordering option, newest|oldest|popular|alpha|category
 * @param mixed An array if the search it to be restricted to areas, null if search all
 */
function plgSearchRSTicketsProContent($text, $phrase = '', $ordering = '', $areas = null)
{
    jimport('joomla.filesystem.file');
    if (!JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsticketspro' . DS . 'helpers' . DS . 'rsticketspro.php')) {
        return false;
    }
    require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsticketspro' . DS . 'helpers' . DS . 'rsticketspro.php';
    global $mainframe;
    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    $searchText = $text;
    if (is_array($areas) && !array_intersect($areas, array_keys(plgSearchRSTicketsProContentAreas()))) {
        return array();
    }
    // load plugin params info
    $plugin =& JPluginHelper::getPlugin('search', 'rsticketsprocontent');
    jimport('joomla.html.parameter');
    $params = new JParameter($plugin->params);
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    $select = "SELECT a.id, a.category_id, a.name AS title, a.text, cat.name AS section FROM #__rsticketspro_kb_content a LEFT JOIN #__rsticketspro_kb_categories cat ON (a.category_id=cat.id) WHERE a.published=1";
    if (!RSTicketsProHelper::isStaff()) {
        $select .= " AND a.private = 0";
    }
    $uncategorised = $params->get('search_uncategorised', 1);
    if (!$uncategorised) {
        $select .= " AND a.category_id > 0";
    }
    switch ($phrase) {
        case 'exact':
            $text = $db->getEscaped($text, true);
            $where = " AND (a.name LIKE '%" . $text . "%' OR a.text LIKE '%" . $text . "%')";
            break;
        case 'all':
        case 'any':
        default:
            $text = $db->getEscaped($text);
            $words = explode(' ', $text);
            $wheres = array();
            foreach ($words as $word) {
                $word = $db->getEscaped($word, true);
                $wheres[] = "(a.name LIKE '%" . $word . "%' OR a.text LIKE '%" . $word . "%')";
            }
            $where = " AND (" . implode($phrase == 'all' ? ' AND ' : ' OR ', $wheres) . ")";
            break;
    }
    switch ($ordering) {
        case 'oldest':
            $order = " ORDER BY a.id ASC";
            break;
        case 'alpha':
            $order = " ORDER BY a.name ASC";
            break;
        case 'category':
            $order = " ORDER BY section ASC";
            break;
        case 'newest':
        default:
            $order = " ORDER BY a.id DESC";
            break;
    }
    $query = $select . $where . $order;
    $db->setQuery($query, 0, $params->get('search_limit', 50));
    $results = $db->loadObjectList();
    foreach ($results as $i => $row) {
        $results[$i]->href = JRoute::_('index.php?option=com_rsticketspro&view=article&cid=' . $row->id . ':' . JFilterOutput::stringURLSafe($row->title));
        $results[$i]->browsernav = 2;
        $results[$i]->created = 0;
        if (!$results[$i]->category_id && $uncategorised) {
            $results[$i]->section = JText::_('Uncategorised Content');
        }
    }
    return $results;
}
コード例 #15
0
 function getResults()
 {
     $option = 'com_rsticketspro';
     $value = $this->getResultsWord();
     if (!$value) {
         return array();
     }
     $escvalue = $this->_db->getEscaped($value);
     $escvalue = str_replace('%', '\\%', $escvalue);
     $escvalue = str_replace(' ', '%', $escvalue);
     $is_staff = RSTicketsProHelper::isStaff();
     if (!$is_staff) {
         $this->_db->setQuery("SELECT id FROM #__rsticketspro_kb_categories c WHERE c.private='0' AND c.published='1'");
     } else {
         $this->_db->setQuery("SELECT id FROM #__rsticketspro_kb_categories c WHERE c.published='1'");
     }
     $cat_ids = $this->_db->loadResultArray();
     $results = $this->_getList("SELECT c.*, cat.name AS category_name FROM #__rsticketspro_kb_content c LEFT JOIN #__rsticketspro_kb_categories cat ON (c.category_id=cat.id) WHERE (c.name LIKE '%" . $escvalue . "%' OR c.text LIKE '%" . $escvalue . "%') " . ($is_staff ? "" : " AND c.`private`='0'") . " AND c.published=1 " . ($cat_ids ? " AND c.category_id IN (" . implode(",", $cat_ids) . ")" : "") . " ORDER BY cat.ordering, c.ordering", $this->getState($option . '.categories.limitstart'), $this->getState($option . '.categories.limit'));
     $this->_total = 0;
     if ($results) {
         $this->_db->setQuery("SELECT COUNT(id) FROM #__rsticketspro_kb_content c WHERE (c.name LIKE '%" . $escvalue . "%' OR c.text LIKE '%" . $escvalue . "%') " . ($is_staff ? "" : " AND c.`private`='0'") . " AND c.published=1 " . ($cat_ids ? " AND c.category_id IN (" . implode(",", $cat_ids) . ")" : ""));
         $this->_total = $this->_db->loadResult();
     }
     return $results;
 }
コード例 #16
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     if ($mainframe->isSite()) {
         $params = $mainframe->getParams('com_rsticketspro');
         $this->assignRef('params', $params);
     }
     $this->assign('date_format', RSTicketsProHelper::getConfig('date_format'));
     $this->assign('permissions', $this->get('permissions'));
     $this->assign('is_staff', RSTicketsProHelper::isStaff());
     $this->assignRef('tickets', $this->get('tickets'));
     $this->assignRef('pagination', $this->get('pagination'));
     $staff = RSTicketsProHelper::getStaff();
     $unassigned = array();
     $unassigned[] = JHTML::_('select.option', -1, JText::_('RST_UNCHANGED'));
     $unassigned[] = JHTML::_('select.option', 0, JText::_('RST_UNASSIGNED'));
     $staff = array_merge($unassigned, $staff);
     $lists['staff'] = JHTML::_('select.genericlist', $staff, 'bulk_staff_id', '', 'value', 'text');
     $priority = RSTicketsProHelper::getPriorities();
     $unchanged = array();
     $unchanged[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED'));
     $priority = array_merge($unchanged, $priority);
     $lists['priority'] = JHTML::_('select.genericlist', $priority, 'bulk_priority_id', '', 'value', 'text');
     $status = RSTicketsProHelper::getStatuses();
     $unchanged = array();
     $unchanged[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED'));
     $status = array_merge($unchanged, $status);
     $lists['status'] = JHTML::_('select.genericlist', $status, 'bulk_status_id', '', 'value', 'text');
     $delete = array();
     $delete[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED'));
     $delete[] = JHTML::_('select.option', 1, JText::_('RST_DELETE_SELECTED'));
     $lists['delete'] = JHTML::_('select.genericlist', $delete, 'bulk_delete', 'onchange="rst_disable_bulk(this.value);" onclick="rst_disable_bulk(this.value);"', 'value', 'text', '');
     $notify = array();
     $notify[] = JHTML::_('select.option', 0, JText::_('RST_UNCHANGED'));
     $notify[] = JHTML::_('select.option', 1, JText::_('RST_NOTIFY_SELECTED'));
     $lists['notify'] = JHTML::_('select.genericlist', $notify, 'bulk_notify', '', 'value', 'text', '');
     $this->assignRef('lists', $lists);
     $this->assignRef('sortColumn', $this->get('sortColumn'));
     $this->assignRef('sortOrder', $this->get('sortOrder'));
     $this->assignRef('limitstart', JRequest::getInt('limitstart', 0));
     $this->assign('is_searching', $this->get('searching'));
     $searches = $this->get('searches');
     $this->assign('searches', $searches);
     $this->assign('has_searches', !empty($searches));
     $this->assign('predefined_search', $this->get('predefinedsearch'));
     $this->assign('show_footer', RSTicketsProHelper::getConfig('rsticketspro_link'));
     $this->assign('footer', RSTicketsProHelper::getFooter());
     $this->assignRef('priorityColors', $this->get('prioritycolors'));
     $this->assign('colorWholeTicket', RSTicketsProHelper::getConfig('color_whole_ticket'));
     if (RSTicketsProHelper::isJ16() && $mainframe->isSite()) {
         // Description
         if ($params->get('menu-meta_description')) {
             $this->document->setDescription($params->get('menu-meta_description'));
         }
         // Keywords
         if ($params->get('menu-meta_keywords')) {
             $this->document->setMetadata('keywords', $params->get('menu-meta_keywords'));
         }
         // Robots
         if ($params->get('robots')) {
             $this->document->setMetadata('robots', $params->get('robots'));
         }
     }
     parent::display();
 }
コード例 #17
0
ファイル: ticket.php プロジェクト: atikahmed/joomla-probid
 function notify()
 {
     $mainframe =& JFactory::getApplication();
     $server = JRequest::get('server');
     $referer = $server['HTTP_REFERER'];
     if (!RSTicketsProHelper::isStaff()) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_NOTIFY_TICKETS'));
         $mainframe->redirect($referer);
     }
     $model = $this->getModel('ticket');
     $model->_notifyTicket();
     $mainframe->redirect($referer, JText::_('RST_TICKET_NOTIFIED_OK'));
 }
コード例 #18
0
 function getConsecutiveReplies($ticket_id)
 {
     $ticket_id = (int) $ticket_id;
     $db = JFactory::getDBO();
     $db->setQuery("SELECT `user_id` FROM #__rsticketspro_ticket_messages WHERE `ticket_id` = '" . $ticket_id . "' ORDER BY `date` DESC");
     $users = $db->loadResultArray();
     $replies = 0;
     foreach ($users as $user_id) {
         $is_staff = RSTicketsProHelper::isStaff($user_id);
         if ($is_staff) {
             break;
         }
         $replies++;
     }
     return $replies;
 }
コード例 #19
0
 function updateTickets()
 {
     $mainframe =& JFactory::getApplication();
     $server = JRequest::get('server');
     $referer = $server['HTTP_REFERER'];
     if (!RSTicketsProHelper::isStaff()) {
         JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKETS'));
         $mainframe->redirect($referer);
     }
     $msg = JText::_('RST_TICKETS_UPDATED_OK');
     $staff_id = JRequest::getVar('bulk_staff_id', -1);
     JRequest::setVar('staff_id', $staff_id);
     $priority_id = JRequest::getInt('bulk_priority_id', 0);
     JRequest::setVar('priority_id', $priority_id);
     $status_id = JRequest::getInt('bulk_status_id', 0);
     JRequest::setVar('status_id', $status_id);
     $bulk_notify = JRequest::getInt('bulk_notify', 0);
     $bulk_delete = JRequest::getInt('bulk_delete', 0);
     if ($bulk_delete) {
         $msg = JText::_('RST_TICKETS_DELETED_OK');
     }
     $cid = JRequest::getVar('cid');
     JArrayHelper::toInteger($cid);
     foreach ($cid as $ticket_id) {
         JRequest::setVar('cid', $ticket_id);
         $model = $this->getModel('ticket');
         if ($bulk_delete) {
             $model->_deleteTicket();
             continue;
         }
         $model->_saveBulkInfo();
         $model->_notifyTicket();
     }
     $mainframe->redirect($referer, $msg);
 }
コード例 #20
0
ファイル: ticket.php プロジェクト: atikahmed/joomla-probid
 function _getIsStaff()
 {
     $this->is_staff = RSTicketsProHelper::isStaff();
 }
コード例 #21
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     if ($mainframe->isSite()) {
         $params = $mainframe->getParams('com_rsticketspro');
         $this->assignRef('params', $params);
     }
     $row = $this->get('ticket');
     $this->assignRef('row', $row);
     $this->assign('date_format', RSTicketsProHelper::getConfig('date_format'));
     $this->assign('show_ticket_info', RSTicketsProHelper::getConfig('show_ticket_info'));
     $this->assign('show_ticket_voting', RSTicketsProHelper::getConfig('show_ticket_voting'));
     $this->assign('what', RSTicketsProHelper::getConfig('show_user_info'));
     $this->assign('avatar', RSTicketsProHelper::getConfig('avatars'));
     $this->assign('show_email_link', RSTicketsProHelper::getConfig('show_email_link'));
     $this->assign('show_signature', RSTicketsProHelper::getConfig('show_signature'));
     $this->assign('show_kb_search', RSTicketsProHelper::getConfig('show_kb_search'));
     $this->assign('show_time_spent', RSTicketsProHelper::getConfig('enable_time_spent'));
     $this->assign('time_spent_unit', JText::_('RST_TIME_UNIT_' . strtoupper(RSTicketsProHelper::getConfig('time_spent_unit'))));
     $this->assign('permissions', $this->get('permissions'));
     $is_staff = RSTicketsProHelper::isStaff();
     $this->assign('is_staff', $is_staff);
     $this->assign('can_upload', $this->get('canupload'));
     $this->assign('can_update', $this->get('canupdate'));
     $this->assign('can_update_custom_fields', $this->get('canupdatecustomfields'));
     $this->assign('data', $this->get('data'));
     $this->assign('use_editor', RSTicketsProHelper::getConfig('allow_rich_editor'));
     $this->assignRef('editor', JFactory::getEditor());
     $editor_javascript = "document.getElementById('message').innerHTML = content.replace(/<(.*?)>/g, '');";
     if ($this->use_editor) {
         // fix for JCE
         if ($this->editor->get('_name') == 'jce') {
             $editor_javascript = str_replace("'content'", 'content', $this->editor->setContent('message', 'content'));
         } elseif ($this->editor->get('_name') == 'jckeditor') {
             $editor_javascript = str_replace(array('(!oEditor) ', "'content'"), array('(!oEditor) ? ', 'content'), $this->editor->setContent('message', 'content')) . "\n";
         } else {
             $editor_javascript = $this->editor->setContent('message', 'content');
         }
     } else {
         $editor_javascript = str_replace('innerHTML', 'value', $editor_javascript);
     }
     $this->assign('editor_javascript', $editor_javascript);
     $this->assign('show_footer', $this->get('showfooter'));
     $this->assign('footer', $this->get('footer'));
     $this->assign('do_print', JRequest::getInt('print', 0));
     $this->assignRef('department', $this->get('department'));
     if ($is_staff) {
         $status = RSTicketsProHelper::getStatuses();
         $lists['status'] = JHTML::_('select.genericlist', $status, 'status_id', '', 'value', 'text', $row->status_id);
         $priority = RSTicketsProHelper::getPriorities();
         $lists['priority'] = JHTML::_('select.genericlist', $priority, 'priority_id', '', 'value', 'text', $row->priority_id);
         $department = RSTicketsProHelper::getDepartments();
         $lists['department'] = JHTML::_('select.genericlist', $department, 'department_id', '', 'value', 'text', $row->department_id);
         $staff = RSTicketsProHelper::getStaff();
         $unassigned[] = JHTML::_('select.option', 0, JText::_('RST_UNASSIGNED'));
         $staff = array_merge($unassigned, $staff);
         $lists['staff'] = JHTML::_('select.genericlist', $staff, 'staff_id', '', 'value', 'text', $row->staff_id);
         $this->assignRef('lists', $lists);
         $this->assign('history_tickets', $this->get('HistoryTickets'));
     }
     $ticket_view = RSTicketsProHelper::getConfig('ticket_view');
     $this->assign('ticket_view', $ticket_view);
     if ($ticket_view == 'tabbed') {
         jimport('joomla.html.pane');
         $tabparams = array();
         $tabparams['startOffset'] = JRequest::getInt('tabposition', 0);
         $tabs =& JPane::getInstance('Tabs', $tabparams, true);
         $this->assignRef('tabs', $tabs);
     }
     $model = $this->getModel();
     $model->addViewingHistory();
     parent::display();
 }