forked from GNUsocial/gnu-social
Merge branch 'master' of git@gitorious.org:statusnet/mainline
This commit is contained in:
commit
e5541d09d0
@ -35,6 +35,7 @@ class TagrssAction extends Rss10Action
|
|||||||
$this->clientError(_('No such tag.'));
|
$this->clientError(_('No such tag.'));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
$this->notices = $this->getNotices($this->limit);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ class UserrssAction extends Rss10Action
|
|||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
|
common_debug("UserrssAction");
|
||||||
|
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
$nickname = $this->trimmed('nickname');
|
$nickname = $this->trimmed('nickname');
|
||||||
$this->user = User::staticGet('nickname', $nickname);
|
$this->user = User::staticGet('nickname', $nickname);
|
||||||
@ -38,20 +40,24 @@ class UserrssAction extends Rss10Action
|
|||||||
$this->clientError(_('No such user.'));
|
$this->clientError(_('No such user.'));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$this->notices = $this->getNotices($this->limit);
|
if (!empty($this->tag)) {
|
||||||
|
$this->notices = $this->getTaggedNotices();
|
||||||
|
} else {
|
||||||
|
$this->notices = $this->getNotices();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTaggedNotices($tag = null, $limit=0)
|
function getTaggedNotices()
|
||||||
{
|
{
|
||||||
$user = $this->user;
|
$notice = $this->user->getTaggedNotices(
|
||||||
|
$this->tag,
|
||||||
if (is_null($user)) {
|
0,
|
||||||
return null;
|
($this->limit == 0) ? NOTICES_PER_PAGE : $this->limit,
|
||||||
}
|
0,
|
||||||
|
0
|
||||||
$notice = $user->getTaggedNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit, 0, 0, null, $tag);
|
);
|
||||||
|
|
||||||
$notices = array();
|
$notices = array();
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
@ -62,15 +68,12 @@ class UserrssAction extends Rss10Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getNotices($limit=0)
|
function getNotices()
|
||||||
{
|
{
|
||||||
$user = $this->user;
|
$notice = $this->user->getNotices(
|
||||||
|
0,
|
||||||
if (is_null($user)) {
|
($limit == 0) ? NOTICES_PER_PAGE : $limit
|
||||||
return null;
|
);
|
||||||
}
|
|
||||||
|
|
||||||
$notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
|
|
||||||
|
|
||||||
$notices = array();
|
$notices = array();
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
|
@ -113,4 +113,21 @@ class Foreign_link extends Memcached_DataObject
|
|||||||
return User::staticGet($this->user_id);
|
return User::staticGet($this->user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we only ever delete one record at a time
|
||||||
|
function safeDelete()
|
||||||
|
{
|
||||||
|
if (!empty($this->user_id)
|
||||||
|
&& !empty($this->foreign_id)
|
||||||
|
&& !empty($this->service))
|
||||||
|
{
|
||||||
|
return $this->delete();
|
||||||
|
} else {
|
||||||
|
common_debug(LOG_WARNING,
|
||||||
|
'Foreign_link::safeDelete() tried to delete a '
|
||||||
|
. 'Foreign_link without a fully specified compound key: '
|
||||||
|
. var_export($this, true));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,8 @@ $config['sphinx']['port'] = 3312;
|
|||||||
|
|
||||||
// Email info, used for all outbound email
|
// Email info, used for all outbound email
|
||||||
// $config['mail']['notifyfrom'] = 'microblog@example.net';
|
// $config['mail']['notifyfrom'] = 'microblog@example.net';
|
||||||
|
// Domain for generating no-reply and incoming email addresses, if enabled.
|
||||||
|
// Defaults to site server name.
|
||||||
// $config['mail']['domain'] = 'microblog.example.net';
|
// $config['mail']['domain'] = 'microblog.example.net';
|
||||||
// See http://pear.php.net/manual/en/package.mail.mail.factory.php for options
|
// See http://pear.php.net/manual/en/package.mail.mail.factory.php for options
|
||||||
// $config['mail']['backend'] = 'smtp';
|
// $config['mail']['backend'] = 'smtp';
|
||||||
@ -131,8 +133,6 @@ $config['sphinx']['port'] = 3312;
|
|||||||
// 'host' => 'localhost',
|
// 'host' => 'localhost',
|
||||||
// 'port' => 25,
|
// 'port' => 25,
|
||||||
// );
|
// );
|
||||||
// For incoming email, if enabled. Defaults to site server name.
|
|
||||||
// $config['mail']['domain'] = 'incoming.example.net';
|
|
||||||
|
|
||||||
// exponential decay factor for tags, default 10 days
|
// exponential decay factor for tags, default 10 days
|
||||||
// raise this if traffic is slow, lower it if it's fast
|
// raise this if traffic is slow, lower it if it's fast
|
||||||
|
13
install.php
13
install.php
@ -301,6 +301,19 @@ function checkPrereqs()
|
|||||||
$pass = false;
|
$pass = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Look for known library bugs
|
||||||
|
$str = "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
$replaced = preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
|
||||||
|
if ($str != $replaced) {
|
||||||
|
printf('<p class="error">PHP is linked to a version of the PCRE library ' .
|
||||||
|
'that does not support Unicode properties. ' .
|
||||||
|
'If you are running Red Hat Enterprise Linux / ' .
|
||||||
|
'CentOS 5.3 or earlier, see <a href="' .
|
||||||
|
'http://status.net/wiki/Red_Hat_Enterprise_Linux#PCRE_library' .
|
||||||
|
'">our documentation page</a> on fixing this.</p>');
|
||||||
|
$pass = false;
|
||||||
|
}
|
||||||
|
|
||||||
$reqs = array('gd', 'curl',
|
$reqs = array('gd', 'curl',
|
||||||
'xmlwriter', 'mbstring', 'xml', 'dom', 'simplexml');
|
'xmlwriter', 'mbstring', 'xml', 'dom', 'simplexml');
|
||||||
|
|
||||||
|
@ -428,10 +428,18 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
* Currently assumes that all items in the feed are new,
|
* Currently assumes that all items in the feed are new,
|
||||||
* coming from a PuSH hub.
|
* coming from a PuSH hub.
|
||||||
*
|
*
|
||||||
* @param DOMDocument $feed
|
* @param DOMDocument $doc
|
||||||
|
* @param string $source identifier ("push")
|
||||||
*/
|
*/
|
||||||
public function processFeed($feed, $source)
|
public function processFeed(DOMDocument $doc, $source)
|
||||||
{
|
{
|
||||||
|
$feed = $doc->documentElement;
|
||||||
|
|
||||||
|
if ($feed->localName != 'feed' || $feed->namespaceURI != Activity::ATOM) {
|
||||||
|
common_log(LOG_ERR, __METHOD__ . ": not an Atom feed, ignoring");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$entries = $feed->getElementsByTagNameNS(Activity::ATOM, 'entry');
|
$entries = $feed->getElementsByTagNameNS(Activity::ATOM, 'entry');
|
||||||
if ($entries->length == 0) {
|
if ($entries->length == 0) {
|
||||||
common_log(LOG_ERR, __METHOD__ . ": no entries in feed update, ignoring");
|
common_log(LOG_ERR, __METHOD__ . ": no entries in feed update, ignoring");
|
||||||
@ -449,6 +457,7 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @param DOMElement $entry
|
* @param DOMElement $entry
|
||||||
* @param DOMElement $feed for context
|
* @param DOMElement $feed for context
|
||||||
|
* @param string $source identifier ("push" or "salmon")
|
||||||
*/
|
*/
|
||||||
public function processEntry($entry, $feed, $source)
|
public function processEntry($entry, $feed, $source)
|
||||||
{
|
{
|
||||||
|
@ -39,9 +39,21 @@ class User_openid extends Memcached_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List primary and unique keys in this table.
|
||||||
|
* Unique keys used for lookup *MUST* be listed to ensure proper caching.
|
||||||
|
*/
|
||||||
function keys()
|
function keys()
|
||||||
{
|
{
|
||||||
return array('canonical' => 'K', 'display' => 'U');
|
return array('canonical' => 'K', 'display' => 'U', 'user_id' => 'U');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No sequence keys in this table.
|
||||||
|
*/
|
||||||
|
function sequenceKey()
|
||||||
|
{
|
||||||
|
return array(false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Static function hasOpenID($user_id)
|
Static function hasOpenID($user_id)
|
||||||
|
@ -264,7 +264,7 @@ function remove_twitter_link($flink)
|
|||||||
common_log(LOG_INFO, 'Removing Twitter bridge Foreign link for ' .
|
common_log(LOG_INFO, 'Removing Twitter bridge Foreign link for ' .
|
||||||
"user $user->nickname (user id: $user->id).");
|
"user $user->nickname (user id: $user->id).");
|
||||||
|
|
||||||
$result = $flink->delete();
|
$result = $flink->safeDelete();
|
||||||
|
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
common_log(LOG_ERR, 'Could not remove Twitter bridge ' .
|
common_log(LOG_ERR, 'Could not remove Twitter bridge ' .
|
||||||
|
@ -273,7 +273,13 @@ class TwitterauthorizationAction extends Action
|
|||||||
|
|
||||||
$flink->user_id = $user_id;
|
$flink->user_id = $user_id;
|
||||||
$flink->service = TWITTER_SERVICE;
|
$flink->service = TWITTER_SERVICE;
|
||||||
$flink->delete(); // delete stale flink, if any
|
|
||||||
|
// delete stale flink, if any
|
||||||
|
$result = $flink->find(true);
|
||||||
|
|
||||||
|
if (!empty($result)) {
|
||||||
|
$flink->safeDelete();
|
||||||
|
}
|
||||||
|
|
||||||
$flink->user_id = $user_id;
|
$flink->user_id = $user_id;
|
||||||
$flink->foreign_id = $twuid;
|
$flink->foreign_id = $twuid;
|
||||||
@ -455,6 +461,11 @@ class TwitterauthorizationAction extends Action
|
|||||||
|
|
||||||
$user = User::register($args);
|
$user = User::register($args);
|
||||||
|
|
||||||
|
if (empty($user)) {
|
||||||
|
$this->serverError(_('Error registering user.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->saveForeignLink($user->id,
|
$result = $this->saveForeignLink($user->id,
|
||||||
$this->twuid,
|
$this->twuid,
|
||||||
$this->access_token);
|
$this->access_token);
|
||||||
|
@ -250,7 +250,7 @@ class TwittersettingsAction extends ConnectSettingsAction
|
|||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
$flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
|
$flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
|
||||||
|
|
||||||
$result = $flink->delete();
|
$result = $flink->safeDelete();
|
||||||
|
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
common_log_db_error($flink, 'DELETE', __FILE__);
|
common_log_db_error($flink, 'DELETE', __FILE__);
|
||||||
|
Loading…
Reference in New Issue
Block a user