summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/api.php46
-rw-r--r--actions/avatarsettings.php2
-rw-r--r--actions/editgroup.php6
-rw-r--r--actions/emailsettings.php6
-rw-r--r--actions/grouplogo.php2
-rw-r--r--actions/groupsearch.php6
-rw-r--r--actions/invite.php6
-rw-r--r--actions/login.php8
-rw-r--r--actions/noticesearch.php8
-rw-r--r--actions/othersettings.php6
-rw-r--r--actions/passwordsettings.php6
-rw-r--r--actions/peoplesearch.php6
-rw-r--r--actions/profilesettings.php8
-rw-r--r--actions/register.php6
-rw-r--r--actions/smssettings.php6
-rw-r--r--actions/subscriptions.php6
16 files changed, 128 insertions, 6 deletions
diff --git a/actions/api.php b/actions/api.php
index f425a8dcd..c236378bc 100644
--- a/actions/api.php
+++ b/actions/api.php
@@ -27,6 +27,8 @@ class ApiAction extends Action
var $api_arg;
var $api_method;
var $api_action;
+ var $auth_user;
+ var $auth_pw;
function handle($args)
{
@@ -35,6 +37,7 @@ class ApiAction extends Action
$this->api_action = $this->arg('apiaction');
$method = $this->arg('method');
$argument = $this->arg('argument');
+ $this->basic_auth_process_header();
if (isset($argument)) {
$cmdext = explode('.', $argument);
@@ -50,7 +53,7 @@ class ApiAction extends Action
}
if ($this->requires_auth()) {
- if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ if (!isset($this->auth_user)) {
# This header makes basic auth go
header('WWW-Authenticate: Basic realm="StatusNet API"');
@@ -58,8 +61,8 @@ class ApiAction extends Action
# If the user hits cancel -- bam!
$this->show_basic_auth_error();
} else {
- $nickname = $_SERVER['PHP_AUTH_USER'];
- $password = $_SERVER['PHP_AUTH_PW'];
+ $nickname = $this->auth_user;
+ $password = $this->auth_pw;
$user = common_check_user($nickname, $password);
if ($user) {
@@ -76,8 +79,8 @@ class ApiAction extends Action
} else {
// Caller might give us a username even if not required
- if (isset($_SERVER['PHP_AUTH_USER'])) {
- $user = User::staticGet('nickname', $_SERVER['PHP_AUTH_USER']);
+ if (isset($this->auth_user)) {
+ $user = User::staticGet('nickname', $this->auth_user);
if ($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()
{
header('HTTP/1.1 401 Unauthorized');
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
index 0bc439ff1..02a684b38 100644
--- a/actions/avatarsettings.php
+++ b/actions/avatarsettings.php
@@ -399,5 +399,7 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->script('js/jcrop/jquery.Jcrop.min.js');
$this->script('js/jcrop/jquery.Jcrop.go.js');
}
+
+ $this->autofocus('avatarfile');
}
}
diff --git a/actions/editgroup.php b/actions/editgroup.php
index c92ca6ec6..0c2dc8bdf 100644
--- a/actions/editgroup.php
+++ b/actions/editgroup.php
@@ -160,6 +160,12 @@ class EditgroupAction extends GroupDesignAction
}
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
function trySave()
{
$cur = common_current_user();
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index af528a892..6eff06c0d 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -71,6 +71,12 @@ class EmailsettingsAction extends AccountSettingsAction
return _('Manage how you get email from %%site.name%%.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('email');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/grouplogo.php b/actions/grouplogo.php
index c6f376915..63ba769c7 100644
--- a/actions/grouplogo.php
+++ b/actions/grouplogo.php
@@ -445,6 +445,8 @@ class GrouplogoAction extends GroupDesignAction
$this->script('js/jcrop/jquery.Jcrop.min.js');
$this->script('js/jcrop/jquery.Jcrop.go.js');
}
+
+ $this->autofocus('avatarfile');
}
function showLocalNav()
diff --git a/actions/groupsearch.php b/actions/groupsearch.php
index ee4167552..f0cca7156 100644
--- a/actions/groupsearch.php
+++ b/actions/groupsearch.php
@@ -90,6 +90,12 @@ class GroupsearchAction extends SearchAction
$user_group->free();
}
}
+
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('q');
+ }
}
class GroupSearchResults extends GroupList
diff --git a/actions/invite.php b/actions/invite.php
index 9f9368701..788130c58 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -98,6 +98,12 @@ class InviteAction extends CurrentUserDesignAction
$this->showPage();
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('addresses');
+ }
+
function title()
{
if ($this->mode == 'sent') {
diff --git a/actions/login.php b/actions/login.php
index 4b00b2f08..f6d016310 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -22,6 +22,7 @@
* @category Login
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
@@ -37,6 +38,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @category Personal
* @package StatusNet
* @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
* @link http://status.net/
*/
@@ -158,6 +160,12 @@ class LoginAction extends Action
$this->showPage();
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
/**
* Title of the page
*
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index 734e43464..79cf572cc 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -135,6 +135,12 @@ class NoticesearchAction extends SearchAction
$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'noticesearch', array('q' => $q));
}
+
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('q');
+ }
}
class SearchNoticeList extends NoticeList {
@@ -190,7 +196,7 @@ class SearchNoticeListItem extends NoticeListItem {
$result = preg_replace($pattern, '<strong>\\1</strong>', $text);
/* Remove highlighting from inside links, loop incase multiple highlights in links */
- $pattern = '/(href="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU';
+ $pattern = '/(\w+="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU';
do {
$result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
} while ($count);
diff --git a/actions/othersettings.php b/actions/othersettings.php
index 4ccef8412..011b4fc83 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -71,6 +71,12 @@ class OthersettingsAction extends AccountSettingsAction
return _('Manage various other options.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('urlshorteningservice');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php
index ec842600f..cd4beac3f 100644
--- a/actions/passwordsettings.php
+++ b/actions/passwordsettings.php
@@ -69,6 +69,12 @@ class PasswordsettingsAction extends AccountSettingsAction
return _('Change your password.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('oldpassword');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index ba0f71e39..38135ecbd 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -85,6 +85,12 @@ class PeoplesearchAction extends SearchAction
$profile->free();
}
}
+
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('q');
+ }
}
/**
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index 83051c6fd..5445d9bb2 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -23,6 +23,7 @@
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
@@ -41,6 +42,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
* @package StatusNet
* @author Evan Prodromou <evan@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
* @link http://status.net/
*/
@@ -70,6 +72,12 @@ class ProfilesettingsAction extends AccountSettingsAction
'so people know more about you.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/register.php b/actions/register.php
index b40ac266d..100ab7424 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -136,6 +136,12 @@ class RegisterAction extends Action
}
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('nickname');
+ }
+
/**
* Try to register a user
*
diff --git a/actions/smssettings.php b/actions/smssettings.php
index b956cceba..672abcef8 100644
--- a/actions/smssettings.php
+++ b/actions/smssettings.php
@@ -69,6 +69,12 @@ class SmssettingsAction extends ConnectSettingsAction
return _('You can receive SMS messages through email from %%site.name%%.');
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('sms');
+ }
+
/**
* Content area of the page
*
diff --git a/actions/subscriptions.php b/actions/subscriptions.php
index b1c668228..cc7b38ee4 100644
--- a/actions/subscriptions.php
+++ b/actions/subscriptions.php
@@ -107,6 +107,12 @@ class SubscriptionsAction extends GalleryAction
array('nickname' => $this->user->nickname));
}
+ function showScripts()
+ {
+ parent::showScripts();
+ $this->autofocus('tag');
+ }
+
function showEmptyListMessage()
{
if (common_logged_in()) {