addAlert("danger", lang("ACCESS_DENIED")); if (isset($_POST['ajaxMode']) and $_POST['ajaxMode'] == "true") { echo json_encode(array("errors" => 1, "successes" => 0)); } else { header('Location: ../pm.php'); } exit; } if (isset($msg_id) && $msg_id >= 1) { $parent_id = $msg_id; } else { $parent_id = NULL; } // Call the function to create a message with the required data if ($isreply = '0' or '1') { if (!createMessage($sender_id, $receiver_id, $title, $message, $parent_id)) { echo json_encode(array("errors" => 1, "successes" => 0)); exit; } } else { addAlert("danger", "some bad data here"); echo json_encode(array("errors" => 1, "successes" => 0)); exit; } restore_error_handler(); if (isset($_POST['ajaxMode']) and $_POST['ajaxMode'] == "true") { echo json_encode(array("errors" => 0, "successes" => 1)); } else { header('Location: ' . getReferralPage()); exit; }
// Add alerts for any failed input validation foreach ($validator->errors as $error) { addAlert("danger", $error); } if (count($validator->errors) > 0) { apiReturnError($ajax, getReferralPage()); } if ($user_id) { // Special case to load groups for the logged in user if ($user_id == "0") { $user_id = $loggedInUser->user_id; } // Attempt to load group information for the specified user. if (!($results = loadUserGroups($user_id))) { apiReturnError($ajax, getReferralPage()); } } else { if ($group_id) { // Attempt to load information for the specified group. if (!($results = loadGroup($group_id))) { apiReturnError($ajax, getReferralPage()); } } else { // Attempt to load information for all groups if (!($results = loadGroups())) { apiReturnError($ajax, getReferralPage()); } } } restore_error_handler(); echo json_encode($results);
function checkLoggedInUser($ajax) { if (!isUserLoggedIn()) { addAlert("danger", lang("LOGIN_REQUIRED")); apiReturnError($ajax, getReferralPage()); } }
} else { $error_count++; } } } // Add groups if (!empty($add_groups)) { // Convert string of comma-separated group_id's into array $group_ids_arr = explode(',', $add_groups); foreach ($group_ids_arr as $group_id) { if (addUserToGroup($user_id, $group_id)) { $success_count++; } else { $error_count++; } } } // Set primary group (must be done after group membership is set) if ($primary_group_id && $userdetails['primary_group_id'] != $primary_group_id) { if (updateUserPrimaryGroup($user_id, $primary_group_id)) { $success_count++; } else { $error_count++; } } restore_error_handler(); if ($error_count > 0) { apiReturnError($ajax, getReferralPage()); } else { apiReturnSuccess($ajax, getReferralPage()); }
require_once "../models/config.php"; // Recommended admin-only access if (!securePage(__FILE__)) { if (isset($_POST['ajaxMode']) and $_POST['ajaxMode'] == "true") { echo json_encode(array("errors" => 1, "successes" => 0)); } else { header("Location: " . getReferralPage()); } exit; } $validator = new Validator(); // Look up specified user $selected_user_id = $validator->requiredGetVar('id'); if (!is_numeric($selected_user_id) || !userIdExists($selected_user_id)) { addAlert("danger", "I'm sorry, the user id you specified is invalid!"); header("Location: " . getReferralPage()); exit; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <title>PHP Reports Admin - User Details</title> <?php