summaryrefslogtreecommitdiff
path: root/actions/twitapistatuses.php
diff options
context:
space:
mode:
authorzach <zach@copley.name>2008-07-22 14:29:19 -0400
committerzach <zach@copley.name>2008-07-22 14:29:19 -0400
commit877eb138c4a793cb065e9575e4f31469caf86b36 (patch)
treef432cf57955d014d6ac2a89a7562640edff2b07b /actions/twitapistatuses.php
parent038f762bce95323ac929b0635cceb7f9425527ec (diff)
Twitter-compatible API: made is_readonly() method smarter
darcs-hash:20080722182919-ca946-dce04d84290711066154567458da2dd3253dd957.gz
Diffstat (limited to 'actions/twitapistatuses.php')
-rw-r--r--actions/twitapistatuses.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 3a06d146c..30f2e514a 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -28,12 +28,22 @@ require_once(INSTALLDIR.'/lib/twitterapi.php');
class TwitapistatusesAction extends TwitterapiAction {
function is_readonly() {
- return false;
+
+ static $write_methods = array( 'update',
+ 'destroy');
+
+ $cmdtext = explode('.', $this->arg('method'));
+
+ if (in_array($cmdtext[0], $write_methods)) {
+ return false;
+ }
+
+ return true;
}
function public_timeline($args, $apidata) {
parent::handle($args);
-
+
$sitename = common_config('site', 'name');
$siteserver = common_config('site', 'server');
$title = sprintf(_("%s public timeline"), $sitename);
@@ -365,6 +375,9 @@ class TwitapistatusesAction extends TwitterapiAction {
$user = $apidata['user'];
+ $this->is_readonly();
+
+
$notice = DB_DataObject::factory('notice');
$notice->profile_id = $user->id; # user id *is* profile id