Commit Graph

62 Commits

Author SHA1 Message Date
Alexei Sorokin 665e4574da [DATABASE] Fix index identifiers and clean up redundant ones 2021-07-16 19:44:38 +01:00
Diogo Cordeiro 9f4c4edb02 [ActivityPub][Ostatus] Fetch avatars in accordance to the new media system 2021-07-16 19:44:37 +01:00
Alexei Sorokin 26115482ef [SCHEMA] Improve timestamp storage
Avoid the use of deprecated MariaDB "zero dates" globally. If they're present
as attribute defaults somewhere, they will be replaced with NULL implicitly.
The existing "zero dates" in MariaDB storage will be left intact and this
should not present any issues.

The "timestamp" type in table definitions now corresponds to DATETIME in
MariaDB with "DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", which
should be close enough to the original behaviour for compatibility purposes.
It is now the recommended type for "modified" attributes, because of the
update trigger on MariaDB. But there is no such trigger implemented on
PostgreSQL as of this moment.
2021-07-16 19:44:37 +01:00
Hugo Sales b7ed15c865 [CORE] Make avatars be served with the same mechanism as attachments 2021-07-16 19:44:36 +01:00
Alexei Sorokin 3f17a0efea [DATABASE] Introduce a bool type in schema
PostgreSQL has a clear distinction between integers and booleans, so it makes
sense to draw a clear line.
2021-07-16 19:44:35 +01:00
Diogo Cordeiro f67a93eddc [CORE] Bump Database requirement to MariaDB 10.3+ 2019-08-03 17:47:23 +01:00
Mikael Nordfeldth a112e7f9a4 Use another method of detecting unspecified defaultImage size 2016-03-01 15:00:52 +01:00
Mikael Nordfeldth 3ef573f67c Default to profile size in Avatar::defaultAvatar 2016-02-24 16:42:35 +01:00
Mikael Nordfeldth ec257d940a Either use or don't use HTTPS
The risk of injection attacks using HTTP is too great to allow a
site that allows both HTTP and HTTPS...
2016-02-10 00:57:39 +01:00
Mikael Nordfeldth 1a1e44cdfd Issue #118 wanted better TOR support, now Avatar URLs are not stored
There was no reason to store the generated Avatar URLs because it's so
cheap to generate them on the fly.
2016-01-06 16:14:26 +01:00
Mikael Nordfeldth 3ee673ac91 ImageFile->resize now totally replaced with resizeTo 2015-03-12 20:47:07 +01:00
Mikael Nordfeldth 6f76c8b59d Same as last commit, don't give ID if it's not for a File object 2015-03-11 00:14:14 +01:00
Mikael Nordfeldth caa0dd549e Avatar table url field now 'text', maybe use filename as unique key? 2015-02-28 12:56:42 +01:00
Mikael Nordfeldth 2f86cd8602 utf8mb4 conversion on database with index adjusts 2015-02-12 18:18:55 +01:00
Mikael Nordfeldth 7f3611c51c use intval() instead of floor() for int return type 2014-04-21 19:32:08 +02:00
Mikael Nordfeldth 2dfa0bfcee function delete in dataobjects now don't break strict syntax 2013-10-29 10:20:57 +01: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 d1558a1d8b Fix Avatar-unlink plus better logging in TwitterImport 2013-10-05 11:32:43 +02:00
Mikael Nordfeldth fb4e9b234d Twitter Import improvements. Still buggy?
Apparently mrvdb has problems with duplicate inserts and missing files when
unlinking. It could be due to coding, or it could be due to parallelizing.
2013-10-04 13:36:45 +02:00
Mikael Nordfeldth cd6fa512ac Twitter Import + avatar fixes (cleaning up + fixing)
...there was also a typo in OstatussubAction ($avatarUrl not defined)
2013-10-03 15:28:51 +02:00
Mikael Nordfeldth 39f43e415d Do not name anything getOriginal (because DB_DataObject calls that)
Avatar->getOriginal has been renamed getUploaded
Notice->getOriginal has been renamed getParent
2013-10-02 15:01:11 +02:00
Mikael Nordfeldth 7979918ba9 Various minor Avatar fixes, but pretty necessary.
One typing thing. And a missed exception case.

Get src from displayUrl() instead of url for example.
2013-10-02 14:49:01 +02:00
Mikael Nordfeldth b0dfc70a54 Properly unlink all old avatars when deleting/uploading a new
We're also now using $config['image']['jpegquality'] to determine the
quality setting for resized images.

To set Avatar max size, adjust $config['avatar']['maxsize']

The getAvatar call now throws exceptions too. Related changes applied.
Now let's move Profile->avatarUrl to the Avatar class!
2013-10-01 17:00:10 +02:00
Mikael Nordfeldth a23c4aa236 Avatar resizing improvements and better code reuse
* getOriginal added to Avatar class
    This is a static function that retrieves the original avatar in a leaner
    way than Profile->getOriginalAvatar() did (see below).
    This will throw an Exception if there was none to be found.

* getProfileAvatars added to Avatar class
    This gets all Avatars from a profile and returns them in an array.

* newSize added to Avatar class
    This will scale an original avatar or throw an Exception (originally from
    Avatar::getOriginal) if one wasn't found.

* deleteFromProfile added to Avatar class
    Deletes all avatars for a Profile. This makes the code much smarter when
    removing all avatars from a user.
    Previously only specific, hardcoded (through constants) sizes would be
    deleted. If you ever changed lib/framework.php then many oddsized avatars
    would remain with the old method.

* Migrated Profile class to new Avatar::getOriginal support
    Profile class now uses Avatar::getOriginal through its own
    $this->getOriginalAvatar and thus remains backwards compatible.

* Updating stock GNU Social to use Avatar::getOriginal
    All places where core StatusNet code used the
    $profile->getOriginalAvatar, it will now useAvatar::getOriginal with
    proper error handling.

* Updated Profile class to use Avatar::newSize
    When doing setOriginal, the scaling will be done with the new method
    introduced in this merge.
    This also edits the _fillAvatar function to avoid adding NULL values to
    the array (which causes errors when attempting to access array entries as
    objects). See issue #3478 at http://status.net/open-source/issues/3478
2013-09-30 22:23:03 +02:00
Mikael Nordfeldth fac7371179 pivotGet moved into Managed_DataObject 2013-08-29 10:13:07 +02:00
Mikael Nordfeldth 861e838add pkeyGet is now static and more similar to getKV
Memcached_DataObject now defines
   * pkeyGetClass to avoid collision with Managed_DataObject pkeyGet
   * getClassKV to avoid collision with Managed_DataObject getKV
2013-08-18 15:42:51 +02:00
Mikael Nordfeldth 1a9a8ea730 staticGet for sub-Managed_DataObject classes now calls parent
The parent class for our database objects, Managed_DataObject, has a
dynamically assigned class in staticGet which objects get put into,
leaving us with less code to do the same thing.

We will probably have to move away from the DB_DataObject 'staticGet'
call as it is nowadays deprecated.
2013-08-12 19:46:44 +02:00
Evan Prodromou 9ca3c3d1c3 move core schema to class files 2011-08-22 17:52:02 -04:00
Evan Prodromou 06e2422517 pre-fill avatars for Profiles in a notice list 2011-08-02 11:54:27 -04:00
Evan Prodromou 21c16b2e92 don't show display URL if avatar filename is missing 2011-04-18 16:59:17 -04:00
Evan Prodromou 83fb5e6023 Mass replacement of #-comments with //-comments
like leprous boils in our code. So, I've replaced all of them with //
comments instead. It's a massive, meaningless, and potentially buggy
change -- great one for the middle of a release cycle, eh?
2011-03-22 11:54:23 -04:00
Siebrand Mazeland b03ece26eb * i18n/L10n and translator documentation updates.
* whitespace and indentation updates
2010-09-28 23:21:09 +02:00
Evan Prodromou d6869cde7b let avatars be served over SSL 2010-02-11 16:51:15 -05:00
Brion Vibber 4e2acd153b ...and drop the unnecessary &reference from child class pkeyGet() overrides. 2010-01-06 14:28:40 -08:00
Zach Copley c0190af982 Remove annoying log msg 2009-11-25 19:23:33 +00:00
Evan Prodromou b7e2e3fd2b Restructure theme.php to define a class Theme
For various reasons, it's nicer to have a class for theme-file paths
and such. So, I've rewritten the code for determining the locations of
theme files to be more OOPy.

