<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

function smarty_block_libtext($params, $content, &$smarty)
{
    global $MySQL;

    if (is_null($content)) {
        return;
    }

    $output = $content;

    $entries = $MySQL->query( "SELECT entryID, title, keywords FROM library" );
    while( $row = $MySQL->fetch_array( $entries ) )
    {
        $output = str_replace( ' '.$row['title'].' ', ' <a href="library.php?entryID='.$row['entryID'].'&amp;'.SID.'" title="Bibliotheks-Eintrag ansehen">'.$row['title'].'</a> ', $output );
    }

    return $output;
}

/* vim: set expandtab: */

?>