<?php
        //$thisLink = "/arbour";
        
       
        $table="arbour";
        $query = "SELECT * FROM `{$table}` ORDER by `time` DESC LIMIT 3 ";
        //$accessEdit = (isset($user['id']) ? admin :: getAccess($user,  array('a'=>3,'m_chat'=>1)) : '' );

        $q = DB :: $pdo -> query("{$query}");

        $i = 0;
        $in = 0;
        echo '<div class="app-block">';
        echo'<a href="arbour" class="list _center" style="text-decoration:none;"><b>Сообщения чата</b> <i class="fa fa-chevron-down"></i></a>';

        while($r = $q -> fetch()) {
            $dataUser = ($r['id_user'] == $user['id'] ? $user : profile :: getUser($r['id_user'],"*",false) );
            unset($rData);
            if($r['reply_user'] > 0) { $rData = ($r['reply_user'] == $user['id'] ? $user : profile :: getUser($r['reply_user'],"*",false) ); }
           
              ?>
           
     <div class="list">
            
                <div class="_oh">

<div class="list-flex">
                <div class="post-l emotion-show" data-emotions="<?=system::textOut($dataUser['emotions'])?>">
                    <?=profile :: userAvatar($dataUser, 3)?>
                </div>
                <div class="post-c">
                    <div style="display: block;"><span class="_name"><?=profile :: goPage($dataUser)?> <?=profile :: cake($dataUser)?> </span> <?=(isset($rData['id']) ? ' <span class="_gray _font-m">ответ для '.profile :: goPage($rData,false).'</span>' : '')?><div><span class="_font-m _gray"><?=system :: times($r['time'])?></span></div></div>  
                </div>
                </div>
                </div>
                <div class="_oh">
                    <span style="vertical-align: sub;"><?=emoji :: Text(system :: BBcode(system :: textOut($r['message'])))?></span>
                </div>
           
<?= like::init()->createButton(like::ARBOUR, [
                    'id_post' => $r['id'],
                    'id_user' => isset($user['id']) ? $user['id'] : -1,
                    'id_author' => $r['id_user']
                ]) ?>
            
            </div>

            
        
            
            
            <?php
            
        }
        echo'</div>';