/** !!
  * 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';
     }
 }
Example #2
0
function get_profile_info($uid, $section)
{
    $prof = array();
    foreach (User::load_user_profile($uid, NULL, $section) as $bits) {
        $prof[$bits['name']] = $bits['value'];
    }
    return $prof;
}
 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 for sanitizing the profile_feed_data to array like array('feed_id', 'title', 'blog_url', 'blog_feed')
  * TODO Add access permissions
  * $viewer_uid : User id of the user who is viewing the user's profile. It will be empty for anonymous user.
  */
 public static function get_user_profile_feeds($user_id, $viewer_uid = null)
 {
     Logger::log("Enter: UserProfileFeed::get_user_profile_feeds");
     $profile_data = User::load_user_profile($user_id, $viewer_uid, 'blogs_rss', 'seq ASC');
     $user_profile_feeds = array();
     // code for sanitizing the data to array('feed_id', 'title', 'blog_url', 'blog_feed')
     if (count($profile_data)) {
         $pervious_seq = null;
         $counter = -1;
         foreach ($profile_data as $key => $value) {
             if ($pervious_seq != $value['seq']) {
                 $user_profile_feeds[++$counter][$value['name']] = $value['value'];
                 $pervious_seq = $value['seq'];
             } else {
                 $user_profile_feeds[$counter][$value['name']] = $value['value'];
             }
         }
     }
     Logger::log("Exit: UserProfileFeed::get_user_profile_feeds");
     return $user_profile_feeds;
 }
Example #8
0
 public function save_profile_section($data, $type, $preserve = false)
 {
     $uid = $this->user_id;
     $array_user_data = array();
     if ($preserve) {
         $old_data = User::load_user_profile($this->user_id, $this->user_id, $type, null);
         // ensure we are NOT duplicating data here!!
         foreach ($old_data as $i => $d) {
             $k = $d['name'];
             if (empty($data[$k])) {
                 // only ever preserve if we are NOT submiting this field
                 $array_user_data[] = $d;
             }
         }
     }
     foreach ($data as $k => $v) {
         if (isset($v[1])) {
             // we have a collection here
             // make flat and pull out the sequence
             foreach ($v as $seq => $d) {
                 if (!is_int($seq)) {
                     continue;
                 }
                 // small cleanup
                 $field = $d;
                 // Array with keys 'value' and 'perm'
                 $field['uid'] = $uid;
                 $field['name'] = $k;
                 $field['type'] = $type;
                 $field['seq'] = $seq;
                 // we actually have a value here now
                 $array_user_data[] = $field;
             }
         } else {
             // standard case, single row
             $field = $v;
             // Array with keys 'value' and 'perm'
             $field['uid'] = $uid;
             $field['name'] = $k;
             $field['type'] = $type;
             $field['seq'] = NULL;
             $array_user_data[] = $field;
         }
     }
     try {
         $this->save_user_profile($array_user_data, $type);
     } catch (PAException $e) {
         throw $e;
         return false;
     }
     return true;
 }
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'])) {
Example #10
0
  }*/
$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];
        }
 /** !!
  * Invokes {@see load_user_profile()} to load the current user profile.
  * @param string $profile_type Must be one of the profile types (Basic, general, etc.)
  * @param int $user_id The ID of the user of which to fetch the profile.
  * @return array User profile as loaded by {@see load_user_profile()}
  */
 public function loadSection($profile_type, $user_id)
 {
     $section = NULL;
     switch ($profile_type) {
         case 'basic':
             $section = BASIC;
             break;
         case 'general':
             $section = GENERAL;
             break;
         case 'personal':
             $section = PERSONAL;
             break;
         case 'professional':
             $section = PROFESSIONAL;
             break;
     }
     return !is_null($section) ? User::load_user_profile($user_id, $user_id, $section) : FALSE;
 }
