<?
  ### Версия ПО (ДМ) 1.0.0.0 ( (c)2018 MISOFT Продукт защищен регистрацией патента и авторских прав! www.misoft.studio )
  ######################################################################################################################

  ini_set('display_errors', 'Off');

  if ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) {
    define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );
    session_start();
    header( 'Content-type: text/html; charset=windows-1251' );
    include_once ROOT_DIR . '/engine/config.php';
    include_once ROOT_DIR . '/engine/function.php';
  } else {
    if ( !defined( 'MISOFT' ) ) { exit(); }
  }
  
  if ( !isset( $_SESSION['iduser'] ) ) { exit(); }
  
  #Берем сумму рейтинга максимального статуса, и вычисляем текущий процент рейтинга и приводим его к 100 значной процентной ставки.
  $progress_status_mobile = ( $config_site['status_meaning_6a'] / 100 );
  $progress_status_mobile = ( $config_user['reyting'] / $progress_status_mobile );
  
  #Проверка ответа ТП
  $sql_tiket_mobile = mysql_fetch_array( mysql_query( "SELECT COUNT(id) as count FROM tickets WHERE iduser = '".$_SESSION['iduser']."' and status = '1'" ) );
  
  #Проверка конкурсов от реферера
  $sql_cont_ref_mob = mysql_fetch_array( mysql_query( "SELECT COUNT(id) as count FROM contests WHERE autor = '".$config_user['referer']."'" ) );
  #Проверка конкурсов от админа
  $sql_cont_adm_mob = mysql_fetch_array( mysql_query( "SELECT COUNT(id) as count FROM konkurs " ) );
  #Проверка сообщений
  $sql_mess_mob = mysql_fetch_array( mysql_query( "SELECT COUNT(id) as count FROM messages WHERE to_id = '" . $_SESSION['iduser'] . "' and m_state = 'inbox' and m_type = 0" ) );
  #Проверка заданий для оплаты
  $tasks_user_ok_mob = 0;
  $get_task_ok_mob = mysql_query( "SELECT id FROM tasks WHERE iduser = '" . $_SESSION['iduser'] . "'" );
  if ( mysql_num_rows( $get_task_ok_mob ) > 0 ) {
    while ( $get_task_ok_row_mob = mysql_fetch_array( $get_task_ok_mob ) ) {
      $get_task_ok_temp_mob = mysql_query( "SELECT id FROM tasks_temp WHERE ident = '" . $get_task_ok_row_mob['id'] . "' and status = 4" );
      if ( mysql_num_rows( $get_task_ok_temp_mob ) > 0 ) {
        while ( $get_task_ok_temp_row_mob = mysql_fetch_array( $get_task_ok_temp_mob ) ) {
          $tasks_user_ok_mob += 1;
        }
      }
    }
  }
  ?>
    <script type="text/javascript" >
      function addreyting() {
	    $.post('ajax.php?func=addreyting', {
	    }, function(data) {
		  if(data == 1) {
		    $('.addreyting').fadeOut(0);
		    Page.Go(window.location.reload());
		  }
	    });
	    return false;
	  }
	  $(document).ready(function(){
	    $('.addreyting').tipTip({defaultPosition:'right'});
	  });
    </script>
    <div class="collapse navbar-toggleable-xs" style="height: 5px;"></div>
	<div class="pos-f-t" style="margin-bottom: 100px;">
	  
	  <nav class="navbar navbar-light navbar-static-top bg-faded" >
		<div class="container" >
			
		  <div class="collapse navbar-toggleable-xs" id="exCollapsingNavbar1">
			<div style="margin-left: 60px;">
			  <a class="navbar-brand" href="#" style="margin-top: 2px;"><?=$config_site['sitename']?></a>
			  <ul class="nav navbar-nav" style="font-size: 18px;">
				<li class="nav-item /*active*/">
				  <a class="nav-link" href="/home">Главная </a>
				</li>
				<li class="nav-item /*active*/">
				  <a class="nav-link" href="/news">Новости </a>
				</li>
				<li class="nav-item">
				  <a class="nav-link" href="/serfing">Заработок</a>
				</li>
				<li class="nav-item">
				  <a class="nav-link" href="/adddyn">Реклама</a>
				</li>
				<li class="nav-item">
				  <a class="nav-link" href="/forum">Форум</a>
				</li>
				<li class="nav-item">
				  <a class="nav-link" href="/payments">Выплаты</a>
				</li>
			  </ul>
			</div>
		  </div>
	  
		  <div style="margin-top: -35px; float: left;">
			<div style="background: #fff; width: 43px; " class="">
			  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar" aria-controls="exCollapsingNavbar" aria-expanded="false" aria-label="Toggle navigation">
				&#9776;
			  </button>
			</div>
			<div class="collapse" id="exCollapsingNavbar">
			  <div class="/*bg-inverse p-a-1*/" style="margin-top: 8px; height: 400px; overflow-y: scroll;">
				  <table class="" style="width: 770px; margin: 10px 0 0 -25px;">
				    <tr>
					  <td style="width: 40%; font-size: 20px; text-aling: right; ">
					    <div class="mobile-block-header-left">
						  <div class="mobile-block-left-1">
					       <div class="mobile-block-left-3"><?=$config_user['reyting']?> <img src="/theme/images/mobile/rating.png" style="margin-top: 4px; margin-bottom: -4px;"/>  </div>
					      <br/>
					      <div class="mobile-block-left-2"><?=$config_user['likes']?> <img src="/theme/images/mobile/heart.png" style="margin-top: 4px; margin-bottom: -4px;"/>  </div>
					      </div>
					    </div>
						<?
						  if ( $config_user['addreyting'] < time() ) {
						    ?>
							  <div class="mobile-addreyting" onclick="addreyting(); return false;"  title="Бонус +<?=$config['everybonus']?> к рейтингу"></div>  
						    <?
						  }
					    ?>
					  </td>
					  <td style="width: 20%; ">
					    <div class="div_centralizator">
					      <a href="/id<?=$config_user['id']?>">
						    <div style="margin: 15px 0 0 0;"><img src="/temp/avatar/<?=$config_user['avatar']?>" class=" img-circle" alt="" /></div>
							<div class="progress" style="width: 120px; height: 20px; margin: 10px 0 0 0;">
							  <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="10" style="width: <?=$progress_status_mobile?>%"></div>
							</div>
						  </a>
						</div>
					  </td>
					  <td style="width: 40%; font-size: 20px; ">
					    <div class="">
						  <img src="/theme/images/mobile/money.png" style="margin-top: 4px; margin-bottom: -4px;"/> <?=moneyraund( $config_user['money'], 2 )?> <?=$config['valutaname']?>
						    <a href="/payuser">
						      <button type="button" class="btn btn-success btn-sm" style="height: 16px; padding-top: 5px; padding-bottom: 5px; font-size: 14px;" onclick="delHistory(<?=$get_history_row['id']?>, 0);">
							  <i class="fa fa-arrow-up" aria-hidden="true"></i> вывести</button>
						    </a>
					    </div>
					    <div class="">
						  <img src="/theme/images/mobile/money.png" style="margin-top: 4px; margin-bottom: -4px;" /> <?=moneyraund( $config_user['adv_money'], 2 )?> <?=$config['valutaname']?>
						  <a href="/advertising">
						    <button type="button" class="btn btn-info btn-sm" style="height: 16px; padding-top: 5px; padding-bottom: 5px; font-size: 14px;" onclick="delHistory(<?=$get_history_row['id']?>, 0);"><i class="fa fa-arrow-down" aria-hidden="true"></i> пополнить</button>
					      </a>
						</div>
					  </td>
					</tr>
				  </table>
				
				<div class="mobile-left-menu">
				  <? if ( $config_user['account'] == 5 ) { ?>
				    <a href="/admin">
				      <div class="mobile-left-menu-li-red">
				        <i class="fa fa-linux" aria-hidden="true"></i> Админ-панель
				      </div>
				    </a>
				  <? } 
				  if ( $sql_tiket_mobile['count'] > 0 ) { ?>
				    <a href="/support">
				      <div class="mobile-left-menu-li-red">
				        <i class="fa fa-life-ring" aria-hidden="true"></i> Поддержка <div class="support-hover-two ">(<b>новый ответ</b>)</div>
				      </div>
				    </a>
				  <? } ?>
				  <a href="/serfing">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-hand-pointer-o" aria-hidden="true"></i> Зароботок
				    </div>
				  </a>
				  <a href="/competition">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-bookmark-o" aria-hidden="true"></i> Конкурсы (<b><?=$sql_cont_adm_mob['count']?></b>)
				    </div>
				  </a>
				  <a href="/contests">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-bookmark-o" aria-hidden="true"></i> Конкурсы от реферера (<b><?=$sql_cont_ref_mob['count']?></b>)
				    </div>
				  </a>
				  <a href="/referrals">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-users" aria-hidden="true"></i> Реферальная програма
				    </div>
				  </a>
				  <a href="/adddyn">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-bullhorn" aria-hidden="true"></i> Разместить рекламу
				    </div>
				  </a>
				  <a href="/mtasks">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-folder-o" aria-hidden="true"></i> Управление рекламой (<b><?=$tasks_user_ok_mob?></b>)
				    </div>
				  </a>
				  <a href="/msg=inbox">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-paper-plane-o" aria-hidden="true"></i> Ваша личная почта (<b><?=$sql_mess_mob['count']?></b>)
				    </div>
				  </a>
				  <a href="/mstatistic">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-pie-chart" aria-hidden="true"></i> Ваша статистика
				    </div>
				  </a>
				  <a href="/id<?=$config_user['id']?>">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-address-card-o" aria-hidden="true"></i> Ваша стенка
				    </div>
				  </a>
				  <a href="/profile">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-linux" aria-hidden="true"></i> Настройки аккаунта
				    </div>
				  </a>
				  <a href="/chat">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-comment-o" aria-hidden="true"></i> Онлайн чат
				    </div>
				  </a>
				  <a href="/bonus">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-gift" aria-hidden="true"></i> Ежедневные бонусы
				    </div>
				  </a>
				  <a href="/referral_fair">
				    <div class="mobile-left-menu-li">
				      <i class="fa fa-gavel" aria-hidden="true"></i> Ярмарка рефералов
				    </div>
				  </a>
				  <a href="/exit">
				    <div class="mobile-left-menu-li-exit">
				      <i class="fa fa-sign-out" aria-hidden="true"></i> Выход с аккаунта?
				    </div>
				  </a>
				  
				
				  <br/>
				  <br/>
				</div>
				
				
			  </div>
			</div>
		  </div>
		  
		</div>
	  </nav>
    </div>