forked from GNUsocial/gnu-social
fix merge conflict 0.7.x 0.8.x in util.php and register.php.
This commit is contained in:
commit
e5094c3359
3
README
3
README
@ -1133,6 +1133,9 @@ welcome: nickname of a user account that sends welcome messages to new
|
|||||||
busy servers it may be a good idea to keep that one just for
|
busy servers it may be a good idea to keep that one just for
|
||||||
'urgent' messages. Default is null; no message.
|
'urgent' messages. Default is null; no message.
|
||||||
|
|
||||||
|
If either of these special user accounts are specified, the users should
|
||||||
|
be created before the configuration is updated.
|
||||||
|
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ if (!defined('LACONICA')) {
|
|||||||
|
|
||||||
require_once INSTALLDIR.'/lib/rssaction.php';
|
require_once INSTALLDIR.'/lib/rssaction.php';
|
||||||
|
|
||||||
define('MEMBERS_PER_SECTION', 81);
|
define('MEMBERS_PER_SECTION', 27);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Group RSS feed
|
* Group RSS feed
|
||||||
|
@ -91,9 +91,9 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
$this->element('legend', null, _('Profile information'));
|
$this->element('legend', null, _('Profile information'));
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
|
|
||||||
# too much common patterns here... abstractable?
|
// too much common patterns here... abstractable?
|
||||||
|
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
|
if (Event::handle('StartProfileFormData', array($this))) {
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->input('nickname', _('Nickname'),
|
$this->input('nickname', _('Nickname'),
|
||||||
($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
|
($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
|
||||||
@ -118,6 +118,7 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
($this->arg('location')) ? $this->arg('location') : $profile->location,
|
($this->arg('location')) ? $this->arg('location') : $profile->location,
|
||||||
_('Where you are, like "City, State (or Region), Country"'));
|
_('Where you are, like "City, State (or Region), Country"'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
Event::handle('EndProfileFormData', array($this));
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->input('tags', _('Tags'),
|
$this->input('tags', _('Tags'),
|
||||||
($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
|
($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()),
|
||||||
@ -127,7 +128,7 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
$language = common_language();
|
$language = common_language();
|
||||||
$this->dropdown('language', _('Language'),
|
$this->dropdown('language', _('Language'),
|
||||||
get_nice_language_list(), _('Preferred language'),
|
get_nice_language_list(), _('Preferred language'),
|
||||||
true, $language);
|
false, $language);
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$timezone = common_timezone();
|
$timezone = common_timezone();
|
||||||
$timezones = array();
|
$timezones = array();
|
||||||
@ -146,12 +147,12 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
($this->arg('autosubscribe')) ?
|
($this->arg('autosubscribe')) ?
|
||||||
$this->boolean('autosubscribe') : $user->autosubscribe);
|
$this->boolean('autosubscribe') : $user->autosubscribe);
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
}
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
$this->submit('save', _('Save'));
|
$this->submit('save', _('Save'));
|
||||||
|
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,8 +166,7 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
|
|
||||||
function handlePost()
|
function handlePost()
|
||||||
{
|
{
|
||||||
# CSRF protection
|
// CSRF protection
|
||||||
|
|
||||||
$token = $this->trimmed('token');
|
$token = $this->trimmed('token');
|
||||||
if (!$token || $token != common_session_token()) {
|
if (!$token || $token != common_session_token()) {
|
||||||
$this->showForm(_('There was a problem with your session token. '.
|
$this->showForm(_('There was a problem with your session token. '.
|
||||||
@ -174,6 +174,8 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Event::handle('StartProfileSaveForm', array($this))) {
|
||||||
|
|
||||||
$nickname = $this->trimmed('nickname');
|
$nickname = $this->trimmed('nickname');
|
||||||
$fullname = $this->trimmed('fullname');
|
$fullname = $this->trimmed('fullname');
|
||||||
$homepage = $this->trimmed('homepage');
|
$homepage = $this->trimmed('homepage');
|
||||||
@ -184,8 +186,7 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
$timezone = $this->trimmed('timezone');
|
$timezone = $this->trimmed('timezone');
|
||||||
$tagstring = $this->trimmed('tags');
|
$tagstring = $this->trimmed('tags');
|
||||||
|
|
||||||
# Some validation
|
// Some validation
|
||||||
|
|
||||||
if (!Validate::string($nickname, array('min_length' => 1,
|
if (!Validate::string($nickname, array('min_length' => 1,
|
||||||
'max_length' => 64,
|
'max_length' => 64,
|
||||||
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
|
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
|
||||||
@ -259,13 +260,12 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
$this->serverError(_('Couldn\'t update user.'));
|
$this->serverError(_('Couldn\'t update user.'));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
# Re-initialize language environment if it changed
|
// Re-initialize language environment if it changed
|
||||||
common_init_language();
|
common_init_language();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# XXX: XOR
|
// XXX: XOR
|
||||||
|
|
||||||
if ($user->autosubscribe ^ $autosubscribe) {
|
if ($user->autosubscribe ^ $autosubscribe) {
|
||||||
|
|
||||||
$original = clone($user);
|
$original = clone($user);
|
||||||
@ -303,8 +303,7 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set the user tags
|
// Set the user tags
|
||||||
|
|
||||||
$result = $user->setSelfTags($tags);
|
$result = $user->setSelfTags($tags);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
@ -313,10 +312,12 @@ class ProfilesettingsAction extends AccountSettingsAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user->query('COMMIT');
|
$user->query('COMMIT');
|
||||||
|
Event::handle('EndProfileSaveForm', array($this));
|
||||||
common_broadcast_profile($profile);
|
common_broadcast_profile($profile);
|
||||||
|
|
||||||
$this->showForm(_('Settings saved.'), true);
|
$this->showForm(_('Settings saved.'), true);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nicknameExists($nickname)
|
function nicknameExists($nickname)
|
||||||
|
@ -108,6 +108,7 @@ class RegisterAction extends Action
|
|||||||
|
|
||||||
function tryRegister()
|
function tryRegister()
|
||||||
{
|
{
|
||||||
|
if (Event::handle('StartRegistrationTry', array($this))) {
|
||||||
$token = $this->trimmed('token');
|
$token = $this->trimmed('token');
|
||||||
if (!$token || $token != common_session_token()) {
|
if (!$token || $token != common_session_token()) {
|
||||||
$this->showForm(_('There was a problem with your session token. '.
|
$this->showForm(_('There was a problem with your session token. '.
|
||||||
@ -123,27 +124,22 @@ class RegisterAction extends Action
|
|||||||
$location = $this->trimmed('location');
|
$location = $this->trimmed('location');
|
||||||
|
|
||||||
// We don't trim these... whitespace is OK in a password!
|
// We don't trim these... whitespace is OK in a password!
|
||||||
|
|
||||||
$password = $this->arg('password');
|
$password = $this->arg('password');
|
||||||
$confirm = $this->arg('confirm');
|
$confirm = $this->arg('confirm');
|
||||||
|
|
||||||
// invitation code, if any
|
// invitation code, if any
|
||||||
|
|
||||||
$code = $this->trimmed('code');
|
$code = $this->trimmed('code');
|
||||||
|
|
||||||
$invite = null;
|
|
||||||
|
|
||||||
if ($code) {
|
if ($code) {
|
||||||
$invite = Invitation::staticGet($code);
|
$invite = Invitation::staticGet($code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (common_config('site', 'inviteonly') && !($code && !empty($invite))) {
|
if (common_config('site', 'inviteonly') && !($code && $invite)) {
|
||||||
$this->clientError(_('Sorry, only invited people can register.'));
|
$this->clientError(_('Sorry, only invited people can register.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input scrubbing
|
// Input scrubbing
|
||||||
|
|
||||||
$nickname = common_canonical_nickname($nickname);
|
$nickname = common_canonical_nickname($nickname);
|
||||||
$email = common_canonical_email($email);
|
$email = common_canonical_email($email);
|
||||||
|
|
||||||
@ -206,6 +202,9 @@ class RegisterAction extends Action
|
|||||||
common_debug('Adding rememberme cookie for ' . $nickname);
|
common_debug('Adding rememberme cookie for ' . $nickname);
|
||||||
common_rememberme($user);
|
common_rememberme($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event::handle('EndRegistrationTry', array($this));
|
||||||
|
|
||||||
// Re-init language env in case it changed (not yet, but soon)
|
// Re-init language env in case it changed (not yet, but soon)
|
||||||
common_init_language();
|
common_init_language();
|
||||||
$this->showSuccess();
|
$this->showSuccess();
|
||||||
@ -213,6 +212,7 @@ class RegisterAction extends Action
|
|||||||
$this->showForm(_('Invalid username or password.'));
|
$this->showForm(_('Invalid username or password.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the given nickname already exist?
|
* Does the given nickname already exist?
|
||||||
@ -252,8 +252,10 @@ class RegisterAction extends Action
|
|||||||
|
|
||||||
// overrrided to add entry-title class
|
// overrrided to add entry-title class
|
||||||
function showPageTitle() {
|
function showPageTitle() {
|
||||||
|
if (Event::handle('StartShowPageTitle', array($this))) {
|
||||||
$this->element('h1', array('class' => 'entry-title'), $this->title());
|
$this->element('h1', array('class' => 'entry-title'), $this->title());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// overrided to add hentry, and content-inner class
|
// overrided to add hentry, and content-inner class
|
||||||
function showContentBlock()
|
function showContentBlock()
|
||||||
@ -367,6 +369,7 @@ class RegisterAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
|
if (Event::handle('StartRegistrationFormData', array($this))) {
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
|
$this->input('nickname', _('Nickname'), $this->trimmed('nickname'),
|
||||||
_('1-64 lowercase letters or numbers, '.
|
_('1-64 lowercase letters or numbers, '.
|
||||||
@ -381,7 +384,7 @@ class RegisterAction extends Action
|
|||||||
_('Same as password above. Required.'));
|
_('Same as password above. Required.'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
if (!empty($invite) && $invite->address_type == 'email') {
|
if ($invite && $invite->address_type == 'email') {
|
||||||
$this->input('email', _('Email'), $invite->address,
|
$this->input('email', _('Email'), $invite->address,
|
||||||
_('Used only for updates, announcements, '.
|
_('Used only for updates, announcements, '.
|
||||||
'and password recovery'));
|
'and password recovery'));
|
||||||
@ -414,6 +417,7 @@ class RegisterAction extends Action
|
|||||||
_('Where you are, like "City, '.
|
_('Where you are, like "City, '.
|
||||||
'State (or Region), Country"'));
|
'State (or Region), Country"'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
Event::handle('EndRegistrationFormData', array($this));
|
||||||
$this->elementStart('li', array('id' => 'settings_rememberme'));
|
$this->elementStart('li', array('id' => 'settings_rememberme'));
|
||||||
$this->checkbox('rememberme', _('Remember me'),
|
$this->checkbox('rememberme', _('Remember me'),
|
||||||
$this->boolean('rememberme'),
|
$this->boolean('rememberme'),
|
||||||
@ -438,6 +442,7 @@ class RegisterAction extends Action
|
|||||||
'email address, IM address, and phone number.'));
|
'email address, IM address, and phone number.'));
|
||||||
$this->elementEnd('label');
|
$this->elementEnd('label');
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
}
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
$this->submit('submit', _('Register'));
|
$this->submit('submit', _('Register'));
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
@ -519,3 +524,4 @@ class RegisterAction extends Action
|
|||||||
$nav->show();
|
$nav->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ if (!defined('LACONICA')) {
|
|||||||
require_once INSTALLDIR.'/lib/noticelist.php';
|
require_once INSTALLDIR.'/lib/noticelist.php';
|
||||||
require_once INSTALLDIR.'/lib/feedlist.php';
|
require_once INSTALLDIR.'/lib/feedlist.php';
|
||||||
|
|
||||||
define('MEMBERS_PER_SECTION', 81);
|
define('MEMBERS_PER_SECTION', 27);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Group main page
|
* Group main page
|
||||||
@ -361,7 +361,7 @@ class ShowgroupAction extends Action
|
|||||||
$this->element('p', null, _('(None)'));
|
$this->element('p', null, _('(None)'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cnt == MEMBERS_PER_SECTION) {
|
if ($cnt > MEMBERS_PER_SECTION) {
|
||||||
$this->element('a', array('href' => common_local_url('groupmembers',
|
$this->element('a', array('href' => common_local_url('groupmembers',
|
||||||
array('nickname' => $this->group->nickname))),
|
array('nickname' => $this->group->nickname))),
|
||||||
_('All members'));
|
_('All members'));
|
||||||
|
14
js/util.js
14
js/util.js
@ -166,28 +166,36 @@ $(document).ready(function(){
|
|||||||
$("#notice_action-submit").addClass("disabled");
|
$("#notice_action-submit").addClass("disabled");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
success: function(xml) { if ($("#error", xml).length > 0 || $("#command_result", xml).length > 0) {
|
success: function(xml) { if ($("#error", xml).length > 0) {
|
||||||
|
var result = document._importNode($("p", xml).get(0), true);
|
||||||
|
result = result.textContent || result.innerHTML;
|
||||||
|
alert(result);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($("#command_result", xml).length > 0) {
|
||||||
var result = document._importNode($("p", xml).get(0), true);
|
var result = document._importNode($("p", xml).get(0), true);
|
||||||
result = result.textContent || result.innerHTML;
|
result = result.textContent || result.innerHTML;
|
||||||
alert(result);
|
alert(result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true));
|
$("#notices_primary .notices").prepend(document._importNode($("li", xml).get(0), true));
|
||||||
$("#notice_data-text").val("");
|
|
||||||
counter();
|
counter();
|
||||||
$("#notices_primary .notice:first").css({display:"none"});
|
$("#notices_primary .notice:first").css({display:"none"});
|
||||||
$("#notices_primary .notice:first").fadeIn(2500);
|
$("#notices_primary .notice:first").fadeIn(2500);
|
||||||
NoticeHover();
|
NoticeHover();
|
||||||
NoticeReply();
|
NoticeReply();
|
||||||
}
|
}
|
||||||
|
$("#notice_data-text").val("");
|
||||||
|
}
|
||||||
$("#form_notice").removeClass("processing");
|
$("#form_notice").removeClass("processing");
|
||||||
$("#notice_action-submit").removeAttr("disabled");
|
$("#notice_action-submit").removeAttr("disabled");
|
||||||
$("#notice_action-submit").removeClass("disabled");
|
$("#notice_action-submit").removeClass("disabled");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (document.body.id != 'inbox' && document.body.id != 'outbox') {
|
||||||
$("#form_notice").ajaxForm(PostNotice);
|
$("#form_notice").ajaxForm(PostNotice);
|
||||||
$("#form_notice").each(addAjaxHidden);
|
$("#form_notice").each(addAjaxHidden);
|
||||||
|
}
|
||||||
NoticeHover();
|
NoticeHover();
|
||||||
NoticeReply();
|
NoticeReply();
|
||||||
});
|
});
|
||||||
|
@ -93,6 +93,7 @@ class PersonalGroupNav extends Widget
|
|||||||
|
|
||||||
$this->out->elementStart('ul', array('class' => 'nav'));
|
$this->out->elementStart('ul', array('class' => 'nav'));
|
||||||
|
|
||||||
|
if (Event::handle('StartPersonalGroupNav', array($this))) {
|
||||||
$this->out->menuItem(common_local_url('all', array('nickname' =>
|
$this->out->menuItem(common_local_url('all', array('nickname' =>
|
||||||
$nickname)),
|
$nickname)),
|
||||||
_('Personal'),
|
_('Personal'),
|
||||||
@ -129,7 +130,8 @@ class PersonalGroupNav extends Widget
|
|||||||
_('Your sent messages'),
|
_('Your sent messages'),
|
||||||
$action == 'outbox');
|
$action == 'outbox');
|
||||||
}
|
}
|
||||||
|
Event::handle('EndPersonalGroupNav', array($this));
|
||||||
|
}
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class SearchAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
function isReadOnly($args)
|
function isReadOnly()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,124 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Laconica, the distributed open-source microblogging tool
|
|
||||||
*
|
|
||||||
* Base class for sections showing tag clouds
|
|
||||||
*
|
|
||||||
* 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 Widget
|
|
||||||
* @package Laconica
|
|
||||||
* @author Evan Prodromou <evan@controlyourself.ca>
|
|
||||||
* @copyright 2009 Control Yourself, Inc.
|
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
||||||
* @link http://laconi.ca/
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('LACONICA')) {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
define('TAGS_PER_SECTION', 20);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for sections
|
|
||||||
*
|
|
||||||
* These are the widgets that show interesting data about a person
|
|
||||||
* group, or site.
|
|
||||||
*
|
|
||||||
* @category Widget
|
|
||||||
* @package Laconica
|
|
||||||
* @author Evan Prodromou <evan@controlyourself.ca>
|
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
||||||
* @link http://laconi.ca/
|
|
||||||
*/
|
|
||||||
|
|
||||||
class TagCloudSection extends Section
|
|
||||||
{
|
|
||||||
function showContent()
|
|
||||||
{
|
|
||||||
$tags = $this->getTags();
|
|
||||||
|
|
||||||
if (!$tags) {
|
|
||||||
$this->out->element('p', null, _('None'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnt = 0;
|
|
||||||
|
|
||||||
$tw = array();
|
|
||||||
$sum = 0;
|
|
||||||
|
|
||||||
while ($tags->fetch() && ++$cnt <= TAGS_PER_SECTION) {
|
|
||||||
$tw[$tags->tag] = $tags->weight;
|
|
||||||
$sum += $tags->weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cnt == 0) {
|
|
||||||
$this->out->element('p', null, _('(None)'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ksort($tw);
|
|
||||||
|
|
||||||
$this->out->elementStart('ul', 'tags xoxo tag-cloud');
|
|
||||||
foreach ($tw as $tag => $weight) {
|
|
||||||
$this->showTag($tag, $weight, ($sum == 0) ? 0 : $weight/$sum);
|
|
||||||
}
|
|
||||||
$this->out->elementEnd('ul');
|
|
||||||
|
|
||||||
return ($cnt > TAGS_PER_SECTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTags()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showTag($tag, $weight, $relative)
|
|
||||||
{
|
|
||||||
if ($relative > 0.1) {
|
|
||||||
$rel = 'tag-cloud-7';
|
|
||||||
} else if ($relative > 0.05) {
|
|
||||||
$rel = 'tag-cloud-6';
|
|
||||||
} else if ($relative > 0.02) {
|
|
||||||
$rel = 'tag-cloud-5';
|
|
||||||
} else if ($relative > 0.01) {
|
|
||||||
$rel = 'tag-cloud-4';
|
|
||||||
} else if ($relative > 0.005) {
|
|
||||||
$rel = 'tag-cloud-3';
|
|
||||||
} else if ($relative > 0.002) {
|
|
||||||
$rel = 'tag-cloud-2';
|
|
||||||
} else {
|
|
||||||
$rel = 'tag-cloud-1';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->out->elementStart('li', $rel);
|
|
||||||
$this->out->element('a', array('href' => $this->tagUrl($tag)),
|
|
||||||
$tag);
|
|
||||||
$this->out->elementEnd('li');
|
|
||||||
}
|
|
||||||
|
|
||||||
function tagUrl($tag)
|
|
||||||
{
|
|
||||||
return common_local_url('tag', array('tag' => $tag));
|
|
||||||
}
|
|
||||||
|
|
||||||
function divId()
|
|
||||||
{
|
|
||||||
return 'tagcloud';
|
|
||||||
}
|
|
||||||
}
|
|
@ -418,7 +418,7 @@ class TwitterapiAction extends Action
|
|||||||
function date_twitter($dt)
|
function date_twitter($dt)
|
||||||
{
|
{
|
||||||
$t = strtotime($dt);
|
$t = strtotime($dt);
|
||||||
return date("D M d G:i:s O Y", $t);
|
return date("D M d H:i:s O Y", $t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: Candidate for a general utility method somewhere?
|
// XXX: Candidate for a general utility method somewhere?
|
||||||
|
@ -1392,3 +1392,4 @@ function common_database_tablename($tablename)
|
|||||||
//table prefixes could be added here later
|
//table prefixes could be added here later
|
||||||
return $tablename;
|
return $tablename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,13 @@ class JabberQueueHandler extends XmppQueueHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
|
||||||
|
// lots of CPU trying to connect to unconfigured servers
|
||||||
|
if (common_config('xmpp','enabled')==false) {
|
||||||
|
print "Aborting daemon - xmpp is disabled\n";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
ini_set("max_execution_time", "0");
|
ini_set("max_execution_time", "0");
|
||||||
ini_set("max_input_time", "0");
|
ini_set("max_input_time", "0");
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
@ -52,6 +52,13 @@ class PublicQueueHandler extends XmppQueueHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
|
||||||
|
// lots of CPU trying to connect to unconfigured servers
|
||||||
|
if (common_config('xmpp','enabled')==false) {
|
||||||
|
print "Aborting daemon - xmpp is disabled\n";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
ini_set("max_execution_time", "0");
|
ini_set("max_execution_time", "0");
|
||||||
ini_set("max_input_time", "0");
|
ini_set("max_input_time", "0");
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
@ -140,6 +140,13 @@ class XmppConfirmHandler extends XmppQueueHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
|
||||||
|
// lots of CPU trying to connect to unconfigured servers
|
||||||
|
if (common_config('xmpp','enabled')==false) {
|
||||||
|
print "Aborting daemon - xmpp is disabled\n";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
ini_set("max_execution_time", "0");
|
ini_set("max_execution_time", "0");
|
||||||
ini_set("max_input_time", "0");
|
ini_set("max_input_time", "0");
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
@ -321,6 +321,13 @@ class XMPPDaemon extends Daemon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
|
||||||
|
// lots of CPU trying to connect to unconfigured servers
|
||||||
|
if (common_config('xmpp','enabled')==false) {
|
||||||
|
print "Aborting daemon - xmpp is disabled\n";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
ini_set("max_execution_time", "0");
|
ini_set("max_execution_time", "0");
|
||||||
ini_set("max_input_time", "0");
|
ini_set("max_input_time", "0");
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user