From 93735df2c78b249d5735834c190dc91bad336172 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 13 Jan 2015 17:54:40 +0100 Subject: Allow tags in mail, many profile fields, and admin info --- include/identity.php | 14 +------------- include/text.php | 2 +- mod/admin.php | 2 ++ mod/item.php | 2 +- mod/mail.php | 3 +++ mod/photos.php | 2 +- mod/profiles.php | 16 ++++++++++++++++ mod/siteinfo.php | 3 ++- 8 files changed, 27 insertions(+), 17 deletions(-) diff --git a/include/identity.php b/include/identity.php index 2f400520f..d98f39cb7 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1205,21 +1205,9 @@ function advanced_profile(&$a) { if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); - if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); - // Support tags in the other channels field (probably want to restrict it to channels only?) - $txt = $a->profile['channels']; - $matches = get_tags($txt); - $access_tag = ''; - $str_tags = ''; - foreach($matches as $m) { - $success = handle_tag($a, $txt, $access_tag, $str_tags, $a->profile_uid, $m); // Use uid of the profile maker - } - - if($txt = prepare_text($txt)) { - $profile['channels'] = array( t('My other channels:'), $txt); - } + if($txt = prepare_text($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt); if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); diff --git a/include/text.php b/include/text.php index 035c092a6..6b579e35c 100644 --- a/include/text.php +++ b/include/text.php @@ -2351,7 +2351,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) { return array('replaced' => $replaced, 'termtype' => $termtype, 'term' => $newname, 'url' => $url, 'contact' => $r[0]); } -function linkify_tags($a, &$body, $uid, $profile_uid) { +function linkify_tags($a, &$body, $uid) { $str_tags = ''; $tagged = array(); $result = array(); diff --git a/mod/admin.php b/mod/admin.php index 74a373738..1503bf18e 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -288,6 +288,8 @@ function admin_page_site_post(&$a){ del_config('system','admininfo'); } else { + require_once('include/text.php'); + linkify_tags($a, $admininfo, local_user()); set_config('system','admininfo', $admininfo); } set_config('system','language', $language); diff --git a/mod/item.php b/mod/item.php index 7a14a8ae9..e1855732e 100644 --- a/mod/item.php +++ b/mod/item.php @@ -576,7 +576,7 @@ function item_post(&$a) { // Look for tags and linkify them - $results = linkify_tags($a, $body, $uid, $profile_uid); + $results = linkify_tags($a, $body, ($uid) ? $uid : $profile_uid); // Set permissions based on tag replacements set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $parent_item); diff --git a/mod/mail.php b/mod/mail.php index 6c778b956..37679aebf 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -83,6 +83,9 @@ function mail_post(&$a) { // $body = fix_mce_lf($body); // } + require_once('include/text.php'); + linkify_tags($a, $body, local_user()); + if(! $recipient) { notice('No recipient found.'); $a->argc = 2; diff --git a/mod/photos.php b/mod/photos.php index df9880c8d..3a7ef2d71 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -354,7 +354,7 @@ function photos_post(&$a) { require_once('include/text.php'); $profile_uid = $a->profile['profile_uid']; - $results = linkify_tags($a, $rawtags, local_user(), $profile_uid); + $results = linkify_tags($a, $rawtags, (local_user()) ? local_user() : $profile_uid); $success = $results['success']; $post_tags = array(); diff --git a/mod/profiles.php b/mod/profiles.php index fa6a6e35c..11cd86645 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -296,6 +296,22 @@ function profiles_post(&$a) { $work = fix_mce_lf(escape_tags(trim($_POST['work']))); $education = fix_mce_lf(escape_tags(trim($_POST['education']))); + require_once('include/text.php'); + linkify_tags($a, $likes, local_user()); + linkify_tags($a, $dislikes, local_user()); + linkify_tags($a, $about, local_user()); + linkify_tags($a, $interest, local_user()); + linkify_tags($a, $interest, local_user()); + linkify_tags($a, $contact, local_user()); + linkify_tags($a, $channels, local_user()); + linkify_tags($a, $music, local_user()); + linkify_tags($a, $book, local_user()); + linkify_tags($a, $tv, local_user()); + linkify_tags($a, $film, local_user()); + linkify_tags($a, $romance, local_user()); + linkify_tags($a, $work, local_user()); + linkify_tags($a, $education, local_user()); + $hide_friends = (($_POST['hide_friends'] == 1) ? 1: 0); $with = ((x($_POST,'with')) ? escape_tags(trim($_POST['with'])) : ''); diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 01804e62a..1f3cd4479 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -126,7 +126,8 @@ function siteinfo_content(&$a) { else $plugins_text = t('No installed plugins/addons/apps'); - $admininfo = bbcode(get_config('system','admininfo')); + $txt = get_config('system','admininfo'); + $admininfo = bbcode($txt); if(file_exists('doc/site_donate.html')) $donate .= file_get_contents('doc/site_donate.html'); -- cgit v1.2.3