$pictures = Image::load_images($uid, 10);
// loading audio
$audios = Audio::load_audio($uid, 10);
// loading video
$videos = Video::load_video($uid, 10);
if ($_SESSION['user']['id']) {
    $user = new User();
    $user->load((int) $uid);
} else {
    header("Location: homepage.php?error=1");
}
// accessing page settings data
$setting_data = ModuleSetting::load_setting(4, $uid);
// user general info
$user_data_general = array();
$user_generaldata = User::load_user_profile($uid, (int) $_SESSION['user']['id'], GENERAL);
for ($i = 0; $i < count($user_generaldata); $i++) {
    $name = $user_generaldata[$i]['name'];
    $value = $user_generaldata[$i]['value'];
    $perm_name = $name . "_perm";
    $perm_value = $user_generaldata[$i]['perm'];
    $user_data_general["{$name}"] = $value;
    $user_data_general["{$perm_name}"] = $perm_value;
}
// relations
if ($_SESSION['user']['id']) {
    // user Relations (user relations with all informations)
    $relations = Relation::get_all_relations((int) $uid);
}
$users = User::allUsers_with_paging(1, 10);
$module1 = new ImagesModule($pictures);
Example #13
0
 public static function load_profile_section($uid, $slot, $order_by = null)
 {
     $user_profile = User::load_user_profile($uid, $uid, $slot, $order_by);
     $profile_data = array();
     $c = count($user_profile);
     for ($i = 0; $i < $c; $i++) {
         $k = $user_profile[$i]['name'];
         $v = $user_profile[$i];
         if ($v['seq']) {
             // we have several rows for this name
             // it belongs to a collection
             $profile_data[$k][$v['seq']] = $v;
         } else {
             // there is only one of this kind
             $profile_data[$k] = $v;
         }
     }
     return $profile_data;
 }
                     // a user, then it skipped that user
                     // and continue to send bulletin to other users.
                 }
                 $my_messages_url = PA::$url . '/' . FILE_MYMESSAGE;
                 $sender_url = url_for('user_blog', array('login' => $user->login_name));
                 $params = array('first_name_sender' => $user->first_name, 'first_name_recipient' => $to_member['users_data'][$counter]['first_name'], 'sender_id' => $user->user_id, 'recipient_id' => $to_uid, 'recipient_email' => $to_member['users_data'][$counter]['email'], 'my_messages_url' => $my_messages_url, 'sender_url' => $sender_url, 'config_site_name' => $config_site_name);
                 auto_email_notification('msg_waiting', $params);
             }
         }
     }
 }
 if (!empty($_POST['mail'])) {
     // posting the bulletin to registered email
     for ($i = 0; $i < count($to_member['users_data']); $i++) {
         $to_uid = $to_member['users_data'][$i]['user_id'];
         $user_profile = User::load_user_profile($to_uid, $to_uid, 'notifications');
         if (!empty($user_profile)) {
             $notify = unserialize($user_profile[0]['value']);
             $destination = $notify['bulletin_sent']['value'];
             if ($destination == NET_EMAIL || $destination == NET_BOTH) {
                 $inv_user_email = $to_member['users_data'][$i]['email'];
                 $mail_type = 'bulletins';
                 try {
                     $check = pa_mail($inv_user_email, $mail_type, $array_of_data, $user->email);
                 } catch (PAException $e) {
                     $error_msg .= $e->message;
                 }
             }
         }
     }
 }
 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;
 }
 protected function sendNotification()
 {
     if (empty($this->message_obj->template_vars["%requester.user_id%"]) || empty($this->message_obj->template_vars["%recipient.login_name%"])) {
         Logger::log("Error exit: function MessageDispatcher::sendNotification() - Missing Recipient or Requester info.");
         throw new Exception("MessageDispatcher::sendNotification() - Missing Recipient or Requester info.");
     }
     $recipient_notif_settings = null;
     $destination = NET_NONE;
     // initial set to NONE
     $msg_waiting_blink = NET_NONE;
     // initial set to NONE
     $msg_categ = $this->message_obj->message['category'];
     $recipient_id = $this->message_obj->template_vars["%recipient.user_id%"];
     $recipient_profile = User::load_user_profile($recipient_id, $recipient_id, 'notifications');
     if (!empty($recipient_profile)) {
         $recipient_notif_settings = unserialize($recipient_profile[0]['value']);
     }
     if ($msg_categ == 'notify_network_owner') {
         // get network notification settings and notify network owner
         $extra = unserialize(PA::$network_info->extra);
         if (isset($extra['notify_owner'][$this->message_type]['value'])) {
             $destination = $extra['notify_owner'][$this->message_type]['value'];
         } else {
             // temporrary solution - if no notification settings data defined for a message
             $destination = NET_BOTH;
             // message category is 'notify_network_owner', so notify owner
         }
     } else {
         if ($msg_categ == 'notify_group_owner') {
             $destination = NET_BOTH;
             // temporrary solution - currently there is no group notification settings
         } else {
             if (!empty($recipient_notif_settings) && isset($recipient_notif_settings[$this->message_type]['value'])) {
                 $destination = $recipient_notif_settings[$this->message_type]['value'];
             }
         }
     }
     if ($msg_categ == 'outgoing_email') {
         $destination = NET_EMAIL;
         // override destination if message category is outgoing_email
     }
     if ($destination != NET_NONE) {
         $email_recipient = $this->message_obj->template_vars["%recipient.email_address%"];
         $requester = $this->message_obj->template_vars["%requester.user_id%"];
         $recipient = $this->message_obj->template_vars["%recipient.login_name%"];
         switch ($destination) {
             case NET_MSG:
                 self::internalMessage($recipient, $requester);
                 // only send message_waiting if the user isn't already recieving the message as email ^^
                 if (isset($recipient_notif_settings['msg_waiting_blink']) && $recipient_notif_settings['msg_waiting_blink'] == NET_EMAIL) {
                     $msg_waiting_blink = $recipient_notif_settings['msg_waiting_blink'];
                 }
                 break;
             case NET_EMAIL:
                 self::sendEmail($email_recipient);
                 break;
             case NET_BOTH:
                 self::internalMessage($recipient, $requester);
                 self::sendEmail($email_recipient);
                 break;
         }
     }
     if ($msg_waiting_blink == NET_EMAIL) {
         $recipient_id = $this->message_obj->template_vars["%recipient.user_id%"];
         $recipient = new User();
         $recipient->load((int) $recipient_id);
         $requester = PA::$network_info;
         // msg_waiting_blink message is sent by network owner
         PAMail::send("msg_waiting_blink", $recipient, $requester, array());
     }
 }
 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;
 }
function peopleaggregator_getUserProfile($args)
{
    // global var $_base_url has been removed - please, use PA::$url static variable
    $login = $args['login'];
    $user = new User();
    $user->load($login);
    $profile = array();
    foreach (array(BASIC => "basic", GENERAL => "general", PERSONAL => "personal", PROFESSIONAL => "professional") as $slicekey => $slicename) {
        $section = array();
        foreach (User::load_user_profile($user->user_id, 0, $slicekey) as $info) {
            $v = $info['value'];
            $k = $info['name'];
            if ($v) {
                // some values require munging
                switch ($slicekey) {
                    case GENERAL:
                        switch ($k) {
                            case 'dob':
                                $v = new IXR_Date((int) $v);
                                break;
                        }
                        break;
                }
                // now shove it in the results
                $section[$k] = $v;
            }
        }
        $profile[$slicename] = $section;
    }
    return array('success' => TRUE, 'login' => $user->login_name, 'id' => $user->user_id, 'url' => PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $user->user_id, 'name' => "{$user->firstName} {$user->lastName}", 'profile' => $profile);
}
Example #19
0
} else {
    // foaf.php/myelin
    if (!preg_match("|^/([^/]+)(/)?\$|", $path, $m)) {
        notfound("Unable to parse username out of URL");
    }
    $username = $m[1];
    // find user
    $user = new User();
    try {
        $user->load($username, "login_name");
    } catch (PAException $e) {
        notfound("User {$username} not found");
    }
}
try {
    $user_generaldata = User::load_user_profile($user->user_id, 0, GENERAL);
} catch (PAException $e) {
    notfound("User {$username} exists, but unable to load profile data.");
}
function profile_block_filter($data)
{
    $ret = array();
    foreach ($data as $blk) {
        $ret[$blk['name']] = $blk;
    }
    return $ret;
}
$user_generaldata = profile_block_filter($user_generaldata);
function esc($s)
{
    return htmlspecialchars($s);
Example #20
0
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.*/
 /** !!
  * Takes the data submitted in the form and gets all of the useful data
  * necessary to send a message.  It takes the name that is being sent to and 
  * gets the id, email, and other assorted data.  It then sends the message and
  * tells the user what the outcome of that process is. It also makes sure the
  *  message is within the correct length.
  *
  *  @param array $request_data  The data to be operated on.
  */
 public function handlePOSTPageSubmit($request_data)
 {
     $error = false;
     if (!empty($request_data)) {
         if (isset($request_data['send'])) {
             $message = NULL;
             filter_all_post($request_data, TRUE);
             // applying input filter to the post data, this function is define in function.php
             $subject = $request_data['subject'];
             $body = $request_data['body'];
             $in_reply_to = $request_data['in_reply_to'];
             if (empty($request_data['to'])) {
                 $message = 8003;
                 $error = true;
             }
             if (strlen($body) > MAX_MESSAGE_LENGTH) {
                 $message = 8002;
                 $error = true;
             }
             if (!$error) {
                 if (empty($subject)) {
                     $subject = '[none]';
                 }
                 $login_names = preg_split("/,\\s*/", $request_data['to']);
                 $valid_recipients = array();
                 //login name of all the valid login names.
                 $invalid_recipients = array();
                 // names of all the invalid recipients.
                 foreach ($login_names as $login_name) {
                     try {
                         $User = new User();
                         $User->load($login_name);
                         $valid_recipients['id'][] = $User->user_id;
                         $valid_recipients['name'][] = $User->login_name;
                         $valid_recipients['display_name'][] = $User->display_name;
                         $valid_recipients['fname'][] = $User->first_name;
                         $valid_recipients['email'][] = $User->email;
                         $valid_recipients['user'][] = $User;
                         $notif_settings = null;
                         $recipient_profile = User::load_user_profile($User->user_id, $User->user_id, 'notifications');
                         if (!empty($recipient_profile)) {
                             $notif_settings = unserialize($recipient_profile[0]['value']);
                         }
                         $valid_recipients['notifications'][] = $notif_settings;
                     } catch (PAException $e) {
                         $invalid_recipients[] = $login_name;
                     }
                 }
                 $message = null;
                 if (count($valid_recipients)) {
                     $is_draft = FALSE;
                     // actually 'send' the message
                     Message::add_message(PA::$login_uid, $valid_recipients['id'], $valid_recipients['name'], $subject, $body, $is_draft, $in_reply_to);
                     // handle 'also send to email' and 'message_waiting_blink'
                     $valid_recipients_count = count($valid_recipients['id']);
                     for ($counter = 0; $counter < $valid_recipients_count; $counter++) {
                         if (!empty($valid_recipients['notifications'][$counter])) {
                             $rec_notif_settings = $valid_recipients['notifications'][$counter];
                             $as_email = false;
                             if (!empty($rec_notif_settings['user_send_message']['value'])) {
                                 switch ($rec_notif_settings['user_send_message']['value']) {
                                     case NET_EMAIL:
                                     case NET_BOTH:
                                         $as_email = true;
                                         PAMail::send("user_send_message", $valid_recipients['user'][$counter], PA::$login_user, array('subject' => $subject, 'message' => $body));
                                         break;
                                     default:
                                         break;
                                 }
                             }
                             // if they are not getting it in email already
                             if (empty($as_email) && !empty($rec_notif_settings['msg_waiting_blink']) && $rec_notif_settings['msg_waiting_blink'] == NET_EMAIL) {
                                 PAMail::send("msg_waiting_blink", $valid_recipients['email'][$counter], PA::$login_user, array());
                             }
                         }
                     }
                     $message = sprintf(__("Message sent successfully to %s"), implode(", ", $valid_recipients['display_name']));
                 }
                 if (count($invalid_recipients)) {
                     //some of the recipients are invalid. So displaying the error message for them.
                     $message .= sprintf(__("Message sending failed for %s  as user(s) doesn't exist"), implode(", ", $invalid_recipients));
                     $error = true;
                 } else {
                     // message sent successfully to all the recipients. Redirecting user to inbox
                     header('Location: ' . PA::$url . PA_ROUTE_MYMESSAGE . "/msg={$message}");
                     exit;
                 }
             }
             if (!empty($message)) {
                 $msg_array = array();
                 $msg_array['failure_msg'] = $message;
                 $msg_array['success_msg'] = NULL;
                 $redirect_url = NULL;
                 $query_str = NULL;
                 set_web_variables($msg_array, $redirect_url, $query_str);
             }
         }
     }
 }
/**
* 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;
}
Example #23
0
// 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;
 function welcome_message($array_of_data)
 {
     $requested_user_id = $array_of_data['params']['recipient_id'];
     $user_profile = User::load_user_profile($requested_user_id, $requested_user_id, 'notifications');
     if (!empty($user_profile)) {
         $notify = unserialize($user_profile[0]['value']);
         $destination = $notify['welcome_message']['value'];
         if ($destination == NET_NONE) {
             return;
         }
     }
     // to for external mail
     $this->to = $array_of_data['params']['recipient_email'];
     // to/from for internal msg
     $this->from = $array_of_data['params']['sender_uid'];
     $this->network_owner = $array_of_data['params']['network_owner_name'];
     // mail type and array of data to be replaced with configurable variables
     $this->mail_type = 'welcome_message';
     $this->mail_sub_msg_array = $array_of_data['params'];
     // now send msg to proper destination either email or inbox
     $this->switch_destination($destination);
 }
 /** !!
  * 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));
 }
Example #26
0
 function load_ext_profile($slot = 4)
 {
     $uid = $this->user->user_id;
     $user_profile = User::load_user_profile($uid, $uid, $slot);
     return $user_profile;
 }
function relationship_denied($array_of_data)
{
    global $to, $mail_type, $mail_sub_msg_array, $from, $network_owner, $subject, $message, $owner;
    $requested_user_id = $array_of_data['params']['requested_user_id'];
    $user_profile = User::load_user_profile($requested_user_id, $requested_user_id, 'notifications');
    if (!empty($user_profile)) {
        $notify = unserialize($user_profile[0]['value']);
        $destination = $notify['friend_request_denial']['value'];
        if ($destination == NET_NONE) {
            return;
        }
    }
    // to for external mail
    $to = $array_of_data['params']['to'];
    // to/from for internal messaging
    $from = $array_of_data['params']['user_id'];
    $network_owner = $array_of_data['params']['requested_user_name'];
    // mail type and array of data to be replaced with configurable variables
    $mail_type = 'friend_denied';
    $mail_sub_msg_array = $array_of_data['params'];
    switch_destination($destination);
}