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>
|
||||||
|
106
js/util.js
106
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,53 +501,61 @@ var SN = { // StatusNet
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(function(position) {
|
navigator.geolocation.getCurrentPosition(
|
||||||
$('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
|
function(position) {
|
||||||
$('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
|
$('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
|
||||||
|
$('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
'lat': position.coords.latitude,
|
'lat': position.coords.latitude,
|
||||||
'lon': position.coords.longitude,
|
'lon': position.coords.longitude,
|
||||||
'token': $('#token').val()
|
'token': $('#token').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$.getJSON(geocodeURL, data, function(location) {
|
$.getJSON(geocodeURL, data, function(location) {
|
||||||
NLN.replaceWith('<a id="notice_data-location_name"/>');
|
NLN = $('#'+SN.C.S.NoticeLocationName);
|
||||||
NLN = $('#'+SN.C.S.NoticeLocationName);
|
NLN.replaceWith('<a id="notice_data-location_name"/>');
|
||||||
|
NLN = $('#'+SN.C.S.NoticeLocationName);
|
||||||
|
|
||||||
if (typeof(location.location_ns) != 'undefined') {
|
if (typeof(location.location_ns) != 'undefined') {
|
||||||
$('#'+SN.C.S.NoticeLocationNs).val(location.location_ns);
|
$('#'+SN.C.S.NoticeLocationNs).val(location.location_ns);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(location.location_id) != 'undefined') {
|
||||||
|
$('#'+SN.C.S.NoticeLocationId).val(location.location_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(location.name) == 'undefined') {
|
||||||
|
NLN_text = position.coords.latitude + ';' + position.coords.longitude;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
NLN_text = location.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
NLN.attr('href', location.url);
|
||||||
|
NLN.text(NLN_text);
|
||||||
|
NLN.click(function() {
|
||||||
|
window.open(location.url);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
function(error) {
|
||||||
|
if (error.PERMISSION_DENIED == 1) {
|
||||||
|
removeNoticeDataGeo();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (typeof(location.location_id) != 'undefined') {
|
);
|
||||||
$('#'+SN.C.S.NoticeLocationId).val(location.location_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof(location.name) == 'undefined') {
|
|
||||||
NLN_text = position.coords.latitude + ';' + position.coords.longitude;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
NLN_text = location.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
NLN.attr('href', location.url);
|
|
||||||
NLN.text(NLN_text);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
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,
|
||||||
|
@ -523,6 +523,10 @@ class Schema
|
|||||||
} else {
|
} else {
|
||||||
$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){
|
if(Event::handle('AutoRegister', array($nickname, $this->provider_name, &$authenticatedUser))){
|
||||||
$user = $this->autoregister($nickname);
|
if($authenticatedUser){
|
||||||
if($user){
|
|
||||||
$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,34 +56,90 @@ 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,
|
||||||
new ColumnDef('profile_id', 'integer',
|
'sub_start' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
|
||||||
null, false),
|
'sub_end' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
|
||||||
new ColumnDef('feeduri', 'varchar',
|
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
|
||||||
255, false, 'UNI'),
|
'lastupdate' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
|
||||||
new ColumnDef('homeuri', 'varchar',
|
}
|
||||||
255, false),
|
|
||||||
new ColumnDef('huburi', 'varchar',
|
static function schemaDef()
|
||||||
255, false),
|
{
|
||||||
new ColumnDef('verify_token', 'varchar',
|
return array(new ColumnDef('id', 'integer',
|
||||||
32, true),
|
/*size*/ null,
|
||||||
new ColumnDef('sub_start', 'datetime',
|
/*nullable*/ false,
|
||||||
null, true),
|
/*key*/ 'PRI',
|
||||||
new ColumnDef('sub_end', 'datetime',
|
/*default*/ '0',
|
||||||
null, true),
|
/*extra*/ null,
|
||||||
new ColumnDef('created', 'datetime',
|
/*auto_increment*/ true),
|
||||||
null, false),
|
new ColumnDef('profile_id', 'integer',
|
||||||
new ColumnDef('lastupdate', 'datetime',
|
null, false),
|
||||||
null, false)));
|
new ColumnDef('feeduri', 'varchar',
|
||||||
|
255, false, 'UNI'),
|
||||||
|
new ColumnDef('homeuri', 'varchar',
|
||||||
|
255, false),
|
||||||
|
new ColumnDef('huburi', 'varchar',
|
||||||
|
255, false),
|
||||||
|
new ColumnDef('verify_token', 'varchar',
|
||||||
|
32, true),
|
||||||
|
new ColumnDef('sub_start', 'datetime',
|
||||||
|
null, true),
|
||||||
|
new ColumnDef('sub_end', 'datetime',
|
||||||
|
null, true),
|
||||||
|
new ColumnDef('created', 'datetime',
|
||||||
|
null, false),
|
||||||
|
new ColumnDef('lastupdate', 'datetime',
|
||||||
|
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