function _get_nsid($flickr_user, $more = array())
{
    # TO DO: put this all in a function somewhere and
    # call/queue it when a user signs up...
    # As db_main:Users
    $user = users_get_by_id($flickr_user['user_id']);
    if (!$user) {
        return;
    }
    $method = 'flickr.people.getInfo';
    $args = array('user_id' => $flickr_user['nsid']);
    $ret = flickr_api_call($method, $args);
    if (!$ret['ok']) {
        dumper($args);
        dumper($ret);
        return;
    }
    $rsp = $ret['rsp']['person'];
    $path_alias = $rsp['path_alias'];
    $username = $rsp['username']['_content'];
    echo "[{$user['id']}] path alias: {$path_alias} screen name: {$username}\n";
    if ($path_alias != $flickr_user['path_alias']) {
        $update = array('path_alias' => $path_alias);
        $rsp = flickr_users_update_user($flickr_user, $update);
        echo "[{$user['id']}] update path alias: {$rsp['ok']}\n";
        # just let this fail silently if there's a duplicate
        flickr_users_path_aliases_create($user, $path_alias);
    }
    if ($username != $user['username']) {
        $update = array('username' => $username);
        $rsp = users_update_user($user, $update);
        echo "[{$user['id']}] update username: {$rsp['ok']}\n";
    }
}
コード例 #2
0
function users_delete_user(&$user)
{
    # rely on mysql to enforce a unique key
    # on (email, deleted)
    $new_email = "{$user['email']}.DELETED";
    $rsp = users_update_user($user, array('deleted' => time(), 'email' => AddSlashes($new_email)));
    if (!$rsp['ok']) {
        return $rsp;
    }
    # Hey look! A Dotspotting-ism !
    users_reload_user($user);
    $sheets_rsp = sheets_delete_sheets_for_user($user);
    return $rsp;
}
コード例 #3
0
function users_delete_user(&$user)
{
    # rely on mysql to enforce a unique key
    # on (email, deleted)
    $new_email = "{$user['email']}.DELETED";
    $rsp = users_update_user($user, array('deleted' => time(), 'email' => AddSlashes($new_email)));
    if (!$rsp['ok']) {
        return $rsp;
    }
    #
    # check to see if the application (outside of
    # flamework) has defined a callback function
    # to run once the user has been 'deleted' in
    # the database.
    #
    if (function_exists('users_delete_user_callback')) {
        users_reload_user($user);
        $rsp['callback'] = users_delete_user_callback($user);
    }
    return $rsp;
}
コード例 #4
0
if (post_isset("done") && crumb_check($crumb_key)) {
    $ok = 1;
    if (!post_isset("sync")) {
        $update_error = "missing sync";
        $ok = 0;
    }
    if ($ok) {
        $sync = post_int32("sync");
        if (!isset($sync_states[$sync])) {
            $update_error = "invalid sync";
            $ok = 0;
        }
    }
    if ($ok) {
        if ($sync != $GLOBALS['cfg']['user']['sync_foursquare']) {
            $update = array('sync_foursquare' => $sync);
            $ok = users_update_user($GLOBALS['cfg']['user'], $update);
            if ($ok) {
                $GLOBALS['cfg']['user'] = users_get_by_id($GLOBALS['cfg']['user']['id']);
            } else {
                $update_error = "db error";
            }
        }
    }
    $GLOBALS['smarty']->assign("update", 1);
    $GLOBALS['smarty']->assign("update_ok", $ok);
    $GLOBALS['smarty']->assign("update_error", $update_error);
}
$GLOBALS['smarty']->assign_by_ref("sync_states", $sync_states);
$GLOBALS['smarty']->display("page_account_foursquare_sync.txt");
exit;
コード例 #5
0
ファイル: lib_users.php プロジェクト: jacques/flamework
function users_delete_user(&$user)
{
    return users_update_user($user, array('deleted' => time(), 'email' => $user['email'] . '.DELETED'));
}