summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-13 15:49:26 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-13 15:49:26 -0400
commite9e75fc9d5f44b2ffe10602a3bd183cccb7da4ec (patch)
treedb1cd4be57f00bced05cd70528b224ef84c75adc
parent4237407cd9ba7b44be81cb506eddc4671605802a (diff)
isReadOnly() now takes arguments
Add an array of arguments to isReadOnly() method of actions, to let them change their results depending on what actions are called. Primarily used by the 'api' action. Ideally in the future that will be multiple actions. But this might still be useful.
-rw-r--r--actions/all.php2
-rw-r--r--actions/api.php13
-rw-r--r--actions/avatarbynickname.php2
-rw-r--r--actions/doc.php2
-rw-r--r--actions/favorited.php2
-rw-r--r--actions/featured.php2
-rw-r--r--actions/foaf.php2
-rw-r--r--actions/groupbyid.php2
-rw-r--r--actions/groupmembers.php2
-rw-r--r--actions/grouprss.php2
-rw-r--r--actions/groups.php2
-rw-r--r--actions/invite.php2
-rw-r--r--actions/login.php2
-rw-r--r--actions/logout.php2
-rw-r--r--actions/microsummary.php2
-rw-r--r--actions/noticesearchrss.php2
-rw-r--r--actions/nudge.php2
-rw-r--r--actions/opensearch.php2
-rw-r--r--actions/public.php2
-rw-r--r--actions/publicrss.php2
-rw-r--r--actions/publictagcloud.php2
-rw-r--r--actions/publicxrds.php2
-rw-r--r--actions/replies.php2
-rw-r--r--actions/repliesrss.php2
-rw-r--r--actions/requesttoken.php2
-rw-r--r--actions/showfavorites.php2
-rw-r--r--actions/showgroup.php2
-rw-r--r--actions/showmessage.php2
-rw-r--r--actions/shownotice.php2
-rw-r--r--actions/showstream.php2
-rw-r--r--actions/subscribers.php2
-rw-r--r--actions/sup.php2
-rw-r--r--actions/tag.php2
-rw-r--r--actions/tagrss.php2
-rw-r--r--actions/twitapisearchjson.php2
-rw-r--r--actions/userbyid.php2
-rw-r--r--actions/usergroups.php2
-rw-r--r--actions/userrss.php2
-rw-r--r--actions/xrds.php2
-rw-r--r--index.php2
-rw-r--r--lib/action.php5
-rw-r--r--lib/error.php2
-rw-r--r--lib/galleryaction.php2
-rw-r--r--lib/peoplesearchresults.php2
-rw-r--r--lib/personal.php2
-rw-r--r--lib/searchaction.php2
46 files changed, 54 insertions, 52 deletions
diff --git a/actions/all.php b/actions/all.php
index f5bbfe2e3..69890a70c 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -25,7 +25,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
class AllAction extends ProfileAction
{
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/api.php b/actions/api.php
index c18d551b6..e40a18798 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -134,8 +134,8 @@ class ApiAction extends Action
'favorites/favorites');
$fullname = "$this->api_action/$this->api_method";
-
- // If the site is "private", all API methods except laconica/config
+
+ // If the site is "private", all API methods except laconica/config
// need authentication
if (common_config('site', 'private')) {
return $fullname != 'laconica/config' || false;
@@ -180,11 +180,11 @@ class ApiAction extends Action
}
}
- function isReadOnly()
+ function isReadOnly($args)($args)
{
- # NOTE: before handle(), can't use $this->arg
- $apiaction = $_REQUEST['apiaction'];
- $method = $_REQUEST['method'];
+ $apiaction = $args['apiaction'];
+ $method = $args['method'];
+
list($cmdtext, $fmt) = explode('.', $method);
static $write_methods = array(
@@ -207,5 +207,4 @@ class ApiAction extends Action
return false;
}
-
}
diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php
index ca58c9653..e92a99372 100644
--- a/actions/avatarbynickname.php
+++ b/actions/avatarbynickname.php
@@ -98,7 +98,7 @@ class AvatarbynicknameAction extends Action
common_redirect($url, 302);
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/doc.php b/actions/doc.php
index ebffb7c15..e6508030b 100644
--- a/actions/doc.php
+++ b/actions/doc.php
@@ -108,7 +108,7 @@ class DocAction extends Action
return ucfirst($this->title);
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/favorited.php b/actions/favorited.php
index 09ab1216a..c902d80f5 100644
--- a/actions/favorited.php
+++ b/actions/favorited.php
@@ -85,7 +85,7 @@ class FavoritedAction extends Action
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/featured.php b/actions/featured.php
index 86fd3f374..79eba2aa6 100644
--- a/actions/featured.php
+++ b/actions/featured.php
@@ -50,7 +50,7 @@ class FeaturedAction extends Action
{
var $page = null;
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/foaf.php b/actions/foaf.php
index 416935b1b..2d5b78d12 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -25,7 +25,7 @@ define('BOTH', 0);
class FoafAction extends Action
{
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/groupbyid.php b/actions/groupbyid.php
index 678119a94..7d327d56c 100644
--- a/actions/groupbyid.php
+++ b/actions/groupbyid.php
@@ -59,7 +59,7 @@ class GroupbyidAction extends Action
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/groupmembers.php b/actions/groupmembers.php
index 00f43a9f5..a90108e4d 100644
--- a/actions/groupmembers.php
+++ b/actions/groupmembers.php
@@ -48,7 +48,7 @@ class GroupmembersAction extends Action
{
var $page = null;
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/grouprss.php b/actions/grouprss.php
index de76a5960..a9a2eef87 100644
--- a/actions/grouprss.php
+++ b/actions/grouprss.php
@@ -57,7 +57,7 @@ class groupRssAction extends Rss10Action
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/groups.php b/actions/groups.php
index 39dc2232b..26b52a5fc 100644
--- a/actions/groups.php
+++ b/actions/groups.php
@@ -51,7 +51,7 @@ class GroupsAction extends Action
var $page = null;
var $profile = null;
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/invite.php b/actions/invite.php
index df6e3b714..7e52cdbcc 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -27,7 +27,7 @@ class InviteAction extends Action
var $subbed = null;
var $sent = null;
- function isReadOnly()
+ function isReadOnly($args)
{
return false;
}
diff --git a/actions/login.php b/actions/login.php
index 59c6b4874..50de83f6f 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -55,7 +55,7 @@ class LoginAction extends Action
* @return boolean false
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return false;
}
diff --git a/actions/logout.php b/actions/logout.php
index b7681be38..9f3bfe247 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -52,7 +52,7 @@ class LogoutAction extends Action
*
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return false;
}
diff --git a/actions/microsummary.php b/actions/microsummary.php
index 065a2e0eb..0b408ec95 100644
--- a/actions/microsummary.php
+++ b/actions/microsummary.php
@@ -74,7 +74,7 @@ class MicrosummaryAction extends Action
print $user->nickname . ': ' . $notice->content;
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index ba5276d06..f6da969ee 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -92,7 +92,7 @@ class NoticesearchrssAction extends Rss10Action
return null;
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/nudge.php b/actions/nudge.php
index b4e5e01dd..c23d3e643 100644
--- a/actions/nudge.php
+++ b/actions/nudge.php
@@ -124,7 +124,7 @@ class NudgeAction extends Action
}
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/opensearch.php b/actions/opensearch.php
index 2eb818306..d1f4895ce 100644
--- a/actions/opensearch.php
+++ b/actions/opensearch.php
@@ -84,7 +84,7 @@ class OpensearchAction extends Action
$this->endXML();
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/public.php b/actions/public.php
index 5a380de9a..27153f131 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -56,7 +56,7 @@ class PublicAction extends Action
var $page = null;
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/publicrss.php b/actions/publicrss.php
index 77e26e0f4..bc52f2952 100644
--- a/actions/publicrss.php
+++ b/actions/publicrss.php
@@ -102,7 +102,7 @@ class PublicrssAction extends Rss10Action
// nop
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php
index 855cfed9b..e9f33d58b 100644
--- a/actions/publictagcloud.php
+++ b/actions/publictagcloud.php
@@ -47,7 +47,7 @@ define('TAGS_PER_PAGE', 100);
class PublictagcloudAction extends Action
{
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/publicxrds.php b/actions/publicxrds.php
index 2c52f1246..283a932ca 100644
--- a/actions/publicxrds.php
+++ b/actions/publicxrds.php
@@ -54,7 +54,7 @@ class PublicxrdsAction extends Action
*
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/replies.php b/actions/replies.php
index 2769cb422..eac4d0a3a 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -196,7 +196,7 @@ class RepliesAction extends Action
$this->elementEnd('div');
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/repliesrss.php b/actions/repliesrss.php
index 985318bf1..2017c4309 100644
--- a/actions/repliesrss.php
+++ b/actions/repliesrss.php
@@ -83,7 +83,7 @@ class RepliesrssAction extends Rss10Action
return ($avatar) ? $avatar->url : null;
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/requesttoken.php b/actions/requesttoken.php
index ca253b97a..fb577fdd5 100644
--- a/actions/requesttoken.php
+++ b/actions/requesttoken.php
@@ -52,7 +52,7 @@ class RequesttokenAction extends Action
*
* @return boolean false
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return false;
}
diff --git a/actions/showfavorites.php b/actions/showfavorites.php
index 4d4349505..e8cf1cb01 100644
--- a/actions/showfavorites.php
+++ b/actions/showfavorites.php
@@ -58,7 +58,7 @@ class ShowfavoritesAction extends Action
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/showgroup.php b/actions/showgroup.php
index 79445851f..7e86a79f1 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -60,7 +60,7 @@ class ShowgroupAction extends Action
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/showmessage.php b/actions/showmessage.php
index 572a71739..4fcaadbe8 100644
--- a/actions/showmessage.php
+++ b/actions/showmessage.php
@@ -177,7 +177,7 @@ class ShowmessageAction extends MailboxAction
return '';
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/shownotice.php b/actions/shownotice.php
index ccae49bb3..2c469c9de 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -106,7 +106,7 @@ class ShownoticeAction extends Action
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/showstream.php b/actions/showstream.php
index ce237dae2..c1a2c337a 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -56,7 +56,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
class ShowstreamAction extends ProfileAction
{
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/subscribers.php b/actions/subscribers.php
index 7ebb54d33..d91a7d4fd 100644
--- a/actions/subscribers.php
+++ b/actions/subscribers.php
@@ -130,7 +130,7 @@ class SubscribersList extends ProfileList
$bf->show();
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/sup.php b/actions/sup.php
index 246b3299d..691153d6a 100644
--- a/actions/sup.php
+++ b/actions/sup.php
@@ -79,7 +79,7 @@ class SupAction extends Action
return $updates;
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/tag.php b/actions/tag.php
index c413bf8c3..7f82c2a58 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -87,7 +87,7 @@ class TagAction extends Action
$this->page, 'tag', array('tag' => $this->tag));
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/tagrss.php b/actions/tagrss.php
index a77fa12c9..83cf3afe2 100644
--- a/actions/tagrss.php
+++ b/actions/tagrss.php
@@ -65,7 +65,7 @@ class TagrssAction extends Rss10Action
return $c;
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php
index 0f9f523a1..b0e3be687 100644
--- a/actions/twitapisearchjson.php
+++ b/actions/twitapisearchjson.php
@@ -142,7 +142,7 @@ class TwitapisearchjsonAction extends TwitterapiAction
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/userbyid.php b/actions/userbyid.php
index 1e30d1aac..4a985fcd7 100644
--- a/actions/userbyid.php
+++ b/actions/userbyid.php
@@ -50,7 +50,7 @@ class UserbyidAction extends Action
*
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/usergroups.php b/actions/usergroups.php
index 06b2334bf..e3088dcbd 100644
--- a/actions/usergroups.php
+++ b/actions/usergroups.php
@@ -52,7 +52,7 @@ class UsergroupsAction extends Action
var $page = null;
var $profile = null;
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/userrss.php b/actions/userrss.php
index d3bf352d8..5861d9ee3 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -96,7 +96,7 @@ class UserrssAction extends Rss10Action
parent::initRss($limit);
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/actions/xrds.php b/actions/xrds.php
index 075831803..1335b6b80 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -52,7 +52,7 @@ class XrdsAction extends Action
*
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/index.php b/index.php
index e83d08c13..e24bde917 100644
--- a/index.php
+++ b/index.php
@@ -128,7 +128,7 @@ function main()
// XXX: find somewhere for this little block to live
- if (common_config('db', 'mirror') && $action_obj->isReadOnly()) {
+ if (common_config('db', 'mirror') && $action_obj->isReadOnly($args)) {
if (is_array(common_config('db', 'mirror'))) {
// "load balancing", ha ha
$arr = common_config('db', 'mirror');
diff --git a/lib/action.php b/lib/action.php
index cc98d4445..673549246 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -791,9 +791,12 @@ class Action extends HTMLOutputter // lawsuit
*
* MAY override
*
+ * @param array $args other arguments
+ *
* @return boolean is read only action?
*/
- function isReadOnly()
+
+ function isReadOnly($args)($args)
{
return false;
}
diff --git a/lib/error.php b/lib/error.php
index 526d9f81b..282682133 100644
--- a/lib/error.php
+++ b/lib/error.php
@@ -93,7 +93,7 @@ class ErrorAction extends Action
return $this->message;
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/lib/galleryaction.php b/lib/galleryaction.php
index 8e21d7393..0484918ce 100644
--- a/lib/galleryaction.php
+++ b/lib/galleryaction.php
@@ -76,7 +76,7 @@ class GalleryAction extends Action
return true;
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/lib/peoplesearchresults.php b/lib/peoplesearchresults.php
index f8ab7cf3b..d3f840852 100644
--- a/lib/peoplesearchresults.php
+++ b/lib/peoplesearchresults.php
@@ -67,7 +67,7 @@ class PeopleSearchResults extends ProfileList
return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
}
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/lib/personal.php b/lib/personal.php
index e46350c63..f92732375 100644
--- a/lib/personal.php
+++ b/lib/personal.php
@@ -47,7 +47,7 @@ class PersonalAction extends Action
var $user = null;
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}
diff --git a/lib/searchaction.php b/lib/searchaction.php
index e7ad4affd..e74450e11 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -51,7 +51,7 @@ class SearchAction extends Action
*
* @return boolean true
*/
- function isReadOnly()
+ function isReadOnly($args)
{
return true;
}