$result = $upload_result;
        }
    }
} elseif ($task == 'paging') {
    $action_id = $_GET['action_id'];
    $count = $_GET['count'];
    $total_comments = he_wall::total_comments($action_id);
    $per_click = $setting['setting_he_wall_comments_per_page'];
    $per_click = $total_comments - $count - $per_click < 0 ? $total_comments - $count : $setting['setting_he_wall_comments_per_page'];
    $result_2 = he_wall::get_paging_comments($action_id, $total_comments - $count - $per_click, $per_click);
    $count = $result_2['count'];
    $action_comments = $result_2['action_comments'];
    ksort($action_comments);
    $smarty->assign('action_comments', $action_comments);
    $smarty->assign('action_id', $action_id);
    $result = array('action_id' => $action_id, 'count' => $count, 'html' => he_wall_include_footer_logic('he_wall_comments.tpl'));
}
// CONSTRUCT AND OUTPUT JSON
if (!$headers_sent) {
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // always modified
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Pragma: no-cache");
    // HTTP/1.0
    header("Content-Type: application/json");
}
echo json_encode($result);
exit;
function he_wall_actions_display($wall_object, $wall_object_id, $first_id = false, $last_id = false)
{
    global $user, $setting, $smarty;
    $setting_actions_visibility = 0;
    $setting_actions_actionsper = $setting['setting_actions_actionsonprofile'];
    if ($wall_object == 'user') {
        $owner = new se_user(array($wall_object_id));
        $actiontype_ids = he_wall::get_actiontype_ids();
        $actiontype_ids_str = implode(',', $actiontype_ids);
        $where_clause .= "\r\n             IF ( \r\n                se_actions.action_actiontype_id IN ({$actiontype_ids_str}),\r\n                ( se_actions.action_object_owner='user' AND se_actions.action_object_owner_id='{$owner->user_info['user_id']}'),\r\n                se_actions.action_user_id='{$owner->user_info['user_id']}'\r\n             )\r\n            ";
    } elseif ($wall_object == 'userhome') {
        $owner = new se_user(array($wall_object_id));
        $setting_actions_visibility = 10;
        $setting_actions_actionsper = $setting['setting_actions_actionsperuser'];
        $where_clause .= "1";
    } elseif ($wall_object == 'group') {
        $owner = new se_group($user->user_info['user_id'], $wall_object_id);
        $privacy_max = $owner->user_rank;
        $allow_post = (int) ($privacy_max != -1);
        $setting_actions_visibility = 10;
        $setting_actions_actionsper = $setting['setting_actions_actionsonprofile'];
        $where_clause .= "se_actions.action_object_owner='group' AND se_actions.action_object_owner_id='{$wall_object_id}'";
    } elseif ($wall_object == 'pages') {
        $setting_actions_visibility = 10;
        $where_clause .= " se_actions.action_object_owner='pages' AND se_actions.action_object_owner_id='{$wall_object_id}'";
    } else {
        $where_clause .= '';
    }
    $hidden_action_ids = he_wall::get_hidden_actions($user->user_info['user_id']);
    if ($hidden_action_ids) {
        $where_clause .= $where_clause != '' ? " AND " : '';
        $where_clause .= " se_actions.action_id NOT IN (" . implode(',', $hidden_action_ids) . ")";
    }
    $wall_actions = he_wall::actions_display($setting_actions_visibility, $setting_actions_actionsper, $where_clause, $last_id, $first_id);
    $action_owner_ids = array();
    foreach ($wall_actions as $key => $wall_action) {
        $action_owner_ids[] = $wall_action['action_user_id'];
    }
    $action_owner_ids = array_unique($action_owner_ids);
    $action_owners = he_wall::get_users($action_owner_ids);
    $action_ids = array();
    foreach ($wall_actions as $key => $wall_action) {
        $action_ids[] = $wall_action['action_id'];
        $wall_actions[$key]['owner'] = $action_owners[$wall_action['action_user_id']];
    }
    $action_likes = he_wall::get_likes($action_ids);
    $action_comments = he_wall::get_comments($action_ids);
    $video_actiontype_id = he_wall::video_actiontype_id();
    $smarty->assign('wall_actions', $wall_actions);
    $smarty->assign('action_likes', $action_likes);
    $smarty->assign('action_comments', $action_comments);
    $smarty->assign('video_actiontype_id', $video_actiontype_id);
    return array('action_ids' => $action_ids, 'html' => he_wall_include_footer_logic('he_wall_actions.tpl'));
}