# Perms are the same; just carry on... if ($flickr_user['token_perms'] == $perms_map_str[$perms]) { $redir = get_str("redir"); if (!$redir) { $redir = $GLOBALS['cfg']['abs_root_url']; } header("location: {$redir}"); exit; } # confirm token perms change if (!crumb_check($crumb_key) || !post_str("confirm")) { $old_perms = $perms_map[$flickr_user['token_perms']]; $GLOBALS['smarty']->assign("old_perms", $old_perms); $GLOBALS['smarty']->assign("new_perms", $perms); $more_permissive = $perms_map_str[$perms] > $flickr_user['token_perms'] ? 1 : 0; $GLOBALS['smarty']->assign("more_permissive", $more_permissive); $GLOBALS['smarty']->display("page_account_flickr_auth.txt"); exit; } } # $now = time(); $crumb = implode(":", array($GLOBALS['cfg']['user']['id'], $now)); $enc_crumb = crypto_encrypt($crumb, $GLOBALS['cfg']['flickr_api_secret']); $extra = array('crumb' => $enc_crumb); if ($redir = get_str('redir')) { $extra['redir'] = $redir; } $url = flickr_api_auth_url($perms, $extra); header("location: {$url}"); exit;
function login_generate_auth_cookie(&$user) { $cookie = implode(":", array($user['id'], $user['password'])); return crypto_encrypt($cookie, $GLOBALS['cfg']['crypto_cookie_secret']); }
function invite_codes_generate_cookie(&$invite) { $raw = implode("-", array($invite['code'], $invite['created'])); return crypto_encrypt($raw, $GLOBALS['cfg']['crypt_invite_secret']); }