Commit Graph

65 Commits

Author SHA1 Message Date
Diogo Cordeiro
02055dee49 [AVATAR] Temporary ImageFile wasn't 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
44ad0d3a85 [AVATAR] Try to delete tmp avatar if something goes wrong during the process 2021-07-16 19:44:37 +01:00
Diogo Cordeiro
5439ff3ec5 [MEDIA] ImageFile fromUpload method wasn't ensuring uploaded file was an image 2021-07-16 19:44:37 +01:00
Chimo
c81322d51a WIP: Display error if wrong perms on 'avatar' dir
If the 'avatar' folder isn't writeable, don't let users try to
upload/delete one (and fail). Instead, print an error message about
the misconfigured folder permission.

Ref. #196
2016-06-04 11:08:32 -04:00
Mikael Nordfeldth
bf34f730dd Use $this->scoped in AvatarsettingsAction 2016-03-05 01:03:48 +01:00
Mikael Nordfeldth
fd2efbc6f8 AvatarSettings more aligned to FormAction
TODO: Make classes called AvatarCropForm and AvatarUploadForm
2015-07-16 19:21:12 +02:00
Mikael Nordfeldth
3ee673ac91 ImageFile->resize now totally replaced with resizeTo 2015-03-12 20:47:07 +01:00
Mikael Nordfeldth
2a32af084f ImageFile $id argument is only for File objects
Remember to eliminate the Avatar/group logo call to ImageFile->resize!
2015-03-11 00:20:48 +01:00
Mikael Nordfeldth
79824a3625 Could not update avatar due to Bad Thumbnail parameters 2014-06-17 12:48:10 +02:00
Mikael Nordfeldth
7f3611c51c use intval() instead of floor() for int return type 2014-04-21 19:32:08 +02:00
Mikael Nordfeldth
c00491cd7a Cosmetic changes to common_redirect, clientError, serverError
Since these functions exit (or throw exception) after running, there
is no need to have a 'return' statement or similar afterwards.
2014-03-10 00:25:57 +01:00
Mikael Nordfeldth
fcba540a14 Removed legacy OMB. Use OStatus for remote profiles. 2013-10-28 16:22:09 +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
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
31bace8cfd updated and moved jquery-jcrop (no longer .min.js)
This won't run properly if other scripts stop javascript execution before
it's time to crop (such as in the Bookmark plugin, which when writing this
hasn't been migrated to Jquery 2.x - so it stops on a '.die' call).

Some images were cleaned up from the theme/base/images/illustrations too.
2013-09-14 13:31:16 +02:00
Siebrand Mazeland
a2e4a1803c Harmonize message for 'User has no profile.' and update translator documentation. 2011-04-25 22:44:19 +02:00
Evan Prodromou
c7a4aaddfc show correct preview URL and hide delete button if avatar is not local 2011-04-14 11:47:55 -04:00
Siebrand Mazeland
9a6ee5e859 Update translator documentation. 2011-04-03 23:47:46 +02:00
Zach Copley
b7d0746694 Merge branch '0.9.x' into 1.0.x
Conflicts:
	actions/confirmaddress.php
	actions/emailsettings.php
	actions/hostmeta.php
	actions/imsettings.php
	actions/login.php
	actions/profilesettings.php
	actions/showgroup.php
	actions/smssettings.php
	actions/urlsettings.php
	actions/userauthorization.php
	actions/userdesignsettings.php
	classes/Memcached_DataObject.php
	index.php
	lib/accountsettingsaction.php
	lib/action.php
	lib/common.php
	lib/connectsettingsaction.php
	lib/designsettings.php
	lib/personalgroupnav.php
	lib/profileaction.php
	lib/userprofile.php
	plugins/ClientSideShorten/ClientSideShortenPlugin.php
	plugins/Facebook/FBConnectSettings.php
	plugins/Facebook/FacebookPlugin.php
	plugins/NewMenu/NewMenuPlugin.php
	plugins/NewMenu/newmenu.css
2011-02-28 15:39:43 -08:00
Siebrand Mazeland
a159352b65 * improve L10n consistency for English. For example proper punctuation for all button and label titles.
* fix some i18n bugs (in-message variables).
* update/add translator documentation.
* remove superfluous whitespace.
2011-02-17 00:40:47 +01:00
Brion Vibber
54e98ffe22 Fix ticket #3013: MAX_FILE_SIZE hidden fields were incorrectly placed
In order to apply to PHP's POST processing, the MAX_FILE_SIZE field must appear *before* the file upload field. They were incorrectly placed after, where they had no effect on POST processing.
2011-01-26 15:49:57 -08:00
Brion Vibber
820dd293c9 Fix for ticket #3007: .bmp avatar uploads weren't being properly converted to PNG in all cases
Part of the reported issue was previuosly fixed by dc497ed0 (smaller size images being blanked).
This commit fixes the remaining bug with original-size avatars being left as BMP (which could include the 96px size for instance, which could cause problems in browsers not supporting BMP natively)

Added ImageFile::copyTo() as a convenient alias for resizeTo() when not resizing; this performs the BMP/XPM/XBM->PNG conversion if needed, or copies the original file.
Copying instead of using move_uploaded_file() is fine here since:
a) the files are cleaned up on script completion anyway (vs moving to remove it)
b) we're already performing getimagesize() and possibly load/resize on the file before this point (vs needing to move the file into a usable area to work with open_basedir restrictions that prevent working directly with uploaded files in the temp dir; since this would fail anyway, we lose nothing)

