Exemplo n.º 1
0
} else {
    $action_object_owner = $wall_object;
}
//TASKS
$headers_sent = false;
if ($task == 'hide_action' && $user->user_exists) {
    $action_id = isset($_POST['action_id']) ? (int) $_POST['action_id'] : 0;
    $result = he_wall::hide_action($user->user_info['user_id'], $action_id);
} elseif ($task == 'remove_action' && $user->user_exists) {
    $action_id = isset($_POST['action_id']) ? (int) $_POST['action_id'] : 0;
    $result = he_wall::remove_action($user->user_info['user_id'], $action_id);
} elseif ($task == 'like_action') {
    $action_id = isset($_POST['action_id']) ? (int) $_POST['action_id'] : 0;
    $result = he_wall::like_action($user->user_info['user_id'], $action_id);
    if ($result['like']) {
        he_wall::new_like_notify($action_id);
    }
} elseif ($task == 'add_comment') {
    $action_id = isset($_POST['action_id']) ? (int) $_POST['action_id'] : 0;
    $text = isset($_POST['text']) ? trim($_POST['text']) : '';
    if (strlen($text) > 1000) {
        $result = array('result' => 0, 'message' => SE_Language::get(690706058));
    } elseif ($comment_id = he_wall::add_comment($user->user_info['user_id'], $action_id, $text)) {
        $comment_info = he_wall::get_comment($comment_id);
        $comment_info['text'] = he_wall_format_text($comment_info['text']);
        he_wall::new_comment_notify($action_id);
        $result = array('result' => 1, 'comment_info' => $comment_info);
    } else {
        $result = array('result' => 0, 'message' => 'Error');
    }
} elseif ($task == 'delete_comment') {