* as a reference so when run() is called, you still have a handle to the
* results.
*/
-$facebook->batchBegin();
-$notifications = &$facebook->notifications->get();
-$friends = &$facebook->friends->get();
-$facebook->batchEnd();
-var_dump($friends);
-var_dump($notifications);
+//$facebook->batchBegin();
+//$notifications = &$facebook->notifications->get();
+//$friends = &$facebook->friends->get();
+//$facebook->batchEnd();
+//var_dump($friends);
+//var_dump($notifications);
/**
* View a user's pictures. $uid should be the user id whose albums you want to
* retrieve. (Permissions permitting, of course)
*/
-$albums = $facebook->photos->getAlbums($uid);
-var_dump($albums);
-$images = $facebook->photos->get('', $albums[0]['aid']);
-var_dump($images);
+//$albums = $facebook->photos->getAlbums($uid);
+//var_dump($albums);
+//$images = $facebook->photos->get('', $albums[0]['aid']);
+//var_dump($images);
/**
* Request the raw JSON (or XML) data
*/
-$facebook->dataFormat = Horde_Service_Facebook::DATA_FORMAT_JSON;
-$results = $facebook->photos->getAlbums($uid);
-var_dump($results);
+//$facebook->dataFormat = Horde_Service_Facebook::DATA_FORMAT_JSON;
+//$results = $facebook->photos->getAlbums($uid);
+//var_dump($results);
+/**
+ * Upload a photo
+ */
+$path = "/Users/mrubinsk/Desktop/horde_fb.jpg"
+$results = $facebook->photos->upload($path);
+var_dump($results);
\ No newline at end of file
* rest interface.
*
* This code was originally a Hordified version of Facebook's official PHP
- * client. However, very little of the original code or design is left. I left
- * the original copyright notice intact below.
+ * client. However, since that client was very buggy and incomplete, very little
+ * of the original code or design is left. I left the original copyright notice
+ * intact below.
*
* Copyright 2009 The Horde Project (http://www.horde.org)
*
}
/**
- * Return a valid FB login URL with necessary GET parameters appended.
- *
- * @return string
- */
- public function get_login_url($next)
- {
- return self::getFacebookUrl() . '/login.php?v=1.0&api_key='
- . $this->_apiKey . ($next ? '&next=' . urlencode($next) : '');
- }
-
- /**
* Start a batch operation.
*/
public function batchBegin()
*
* @return array A dictionary representing the response.
*/
- public function call_upload_method($method, $params, $file)
+ public function callUploadMethod($method, $params, $file)
{
if ($this->_batchRequest === null) {
if (!file_exists($file)) {
}
/**
+ * Return a valid FB login URL with necessary GET parameters appended.
+ *
+ * @return string
+ */
+ public function getLoginUrl($next)
+ {
+ return Horde_Service_Facebook::getFacebookUrl() . '/login.php?v=1.0&api_key='
+ . $this->_apiKey . ($next ? '&next=' . urlencode($next) : '');
+ }
+
+ /**
* Returns the URL for a user to obtain the auth token needed to generate an
* infinite session for a web app.
*
$this->_sessionKey = $sessionKey;
$this->_session_expires = $expires;
}
+
+ /**
+ * Revoke a previously authorizied extended permission
+ *
+ * @param $perm
+ * @param $uid
+ * @return unknown_type
+ */
+ public function revokeExtendedPermission($perm, $uid)
+ {
+ // Session key is *required*
+ if (!$skey = $this->getSessionKey()) {
+ throw new Horde_Service_Facebook_Exception('session_key is required',
+ Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
+ }
+
+ return $this->_facebook->callMethod('Auth.revokeExtendedPermission',
+ array('session_key' => $skey,
+ 'perm' => $perm,
+ 'user' => $uid));
+
+ }
}
\ No newline at end of file
if ($this->_facebook->dataFormat == Horde_Service_Facebook::DATA_FORMAT_ARRAY) {
$oldFormat = $this->_facebook->setInternalFormat(Horde_Service_Facebook::DATA_FORMAT_XML);
}
- $results = $this->_facebook->call_upload_method('facebook.photos.upload', $params, $file);
+ $results = $this->_facebook->callUploadMethod('facebook.photos.upload', $params, $file);
if (!empty($oldFormat)) {
$this->_facebook->setInternalFormat($oldFormat);
}
* authorized your application will be returned.
*
* Check the wiki for fields that can be queried through this API call.
- * Data returned from here should not be used for rendering to application
+ * Data returned from here should *not* be used for rendering to application
* users, use users.getInfo instead, so that proper privacy rules will be
* applied.
*