Commit ac7fc794f5f0fb43e8ce0629ede84f5622ec6b3d
1 parent
9603a82c
StoryId:702985 Open Search Formated Results
Commited by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
1 changed file
with
17 additions
and
2 deletions
plugins/search2/openSearch.php
| ... | ... | @@ -422,6 +422,7 @@ class openSearch extends KTStandardDispatcher { |
| 422 | 422 | * @return kt_response |
| 423 | 423 | */ |
| 424 | 424 | public function login() { |
| 425 | + if(isset($_REQUEST['type'])) { $this->setType($_REQUEST['type']); } | |
| 425 | 426 | if(isset($_REQUEST['username'])) { $this->setUsername($_REQUEST['username']); } |
| 426 | 427 | if(isset($_REQUEST['password'])) { $this->setPassword($_REQUEST['password']); } |
| 427 | 428 | $kt = new KTAPI(); |
| ... | ... | @@ -442,7 +443,14 @@ class openSearch extends KTStandardDispatcher { |
| 442 | 443 | } |
| 443 | 444 | |
| 444 | 445 | private function login_fail() { |
| 445 | - $response = $this->dom->appendChild($this->dom->createElement("response")); | |
| 446 | + if($this->type == 'atom') { | |
| 447 | + $response = $this->dom->appendChild($this->dom->createElement("response")); | |
| 448 | + } else { | |
| 449 | + $response = $this->dom->appendChild($this->dom->createElement("rss")); | |
| 450 | + $response->setAttribute("version", "2.0"); | |
| 451 | + $response->setAttribute("xmlns:opensearch", "http://a9.com/-/spec/opensearch/1.1/"); | |
| 452 | + $response->setAttribute("xmlns:atom", "http://www.w3.org/2005/Atom"); | |
| 453 | + } | |
| 446 | 454 | $response_status = $response->appendChild($this->dom->createElement("status_code")); |
| 447 | 455 | $response_status->appendChild($this->dom->createTextNode("{$this->status_code}")); |
| 448 | 456 | $response_message = $response->appendChild($this->dom->createElement("message")); |
| ... | ... | @@ -455,7 +463,14 @@ class openSearch extends KTStandardDispatcher { |
| 455 | 463 | } |
| 456 | 464 | |
| 457 | 465 | private function login_pass() { |
| 458 | - $response = $this->dom->appendChild($this->dom->createElement("response")); | |
| 466 | + if($this->type == 'atom') { | |
| 467 | + $response = $this->dom->appendChild($this->dom->createElement("response")); | |
| 468 | + } else { | |
| 469 | + $response = $this->dom->appendChild($this->dom->createElement("rss")); | |
| 470 | + $response->setAttribute("version", "2.0"); | |
| 471 | + $response->setAttribute("xmlns:opensearch", "http://a9.com/-/spec/opensearch/1.1/"); | |
| 472 | + $response->setAttribute("xmlns:atom", "http://www.w3.org/2005/Atom"); | |
| 473 | + } | |
| 459 | 474 | $response_status = $response->appendChild($this->dom->createElement("status_code")); |
| 460 | 475 | $response_status->appendChild($this->dom->createTextNode("{$this->status_code}")); |
| 461 | 476 | $response_results = $response->appendChild($this->dom->createElement("results")); | ... | ... |