Exemple #1
0
 protected function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $item->body = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->summary = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->addTaxonomy('Type', 'FSF_FINDER_GLOSSARY');
     $word = $item->title;
     $anchor = strtolower(preg_replace("/[^A-Za-z0-9]/", '-', $word));
     $letter = strtolower(substr($word, 0, 1));
     $item->url = 'index.php?option=com_fsf&view=glossary&letter=' . $letter . '#' . $anchor;
     $item->route = $item->url;
     $item->state = $item->published;
     $item->access = 1;
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FSFJ3Helper::IsJ3()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
Exemple #2
0
 function _buildQuery()
 {
     $db =& JFactory::getDBO();
     $query = ' SELECT  id, word, description, published, access, language FROM #__fsf_glossary ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( word ) LIKE ' . $db->Quote('%' . FSFJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == 'word') {
         $order = ' ORDER BY word ' . $this->lists['order_Dir'];
     } else {
         $order = ' ORDER BY ' . $this->lists['order'] . ' ' . $this->lists['order_Dir'] . ', word';
     }
     if ($this->lists['ispublished'] > -1) {
         $where[] = 'published = ' . $this->lists['ispublished'];
     }
     if (FSFAdminHelper::Is16()) {
         FSFAdminHelper::LA_GetFilterState();
         if (FSFAdminHelper::$filter_lang) {
             $where[] = "language = '" . FSFJ3Helper::getEscaped($db, FSFAdminHelper::$filter_lang) . "'";
         }
         if (FSFAdminHelper::$filter_access) {
             $where[] = "access = '" . FSFJ3Helper::getEscaped($db, FSFAdminHelper::$filter_access) . "'";
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Exemple #3
0
function FSF_GetFeaturedText($ispub)
{
    if (FSFJ3Helper::IsJ3()) {
        if ($ispub) {
            return "<i class='icon-star'></i>";
            //return '<span class="state publish"><span class="text"><i class="icon-publish"></i>'.JText::_('Published').'</span></span>';
        } else {
            return "<i class='icon-star-empty'></i>";
        }
    } elseif (FSF_Helper::Is16()) {
        if (!$ispub) {
            return '<img src="templates/bluestork/images/admin/disabled.png" alt="' . JText::_('Featured_FAQ') . '">';
            //return '<span class="state featured"><span class="text">'.JText::_('Featured').'</span></span>';
        } else {
            return '<img src="templates/bluestork/images/admin/featured.png" alt="' . JText::_('Unfeatured_FAQ') . '">';
            //return '<span class="state unfeatured"><span class="text">'.JText::_('Unfeatured').'</span></span>';
        }
    } else {
        $img = 'publish_g.png';
        $alt = JText::_("Featured_FAQ");
        if ($ispub == 0) {
            $img = 'publish_x.png';
            $alt = JText::_("Unfeatured_FAQ");
        }
        return '<img src="images/' . $img . '" width="16" height="16" border="0" alt="' . $alt . '" />';
    }
}
Exemple #4
0
 static function loadResultArray(&$db)
 {
     if (FSFJ3Helper::IsJ3()) {
         return $db->loadColumn(0);
     } else {
         return $db->loadResultArray();
     }
 }
Exemple #5
0
 function Load($template, $tpltype)
 {
     //echo "Loading $template => $tpltype<br>";
     if ($this->loadedtmpl == $template && $this->loadedtype == $tpltype) {
         return;
     }
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fsf_templates WHERE template = '" . FSFJ3Helper::getEscaped($db, $template) . "' AND tpltype = " . FSFJ3Helper::getEscaped($db, $tpltype);
     $db->SetQuery($query);
     $tmpl = $db->LoadObject();
     $this->template = $tmpl->value;
     $this->ProcessLanguage();
     $this->loadedtmpl = $template;
     $this->loadedtype = $tpltype;
 }
Exemple #6
0
 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fsf_glossary ' . '  WHERE id = ' . FSFJ3Helper::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->word = null;
         $this->_data->description = null;
         $this->_data->longdesc = null;
         $this->_data->published = 1;
         $this->_data->access = 1;
         $this->_data->language = "*";
     }
     return $this->_data;
 }
Exemple #7
0
 function SaveAPI()
 {
     $username = JRequest::getVar('username');
     $apikey = JRequest::getVar('apikey');
     $db =& JFactory::getDBO();
     $qry = "REPLACE INTO #__fsf_settings (setting, value) VALUES ('fsj_username','" . FSFJ3Helper::getEscaped($db, $username) . "')";
     $db->setQuery($qry);
     $db->Query();
     $qry = "REPLACE INTO #__fsf_settings (setting, value) VALUES ('fsj_apikey','" . FSFJ3Helper::getEscaped($db, $apikey) . "')";
     $db->setQuery($qry);
     $db->Query();
     // update url links
     if (FSFAdminHelper::Is16()) {
         $updater = new FSFUpdater();
         $updater->SortAPIKey($username, $apikey);
     }
     $mainframe = JFactory::getApplication();
     $link = FSFRoute::x('index.php?option=com_fsf&view=backup', false);
     $mainframe->redirect($link);
 }
Exemple #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 #__fsf_faq_faq as f LEFT JOIN #__fsf_faq_cat as c ';
     $query .= ' ON f.faq_cat_id = c.id ';
     $where = array();
     if ($this->lists['search']) {
         $where[] = '(LOWER( question ) LIKE ' . $db->Quote('%' . FSFJ3Helper::getEscaped($db, $this->lists['search'], true) . '%', false) . ')';
     }
     if ($this->lists['order'] == "fsf_filter_access") {
         $this->lists['order'] = "f.access";
     }
     if ($this->lists['order'] == "fsf_filter_language") {
         $this->lists['order'] = "f.language";
     }
     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'];
     }
     if (FSFAdminHelper::Is16()) {
         FSFAdminHelper::LA_GetFilterState();
         if (FSFAdminHelper::$filter_lang) {
             $where[] = "f.language = '" . FSFJ3Helper::getEscaped($db, FSFAdminHelper::$filter_lang) . "'";
         }
         if (FSFAdminHelper::$filter_access) {
             $where[] = "f.access = '" . FSFJ3Helper::getEscaped($db, FSFAdminHelper::$filter_access) . "'";
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $query .= $where . $order;
     return $query;
 }
Exemple #9
0
 public function index(FinderIndexerResult $item, $format = 'html')
 {
     // Check if the extension is enabled
     if (JComponentHelper::isEnabled($this->extension) == false) {
         return;
     }
     $item->body = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->summary = FinderIndexerHelper::prepareContent($item->getElement('body'));
     $item->addTaxonomy('Type', 'FSF_FINDER_FAQ');
     $item->url = 'index.php?option=com_fsf&view=faq&faqid=' . $item->getElement('id');
     $item->route = $item->url;
     $item->state = $item->getElement('pub');
     $item->access = 1;
     // Get content extras.
     FinderIndexerHelper::getContentExtras($item);
     // Index the item.
     if (FSFJ3Helper::IsJ3()) {
         $this->indexer->index($item);
     } else {
         FinderIndexer::index($item);
     }
 }
Exemple #10
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $faq =& $this->get('Data');
     $isNew = $faq->id < 1;
     $text = $isNew ? JText::_("NEW") : JText::_("EDIT");
     JToolBarHelper::title(JText::_("FAQ") . ': <small><small>[ ' . $text . ' ]</small></small>', 'fsf_faqs');
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     FSFAdminHelper::DoSubToolbar();
     $this->assignRef('faq', $faq);
     $query = 'SELECT id, title' . ' FROM #__fsf_faq_cat' . ' ORDER BY ordering';
     $db =& JFactory::getDBO();
     $db->setQuery($query);
     $sections = $db->loadObjectList();
     if (count($sections) < 1) {
         $link = FSFRoute::x('index.php?option=com_fsf&view=faqs', false);
         $mainframe->redirect($link, "You must create a FAQ category first");
         return;
     }
     if ($faq->id > 0) {
         $qry = "SELECT * FROM #__fsf_faq_tags WHERE faq_id = " . FSFJ3Helper::getEscaped($db, $faq->id) . " ORDER BY tag";
         $db->setQuery($qry);
         $this->tags = $db->loadObjectList();
     } else {
         $this->tags = array();
     }
     $lists['catid'] = JHTML::_('select.genericlist', $sections, 'faq_cat_id', 'class="inputbox" size="1" ', 'id', 'title', intval($faq->faq_cat_id));
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
Exemple #11
0
 static function CurDate()
 {
     if (FSF_Helper::Is16()) {
         $myTimezone = FSF_Helper::getTimezone();
         $myDate = null;
         $date = new JDate($myDate, $myTimezone);
         $formatted = $date->format('Y-m-d H:i:s', false, false);
         return $formatted;
     } else {
         $myTimezone = FSF_Helper::getTimezone();
         $date = null;
         $date = new JDate($date, $myTimezone);
         if (FSFJ3Helper::IsJ3()) {
             return $date->toSql();
         } else {
             return $date->toMySQL();
         }
     }
 }
Exemple #12
0
 function feature()
 {
     $cids = JRequest::getVar('cid', array(0), 'post', 'array');
     $db =& JFactory::getDBO();
     $ids = array();
     foreach ($cids as $id) {
         $ids[] = (int) FSFJ3Helper::getEscaped($db, $id);
     }
     $qry = "UPDATE #__fsf_faq_faq SET featured = 1 WHERE id IN (" . implode(", ", $ids) . ")";
     $db->setQuery($qry);
     return $db->query();
 }
Exemple #13
0
 function SortAPIKey($username = "", $apikey = "")
 {
     $db = JFactory::getDBO();
     $log = "";
     if ($username == "") {
         $qry = "SELECT * FROM #__fsf_settings WHERE setting = 'fsj_username'";
         $db->setQuery($qry);
         $row = $db->loadObject();
         if ($row) {
             $username = $row->value;
         }
         $qry = "SELECT * FROM #__fsf_settings WHERE setting = 'fsj_apikey'";
         $db->setQuery($qry);
         $row = $db->loadObject();
         if ($row) {
             $apikey = $row->value;
         }
     }
     if ($apikey == "" || $username == "") {
         $log = "No API key set\n";
         return $log;
     }
     // find current component id
     $qry = "SELECT * FROM #__extensions WHERE element = 'com_fsf'";
     $db->setQuery($qry);
     $comp = $db->loadObject();
     if ($comp) {
         // delete from update sites where component is me
         $qry = "SELECT * FROM #__update_sites_extensions WHERE extension_id = {$comp->extension_id}";
         $db->setQuery($qry);
         $sites = $db->loadObjectList();
         foreach ($sites as $site) {
             $siteid = $site->update_site_id;
             $qry = "DELETE FROM #__update_sites WHERE update_site_id = {$siteid}";
             $db->setQuery($qry);
             $db->Query($qry);
         }
         $qry = "DELETE FROM #__update_sites_extensions WHERE extension_id = {$comp->extension_id}";
         $db->setQuery($qry);
         $db->Query($qry);
         // insert new record in to site
         $qry = "INSERT INTO #__update_sites (name, type, location, enabled) VALUES ('Freestyle FAQs Updates', 'collection', 'http://www.freestyle-joomla.com/update/list.php?username="******"&apikey=" . FSFJ3Helper::getEscaped($db, $apikey) . "', 1)";
         $db->setQuery($qry);
         $db->Query();
         $site_id = $db->insertid();
         $qry = "INSERT INTO #__update_sites_extensions (update_site_id, extension_id) VALUES ({$site_id}, {$comp->extension_id})";
         $db->setQuery($qry);
         $db->Query();
         $log .= "Updater link appended with api information\n";
     } else {
         $log .= "Unable to find component\n";
     }
     return $log;
 }
Exemple #14
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addScript(JURI::root() . 'components/com_fsf/assets/js/accordion.js');
     require_once JPATH_SITE . DS . 'components' . DS . 'com_fsf' . DS . 'helper' . DS . 'content' . DS . 'faqs.php';
     $this->content = new FSF_ContentEdit_FAQs();
     $this->content->Init();
     $model = $this->getModel();
     $model->content = $this->content;
     $mainframe = JFactory::getApplication();
     $faqid = JRequest::getVar('faqid', 0, '', 'int');
     $aparams = FSF_Settings::GetViewSettingsObj('faqs');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.fsf_modal');
     JHTML::_('behavior.framework', true);
     if ($faqid > 0) {
         $tmpl = JRequest::getVar('tmpl');
         $this->assignRef('tmpl', $tmpl);
         $this->setLayout("faq");
         $faq = $this->get("Faq");
         $this->assignRef('faq', $faq);
         if (!$this->faq) {
             return JError::raiseWarning(404, JText::_('FAQ NOT FOUND'));
         }
         $pathway = $mainframe->getPathway();
         if (FSF_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'faq'))) {
             $pathway->addItem(JText::_('FREQUENTLY_ASKED_QUESTIONS'), FSFRoute::x('index.php?option=com_fsf&view=faq'));
         }
         $pathway->addItem($faq['title'], FSFRoute::x('&limitstart=&layout=&faqid=&catid=' . $faq['faq_cat_id']));
         $pathway->addItem($faq['question']);
         if (FSF_Settings::get('faq_use_content_plugins')) {
             // apply plugins to article body
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $art = new stdClass();
             $art->text = $faq['answer'];
             $art->noglossary = 1;
             $this->params = $mainframe->getParams('com_fsf');
             if (FSF_Helper::Is16()) {
                 $results = $dispatcher->trigger('onContentPrepare', array('com_fsf.faq', &$art, &$this->params, 0));
             } else {
                 $results = $dispatcher->trigger('onPrepareContent', array(&$art, &$this->params, 0));
             }
             $faq['answer'] = $art->text;
         }
         // load tags
         $db =& JFactory::getDBO();
         $qry = "SELECT * FROM #__fsf_faq_tags WHERE faq_id IN (" . FSFJ3Helper::getEscaped($db, $faqid) . ") GROUP BY tag ORDER BY tag";
         $db->setQuery($qry);
         $rows = $db->loadObjectList();
         $this->tags = array();
         foreach ($rows as &$row) {
             $id = $row->faq_id;
             $this->tags[] = "<a href='" . FSFRoute::_('index.php?option=com_fsf&view=faq&tag=' . urlencode($row->tag) . '&Itemid=' . JRequest::getVar('Itemid')) . "'>{$row->tag}</a>";
         }
         //$document = JFactory::getDocument();
         //$document->setTitle(JText::_("FAQS") . ' - ' . $faq['title']);
         parent::display();
         return;
     }
     $pathway = $mainframe->getPathway();
     if (FSF_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'faq'))) {
         $pathway->addItem(JText::_('FREQUENTLY_ASKED_QUESTIONS'), FSFRoute::x('index.php?option=com_fsf&view=faq'));
     }
     $always_show_cats = $aparams->get('always_show_cats', 0);
     $always_show_faqs = $aparams->get('always_show_faqs', 0);
     $hide_allfaqs = $aparams->get('hide_allfaqs', 0);
     $show_featured = $aparams->get('show_featured', 0);
     $hide_tags = $aparams->get('hide_tags', 0);
     $hide_search = $aparams->get('hide_search', 0);
     $view_mode = $aparams->get('view_mode', 'questionwithpopup');
     $view_mode_cat = $aparams->get('view_mode_cat', 'list');
     $view_mode_incat = $aparams->get('view_mode_incat', 'list');
     $enable_pages = $aparams->get('enable_pages', 1);
     $num_cat_colums = $aparams->get('num_cat_colums', 1);
     if ($num_cat_colums < 1 && !$num_cat_colums) {
         $num_cat_colums = 1;
     }
     if ($view_mode_cat != "list") {
         $num_cat_colums = 1;
     }
     $catlist = $this->get("CatList");
     $this->assignRef('catlist', $catlist);
     $search = $this->get("Search");
     $this->assignRef('search', $search);
     $curcattitle = $this->get("CurCatTitle");
     $this->assignRef('curcattitle', $curcattitle);
     $curcatimage = $this->get("CurCatImage");
     $this->assignRef('curcatimage', $curcatimage);
     $curcatdesc = $this->get("CurCatDesc");
     $this->assignRef('curcatdesc', $curcatdesc);
     $curcatid = $this->get("CurCatID");
     // Get data from the model
     if ($curcatid == -4) {
         return $this->listTags();
     }
     if ($curcatid == -5) {
         $curcattitle = "Featured FAQs";
         $curcatimage = "/components/com_fsf/assets/images/featured.png";
     }
     $pagination = $this->get('Pagination');
     $model = $this->getModel();
     $search = $model->_search;
     if ($search || $curcatid > 0 || JRequest::getVar('catid') != "" || JRequest::getVar('tag') != "") {
         $view_mode_cat = "";
     }
     if ($view_mode_cat == "inline" || $view_mode_cat == "accordian") {
         $alldata = $this->get("AllData");
         if (FSF_Settings::get('faq_use_content_plugins_list')) {
             // apply plugins to article body
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $art = new stdClass();
             foreach ($alldata as &$item) {
                 $art->text = $item['answer'];
                 $art->noglossary = 1;
                 $this->params = $mainframe->getParams('com_fsf');
                 if (FSF_Helper::Is16()) {
                     $results = $dispatcher->trigger('onContentPrepare', array('com_fsf.faq', &$art, &$this->params, 0));
                 } else {
                     $results = $dispatcher->trigger('onPrepareContent', array(&$art, &$this->params, 0));
                 }
                 $item['answer'] = $art->text;
             }
         }
         foreach ($catlist as &$cat) {
             $catid = $cat['id'];
             foreach ($alldata as &$faq) {
                 if ($faq['faq_cat_id'] == $catid) {
                     $cat['faqs'][] =& $faq;
                 }
             }
         }
         // inline mode, so if we have featured faqs listed, load the data for those
         $this->featured_faqs = $this->get('FeaturedFaqs');
     } else {
         $items = $this->get('Data');
         if (FSF_Settings::get('faq_use_content_plugins_list')) {
             // apply plugins to article body
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $art = new stdClass();
             foreach ($items as &$item) {
                 $art->text = $item['answer'];
                 $art->noglossary = 1;
                 $this->params = $mainframe->getParams('com_fsf');
                 if (FSF_Helper::Is16()) {
                     $results = $dispatcher->trigger('onContentPrepare', array('com_fsf.faq', &$art, &$this->params, 0));
                 } else {
                     $results = $dispatcher->trigger('onPrepareContent', array(&$art, &$this->params, 0));
                 }
                 $item['answer'] = $art->text;
             }
         }
     }
     // push data into the template
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $showfaqs = true;
     $showcats = true;
     if (JRequest::getVar('tag') != "") {
         // got tag selected
         $showfaqs = true;
         $showcats = false;
         $curcatid = -2;
         $pathway = $mainframe->getPathway();
         $pathway->addItem(JText::_("TAGS"), FSFRoute::_('index.php?option=com_fsf&view=faq&catid=-4&Itemid=' . JRequest::getVar('Itemid')));
         $pathway->addItem(JRequest::getVar('tag'));
         $curcattitle = JRequest::getVar('tag');
         // do we have a category specified???
     } else {
         if (JRequest::getVar('catid', '') == '' && JRequest::getVar('search', '') == '') {
             // no cat specified
             if (!$always_show_faqs) {
                 $showfaqs = false;
                 $curcatid = -2;
             } else {
                 $pathway = $mainframe->getPathway();
                 $pathway->addItem($curcattitle);
             }
         } else {
             // got a cat specced
             $pathway = $mainframe->getPathway();
             $pathway->addItem($curcattitle);
             if (!$always_show_cats) {
                 $showcats = false;
             }
         }
     }
     // load tags
     $faqids = array();
     if ($this->items && is_array($this->items)) {
         foreach ($this->items as &$item) {
             $faqids[] = FSFJ3Helper::getEscaped($db, $item['id']);
         }
     }
     $db = JFactory::getDBO();
     $this->tags = array();
     if (count($faqids) > 0) {
         $qry = "SELECT * FROM #__fsf_faq_tags WHERE faq_id IN (" . implode(", ", $faqids) . ") GROUP BY tag ORDER BY tag";
         $db->setQuery($qry);
         $rows = $db->loadObjectList();
         foreach ($rows as &$row) {
             $id = $row->faq_id;
             if (!array_key_exists($id, $this->tags)) {
                 $this->tags[$id] = array();
             }
             $this->tags[$id][] = "<a href='" . FSFRoute::_('index.php?option=com_fsf&view=faq&tag=' . urlencode($row->tag) . '&Itemid=' . JRequest::getVar('Itemid')) . "'>{$row->tag}</a>";
         }
     }
     // hide tags if none have been set
     $qry = "SELECT count(*) as cnt FROM #__fsf_faq_tags";
     $db->setQuery($qry);
     $row = $db->loadObject();
     if ($row->cnt == 0) {
         $hide_tags = true;
     }
     $this->assign('curcatid', $curcatid);
     $this->assign('showcats', $showcats);
     $this->assign('showfaqs', $showfaqs);
     $this->assign('hide_allfaqs', $hide_allfaqs);
     $this->assign('show_featured', $show_featured);
     $this->assign('hide_tags', $hide_tags);
     $this->assign('hide_search', $hide_search);
     $this->assign('view_mode', $view_mode);
     $this->assign('num_cat_colums', $num_cat_colums);
     $this->assign('view_mode_cat', $view_mode_cat);
     $this->assign('view_mode_incat', $view_mode_incat);
     $this->assign('enable_pages', $enable_pages);
     parent::display($tpl);
 }
