Merge branch '0.7.x' into 0.8.x

This commit is contained in:
Sarven Capadisli 2009-03-30 15:15:40 +00:00
commit 27b45eeb48
27 changed files with 596 additions and 367 deletions

24
README
View File

@ -929,6 +929,16 @@ dupelimit: Time in which it's not OK for the same person to post the
same notice; default = 60 seconds. same notice; default = 60 seconds.
logo: URL of an image file to use as the logo for the site. Overrides logo: URL of an image file to use as the logo for the site. Overrides
the logo in the theme, if any. the logo in the theme, if any.
ssl: Whether to use SSL and https:// URLs for some or all pages.
Possible values are 'always' (use it for all pages), 'never'
(don't use it for any pages), or 'sometimes' (use it for
sensitive pages that include passwords like login and registration,
but not for regular pages). Default to 'never'.
sslserver: use an alternate server name for SSL URLs, like
'secure.example.org'. You should be careful to set cookie
parameters correctly so that both the SSL server and the
"normal" server can access the session cookie and
preferably other cookies as well.
db db
-- --
@ -1173,6 +1183,20 @@ banned: an array of usernames and/or profile IDs of 'banned' profiles.
not be accepted at all. (Compare with blacklisted users above, not be accepted at all. (Compare with blacklisted users above,
whose posts just won't show up in the public stream.) whose posts just won't show up in the public stream.)
newuser
-------
Options with new users.
subscribe: nickname of a user account to automatically subscribe new
users to. Typically this would be system account for e.g.
service updates or announcements. Users are able to unsub
if they want. Default is null; no auto subscribe.
welcome: nickname of a user account that sends welcome messages to new
users. Can be the same as 'subscribe' account, although on
busy servers it may be a good idea to keep that one just for
'urgent' messages. Default is null; no message.
Troubleshooting Troubleshooting
=============== ===============

View File

@ -125,6 +125,7 @@ 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 isReadOnly() function isReadOnly()
{ {
return true; return true;

View File

@ -73,11 +73,17 @@ class ShowgroupAction extends Action
function title() function title()
{ {
if (!empty($this->group->fullname)) {
$base = $this->group->fullname . ' (' . $this->group->nickname . ')';
} else {
$base = $this->group->nickname;
}
if ($this->page == 1) { if ($this->page == 1) {
return sprintf(_("%s group"), $this->group->nickname); return sprintf(_("%s group"), $base);
} else { } else {
return sprintf(_("%s group, page %d"), return sprintf(_("%s group, page %d"),
$this->group->nickname, $base,
$this->page); $this->page);
} }
} }

View File

@ -67,11 +67,17 @@ class ShowstreamAction extends Action
function title() function title()
{ {
if (!empty($this->profile->fullname)) {
$base = $this->profile->fullname . ' (' . $this->user->nickname . ') ';
} else {
$base = $this->user->nickname;
}
if ($this->page == 1) { if ($this->page == 1) {
return $this->user->nickname; return $base;
} else { } else {
return sprintf(_("%s, page %d"), return sprintf(_("%s, page %d"),
$this->user->nickname, $base,
$this->page); $this->page);
} }
} }
@ -140,16 +146,6 @@ class ShowstreamAction extends Action
$nav->show(); $nav->show();
} }
function showPageTitle()
{
$user =& common_current_user();
if ($user && ($user->id == $this->profile->id)) {
$this->element('h1', NULL, _("Your profile"));
} else {
$this->element('h1', NULL, sprintf(_('%s\'s profile'), $this->profile->nickname));
}
}
function showPageNoticeBlock() function showPageNoticeBlock()
{ {
return; return;

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
* Laconica - a distributed open-source microblogging tool * Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc. * Copyright (C) 2008, 2009, Control Yourself, Inc.
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Affero General Public License as published by
@ -17,11 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('LACONICA')) { exit(1); } if (!defined('LACONICA')) {
exit(1);
}
/** /**
* Table Definition for user * Table Definition for user
*/ */
require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
require_once 'Validate.php'; require_once 'Validate.php';
@ -79,13 +82,13 @@ class User extends Memcached_DataObject
function isSubscribed($other) function isSubscribed($other)
{ {
assert(!is_null($other)); assert(!is_null($other));
# XXX: cache results of this query // XXX: cache results of this query
$sub = Subscription::pkeyGet(array('subscriber' => $this->id, $sub = Subscription::pkeyGet(array('subscriber' => $this->id,
'subscribed' => $other->id)); 'subscribed' => $other->id));
return (is_null($sub)) ? false : true; return (is_null($sub)) ? false : true;
} }
# 'update' won't write key columns, so we have to do it ourselves. // 'update' won't write key columns, so we have to do it ourselves.
function updateKeys(&$orig) function updateKeys(&$orig)
{ {
@ -96,7 +99,7 @@ class User extends Memcached_DataObject
} }
} }
if (count($parts) == 0) { if (count($parts) == 0) {
# No changes // No changes
return true; return true;
} }
$toupdate = implode(', ', $parts); $toupdate = implode(', ', $parts);
@ -117,7 +120,7 @@ class User extends Memcached_DataObject
function allowed_nickname($nickname) function allowed_nickname($nickname)
{ {
# XXX: should already be validated for size, content, etc. // XXX: should already be validated for size, content, etc.
static $blacklist = array('rss', 'xrds', 'doc', 'main', static $blacklist = array('rss', 'xrds', 'doc', 'main',
'settings', 'notice', 'user', 'settings', 'notice', 'user',
'search', 'avatar', 'tag', 'tags', 'search', 'avatar', 'tag', 'tags',
@ -147,7 +150,7 @@ class User extends Memcached_DataObject
$sub->subscriber = $this->id; $sub->subscriber = $this->id;
$sub->subscribed = $other->id; $sub->subscribed = $other->id;
$sub->created = common_sql_now(); # current time $sub->created = common_sql_now(); // current time
if (!$sub->insert()) { if (!$sub->insert()) {
return false; return false;
@ -173,7 +176,7 @@ class User extends Memcached_DataObject
static function register($fields) { static function register($fields) {
# MAGICALLY put fields into current scope // MAGICALLY put fields into current scope
extract($fields); extract($fields);
@ -211,11 +214,11 @@ class User extends Memcached_DataObject
$user->id = $id; $user->id = $id;
$user->nickname = $nickname; $user->nickname = $nickname;
if (!empty($password)) { # may not have a password for OpenID users if (!empty($password)) { // may not have a password for OpenID users
$user->password = common_munge_password($password, $id); $user->password = common_munge_password($password, $id);
} }
# Users who respond to invite email have proven their ownership of that address // Users who respond to invite email have proven their ownership of that address
if (!empty($code)) { if (!empty($code)) {
$invite = Invitation::staticGet($code); $invite = Invitation::staticGet($code);
@ -240,7 +243,7 @@ class User extends Memcached_DataObject
return false; return false;
} }
# Everyone is subscribed to themself // Everyone is subscribed to themself
$subscription = new Subscription(); $subscription = new Subscription();
$subscription->subscriber = $user->id; $subscription->subscriber = $user->id;
@ -273,16 +276,58 @@ class User extends Memcached_DataObject
$user->emailChanged(); $user->emailChanged();
} }
// Default system subscription
$defnick = common_config('newuser', 'default');
if (!empty($defnick)) {
$defuser = User::staticGet('nickname', $defnick);
if (empty($defuser)) {
common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick),
__FILE__);
} else {
$defsub = new Subscription();
$defsub->subscriber = $user->id;
$defsub->subscribed = $defuser->id;
$defsub->created = $user->created;
$result = $defsub->insert();
if (!$result) {
common_log_db_error($defsub, 'INSERT', __FILE__);
return false;
}
}
}
$profile->query('COMMIT'); $profile->query('COMMIT');
if ($email && !$user->email) { if ($email && !$user->email) {
mail_confirm_address($user, $confirm->code, $profile->nickname, $email); mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
} }
// Welcome message
$welcome = common_config('newuser', 'welcome');
if (!empty($welcome)) {
$welcomeuser = User::staticGet('nickname', $welcome);
if (empty($welcomeuser)) {
common_log(LOG_WARNING, sprintf("Welcome user %s does not exist.", $defnick),
__FILE__);
} else {
$notice = Notice::saveNew($welcomeuser->id,
sprintf(_('Welcome to %1$s, @%2$s!'),
common_config('site', 'name'),
$user->nickname),
'system');
}
}
return $user; return $user;
} }
# Things we do when the email changes // Things we do when the email changes
function emailChanged() function emailChanged()
{ {
@ -303,46 +348,46 @@ class User extends Memcached_DataObject
{ {
$cache = common_memcache(); $cache = common_memcache();
# XXX: Kind of a hack. // XXX: Kind of a hack.
if ($cache) { if ($cache) {
# This is the stream of favorite notices, in rev chron // This is the stream of favorite notices, in rev chron
# order. This forces it into cache. // order. This forces it into cache.
$faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW); $faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
$cnt = 0; $cnt = 0;
while ($faves->fetch()) { while ($faves->fetch()) {
if ($faves->id < $notice->id) { if ($faves->id < $notice->id) {
# If we passed it, it's not a fave // If we passed it, it's not a fave
return false; return false;
} else if ($faves->id == $notice->id) { } else if ($faves->id == $notice->id) {
# If it matches a cached notice, then it's a fave // If it matches a cached notice, then it's a fave
return true; return true;
} }
$cnt++; $cnt++;
} }
# If we're not past the end of the cache window, // If we're not past the end of the cache window,
# then the cache has all available faves, so this one // then the cache has all available faves, so this one
# is not a fave. // is not a fave.
if ($cnt < NOTICE_CACHE_WINDOW) { if ($cnt < NOTICE_CACHE_WINDOW) {
return false; return false;
} }
# Otherwise, cache doesn't have all faves; // Otherwise, cache doesn't have all faves;
# fall through to the default // fall through to the default
} }
$fave = Fave::pkeyGet(array('user_id' => $this->id, $fave = Fave::pkeyGet(array('user_id' => $this->id,
'notice_id' => $notice->id)); 'notice_id' => $notice->id));
return ((is_null($fave)) ? false : true); return ((is_null($fave)) ? false : true);
} }
function mutuallySubscribed($other) function mutuallySubscribed($other)
{ {
return $this->isSubscribed($other) && return $this->isSubscribed($other) &&
$other->isSubscribed($this); $other->isSubscribed($this);
} }
function mutuallySubscribedUsers() function mutuallySubscribedUsers()
{ {
// 3-way join; probably should get cached
# 3-way join; probably should get cached $UT = common_config('db','type')=='pgsql'?'"user"':'user';
$UT = common_config('db','type')=='pgsql'?'"user"':'user';
$qry = "SELECT $UT.* " . $qry = "SELECT $UT.* " .
"FROM subscription sub1 JOIN $UT ON sub1.subscribed = $UT.id " . "FROM subscription sub1 JOIN $UT ON sub1.subscribed = $UT.id " .
"JOIN subscription sub2 ON $UT.id = sub2.subscriber " . "JOIN subscription sub2 ON $UT.id = sub2.subscriber " .
@ -365,8 +410,8 @@ class User extends Memcached_DataObject
$offset, $limit, $since_id, $before_id, null, $since); $offset, $limit, $since_id, $before_id, null, $since);
} }
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
{ {
$profile = $this->getProfile(); $profile = $this->getProfile();
if (!$profile) { if (!$profile) {
return null; return null;
@ -375,8 +420,8 @@ class User extends Memcached_DataObject
} }
} }
function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE)
{ {
$qry = $qry =
'SELECT notice.* ' . 'SELECT notice.* ' .
'FROM notice JOIN fave ON notice.id = fave.notice_id ' . 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
@ -386,12 +431,12 @@ class User extends Memcached_DataObject
$offset, $limit); $offset, $limit);
} }
function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
{ {
$enabled = common_config('inboxes', 'enabled'); $enabled = common_config('inboxes', 'enabled');
# Complicated code, depending on whether we support inboxes yet // Complicated code, depending on whether we support inboxes yet
# XXX: make this go away when inboxes become mandatory // XXX: make this go away when inboxes become mandatory
if ($enabled === false || if ($enabled === false ||
($enabled == 'transitional' && $this->inboxed == 0)) { ($enabled == 'transitional' && $this->inboxed == 0)) {
@ -401,13 +446,13 @@ class User extends Memcached_DataObject
'WHERE subscription.subscriber = %d '; 'WHERE subscription.subscriber = %d ';
$order = null; $order = null;
} else if ($enabled === true || } else if ($enabled === true ||
($enabled == 'transitional' && $this->inboxed == 1)) { ($enabled == 'transitional' && $this->inboxed == 1)) {
$qry = $qry =
'SELECT notice.* ' . 'SELECT notice.* ' .
'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' . 'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' .
'WHERE notice_inbox.user_id = %d '; 'WHERE notice_inbox.user_id = %d ';
# NOTE: we override ORDER // NOTE: we override ORDER
$order = null; $order = null;
} }
return Notice::getStream(sprintf($qry, $this->id), return Notice::getStream(sprintf($qry, $this->id),
@ -416,35 +461,34 @@ class User extends Memcached_DataObject
$order, $since); $order, $since);
} }
function blowFavesCache() function blowFavesCache()
{ {
$cache = common_memcache(); $cache = common_memcache();
if ($cache) { if ($cache) {
# Faves don't happen chronologically, so we need to blow // Faves don't happen chronologically, so we need to blow
# ;last cache, too // ;last cache, too
$cache->delete(common_cache_key('user:faves:'.$this->id)); $cache->delete(common_cache_key('user:faves:'.$this->id));
$cache->delete(common_cache_key('user:faves:'.$this->id).';last'); $cache->delete(common_cache_key('user:faves:'.$this->id).';last');
} }
} }
function getSelfTags() function getSelfTags()
{ {
return Profile_tag::getTags($this->id, $this->id); return Profile_tag::getTags($this->id, $this->id);
} }
function setSelfTags($newtags) function setSelfTags($newtags)
{ {
return Profile_tag::setTags($this->id, $this->id, $newtags); return Profile_tag::setTags($this->id, $this->id, $newtags);
} }
function block($other) function block($other)
{ {
// Add a new block record
# Add a new block record
$block = new Profile_block(); $block = new Profile_block();
# Begin a transaction // Begin a transaction
$block->query('BEGIN'); $block->query('BEGIN');
@ -458,7 +502,7 @@ class User extends Memcached_DataObject
return false; return false;
} }
# Cancel their subscription, if it exists // Cancel their subscription, if it exists
$sub = Subscription::pkeyGet(array('subscriber' => $other->id, $sub = Subscription::pkeyGet(array('subscriber' => $other->id,
'subscribed' => $this->id)); 'subscribed' => $this->id));
@ -478,8 +522,7 @@ class User extends Memcached_DataObject
function unblock($other) function unblock($other)
{ {
// Get the block record
# Get the block record
$block = Profile_block::get($this->id, $other->id); $block = Profile_block::get($this->id, $other->id);

View File

@ -174,3 +174,13 @@ $config['sphinx']['port'] = 3312;
#http://taguri.org/ Examples: #http://taguri.org/ Examples:
#$config['integration']['taguri'] = 'example.net,2008'; #$config['integration']['taguri'] = 'example.net,2008';
#$config['integration']['taguri'] = 'admin@example.net,2009-03-09' #$config['integration']['taguri'] = 'admin@example.net,2009-03-09'
#Don't use SSL
#$config['site']['ssl'] = 'never';
#Use SSL only for sensitive pages (like login, password change)
#$config['site']['ssl'] = 'sometimes';
#Use SSL for all pages
#$config['site']['ssl'] = 'always';
#Use a different hostname for SSL-encrypted pages
#$config['site']['sslserver'] = 'secure.example.org';

View File

@ -45,4 +45,4 @@ VALUES
('twitux','Twitux','http://live.gnome.org/DanielMorales/Twitux', now()), ('twitux','Twitux','http://live.gnome.org/DanielMorales/Twitux', now()),
('twitvim','TwitVim','http://vim.sourceforge.net/scripts/script.php?script_id=2204', now()), ('twitvim','TwitVim','http://vim.sourceforge.net/scripts/script.php?script_id=2204', now()),
('urfastr','urfastr','http://urfastr.net/', now()), ('urfastr','urfastr','http://urfastr.net/', now()),
('adium', 'Adium', 'http://www.adiumx.com/', now())); ('adium', 'Adium', 'http://www.adiumx.com/', now());

View File

@ -241,12 +241,7 @@ class Net_URL_Mapper_Path
} }
$path = '/'.trim(Net_URL::resolvePath($path), '/'); $path = '/'.trim(Net_URL::resolvePath($path), '/');
if (!empty($qstring)) { if (!empty($qstring)) {
if (!strpos($path, '?')) { $path .= '?'.http_build_query($qstring);
$path .= '?';
} else {
$path .= '&';
}
$path .= http_build_query($qstring);
} }
if (!empty($anchor)) { if (!empty($anchor)) {
$path .= '#'.ltrim($anchor, '#'); $path .= '#'.ltrim($anchor, '#');

495
js/jquery.js vendored
View File

@ -1,13 +1,13 @@
/*! /*!
* jQuery JavaScript Library v1.3.1 * jQuery JavaScript Library v1.3.2
* http://jquery.com/ * http://jquery.com/
* *
* Copyright (c) 2009 John Resig * Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses. * Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License * http://docs.jquery.com/License
* *
* Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009) * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6158 * Revision: 6246
*/ */
(function(){ (function(){
@ -88,14 +88,16 @@ jQuery.fn = jQuery.prototype = {
this.context = selector.context; this.context = selector.context;
} }
return this.setArray(jQuery.makeArray(selector)); return this.setArray(jQuery.isArray( selector ) ?
selector :
jQuery.makeArray(selector));
}, },
// Start with an empty selector // Start with an empty selector
selector: "", selector: "",
// The current version of jQuery being used // The current version of jQuery being used
jquery: "1.3.1", jquery: "1.3.2",
// The number of elements contained in the matched element set // The number of elements contained in the matched element set
size: function() { size: function() {
@ -108,7 +110,7 @@ jQuery.fn = jQuery.prototype = {
return num === undefined ? return num === undefined ?
// Return a 'clean' array // Return a 'clean' array
jQuery.makeArray( this ) : Array.prototype.slice.call( this ) :
// Return just the object // Return just the object
this[ num ]; this[ num ];
@ -278,23 +280,21 @@ jQuery.fn = jQuery.prototype = {
}, },
// For internal use only. // For internal use only.
// Behaves like an Array's .push method, not like a jQuery method. // Behaves like an Array's method, not like a jQuery method.
push: [].push, push: [].push,
sort: [].sort,
splice: [].splice,
find: function( selector ) { find: function( selector ) {
if ( this.length === 1 && !/,/.test(selector) ) { if ( this.length === 1 ) {
var ret = this.pushStack( [], "find", selector ); var ret = this.pushStack( [], "find", selector );
ret.length = 0; ret.length = 0;
jQuery.find( selector, this[0], ret ); jQuery.find( selector, this[0], ret );
return ret; return ret;
} else { } else {
var elems = jQuery.map(this, function(elem){ return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
return jQuery.find( selector, elem ); return jQuery.find( selector, elem );
}); })), "find", selector );
return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
jQuery.unique( elems ) :
elems, "find", selector );
} }
}, },
@ -310,33 +310,37 @@ jQuery.fn = jQuery.prototype = {
// attributes in IE that are actually only stored // attributes in IE that are actually only stored
// as properties will not be copied (such as the // as properties will not be copied (such as the
// the name attribute on an input). // the name attribute on an input).
var clone = this.cloneNode(true), var html = this.outerHTML;
container = document.createElement("div"); if ( !html ) {
container.appendChild(clone); var div = this.ownerDocument.createElement("div");
return jQuery.clean([container.innerHTML])[0]; div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
}
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
} else } else
return this.cloneNode(true); return this.cloneNode(true);
}); });
// Need to set the expando to null on the cloned set if it exists
// removeData doesn't work here, IE removes it from the original as well
// this is primarily for IE but the data expando shouldn't be copied over in any browser
var clone = ret.find("*").andSelf().each(function(){
if ( this[ expando ] !== undefined )
this[ expando ] = null;
});
// Copy the events from the original to the clone // Copy the events from the original to the clone
if ( events === true ) if ( events === true ) {
this.find("*").andSelf().each(function(i){ var orig = this.find("*").andSelf(), i = 0;
if (this.nodeType == 3)
return;
var events = jQuery.data( this, "events" );
for ( var type in events ) ret.find("*").andSelf().each(function(){
for ( var handler in events[ type ] ) if ( this.nodeName !== orig[i].nodeName )
jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); return;
var events = jQuery.data( orig[i], "events" );
for ( var type in events ) {
for ( var handler in events[ type ] ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
}
}
i++;
}); });
}
// Return the cloned set // Return the cloned set
return ret; return ret;
@ -355,14 +359,18 @@ jQuery.fn = jQuery.prototype = {
}, },
closest: function( selector ) { closest: function( selector ) {
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null; var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
closer = 0;
return this.map(function(){ return this.map(function(){
var cur = this; var cur = this;
while ( cur && cur.ownerDocument ) { while ( cur && cur.ownerDocument ) {
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
jQuery.data(cur, "closest", closer);
return cur; return cur;
}
cur = cur.parentNode; cur = cur.parentNode;
closer++;
} }
}); });
}, },
@ -475,7 +483,7 @@ jQuery.fn = jQuery.prototype = {
html: function( value ) { html: function( value ) {
return value === undefined ? return value === undefined ?
(this[0] ? (this[0] ?
this[0].innerHTML : this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
null) : null) :
this.empty().append( value ); this.empty().append( value );
}, },
@ -507,12 +515,12 @@ jQuery.fn = jQuery.prototype = {
if ( this[0] ) { if ( this[0] ) {
var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
first = fragment.firstChild, first = fragment.firstChild;
extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
if ( first ) if ( first )
for ( var i = 0, l = this.length; i < l; i++ ) for ( var i = 0, l = this.length; i < l; i++ )
callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment ); callback.call( root(this[i], first), this.length > 1 || i > 0 ?
fragment.cloneNode(true) : fragment );
if ( scripts ) if ( scripts )
jQuery.each( scripts, evalScript ); jQuery.each( scripts, evalScript );
@ -636,9 +644,7 @@ jQuery.extend({
// Evalulates a script in a global context // Evalulates a script in a global context
globalEval: function( data ) { globalEval: function( data ) {
data = jQuery.trim( data ); if ( data && /\S/.test(data) ) {
if ( data ) {
// Inspired by code by Andrea Giammarchi // Inspired by code by Andrea Giammarchi
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
var head = document.getElementsByTagName("head")[0] || document.documentElement, var head = document.getElementsByTagName("head")[0] || document.documentElement,
@ -741,26 +747,32 @@ jQuery.extend({
elem.style[ name ] = old[ name ]; elem.style[ name ] = old[ name ];
}, },
css: function( elem, name, force ) { css: function( elem, name, force, extra ) {
if ( name == "width" || name == "height" ) { if ( name == "width" || name == "height" ) {
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
function getWH() { function getWH() {
val = name == "width" ? elem.offsetWidth : elem.offsetHeight; val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
var padding = 0, border = 0;
if ( extra === "border" )
return;
jQuery.each( which, function() { jQuery.each( which, function() {
padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; if ( !extra )
border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
if ( extra === "margin" )
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
else
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
}); });
val -= Math.round(padding + border);
} }
if ( jQuery(elem).is(":visible") ) if ( elem.offsetWidth !== 0 )
getWH(); getWH();
else else
jQuery.swap( elem, props, getWH ); jQuery.swap( elem, props, getWH );
return Math.max(0, val); return Math.max(0, Math.round(val));
} }
return jQuery.curCSS( elem, name, force ); return jQuery.curCSS( elem, name, force );
@ -866,7 +878,7 @@ jQuery.extend({
}); });
// Trim whitespace, otherwise indexOf won't work as expected // Trim whitespace, otherwise indexOf won't work as expected
var tags = jQuery.trim( elem ).toLowerCase(); var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
var wrap = var wrap =
// option or optgroup // option or optgroup
@ -906,11 +918,12 @@ jQuery.extend({
if ( !jQuery.support.tbody ) { if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody> // String was a <table>, *may* have spurious <tbody>
var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? var hasBody = /<tbody/i.test(elem),
div.firstChild && div.firstChild.childNodes : tbody = !tags.indexOf("<table") && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot> // String was a bare <thead> or <tfoot>
wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? wrap[1] == "<table>" && !hasBody ?
div.childNodes : div.childNodes :
[]; [];
@ -1189,13 +1202,16 @@ jQuery.each({
insertAfter: "after", insertAfter: "after",
replaceAll: "replaceWith" replaceAll: "replaceWith"
}, function(name, original){ }, function(name, original){
jQuery.fn[ name ] = function() { jQuery.fn[ name ] = function( selector ) {
var args = arguments; var ret = [], insert = jQuery( selector );
return this.each(function(){ for ( var i = 0, l = insert.length; i < l; i++ ) {
for ( var i = 0, length = args.length; i < length; i++ ) var elems = (i > 0 ? this.clone(true) : this).get();
jQuery( args[ i ] )[ original ]( this ); jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
}); ret = ret.concat( elems );
}
return this.pushStack( ret, name, selector );
}; };
}); });
@ -1234,7 +1250,7 @@ jQuery.each({
empty: function() { empty: function() {
// Remove element nodes and prevent memory leaks // Remove element nodes and prevent memory leaks
jQuery( ">*", this ).remove(); jQuery(this).children().remove();
// Remove any remaining nodes // Remove any remaining nodes
while ( this.firstChild ) while ( this.firstChild )
@ -1402,7 +1418,7 @@ jQuery.fn.extend({
*/ */
(function(){ (function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g, var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
done = 0, done = 0,
toString = Object.prototype.toString; toString = Object.prototype.toString;
@ -1507,6 +1523,19 @@ var Sizzle = function(selector, context, results, seed) {
if ( extra ) { if ( extra ) {
Sizzle( extra, context, results, seed ); Sizzle( extra, context, results, seed );
if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
}
}
}
} }
return results; return results;
@ -1548,7 +1577,8 @@ Sizzle.find = function(expr, context, isXML){
}; };
Sizzle.filter = function(expr, set, inplace, not){ Sizzle.filter = function(expr, set, inplace, not){
var old = expr, result = [], curLoop = set, match, anyFound; var old = expr, result = [], curLoop = set, match, anyFound,
isXMLFilter = set && set[0] && isXML(set[0]);
while ( expr && set.length ) { while ( expr && set.length ) {
for ( var type in Expr.filter ) { for ( var type in Expr.filter ) {
@ -1561,7 +1591,7 @@ Sizzle.filter = function(expr, set, inplace, not){
} }
if ( Expr.preFilter[ type ] ) { if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not ); match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) { if ( !match ) {
anyFound = found = true; anyFound = found = true;
@ -1606,8 +1636,6 @@ Sizzle.filter = function(expr, set, inplace, not){
} }
} }
expr = expr.replace(/\s*,\s*/, "");
// Improper expression // Improper expression
if ( expr == old ) { if ( expr == old ) {
if ( anyFound == null ) { if ( anyFound == null ) {
@ -1645,26 +1673,33 @@ var Expr = Sizzle.selectors = {
} }
}, },
relative: { relative: {
"+": function(checkSet, part){ "+": function(checkSet, part, isXML){
for ( var i = 0, l = checkSet.length; i < l; i++ ) { var isPartStr = typeof part === "string",
var elem = checkSet[i]; isTag = isPartStr && !/\W/.test(part),
if ( elem ) { isPartStrNotTag = isPartStr && !isTag;
var cur = elem.previousSibling;
while ( cur && cur.nodeType !== 1 ) { if ( isTag && !isXML ) {
cur = cur.previousSibling; part = part.toUpperCase();
} }
checkSet[i] = typeof part === "string" ?
cur || false : for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
cur === part; if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
elem || false :
elem === part;
} }
} }
if ( typeof part === "string" ) { if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true ); Sizzle.filter( part, checkSet, true );
} }
}, },
">": function(checkSet, part, isXML){ ">": function(checkSet, part, isXML){
if ( typeof part === "string" && !/\W/.test(part) ) { var isPartStr = typeof part === "string";
if ( isPartStr && !/\W/.test(part) ) {
part = isXML ? part : part.toUpperCase(); part = isXML ? part : part.toUpperCase();
for ( var i = 0, l = checkSet.length; i < l; i++ ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) {
@ -1678,19 +1713,19 @@ var Expr = Sizzle.selectors = {
for ( var i = 0, l = checkSet.length; i < l; i++ ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i]; var elem = checkSet[i];
if ( elem ) { if ( elem ) {
checkSet[i] = typeof part === "string" ? checkSet[i] = isPartStr ?
elem.parentNode : elem.parentNode :
elem.parentNode === part; elem.parentNode === part;
} }
} }
if ( typeof part === "string" ) { if ( isPartStr ) {
Sizzle.filter( part, checkSet, true ); Sizzle.filter( part, checkSet, true );
} }
} }
}, },
"": function(checkSet, part, isXML){ "": function(checkSet, part, isXML){
var doneName = "done" + (done++), checkFn = dirCheck; var doneName = done++, checkFn = dirCheck;
if ( !part.match(/\W/) ) { if ( !part.match(/\W/) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase(); var nodeCheck = part = isXML ? part : part.toUpperCase();
@ -1700,7 +1735,7 @@ var Expr = Sizzle.selectors = {
checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
}, },
"~": function(checkSet, part, isXML){ "~": function(checkSet, part, isXML){
var doneName = "done" + (done++), checkFn = dirCheck; var doneName = done++, checkFn = dirCheck;
if ( typeof part === "string" && !part.match(/\W/) ) { if ( typeof part === "string" && !part.match(/\W/) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase(); var nodeCheck = part = isXML ? part : part.toUpperCase();
@ -1718,8 +1753,16 @@ var Expr = Sizzle.selectors = {
} }
}, },
NAME: function(match, context, isXML){ NAME: function(match, context, isXML){
if ( typeof context.getElementsByName !== "undefined" && !isXML ) { if ( typeof context.getElementsByName !== "undefined" ) {
return context.getElementsByName(match[1]); var ret = [], results = context.getElementsByName(match[1]);
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
} }
}, },
TAG: function(match, context){ TAG: function(match, context){
@ -1727,13 +1770,16 @@ var Expr = Sizzle.selectors = {
} }
}, },
preFilter: { preFilter: {
CLASS: function(match, curLoop, inplace, result, not){ CLASS: function(match, curLoop, inplace, result, not, isXML){
match = " " + match[1].replace(/\\/g, "") + " "; match = " " + match[1].replace(/\\/g, "") + " ";
var elem; if ( isXML ) {
for ( var i = 0; (elem = curLoop[i]) != null; i++ ) { return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) { if ( elem ) {
if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) { if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
if ( !inplace ) if ( !inplace )
result.push( elem ); result.push( elem );
} else if ( inplace ) { } else if ( inplace ) {
@ -1764,14 +1810,14 @@ var Expr = Sizzle.selectors = {
} }
// TODO: Move to normal caching system // TODO: Move to normal caching system
match[0] = "done" + (done++); match[0] = done++;
return match; return match;
}, },
ATTR: function(match){ ATTR: function(match, curLoop, inplace, result, not, isXML){
var name = match[1].replace(/\\/g, ""); var name = match[1].replace(/\\/g, "");
if ( Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -1784,7 +1830,7 @@ var Expr = Sizzle.selectors = {
PSEUDO: function(match, curLoop, inplace, result, not){ PSEUDO: function(match, curLoop, inplace, result, not){
if ( match[1] === "not" ) { if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one // If we're dealing with a complex expression, or a simple one
if ( match[3].match(chunker).length > 1 ) { if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop); match[3] = Sizzle(match[3], null, null, curLoop);
} else { } else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
@ -1793,7 +1839,7 @@ var Expr = Sizzle.selectors = {
} }
return false; return false;
} }
} else if ( Expr.match.POS.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
@ -1890,47 +1936,6 @@ var Expr = Sizzle.selectors = {
} }
}, },
filter: { filter: {
CHILD: function(elem, match){
var type = match[1], parent = elem.parentNode;
var doneName = match[0];
if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) {
var count = 1;
for ( var node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType == 1 ) {
node.nodeIndex = count++;
}
}
parent[ doneName ] = count - 1;
}
if ( type == "first" ) {
return elem.nodeIndex == 1;
} else if ( type == "last" ) {
return elem.nodeIndex == parent[ doneName ];
} else if ( type == "only" ) {
return parent[ doneName ] == 1;
} else if ( type == "nth" ) {
var add = false, first = match[2], last = match[3];
if ( first == 1 && last == 0 ) {
return true;
}
if ( first == 0 ) {
if ( elem.nodeIndex == last ) {
add = true;
}
} else if ( (elem.nodeIndex - last) % first == 0 && (elem.nodeIndex - last) / first >= 0 ) {
add = true;
}
return add;
}
},
PSEUDO: function(elem, match, i, array){ PSEUDO: function(elem, match, i, array){
var name = match[1], filter = Expr.filters[ name ]; var name = match[1], filter = Expr.filters[ name ];
@ -1950,6 +1955,49 @@ var Expr = Sizzle.selectors = {
return true; return true;
} }
}, },
CHILD: function(elem, match){
var type = match[1], node = elem;
switch (type) {
case 'only':
case 'first':
while (node = node.previousSibling) {
if ( node.nodeType === 1 ) return false;
}
if ( type == 'first') return true;
node = elem;
case 'last':
while (node = node.nextSibling) {
if ( node.nodeType === 1 ) return false;
}
return true;
case 'nth':
var first = match[2], last = match[3];
if ( first == 1 && last == 0 ) {
return true;
}
var doneName = match[0],
parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent.sizcache = doneName;
}
var diff = elem.nodeIndex - last;
if ( first == 0 ) {
return diff == 0;
} else {
return ( diff % first == 0 && diff / first >= 0 );
}
}
},
ID: function(elem, match){ ID: function(elem, match){
return elem.nodeType === 1 && elem.getAttribute("id") === match; return elem.nodeType === 1 && elem.getAttribute("id") === match;
}, },
@ -1957,10 +2005,20 @@ var Expr = Sizzle.selectors = {
return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
}, },
CLASS: function(elem, match){ CLASS: function(elem, match){
return match.test( elem.className ); return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
}, },
ATTR: function(elem, match){ ATTR: function(elem, match){
var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4]; var name = match[1],
result = Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ? return result == null ?
type === "!=" : type === "!=" :
type === "=" ? type === "=" ?
@ -1969,8 +2027,8 @@ var Expr = Sizzle.selectors = {
value.indexOf(check) >= 0 : value.indexOf(check) >= 0 :
type === "~=" ? type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 : (" " + value + " ").indexOf(check) >= 0 :
!match[4] ? !check ?
result : value && result !== false :
type === "!=" ? type === "!=" ?
value != check : value != check :
type === "^=" ? type === "^=" ?
@ -2036,6 +2094,39 @@ try {
}; };
} }
var sortOrder;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
} else if ( "sourceIndex" in document.documentElement ) {
sortOrder = function( a, b ) {
var ret = a.sourceIndex - b.sourceIndex;
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
} else if ( document.createRange ) {
sortOrder = function( a, b ) {
var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
aRange.selectNode(a);
aRange.collapse(true);
bRange.selectNode(b);
bRange.collapse(true);
var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
}
// Check to see if the browser returns elements by name when // Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround) // querying by getElementById (and provide a workaround)
(function(){ (function(){
@ -2099,7 +2190,8 @@ try {
// Check to see if an attribute returns normalized href attributes // Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>"; div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && div.firstChild.getAttribute("href") !== "#" ) { if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function(elem){ Expr.attrHandle.href = function(elem){
return elem.getAttribute("href", 2); return elem.getAttribute("href", 2);
}; };
@ -2136,29 +2228,50 @@ if ( document.querySelectorAll ) (function(){
Sizzle.matches = oldSizzle.matches; Sizzle.matches = oldSizzle.matches;
})(); })();
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) { if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
if ( div.getElementsByClassName("e").length === 0 )
return;
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 )
return;
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function(match, context) { Expr.find.CLASS = function(match, context, isXML) {
return context.getElementsByClassName(match[1]); if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
}; };
} })();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
var sibDir = dir == "previousSibling" && !isXML;
for ( var i = 0, l = checkSet.length; i < l; i++ ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i]; var elem = checkSet[i];
if ( elem ) { if ( elem ) {
if ( sibDir && elem.nodeType === 1 ){
elem.sizcache = doneName;
elem.sizset = i;
}
elem = elem[dir]; elem = elem[dir];
var match = false; var match = false;
while ( elem && elem.nodeType ) { while ( elem ) {
var done = elem[doneName]; if ( elem.sizcache === doneName ) {
if ( done ) { match = checkSet[elem.sizset];
match = checkSet[ done ];
break; break;
} }
if ( elem.nodeType === 1 && !isXML ) if ( elem.nodeType === 1 && !isXML ){
elem[doneName] = i; elem.sizcache = doneName;
elem.sizset = i;
}
if ( elem.nodeName === cur ) { if ( elem.nodeName === cur ) {
match = elem; match = elem;
@ -2174,22 +2287,28 @@ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
} }
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
var sibDir = dir == "previousSibling" && !isXML;
for ( var i = 0, l = checkSet.length; i < l; i++ ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i]; var elem = checkSet[i];
if ( elem ) { if ( elem ) {
if ( sibDir && elem.nodeType === 1 ) {
elem.sizcache = doneName;
elem.sizset = i;
}
elem = elem[dir]; elem = elem[dir];
var match = false; var match = false;
while ( elem && elem.nodeType ) { while ( elem ) {
if ( elem[doneName] ) { if ( elem.sizcache === doneName ) {
match = checkSet[ elem[doneName] ]; match = checkSet[elem.sizset];
break; break;
} }
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
if ( !isXML ) if ( !isXML ) {
elem[doneName] = i; elem.sizcache = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) { if ( typeof cur !== "string" ) {
if ( elem === cur ) { if ( elem === cur ) {
match = true; match = true;
@ -2248,15 +2367,11 @@ jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters; jQuery.expr[":"] = jQuery.expr.filters;
Sizzle.selectors.filters.hidden = function(elem){ Sizzle.selectors.filters.hidden = function(elem){
return "hidden" === elem.type || return elem.offsetWidth === 0 || elem.offsetHeight === 0;
jQuery.css(elem, "display") === "none" ||
jQuery.css(elem, "visibility") === "hidden";
}; };
Sizzle.selectors.filters.visible = function(elem){ Sizzle.selectors.filters.visible = function(elem){
return "hidden" !== elem.type && return elem.offsetWidth > 0 || elem.offsetHeight > 0;
jQuery.css(elem, "display") !== "none" &&
jQuery.css(elem, "visibility") !== "hidden";
}; };
Sizzle.selectors.filters.animated = function(elem){ Sizzle.selectors.filters.animated = function(elem){
@ -2552,6 +2667,7 @@ jQuery.event = {
var all, handlers; var all, handlers;
event = arguments[0] = jQuery.event.fix( event || window.event ); event = arguments[0] = jQuery.event.fix( event || window.event );
event.currentTarget = this;
// Namespaced event handlers // Namespaced event handlers
var namespaces = event.type.split("."); var namespaces = event.type.split(".");
@ -2883,9 +2999,13 @@ function liveHandler( event ){
} }
}); });
elems.sort(function(a,b) {
return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
});
jQuery.each(elems, function(){ jQuery.each(elems, function(){
if ( this.fn.call(this.elem, event, this.fn.data) === false ) if ( this.fn.call(this.elem, event, this.fn.data) === false )
stop = false; return (stop = false);
}); });
return stop; return stop;
@ -2949,7 +3069,7 @@ function bindReady(){
// If IE and not an iframe // If IE and not an iframe
// continually check to see if the document is ready // continually check to see if the document is ready
if ( document.documentElement.doScroll && typeof window.frameElement === "undefined" ) (function(){ if ( document.documentElement.doScroll && window == window.top ) (function(){
if ( jQuery.isReady ) return; if ( jQuery.isReady ) return;
try { try {
@ -3079,12 +3199,11 @@ jQuery( window ).bind( 'unload', function(){
// document.body must exist before we can do this // document.body must exist before we can do this
jQuery(function(){ jQuery(function(){
var div = document.createElement("div"); var div = document.createElement("div");
div.style.width = "1px"; div.style.width = div.style.paddingLeft = "1px";
div.style.paddingLeft = "1px";
document.body.appendChild( div ); document.body.appendChild( div );
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
document.body.removeChild( div ); document.body.removeChild( div ).style.display = 'none';
}); });
})(); })();
@ -3175,7 +3294,7 @@ jQuery.fn.extend({
.filter(function(){ .filter(function(){
return this.name && !this.disabled && return this.name && !this.disabled &&
(this.checked || /select|textarea/i.test(this.nodeName) || (this.checked || /select|textarea/i.test(this.nodeName) ||
/text|hidden|password/i.test(this.type)); /text|hidden|password|search/i.test(this.type));
}) })
.map(function(i, elem){ .map(function(i, elem){
var val = jQuery(this).val(); var val = jQuery(this).val();
@ -3371,6 +3490,9 @@ jQuery.extend({
done = true; done = true;
success(); success();
complete(); complete();
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
head.removeChild( script ); head.removeChild( script );
} }
}; };
@ -3686,10 +3808,16 @@ jQuery.fn.extend({
elemdisplay[ tagName ] = display; elemdisplay[ tagName ] = display;
} }
this[i].style.display = jQuery.data(this[i], "olddisplay", display); jQuery.data(this[i], "olddisplay", display);
} }
} }
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( var i = 0, l = this.length; i < l; i++ ){
this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
}
return this; return this;
} }
}, },
@ -3702,8 +3830,14 @@ jQuery.fn.extend({
var old = jQuery.data(this[i], "olddisplay"); var old = jQuery.data(this[i], "olddisplay");
if ( !old && old !== "none" ) if ( !old && old !== "none" )
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( var i = 0, l = this.length; i < l; i++ ){
this[i].style.display = "none"; this[i].style.display = "none";
} }
return this; return this;
} }
}, },
@ -3915,7 +4049,7 @@ jQuery.fx.prototype = {
t.elem = this.elem; t.elem = this.elem;
if ( t() && jQuery.timers.push(t) == 1 ) { if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval(function(){ timerId = setInterval(function(){
var timers = jQuery.timers; var timers = jQuery.timers;
@ -3925,6 +4059,7 @@ jQuery.fx.prototype = {
if ( !timers.length ) { if ( !timers.length ) {
clearInterval( timerId ); clearInterval( timerId );
timerId = undefined;
} }
}, 13); }, 13);
} }
@ -4193,22 +4328,21 @@ jQuery.each( ['Left', 'Top'], function(i, name) {
jQuery.each([ "Height", "Width" ], function(i, name){ jQuery.each([ "Height", "Width" ], function(i, name){
var tl = i ? "Left" : "Top", // top or left var tl = i ? "Left" : "Top", // top or left
br = i ? "Right" : "Bottom"; // bottom or right br = i ? "Right" : "Bottom", // bottom or right
lower = name.toLowerCase();
// innerHeight and innerWidth // innerHeight and innerWidth
jQuery.fn["inner" + name] = function(){ jQuery.fn["inner" + name] = function(){
return this[ name.toLowerCase() ]() + return this[0] ?
num(this, "padding" + tl) + jQuery.css( this[0], lower, false, "padding" ) :
num(this, "padding" + br); null;
}; };
// outerHeight and outerWidth // outerHeight and outerWidth
jQuery.fn["outer" + name] = function(margin) { jQuery.fn["outer" + name] = function(margin) {
return this["inner" + name]() + return this[0] ?
num(this, "border" + tl + "Width") + jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
num(this, "border" + br + "Width") + null;
(margin ?
num(this, "margin" + tl) + num(this, "margin" + br) : 0);
}; };
var type = name.toLowerCase(); var type = name.toLowerCase();
@ -4238,4 +4372,5 @@ jQuery.each([ "Height", "Width" ], function(i, name){
this.css( type, typeof size === "string" ? size : size + "px" ); this.css( type, typeof size === "string" ? size : size + "px" );
}; };
});})(); });
})();

10
js/jquery.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -161,6 +161,7 @@ $(document).ready(function(){
$("#form_notice").addClass("warning"); $("#form_notice").addClass("warning");
return false; return false;
} }
$("#form_notice").addClass("processing");
$("#notice_action-submit").attr("disabled", "disabled"); $("#notice_action-submit").attr("disabled", "disabled");
$("#notice_action-submit").addClass("disabled"); $("#notice_action-submit").addClass("disabled");
return true; return true;
@ -179,6 +180,7 @@ $(document).ready(function(){
NoticeHover(); NoticeHover();
NoticeReply(); NoticeReply();
} }
$("#form_notice").removeClass("processing");
$("#notice_action-submit").removeAttr("disabled"); $("#notice_action-submit").removeAttr("disabled");
$("#notice_action-submit").removeClass("disabled"); $("#notice_action-submit").removeClass("disabled");
} }

View File

@ -87,6 +87,8 @@ $config =
'closed' => false, 'closed' => false,
'inviteonly' => false, 'inviteonly' => false,
'private' => false, 'private' => false,
'ssl' => 'never',
'sslserver' => null,
'dupelimit' => 60), # default for same person saying the same thing 'dupelimit' => 60), # default for same person saying the same thing
'syslog' => 'syslog' =>
array('appname' => 'laconica', # for syslog array('appname' => 'laconica', # for syslog
@ -151,6 +153,9 @@ $config =
array('notify' => array()), array('notify' => array()),
'inboxes' => 'inboxes' =>
array('enabled' => true), # on by default for new sites array('enabled' => true), # on by default for new sites
'newuser' =>
array('subscribe' => null,
'welcome' => null),
); );
$config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');

View File

@ -179,7 +179,7 @@ function jabber_format_entry($profile, $notice)
$xs->elementEnd('body'); $xs->elementEnd('body');
$xs->elementEnd('html'); $xs->elementEnd('html');
$html = $xs->asString(); $html = $xs->getString();
return $html . ' ' . $entry; return $html . ' ' . $entry;
} }

View File

@ -115,7 +115,7 @@ function get_all_languages() {
'he' => array('q' => 0.5, 'lang' => 'he_IL', 'name' => 'Hebrew', 'direction' => 'rtl'), 'he' => array('q' => 0.5, 'lang' => 'he_IL', 'name' => 'Hebrew', 'direction' => 'rtl'),
'it' => array('q' => 1, 'lang' => 'it_IT', 'name' => 'Italian', 'direction' => 'ltr'), 'it' => array('q' => 1, 'lang' => 'it_IT', 'name' => 'Italian', 'direction' => 'ltr'),
'jp' => array('q' => 0.5, 'lang' => 'ja_JP', 'name' => 'Japanese', 'direction' => 'ltr'), 'jp' => array('q' => 0.5, 'lang' => 'ja_JP', 'name' => 'Japanese', 'direction' => 'ltr'),
'ko' => array('q' => 0.9, 'lang' => 'ko', 'name' => 'Korean', 'direction' => 'ltr'), 'ko' => array('q' => 0.9, 'lang' => 'ko_KR', 'name' => 'Korean', 'direction' => 'ltr'),
'mk' => array('q' => 0.5, 'lang' => 'mk_MK', 'name' => 'Macedonian', 'direction' => 'ltr'), 'mk' => array('q' => 0.5, 'lang' => 'mk_MK', 'name' => 'Macedonian', 'direction' => 'ltr'),
'nb' => array('q' => 0.1, 'lang' => 'nb_NO', 'name' => 'Norwegian (Bokmål)', 'direction' => 'ltr'), 'nb' => array('q' => 0.1, 'lang' => 'nb_NO', 'name' => 'Norwegian (Bokmål)', 'direction' => 'ltr'),
'no' => array('q' => 0.1, 'lang' => 'nb_NO', 'name' => 'Norwegian (Bokmål)', 'direction' => 'ltr'), 'no' => array('q' => 0.1, 'lang' => 'nb_NO', 'name' => 'Norwegian (Bokmål)', 'direction' => 'ltr'),

View File

@ -554,17 +554,19 @@ function mail_notify_fave($other, $user, $notice)
$body = sprintf(_("%1\$s just added your notice from %2\$s". $body = sprintf(_("%1\$s just added your notice from %2\$s".
" as one of their favorites.\n\n" . " as one of their favorites.\n\n" .
"In case you forgot, you can see the text". "The URL of your notice is:\n\n" .
" of your notice here:\n\n" .
"%3\$s\n\n" . "%3\$s\n\n" .
"You can see the list of %1\$s's favorites here:\n\n" . "The text of your notice is:\n\n" .
"%4\$s\n\n" . "%4\$s\n\n" .
"You can see the list of %1\$s's favorites here:\n\n" .
"%5\$s\n\n" .
"Faithfully yours,\n" . "Faithfully yours,\n" .
"%5\$s\n"), "%6\$s\n"),
$bestname, $bestname,
common_exact_date($notice->created), common_exact_date($notice->created),
common_local_url('shownotice', common_local_url('shownotice',
array('notice' => $notice->id)), array('notice' => $notice->id)),
$notice->content,
common_local_url('showfavorites', common_local_url('showfavorites',
array('nickname' => $user->nickname)), array('nickname' => $user->nickname)),
common_config('site', 'name')); common_config('site', 'name'));

View File

@ -132,20 +132,14 @@ class MessageForm extends Form
$mutual_users->free(); $mutual_users->free();
unset($mutual_users); unset($mutual_users);
$this->out->elementStart('ul', 'form_data');
$this->out->elementStart('li', array('id' => 'notice_to'));
$this->out->dropdown('to', _('To'), $mutual, null, false, $this->out->dropdown('to', _('To'), $mutual, null, false,
($this->to) ? $this->to->id : null); ($this->to) ? $this->to->id : null);
$this->out->elementEnd('li');
$this->out->elementStart('li', array('id' => 'notice_text'));
$this->out->element('textarea', array('id' => 'notice_data-text', $this->out->element('textarea', array('id' => 'notice_data-text',
'cols' => 35, 'cols' => 35,
'rows' => 4, 'rows' => 4,
'name' => 'content'), 'name' => 'content'),
($this->content) ? $this->content : ''); ($this->content) ? $this->content : '');
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
} }
/** /**
@ -156,14 +150,10 @@ class MessageForm extends Form
function formActions() function formActions()
{ {
$this->out->elementStart('ul', 'form_actions');
$this->out->elementStart('li', array('id' => 'notice_submit'));
$this->out->element('input', array('id' => 'notice_action-submit', $this->out->element('input', array('id' => 'notice_action-submit',
'class' => 'submit', 'class' => 'submit',
'name' => 'message_send', 'name' => 'message_send',
'type' => 'submit', 'type' => 'submit',
'value' => _('Send'))); 'value' => _('Send')));
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
} }
} }

View File

@ -134,9 +134,6 @@ class NoticeForm extends Form
function formData() function formData()
{ {
$this->out->elementStart('ul', 'form_data');
$this->out->elementStart('li', array('id' => 'notice_text'));
$this->out->element('label', array('for' => 'notice_data-text'), $this->out->element('label', array('for' => 'notice_data-text'),
sprintf(_('What\'s up, %s?'), $this->user->nickname)); sprintf(_('What\'s up, %s?'), $this->user->nickname));
// XXX: vary by defined max size // XXX: vary by defined max size
@ -145,8 +142,6 @@ class NoticeForm extends Form
'rows' => 4, 'rows' => 4,
'name' => 'status_textarea'), 'name' => 'status_textarea'),
($this->content) ? $this->content : ''); ($this->content) ? $this->content : '');
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
$this->out->elementStart('dl', 'form_note'); $this->out->elementStart('dl', 'form_note');
$this->out->element('dt', null, _('Available characters')); $this->out->element('dt', null, _('Available characters'));
@ -168,14 +163,10 @@ class NoticeForm extends Form
function formActions() function formActions()
{ {
$this->out->elementStart('ul', 'form_actions');
$this->out->elementStart('li', array('id' => 'notice_submit'));
$this->out->element('input', array('id' => 'notice_action-submit', $this->out->element('input', array('id' => 'notice_action-submit',
'class' => 'submit', 'class' => 'submit',
'name' => 'status_submit', 'name' => 'status_submit',
'type' => 'submit', 'type' => 'submit',
'value' => _('Send'))); 'value' => _('Send')));
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
} }
} }

View File

@ -258,8 +258,12 @@ class NoticeListItem extends Widget
function showAuthor() function showAuthor()
{ {
$this->out->elementStart('span', 'vcard author'); $this->out->elementStart('span', 'vcard author');
$this->out->elementStart('a', array('href' => $this->profile->profileurl, $attrs = array('href' => $this->profile->profileurl,
'class' => 'url')); 'class' => 'url');
if (!empty($this->profile->fullname)) {
$attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ') ';
}
$this->out->elementStart('a', $attrs);
$this->showAvatar(); $this->showAvatar();
$this->showNickname(); $this->showNickname();
$this->out->elementEnd('a'); $this->out->elementEnd('a');
@ -387,6 +391,7 @@ class NoticeListItem extends Widget
case 'xmpp': case 'xmpp':
case 'mail': case 'mail':
case 'omb': case 'omb':
case 'system':
case 'api': case 'api':
$this->out->element('dd', null, $source_name); $this->out->element('dd', null, $source_name);
break; break;

View File

@ -50,7 +50,15 @@ function ping_broadcast_notice($notice) {
"User-Agent: Laconica/".LACONICA_VERSION."\r\n", "User-Agent: Laconica/".LACONICA_VERSION."\r\n",
'content' => $req))); 'content' => $req)));
$file = file_get_contents($notify_url, false, $context); $file = file_get_contents($notify_url, false, $context);
if ($file === false || mb_strlen($file) == 0) {
common_log(LOG_WARNING,
"XML-RPC empty results for ping ($notify_url, $notice->id) ");
continue;
}
$response = xmlrpc_decode($file); $response = xmlrpc_decode($file);
if (xmlrpc_is_fault($response)) { if (xmlrpc_is_fault($response)) {
common_log(LOG_WARNING, common_log(LOG_WARNING,
"XML-RPC error for ping ($notify_url, $notice->id) ". "XML-RPC error for ping ($notify_url, $notice->id) ".

View File

@ -68,8 +68,8 @@ class Router
} }
} }
function initialize() { function initialize()
{
$m = Net_URL_Mapper::getInstance(); $m = Net_URL_Mapper::getInstance();
// In the "root" // In the "root"
@ -136,14 +136,17 @@ class Router
foreach (array('group', 'people', 'notice') as $s) { foreach (array('group', 'people', 'notice') as $s) {
$m->connect('search/'.$s, array('action' => $s.'search')); $m->connect('search/'.$s, array('action' => $s.'search'));
$m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'),array('q' => '.+')); $m->connect('search/'.$s.'?q=:q',
array('action' => $s.'search'),
array('q' => '.+'));
} }
// The second of these is needed to make the link work correctly // The second of these is needed to make the link work correctly
// when inserted into the page. The first is needed to match the // when inserted into the page. The first is needed to match the
// route on the way in. Seems to be another Net_URL_Mapper bug to me. // route on the way in. Seems to be another Net_URL_Mapper bug to me.
$m->connect('search/notice/rss', array('action' => 'noticesearchrss')); $m->connect('search/notice/rss', array('action' => 'noticesearchrss'));
$m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),array('q' => '.+')); $m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),
array('q' => '.+'));
// notice // notice
@ -269,8 +272,8 @@ class Router
foreach (array('xml', 'json', 'rss', 'atom') as $e) { foreach (array('xml', 'json', 'rss', 'atom') as $e) {
$m->connect('api/direct_messages/sent.'.$e, $m->connect('api/direct_messages/sent.'.$e,
array('action' => 'api', array('action' => 'api',
'apiaction' => 'direct_messages', 'apiaction' => 'direct_messages',
'method' => 'sent.'.$e)); 'method' => 'sent.'.$e));
} }
$m->connect('api/direct_messages/destroy/:argument', $m->connect('api/direct_messages/destroy/:argument',
@ -334,9 +337,9 @@ class Router
foreach (array('xml', 'json', 'rss', 'atom') as $e) { foreach (array('xml', 'json', 'rss', 'atom') as $e) {
$m->connect('api/favorites.'.$e, $m->connect('api/favorites.'.$e,
array('action' => 'api', array('action' => 'api',
'apiaction' => 'favorites', 'apiaction' => 'favorites',
'method' => 'favorites.'.$e)); 'method' => 'favorites.'.$e));
} }
// notifications // notifications
@ -421,7 +424,7 @@ class Router
$match = $this->m->match($path); $match = $this->m->match($path);
} catch (Net_URL_Mapper_InvalidException $e) { } catch (Net_URL_Mapper_InvalidException $e) {
common_log(LOG_ERR, "Problem getting route for $path - " . common_log(LOG_ERR, "Problem getting route for $path - " .
$e->getMessage()); $e->getMessage());
$cac = new ClientErrorAction("Page not found.", 404); $cac = new ClientErrorAction("Page not found.", 404);
$cac->showPage(); $cac->showPage();
} }
@ -431,8 +434,6 @@ class Router
function build($action, $args=null, $params=null, $fragment=null) function build($action, $args=null, $params=null, $fragment=null)
{ {
if($params!=null)
common_log(LOG_DEBUG,"build: ".$action." ".print_r($args,true)." ".print_r($params,true));
$action_arg = array('action' => $action); $action_arg = array('action' => $action);
if ($args) { if ($args) {
@ -441,8 +442,17 @@ class Router
$args = $action_arg; $args = $action_arg;
} }
if($params!=null) $url = $this->m->generate($args, $params, $fragment);
common_log(LOG_DEBUG,"generate args:".print_r($args,true));
return $this->m->generate($args, $params, $fragment); // Due to a bug in the Net_URL_Mapper code, the returned URL may
// contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We
// repair that here rather than modifying the upstream code...
$qpos = strpos($url, '?');
if ($qpos !== false) {
$url = substr($url, 0, $qpos+1) .
str_replace('?', '&', substr($url, $qpos+1));
}
return $url;
} }
} }

View File

@ -622,9 +622,13 @@ function common_at_link($sender_id, $nickname)
$url = $recipient->profileurl; $url = $recipient->profileurl;
} }
$xs = new XMLStringer(false); $xs = new XMLStringer(false);
$attrs = array('href' => $url,
'class' => 'url');
if (!empty($recipient->fullname)) {
$attrs['title'] = $recipient->fullname . ' (' . $recipient->nickname . ')';
}
$xs->elementStart('span', 'vcard'); $xs->elementStart('span', 'vcard');
$xs->elementStart('a', array('href' => $url, $xs->elementStart('a', $attrs);
'class' => 'url'));
$xs->element('span', 'fn nickname', $nickname); $xs->element('span', 'fn nickname', $nickname);
$xs->elementEnd('a'); $xs->elementEnd('a');
$xs->elementEnd('span'); $xs->elementEnd('span');
@ -639,10 +643,14 @@ function common_group_link($sender_id, $nickname)
$sender = Profile::staticGet($sender_id); $sender = Profile::staticGet($sender_id);
$group = User_group::staticGet('nickname', common_canonical_nickname($nickname)); $group = User_group::staticGet('nickname', common_canonical_nickname($nickname));
if ($group && $sender->isMember($group)) { if ($group && $sender->isMember($group)) {
$attrs = array('href' => $group->permalink(),
'class' => 'url');
if (!empty($group->fullname)) {
$attrs['title'] = $group->fullname . ' (' . $group->nickname . ')';
}
$xs = new XMLStringer(); $xs = new XMLStringer();
$xs->elementStart('span', 'vcard'); $xs->elementStart('span', 'vcard');
$xs->elementStart('a', array('href' => $group->permalink(), $xs->elementStart('a', $attrs);
'class' => 'url'));
$xs->element('span', 'fn nickname', $nickname); $xs->element('span', 'fn nickname', $nickname);
$xs->elementEnd('a'); $xs->elementEnd('a');
$xs->elementEnd('span'); $xs->elementEnd('span');
@ -713,25 +721,46 @@ function common_relative_profile($sender, $nickname, $dt=null)
function common_local_url($action, $args=null, $params=null, $fragment=null) function common_local_url($action, $args=null, $params=null, $fragment=null)
{ {
static $sensitive = array('login', 'register', 'passwordsettings',
'twittersettings', 'finishopenidlogin',
'api');
$r = Router::get(); $r = Router::get();
$path = $r->build($action, $args, $params, $fragment); $path = $r->build($action, $args, $params, $fragment);
$ssl = in_array($action, $sensitive);
if (common_config('site','fancy')) { if (common_config('site','fancy')) {
$url = common_path(mb_substr($path, 1)); $url = common_path(mb_substr($path, 1), $ssl);
} else { } else {
if (mb_strpos($path, '/index.php') === 0) { if (mb_strpos($path, '/index.php') === 0) {
$url = common_path(mb_substr($path, 1)); $url = common_path(mb_substr($path, 1), $ssl);
} else { } else {
$url = common_path('index.php'.$path); $url = common_path('index.php'.$path, $ssl);
} }
} }
return $url; return $url;
} }
function common_path($relative) function common_path($relative, $ssl=false)
{ {
$pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : '';
return "http://".common_config('site', 'server').'/'.$pathpart.$relative;
if (($ssl && (common_config('site', 'ssl') === 'sometimes'))
|| common_config('site', 'ssl') === 'always') {
$proto = 'https';
if (is_string(common_config('site', 'sslserver')) &&
mb_strlen(common_config('site', 'sslserver')) > 0) {
$serverpart = common_config('site', 'sslserver');
} else {
$serverpart = common_config('site', 'server');
}
} else {
$proto = 'http';
$serverpart = common_config('site', 'server');
}
return $proto.'://'.$serverpart.'/'.$pathpart.$relative;
} }
function common_date_string($dt) function common_date_string($dt)

View File

@ -105,12 +105,13 @@ class LinkbackPlugin extends Plugin
$pb = $match[1]; $pb = $match[1];
} }
$tb = $this->getTrackback($result->body, $result->final_url); if (!empty($pb)) {
if (!empty($tb)) {
$this->trackback($result->final_url, $tb);
} else if (!empty($pb)) {
$this->pingback($result->final_url, $pb); $this->pingback($result->final_url, $pb);
} else {
$tb = $this->getTrackback($result->body, $result->final_url);
if (!empty($tb)) {
$this->trackback($result->final_url, $tb);
}
} }
return $orig; return $orig;

View File

@ -216,6 +216,9 @@ margin-right:0;
address .fn { address .fn {
font-weight:bold; font-weight:bold;
} }
address img + .fn {
display:none;
}
#header { #header {
width:100%; width:100%;
@ -421,6 +424,7 @@ padding:0;
display:none; display:none;
} }
#form_notice textarea { #form_notice textarea {
float:left;
border-radius:7px; border-radius:7px;
-moz-border-radius:7px; -moz-border-radius:7px;
-webkit-border-radius:7px; -webkit-border-radius:7px;
@ -431,30 +435,19 @@ padding:7px 7px 16px 7px;
} }
#form_notice label { #form_notice label {
display:block; display:block;
float:left;
font-size:1.3em; font-size:1.3em;
margin-bottom:7px; margin-bottom:7px;
} }
#form_notice .form_data li {
float:left;
}
#form_notice #notice_attach_file label,
#form_notice #notice_submit label { #form_notice #notice_submit label {
display:none; display:none;
} }
#form_notice #notice_attachment {
margin-top:25px;
margin-left:4px;
}
#form_notice .form_note { #form_notice .form_note {
position:absolute; position:absolute;
top:99px; top:99px;
right:98px; right:98px;
z-index:9; z-index:9;
} }
#form_notice .form_note dt { #form_notice .form_note dt {
font-weight:bold; font-weight:bold;
display:none; display:none;
@ -464,42 +457,19 @@ font-weight:bold;
line-height:1.15; line-height:1.15;
padding:1px 2px; padding:1px 2px;
} }
#form_notice #notice_action-submit {
#form_notice #notice_data-attach_view { width:60px;
position:absolute; padding:8px;
top:25px;
right:30px;
margin-left:4px;
padding:0;
width:16px;
height:16px;
border:0;
text-indent:-9999px;
}
#form_notice .form_actions {
position:absolute; position:absolute;
bottom:0; bottom:0;
right:0; right:0;
} }
#form_notice .form_actions input.submit { #form_notice label[for=to] {
width:60px;
padding:8px;
}
#form_notice li {
margin-bottom:0;
}
#form_notice #notice_to {
margin-bottom:7px;
}
#notice_to label {
float:left;
margin-right:18px;
margin-top:11px; margin-top:11px;
} }
#notice_to select { #form_notice select[id=to] {
margin-bottom:7px;
margin-left:18px;
float:left; float:left;
} }
/*end FORM NOTICE*/ /*end FORM NOTICE*/

View File

@ -9,3 +9,6 @@ margin-left:0;
.entity_profile .entity_depiction { .entity_profile .entity_depiction {
margin-bottom:123px; margin-bottom:123px;
} }
.notice div.entry-content {
width:63%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

@ -19,9 +19,6 @@ font-size:1em;
address { address {
margin-right:71px; margin-right:71px;
} }
address .fn {
display:none;
}
input, textarea, select, option { input, textarea, select, option {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
@ -94,6 +91,11 @@ color:#333;
#form_notice.warning #notice_text-count { #form_notice.warning #notice_text-count {
color:#000; color:#000;
} }
#form_notice.processing #notice_action-submit {
background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
cursor:wait;
text-indent:-9999px;
}
#nav_register a { #nav_register a {

View File

@ -19,9 +19,6 @@ font-size:1em;
address { address {
margin-right:71px; margin-right:71px;
} }
address .fn {
display:none;
}
input, textarea, select, option { input, textarea, select, option {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
@ -94,7 +91,11 @@ color:#333;
#form_notice.warning #notice_text-count { #form_notice.warning #notice_text-count {
color:#000; color:#000;
} }
#form_notice.processing #notice_action-submit {
background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%;
cursor:wait;
text-indent:-9999px;
}
#nav_register a { #nav_register a {
text-decoration:none; text-decoration:none;