<?

function dispNews(){
  $str = '<div id="all_side">';
  $str .= '<div id="newsbox">';
  $str .= '<ul>' . dispNewsRows() . '</ul>';
  $str .= '</div></div>';
  echo $str;
}

function dispNewsRows($max_news = PHP_INT_MAX) {

  $str = '';

  if ($_SESSION["user_right"] >= $GLOBALS["PRIV_GUEST"] )
    $result = getLastNews(2);
  else if ($_SESSION["user_right"] >= $GLOBALS["GUEST"] )
    $result = getLastNews(1);
  else
    $result = getLastNews(0);

  if (mysql_num_rows($result)) {
    for ($cpt = 0; $cpt < $max_news && ($news = mysql_fetch_array($result)); $cpt++) {
      $str .= dispWhenTendu($news["news_tendu"]);
      $str .= '<li><h2><strong><a name="'.$news["news_id"].'">'.$news["news_title"].'</a></strong>';
      $str .= dispWhenTendu($news["news_tendu"]);
      $str .= '<span class="news_date"> - le '.date("d/m/Y", strtotime($news["news_date"])).'</span><span class="news_by"> par '.$news["user_pseudo"].'</span></h2>
                <p class="news_text">'.$news["news_comment"].'</p>
                <p class="news_separator"><br /><img alt="" src="images/corner_20.png" /><br /></p>
                </li>';
    }
  }
  return $str;
}

?>
