Файл: autoload/wall.php
Строк: 107
<?php
function like($modul, $id, $arr_ulike, $arr_clike, $arr_user_id)
{
    global $user_id;
    if (!empty($user_id) && $user_id != $arr_user_id)
    {
        if (!in_array($user_id, explode("||", substr($arr_ulike, 1, -1)))) $img_like = '<img src="'.URL.'/design/img/like.png"/>'; else $img_like = '<img src="'.URL.'/design/img/like_ok.png"/>';
        echo '<span id="like_'.$id.'"><a class="crl" class="'.$id.'" href="'.URL.'/'.$modul.'/like.php?id='.$id.'" onclick="Like.Go(this.href,'.$id.'); return false">'.$img_like.''.($arr_clike>0?'<b>'.$arr_clike.'</b>':'').'</a></span>';
    }
    else echo '<a class="crl" href="'.URL.'/'.$modul.'/show_like.php?id='.$id.'" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/like.png"/>'.($arr_clike>0?'<b>'.$arr_clike.'</b>':'').'</a>';
}
function wall_post($arr, $hide_post_panel=0, $search=false)
{
    global $user_id;
    
if ($arr == false) return '<ul>'.err(lang('Запись не найдена','Запис не знайдений')).'</ul>';
    if ($hide_post_panel == 0) echo '<div class="block">';
    if ($hide_post_panel == 0 && !empty($user_id)) if ($user_id == $arr['user_id'] || $user_id == $arr['wall_id']) echo '<div class="right"><a href="'.URL.'/?id='.$arr['wall_id'].'&del_post='.$arr['id'].'" onclick="Form.delWall(this.href); return false"><img src="'.URL.'/design/img/closed.png"/></a></div>';
    echo user_name($arr['user_id']).'<ul><a href="'.URL.'/wall/post.php?id='.$arr['id'].'" onclick="Page.Go(this.href); return false">'.($arr['type']=='repost'||$arr['type']=='group_repost'?'<img src="'.URL.'/design/img/repost.png"/>':'').' '.vtime($arr['time']).'</a></ul>';
    echo '<ul>'.($search==true?str_replace($search,'<span style="background:#EEEEEE;">'.$search.'</span>',links(smiles(hastag(cut($arr['text'],URL.'/wall/post.php?id='.$arr['id'].'&text=full'))))):links(smiles(hastag(cut($arr['text'],URL.'/wall/post.php?id='.$arr['id'].'&text=full'))))).'</ul>';
    if ($arr['type'] == 'post')
    {        
    
    
    
        if (!empty($arr['photos']))
        {
            echo '<ul><p>';
            $q = explode("||", substr($arr['photos'], 1, -1));
            $count = count($q);
            for ($i = 0; $i < $count; $i++)
            {
                if (file_exists(HOME .'/files/wall/'.$arr['user_id'].'/photos/'.$q[$i])) echo '<a href="'.URL.'/wall/post.php?id='.$arr['id'].'&n='.($i+1).'" onclick="Page.Go(this.href); return false"><img class="'.($count>1?'preview_mini':'preview').'" src="'.URL.'/files/wall/'.$arr['user_id'].'/photos/'.($count>1?'mini':'preview').'/'.$q[$i].'"/></a>';
                else echo '<img class="preview_mini" src="'.URL.'/design/img/image_not_found.png"/>';
            }
            echo '</p></ul>';
        }
        if (!empty($arr['audio']))
        {
            echo '<ul><p>';
            $q = explode("||", substr($arr['audio'], 1, -1));
            $count = count($q);
            for ($i = 0; $i < $count; $i++)
            {
                echo '<p>'.track($q[$i]).'</p>';
            }
            echo '</p></ul>';
        }
        if ($hide_post_panel == 0)
        {
            echo '<div class="post_panel">';
            echo '<a class="crl" href="'.URL.'/wall/post.php?id='.$arr['id'].'" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/comm.png"/>'.($arr['comm']>0?'<b>'.$arr['comm'].'</b>':'').'</a>';
            echo repost('wall',$arr['id'],$arr['urepost'],$arr['crepost'],$arr['user_id']);
            echo like('wall',$arr['id'],$arr['ulike'],$arr['clike'],$arr['user_id']);
            echo '</div>';
        }
    
        
        
    }
    else if ($arr['type'] == 'repost')
    {
    
    
    
        $arr_repost = mysql_fetch_array(mysql_query("SELECT * FROM `wall` WHERE `id` = '".$arr['repost_id']."' LIMIT 1"));
        echo wall_post($arr_repost,1);
        echo '<div class="post_panel">';
        if ($hide_post_panel < 2) echo '<a class="crl" href="'.URL.'/wall/post.php?id='.$arr['id'].'" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/comm.png"/>'.($arr['comm']>0?'<b>'.$arr['comm'].'</b>':'').'</a>';
        echo repost('wall',$arr['id'],$arr['urepost'],$arr['crepost'],$arr['user_id']);
        echo like('wall',$arr['id'],$arr['ulike'],$arr['clike'],$arr['user_id']);
        echo '</div>';
        
        
        
    }
    else if ($arr['type'] == 'group_repost')
    {
    
    
    
        $arr_repost = mysql_fetch_array(mysql_query("SELECT * FROM `groups_wall` WHERE `id` = '".$arr['repost_id']."' LIMIT 1"));
        echo group_wall_post($arr_repost,1);
        if ($arr_repost['from_group']==0) echo '<ul>'.group_name2($arr_repost['wall_id']).'</ul>';
        echo '<div class="post_panel">';
        if ($hide_post_panel < 2) echo '<a class="crl" href="'.URL.'/wall/post.php?id='.$arr['id'].'" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/comm.png"/>'.($arr['comm']>0?'<b>'.$arr['comm'].'</b>':'').'</a>';
        echo repost('wall',$arr['id'],$arr['urepost'],$arr['crepost'],$arr['user_id']);
        echo like('wall',$arr['id'],$arr['ulike'],$arr['clike'],$arr['user_id']);
        echo '</div>';
        
        
        
    }
    else if ($arr['type'] == 'update_avatar')
    {
    
    
    
        $arr_user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$arr['user_id']."' LIMIT 1"));
        $arr_ava = mysql_fetch_array(mysql_query("SELECT * FROM `avatars` WHERE `name` = '".$arr['photos']."' AND `user_id` = '".$arr['user_id']."' LIMIT 1"));
        echo '<ul style="color:#777777;">'.($arr_user['sex']==1?lang('обновил','оновив'):lang('обновила','оновила')).' фото</ul>';
        if (file_exists(HOME .'/files/avatars/'.$arr['user_id'].'/preview/'.$arr['photos'])) echo '<ul><p><a href="'.URL.'/avatars/preview.php?fname='.$arr['photos'].'" onclick="Page.Go(this.href); return false"><img class="preview" src="'.URL.'/files/avatars/'.$arr['user_id'].'/preview/'.$arr['photos'].'"/></a></p></ul>';
        else echo '<ul><img class="preview_mini" src="'.URL.'/design/img/image_not_found.png"/></ul>';
        if ($hide_post_panel == 0)
        {
            echo '<div class="post_panel">
            <a class="crl" href="'.URL.'/avatars/preview.php?fid='.$arr_ava['id'].'" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/comm.png"/>'.($arr_ava['comm']>0?'<b>'.$arr_ava['comm'].'</b>':'').'</a>';
            echo repost('wall',$arr['id'],$arr['urepost'],$arr['crepost'],$arr['user_id']);
            echo like('avatars',$arr_ava['id'],$arr_ava['ulike'],$arr_ava['clike'],$arr_ava['user_id']);
            echo '</div>';
        }
    }
    if ($hide_post_panel == 0) echo '</div>';
}
function repost($modul, $id, $arr_urepost, $arr_crepost, $arr_user_id)
{
    global $user_id;
    if (!empty($user_id) && $user_id != $arr_user_id)
    {
        if (!in_array($user_id, explode("||", substr($arr_urepost, 1, -1)))) $img_repost = '<img src="'.URL.'/design/img/repost.png"/>'; else $img_repost = '<img src="'.URL.'/design/img/repost_ok.png"/>';
        echo '<span id="'.$id.'"><a class="crl" href="'.URL.'/'.$modul.'/repost.php?id='.$id.'" onclick="Page.Go(this.href); return false">'.$img_repost.'<b>'.($arr_crepost>0?'<b>'.$arr_crepost.'</b>':'').'</b></a></span>';
    }
    else echo '<a class="crl" href="'.URL.'/wall/show_repost.php?id='.$id.'" onclick="Page.Go(this.href); return false"><img src="'.URL.'/design/img/repost.png"/><b>'.($arr_crepost>0?'<b>'.$arr_crepost.'</b>':'').'</b></a>';
}
?>