]> git.mxchange.org Git - friendica.git/commitdiff
relationship targets (linked if applicable)
authorFriendika <info@friendika.com>
Sat, 4 Dec 2010 06:46:42 +0000 (22:46 -0800)
committerFriendika <info@friendika.com>
Sat, 4 Dec 2010 06:46:42 +0000 (22:46 -0800)
mod/profiles.php
view/en/profile_advanced.php
view/en/profile_edit.tpl
view/theme/default/style.css

index d510e4398a5949fc482e33515c7864c9033ef148..604eb2f62c30a54dfe47f01788a9fae36662300f 100644 (file)
@@ -57,6 +57,53 @@ function profiles_post(&$a) {
                if($marital != $orig[0]['marital'])
                        $maritalchanged = true;
 
+               $with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
+
+               // linkify the relationship target if applicable
+
+               if(strlen($with)) {
+                       if($with != strip_tags($orig[0]['with'])) {
+                               $prf = '';
+                               $lookup = $with;
+                               if((strpos($lookup,'@')) || (strpos($lookup,'http://'))) {
+                                       $newname = $lookup;
+                                       $links = @lrdd($lookup);
+                                       if(count($links)) {
+                                               foreach($links as $link) {
+                                                       if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
+                                       $prf = $link['@attributes']['href'];
+                                                       }
+                                               }
+                                       }
+                               }
+                               else {
+                                       $newname = $lookup;
+                                       if(strstr($lookup,' ')) {
+                                               $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
+                                                       dbesc($newname),
+                                                       intval(local_user())
+                                               );
+                                       }
+                                       else {
+                                               $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
+                                                       dbesc($lookup),
+                                                       intval(local_user())
+                                               );
+                                       }
+                                       if(count($r)) {
+                                               $prf = $r[0]['url'];
+                                               $newname = $r[0]['name'];
+                                       }
+                               }
+       
+                               if($prf) {
+                                       $with = str_replace($lookup,'<a href="' . $prf . '">' . $newname        . '</a>', $with);
+                               }
+                       }
+                       else
+                               $with = $orig[0]['with'];
+               }
+
                $sexual = notags(trim($_POST['sexual']));
                $homepage = notags(trim($_POST['homepage']));
                $politic = notags(trim($_POST['politic']));
@@ -86,6 +133,7 @@ function profiles_post(&$a) {
                        `postal-code` = '%s',
                        `country-name` = '%s',
                        `marital` = '%s',
+                       `with` = '%s',
                        `sexual` = '%s',
                        `homepage` = '%s',
                        `politic` = '%s',
@@ -112,6 +160,7 @@ function profiles_post(&$a) {
                        dbesc($postal_code),
                        dbesc($country_name),
                        dbesc($marital),
+                       dbesc($with),
                        dbesc($sexual),
                        dbesc($homepage),
                        dbesc($politic),
@@ -296,9 +345,6 @@ function profiles_content(&$a) {
                $a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"include/country.js\" ></script>";
 
 
-
-       
-
                $is_default = (($r[0]['is-default']) ? 1 : 0);
                $tpl = load_view_file("view/profile_edit.tpl");
                $o .= replace_macros($tpl,array(
@@ -318,6 +364,7 @@ function profiles_content(&$a) {
                        '$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
                        '$gender' => gender_selector($r[0]['gender']),
                        '$marital' => marital_selector($r[0]['marital']),
+                       '$with' => strip_tags($r[0]['with']),
                        '$sexual' => sexpref_selector($r[0]['sexual']),
                        '$about' => $r[0]['about'],
                        '$homepage' => $r[0]['homepage'],
@@ -335,8 +382,6 @@ function profiles_content(&$a) {
                ));
 
                return $o;
-
-
        }
        else {
 
index 5f20548072cc5469b49a22ffa2f9650925e4ba1f..c736448e588903cfb6a512316c6e446162a84e18 100644 (file)
@@ -62,6 +62,7 @@ $o .= <<< EOT
 <div id="advanced-profile-marital-wrapper" >
 <div id="advanced-profile-marital-text"><span class="heart">&hearts;</span> Status:</div>
 <div id="advanced-profile-marital">{$a->profile['marital']}</div>
+<div id="advanced-profile-with">({$a->profile['with']})</div>
 </div>
 <div id="advanced-profile-marital-end"></div>
 EOT;
index 8d32226bc9dc65e542bd19cd50eee07f3e71c368..c5b24a88aca0572d26535af793d511034229d498 100644 (file)
@@ -96,6 +96,8 @@ $hide_friends
 <label id="profile-edit-marital-label" for="profile-edit-marital" >Marital Status: </label>
 $marital
 </div>
+<label id="profile-edit-with-label" for="profile-edit-with" > Who: (if applicable) </label>
+<input type="text" size="32" name="with" id="profile-edit-with" value="$with" />
 <div id="profile-edit-marital-end"></div>
 
 <div id="profile-edit-sexual-wrapper" >
index a7896eb35f8e08cb262ae588a510b2e539407b9a..ad3e1c7c156cd2092dd1d6f2ce9b2b19617059b7 100644 (file)
@@ -757,6 +757,11 @@ input#dfrn-url {
        width: 50px;
 }
 
+#profile-edit-with-label {
+       width: 175px;
+       margin-left: 20px;
+}
+
 #profile-edit-homepage {
        float: left;
        margin-bottom: 35px;
@@ -1255,6 +1260,11 @@ input#dfrn-url {
        border: 1px solid #CCCCCC;
 }
 
+#advanced-profile-with {
+       float: left;
+       margin-left: 15px;
+}
+
 #contact-edit-wrapper {
        margin-top: 50px;
 }