<?
class group {
		public static function getAvatar($d, $c = '') {
			return FILES_SERVER."groups/avatar/{$c}".($d['avatar'] != NULL && is_file(FILES_PATH."groups/avatar/{$c}".$d['avatar']) ? $d['avatar'] : '0.jpg');
		}

		public static function Avatar($d, $s = 0) {
			$wdata = array('64', '100','45');
			$hdata = array('64', '100','45');
			$c = array('64/', '150/','64/');
			return "<img src=\"".self :: getAvatar($d, $c[$s])."\" style=\"border-radius: 50%;".($s != 1 ? "width: ".$wdata[$s]."px;height: ".$hdata[$s]."px;" : '' )."\">";
		}

		public static function getLink($d) {
			return "/groups/?group=".(int)$d['id'];
		}
		public static function getName($d) {
			return $d['name'];
		}
		public static function goPage($d) {
			return "<a href=\"".self :: getLink($d)."\">".self :: getName($d)."</a>";
		}
		public static function get($id, $s = NULL, $r = true) {
			global $thisPage, $config;
			$db = DB :: $pdo -> queryFetch("SELECT ".($s == NULL ? "*" : $s )." FROM `groups` WHERE `id` = ? LIMIT 1;", array($id));
			return $db;
		}
		
	public static	function Komments($id=0)
    {
    $group_komm = DB :: $pdo -> queryFetch("SELECT * FROM `groups_komm` WHERE `id` = ? LIMIT 1;", array($id));
    if (!isset($group_komm) || $group_komm['id'] <= 0 || $group_komm['post'] == NULL)
    {
    echo'<font color="red">Текст сообщения отсутствует!</font>';
    } else {
        echo emoji :: Text(system :: BBcode(system :: textOut($group_komm['post'])));
    //echo emoji :: Text($group_komm['post']);
    if (DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `groups_files` WHERE `id_post` = '".$group_komm['id']."'") > 0)
    {
    echo'<div class="list_blog39">';
        $query_f = DB :: $pdo -> query("SELECT * FROM `groups_files` WHERE `id_post` = '".$group_komm['id']."' ORDER BY `id` DESC");
            while($r_f = $query_f -> fetch())
                {
                echo"<div class='llq_pdq--2911'><img class='liq-pdq--891' src='".FILES_SERVER."/groups/files/".$r_f['id'].".jpg'></div>";
            }
            echo'</div>';
        }
        }
        }
		
		
		
		
		
		
		
		
	}