/** * @brief Loads a profile into the App structure. * * The function requires a writeable copy of the main App structure, and the * nickname of a valid channel. * * Permissions of the current observer are checked. If a restricted profile is available * to the current observer, that will be loaded instead of the channel default profile. * * The channel owner can set $profile to a valid profile_guid to preview that profile. * * The channel default theme is also selected for use, unless over-riden elsewhere. * * @param[in,out] App &$a * @param string $nickname * @param string $profile */ function profile_load(&$a, $nickname, $profile = '') { // logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : '')); $user = q("select channel_id from channel where channel_address = '%s' and channel_removed = 0 limit 1", dbesc($nickname)); if (!$user) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(t('Requested channel is not available.') . EOL); $a->error = 404; return; } // get the current observer $observer = $a->get_observer(); $can_view_profile = true; // Can the observer see our profile? require_once 'include/permissions.php'; if (!perm_is_allowed($user[0]['channel_id'], $observer['xchan_hash'], 'view_profile')) { $can_view_profile = false; } if (!$profile) { $r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' and abook_channel = '%d' limit 1", dbesc($observer['xchan_hash']), intval($user[0]['channel_id'])); if ($r) { $profile = $r[0]['abook_profile']; } } $p = null; if ($profile) { $p = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile\n\t\t\t\tLEFT JOIN channel ON profile.uid = channel.channel_id\n\t\t\t\tWHERE channel.channel_address = '%s' AND profile.profile_guid = '%s' LIMIT 1", dbesc($nickname), dbesc($profile)); } if (!$p) { $p = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile\n\t\t\tLEFT JOIN channel ON profile.uid = channel.channel_id\n\t\t\tWHERE channel.channel_address = '%s' and channel_removed = 0\n\t\t\tAND profile.is_default = 1 LIMIT 1", dbesc($nickname)); } if (!$p) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(t('Requested profile is not available.') . EOL); $a->error = 404; return; } $q = q("select * from profext where hash = '%s' and channel_id = %d", dbesc($p[0]['profile_guid']), intval($p[0]['profile_uid'])); if ($q) { $extra_fields = array(); require_once 'include/identity.php'; $profile_fields_basic = get_profile_fields_basic(); $profile_fields_advanced = get_profile_fields_advanced(); $advanced = feature_enabled(local_channel(), 'advanced_profiles') ? true : false; if ($advanced) { $fields = $profile_fields_advanced; } else { $fields = $profile_fields_basic; } foreach ($q as $qq) { foreach ($fields as $k => $f) { if ($k == $qq['k']) { $p[0][$k] = $qq['v']; $extra_fields[] = $k; break; } } } } $p[0]['extra_fields'] = $extra_fields; $z = q("select xchan_photo_date, xchan_addr from xchan where xchan_hash = '%s' limit 1", dbesc($p[0]['channel_hash'])); if ($z) { $p[0]['picdate'] = $z[0]['xchan_photo_date']; $p[0]['reddress'] = str_replace('@', '@', $z[0]['xchan_addr']); } // fetch user tags if this isn't the default profile if (!$p[0]['is_default']) { /** @BUG $profile_uid is undefinded for this query, so should not work. */ $x = q("select `keywords` from `profile` where uid = %d and `is_default` = 1 limit 1", intval($profile_uid)); if ($x && $can_view_profile) { $p[0]['keywords'] = $x[0]['keywords']; } } if ($p[0]['keywords']) { $keywords = str_replace(array('#', ',', ' ', ',,'), array('', ' ', ',', ','), $p[0]['keywords']); if (strlen($keywords) && $can_view_profile) { $a->page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords, ENT_COMPAT, 'UTF-8') . '" />' . "\r\n"; } } $a->profile = $p[0]; $a->profile_uid = $p[0]['profile_uid']; $a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname(); $a->profile['permission_to_view'] = $can_view_profile; if ($can_view_profile) { $online = get_online_status($nickname); $a->profile['online_status'] = $online['result']; } if (local_channel()) { $a->profile['channel_mobile_theme'] = get_pconfig(local_channel(), 'system', 'mobile_theme'); $_SESSION['mobile_theme'] = $a->profile['channel_mobile_theme']; } /* * load/reload current theme info */ $_SESSION['theme'] = $p[0]['channel_theme']; // $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one // $theme_info_file = "view/theme/".current_theme()."/php/theme.php"; // if (file_exists($theme_info_file)){ // require_once($theme_info_file); // } }
function advanced_profile(&$a) { require_once 'include/text.php'; if (!perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_profile')) { return ''; } if (App::$profile['fullname']) { $profile_fields_basic = get_profile_fields_basic(); $profile_fields_advanced = get_profile_fields_advanced(); $advanced = feature_enabled(App::$profile['profile_uid'], 'advanced_profiles') ? true : false; if ($advanced) { $fields = $profile_fields_advanced; } else { $fields = $profile_fields_basic; } $clean_fields = array(); if ($fields) { foreach ($fields as $k => $v) { $clean_fields[] = trim($k); } } $tpl = get_markup_template('profile_advanced.tpl'); $profile = array(); $profile['fullname'] = array(t('Full Name:'), App::$profile['fullname']); if (App::$profile['gender']) { $profile['gender'] = array(t('Gender:'), App::$profile['gender']); } $ob_hash = get_observer_hash(); if ($ob_hash && perm_is_allowed(App::$profile['profile_uid'], $ob_hash, 'post_like')) { $profile['canlike'] = true; $profile['likethis'] = t('Like this channel'); $profile['profile_guid'] = App::$profile['profile_guid']; } $likers = q("select liker, xchan.* from likes left join xchan on liker = xchan_hash where channel_id = %d and target_type = '%s' and verb = '%s'", intval(App::$profile['profile_uid']), dbesc(ACTIVITY_OBJ_PROFILE), dbesc(ACTIVITY_LIKE)); $profile['likers'] = array(); $profile['like_count'] = count($likers); $profile['like_button_label'] = tt('Like', 'Likes', $profile['like_count'], 'noun'); if ($likers) { foreach ($likers as $l) { $profile['likers'][] = array('name' => $l['xchan_name'], 'photo' => zid($l['xchan_photo_s']), 'url' => zid($l['xchan_url'])); } } if (App::$profile['dob'] && App::$profile['dob'] != '0000-00-00') { $val = ''; if (substr(App::$profile['dob'], 5, 2) === '00' || substr(App::$profile['dob'], 8, 2) === '00') { $val = substr(App::$profile['dob'], 0, 4); } $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); if (!$val) { $val = intval(App::$profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', App::$profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr(App::$profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format)); } $profile['birthday'] = array(t('Birthday:'), $val); } if ($age = age(App::$profile['dob'], App::$profile['timezone'], '')) { $profile['age'] = array(t('Age:'), $age); } if (App::$profile['marital']) { $profile['marital'] = array(t('Status:'), App::$profile['marital']); } if (App::$profile['partner']) { $profile['marital']['partner'] = bbcode(App::$profile['partner']); } if (strlen(App::$profile['howlong']) && App::$profile['howlong'] > NULL_DATE) { $profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s')); } if (App::$profile['sexual']) { $profile['sexual'] = array(t('Sexual Preference:'), App::$profile['sexual']); } if (App::$profile['homepage']) { $profile['homepage'] = array(t('Homepage:'), linkify(App::$profile['homepage'])); } if (App::$profile['hometown']) { $profile['hometown'] = array(t('Hometown:'), linkify(App::$profile['hometown'])); } if (App::$profile['keywords']) { $profile['keywords'] = array(t('Tags:'), App::$profile['keywords']); } if (App::$profile['politic']) { $profile['politic'] = array(t('Political Views:'), App::$profile['politic']); } if (App::$profile['religion']) { $profile['religion'] = array(t('Religion:'), App::$profile['religion']); } if ($txt = prepare_text(App::$profile['about'])) { $profile['about'] = array(t('About:'), $txt); } if ($txt = prepare_text(App::$profile['interest'])) { $profile['interest'] = array(t('Hobbies/Interests:'), $txt); } if ($txt = prepare_text(App::$profile['likes'])) { $profile['likes'] = array(t('Likes:'), $txt); } if ($txt = prepare_text(App::$profile['dislikes'])) { $profile['dislikes'] = array(t('Dislikes:'), $txt); } if ($txt = prepare_text(App::$profile['contact'])) { $profile['contact'] = array(t('Contact information and Social Networks:'), $txt); } if ($txt = prepare_text(App::$profile['channels'])) { $profile['channels'] = array(t('My other channels:'), $txt); } if ($txt = prepare_text(App::$profile['music'])) { $profile['music'] = array(t('Musical interests:'), $txt); } if ($txt = prepare_text(App::$profile['book'])) { $profile['book'] = array(t('Books, literature:'), $txt); } if ($txt = prepare_text(App::$profile['tv'])) { $profile['tv'] = array(t('Television:'), $txt); } if ($txt = prepare_text(App::$profile['film'])) { $profile['film'] = array(t('Film/dance/culture/entertainment:'), $txt); } if ($txt = prepare_text(App::$profile['romance'])) { $profile['romance'] = array(t('Love/Romance:'), $txt); } if ($txt = prepare_text(App::$profile['employment'])) { $profile['employment'] = array(t('Work/employment:'), $txt); } if ($txt = prepare_text(App::$profile['education'])) { $profile['education'] = array(t('School/education:'), $txt); } if (App::$profile['extra_fields']) { foreach (App::$profile['extra_fields'] as $f) { $x = q("select * from profdef where field_name = '%s' limit 1", dbesc($f)); if ($x && ($txt = prepare_text(App::$profile[$f]))) { $profile[$f] = array($x[0]['field_desc'] . ':', $txt); } } $profile['extra_fields'] = App::$profile['extra_fields']; } $things = get_things(App::$profile['profile_guid'], App::$profile['profile_uid']); // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); return replace_macros($tpl, array('$title' => t('Profile'), '$canlike' => $profile['canlike'] ? true : false, '$likethis' => t('Like this thing'), '$profile' => $profile, '$fields' => $clean_fields, '$editmenu' => profile_edit_menu(App::$profile['profile_uid']), '$things' => $things)); } return ''; }
function get() { $o = ''; $channel = \App::get_channel(); if (!local_channel()) { notice(t('Permission denied.') . EOL); return; } require_once 'include/channel.php'; $profile_fields_basic = get_profile_fields_basic(); $profile_fields_advanced = get_profile_fields_advanced(); if (argc() > 1 && intval(argv(1)) || !feature_enabled(local_channel(), 'multi_profiles')) { if (feature_enabled(local_channel(), 'multi_profiles')) { $id = \App::$argv[1]; } else { $x = q("select id from profile where uid = %d and is_default = 1", intval(local_channel())); if ($x) { $id = $x[0]['id']; } } $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($id), intval(local_channel())); if (!count($r)) { notice(t('Profile not found.') . EOL); return; } $editselect = 'none'; \App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array('$baseurl' => z_root(), '$editselect' => $editselect)); $advanced = feature_enabled(local_channel(), 'advanced_profiles') ? true : false; if ($advanced) { $fields = $profile_fields_advanced; } else { $fields = $profile_fields_basic; } $hide_friends = array('hide_friends', t('Hide your connections list from viewers of this profile'), $r[0]['hide_friends'], '', array(t('No'), t('Yes'))); $q = q("select * from profdef where true"); if ($q) { $extra_fields = array(); foreach ($q as $qq) { $mine = q("select v from profext where k = '%s' and hash = '%s' and channel_id = %d limit 1", dbesc($qq['field_name']), dbesc($r[0]['profile_guid']), intval(local_channel())); if (array_key_exists($qq['field_name'], $fields)) { $extra_fields[] = array($qq['field_name'], $qq['field_desc'], $mine ? $mine[0]['v'] : '', $qq['field_help']); } } } //logger('extra_fields: ' . print_r($extra_fields,true)); $f = get_config('system', 'birthday_input_format'); if (!$f) { $f = 'ymd'; } $is_default = $r[0]['is_default'] ? 1 : 0; $tpl = get_markup_template("profile_edit.tpl"); $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("profile_edit"), '$profile_clone_link' => feature_enabled(local_channel(), 'multi_profiles') ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : '', '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), '$fields' => $fields, '$guid' => $r[0]['profile_guid'], '$banner' => t('Edit Profile Details'), '$submit' => t('Submit'), '$viewprof' => t('View this profile'), '$editvis' => t('Edit visibility'), '$tools_label' => t('Profile Tools'), '$coverpic' => t('Change cover photo'), '$profpic' => t('Change profile photo'), '$cr_prof' => t('Create a new profile using these settings'), '$cl_prof' => t('Clone this profile'), '$del_prof' => t('Delete this profile'), '$addthing' => t('Add profile things'), '$personal' => t('Personal'), '$location' => t('Location'), '$relation' => t('Relation'), '$miscellaneous' => t('Miscellaneous'), '$exportable' => feature_enabled(local_channel(), 'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), '$lbl_gender' => t('Your gender'), '$lbl_marital' => t('Marital status'), '$lbl_sexual' => t('Sexual preference'), '$baseurl' => z_root(), '$profile_id' => $r[0]['id'], '$profile_name' => array('profile_name', t('Profile name'), $r[0]['profile_name'], t('Required'), '*'), '$is_default' => $is_default, '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$advanced' => $advanced, '$name' => array('name', t('Your full name'), $r[0]['fullname'], t('Required'), '*'), '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']), '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, '$address' => array('address', t('Street address'), $r[0]['address']), '$locality' => array('locality', t('Locality/City'), $r[0]['locality']), '$region' => array('region', t('Region/State'), $r[0]['region']), '$postal_code' => array('postal_code', t('Postal/Zip code'), $r[0]['postal_code']), '$country_name' => array('country_name', t('Country'), $r[0]['country_name']), '$gender' => gender_selector($r[0]['gender']), '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), '$with' => array('with', t("Who (if applicable)"), $r[0]['partner'], t('Examples: cathy123, Cathy Williams, cathy@example.com')), '$howlong' => array('howlong', t('Since (date)'), $r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC', date_default_timezone_get(), $r[0]['howlong'])), '$sexual' => sexpref_selector($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']), '$about' => array('about', t('Tell us about yourself'), $r[0]['about']), '$homepage' => array('homepage', t('Homepage URL'), $r[0]['homepage']), '$hometown' => array('hometown', t('Hometown'), $r[0]['hometown']), '$politic' => array('politic', t('Political views'), $r[0]['politic']), '$religion' => array('religion', t('Religious views'), $r[0]['religion']), '$keywords' => array('keywords', t('Keywords used in directory listings'), $r[0]['keywords'], t('Example: fishing photography software')), '$likes' => array('likes', t('Likes'), $r[0]['likes']), '$dislikes' => array('dislikes', t('Dislikes'), $r[0]['dislikes']), '$music' => array('music', t('Musical interests'), $r[0]['music']), '$book' => array('book', t('Books, literature'), $r[0]['book']), '$tv' => array('tv', t('Television'), $r[0]['tv']), '$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']), '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), '$romance' => array('romance', t('Love/Romance'), $r[0]['romance']), '$work' => array('work', t('Work/Employment'), $r[0]['employment']), '$education' => array('education', t('School/Education'), $r[0]['education']), '$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']), '$channels' => array('channels', t('My other channels'), $r[0]['channels']), '$extra_fields' => $extra_fields)); $arr = array('profile' => $r[0], 'entry' => $o); call_hooks('profile_edit', $arr); return $o; } else { $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_channel()); if ($r) { $tpl = get_markup_template('profile_entry.tpl'); foreach ($r as $rr) { $profiles .= replace_macros($tpl, array('$photo' => $rr['thumb'], '$id' => $rr['id'], '$alt' => t('Profile Image'), '$profile_name' => $rr['profile_name'], '$visible' => $rr['is_default'] ? '<strong>' . translate_scope(map_scope($channel['channel_r_profile'])) . '</strong>' : '<a href="' . z_root() . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')); } $tpl_header = get_markup_template('profile_listing_header.tpl'); $o .= replace_macros($tpl_header, array('$header' => t('Edit Profiles'), '$cr_new' => t('Create New'), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"), '$profiles' => $profiles)); } return $o; } }
function admin_page_profs(&$a) { if (argc() > 3 && argv(2) == 'drop' && intval(argv(3))) { $r = q("delete from profdef where id = %d", intval(argv(3))); // remove from allowed fields goaway(z_root() . '/admin/profs'); } if (argc() > 2 && argv(2) === 'new') { return replace_macros(get_markup_template('profdef_edit.tpl'), array('$header' => t('New Profile Field'), '$field_name' => array('field_name', t('Field nickname'), $_REQUEST['field_name'], t('System name of field')), '$field_type' => array('field_type', t('Input type'), $_REQUEST['field_type'] ? $_REQUEST['field_type'] : 'text', ''), '$field_desc' => array('field_desc', t('Field Name'), $_REQUEST['field_desc'], t('Label on profile pages')), '$field_help' => array('field_help', t('Help text'), $_REQUEST['field_help'], t('Additional info (optional)')), '$submit' => t('Save'))); } if (argc() > 2 && intval(argv(2))) { $r = q("select * from profdef where id = %d limit 1", intval(argv(2))); if (!$r) { notice(t('Field definition not found') . EOL); goaway(z_root() . '/admin/profs'); } return replace_macros(get_markup_template('profdef_edit.tpl'), array('$id' => intval($r[0]['id']), '$header' => t('Edit Profile Field'), '$field_name' => array('field_name', t('Field nickname'), $r[0]['field_name'], t('System name of field')), '$field_type' => array('field_type', t('Input type'), $r[0]['field_type'], ''), '$field_desc' => array('field_desc', t('Field Name'), $r[0]['field_desc'], t('Label on profile pages')), '$field_help' => array('field_help', t('Help text'), $r[0]['field_help'], t('Additional info (optional)')), '$submit' => t('Save'))); } $basic = ''; $barr = array(); $fields = get_profile_fields_basic(); if (!$fields) { $fields = get_profile_fields_basic(1); } if ($fields) { foreach ($fields as $k => $v) { if ($basic) { $basic .= ', '; } $basic .= trim($k); $barr[] = trim($k); } } $advanced = ''; $fields = get_profile_fields_advanced(); if (!$fields) { $fields = get_profile_fields_advanced(1); } if ($fields) { foreach ($fields as $k => $v) { if (in_array(trim($k), $barr)) { continue; } if ($advanced) { $advanced .= ', '; } $advanced .= trim($k); } } $all = ''; $fields = get_profile_fields_advanced(1); if ($fields) { foreach ($fields as $k => $v) { if ($all) { $all .= ', '; } $all .= trim($k); } } $r = q("select * from profdef where true"); if ($r) { foreach ($r as $rr) { if ($all) { $all .= ', '; } $all .= $rr['field_name']; } } $o = replace_macros(get_markup_template('admin_profiles.tpl'), array('$title' => t('Profile Fields'), '$basic' => array('basic', t('Basic Profile Fields'), $basic, ''), '$advanced' => array('advanced', t('Advanced Profile Fields'), $advanced, t('(In addition to basic fields)')), '$all' => $all, '$all_desc' => t('All available fields'), '$cust_field_desc' => t('Custom Fields'), '$cust_fields' => $r, '$edit' => t('Edit'), '$drop' => t('Delete'), '$new' => t('Create Custom Field'), '$submit' => t('Submit'))); return $o; }
function profiles_content(&$a) { $o = ''; $channel = $a->get_channel(); if (!local_channel()) { notice(t('Permission denied.') . EOL); return; } require_once 'include/identity.php'; $profile_fields_basic = get_profile_fields_basic(); $profile_fields_advanced = get_profile_fields_advanced(); if (argc() > 1 && intval(argv(1)) || !feature_enabled(local_channel(), 'multi_profiles')) { if (feature_enabled(local_channel(), 'multi_profiles')) { $id = $a->argv[1]; } else { $x = q("select id from profile where uid = %d and is_default = 1", intval(local_channel())); if ($x) { $id = $x[0]['id']; } } $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($id), intval(local_channel())); if (!count($r)) { notice(t('Profile not found.') . EOL); return; } require_once 'include/profile_selectors.php'; $editselect = 'none'; // if(feature_enabled(local_channel(),'richtext')) // $editselect = 'textareas'; $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array('$baseurl' => $a->get_baseurl(true), '$editselect' => $editselect)); $advanced = feature_enabled(local_channel(), 'advanced_profiles') ? true : false; if ($advanced) { $fields = $profile_fields_advanced; } else { $fields = $profile_fields_basic; } $opt_tpl = get_markup_template("profile_hide_friends.tpl"); $hide_friends = replace_macros($opt_tpl, array('$field' => array('hide_friends', t('Hide your contact/friend list from viewers of this profile?'), $r[0]['hide_friends'], ''))); $q = q("select * from profdef where true"); if ($q) { $extra_fields = array(); foreach ($q as $qq) { $mine = q("select v from profext where k = '%s' and hash = '%s' and channel_id = %d limit 1", dbesc($qq['field_name']), dbesc($r[0]['profile_guid']), intval(local_channel())); if (array_key_exists($qq['field_name'], $fields)) { $extra_fields[] = array($qq['field_name'], $qq['field_desc'], $mine ? $mine[0]['v'] : '', $qq['field_help']); } } } //logger('extra_fields: ' . print_r($extra_fields,true)); $f = get_config('system', 'birthday_input_format'); if (!$f) { $f = 'ymd'; } $is_default = $r[0]['is_default'] ? 1 : 0; $tpl = get_markup_template("profile_edit.tpl"); $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("profile_edit"), '$profile_clone_link' => feature_enabled(local_channel(), 'multi_profiles') ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : '', '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), '$fields' => $fields, '$guid' => $r[0]['profile_guid'], '$banner' => t('Edit Profile Details'), '$submit' => t('Submit'), '$viewprof' => t('View this profile'), '$editvis' => t('Edit visibility'), '$profpic' => t('Change Profile Photo'), '$cr_prof' => t('Create a new profile using these settings'), '$cl_prof' => t('Clone this profile'), '$del_prof' => t('Delete this profile'), '$exportable' => feature_enabled(local_channel(), 'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), '$lbl_profname' => t('Profile Name:'), '$lbl_fullname' => t('Your Full Name:'), '$lbl_title' => t('Title/Description:'), '$lbl_gender' => t('Your Gender:'), '$lbl_bd' => t("Birthday :"), '$lbl_address' => t('Street Address:'), '$lbl_city' => t('Locality/City:'), '$lbl_zip' => t('Postal/Zip Code:'), '$lbl_country' => t('Country:'), '$lbl_region' => t('Region/State:'), '$lbl_marital' => t('<span class="heart">♥</span> Marital Status:'), '$lbl_with' => t("Who: (if applicable)"), '$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'), '$lbl_howlong' => t('Since [date]:'), '$lbl_sexual' => t('Sexual Preference:'), '$lbl_homepage' => t('Homepage URL:'), '$lbl_hometown' => t('Hometown:'), '$lbl_politic' => t('Political Views:'), '$lbl_religion' => t('Religious Views:'), '$lbl_pubkey' => t('Keywords:'), '$lbl_likes' => t('Likes:'), '$lbl_dislikes' => t('Dislikes:'), '$lbl_ex2' => t('Example: fishing photography software'), '$lbl_pubdsc' => t("Used in directory listings"), '$lbl_about' => t('Tell us about yourself...'), '$lbl_hobbies' => t('Hobbies/Interests'), '$lbl_social' => t('Contact information and Social Networks'), '$lbl_channels' => t('My other channels'), '$lbl_music' => t('Musical interests'), '$lbl_book' => t('Books, literature'), '$lbl_tv' => t('Television'), '$lbl_film' => t('Film/dance/culture/entertainment'), '$lbl_love' => t('Love/romance'), '$lbl_work' => t('Work/employment'), '$lbl_school' => t('School/education'), '$disabled' => $is_default ? 'onclick="return false;" style="color: #BBBBFF;"' : '', '$baseurl' => $a->get_baseurl(true), '$profile_id' => $r[0]['id'], '$profile_name' => $r[0]['profile_name'], '$is_default' => $is_default, '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$advanced' => $advanced, '$name' => $r[0]['name'], '$pdesc' => $r[0]['pdesc'], '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, '$address' => $r[0]['address'], '$locality' => $r[0]['locality'], '$region' => $r[0]['region'], '$postal_code' => $r[0]['postal_code'], '$country_name' => $r[0]['country_name'], '$age' => intval($r[0]['dob']) ? '(' . t('Age: ') . age($r[0]['dob'], $a->user['timezone'], $a->user['timezone']) . ')' : '', '$gender' => gender_selector($r[0]['gender']), '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), '$with' => $r[0]['with'], '$howlong' => $r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC', date_default_timezone_get(), $r[0]['howlong']), '$sexual' => sexpref_selector($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']), '$about' => $r[0]['about'], '$homepage' => $r[0]['homepage'], '$hometown' => $r[0]['hometown'], '$politic' => $r[0]['politic'], '$religion' => $r[0]['religion'], '$keywords' => $r[0]['keywords'], '$likes' => $r[0]['likes'], '$dislikes' => $r[0]['dislikes'], '$music' => $r[0]['music'], '$book' => $r[0]['book'], '$tv' => $r[0]['tv'], '$film' => $r[0]['film'], '$interest' => $r[0]['interest'], '$romance' => $r[0]['romance'], '$work' => $r[0]['work'], '$education' => $r[0]['education'], '$contact' => $r[0]['contact'], '$channels' => $r[0]['channels'], '$extra_fields' => $extra_fields)); $arr = array('profile' => $r[0], 'entry' => $o); call_hooks('profile_edit', $arr); return $o; } else { $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_channel()); if (count($r)) { $tpl_header = get_markup_template('profile_listing_header.tpl'); $o .= replace_macros($tpl_header, array('$header' => t('Edit/Manage Profiles'), '$addstuff' => t('Add profile things'), '$stuff_desc' => t('Include desirable objects in your profile'), '$chg_photo' => t('Change profile photo'), '$cr_new' => t('Create New Profile'), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"))); $tpl = get_markup_template('profile_entry.tpl'); foreach ($r as $rr) { $o .= replace_macros($tpl, array('$photo' => $rr['thumb'], '$id' => $rr['id'], '$alt' => t('Profile Image'), '$profile_name' => $rr['profile_name'], '$visible' => $rr['is_default'] ? '<strong>' . translate_scope(map_scope($channel['channel_r_profile'])) . '</strong>' : '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')); } } return $o; } }