clear_all_cache(); } // Show the cached page $cacheid = md5(serialize($HTTP_POST_VARS).serialize($HTTP_GET_VARS).$FAQ_USER['admin']); if ($t->is_cached('index.ihtml', $cacheid) AND !$FAQ_USER['admin']) { $t->display('index.ihtml', $cacheid); die(); } // Check for most recent if no group_key passed $current_group = array(); if ($FAQ_Show_Recent AND !$group_key) { // FIXME: this sql needs to be changed for different backends due to 'LIMIT' $current_group = $db->getAll("SELECT max(faq_detail.dateentered) as dateorder, faq_key, summary, faq.username FROM faq, faq_detail WHERE ref_faq = faq_key GROUP BY faq_key ORDER BY dateorder DESC LIMIT $FAQ_Show_Recent"); $t->assign('group_name', 'Recent FAQ Questions'); } elseif ($group_key) { // Get current group summaries if specified $current_group = $db->getAll("SELECT faq_key, summary, ref_group, username FROM faq WHERE ref_group = $group_key ORDER BY summary"); $t->assign('group_name', $db->getOne('SELECT description FROM faq_group WHERE group_key = ' . $current_group[0]['ref_group'])); } $t->assign('detail', $current_group); // Get all groups $groups = $db->getAll(" SELECT group_key, description, count(faq_key) as detailcount FROM faq_group, faq WHERE ref_group = group_key GROUP BY group_key ORDER BY description "); $t->assign('groups', $groups); $t->assign('user', $FAQ_USER); $t->display('index.ihtml', $cacheid); ?>