Commit Graph

1940 Commits

Author SHA1 Message Date
Mikael Nordfeldth 0883f54f62 getUrl replaces deprecated bestUrl (more to come) 2014-04-28 14:04:54 +02:00
Mikael Nordfeldth 37ce1f4766 Better fallback on UnsupportedMediaException 2014-04-28 12:12:06 +02:00
Mikael Nordfeldth e526909bd8 File width and height is now properly set for File 2014-04-22 12:09:24 +02:00
Mikael Nordfeldth d59eb5e184 Dynamically generate thumbnails (see full text)
The File object now stores width and height of files that can
supply this kind of information. Formats which we can not read
natively in PHP do not currently benefit from this. However an
event hook will be introduced later.

The CreateFileImageThumbnail event is renamed to:
CreateFileImageThumbnailSource to clarify that the hooks should not
generate their own thumbnails but only the source image. Also it now
accepts File objects, not MediaFile objects.

The thumbnail generation is documented in the source code. For
developers, call 'getThumbnail' on a File object and hope for the best.

Default thumbnail sizes have increased to be more appealing.
2014-04-21 20:46:11 +02:00
Mikael Nordfeldth 7f3611c51c use intval() instead of floor() for int return type 2014-04-21 19:32:08 +02:00
Mikael Nordfeldth b3bf036975 Preparing File for dynamic thumbnail generation. 2014-04-21 12:33:26 +02:00
Mikael Nordfeldth 43a3f5ea90 File_oembed::saveNew are File::saveNew are static
Also did some non-backwards-compatible (to StatusNet) code cleanup.
2014-04-20 16:10:05 +02:00
Mikael Nordfeldth 72707ddc26 deprecate Notice::bestUrl() in favor of getUrl() 2014-04-20 15:28:31 +02:00
Mikael Nordfeldth 132be99506 Improve ShownoticeAction remote redirect code 2014-04-19 22:13:48 +02:00
Mikael Nordfeldth 454a9bc1c4 Use getUrl() instead of ->url in OembedAction 2014-04-19 22:05:44 +02:00
Mikael Nordfeldth 2c1dcc7f14 Fixes to URI/URL handling for notices 2014-04-19 22:04:52 +02:00
Mikael Nordfeldth 85b022246f Handle missing URIs and URLs better 2014-04-18 23:36:01 +02:00
Mikael Nordfeldth 3e2136f222 Avoid double colon on Notice URI generation 2014-04-18 23:17:34 +02:00
Mikael Nordfeldth e0e69ddd7c Throw exception when we can't get the url for a notice 2014-04-18 23:17:15 +02:00
Mikael Nordfeldth 7025817cc1 File_thumbnail lacked getUrl function
The only reason it worked was because DB fetches calls to get$varname if
the dataobject has a variable with the specific name. However, it started
blurting out errors that the case must be correct (which would require
'geturl' to be the function name).

Since we probably want to replace DB sometime, we'll just override this
auto-fetching mechanism and use more explicitly defined functions.
2014-04-18 23:06:28 +02:00
Mikael Nordfeldth 28dc361a15 Set new notice uri to something that's not a URL 2014-04-18 22:42:01 +02:00
Mikael Nordfeldth d3b4a8616d Original name preserved in uploaded file.
Avoiding collisions with date (shorter than before) and 4 character
random alphanumeric string. I bet someone could mass-upload files
and generate all combinations of aaaa-zzzz during the course of a
day, but then maybe that user should be disabled anyway :)
(filling the collision space will cause a never-ending loop).
2014-04-16 23:17:27 +02:00
Mikael Nordfeldth 06d4cecf7f MediaFile thumbnail event hooks + VideoThumbnails plugin
The exception thrown from MediaFile will be caught and simply result in
no thumbnail at all right now. In the future we might use a catch-all
and have a "cannot generate preview"-icon or something.

VideoThumbnails requires php5-ffmpeg and php5-gd.
2014-04-16 21:48:58 +02:00
Mikael Nordfeldth 639f1a01e0 File class no longer depends on MIME
+ minor tweaks to MediaFile
2014-03-08 03:51:47 +01:00
Mikael Nordfeldth 79cacdc62f Removing unused "inboxed" flag for User class 2014-03-07 21:37:48 +01:00
Mikael Nordfeldth 5842c59ba7 Get group attentions back into the "all" feed 2014-03-07 02:49:42 +01:00
Mikael Nordfeldth 5e4a275220 Clear Attentions when notice or profile is removed 2014-03-06 14:43:36 +01:00
Mikael Nordfeldth bed8cc48bc Add an index for Attention notice_ids too
Not sure if this is really needed, since notice_id and profile_id together
build up the primary key. That might cause MySQL to index them anyway.
2014-03-06 14:42:29 +01:00
Mikael Nordfeldth 018fd84032 Add Attention class for non-sub and non-mention notice attentions 2014-03-06 14:22:26 +01:00
Mikael Nordfeldth 5127a83935 Add Managed_DataObject getID() to avoid $obj->id 2014-03-06 14:21:44 +01:00
Mikael Nordfeldth 2272cc244d Removed Inbox from core (unused since 4b2a66ed29)
Added the following FIXME:
How should a Twitter user get their Inbox filled with foreign tweets?

Every imported Twitter user has a profile in the Profile table, so we
could setup a Subscription entry for each of those, meaning they get
collected in the InboxNoticeStream... But this would mean a lot of
unnecessary entries and listings that generally just point to the
locked down Twitter service.

Let's figure out a good relation so we can connect any profile to any
imported foreign notice, so it shows up in the "all" feed.
2014-03-06 04:46:29 +01:00
Mikael Nordfeldth c812e7c0d6 Removed deprecated Inbox functions not in use from User 2014-03-06 03:41:50 +01:00
Mikael Nordfeldth da87e742f8 Treat author just as anyone else (Notice distrib) 2014-03-06 01:55:23 +01:00
Mikael Nordfeldth 00db57949f Always queue inbox distribution 2014-03-06 01:50:54 +01:00
Mikael Nordfeldth 1056348029 Merge commit 'refs/merge-requests/11' of git://gitorious.org/statusnet/gnu-social into merge-requests/11 2014-03-05 13:58:32 +01:00
Mikael Nordfeldth f323f234d7 Better typing for isSubscribed 2014-03-05 13:44:34 +01:00
Mikael Nordfeldth f83b2cf324 Handle removed profile more gracefully in noticelist
Just hide it from the visitor, but log a warning (and error, since
the exception itself logs that).
2014-03-05 01:27:27 +01:00
Jean Baptiste Favre 29f0922705 Add check after oembed API call. In case of error, returned value is false which generate error messages 'Trying to get property of non-object'. 2014-03-02 15:06:06 +01:00
Mikael Nordfeldth 5144c0cb78 Throw exception, don't return null in Conversation::create 2014-03-01 17:19:10 +01:00
Mikael Nordfeldth 5c505d8539 Conversation ID now gets set from initial notice.
This will work without much extra effort because there will always be
more notices (higher value) than conversations (so no collisions).

But please run upgrade.php to avoid having an autoincrement id on
conversation table.

Installations using code after 2014-03-01 will have identical
conversation IDs to the initial (conversation root) notice IDs. This
will not affect older installations, which will have very different
values.
2014-03-01 17:12:40 +01:00
Mikael Nordfeldth fc047bd6e6 Minor code cleanup with group related actions (thanks brw12)
Originated from brw12 who noticed an incorrect variable name used in
an error message in actions/apigroupjoin.php:109
2014-03-01 12:01:17 +01:00
Mikael Nordfeldth edee39790e Use exceptions for Notice::getByUri
..jeez, a long time since I commited. Three in a row to get this right. Sorry :)
2014-01-12 22:46:50 +01:00
Mikael Nordfeldth 08dba7e21d Notice::getByUri is of course static 2014-01-12 22:41:30 +01:00
Mikael Nordfeldth 15c95dc415 getByUri added to Notice for future use 2014-01-12 22:37:41 +01:00
Mikael Nordfeldth 73fe8a81b7 Slight cleanup in typing and syntax of File and File_* classes 2013-11-10 14:33:45 +01:00
Mikael Nordfeldth 729c6eef36 Inbox class a bit more consistent in argument order and type 2013-11-09 01:18:44 +01:00
Mikael Nordfeldth 3eac5e6026 Notice_inbox no longer used (and should've already been migrated for anyone using StatusNet 1.1.x) 2013-11-09 01:10:47 +01:00
Mikael Nordfeldth 1535ae5e3b Call self:: instead of Memcached_DataObject 2013-11-04 17:38:40 +01:00
Mikael Nordfeldth 5e054bfdb3 Minor typing stuff and syntax fixes 2013-11-02 17:28:11 +01:00
Mikael Nordfeldth a6f99e7296 Implement a User_group fetching function for Local_group 2013-11-02 17:27:50 +01:00
Mikael Nordfeldth 05b603b1da Less raw SQL in User_group 2013-11-02 14:30:29 +01:00
Mikael Nordfeldth d289ccb7f2 Minor PHP stylistic features and typing stuff 2013-11-02 13:05:08 +01:00
Mikael Nordfeldth bd86519d50 Minor labeling things for StatusNet to GNU social migration 2013-11-01 14:04:40 +01:00
Mikael Nordfeldth 20bd0c1136 getStreamName will now return nick/fullname based on current user's preferred representation 2013-10-30 13:05:04 +01:00
Mikael Nordfeldth 09ef1fff69 NoticeListItem attentions showed double for User_group
...because they each have their own Profile now! Whiie!
2013-10-30 12:56:17 +01:00
Mikael Nordfeldth 71978a84fd File oEmbed lookup failure is not as severe as LOG_ERR 2013-10-29 14:09:00 +01:00
Mikael Nordfeldth 9b6633698c Group discovery from text functions polished
Also removed the entirely unused saveGroups function.

Now avoiding multiGet and using listFind in Profile->getGroups()
so we don't have to deal with ArrayWrapper.
2013-10-29 13:40:14 +01:00
Mikael Nordfeldth 2dfa0bfcee function delete in dataobjects now don't break strict syntax 2013-10-29 10:20:57 +01:00
Mikael Nordfeldth 23a6b4595f Reworked the ActivityContext->attention structure
Removing Evan's obscure attentionType solution and directly using the attention array
2013-10-28 22:21:14 +01:00
Mikael Nordfeldth f99c4b7f07 More OOP-ish tests using instanceof 2013-10-28 22:18:00 +01:00
Mikael Nordfeldth 3ba6374b9d Memcached_DataObject extensions got their update functions more consistent 2013-10-28 19:36:05 +01:00
Mikael Nordfeldth 9ea57e5cb2 getAcctUri function added with related exception
Used in ActivityObject for Atom Title generation.

New events:
    * StartGetProfileAcctUri
    * EndGetProfileAcctUri
2013-10-28 18:21:10 +01:00
Mikael Nordfeldth a5d8707658 Use getParent instead of manual reply_to lookup 2013-10-28 17:28:10 +01:00
Mikael Nordfeldth fcba540a14 Removed legacy OMB. Use OStatus for remote profiles. 2013-10-28 16:22:09 +01:00
Mikael Nordfeldth 340740266c Notice class local cache fixes 2013-10-23 12:33:37 +02:00
Mikael Nordfeldth a980f4ed33 Call memcache() as a static object (it's a static class) 2013-10-23 12:02:15 +02:00
Mikael Nordfeldth f54584c126 Don't disconnect a DB_Error, instead log for better understanding. 2013-10-22 18:56:56 +02:00
Mikael Nordfeldth e274f69634 Notice->getParent function fixes
NoResultException was the wrong choice in this case, because it was
not a DB_DataObject instance that performed the search, but a static
call to the Notice class.
2013-10-22 15:37:19 +02:00
Mikael Nordfeldth 355c37bc3f Revert "Better ID for notice activity"
This reverts commit 8cc4660bd9.

This seems like something Evan only did to make pump.io import notices easier,
or maybe he just wanted to get rid of the identi.ca URLs?
2013-10-21 23:25:35 +02:00
Mikael Nordfeldth f4c0cff032 Only use ActivityVerb::SHARE (forwardId is deprecated)
StatusNet >= 1.0 support it.
2013-10-21 22:25:19 +02:00
Mikael Nordfeldth 3cab5b36c1 Replace common_good_random with common_random_hexstr 2013-10-21 13:20:30 +02:00
Mikael Nordfeldth df5aa6f93a Exception wasn't thrown. How does PHP handle daisychained calls, really? 2013-10-21 09:09:32 +02:00
Mikael Nordfeldth 9811783f19 Strict type check against false in User_group 2013-10-20 17:15:46 +02:00
Mikael Nordfeldth e868ebfe77 WebFingerResource introduced, instead of strict Profile object
This is the beginning of getting notice URI info via WebFinger

*XrdActionLinks is renamed *WebFingerProfileLinks, check EVENTS.txt
in WebFinger plugin for new events.
2013-10-20 15:48:14 +02:00
Mikael Nordfeldth 2a5ba1f74b Core and Default plugins separated, now loads on install
_flow_ reported on IRC that install.php had stopped working. This was
because default plugins had been put into two separate lists, and the
list with AuthCrypt was never loaded when performing an installation.

Core plugins cannot be disabled.

I also removed the Memcache autodetection thing since it should be
solved in a more elegant manner.
2013-10-19 14:38:15 +02:00
Mikael Nordfeldth 145fbf1130 Move nick updating of User entry to Profile->update()
Also, timezone and language in User table weren't indexes. So no need
to do them separately.
2013-10-17 16:38:42 +02:00
Mikael Nordfeldth 274b70784f When updating a User_group nickname, correlate Local_group and Profile
...no need to make a separate call to Local_group's setNickname all the time,
or a bunch of redundant code for the Profile table.

Next up is User->update()...
2013-10-17 13:49:20 +02:00
Mikael Nordfeldth 6ed66d9c76 Local_group and User are now assumed to be in same namespace 2013-10-17 01:27:01 +02:00
Mikael Nordfeldth 38a69b5597 Better checks during User::register and improved Nickname checks 2013-10-16 14:58:06 +02:00
Mikael Nordfeldth 352bef2374 Add support (and upgrade path) for group profiles 2013-10-15 11:12:50 +02:00
Mikael Nordfeldth 202f6ad7a9 Removing legacy code and fixup_* for Status_network tags 2013-10-15 10:54:03 +02:00
Mikael Nordfeldth 8202e922aa Do calls straight to the result of getProfile 2013-10-15 02:34:10 +02:00
Mikael Nordfeldth 4e8d7795d0 Moved favoriteNotices from User to Profile class 2013-10-15 02:15:58 +02:00
Mikael Nordfeldth fdbb528e7a getTaggedSub-stuff moved to Profile class 2013-10-15 02:00:27 +02:00
Mikael Nordfeldth 1dc051a9eb We never accept a user without a Profile 2013-10-15 01:00:27 +02:00
Mikael Nordfeldth f46d675a20 GNU social is with a minor s. 2013-10-15 00:20:36 +02:00
Mikael Nordfeldth b903db059c static:: call are less cluttery 2013-10-14 18:34:26 +02:00
Mikael Nordfeldth a8bcdc905f common_sql_now() is recommended before DB_DataObject_Cast::dateTime() 2013-10-14 13:42:27 +02:00
Mikael Nordfeldth 53face3340 MDB2 now works with UTF-8 2013-10-14 13:18:26 +02:00
Mikael Nordfeldth 390556d932 Remote Profile Action from ModPlus now more generic 2013-10-08 21:08:02 +02:00
Mikael Nordfeldth fcf47f315b Removed deprecated activity:subject 2013-10-08 15:06:19 +02:00
Mikael Nordfeldth 1d1951d4b0 common_sql_now() is recommended 2013-10-08 11:40:23 +02:00
Mikael Nordfeldth 9ddc40b6da NoResultException returns the failed object 2013-10-08 00:21:24 +02:00
Mikael Nordfeldth 87370f0cb1 URL shortening can now be disabled for the 'maxurllength'
Also, URL shortening now consistently uses 'maxurllength'...
2013-10-06 22:35:49 +02:00
Mikael Nordfeldth 34a6624452 Qvitter API changes (thanks hannes2peer)
I implemented changes from quitter.se's new API that their front-end qvitter
uses, https://github.com/hannesmannerheim/qvitter/blob/master/api-changes-1.1.1/CHANGES

However I left out the URL shortening commens, since I believe whatever behaviour
they experienced that caused them to implement this was a bug (or many) and should
be fixed in their proper areas and that shortening should not be entirely left
out in API calls.
2013-10-06 21:51:50 +02:00
Mikael Nordfeldth 3000adb33d pkeyGet unfortunately returns null (should throw NoResultException) on empty result 2013-10-06 20:04:09 +02:00
Mikael Nordfeldth 2770ef9718 listFind throws NoResultException on no results 2013-10-06 16:37:51 +02:00
Mikael Nordfeldth fb94a16217 Moved Avatar retrieval into Avatar class
Backwards compatible functions are still in Profile class.
2013-10-06 15:55:06 +02:00
Mikael Nordfeldth c3d46b81a8 Added Profile_prefs class for profile preferences
Profile_prefs aims to consolidate all the profile preferences into a
single table. Otherwise we end up with a bajillion *_prefs classes, like
User_urlshortener_prefs, or new fields in existing User/Profile classes,
like 'urlshorteningservice', 'homepage', 'phone_number', 'pet_name' etc.

Eventually we should migrate as many user-settable preferences as we can
into this system.

The data in Profile_prefs is organized by:
    * profile_id    Identify the current Profile.
    * namespace     Which plugin/section the preference is for.
    * topic         Preference name (like 'homepage')
    * data          Preference data (like 'https://gnu.org/')

The names 'topic' and 'data' are because 'key' and 'value' may be rather
ambigous when dealing with our DB_DataObject classes etc.
2013-10-06 14:07:00 +02:00
Mikael Nordfeldth 78f9629bf3 Moved shareLocation preference check to Profile class 2013-10-06 13:38:09 +02:00
Mikael Nordfeldth 64dbd93534 Some PHP strict warning fixes 2013-10-06 03:37:12 +02:00
Mikael Nordfeldth ac819e5738 fillAvatars would avoid the *ProfileGetAvatar events 2013-10-06 03:01:43 +02:00
Mikael Nordfeldth ba481d1e31 LOG_WARNING, not LOG_WARN 2013-10-06 01:33:10 +02:00
Mikael Nordfeldth 48da97f204 MediaFile code improvements, preparing to implement multi-attachments
Maybe in the future we can use this for anonymous file uploads too?
With some kind of anonymous/pseudonymous profile. That'd be neat.
2013-10-05 18:47:45 +02:00
Mikael Nordfeldth e376905d93 Forgot to clean some debug logging 2013-10-05 14:33:02 +02:00