Exemple #15
0
 static function &Comm_GetCustomFields($ident)
 {
     $db = JFactory::getDBO();
     // get a list of all available fields
     if ($ident != -1) {
         $qry = "SELECT * FROM #__fsf_field as f WHERE f.published = 1 AND (f.ident = 999 OR f.ident = '" . FSFJ3Helper::getEscaped($db, $ident) . "') ";
     } else {
         $qry = "SELECT * FROM #__fsf_field as f WHERE f.published = 1 ";
     }
     $qry .= " ORDER BY f.ordering";
     $db->setQuery($qry);
     $rows = $db->loadAssocList("id");
     $indexes = array();
     if (count($rows) > 0) {
         foreach ($rows as $index => &$row) {
             $indexes[] = FSFJ3Helper::getEscaped($db, $index);
         }
     }
     $indexlist = implode(",", $indexes);
     if (count($indexes) == 0) {
         $indexlist = "0";
     }
     $qry = "SELECT * FROM #__fsf_field_values WHERE field_id IN ({$indexlist})";
     $db->setQuery($qry);
     $values = $db->loadAssocList();
     if (count($values) > 0) {
         foreach ($values as &$value) {
             $field_id = $value['field_id'];
             $rows[$field_id]['values'][] = $value['value'];
         }
     }
     return $rows;
 }
