Beispiel #1
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT t.id as id,t.body as body, t.email as email, t.name as name, t.website as website, t.published as published, ';
     $query .= ' t.created as added, ident, itemid FROM #__fss_comments as t';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( t.name ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search']) . '%', false) . ' OR ' . 'LOWER( t.body ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search']) . '%', false) . ')';
     }
     $order = "";
     if ($this->lists['order'] == 'added') {
         $order = ' ORDER BY added ' . FSSJ3Helper::getEscaped($db, $this->lists['order_Dir']);
     } else {
         if ($this->lists['order']) {
             $order = ' ORDER BY ' . FSSJ3Helper::getEscaped($db, $this->lists['order']) . ' ' . FSSJ3Helper::getEscaped($db, $this->lists['order_Dir']) . '';
         }
     }
     if ($this->lists['prod_id'] > 0) {
         $where[] = 'p.id = ' . FSSJ3Helper::getEscaped($db, $this->lists['prod_id']);
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 't.published = ' . FSSJ3Helper::getEscaped($db, $this->lists['ispublished']);
     }
     $ident = JRequest::getVar('ident', '');
     if ($ident > 0) {
         $where[] = 'ident = ' . FSSJ3Helper::getEscaped($db, $ident);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Beispiel #2
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT a.*, u.name, u.username FROM #__fss_announce as a ';
     $query .= ' LEFT JOIN #__users as u ON a.author = u.id ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( title ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     $order = "";
     if ($this->lists['order']) {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'];
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'published = ' . $this->lists['ispublished'];
     }
     FSSAdminHelper::LA_GetFilterState();
     if (FSSAdminHelper::$filter_lang) {
         $where[] = "language = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_lang) . "'";
     }
     if (FSSAdminHelper::$filter_access) {
         $where[] = "access = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_access) . "'";
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Beispiel #3
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fss_prod ' . '  WHERE id = ' . FSSJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->title = null;
         $this->_data->description = null;
         $this->_data->ordering = 0;
         $this->_data->image = null;
         $this->_data->extratext = null;
         $this->_data->inkb = 1;
         $this->_data->insupport = 1;
         $this->_data->intest = 1;
         $this->_data->published = 1;
         $this->published = 1;
         $this->_data->access = 1;
         $this->_data->translation = "";
     }
     return $this->_data;
 }
Beispiel #4
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT * FROM #__fss_faq_cat ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( title ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == 'ordering') {
         $order = ' ORDER BY ordering ' . $this->lists['order_Dir'];
     } else {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . ', ordering';
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'published = ' . $this->lists['ispublished'];
     }
     FSSAdminHelper::LA_GetFilterState();
     if (FSSAdminHelper::$filter_lang) {
         $where[] = "language = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_lang) . "'";
     }
     if (FSSAdminHelper::$filter_access) {
         $where[] = "access = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_access) . "'";
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
 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");
 }
Beispiel #6
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fss_main_menu ' . '  WHERE id = ' . FSSJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->title = null;
         $this->_data->description = null;
         $this->_data->icon = null;
         $this->_data->ordering = 0;
         $this->_data->itemtype = 7;
         $this->_data->link = "";
         $this->_data->itemid = 0;
         $this->_data->published = 1;
         $this->_data->access = 1;
         $this->_data->language = "*";
         $this->_data->target = '';
         $this->_data->translation = '';
         $this->published = 1;
     }
     return $this->_data;
 }
Beispiel #7
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT * FROM #__fss_help_text ';
     $where = array();
     if ($this->lists['search']) {
         $search = array();
         $search[] = '(LOWER( description ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
         $search[] = '(LOWER( message ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
         $search[] = '(LOWER( identifier ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
         $where[] = " ( " . implode(" OR ", $search) . " ) ";
     }
     if ($this->lists['group'] != "") {
         $where[] = "`group` = '" . $db->escape($this->lists['group']) . "'";
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'published = ' . $this->lists['ispublished'];
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $order_ok = array("group", "description", "identifier", "message", "published");
     if (!in_array($this->lists['order'], $order_ok)) {
         $this->lists['order'] = "`group`, `description`";
     }
     if ($this->lists['order'] == "group") {
         $this->lists['order'] = "`group`";
     }
     $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'];
     $query .= $where . $order;
     return $query;
 }
