TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: Benny Pedersen
from: andrew clarke
date: 2004-05-29 10:15:30
subject: husky & fidosql

Fri 2004-05-28 04:42, Benny Pedersen (2:237/53) wrote to Bo Simonsen:

 BP> can i safely convert from ftn (control m chars) to html as  ?

Yes, unless you're using  (see below).

 BP> will one explain it so i can create the php function or give me
 BP> pointers ?

For http://fidonet.sensationcontent.com/ I use  tags, and this:

function wraptext($str)
{
    $retstr = "";

    $lines = explode("\r", $str);
    $cnt = count($lines);

    for ($i = 0; $i < $cnt; $i++)
    {
        if (strlen($lines[$i]) > 85)
        {
            $retstr = $retstr . wordwrap($lines[$i]) . "\r";
        }
        else
        {
            $retstr = $retstr . $lines[$i] . "\r";
        }
     }

     return $retstr;
}


    /* main function */

    /* ... */

    $msg_text = htmlspecialchars($msg_text);
    $msg_text = wraptext($msg_text);

    /* read $tpl_text from a template file, then: */

    $tpl_text = str_replace("[text]", $msg_text, $tpl_text);

    /* ... */

    /* replace 0x01 in kludge lines with {at} */

    $tpl_text = str_replace("\01", "{at}", $tpl_text);

    /* be consistent about outputting newlines */

    $tpl_text = str_replace("\r", "\n", $tpl_text);

    /* convert URLs in the text to hypertext links */

    $tpl_text =
      
ereg_replace("[[:alpha:]]+://[^[:space:]]+[[:alnum:]/]","\\0",
         $tpl_text);

    print $tpl_text;

-- mail{at}ozzmosis.com

--- timEd/FreeBSD 1.11.b1
* Origin: Blizzard of Ozz, Melbourne, Victoria, Australia (3:633/267)
SEEN-BY: 633/267 270
@PATH: 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.