diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-01-23 04:23:44 +0000 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-01-23 04:23:44 +0000 |
commit | 8dad87ea95275a1fa57424ca537eb25b701e1a2b (patch) | |
tree | e1b8db0c0d8dfaa9d4250ca4de2a2d01bc567784 /lib | |
parent | e59b8c87585bdb044d9a3fd7a712a0cfcb93ad48 (diff) |
trac750 FB script to update statuses working again with new uiredesign stuff
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facebookaction.php | 26 | ||||
-rw-r--r-- | lib/facebookutil.php | 10 |
2 files changed, 33 insertions, 3 deletions
diff --git a/lib/facebookaction.php b/lib/facebookaction.php index dcd4e33d0..528b58154 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -46,13 +46,37 @@ class FacebookAction extends Action var $app_uri = null; var $app_name = null; + /** + * Constructor + * + * Just wraps the HTMLOutputter constructor. + * + * @param string $output URI to output to, default = stdout + * @param boolean $indent Whether to indent output, default true + * + * @see XMLOutputter::__construct + * @see HTMLOutputter::__construct + */ + function __construct($output='php://output', $indent=true, $facebook=null, $flink=null) + { + parent::__construct($output, $indent); + + $this->facebook = $facebook; + $this->flink = $flink; + + if ($this->flink) { + $this->fbuid = $flink->foreign_id; + $this->user = $flink->getUser(); + } + } + function prepare($argarray) { parent::prepare($argarray); common_debug("Facebookaction::prepare"); - $this->facebook = get_facebook(); + $this->facebook = getFacebook(); $this->fbuid = $this->facebook->require_login(); $this->action = $this->trimmed('action'); diff --git a/lib/facebookutil.php b/lib/facebookutil.php index 7b3fd7b49..81737e4d5 100644 --- a/lib/facebookutil.php +++ b/lib/facebookutil.php @@ -18,6 +18,7 @@ */ require_once INSTALLDIR.'/extlib/facebook/facebook.php'; +require_once INSTALLDIR.'/lib/facebookaction.php'; require_once INSTALLDIR.'/lib/noticelist.php'; define("FACEBOOK_SERVICE", 2); // Facebook is foreign_service ID 2 @@ -25,7 +26,7 @@ define("FACEBOOK_NOTICE_PREFIX", 1); define("FACEBOOK_PROMPTED_UPDATE_PREF", 2); // Gets all the notices from users with a Facebook link since a given ID -function get_facebook_notices($since) +function getFacebookNotices($since) { $qry = 'SELECT notice.* ' . 'FROM notice ' . @@ -37,7 +38,7 @@ function get_facebook_notices($since) return Notice::getStreamDirect($qry, 0, 100, 0, 0, null, $since); } -function get_facebook() +function getFacebook() { $apikey = common_config('facebook', 'apikey'); $secret = common_config('facebook', 'secret'); @@ -76,3 +77,8 @@ function getFacebookJS() { return $jsurl; } +function updateProfileBox($facebook, $flink, $notice) { + $fbaction = new FacebookAction($output='php://output', $indent=true, $facebook, $flink); + $fbaction->updateProfileBox($notice); +} + |