diff options
author | friendica <info@friendica.com> | 2012-06-24 21:16:55 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-06-24 21:16:55 -0700 |
commit | c464bc494c51bd871c2cf01a441ea2c4f8defc65 (patch) | |
tree | 14a4c5a83cab785f41ae465c308729ce7b551a56 | |
parent | 9528beac34389f8d8f20de1816bca8d516a556cc (diff) | |
download | volse-hubzilla-c464bc494c51bd871c2cf01a441ea2c4f8defc65.tar.gz volse-hubzilla-c464bc494c51bd871c2cf01a441ea2c4f8defc65.tar.bz2 volse-hubzilla-c464bc494c51bd871c2cf01a441ea2c4f8defc65.zip |
add like/dislike to profiles
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | database.sql | 2 | ||||
-rw-r--r-- | include/profile_advanced.php | 5 | ||||
-rw-r--r-- | mod/profiles.php | 21 | ||||
-rw-r--r-- | update.php | 11 | ||||
-rw-r--r-- | view/profile_advanced.tpl | 13 | ||||
-rw-r--r-- | view/profile_edit.tpl | 24 |
7 files changed, 75 insertions, 3 deletions
@@ -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' ); diff --git a/database.sql b/database.sql index 53dc0c5b2..8178ffa86 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 ffb45090b..8dfb1beec 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 a9da5454c..4df8a5af7 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 0f7bf664d..eeb8b07b1 100644 --- a/update.php +++ b/update.php @@ -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; +} diff --git a/view/profile_advanced.tpl b/view/profile_advanced.tpl index 0b8f31f43..b02b7f27d 100644 --- a/view/profile_advanced.tpl +++ b/view/profile_advanced.tpl @@ -89,6 +89,19 @@ </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"> diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl index ad34b9956..64cd47324 100644 --- a/view/profile_edit.tpl +++ b/view/profile_edit.tpl @@ -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 |