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 . '" />'; } }
static function DoSubToolbar() { if (!FSF_Helper::Is16()) { JToolBarHelper::divider(); JToolBarHelper::help("help.php?help=admin-view-" . JRequest::getVar('view'), true); return; } if (JFactory::getUser()->authorise('core.admin', 'com_fsf')) { JToolBarHelper::preferences('com_fsf'); } JToolBarHelper::divider(); JToolBarHelper::help("", false, "http://www.freestyle-joomla.com/comhelp/fsf/admin-view-" . JRequest::getVar('view')); $vName = JRequest::getCmd('view', 'fsfs'); JSubMenuHelper::addEntry(JText::_('COM_FSF_OVERVIEW'), 'index.php?option=com_fsf&view=fsfs', $vName == 'fsfs' || $vName == ""); JSubMenuHelper::addEntry(JText::_('COM_FSF_SETTINGS'), 'index.php?option=com_fsf&view=settings', $vName == 'settings'); JSubMenuHelper::addEntry(JText::_('COM_FSF_TEMPLATES'), 'index.php?option=com_fsf&view=templates', $vName == 'templates'); JSubMenuHelper::addEntry(JText::_('COM_FSF_VIEW_SETTINGS'), 'index.php?option=com_fsf&view=settingsview', $vName == 'settingsview'); // ##NOT_TEST_START## // JSubMenuHelper::addEntry(JText::_('COM_FSF_FAQS'), 'index.php?option=com_fsf&view=faqs', $vName == 'faqs'); JSubMenuHelper::addEntry(JText::_('COM_FSF_FAQ_CATEGORIES'), 'index.php?option=com_fsf&view=faqcats', $vName == 'faqcats'); // JSubMenuHelper::addEntry(JText::_('COM_FSF_GLOSSARY'), 'index.php?option=com_fsf&view=glossarys', $vName == 'glossarys'); // JSubMenuHelper::addEntry(JText::_('COM_FSF_ADMIN'), 'index.php?option=com_fsf&view=backup', $vName == 'backup'); }
static function GetGlossary() { if (empty(FSF_Glossary::$fsf_glossary)) { $db = JFactory::getDBO(); $query = 'SELECT * 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) { $query .= " WHERE " . implode(" AND ", $where); } $query .= ' ORDER BY LENGTH(word) DESC'; $db->setQuery($query); $rows = $db->loadAssocList(); $fsf_glossary = array(); foreach ($rows as $data) { FSF_Glossary::$fsf_glossary[$data['word']] = $data['description']; } } }
$where[] = "parcatid = 0"; 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 ordering"; } else { $query = "SELECT * FROM #__fsf_kb_cat"; $where = array(); $where[] = "published = 1"; $where[] = "parcatid = 0"; 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 ordering"; } $db->setQuery($query); $rows = $db->loadAssocList('id'); require JModuleHelper::getLayoutPath('mod_fsf_catprods', 'kbcats'); } else { $module->showtitle = 0; $attribs['style'] = "hide_me";
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; }
function plgSearchFSFGlossary($text, $phrase = '', $ordering = '', $areas = null) { $db =& JFactory::getDBO(); $user =& JFactory::getUser(); if (is_array($areas)) { if (!array_intersect($areas, array_keys(plgSearchFSFGlossaryAreas()))) { return array(); } } $plugin =& JPluginHelper::getPlugin('search', 'fsf_glossary'); if ($plugin) { $pluginParams = new JParameter($plugin->params); } else { $pluginParams = new JParameter(null); } $limit = $pluginParams->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'; $ow = "( " . $where . ")"; $where = array(); $where[] = $ow; $where[] = "a.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) { $query .= " WHERE " . implode(" AND ", $where); } $query .= ' 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; }
static function _($url, $xhtml = true, $ssl = null) { if (FSF_Helper::Is16()) { return FSFRoute::_16($url, $xhtml, $ssl); } else { return FSFRoute::_15($url, $xhtml, $ssl); } }
function Misc() { $log = ""; if (FSF_Helper::Is16()) { // update #__updates table to have longer version field $qry = "ALTER TABLE #__updates CHANGE version version VARCHAR( 20 ) DEFAULT NULL"; $db = JFactory::getDBO(); $db->setQuery($qry); $db->Query(); } return $log; }
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; }
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); }
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); }
static function _GetDefaults() { global $fsf_settings; if (empty($fsf_settings)) { $fsf_settings = array(); $fsf_settings['version'] = 0; $fsf_settings['fsj_username'] = ''; $fsf_settings['fsj_apikey'] = ''; $fsf_settings['jquery_include'] = "auto"; $fsf_settings['perm_mod_joomla'] = 0; $fsf_settings['perm_article_joomla'] = 0; $fsf_settings['captcha_type'] = 'none'; $fsf_settings['recaptcha_public'] = ''; $fsf_settings['recaptcha_private'] = ''; $fsf_settings['recaptcha_theme'] = 'red'; $fsf_settings['comments_moderate'] = 'none'; $fsf_settings['comments_hide_add'] = 1; $fsf_settings['email_on_comment'] = ''; $fsf_settings['comments_who_can_add'] = 'anyone'; $fsf_settings['test_use_email'] = 1; $fsf_settings['test_use_website'] = 1; $fsf_settings['commnents_use_email'] = 1; $fsf_settings['commnents_use_website'] = 1; $fsf_settings['hide_powered'] = 0; $fsf_settings['announce_use_content_plugins'] = 0; $fsf_settings['announce_use_content_plugins_list'] = 0; $fsf_settings['announce_comments_allow'] = 1; $fsf_settings['announce_comments_per_page'] = 0; $fsf_settings['announce_per_page'] = 10; $fsf_settings['kb_rate'] = 1; $fsf_settings['kb_comments'] = 1; $fsf_settings['kb_view_top'] = 0; $fsf_settings['kb_show_views'] = 1; $fsf_settings['kb_show_recent'] = 1; $fsf_settings['kb_show_recent_stats'] = 1; $fsf_settings['kb_show_viewed'] = 1; $fsf_settings['kb_show_viewed_stats'] = 1; $fsf_settings['kb_show_rated'] = 1; $fsf_settings['kb_show_rated_stats'] = 1; $fsf_settings['kb_show_dates'] = 1; $fsf_settings['kb_use_content_plugins'] = 0; $fsf_settings['kb_show_art_related'] = 1; $fsf_settings['kb_show_art_products'] = 1; $fsf_settings['kb_show_art_attach'] = 1; $fsf_settings['kb_contents'] = 1; $fsf_settings['kb_smaller_subcat_images'] = 0; $fsf_settings['kb_comments_per_page'] = 0; $fsf_settings['kb_prod_per_page'] = 5; $fsf_settings['kb_art_per_page'] = 10; $fsf_settings['kb_print'] = 1; $fsf_settings['test_moderate'] = 'none'; $fsf_settings['test_email_on_submit'] = ''; $fsf_settings['test_allow_no_product'] = 1; $fsf_settings['test_who_can_add'] = 'anyone'; $fsf_settings['test_hide_empty_prod'] = 1; $fsf_settings['test_comments_per_page'] = 0; $fsf_settings['skin_style'] = 0; $fsf_settings['support_entire_row'] = 0; $fsf_settings['support_autoassign'] = 0; $fsf_settings['support_assign_open'] = 0; $fsf_settings['support_assign_reply'] = 0; $fsf_settings['support_user_attach'] = 1; $fsf_settings['support_lock_time'] = 30; $fsf_settings['support_show_msg_counts'] = 1; $fsf_settings['support_reference'] = "4L-4L-4L"; $fsf_settings['support_list_template'] = "classic"; $fsf_settings['support_custom_register'] = ""; $fsf_settings['support_no_logon'] = 0; $fsf_settings['support_no_register'] = 0; $fsf_settings['support_info_cols'] = 1; $fsf_settings['support_actions_as_buttons'] = 0; $fsf_settings['support_choose_handler'] = 'none'; $fsf_settings['support_dont_check_dupe'] = 1; $fsf_settings['support_admin_refresh'] = 0; $fsf_settings['support_only_admin_open'] = 0; $fsf_settings['support_user_reply_width'] = 56; $fsf_settings['support_user_reply_height'] = 10; $fsf_settings['support_admin_reply_width'] = 56; $fsf_settings['support_admin_reply_height'] = 10; $fsf_settings['ticket_label_width'] = 100; $fsf_settings['support_next_prod_click'] = 1; $fsf_settings['support_subject_size'] = 35; $fsf_settings['support_subject_message_hide'] = ''; $fsf_settings['support_filename'] = 0; $fsf_settings['support_subject_at_top'] = 0; $fsf_settings['support_tabs_allopen'] = 0; $fsf_settings['support_tabs_allclosed'] = 0; $fsf_settings['support_tabs_all'] = 0; $fsf_settings['ticket_prod_per_page'] = 5; $fsf_settings['ticket_per_page'] = 10; $fsf_settings['support_restrict_prod'] = 0; $fsf_settings['css_hl'] = '#f0f0f0'; $fsf_settings['css_tb'] = '#ffffff'; $fsf_settings['css_bo'] = '#e0e0e0'; $fsf_settings['display_head'] = ''; $fsf_settings['display_foot'] = ''; $fsf_settings['use_joomla_page_title_setting'] = 0; $fsf_settings['title_prefix'] = 1; $fsf_settings['content_unpublished_color'] = '#FFF0F0'; if (FSF_Helper::Is16()) { $fsf_settings['display_h1'] = '<h1>$1</h1>'; $fsf_settings['display_h2'] = '<h2>$1</h2>'; $fsf_settings['display_h3'] = '<h3>$1</h3>'; $fsf_settings['display_popup'] = '<h2>$1</h2>'; $fsf_settings['display_style'] = '.fsf_main tr, td { border: none; padding: 1px; }'; $fsf_settings['display_popup_style'] = '.fsf_popup tr, td { border: none; padding: 1px; }'; } else { $fsf_settings['display_h1'] = '<div class="component-header"><div class="componentheading">$1</div></div>'; $fsf_settings['display_h2'] = '<div class="fsf_spacer contentheading">$1</div>'; $fsf_settings['display_h3'] = '<div class="fsf_admin_create">$1</div>'; $fsf_settings['display_popup'] = '<div class="component-header"><div class="componentheading">$1</div></div>'; $fsf_settings['display_style'] = ''; $fsf_settings['display_popup_style'] = ''; } $fsf_settings['support_email_on_create'] = 0; $fsf_settings['support_email_handler_on_create'] = 0; $fsf_settings['support_email_on_reply'] = 0; $fsf_settings['support_email_handler_on_reply'] = 0; $fsf_settings['support_email_handler_on_forward'] = 0; $fsf_settings['support_email_on_close'] = 0; $fsf_settings['support_email_all_admins'] = 0; $fsf_settings['support_email_all_admins_only_unassigned'] = 0; $fsf_settings['support_email_all_admins_ignore_auto'] = 0; $fsf_settings['support_email_all_admins_can_view'] = 0; $fsf_settings['support_user_can_close'] = 1; $fsf_settings['support_user_can_reopen'] = 1; $fsf_settings['support_advanced'] = 1; $fsf_settings['support_allow_unreg'] = 0; $fsf_settings['support_delete'] = 1; $fsf_settings['support_advanced_default'] = 0; $fsf_settings['support_sceditor'] = 1; $fsf_settings['support_altcat'] = 0; $fsf_settings['support_cronlog_keep'] = 5; $fsf_settings['support_hide_priority'] = 0; $fsf_settings['support_hide_handler'] = 0; $fsf_settings['support_hide_users_tickets'] = 0; $fsf_settings['support_hide_tags'] = 0; $fsf_settings['support_email_unassigned'] = ''; $fsf_settings['support_email_admincc'] = ''; $fsf_settings['support_email_from_name'] = ''; $fsf_settings['support_email_from_address'] = ''; $fsf_settings['support_email_site_name'] = ''; $fsf_settings['support_ea_check'] = 0; $fsf_settings['support_ea_all'] = 0; $fsf_settings['support_ea_reply'] = 0; $fsf_settings['support_ea_type'] = 0; $fsf_settings['support_ea_host'] = ''; $fsf_settings['support_ea_port'] = ''; $fsf_settings['support_ea_username'] = ''; $fsf_settings['support_ea_password'] = ''; $fsf_settings['support_ea_mailbox'] = ''; $fsf_settings['support_user_message'] = '#c0c0ff'; $fsf_settings['support_admin_message'] = '#c0ffc0'; $fsf_settings['support_private_message'] = '#ffc0c0'; $fsf_settings['support_basic_name'] = ''; $fsf_settings['support_basic_username'] = ''; $fsf_settings['support_basic_email'] = ''; $fsf_settings['support_basic_messages'] = ''; $fsf_settings['glossary_faqs'] = 1; $fsf_settings['glossary_kb'] = 1; $fsf_settings['glossary_announce'] = 1; $fsf_settings['glossary_link'] = 1; $fsf_settings['glossary_title'] = 0; $fsf_settings['glossary_use_content_plugins'] = 0; $fsf_settings['glossary_ignore'] = ''; $fsf_settings['glossary_exclude'] = "a,script,pre,h1,h2,h3,h4,h5,h6"; $fsf_settings['glossary_all_letters'] = 0; $fsf_settings['faq_popup_width'] = 650; $fsf_settings['faq_popup_height'] = 375; $fsf_settings['faq_popup_inner_width'] = 0; $fsf_settings['faq_use_content_plugins'] = 0; $fsf_settings['faq_use_content_plugins_list'] = 0; $fsf_settings['faq_per_page'] = 10; $fsf_settings['faq_cat_prefix'] = 1; // 1.9 comments stuff $fsf_settings['comments_announce_use_custom'] = 0; $fsf_settings['comments_kb_use_custom'] = 0; $fsf_settings['comments_test_use_custom'] = 0; $fsf_settings['comments_general_use_custom'] = 0; $fsf_settings['comments_testmod_use_custom'] = 0; $fsf_settings['announce_use_custom'] = 0; $fsf_settings['announcemod_use_custom'] = 0; $fsf_settings['announcesingle_use_custom'] = 0; // date format stuff $fsf_settings['date_dt_short'] = ''; $fsf_settings['date_dt_long'] = ''; $fsf_settings['date_d_short'] = ''; $fsf_settings['date_d_long'] = ''; $fsf_settings['timezone_offset'] = 0; $fsf_settings['mainmenu_moderate'] = 1; $fsf_settings['mainmenu_support'] = 1; } }
/** * 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; }