mashup-flickr-complete-lib-FlickrAuthenticator.php / php
<?php class FlickrAuthenticator { var apikey; var auth; var apikey, this->apikey = this->secret = this->flickr = new phpFlickr(secret, false); _SERVER['HTTP_HOST'] . '/error.php'; } function authenticate(doAuth = true; _SESSION['FlickrAuthenticationToken']; token); if (!empty(auth = this->flickr->getErrorCode()) { // We have a good token // Check we have the required privileges perms = perms) { case "read": if (doAuth = false; } break; case "write": if (requiredPerms == "write") { requiredPerms == "read" || requiredPerms == "delete") { doAuth) { // No further authentication necessary, so store away // the results from checkToken auth; auth['user']['username']; } } } if (// Need to authenticate - redirect to flickr extra = apisig = md5(this->apikey . "extra" . requiredPerms); this->apikey . '&extra=' . requiredPerms . '&api_sig='. url); exit(0); } } function updateCredentials(this->setToken(NULL); this->flickr->auth_getToken(this->flickr->getErrorCode()) { token); this->flickr->auth_checkToken(); if (this->setToken(NULL); this->flickr->getErrorCode() . " " . this->setToken(NULL); this->flickr->getErrorCode() . " " . token) { token; unset(this->flickr->setToken(message) { message; header('Location: ' .
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.