<?php 

if ($type  ==  'groups_albums')
{
$albums = 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_albums` 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_file]'
                                            LIMIT 1"));

?>
<div class="groups">
  <div class="group-post">
    <div class="group-table">
      <div class="group-table-cell group-post-title">
        <img src="/groups/<?= ($albums['img'] ? '30x30/' . $albums['img'] . '.jpg' : 'style/img/group_ava_50.png')?>" class="group-small-avatar" /> 
        <? if ($albums['public_admin'] == 1 && $albums['level'] > 1) { ?>
          <a href="/groups/group.php?uid=<?= $albums['id_group']?>"><?= text($albums['group_name'])?></a>
        <? } else { ?>
          <a href="/groups/group.php?uid=<?= $albums['id_group']?>"><?= text($albums['group_name'])?></a><b>.:</b>  
          <a href="/info.php?id=<?= $albums['id_user']?>"><?= text($albums['nick'])?></a> 
          <span class="<?= ($albums['date_last'] >= ($time - $set['time_online']) ? 'online' : 'offline')?>"></span>
        <? } ?>
        
        добавлены <?= $post['count']?> фото в альбом
        <span class="group-post-time">
          <?= vremja($post['time'])?>
        </span>
      </div>
    </div>
  
    <div class="group-post-title">
      <a href="/groups/albums.php?uid=<?= $albums['id_group']?>&amp;albums=<?= $post['id_file']?>"><?= text($albums['name'])?></a>
    </div>

    <?
    $t = mysql_query("SELECT `uid`, `hash`, `name` FROM groups_photos 
                      WHERE `id_albums` = '$albums[uid]' AND `id_group` = '$albums[id_group]' AND uid <= '$post[ot_kogo]'
                      ORDER BY time DESC
                      LIMIT $post[count]");

    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="<?= ($post['count'] == 1 ? 'flex-block' : 'flex-photo')?>"> 
      <?
      while($photos = mysql_fetch_assoc($t)) {
          ?>
          <a href="/groups/albums.php?uid=<?= $albums['id_group']?>&amp;albums=<?= $albums['uid']?>&amp;photo=<?= $photos['uid']?>" data-albums="<?= $albums['uid']?>" data-photos="<?= $photos['uid']?>">
            <img src="/groups/<?= $img_src_size?>/<?= $photos['hash']?>.jpg" class="flex-img" />
            
            <? if ($post['count'] == 1) { ?>
              <div class="flex-photo-name">
                <?= output_text($photos['name'], 1, 1, 1, 0)?>
              </div>
              
            <? } ?>
          </a>
          
          <?
      }
      ?>
      </div>
    </div>
  </div>
<? 
}