]> git.mxchange.org Git - friendica.git/commitdiff
add like/dislike to profiles
authorfriendica <info@friendica.com>
Mon, 25 Jun 2012 04:16:55 +0000 (21:16 -0700)
committerfriendica <info@friendica.com>
Mon, 25 Jun 2012 04:16:55 +0000 (21:16 -0700)
boot.php
database.sql
include/profile_advanced.php
mod/profiles.php
update.php
view/profile_advanced.tpl
view/profile_edit.tpl

index 8aa36f18ab4b3138abf8b1da3a1ae3cbef6a8048..2c8723d26b729e71c6f4c4a0e398383c18e1eb2f 100644 (file)
--- 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',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
index 53dc0c5b215c77248563c9cb6246cba62ff646d8..8178ffa866b7f9ac040cd0dcc8a57e6fc6a6e399 100644 (file)
@@ -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,
index ffb45090b9b8c5f876c30b2272ba4b48287f9bd5..8dfb1beecc3744d2661efb34dddb490cf01619f8 100644 (file)
@@ -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);
index a9da5454cf787ae4674b77d4ecc96defaa20e91d..4df8a5af7e6b3d1da8c52c41ccdfa7810e17ff91 100644 (file)
@@ -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]&hearts;[/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'],
index 0f7bf664d99ec8e8fb1a766909d583a6fd6dedab..eeb8b07b15f5302bd94cc9c112e212aba609763c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1149 );
+define( 'UPDATE_VERSION' , 1150 );
 
 /**
  *
@@ -1289,3 +1289,12 @@ function update_1148() {
                return UPDATE_FAILED;
        return UPDATE_SUCCESS;
 }
+
+
+function update_1149() {
+       $r1 = q("ALTER TABLE profile ADD likes text NOT NULL after prv_keywords");
+       $r2 = q("ALTER TABLE profile ADD dislikes text NOT NULL after likes");
+       if (! ($r1 && $r2))
+               return UPDATE_FAILED;
+       return UPDATE_SUCCESS;
+}
index 0b8f31f437fabceb792add6d83b1297c16f10df0..b02b7f27defc2d2c9de287cc039648a0c87974c8 100644 (file)
 </dl>
 {{ endif }}
 
+{{ if $profile.likes }}
+<dl id="aprofile-likes" class="aprofile">
+ <dt>$profile.likes.0</dt>
+ <dd>$profile.likes.1</dd>
+</dl>
+{{ endif }}
+
+{{ if $profile.dislikes }}
+<dl id="aprofile-dislikes" class="aprofile">
+ <dt>$profile.dislikes.0</dt>
+ <dd>$profile.dislikes.1</dd>
+</dl>
+{{ endif }}
 
 {{ if $profile.contact }}
 <dl id="aprofile-contact" class="aprofile">
index ad34b995672e8bffc18128514d3ee8ec42d71898..64cd4732487a90a487618e2232941fcfef984501 100644 (file)
@@ -187,6 +187,30 @@ $lbl_hobbies
 </div>
 
 
+<div id="likes-jot-wrapper" >
+<p id="likes-jot-desc" >
+$lbl_likes
+</p>
+
+<textarea rows="10" cols="72" id="likes-jot-text" name="likes" >$likes</textarea>
+
+</div>
+<div id="likes-jot-end"></div>
+</div>
+
+
+<div id="dislikes-jot-wrapper" >
+<p id="dislikes-jot-desc" >
+$lbl_dislikes
+</p>
+
+<textarea rows="10" cols="72" id="dislikes-jot-text" name="dislikes" >$dislikes</textarea>
+
+</div>
+<div id="dislikes-jot-end"></div>
+</div>
+
+
 <div id="contact-jot-wrapper" >
 <p id="contact-jot-desc" >
 $lbl_social