]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
isReadOnly() now takes arguments
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 13 Apr 2009 19:49:26 +0000 (15:49 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 13 Apr 2009 19:55:25 +0000 (15:55 -0400)
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.

46 files changed:
actions/all.php
actions/api.php
actions/avatarbynickname.php
actions/doc.php
actions/favorited.php
actions/featured.php
actions/foaf.php
actions/groupbyid.php
actions/groupmembers.php
actions/grouprss.php
actions/groups.php
actions/invite.php
actions/login.php
actions/logout.php
actions/microsummary.php
actions/noticesearchrss.php
actions/nudge.php
actions/opensearch.php
actions/public.php
actions/publicrss.php
actions/publictagcloud.php
actions/publicxrds.php
actions/replies.php
actions/repliesrss.php
actions/requesttoken.php
actions/showfavorites.php
actions/showgroup.php
actions/showmessage.php
actions/shownotice.php
actions/showstream.php
actions/subscribers.php
actions/sup.php
actions/tag.php
actions/tagrss.php
actions/twitapisearchjson.php
actions/userbyid.php
actions/usergroups.php
actions/userrss.php
actions/xrds.php
index.php
lib/action.php
lib/error.php
lib/galleryaction.php
lib/peoplesearchresults.php
lib/personal.php
lib/searchaction.php

index f5bbfe2e395c00138bdc990da56f01a9326a5bb8..69890a70ca351bd2ce54978d5e6dda076dbbe262 100644 (file)
@@ -25,7 +25,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
 
 class AllAction extends ProfileAction
 {
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index c18d551b6d487151286e011c65f1f534ee8afd2c..e40a1879878c8dadb6cca7f4558c8e4bf68bc5d7 100644 (file)
@@ -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;
     }
-
 }
index ca58c965374f11a4e0e5ed8a38821dfff0c6bd18..e92a993722366ec1c9551857e11a369aec210f6f 100644 (file)
@@ -98,7 +98,7 @@ class AvatarbynicknameAction extends Action
         common_redirect($url, 302);
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index ebffb7c1542fc64843d635b7a19c310c689f20f5..e6508030b658770e3009df0d47959886d4b89d52 100644 (file)
@@ -108,7 +108,7 @@ class DocAction extends Action
         return ucfirst($this->title);
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 09ab1216a64cdfa256a1e4a6b3dda9ace53bbac3..c902d80f5387e2e5c4f9f50a770864380c9cbd94 100644 (file)
@@ -85,7 +85,7 @@ class FavoritedAction extends Action
      * @return boolean true
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 86fd3f374aa37e221e691f83aaf0c78cc8195f9b..79eba2aa67b9985372a2e23a1e977306a62439ca 100644 (file)
@@ -50,7 +50,7 @@ class FeaturedAction extends Action
 {
     var $page = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 416935b1b724316daefc046172b9f567bedc6754..2d5b78d123066a58d75f7ffdb5ec21e05015ccf9 100644 (file)
@@ -25,7 +25,7 @@ define('BOTH', 0);
 
 class FoafAction extends Action
 {
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 678119a9452b71f2a0a6a040e64d39aae33d3b0b..7d327d56ccf4525c4e2c010dd83e7d184a80abe1 100644 (file)
@@ -59,7 +59,7 @@ class GroupbyidAction extends Action
      * @return boolean true
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 00f43a9f55e89c2e80d4a538e2fa3c62d45a6e8f..a90108e4d496b6c402a603fdd574179bf712ac0a 100644 (file)
@@ -48,7 +48,7 @@ class GroupmembersAction extends Action
 {
     var $page = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index de76a59600dbb67d409c44bf434784b3d62e04f0..a9a2eef877c442396424ada89c55eab7289e27b8 100644 (file)
@@ -57,7 +57,7 @@ class groupRssAction extends Rss10Action
      * @return boolean true
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 39dc2232bc5d82574b658b22883d8e831f11c531..26b52a5fcd4dde75618205ccb3716900a8a4d6b8 100644 (file)
@@ -51,7 +51,7 @@ class GroupsAction extends Action
     var $page = null;
     var $profile = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index df6e3b7147c145c6559da824ee08f77912de8e6b..7e52cdbcc6af6d20b88be1944f038a306d999c0c 100644 (file)
@@ -27,7 +27,7 @@ class InviteAction extends Action
     var $subbed = null;
     var $sent = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return false;
     }
index 59c6b4874bc24464d6fd9fbc15f05128ad4da8f2..50de83f6fb2574dc2627c2c3b87da9785110ba3a 100644 (file)
@@ -55,7 +55,7 @@ class LoginAction extends Action
      * @return boolean false
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return false;
     }
index b7681be3827ed25fe2546f7b83c8f7ea37fe9499..9f3bfe2470a2253d0e93acd9ca3ec2bf976c5423 100644 (file)
@@ -52,7 +52,7 @@ class LogoutAction extends Action
      *
      * @return boolean true
      */
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return false;
     }
