Merge branch 'master' into 0.9.x

This commit is contained in:
Evan Prodromou 2010-01-19 00:31:42 -05:00
commit 01dc77c2fd
6 changed files with 77 additions and 23 deletions

View File

@ -687,3 +687,9 @@ StartLeaveGroup: when a user is leaving a group
EndLeaveGroup: when a user has left a group EndLeaveGroup: when a user has left a group
- $group: the group being left - $group: the group being left
- $user: the user leaving - $user: the user leaving
StartShowContentLicense: Showing the default license for content
- $action: the current action
EndShowContentLicense: Showing the default license for content
- $action: the current action

6
README
View File

@ -1035,6 +1035,12 @@ Creative Commons Attribution 3.0 license, which is probably the right
choice for any public site. Note that some other servers will not choice for any public site. Note that some other servers will not
accept notices if you apply a stricter license than this. accept notices if you apply a stricter license than this.
type: one of 'cc' (for Creative Commons licenses), 'allrightsreserved'
(default copyright), or 'private' (for private and confidential
information).
owner: for 'allrightsreserved' or 'private', an assigned copyright
holder (for example, an employer for a private site). If
not specified, will be attributed to 'contributors'.
url: URL of the license, used for links. url: URL of the license, used for links.
title: Title for the license, like 'Creative Commons Attribution 3.0'. title: Title for the license, like 'Creative Commons Attribution 3.0'.
image: A button shown on each page for the license. image: A button shown on each page for the license.

View File

@ -826,6 +826,10 @@ class Notice extends Memcached_DataObject
return $ids; return $ids;
} }
/**
* @param $groups array of Group *objects*
* @param $recipients array of profile *ids*
*/
function whoGets($groups=null, $recipients=null) function whoGets($groups=null, $recipients=null)
{ {
$c = self::memcache(); $c = self::memcache();
@ -925,6 +929,9 @@ class Notice extends Memcached_DataObject
return $ids; return $ids;
} }
/**
* @return array of Group objects
*/
function saveGroups() function saveGroups()
{ {
// Don't save groups for repeats // Don't save groups for repeats
@ -1117,11 +1124,22 @@ class Notice extends Memcached_DataObject
return $ids; return $ids;
} }
/**
* Same calculation as saveGroups but without the saving
* @fixme merge the functions
* @return array of Group objects
*/
function getGroups() function getGroups()
{ {
// Don't save groups for repeats
if (!empty($this->repeat_of)) {
return array();
}
// XXX: cache me // XXX: cache me
$ids = array(); $groups = array();
$gi = new Group_inbox(); $gi = new Group_inbox();
@ -1132,13 +1150,13 @@ class Notice extends Memcached_DataObject
if ($gi->find()) { if ($gi->find()) {
while ($gi->fetch()) { while ($gi->fetch()) {
$ids[] = $gi->group_id; $groups[] = clone($gi);
} }
} }
$gi->free(); $gi->free();
return $ids; return $groups;
} }
function asAtomEntry($namespace=false, $source=false) function asAtomEntry($namespace=false, $source=false)

View File

@ -791,8 +791,25 @@ class Action extends HTMLOutputter // lawsuit
*/ */
function showContentLicense() function showContentLicense()
{ {
if (Event::handle('StartShowContentLicense', array($this))) {
$this->element('dt', array('id' => 'site_content_license'), _('Site content license')); $this->element('dt', array('id' => 'site_content_license'), _('Site content license'));
$this->elementStart('dd', array('id' => 'site_content_license_cc')); $this->elementStart('dd', array('id' => 'site_content_license_cc'));
switch (common_config('license', 'type')) {
case 'private':
$this->element('p', null, sprintf(_('Content and data of %1$s are private and confidential.'),
common_config('site', 'name')));
// fall through
case 'allrightsreserved':
if (common_config('license', 'owner')) {
$this->element('p', null, sprintf(_('Content and data copyright by %1$s. All rights reserved.'),
common_config('license', 'owner')));
} else {
$this->element('p', null, _('Content and data copyright by contributors. All rights reserved.'));
}
break;
case 'cc': // fall through
default:
$this->elementStart('p'); $this->elementStart('p');
$this->element('img', array('id' => 'license_cc', $this->element('img', array('id' => 'license_cc',
'src' => common_config('license', 'image'), 'src' => common_config('license', 'image'),
@ -807,7 +824,12 @@ class Action extends HTMLOutputter // lawsuit
common_config('license', 'title')); common_config('license', 'title'));
$this->text(_('license.')); $this->text(_('license.'));
$this->elementEnd('p'); $this->elementEnd('p');
break;
}
$this->elementEnd('dd'); $this->elementEnd('dd');
Event::handle('EndShowContentLicense', array($this));
}
} }
/** /**

View File

@ -83,7 +83,9 @@ $default =
'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully 'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully
), ),
'license' => 'license' =>
array('url' => 'http://creativecommons.org/licenses/by/3.0/', array('type' => 'cc', # can be 'cc', 'allrightsreserved', 'private'
'owner' => null, # can be name of content owner e.g. for enterprise
'url' => 'http://creativecommons.org/licenses/by/3.0/',
'title' => 'Creative Commons Attribution 3.0', 'title' => 'Creative Commons Attribution 3.0',
'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'), 'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'),
'mail' => 'mail' =>

View File

@ -170,8 +170,8 @@ class MemcachePlugin extends Plugin
$servers = array($this->servers); $servers = array($this->servers);
} }
foreach ($servers as $server) { foreach ($servers as $server) {
if (strpos($server, ':') !== false) { if (strpos($server, ';') !== false) {
list($host, $port) = explode(':', $server); list($host, $port) = explode(';', $server);
} else { } else {
$host = $server; $host = $server;
$port = 11211; $port = 11211;