ImageFile::preferredType() now works on $this->type instead of asking for one, to make it handier to use from outside. (This is still needed in order for calling code to generate a target filename.)

Recommended for future:
* additional consolidation between the various ways of uploading avatars (touched avatarsettings, grouplogo, and apiaccountupdateprofileimage with similar minor changes)
* consolidate type checks and file naming into Avatar class
2011-01-24 12:22:47 -08:00
Evan Prodromou
592e2be5e1 Make new menu the default menu
There's a new menu layout in this version of the software. It was
implemented as a plugin in 0.9.x to avoid clashes with existing themes,
but we're going to break that compatibility in this version, so we're just going for it.

This change involved moving all the changes in NewMenuPlugin into the
default code that was calling it. In addition, since
accountsettingsaction and connectsettingsaction differed only by menu,
I removed them, changed all references to them to the settingsmenu, and moved
the combined nav to its own class.

Let's put that episode behind us.

The CSS shim that was loaded by NewMenuPlugin for certain themes and certain actions
was removed.
2011-01-23 12:35:35 -05:00
Siebrand Mazeland
1c0e84f066 Add forgotten translator documentation. 2010-10-31 01:26:39 +02:00
Siebrand Mazeland
08edd1fedf * i18n/L10n updates.
* translator documentation added/updated.
* superfluous whitespace removed.
2010-10-31 00:58:35 +02:00
Siebrand Mazeland
cb74822e7a i18n/L10n consistency updates. 2010-10-21 13:20:21 +02:00
Siebrand Mazeland
47eed2c999 Update message formatting for serverError to use a starting capital and a leading period. 2010-04-10 00:07:20 +02:00
Brion Vibber
01a1e882af Handle "forgot to upload an avatar on avatarsettings" a little more gracefully. 2010-03-18 17:18:01 -07:00
Evan Prodromou
c52951cef5 Optionally set a separate Javascript server and path
We have about 10-12 JavaScript pages per Web page. They usually
are based on the same server as the Web pages, but since they're
static files, it makes sense to offload them to a lite server that
handles static files well.

This commit lets you set a separate Javascript server and path for the
default Javascript code in StatusNet.

Squashed commit of the following:

commit 139d1622fdafe5ad00c820224416d9021efc3234
Author: Evan Prodromou <evan@status.net>
Date:   Wed Jan 27 11:30:24 2010 -0500

    modules that call htmloutputter::script() don't prescribe js/ path

commit c6ca3174af73efed55eaed5ff1e2a3bdc77d2d87
Author: Evan Prodromou <evan@status.net>
Date:   Wed Jan 27 11:28:07 2010 -0500

    configurable server and path for javascript files
2010-01-27 11:37:22 -05:00
Eric Helgeson
4db184e5b4 New Events for avatar settings 2009-12-09 22:31:07 -05:00
Zach Copley
b522c401e6 Better workaround for PHP returning empty $_POST and $_FILES when
POST length > post_max_size in php.ini. I also added this check to
avatar upload, which was failing with huge files.
2009-11-06 17:21:08 -08:00
Craig Andrews
29d937d04e Check if the avatar exists before trying to delete it.
Fixes http://status.net/trac/ticket/1868
2009-09-12 17:11:55 -04:00
Sarven Capadisli
277b464054 Created autofocus method to give focus to an element (primarily a form
control) on page onload.

Updated some of the pages to use autofocus.
2009-09-03 19:42:50 +00:00
Evan Prodromou
df86aa7214 define LACONICA and accept LACONICA for backwards compatibility 2009-08-26 10:41:36 -04:00
Evan Prodromou
865b716f09 change LACONICA to STATUSNET 2009-08-25 18:42:34 -04:00
Evan Prodromou
ae883ceb9b change controlyourself.ca to status.net 2009-08-25 18:19:04 -04:00
Evan Prodromou
d35b2d3f3c change laconi.ca to status.net 2009-08-25 18:16:46 -04:00
Evan Prodromou
c8b8f07af1 change Laconica and Control Yourself to StatusNet in PHP files 2009-08-25 18:12:20 -04:00
Jeffery To
a459313e10 Updated Jcrop to 0.9.8 (avatar cropping wasn't working in IE7 with 0.9.5) 2009-08-11 20:29:45 +08:00
Craig Andrews
304db1d30b Use script() and cssLink() methods everywhere instead of manually writing out javascript and css each time 2009-08-05 19:45:12 -04:00
Sarven Capadisli
64e4b8a20f Updated remaining files and styles for style separation for themes 2009-04-14 23:32:09 +00:00
Sarven Capadisli
4a8c23fe32 Updated path for jCrop 2009-04-13 03:49:37 +00:00
Sarven Capadisli
dcdf47cff2 Avatar crop fix for shrinking/stretching of images when user doesn't
scale it with the Jcrop tool (but hits Crop). This will use the lower
value from width/height.
2009-03-04 05:11:18 +00:00
Adrian Lang
a90a8da5c3 Broadcast profile via OMB after avatar change. 2009-02-27 15:41:23 -08:00
Sean Murphy
55fcc150fe Fixed #1025: Delete avatar option. 2009-02-09 20:17:56 -05:00
Evan Prodromou
fc094e0cf4 fix formatting of new Avatar:: calls 2009-02-06 03:55:53 -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