index 065a2e0eba02b93b12bbbdbce748de2086a6ce8b..0b408ec953aff275b5523fbd3281b0f917de0564 100644 (file)
@@ -74,7 +74,7 @@ class MicrosummaryAction extends Action
         print $user->nickname . ': ' . $notice->content;
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index ba5276d06e34647df9661b48c4fe4607f346f8b1..f6da969ee47bc29a0257ac3772320874a943299c 100644 (file)
@@ -92,7 +92,7 @@ class NoticesearchrssAction extends Rss10Action
         return null;
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index b4e5e01dd88d4ec4d5965ba531d5beca5dab246b..c23d3e64356f4af88ea166663e9d61d56cc95c09 100644 (file)
@@ -124,7 +124,7 @@ class NudgeAction extends Action
         }
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 2eb8183066b062dc9111d890eeb6936656373aab..d1f4895ce4a2d569aa2263eaf3bce37a9d8f0ede 100644 (file)
@@ -84,7 +84,7 @@ class OpensearchAction extends Action
         $this->endXML();
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 5a380de9a8bb984ddf03b579febb03e348c6c147..27153f13159daf2c990ba7937cc697e0724ad27f 100644 (file)
@@ -56,7 +56,7 @@ class PublicAction extends Action
 
     var $page = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 77e26e0f4c5c15104d7e736fa90c0208e36c73f4..bc52f29522778483220c7994605b5b552c928502 100644 (file)
@@ -102,7 +102,7 @@ class PublicrssAction extends Rss10Action
         // nop
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 855cfed9b53437ea8a4ddd33f280e334b74cf15f..e9f33d58b6d95df7925a07355e20ec31217f1c38 100644 (file)
@@ -47,7 +47,7 @@ define('TAGS_PER_PAGE', 100);
 
 class PublictagcloudAction extends Action
 {
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 2c52f12468c9e5ef5af72f7a077b25515f529a74..283a932ca56772b4191a5bc6a5fa7e2c5618085c 100644 (file)
@@ -54,7 +54,7 @@ class PublicxrdsAction extends Action
      *
      * @return boolean true
      */
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 2769cb4227c05ea2796167a6e61a07913de4a4a0..eac4d0a3aeeda3622eec4bcbaec8a787fbbe82ac 100644 (file)
@@ -196,7 +196,7 @@ class RepliesAction extends Action
         $this->elementEnd('div');
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 985318bf168794943b1d1cc5216b21279d502f23..2017c43094a5f40f176d48efb3c3ff4601aba8c0 100644 (file)
@@ -83,7 +83,7 @@ class RepliesrssAction extends Rss10Action
         return ($avatar) ? $avatar->url : null;
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index ca253b97aa7729e957e3b70832df0417bb8da4a1..fb577fdd57bfea0902b4bab9b822ffa591a0e35f 100644 (file)
@@ -52,7 +52,7 @@ class RequesttokenAction extends Action
      * 
      * @return boolean false
      */
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return false;
     }
