<?php
/**
 * $Source: /home/cvs/nukescripts/modules/Encyclopedia/includes/terms.php,v $
 * $Revision: 1.0.0-1 $
 * $Author: cyril $
 * $Date: 2007/01/08 11:42:25 $
 * Fix Bug 191 ( Darthois )
 */
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
defined('MAXIMUS') or Header("Location: index.php");

	$eid = $GLOBALS['db']->XMFnum($eid);
    $ltr = substr($ltr,0,1);
    if (ereg("[^a-zA-Z0-9]",$ltr))
    {
       die('Invalid letter/digit specified!');
    }
	$sql = "SELECT `title`, `active` FROM `".TABLE_ENCYCLOPEDIA."` WHERE `eid`='$eid'";
	if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(CORE_ERROR, 'Could not obtain _encyclopedia', '', __LINE__, __FILE__, $sql);}
	$row = $GLOBALS['db']->sql_fetchrow($result);
	$active = $GLOBALS['db']->XMFnum($row['active']);
	$title  = stripslashes(check_html($row['title'], "nohtml"));
	incoh();
	title("$title");
	Max_OpenTable();
	if (($active == 1) OR (defined('ADMIN_ALLOW'))) {
		if (($active != 1) AND (defined('ADMIN_ALLOW'))) {
			echo "<center>"._YOURADMINENCY."</center><br /><br />";
		}
		echo "<center>"._SELECTTERM."</center><br /><br />"
		."<table border=\"0\" align=\"center\">";
		$sql3 = "SELECT `tid`, `title` FROM `".TABLE_ENCYCLOPEDIA_TEXT."` WHERE UPPER(title) LIKE '$ltr%' AND `eid`='$eid' ORDER BY `title`";
		if ( !($result3 = $GLOBALS['db']->sql_query($sql3)) )
{ query_die(CORE_ERROR, 'Could not obtain _encyclopedia_text', '', __LINE__, __FILE__, $sql3);}
		$numrows = $GLOBALS['db']->sql_numrows($result3);
		if ($numrows == 0) {
			echo "<center><i>"._NOCONTENTFORLETTER." ".htmlentities($ltr).".</i></center>";
		}
		while ($row3 = $GLOBALS['db']->sql_fetchrow($result3)) {
			$tid = $GLOBALS['db']->XMFnum($row3['tid']);
			$title = stripslashes(check_html($row3['title'], "nohtml"));
			echo "<tr><td><a href=\"modules.php?name=$module_name&amp;op=content&amp;tid=$tid\">$title</a></td></tr>";
		}
		echo "</table>";
		br('2');
		alpha($eid);
	} else {
		echo "<center>"._ENCYNOTACTIVE."<br /><br />"
		.""._GOBACK."</center>";
	}
	Max_CloseTable();
	incof();