Вход Регистрация
Файл: adultscript-2.0.3-pro/files/mobile/templates/default/extend/ajax/comment_approve.plugin.php
Строк: 32
<?php
defined
('_VALID') or die('Restricted Access!');
function 
ajax_plugin_comment_approve()
{
    
$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.mobile');
          
              
$comment_id = (int) trim($_POST['comment_id']);
              
              
$db VF::factory('database');
              
$db->query("SELECT c.video_id, v.user_id
                          FROM #__video_comments AS c
                          LEFT JOIN #__video AS v ON (v.video_id = c.video_id AND v.status = 1)
                          WHERE comment_id = "
.$comment_id."
                          LIMIT 1"
);
              if (
$db->affected_rows()) {
                  
$data        $db->fetch_assoc();
                  
$video_id    = (int) $data['video_id'];
                  
$vuser_id    = (int) $data['user_id'];
                  
                  if (
$user_id == $vuser_id) {
                      
$db->query("UPDATE #__video_comments
                                  SET status = '1'
                                  WHERE comment_id = "
.$comment_id."
                                LIMIT 1"
);

                      
$data['msg']    = __('comment-approve-success');
                      
$data['status']    = 1;
                  } else {
                      
$data['msg'] = __('comment-approve-access');
                  }
              } else {
                  
$data['msg'] = __('comment-missing');
              }
          } else {
              
$data['msg'] = __('comment-approve-delete');
          }
    } else {
          
$data['msg'] = 'Invalid ajax request!?';
    }
    
    return 
json_encode($data);
}
Онлайн: 0
Реклама