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.
This commit is contained in:
Evan Prodromou
2009-04-13 15:49:26 -04:00
parent 4237407cd9
commit e9e75fc9d5
46 changed files with 54 additions and 52 deletions

View 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;
}
}