diff options
-rw-r--r-- | actions/newnotice.php | 2 | ||||
-rw-r--r-- | actions/publictagcloud.php | 7 | ||||
-rw-r--r-- | install.php | 1 | ||||
-rw-r--r-- | js/util.js | 102 | ||||
-rw-r--r-- | lib/columndef.php | 1 | ||||
-rw-r--r-- | lib/schema.php | 4 | ||||
-rw-r--r-- | plugins/Authentication/AuthenticationPlugin.php | 28 | ||||
-rw-r--r-- | plugins/FeedSub/FeedSubPlugin.php | 7 | ||||
-rw-r--r-- | plugins/FeedSub/feedinfo.php | 108 | ||||
-rw-r--r-- | plugins/MemcachePlugin.php | 5 | ||||
-rw-r--r-- | theme/base/css/display.css | 3 |
11 files changed, 183 insertions, 85 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php index 8d89e9da0..a4ed87bb6 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -184,7 +184,7 @@ class NewnoticeAction extends Action $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'), $this->trimmed('lon'), diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php index e7f6ee36c..5c7074029 100644 --- a/actions/publictagcloud.php +++ b/actions/publictagcloud.php @@ -136,7 +136,12 @@ class PublictagcloudAction extends Action $this->elementStart('dd'); $this->elementStart('ul', 'tags xoxo tag-cloud'); 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('dd'); diff --git a/install.php b/install.php index 1c62bb2b2..435f6d63b 100644 --- a/install.php +++ b/install.php @@ -454,7 +454,6 @@ function showForm() <dd> <div class="instructions"> <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> </dd> </dl> diff --git a/js/util.js b/js/util.js index f6b59ec74..2d108118a 100644 --- a/js/util.js +++ b/js/util.js @@ -442,17 +442,25 @@ var SN = { // StatusNet }, 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); if (NDG.length > 0) { var NLE = $('#notice_data-location_wrap'); 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) { NDG.change(function() { - NLE.removeAttr('title'); - $.cookie(SN.C.S.NoticeLocationCookieName, $('#'+SN.C.S.NoticeDataGeo).attr('checked')); 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+'"/>'; - NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); + var NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); if (NDGS.length > 0) { NDGS.replaceWith(S); } @@ -471,18 +479,18 @@ var SN = { // StatusNet NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); 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) { 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>'); $('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){ $('#'+SN.C.S.NoticeDataGeoSelected).remove(); $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); - $('label[for=notice_data-geo]').removeClass('checked'); + $('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked'); return false; }); @@ -493,53 +501,61 @@ var SN = { // StatusNet return false; }); - navigator.geolocation.getCurrentPosition(function(position) { - $('#'+SN.C.S.NoticeLat).val(position.coords.latitude); - $('#'+SN.C.S.NoticeLon).val(position.coords.longitude); + navigator.geolocation.getCurrentPosition( + function(position) { + $('#'+SN.C.S.NoticeLat).val(position.coords.latitude); + $('#'+SN.C.S.NoticeLon).val(position.coords.longitude); - var data = { - 'lat': position.coords.latitude, - 'lon': position.coords.longitude, - 'token': $('#token').val() - }; + var data = { + 'lat': position.coords.latitude, + 'lon': position.coords.longitude, + 'token': $('#token').val() + }; - $.getJSON(geocodeURL, data, function(location) { - NLN.replaceWith('<a id="notice_data-location_name"/>'); - NLN = $('#'+SN.C.S.NoticeLocationName); + $.getJSON(geocodeURL, data, function(location) { + NLN = $('#'+SN.C.S.NoticeLocationName); + NLN.replaceWith('<a id="notice_data-location_name"/>'); + NLN = $('#'+SN.C.S.NoticeLocationName); - if (typeof(location.location_ns) != 'undefined') { - $('#'+SN.C.S.NoticeLocationNs).val(location.location_ns); - } + if (typeof(location.location_ns) != 'undefined') { + $('#'+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.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; - } + 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.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(); + } + } + ); } else { - $('label[for=notice_data-geo]').removeClass('checked'); - NDGS.hide(); - $('#'+SN.C.S.NoticeLat).val(''); - $('#'+SN.C.S.NoticeLon).val(''); - $('#'+SN.C.S.NoticeLocationNs).val(''); - $('#'+SN.C.S.NoticeLocationId).val(''); + removeNoticeDataGeo(); } - }); + }).change(); var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName); - NDG.attr('checked', (cookieVal == null || cookieVal == 'true')); - NDG.change(); + NDG.attr('checked', (cookieVal === null || cookieVal == 'true')); } } }, diff --git a/lib/columndef.php b/lib/columndef.php index 1bae6b33b..ac2fcd23e 100644 --- a/lib/columndef.php +++ b/lib/columndef.php @@ -74,6 +74,7 @@ class ColumnDef * @param string $key type of key * @param value $default default value * @param value $extra unused + * @param boolean $auto_increment */ function __construct($name=null, $type=null, $size=null, diff --git a/lib/schema.php b/lib/schema.php index a8ba91b87..6fe442d56 100644 --- a/lib/schema.php +++ b/lib/schema.php @@ -523,6 +523,10 @@ class Schema } else { $sql .= ($cd->nullable) ? "null " : "not null "; } + + if (!empty($cd->auto_increment)) { + $sql .= " auto_increment "; + } return $sql; } diff --git a/plugins/Authentication/AuthenticationPlugin.php b/plugins/Authentication/AuthenticationPlugin.php index a76848b04..75e8d2b76 100644 --- a/plugins/Authentication/AuthenticationPlugin.php +++ b/plugins/Authentication/AuthenticationPlugin.php @@ -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){ //map the nickname to a username $user_username = new User_username(); @@ -127,13 +144,10 @@ abstract class AuthenticationPlugin extends Plugin } } }else{ - if($this->autoregistration){ - $authenticated = $this->checkPassword($nickname, $password); - if($authenticated){ - $user = $this->autoregister($nickname); - if($user){ - $authenticatedUser = $user; - User_username::register($authenticatedUser,$nickname,$this->provider_name); + $authenticated = $this->checkPassword($nickname, $password); + if($authenticated){ + if(Event::handle('AutoRegister', array($nickname, $this->provider_name, &$authenticatedUser))){ + if($authenticatedUser){ return false; } } diff --git a/plugins/FeedSub/FeedSubPlugin.php b/plugins/FeedSub/FeedSubPlugin.php index 857a9794d..e49e2a648 100644 --- a/plugins/FeedSub/FeedSubPlugin.php +++ b/plugins/FeedSub/FeedSubPlugin.php @@ -105,12 +105,11 @@ class FeedSubPlugin extends Plugin return true; } - /* - // auto increment seems to be broken 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->ensureDataObject('Feedinfo'); + $schema->ensureTable('feedinfo', Feedinfo::schemaDef()); return true; } - */ } diff --git a/plugins/FeedSub/feedinfo.php b/plugins/FeedSub/feedinfo.php index fff66afe9..b166bd6e1 100644 --- a/plugins/FeedSub/feedinfo.php +++ b/plugins/FeedSub/feedinfo.php @@ -31,7 +31,7 @@ class FeedDBException extends FeedSubException } } -class Feedinfo extends Plugin_DataObject +class Feedinfo extends Memcached_DataObject { public $__table = 'feedinfo'; @@ -56,34 +56,90 @@ class Feedinfo extends Plugin_DataObject 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() + { + return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, + 'profile_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, + 'feeduri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, + 'homeuri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, + 'huburi' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, + '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', + 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() { - class_exists('Schema'); // autoload hack - // warning: the autoincrement doesn't seem to set. - // alter table feedinfo change column id id int(11) not null auto_increment; - return new TableDef($this->__table, - array(new ColumnDef('id', 'integer', - null, false, 'PRI', '0', null, true), - new ColumnDef('profile_id', 'integer', - 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 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() { return Profile::staticGet('id', $this->profile_id); diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php index acbec135e..78e2b2406 100644 --- a/plugins/MemcachePlugin.php +++ b/plugins/MemcachePlugin.php @@ -156,6 +156,11 @@ class MemcachePlugin extends Plugin } $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); } } } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 0bb3479cc..f441a4020 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -559,7 +559,6 @@ line-height:1.618; float:left; width:80%; display:block; -line-height:1.8; overflow:auto; margin-right:2.5%; } @@ -571,7 +570,7 @@ font-size:1.1em; float:right; font-size:0.8em; } -, + .form_notice #notice_data-geo_selected button.minimize { float:left; } |