Beispiel #8
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT f.id as id, question, answer, f.ordering as ordering, f.published as published, c.title as title, f.featured, f.access, f.language FROM #__fss_faq_faq as f LEFT JOIN #__fss_faq_cat as c ';
     $query .= ' ON f.faq_cat_id = c.id ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( question ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == 'f.ordering') {
         $order = ' ORDER BY f.ordering ' . $this->lists['order_Dir'];
     } else {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . ', f.ordering';
     }
     if ($this->lists['faq_cat_id'] > 0) {
         $where[] = 'faq_cat_id = ' . $this->lists['faq_cat_id'];
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'f.published = ' . $this->lists['ispublished'];
     }
     FSSAdminHelper::LA_GetFilterState();
     if (FSSAdminHelper::$filter_lang) {
         $where[] = "f.language = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_lang) . "'";
     }
     if (FSSAdminHelper::$filter_access) {
         $where[] = "f.access = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_access) . "'";
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     //echo $query . "<br>";
     return $query;
 }
Beispiel #9
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT k.id, k.title, k.body, k.ordering, k.published, c.title as cattitle, f.filecount, k.rating, k.ratingdetail, k.allprods, k.created, k.modified, k.views, k.access, k.language FROM #__fss_kb_art as k LEFT JOIN #__fss_kb_cat as c ';
     $query .= ' ON k.kb_cat_id = c.id ';
     $query .= ' LEFT JOIN (SELECT count(*) as filecount, kb_art_id FROM #__fss_kb_attach GROUP BY kb_art_id) as f ON k.id = f.kb_art_id ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( k.title ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == 'k.ordering') {
         $order = ' ORDER BY k.ordering ' . $this->lists['order_Dir'];
     } else {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . ', k.ordering';
     }
     if ($this->lists['kb_cat_id'] > 0) {
         $where[] = 'kb_cat_id = ' . $this->lists['kb_cat_id'];
     }
     if ($this->lists['prod_id'] > 0) {
         $where[] = "allprods = 1 OR k.id IN (SELECT kb_art_id FROM #__fss_kb_art_prod WHERE prod_id = '{$this->lists['prod_id']}')";
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'k.published = ' . $this->lists['ispublished'];
     }
     FSSAdminHelper::LA_GetFilterState();
     if (FSSAdminHelper::$filter_lang) {
         $where[] = "k.language = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_lang) . "'";
     }
     if (FSSAdminHelper::$filter_access) {
         $where[] = "k.access = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_access) . "'";
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Beispiel #10
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT c.id, c.title, c.ordering as ordering, c.published, c.description, c.image, c.inkb, c.insupport, c.intest, c.access, c.translation, c.category, c.subcat FROM #__fss_prod as c ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( title ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == 'c.ordering') {
         $order = ' ORDER BY c.ordering ' . $this->lists['order_Dir'];
     } else {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . ', c.ordering';
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'published = ' . $this->lists['ispublished'];
     }
     FSSAdminHelper::LA_GetFilterState();
     /*if (FSSAdminHelper::$filter_lang)	
     		$where[] = "language = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_lang) . "'";*/
     if (FSSAdminHelper::$filter_access) {
         $where[] = "access = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_access) . "'";
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Beispiel #11
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fss_comments ' . '  WHERE id = ' . FSSJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->ident = 5;
         // ##NOT_TEST_START##
         $this->_data->ident = 0;
         // ##NOT_TEST_END##
         $this->_data->itemid = 0;
         $this->_data->body = null;
         $this->_data->email = null;
         $this->_data->name = null;
         $this->_data->website = null;
         $this->_data->published = 1;
         $current_date = new JDate();
         if (FSSJ3Helper::IsJ3()) {
             $mySQL_conform_date = $current_date->toSql();
         } else {
             $mySQL_conform_date = $current_date->toMySQL();
         }
         $this->_data->created = $mySQL_conform_date;
     }
     return $this->_data;
 }
