forked from GNUsocial/gnu-social
Merge branch '0.8.x' of git://gitorious.org/laconica/mainline into 0.9.x
This commit is contained in:
commit
d635a0685d
@ -27,6 +27,8 @@ class ApiAction extends Action
|
|||||||
var $api_arg;
|
var $api_arg;
|
||||||
var $api_method;
|
var $api_method;
|
||||||
var $api_action;
|
var $api_action;
|
||||||
|
var $auth_user;
|
||||||
|
var $auth_pw;
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
@ -35,6 +37,7 @@ class ApiAction extends Action
|
|||||||
$this->api_action = $this->arg('apiaction');
|
$this->api_action = $this->arg('apiaction');
|
||||||
$method = $this->arg('method');
|
$method = $this->arg('method');
|
||||||
$argument = $this->arg('argument');
|
$argument = $this->arg('argument');
|
||||||
|
$this->basic_auth_process_header();
|
||||||
|
|
||||||
if (isset($argument)) {
|
if (isset($argument)) {
|
||||||
$cmdext = explode('.', $argument);
|
$cmdext = explode('.', $argument);
|
||||||
@ -50,7 +53,7 @@ class ApiAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->requires_auth()) {
|
if ($this->requires_auth()) {
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($this->auth_user)) {
|
||||||
|
|
||||||
# This header makes basic auth go
|
# This header makes basic auth go
|
||||||
header('WWW-Authenticate: Basic realm="StatusNet API"');
|
header('WWW-Authenticate: Basic realm="StatusNet API"');
|
||||||
@ -58,8 +61,8 @@ class ApiAction extends Action
|
|||||||
# If the user hits cancel -- bam!
|
# If the user hits cancel -- bam!
|
||||||
$this->show_basic_auth_error();
|
$this->show_basic_auth_error();
|
||||||
} else {
|
} else {
|
||||||
$nickname = $_SERVER['PHP_AUTH_USER'];
|
$nickname = $this->auth_user;
|
||||||
$password = $_SERVER['PHP_AUTH_PW'];
|
$password = $this->auth_pw;
|
||||||
$user = common_check_user($nickname, $password);
|
$user = common_check_user($nickname, $password);
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
@ -76,8 +79,8 @@ class ApiAction extends Action
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Caller might give us a username even if not required
|
// Caller might give us a username even if not required
|
||||||
if (isset($_SERVER['PHP_AUTH_USER'])) {
|
if (isset($this->auth_user)) {
|
||||||
$user = User::staticGet('nickname', $_SERVER['PHP_AUTH_USER']);
|
$user = User::staticGet('nickname', $this->auth_user);
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
@ -203,6 +206,39 @@ class ApiAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function basic_auth_process_header()
|
||||||
|
{
|
||||||
|
if(isset($_SERVER['AUTHORIZATION']) || isset($_SERVER['HTTP_AUTHORIZATION']))
|
||||||
|
{
|
||||||
|
$authorization_header = isset($_SERVER['HTTP_AUTHORIZATION'])?$_SERVER['HTTP_AUTHORIZATION']:$_SERVER['AUTHORIZATION'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_SERVER['PHP_AUTH_USER']))
|
||||||
|
{
|
||||||
|
$this->auth_user = $_SERVER['PHP_AUTH_USER'];
|
||||||
|
$this->auth_pw = $_SERVER['PHP_AUTH_PW'];
|
||||||
|
}
|
||||||
|
elseif ( isset($authorization_header) && strstr(substr($authorization_header, 0,5),'Basic') )
|
||||||
|
{
|
||||||
|
// decode the HTTP_AUTHORIZATION header on php-cgi server self
|
||||||
|
// on fcgid server the header name is AUTHORIZATION
|
||||||
|
|
||||||
|
$auth_hash = base64_decode( substr($authorization_header, 6) );
|
||||||
|
list($this->auth_user, $this->auth_pw) = explode(':', $auth_hash);
|
||||||
|
|
||||||
|
// set all to NULL on a empty basic auth request
|
||||||
|
if($this->auth_user == "") {
|
||||||
|
$this->auth_user = NULL;
|
||||||
|
$this->auth_pw = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->auth_user = NULL;
|
||||||
|
$this->auth_pw = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function show_basic_auth_error()
|
function show_basic_auth_error()
|
||||||
{
|
{
|
||||||
header('HTTP/1.1 401 Unauthorized');
|
header('HTTP/1.1 401 Unauthorized');
|
||||||
|
@ -399,5 +399,7 @@ class AvatarsettingsAction extends AccountSettingsAction
|
|||||||
$this->script('js/jcrop/jquery.Jcrop.min.js');
|
$this->script('js/jcrop/jquery.Jcrop.min.js');
|
||||||
$this->script('js/jcrop/jquery.Jcrop.go.js');
|
$this->script('js/jcrop/jquery.Jcrop.go.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->autofocus('avatarfile');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,12 @@ class EditgroupAction extends GroupDesignAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('nickname');
|
||||||
|
}
|
||||||
|
|
||||||
function trySave()
|
function trySave()
|
||||||
{
|
{
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
@ -71,6 +71,12 @@ class EmailsettingsAction extends AccountSettingsAction
|
|||||||
return _('Manage how you get email from %%site.name%%.');
|
return _('Manage how you get email from %%site.name%%.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('email');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content area of the page
|
* Content area of the page
|
||||||
*
|
*
|
||||||
|
@ -445,6 +445,8 @@ class GrouplogoAction extends GroupDesignAction
|
|||||||
$this->script('js/jcrop/jquery.Jcrop.min.js');
|
$this->script('js/jcrop/jquery.Jcrop.min.js');
|
||||||
$this->script('js/jcrop/jquery.Jcrop.go.js');
|
$this->script('js/jcrop/jquery.Jcrop.go.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->autofocus('avatarfile');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
|
@ -90,6 +90,12 @@ class GroupsearchAction extends SearchAction
|
|||||||
$user_group->free();
|
$user_group->free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('q');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupSearchResults extends GroupList
|
class GroupSearchResults extends GroupList
|
||||||
|
@ -98,6 +98,12 @@ class InviteAction extends CurrentUserDesignAction
|
|||||||
$this->showPage();
|
$this->showPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('addresses');
|
||||||
|
}
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
if ($this->mode == 'sent') {
|
if ($this->mode == 'sent') {
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* @category Login
|
* @category Login
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2009 StatusNet, Inc.
|
||||||
* @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/
|
* @link http://status.net/
|
||||||
@ -37,6 +38,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
* @category Personal
|
* @category Personal
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @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/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
@ -158,6 +160,12 @@ class LoginAction extends Action
|
|||||||
$this->showPage();
|
$this->showPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('nickname');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
*
|
*
|
||||||
|
@ -135,6 +135,12 @@ class NoticesearchAction extends SearchAction
|
|||||||
$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
|
$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
|
||||||
$page, 'noticesearch', array('q' => $q));
|
$page, 'noticesearch', array('q' => $q));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('q');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SearchNoticeList extends NoticeList {
|
class SearchNoticeList extends NoticeList {
|
||||||
|
@ -71,6 +71,12 @@ class OthersettingsAction extends AccountSettingsAction
|
|||||||
return _('Manage various other options.');
|
return _('Manage various other options.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('urlshorteningservice');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content area of the page
|
* Content area of the page
|
||||||
*
|
*
|
||||||
|
@ -69,6 +69,12 @@ class PasswordsettingsAction extends AccountSettingsAction
|
|||||||
return _('Change your password.');
|
return _('Change your password.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('oldpassword');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content area of the page
|
* Content area of the page
|
||||||
*
|
*
|
||||||
|
@ -85,6 +85,12 @@ class PeoplesearchAction extends SearchAction
|
|||||||
$profile->free();
|
$profile->free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('q');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2009 StatusNet, Inc.
|
||||||
* @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/
|
* @link http://status.net/
|
||||||
@ -41,6 +42,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
|||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @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/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
@ -70,6 +72,12 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
'so people know more about you.');
|
'so people know more about you.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('nickname');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content area of the page
|
* Content area of the page
|
||||||
*
|
*
|
||||||
|
@ -136,6 +136,12 @@ class RegisterAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('nickname');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to register a user
|
* Try to register a user
|
||||||
*
|
*
|
||||||
|
@ -69,6 +69,12 @@ class SmssettingsAction extends ConnectSettingsAction
|
|||||||
return _('You can receive SMS messages through email from %%site.name%%.');
|
return _('You can receive SMS messages through email from %%site.name%%.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('sms');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content area of the page
|
* Content area of the page
|
||||||
*
|
*
|
||||||
|
@ -107,6 +107,12 @@ class SubscriptionsAction extends GalleryAction
|
|||||||
array('nickname' => $this->user->nickname));
|
array('nickname' => $this->user->nickname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('tag');
|
||||||
|
}
|
||||||
|
|
||||||
function showEmptyListMessage()
|
function showEmptyListMessage()
|
||||||
{
|
{
|
||||||
if (common_logged_in()) {
|
if (common_logged_in()) {
|
||||||
|
@ -199,7 +199,8 @@ class OAuthRequest {/*{{{*/
|
|||||||
} else {
|
} else {
|
||||||
// collect request parameters from query string (GET) and post-data (POST) if appropriate (note: POST vars have priority)
|
// collect request parameters from query string (GET) and post-data (POST) if appropriate (note: POST vars have priority)
|
||||||
$req_parameters = $_GET;
|
$req_parameters = $_GET;
|
||||||
if ($http_method == "POST" && @strstr($request_headers["Content-Type"], "application/x-www-form-urlencoded") ) {
|
if ($http_method == "POST" &&
|
||||||
|
( @strstr($request_headers["Content-Type"], "application/x-www-form-urlencoded") || @strstr($_ENV["CONTENT_TYPE"], "application/x-www-form-urlencoded") )) {
|
||||||
$req_parameters = array_merge($req_parameters, $_POST);
|
$req_parameters = array_merge($req_parameters, $_POST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,6 +327,8 @@ class DesignSettingsAction extends AccountSettingsAction
|
|||||||
$this->script('js/farbtastic/farbtastic.js');
|
$this->script('js/farbtastic/farbtastic.js');
|
||||||
$this->script('js/farbtastic/farbtastic.go.js');
|
$this->script('js/farbtastic/farbtastic.go.js');
|
||||||
$this->script('js/userdesign.go.js');
|
$this->script('js/userdesign.go.js');
|
||||||
|
|
||||||
|
$this->autofocus('design_background-image_file');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -412,4 +412,29 @@ class HTMLOutputter extends XMLOutputter
|
|||||||
$this->element('p', 'form_guide', $instructions);
|
$this->element('p', 'form_guide', $instructions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal script to autofocus the given element on page onload.
|
||||||
|
*
|
||||||
|
* @param string $id element ID, must refer to an existing element
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function autofocus($id)
|
||||||
|
{
|
||||||
|
$this->elementStart('script', array('type' => 'text/javascript'));
|
||||||
|
$this->raw('
|
||||||
|
<!--
|
||||||
|
$(document).ready(function() {
|
||||||
|
var el = $("#' . $id . '");
|
||||||
|
if (el.length) {
|
||||||
|
el.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
-->
|
||||||
|
');
|
||||||
|
$this->elementEnd('script');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,12 @@ class OpenidloginAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('openid_url');
|
||||||
|
}
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
return _('OpenID Login');
|
return _('OpenID Login');
|
||||||
|
@ -72,6 +72,12 @@ class OpenidsettingsAction extends AccountSettingsAction
|
|||||||
' Manage your associated OpenIDs from here.');
|
' Manage your associated OpenIDs from here.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showScripts()
|
||||||
|
{
|
||||||
|
parent::showScripts();
|
||||||
|
$this->autofocus('openid_url');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for OpenID management
|
* Show the form for OpenID management
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user