function show_amazon_s3_image($picture_path, $max_x, $max_y, $extra_attrs = "") { if (!isset($picture_path) || empty($picture_path)) { $defaultImg = PA::$url . '/files/default.png'; return ImageResize::display_image_from_url($defaultImg, $max_x, $max_y, $extra_attrs); } if (preg_match("|^http://|", $picture_path)) { return ImageResize::display_image_from_url($picture_path, $max_x, $max_y, $extra_attrs); } else { $full_amazon_path = get_full_amazon_s3_url($picture_path); return ImageResize::display_image_from_url($full_amazon_path, $max_x, $max_y, $extra_attrs); } }
function get_links() { // Loading the Searching data if ($this->sort_by == 'alphabetic') { $this->sort_by = 'login_name'; $sorting_direction = 'ASC'; } else { $this->sort_by = 'display_name'; $sorting_direction = 'ASC'; } $this->only_with_photo = !$this->no_photo_ok; $extra_condition = null; if ($this->only_with_photo) { $extra_condition = "U.picture IS NOT NULL"; } $users = array(); $this->users_data = array(); if (empty($this->search_data)) { $this->search_data = @$this->search; } if ($this->search_data) { // load users on the basis of the search parameters. if ($this->only_with_photo) { $users_count = User::user_search($this->search_data, $this->viewer_uid, PA::$network_info->network_id, TRUE, 'ALL', 0, 'U.' . $this->sort_by, 'DESC', $extra_condition); $this->Paging["count"] = $users_count['total_users']; $users = User::user_search($this->search_data, $this->viewer_uid, PA::$network_info->network_id, FALSE, $this->Paging["show"], $this->Paging["page"], 'U.' . $this->sort_by, $sorting_direction, $extra_condition); } else { $users_count = User::user_search($this->search_data, $this->viewer_uid, PA::$network_info->network_id, FALSE); $this->Paging["count"] = $users_count['total_users']; $users = User::user_search($this->search_data, $this->viewer_uid, PA::$network_info->network_id, FALSE, $this->Paging["show"], $this->Paging["page"], 'U.' . $this->sort_by, $sorting_direction); } } else { if ($this->only_with_photo) { $this->Paging["count"] = Network::get_network_members(PA::$network_info->network_id, array('cnt' => TRUE, 'extra_condition' => $extra_condition)); $params = array('page' => $this->Paging["page"], 'show' => $this->Paging["show"], 'sort_by' => $this->sort_by, 'direction' => $sorting_direction, 'extra_condition' => $extra_condition); $users = Network::get_network_members(PA::$network_info->network_id, $params); } else { $this->Paging["count"] = Network::get_network_members(PA::$network_info->network_id, array('cnt' => TRUE)); $params = array('page' => $this->Paging["page"], 'show' => $this->Paging["show"], 'sort_by' => $this->sort_by, 'direction' => $sorting_direction); $users = Network::get_network_members(PA::$network_info->network_id, $params); } } // Parag Jagdale - 10-17-10: Modified to support new avatar image URL, width and height $users_count = count(@$users['users_data']); $users_to_show = array(); if ($users_count) { $user_profiles = $this->get_profile_data($users['users_data']); for ($cnt = 0; $cnt < $users_count; $cnt++) { $userCreatedDate = $users['users_data'][$cnt]['created']; $userLoginDate = $users['users_data'][$cnt]['last_login']; if ($userCreatedDate != $userLoginDate) { if (!isset($user_profiles[$cnt]['avatar']) || empty($user_profiles[$cnt]['avatar'])) { $users['users_data'][$cnt]['avatar'] = PA::$url . '/files/default.png'; $big_img['url'] = PA::$url . '/files/default.png'; $users['users_data'][$cnt]['big_picture'] = $big_img['url']; } else { if (preg_match("|^http://|", $user_profiles[$cnt]['avatar'])) { $users['users_data'][$cnt]['big_picture'] = $user_profiles[$cnt]['avatar']; $users['users_data'][$cnt]['big_picture_width'] = $user_profiles[$cnt]['avatar_width']; $users['users_data'][$cnt]['big_picture_height'] = $user_profiles[$cnt]['avatar_height']; } else { $amazon_full_url = get_full_amazon_s3_url($user_profiles[$cnt]['avatar']); $users['users_data'][$cnt]['big_picture'] = $amazon_full_url; } } $users_to_show['users_data'][$cnt] = array_merge($user_profiles[$cnt], $users['users_data'][$cnt]); } } $this->users_data = $users_to_show['users_data']; } }