Вход Регистрация
Файл: adultscript-2.0.3-pro/files/templates/defboot/extend/ajax/user_comment_delete.plugin.php
Строк: 34
<?php
defined
('_VALID') or die('Restricted Access!');
function 
ajax_plugin_user_comment_delete()
{
    
$data = array('status' => 0'code' => '''msg' => '''debug' => '');
    if (isset(
$_POST['comment_id'])) {
          
$user_id = (VAuth::loggedin()) ? (int) $_SESSION['user_id'] : 0;
          if (
$user_id) {
              
VLanguage::load('frontend.video');
          
              
$comment_id = (int) trim($_POST['comment_id']);
              
              
$db VF::factory('database');
              
$db->query("SELECT poster_id
                          FROM #__user_comments
                          WHERE comment_id = "
.$comment_id."
                          AND user_id = "
.$user_id."
                          LIMIT 1"
);
              if (
$db->affected_rows()) {
                  
$comment    $db->fetch_assoc();
                  
                  
$db->query("UPDATE #__user_activity
                              SET total_profile_comments = CASE WHEN total_profile_comments > 0 THEN total_profile_comments-1 ELSE 0 END
                              WHERE user_id = "
.$user_id."
                              LIMIT 1"
);
                  
$db->query("DELETE FROM #__user_comments
                              WHERE comment_id = "
.$comment_id."
                              LIMIT 1"
);
                      
                  
$data['msg']    = __('comment-delete-success');
                  
$data['status']    = 1;
              } else {
                  
$data['msg'] = __('comment-missing');
              }
          } else {
              
$data['msg'] = __('comment-login-delete');
          }
    } else {
          
$data['msg'] = 'Invalid ajax request!?';
    }
    
    return 
json_encode($data);
}
Онлайн: 0
Реклама