/** * Function : setup_module() * Purpose : call back function to set up variables * used in PageRenderer class * To see how it is used see api/PageRenderer/PageRenderer.php * @param $column - string - contains left, middle, right * position of the block module * @param $moduleName - string - contains name of the block module * @param $obj - object - object reference of the block module * @return type string - returns skip means skip the block module * returns rendered html code of block module */ function setup_module($column, $module, $obj) { global $network_info, $paging; $user_name = PA::$page_user->login_name; switch ($module) { case 'EventCalendarSidebarModule': $obj->assoc_id = PA::$page_uid; $obj->assoc_type = "user"; // this is the personal calendar if (PA::$login_uid != PA::$page_uid) { $obj->may_edit = false; } else { $obj->may_edit = true; } break; case 'UserPhotoModule': $obj->block_type = 'UserPhotoBlock'; $obj->uid = PA::$page_uid; break; case 'ImagesModule': PA::$page_uid == PA::$login_uid ? $obj->title = 'My Gallery' : ($obj->title = sprintf(__("%s's Gallery"), ucfirst($user_name))); $obj->uid = PA::$page_uid; break; case 'AboutUserModule': $obj->mode = PUB; $obj->title = 'About:'; $obj->block_type = 'AboutUser'; $obj->uid = PA::$page_uid; break; case 'FlickrModule': $obj->block_type = 'UserPhotoBlock'; $obj->uid = PA::$page_uid; break; case 'RelationsModule': PA::$page_uid == PA::$login_uid ? $obj->title = 'My Relations' : ($obj->title = sprintf(__("%s's Relations"), ucfirst($user_name))); $obj->uid = PA::$page_uid; break; case 'MyNetworksModule': PA::$page_uid == PA::$login_uid ? $obj->title = 'My Networks' : ($obj->title = sprintf(__("%s's Networks"), ucfirst($user_name))); $obj->uid = PA::$page_uid; break; case 'MyLinksModule': PA::$page_uid == PA::$login_uid ? $obj->title = 'My Links' : ($obj->title = sprintf(__("%s's Links"), ucfirst($user_name))); $obj->uid = PA::$page_uid; break; case 'MyGroupsModule': $obj->block_type = 'usergroups'; $obj->uid = PA::$page_uid; PA::$page_uid == PA::$login_uid ? $obj->title = 'My Groups' : ($obj->title = sprintf(__("%s's Groups"), ucfirst($user_name))); break; case 'InRelationModule': $status = null; $extra = unserialize($network_info->extra); if ($extra['reciprocated_relationship'] == NET_YES) { $status = APPROVED; // If the network operator has enabled reciprocated relationships, show only approved friends, otherwise all friends will be listed. } $relations_ids = Relation::get_all_user_ids((int) PA::$page_uid, 6, $cnt = FALSE, $show = 'ALL', $page = 0, $sort_by = 'created', $direction = 'DESC', $status); $obj->user_name = PA::$page_user->first_name; $obj->uid = PA::$page_uid; $obj->links = $relations_ids; break; case 'RecentCommentsModule': PA::$page_uid == PA::$login_uid ? $obj->title = 'My Comments' : ($obj->title = sprintf(__("%s's Comments"), ucfirst($user_name))); $obj->block_type = 'usercomments'; $obj->uid = PA::$page_uid; break; case 'ShowContentModule': global $post_type_message; if (!empty($_GET['post_type'])) { $post_type = $_GET['post_type']; } else { $post_type = 'all'; } $content_type = get_content_type($post_type); $obj->cid = @$_GET['cid']; $obj->mode = PUB; $obj->block_type = HOMEPAGE; $obj->content_type = $content_type; $obj->uid = PA::$page_uid; $obj->block_heading = sprintf(__("%s's Blog"), PA::$page_user->first_name); $obj->message = $post_type_message[$post_type]; $obj->Paging["page"] = 1; $obj->Paging["show"] = 10; break; case 'LinkModule': $delicious_id = PA::$page_user->get_profile_field('external', 'delicious'); if (!$delicious_id) { return "skip"; } $obj->block_type = 'UserPhotoBlock'; $obj->delicious_id = $delicious_id; $obj->title = 'Delicious'; break; case 'ProfileFeedModule': $profile_feeds = UserProfileFeed::get_user_profile_feeds(PA::$page_uid, PA::$login_uid); if (empty($profile_feeds)) { return 'skip'; } $obj->profile_feeds = $profile_feeds; $obj->title = PA::$page_user->first_name . "'s " . $obj->title; break; case 'ShowTestimonialModule': //FIXME: probably querying testimonials at least twice here - //once to determine whether to skip, and once or more inside //ShowTestimonialModule. $count_testimonial = Testimonials::count_testimonials(PA::$page_uid, APPROVED); if ($count_testimonial == 0) { return 'skip'; } $obj->testimonial_status = APPROVED; $obj->title = ucfirst(PA::$page_user->first_name) . "'s testimonials"; $obj->mode = PUB; $obj->Paging["page"] = $paging["page"]; $obj->Paging["show"] = 3; break; case 'ShowUserCommentModule': //FIXME: probably querying comments at least twice here - once to //determine whether to skip, and once or more inside //ShowUserCommentModule to actually get the comments. $count_comment = Comment::count_comment(PA::$page_uid, TYPE_USER); if ($count_comment == 0) { return 'skip'; } $obj->Paging["page"] = $paging["page"]; $obj->Paging["show"] = 3; $obj->title = 'Comments for ' . ucfirst(PA::$page_user->first_name); break; } }
} $content_type = get_content_type($post_type); // this Function is define in user_page_function.php // Loading user relations (relation ids) $extra = unserialize($network_info->extra); $status = null; if (@$extra['reciprocated_relationship'] == NET_YES) { $status = APPROVED; /* Network operator has enables Reciprocated Relation then show show only approved friends otherwise all friends will be listed.*/ } $onload = "ajax_call_method(ajax_titles, {$uid}, ajax_urls);"; //code for checking whether user has any feed in its profile require_once "{$path_prefix}/api/ExternalFeed/ExternalFeed.php"; require_once "{$path_prefix}/ext/UserProfileFeed/UserProfileFeed.php"; $profile_feeds = UserProfileFeed::get_user_profile_feeds($uid, $uid); if (count($profile_feeds)) { foreach ($profile_feeds as $feed) { $current_feed_data[] = $feed; break; } } //$user = new User(); Hack who added this line. This just reset the whole user and his data is not available $params_profile = array(','); $field_type = GENERAL; $params_profile = array('field_name' => 'BlogSetting', 'user_id' => $_SESSION['user']['id']); $data_profile = User::get_profile_data($params_profile); function setup_module($column, $moduleName, $obj) { global $user, $setting_data, $flickr_id, $flickr_nsid, $delicious_id, $uid; global $content_type, $post_type_message, $paging, $post_type_message, $post_type, $profile_feeds, $base_url, $count_testimonial, $paging;