<?php 

if ($type  ==  'groups_photo')
{
$photos = mysql_fetch_assoc(mysql_query("SELECT p.*, u.level, ru.nick, ru.date_last, g.name AS 'group_name', g.public_admin, g.avatar AS 'img'
                                            FROM `groups_photos` AS p
                                            LEFT JOIN groups_users AS u ON u.id_user = p.id_user
                                            LEFT JOIN user AS ru ON p.id_user = ru.id
                                            LEFT JOIN groups AS g ON g.uid = p.id_group
                                            WHERE p.uid = '$post[id_sim]'
                                            LIMIT 1"));

?>
<div class="groups">
  <div class="group-post">
    <div class="group-table">
      <div class="group-table-cell group-post-title">
        <img src="/groups/<?= ($photos['img'] ? '30x30/' . $photos['img'] . '.jpg' : 'style/img/group_ava_50.png')?>" class="group-small-avatar" /> 
        <a href="/groups/group.php?uid=<?= $photos['id_group']?>"><?= text($photos['group_name'])?></a>
        Фото из группы 
        <span class="<?= ($post['count'] == 0 ? 'group-post-time' : 'time')?>">
          <?= ($post['count'] > 0 ? '<span class="off"><b>+' . $post['count'] . '</b> ' . vremja($post['time']) . '</span>' : vremja($post['time']))?>
        </span>
      </div>
    </div>
  
    <?
    if (preg_match('/UCBrowser/i', $_SERVER['HTTP_USER_AGENT']) || !$webbrowser) {
      $img_src_size = ($post['count'] == 1 ? '128' : '128x128');
    } else {
      $img_src_size = ($post['count'] == 1 ? '480' : '320x324');
    }
    ?>
    <div class="flex">
      <div class="flex-block"> 
          <a href="/groups/albums.php?uid=<?= $photos['id_group']?>&amp;albums=<?= $photos['uid']?>&amp;photo=<?= $photos['uid']?>&amp;disc=true" data-albums="<?= $photos['uid']?>" data-photos="<?= $photos['uid']?>">
            <img src="/groups/<?= $img_src_size?>/<?= $photos['hash']?>.jpg" class="flex-img" />
          
            <div class="flex-photo-name">
              <?= output_text($photos['name'], 1, 1, 1, 0)?>
            </div>
          </a>
      </div>
    </div>
    
    <div class="ic-panel">
      <?php echo get_comments_count('photo', $photos['id_group'], $post['id_sim']); ?>
    </div>
  </div>
<? 
}