* @author Evan Prodromou <evan@status.net>
* @author mEDI <medi@milaro.net>
* @author Sarven Capadisli <csarven@status.net>
- * @author Zach Copley <zach@status.net>
+ * @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiBareAuthAction extends ApiAuthAction
{
* @return boolean success flag
*
*/
-
function prepare($args)
{
parent::prepare($args);
*
* @return boolean true or false
*/
-
function requiresAuth()
{
// If the site is "private", all API methods except statusnet/config
// need authentication
-
if (common_config('site', 'private')) {
return true;
}
// check whether a user has been specified somehow
-
$id = $this->arg('id');
$user_id = $this->arg('user_id');
$screen_name = $this->arg('screen_name');
return false;
}
-
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiOauthAction extends Action
{
/**
*
* @return boolean false
*/
-
function isReadOnly($args)
{
return false;
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
static function cleanRequest()
{
// kill evil effects of magical slashing
-
if (get_magic_quotes_gpc() == 1) {
$_POST = array_map('stripslashes', $_POST);
$_GET = array_map('stripslashes', $_GET);
// XXX: should we strip anything else? Or alternatively
// only allow a known list of params?
-
unset($_GET['p']);
unset($_POST['p']);
}
return ($url . '&' . $k . '=' . $v);
}
}
-
}
class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
{
-
function lookup_consumer($consumer_key)
{
$con = Consumer::staticGet('consumer_key', $consumer_key);
function getAppByRequestToken($token_key)
{
// Look up the full req tokenx
-
$req_token = $this->lookup_token(null,
'request',
$token_key);
}
// Look up the full Token
-
$token = new Token();
$token->tok = $req_token->key;
$result = $token->find(true);
}
// Okay, good
-
return new OAuthToken($at->tok, $at->secret);
}
*
* @return void
*/
-
public function revoke_token($token_key, $type = 0) {
$rt = new Token();
$rt->tok = $token_key;
$rt->type = $type;
$rt->state = 0;
if (!$rt->find(true)) {
- throw new Exception('Tried to revoke unknown token');
+ // TRANS: Exception thrown when an attempt is made to revoke an unknown token.
+ throw new Exception(_('Tried to revoke unknown token'));
}
if (!$rt->delete()) {
- throw new Exception('Failed to delete revoked token');
+ // TRANS: Exception thrown when an attempt is made to remove a revoked token.
+ throw new Exception(_('Failed to delete revoked token'));
}
}
-
}
-
* @author Evan Prodromou <evan@status.net>
* @author mEDI <medi@milaro.net>
* @author Sarven Capadisli <csarven@status.net>
- * @author Zach Copley <zach@status.net>
+ * @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApiPrivateAuthAction extends ApiAuthAction
{
-
/**
* Does this API resource require authentication?
*
* @return boolean true or false
*/
-
function requiresAuth()
{
// If the site is "private", all API methods except statusnet/config
// need authentication
-
if (common_config('site', 'private')) {
return true;
}
return false;
}
-
}
* @link http://status.net/
*
*/
-
class ApplicationEditForm extends Form
{
/**
* group for user to join
*/
-
var $application = null;
/**
* @param Action $out output channel
* @param User_group $group group to join
*/
-
function __construct($out=null, $application=null)
{
parent::__construct($out);
*
* @return string ID of the form
*/
-
function id()
{
if ($this->application) {
*
* @return string the method to use for submitting
*/
-
function method()
{
$this->enctype = 'multipart/form-data';
*
* @return string of the form class
*/
-
function formClass()
{
return 'form_settings';
*
* @return string URL of the action
*/
-
function action()
{
$cur = common_current_user();
*
* @return void
*/
-
function formLegend()
{
// TRANS: Form legend.
*
* @return void
*/
-
function formData()
{
if ($this->application) {
*
* @return void
*/
-
function formActions()
{
- // TRANS: Button label
+ // TRANS: Button label in the "Edit application" form.
$this->out->submit('cancel', _m('BUTTON','Cancel'), 'submit form_action-primary',
- // TRANS: Submit button title
+ // TRANS: Submit button title.
'cancel', _('Cancel'));
- // TRANS: Button label
+ // TRANS: Button label in the "Edit application" form.
$this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary',
- // TRANS: Submit button title
+ // TRANS: Submit button title.
'save', _('Save'));
}
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ApplicationList extends Widget
{
/** Current application, application query */
}
/* Override this in subclasses. */
-
function showOwnerControls()
{
return;
}
-
}