Beispiel #1
0
    $tw_user_id = $token->getParam('user_id');
    $tw_screen_name = $token->getParam('screen_name');
    $tw_config = $do_twitter->getTwitterConfig();
    $ofuz_twitter = new Ofuz_Service_Twitter($tw_user_id, $tw_config, $token);
    $friends = $ofuz_twitter->userFriends(array('id' => $tw_user_id));
    if (count($friends->user) > 0) {
        foreach ($friends->user as $user) {
            $user_id = $user->id;
            $name = $user->name;
            // will contain the first and last name
            $screen_name = $user->screen_name;
            $description = $user->description;
            $profile_image_url = $user->profile_image_url;
            $url = $user->url;
            $friend_data = array('user_id' => $user_id, 'name' => $name, 'screen_name' => $screen_name, 'description' => $description, 'profile_image_url' => $profile_image_url, 'url' => $url);
            $do_twitter->importTwitterFriend($friend_data);
        }
        //rebuilding the userXX_contact table
        $contact_view = new ContactView();
        $contact_view->setUser($_SESSION['do_User']->iduser);
        $contact_view->rebuildContactUserTable();
        echo _('Your Twitter contacts have been successfully imported.');
        echo '&nbsp;&nbsp;&nbsp;<a href="contacts.php">', _('Go to the Contacts Page'), '</a>';
    }
    ?>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
    $("#waitimage").hide(0);
});
//]]>
    $tw_screen_name = $token->getParam('screen_name');
    $tw_config = $do_twitter->getTwitterConfig();
    $ofuz_twitter = new Ofuz_Service_Twitter($tw_user_id, $tw_config, $token);
    $followers = $ofuz_twitter->userFollowers(false);
    // false = do not fetch Status
    if (count($followers->user) > 0) {
        foreach ($followers->user as $user) {
            $user_id = $user->id;
            $name = $user->name;
            // will contain the first and last name
            $screen_name = $user->screen_name;
            $description = $user->description;
            $profile_image_url = $user->profile_image_url;
            $url = $user->url;
            $friend_data = array('user_id' => $user_id, 'name' => $name, 'screen_name' => $screen_name, 'description' => $description, 'profile_image_url' => $profile_image_url, 'url' => $url);
            $do_twitter->importTwitterFriend($friend_data, 'Follower');
        }
        //rebuilding the userXX_contact table
        $contact_view = new ContactView();
        $contact_view->setUser($_SESSION['do_User']->iduser);
        $contact_view->rebuildContactUserTable();
        echo _('Your Twitter followers have been successfully imported.');
        echo '&nbsp;&nbsp;&nbsp;<a href="contacts.php">', _('Go to the Contacts Page'), '</a>';
    }
    ?>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
    $("#waitimage").hide(0);
});
//]]>