View file script/commentflash.php

File size: 1.89Kb
<?php
///////////////////////////////////////////////////////////////////////
// mcGalleryPRO                                                      //
// All code is © 2002-2003 Marc Cagninacci.                          //
// No files may be redistributed in whole or significant part.       //
// -------------- mcgalleryPRO IS NOT FREE SOFTWARE ---------------- //
// You should have receive a file called license.txt in this package //
///////////////////////////////////////////////////////////////////////

// Last modified 2003-02-04

function courte($text)
{ 
  $text = trim($text); 
  $tab_w = explode(" ", $text);  
  $nb_w = count($tab_w);  
  $nb_i = 0; 
  $string = ""; 
  for ($i = 0; $i < $nb_w; $i++)
  { 
   $tmp_w = strip_tags($tab_w[$i]); 
   $nb_i+= strlen($tmp_w); 
   if ($nb_i < 80)
   { 
    $nb_i+= 1; 
    $string.= $tab_w[$i]." "; //
   } 
   else 
   { 
    $string.= "<br>".$tab_w[$i]." "; //
    $nb_i = strlen($tmp_w);
   } 
  }
return $string; 
}

$id = $row['id'];
$query = "SELECT * FROM mcgallery_comment WHERE id_photo=$id AND valid='Y' AND type='F' ORDER BY date DESC, id DESC";
$result = mysql_query($query);

while ($comm=mysql_fetch_array($result))
{
echo '<tr><td class="td2" colspan="2">';
echo '<font face="'.$rowd['fontface'].'" color="'.$rowd['fontcolor2'].'" size="1">&nbsp;'.$comm['date'].'&nbsp;<b>'.stripslashes($comm['author']).'</b>';
echo '<a href="mailto:'.$comm['email'].'"><img src="images/ecrire.gif" border="0" alt=""></a>';
echo '</font></td></tr>';
echo '<tr><td class="td2" colspan="2" width="'.($taille[0]*1.1).'">';
echo '<font face="'.$rowd['fontface'].'" color="'.$rowd['fontcolor2'].'" size="1">';
$comm['text'] = preg_replace('/([^ ]{50})/si','\\1 ',$comm['text']);
echo nl2br(courte(htmlspecialchars(stripslashes($comm['text']))));
echo '</font></td></tr>';
echo '<tr><td class="td1" colspan="2" height="2">';
}
?>