Commit 3fcb4429 authored by Seblu's avatar Seblu

adding who post the news

formating date as french one
merging news showing code between news.php and home.php
parent 4d66b5fb
......@@ -270,6 +270,11 @@ div.rightbox h1 {
padding: 0px 0px 0px 5px;
}
.news_by {
color: #6D6C6C;
font-style: italic;
}
.news_separator {
margin: 0px 0px 0px -15px;
padding:0;
......
......@@ -12,7 +12,7 @@ function getOneNews($news_id) {
function getLastNews($tendu) {
$tendu = mysql_real_escape_string($tendu);
$query = "SELECT * FROM $DB.news_db WHERE news_tendu<='$tendu' ORDER BY news_date desc, news_time desc";
$query = "SELECT * FROM $DB.news_db INNER JOIN $DB.users_db ON news_db.news_user_id = users_db.user_id WHERE news_tendu<='$tendu' ORDER BY news_date desc, news_time desc";
return mysql_query($query);
}
......
......@@ -14,7 +14,7 @@ $str = '
<h1><img alt="" src="images/puce.png" /> <strong>Derni&egrave;res actualit&eacute;s</strong></h1>
<ul>';
$str .=dispHomeNews();
$str .=dispNewsRows();
$str .= '
</ul></div>
......@@ -47,41 +47,6 @@ $str = '
echo $str;
}
function dispHomeNews(){
$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 < 10 && ($news = mysql_fetch_array($result)); $cpt++) {
// DISP NEWS TITLE BY TENDU
$str .= dispWhenTendu($news["news_tendu"]);
$str .= '
<li>
<h2><strong>
'.$news["news_title"].'
</strong>';
// DISP NEWS CONTENT BY TENDU
$str .= dispWhenTendu($news["news_tendu"]);
$str .= '
<span class="news_date"> - '.$news["news_date"].'</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);
}
function dispHomeEdito(){
$result = getLastEdito();
if (mysql_num_rows($result))
......
......@@ -32,8 +32,7 @@ function dispNewsRows(){
// DISP NEWS CONTENT BY TENDU
$str .= dispWhenTendu($news["news_tendu"]);
$str .= '<span class="news_date"> - '.$news["news_date"].'</span></h2>
$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>';
......
......@@ -124,7 +124,7 @@ function dispVideosByType($result, $video_type) {
if ($video["video_path_daily"])
$str .= '<a href="javascript:popup_video_dailymotion(\'?dailymotion='.$video["video_id"].'\')"><img src=\'../images/daily.png\' height=15 border=0 /></a>';
$str .= '</TD><TD>'.$video["video_date"].'</TD><TD align=center><strong>'.$video["video_size"].' Mo</strong></TD></TR>';
$str .= '</TD><TD>'.date("d/m/Y", strtotime($video["video_date"])).'</TD><TD align=center><strong>'.$video["video_size"].' Mo</strong></TD></TR>';
}
$str .= '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment