Brion Vibber [Wed, 5 Jan 2011 23:27:17 +0000 (23:27 +0000)]
Switch autoloader from '__autoload' magic function name to registering our function with spl_autoload_register(); fixes compat problem with PHPUnit 3.5+ which seems to break the old __autoload
Brion Vibber [Wed, 5 Jan 2011 22:27:53 +0000 (14:27 -0800)]
Salmon slap / magicsig test script
Given a notice in the local system, we package it up as an Atom entry and MagicSig it up.
We run the magicenv verification on it locally to make sure our own functions can decode it.
Optionally with --verify we can send to Tuomas Koski's verification test service (not sure if this is working 100%)
If given --slap= with a target Salmon endpoint, we'll sent it on and see if it liked it. (Note that StatusNet will reject if there's not a relevant mention, but will report acceptance for dupes so you can use a message that's already been delivered as a test.)
Brion Vibber [Wed, 5 Jan 2011 17:39:36 +0000 (09:39 -0800)]
Remove json2 author's "don't hotlink my script pls" alert line from our local copy of json2.js :D
Added json2.min.js to the makefile so it can be updated easily when json2.js changes.
Brion Vibber [Tue, 4 Jan 2011 21:09:44 +0000 (13:09 -0800)]
Fix ticket #2181: Can't save #000000 (black) in color fields on design page
It seems to have actually been saving correctly, but the update of the colors on the form success page wasn't working properly.
When a design object is pulled out of the database, the numeric fields are read in as strings, so black comes back as "0".
But, when we populate the new object and then stick it live, we've populated it with actual integers; with memcache on these might live for a while in the cache...
The fallback code in Design::toWebColor() did a check ($color == null) which would be false for the string "0", but counts as true for the *integer* 0.
Thus, the display code would initially interpret the correctly-saved black color as "use default".
Changing the check to === against null and "" empty string avoids the false positive on integers, and lets us see our nice black text immediately after save.
Evan Prodromou [Mon, 3 Jan 2011 18:38:32 +0000 (10:38 -0800)]
Configuration options for using an HTTP proxy
We can make a lot of HTTP requests from the server side. This change
adds some configuration options for using an HTTP proxy, which can
cache hits from multiple sites (good for status.net-like services, for example).
Brion Vibber [Fri, 31 Dec 2010 20:42:26 +0000 (12:42 -0800)]
Bookmark plugin: tweak post-upload success message to distinguish between "already done" (UnQueueManager) and "started, should finish eventually" (other queue manager)
Brion Vibber [Fri, 31 Dec 2010 20:33:51 +0000 (12:33 -0800)]
Bookmark plugin: fix for delicious import with queues enabled
We were passing DOM nodes directly into the queues for the final bookmark import stage; unfortunately these don't actually survive serialization.
Moved the extraction of properties from the HTML up to the first-stage handler, so now we don't have to worry about moving DOM nodes from one handler to the next. Instead passing an associative array of properties, which is fed into the Bookmark::saveNew by the per-bookmark handler.
Brion Vibber [Fri, 31 Dec 2010 20:09:54 +0000 (12:09 -0800)]
Bookmark plugin: fixes for bad DOM element nesting in delicious import data
delicious bookmark exports use the godawful HTML bookmark file format that ancient versions of Netscape used (and has thus been the common import/export format for bookmarks since the dark ages of the web :)
This arranges bookmark entries as an HTML definition list, using a lot of implied close tags (leaving off the </dt> and </dd>).
DOMDocument->loadHTML() uses libxml2's HTML mode, which generally does ok with muddling through things but apparently is really, really bad about handling those implied close tags.
Sequences of adjacent <dt> elements (eg bookmark without a description, followed by another bookmark "<dt><dt>"), end up interpreted as nested ("<dt><dt></dt></dt>") instead of as siblings ("<dt></dt><dt></dt>").
The first round of code tried to resolve the nesting inline, but ended up a bit funky in places.
I've replaced this with a standalone run through the data to re-order the elements, based on our knowing that <dt> and <dd> cannot directly contain one another; once that's done, our main logic loop can be a bit cleaner. I'm not 100% sure it's doing nested sublists correctly, but these don't seem to show up in delicious export (and even if they do, with the way we flatten the input it shouldn't make a difference).
Also fixed a clearer edge case where some bookmarks didn't get imported when missing descriptions.
Brion Vibber [Fri, 31 Dec 2010 01:11:16 +0000 (17:11 -0800)]
Fix up edge case in nickname processing: overlong display forms should be rejected before normalization (storage of display forms will also have fields with limited length)
Evan Prodromou [Thu, 30 Dec 2010 21:21:14 +0000 (13:21 -0800)]
Use UUIDs for Bookmark unique ID
I was trying to generate URIs for Bookmarks based on (profile, crc32(url), created).
I failed at that. CRC32s are unsigned ints, and our schema code didn't like that.
On top of that, my code to encode and restore created timestamps was problematic.
So, I switched back to using a meaningless unique ID for Bookmarks.
One way to do this would be to use an auto-incrementing integer ID. However, we've been
kind of crabbed out a few times for exposing auto-incrementing integer IDs as URIs, so
I thought maybe using a random UUID would be a better way to do it.
So, this patch sets random UUIDs for URIs of bookmarks.
Evan Prodromou [Wed, 29 Dec 2010 23:33:57 +0000 (15:33 -0800)]
Show <activity:subject> in Atom group notice feed
Version 0.9.6 and below of StatusNet assume anything in <author> is a
Person. So, we include an <activity:subject> element, which will be
checked first by those versions of the code, only for group feeds.
At some point we'll take this out, but it's useful for now.
Brion Vibber [Tue, 28 Dec 2010 19:34:02 +0000 (11:34 -0800)]
Prevent group creation by silenced users.
* adds Right::CREATEGROUP
* logic in Profile::hasRight() checks for silencing
* NewgroupAction checks for the permission before letting you see or process the form in the UI
* User_group::register() logic does a low-level check on the specified initial group admin, and rejects creation if that user doesn't have the right; guaranteeing that API methods etc will also have this restriction applied sensibly.
Evan Prodromou [Sat, 25 Dec 2010 04:34:15 +0000 (20:34 -0800)]
Radical differences in Bookmark storage
Had some problems with PuSH and Salmon use of Bookmarks; they were
being required to generate Atom versions of the bookmark _before_ the bookmark was saved.
So, I reversed the order of how things are saved, and associate notices and bookmarks
by URI rather than notice_id.
Brion Vibber [Wed, 22 Dec 2010 23:20:07 +0000 (15:20 -0800)]
Break xbImportNode.js and geometa.js back out of util.js; the Makefile in js has been updated to combine them with util.js source when building util.min.js
Revert "combine our standard scripts into one big script"
Brion Vibber [Wed, 22 Dec 2010 22:55:13 +0000 (14:55 -0800)]
When queueing is off, restore runs immediately. Indicate that we've already finished processing on the success page in this case; otherwise continue to show the 'will take a few minutes' message.
Brion Vibber [Wed, 22 Dec 2010 21:56:19 +0000 (13:56 -0800)]
Don't trust text/xml mime types; generic content detection gives useless stuff like that on SVG images! Todo: replace the extension check in this case with better content-based checks.