Current Path : /var/www/html/clients/kampol.e-nk.ru/OLD/components/com_xfaq/ |
Current File : /var/www/html/clients/kampol.e-nk.ru/OLD/components/com_xfaq/xfaq.php |
<?php /** * @version $Id: xfaq.php,v 1.0 2005/10/02 13:15:15 mic Exp $ * @package XfaQ - a frequently asked question component for Joomla! & Mambo CMS * @copyright (C) 2005 mgfi.info * @info info@mgfi.info http://www.mgfi.info * @license GNU/GPL * based in simplefaq 2.0.1 & glossary 1.4 */ # Don't allow direct linking defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); require( $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_xfaq/config.xfaq.php' ); $xfaqversion = 'v.1.1_mgfi'; $catid=mosGetParam( $_REQUEST, 'catid','' ); $task=mosGetParam( $_REQUEST, 'task','' ); $answerid=mosGetParam( $_REQUEST, 'aid', '0' ); $page=mosGetParam( $_REQUEST, 'page', '-1' ); if ($page==-1) unset($page); // cache activation $cache =& mosCache::getCache( 'com_xfaq' ); // Dynamic Page Title $mainframe->SetPageTitle( 'FAQs' ); # Functions of xFAQ function xFAQHeader( $catid=0 ) { global $Itemid, $database, $task, $xfaq, $search; $database->setQuery( 'SELECT name FROM #__menu WHERE id=\'' . $Itemid . '\'' ); $menuname = $database->loadResult(); ?> <script type="text/javascript"> <!-- function validate(){ if (document.sfForm.search.value == '<?php echo _XFAQ_KEYWORD; ?>') document.sfForm.search.value = '' } //--> </script> <a name="faq_top"></a> <table width="100%" class="contentpaneopen"> <tr> <?php if( $xfaq['showsearch'] ) { ?> <td> <form action="index.php" method="post" name="sfForm" id="sfForm"> <input type="hidden" name="option" value="com_xfaq" /> <input type="hidden" name="catid" value="<?php echo $catid; ?>" /> <input type="hidden" name="task" value="display" /> <?php echo _XFAQ_SEARCH_INTRO; ?> <br /> <input type="text" name="search" class="inputbox" size="60" style="width: 200px;" value="<?php echo _XFAQ_KEYWORD; ?>" onblur="if(this.value=='') this.value='<?php echo _XFAQ_KEYWORD; ?>';" onfocus="if(this.value=='<?php echo _XFAQ_KEYWORD; ?>') this.value='';" /> <button type="submit" class="button" onClick="validate()"><?php echo _XFAQ_SEARCH; ?></button> </form> </td> <?php } ?> <td align="left" style="padding-left:15px"> <?php if( $xfaq['showcategories'] ){ $link = sefRelToAbs( 'index.php?option=com_xfaq&Itemid=' . $Itemid ); ?> <li><a href="<?php echo $link; ?>"><?php echo _XFAQ_VIEW; ?></a></li> <?php } if( $xfaq['allowentry'] ){ $link = sefRelToAbs( 'index.php?option=com_xfaq&catid=' . $catid . '&Itemid=' . $Itemid . '&task=submit' ); ?> <li><a href="<?php echo $link; ?>"><?php echo _XFAQ_SUBMIT; ?></a></li> <?php } ?> </td> </tr> <?php if ($catid != 0) { // Choosen a specific category, let's retrieve the details' $database->setQuery( "SELECT title, description FROM #__categories WHERE id = '" . $catid . "'" ); $rows = $database->loadObjectList(); //$row = $rows[0]; ?> <tr> <td colspan="2"> <b>Êàòåãîðèÿ: <?php echo $rows[0]->title; ?> <?php echo $rows[0]->description; ?> </td> </tr> <?php } else { // No specific category chosen if( $xfaq['introtext'] != '' ){ ?> <tr><td><?php echo $xfaq['introtext']; ?></td></tr> <?php } if( $task <> 'submit' ) { ?> <tr><td class="category"><?php echo _XFAQ_CAT_LIST; ?></td></tr> <?php } } ?> </table> <?php // if search is running if( isset( $search )){ $search = trim( $search ); $search = str_replace( '<?php', '', $search ); $search = str_replace( '<?', '', $search ); $search = str_replace( '?>', '', $search ); $search = str_replace( '"', '', $search ); $search = str_replace( '§', '', $search ); $search = str_replace( '$', '', $search ); $search = str_replace( '%', '', $search ); $search = str_replace( '&', '', $search ); $search = str_replace( '/', '', $search ); $search = str_replace( '(', '', $search ); $search = str_replace( ')', '', $search ); $search = str_replace( '=', '', $search ); $search = str_replace( '?', '', $search ); $search = str_replace( '*', '', $search ); $search = str_replace( '#', '', $search ); // filter search value $inpfilter = $GLOBALS['mosConfig_absolute_path'] . '/includes/phpInputFilter/class.inputfilter.php'; if( file_exists( $inpfilter )) { require_once( $inpfilter ); $iFilter = new InputFilter(); $search = trim( $iFilter->process( $search )); } } return; } // end function xFAQHeader function xFAQFooter() { global $xfaqversion, $task; ?> <a href="http://www.mgfi.info" target="_blank" style="font-size:8px;float:right;font-family:verdana;font-weight:normal" class=pathway> XfaQ <?php echo $xfaqversion; ?> by MGFi</a> <?php return; } function is_email( $email ){ $rBool = false; if( preg_match( "/[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}/", $email )) { $rBool = true; } return $rBool; } function textwrap( $text, $width = 75 ){ if( $text ) return preg_replace( "/([^\n\r ?&\.\/<>\"\\-]{" . $width . "})/i", " \\1\n", $text ); } function showAnswers( $catid, $answerid = 0 ){ global $Itemid, $database, $page, $search, $is_editor, $mainframe, $xfaq; if( isset( $search) && ( !$search || strlen( $search ) < '3' )) return; # Limit using global $page - will have been set in showQuestions $start = ( $page - 1 ) * $xfaq['perpage']; // Build Database Query $where = array(); $where[] = 'published = \'1\' '; $where[] = 'catid = \'' . $catid . '\' '; if( $search ){ $where[] = '(answer LIKE \'%' . $search . '%\' OR question LIKE \'%' . $search . '%\' OR comment LIKE \'%' . $search . '%\')'; } $tableheader = _XFAQ_QANDAS ; if( $answerid ){ $where[] = ' id=' . $answerid; $tableheader = _XFAQ_ANSWER ; } $dbwhere = ( count( $where ) ? ' WHERE '.implode( ' AND ', $where ) : '' ); // get the total number of records $query1 = 'SELECT * FROM #__xfaq ' . $dbwhere . ' ORDER BY ordering'; if( !$xfaq['indexmode'] ){ $query1 .= ' LIMIT ' . $start . ',' . $xfaq['perpage']; } $database->setquery( $query1 ); $result1 = $database->query(); // ok - we have the results. Now output the table of results if( (isset( $xfaq['count'] ) && $xfaq['count'] ) || $answerid ){ ?> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <?php $line=1; while( $row1 = mysql_fetch_object( $result1 )) { if( $row1->catid == $xfaq['exclcat'] ){ continue; } $linecolor = ($line % 2) + 1; $sfkeyword1 = $row1->question; $sfkeyword2 = $row1->answer; ?> <tr class="sectiontableentry<?php echo $linecolor; ?>"> <td colspan="2" valign="top"> <a name="FAQ<?php echo $row1->id; ?>"></a> <strong><?php echo $row1->question; ?></strong> <?php if( $xfaq['hideauthor'] ) { $row1->name = textwrap( $row1->name, 20 ); if( $row1->name <> '' ){ if( $row1->homepage <> '' ) { # Check if URL is in right format if( substr( $row1->homepage, 0, 7 ) != 'http://' ){ $row1->homepage = 'http://' . $row1->homepage; }elseif( strlen( $row1->homepage > 11 ) && substr( $row1->homepage, 0, 7 ) != 'http://' ){ $row1->homepage = 'http://' . $row1->homepage; } echo '<br /><a href="' . $row1->homepage . '" target="_blank" title="' . $row1->homepage . '"><span class="small">' . _XFAQ_AUTHOR . ': ' . $row1->name . '</span></a>'; } else { echo '<br /><span class="small">' . _XFAQ_AUTHOR . '": ' . $row1->name . '</span>'; } } } ?> </td> </tr> <tr class="sectiontableentry<?php echo $linecolor; ?>"> <td width="10%" align="center"> <a href="<?php echo sefRelToAbs( 'index.php?option=com_xfaq&task=display&Itemid=' . $Itemid . '&catid=' . $catid . '&page=' . $page ); ?>#faq_top"> <img src="components/com_xfaq/images/up.png" border="0" alt="" /> </a> </td> <td width="90%" valign="top" style="text-align:justify"><b><u>Îòâåò:</u></b><br> <?php $answer = ( $row1->answer <> '') ? $row1->answer : "Îòâåòà ïîêà íåò" ; $answer = textwrap($answer,80); echo $answer; // êîììåíòàðèè ñêðûâàåì /* if ( $row1->comment <> '') { $origcomment = $row1->comment; ?> <hr /> <span class="small"><strong><?php echo _XFAQ_ACOMMENTS; ?>:</strong><?php echo $origcomment; ?></span> <?php } */ ?> </td> </tr> <?php if( $is_editor ) { ?> <tr class="sectiontableentry<?php echo $linecolor; ?>"><td width="10%" valign="top"> </td> <td width="90%" valign="top"> <strong><?php echo _XFAQ_ADMIN; ?>:</strong> <a href="<?php echo sefRelToAbs( 'index.php?option=com_xfaq&Itemid=' . $Itemid . '&task=comment&id=' . $row1->id . '&page=' . $page . '&catid=' . $row1->catid ); ?>"><?php echo _XFAQ_ACOMMENT; ?></a> - <?php if( $row1->comment ) { ?> <a href="<?php echo sefRelToAbs( 'index.php?option=com_xfaq&page=' . $page . '&Itemid=' . $Itemid . '&task=comment&opt=del&id=' . $row1->id . '&catid=' . $row1->catid ); ?>"><?php echo _XFAQ_ACOMMENTDEL; ?></a> - <?php } ?> <a href="<?php echo sefRelToAbs( 'index.php?option=com_xfaq&Itemid=' . $Itemid . '&task=submit&id=' . $row1->id , '&page=' . $page . '&catid=' . $row1->catid ); ?>"><?php echo _XFAQ_AEDIT; ?></a> - <a href="<?php echo sefRelToAbs( 'index.php?option=com_xfaq&Itemid=' . $Itemid . '&task=delete&id=' . $row1->id . '&page=' . $page . '&catid=' . $row1->catid ); ?>"><?php echo _xFAQ_ADELETE; ?></a> </td> </tr> <?php } $line++; } ?> </table> <?php // $mainframe->appendPathWay( _XFAQ_VIEW ); ñêðûâàåì åùå îäíó öåïü íàâèãàöèè if( isset( $sfkeyword1 )){ if( !$sfkeyword1 ) $sfkeyword1 = ''; // $mainframe->SetPageTitle( _XFAQ_TIT_ANSWER . ' | ' . $sfkeyword1 ); óáèðàåì title ñ íàçâàíèåì âîïðîñà $mainframe->prependMetaTag( 'keywords', $sfkeyword1 ); // sfkeyword2 can be added here } } // end if count } // ShowAnswers() function showQuestions( $catid ){ global $Itemid, $database, $page, $search, $is_editor, $xfaq; if( isset( $search) && ( !$search || strlen( $search ) < '3' )){ // if no searchitem leave this and go back echo _XFAQ_ERR_NO_SEARCH_STRING; return; } if( !$xfaq['indexmode'] ) { // // Handle multiple pages - Not aplicable in Index Mode // // Build Database Query (new by mic) $where = array(); $where[] = 'published=\'1\' '; if( $catid) $where[] = 'catid=\'' . $catid . '\' '; if( $search ){ $where[] = 'answer LIKE \'%' . $search . '%\' OR question LIKE \'%' . $search . '%\' OR comment LIKE \'%' . $search . '%\''; } $dbwhere = ( count( $where ) ? ' WHERE '.implode( ' AND ', $where ) : '' ); // get the total number of records $count_query = 'SELECT id FROM #__xfaq ' . $dbwhere; # Determine the number of records $count_result = $database->setquery( $count_query ); $count_result = $database->query(); $count = mysql_num_rows( $count_result ); // new by mic $xfaq['count'] = $count; // needed to speed up and is asked for in function showAnwsers # Calculate the page count if( !$xfaq['perpage'] ) $xfaq['perpage'] = 25; // Catch div by zero $pagecount = floor( $count / $xfaq['perpage'] ); $overflow = $count % $xfaq['perpage']; if ($overflow>0) { $pagecount++; } # Determine the current page if (isset($page)) { if ($page>$pagecount) { $page = $pagecount; } else if ($page<1) { $page = 1; } } else { $page = 1; } echo '<p>'; // no results, saving time and leave if( $count == '0' && $search ) { echo sprintf( _XFAQ_NO_ENTRIES, $search ); ?> <br /> <a href="javascript:history.go(-1);" title="<?php echo _XFAQ_BACK; ?>"> <button type="submit" class="button"><?php echo _XFAQ_BACK; ?></button></a> </p> <?php return; } if( isset( $search ) && !$search ) echo _XFAQ_SEARCH_ENTRY . ' [ <i>' . $search . '</i> ] - '; // if( $count == '1' ) echo _XFAQ_ONE_ENTRY; // if( $count > '1' ) echo sprintf( _XFAQ_ENTRIES, $count ); if( $count >= '1' && $pagecount > '1' ) { echo '<span style="float:right;font-weight:normal" class="pathway">'; # Show the Page - Back marker $pageback = $page - 1; if( $pageback > 0 ) { echo '<a class="pathway" href="' . sefRelToAbs( 'index.php?option=com_xfaq&task=display&page=' . $pageback . '&catid=' . $catid . '&Itemid=' . $Itemid ) . '"><strong> « </strong></a> '; } # Show the individual page numbers for( $i = 1; $i <= $pagecount; $i++ ) { if( $i == $page ) { echo ' - ' . $i. ' - '; } else { echo '<a class="pathway" href="' . sefRelToAbs( 'index.php?option=com_xfaq&task=display&page=' . $i . '&catid=' . $catid . '&Itemid=' . $Itemid ) . '">' . $i . '</a> '; } } # Show the Page - Forward marker $pagenext = $page + 1; if( $pagenext <= $pagecount ) { echo ' <a class="pathway" href="' . sefRelToAbs( 'index.php?option=com_xfaq&task=display&Itemid=' . $Itemid . '&catid=' . $catid . '&page=' . $pagenext ) . '"><strong> » </strong></a> '; } print "</span>"; } // end if pagecount > 1 # Calculate Limit and Start Page $start = ( $page - 1 ) * $xfaq['perpage']; echo '</p>'; } // end if no xfaq['indexmode'] // Build Database Query $where = array(); $where[] = 'published=\'1\' '; if( $catid) $where[] = 'catid=\'' . $catid . '\' '; if( $search ) { $where[] = 'answer LIKE \'%' . $search . '%\' OR question LIKE \'%' . $search . '%\' OR comment LIKE \'%' . $search . '%\''; } $dbwhere = ( count( $where ) ? ' WHERE '.implode( ' AND ', $where ) : '' ); // get the total number of records $query1 = 'SELECT * FROM #__xfaq ' . $dbwhere . ' ORDER BY catid, question ASC'; if( !$xfaq['indexmode'] ) $query1 .= ' LIMIT ' . $start . ', ' . $xfaq['perpage']; $result1 = $database->setquery($query1); $result1 = $database->query(); $count = mysql_num_rows($result1); if( $xfaq['indexmode'] ){ if( $count == '0' ){ ?> <p> <?php echo _XFAQ_NO_ENTRIES1; ?> <br /> <a href="javascript:history.go(-1);" title="<?php echo _XFAQ_BACK; ?>"><button type="submit" class="button"><?php echo _XFAQ_BACK; ?></button></a> </p> <?php } if( isset( $search ) && !$search ) echo _XFAQ_SEARCH_ENTRY . ' [ <i>' . $search . '</i> ] - '; if( $count == '1' ) echo _XFAQ_ONE_ENTRY; if( $count > '1' ) echo sprintf( _XFAQ_ENTRIES, $count ); } // ok - we have the results. Now output the list of questions if( $count >= 1 ){ while( $row1 = mysql_fetch_object( $result1 )) { if( $row1->catid == $xfaq['exclcat'] ){ continue; } // retrieve the categorie $database->setQuery( 'SELECT name FROM #__categories WHERE id=' . $row1->catid ); $sfCat = $database->loadResult(); ?> <img src="<?php echo $GLOBALS['mosConfig_live_site']; ?>/templates/<?php echo $GLOBALS['cur_template']; ?>/images/arrow.png" alt="" /> <?php echo '[ '. $sfCat . ' ] <a href="'; if( $xfaq['indexmode'] ){ echo sefRelToAbs( 'index.php?option=com_xfaq&task=answer&Itemid=' . $Itemid . '&catid=' . $row1->catid . '&aid=' . $row1->id ); } else { echo sefRelToAbs( 'index.php?option=com_xfaq&task=display&Itemid=' . $Itemid . '&catid=' . $row1->catid . '&page=' . $page ); echo '#FAQ' . $row1->id; } echo '"><strong>' . $row1->question . '</strong></a><br />' . "\n"; } echo '<br />'; if( $xfaq['indexmode'] ) echo _XFAQ_INDEXHELP ; } // end if count } // ShowQuestions() // // Main Body // # Get the right language if it exists if( file_exists( $GLOBALS['mosConfig_absolute_path'] . '/components/com_xfaq/languages/' . $GLOBALS['mosConfig_lang'] . '.php' )) { include( $GLOBALS['mosConfig_absolute_path'] . '/components/com_xfaq/languages/' . $GLOBALS['mosConfig_lang'] . '.php'); } else { include( $GLOBALS['mosConfig_absolute_path'] . '/components/com_xfaq/languages/english.php' ); } # Check for Editor rights $is_editor = (strtolower($my->usertype) == 'editor' || strtolower($my->usertype) == 'publisher' || strtolower($my->usertype) == 'manager' || strtolower($my->usertype) == 'administrator' || strtolower($my->usertype) == 'super administrator' ); $is_user = (strtolower($my->usertype) <> ''); switch ($task) { case 'popup': // get the record xFAQHeader(); $template = $mainframe->getTemplate(); $database->setQuery( 'SELECT question, answer FROM #__xfaq WHERE id=\'' . $answerid . '\' AND published=\'1\'' ); $rows = $database->loadObjectList(); $row = $rows[0]; ?> <h1 class="contentHeading"><?php echo $row->question; ?></h1> <p><?php echo $row->answer; ?></p> <p><a href="javascript:history.go(-1);"><span class="small"><?php echo _XFAQ_BACK; ?></span></a></p> <?php break; // not activ case 'search': xFAQHeader($catid); include( $GLOBALS['mosConfig_absolute_path'] . '/components/com_xfaq/search.php' ); break; case 'delete': xFAQHeader($catid); include( $GLOBALS['mosConfig_absolute_path'] . '/components/com_xfaq/delete.php' ); break; case 'comment': xFAQHeader($catid); include( $GLOBALS['mosConfig_absolute_path'] . '/components/com_xfaq/comment.php' ); break; case 'entry': case 'save': global $ttext, $id; // Clear any HTML & PHP code snips $ttext = strip_tags($ttext); // check entries with inputfilter // filter input before insert $inpfilter = $GLOBALS['mosConfig_absolute_path'] . '/includes/phpInputFilter/class.inputfilter.php'; if( file_exists( $inpfilter )) { require_once( $inpfilter ); $iFilter = new InputFilter(); $name = trim( $iFilter->process( $name )); $email = trim( $iFilter->process( $email )); $location = trim( $iFilter->process( $location )); $homepage = trim( $iFilter->process( $homepage )); $question = trim( $iFilter->process( $question )); $answer = trim( $iFilter->process( $answer )); } // end input filter // Check if entry was edited by editor if( $is_editor && $id ) { $query1 = 'UPDATE #__xfaq SET catid=\'' . $catid . '\', name=\'' . $name . '\', email=\'' . $email . '\', location=\'' . $location . '\', homepage=\'' . $homepage . '\', question=\'' . $question . '\', answer=\'' . $answer . '\' WHERE id=\'' . $id . '\''; $database->setQuery( $query1 ); $database->query(); } else { $tip = $_SERVER['REMOTE_ADDR']; $date_created = date( 'y/m/d g:i:s' ); $query2 = 'INSERT INTO #__xfaq SET catid=\'' . $catid . '\', name=\'' . $name . '\', date_created=\'' . $date_created . '\', email=\'' . $email . '\', location=\''. $location . '\', homepage=\'' . $homepage . '\', question=\'' . $question . '\', answer=\'' . $answer . '\''; if( $xfaq['autopublish'] ) { $query2 .= ', published=\'1\''; } $database->setQuery( $query2 ); $database->query(); if( $xfaq['notify'] && is_email( $xfaq['notify_email'] ) ) { $mailtext = _XFAQ_ADMINMAIL1 . "\r\n\r\n"; $mailtext .= sprintf( _XFAQ_ADMINMAIL2, $GLOBALS['mosConfig_live_site'] ) . "\r\n\r\n"; $mailtext .= _XFAQ_ENTERNAME .': ' . $name . "\r\n"; $mailtext .= _XFAQ_ENTERQUESTION . ': ' . $question . "\r\n\r\n"; if( $answer ){ $mailtext .= _XFAQ_ENTERANSWER . ': ' . $answer . "\r\n\r\n"; } $mailtext .= _XFAQ_MAILFOOTER; $adminMailHeader = sprintf( _XFAQ_ADMINMAILHEADER, $GLOBALS['mosConfig_sitename'] ); // mail( $xfaq['notify_email'], _XFAQ_ADMINMAILHEADER, $mailtext, "From: " . $xfaq['notify_email'] ); // orig mosMail( $xfaq['notify_email'], $GLOBALS['mosConfig_fromname'], $xfaq['notify_email'], $adminMailHeader, $mailtext ); } if( $xfaq['thankuser'] && is_email( $email ) ) { $mailtext = _XFAQ_USERMAIL1 . "\r\n\r\n"; $mailtext .= sprintf( _FAQ_USERMAIL2, $GLOBALS['mosConfig_live_site'] ) . "\r\n\r\n"; $mailtext .= _XFAQ_ENTERNAME . ': ' . $name . "\r\n"; $mailtext .= _XFAQ_ENTERQUESTION . ': ' . $question . "\r\n\r\n"; if( $answer ){ $mailtext .= _XFAQ_ENTERANSWER . ': ' . $answer . "\r\n\r\n"; } $mailtext .= _XFAQ_MAILFOOTER; // mail( $email, _XFAQ_USERMAILHEADER, $mailtext, "From: " . $xfaq['notify_email'] ); mosMail( $xfaq['notify_email'], $GLOBALS['mosConfig_fromname'], $xfaq['notify_email'], _XFAQ_USERMAILHEADER, $mailtext ); } } $link = sefRelToAbs( 'index.php?option=com_xfaq&task=display&Itemid=' . $Itemid . '&page=' . $page . '&catid=' . $catid ); echo "<script> alert('Ñïàñèáî! Âàø âîïðîñ îòïðàâëåí.'); document.location.href='" . $link . "';</script>"; break; case 'submit': xFAQHeader(); if( $xfaq['allowentry'] ) { include( $GLOBALS['mosConfig_absolute_path'] . '/components/com_xfaq/submit.php' ); break; } case 'cancel': $link = sefRelToAbs( 'index.php?option=com_xfaq&task=display&page=' . $page . '&Itemid=' . $Itemid . '&catid=' . $catid ); echo "<script> document.location.href='" . $link . "';</script>"; case 'display': xFAQHeader( $catid ); showQuestions( $catid ); if( !$xfaq['indexmode'] ){ showAnswers( $catid ); } break; case 'answer': $mainframe->appendPathWay( _XFAQ_TIT_ANSWER ); $mainframe->SetPageTitle( _XFAQ_TIT_ANSWER ); xFAQHeader( $catid ); showAnswers( $catid, $answerid ); break; default: $mainframe->appendPathWay( _XFAQ_VIEW ); $mainframe->SetPageTitle( _XFAQ_VIEW ); if( $xfaq['showcategories'] ) { xFAQHeader(); $database->setQuery( 'SELECT * FROM #__categories WHERE section=\'com_xfaq\' AND published=\'1\' ORDER BY ordering' ); $categories = $database->loadObjectList(); if(count( $categories ) > 1 || (count( $categories ) < 2 )) { echo '<ul>'; foreach( $categories as $row2 ) { // exclude cats from showing if defined if( $row2->id == $xfaq['exclcat'] ){ continue; } if( $row2->access <= $gid ) { $sfLink = sefRelToAbs( 'index.php?option=com_xfaq&task=display&Itemid=' . $Itemid . '&catid=' . $row2->id ); // get items per catagory $database->setQuery( 'SELECT count(*) FROM #__xfaq WHERE catid=\'' . $row2->id . '\' AND published=\'1\'' ); $total = $database->loadResult(); // end items ?> <li> <a href="<?php echo $sfLink; ?>" title="<?php echo $row2->name; ?>"><?php echo $row2->name; ?></a> <?php echo ' <i>( ' . $total . ' ' . ( $total = 1 ? _XFAQ_ONE_CONTRIB : _XFAQ_CONTRIBS ) . ' )</i>'; } else { echo $row2->name; $sfLink = sefRelToAbs( 'index.php?option=com_registration&task=register' ); ?> <li> <a href="<?php echo $sfLink; ?>" title="<?php echo _E_REGISTERED; ?>">( <?php echo _E_REGISTERED; ?> )</a> <?php } ?> </li> <?php } ?> </ul> <?php } } else { $database->setQuery( 'SELECT id FROM #__categories WHERE section=\'com_xfaq\' AND published=\'1\' ORDER BY title, name ASC' ); $catid = $database->loadResult(); xFAQHeader( $catid ); showQuestions( $catid ); if( !$xfaq['indexmode'] ) showAnswers( $catid ); } break; } // end switch xFAQFooter(); ?>