From 7e6870db914d4e905fc7ae833b69404fd3ea0d3d Mon Sep 17 00:00:00 2001 From: zach Date: Tue, 22 Jul 2008 17:20:56 -0400 Subject: base class is_readonly() now returns false by default darcs-hash:20080722212056-ca946-e4bd9eef8e3d8991414932e9fc7b8c9a31f818c0.gz --- actions/avatar.php | 4 ---- actions/confirmaddress.php | 4 ---- actions/finishaddopenid.php | 4 ---- actions/finishremotesubscribe.php | 4 ---- actions/foaf.php | 4 ++++ actions/login.php | 4 ++++ actions/logout.php | 5 +++++ actions/newnotice.php | 6 +----- actions/postnotice.php | 4 ---- actions/publicxrds.php | 4 ++++ actions/recoverpassword.php | 4 ---- actions/register.php | 4 ---- actions/requesttoken.php | 5 +++++ actions/subscribe.php | 4 ---- actions/twitapidirect_messages.php | 15 +++++++++++++++ actions/twitapifavorites.php | 13 +++++++++++++ actions/twitapihelp.php | 4 ++++ actions/twitapinotifications.php | 1 - actions/unsubscribe.php | 4 ---- actions/updateprofile.php | 4 ---- actions/userauthorization.php | 4 ---- actions/userbyid.php | 5 +++++ actions/xrds.php | 4 ++++ lib/action.php | 2 +- lib/gallery.php | 4 ++++ lib/rssaction.php | 4 ++++ lib/searchaction.php | 4 ++++ lib/settingsaction.php | 4 ---- lib/stream.php | 4 ++++ 29 files changed, 81 insertions(+), 55 deletions(-) diff --git a/actions/avatar.php b/actions/avatar.php index b1697f97b..ebfbd7295 100644 --- a/actions/avatar.php +++ b/actions/avatar.php @@ -23,10 +23,6 @@ require_once(INSTALLDIR.'/lib/settingsaction.php'); class AvatarAction extends SettingsAction { - function is_readonly() { - return false; - } - function get_instructions() { return _('Upload a new "avatar" (user image) here. You can\'t edit the picture after you upload it, so make sure it\'s more or less square. It must be under the site license, also. Use a picture that belongs to you and that you want to share.'); } diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php index 66a41d9d7..3cffda871 100644 --- a/actions/confirmaddress.php +++ b/actions/confirmaddress.php @@ -21,10 +21,6 @@ if (!defined('LACONICA')) { exit(1); } class ConfirmaddressAction extends Action { - function is_readonly() { - return false; - } - function handle($args) { parent::handle($args); if (!common_logged_in()) { diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php index af96635d6..54d81b0b4 100644 --- a/actions/finishaddopenid.php +++ b/actions/finishaddopenid.php @@ -31,10 +31,6 @@ class FinishaddopenidAction extends Action { $this->try_login(); } } - - function is_readonly() { - return false; - } function try_login() { diff --git a/actions/finishremotesubscribe.php b/actions/finishremotesubscribe.php index bce2447ac..ba5156a20 100644 --- a/actions/finishremotesubscribe.php +++ b/actions/finishremotesubscribe.php @@ -23,10 +23,6 @@ require_once(INSTALLDIR.'/lib/omb.php'); class FinishremotesubscribeAction extends Action { - function is_readonly() { - return false; - } - function handle($args) { parent::handle($args); diff --git a/actions/foaf.php b/actions/foaf.php index 8de4c7502..c64617e5f 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -25,6 +25,10 @@ define('BOTH', 0); class FoafAction extends Action { + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); diff --git a/actions/login.php b/actions/login.php index 0f2dec1a4..aa25a0cec 100644 --- a/actions/login.php +++ b/actions/login.php @@ -21,6 +21,10 @@ if (!defined('LACONICA')) { exit(1); } class LoginAction extends Action { + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); if (common_is_real_login()) { diff --git a/actions/logout.php b/actions/logout.php index fb61689ee..f00fa0ba7 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -22,6 +22,11 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/openid.php'); class LogoutAction extends Action { + + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); if (!common_logged_in()) { diff --git a/actions/newnotice.php b/actions/newnotice.php index 487396e4e..711b77e0a 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -20,11 +20,7 @@ if (!defined('LACONICA')) { exit(1); } class NewnoticeAction extends Action { - - function is_readonly() { - return false; - } - + function handle($args) { parent::handle($args); # XXX: Ajax! diff --git a/actions/postnotice.php b/actions/postnotice.php index 3b5a4ee15..ab12277bb 100644 --- a/actions/postnotice.php +++ b/actions/postnotice.php @@ -21,10 +21,6 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); -function is_readonly() { - return false; -} - class PostnoticeAction extends Action { function handle($args) { parent::handle($args); diff --git a/actions/publicxrds.php b/actions/publicxrds.php index 29c8e1314..951434c87 100644 --- a/actions/publicxrds.php +++ b/actions/publicxrds.php @@ -25,6 +25,10 @@ require_once(INSTALLDIR.'/lib/openid.php'); class PublicxrdsAction extends Action { + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php index 0d85163d7..9c34ff3d8 100644 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php @@ -25,10 +25,6 @@ define(MAX_RECOVERY_TIME, 24 * 60 * 60); class RecoverpasswordAction extends Action { - function is_readonly() { - return false; - } - function handle($args) { parent::handle($args); if (common_logged_in()) { diff --git a/actions/register.php b/actions/register.php index 0d6338797..6ac283059 100644 --- a/actions/register.php +++ b/actions/register.php @@ -21,10 +21,6 @@ if (!defined('LACONICA')) { exit(1); } class RegisterAction extends Action { - function is_readonly() { - return false; - } - function handle($args) { parent::handle($args); diff --git a/actions/requesttoken.php b/actions/requesttoken.php index 0e233ff17..09ce5a642 100644 --- a/actions/requesttoken.php +++ b/actions/requesttoken.php @@ -22,6 +22,11 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); class RequesttokenAction extends Action { + + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); try { diff --git a/actions/subscribe.php b/actions/subscribe.php index 7ce50dac8..e292fdd6b 100644 --- a/actions/subscribe.php +++ b/actions/subscribe.php @@ -21,10 +21,6 @@ if (!defined('LACONICA')) { exit(1); } class SubscribeAction extends Action { - function is_readonly() { - return false; - } - function handle($args) { parent::handle($args); diff --git a/actions/twitapidirect_messages.php b/actions/twitapidirect_messages.php index e7f3e1266..9a84082e6 100644 --- a/actions/twitapidirect_messages.php +++ b/actions/twitapidirect_messages.php @@ -23,6 +23,21 @@ require_once(INSTALLDIR.'/lib/twitterapi.php'); class Twitapidirect_messagesAction extends TwitterapiAction { + + function is_readonly() { + + static $write_methods = array( 'direct_messages', + 'sent'); + + $cmdtext = explode('.', $this->arg('method')); + + if (in_array($cmdtext[0], $write_methods)) { + return false; + } + + return true; + } + function direct_messages($args, $apidata) { parent::handle($args); common_server_error("API method under construction.", $code=501); diff --git a/actions/twitapifavorites.php b/actions/twitapifavorites.php index a4afa732a..4de567603 100644 --- a/actions/twitapifavorites.php +++ b/actions/twitapifavorites.php @@ -23,6 +23,19 @@ require_once(INSTALLDIR.'/lib/twitterapi.php'); class TwitapifavoritesAction extends TwitterapiAction { + function is_readonly() { + + static $write_methods = array('favorites'); + + $cmdtext = explode('.', $this->arg('method')); + + if (in_array($cmdtext[0], $write_methods)) { + return false; + } + + return true; + } + function favorites($args, $apidata) { parent::handle($args); common_server_error("API method under construction.", $code=501); diff --git a/actions/twitapihelp.php b/actions/twitapihelp.php index e07c9b667..7695190fc 100644 --- a/actions/twitapihelp.php +++ b/actions/twitapihelp.php @@ -23,6 +23,10 @@ require_once(INSTALLDIR.'/lib/twitterapi.php'); class TwitapihelpAction extends TwitterapiAction { + function is_readonly() { + return true; + } + /* Returns the string "ok" in the requested format with a 200 OK HTTP status code. * URL:http://identi.ca/api/help/test.format * Formats: xml, json diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php index 45a33427b..95fe550b1 100644 --- a/actions/twitapinotifications.php +++ b/actions/twitapinotifications.php @@ -24,7 +24,6 @@ require_once(INSTALLDIR.'/lib/twitterapi.php'); # This naming convention looks real sick class TwitapinotificationsAction extends TwitterapiAction { - function follow($args, $apidata) { parent::handle($args); common_server_error("API method under construction.", $code=501); diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index 69d513907..3863a3a5e 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -19,10 +19,6 @@ class UnsubscribeAction extends Action { - function is_readonly() { - return false; - } - function handle($args) { parent::handle($args); if (!common_logged_in()) { diff --git a/actions/updateprofile.php b/actions/updateprofile.php index 72246dab8..7e604f6b1 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -22,10 +22,6 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/omb.php'); class UpdateprofileAction extends Action { - - function is_readonly() { - return false; - } function handle($args) { parent::handle($args); diff --git a/actions/userauthorization.php b/actions/userauthorization.php index b02fe96ce..6ae3434a6 100644 --- a/actions/userauthorization.php +++ b/actions/userauthorization.php @@ -23,10 +23,6 @@ require_once(INSTALLDIR.'/lib/omb.php'); define('TIMESTAMP_THRESHOLD', 300); class UserauthorizationAction extends Action { - - function is_readonly() { - return false; - } function handle($args) { parent::handle($args); diff --git a/actions/userbyid.php b/actions/userbyid.php index 7b95d0725..c42cad083 100644 --- a/actions/userbyid.php +++ b/actions/userbyid.php @@ -20,6 +20,11 @@ if (!defined('LACONICA')) { exit(1); } class UserbyidAction extends Action { + + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); $id = $this->trimmed('id'); diff --git a/actions/xrds.php b/actions/xrds.php index 70a18a6b9..1d516aab7 100644 --- a/actions/xrds.php +++ b/actions/xrds.php @@ -23,6 +23,10 @@ require_once(INSTALLDIR.'/lib/omb.php'); class XrdsAction extends Action { + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); $nickname = $this->trimmed('nickname'); diff --git a/lib/action.php b/lib/action.php index 1dca596eb..1d3614ae1 100644 --- a/lib/action.php +++ b/lib/action.php @@ -27,7 +27,7 @@ class Action { // lawsuit } function is_readonly() { - return true; + return false; } function arg($key, $def=NULL) { diff --git a/lib/gallery.php b/lib/gallery.php index 4f3c18ff9..c6f1585b4 100644 --- a/lib/gallery.php +++ b/lib/gallery.php @@ -25,6 +25,10 @@ define('AVATARS_PER_PAGE', 80); class GalleryAction extends Action { + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); $nickname = $this->arg('nickname'); diff --git a/lib/rssaction.php b/lib/rssaction.php index e8a3aca70..76859a876 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -25,6 +25,10 @@ class Rss10Action extends Action { # This will contain the details of each feed item's author and be used to generate SIOC data. var $creators = array(); + + function is_readonly() { + return true; + } function handle($args) { parent::handle($args); diff --git a/lib/searchaction.php b/lib/searchaction.php index 729cfe6d4..46779bf7a 100644 --- a/lib/searchaction.php +++ b/lib/searchaction.php @@ -21,6 +21,10 @@ if (!defined('LACONICA')) { exit(1); } class SearchAction extends Action { + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); $this->show_form(); diff --git a/lib/settingsaction.php b/lib/settingsaction.php index 0e39a7459..a71c9e9bc 100644 --- a/lib/settingsaction.php +++ b/lib/settingsaction.php @@ -21,10 +21,6 @@ if (!defined('LACONICA')) { exit(1); } class SettingsAction extends Action { - function is_readonly() { - return false; - } - function handle($args) { parent::handle($args); if (!common_logged_in()) { diff --git a/lib/stream.php b/lib/stream.php index a595958e4..fefd77a46 100644 --- a/lib/stream.php +++ b/lib/stream.php @@ -21,6 +21,10 @@ if (!defined('LACONICA')) { exit(1); } class StreamAction extends Action { + function is_readonly() { + return true; + } + function handle($args) { parent::handle($args); } -- cgit v1.2.3-54-g00ecf