| 
									
										
										
										
											2008-12-05 22:01:32 -05:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2009-08-25 18:12:20 -04:00
										 |  |  |  * StatusNet, the distributed open-source microblogging tool | 
					
						
							| 
									
										
										
										
											2008-12-05 22:01:32 -05:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  |  * Base Facebook Action | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * PHP version 5 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * LICENCE: This program is free software: you can redistribute it and/or modify | 
					
						
							| 
									
										
										
										
											2008-12-05 22:01:32 -05:00
										 |  |  |  * it under the terms of the GNU Affero General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							| 
									
										
										
										
											2008-12-05 22:01:32 -05:00
										 |  |  |  * GNU Affero General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category  Faceboook | 
					
						
							| 
									
										
										
										
											2009-08-25 18:12:20 -04:00
										 |  |  |  * @package   StatusNet | 
					
						
							| 
									
										
										
										
											2009-08-25 18:19:04 -04:00
										 |  |  |  * @author    Zach Copley <zach@status.net> | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  |  * @copyright 2008-2009 StatusNet, Inc. | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 | 
					
						
							| 
									
										
										
										
											2009-08-25 18:16:46 -04:00
										 |  |  |  * @link      http://status.net/ | 
					
						
							| 
									
										
										
										
											2008-12-05 22:01:32 -05:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  | if (!defined('STATUSNET') && !defined('LACONICA')) { | 
					
						
							| 
									
										
										
										
											2009-01-18 01:31:39 +00:00
										 |  |  |     exit(1); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-12-05 22:01:32 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  | require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php'; | 
					
						
							| 
									
										
										
										
											2009-12-31 22:32:10 +00:00
										 |  |  | require_once INSTALLDIR . '/plugins/Facebook/facebooknoticeform.php'; | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-23 14:49:23 -05:00
										 |  |  | class FacebookAction extends Action | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     var $facebook = null; | 
					
						
							|  |  |  |     var $fbuid    = null; | 
					
						
							|  |  |  |     var $flink    = null; | 
					
						
							|  |  |  |     var $action   = null; | 
					
						
							|  |  |  |     var $app_uri  = null; | 
					
						
							|  |  |  |     var $app_name = null; | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-05 01:03:04 -05:00
										 |  |  |     function __construct($output='php://output', $indent=null, $facebook=null, $flink=null) | 
					
						
							| 
									
										
										
										
											2009-01-23 04:23:44 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         parent::__construct($output, $indent); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 04:23:44 +00:00
										 |  |  |         $this->facebook = $facebook; | 
					
						
							|  |  |  |         $this->flink = $flink; | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 04:23:44 +00:00
										 |  |  |         if ($this->flink) { | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |             $this->fbuid = $flink->foreign_id; | 
					
						
							| 
									
										
										
										
											2009-01-23 04:23:44 +00:00
										 |  |  |             $this->user = $flink->getUser(); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 07:22:01 +00:00
										 |  |  |         $this->args = array(); | 
					
						
							| 
									
										
										
										
											2009-01-23 04:23:44 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     function prepare($argarray) | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         parent::prepare($argarray); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 04:23:44 +00:00
										 |  |  |         $this->facebook = getFacebook(); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $this->fbuid = $this->facebook->require_login(); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $this->action = $this->trimmed('action'); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $app_props = $this->facebook->api_client->Admin_getAppProperties( | 
					
						
							|  |  |  |                 array('canvas_name', 'application_name')); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $this->app_uri = 'http://apps.facebook.com/' . $app_props['canvas_name']; | 
					
						
							|  |  |  |         $this->app_name = $app_props['application_name']; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_SERVICE); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         return true; | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     function showStylesheets() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-08-05 19:45:12 -04:00
										 |  |  |         $this->cssLink('css/display.css', 'base'); | 
					
						
							| 
									
										
										
										
											2009-10-27 21:00:26 +00:00
										 |  |  |         $this->cssLink('css/display.css', null, 'screen, projection, tv'); | 
					
						
							|  |  |  |         $this->cssLink('plugins/Facebook/facebookapp.css'); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     function showScripts() | 
					
						
							| 
									
										
										
										
											2008-12-23 14:33:23 -05:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-01-28 04:46:10 +00:00
										 |  |  |         $this->script(common_path('plugins/Facebook/facebookapp.js')); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Start an Facebook ready HTML document | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2009-11-09 20:01:46 +01:00
										 |  |  |      * For Facebook we don't want to actually output any headers, | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  |      * DTD info, etc.  Just Stylesheet and JavaScript links. | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @param string $type MIME type to use; default is to do negotation. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |     function startHTML($type=null) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-02-04 22:33:50 +00:00
										 |  |  |         $this->showStylesheets(); | 
					
						
							|  |  |  |         $this->showScripts(); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $this->elementStart('div', array('class' => 'facebook-page')); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |     *  Ends a Facebook ready HTML document | 
					
						
							|  |  |  |     * | 
					
						
							|  |  |  |     *  @return void | 
					
						
							|  |  |  |     */ | 
					
						
							|  |  |  |     function endHTML() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->elementEnd('div'); | 
					
						
							|  |  |  |         $this->endXML(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Show notice form. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return nothing | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function showNoticeForm() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-11-09 20:01:46 +01:00
										 |  |  |         // don't do it for most of the Facebook pages
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     function showBody() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-02-04 17:03:59 +00:00
										 |  |  |         $this->elementStart('div', array('id' => 'wrap')); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $this->showHeader(); | 
					
						
							|  |  |  |         $this->showCore(); | 
					
						
							|  |  |  |         $this->showFooter(); | 
					
						
							|  |  |  |         $this->elementEnd('div'); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     function showHead($error, $success) | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         if ($error) { | 
					
						
							|  |  |  |             $this->element("h1", null, $error); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         if ($success) { | 
					
						
							|  |  |  |             $this->element("h1", null, $success); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-01-11 07:03:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('fb:if-section-not-added', array('section' => 'profile')); | 
					
						
							|  |  |  |         $this->elementStart('span', array('id' => 'add_to_profile')); | 
					
						
							|  |  |  |         $this->element('fb:add-section-button', array('section' => 'profile')); | 
					
						
							|  |  |  |         $this->elementEnd('span'); | 
					
						
							|  |  |  |         $this->elementEnd('fb:if-section-not-added'); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     // Make this into a widget later
 | 
					
						
							|  |  |  |     function showLocalNav() | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('ul', array('class' => 'nav')); | 
					
						
							| 
									
										
										
										
											2009-01-18 01:31:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('li', array('class' => | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |             ($this->action == 'facebookhome') ? 'current' : 'facebook_home')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->element('a', | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |             array('href' => 'index.php', 'title' => _m('Home')), _m('Home')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('li'); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-14 16:17:22 +08:00
										 |  |  |         if (common_config('invite', 'enabled')) { | 
					
						
							|  |  |  |             $this->elementStart('li', | 
					
						
							|  |  |  |                 array('class' => | 
					
						
							|  |  |  |                     ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite')); | 
					
						
							|  |  |  |             $this->element('a', | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |                 array('href' => 'invite.php', 'title' => _m('Invite')), _m('Invite')); | 
					
						
							| 
									
										
										
										
											2009-06-14 16:17:22 +08:00
										 |  |  |             $this->elementEnd('li'); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('li', | 
					
						
							| 
									
										
										
										
											2009-01-18 01:31:39 +00:00
										 |  |  |             array('class' => | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |                 ($this->action == 'facebooksettings') ? 'current' : 'facebook_settings')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->element('a', | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  |             array('href' => 'settings.php', | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |                 'title' => _m('Settings')), _m('Settings')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('li'); | 
					
						
							| 
									
										
										
										
											2009-01-18 01:31:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('ul'); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Show header of the page. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return nothing | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function showHeader() | 
					
						
							| 
									
										
										
										
											2008-12-23 14:33:23 -05:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $this->elementStart('div', array('id' => 'header')); | 
					
						
							|  |  |  |         $this->showLogo(); | 
					
						
							|  |  |  |         $this->showNoticeForm(); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('div'); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Show page, a template method. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return nothing | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function showPage($error = null, $success = null) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->startHTML(); | 
					
						
							|  |  |  |         $this->showHead($error, $success); | 
					
						
							|  |  |  |         $this->showBody(); | 
					
						
							|  |  |  |         $this->endHTML(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-18 01:31:39 +00:00
										 |  |  |     function showInstructions() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-26 06:31:25 +00:00
										 |  |  |         $this->elementStart('div', array('class' => 'facebook_guide')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('dl', array('class' => 'system_notice')); | 
					
						
							|  |  |  |         $this->element('dt', null, 'Page Notice'); | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |         $loginmsg_part1 = _m('To use the %s Facebook Application you need to login ' . | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  |             'with your username and password. Don\'t have a username yet? '); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |         $loginmsg_part2 = _m(' a new account.'); | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('dd'); | 
					
						
							|  |  |  |         $this->elementStart('p'); | 
					
						
							|  |  |  |         $this->text(sprintf($loginmsg_part1, common_config('site', 'name'))); | 
					
						
							| 
									
										
										
										
											2009-08-21 16:45:42 -04:00
										 |  |  |         $this->element('a', | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |             array('href' => common_local_url('register')), _m('Register')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->text($loginmsg_part2); | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  |         $this->elementEnd('p'); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('dd'); | 
					
						
							| 
									
										
										
										
											2009-02-05 04:54:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('dl'); | 
					
						
							| 
									
										
										
										
											2009-01-26 06:31:25 +00:00
										 |  |  |         $this->elementEnd('div'); | 
					
						
							| 
									
										
										
										
											2009-01-18 01:31:39 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  |     function showLoginForm($msg = null) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 04:54:42 +00:00
										 |  |  |         $this->elementStart('div', array('id' => 'content')); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |         $this->element('h1', null, _m('Login')); | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-11 07:03:59 +00:00
										 |  |  |         if ($msg) { | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |              $this->element('fb:error', array('message' => $msg)); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-18 01:31:39 +00:00
										 |  |  |         $this->showInstructions(); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('div', array('id' => 'content_inner')); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('form', array('method' => 'post', | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  |                                                'class' => 'form_settings', | 
					
						
							| 
									
										
										
										
											2009-01-11 07:03:59 +00:00
										 |  |  |                                                'id' => 'login', | 
					
						
							|  |  |  |                                                'action' => 'index.php')); | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('fieldset'); | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('ul', array('class' => 'form_datas')); | 
					
						
							|  |  |  |         $this->elementStart('li'); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |         $this->input('nickname', _m('Nickname')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('li'); | 
					
						
							|  |  |  |         $this->elementStart('li'); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |         $this->password('password', _m('Password')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('li'); | 
					
						
							|  |  |  |         $this->elementEnd('ul'); | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |         $this->submit('submit', _m('Login')); | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  |         $this->elementEnd('fieldset'); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('form'); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementStart('p'); | 
					
						
							|  |  |  |         $this->element('a', array('href' => common_local_url('recoverpassword')), | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |                        _m('Lost or forgotten password?')); | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('p'); | 
					
						
							| 
									
										
										
										
											2009-01-19 00:50:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  |         $this->elementEnd('div'); | 
					
						
							| 
									
										
										
										
											2009-02-05 04:54:42 +00:00
										 |  |  |         $this->elementEnd('div'); | 
					
						
							| 
									
										
										
										
											2009-01-11 07:03:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     function updateProfileBox($notice) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         // Need to include inline CSS for styling the Profile box
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-20 16:32:30 -07:00
										 |  |  |         $app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url')); | 
					
						
							|  |  |  |         $icon_url = $app_props['icon_url']; | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-30 23:09:12 +00:00
										 |  |  |         $style = '<style> .entry-title *, .entry-content * { font-size:14px; font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif; } .entry-title a, .entry-content a { color:#002E6E; } .entry-title .vcard .photo { float:left; display:inline; margin-right:11px; margin-bottom:11px } .entry-title { margin-bottom:11px; } .entry-title p.entry-content { display:inline; margin-left:5px; } div.entry-content { clear:both; } div.entry-content dl, div.entry-content dt, div.entry-content dd { display:inline; text-transform:lowercase; } div.entry-content dd, div.entry-content .device dt { margin-left:0; margin-right:5px; } div.entry-content dl.timestamp dt, div.entry-content dl.response dt { display:none; } div.entry-content dd a { display:inline-block; } #facebook_statusnet_app { text-indent:-9999px; height:16px; width:16px; display:block; background:url('.$icon_url.') no-repeat 0 0; float:right; } </style>'; | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $this->xw->openMemory(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |         $item = new FacebookProfileBoxNotice($notice, $this); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $item->show(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $fbml = "<fb:wide>$style " . $this->xw->outputMemory(false) . "</fb:wide>"; | 
					
						
							|  |  |  |         $fbml .= "<fb:narrow>$style " . $this->xw->outputMemory(false) . "</fb:narrow>"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $fbml_main = "<fb:narrow>$style " . $this->xw->outputMemory(false) . "</fb:narrow>"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |         $this->facebook->api_client->profile_setFBML(null, $this->fbuid, $fbml, null, null, $fbml_main); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $this->xw->openURI('php://output'); | 
					
						
							| 
									
										
										
										
											2008-12-23 14:19:07 -05:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Generate pagination links | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param boolean $have_before is there something before? | 
					
						
							|  |  |  |      * @param boolean $have_after  is there something after? | 
					
						
							|  |  |  |      * @param integer $page        current page | 
					
						
							|  |  |  |      * @param string  $action      current action | 
					
						
							|  |  |  |      * @param array   $args        rest of query arguments | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return nothing | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function pagination($have_before, $have_after, $page, $action, $args=null) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // Does a little before-after block for next/prev page
 | 
					
						
							|  |  |  |         if ($have_before || $have_after) { | 
					
						
							| 
									
										
										
										
											2009-11-13 12:26:24 +00:00
										 |  |  |             $this->elementStart('dl', 'pagination'); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |             $this->element('dt', null, _m('Pagination')); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |             $this->elementStart('dd', null); | 
					
						
							|  |  |  |             $this->elementStart('ul', array('class' => 'nav')); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if ($have_before) { | 
					
						
							|  |  |  |             $pargs   = array('page' => $page-1); | 
					
						
							|  |  |  |             $newargs = $args ? array_merge($args, $pargs) : $pargs; | 
					
						
							|  |  |  |             $this->elementStart('li', array('class' => 'nav_prev')); | 
					
						
							|  |  |  |             $this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'prev'), | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |                            _m('After')); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |             $this->elementEnd('li'); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if ($have_after) { | 
					
						
							|  |  |  |             $pargs   = array('page' => $page+1); | 
					
						
							|  |  |  |             $newargs = $args ? array_merge($args, $pargs) : $pargs; | 
					
						
							|  |  |  |             $this->elementStart('li', array('class' => 'nav_next')); | 
					
						
							|  |  |  |             $this->element('a', array('href' => "$this->app_uri/$action?page=$newargs[page]", 'rel' => 'next'), | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |                            _m('Before')); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |             $this->elementEnd('li'); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if ($have_before || $have_after) { | 
					
						
							|  |  |  |             $this->elementEnd('ul'); | 
					
						
							|  |  |  |             $this->elementEnd('dd'); | 
					
						
							|  |  |  |             $this->elementEnd('dl'); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-29 05:58:27 +00:00
										 |  |  |     function saveNewNotice() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $user = $this->flink->getUser(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $content = $this->trimmed('status_textarea'); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-29 05:58:27 +00:00
										 |  |  |         if (!$content) { | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |             $this->showPage(_m('No notice content!')); | 
					
						
							| 
									
										
										
										
											2009-01-29 05:58:27 +00:00
										 |  |  |             return; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $content_shortened = common_shorten_links($content); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-21 08:23:52 -04:00
										 |  |  |             if (Notice::contentTooLong($content_shortened)) { | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |                 $this->showPage(sprintf(_m('That\'s too long. Max notice size is %d chars.'), | 
					
						
							| 
									
										
										
										
											2009-08-21 08:23:52 -04:00
										 |  |  |                                         Notice::maxContent())); | 
					
						
							| 
									
										
										
										
											2009-01-29 05:58:27 +00:00
										 |  |  |                 return; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $inter = new CommandInterpreter(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $cmd = $inter->handle_command($user, $content_shortened); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if ($cmd) { | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-29 05:58:27 +00:00
										 |  |  |             // XXX fix this
 | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-29 05:58:27 +00:00
										 |  |  |             $cmd->execute(new WebChannel()); | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $replyto = $this->trimmed('inreplyto'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-29 17:25:52 -04:00
										 |  |  |         try { | 
					
						
							| 
									
										
										
										
											2009-12-11 11:29:51 -05:00
										 |  |  |             $notice = Notice::saveNew($user->id, $content, 'web', | 
					
						
							|  |  |  |                                       array('reply_to' => ($replyto == 'false') ? null : $replyto)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-29 17:25:52 -04:00
										 |  |  |         } catch (Exception $e) { | 
					
						
							|  |  |  |             $this->showPage($e->getMessage()); | 
					
						
							| 
									
										
										
										
											2009-01-29 05:58:27 +00:00
										 |  |  |             return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2008-12-07 20:54:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class FacebookNoticeList extends NoticeList | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * constructor | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Notice $notice stream of notices from DB_DataObject | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function __construct($notice, $out=null) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         parent::__construct($notice, $out); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * show the list of notices | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2009-11-08 23:28:51 +01:00
										 |  |  |      * "Uses up" the stream by looping through it. So, probably can't | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |      * be called twice on the same list. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return int count of notices listed. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function show() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->out->elementStart('div', array('id' =>'notices_primary')); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:17:11 -08:00
										 |  |  |         $this->out->element('h2', null, _m('Notices')); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $this->out->elementStart('ul', array('class' => 'notices')); | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         $cnt = 0; | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |         while ($this->notice->fetch() && $cnt <= NOTICES_PER_PAGE) { | 
					
						
							|  |  |  |             $cnt++; | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |             if ($cnt > NOTICES_PER_PAGE) { | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |             $item = $this->newListItem($this->notice); | 
					
						
							|  |  |  |             $item->show(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementEnd('ul'); | 
					
						
							|  |  |  |         $this->out->elementEnd('div'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return $cnt; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * returns a new list item for the current notice | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * Overridden to return a Facebook specific list item. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Notice $notice the current notice | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return FacebookNoticeListItem a list item for displaying the notice | 
					
						
							|  |  |  |      * formatted for display in the Facebook App. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function newListItem($notice) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return new FacebookNoticeListItem($notice, $this); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-01-19 13:44:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | class FacebookNoticeListItem extends NoticeListItem | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * constructor | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * Also initializes the profile attribute. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Notice $notice The notice we'll display | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function __construct($notice, $out=null) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         parent::__construct($notice, $out); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * recipe function for displaying a single notice in the Facebook App. | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2009-11-09 20:01:46 +01:00
										 |  |  |      * Overridden to strip out some of the controls that we don't | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  |      * want to be available. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function show() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->showStart(); | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |         $this->showNotice(); | 
					
						
							|  |  |  |         $this->showNoticeInfo(); | 
					
						
							| 
									
										
										
										
											2009-01-19 07:24:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |         // XXX: Need to update to show attachements and controls
 | 
					
						
							| 
									
										
										
										
											2009-01-23 03:16:03 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $this->showEnd(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-05 22:01:32 -05:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class FacebookProfileBoxNotice extends FacebookNoticeListItem | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * constructor | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * Also initializes the profile attribute. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Notice $notice The notice we'll display | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function __construct($notice, $out=null) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         parent::__construct($notice, $out); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |      * Recipe function for displaying a single notice in the | 
					
						
							|  |  |  |      * Facebook App profile notice box | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function show() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |         $this->showNotice(); | 
					
						
							|  |  |  |         $this->showNoticeInfo(); | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |         $this->showAppLink(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  |     function showAppLink() | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |         $this->facebook = getFacebook(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $app_props = $this->facebook->api_client->Admin_getAppProperties( | 
					
						
							|  |  |  |                 array('canvas_name', 'application_name')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->app_uri = 'http://apps.facebook.com/' . $app_props['canvas_name']; | 
					
						
							|  |  |  |         $this->app_name = $app_props['application_name']; | 
					
						
							| 
									
										
										
										
											2009-05-26 23:21:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-25 18:53:24 -04:00
										 |  |  |         $this->out->elementStart('a', array('id' => 'facebook_statusnet_app', | 
					
						
							| 
									
										
										
										
											2009-02-05 07:07:36 +00:00
										 |  |  |                                             'href' => $this->app_uri)); | 
					
						
							|  |  |  |         $this->out->text($this->app_name); | 
					
						
							|  |  |  |         $this->out->elementEnd('a'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |