<?php
/**
 * Класс выводит аватарку из СУБД
 * *
 * (c) Дмитрий Куринский, 2006.
 * Пространство имён: xmlns:mr=http://www.mirari.ru
 */

    
class mr_avatar{
 static public function 
out($login)
 {
  
uses::module("mr_db");

  
$id mr_db::fetch("SELECT id FROM mr_users WHERE login='$login' LIMIT 1"mr_db::get);
  if(!
$id) exit;

  
$f mr_db::fetch("SELECT type, image FROM mr_user_avatars WHERE user_id=$id LIMIT 1"mr_db::obj);
  if(!
is_object($f))
   
$f mr_db::fetch("SELECT type, image FROM mr_user_avatars WHERE user_id=0 LIMIT 1"mr_db::obj);

  
header("Content-type: ".$f->type);

  print 
$f->image;

  exit;
 }
    }
?>