]> 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 9cd1ed8a02c1fd627a2dfc34a78db1f289938cbe..f9fde658d2a9766d0a825b2a36928563065a3287 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 require_once("include/Contact.php");
+require_once('include/Probe.php');
 
 function profiles_init(&$a) {
 
@@ -14,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
@@ -129,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;
@@ -251,7 +252,7 @@ function profiles_post(&$a) {
                                $lookup = str_replace('_',' ', $lookup);
                                if(strpos($lookup,'@') || (strpos($lookup,'http://'))) {
                                        $newname = $lookup;
-                                       $links = @lrdd($lookup);
+                                       $links = @Probe::lrdd($lookup);
                                        if(count($links)) {
                                                foreach($links as $link) {
                                                        if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
@@ -285,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'];
                                        }
@@ -302,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
@@ -367,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;
@@ -408,6 +414,7 @@ function profiles_post(&$a) {
                        `with` = '%s',
                        `howlong` = '%s',
                        `sexual` = '%s',
+                       `xmpp` = '%s',
                        `homepage` = '%s',
                        `hometown` = '%s',
                        `politic` = '%s',
@@ -442,6 +449,7 @@ function profiles_post(&$a) {
                        dbesc($with),
                        dbesc($howlong),
                        dbesc($sexual),
+                       dbesc($xmpp),
                        dbesc($homepage),
                        dbesc($hometown),
                        dbesc($politic),
@@ -495,7 +503,7 @@ function profiles_post(&$a) {
                        // Update global directory in background
                        $url = $_SESSION['my_url'];
                        if($url && strlen(get_config('system','directory')))
-                               proc_run('php',"include/directory.php","$url");
+                               proc_run(PRIORITY_LOW, "include/directory.php", $url);
 
                        require_once('include/profile_update.php');
                        profile_change();
@@ -586,9 +594,8 @@ function profile_activity($changed, $value) {
        $arr['deny_gid']  = $a->user['deny_gid'];
 
        $i = item_store($arr);
-       if($i) {
-               proc_run('php',"include/notifier.php","activity","$i");
-       }
+       if($i)
+               proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
 }
 
 
@@ -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) {