Beispiel #12
0
    function _buildQuery()
    {
        if (!empty($this->_query)) {
            return $this->_query;
        }
        $db = JFactory::getDBO();
        $query = 'SELECT u.id, u.username, u.name, u.email, g.title as lf1, gm.group_id as gid FROM #__users as u 
				LEFT JOIN #__user_usergroup_map as gm ON u.id = gm.user_id
				LEFT JOIN #__usergroups as g ON gm.group_id = g.id';
        $where = array();
        if ($this->lists['search']) {
            $search = array();
            $search[] = '(LOWER( u.username ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
            $search[] = '(LOWER( u.name ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
            $search[] = '(LOWER( u.email ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
            $where[] = " ( " . implode(" OR ", $search) . " ) ";
        }
        $order = "";
        if ($this->lists['order']) {
            $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . '';
        }
        if ($this->lists['gid'] != '') {
            $where[] = 'gm.group_id = "' . $this->lists['gid'] . '"';
        }
        if (JRequest::getVar('tpl') == 'fuser') {
            $query .= " LEFT JOIN #__fss_users AS fssu ON u.id = fssu.user_id";
            $where[] = "(rules = '' OR rules IS NULL)";
        }
        $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
        $query .= $where . " GROUP BY username " . $order;
        $this->_query = $query;
        return $query;
    }
Beispiel #13
0
 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;
 }
Beispiel #14
0
 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);
 }
Beispiel #15
0
 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;
 }
Beispiel #16
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = ' SELECT c.id, c.title, c.ordering, c.published, c.description, c.image, c.parcatid, pc.title as parcattitle, c.access, c.language FROM #__fss_kb_cat as c ';
     $query .= " LEFT JOIN #__fss_kb_cat as pc on c.parcatid = pc.id ";
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( c.title ) LIKE ' . $db->Quote('%' . FSSJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == 'c.ordering') {
         $order = ' ORDER BY c.ordering ' . $this->lists['order_Dir'];
     } else {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . ', c.ordering';
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'c.published = ' . $this->lists['ispublished'];
     }
     FSSAdminHelper::LA_GetFilterState();
     if (FSSAdminHelper::$filter_lang) {
         $where[] = "c.language = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_lang) . "'";
     }
     if (FSSAdminHelper::$filter_access) {
         $where[] = "c.access = '" . FSSJ3Helper::getEscaped($db, FSSAdminHelper::$filter_access) . "'";
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Beispiel #17
0
 function AddMembership($userids, $groupid)
 {
     $db = JFactory::getDBO();
     foreach ($userids as $userid) {
         $qry = "REPLACE INTO #__fss_ticket_group_members (group_id, user_id) VALUES ('" . FSSJ3Helper::getEscaped($db, $groupid) . "', '" . FSSJ3Helper::getEscaped($db, $userid) . "')";
         $db->setQuery($qry);
         $db->query($qry);
     }
 }
Beispiel #18
0
 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;
 }
Beispiel #19
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fss_emails ' . '  WHERE id = ' . FSSJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     return $this->_data;
 }
Beispiel #20
0
 function display($tpl = null)
 {
     JHTML::_('behavior.modal');
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("\nvar fss_settings_url = '" . JRoute::_('index.php?option=com_fss&view=settings', false) . "';\n");
     $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/settings.js');
     $what = JRequest::getString('what', '');
     $this->tab = JRequest::getVar('tab');
     if (JRequest::getVar('task') == "cancellist") {
         $mainframe = JFactory::getApplication();
         $link = FSSRoute::_('index.php?option=com_fss&view=fsss', false);
         $mainframe->redirect($link);
         return;
     }
     $settings = FSS_Settings::GetAllViewSettings();
     // CHANGE
     $db = JFactory::getDBO();
     if ($what == "save") {
         $data = JRequest::get('POST', JREQUEST_ALLOWRAW);
         foreach ($data as $setting => $value) {
             if (array_key_exists($setting, $settings)) {
                 $settings[$setting] = $value;
             }
         }
         foreach ($settings as $setting => $value) {
             if (!array_key_exists($setting, $data)) {
                 $settings[$setting] = 0;
                 $value = 0;
             }
             $qry = "REPLACE INTO #__fss_settings_view (setting, value) VALUES ('";
             $qry .= FSSJ3Helper::getEscaped($db, $setting) . "','";
             $qry .= FSSJ3Helper::getEscaped($db, $value) . "')";
             $db->setQuery($qry);
             $db->Query();
         }
         $link = 'index.php?option=com_fss&view=settingsview#' . $this->tab;
         if (JRequest::getVar('task') == "save") {
             $link = 'index.php?option=com_fss';
         }
         $mainframe = JFactory::getApplication();
         $mainframe->redirect($link, JText::_("View_Settings_Saved"));
         exit;
     } else {
         $document = JFactory::getDocument();
         $document->addStyleSheet(JURI::root() . 'administrator/components/com_fss/assets/css/js_color_picker_v2.css');
         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/color_functions.js');
         $document->addScript(JURI::root() . 'administrator/components/com_fss/assets/js/js_color_picker_v2.js');
         $this->settings = $settings;
         JToolBarHelper::title(JText::_("FREESTYLE_SUPPORT_PORTAL") . ' - ' . JText::_("VIEW_SETTINGS"), 'fss_viewsettings');
         JToolBarHelper::apply();
         JToolBarHelper::save();
         JToolBarHelper::cancel('cancellist');
         FSSAdminHelper::DoSubToolbar();
         parent::display($tpl);
     }
 }
Beispiel #21
0
 function GetSelect(&$handler, $ident, $itemid)
 {
     $db = JFactory::getDBO();
     $qry = "SELECT " . FSSJ3Helper::getEscaped($db, $handler->field_title) . ", " . FSSJ3Helper::getEscaped($db, $handler->field_id) . " FROM " . FSSJ3Helper::getEscaped($db, $handler->table) . " ORDER BY " . FSSJ3Helper::getEscaped($db, $handler->field_title);
     $db->setQuery($qry);
     $items = $db->loadObjectList();
     if ($ident == 5) {
         $newitems[] = JHTML::_('select.option', '0', JText::_("GENERAL_TESTIMONIALS"), $handler->field_id, $handler->field_title);
         $items = array_merge($newitems, $items);
     }
     return JHTML::_('select.genericlist', $items, 'itemid', 'class="inputbox" size="1"', $handler->field_id, $handler->field_title, $itemid);
 }
Beispiel #22
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fss_ticket_group_members ' . '  WHERE user_id = ' . FSSJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->group_id = '';
     }
     return $this->_data;
 }
Beispiel #23
0
 function SaveLog()
 {
     $db = JFactory::getDBO();
     $class = get_class($this);
     $class = str_ireplace("FSSCron", "", $class);
     $now = FSS_Helper::CurDate();
     $qry = "INSERT INTO #__fss_cron_log (cron, `when`, log) VALUES ('" . FSSJ3Helper::getEscaped($db, $class) . "', '{$now}', '" . FSSJ3Helper::getEscaped($db, $this->_log) . "')";
     $db->SetQuery($qry);
     $db->Query();
     //echo $qry."<br>";
     $qry = "DELETE FROM #__fss_cron_log WHERE `when` < DATE_SUB('{$now}', INTERVAL " . (int) FSS_Settings::get('support_cronlog_keep') . " DAY)";
     $db->SetQuery($qry);
     $db->Query();
 }
Beispiel #24
0
 function GetItemData($itemids = null)
 {
     $db = JFactory::getDBO();
     $qry = "SELECT {$this->field_id}, {$this->field_title} FROM {$this->table} WHERE {$this->field_id}";
     if ($itemids) {
         $ids = array();
         foreach ($itemids as $id) {
             $ids[] = FSSJ3Helper::getEscaped($db, $id);
         }
         $qry .= " IN (" . implode(", ", $ids) . ")";
     }
     $db->setQuery($qry);
     $this->itemdata = $db->loadAssocList($this->field_id);
 }
Beispiel #25
0
 function DoPublishComment($published)
 {
     $commentid = JRequest::getVar('commentid', 0, '', 'int');
     if (!$commentid) {
         return;
     }
     $db = JFactory::getDBO();
     $qry = "UPDATE #__fss_comments SET published = {$published} WHERE id = '" . FSSJ3Helper::getEscaped($db, $commentid) . "'";
     $db->SetQuery($qry);
     $db->Query();
     echo $qry;
     exit;
     return true;
 }
Beispiel #26
0
 function displayProds()
 {
     $kb_art_id = JRequest::getInt('kb_art_id', 0);
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fss_kb_art_prod as a LEFT JOIN #__fss_prod as p ON a.prod_id = p.id WHERE a.kb_art_id = '" . FSSJ3Helper::getEscaped($db, $kb_art_id) . "'";
     $db->setQuery($query);
     $products = $db->loadObjectList();
     $query = "SELECT * FROM #__fss_kb_art WHERE id = '" . FSSJ3Helper::getEscaped($db, $kb_art_id) . "'";
     $db->setQuery($query);
     $article = $db->loadObject();
     $this->article = $article;
     $this->products = $products;
     parent::display();
 }
