]> git.mxchange.org Git - friendica.git/blobdiff - mod/contacts.php
Add Contact Object
[friendica.git] / mod / contacts.php
index a129a665d131d67f2e55ab020218e01d2d22e1ef..dba7680bad17bc357278b5320bcb307fb0b1fb6e 100644 (file)
@@ -2,12 +2,14 @@
 
 use Friendica\App;
 use Friendica\Core\System;
+use Friendica\Core\Worker;
+use Friendica\Database\DBM;
+use Friendica\Model\GlobalContact;
 use Friendica\Network\Probe;
+use Friendica\Object\Contact;
 
 require_once 'include/Contact.php';
-require_once 'include/socgraph.php';
 require_once 'include/contact_selectors.php';
-require_once 'include/probe.php';
 require_once 'mod/proxy.php';
 require_once 'include/Photo.php';
 
@@ -24,7 +26,7 @@ function contacts_init(App $a) {
                        intval(local_user()),
                        intval($contact_id)
                );
-               if (! dbm::is_result($r)) {
+               if (! DBM::is_result($r)) {
                        $contact_id = 0;
                }
        }
@@ -183,7 +185,7 @@ function contacts_post(App $a) {
                        intval($profile_id),
                        intval(local_user())
                );
-               if (! dbm::is_result($r)) {
+               if (! DBM::is_result($r)) {
                        notice( t('Could not locate selected profile.') . EOL);
                        return;
                }
@@ -225,7 +227,7 @@ function contacts_post(App $a) {
                intval($contact_id),
                intval(local_user())
        );
-       if($r && dbm::is_result($r))
+       if($r && DBM::is_result($r))
                $a->data['contact'] = $r[0];
 
        return;
@@ -251,7 +253,7 @@ function _contact_update($contact_id) {
                                intval($contact_id));
        } else
                // pull feed and consume it, which should subscribe to the hub.
-               proc_run(PRIORITY_HIGH, "include/onepoll.php", $contact_id, "force");
+               Worker::add(PRIORITY_HIGH, "OnePoll", $contact_id, "force");
 }
 
 function _contact_update_profile($contact_id) {
@@ -311,7 +313,7 @@ function _contact_update_profile($contact_id) {
        update_contact_avatar($data['photo'], local_user(), $contact_id, true);
 
        // Update the entry in the gcontact table
-       update_gcontact_from_probe($data["url"]);
+       GlobalContact::updateFromProbe($data["url"]);
 }
 
 function _contact_block($contact_id, $orig_record) {
@@ -352,7 +354,7 @@ function _contact_drop($contact_id, $orig_record) {
                WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
                intval($a->user['uid'])
        );
-       if (!dbm::is_result($r)) {
+       if (!DBM::is_result($r)) {
                return;
        }
 
@@ -560,12 +562,12 @@ function contacts_content(App $a) {
 
                $nettype = sprintf( t('Network type: %s'),network_to_name($contact['network'], $contact["url"]));
 
-               //$common = count_common_friends(local_user(),$contact['id']);
+               //$common = GlobalContact::countCommonFriends(local_user(),$contact['id']);
                //$common_text = (($common) ? sprintf( tt('%d contact in common','%d contacts in common', $common),$common) : '');
 
                $polling = (($contact['network'] === NETWORK_MAIL | $contact['network'] === NETWORK_FEED) ? 'polling' : '');
 
-               //$x = count_all_friends(local_user(), $contact['id']);
+               //$x = GlobalContact::countAllFriends(local_user(), $contact['id']);
                //$all_friends = (($x) ? t('View all contacts') : '');
 
                // tabs
@@ -794,7 +796,7 @@ function contacts_content(App $a) {
        $r = q("SELECT COUNT(*) AS `total` FROM `contact`
                WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
                intval($_SESSION['uid']));
-       if (dbm::is_result($r)) {
+       if (DBM::is_result($r)) {
                $a->set_pager_total($r[0]['total']);
                $total = $r[0]['total'];
        }
@@ -809,7 +811,7 @@ function contacts_content(App $a) {
 
        $contacts = array();
 
-       if (dbm::is_result($r)) {
+       if (DBM::is_result($r)) {
                foreach ($r as $rr) {
                        $contacts[] = _contact_detail_for_template($rr);
                }
@@ -871,13 +873,13 @@ function contacts_tab($a, $contact_id, $active_tab) {
                        'url' => "contacts/".$contact_id,
                        'sel' => (($active_tab == 2)?'active':''),
                        'title' => t('Profile Details'),
-                       'id' => 'status-tab',
+                       'id' => 'profile-tab',
                        'accesskey' => 'o',
                )
        );
 
        // Show this tab only if there is visible friend list
-       $x = count_all_friends(local_user(), $contact_id);
+       $x = GlobalContact::countAllFriends(local_user(), $contact_id);
        if ($x)
                $tabs[] = array('label'=>t('Contacts'),
                                'url' => "allfriends/".$contact_id,
@@ -887,7 +889,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
                                'accesskey' => 't');
 
        // Show this tab only if there is visible common friend list
-       $common = count_common_friends(local_user(),$contact_id);
+       $common = GlobalContact::countCommonFriends(local_user(), $contact_id);
        if ($common)
                $tabs[] = array('label'=>t('Common Friends'),
                                'url' => "common/loc/".local_user()."/".$contact_id,