The feed header is now displayed even with "hidewall" activated
This commit is contained in:
		
					parent
					
						
							
								6f72bc8d3a
							
						
					
				
			
			
				commit
				
					
						b7c14803b2
					
				
			
		
					 1 changed files with 36 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -462,45 +462,53 @@ class dfrn {
 | 
			
		|||
	 */
 | 
			
		||||
	private function add_author($doc, $owner, $authorelement, $public) {
 | 
			
		||||
 | 
			
		||||
		$author = $doc->createElement($authorelement);
 | 
			
		||||
 | 
			
		||||
		$namdate = datetime_convert('UTC', 'UTC', $owner['name-date'].'+00:00' , ATOM_TIME);
 | 
			
		||||
		$uridate = datetime_convert('UTC', 'UTC', $owner['uri-date'].'+00:00', ATOM_TIME);
 | 
			
		||||
		$picdate = datetime_convert('UTC', 'UTC', $owner['avatar-date'].'+00:00', ATOM_TIME);
 | 
			
		||||
 | 
			
		||||
		$attributes = array("dfrn:updated" => $namdate);
 | 
			
		||||
		xml::add_element($doc, $author, "name", $owner["name"], $attributes);
 | 
			
		||||
 | 
			
		||||
		$attributes = array("dfrn:updated" => $namdate);
 | 
			
		||||
		xml::add_element($doc, $author, "uri", app::get_baseurl().'/profile/'.$owner["nickname"], $attributes);
 | 
			
		||||
 | 
			
		||||
		$attributes = array("dfrn:updated" => $namdate);
 | 
			
		||||
		xml::add_element($doc, $author, "dfrn:handle", $owner["addr"], $attributes);
 | 
			
		||||
 | 
			
		||||
		$attributes = array("rel" => "photo", "type" => "image/jpeg", "dfrn:updated" => $picdate,
 | 
			
		||||
					"media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
 | 
			
		||||
		xml::add_element($doc, $author, "link", "", $attributes);
 | 
			
		||||
 | 
			
		||||
		$attributes = array("rel" => "avatar", "type" => "image/jpeg", "dfrn:updated" => $picdate,
 | 
			
		||||
					"media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
 | 
			
		||||
		xml::add_element($doc, $author, "link", "", $attributes);
 | 
			
		||||
 | 
			
		||||
		$birthday = feed_birthday($owner['uid'], $owner['timezone']);
 | 
			
		||||
 | 
			
		||||
		if ($birthday)
 | 
			
		||||
			xml::add_element($doc, $author, "dfrn:birthday", $birthday);
 | 
			
		||||
 | 
			
		||||
		// Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
 | 
			
		||||
		$r = q("SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
 | 
			
		||||
				WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d",
 | 
			
		||||
			intval($owner['uid']));
 | 
			
		||||
		if ($r)
 | 
			
		||||
			$hidewall = true;
 | 
			
		||||
		else
 | 
			
		||||
			$hidewall = false;
 | 
			
		||||
 | 
			
		||||
		$author = $doc->createElement($authorelement);
 | 
			
		||||
 | 
			
		||||
		$namdate = datetime_convert('UTC', 'UTC', $owner['name-date'].'+00:00', ATOM_TIME);
 | 
			
		||||
		$uridate = datetime_convert('UTC', 'UTC', $owner['uri-date'].'+00:00', ATOM_TIME);
 | 
			
		||||
		$picdate = datetime_convert('UTC', 'UTC', $owner['avatar-date'].'+00:00', ATOM_TIME);
 | 
			
		||||
 | 
			
		||||
		if (!$public OR !$hidewall)
 | 
			
		||||
			$attributes = array("dfrn:updated" => $namdate);
 | 
			
		||||
		else
 | 
			
		||||
			$attributes = array();
 | 
			
		||||
 | 
			
		||||
		xml::add_element($doc, $author, "name", $owner["name"], $attributes);
 | 
			
		||||
		xml::add_element($doc, $author, "uri", app::get_baseurl().'/profile/'.$owner["nickname"], $attributes);
 | 
			
		||||
		xml::add_element($doc, $author, "dfrn:handle", $owner["addr"], $attributes);
 | 
			
		||||
 | 
			
		||||
		$attributes = array("rel" => "photo", "type" => "image/jpeg",
 | 
			
		||||
					"media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
 | 
			
		||||
 | 
			
		||||
		if (!$public OR !$hidewall)
 | 
			
		||||
			$attributes["dfrn:updated"] = $picdate;
 | 
			
		||||
 | 
			
		||||
		xml::add_element($doc, $author, "link", "", $attributes);
 | 
			
		||||
 | 
			
		||||
		$attributes["rel"] = "avatar";
 | 
			
		||||
		xml::add_element($doc, $author, "link", "", $attributes);
 | 
			
		||||
 | 
			
		||||
		if ($hidewall)
 | 
			
		||||
			xml::add_element($doc, $author, "dfrn:hide", "true");
 | 
			
		||||
 | 
			
		||||
		// The following fields will only be generated if the data isn't meant for a public feed
 | 
			
		||||
		if ($public)
 | 
			
		||||
			return $author;
 | 
			
		||||
 | 
			
		||||
		$birthday = feed_birthday($owner['uid'], $owner['timezone']);
 | 
			
		||||
 | 
			
		||||
		if ($birthday)
 | 
			
		||||
			xml::add_element($doc, $author, "dfrn:birthday", $birthday);
 | 
			
		||||
 | 
			
		||||
		// Only show contact details when we are allowed to
 | 
			
		||||
		$r = q("SELECT `profile`.`about`, `profile`.`name`, `profile`.`homepage`, `user`.`nickname`, `user`.`timezone`,
 | 
			
		||||
				`profile`.`locality`, `profile`.`region`, `profile`.`country-name`, `profile`.`pub_keywords`, `profile`.`dob`
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue