/** !! * Get all of the data to be rendered, but no rendering is done in here * This sets { @link $uid },{ @link $user } , { @link $login_uid }, and the title * @todo These parameters do nothing */ public function initializeModule($request_method, $request_data) { switch ($this->page_id) { case PAGE_USER_PRIVATE: $this->title = __('About Me'); if (!empty(PA::$login_uid)) { $this->uid = PA::$login_uid; $this->user = PA::$login_user; $this->login_uid = PA::$login_uid; } break; case PAGE_USER_PUBLIC: default: $this->uid = PA::$page_uid; $this->user = PA::$page_user; if (!empty(PA::$login_uid)) { $this->login_uid = PA::$login_uid; } $this->title = __("About") . " " . ucfirst(PA::$page_user->display_name); } $user_generaldata = User::load_user_profile((int) $this->uid, $this->login_uid, GENERAL); $this->general_info = sanitize_user_data($user_generaldata); if (isset($this->general_info)) { if (!isset($this->general_info['about'])) { return 'skip'; } else { if (empty($this->general_info['about'])) { return 'skip'; } } } else { return 'skip'; } }
function render() { if (empty($this->user)) { $this->user = new User(); $this->user->load((int) $this->uid); } $user_socialdata = User::load_user_profile((int) $this->uid, $this->login_uid, SOCIAL); $this->professional_info = sanitize_user_data($user_socialdata); $this->inner_HTML = $this->generate_inner_html(); $content = parent::render(); return $content; }
function initializeModule($request_method, $request_data) { global $error_msg; if ($this->column == 'middle') { $this->page_size = 10; $this->page = !empty($request_data['page']) ? $request_data['page'] : 0; $this->title = PA::$network_info->name . ' ' . __('Leader Board'); $this->outer_template = 'outer_public_center_module.tpl'; $this->set_inner_template('module_middle.tpl.php'); } else { $this->page = 0; $this->title = __('Leader Board'); $this->page_size = 5; $this->outer_template = 'outer_public_side_module.tpl'; $this->set_inner_template('module_default.tpl.php'); $this->view_all_url = PA::$url . PA_ROUTE_LEADER_BOARD; } $pagination_links = null; $users_ranking = array(); $act = array(); $users_counter_increment = 0; $nb_items = UserPopularity::countUserPopularity(); if ($nb_items > 0) { $rankings = UserPopularity::listUserPopularity(null, 'popularity', 'DESC'); $max_rank = $rankings[0]->get_popularity(); $pagination = UserPopularity::getPagging($rankings, $this->page_size, $this->page); $page_items = $pagination->getPageItems(); foreach ($page_items as $idx => $item) { try { $user = new User(); $user->load((int) $item->get_user_id()); $user_generaldata = User::load_user_profile($item->get_user_id(), PA::$login_uid, GENERAL); $user->profile_info = sanitize_user_data($user_generaldata); $user->ranking_points = $item->get_popularity(); $user->ranking_stars = intval($user->ranking_points * 5 / $max_rank); $user->last_activity = $item->get_time(); $users_ranking[$idx] = $user; // Grab the recent activities of the user $act[$idx] = Activities::get_activities(array("limit" => 3), array("subject" => $item->get_user_id(), "status" => "new")); } catch (Exception $e) { $error_msg = "Exception in LeaderBoardModule, message: <br />" . $e->getMessage(); return 'skip'; } } $pagination_links = $pagination->getPaggingLinks(PA::$url . PA_ROUTE_LEADER_BOARD, 'page', 'pagging', 'pagging_selected'); $users_counter_increment = $this->page_size * $this->page; } $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'users_ranking' => $users_ranking, 'pagination_links' => $pagination_links, 'increment' => $users_counter_increment, 'activities' => $act)); }
function render() { $this->user = new User(); $this->user->load((int) $this->uid); $this->title = sprintf(__('About: %s'), chop_string($this->user->login_name, 12)); $user_generaldata = User::load_user_profile((int) $this->uid, $this->login_uid, GENERAL); $this->general_info = sanitize_user_data($user_generaldata); $user_personaldata = User::load_user_profile((int) $this->uid, $this->login_uid, PERSONAL); $this->personal_info = sanitize_user_data($user_personaldata); $user_professionaldata = User::load_user_profile((int) $this->uid, $this->login_uid, PROFESSIONAL); $this->professional_info = sanitize_user_data($user_professionaldata); $this->inner_HTML = $this->generate_inner_html(); $content = parent::render(); return $content; }
/** !! * This uses the data generated by { @link initializeModule() } and gets * the data from the user profile and puts it in blocks of data that can * be used to easily output it to the page. * It is setting {@link $general_info }, {@link $personal_info }, * and {@link $professional_info } * * @return string $content The html code specific to this module, and its outer html * * @todo remove the backword compat issue commented in the function */ function render() { if (empty($this->user)) { //kept for backword compatibility. Can we removed later on when any module on any page refactoring is done. $this->user = new User(); $this->user->load((int) $this->uid); } // $this->title = sprintf(__('About: %s'), chop_string($this->user->login_name, 12)); $user_generaldata = User::load_user_profile((int) $this->uid, $this->login_uid, GENERAL); $this->general_info = sanitize_user_data($user_generaldata); $user_personaldata = User::load_user_profile((int) $this->uid, $this->login_uid, PERSONAL); $this->personal_info = sanitize_user_data($user_personaldata); $user_professionaldata = User::load_user_profile((int) $this->uid, $this->login_uid, PROFESSIONAL); $this->professional_info = sanitize_user_data($user_professionaldata); $this->inner_HTML = $this->generate_inner_html(); $content = parent::render(); return $content; }
function get_profile_data($users_data) { $facewall_trunkwords = 7; $facewall_maxlength = 8; $out_data = array(); $viewer_uid = 0; if (!empty(PA::$login_uid)) { $viewer_uid = PA::$login_uid; } $i = 0; foreach ($users_data as $user) { $u = new User(); $u->load((int) $user['user_id']); $profile_data = User::load_user_profile($user['user_id'], $viewer_uid); $profile_data = sanitize_user_data($profile_data); $out_data[$i]['display_name'] = $u->display_name; $out_data[$i]['user_url'] = url_for('user_blog', array('login' => urlencode($user['login_name']))); $out_data[$i]['nickname'] = strlen($user['login_name']) > $facewall_maxlength ? substr($user['login_name'], 0, $facewall_trunkwords) . ' ...' : $user['login_name']; $out_data[$i]['location'] = field_value(@$profile_data['city'], ' '); $age = ' '; if (!empty($profile_data['dob'])) { $age = convert_birthDate2Age($profile_data['dob']); } $out_data[$i]['age'] = $age; $out_data[$i]['gender'] = field_value(@$profile_data['sex'], ' '); $out_data[$i]['effect']['event'] = 'baloon.say'; if (empty($profile_data['sub_caption'])) { $profile_data['sub_caption'] = 'Hi.'; } $out_data[$i]['effect']['shoutout'] = $profile_data['sub_caption']; $i++; } return $out_data; }
/** * This function will return true or false on basis of whether custom user header is allowed in the theme or not. * if 'headerImageOk' element in config.xml is 'yes' then custom header is allowed otherwise not */ function is_custom_header_allowed($uid) { $return = false; $current_skin = sanitize_user_data(User::load_user_profile($uid, $uid, 'skin')); if (empty($current_skin)) { $return = true; } else { $skin_info = skin_details($current_skin['theme']); $flag = $skin_info['headerImageOk']; $return = $flag == 'yes' || $flag == 'yes' ? true : false; } return $return; }
function get_profile_data($users_data) { $facewall_trunkwords = 7; $facewall_maxlength = 8; $out_data = array(); $viewer_uid = 0; if (!empty(PA::$login_uid)) { $viewer_uid = PA::$login_uid; } $i = 0; foreach ($users_data as $user) { $u = new User(); $u->load((int) $user['user_id']); $profile_data = User::load_user_profile($user['user_id'], $viewer_uid); $profile_data = sanitize_user_data($profile_data); $out_data[$i]['display_name'] = $u->display_name; $out_data[$i]['user_url'] = url_for('user_blog', array('login' => urlencode($user['login_name']))); $out_data[$i]['nickname'] = strlen($user['login_name']) > $facewall_maxlength ? substr($user['login_name'], 0, $facewall_trunkwords) . ' ...' : $user['login_name']; $city = ' '; if (!empty($profile_data['city'])) { $city = $profile_data['city']; } $out_data[$i]['location'] = $city; $age = ' '; if (!empty($profile_data['dob'])) { $age = convert_birthDate2Age($profile_data['dob']); } $out_data[$i]['age'] = $age; $sex = ' '; if (!empty($profile_data['sex'])) { $sex = $profile_data['sex']; } $out_data[$i]['gender'] = $sex; $physical_info_body_height = ' '; if (!empty($profile_data['physical_info_body_height'])) { $physical_info_body_height = $profile_data['physical_info_body_height']; } $out_data[$i]['height'] = $physical_info_body_height; $physical_info_body_weight = ' '; if (!empty($profile_data['physical_info_body_weight'])) { $physical_info_body_weight = $profile_data['physical_info_body_weight']; } $out_data[$i]['weight'] = $physical_info_body_weight; $physical_info_body_measurements = ' '; if (!empty($profile_data['physical_info_body_measurements'])) { $physical_info_body_measurements = $profile_data['physical_info_body_measurements']; } $out_data[$i]['measurements'] = $physical_info_body_measurements; $birthplace = ' '; if (!empty($profile_data['birthplace'])) { $birthplace = $profile_data['birthplace']; } $out_data[$i]['birthplace'] = $birthplace; $facebook = ' '; if (!empty($profile_data['facebook'])) { $facebook = $profile_data['facebook']; } $out_data[$i]['facebook'] = $facebook; $out_data[$i]['effect']['event'] = 'baloon.say'; if (empty($profile_data['sub_caption'])) { $profile_data['sub_caption'] = 'Hi.'; } $out_data[$i]['effect']['shoutout'] = $profile_data['sub_caption']; $i++; } return $out_data; }
$PeopleModule = new PeopleModule(); require dirname(__FILE__) . '/peoples_helper.php'; $PeopleModule->search_data = $search_data_array; if (!empty($_GET['sort_by'])) { $PeopleModule->sort_by = $_GET['sort_by']; } $PeopleModule->Paging = $paging; $PeopleModule->Paging["show"] = $rows * FACEWALL_COLUMN_COUNT; $PeopleModule->get_links(); $users_data = $PeopleModule->users_data; if (count($users_data)) { $xml_obj = new DomDocument(); $buddylist = $xml_obj->createElement('buddylist'); foreach ($users_data as $user) { $profile_data = User::load_user_profile($user['user_id'], $viewer_uid); $profile_data = sanitize_user_data($profile_data); $buddy = $xml_obj->createElement("buddy"); //adding idbuddy to the xml $idbuddy = $xml_obj->createElement("idbuddy"); $idbuddy->appendChild($xml_obj->createTextNode($user['user_id'])); $buddy->appendChild($idbuddy); //adding thumbnail to the xml if (empty($user['picture'])) { $user['picture'] = $current_theme_path . '/images/default.png'; } else { $img = uihelper_resize_mk_user_img($user['picture'], 80, 80, 'alt="PA"'); preg_match("/src=\"([^']*?)\"/", $img, $match); //preg_match to get the src of the image $user['picture'] = $match[1]; } $thumbnail = $xml_obj->createElement("thumbnail");
if (@$_GET['updated'] == 1) { $uploaded_msg = " Profile updated successfully"; $msg_tpl = new Template(CURRENT_THEME_FSPATH . "/display_message.php"); $msg_tpl->set('message', $uploaded_msg); $m = $msg_tpl->fetch(); $page->add_module("middle", "top", $m); } if (!empty($msg) || !empty($msg1) || !empty($msg2)) { $uploaded_msg = " Profile updated successfully"; $msg_tpl = new Template(CURRENT_THEME_FSPATH . "/display_message.php"); $msg_tpl->set('message', $msg . $msg1 . $msg2); $m = $msg_tpl->fetch(); $page->add_module("middle", "top", $m); } // see if we have a user defined CSS $user_data_ui = sanitize_user_data(User::load_user_profile($uid, $uid, 'ui')); if (isset($user_data_ui['newcss'])) { $usercss = '<style type="text/css">' . $user_data_ui['newcss'] . '</style>'; $page->add_header_html($usercss); } //To print delete message if (!empty($_GET['msg_id'])) { uihelper_error_msg($_GET['msg_id']); } // set caption value if (isset($user_data_general['user_caption'])) { $caption1 = chop_string($user_data_general['user_caption'], 20); } else { $caption1 = chop_string($user->first_name . " " . $user->last_name, 20); } if (isset($page_settings['body_attributes'])) {
/** !! * Assemble all data to create the interface for editing stlyes. Determine * if the user is editing a user, group or network style and include that * information as well. Send all information to { @link generate_inner_html() } * create the interface. * @todo: parameter $request_data is never used */ private function setupCustomizeStyle($request_data) { $css_path = PA::$theme_url . '/' . "css" . '/'; $js_path = PA::$theme_url . '/' . "js" . '/'; $this->renderer->add_page_js($js_path . 'iutil.js'); $this->renderer->add_page_js($js_path . 'json.js'); $this->renderer->add_page_js($js_path . 'idrag.js'); $this->renderer->add_page_js($js_path . 'isortables.js'); // for style editor $this->renderer->add_page_js($js_path . 'jsonStringify.js'); // $parameter .= js_includes('jquery.js'); $this->renderer->add_page_js($js_path . 'jquery.compat-1.0.js'); $this->renderer->add_page_js($js_path . 'configurator.js'); $this->renderer->add_page_js($js_path . 'conf_css.js'); $this->renderer->add_page_js($js_path . 'farbtastic.js '); // adding some New Css files require for this page only $this->renderer->add_header_css($css_path . "configurator.css"); $this->renderer->add_header_css($css_path . "farbtastic.css"); switch ($this->settings_type) { case 'user': $user = $this->shared_data['user_info']; $user_data_ui = sanitize_user_data(User::load_user_profile($user->user_id, $user->user_id, 'ui')); $json_data = !empty($user_data_ui['user_json']) ? $user_data_ui['user_json'] : null; break; case 'group': $extra = $this->shared_data['group_extra']; $json_data = !empty($extra['style']['user_json']) ? $extra['style']['user_json'] : null; break; case 'network': $extra =& $this->shared_data['extra']; $json_data = !empty($extra['network_json']) ? $extra['network_json'] : null; break; } // clean up the JSON a bit $json_data = preg_replace("/'/", '', $json_data); $this->set_inner_template('cnmodule_style.php'); $this->inner_HTML = $this->generate_inner_html(array('json_data' => $json_data, 'page_url' => $this->url, 'base_url' => $this->base_url, 'uid' => $this->uid, 'gid' => $this->gid, 'type' => 'style', 'settings_type' => $this->settings_type)); }
// Load Professional Data $user_professionaldata = User::load_user_profile($uid, (int) $_SESSION['user']['id'], PROFESSIONAL); $user_data_professional = sanitize_user_data($user_professionaldata); $data = array('user_data_general' => $user_data_general, 'user_data_personal' => $user_data_personal, 'user_data_professional' => $user_data_professional); $user_data_external = sanitize_user_data(User::load_user_profile($uid, $uid, 'external')); $delicious_id = @$user_data_external['delicious']; $flickr_id = @$user_data_external['flickr_email']; // try and get the Flickr nsid if user has imported profile $user_data_flickr = sanitize_user_data(User::load_user_profile($uid, $uid, 'flickr')); $flickr_nsid = @$user_data_flickr['nsid']; // Loading user relations (relation ids) $relations_ids = Relation::get_all_user_ids((int) $_SESSION['user']['id'], 5); // $onload="ajax_call_method(ajax_titles, $uid, ajax_urls);"; // see if we have a user defined CSS $user_data_ui = sanitize_user_data(User::load_user_profile($uid, $uid, 'ui')); $skin_var = sanitize_user_data(User::load_user_profile($uid, $uid, 'skin')); // accessing page settings data $setting_data = ModuleSetting::load_setting(PAGE_USER_PRIVATE, $uid); function setup_module($column, $moduleName, $obj) { global $logged_user, $setting_data, $flickr_id, $flickr_nsid, $delicious_id, $uid, $data; global $content_type, $post_type_message, $paging, $relations_ids, $post_type_message, $post_type; global $type, $user_data_ui, $skin_var, $setting_data, $user_info; switch ($moduleName) { case 'CustomizeUIModule': $obj->uid = $uid; $obj->type = $type; $obj->data = $data; $obj->user_data_ui = $user_data_ui; $obj->skin_var = $skin_var; $obj->setting_data = $setting_data;
if ($login_uid) { $parameter .= "<script language='javascript' type='text/javascript'>\n // var uid = {$login_uid};\n var page_id = {$page_id};\n </script>"; } // accessing page settings data $setting_data = ModuleSetting::load_setting(PAGE_USER_PRIVATE, $uid); //let's get all modules in a single array // let's see if we have collapsed modules $parameter .= "\n<script language='javascript' type='text/javascript'>\n"; $parameter .= "var collapsed"; if (@$setting_data['collapsed']) { require_once "JSON.php"; $json = new Services_JSON(); $parameter .= " = " . $json->encode($setting_data['collapsed']); } $parameter .= "\n</script>\n"; $user_data_external = sanitize_user_data(User::load_user_profile($uid, $uid, 'external')); $delicious_id = @$user_data_external['delicious']; if (!empty($_GET['post_type'])) { $post_type = $_GET['post_type']; } else { $post_type = 'all'; } $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.*/