Exemple #16
0
 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fsf_faq_faq";
     $where = array();
     if ($this->_search != "") {
         $words = explode(" ", $this->_search);
         foreach ($words as $word) {
             $searches[] = "(question LIKE '%" . FSFJ3Helper::getEscaped($db, $word) . "%' OR answer LIKE '%" . FSFJ3Helper::getEscaped($db, $word) . "%')";
         }
         $where[] = implode(" AND ", $searches);
     } else {
         if ($this->_curcatid > 0) {
             $where[] = "faq_cat_id = '" . FSFJ3Helper::getEscaped($db, $this->_curcatid) . "'";
         }
     }
     if ($this->_curcatid == -5) {
         $where[] = "featured = 1";
     }
     if ($this->content->permission['artperm'] > 1) {
     } else {
         if ($this->content->permission['artperm'] == 1) {
             $where[] = " ( published = 1 OR author = {$this->content->userid} ) ";
         } else {
             $where[] = "published = 1";
         }
     }
     if (FSF_Helper::Is16()) {
         $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
         $user = JFactory::getUser();
         $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
     }
     $tag = JRequest::getVar('tag');
     if ($tag) {
         $qry2 = "SELECT faq_id FROM #__fsf_faq_tags WHERE tag = '" . FSFJ3Helper::getEscaped($db, $tag) . "'";
         $db->setQuery($qry2);
         $rows = $db->loadObjectList();
         $ids = array();
         foreach ($rows as &$row) {
             $ids[] = $row->faq_id;
         }
         if (count($ids) > 0) {
             $where[] = "id IN (" . implode(", ", $ids) . ")";
         } else {
             $where[] = "id = 0";
         }
     }
     if (count($where) > 0) {
         $query .= " WHERE " . implode(" AND ", $where);
     }
     $query .= " ORDER BY ordering";
     //echo $query."<br>";
     return $query;
 }
