From 7b6385df946db4a61e8fc330c1a89b1415ca68ef Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 28 Dec 2010 01:06:34 -0800 Subject: [PATCH] freeform text area for private contact info - notes or things you just want to remember (addresses, phone numbers, birthdays, whatever) --- boot.php | 2 +- database.sql | 1 + mod/contacts.php | 8 +++++++- update.php | 3 +++ view/contact_head.tpl | 31 +++++++++++++++++++++++++++++++ view/en/contact_edit.tpl | 8 ++++++++ view/it/contact_edit.tpl | 9 +++++++++ 7 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 view/contact_head.tpl diff --git a/boot.php b/boot.php index 6565d40bd8..197b6d2381 100644 --- a/boot.php +++ b/boot.php @@ -2,7 +2,7 @@ set_time_limit(0); -define ( 'BUILD_ID', 1029 ); +define ( 'BUILD_ID', 1030 ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); diff --git a/database.sql b/database.sql index bb151da27c..4a8350f84f 100644 --- a/database.sql +++ b/database.sql @@ -87,6 +87,7 @@ CREATE TABLE IF NOT EXISTS `contact` ( `pending` tinyint(1) NOT NULL DEFAULT '1', `rating` tinyint(1) NOT NULL DEFAULT '0', `reason` text NOT NULL, + `info` MEDIUMTEXT NOT NULL AFTER `reason`, `profile-id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `uid` (`uid`), diff --git a/mod/contacts.php b/mod/contacts.php index 29ef8a8cd7..33d1955a54 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -65,12 +65,15 @@ function contacts_post(&$a) { $reason = notags(trim($_POST['reason'])); - $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s' + $info = escape_tags(trim($_POST['info'])); + + $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s', `info` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($profile_id), intval($priority), intval($rating), dbesc($reason), + dbesc($info), intval($contact_id), intval(local_user()) ); @@ -190,6 +193,8 @@ function contacts_content(&$a) { return; } + $tpl = load_view_file('view/contact_head.tpl'); + $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); require_once('include/contact_selectors.php'); @@ -239,6 +244,7 @@ function contacts_content(&$a) { '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ), '$ignore_text' => (($r[0]['readonly']) ? t('Unignore this contact') : t('Ignore this contact') ), '$insecure' => (($r[0]['network'] === 'dfrn') ? '' : load_view_file('view/insecure_net.tpl')), + '$info' => $r[0]['info'], '$blocked' => (($r[0]['blocked']) ? '
' . t('Currently blocked') . '
' : ''), '$ignored' => (($r[0]['readonly']) ? '
' . t('Currently ignored') . '
' : ''), '$rating' => contact_reputation($r[0]['rating']), diff --git a/update.php b/update.php index d6fab4255a..afa3b58a43 100644 --- a/update.php +++ b/update.php @@ -274,3 +274,6 @@ function update_1028() { q("ALTER TABLE `user` ADD `openidserver` text NOT NULL AFTER `deny_gid` "); } +function update_1029() { + q("ALTER TABLE `contact` ADD `info` MEDIUMTEXT NOT NULL AFTER `reason` "); +} diff --git a/view/contact_head.tpl b/view/contact_head.tpl new file mode 100644 index 0000000000..6a80c21222 --- /dev/null +++ b/view/contact_head.tpl @@ -0,0 +1,31 @@ + + + diff --git a/view/en/contact_edit.tpl b/view/en/contact_edit.tpl index a5c8dc4abb..79a7651c1c 100644 --- a/view/en/contact_edit.tpl +++ b/view/en/contact_edit.tpl @@ -38,6 +38,14 @@ $ignored
+
+

Contact Information / Notes

+ +
+
+ + +

Profile Visibility

Please choose the profile you would like to display to $name when viewing your profile securely. diff --git a/view/it/contact_edit.tpl b/view/it/contact_edit.tpl index cc4db7c15c..80446f044d 100644 --- a/view/it/contact_edit.tpl +++ b/view/it/contact_edit.tpl @@ -38,6 +38,15 @@ $ignored +

+

Informazioni di contatto / Note

+ +
+
+ + + +

Visibiltà Profiloe

Scegli il profilo che vuoi mostrare a $name quando guarda il tuo profilo in modo sicuro.