Вход Регистрация
Файл: adultscript-2.0.3-pro/files/templates/defboot/extend/ajax/friend_del.plugin.php
Строк: 38
<?php
defined
('_VALID') or die('Restricted Access!');
function 
ajax_plugin_friend_del()
{
    
$data = array('status' => 0'msg' => '''code' => '''debug' => '');
    if (isset(
$_POST['user_id'])) {
        if (
VAuth::loggedin()) {
            
$user_id     = (int) trim($_POST['user_id']);
            
$friend_id    = (int) $_SESSION['user_id'];
            
            
VLanguage::load('profile.profile');
            
            
$db VF::factory('database');
            
$db->query("SELECT status
                        FROM #__user_friends
                        WHERE user_id = "
.$user_id."
                        AND friend_id = "
.$friend_id."
                        LIMIT 1"
);
            if (
$db->affected_rows()) {
                
$db->query("DELETE FROM #__user_friends
                            WHERE ((user_id = "
.$user_id." AND friend_id = ".$friend_id.") OR
                                   (user_id = "
.$friend_id." AND friend_id = ".$user_id."))
                            LIMIT 2"
);
                
$data['msg'] = __('friend-removed');
            }
            
            
// even if no rows found, we still display the add friend link, bug no Friendship removed! message!
            
$data['status']    = 1;
            
$data['code']    = '<a href="#add-friend" id="profile-friend-add" rel="friend">'.__('leftmenu-addfriend').'</a>';
        } else {
            
$data['msg'] = 'Please login to remove friends!';
        }
    } else {
        
$data['msg'] = 'Invalid ajax request!';
    }
    
    return 
json_encode($data);
}
Онлайн: 0
Реклама