0 ORDER BY topic.sort LIMIT 0,1'), 0)) $default['TOPIC'] = $r[0]; } if (isset($_GET[ARTICLE])) if ($_GET[ARTICLE] != '') if (is_numeric($_GET[ARTICLE])) $default['ARTICLE'] = $_GET[ARTICLE]; if (!isset($default['ARTICLE'])) { if ($r = db_fetch_row(db_query(db_connect(), 'SELECT id from article WHERE topic_id = ' . $default['TOPIC'] . ' ORDER BY sort LIMIT 0,1'), 0)) $default['ARTICLE'] = $r[0]; } // ARTICLE $sql = 'SELECT article.id, article.title, article.content FROM article WHERE article.id = ' . $default['ARTICLE']; fill_template_block($conf['template'], $sql, 'article'); // TOPIC MENU $sql_array[] = 'SELECT topic.id, topic.topic, topic.area_id, IF(topic.id = ' . $default['TOPIC'] . ',"b","a") AS toggle, IF(topic.id = ' . $default['TOPIC'] . ',"a","b") AS nottoggle FROM topic WHERE topic.area_id = ' . $default['AREA'] . ' ORDER BY topic.sort'; $sql_array[] = 'SELECT article.id, article.title FROM article WHERE article.topic_id = {id} ORDER BY article.id ASC'; fill_template_group($conf['template'], $sql_array, 'menu'); } // AREA MENU (remove toggle if searching so area 1 is not hilited, but use area 1 livery $sql = 'SELECT id, area, bgcolor, IF(id = ' . (($_GET[SEARCH] != '') ? 0 : $default['AREA']) . ',"c","a") AS toggle FROM area ORDER BY area.sort ASC'; fill_template_block($conf['template'], $sql, 'area_menu'); $default['BGCOLOR'] = $bgcolor[$default['AREA']]; $default['BGCOLOR2'] = $bgcolor2[$default['AREA']]; $default['QS'] = '?' . AREA . '=' . $default['AREA'] . '&' . TOPIC . '=' . $default['TOPIC'] . '&' . ARTICLE . '=' . $default['ARTICLE']; $conf['template']->assign_vars($default); // FILES (by current article or search) $where = ($_GET[SEARCH] != '') ? 'MATCH(file.title, file.subject, file.description) AGAINST ("' . $_GET[SEARCH] . '")' : 'related.article_id = ' . $default['ARTICLE']; if ($_GET[SEARCH_AREA] != '') $where .= ' AND topic.area_id = ' . $_GET[SEARCH_AREA]; $sql = 'SELECT file.id, RPAD(CONCAT(file.title), 24, " ") AS title FROM file INNER JOIN related ON file.id = related.file_id WHERE ' . $where . ' AND file.media_type = 1 ORDER BY file.title ASC'; fill_template_block($conf['template'], $sql, 'media_menu_1'); $sql = 'SELECT file.id, RPAD(CONCAT(file.title), 24, " ") AS title FROM file INNER JOIN related ON file.id = related.file_id WHERE ' . $where . ' AND file.media_type = 2 ORDER BY file.title ASC'; fill_template_block($conf['template'], $sql, 'media_menu_2'); $sql = 'SELECT file.id, RPAD(CONCAT(file.title), 24, " ") AS title FROM file INNER JOIN related ON file.id = related.file_id WHERE ' . $where . ' AND file.media_type = 3 ORDER BY file.title ASC'; fill_template_block($conf['template'], $sql, 'media_menu_3'); $conf['template']->parse(); ?>