forked from GNUsocial/gnu-social
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
This commit is contained in:
commit
b5e0f7d572
@ -184,7 +184,7 @@ class NewnoticeAction extends Action
|
|||||||
|
|
||||||
$options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
|
$options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
|
||||||
|
|
||||||
if ($user->shareLocation() && $this->arg('notice_data-location_enabled')) {
|
if ($user->shareLocation() && $this->arg('notice_data-geo')) {
|
||||||
|
|
||||||
$locOptions = Notice::locationOptions($this->trimmed('lat'),
|
$locOptions = Notice::locationOptions($this->trimmed('lat'),
|
||||||
$this->trimmed('lon'),
|
$this->trimmed('lon'),
|
||||||
|
@ -136,7 +136,12 @@ class PublictagcloudAction extends Action
|
|||||||
$this->elementStart('dd');
|
$this->elementStart('dd');
|
||||||
$this->elementStart('ul', 'tags xoxo tag-cloud');
|
$this->elementStart('ul', 'tags xoxo tag-cloud');
|
||||||
foreach ($tw as $tag => $weight) {
|
foreach ($tw as $tag => $weight) {
|
||||||
$this->showTag($tag, $weight, $weight/$sum);
|
if ($sum) {
|
||||||
|
$weightedSum = $weight/$sum;
|
||||||
|
} else {
|
||||||
|
$weightedSum = 1;
|
||||||
|
}
|
||||||
|
$this->showTag($tag, $weight, $weightedSum);
|
||||||
}
|
}
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
$this->elementEnd('dd');
|
$this->elementEnd('dd');
|
||||||
|
@ -454,7 +454,6 @@ function showForm()
|
|||||||
<dd>
|
<dd>
|
||||||
<div class="instructions">
|
<div class="instructions">
|
||||||
<p>Enter your database connection information below to initialize the database.</p>
|
<p>Enter your database connection information below to initialize the database.</p>
|
||||||
<p>StatusNet bundles a number of libraries for ease of installation. <a href="?checklibs=true">You can see what bundled libraries you are using, versus what libraries are installed on your server.</a>
|
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
50
js/util.js
50
js/util.js
@ -442,17 +442,25 @@ var SN = { // StatusNet
|
|||||||
},
|
},
|
||||||
|
|
||||||
NoticeLocationAttach: function() {
|
NoticeLocationAttach: function() {
|
||||||
|
function removeNoticeDataGeo() {
|
||||||
|
$('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked');
|
||||||
|
$('#'+SN.C.S.NoticeDataGeoSelected).hide();
|
||||||
|
$('#'+SN.C.S.NoticeLat).val('');
|
||||||
|
$('#'+SN.C.S.NoticeLon).val('');
|
||||||
|
$('#'+SN.C.S.NoticeLocationNs).val('');
|
||||||
|
$('#'+SN.C.S.NoticeLocationId).val('');
|
||||||
|
}
|
||||||
|
|
||||||
var NDG = $('#'+SN.C.S.NoticeDataGeo);
|
var NDG = $('#'+SN.C.S.NoticeDataGeo);
|
||||||
if (NDG.length > 0) {
|
if (NDG.length > 0) {
|
||||||
var NLE = $('#notice_data-location_wrap');
|
var NLE = $('#notice_data-location_wrap');
|
||||||
var geocodeURL = NLE.attr('title');
|
var geocodeURL = NLE.attr('title');
|
||||||
|
NLE.removeAttr('title');
|
||||||
|
|
||||||
$('label[for=notice_data-geo]').attr('title', NLE.text());
|
$('label[for='+SN.C.S.NoticeDataGeo+']').attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text()));
|
||||||
|
|
||||||
if (navigator.geolocation) {
|
if (navigator.geolocation) {
|
||||||
NDG.change(function() {
|
NDG.change(function() {
|
||||||
NLE.removeAttr('title');
|
|
||||||
|
|
||||||
$.cookie(SN.C.S.NoticeLocationCookieName, $('#'+SN.C.S.NoticeDataGeo).attr('checked'));
|
$.cookie(SN.C.S.NoticeLocationCookieName, $('#'+SN.C.S.NoticeDataGeo).attr('checked'));
|
||||||
|
|
||||||
var NLN = $('#'+SN.C.S.NoticeLocationName);
|
var NLN = $('#'+SN.C.S.NoticeLocationName);
|
||||||
@ -461,7 +469,7 @@ var SN = { // StatusNet
|
|||||||
}
|
}
|
||||||
|
|
||||||
var S = '<div id="'+SN.C.S.NoticeDataGeoSelected+'" class="'+SN.C.S.Success+'"/>';
|
var S = '<div id="'+SN.C.S.NoticeDataGeoSelected+'" class="'+SN.C.S.Success+'"/>';
|
||||||
NDGS = $('#'+SN.C.S.NoticeDataGeoSelected);
|
var NDGS = $('#'+SN.C.S.NoticeDataGeoSelected);
|
||||||
if (NDGS.length > 0) {
|
if (NDGS.length > 0) {
|
||||||
NDGS.replaceWith(S);
|
NDGS.replaceWith(S);
|
||||||
}
|
}
|
||||||
@ -471,18 +479,18 @@ var SN = { // StatusNet
|
|||||||
NDGS = $('#'+SN.C.S.NoticeDataGeoSelected);
|
NDGS = $('#'+SN.C.S.NoticeDataGeoSelected);
|
||||||
NDGS.prepend('<span id="'+SN.C.S.NoticeLocationName+'">Geo</span>');
|
NDGS.prepend('<span id="'+SN.C.S.NoticeLocationName+'">Geo</span>');
|
||||||
|
|
||||||
NLN = $('#'+SN.C.S.NoticeLocationName);
|
var NLN = $('#'+SN.C.S.NoticeLocationName);
|
||||||
|
|
||||||
if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true) {
|
if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true) {
|
||||||
NLN.addClass('processing');
|
NLN.addClass('processing');
|
||||||
$('label[for=notice_data-geo]').addClass('checked');
|
$('label[for='+SN.C.S.NoticeDataGeo+']').addClass('checked');
|
||||||
|
|
||||||
NDGS.append('<button class="minimize">_</button> <button class="close">×</button>');
|
NDGS.append('<button class="minimize">_</button> <button class="close">×</button>');
|
||||||
|
|
||||||
$('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){
|
$('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){
|
||||||
$('#'+SN.C.S.NoticeDataGeoSelected).remove();
|
$('#'+SN.C.S.NoticeDataGeoSelected).remove();
|
||||||
$('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
|
$('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
|
||||||
$('label[for=notice_data-geo]').removeClass('checked');
|
$('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -493,7 +501,8 @@ var SN = { // StatusNet
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(function(position) {
|
navigator.geolocation.getCurrentPosition(
|
||||||
|
function(position) {
|
||||||
$('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
|
$('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
|
||||||
$('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
|
$('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
|
||||||
|
|
||||||
@ -504,6 +513,7 @@ var SN = { // StatusNet
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.getJSON(geocodeURL, data, function(location) {
|
$.getJSON(geocodeURL, data, function(location) {
|
||||||
|
NLN = $('#'+SN.C.S.NoticeLocationName);
|
||||||
NLN.replaceWith('<a id="notice_data-location_name"/>');
|
NLN.replaceWith('<a id="notice_data-location_name"/>');
|
||||||
NLN = $('#'+SN.C.S.NoticeLocationName);
|
NLN = $('#'+SN.C.S.NoticeLocationName);
|
||||||
|
|
||||||
@ -524,22 +534,28 @@ var SN = { // StatusNet
|
|||||||
|
|
||||||
NLN.attr('href', location.url);
|
NLN.attr('href', location.url);
|
||||||
NLN.text(NLN_text);
|
NLN.text(NLN_text);
|
||||||
|
NLN.click(function() {
|
||||||
|
window.open(location.url);
|
||||||
|
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
function(error) {
|
||||||
|
if (error.PERMISSION_DENIED == 1) {
|
||||||
|
removeNoticeDataGeo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('label[for=notice_data-geo]').removeClass('checked');
|
removeNoticeDataGeo();
|
||||||
NDGS.hide();
|
|
||||||
$('#'+SN.C.S.NoticeLat).val('');
|
|
||||||
$('#'+SN.C.S.NoticeLon).val('');
|
|
||||||
$('#'+SN.C.S.NoticeLocationNs).val('');
|
|
||||||
$('#'+SN.C.S.NoticeLocationId).val('');
|
|
||||||
}
|
}
|
||||||
});
|
}).change();
|
||||||
|
|
||||||
var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName);
|
var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName);
|
||||||
NDG.attr('checked', (cookieVal == null || cookieVal == 'true'));
|
NDG.attr('checked', (cookieVal === null || cookieVal == 'true'));
|
||||||
NDG.change();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -74,6 +74,7 @@ class ColumnDef
|
|||||||
* @param string $key type of key
|
* @param string $key type of key
|
||||||
* @param value $default default value
|
* @param value $default default value
|
||||||
* @param value $extra unused
|
* @param value $extra unused
|
||||||
|
* @param boolean $auto_increment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($name=null, $type=null, $size=null,
|
function __construct($name=null, $type=null, $size=null,
|
||||||
|
@ -524,6 +524,10 @@ class Schema
|
|||||||
$sql .= ($cd->nullable) ? "null " : "not null ";
|
$sql .= ($cd->nullable) ? "null " : "not null ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($cd->auto_increment)) {
|
||||||
|
$sql .= " auto_increment ";
|
||||||
|
}
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,23 @@ abstract class AuthenticationPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal AutoRegister event handler
|
||||||
|
* @param nickname
|
||||||
|
* @param provider_name
|
||||||
|
* @param user - the newly registered user
|
||||||
|
*/
|
||||||
|
function onAutoRegister($nickname, $provider_name, &$user)
|
||||||
|
{
|
||||||
|
if($provider_name == $this->provider_name && $this->autoregistration){
|
||||||
|
$user = $this->autoregister($nickname);
|
||||||
|
if($user){
|
||||||
|
User_username::register($user,$nickname,$this->provider_name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onStartCheckPassword($nickname, $password, &$authenticatedUser){
|
function onStartCheckPassword($nickname, $password, &$authenticatedUser){
|
||||||
//map the nickname to a username
|
//map the nickname to a username
|
||||||
$user_username = new User_username();
|
$user_username = new User_username();
|
||||||
@ -127,13 +144,10 @@ abstract class AuthenticationPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if($this->autoregistration){
|
|
||||||
$authenticated = $this->checkPassword($nickname, $password);
|
$authenticated = $this->checkPassword($nickname, $password);
|
||||||
if($authenticated){
|
if($authenticated){
|
||||||
$user = $this->autoregister($nickname);
|
if(Event::handle('AutoRegister', array($nickname, $this->provider_name, &$authenticatedUser))){
|
||||||
if($user){
|
if($authenticatedUser){
|
||||||
$authenticatedUser = $user;
|
|
||||||
User_username::register($authenticatedUser,$nickname,$this->provider_name);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,12 +105,11 @@ class FeedSubPlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// auto increment seems to be broken
|
|
||||||
function onCheckSchema() {
|
function onCheckSchema() {
|
||||||
|
// warning: the autoincrement doesn't seem to set.
|
||||||
|
// alter table feedinfo change column id id int(11) not null auto_increment;
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
$schema->ensureDataObject('Feedinfo');
|
$schema->ensureTable('feedinfo', Feedinfo::schemaDef());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class FeedDBException extends FeedSubException
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Feedinfo extends Plugin_DataObject
|
class Feedinfo extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'feedinfo';
|
public $__table = 'feedinfo';
|
||||||
|
|
||||||
@ -56,14 +56,38 @@ class Feedinfo extends Plugin_DataObject
|
|||||||
return parent::staticGet(__CLASS__, $k, $v);
|
return parent::staticGet(__CLASS__, $k, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tableDef()
|
/**
|
||||||
|
* return table definition for DB_DataObject
|
||||||
|
*
|
||||||
|
* DB_DataObject needs to know something about the table to manipulate
|
||||||
|
* instances. This method provides all the DB_DataObject needs to know.
|
||||||
|
*
|
||||||
|
* @return array array of column definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
function table()
|
||||||
{
|
{
|
||||||
class_exists('Schema'); // autoload hack
|
return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
|
||||||
// warning: the autoincrement doesn't seem to set.
|
'profile_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
|
||||||
// alter table feedinfo change column id id int(11) not null auto_increment;
|
'feeduri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
|
||||||
return new TableDef($this->__table,
|
'homeuri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
|
||||||
array(new ColumnDef('id', 'integer',
|
'huburi' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
|
||||||
null, false, 'PRI', '0', null, true),
|
'verify_token' => DB_DATAOBJECT_STR,
|
||||||
|
'sub_start' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
|
||||||
|
'sub_end' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
|
||||||
|
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
|
||||||
|
'lastupdate' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function schemaDef()
|
||||||
|
{
|
||||||
|
return array(new ColumnDef('id', 'integer',
|
||||||
|
/*size*/ null,
|
||||||
|
/*nullable*/ false,
|
||||||
|
/*key*/ 'PRI',
|
||||||
|
/*default*/ '0',
|
||||||
|
/*extra*/ null,
|
||||||
|
/*auto_increment*/ true),
|
||||||
new ColumnDef('profile_id', 'integer',
|
new ColumnDef('profile_id', 'integer',
|
||||||
null, false),
|
null, false),
|
||||||
new ColumnDef('feeduri', 'varchar',
|
new ColumnDef('feeduri', 'varchar',
|
||||||
@ -81,9 +105,41 @@ class Feedinfo extends Plugin_DataObject
|
|||||||
new ColumnDef('created', 'datetime',
|
new ColumnDef('created', 'datetime',
|
||||||
null, false),
|
null, false),
|
||||||
new ColumnDef('lastupdate', 'datetime',
|
new ColumnDef('lastupdate', 'datetime',
|
||||||
null, false)));
|
null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return key definitions for DB_DataObject
|
||||||
|
*
|
||||||
|
* DB_DataObject needs to know about keys that the table has; this function
|
||||||
|
* defines them.
|
||||||
|
*
|
||||||
|
* @return array key definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
function keys()
|
||||||
|
{
|
||||||
|
return array('id' => 'P'); //?
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return key definitions for Memcached_DataObject
|
||||||
|
*
|
||||||
|
* Our caching system uses the same key definitions, but uses a different
|
||||||
|
* method to get them.
|
||||||
|
*
|
||||||
|
* @return array key definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
function keyTypes()
|
||||||
|
{
|
||||||
|
return $this->keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the StatusNet-side profile for this feed
|
||||||
|
* @return Profile
|
||||||
|
*/
|
||||||
public function getProfile()
|
public function getProfile()
|
||||||
{
|
{
|
||||||
return Profile::staticGet('id', $this->profile_id);
|
return Profile::staticGet('id', $this->profile_id);
|
||||||
|
@ -156,6 +156,11 @@ class MemcachePlugin extends Plugin
|
|||||||
}
|
}
|
||||||
$this->_conn->addServer($host, $port);
|
$this->_conn->addServer($host, $port);
|
||||||
}
|
}
|
||||||
|
//Compress items stored in the cache if they're over 2k in size
|
||||||
|
//and the compression would save more than 20%.
|
||||||
|
//Allows the cache to store objects larger than 1MB (if they
|
||||||
|
//compress to less than 1MB), and improves cache memory efficiency.
|
||||||
|
$this->_conn->setCompressThreshold(20000, 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,6 @@ line-height:1.618;
|
|||||||
float:left;
|
float:left;
|
||||||
width:80%;
|
width:80%;
|
||||||
display:block;
|
display:block;
|
||||||
line-height:1.8;
|
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
margin-right:2.5%;
|
margin-right:2.5%;
|
||||||
}
|
}
|
||||||
@ -571,7 +570,7 @@ font-size:1.1em;
|
|||||||
float:right;
|
float:right;
|
||||||
font-size:0.8em;
|
font-size:0.8em;
|
||||||
}
|
}
|
||||||
,
|
|
||||||
.form_notice #notice_data-geo_selected button.minimize {
|
.form_notice #notice_data-geo_selected button.minimize {
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user