dirname()."/include/cleantags.php";
$start = isset( $_GET['start'] ) ? intval( $_GET['start'] ) : 0;
$columna = array ();
/**
* Suggest searchterms and assign the module_header accordingly
*/
$js = XOOPS_ROOT_PATH. "/modules/" . $xoopsModule->dirname()."/js/prototype.js";
if (lx_getmoduleoption('autocomplete') && is_readable( $js )) {
$xoopsTpl->assign('autocomplete', true);
lx_get_module_header();
$xoopsTpl->assign('xoops_module_header', $lexikon_module_header);
} else {
$xoopsTpl->assign('autocomplete', false);
$xoopsTpl->assign("xoops_module_header", '');
}
// Options
switch ( $op )
{
case "default":
default:
global $xoopsUser, $xoopsConfig, $xoopsDB, $myts, $xoopsModuleConfig, $xoopsModule;
lx_calculateTotals();
$xoopsTpl->assign('multicats', intval($xoopsModuleConfig['multicats']));
// Counts
if ($xoopsModuleConfig['multicats'] == 1)
{
$totalcats = lx_countCats();
$xoopsTpl->assign('totalcats', $totalcats);
}
$publishedwords = lx_countWords();
$xoopsTpl->assign('publishedwords', $publishedwords);
if ($xoopsModuleConfig['multicats'] == 1)
{
$xoopsTpl->assign('multicats', 1);
}
else
{
$xoopsTpl->assign('multicats', 0);
}
// If there's no entries yet in the system...
if ( $publishedwords == 0 )
{
$xoopsTpl -> assign ('empty', '1');
}
// To display the search form
//$searchform = lx_showSearchForm();
//$xoopsTpl->assign('searchform', $searchform);
$xoopsTpl->assign('searchform', lx_showSearchForm());
// To display the linked letter list
$alpha = lx_alphaArray();
$xoopsTpl->assign('alpha', $alpha);
$sql = $xoopsDB -> query ( "SELECT * FROM " . $xoopsDB -> prefix ( "lxentries") . " WHERE init = '#' " );
$howmanyother = $xoopsDB -> getRowsNum( $sql );
$xoopsTpl->assign('totalother', $howmanyother);
// To display the list of categories
if ( $xoopsModuleConfig['multicats'] == 1 )
{
lx_getallcategories();
}
// To display the recent entries block
if ($xoopsModuleConfig["blocksperpage"] > 0 ) //v.1.17
{
$block1 = array();
//$result05 = $xoopsDB -> query( "SELECT entryID, term, datesub FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND submit = '0' AND offline = '0' AND request = '0' ORDER BY datesub DESC", $xoopsModuleConfig['indexperpage'], 0 );
$result05 = $xoopsDB -> query( "SELECT entryID, term, datesub FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND submit = '0' AND offline = '0' AND request = '0' ORDER BY datesub DESC", $xoopsModuleConfig['blocksperpage'], 0 );//v.1.17
if ( $publishedwords > 0 ) // If there are definitions
{
while (list( $entryID, $term, $datesub ) = $xoopsDB->fetchRow($result05))
{
$newentries = array();
$xoopsModule = XoopsModule::getByDirname("lexikon");
$linktext = ucfirst($myts -> makeTboxData4Show( $term ));
$newentries['linktext'] = $linktext;
$newentries['id'] = $entryID;
$newentries['date'] = formatTimestamp( $datesub, "s" );
$block1['newstuff'][] = $newentries;
}
$xoopsTpl -> assign( 'block', $block1);
}
}
// To display the most read entries block
if ($xoopsModuleConfig["blocksperpage"] > 0 ) //v.1.17
{
$block2 = array();
//$result06 = $xoopsDB -> query( "SELECT entryID, term, counter FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND submit = '0' AND offline = '0' AND request = '0' ORDER BY counter DESC", $xoopsModuleConfig['indexperpage'], 0 );
$result06 = $xoopsDB -> query( "SELECT entryID, term, counter FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND submit = '0' AND offline = '0' AND request = '0' ORDER BY counter DESC", $xoopsModuleConfig['blocksperpage'], 0 );
if ( $publishedwords > 0 ) // If there are definitions
{
while (list( $entryID, $term, $counter ) = $xoopsDB->fetchRow($result06))
{
$popentries = array();
$xoopsModule = XoopsModule::getByDirname("lexikon");
$linktext = ucfirst($myts -> makeTboxData4Show($term ));
$popentries['linktext'] = $linktext;
$popentries['id'] = $entryID;
$popentries['counter'] = intval( $counter );
$block2['popstuff'][] = $popentries;
}
$xoopsTpl -> assign( 'block2', $block2);
}
}
// To display the random term block
list($numrows) = $xoopsDB -> fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB -> prefix("lxentries")." WHERE submit = 'O' AND offline = '0'"));
if ( $numrows > 1)
{
$numrows = $numrows-1;
mt_srand((double)microtime()*1000000);
$entrynumber = mt_rand(0, $numrows);
}
else
{
$entrynumber = 0;
}
$resultZ = $xoopsDB -> query ( "SELECT categoryID, entryID, term, definition FROM ".$xoopsDB->prefix("lxentries")." WHERE submit = 'O' AND offline = '0' LIMIT $entrynumber, 1");
$zerotest = $xoopsDB -> getRowsNum( $resultZ );
if ( $zerotest != 0 )
{
while( $myrow = $xoopsDB->fetchArray($resultZ))
{
$random = array();
$random['entryID'] = $myrow['entryID'];
$random['term'] = ucfirst($myrow['term']);
if ( !XOOPS_USE_MULTIBYTES )
{
$deftemp = substr ( $myrow['definition'], 0, ( $xoopsModuleConfig['rndlength'] -1 ));
$deftemp = $myts -> displayTarea ( $deftemp, 1, 1, 1, 1) . "...";
//$deftemp = lx_cleanTags( $deftemp );
$random['definition'] = $deftemp;
}
if ( $xoopsModuleConfig['multicats'] == 1 )
{
$random['categoryID'] = $myrow['categoryID'];
$resultY = $xoopsDB -> query ("SELECT categoryID, name FROM ". $xoopsDB -> prefix ("lxcategories") . " WHERE categoryID = ".$myrow['categoryID']." ");
list ( $categoryID, $name ) = $xoopsDB -> fetchRow ( $resultY );
$random['categoryname'] = $myts -> displayTarea ($name);
}
}
$microlinks = lx_serviceLinks ( $random['entryID'] );//erroneous 10,11,12->1
$xoopsTpl -> assign ( 'random', $random );
}
if ( $xoopsUser && $xoopsUser->isAdmin() )
{
// To display the submitted and requested terms box
$xoopsTpl -> assign ('userisadmin', 1 );
$blockS = array();
$resultS = $xoopsDB -> query( "SELECT entryID, term FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND submit = '1' AND offline = '1' AND request = '0' ORDER BY term" );
$totalSwords = $xoopsDB -> getRowsNum ( $resultS );
if ( $totalSwords > 0 ) // If there are definitions
{
while (list( $entryID, $term ) = $xoopsDB->fetchRow($resultS))
{
$subentries = array();
$xoopsModule = XoopsModule::getByDirname("lexikon");
$linktext = ucfirst($myts -> makeTboxData4Show( $term ));
$subentries['linktext'] = $linktext;
$subentries['id'] = $entryID;
$blockS['substuff'][] = $subentries;
}
$xoopsTpl -> assign( 'blockS', $blockS);
$xoopsTpl -> assign ( 'wehavesubs', 1 );
}
else
{
$xoopsTpl -> assign ( 'wehavesubs', 0 );
}
$blockR = array();
$resultR = $xoopsDB -> query( "SELECT entryID, term FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND request = '1' ORDER BY term" );
$totalRwords = $xoopsDB -> getRowsNum ( $resultR );
if ( $totalRwords > 0 ) // If there are definitions
{
while (list( $entryID, $term ) = $xoopsDB->fetchRow($resultR))
{
$reqentries = array();
$xoopsModule = XoopsModule::getByDirname("lexikon");
$linktext = ucfirst($myts -> makeTboxData4Show( $term ));
$reqentries['linktext'] = $linktext;
$reqentries['id'] = $entryID;
$blockR['reqstuff'][] = $reqentries;
}
$xoopsTpl -> assign( 'blockR', $blockR);
$xoopsTpl -> assign ( 'wehavereqs', 1 );
}
else
{
$xoopsTpl -> assign ( 'wehavereqs', 0 );
}
}
else {
$xoopsTpl -> assign ('userisadmin', 0 );
$blockR = array();
$resultR = $xoopsDB -> query( "SELECT entryID, term FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE datesub < ".time()." AND datesub > 0 AND request = '1' ORDER BY term" );
$totalRwords = $xoopsDB -> getRowsNum ( $resultR );
if ( $totalRwords > 0 ) // If there are definitions
{
while (list( $entryID, $term ) = $xoopsDB->fetchRow($resultR))
{
$reqentries = array();
$xoopsModule = XoopsModule::getByDirname("lexikon");
$linktext = ucfirst($myts -> makeTboxData4Show( $term ));
$reqentries['linktext'] = $linktext;
$reqentries['id'] = $entryID;
$blockR['reqstuff'][] = $reqentries;
}
$xoopsTpl -> assign( 'blockR', $blockR);
$xoopsTpl -> assign ( 'wehavereqs', 1 );
}
else
{
$xoopsTpl -> assign ( 'wehavereqs', 0 );
}
}
// Various strings
$xoopsTpl -> assign ( 'lang_modulename', $xoopsModule->name() );
$xoopsTpl -> assign ( 'lang_moduledirname', $xoopsModule->dirname() );
$xoopsTpl -> assign ( 'microlinks', $microlinks );
$xoopsTpl -> assign ( 'alpha', $alpha );
$xoopsTpl -> assign ( 'blocksperpage', intval($xoopsModuleConfig["blocksperpage"]) ); //v.1.17
// addition 1.0
$xoopsTpl -> assign ( 'showdate', intval($xoopsModuleConfig["showdate"]) );
$xoopsTpl -> assign ( 'showcount', intval($xoopsModuleConfig["showcount"]) );
}
// 1.17
//$xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars($xoopsModule->name()). ' - ' ._MI_LX_MD_DESC);
$xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars($xoopsModule->name()));
/**
* Meta start
*/
$metadef = substr( lx_html2text($random['definition']),0,15 ). " ..."; // lenght of definition to show
if ($xoopsModuleConfig['multicats'] == 0 )
{
lx_extract_keywords($xoopsModule->name().', '.$random['term'].', '.$metadef.','.$popentries['linktext'].','.$newentries['linktext']);
lx_get_metadescription($random['term'].' '.$metadef.' '.$popentries['linktext'].' '.$newentries['linktext']);
} else {
lx_extract_keywords($xoopsModule->name().', '.$random['term'].', '.$random['categoryname'].', '. $metadef .', '.$popentries['linktext'].', '.$newentries['linktext']);
lx_get_metadescription($random['term'].' '.$random['categoryname'].' '.$popentries['linktext'].' '.$newentries['linktext'].' '.$metadef);
}
/* Metas End */
//$xoopsTpl->assign("xoops_module_header", '');
include( XOOPS_ROOT_PATH . "/footer.php" );
?>