| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  | <?php | 
					
						
							|  |  |  | /*  | 
					
						
							|  |  |  |  * To change this template, choose Tools | Templates | 
					
						
							|  |  |  |  * and open the template in the editor. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class RemoteProfileAction extends ShowstreamAction | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     function prepare($args) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         OwnerDesignAction::prepare($args); // skip the ProfileAction code and replace it...
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $id = $this->arg('id'); | 
					
						
							|  |  |  |         $this->user = false; | 
					
						
							|  |  |  |         $this->profile = Profile::staticGet('id', $id); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!$this->profile) { | 
					
						
							| 
									
										
										
										
											2011-03-30 22:30:23 +02:00
										 |  |  |             $this->serverError(_m('User has no profile.')); | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 15:40:07 -08:00
										 |  |  |         $user = User::staticGet('id', $this->profile->id); | 
					
						
							|  |  |  |         if ($user) { | 
					
						
							|  |  |  |             // This is a local user -- send to their regular profile.
 | 
					
						
							|  |  |  |             $url = common_local_url('showstream', array('nickname' => $user->nickname)); | 
					
						
							|  |  |  |             common_redirect($url); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |         $this->tag = $this->trimmed('tag'); | 
					
						
							|  |  |  |         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; | 
					
						
							|  |  |  |         common_set_returnto($this->selfUrl()); | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function handle($args) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // skip yadis thingy
 | 
					
						
							|  |  |  |         $this->showPage(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function title() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // maybe fixed in 0.9.x
 | 
					
						
							|  |  |  |         if (!empty($this->profile->fullname)) { | 
					
						
							|  |  |  |             $base = $this->profile->fullname . ' (' . $this->profile->nickname . ') '; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $base = $this->profile->nickname; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-11-15 15:57:57 -08:00
										 |  |  |         $host = parse_url($this->profile->profileurl, PHP_URL_HOST); | 
					
						
							|  |  |  |         return sprintf(_m('%s on %s'), $base, $host); | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 15:57:57 -08:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Instead of showing notices, link to the original offsite profile. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function showNotices() | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-11-15 15:57:57 -08:00
										 |  |  |         $url = $this->profile->profileurl; | 
					
						
							|  |  |  |         $host = parse_url($url, PHP_URL_HOST); | 
					
						
							|  |  |  |         $markdown = sprintf( | 
					
						
							| 
									
										
										
										
											2010-11-15 16:38:18 -08:00
										 |  |  |                 _m('This remote profile is registered on another site; see [%s\'s original profile page on %s](%s).'), | 
					
						
							|  |  |  |                 $this->profile->nickname, | 
					
						
							| 
									
										
										
										
											2010-11-15 15:57:57 -08:00
										 |  |  |                 $host, | 
					
						
							|  |  |  |                 $url); | 
					
						
							|  |  |  |         $html = common_markup_to_html($markdown); | 
					
						
							|  |  |  |         $this->raw($html); | 
					
						
							| 
									
										
										
										
											2010-11-15 16:12:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if ($this->profile->hasRole(Profile_role::SILENCED)) { | 
					
						
							|  |  |  |             $markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.'); | 
					
						
							|  |  |  |             $this->raw(common_markup_to_html($markdown)); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function getFeeds() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // none
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 16:12:16 -08:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Don't do various extra stuff, and also trim some things to avoid crawlers. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     function extraHead() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-11-15 16:12:16 -08:00
										 |  |  |         $this->element('meta', array('name' => 'robots', | 
					
						
							|  |  |  |                                      'content' => 'noindex,nofollow')); | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-11-15 15:57:57 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     function showLocalNav() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-11-15 15:57:57 -08:00
										 |  |  |         $nav = new PublicGroupNav($this); | 
					
						
							|  |  |  |         $nav->show(); | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-11-15 15:57:57 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  |     function showSections() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         ProfileAction::showSections(); | 
					
						
							|  |  |  |         // skip tag cloud
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 16:38:18 -08:00
										 |  |  |     function showStatistics() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // skip
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-15 15:34:12 -08:00
										 |  |  | } |