2 require_once("include/Contact.php");
3 require_once('include/Probe.php');
5 function profiles_init(App &$a) {
7 nav_set_selected('profiles');
13 if(($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) {
14 $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 LIMIT 1",
18 if (! dbm::is_result($r)) {
19 notice( t('Profile not found.') . EOL);
24 check_form_security_token_redirectOnErr('/profiles', 'profile_drop', 't');
26 // move every contact using this profile as their default to the user default
28 $r = q("UPDATE `contact` SET `profile-id` = (SELECT `profile`.`id` AS `profile-id` FROM `profile` WHERE `profile`.`is-default` = 1 AND `profile`.`uid` = %d LIMIT 1) WHERE `profile-id` = %d AND `uid` = %d ",
33 $r = q("DELETE FROM `profile` WHERE `id` = %d AND `uid` = %d",
38 info(t('Profile deleted.').EOL);
48 if(($a->argc > 1) && ($a->argv[1] === 'new')) {
50 check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
52 $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
53 intval(local_user()));
54 $num_profiles = count($r0);
56 $name = t('Profile-') . ($num_profiles + 1);
58 $r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
59 intval(local_user()));
61 $r2 = q("INSERT INTO `profile` (`uid` , `profile-name` , `name`, `photo`, `thumb`)
62 VALUES ( %d, '%s', '%s', '%s', '%s' )",
65 dbesc($r1[0]['name']),
66 dbesc($r1[0]['photo']),
67 dbesc($r1[0]['thumb'])
70 $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
75 info( t('New profile created.') . EOL);
77 goaway('profiles/'.$r3[0]['id']);
82 if(($a->argc > 2) && ($a->argv[1] === 'clone')) {
84 check_form_security_token_redirectOnErr('/profiles', 'profile_clone', 't');
86 $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
87 intval(local_user()));
88 $num_profiles = count($r0);
90 $name = t('Profile-') . ($num_profiles + 1);
91 $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1",
95 if(! dbm::is_result($r1)) {
96 notice( t('Profile unavailable to clone.') . EOL);
101 $r1[0]['is-default'] = 0;
102 $r1[0]['publish'] = 0;
103 $r1[0]['net-publish'] = 0;
104 $r1[0]['profile-name'] = dbesc($name);
108 $r2 = dbq("INSERT INTO `profile` (`"
109 . implode("`, `", array_keys($r1[0]))
111 . implode("', '", array_values($r1[0]))
114 $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
115 intval(local_user()),
118 info( t('New profile created.') . EOL);
119 if ((dbm::is_result($r3)) && (count($r3) == 1))
120 goaway('profiles/'.$r3[0]['id']);
124 return; // NOTREACHED
128 if(($a->argc > 1) && (intval($a->argv[1]))) {
129 $r = q("SELECT id FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
133 if (! dbm::is_result($r)) {
134 notice( t('Profile not found.') . EOL);
139 profile_load($a,$a->user['nickname'],$r[0]['id']);
146 function profile_clean_keywords($keywords) {
147 $keywords = str_replace(","," ",$keywords);
148 $keywords = explode(" ", $keywords);
151 foreach ($keywords as $keyword) {
152 $keyword = trim(strtolower($keyword));
153 $keyword = trim($keyword, "#");
155 $cleaned[] = $keyword;
158 $keywords = implode(", ", $cleaned);
163 function profiles_post(App &$a) {
165 if (! local_user()) {
166 notice( t('Permission denied.') . EOL);
170 $namechanged = false;
172 call_hooks('profile_post', $_POST);
174 if(($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) {
175 $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
180 notice( t('Profile not found.') . EOL);
184 check_form_security_token_redirectOnErr('/profiles', 'profile_edit');
186 $is_default = (($orig[0]['is-default']) ? 1 : 0);
188 $profile_name = notags(trim($_POST['profile_name']));
189 if(! strlen($profile_name)) {
190 notice( t('Profile Name is required.') . EOL);
194 $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
196 $y = substr($dob,0,4);
197 if((! ctype_digit($y)) || ($y < 1900))
200 $ignore_year = false;
201 if($dob != '0000-00-00') {
202 if(strpos($dob,'0000-') === 0) {
204 $dob = substr($dob,5);
206 $dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
208 $dob = '0000-' . $dob;
211 $name = notags(trim($_POST['name']));
213 if(! strlen($name)) {
217 if($orig[0]['name'] != $name)
222 $pdesc = notags(trim($_POST['pdesc']));
223 $gender = notags(trim($_POST['gender']));
224 $address = notags(trim($_POST['address']));
225 $locality = notags(trim($_POST['locality']));
226 $region = notags(trim($_POST['region']));
227 $postal_code = notags(trim($_POST['postal_code']));
228 $country_name = notags(trim($_POST['country_name']));
229 $pub_keywords = profile_clean_keywords(notags(trim($_POST['pub_keywords'])));
230 $prv_keywords = profile_clean_keywords(notags(trim($_POST['prv_keywords'])));
231 $marital = notags(trim($_POST['marital']));
232 $howlong = notags(trim($_POST['howlong']));
234 $with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
236 if(! strlen($howlong))
237 $howlong = '0000-00-00 00:00:00';
239 $howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
241 // linkify the relationship target if applicable
243 $withchanged = false;
246 if($with != strip_tags($orig[0]['with'])) {
250 if(strpos($lookup,'@') === 0)
251 $lookup = substr($lookup,1);
252 $lookup = str_replace('_',' ', $lookup);
253 if(strpos($lookup,'@') || (strpos($lookup,'http://'))) {
255 $links = @Probe::lrdd($lookup);
257 foreach($links as $link) {
258 if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
259 $prf = $link['@attributes']['href'];
266 /* if(strstr($lookup,' ')) {
267 $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
273 $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
279 $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
284 $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
289 if (dbm::is_result($r)) {
291 $newname = $r[0]['name'];
296 $with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with);
297 if(strpos($with,'@') === 0)
298 $with = substr($with,1);
302 $with = $orig[0]['with'];
305 $sexual = notags(trim($_POST['sexual']));
306 $xmpp = notags(trim($_POST['xmpp']));
307 $homepage = notags(trim($_POST['homepage']));
308 if ((strpos($homepage, 'http') !== 0) && (strlen($homepage))) {
309 // neither http nor https in URL, add them
310 $homepage = 'http://'.$homepage;
312 $hometown = notags(trim($_POST['hometown']));
313 $politic = notags(trim($_POST['politic']));
314 $religion = notags(trim($_POST['religion']));
316 $likes = fix_mce_lf(escape_tags(trim($_POST['likes'])));
317 $dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes'])));
319 $about = fix_mce_lf(escape_tags(trim($_POST['about'])));
320 $interest = fix_mce_lf(escape_tags(trim($_POST['interest'])));
321 $contact = fix_mce_lf(escape_tags(trim($_POST['contact'])));
322 $music = fix_mce_lf(escape_tags(trim($_POST['music'])));
323 $book = fix_mce_lf(escape_tags(trim($_POST['book'])));
324 $tv = fix_mce_lf(escape_tags(trim($_POST['tv'])));
325 $film = fix_mce_lf(escape_tags(trim($_POST['film'])));
326 $romance = fix_mce_lf(escape_tags(trim($_POST['romance'])));
327 $work = fix_mce_lf(escape_tags(trim($_POST['work'])));
328 $education = fix_mce_lf(escape_tags(trim($_POST['education'])));
330 $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
332 set_pconfig(local_user(),'system','detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0));
337 if($marital != $orig[0]['marital']) {
338 $changes[] = '[color=#ff0000]♥[/color] ' . t('Marital Status');
342 $changes[] = '[color=#ff0000]♥[/color] ' . t('Romantic Partner');
343 $value = strip_tags($with);
345 if($likes != $orig[0]['likes']) {
346 $changes[] = t('Likes');
349 if($dislikes != $orig[0]['dislikes']) {
350 $changes[] = t('Dislikes');
353 if($work != $orig[0]['work']) {
354 $changes[] = t('Work/Employment');
356 if($religion != $orig[0]['religion']) {
357 $changes[] = t('Religion');
360 if($politic != $orig[0]['politic']) {
361 $changes[] = t('Political Views');
364 if($gender != $orig[0]['gender']) {
365 $changes[] = t('Gender');
368 if($sexual != $orig[0]['sexual']) {
369 $changes[] = t('Sexual Preference');
372 if($xmpp != $orig[0]['xmpp']) {
373 $changes[] = t('XMPP');
376 if($homepage != $orig[0]['homepage']) {
377 $changes[] = t('Homepage');
380 if($interest != $orig[0]['interest']) {
381 $changes[] = t('Interests');
384 if($address != $orig[0]['address']) {
385 $changes[] = t('Address');
386 // New address not sent in notifications, potential privacy issues
387 // in case this leaks to unintended recipients. Yes, it's in the public
388 // profile but that doesn't mean we have to broadcast it to everybody.
390 if($locality != $orig[0]['locality'] || $region != $orig[0]['region']
391 || $country_name != $orig[0]['country-name']) {
392 $changes[] = t('Location');
393 $comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' ');
394 $comma2 = (($region && $country_name) ? ', ' : '');
395 $value = $locality . $comma1 . $region . $comma2 . $country_name;
398 profile_activity($changes,$value);
402 $r = q("UPDATE `profile`
403 SET `profile-name` = '%s',
411 `postal-code` = '%s',
412 `country-name` = '%s',
422 `pub_keywords` = '%s',
423 `prv_keywords` = '%s',
437 WHERE `id` = %d AND `uid` = %d",
438 dbesc($profile_name),
447 dbesc($country_name),
457 dbesc($pub_keywords),
458 dbesc($prv_keywords),
471 intval($hide_friends),
477 info( t('Profile updated.') . EOL);
480 if($namechanged && $is_default) {
481 $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
483 dbesc(datetime_convert()),
486 $r = q("UPDATE `user` set `username` = '%s' where `uid` = %d",
493 $location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
495 q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
498 dbesc($pub_keywords),
503 // Update global directory in background
504 $url = $_SESSION['my_url'];
505 if ($url && strlen(get_config('system','directory'))) {
506 proc_run(PRIORITY_LOW, "include/directory.php", $url);
509 require_once('include/profile_update.php');
512 // Update the global contact for the user
513 update_gcontact_for_user(local_user());
519 function profile_activity($changed, $value) {
522 if(! local_user() || ! is_array($changed) || ! count($changed))
525 if($a->user['hidewall'] || get_config('system','block_public'))
528 if(! get_pconfig(local_user(),'system','post_profilechange'))
531 require_once('include/items.php');
533 $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
542 $arr['guid'] = get_guid(32);
543 $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user());
544 $arr['uid'] = local_user();
545 $arr['contact-id'] = $self[0]['id'];
547 $arr['type'] = 'wall';
550 $arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
551 $arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
552 $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
553 $arr['verb'] = ACTIVITY_UPDATE;
554 $arr['object-type'] = ACTIVITY_OBJ_PROFILE;
556 $A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
560 $t = count($changed);
562 foreach($changed as $ch) {
563 if(strlen($changes)) {
565 $changes .= t(' and ');
573 $prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]';
575 if($t == 1 && strlen($value)) {
576 $message = sprintf( t('%1$s changed %2$s to “%3$s”'), $A, $changes, $value);
577 $message .= "\n\n" . sprintf( t(' - Visit %1$s\'s %2$s'), $A, $prof);
580 $message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
583 $arr['body'] = $message;
585 $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PROFILE . '</type><title>' . $self[0]['name'] . '</title>'
586 . '<id>' . $self[0]['url'] . '/' . $self[0]['name'] . '</id>';
587 $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $self[0]['url'] . '?tab=profile' . '" />' . "\n");
588 $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $self[0]['thumb'] . '" />' . "\n");
589 $arr['object'] .= '</link></object>' . "\n";
590 $arr['last-child'] = 1;
592 $arr['allow_cid'] = $a->user['allow_cid'];
593 $arr['allow_gid'] = $a->user['allow_gid'];
594 $arr['deny_cid'] = $a->user['deny_cid'];
595 $arr['deny_gid'] = $a->user['deny_gid'];
597 $i = item_store($arr);
599 proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
604 function profiles_content(App &$a) {
606 if (! local_user()) {
607 notice( t('Permission denied.') . EOL);
613 if(($a->argc > 1) && (intval($a->argv[1]))) {
614 $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
618 if (! dbm::is_result($r)) {
619 notice( t('Profile not found.') . EOL);
623 require_once('include/profile_selectors.php');
626 /* $editselect = 'textareas';
627 if( intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
628 $editselect = 'none';*/
629 $editselect = 'none';
630 if( feature_enabled(local_user(),'richtext') )
631 $editselect = 'textareas';
633 $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
634 '$baseurl' => App::get_baseurl(true),
635 '$editselect' => $editselect,
637 $a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array(
638 '$baseurl' => App::get_baseurl(true),
639 '$editselect' => $editselect,
643 $opt_tpl = get_markup_template("profile-hide-friends.tpl");
644 $hide_friends = replace_macros($opt_tpl,array(
646 'hide-friends', //Name
647 t('Hide contacts and friends:'), //Label
648 !!$r[0]['hide-friends'], //Value
650 array(t('No'),t('Yes')) //Off - On strings
652 '$desc' => t('Hide your contact/friend list from viewers of this profile?'),
653 '$yes_str' => t('Yes'),
654 '$no_str' => t('No'),
655 '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""),
656 '$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "")
659 $personal_account = !(in_array($a->user["page-flags"],
660 array(PAGE_COMMUNITY, PAGE_PRVGROUP)));
662 $detailled_profile = (get_pconfig(local_user(),'system','detailled_profile') AND $personal_account);
664 $f = get_config('system','birthday_input_format');
668 $is_default = (($r[0]['is-default']) ? 1 : 0);
669 $tpl = get_markup_template("profile_edit.tpl");
670 $o .= replace_macros($tpl,array(
671 '$personal_account' => $personal_account,
672 '$detailled_profile' => $detailled_profile,
675 'detailled_profile', //Name
676 t('Show more profile fields:'), //Label
677 $detailled_profile, //Value
679 array(t('No'),t('Yes')) //Off - On strings
682 '$multi_profiles' => feature_enabled(local_user(),'multi_profiles'),
683 '$form_security_token' => get_form_security_token("profile_edit"),
684 '$form_security_token_photo' => get_form_security_token("profile_photo"),
685 '$profile_clone_link' => ((feature_enabled(local_user(),'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
686 '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
688 '$profile_action' => t('Profile Actions'),
689 '$banner' => t('Edit Profile Details'),
690 '$submit' => t('Submit'),
691 '$profpic' => t('Change Profile Photo'),
692 '$viewprof' => t('View this profile'),
693 '$editvis' => t('Edit visibility'),
694 '$cr_prof' => t('Create a new profile using these settings'),
695 '$cl_prof' => t('Clone this profile'),
696 '$del_prof' => t('Delete this profile'),
698 '$lbl_basic_section' => t('Basic information'),
699 '$lbl_picture_section' => t('Profile picture'),
700 '$lbl_location_section' => t('Location'),
701 '$lbl_preferences_section' => t('Preferences'),
702 '$lbl_status_section' => t('Status information'),
703 '$lbl_about_section' => t('Additional information'),
704 '$lbl_interests_section' => t('Interests'),
705 '$lbl_personal_section' => t('Personal'),
706 '$lbl_relation_section' => t('Relation'),
707 '$lbl_miscellaneous_section' => t('Miscellaneous'),
709 '$lbl_profile_photo' => t('Upload Profile Photo'),
710 '$lbl_gender' => t('Your Gender:'),
711 '$lbl_marital' => t('<span class="heart">♥</span> Marital Status:'),
712 '$lbl_sexual' => t('Sexual Preference:'),
713 '$lbl_ex2' => t('Example: fishing photography software'),
715 '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
716 '$baseurl' => App::get_baseurl(true),
717 '$profile_id' => $r[0]['id'],
718 '$profile_name' => array('profile_name', t('Profile Name:'), $r[0]['profile-name'], t('Required'), '*'),
719 '$is_default' => $is_default,
720 '$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""),
721 '$name' => array('name', t('Your Full Name:'), $r[0]['name']),
722 '$pdesc' => array('pdesc', t('Title/Description:'), $r[0]['pdesc']),
723 '$dob' => dob($r[0]['dob']),
724 '$hide_friends' => $hide_friends,
725 '$address' => array('address', t('Street Address:'), $r[0]['address']),
726 '$locality' => array('locality', t('Locality/City:'), $r[0]['locality']),
727 '$region' => array('region', t('Region/State:'), $r[0]['region']),
728 '$postal_code' => array('postal_code', t('Postal/Zip Code:'), $r[0]['postal-code']),
729 '$country_name' => array('country_name', t('Country:'), $r[0]['country-name']),
730 '$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
731 '$gender' => gender_selector($r[0]['gender']),
732 '$marital' => marital_selector($r[0]['marital']),
733 '$with' => array('with', t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), t('Examples: cathy123, Cathy Williams, cathy@example.com')),
734 '$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
735 '$sexual' => sexpref_selector($r[0]['sexual']),
736 '$about' => array('about', t('Tell us about yourself...'), $r[0]['about']),
737 '$xmpp' => array('xmpp', t('XMPP (Jabber) address:'), $r[0]['xmpp'], t("The XMPP address will be propagated to your contacts so that they can follow you.")),
738 '$homepage' => array('homepage', t('Homepage URL:'), $r[0]['homepage']),
739 '$hometown' => array('hometown', t('Hometown:'), $r[0]['hometown']),
740 '$politic' => array('politic', t('Political Views:'), $r[0]['politic']),
741 '$religion' => array('religion', t('Religious Views:'), $r[0]['religion']),
742 '$pub_keywords' => array('pub_keywords', t('Public Keywords:'), $r[0]['pub_keywords'], t("\x28Used for suggesting potential friends, can be seen by others\x29")),
743 '$prv_keywords' => array('prv_keywords', t('Private Keywords:'), $r[0]['prv_keywords'], t("\x28Used for searching profiles, never shown to others\x29")),
744 '$likes' => array('likes', t('Likes:'), $r[0]['likes']),
745 '$dislikes' => array('dislikes', t('Dislikes:'), $r[0]['dislikes']),
746 '$music' => array('music', t('Musical interests'), $r[0]['music']),
747 '$book' => array('book', t('Books, literature'), $r[0]['book']),
748 '$tv' => array('tv', t('Television'), $r[0]['tv']),
749 '$film' => array('film', t('Film/dance/culture/entertainment'), $r[0]['film']),
750 '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']),
751 '$romance' => array('romance',t('Love/romance'), $r[0]['romance']),
752 '$work' => array('work', t('Work/employment'), $r[0]['work']),
753 '$education' => array('education', t('School/education'), $r[0]['education']),
754 '$contact' => array('contact', t('Contact information and Social Networks'), $r[0]['contact']),
757 $arr = array('profile' => $r[0], 'entry' => $o);
758 call_hooks('profile_edit', $arr);
766 //If we don't support multi profiles, don't display this list.
767 if(!feature_enabled(local_user(),'multi_profiles')){
769 "SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
772 if (dbm::is_result($r)){
773 //Go to the default profile.
774 goaway('profiles/'.$r[0]['id']);
778 $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
780 if (dbm::is_result($r)) {
782 $tpl = get_markup_template('profile_entry.tpl');
785 foreach ($r as $rr) {
786 $profiles .= replace_macros($tpl, array(
787 '$photo' => $a->remove_baseurl($rr['thumb']),
789 '$alt' => t('Profile Image'),
790 '$profile_name' => $rr['profile-name'],
791 '$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>'
792 : '<a href="'.'profperm/'.$rr['id'].'" />' . t('Edit visibility') . '</a>')
796 $tpl_header = get_markup_template('profile_listing_header.tpl');
797 $o .= replace_macros($tpl_header,array(
798 '$header' => t('Edit/Manage Profiles'),
799 '$chg_photo' => t('Change profile photo'),
800 '$cr_new' => t('Create New Profile'),
801 '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"),
802 '$profiles' => $profiles