Moved group create API into its own action
Merge branch '0.9.x' into refactor-api * 0.9.x: Implemented create group api fix FBConnect so it doesn't muffle EndPrimaryNav don't write session if it's unchanged Fixed facebook connect primary nav to hide search option when site is private and user is not logged in Fixed facebook connect primary nav to obey sms/twitter/openid settings Fixed facebook connect login nav to obey openid settings Fixed facebook connect nav to obey sms/twitter disabled Fixed twitter defaulting to disabled Revert "Open tags should have closing tags" Don't show search suggestions for private sites Fixed E_NOTICE when returnto isn't set Fixed E_NOTICE when the "lite" parameter isn't included in the request Fixed E_NOTICE - GroupList expects an owner object in the constructor, not an array of search terms Returning false seems to fix IE from reclaiming window focus. I think Aligning notice attach label from right instead of left Fixed IE background image alignment for attach, favour and disfavour Fixed nudge and direct message background image alignment Using 'CSS sprites' for common icons for the identica theme. Default Open tags should have closing tags Conflicts: actions/twitapigroups.php actions/twitapistatuses.php
This commit is contained in:
commit
e071a8cbff
360
actions/apigroupcreate.php
Normal file
360
actions/apigroupcreate.php
Normal file
@ -0,0 +1,360 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
|
*
|
||||||
|
* Create a group via the API
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @category API
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Craig Andrews <candrews@integralblue.com>
|
||||||
|
* @author Zach Copley <zach@status.net>
|
||||||
|
* @copyright 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/
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('STATUSNET')) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once INSTALLDIR . '/lib/apiauth.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a new group. Sets the authenticated user as the administrator of the group.
|
||||||
|
*
|
||||||
|
* @category API
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Zach Copley <zach@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/
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ApiGroupCreateAction extends ApiAuthAction
|
||||||
|
{
|
||||||
|
var $group = null;
|
||||||
|
var $nickname = null;
|
||||||
|
var $fullname = null;
|
||||||
|
var $homepage = null;
|
||||||
|
var $description = null;
|
||||||
|
var $location = null;
|
||||||
|
var $aliasstring = null;
|
||||||
|
var $aliases = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take arguments for running
|
||||||
|
*
|
||||||
|
* @param array $args $_REQUEST args
|
||||||
|
*
|
||||||
|
* @return boolean success flag
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function prepare($args)
|
||||||
|
{
|
||||||
|
parent::prepare($args);
|
||||||
|
|
||||||
|
$this->user = $this->auth_user;
|
||||||
|
|
||||||
|
$this->nickname = $this->arg('nickname');
|
||||||
|
$this->fullname = $this->arg('full_name');
|
||||||
|
$this->homepage = $this->arg('homepage');
|
||||||
|
$this->description = $this->arg('description');
|
||||||
|
$this->location = $this->arg('location');
|
||||||
|
$this->aliasstring = $this->arg('aliases');
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the request
|
||||||
|
*
|
||||||
|
* Save the new group
|
||||||
|
*
|
||||||
|
* @param array $args $_REQUEST data (unused)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function handle($args)
|
||||||
|
{
|
||||||
|
parent::handle($args);
|
||||||
|
|
||||||
|
if (!common_config('inboxes','enabled')) {
|
||||||
|
$this->serverError(
|
||||||
|
_('Inboxes must be enabled for groups to work'),
|
||||||
|
400,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
|
$this->clientError(
|
||||||
|
_('This method requires a POST.'),
|
||||||
|
400,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->user)) {
|
||||||
|
$this->clientError(_('No such user!'), 404, $this->format);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->validateParams() == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$group = new User_group();
|
||||||
|
|
||||||
|
$group->query('BEGIN');
|
||||||
|
|
||||||
|
$group->nickname = $this->nickname;
|
||||||
|
$group->fullname = $this->fullname;
|
||||||
|
$group->homepage = $this->homepage;
|
||||||
|
$group->description = $this->description;
|
||||||
|
$group->location = $this->location;
|
||||||
|
$group->created = common_sql_now();
|
||||||
|
|
||||||
|
$result = $group->insert();
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
common_log_db_error($group, 'INSERT', __FILE__);
|
||||||
|
$this->serverError(
|
||||||
|
_('Could not create group.'),
|
||||||
|
500,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $group->setAliases($this->aliases);
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
$this->serverError(
|
||||||
|
_('Could not create aliases.'),
|
||||||
|
500,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$member = new Group_member();
|
||||||
|
|
||||||
|
$member->group_id = $group->id;
|
||||||
|
$member->profile_id = $this->user->id;
|
||||||
|
$member->is_admin = 1;
|
||||||
|
$member->created = $group->created;
|
||||||
|
|
||||||
|
$result = $member->insert();
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
common_log_db_error($member, 'INSERT', __FILE__);
|
||||||
|
$this->serverError(
|
||||||
|
_('Could not set group membership.'),
|
||||||
|
500,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$group->query('COMMIT');
|
||||||
|
|
||||||
|
switch($this->format) {
|
||||||
|
case 'xml':
|
||||||
|
$this->showSingleXmlGroup($group);
|
||||||
|
break;
|
||||||
|
case 'json':
|
||||||
|
$this->showSingleJsonGroup($group);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->clientError(
|
||||||
|
_('API method not found!'),
|
||||||
|
404,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate params for the new group
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function validateParams()
|
||||||
|
{
|
||||||
|
if (!Validate::string(
|
||||||
|
$this->nickname, array(
|
||||||
|
'min_length' => 1,
|
||||||
|
'max_length' => 64,
|
||||||
|
'format' => NICKNAME_FMT)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$this->clientError(
|
||||||
|
_(
|
||||||
|
'Nickname must have only lowercase letters ' .
|
||||||
|
'and numbers and no spaces.'
|
||||||
|
),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} elseif ($this->groupNicknameExists($this->nickname)) {
|
||||||
|
$this->clientError(
|
||||||
|
_('Nickname already in use. Try another one.'),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} else if (!User_group::allowedNickname($this->nickname)) {
|
||||||
|
$this->clientError(
|
||||||
|
_('Not a valid nickname.'),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} elseif (!is_null($this->homepage)
|
||||||
|
&& strlen($this->homepage) > 0
|
||||||
|
&& !Validate::uri(
|
||||||
|
$this->homepage, array(
|
||||||
|
'allowed_schemes' =>
|
||||||
|
array('http', 'https')
|
||||||
|
)
|
||||||
|
))
|
||||||
|
{
|
||||||
|
$this->clientError(
|
||||||
|
_('Homepage is not a valid URL.'),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} elseif (!is_null($this->fullname)
|
||||||
|
&& mb_strlen($this->fullname) > 255)
|
||||||
|
{
|
||||||
|
$this->clientError(
|
||||||
|
_('Full name is too long (max 255 chars).'),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} elseif (User_group::descriptionTooLong($this->description)) {
|
||||||
|
$this->clientError(sprintf(
|
||||||
|
_('Description is too long (max %d chars).'),
|
||||||
|
User_group::maxDescription()),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
} elseif (!is_null($this->location)
|
||||||
|
&& mb_strlen($this->location) > 255)
|
||||||
|
{
|
||||||
|
$this->clientError(
|
||||||
|
_('Location is too long (max 255 chars).'),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->aliasstring)) {
|
||||||
|
$this->aliases = array_map(
|
||||||
|
'common_canonical_nickname',
|
||||||
|
array_unique(preg_split('/[\s,]+/',
|
||||||
|
$this->aliasstring)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->aliases = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($this->aliases) > common_config('group', 'maxaliases')) {
|
||||||
|
$this->clientError(
|
||||||
|
sprintf(_('Too many aliases! Maximum %d.'),
|
||||||
|
common_config('group', 'maxaliases')),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->aliases as $alias) {
|
||||||
|
if (!Validate::string($alias, array(
|
||||||
|
'min_length' => 1,
|
||||||
|
'max_length' => 64,
|
||||||
|
'format' => NICKNAME_FMT
|
||||||
|
)
|
||||||
|
))
|
||||||
|
{
|
||||||
|
$this->clientError(
|
||||||
|
sprintf(_('Invalid alias: "%s"'), $alias),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($this->groupNicknameExists($alias)) {
|
||||||
|
$this->clientError(
|
||||||
|
sprintf(_('Alias "%s" already in use. Try another one.'),
|
||||||
|
$alias),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX assumes alphanum nicknames
|
||||||
|
|
||||||
|
if (strcmp($alias, $this->nickname) == 0) {
|
||||||
|
$this->clientError(
|
||||||
|
_('Alias can\'t be the same as nickname.'),
|
||||||
|
403,
|
||||||
|
$this->format
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Evarything looks OK
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function groupNicknameExists($nickname)
|
||||||
|
{
|
||||||
|
$group = User_group::staticGet('nickname', $nickname);
|
||||||
|
|
||||||
|
if (!empty($group)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$alias = Group_alias::staticGet('alias', $nickname);
|
||||||
|
|
||||||
|
if (!empty($alias)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -105,7 +105,7 @@ class GroupSearchResults extends GroupList
|
|||||||
|
|
||||||
function __construct($user_group, $terms, $action)
|
function __construct($user_group, $terms, $action)
|
||||||
{
|
{
|
||||||
parent::__construct($user_group, $terms, $action);
|
parent::__construct($user_group, null, $action);
|
||||||
$this->terms = array_map('preg_quote',
|
$this->terms = array_map('preg_quote',
|
||||||
array_map('htmlspecialchars', $terms));
|
array_map('htmlspecialchars', $terms));
|
||||||
$this->pattern = '/('.implode('|',$terms).')/i';
|
$this->pattern = '/('.implode('|',$terms).')/i';
|
||||||
|
@ -85,9 +85,18 @@ class Session extends Memcached_DataObject
|
|||||||
|
|
||||||
return $session->insert();
|
return $session->insert();
|
||||||
} else {
|
} else {
|
||||||
|
if (strcmp($session->session_data, $session_data) == 0) {
|
||||||
|
self::logdeb("Not writing session '$id'; unchanged");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
self::logdeb("Session '$id' data changed; updating");
|
||||||
|
|
||||||
|
$orig = clone($session);
|
||||||
|
|
||||||
$session->session_data = $session_data;
|
$session->session_data = $session_data;
|
||||||
|
|
||||||
return $session->update();
|
return $session->update($orig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,7 +894,7 @@ class ApiAction extends Action
|
|||||||
$this->endDocument('json');
|
$this->endDocument('json');
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_single_xml_group($group)
|
function showSingleXmlGroup($group)
|
||||||
{
|
{
|
||||||
$this->initDocument('xml');
|
$this->initDocument('xml');
|
||||||
$twitter_group = $this->twitterGroupArray($group);
|
$twitter_group = $this->twitterGroupArray($group);
|
||||||
|
@ -140,15 +140,14 @@ $default =
|
|||||||
array('enabled' => true),
|
array('enabled' => true),
|
||||||
'sms' =>
|
'sms' =>
|
||||||
array('enabled' => true),
|
array('enabled' => true),
|
||||||
'twitter' =>
|
|
||||||
array('enabled' => true),
|
|
||||||
'twitterbridge' =>
|
'twitterbridge' =>
|
||||||
array('enabled' => false),
|
array('enabled' => false),
|
||||||
'integration' =>
|
'integration' =>
|
||||||
array('source' => 'StatusNet', # source attribute for Twitter
|
array('source' => 'StatusNet', # source attribute for Twitter
|
||||||
'taguri' => $_server.',2009'), # base for tag URIs
|
'taguri' => $_server.',2009'), # base for tag URIs
|
||||||
'twitter' =>
|
'twitter' =>
|
||||||
array('consumer_key' => null,
|
array('enabled' => true,
|
||||||
|
'consumer_key' => null,
|
||||||
'consumer_secret' => null),
|
'consumer_secret' => null),
|
||||||
'memcached' =>
|
'memcached' =>
|
||||||
array('enabled' => false,
|
array('enabled' => false,
|
||||||
|
@ -572,6 +572,10 @@ class Router
|
|||||||
array('action' => 'ApiGroupMembership',
|
array('action' => 'ApiGroupMembership',
|
||||||
'id' => '[a-zA-Z0-9]+',
|
'id' => '[a-zA-Z0-9]+',
|
||||||
'format' => '(xml|json)'));
|
'format' => '(xml|json)'));
|
||||||
|
|
||||||
|
$m->connect('api/statusnet/groups/create.:format',
|
||||||
|
array('action' => 'ApiGroupCreate',
|
||||||
|
'format' => '(xml|json)'));
|
||||||
// Tags
|
// Tags
|
||||||
$m->connect('api/statusnet/tags/timeline/:tag.:format',
|
$m->connect('api/statusnet/tags/timeline/:tag.:format',
|
||||||
array('action' => 'ApiTimelineTag',
|
array('action' => 'ApiTimelineTag',
|
||||||
|
@ -135,16 +135,21 @@ class SearchAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSuggestions($q) {
|
function searchSuggestions($q) {
|
||||||
$qe = urlencode($q);
|
$message = _(<<<E_O_T
|
||||||
$message = sprintf(_(<<<E_O_T
|
|
||||||
* Make sure all words are spelled correctly.
|
* Make sure all words are spelled correctly.
|
||||||
* Try different keywords.
|
* Try different keywords.
|
||||||
* Try more general keywords.
|
* Try more general keywords.
|
||||||
* Try fewer keywords.
|
* Try fewer keywords.
|
||||||
|
|
||||||
|
E_O_T
|
||||||
|
);
|
||||||
|
if (!common_config('site', 'private')) {
|
||||||
|
$qe = urlencode($q);
|
||||||
|
$message .= sprintf(_(<<<E_O_T
|
||||||
|
|
||||||
You can also try your search on other engines:
|
You can also try your search on other engines:
|
||||||
|
|
||||||
* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=identi.ca)
|
* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=%%%%site.server%%%%)
|
||||||
* [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
|
* [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
|
||||||
* [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
|
* [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
|
||||||
* [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
|
* [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
|
||||||
@ -152,6 +157,7 @@ You can also try your search on other engines:
|
|||||||
|
|
||||||
E_O_T
|
E_O_T
|
||||||
), $qe, $qe, $qe, $qe, $qe);
|
), $qe, $qe, $qe, $qe, $qe);
|
||||||
|
}
|
||||||
$this->elementStart('dl', array('id' => 'help_search', 'class' => 'help'));
|
$this->elementStart('dl', array('id' => 'help_search', 'class' => 'help'));
|
||||||
$this->element('dt', null, _('Search help'));
|
$this->element('dt', null, _('Search help'));
|
||||||
$this->elementStart('dd', 'instructions');
|
$this->elementStart('dd', 'instructions');
|
||||||
|
@ -998,7 +998,7 @@ function common_set_returnto($url)
|
|||||||
function common_get_returnto()
|
function common_get_returnto()
|
||||||
{
|
{
|
||||||
common_ensure_session();
|
common_ensure_session();
|
||||||
return $_SESSION['returnto'];
|
return (array_key_exists('returnto', $_SESSION)) ? $_SESSION['returnto'] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_timestamp()
|
function common_timestamp()
|
||||||
|
@ -78,6 +78,7 @@ class FBCLoginGroupNav extends Widget
|
|||||||
// action => array('prompt', 'title')
|
// action => array('prompt', 'title')
|
||||||
$menu = array();
|
$menu = array();
|
||||||
|
|
||||||
|
if (!common_config('site','openidonly')) {
|
||||||
$menu['login'] = array(_('Login'),
|
$menu['login'] = array(_('Login'),
|
||||||
_('Login with a username and password'));
|
_('Login with a username and password'));
|
||||||
|
|
||||||
@ -85,9 +86,12 @@ class FBCLoginGroupNav extends Widget
|
|||||||
$menu['register'] = array(_('Register'),
|
$menu['register'] = array(_('Register'),
|
||||||
_('Sign up for a new account'));
|
_('Sign up for a new account'));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (common_config('openid', 'enabled')) {
|
||||||
$menu['openidlogin'] = array(_('OpenID'),
|
$menu['openidlogin'] = array(_('OpenID'),
|
||||||
_('Login or register with OpenID'));
|
_('Login or register with OpenID'));
|
||||||
|
}
|
||||||
|
|
||||||
$menu['FBConnectLogin'] = array(_('Facebook'),
|
$menu['FBConnectLogin'] = array(_('Facebook'),
|
||||||
_('Login or register using Facebook'));
|
_('Login or register using Facebook'));
|
||||||
|
@ -77,28 +77,30 @@ class FBCSettingsNav extends Widget
|
|||||||
$this->action->elementStart('dd');
|
$this->action->elementStart('dd');
|
||||||
|
|
||||||
# action => array('prompt', 'title')
|
# action => array('prompt', 'title')
|
||||||
$menu =
|
$menu = array();
|
||||||
array('imsettings' =>
|
if (common_config('xmpp', 'enabled')) {
|
||||||
|
$menu['imsettings'] =
|
||||||
array(_('IM'),
|
array(_('IM'),
|
||||||
_('Updates by instant messenger (IM)')),
|
_('Updates by instant messenger (IM)'));
|
||||||
'smssettings' =>
|
}
|
||||||
|
if (common_config('sms', 'enabled')) {
|
||||||
|
$menu['smssettings'] =
|
||||||
array(_('SMS'),
|
array(_('SMS'),
|
||||||
_('Updates by SMS')),
|
_('Updates by SMS'));
|
||||||
'twittersettings' =>
|
}
|
||||||
|
if (common_config('twitter', 'enabled')) {
|
||||||
|
$menu['twittersettings'] =
|
||||||
array(_('Twitter'),
|
array(_('Twitter'),
|
||||||
_('Twitter integration options')),
|
_('Twitter integration options'));
|
||||||
'FBConnectSettings' =>
|
}
|
||||||
|
$menu['FBConnectSettings'] =
|
||||||
array(_('Facebook'),
|
array(_('Facebook'),
|
||||||
_('Facebook Connect settings')));
|
_('Facebook Connect settings'));
|
||||||
|
|
||||||
$action_name = $this->action->trimmed('action');
|
$action_name = $this->action->trimmed('action');
|
||||||
$this->action->elementStart('ul', array('class' => 'nav'));
|
$this->action->elementStart('ul', array('class' => 'nav'));
|
||||||
|
|
||||||
foreach ($menu as $menuaction => $menudesc) {
|
foreach ($menu as $menuaction => $menudesc) {
|
||||||
if ($menuaction == 'imsettings' &&
|
|
||||||
!common_config('xmpp', 'enabled')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$this->action->menuItem(common_local_url($menuaction),
|
$this->action->menuItem(common_local_url($menuaction),
|
||||||
$menudesc[0],
|
$menudesc[0],
|
||||||
$menudesc[1],
|
$menudesc[1],
|
||||||
|
@ -232,6 +232,14 @@ class FBConnectPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
|
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
$connect = 'FBConnectSettings';
|
||||||
|
if (common_config('xmpp', 'enabled')) {
|
||||||
|
$connect = 'imsettings';
|
||||||
|
} else if (common_config('sms', 'enabled')) {
|
||||||
|
$connect = 'smssettings';
|
||||||
|
} else if (common_config('twitter', 'enabled')) {
|
||||||
|
$connect = 'twittersettings';
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
|
|
||||||
@ -266,13 +274,8 @@ class FBConnectPlugin extends Plugin
|
|||||||
_('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
|
_('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
|
||||||
$action->menuItem(common_local_url('profilesettings'),
|
$action->menuItem(common_local_url('profilesettings'),
|
||||||
_('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
|
_('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
|
||||||
if (common_config('xmpp', 'enabled')) {
|
$action->menuItem(common_local_url($connect),
|
||||||
$action->menuItem(common_local_url('imsettings'),
|
_('Connect'), _('Connect to services'), false, 'nav_connect');
|
||||||
_('Connect'), _('Connect to IM, SMS, Twitter'), false, 'nav_connect');
|
|
||||||
} else {
|
|
||||||
$action->menuItem(common_local_url('smssettings'),
|
|
||||||
_('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect');
|
|
||||||
}
|
|
||||||
if (common_config('invite', 'enabled')) {
|
if (common_config('invite', 'enabled')) {
|
||||||
$action->menuItem(common_local_url('invite'),
|
$action->menuItem(common_local_url('invite'),
|
||||||
_('Invite'),
|
_('Invite'),
|
||||||
@ -300,18 +303,30 @@ class FBConnectPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (!common_config('site', 'openidonly')) {
|
||||||
if (!common_config('site', 'closed')) {
|
if (!common_config('site', 'closed')) {
|
||||||
$action->menuItem(common_local_url('register'),
|
$action->menuItem(common_local_url('register'),
|
||||||
_('Register'), _('Create an account'), false, 'nav_register');
|
_('Register'), _('Create an account'), false, 'nav_register');
|
||||||
}
|
}
|
||||||
$action->menuItem(common_local_url('login'),
|
$action->menuItem(common_local_url('login'),
|
||||||
_('Login'), _('Login to the site'), false, 'nav_login');
|
_('Login'), _('Login to the site'), false, 'nav_login');
|
||||||
|
} else {
|
||||||
|
$this->menuItem(common_local_url('openidlogin'),
|
||||||
|
_('OpenID'), _('Login with OpenID'), false, 'nav_openid');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$action->menuItem(common_local_url('doc', array('title' => 'help')),
|
$action->menuItem(common_local_url('doc', array('title' => 'help')),
|
||||||
_('Help'), _('Help me!'), false, 'nav_help');
|
_('Help'), _('Help me!'), false, 'nav_help');
|
||||||
|
if ($user || !common_config('site', 'private')) {
|
||||||
$action->menuItem(common_local_url('peoplesearch'),
|
$action->menuItem(common_local_url('peoplesearch'),
|
||||||
_('Search'), _('Search for people or text'), false, 'nav_search');
|
_('Search'), _('Search for people or text'), false, 'nav_search');
|
||||||
|
}
|
||||||
|
|
||||||
|
// We are replacing the primary nav entirely; give other
|
||||||
|
// plugins a chance to handle it here.
|
||||||
|
|
||||||
|
Event::handle('EndPrimaryNav', array($action));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ RealtimeUpdate = {
|
|||||||
'border-top-color':'#AAAAAA',
|
'border-top-color':'#AAAAAA',
|
||||||
'border-top-style':'solid'
|
'border-top-style':'solid'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -468,16 +468,15 @@ margin-bottom:7px;
|
|||||||
#form_notice #notice_data-attach {
|
#form_notice #notice_data-attach {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:25px;
|
top:25px;
|
||||||
|
right:10.5%;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
#form_notice label[for=notice_data-attach] {
|
#form_notice label[for=notice_data-attach] {
|
||||||
text-indent:-9999px;
|
text-indent:-9999px;
|
||||||
left:86%;
|
|
||||||
width:16px;
|
width:16px;
|
||||||
height:16px;
|
height:16px;
|
||||||
}
|
}
|
||||||
#form_notice #notice_data-attach {
|
#form_notice #notice_data-attach {
|
||||||
left:40.6%;
|
|
||||||
padding:0;
|
padding:0;
|
||||||
height:16px;
|
height:16px;
|
||||||
}
|
}
|
||||||
|
BIN
theme/base/images/icons/icons-01.png
Normal file
BIN
theme/base/images/icons/icons-01.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
@ -88,7 +88,7 @@ color:#333333;
|
|||||||
color:#000000;
|
color:#000000;
|
||||||
}
|
}
|
||||||
#form_notice label[for=notice_data-attach] {
|
#form_notice label[for=notice_data-attach] {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -328px;
|
||||||
}
|
}
|
||||||
#form_notice #notice_data-attach {
|
#form_notice #notice_data-attach {
|
||||||
opacity:0;
|
opacity:0;
|
||||||
@ -150,16 +150,18 @@ background-color:#9BB43E;
|
|||||||
|
|
||||||
#export_data li a {
|
#export_data li a {
|
||||||
background-repeat:no-repeat;
|
background-repeat:no-repeat;
|
||||||
background-position:0 45%;
|
|
||||||
}
|
}
|
||||||
#export_data li a.rss {
|
#export_data li a.rss {
|
||||||
background-image:url(../../base/images/icons/icon_rss.png);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position:0 -130px;
|
||||||
}
|
}
|
||||||
#export_data li a.atom {
|
#export_data li a.atom {
|
||||||
background-image:url(../../base/images/icons/icon_atom.png);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position:0 -64px;
|
||||||
}
|
}
|
||||||
#export_data li a.foaf {
|
#export_data li a.foaf {
|
||||||
background-image:url(../../base/images/icons/icon_foaf.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position:0 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entity_edit a,
|
.entity_edit a,
|
||||||
@ -171,7 +173,6 @@ background-image:url(../../base/images/icons/icon_foaf.gif);
|
|||||||
.form_group_unblock input.submit,
|
.form_group_unblock input.submit,
|
||||||
.entity_nudge p,
|
.entity_nudge p,
|
||||||
.form_make_admin input.submit {
|
.form_make_admin input.submit {
|
||||||
background-position: 0 40%;
|
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-color:transparent;
|
background-color:transparent;
|
||||||
}
|
}
|
||||||
@ -189,43 +190,48 @@ background-color:#87B4C8;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.entity_edit a {
|
.entity_edit a {
|
||||||
background-image:url(../../base/images/icons/twotone/green/edit.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position: 0 -718px;
|
||||||
}
|
}
|
||||||
.entity_send-a-message a {
|
.entity_send-a-message a {
|
||||||
background-image:url(../../base/images/icons/twotone/green/quote.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position: 0 -849px;
|
||||||
}
|
}
|
||||||
.entity_nudge p,
|
.entity_nudge p,
|
||||||
.form_user_nudge input.submit {
|
.form_user_nudge input.submit {
|
||||||
background-image:url(../../base/images/icons/twotone/green/mail.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position: 0 -785px;
|
||||||
}
|
}
|
||||||
.form_user_block input.submit,
|
.form_user_block input.submit,
|
||||||
.form_user_unblock input.submit,
|
.form_user_unblock input.submit,
|
||||||
.form_group_block input.submit,
|
.form_group_block input.submit,
|
||||||
.form_group_unblock input.submit {
|
.form_group_unblock input.submit {
|
||||||
background-image:url(../../base/images/icons/twotone/green/shield.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position: 0 -918px;
|
||||||
}
|
}
|
||||||
.form_make_admin input.submit {
|
.form_make_admin input.submit {
|
||||||
background-image:url(../../base/images/icons/twotone/green/admin.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
|
background-position: 0 -983px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTICES */
|
/* NOTICES */
|
||||||
.notice .attachment {
|
.notice .attachment {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -394px;
|
||||||
}
|
}
|
||||||
#attachments .attachment {
|
#attachments .attachment {
|
||||||
background:none;
|
background:none;
|
||||||
}
|
}
|
||||||
.notice-options .notice_reply {
|
.notice-options .notice_reply {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/reply.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -589px;
|
||||||
}
|
}
|
||||||
.notice-options form.form_favor input.submit {
|
.notice-options form.form_favor input.submit {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -457px;
|
||||||
}
|
}
|
||||||
.notice-options form.form_disfavor input.submit {
|
.notice-options form.form_disfavor input.submit {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -523px;
|
||||||
}
|
}
|
||||||
.notice-options .notice_delete {
|
.notice-options .notice_delete {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/trash.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -655px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notices div.entry-content,
|
.notices div.entry-content,
|
||||||
@ -262,7 +268,7 @@ background-color:rgba(200, 200, 200, 0.300);
|
|||||||
/*END: NOTICES */
|
/*END: NOTICES */
|
||||||
|
|
||||||
#new_group a {
|
#new_group a {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/news.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -1054px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination .nav_prev a,
|
.pagination .nav_prev a,
|
||||||
@ -271,10 +277,10 @@ background-repeat:no-repeat;
|
|||||||
border-color:#CEE1E9;
|
border-color:#CEE1E9;
|
||||||
}
|
}
|
||||||
.pagination .nav_prev a {
|
.pagination .nav_prev a {
|
||||||
background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
background-position:10% 45%;
|
background-position:10% -187px;
|
||||||
}
|
}
|
||||||
.pagination .nav_next a {
|
.pagination .nav_next a {
|
||||||
background-image:url(../../base/images/icons/twotone/green/arrow-right.gif);
|
background-image:url(../../base/images/icons/icons-01.png);
|
||||||
background-position:90% 45%;
|
background-position:105% -252px;
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,14 @@ color:#FFFFFF;
|
|||||||
background-color:#D9DADB;
|
background-color:#D9DADB;
|
||||||
}
|
}
|
||||||
#form_notice .form_note + label {
|
#form_notice .form_note + label {
|
||||||
background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%;
|
background:transparent url(../../base/images/icons/icons-01.png) no-repeat 0 -328px;
|
||||||
}
|
}
|
||||||
#form_notice #notice_data-attach {
|
#form_notice #notice_data-attach {
|
||||||
filter: alpha(opacity=0);
|
filter: alpha(opacity=0);
|
||||||
}
|
}
|
||||||
|
.notice-options form.form_favor input.submit {
|
||||||
|
background-position:0 -460px;
|
||||||
|
}
|
||||||
|
.notice-options form.form_disfavor input.submit {
|
||||||
|
background-position:0 -526px;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user