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'); }
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 . '" />'; } }
protected function _glossary(&$text, &$params) { $text = fsf_Glossary::ReplaceGlossary($text); $text .= fsf_Glossary::Footer(); $css = JURI::root(true) . "/index.php?option=com_fsf&view=css&layout=default"; $document = JFactory::getDocument(); $document->addStyleSheet($css); FSF_Helper::IncludeJQuery(); return true; }
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']; } } }
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; }
function ParserPopulateTicket(&$parser, $row) { $parser->Clear(); if ($row) { $parser->SetVar('ref', $row['reference']); $parser->SetVar('subject', "<a href='" . FSFRoute::_('index.php?option=com_fsf&view=admin&layout=support&ticketid=' . $row['id']) . "'>" . $row['title'] . "</a>"); $parser->SetVar("status", "<span style='color:" . $row['color'] . ";'>" . $row['status'] . "</span>"); if ($row['user_id'] == 0) { $name = $row['unregname'] . " (" . JText::_("UNREG") . ")"; } else { $name = $row['name']; } $parser->SetVar("name", $name); $parser->SetVar("lastactivity", FSF_Helper::Date($row['lastupdate'], FSF_DATETIME_SHORT)); $parser->SetVar("opened", FSF_Helper::Date($row['opened'], FSF_DATETIME_SHORT)); $parser->SetVar("closed", FSF_Helper::Date($row['closed'], FSF_DATETIME_SHORT)); $parser->SetVar("department", $row['department']); $parser->SetVar("category", $row['category']); $parser->SetVar("product", $row['product']); $parser->SetVar("priority", "<span style='color:" . $row['pricolor'] . ";'>" . $row['priority'] . "</span>"); $groups = implode(", ", $row['groups']); $parser->SetVar('groups', $groups); $parser->SetVar('deletebutton', 'deletebutton'); $parser->SetVar('archivebutton', 'archivebutton'); if (array_key_exists("custom", $row)) { $allcustom = array(); if (count($row['custom']) > 0) { foreach ($row['custom'] as $id => $value) { if (array_key_exists($id, $this->customfields)) { $field = $this->customfields[$id]; if ($field['type'] == "plugin") { $aparams = FSFCF::GetValues($field); if (array_key_exists("plugin", $aparams) && array_key_exists("plugindata", $aparams)) { $plugin = FSFCF::get_plugin($aparams['plugin']); $value = $plugin->Display($value, $aparams['plugindata'], array('ticketid' => $row['id'], 'userid' => $row['user_id'], 'ticket' => $row), $field['id']); } } $text = "<span class='fsf_support_fieldname'>" . $this->customfields[$id]['description'] . "</span>"; if ($this->customfields[$id]['type'] == "checkbox") { if ($value == "on") { $value = JText::_("Yes"); } else { $value = JText::_("No"); } } $parser->SetVar("custom" . $id, $value); $parser->SetVar("custom_" . $id, $value); $allcustom[] = $text . ": " . $value; } } } //echo "All custom : " . implode(", ",$allcustom) . "<br>"; $parser->SetVar("custom", implode(", ", $allcustom)); } if ($row['assigned'] == '') { $parser->SetVar('handlername', JText::_("UNASSIGNED")); } else { $parser->SetVar('handlername', $row['assigned']); } $parser->SetVar('username', $row['username']); $parser->SetVar('email', $row['useremail']); $parser->SetVar('handlerusername', $row['handlerusername']); $parser->SetVar('handleremail', $row['handleremail']); $icons = ""; if (FSF_Settings::get('support_show_msg_counts')) { $icons .= "<span>"; $icons .= "<span style='font-weight:normal;top:-2px;position:relative;padding-right:2px;'>" . $row['msgcount']['total'] . "</span><span style='font-weight:normal;top:-2px;position:relative;padding-right:2px;'>x</span><img src='" . JURI::root(true) . "/components/com_fsf/assets/images/messages.png'>"; $icons .= "</span>"; } $cotime = $this->db_time - strtotime($row['checked_out_time']); if ($cotime < FSF_Settings::get('support_lock_time') && $row['checked_out'] != $this->userid && $row['checked_out'] > 0) { $html = "<div class='fsf_user_tt'>" . $row['co_user']->name . " (" . $row['co_user']->email . ")</div>"; $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fsf/assets/images/lock.png' title=\"" . JText::_('TICKET_LOCKED') . "::" . $html . "\">"; } else { $icons .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/blank_16.png'>"; } if (!FSF_Settings::get('support_hide_tags')) { if (isset($row['tags'])) { $html = ""; foreach ($row['tags'] as $tag) { $html .= "<div class='fsf_tag_tt'>" . $tag['tag'] . "</div>"; } $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fsf/assets/images/tag.png' title=\"" . JText::_('TICKET_TAGS') . "::" . $html . "\">"; } else { $icons .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/blank_16.png'>"; } } if (isset($row['attach'])) { $html = "<table class='fsf_attach_tt'>"; foreach ($row['attach'] as $attach) { $html .= "<tr style='border:0px;'><td nowrap style='border:0px;'>" . $attach['filename'] . " </td><td nowrap style='border:0px;'> " . FSF_Helper::display_filesize($attach['size']) . "</td></tr>"; } $html .= "<table>"; $icons .= "<img class='fsj_tip' src='" . JURI::root(true) . "/components/com_fsf/assets/images/attach.png' title=\"" . JText::_('TICKET_ATTACHMENTS') . "::" . $html . "\">"; } else { $icons .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/blank_16.png'>"; } $parser->SetVar('icons', $icons); $delete = "<a href='" . FSFRoute::x('index.php?option=com_fsf&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&delete=' . $row['id']) . "'>"; $delete .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/delete_ticket.png'>"; $delete .= JText::_("DELETE") . "</a>"; $archive = "<a href='" . FSFRoute::x('index.php?option=com_fsf&view=admin&layout=support&tickets=' . JRequest::getVar('tickets') . '&archive=' . $row['id']) . "'>"; $archive .= "<img src='" . JURI::root(true) . "/components/com_fsf/assets/images/archive_ticket.png'>"; $archive .= JText::_("ARCHIVE") . "</a>"; $parser->SetVar('archivebutton', $archive); $parser->SetVar('deletebutton', $delete); // TODO: trhl /*id='ticket_<?php echo $ticket['id'];?>' onmouseover="$('ticket_<?php echo $ticket['id'];?>').style.background = '<?php echo FSF_Settings::get('css_hl'); ?>';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '<?php echo FSF_Settings::get('css_hl'); ?>';" onmouseout="$('ticket_<?php echo $ticket['id'];?>').style.background = '';$('ticket_<?php echo $ticket['id'];?>_2').style.background = '';"*/ $this->_permissions = FSF_Ticket_Helper::getAdminPermissions(); $type = "unassigned"; if ($row['admin_id'] == $this->_permissions['id']) { $type = "mine"; } else { if ($row['admin_id'] > 0) { $type = "other"; } } $style = ""; if (array_key_exists($row['ticket_pri_id'], $this->priorities)) { $pri = $this->priorities[$row['ticket_pri_id']]; if ($pri['backcolor']) { $style .= "background-color: {$pri['backcolor']};"; } } $handler_highlight = "ticket_type_{$type}"; $parser->SetVar('handler_highlight', $handler_highlight); $trhl = " class='ticket_{$row['id']} ' onmouseover='highlightticket({$row['id']})' onmouseout='unhighlightticket({$row['id']})' "; if (FSF_Settings::get('support_entire_row')) { $style .= "cursor: pointer;"; $trhl .= " onclick='window.location=\"" . FSFRoute::x('&limitstart=&ticketid=' . $row['id']) . "\"' "; } $trhl .= " style='{$style}' "; $parser->SetVar('trhl', $trhl); } $parser->SetVar("showassigned", $this->showassigned); $parser->SetVar("hidehandler", FSF_Settings::get('support_hide_handler')); $parser->SetVar("candelete", FSF_Settings::get('support_delete')); $parser->SetVar("view", $this->ticket_view); }
static function FieldInput(&$field, &$errors, $errortype = "ticket", $context = array()) { $output = ""; $id = $field['id']; $userid = 0; if (array_key_exists('userid', $context)) { $userid = $context['userid']; } $ticketid = 0; if (array_key_exists('ticketid', $context)) { $ticketid = $context['ticketid']; } // if its a per user field, try to load the value $current = $field['default']; if ($field['peruser'] && $errortype == "ticket") { $uservalues = FSFCF::GetUserValues($userid, $ticketid); if (array_key_exists($field['id'], $uservalues)) { $current = $uservalues[$field['id']]['value']; } } $current = JRequest::getVar("custom_{$id}", $current); if ($field['type'] == "text") { $aparams = FSFCF::GetValues($field); $text_max = $aparams['text_max']; $text_size = $aparams['text_size']; $output = "<input name='custom_{$id}' id='custom_{$id}' value=\"" . FSF_Helper::escape($current) . "\" maxlength='{$text_max}' size='{$text_size}'>\n"; } if ($field['type'] == "radio") { $values = FSFCF::GetValues($field); $output = ""; if (count($values) > 0) { foreach ($values as $value) { $output .= "<input type='radio' id='custom_{$id}' name='custom_{$id}' value=\"" . FSF_Helper::escape($value) . "\""; if ($value == $current) { $output .= " checked"; } $output .= ">{$value}<br>\n"; } } } if ($field['type'] == "combo") { $values = FSFCF::GetValues($field); $output = "<select name='custom_{$id}' id='custom_{$id}'>\n"; $output .= "<option value=''>" . JText::_("PLEASE_SELECT") . "</option>\n"; if (count($values) > 0) { foreach ($values as $value) { $output .= "<option value=\"" . FSF_Helper::escape($value) . "\""; if ($value == $current) { $output .= " selected"; } $output .= ">{$value}</option>\n"; } } $output .= "</select>"; } if ($field['type'] == "area") { $aparams = FSFCF::GetValues($field); $area_width = $aparams['area_width']; $area_height = $aparams['area_height']; $output = "<textarea name='custom_{$id}' id='custom_{$id}' cols='{$area_width}' rows='{$area_height}' style='width:95%'>{$current}</textarea>\n"; } if ($field['type'] == "checkbox") { $output = "<input type='checkbox' name='custom_{$id}' id='custom_{$id}'"; if ($current == "on") { $output .= " checked"; } $output .= ">\n"; } if ($field['type'] == "plugin") { $aparams = FSFCF::GetValues($field); $plugin = FSFCF::get_plugin($aparams['plugin']); $output = $plugin->Input($current, $aparams['plugindata'], $context, $id); } $id = "custom_" . $field['id']; if (array_key_exists($id, $errors)) { if ($errortype == "ticket") { $output .= '<div class="fsf_ticket_error" id="error_subject">' . $errors[$id] . '</div>'; } else { $output .= '</td><td class="fsf_must_have_field">' . $errors[$id]; } } return $output; }
<?php $letter = ""; foreach ($this->rows as $glossary) { $thisletter = strtolower(substr($glossary->word, 0, 1)); if ($thisletter != $letter) { $letter = $thisletter; echo "<a name='letter_{$letter}' ></a>"; } ?> <div class="fsf_glossary_div"> <div class="fsf_glossary_title"><a name='<?php echo FSF_Glossary::MakeAnchor($glossary->word); ?> '></a><?php echo $glossary->word; ?> </div> <div class="fsf_glossary_text"><?php echo $glossary->description; echo $glossary->longdesc; ?> </div> <div class="fsf_clear"></div> </div> <?php } include JPATH_SITE . DS . 'components' . DS . 'com_fsf' . DS . '_powered.php'; echo FSF_Helper::PageStyleEnd();
<?php include JPATH_SITE . DS . 'components' . DS . 'com_fsf' . DS . '_powered.php'; if (FSF_Settings::get('glossary_faqs')) { echo FSF_Glossary::Footer(); } ?> <?php if ($this->tmpl) { echo "</div>"; } ?> <?php echo $this->tmpl ? FSF_Helper::PageStylePopupEnd() : FSF_Helper::PageStyleEnd(); ?> <script> <?php if ($this->tmpl) { ?> jQuery(document).ready( function () { jQuery('a').click( function (ev) { ev.preventDefault(); var href = jQuery(this).attr('href'); window.parent.location.href = href; }); }); <?php
function EditPanel($item, $changeclass = true) { $this->Init(); $this->changeclass = $changeclass; if ($this->permission['artperm'] > 1 || $this->permission['artperm'] == 1 && $item['author'] == $this->userid) { echo "<div class='fsf_content_edit_article'>"; echo "<a href='" . FSFRoute::_("index.php?option=com_fsf&view=admin&layout=content&type={$this->id}&what=edit&id={$item['id']}&option=com_fsf&return=1") . "' class='fsj_tip' title='" . JText::_('EDIT_ARTICLE') . "'><img src='" . JURI::root(true) . "/components/com_fsf/assets/images/edit.png' alt='Edit' /></a>"; if ($item['published']) { $tip = JText::_("CONTENT_PUB_TIP"); } else { $tip = JText::_('CONTENT_UNPUB_TIP'); } if ($this->permission['artperm'] > 2) { ?> <a href="#" id="publish_<?php echo $item['id']; ?> " class="fsf_publish_button fsj_tip" state="<?php echo $item['published']; ?> " title="<?php echo $tip; ?> "> <?php echo FSF_Helper::GetPublishedText($item['published'], true); ?> </a> <?php } else { ?> <?php echo str_replace("_16.png", "_g_16.png", FSF_Helper::GetPublishedText($item['published'])); ?> <?php } echo "</div>"; } }
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; } }
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } // if bad version display warning message if ($ver_files != $ver_inst) { $task = JRequest::getVar('task'); $view = JRequest::getVar('view'); if ($task != "update" || $view != "backup") { JError::raiseWarning(100, JText::sprintf('INCORRECT_VERSION', FSFRoute::x('index.php?option=com_fsf&view=backup&task=update'))); } if ($view != "" && $view != "backup") { JRequest::setVar('view', ''); } } // if bad version and controller is not fsfs dont display // Create the controller $controllername = $controller; $classname = 'FsfsController' . $controller; $controller = new $classname(); $css = JRoute::_(JURI::root() . "index.php?option=com_fsf&view=css"); $document = JFactory::getDocument(); $document->addStyleSheet($css); $document->addStyleSheet(JURI::root() . 'administrator/components/com_fsf/assets/css/main.css'); $document->addStyleSheet(JURI::root() . 'components/com_fsf/assets/css/popup.css'); $document->addScript(JURI::root() . 'components/com_fsf/assets/js/popup.js'); $document->addScript(JURI::root() . 'administrator/components/com_fsf/assets/js/translate.js'); FSF_Helper::IncludeJQuery(true); // Perform the Request task $controller->execute(JRequest::getVar('task')); // Redirect if set by the controller $controller->redirect();
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 testdate($date, $format) { $date = new JDate($date, new DateTimeZone("UTC")); $date->setTimezone(FSF_Helper::getTimezone()); return $date->format($format, true); }
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); }
require_once JPATH_COMPONENT . DS . 'helper' . DS . 'helper.php'; require_once JPATH_COMPONENT . DS . 'helper' . DS . 'settings.php'; // Require specific controller if requested if ($controller = JRequest::getWord('controller')) { $path = JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php'; if (file_exists($path)) { require_once $path; } else { $controller = ''; } } // Create the controller $classname = 'FsfController' . $controller; $controller = new $classname(); $css = JURI::root(true) . "/index.php?option=com_fsf&view=css&layout=default"; $document = JFactory::getDocument(); $document->addStyleSheet($css); FSF_Helper::IncludeJQuery(); // Perform the Request task $task = JRequest::getVar('task'); if ($task == "captcha_image") { ob_clean(); require_once JPATH_SITE . DS . 'components' . DS . 'com_fsf' . DS . 'helper' . DS . 'captcha.php'; $cap = new FSF_Captcha(); $cap->GetImage(); exit; } else { $controller->execute($task); // Redirect if set by the controller $controller->redirect(); }
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; }
$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";
/** * 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; }