Martin CX
10-17-2004, 10:00 PM
This is as much for my own benefit as others. The hack is working fine, but there is a known bug in that the quoting only applies to forum posts and not private messages.
In newreply.php just below the line...
$pagetext = trim(strip_quotes($pagetext));
...insert the following
// HACK BEGIN
function word_wrap ($string)
{
$cols = 80;
$prefix = "?";
$t_lines = split("\n", $string);
$outlines = "";
while(list(, $thisline) = each($t_lines))
{
$thisline = trim($thisline);
if(strlen($thisline) > $cols)
{
$newline = "";
$t_l_lines = split(" ", $thisline);
while(list(, $thisword) = each($t_l_lines))
{
while((strlen($thisword) + strlen($prefix)) > $cols-15)
{
$cur_pos = 0;
$outlines .= $prefix;
for($num=0; $num < $cols-16; $num++)
{
$outlines .= $thisword[$num];
$cur_pos++;
}
$outlines .= "\n";
$thisword = substr($thisword, $cur_pos, (strlen($thisword)-$cur_pos));
}
if((strlen($newline) + strlen($thisword)) > $cols-15)
{
$outlines .= $prefix.$newline."\n";
$newline = $thisword." ";
}
else
{
$newline .= $thisword." ";
}
}
$outlines .= $prefix.$newline."\n";
}
else
{
$outlines .= $prefix.$thisline."\n";
}
}
return $outlines;
}
$pagetext = word_wrap($pagetext);
// HACK ENDScreenshot attached.
Best wishes,
Edit: I forgot. In order to not make it look crazy, you have to leave the "newpost_quote"-template empty except for "$pagetext"
In newreply.php just below the line...
$pagetext = trim(strip_quotes($pagetext));
...insert the following
// HACK BEGIN
function word_wrap ($string)
{
$cols = 80;
$prefix = "?";
$t_lines = split("\n", $string);
$outlines = "";
while(list(, $thisline) = each($t_lines))
{
$thisline = trim($thisline);
if(strlen($thisline) > $cols)
{
$newline = "";
$t_l_lines = split(" ", $thisline);
while(list(, $thisword) = each($t_l_lines))
{
while((strlen($thisword) + strlen($prefix)) > $cols-15)
{
$cur_pos = 0;
$outlines .= $prefix;
for($num=0; $num < $cols-16; $num++)
{
$outlines .= $thisword[$num];
$cur_pos++;
}
$outlines .= "\n";
$thisword = substr($thisword, $cur_pos, (strlen($thisword)-$cur_pos));
}
if((strlen($newline) + strlen($thisword)) > $cols-15)
{
$outlines .= $prefix.$newline."\n";
$newline = $thisword." ";
}
else
{
$newline .= $thisword." ";
}
}
$outlines .= $prefix.$newline."\n";
}
else
{
$outlines .= $prefix.$thisline."\n";
}
}
return $outlines;
}
$pagetext = word_wrap($pagetext);
// HACK ENDScreenshot attached.
Best wishes,
Edit: I forgot. In order to not make it look crazy, you have to leave the "newpost_quote"-template empty except for "$pagetext"