From c464bc494c51bd871c2cf01a441ea2c4f8defc65 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 24 Jun 2012 21:16:55 -0700 Subject: [PATCH] add like/dislike to profiles --- boot.php | 2 +- database.sql | 2 ++ include/profile_advanced.php | 5 +++++ mod/profiles.php | 21 ++++++++++++++++++++- update.php | 11 ++++++++++- view/profile_advanced.tpl | 13 +++++++++++++ view/profile_edit.tpl | 24 ++++++++++++++++++++++++ 7 files changed, 75 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 8aa36f18ab..2c8723d26b 100644 --- a/boot.php +++ b/boot.php @@ -12,7 +12,7 @@ require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_VERSION', '3.0.1384' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1149 ); +define ( 'DB_UPDATE_VERSION', 1150 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 53dc0c5b21..8178ffa866 100644 --- a/database.sql +++ b/database.sql @@ -831,6 +831,8 @@ CREATE TABLE IF NOT EXISTS `profile` ( `religion` char(255) NOT NULL, `pub_keywords` text NOT NULL, `prv_keywords` text NOT NULL, + `likes` text NOT NULL, + `dislikes` text NOT NULL, `about` text NOT NULL, `summary` char(255) NOT NULL, `music` text NOT NULL, diff --git a/include/profile_advanced.php b/include/profile_advanced.php index ffb45090b9..8dfb1beecc 100644 --- a/include/profile_advanced.php +++ b/include/profile_advanced.php @@ -59,6 +59,11 @@ function advanced_profile(&$a) { if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); + if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); + + 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); if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); diff --git a/mod/profiles.php b/mod/profiles.php index a9da5454cf..4df8a5af7e 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -130,6 +130,9 @@ function profiles_post(&$a) { $politic = notags(trim($_POST['politic'])); $religion = notags(trim($_POST['religion'])); + $likes = fix_mce_lf(escape_tags(trim($_POST['likes']))); + $dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes']))); + $about = fix_mce_lf(escape_tags(trim($_POST['about']))); $interest = fix_mce_lf(escape_tags(trim($_POST['interest']))); $contact = fix_mce_lf(escape_tags(trim($_POST['contact']))); @@ -155,7 +158,15 @@ function profiles_post(&$a) { if($withchanged) { $changes[] = '[color=#ff0000]♥[/color] ' . t('Romantic Partner'); $value = strip_tags($with); - } + } + if($likes != $orig[0]['likes']) { + $changes[] = t('Likes'); + $value = $likes; + } + if($dislikes != $orig[0]['dislikes']) { + $changes[] = t('Dislikes'); + $value = $dislikes; + } if($work != $orig[0]['work']) { $changes[] = t('Work/Employment'); } @@ -222,6 +233,8 @@ function profiles_post(&$a) { `religion` = '%s', `pub_keywords` = '%s', `prv_keywords` = '%s', + `likes` = '%s', + `dislikes` = '%s', `about` = '%s', `interest` = '%s', `contact` = '%s', @@ -254,6 +267,8 @@ function profiles_post(&$a) { dbesc($religion), dbesc($pub_keywords), dbesc($prv_keywords), + dbesc($likes), + dbesc($dislikes), dbesc($about), dbesc($interest), dbesc($contact), @@ -577,6 +592,8 @@ function profiles_content(&$a) { '$lbl_religion' => t('Religious Views:'), '$lbl_pubkey' => t('Public Keywords:'), '$lbl_prvkey' => t('Private Keywords:'), + '$lbl_likes' => t('Likes:'), + '$lbl_dislikes' => t('Dislikes:'), '$lbl_ex2' => t('Example: fishing photography software'), '$lbl_pubdsc' => t("\x28Used for suggesting potential friends, can be seen by others\x29"), '$lbl_prvdsc' => t("\x28Used for searching profiles, never shown to others\x29"), @@ -617,6 +634,8 @@ function profiles_content(&$a) { '$religion' => $r[0]['religion'], '$pub_keywords' => $r[0]['pub_keywords'], '$prv_keywords' => $r[0]['prv_keywords'], + '$likes' => $r[0]['likes'], + '$dislikes' => $r[0]['dislikes'], '$music' => $r[0]['music'], '$book' => $r[0]['book'], '$tv' => $r[0]['tv'], diff --git a/update.php b/update.php index 0f7bf664d9..eeb8b07b15 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ {{ endif }} +{{ if $profile.likes }} +
+
$profile.likes.0
+
$profile.likes.1
+
+{{ endif }} + +{{ if $profile.dislikes }} +
+
$profile.dislikes.0
+
$profile.dislikes.1
+
+{{ endif }} {{ if $profile.contact }}
diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl index ad34b99567..64cd473248 100644 --- a/view/profile_edit.tpl +++ b/view/profile_edit.tpl @@ -187,6 +187,30 @@ $lbl_hobbies +
+

+$lbl_likes +

+ + + +
+
+ + + +
+

+$lbl_dislikes +

+ + + +
+
+ + +

$lbl_social