$wall_object = !$wall_object && isset($_GET['wall_object']) ? $_GET['wall_object'] : $wall_object; $wall_object_id = isset($_POST['wall_object_id']) ? $_POST['wall_object_id'] : false; $wall_object_id = !$wall_object_id && isset($_GET['wall_object_id']) ? $_GET['wall_object_id'] : $wall_object_id; if ($wall_object == 'userhome') { $action_object_owner = 'user'; } 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);
function delete_group_actions($group_id) { global $user; if (!$group_id || !$user->user_exists) { return false; } // get user rank $query = he_database::placeholder("SELECT `groupmember_rank` FROM `se_groupmembers`\r\n WHERE `groupmember_user_id`=? AND `groupmember_group_id`=?", $user->user_info['user_id'], $group_id); $user_rank = he_database::fetch_field($query); if ($user_rank != 2) { return false; } $query = he_database::placeholder("SELECT `action_id`, `action_user_id` FROM `se_actions`\r\n WHERE `action_object_owner`='group' AND `action_object_owner_id`=?", $group_id); $actions = he_database::fetch_column($query, true); foreach ($actions as $action_id => $user_id) { he_wall::remove_action($user_id, $action_id); } $query = he_database::placeholder("DELETE FROM `se_actions`\r\n WHERE `action_object_owner`='group' AND `action_object_owner_id`=?", $group_id); he_database::query($query); }