Exemple #17
0
 function HandlePublish()
 {
     $id = JRequest::getInt('id', 0);
     if ($id < 1) {
         exit;
     }
     if ($this->permission['artperm'] > 2) {
         $db =& JFactory::getDBO();
         $pub = 0;
         if ($this->what == "publish") {
             $pub = 1;
         }
         $qry = "UPDATE {$this->table} SET published = {$pub} WHERE id = '" . FSFJ3Helper::getEscaped($db, $id) . "'";
         $db->setquery($qry);
         $db->query();
     }
     exit;
 }
Exemple #18
0
 $document->addScript(JURI::base() . 'components/com_fsf/assets/js/jquery.autoscroll.js');
 $document->addScript(JURI::base() . 'components/com_fsf/assets/js/accordion.js');
 $catid = $params->get('catid');
 $dispcount = $params->get('dispcount');
 $maxheight = $params->get('maxheight');
 $mode = $params->get('listtype');
 if ($mode == "accordion") {
     $maxheight = 0;
 }
 $db = JFactory::getDBO();
 $qry = "SELECT * FROM #__fsf_faq_faq";
 $where = array();
 $where[] = "published = 1";
 // for cats
 if ($catid > 0) {
     $where[] = "faq_cat_id = " . FSFJ3Helper::getEscaped($db, $catid);
 } else {
     if ($catid == -5) {
         $where[] = "featured = 1";
     }
 }
 if (count($where) > 0) {
     $qry .= " WHERE " . implode(" AND ", $where);
 }
 $order = "ordering";
 $qry .= " ORDER BY {$order} ";
 if ($dispcount > 0) {
     $qry .= " LIMIT {$dispcount}";
 }
 $db->setQuery($qry);
 $data = $db->loadObjectList();
