<?php
#-----------------------------------------------------#
#          ********* Бизнес Сайты *********           #
#             Made by   :  BIZON                      #
#               E-mail  :  blin.alex@bk.ru            #
#                 Site  :  http://f913218p.bget.ru    #
#  Вы не имеете право вносить изменения в код скрипта #
#      это может повлечь неработоспособность сайта    #
#-----------------------------------------------------#
if($numaz != 0){
////////////////////////////////////////////////////////////// Навигация
echo'<div class="wrapper">';
echo'<div id="breadcrumb">';
echo'<ul>';
if(empty($st)){
if(empty($tpp)){echo'<li class="first">Входящие ('.coll_dbmail_status(s_vhmail,s_userdan(id),user).'/'.coll_dbmail(s_vhmail,s_userdan(id),user).')</li>';
}else{
echo'<li><a href="'.$link.SID.'">Входящие ('.coll_dbmail_status(s_vhmail,s_userdan(id),user).'/'.coll_dbmail(s_vhmail,s_userdan(id),user).')</a></li>';
echo'<li>&#187;</li>';                        //// Не риалезовано
echo'<li class="first">'.$usma['tema'].'</li>';
}}else{
if($st==3)echo'<li class="first">Корзина</li>';
if($st==2)echo'<li class="first">Написать письмо</li>';
if($st==1){if(isset($tpp))echo'<li><a href="'.$link.'st=1&amp;'.SID.'">Исходящие ('.coll_dbmail(s_ismail,s_userdan(id),avtor).')</a></li><li>&#187;</li><li class="first">'.$usma['tema'].'</li>'; else echo'<li class="first">Исходящие ('.coll_dbmail(s_ismail,s_userdan(id),avtor).')</li>';}
}
echo'</ul>';
echo'</div></div>';
///////////////////////////////////////////////////////////// Середина
echo'<div class="wrapper">';
echo'<div class="container">';
echo'<div class="content">';
/////////////////////////////////

switch($st)
{
case 1:
if(isset($tpp) && $tpp!=0){
echo'<div id="comments"><h2>'.$usma['tema'].'</h2><ul class="commentlist"><li class="comment_odd">
<div class="author"><img class="avatar" src="./images/avatar/'.prof_dan(avatar,$usma['user']).'" width="42" height="42" alt="" /><span class="name">Кому: <a href=/?p=profil&amp;id='.$usma['user'].'&amp;'.SID.'>'.prof_dan(login,$usma['user']).'</a>'.prof_onli($usma['user'],2).' <span class="wrote">Дата: '.date("d.m.y",$usma['time']).'</span></div>
<div class="submitdate"><b>Сообщение</b></div><p>&nbsp;&nbsp;'.bb_code($usma['text']).'</p>
</li></ul></div>';
}else{
if(coll_dbmail(s_ismail,s_userdan(id),avtor)==0){
echo'<h1>Исходящих писем нет</h1>';
}else{
echo'<table summary="Summary Here" cellpadding="0" cellspacing="0" width="100%">';
echo'<thead><tr><th>Кому</th><th>Тема</th><th>Дата</th><th></th></tr></thead>';
$total = coll_dbmail(s_ismail,s_userdan(id),avtor);
if ($start < 0 || $start > $total){$start = 0;}
$strdb = "SELECT * FROM s_ismail WHERE `avtor`='".s_userdan(id)."' and `status`!='2' ORDER BY time DESC LIMIT $start,8";
$rdd = mysql_query($strdb);
while($ron = mysql_fetch_array($rdd)){
echo'<tr><td width="120px"><div align="center"><a href="/?p=profil&amp;id='.$ron['user'].'&amp;'.SID.'"><img src="images/avatar/'.prof_dan(avatar,$ron['user']).'" width="60" height="60"/></a><br /><a href="/?p=profil&amp;id='.$ron['user'].'&amp;'.SID.'"><b>'.prof_dan(login,$ron['user']).'</b></a><br />'.prof_onli($ron['user'],1).'</td><td><a href="/?p='.$pages.'&amp;st='.$st.'&amp;maili='.$ron['id'].'&amp;'.SID.'">'.$ron['tema'].'</a></td><td width="120px" align="center"><b align="center">'.date("d.m.y h:i",$ron['time']).'</b></td><td width="18px">
<form action="/?p='.$pages.'&amp;st='.$st.'&amp;'.SID.'" method="post">
<input type="hidden" name="korzis" value="'.$ron['id'].'">
<input type=image src="images/cart.gif" name="sub">
</form></td></tr>';
}
echo'</table>';
if($total>8)page_strnavigation('/?p='.$pages.'&amp;st='.$st.'&amp;', 8, $start, $total);
}}
break;
/////////////////////////////
case 2:
if(!empty($N_error))echo'<div class="error">'.$N_error.'</div>';
echo'<form method="post" action="/?p='.$pages.'&amp;st='.$st.'&amp;'.SID.'" id="form">';
echo'<div class="field"><label>Кому (Логин):</label><div class="input"><input type="text" name="komu"  maxlength="50"></div></div>';
echo'<div class="field"><label>Тема письма:</label><div class="input"><input type="text" name="tema"  maxlength="150"></div></div>';
echo'<div class="field"><label>';
bb_codimg();
echo'</label><div class="input"><textarea id="textarea" type="text" name="text"  maxlength="500"></textarea></div></div>';
echo'<input type="hidden" name="addm" value="go"><div class="submit"><button type="submit">Отправить</button></div>';
echo'</form>';
include_once("includes/bbcod.php");
break;
/////////////////////////////
case 3:

if((coll_dbmail_korz(s_vhmail,s_userdan(id),user)==0) && (coll_dbmail_korz(s_ismail,s_userdan(id),avtor)==0)){
echo'<h1>Корзина пуста</h1>';
}else{

if($is==0) {
$total = coll_dbmail_korz(s_vhmail,s_userdan(id),user);
$avtor="Автор";
$naz_ten="Входящие (".$total.")";
$db_m="s_vhmail WHERE `user`='".s_userdan(id)."'";
}else{
$total = coll_dbmail_korz(s_ismail,s_userdan(id),avtor);
$avtor="Кому";
$naz_ten="Исходящие (".$total.")";
$db_m="s_ismail WHERE `avtor`='".s_userdan(id)."'";
}

if($is==0 && $total==0) {
echo'<h1>Входящих писем в корзине нет</h1>';
}else{
if($is==1 && $total==0){
echo'<h1>Исходящих писем в корзине нет</h1>';
}else{
echo'<h1>'.$naz_ten.'</h1>';
echo'<table summary="Summary Here" cellpadding="0" cellspacing="0" width="100%">';
echo'<thead><tr><th>'.$avtor.'</th><th>Тема</th><th>Дата</th><th></th><th></th></tr></thead>';
if ($start < 0 || $start > $total){$start = 0;}
$strdb = "SELECT * FROM ".$db_m." and `status`='2' ORDER BY time DESC LIMIT $start,8";
$rdd = mysql_query($strdb);
while($ron = mysql_fetch_array($rdd)){
if($is==0) $user=$ron['avtor']; else $user=$ron['user'];

echo'<tr><td width="120px"><div align="center"><a href="/?p=profil&amp;id='.$user.'&amp;'.SID.'">
<img src="images/avatar/'.prof_dan(avatar,$user).'" width="60" height="60" align="center"/></a><br />
<a href="/?p=profil&amp;id='.$user.'&amp;'.SID.'"><b>'.prof_dan(login,$user).'</b></a><br />'.prof_onli($user,1).'</div></td>
<td><b>'.$ron['tema'].'</b></td><td width="120px" align="center"><b>'.date("d.m.y h:i",$ron['time']).'</b></td><td width="18px">
<form action="/?p='.$pages.'&amp;st='.$st.'&amp;is='.$is.'&amp;'.SID.'" method="post">
<input type="hidden" name="vost" value="'.$ron['id'].'">
<input type=image src="images/open.gif" name="sub">
</form></td><td width="18px"><form action="/?p='.$pages.'&amp;st='.$st.'&amp;is='.$is.'&amp;'.SID.'" method="post">
<input type="hidden" name="delet" value="'.$ron['id'].'">
<input type=image src="images/del.gif" name="sub">
</form></td></tr>';
}
echo'</table>';
if($total>8)page_strnavigation('/?p='.$pages.'&amp;st='.$st.'&amp;is='.$is.'&amp;', 8, $start, $total);
}}}
break;
///////////////////////////////////////////////////////////////////////////////////
default:
if(isset($tpp) && $tpp!=0){
echo'<div id="comments"><h2>'.$usma['tema'].'</h2><ul class="commentlist"><li class="comment_odd">
<div class="author"><img class="avatar" src="./images/avatar/'.prof_dan(avatar,$usma['avtor']).'" width="42" height="42" alt="" /><span class="name"><a href=/?p=profil&amp;id='.$usma['avtor'].'&amp;'.SID.'>'.prof_dan(login,$usma['avtor']).'</a>'.prof_onli($usma['avtor'],2).' <span class="wrote">Дата: '.date("d.m.y",$usma['time']).'</span></div>
<div class="submitdate"><b>Сообщение</b></div><p>&nbsp;&nbsp;'.bb_code($usma['text']).'</p>
</li></ul></div>';
}else{
if(coll_dbmail(s_vhmail,s_userdan(id),user)==0){
echo'<h1>Входящих писем нет</h1>';
}else{
echo'<table summary="Summary Here" cellpadding="0" cellspacing="0" width="100%">';
echo'<thead><tr><th>Автор</th><th>Тема</th><th>Дата</th><th></th></tr></thead>';
$total = coll_dbmail(s_vhmail,s_userdan(id),user);
if ($start < 0 || $start > $total){$start = 0;}
$strdb = "SELECT * FROM s_vhmail WHERE `user`='".s_userdan(id)."' and `status`!='2' ORDER BY time DESC LIMIT $start,5";
$rdd = mysql_query($strdb);
while($ron = mysql_fetch_array($rdd)){
if($ron['status']==0) $tema_a='<b>'.$ron['tema'].'</b>'; else $tema_a=$ron['tema'];
echo'<tr><td width="120px"><div align="center"><a href="/?p=profil&amp;id='.$ron['avtor'].'&amp;'.SID.'"><img src="images/avatar/'.prof_dan(avatar,$ron['avtor']).'" width="60" height="60" align="bottom"/></a><br/><a href="/?p=profil&amp;id='.$ron['avtor'].'&amp;'.SID.'"><b>'.prof_dan(login,$ron['avtor']).'</b></a><br />'.prof_onli($ron['avtor'],1).'</div></td><td><a href="'.$link.'mailv='.$ron['id'].'&amp;'.SID.'">'.$tema_a.'</a></td><td width="120px" align="center"><b>'.date("d.m.y h:i",$ron['time']).'</b></td><td width="18px">
<form action="/?p='.$pages.'&amp;'.SID.'" method="post">
<input type="hidden" name="korzina" value="'.$ron['id'].'">
<input type=image src="images/cart.gif" name="sub">
</form></td></tr>';
}
echo'</table>';
if($total>5)page_strnavigation($link, 5, $start, $total);
}}}
/////////////////////////////////////// Навигация
echo'</div><div class="column">';
echo'<div class="holder">';
echo'<h2 class="title"><img src="./images/avatar/'.$P_av.'" height="60" alt="60">Ваш текущий Аватар</h2>';
echo'<p>Выбрать другой Аватар вы можете, перейдя по ссылке изменить.</p>';
echo'<p class="readmore"><a href="/?p=vho&amp;st=1&'.SID.'">Изменить &raquo;</a></p>';
echo'</div>';
echo'<div class="subnav">';
echo'<h2>Почта (<b>'.s_userdan(login).'</b>)</h2>';
echo'<ul>';
echo'<li><a href="'.$link.SID.'">Входящие ('.coll_dbmail_status(s_vhmail,s_userdan(id),user).'/'.coll_dbmail(s_vhmail,s_userdan(id),user).')</a></li>';
echo'<li><a href="'.$link.'st=1&amp;'.SID.'">Исходящие ('.coll_dbmail(s_ismail,s_userdan(id),avtor).')</a></li>';
echo'<li><a href="'.$link.'st=2&amp;'.SID.'">Написать</a></li>';
echo'<li><a href="'.$link.'st=3&amp;'.SID.'">Корзина ('.coll_dbmail_korz(s_vhmail,s_userdan(id),user).'/'.coll_dbmail_korz(s_ismail,s_userdan(id),avtor).')</a>';
if($st==3){
echo'<ul>';
echo'<li><a href="'.$link.'st='.$st.'&amp;'.SID.'">Входящие ('.coll_dbmail_korz(s_vhmail,s_userdan(id),user).')</a></li>';
echo'<li><a href="'.$link.'st='.$st.'&amp;is=1&amp;'.SID.'">Исходящие ('.coll_dbmail_korz(s_ismail,s_userdan(id),avtor).')</a></li>';
echo'<li><a href="'.$link.'st='.$st.'&amp;is=3&amp;'.SID.'">Удалить все</a></li>';
echo'</ul>';
}
echo'</li></ul>';
echo'</div>';
echo'</div>';
///////////////////////////////////// низ
echo'<br class="clear" />';
echo'</div>';
echo'</div>';
}
?>