Beispiel #27
0
 function displayProds()
 {
     $ticket_dept_id = JRequest::getInt('ticket_dept_id', 0);
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fss_ticket_dept_prod as a LEFT JOIN #__fss_prod as p ON a.prod_id = p.id WHERE a.ticket_dept_id = " . FSSJ3Helper::getEscaped($db, $ticket_dept_id);
     $db->setQuery($query);
     $products = $db->loadObjectList();
     $query = "SELECT * FROM #__fss_ticket_dept WHERE id = '" . FSSJ3Helper::getEscaped($db, $ticket_dept_id) . "'";
     $db->setQuery($query);
     $department = $db->loadObject();
     $this->department = $department;
     $this->products = $products;
     parent::display();
 }
Beispiel #28
0
 function DisplayList()
 {
     JHTML::_('behavior.modal', 'a.modal');
     $page = JRequest::getVar('page', 0);
     $perpage = 20;
     $date = JRequest::getVar('date');
     $qry = "SELECT DATE(`when`) as `date`, DATE(`when`) as `label` FROM #__fss_cron_log GROUP BY `date` ORDER BY `date` DESC";
     $db = JFactory::getDBO();
     $db->setQuery($qry);
     $dates = array();
     $dates[] = JHTML::_('select.option', '', JText::_("SELECT_DATE"), 'date', 'label');
     $dates = array_merge($dates, $db->loadObjectList());
     $datelist = JHTML::_('select.genericlist', $dates, 'date', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'date', 'label', $date);
     $this->dates = $datelist;
     $taskname = JRequest::getVar('taskname');
     $qry = "SELECT cron, cron as label FROM #__fss_cron_log GROUP BY cron ORDER BY cron";
     $db = JFactory::getDBO();
     $db->setQuery($qry);
     $tasks = array();
     $tasks[] = JHTML::_('select.option', '', JText::_("SELECT_TASK"), 'cron', 'label');
     $tasks = array_merge($tasks, $db->loadObjectList());
     $takslist = JHTML::_('select.genericlist', $tasks, 'taskname', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'cron', 'label', $taskname);
     $this->tasks = $takslist;
     $qry = "SELECT * FROM #__fss_cron_log ";
     $wheres = array();
     if ($date) {
         $wheres[] = " DATE(`when`) = '" . FSSJ3Helper::getEscaped($db, $date) . "' ";
     }
     if ($taskname) {
         $wheres[] = " cron = '" . FSSJ3Helper::getEscaped($db, $taskname) . "' ";
     }
     if (count($wheres) > 0) {
         $qry .= "WHERE " . implode(" AND ", $wheres);
     }
     $qry .= " ORDER BY `when` desc";
     $db = JFactory::getDBO();
     $db->setQuery($qry);
     $db->query();
     $rowcount = $db->getNumRows();
     if ($rowcount > $perpage) {
         $db->setQuery($qry, $page * $perpage, $perpage);
     }
     $rows = $db->loadObjectList();
     $this->rows = $rows;
     $pagecount = ceil($rowcount / $perpage);
     $this->pagecount = $pagecount;
     $this->page = $page;
     parent::display();
 }
Beispiel #29
0
 function Load($template, $tpltype)
 {
     //echo "Loading $template => $tpltype<br>";
     if ($this->loadedtmpl == $template && $this->loadedtype == $tpltype) {
         return;
     }
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fss_templates WHERE template = '" . FSSJ3Helper::getEscaped($db, $template) . "' AND tpltype = " . FSSJ3Helper::getEscaped($db, $tpltype);
     $db->SetQuery($query);
     $tmpl = $db->LoadObject();
     $this->template = $tmpl->value;
     $this->ProcessLanguage();
     $this->loadedtmpl = $template;
     $this->loadedtype = $tpltype;
 }
Beispiel #30
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT u.user_id as id, u.*, ' . 'CONCAT(m.username," (",m.name,")") as name ' . ' FROM #__fss_users as u ' . ' LEFT JOIN #__users as m ON u.user_id = m.id ' . '  WHERE u.user_id = ' . FSSJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->user_id = 0;
         $this->name = "";
     }
     return $this->_data;
 }