add some breaks so that switch statement works

darcs-hash:20081230210114-84dde-4fbf5b718841ae1c46129a6b58d6b4e239d8be09.gz
This commit is contained in:
Evan Prodromou 2008-12-30 16:01:14 -05:00
parent a3f601cd4e
commit 481c6d2316
5 changed files with 11 additions and 18 deletions

View File

@ -104,4 +104,6 @@ Evan Prodromou <evan@prodromou.name>**20081230202513]
[add laconica methods to unauthed ones [add laconica methods to unauthed ones
Evan Prodromou <evan@prodromou.name>**20081230203747] Evan Prodromou <evan@prodromou.name>**20081230203747]
[implement api/laconica/version method [implement api/laconica/version method
Evan Prodromou <evan@prodromou.name>**20081230205939] Evan Prodromou <evan@prodromou.name>**20081230205939]
[add some breaks so that switch statement works
Evan Prodromou <evan@prodromou.name>**20081230210114]

View File

@ -72,10 +72,12 @@ class TwitapilaconicaAction extends TwitterapiAction
$this->init_document('xml'); $this->init_document('xml');
common_element('version', null, LACONICA_VERSION); common_element('version', null, LACONICA_VERSION);
$this->end_document('xml'); $this->end_document('xml');
break;
case 'json': case 'json':
$this->init_document('json'); $this->init_document('json');
print '"'.LACONICA_VERSION.'"'; print '"'.LACONICA_VERSION.'"';
$this->end_document('json'); $this->end_document('json');
break;
default: default:
$this->client_error(_('API method not found!'), $code=404); $this->client_error(_('API method not found!'), $code=404);
} }

View File

@ -1,17 +1,4 @@
hunk ./actions/twitapilaconica.php 56 hunk ./actions/twitapilaconica.php 75
+ * URL: http://identi.ca/api/laconica/version.(xml|json) + break;
+ * Formats: xml, json hunk ./actions/twitapilaconica.php 80
hunk ./actions/twitapilaconica.php 70 + break;
- common_server_error(_('API method under construction.'), 501);
+ switch ($apidata['content-type']) {
+ case 'xml':
+ $this->init_document('xml');
+ common_element('version', null, LACONICA_VERSION);
+ $this->end_document('xml');
+ case 'json':
+ $this->init_document('json');
+ print '"'.LACONICA_VERSION.'"';
+ $this->end_document('json');
+ default:
+ $this->client_error(_('API method not found!'), $code=404);
+ }

View File

@ -72,10 +72,12 @@ class TwitapilaconicaAction extends TwitterapiAction
$this->init_document('xml'); $this->init_document('xml');
common_element('version', null, LACONICA_VERSION); common_element('version', null, LACONICA_VERSION);
$this->end_document('xml'); $this->end_document('xml');
break;
case 'json': case 'json':
$this->init_document('json'); $this->init_document('json');
print '"'.LACONICA_VERSION.'"'; print '"'.LACONICA_VERSION.'"';
$this->end_document('json'); $this->end_document('json');
break;
default: default:
$this->client_error(_('API method not found!'), $code=404); $this->client_error(_('API method not found!'), $code=404);
} }