]> git.mxchange.org Git - friendica.git/blobdiff - mod/profiles.php
Again, static *OR* object-referencing calls? Blue or red pill?
[friendica.git] / mod / profiles.php
index d770e75c3af21f52549517f359f8aee257d08817..f9fde658d2a9766d0a825b2a36928563065a3287 100644 (file)
@@ -15,7 +15,7 @@ function profiles_init(&$a) {
                        intval($a->argv[2]),
                        intval(local_user())
                );
-               if(! count($r)) {
+               if(! dbm::is_result($r)) {
                        notice( t('Profile not found.') . EOL);
                        goaway('profiles');
                        return; // NOTREACHED
@@ -130,7 +130,7 @@ function profiles_init(&$a) {
                        intval($a->argv[1]),
                        intval(local_user())
                );
-               if(! count($r)) {
+               if(! dbm::is_result($r)) {
                        notice( t('Profile not found.') . EOL);
                        killme();
                        return;
@@ -286,7 +286,7 @@ function profiles_post(&$a) {
                                                        intval(local_user())
                                                );
                                        }
-                                       if(count($r)) {
+                                       if (dbm::is_result($r)) {
                                                $prf = $r[0]['url'];
                                                $newname = $r[0]['name'];
                                        }
@@ -303,6 +303,7 @@ function profiles_post(&$a) {
                }
 
                $sexual = notags(trim($_POST['sexual']));
+               $xmpp = notags(trim($_POST['xmpp']));
                $homepage = notags(trim($_POST['homepage']));
                if ((strpos($homepage, 'http') !== 0) && (strlen($homepage))) {
                        // neither http nor https in URL, add them
@@ -368,6 +369,10 @@ function profiles_post(&$a) {
                                $changes[] = t('Sexual Preference');
                                $value = $sexual;
                        }
+                       if($xmpp != $orig[0]['xmpp']) {
+                               $changes[] = t('XMPP');
+                               $value = $xmpp;
+                       }
                        if($homepage != $orig[0]['homepage']) {
                                $changes[] = t('Homepage');
                                $value = $homepage;
@@ -409,6 +414,7 @@ function profiles_post(&$a) {
                        `with` = '%s',
                        `howlong` = '%s',
                        `sexual` = '%s',
+                       `xmpp` = '%s',
                        `homepage` = '%s',
                        `hometown` = '%s',
                        `politic` = '%s',
@@ -443,6 +449,7 @@ function profiles_post(&$a) {
                        dbesc($with),
                        dbesc($howlong),
                        dbesc($sexual),
+                       dbesc($xmpp),
                        dbesc($homepage),
                        dbesc($hometown),
                        dbesc($politic),
@@ -606,7 +613,7 @@ function profiles_content(&$a) {
                        intval($a->argv[1]),
                        intval(local_user())
                );
-               if(! count($r)) {
+               if(! dbm::is_result($r)) {
                        notice( t('Profile not found.') . EOL);
                        return;
                }
@@ -725,6 +732,7 @@ function profiles_content(&$a) {
                        '$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
                        '$sexual' => sexpref_selector($r[0]['sexual']),
                        '$about' => array('about', t('Tell us about yourself...'), $r[0]['about']),
+                       '$xmpp' => array('xmpp', t('XMPP (Jabber) address:'), $r[0]['xmpp'], t("The XMPP address will be propagated to your contacts so that they can follow you.")),
                        '$homepage' => array('homepage', t('Homepage URL:'), $r[0]['homepage']),
                        '$hometown' => array('hometown', t('Hometown:'), $r[0]['hometown']),
                        '$politic' => array('politic', t('Political Views:'), $r[0]['politic']),
@@ -759,7 +767,7 @@ function profiles_content(&$a) {
                                "SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
                                local_user()
                        );
-                       if(count($r)){
+                       if (dbm::is_result($r)){
                                //Go to the default profile.
                                goaway('profiles/'.$r[0]['id']);
                        }
@@ -767,7 +775,7 @@ function profiles_content(&$a) {
 
                $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
                        local_user());
-               if(count($r)) {
+               if (dbm::is_result($r)) {
 
                        $tpl = get_markup_template('profile_entry.tpl');
                        foreach($r as $rr) {