I changed all the uses of the two functions in the module (theme_file
and theme_path) to use Theme::file and Theme::path respectively.

I've also removed the code in common.php that require's the module;
using a class means we can autoload it instead.
2009-11-08 17:04:46 -05:00
Zach Copley 0fd8e758ad Make queuing and daemons work via events 2009-10-14 04:50:16 +00:00
Evan Prodromou c077ad0775 Configurable avatar directory
Avatar directory and path are configurable.
2009-06-15 10:45:50 -07:00
Evan Prodromou 5cdead72cd Fix name of default avatar 2009-02-06 04:03:03 -05:00
Evan Prodromou 343cd6f205 Move common_avatar_* functions to Avatar
Moved the common_avatar_* functions to the Avatar class. Typically
either as methods on the object or as static methods. Replaced all the
uses of the functions in other modules.
2009-02-06 03:55:48 -05:00
Sean Murphy 7e975b17c5 Fixed #1134; Consolidated image scaling functions. 2009-02-04 19:32:15 -05:00
Zach Copley 5e061d2060 Some fixups of patches not already migrated to trunk to bring inline with PEAR coding stds
darcs-hash:20081225144601-7b5ce-4846f3d036c36037836d15ed672c10ba33f9f84c.gz
2008-12-25 09:46:01 -05:00
Zach Copley 6b51941056 Actually crop your avatar when hitting 'crop' button on profile
darcs-hash:20081212043018-7b5ce-bc83b66e19007aa0a04fbb40053217ef92c44779.gz
2008-12-11 23:30:18 -05:00
Evan Prodromou 04ef1ba8ee change function headers to K&R style
Another huge change, for PEAR code standards compliance. Function
headers have to be in K&R style (opening brace on its own line),
instead of having the opening brace on the same line as the function
and parameters. So, a little perl magic found all the function
definitions and move the opening brace to the next line (properly
indented... usually).

darcs-hash:20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz
2008-12-23 14:33:23 -05:00
Evan Prodromou eb2f9c98ac replace NULL with null
Another global search-and-replace update. Here, I've replaced the PHP
keyword 'NULL' with its lowercase version. This is another PEAR code
standards change.

darcs-hash:20081223192129-84dde-4a0182e0ec16a01ad88745ad3e08f7cb501aee0b.gz
2008-12-23 14:21:29 -05:00
Evan Prodromou edbc0c665c replace all tabs with four spaces
The PEAR coding standards decree: no tabs, but indent by four spaces.
I've done a global search-and-replace on all tabs, replacing them by
four spaces. This is a huge change, but it will go a long way to
getting us towards phpcs-compliance. And that means better code
readability, and that means more participation.

darcs-hash:20081223191907-84dde-21e8efe210e6d5d54e935a22d0cee5c7bbfc007d.gz
2008-12-23 14:19:07 -05:00
millette f9c88fe09c trac768 keep transparency of resized avatar images.
darcs-hash:20081204182953-099f7-b47315607d937da4d648b200a733c715a97d9bc2.gz
2008-12-04 13:29:53 -05:00
Evan Prodromou c8392ed58d use pkeyGet for Avatar
darcs-hash:20081002144749-5ed1f-a5503625b811f28a853712d4ddd4a76813f24bc1.gz
2008-10-02 10:47:49 -04:00
Evan Prodromou 8da61dc1d3 path correct in require_once for memcached
darcs-hash:20080926161824-5ed1f-b4fb53e5ca65bb099aabbba6ea60a13496f669a2.gz
2008-09-26 12:18:24 -04:00
Evan Prodromou f6615f70e5 prepend Memcached_DataObject require with INSTALLDIR
darcs-hash:20080926161540-5ed1f-2e9dc6f2297c612208214a6d52f36ce0dd7aa4de.gz
2008-09-26 12:15:40 -04:00