index 4d434950548e14d00a0f0d738f225e90d62fb605..e8cf1cb01cb1578eddd7223b5688d1f1f810bdea 100644 (file)
@@ -58,7 +58,7 @@ class ShowfavoritesAction extends Action
      * @return boolean true
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 79445851f923b1b6f41352a546ca6b3bb0cf47f2..7e86a79f156ab8ebc323cfe2a61acff7e2b13e40 100644 (file)
@@ -60,7 +60,7 @@ class ShowgroupAction extends Action
      * @return boolean true
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 572a71739aa56a000062c8e7418b02dff34317c4..4fcaadbe833aa829661affdc44b8acb714174517 100644 (file)
@@ -177,7 +177,7 @@ class ShowmessageAction extends MailboxAction
         return '';
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index ccae49bb3e4a59e13c526117962ec130cd7ced4b..2c469c9deec69c88a546de8b239007614d6a142c 100644 (file)
@@ -106,7 +106,7 @@ class ShownoticeAction extends Action
      * @return boolean true
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index ce237dae225560dcdbdea879473851bc768b9f23..c1a2c337a0da3ab070c05a75ddb5bca728226c17 100644 (file)
@@ -56,7 +56,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
 
 class ShowstreamAction extends ProfileAction
 {
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 7ebb54d33d6b6b00204bf8df7806650afd10f9d1..d91a7d4fd35241c7c756a3b1b157aa763a43e4d5 100644 (file)
@@ -130,7 +130,7 @@ class SubscribersList extends ProfileList
         $bf->show();
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 246b3299d32e975db9faa02648a3b18cade8335e..691153d6a3bcd845c0f3c4765cc8ee9f3040b328 100644 (file)
@@ -79,7 +79,7 @@ class SupAction extends Action
         return $updates;
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index c413bf8c34a7bd7cd49f459b44eb69e4f7e5c9da..7f82c2a581e4456af92af23c777b7a58dc8d017e 100644 (file)
@@ -87,7 +87,7 @@ class TagAction extends Action
                           $this->page, 'tag', array('tag' => $this->tag));
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index a77fa12c984c5a00b18037664eaa0565db15564e..83cf3afe2f45b7aa594adb248291117dd4d87908 100644 (file)
@@ -65,7 +65,7 @@ class TagrssAction extends Rss10Action
         return $c;
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 0f9f523a14f7b65d88290ab7492c28b0ba4437b2..b0e3be687c1118da16e0f88584911b6a7b786c2e 100644 (file)
@@ -142,7 +142,7 @@ class TwitapisearchjsonAction extends TwitterapiAction
      * @return boolean true
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 1e30d1aac3d1249683ba51b775028f268b4f36f7..4a985fcd7220c842f6b99efc9dcc597f21e959bd 100644 (file)
@@ -50,7 +50,7 @@ class UserbyidAction extends Action
      * 
      * @return boolean true
      */
-    function isReadOnly()
+    function isReadOnly($args)
     {                
         return true;
     }
index 06b2334bf5b636801e99b32f87e7ecfc830eea2e..e3088dcbd83d6e26dc51110ecd633f626e78becc 100644 (file)
@@ -52,7 +52,7 @@ class UsergroupsAction extends Action
     var $page = null;
     var $profile = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index d3bf352d8df3cd71bca218686657be344a2454c9..5861d9ee3687bd7a4e79e6088ea30a059c690a2b 100644 (file)
@@ -96,7 +96,7 @@ class UserrssAction extends Rss10Action
         parent::initRss($limit);
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 0758318037af2f26df170cf07bf96d9034594f70..1335b6b806653119d6ab6c0ee96c7e4c86ab5eb0 100644 (file)
@@ -52,7 +52,7 @@ class XrdsAction extends Action
      *
      * @return boolean true
      */
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index e83d08c13e9024fe5482aa7b4540b178754dbad4..e24bde9179fd884a220b05f26f170a06914b07b5 100644 (file)
--- 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');
index cc98d4445a4b6c1d95b602b50677c14c28d53cd8..673549246791a046364f34fc5063e80ee2c6f8a3 100644 (file)
@@ -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;
     }
index 526d9f81be245a36e1173814415b25e6e3720818..282682133a2c64abd366ef1102fd2869c74b4648 100644 (file)
@@ -93,7 +93,7 @@ class ErrorAction extends Action
         return $this->message;
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index 8e21d7393b082950a3113b7758e6f1a601a36ad3..0484918ce22d59e35d0a4af3e56f47a1d6778ad2 100644 (file)
@@ -76,7 +76,7 @@ class GalleryAction extends Action
         return true;
     }
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
index f8ab7cf3b65d2109d17b8adae2d017fc6a09f002..d3f8408525ae3eb3dd43f9c5a50b37d63bca1841 100644 (file)
@@ -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;
     }
index e46350c630870385b44236a0cdc27e2f163db49c..f92732375b53ff4c4967e98965fb7668d7f31f83 100644 (file)
@@ -47,7 +47,7 @@ class PersonalAction extends Action
 
     var $user = null;
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
          return true;
     }
index e7ad4affdaab9eaac36e4fae6fe7c586443b9a1e..e74450e11f3e06dee57ce04754d81c7ac02a6bd6 100644 (file)
@@ -51,7 +51,7 @@ class SearchAction extends Action
      *
      * @return boolean true
      */
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }