<?php
include("includes/site_info.php");

$VUserID = $_REQUEST['VUserID'];
$WUsername = $_REQUEST['VUserNAME'];

$blog_query=mysql_query("SELECT *, UNIX_TIMESTAMP(blg_datetime) as blgdate FROM blogs WHERE blg_userid = '$VUserID' AND blg_approved='Y' AND blg_private='N' ORDER BY blg_datetime DESC",$link) or die(mysql_error());
$blog_TOTAL = mysql_num_rows($blog_query);

$article_query=mysql_query("SELECT *, UNIX_TIMESTAMP(art_datetime) as artdate FROM articles WHERE art_userid = '$VUserID' AND art_approved='Y' AND art_private='N' ORDER BY art_datetime DESC",$link) or die(mysql_error());
$article_TOTAL = mysql_num_rows($article_query);


?>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5" class="white_back_t_xb">
        <tr>
          <td><div class="light_orang_h">
              <div style="background-color:#FF0000; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"><img src="images/spacer.gif" width="10" height="10" /></div>
              Blogs </div>
            <div class="dot_line"><img src="images/spacer.gif" width="1" height="1" /></div>
            <div class="solid_line"><img src="images/spacer.gif" width="1" height="1" /></div></td>
        </tr>
        <tr>
          <td><?php if ($blog_TOTAL > 0){ ?>
            <table border="0" cellpadding="3" cellspacing="0" class="white_back_t_xb" width="99%" align="center">
              <?php 
			$i=1;
			while (($blog = mysql_fetch_object($blog_query)) && ($i<6)) {
			if(file_exists($SITE_ROOT."/members/".$WUsername."/blog/".$blog->blg_picture."_small.".$blog->blg_ext)){ $image=$CONST_LINK_ROOT."/members/".$WUsername."/blog/".$blog->blg_picture."_small.".$blog->blg_ext ;}  else {$image="$CONST_LINK_ROOT/images/icon-post.gif";}
			if ($i>1) $tr='<tr class="solid_line_separator"><td colspan="4"><img src="images/spacer.gif" height="3"/></td></tr>'; else $tr='';
			?>
              <?=$tr?>
              <tr>
                <td width='50px' align='left' valign="top"><a href="javascript: void(null)" title="<?=$blog->blg_title?>" onclick="javascript: jQuery.facebox({ajax:'<?=$CONST_LINK_ROOT?>/myprofile_blog.php?VUserID=<?=$VUserID?>&bid=<?=$blog->blg_id?>'}, this.title, 'note'); return false;" rel="facebox"><img src='<?=$image?>' title='<?=$blog->blg_title?>' border="0" class="img_b_p3"/></a></td>
                <td width='100px' align='left' valign="top"><a href="javascript: void(null)" title="<?=$blog->blg_title?>" onclick="javascript: jQuery.facebox({ajax:'<?=$CONST_LINK_ROOT?>/myprofile_blog.php?VUserID=<?=$VUserID?>&bid=<?=$blog->blg_id?>'}, this.title, 'note'); return false;" rel="facebox"><b>
                  <?=$blog->blg_title?>
                  </b></a><br>
                  <span class="lightgrey_10">
                  <?php if ($blog->blg_mood) echo "Mood: ".$blog->blg_mood."<br />";?>
                  <?=date("d M'y h:ia",$blog->blgdate)?>
                  </span></td>
                <td align='justify' valign="top"><?php 
				$short_msg_text=strip_tags(stripslashes(substr($blog->blg_message,0,150)));
				if (strlen (strip_tags($blog->blg_message))>150) $short_msg_text.="...";
				echo $short_msg_text;
				?></td>
              </tr>
              <?php
    $i++;
	}
	?>
            </table>
            <?php
} else {
     print(NO_RECORDS_SECTION_NAME);
}
?>          </td>
        </tr>
        <tr>
          <td><div class="light_orang_h">
              <div style="background-color:#0000FF; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"><img src="images/spacer.gif" width="10" height="10" /></div>
              Notes</div>
            <div class="dot_line"><img src="images/spacer.gif" width="1" height="1" /></div>
            <div class="solid_line"><img src="images/spacer.gif" width="1" height="1" /></div></td>
        </tr>
        <tr>
          <td><?php if ($article_TOTAL > 0){ ?>
            <table border="0" cellpadding="3" cellspacing="0" class="white_back_t_xb" width="99%" align="center">
              <?php 
			$j=1;
			while (($article = mysql_fetch_object($article_query)) && ($j<6)) {
			if(file_exists($SITE_ROOT."/members/".$WUsername."/article/".$article->art_picture."_small.".$article->art_ext)){ $image=$CONST_LINK_ROOT."/members/".$WUsername."/article/".$article->art_picture."_small.".$article->art_ext ;}  else {$image="$CONST_LINK_ROOT/images/icon-post.gif";}
			if ($j>1) $tr='<tr class="solid_line_separator"><td colspan="4"><img src="images/spacer.gif" height="3"/></td></tr>'; else $tr='';
			?>
              <?=$tr?>
              <tr>
                <td width='50px' align='left' valign="top"><a href="javascript: void(null)" title="<?=$article->art_title?>" onclick="javascript: jQuery.facebox({ajax:'<?=$CONST_LINK_ROOT?>/myprofile_note.php?VUserID=<?=$VUserID?>&aid=<?=$article->art_id?>'}, this.title, 'note'); return false;" rel="facebox"><img src='<?=$image?>' title='<?=$article->art_title?>' border="0" class="img_b_p3"/></a></td>
                <td width='100px' align='left' valign="top"><a href="javascript: void(null)" title="<?=$article->art_title?>" onclick="javascript: jQuery.facebox({ajax:'<?=$CONST_LINK_ROOT?>/myprofile_note.php?VUserID=<?=$VUserID?>&aid=<?=$article->art_id?>'}, this.title, 'note'); return false;" rel="facebox"><b>
                  <?=$article->art_title?>
                  </b></a><br>
                  <span class="lightgrey_10">
                  <?=date("d M'y h:ia",$article->artdate)?>
                  </span></td>
                <td align='justify' valign="top">
				<?php 
				$short_msg_text=strip_tags(stripslashes(substr($article->art_message,0,200)));
				if (strlen (strip_tags($article->art_message))>200) $short_msg_text.="...";
				echo $short_msg_text;
				?>				</td>
              </tr>
              <?php
    $j++;
	}
	?>
            </table>
            <?php
} else {
     print(NO_RECORDS_SECTION_NAME);
}
?></td>
        </tr>
        
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