Exemple #19
0
			</th>
			<th  class="title" width="8%" nowrap="nowrap">
				<?php 
echo JHTML::_('grid.sort', 'Featured', 'featured', @$this->lists['order_Dir'], @$this->lists['order']);
?>
			</th>
			<th width="1%" nowrap="nowrap">
				<?php 
echo JHTML::_('grid.sort', 'Published', 'published', @$this->lists['order_Dir'], @$this->lists['order']);
?>
			</th>
 			<?php 
FSFAdminHelper::LA_Header($this);
?>
            <th width="<?php 
echo FSFJ3Helper::IsJ3() ? '130px' : '8%';
?>
">
				<?php 
echo JHTML::_('grid.sort', 'Order', 'ordering', @$this->lists['order_Dir'], @$this->lists['order']);
?>
				<?php 
if ($ordering) {
    echo JHTML::_('grid.order', $this->data);
}
?>
			</th>
		</tr>
    </thead>
    <?php 
$k = 0;
Exemple #20
0
 function display($tpl = null)
 {
     JHTML::_('behavior.modal');
     $what = JRequest::getString('what', '');
     $this->tab = JRequest::getVar('tab');
     if (JRequest::getVar('task') == "cancellist") {
         $mainframe = JFactory::getApplication();
         $link = FSFRoute::x('index.php?option=com_fsf&view=fsfs', false);
         $mainframe->redirect($link);
         return;
     }
     $settings = FSF_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;
             }
             // skip any setting that is in the templates list
             if (array_key_exists($setting, $templates)) {
                 continue;
             }
             if (array_key_exists($setting, $large)) {
                 continue;
             }
             $qry = "REPLACE INTO #__fsf_settings_view (setting, value) VALUES ('";
             $qry .= FSFJ3Helper::getEscaped($db, $setting) . "','";
             $qry .= FSFJ3Helper::getEscaped($db, $value) . "')";
             $db->setQuery($qry);
             $db->Query();
             //echo $qry."<br>";
         }
         $link = 'index.php?option=com_fsf&view=settingsview#' . $this->tab;
         if (JRequest::getVar('task') == "save") {
             $link = 'index.php?option=com_fsf';
         }
         //exit;
         $mainframe = JFactory::getApplication();
         $mainframe->redirect($link, JText::_("View_Settings_Saved"));
         exit;
     } else {
         $document = JFactory::getDocument();
         $document->addStyleSheet(JURI::root() . 'administrator/components/com_fsf/assets/css/js_color_picker_v2.css');
         $document->addScript(JURI::root() . 'administrator/components/com_fsf/assets/js/color_functions.js');
         $document->addScript(JURI::root() . 'administrator/components/com_fsf/assets/js/js_color_picker_v2.js');
         $this->assignRef('settings', $settings);
         JToolBarHelper::title(JText::_("FREESTYLE_FAQS") . ' - ' . JText::_("VIEW_SETTINGS"), 'fsf_viewsettings');
         JToolBarHelper::apply();
         JToolBarHelper::save();
         JToolBarHelper::cancel('cancellist');
         FSFAdminHelper::DoSubToolbar();
         parent::display($tpl);
     }
 }
Exemple #21
0
 /**
  * Weblink 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 onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys(plgSearchFSFGlossaryAreas()))) {
             return array();
         }
     }
     $limit = $this->params->def('search_limit', 50);
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $wheres = array();
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . FSFJ3Helper::getEscaped($db, $text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'LOWER(a.word) LIKE ' . $text;
             $wheres2[] = 'LOWER(a.description) LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . FSFJ3Helper::getEscaped($db, $word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'LOWER(a.word) LIKE ' . $word;
                 $wheres2[] = 'LOWER(a.description) LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'alpha':
             $order = 'a.word ASC';
             break;
         case 'oldest':
         case 'popular':
         case 'newest':
         default:
             $order = 'a.word ASC';
     }
     $searchFAQs = JText::_("GLOSSARY");
     $query = 'SELECT a.word AS title,' . ' a.description as text, NULL as created,' . ' a.id, 2 as browsernav, "" as section' . ' FROM #__fsf_glossary AS a' . ' WHERE ( ' . $where . ' )' . ' AND a.published = 1 ' . ' ORDER BY ' . $order;
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $key => $row) {
         $word = $row->title;
         $anchor = strtolower(preg_replace("/[^A-Za-z0-9]/", '-', $word));
         $letter = strtolower(substr($word, 0, 1));
         $rows[$key]->href = 'index.php?option=com_fsf&view=glossary&letter=' . $letter . '#' . $anchor;
     }
     return $rows;
 }
Exemple #22
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     JHTML::_('behavior.modal', 'a.fsf_modal');
     //JHTML::_('behavior.mootools');
     $db = JFactory::getDBO();
     $aparams = FSF_Settings::GetViewSettingsObj('glossary');
     $this->use_letter_bar = $aparams->get('use_letter_bar', 0);
     if ($this->use_letter_bar) {
         $this->letters = array();
         if (FSF_Settings::get('glossary_all_letters')) {
             $letters = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
             foreach ($letters as $letter) {
                 $this->letters[$letter] = 0;
             }
         }
         $qry = "SELECT UPPER(SUBSTR(word,1,1)) as letter FROM #__fsf_glossary";
         $where = array();
         $where[] = "published = 1";
         if (FSF_Helper::Is16()) {
             $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
             $user = JFactory::getUser();
             $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
         }
         if (count($where) > 0) {
             $qry .= " WHERE " . implode(" AND ", $where);
         }
         $qry .= " GROUP BY letter ORDER BY letter";
         $db->setQuery($qry);
         $letters = $db->loadObjectList();
         foreach ($letters as $letter) {
             $this->letters[$letter->letter] = 1;
         }
         if (count($this->letters) == 0) {
             return parent::display("empty");
         }
     }
     $this->curletter = "";
     // if we are showing on a per letter basis only
     if ($this->use_letter_bar == 2) {
         $this->curletter = JRequest::getVar('letter', $this->letters[0]->letter);
     }
     $where = array();
     $where[] = "published = 1";
     $query = "SELECT * FROM #__fsf_glossary";
     if ($this->curletter) {
         $where[] = "SUBSTR(word,1,1) = '" . FSFJ3Helper::getEscaped($db, $this->curletter) . "'";
     }
     if (FSF_Helper::Is16()) {
         $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);
     }
     $query .= " ORDER BY word";
     $db->setQuery($query);
     $this->rows = $db->loadObjectList();
     $pathway =& $mainframe->getPathway();
     if (FSF_Helper::NeedBaseBreadcrumb($pathway, array('view' => 'glossary'))) {
         $pathway->addItem("Glossary");
     }
     if (FSF_Settings::get('glossary_use_content_plugins')) {
         // apply plugins to article body
         $dispatcher =& JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         $art = new stdClass();
         if (FSF_Helper::Is16()) {
             //$aparams = new JParameter(null);
         } else {
             $aparams = new stdClass();
         }
         $this->params =& $mainframe->getParams('com_fsf');
         foreach ($this->rows as &$row) {
             if ($row->description) {
                 $art->text = $row->description;
                 $art->noglossary = 1;
                 if (FSF_Helper::Is16()) {
                     $results = $dispatcher->trigger('onContentPrepare', array('com_fsf.glossary', &$art, &$this->params, 0));
                 } else {
                     $results = $dispatcher->trigger('onPrepareContent', array(&$art, &$this->params, 0));
                 }
                 $row->description = $art->text;
             }
             if ($row->longdesc) {
                 $art->text = $row->longdesc;
                 $art->noglossary = 1;
                 if (FSF_Helper::Is16()) {
                     $results = $dispatcher->trigger('onContentPrepare', array('com_fsf.glossary.long', &$art, &$this->params, 0));
                 } else {
                     $results = $dispatcher->trigger('onPrepareContent', array(&$art, &$this->params, 0));
                 }
                 $row->longdesc = $art->text;
             }
         }
     }
     parent::display($tpl);
 }
Exemple #23
0
 function CustomTemplate()
 {
     $template = JRequest::getVar('name');
     $db =& JFactory::getDBO();
     $qry = "SELECT * FROM #__fsf_templates WHERE template = '" . FSFJ3Helper::getEscaped($db, $template) . "'";
     $db->setQuery($qry);
     $rows = $db->loadAssocList();
     $output = array();
     foreach ($rows as $row) {
         if ($row['tpltype']) {
             $output['head'] = $row['value'];
         } else {
             $output['row'] = $row['value'];
         }
     }
     echo json_encode($output);
     exit;
 }
Exemple #24
0
 static function getAdminPermissions()
 {
     if (empty(FSF_Ticket_Helper::$_permissions)) {
         $mainframe = JFactory::getApplication();
         global $option;
         $user = JFactory::getUser();
         $userid = $user->id;
         $db = JFactory::getDBO();
         $query = "SELECT * FROM #__fsf_user WHERE user_id = '" . FSFJ3Helper::getEscaped($db, $userid) . "'";
         $db->setQuery($query);
         FSF_Ticket_Helper::$_permissions = $db->loadAssoc();
         if (!FSF_Ticket_Helper::$_permissions) {
             FSF_Ticket_Helper::$_permissions['mod_kb'] = 0;
             FSF_Ticket_Helper::$_permissions['mod_test'] = 0;
             FSF_Ticket_Helper::$_permissions['support'] = 0;
             FSF_Ticket_Helper::$_permissions['seeownonly'] = 1;
             FSF_Ticket_Helper::$_permissions['autoassignexc'] = 1;
             FSF_Ticket_Helper::$_permissions['allprods'] = 1;
             FSF_Ticket_Helper::$_permissions['allcats'] = 1;
             FSF_Ticket_Helper::$_permissions['alldepts'] = 1;
             FSF_Ticket_Helper::$_permissions['artperm'] = 0;
             FSF_Ticket_Helper::$_permissions['id'] = 0;
             FSF_Ticket_Helper::$_permissions['groups'] = 0;
             FSF_Ticket_Helper::$_permissions['reports'] = 0;
             FSF_Ticket_Helper::$_permissions['settings'] = '';
         }
         FSF_Ticket_Helper::$_permissions['userid'] = $userid;
         FSF_Ticket_Helper::$_perm_only = '';
         FSF_Ticket_Helper::$_perm_prods = '';
         FSF_Ticket_Helper::$_perm_depts = '';
         FSF_Ticket_Helper::$_perm_cats = '';
         FSF_Ticket_Helper::$_permissions['perm_where'] = '';
         //
         // check for permission overrides for Joomla 1.6
         if (FSF_Settings::get('perm_article_joomla') || FSF_Settings::get('perm_mod_joomla')) {
             if (FSF_Helper::Is16()) {
                 $newart = 0;
                 $newmod = 0;
                 $user = JFactory::getUser();
                 if ($user->authorise('core.edit.own', 'com_fsf')) {
                     $newart = 1;
                 }
                 if ($user->authorise('core.edit', 'com_fsf')) {
                     $newart = 2;
                     $newmod = 1;
                 }
                 if ($user->authorise('core.edit.state', 'com_fsf')) {
                     $newart = 3;
                     $newmod = 1;
                 }
                 if (FSF_Settings::get('perm_article_joomla') && $newart > FSF_Ticket_Helper::$_permissions['artperm']) {
                     FSF_Ticket_Helper::$_permissions['artperm'] = $newart;
                 }
                 if (FSF_Settings::get('perm_mod_joomla') && $newmod > FSF_Ticket_Helper::$_permissions['mod_kb']) {
                     FSF_Ticket_Helper::$_permissions['mod_kb'] = $newmod;
                 }
                 //
             } else {
                 $newart = 0;
                 $newmod = 0;
                 $user = JFactory::getUser();
                 if ($user->authorize('com_fsf', 'create', 'content', 'own')) {
                     $newart = 1;
                 }
                 if ($user->authorize('com_fsf', 'edit', 'content', 'own')) {
                     $newart = 2;
                     $newmod = 1;
                 }
                 if ($user->authorize('com_fsf', 'publish', 'content', 'all')) {
                     $newart = 3;
                     $newmod = 1;
                 }
                 if (FSF_Settings::get('perm_article_joomla') && $newart > FSF_Ticket_Helper::$_permissions['artperm']) {
                     FSF_Ticket_Helper::$_permissions['artperm'] = $newart;
                 }
                 if (FSF_Settings::get('perm_mod_joomla') && $newmod > FSF_Ticket_Helper::$_permissions['mod_kb']) {
                     FSF_Ticket_Helper::$_permissions['mod_kb'] = $newmod;
                 }
             }
         }
     }
     return FSF_Ticket_Helper::$_permissions;
 }
Exemple #25
0
     if (count($where) > 0) {
         $query .= " WHERE " . implode(" AND ", $where);
     }
     $query .= " ORDER BY ordering";
     $db->setQuery($query);
     $rows = $db->loadAssocList();
     FSF_Helper::Tr($rows);
     require JModuleHelper::getLayoutPath('mod_fsf_catprods', 'kbprod');
 } else {
     if ($listtype == 'kbcats') {
         $prodid = $params->get('prodid');
         if ($prodid == -1) {
             $prodid = JRequest::getVar('prodid');
         }
         if ($prodid > 0) {
             $qry1 = "SELECT a.kb_cat_id FROM #__fsf_kb_art as a LEFT JOIN #__fsf_kb_art_prod as p ON a.id = p.kb_art_id WHERE p.prod_id = '" . FSFJ3Helper::getEscaped($db, $prodid) . "' AND published = 1 GROUP BY a.kb_cat_id";
             $qry2 = "SELECT a.kb_cat_id FROM #__fsf_kb_art as a WHERE a.allprods = '1' AND published = 1 GROUP BY a.kb_cat_id";
             $query = "({$qry1}) UNION ({$qry2})";
             $db->setQuery($query);
             $rows = $db->loadAssocList('kb_cat_id');
             $catids = array();
             foreach ($rows as &$rows) {
                 $catids[$rows['kb_cat_id']] = $rows['kb_cat_id'];
             }
             $query = "SELECT parcatid FROM #__fsf_kb_cat WHERE id IN (" . implode(", ", $catids) . ") AND parcatid > 0";
             $db->setQuery($query);
             $rows = $db->loadAssocList();
             foreach ($rows as &$rows) {
                 $catids[$rows['parcatid']] = $rows['parcatid'];
             }
             $query = "SELECT * FROM #__fsf_kb_cat";
Exemple #26
0
 /**
  * Weblink 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 onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys(plgSearchFSFFAQsAreas()))) {
             return array();
         }
     }
     $limit = $this->params->def('search_limit', 50);
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $wheres = array();
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . FSFJ3Helper::getEscaped($db, $text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'LOWER(a.question) LIKE ' . $text;
             $wheres2[] = 'LOWER(a.answer) LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . FSFJ3Helper::getEscaped($db, $word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'LOWER(a.question) LIKE ' . $word;
                 $wheres2[] = 'LOWER(a.answer) LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'alpha':
             $order = 'a.question ASC';
             break;
         case 'oldest':
         case 'popular':
         case 'newest':
         default:
             $order = 'a.question ASC';
     }
     $searchFAQs = JText::_("FAQS");
     $query = 'SELECT a.question AS title,' . ' a.answer as text, c.title as section, ' . ' a.faq_cat_id, a.id, 0 as created, 2 as browsernav' . ' FROM #__fsf_faq_faq AS a' . ' LEFT JOIN #__fsf_faq_cat as c ON a.faq_cat_id = c.id';
     $ow = "( " . $where . ")";
     $where = array();
     $where[] = $ow;
     $where[] = "a.published = 1";
     $where[] = "c.published = 1";
     if (FSF_Helper::Is16()) {
         $where[] = 'a.language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
         $user = JFactory::getUser();
         $where[] = 'a.access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
     }
     if (count($where) > 0) {
         $query .= " WHERE " . implode(" AND ", $where);
     }
     $query .= ' ORDER BY ' . $order;
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $key => $row) {
         $rows[$key]->href = 'index.php?option=com_fsf&view=faq&catid=' . $row->faq_cat_id . '&faqid=' . $row->id;
     }
     return $rows;
 }