Вход Регистрация
Файл: sys/inc/classes/class.contacts.php
Строк: 122
<?php
    
class contacts
{
 public 
$common 0;
 public 
$favorite 0;
 public 
$deleted 0;
 public 
$typeLISTnames = array('common' => 'Активные'
     
'favorite' => 'Избранные''deleted' => 'Корзина',
     
'multi' => array('img' => array( 
     
'0' => 'activ.gif'
     
'1' => 'star_fav.gif',  
     
'2' => 'trash.gif'
     
'3' => 'msg.gif'
     
'4' => 'new_mess.gif',
     
'msg_' => 'В этой категории нет контактов'
 
)));
      public function 
__construct$user_ ) { 
  if ( 
$user_ !== true )
                die(
'Вы не авторизованны');
    
$GETles = !empty($_GET['type'])? $_GET['type']:''
 
$this->GETname $GETname = !empty(  
  
$this->typeLISTnames[$GETles])? $GETles 'common';  
 
$this->titleNAME $this->typeLISTnames[$GETname];
}
     public function 
title (){
 return 
$this->titleNAME;
}
     public function 
start_ $id$set ) {
  
$k_post_ mysql_fetch_assoc
  
mysql_query("SELECT * FROM  
   (SELECT COUNT( pa.type ) deleted  
          FROM `users_konts` AS pa 
   WHERE pa.id_user = '
$id' AND pa.type = 'deleted') A, 
   (SELECT COUNT( pb.type ) favorite  
   FROM `users_konts` AS pb 
   WHERE pb.id_user = '
$id' AND pb.type = 'favorite') B,  
   (SELECT COUNT( pc.type ) common  
   FROM `users_konts` AS pc 
   WHERE pc.id_user = '
$id' AND pc.type = 'common') C, 
   (SELECT COUNT( pu.type ) resets 
   FROM `users_konts` AS pu 
   WHERE pu.id_user = '
$id'
   AND pu.type = '
$this->GETname' ) U 
  "
)); 
        
$this->k_post $k_post $k_post_['resets'];
        
$this->common $k_post_['common'];
        
$this->favorite $k_post_['favorite'];
        
$this->deleted $k_post_['deleted'];
        
$k_page k_page($k_post$set); 
        
$page page($k_page); 
        
$this->start $start $set*$page-$set;
        
$this->k_page $k_page;
        
$this->page $page;
        
$this->user $id;
        
$this->set $set;
        
$type $this->typeLISTnames;
    print 
$k_post'':
 
"<div class='mess'>
  "
.$type['multi']['img']['msg_']."
 </div>"
;
}
    public function 
contact_  (  ) {
   
$this->qus $q mysql_query(
   SELECT pu.id_user, pu.id_kont, pu.new_msg, pu.time 
        FROM `users_konts` AS pu   
        WHERE pu.id_user = '
$this->user'   
        AND pu.type = '
$this->GETname'   
        ORDER BY pu.time DESC, pu.new_msg   
        DESC LIMIT 
$this->start$this->set"); 
 }
   public function 
contactALL  $num ) {
    
?><form method="post" action=""><?
   
while ($post mysql_fetch_assoc($this->qus)){
   
$num++;
   
?><div class="
   <?=($num ?"nav1":"nav2")?>">
   <? 
        
print $this->miniMSG ($post['id_kont']);
   
?> 
   <a href="/mail.php?id=<?=$post['id_kont']?>"><?
   ?>
</a></div>
   <?}?>
     <div class="nav2">
   <? print $this->dies();?>
     </form></div><?
 
}
   public function 
miniMSG $id ) {
     
$mini mysql_fetch_assoc(mysql_query("
             SELECT `msg`, `time`,
             (SELECT COUNT(pk.read)
             FROM mail AS pk WHERE pk.id_kont = 
$this->user 
             AND pk.id_user = 
$id
             AND pk.read = '0') AS readu
             FROM `mail` WHERE `unlink` != '
$this->user
             AND `id_user` = '
$this->user
             AND `id_kont` = '
$id' OR `id_user` = '$id
             AND `id_kont` = '
$this->user
             AND `unlink` != '
$this->user
             ORDER BY id DESC"
));
// --- Аватар, ник и новые смс при наличии(тут работай)
  
echo user::avatar($id) . user::nick($id1);
       print 
$mini['readu']?
 
" NEW (<font color=red>+$mini[readu]</font>)"
 
'&nbsp;'.vremja($mini['time']).'';
 
?>
   <br/><input type="checkbox" 
       name="id_<?=$id?>" value="1"/>
  <?
    $type 
$this->typeLISTnames;
    
$img_ = empty($mini['readu'])?
    
$type['multi']['img'][3] : $type['multi']['img'][4];
  
?><img style="padding: 2px; margin-top: -5px;" src="/style/icons/<?=$img_?>" alt="N"/>&nbsp;<?
  ?>
<a href="/mail.php?id=<?=$id?>"><?
    $msg 
$mini['msg']? "$mini[msg]'Нет сообщений';
    
$rest rez_text(text($msg'5''10'));
    
$string mb_substr($rest040);
        echo 
"<span style='padding: 5px;'>$string</span>"
}
    public function 
dies (  ) {
  
?><div class="mess">
        Отмеченные контакты
    <br/>
    </div>
  <?php  
    
foreach(array_keys(
    
$this->typeLISTnames) as $keY_){
 if (
$this->GETname !== $keY_ && $keY_ !== 'multi'){
 
?>
  <input value="<?=$this->typeLISTnames[$keY_]?>
" type="submit" name="<?=$keY_?>"/>
<? 
}
}
       if (
$this->k_page 1)
  
str("?type=$this->GETname&amp;",$this->k_page,$this->page); 
}
       public function 
contactSORTpost $postCONT ) {
  
$whiteLIST = array('favorite''common''deleted');
  if (
array_intersect_key(array_flip($whiteLIST), $postCONT))
{
   foreach(
$postCONT as $key => $value) {
   
$sort = (array_keys($postCONT));
   
$sort end($sort);
   
$key str_replace(array(
       
"id_","favorite""deleted""common"), nulltrim($key));
   if (!empty(
$key)) {
   
mysql_query("UPDATE `users_konts` 
         SET `type` = '"
.my_esc($sort)."'
         WHERE `id_user` = 
$this->user 
         AND `id_kont` = '"
.(int)$key."'
         AND `id_kont` != '0'"
);
  
$_SESSION['message'] = 'Успешно'
  
header("Location: ?type=$sort");
}}
}}
     public function 
contactMENU (  ) {
     
$count_ = array(
                     
'0' => $this->common
                     
'1' => $this->favorite
                     
'2' => $this->deleted);
  
?><div class='main'><?
    $type 
$this->typeLISTnames;
    for (
$x 0$x<3$x++){ $link array_keys($type);
  
?>
   <img style="padding:2px;" src="/style/icons/<?=$type['multi']['img'][$x]?>" alt="N"/> 
  <a href="?type=<?=$link[$x]?>">
  <?=$type[$link[$x]]?></a>
 (<?=$count_[$x]?>)<br/>
  <? 
}
  
?></div><?
}
}
Онлайн: 0
Реклама