674 Commits

Author SHA1 Message Date
Diogo Cordeiro
ea647d80ee [VersionBump] Patch e2e3c1cdcd 2020-06-11 21:52:18 +01:00
Alexei Sorokin
e2e3c1cdcd [CORE] Another fix for the inboxnoticestream query 2020-06-10 13:28:33 +03:00
Diogo Cordeiro
d705bcbd98 [CORE] Use random_bytes() if available and improve common_confirmation_code() randomness.
With PHP 7 comes the [random_bytes()](https://php.net/manual/en/function.random-bytes.php) and the [random_int()](https://www.php.net/manual/en/function.random-int.php) function which generates cryptographically secure pseudo-random bytes and integers, respectively.
2019-08-03 17:29:14 +01:00
Diogo Cordeiro
f0f5ecb756 [SCRIPTS] Fix sessiongc by XRevan86 2019-08-01 14:38:04 +01:00
Diogo Cordeiro
c0342b1482 [DOCUMENTATION] Allow install.php to be ran with sample nginx conf 2019-08-01 14:37:59 +01:00
Diogo Cordeiro
d1fc7c0774 [CORE] MySQL 5.5 support fully restored 2019-07-25 15:35:24 +01:00
Diogo Cordeiro
46be9b76ef [CORE] Fix wrong Profile_list schema and set created in user_im_prefs properly - by XRevan86
This reverts 496ab8c9, which was a bad correction of user_im_prefs values
2019-07-24 22:28:06 +01:00
Diogo Cordeiro
6c8d2e159e [DOCUMENTATION] Plugin events should be declared in the plugin's directory not in the core 2019-07-15 03:25:16 +01:00
Diogo Cordeiro
db9bb6b5a1 [OStatus] null being returned instead of an empty array
Fixes: "Invalid argument supplied for foreach" in onEndFindMentions
2019-07-10 00:34:46 +01:00
Diogo Cordeiro
5ea0d74a57 [UI] Long strings/words in dents weren't being wrapped 2019-07-10 00:33:19 +01:00
Diogo Cordeiro
30a1a460b7 Minor reformatting of upgrade.php, doesn't change functionality 2019-07-01 23:14:39 +01:00
Diogo Cordeiro
5eb61c17d4 Regression introduced in daa5f87f fixed by XRevan86
require_once(): Failed opening required 'Error.php' in extlib/DB/DataObject.php on line 562
2019-07-01 23:14:23 +01:00
Diogo Cordeiro
0a4eeb89da [CORE][ROUTER] Fix wrong parameter in all/:tag by XRevan86 2019-07-01 22:40:21 +01:00
Diogo Cordeiro
11dc170ead [CORE][FRAMEWORK] URL_REGEX_VALID_PATH_CHARS didn't recognize the parenthesis sign. 2019-06-26 15:54:51 +01:00
Diogo Cordeiro
98c0c1ed53 Implement $config['site']['logdebug'] 2019-06-25 22:59:10 +01:00
Diogo Cordeiro
83a05724b8 [CORE] Fix subscriptions and subscribers list (related to 44653d339d) 2019-06-24 14:06:43 +01:00
Diogo Cordeiro
44653d339d [Poll] Refactoring and minor bug fixes 2019-06-23 23:06:04 +01:00
Diogo Cordeiro
f2705180e0 [TagSub] Fix User's tags list issue
Issue introduced with 6d9f390b and 9a92b58057
2019-06-18 14:56:55 +01:00
Diogo Cordeiro
306d80de94 [DATABASE] Revert accidental regression introduced with 9a39ebe66f 2019-06-14 12:00:10 +01:00
Diogo Cordeiro
2740ff8c4c [DOCUMENTATION] Minor corrections
Add two missing contributors
Bumped patch due to changed introduced with 0583a6a904
2019-06-12 12:55:42 +01:00
Daniel Supernault
74ad4038ac Allow username or email in login form 2019-06-12 03:25:06 +01:00
Diogo Cordeiro
3f8593268e [Nodeinfo][TRANSLATION] Fix languages meta-data 2019-06-12 03:25:02 +01:00
Diogo Cordeiro
8ea83aac48 [OStatus] Wrong exception was being caught 2019-06-12 02:20:58 +01:00
Diogo Cordeiro
81d65afb28 [RELEASE] The Invicta Crusade 2019-06-11 18:37:25 +01:00
Diogo Cordeiro
c93547b080 [OpenID] Added support for GS's Internal Session Handler 2019-06-10 16:49:48 +01:00
Diogo Cordeiro
54f75683c7 [OpenID] s/sync/synch
This commit also fixes the translation in /plugins/OpenID/actions/finishopenidlogin.php#L203-L204 (s/Syncronize/Synchronize)
Sync is a bad technical jargon and we should use Synch instead.
Synch is already used in other parts of GNU social as seen in plugins/TwitterBridge/classes/Twitter_synch_status.php
2019-06-10 15:51:56 +01:00
Diogo Cordeiro
abfd691fda Merge branch 'nightly' of biodantas/gnu-social into nightly 2019-06-09 23:44:43 +00:00
Miguel Dantas
20c73f0596 [FORMATING] Ran php-cs-fixer on lib/mediafile.php, lib/imagefile.php and classes/File.php 2019-06-10 00:38:16 +01:00
Miguel Dantas
b224d93098 [MEDIA] ImageFile now extends MediaFile and validates images more aggressively.
Default supported files need to use consistent names. Bumped version to 1.20.0

ImageFile has been changed to extend MediaFile and rely on it to partially
validate files. This validation has been extended to not rely solely on
Fileinfo, as it is disabled on some places. Now it'll try to use the shell
command `file`, if Fileinfo isn't available.

ImageFile now converts every new upload to PNG, except JPEG and GIF, which
are kept, but still resized (to the same size), to remove possible scripts
embedded therein.

MediaFile::fromUpload will return an ImageFile if the uploaded file is an image
or a MediaFile otherwise.

MediaFile can be constructed with an id with value -1 to denote a temporary
object, which is not added to the DB. This is useful to create a temporary
object for representing images, so it can be used to rescale them.

The supported attachment array needs to be populated with the result of calling
`image_type_to_extension` for the appropriate image type, in the case of images.
This is important so all parts of the code see the same extension for each image
type (jpg vs jpeg).

Added documentation to classes/File.php and to lib/MediaFile and lib/ImageFile
2019-06-10 00:35:53 +01:00
Diogo Cordeiro
719bf065ca Merge branch 'nightly' of tenma/gnu-social into nightly 2019-06-09 17:16:01 +00:00
brunoccast
a1041a53f7 [THEME] Fix OpenID settings styles
- Action buttons are now side-by-side
- Dropped unused style rule concerning the solo-positioning of the Remove button
- Bump GS patch version
2019-06-09 18:13:04 +01:00
Diogo Cordeiro
711badb6b4 Merge branch 'openid-settings-sync' of tenma/gnu-social into nightly 2019-06-09 16:05:12 +00:00
brunoccast
1e4063254b [OpenID] Added synchronization button and corresponding action
UI:
- "Delete" area is now "Actions" area
- Updated themes to better reflect the changes

Routes:
- index.php?action=finishsyncopenid => finishsyncopenid

Translations:
- Updated OpenID translation files
- Updated OpenID POT file

Versioning:
- Bump OpenID minor version
- Bump GS patch version

Why would have labeling the Synchronize button of Sync been of bad taste? - answered by XRevan86:

In "synchronise" "ch" is a digraph meaning /k/ (actually /x/ turned into /k/ in English but whatever).
So… not separate letters.
It's like "ph" in "alphabet", or "sh" in "sheep", or "ch" in "chop" -- "ch" can mean a whole variety of sounds.
2019-06-09 17:04:26 +01:00
brunoccast
b8352e912f [THEME] Fix styles identation 2019-06-09 17:00:06 +01:00
brunoccast
69a1d77480 [OpenID] Add sync confirmation in both OpenID settings and login connection 2019-06-09 17:00:06 +01:00
Diogo Cordeiro
54d7a7cccd Merge branch 'fix-plugins-copyright' of tenma/gnu-social into nightly 2019-06-09 15:35:20 +00:00
brunoccast
c7afe2f86c [TRANSLATION] Update Plugin POs 2019-06-09 16:10:03 +01:00
Diogo Cordeiro
5f4e3fe0eb [TRANSLATION] Update POTs and normalize files 2019-06-08 18:41:10 +01:00
Miguel Dantas
fb95af1cf5 Added Spanish, Polish and Esperanto translations to NodeInfo plugin 2019-06-08 18:36:04 +01:00
brunoccast
7b73d267d5 [TRANSLATION] Update license and copyright notice in translation files 2019-06-08 18:36:04 +01:00
Diogo Cordeiro
08b6cfde66 [SESSION] Add backwards compatibility for third party plugins depending on old Session::cleanup()
Namely Qvitter
2019-06-08 00:31:32 +01:00
Diogo Cordeiro
2110c20ecc [DOCUMENTATION] README.md should mention about the importance of running upgrade.php script 2019-06-07 16:42:50 +01:00
Diogo Cordeiro
9f51692f26 [NGINX conf] Move /var/run to /run
As seen in https://lists.fedoraproject.org/pipermail/devel/2011-March/150031.html
Thanks to XRevan86 for reporting this :)
2019-06-07 15:02:10 +01:00
Diogo Cordeiro
02c67fd114 [Nodeinfo][DATABASE][Usage_stats] Fix wrong type for modified column 2019-06-07 15:02:10 +01:00
Diogo Cordeiro
b6be1a3659 [DATABASE][User_openid_prefs] Fix wrong type for modified column
Patch submited by Sorokin Alexei (XRevan86)
2019-06-07 15:02:09 +01:00
brunoccast
00b4a084ad PSR2-format 2019-06-07 15:02:09 +01:00
brunoccast
061e7891e9 Cleanup and documentation of common_ensure_session
- Remove redundant branch
- Remove error suppression of session_start()
2019-06-07 15:02:09 +01:00
Diogo Cordeiro
a1af5562de EmailRegistration plugin flow requires a confirmation address before user creation 2019-06-07 15:02:09 +01:00
Diogo Cordeiro
df84ccd916 Nodeinfo has a special rule for upgrades 2019-06-07 15:02:08 +01:00
Diogo Cordeiro
2f118fde9e Update /main/version information 2019-06-07 15:02:08 +01:00
Diogo Cordeiro
46f98b3142 [VersionBump] 1.19.0, fairly late
The core plugins whose version was attached to GS's were reseted to 2.0.0.

2.0.0 was chosen as reset version for plugins because it is higher than
  the one that was set by inheriting GS version. Furthermore, it's a
  major change from prior plugin versioning system thus it also makes
  semantic sense.

Justification for version bump:

== GS ==
9a4ab31f26 1.19.0
c13b935201 1.18.3
c13b935201 1.18.2
18fc39d2cf 1.18.1
c083a8bcc2 1.18.0
e8783d46d0 1.17.1
d9a42550ff 1.17.0
1536d3ef29 1.16.0
c03ed457a6 1.15.0
d2e6519bad 1.14.2
fe411e8138 1.14.1
b17e0b4169 1.14.0
daa5f87fd4 1.13.0
d75b5d2f4a 1.11.7
f6dbf66983 1.11.6
6cf674f8f8 1.11.5
7845a09b34 1.11.4
e4d432295d 1.11.3
339204f1ee 1.11.2
a4e679a118 1.11.1
7967db6ff5 1.11.0
bc030da320 1.10.1
9cc7df51d6 1.10.0
bf7f17474d 1.9.2
8a07edec5f 1.9.1
0042971d74 1.9.0
6b5450b7e6 1.8.0
5dcc98d1c6 1.7.0
e6667db0cd 1.6.0
3290227b50 1.5.0
a59c439b46 1.4.0
496ab8c920 1.3.10
986030060b 1.3.9
1d529c021a 1.3.8
f89c052cf8 1.3.7
38f2ecefac 1.3.6
e473937cb9 1.3.5
9a39ebe66f 1.3.4
ddc3cecfc0 1.3.3
2b43d484eb 1.3.2
e8e487187e 1.3.1

== Plugins ==
XMPP plugin
e0887220b0 bump patch
e186ad57d0 bump patch

OStatus
e186ad57d0 bump patch

Nodeinfo
ceae66a30f bump minor
586fb5a517 bump major
195296846e bump minor
2019-06-07 15:02:08 +01:00
Diogo Cordeiro
72ee098e0b [DOCUMENTATION] EVENTS.txt: Add Nodeinfo plugin event 2019-06-07 15:02:07 +01:00
brunoccast
43df2d201c Extend Action with redirect after login logic, update some actions to use it 2019-06-07 15:02:07 +01:00
brunoccast
691df04103 PSR2-format 2019-06-07 15:02:07 +01:00
Diogo Cordeiro
ab24f59660 [DOCUMENTATION] Add CONTRIBUTING information for developers
Inspired both from GNU FM, postActiv and Moodle
2019-06-07 15:02:00 +01:00
Diogo Cordeiro
3886db64bc [DOCUMENTATION] Update README.md 2019-06-05 22:48:29 +01:00
Diogo Cordeiro
e7a875755d [DOCUMENTATION] Move CREDITS to its own file and update list from postActiv 2019-06-05 22:48:29 +01:00
Diogo Cordeiro
7cf4e1bb09 [DOCUMENTATION] Convert INSTALL to markdown and update the requirements 2019-06-05 22:48:28 +01:00
Diogo Cordeiro
eaea9d48c5 [DOCUMENTATION] Convert Configure to markdown, format and improve it by maiyannah and Normandy 2019-06-05 22:48:28 +01:00
Diogo Cordeiro
2e9fa8f4b7 [DOCUMENTATION] Reorganize documentation 2019-06-05 22:48:28 +01:00
Diogo Cordeiro
d7d63e1464 [NGINX conf] Stop serving files as indexAphp, index:php
Removed some boilerplate and overly specific configuration
2019-06-05 22:48:21 +01:00
Diogo Cordeiro
bb175f3d4e [NGINX conf] Fix PHP files being served as files. 2019-05-31 10:00:57 +01:00
Diogo Cordeiro
4ca32628f7 [SESSION] Log messages were a bit confusing
Reported by XRevan86
2019-05-26 20:14:05 +01:00
Diogo Cordeiro
6b4beb90e1 Merge branch 'master' of postblue/gnu-social into master 2019-05-26 19:12:29 +00:00
Guillaume Hayot
d7adc4e13f Changing URI to community plugins page 2019-05-26 20:40:36 +02:00
Guillaume Hayot
c13b935201 Removing community plugins 2019-05-26 20:34:47 +02:00
Diogo Cordeiro
18fc39d2cf Fix noticesearch tag regex 2019-05-22 22:29:33 +01:00
Diogo Cordeiro
c083a8bcc2 [SESSION] Implement SessionHandlerInterface instead of setting custom handlers by XRevan86 2019-05-22 22:29:33 +01:00
Diogo Cordeiro
e8783d46d0 [SESSION] Increase type strictness for full PHP adherence
Documented this file (adapted from maiyannah's postActiv doc)
This commit also fixes PHP Warning:  session_write_close(): Session callback expects true/false return value in classes/Session.php on line 289 (spoted by XRevan86)
Observation: In a newer release we will be replacing this kind of castings with actual explicit PHP7 return types
2019-05-22 22:29:26 +01:00
Diogo Cordeiro
d9a42550ff is_rtl should handle lang instead of code 2019-05-16 22:51:11 +01:00
Diogo Cordeiro
ceae66a30f [Nodeinfo] Fix twitterimport enabled check 2019-05-11 20:52:02 +01:00
Diogo Cordeiro
031a491abd Improved version of nginx sample config by XRevan86 2019-05-11 20:50:08 +01:00
Diogo Cordeiro
1536d3ef29 [XML/HTML Outputter] General improvements and refactoring as well as some bug fixes 2019-05-07 15:57:19 +01:00
Diogo Cordeiro
c03ed457a6 Fix broken user activitystreams feed due to deleted notices 2019-05-06 23:27:38 +01:00
Diogo Cordeiro
d2e6519bad lib/ping.php - Fix PHP 7.3 Warning switch continue -> break 2019-05-06 23:27:38 +01:00
Diogo Cordeiro
688fa4839c [Nodeinfo] Correct HELP info on fix_stats.php 2019-05-06 23:27:38 +01:00
Diogo Cordeiro
fe411e8138 Fix some typos/small obvious bugs on twitterRssGroupArray 2019-05-03 17:09:23 +01:00
Diogo Cordeiro
515682c0cd Merge branch 'ATOM-priority" from Alexandre Alapetite into HEAD
source: https://git.gnu.io/gnu/gnu-social/merge_requests/174
2019-05-03 13:30:20 +01:00
Diogo Cordeiro
b17e0b4169 Update PEAR to v1.10.9 and patch it so it works quietly 2019-04-28 23:39:36 +01:00
Diogo Cordeiro
daa5f87fd4 Ugly patch to maintain old DB handle code working quietly
We have to replace this database engine with a modern one
2019-04-27 18:23:51 +01:00
Diogo Cordeiro
d75b5d2f4a Make group edit and logo great again by XRevan86 2019-04-27 17:39:42 +01:00
Diogo Cordeiro
f6dbf66983 Undefined user in passwordsettings by XRevan86 2019-04-27 15:15:11 +01:00
Diogo Cordeiro
6cf674f8f8 Some minor refactoring on session handler 2019-04-27 00:28:05 +01:00
Diogo Cordeiro
7845a09b34 RSVP asHTML throws a pretty exception that should go out of the div, by XRevan86 2019-04-26 23:08:16 +01:00
Diogo Cordeiro
e4d432295d Only variables should be assigned by reference
caught by XRevan86
2019-04-26 23:03:37 +01:00
Diogo Cordeiro
339204f1ee Fix negative one subscriptions by XRevan86
Only local users are subscribed to themselves.
2019-04-26 01:10:53 +01:00
Diogo Cordeiro
a4e679a118 Add Registration form hook points by XRevan86 2019-04-26 00:59:38 +01:00
Diogo Cordeiro
195296846e Add russian translation to NodeInfo plugin by XRevan86 2019-04-26 00:43:58 +01:00
Diogo Cordeiro
7967db6ff5 Various obvious bug fixes and better PHP 7 support
Many of these came from a XRevan86 patch
2019-04-26 00:34:17 +01:00
Diogo Cordeiro
c4f962a7d0 Fix wrong path on Realtime cleanupchannels script by XRevan86 2019-04-25 23:12:58 +01:00
Diogo Cordeiro
bc030da320 Fix undefined variables on Favorite plugin by XRevan86 2019-04-25 23:12:58 +01:00
Diogo Cordeiro
9cc7df51d6 Some obvious bug fixes for i18n 2019-04-25 23:12:46 +01:00
Diogo Cordeiro
bf7f17474d When an attachment fails to load, it shouldn't destroy the whole layout by XRevan86 2019-04-25 20:46:47 +01:00
Diogo Cordeiro
8a07edec5f Fix fulltext search by XRevan86 2019-04-25 19:32:20 +01:00
Diogo Cordeiro
0042971d74 Fix bug in 36a55d84.
We still have to further review and improve the caching of streams.
Important related changes: 2272cc24#diff-8633314d55a2834ab2ea425d7157bec14aca672L60
Important related discussion: https://github.com/chimo/gs-rediscache/issues/{1,2}
2019-04-25 18:51:44 +01:00
Diogo Cordeiro
6b5450b7e6 Faster inboxnoticestream.php by XRevan86.
This commit consequently reverts 5dcc98d1c6 and a59c439b46. This translated the php based version into a faster SQL query.
2019-04-25 18:48:53 +01:00
Diogo Cordeiro
5dcc98d1c6 inboxnoticestream.php gotta go fast 2019-04-23 23:10:43 +01:00
Diogo Cordeiro
fc4aa470b2 StoreRemoteMedia - removeRemoteMedia script - Add missing newline in bad limit error 2019-04-23 22:11:29 +01:00
Diogo Cordeiro
586fb5a517 Faster NodeInfo stats 2019-04-22 20:03:28 +01:00
Diogo Cordeiro
e186ad57d0 OStatus and XMPP plugins now inform Nodeinfo plugins about their activity 2019-04-22 07:28:45 +01:00
Diogo Cordeiro
e6667db0cd Add chimo's Nodeinfo plugin as a default GNU social plugin 2019-04-22 06:50:28 +01:00
Diogo Cordeiro
e0887220b0 XmppPlugin - Fix preg_match() - Compilation failed
Disallowed Unicodecode point (>= 0xd800 && <= 0xdfff)
2019-04-21 17:13:07 +01:00
Diogo Cordeiro
3290227b50 Modern version of XMPPHP extlib
Original XMPPHP is no longer maintained
Therefore I've done some optimizations and imported some commits from birkner and zorn-v forks.
None of the forks really looked ready to be adopted...
2019-04-21 17:13:07 +01:00
Diogo Cordeiro
a59c439b46 Faster inboxnoticestream.php by XRevan86 2019-04-21 00:56:56 +01:00
Diogo Cordeiro
7b6c887d76 OStatus plugin - Merge some bug fixes by XRevan86 2019-04-20 23:27:46 +01:00
Diogo Cordeiro
25eb06ac46 Remove from .gitignore stuff that should clearly go to developer's global gitignore instead 2019-04-20 01:50:02 +01:00
Diogo Cordeiro
0df8531834 Fix typo on 986030060b 2019-04-19 21:16:42 +01:00
Diogo Cordeiro
496ab8c920 User_im_prefs - Fix wrong schemaDef 2019-04-19 20:54:24 +01:00
Diogo Cordeiro
986030060b XMPPHP - Fix string as array usage errors on PHP 7 2019-04-19 15:56:51 +01:00
Diogo Cordeiro
2d20656e22 [StoreRemoteMedia] script removeRemoteMedia.php was trying to remove already removed files
Sometimes different posts are associated with the same file, that case wasn't considered
Thanks to XRevan86 for spotting this issue.
2019-04-18 01:03:09 +01:00
Diogo Cordeiro
98ebe1f63b [StoreRemoteMedia] script removeRemoteMedia.php was deleting every file posted without being via web interface
Added two more options: delete image-only attachments; delete previews (like oembed thumbs)
Some further minor improvements.
Thanks to colegota for spotting this issue.
2019-04-17 02:05:04 +01:00
Diogo Cordeiro
1d529c021a Updated HTMLPurifier to 4.10.0
Source: http://htmlpurifier.org/releases/htmlpurifier-4.10.0-lite.zip
Release date: 2018-02-22
2019-04-16 01:11:54 +01:00
Diogo Cordeiro
f89c052cf8 Set default value of datetime columns to CURRENT_TIMESTAMP
This resolves an issue with MySQL 5.7 where the default SQL_MODE is set to disallow zero dates (i.e. '0000-00-00 00:00:00')
Fixed thanks to Francis and Normandy from postActiv.
2019-04-16 00:43:17 +01:00
Diogo Cordeiro
38f2ecefac extlib/DB/DataObject - Fix PHP 7.3 Warning switch continue -> break
Also reformatted under PSR norms
2019-04-16 00:20:20 +01:00
Diogo Cordeiro
8305641b20 Update master GS version 2019-04-04 10:12:56 +01:00
Alexandre Alapetite
e473937cb9 Give priority to ATOM to expose WebSub.
Hello,
The ATOM feed contains the hub declaration for WebSub / PubSubHubbub, but the RSS / RDF / JSON versions do not.
Currently, the ATOM version is declared last.
RSS/ATOM clients typically pick whichever version comes first, and will thus not see the WebSub feature.
I therefore suggest putting the ATOM version first, as it is more feature-rich than the other versions.

Clients not compatible with ATOM would not pick it anyway due to the different type attribute.

See same PR for Mastodon: https://github.com/tootsuite/mastodon/pull/9302
and WebSub tester https://websub.rocks/publisher
2018-11-20 22:39:23 +00:00
Diogo Cordeiro
8c9efff1ac Merge branch 'issue-326' into 'master'
Script for removing remote files until a given date

See merge request diogo/gnu-social!5
2018-09-14 21:33:54 +00:00
Diogo Cordeiro
37f8d3bef2 Merge branch 'issue-337' into 'master'
Add option to send email to --all users on sendemail.php script

See merge request diogo/gnu-social!4
2018-09-14 21:33:21 +00:00
Diogo Cordeiro
d1ba0dddec Merge branch 'issue-338' into 'master'
Database fields with timestamp type now allow CURRENT_TIMESTAMP to be set as default value

See merge request diogo/gnu-social!3
2018-09-14 21:30:16 +00:00
Diogo Cordeiro
4a8f330ed2 Merge branch 'issue-323' into 'master'
Add default values for avatar and attachment directories in web installer

See merge request diogo/gnu-social!2
2018-09-14 21:29:32 +00:00
Diogo Cordeiro
63ab20d20b Merge branch 'nightly' into 'master'
GNU social 1.3.0

See merge request diogo/gnu-social!1
2018-09-14 21:27:40 +00:00
Diogo Cordeiro
9a39ebe66f Database fields with timestamp type now allow CURRENT_TIMESTAMP to be set as default value
Add default values to created and modified columns of Profile_list table to fix issue #338
2018-08-25 14:07:52 +01:00
Diogo Cordeiro
ddc3cecfc0 Add default values for avatar and attachment directories in web installer 2018-08-25 14:05:56 +01:00
Diogo Cordeiro
45479c90a3 Add option to send email to --all users on sendemail.php script 2018-08-23 23:48:38 +01:00
Diogo Cordeiro
b3c3af1ef6 Merge branch 'issue-333' into 'nightly'
UserFlag: Pass proper profile to FlaggedProfileListItem

See merge request gnu/gnu-social!168
2018-08-23 21:43:31 +00:00
Chimo
2b43d484eb UserFlag: Pass proper profile to FlaggedProfileListItem
Fixes #333
2018-08-16 19:16:15 -04:00
Diogo Cordeiro
9688a55d56 Merge branch 'nightly' into 'nightly'
Group Members page: Fix typo in groupmembers.php

See merge request gnu/gnu-social!167
2018-08-14 21:18:10 +00:00
Chimo
e8e487187e Group Members page: Fix typo in groupmembers.php
Fixes #332
2018-08-12 18:32:16 -04:00
Diogo Cordeiro
4211206e3b Script for removing remote files until a given date 2018-08-09 17:26:05 +01:00
mmn
ffe14fe5f3 Merge branch 'nightly' into 'nightly'
fixed hard coded twitter char limit

See merge request gnu/gnu-social!154
2017-12-17 17:41:14 +00:00
mmn
c285f80b18 Merge branch 'cas-user-whitelist' into 'nightly'
Added CAS user whitelist feature

See merge request gnu/gnu-social!142
2017-12-17 17:38:21 +00:00
mmn
1e1543dd72 Test if $casSettings['user_whitelist'] is an array - and then perform in_array(...) instead of just checking if it's != null. 2017-12-17 17:37:24 +00:00
mmn
9c0c8a19dd Merge branch 'backupaccount-xml' into 'nightly'
backupaccount: Don't print page HTML in XML export

See merge request gnu/gnu-social!144
2017-12-17 17:35:22 +00:00
Mikael Nordfeldth
ec98fd0c43 Merge remote-tracking branch 'gnuio/master' into nightly 2017-12-17 18:32:23 +01:00
mmn
67a9c0415c Merge branch 'cache-html-sanitizer' into 'master'
set the html sanitizer cache directory to ['cache']['dir'] from the config file;

See merge request gnu/gnu-social!156
2017-12-17 17:25:46 +00:00
mmn
a1ea335140 Merge branch 'cli-install' into 'master'
Don't write the config file when --skip-config flag is given to the installer.

See merge request gnu/gnu-social!155
2017-12-17 17:25:21 +00:00
mmn
69bb81556f Merge branch 'master' into 'master'
Allow GNU social master code to receive Mastodon boosts

See merge request gnu/gnu-social!153
2017-12-17 17:24:53 +00:00
nee
0b9a2fdf3a allow the cmd installer to load the config file from '/etc/gnusocial/config.d/'.$_server.'.php'
using the commandline argument as $_server (passed through lib/common.php to lib/gnusocial.php)
2017-12-17 17:59:46 +01:00
nee
3b5fabbe97 set the html sanitizer cache directory to ['cache']['dir'] from the config file; 2017-12-06 01:55:54 +01:00
nee
fdd3d63098 Don't write the config file when --skip-config flag is given to the installer.
* scripts/installer_cli.php: Read the arguments list before checking
  if the config file is writeable.
2017-11-26 22:14:30 +01:00
vinz
5af96d3ec7 fixed hard coded twitter char limit 2017-11-08 22:50:00 +01:00
vinz
250221ff7f Merge remote-tracking branch 'upstream/nightly' into nightly 2017-11-08 22:47:23 +01:00
Mikael Nordfeldth
ec504ec4df Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly 2017-09-10 14:06:03 +02:00
Mikael Nordfeldth
96ce758c05 Trying to debug some stuff regarding oEmbed 2017-09-10 14:04:12 +02:00
Mikael Nordfeldth
a45d9471ed If $_REQUEST is empty, array_merge == null. 2017-09-10 14:02:16 +02:00
Sebastian
a6e33bdd6a Fixed code so that GNU social can receive Mastodon boosts (from GNU social nightly commit: c741d1a52a) 2017-08-25 11:35:02 +00:00
Mikael Nordfeldth
10f17efc4f disabling auto-backlog-importer on subscribe 2017-08-23 18:09:49 +02:00
mmn
d9fbc17f77 Merge branch 'nightly' into 'nightly'
Added base64 encoding to get RMQ to work

See merge request !151
2017-08-23 15:28:08 +00:00
mmn
50f9f23ff1 Merge branch 'xmpphp-fix' into 'master'
Fix PHP incompatibilities in XMPPHP

See merge request !152
2017-08-23 15:27:34 +00:00
mmn
34bd4e6441 Merge branch 'patch-1' into 'master'
Update INSTALL

See merge request !150
2017-08-23 15:27:22 +00:00
Mikael Nordfeldth
0b75eaed92 missing argument for sprintf 2017-08-22 19:19:17 +02:00
Florian Schmaus
e615032331 Fix PHP incompatibilities in XMPPHP
This fixes the following to errors in XMPPHP:

Stack trace:
0 [internal function]: XMPPHP_XMLStream->endXML(Resource id 150, 'STREAM:FEATURES')
1 /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php(420): xml_parse(Resource id 150, '<?xml version='...', false)
2 /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php(471): XMPPHP_XMLStream->__process()
3 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(165): XMPPHP_XMLStream->processUntil(Array)
4 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(49): XmppManager->connect()
5 /var/vhosts/example.org/lib/iomaster.php(248): XmppManager->start(Object(ImMaster))
6 /var/vhosts/example.org/lib/iomaster.php(111): IoMaster->start()
7 /var/vhosts/example.org/scripts/imdaemon.php(58): IoMaster->service()
8 /var/vhosts/example.org/lib/spawningdaemon.php(189): ImDaemon->runThread()
 in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php on line 567
PHP Fatal error:  Uncaught Error: Function name must be a string in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php:567

PHP Fatal error:  Uncaught Error: Call to undefined function split() in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php:266
Stack trace:
0 /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMPP.php(129): XMPPHP_XMLStream->addXPathHandler('{http://etherx....', 'features_handle...')
1 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(145): XMPPHP_XMPP->__construct('geekplace.eu', 5222, 'gnusocial', 'U^k&l5fV53duGy', 'gnusocial', 'geekplace.eu', false, NULL)
2 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(49): XmppManager->connect()
3 /var/vhosts/example.org/lib/iomaster.php(248): XmppManager->start(Object(ImMaster))
4 /var/vhosts/example.org/lib/iomaster.php(111): IoMaster->start()
5 /var/vhosts/example.org/scripts/imdaemon.php(58): IoMaster->service()
6 /var/vhosts/example.org/lib/spawningdaemon.php(189): ImDaemon->runThread()
7 /var/vhosts/example.org/lib/spawningdaemon.php(118): SpawningDaemon->initAndRunChild(1 in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php on line 266
2017-08-19 17:55:47 +02:00
Mikael Nordfeldth
de8aed6a28 Added bullet point to README 2017-08-12 09:50:39 +02:00
Mikael Nordfeldth
d61375cb7f Group autocompletion now fills in hostname part 2017-08-10 12:41:47 +02:00
Mikael Nordfeldth
4c8a8848ed Groups can now be server-specific with !osm@gnusocial.de vs. !osm@sn.jonkman.ca 2017-08-10 12:30:11 +02:00
Mikael Nordfeldth
00cbc852b0 Make use of variable preMention signal method 2017-08-10 11:33:18 +02:00
Mikael Nordfeldth
8dd06cd8d8 Harmonize webfinger formatting and enable variable pre-mention character 2017-08-10 11:25:04 +02:00
Mikael Nordfeldth
20801a32f7 Logging term used HubSub instead of WebSub. 2017-08-07 00:19:12 +02:00
Mikael Nordfeldth
090f4a9474 Mastodon replies 201 Created for salmon slaps. 2017-08-05 16:21:34 +02:00
Mikael Nordfeldth
0ef483fb4a preamble with newline for AtomPub output etc. 2017-08-05 10:42:38 +02:00
Mikael Nordfeldth
945920f24d Mimetype was not recognized if longer than bare mime 2017-08-05 09:50:42 +02:00
Mikael Nordfeldth
6938d26524 List the thread config value in lib/default.php 2017-08-03 09:53:00 +02:00
Mikael Nordfeldth
dea9f43d85 Updated some PHP-related info in INSTALL 2017-08-03 09:52:04 +02:00
abjectio
90e93b9656 Added base64 encoding to get RMQ to work 2017-07-28 12:42:21 +02:00
Mikael Nordfeldth
586aaa596e Quote URL on dupe search and better logging on upgrade 2017-07-27 19:39:55 +02:00
Mikael Nordfeldth
457d32e273 Merge branch 'takeshitakenji/gnu-social-twitter-repeat-config' into mmn_fixes 2017-07-11 22:09:12 +02:00
mmn
dd8e17a387 Merge branch 'profile' into 'nightly'
Change Profile->getUser() to match the current user

See merge request !129
2017-07-11 20:05:47 +00:00
mmn
93524c4be3 Merge branch 'doc-backup-restore-def-vals' into 'nightly'
doc: Update 'backup', 'restore' default values

See merge request !143
2017-07-11 20:01:28 +00:00
mmn
924bcd93e5 Merge branch 'notice_id-xml' into 'nightly'
Use the statusnet namespace for notice_id in atom feed

See merge request !136
2017-07-11 20:01:01 +00:00
Mikael Nordfeldth
aa004d03aa Merge branch 'master' of git.gnu.io:gnu/gnu-social into mmn_fixes 2017-07-11 21:59:49 +02:00
mmn
7785219234 Merge branch 'fix-doc-twitterapi' into 'master'
Fix a link of doc/twitterapi

See merge request !149
2017-07-11 19:58:48 +00:00
Mikael Nordfeldth
56e2b0007c Issue #279 raises the point of missing newlines 2017-07-11 21:58:24 +02:00
Mikael Nordfeldth
a75b1df627 Merge branch 'master' of git.gnu.io:gnu/gnu-social into mmn_fixes 2017-07-11 21:44:50 +02:00
mmn
e3cafc011e Merge branch 'case-sensitive-openid' into 'master'
Fix OpenID discovery in pages using uppercase <HEAD> tag

Closes #60

See merge request !140
2017-07-11 19:41:33 +00:00
mmn
3b363d626d Merge branch 'safe-gitignore' into 'master'
Ignore whole directory, not only inner contents

See merge request !145
2017-07-11 19:31:26 +00:00
mmn
d564e28f8e Merge branch 'xmpp-fix-1' into 'nightly'
Fix 'from' address in the XMPP ping command

See merge request !141
2017-07-11 19:18:51 +00:00
Mikael Nordfeldth
9b19688d65 Another solution to merge request !146 2017-07-11 21:16:30 +02:00
Mikael Nordfeldth
e4d77cb9b2 Noone uses Facebook anymore. 2017-07-11 12:44:24 +02:00
Mikael Nordfeldth
05a9c11c47 Fixing HTTP_Request2_SocketWrapper so it times out
HTTP_Request2_SocketWrapper would never time out on an fgets() call as
discussed in issue #281 https://git.gnu.io/gnu/gnu-social/issues/281

I'm patching it here by setting the socket to non-blocking mode and
using stream_select to wait until the timeout. This patch or some
similar variant must be implemented in HTTP_Request2_SocketWrapper
to avoid the same issue for other users.
2017-07-11 12:04:09 +02:00
Mikael Nordfeldth
9919ccb8b5 HubSub now remembers recent failures and counts them 2017-07-10 20:28:45 +02:00
Mikael Nordfeldth
661930cbe6 oEmbed had bad variable reference in error message 2017-07-10 20:28:35 +02:00
Mikael Nordfeldth
6a2a54dcb5 Making upgrade.php somewhat more efficient by remember one-time-inits. 2017-07-10 20:27:37 +02:00
Mikael Nordfeldth
c9cfda5ef2 Bad constant (LOG_WARNING, not LOG_WARN) 2017-07-10 14:50:25 +02:00
Mikael Nordfeldth
4ba7c4a021 AuthCrypt README brought out of the stone age 2017-07-10 14:49:01 +02:00
Mikael Nordfeldth
74a60ab963 Rework the push mechanism a bit to a less DB dependant queue 2017-07-10 14:43:28 +02:00
Mikael Nordfeldth
3bc2454e91 Avoid excessive remote requests on oEmbed lookups
I noticed that each time a notice was accessed it'd do a remote lookup
with HEAD (and continue despite 404 etc.) and then another attempt to
download the resource. If this wasn't successful new attempts would be
made for each loading of the resource, which is extremely resource
intensive.

Whenever we can say "it's been n seconds since the last attempt" we
could probably enable this again - or just manually reload remote
thumbnails (as part of the StoreRemoteMedia plugin etc.)
2017-07-10 14:41:03 +02:00
Mikael Nordfeldth
a7df79ac07 Force arrays in constructors of ActivityStreamJSONDocument and JSONActivityCollection
Started using PHP7+ and it started complaining about count() being fed objects
that weren't "Countable". .)
2017-07-10 14:26:01 +02:00
Mikael Nordfeldth
31866be98b Use intval on ini_get or we use a string for timeout 2017-07-10 14:10:32 +02:00
Mikael Nordfeldth
57e22d78e0 Patch DB before release, weird use of count() 2017-07-10 14:10:10 +02:00
Mikael Nordfeldth
a4a6a8469e Updating HTMLPurifier to 4.9.3
Source: https://htmlpurifier.org/download
Release date: 2017-06-19
2017-07-10 13:46:07 +02:00
Mikael Nordfeldth
3158f9c33a Update PEAR DB to 1.9.2
Source: https://pear.php.net/package/DB
Release date: 2015-11-24
2017-07-10 13:34:47 +02:00
Mikael Nordfeldth
711f220397 Updating PEAR Net_URL2 to 2.1.2
Source: https://pear.php.net/package/Net_URL2
Release date: 2016-04-18
2017-07-10 13:29:31 +02:00
Mikael Nordfeldth
a223273544 Update PEAR DB_DataObject to 1.11.5
Source: https://pear.php.net/package/DB_DataObject
Release date: 2015-11-10
2017-07-10 13:25:04 +02:00
Mikael Nordfeldth
61876ed232 PEAR Net_SMTP updated to 1.8.0
Source: https://pear.php.net/package/Net_SMTP
Release date: 2017-04-06
2017-07-10 12:53:13 +02:00
Mikael Nordfeldth
f025671b8a PEAR Net_Socket updated to 1.2.2
Source: https://pear.php.net/package/Net_Socket
Release date: 2017-04-13
2017-07-09 23:09:03 +02:00
Mikael Nordfeldth
489099ca91 change default timeout setting for HTTPClient 2017-07-09 22:49:49 +02:00
Mikael Nordfeldth
08b4b73c67 Updating HTTP_Request2 to 2.3.0
Source: https://pear.php.net/package/HTTP_Request2
Release date: 2016-02-13 15:24 UTC
2017-07-09 22:17:52 +02:00
Mikael Nordfeldth
fb492d4bb2 Remove debug call and change how connect_timeout is set 2017-07-09 20:34:44 +02:00
Mikael Nordfeldth
f0480c34d7 Configure a default timeout for HTTP connections at 60s
No requests we do externally should ever take more than 60 seconds. This
could probably be changed for downloading video or whatever for any cache
plugins that want to store data locally, but in general I think even 60s
is way longer than I expect any outgoing requests should take.

This affects everything using HTTPClient, our helper class, and thus all
hub pings, subscription requests, etc. etc.

The value, afaik, includes connect_timeout and if it takes 10 seconds to
establish a connection only 50 seconds is available to transfer data.
2017-07-09 20:28:22 +02:00
Mikael Nordfeldth
3395f6081c Endless loop nesting on ensureHub failure now fixed
Essentially I was missing a negation on a test if we were in rediscovery mode.
2017-06-22 14:37:32 +02:00
Mikael Nordfeldth
c9a9a8bc58 Fulltext indexes are supported in InnoDB since MariaDB 10.0.15 2017-06-22 01:37:43 +02:00
Mikael Nordfeldth
fa44e0c06e set a 'rediscovered' parameter to avoid nesting into an ensureHub loop forever 2017-06-22 00:30:38 +02:00
Danial Behzadi
16e7b5af12 Update INSTALL
Step 4 of `Getting it up and running` is not applicable in newer versions.
2017-06-18 12:42:14 +00:00
Mikael Nordfeldth
5265c48d04 GNU social avatar by moshpirit / Alberto 2017-05-30 21:37:53 +02:00
MIYAGI Hikaru
b9a4053eec fix a link of doc/twitterapi 2017-05-30 07:23:36 +09:00
Mikael Nordfeldth
1517deeeb6 Since ActivityContext::CONVERSATION changed to 'conversation' instead of 'ostatus:conversation' we need to add it ourselves
the xmlstringerthinger doesn't really use namespaces afaik
2017-05-06 15:27:25 +02:00
Mikael Nordfeldth
0dd68d11cb What just happened? Not sure if me or git caused duplicate code. 2017-05-06 14:48:04 +02:00
Mikael Nordfeldth
4f37c564a5 Merge branch 'master' into mmn_fixes 2017-05-06 14:40:06 +02:00
Mikael Nordfeldth
5ad2f2873e ...and make sure we checkschema on Notice_prefs on upgrade... 2017-05-06 14:38:50 +02:00
Mikael Nordfeldth
966971bd12 Revert some of 8a4bec811b
use Notice_prefs instead of adding a new field. The rationale here
is simply that the Notice table was _huge_ and I rant into issues
with /tmp filling up when altering the tables. So let's just create
a new table instead.
2017-05-06 14:38:48 +02:00
Mikael Nordfeldth
7767c57087 Notice_prefs now available (I just copied Profile_prefs) 2017-05-06 14:38:47 +02:00
Mikael Nordfeldth
ba4a84602a Output proper HTML and XML headers for single Atom entry
RFC5023 <https://tools.ietf.org/html/rfc5023> specifies that the
content type parameter 'type=entry' should be used to clarify data.
2017-05-06 14:38:46 +02:00
Mikael Nordfeldth
d115f9dd1b Output selfLink from notice asActivity[Object] 2017-05-06 14:38:45 +02:00
Mikael Nordfeldth
1ccb934541 Return false immediately if $url is empty for common_valid_http_url 2017-05-06 14:38:43 +02:00
Mikael Nordfeldth
434956fc75 Notices start saving selfLink from activities/objects 2017-05-06 14:38:42 +02:00
Mikael Nordfeldth
7da925ca70 Handle selfLink in ActivityObject 2017-05-06 14:38:41 +02:00
Mikael Nordfeldth
3a7d8efc57 ...and make sure we checkschema on Notice_prefs on upgrade... 2017-05-06 13:54:42 +02:00
Mikael Nordfeldth
286b1e0ab7 Revert some of 8a4bec811b
use Notice_prefs instead of adding a new field. The rationale here
is simply that the Notice table was _huge_ and I rant into issues
with /tmp filling up when altering the tables. So let's just create
a new table instead.
2017-05-06 13:24:11 +02:00
Mikael Nordfeldth
2cbef2b10f Notice_prefs now available (I just copied Profile_prefs) 2017-05-06 13:22:10 +02:00
Mikael Nordfeldth
d88e9ffd33 Output proper HTML and XML headers for single Atom entry
RFC5023 <https://tools.ietf.org/html/rfc5023> specifies that the
content type parameter 'type=entry' should be used to clarify data.
2017-05-06 12:38:34 +02:00
Mikael Nordfeldth
7c829852b8 Output selfLink from notice asActivity[Object] 2017-05-06 12:26:54 +02:00
Mikael Nordfeldth
709f1bbd75 Return false immediately if $url is empty for common_valid_http_url 2017-05-06 12:25:27 +02:00
Mikael Nordfeldth
8a4bec811b Notices start saving selfLink from activities/objects 2017-05-06 12:15:54 +02:00
Mikael Nordfeldth
7889b21e7b Handle selfLink in ActivityObject 2017-05-06 11:57:16 +02:00
Mikael Nordfeldth
000af6d9ee default to #addtag on !group mention 2017-05-02 21:21:53 +02:00
Mikael Nordfeldth
07458e5375 Fixed the parsing of ostatus:conversation etc.
Conversation will now start storing remote URL

The namespace features don't work the way they were written for here
so I fixed that, making the ostatus: namespace properly looked up and
then the homegrown getLink function looks for what is back-compat with
StatusNet etc. if I remember correctly.
2017-05-02 18:58:22 +02:00
Mikael Nordfeldth
e8eb9f9614 Less raw database dumps in debug please 2017-05-02 09:18:43 +02:00
Mikael Nordfeldth
e9ab06b59e Fix issues with non-subscribed Ostatus_profiles 2017-05-02 09:14:30 +02:00
Mikael Nordfeldth
979c525124 I like to throw exceptions instead of using if statements. 2017-05-02 09:07:39 +02:00
Mikael Nordfeldth
06b25f384a File_redirection->getFile could never get the file anyway if $redir->file_id was empty... 2017-05-02 09:07:00 +02:00
Mikael Nordfeldth
5af5bb2a32 Show WebSub state on remote user profiles 2017-05-01 21:18:04 +02:00
Mikael Nordfeldth
caa5fb75b3 Introduce neat function getFeedSub() on Ostatus_profile 2017-05-01 21:17:22 +02:00
Mikael Nordfeldth
f4d6710a0f Change mentions of PuSH to WebSub
WebSub is probably finalised before we make a release anyway. Here is
the official spec: https://www.w3.org/TR/websub/

Mostly just comments that have been changed. Some references to PuSH <0.4
are left because they actually refer to PuSH 0.3 and that's not WebSub...

The only actual code change that might affect anything is FeedSub->isPuSH()
but the only official plugin using that call was FeedPoller anyway...
2017-05-01 11:04:27 +02:00
Mikael Nordfeldth
b3da5bdaa3 Debugging log fix. 2017-05-01 10:36:55 +02:00
Mikael Nordfeldth
f6d4d00e02 I think this will stop my daemons from endlessly looping
I got this which ate all my memory:

queuedaemon.php:10733] HTTPClient: HTTP HEAD https://drive.google.com/file/d/*masked*/view?usp=sharing - 200 OK
queuedaemon.php:10733] Checking for remote URL metadata for https://drive.google.com/file/d/*masked*/view?usp=sharing
queuedaemon.php:10733] HTTPClient: HTTP GET https://drive.google.com/file/d/*masked*/view?usp=sharing - 200 OK
queuedaemon.php:10733] Trying to discover an oEmbed endpoint using link headers.
queuedaemon.php:10733] Could not find an oEmbed endpoint using link headers, trying OpenGraph from HTML.
queuedaemon.php:10733] HTTPClient: HTTP HEAD https://drive.google.com/file/d/*masked*/view?usp=sharing&usp=embed_facebook - 200 OK
queuedaemon.php:10733] Checking for remote URL metadata for https://drive.google.com/file/d/*masked*/view?usp=sharing&usp=embed_facebook
queuedaemon.php:10733] HTTPClient: HTTP GET https://drive.google.com/file/d/*masked*/view?usp=sharing&usp=embed_facebook - 200 OK
queuedaemon.php:10733] Trying to discover an oEmbed endpoint using link headers.
queuedaemon.php:10733] Could not find an oEmbed endpoint using link headers, trying OpenGraph from HTML.
queuedaemon.php:10733] HTTPClient: HTTP HEAD https://drive.google.com/file/d/*masked*/view?usp=sharing&usp=embed_facebook&usp=embed_facebook - 200 OK
queuedaemon.php:10733] Checking for remote URL metadata for https://drive.google.com/file/d/*masked*/view?usp=sharing&usp=embed_facebook&usp=embed_facebook
queuedaemon.php:10733] HTTPClient: HTTP GET https://drive.google.com/file/d/*masked*/view?usp=sharing&usp=embed_facebook&usp=embed_facebook - 200 OK
queuedaemon.php:10733] Trying to discover an oEmbed endpoint using link headers.
queuedaemon.php:10733] Could not find an oEmbed endpoint using link headers, trying OpenGraph from HTML.
...ad nauseam.
2017-05-01 10:27:21 +02:00
Mikael Nordfeldth
37c97ac8fc Message to end-user on why FeedSub failed. 2017-05-01 07:40:16 +02:00
Mikael Nordfeldth
5ac20a4d30 Clearing cache showed my layout fail! 2017-05-01 07:39:56 +02:00
Mikael Nordfeldth
45203a4992 Makes the attachment button stay within the form area... 2017-04-30 20:32:10 +02:00
Mikael Nordfeldth
bb72229d6a Show what you're replying to in the web interface 2017-04-30 10:37:21 +02:00
Mikael Nordfeldth
16880de8f6 ensureHub on 422 status code (Superfeedr error on non-existing topic) 2017-04-30 10:29:16 +02:00
Mikael Nordfeldth
b20b9727cf More debugging info for FeedSub PuSH self-healing 2017-04-30 09:46:15 +02:00
Mikael Nordfeldth
e21043e81c syntax fix (throw _new_ *Exception) 2017-04-30 09:33:06 +02:00
Mikael Nordfeldth
1ecf709918 Make sure we don't receiveFeed() in the case of that exception 2017-04-30 09:31:16 +02:00
Mikael Nordfeldth
5288a6f9e2 Update huburi for FeedSub if PuSH signature is invalid
This because some remote server might have used third party PuSH hubs
but switch and we don't know about it.

Possible risks here are of course MITM that could force us to rediscover
PuSH hubs from a feed they control, but that currently feels ... meh.
2017-04-30 09:20:08 +02:00
Mikael Nordfeldth
c505652c15 Confirm_address::getByAddress not getAddress
Also fixed the error handling to match the function call.
2017-04-29 14:48:46 +02:00
Takuma YOSHIOKA
2ebdac70da Ignore whole directory, not only inner contents
`dir/*` style let git ignore files and directories in `dir/`, but not
`dir/` itself.
This cause `git clean -df` to remove `dir/` **with its contents**!

To prevent `git clean -df` to remove data directories (`avatar/`, `file/`,
etc), use `dir/` (or `dir`) style in gitignore.
2017-04-29 14:22:36 +09:00
Mikael Nordfeldth
853b016a42 Separate ensureHub into function in FeedSub 2017-04-27 09:24:12 +02:00
Mikael Nordfeldth
598b51eb7a Escaping a URI in common_debug call 2017-04-27 09:23:45 +02:00
Mikael Nordfeldth
985f3b44b7 LRDD blacklisted URL test 2017-04-26 23:24:42 +02:00
Mikael Nordfeldth
ea6d8b8bde LRDD blacklisted URL test 2017-04-26 23:21:13 +02:00
Mikael Nordfeldth
e1df763940 Test URLs against blacklist also on PuSH subscriptions. 2017-04-26 22:43:16 +02:00
Mikael Nordfeldth
bb76af4f65 Test URLs against blacklist also on PuSH subscriptions. 2017-04-26 22:41:59 +02:00
Mikael Nordfeldth
839b3e7392 allowed_schemes was misspelled 2017-04-26 22:12:06 +02:00
Mikael Nordfeldth
adfd76f44b allowed_schemes was misspelled 2017-04-26 22:11:28 +02:00
Mikael Nordfeldth
df7ff4ef1a Moving form to its own file as we do nowadays 2017-04-25 21:13:29 +02:00
Mikael Nordfeldth
c71600c144 Modernise some function calls etc, to newer GNU social standards 2017-04-25 21:03:43 +02:00
Mikael Nordfeldth
5f24fc0986 Blacklist plugin enabled by default (bug fixes will come) 2017-04-25 20:43:31 +02:00
Mikael Nordfeldth
a53284fe4f Use getByID nistead of getKV for Feedsub in PushInQueueHandler 2017-04-25 20:42:10 +02:00
Chimo
4ef05e35b8 backupaccount: Don't print page HTML in XML export
The current Atom/XML account backup contains the backupaccount HTML at the end
of the downloaded file. This change makes it so that only the XML is downloaded
by terminating the script before the HTML is served.
2017-04-23 19:03:40 +00:00
Mikael Nordfeldth
956cfaf844 Try https first on URL mention lookup 2017-04-22 12:29:53 +02:00
Mikael Nordfeldth
95f991cff3 Somewhat simpler regex. Thanks acct:takeshitakenji@gs.kawa-kun.com 2017-04-22 12:12:27 +02:00
Mikael Nordfeldth
c4541d8f5b Merge branch 'master' into nightly
No change should be made, just making sure...
2017-04-22 11:47:29 +02:00
Mikael Nordfeldth
ee29b23bd4 Fix URL mention regular expression FOR REALZ 2017-04-22 11:46:43 +02:00
Mikael Nordfeldth
69e944e21a Fix URL mention regular expression FOR REALZ 2017-04-22 11:45:24 +02:00
Mikael Nordfeldth
4827655632 Fix URL mention regular expression in OStatusPlugin 2017-04-22 11:26:23 +02:00
Mikael Nordfeldth
5e7a7701b9 Domain name regular expression into lib/framework.php
cherry-pick-merge
2017-04-22 11:26:13 +02:00
Mikael Nordfeldth
eefbfe746f Split up OStatusPlugin preg functions so they can be reused
cherry-pick-merge
2017-04-22 11:24:55 +02:00
Mikael Nordfeldth
45dfa9f215 A bit more instructive debugging 2017-04-22 11:23:43 +02:00
Mikael Nordfeldth
64b72a3c9b New domain regexp for WebFinger matching. 2017-04-22 11:23:41 +02:00
Mikael Nordfeldth
51e5cc2ac8 Fix URL mention regular expression in OStatusPlugin 2017-04-22 11:15:55 +02:00
Mikael Nordfeldth
2fc4b174c1 Domain name regular expression into lib/framework.php 2017-04-22 11:07:38 +02:00
Mikael Nordfeldth
bd6c93a811 Split up OStatusPlugin preg functions so they can be reused 2017-04-22 11:02:41 +02:00
Mikael Nordfeldth
54971842f2 A bit more instructive debugging 2017-04-22 10:55:24 +02:00
Mikael Nordfeldth
0fd83f0028 New domain regexp for WebFinger matching. 2017-04-22 10:51:03 +02:00
Mikael Nordfeldth
e98bceec10 Import backlog on new subscription.
Danger is when importing a new feed that may be maliciously crafted
to contain a zillion entries.
2017-04-21 09:31:27 +02:00
Mikael Nordfeldth
f51cb6fca9 Split OStatusPlugin FeedSub receive into two parts
FeedSub::receive now only handles the PuSH verification
FeedSub::receiveFeed is protected and only parses+imports feed XML
2017-04-21 08:13:39 +02:00
Chimo
63f9af307d doc: Update 'backup', 'restore' default values 2017-04-19 22:56:45 -04:00
Mikael Nordfeldth
3453521c9c Less frightening interface on remote subscription
Instead of an error message in a red box about being unable to find the
profile, you get the title "Remote subscription" and no error message.
2017-04-19 11:44:07 +02:00
Mikael Nordfeldth
2744bdcdb7 Empty resource would throw exception
The "+ Remote" link on your profile page broke because of exception.
2017-04-19 11:43:58 +02:00
Mikael Nordfeldth
e87115d462 Less frightening interface on remote subscription
Instead of an error message in a red box about being unable to find the
profile, you get the title "Remote subscription" and no error message.
2017-04-19 11:41:34 +02:00
Mikael Nordfeldth
548e59fc99 Empty resource would throw exception
The "+ Remote" link on your profile page broke because of exception.
2017-04-19 11:37:43 +02:00
Andrew Engelbrecht
6ca5bb4d41 Added CAS user whitelist feature
This feature filters users who may log in via CAS. This is useful when
both CAS and password authentication is enabled and there is a mismatch
between some GNU social account names and CAS user names. This prevents
CAS users from logging in as someone else on GNU social.
2017-04-17 12:41:49 -04:00
Mikael Nordfeldth
2a8ab1c6ca Merge branch 'master' into nightly 2017-04-16 11:04:58 +02:00
Mikael Nordfeldth
57f78dc61c Merge branch 'master' of git.gnu.io:gnu/gnu-social 2017-04-16 11:04:17 +02:00
Mikael Nordfeldth
388655d19b Handle normalized acct: URIs in ostatussub
Mastodon sent the proper acct: URI and not just 'user@domain' when
using the remote subscribe functionality.
2017-04-16 11:03:14 +02:00
Mikael Nordfeldth
35b0a9e3ae Handle normalized acct: URIs in ostatussub
Mastodon sent the proper acct: URI and not just 'user@domain' when
using the remote subscribe functionality.
2017-04-16 11:01:16 +02:00
Andrew Engelbrecht
25b4996145 Fix 'from' address in the XMPP ping command
This commit corrects a syntax error that caused the XMPP daemon to
reatedly reconnect to the remote server.
2017-04-13 12:35:49 -04:00
Mikael Nordfeldth
75079320d1 Give remote Atom URL for remote profile view 2017-04-09 12:13:53 +02:00
Sandro Santilli
aac6a21c4e Fix OpenID discovery in pages using uppercase <HEAD> tag
Closes #60

Equivalent change was proposed upstream:
https://github.com/openid/php-openid/pull/134
2017-04-08 09:13:59 +02:00
Mikael Nordfeldth
d2c7c83615 Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly 2017-04-06 13:34:57 +02:00
Mikael Nordfeldth
1b3021d61c E-mail should contain full acct uri too (FancyName) 2017-04-06 13:23:33 +02:00
mmn
550606177b Merge branch 'fixtests' into 'nightly'
Got Old Unittests Passing

See merge request !131
2017-04-06 10:23:12 +00:00
mmn
24910f2363 Merge branch 'fix-twitterbridge' into 'nightly'
Fix TwitterBridge imported notices not displaying in timeline

See merge request !130
2017-04-06 10:20:41 +00:00
Mikael Nordfeldth
2ce2201496 Show full acct uri as html title on link mouseover 2017-04-06 11:45:58 +02:00
mmn
9e89a177c7 Merge branch 'genericons-fix' into 'nightly'
Fix paths for Genericons font

See merge request !132
2017-04-06 09:23:51 +00:00
mmn
bd24724560 Merge branch 'atom-post' into 'nightly'
Add support for Atom entry when posting status

See merge request !135
2017-04-06 09:20:38 +00:00
Mikael Nordfeldth
bc1f8b5db6 Merge branch 'master' of git.gnu.io:gnu/gnu-social into nightly
strk's OpenID fix
2017-04-06 11:15:37 +02:00
mmn
6679ecb9d7 Merge branch 'fix-openid-removal' into 'master'
Fix OpenID URI removal

See merge request !138
2017-04-06 09:12:35 +00:00
mmn
f85aa41adc Merge branch 'normalized_openid' into 'master'
Normalize OpenID URI before checking it for validity

Closes #251

See merge request !139
2017-04-06 09:12:17 +00:00
mmn
f2d2f7ebe2 Merge branch 'newListItem-signatures' into 'nightly'
Add var type to newListItem() parameter

See merge request !137
2017-04-06 09:11:52 +00:00
Mikael Nordfeldth
b54c7f720c add configuration option that was documented in CONFIGURE 2017-04-02 11:05:22 +02:00
Sandro Santilli
1ef206467f Fix OpenID URI removal
See #252
2017-03-18 13:33:07 +01:00
Sandro Santilli
85a407e7b0 Normalize OpenID URI before checking it for validity
Fixes #251
2017-03-18 10:56:01 +01:00
Mikael Nordfeldth
8c7c6f3047 Merge branch 'master' into nightly 2017-03-18 01:37:04 +01:00
Mikael Nordfeldth
9fead39f36 Merge branch 'master' of git.gnu.io:gnu/gnu-social 2017-03-18 01:36:35 +01:00
Mikael Nordfeldth
948744538c StoreRemoteMedia now checks remote filesize before downloading 2017-03-18 01:35:45 +01:00
Chimo
dc7c64592b Add var type to newListItem() parameter
Fixes some "Declaration of $child::method should be compatible with
$parent::method" warnings.
2017-03-16 22:57:16 -04:00
Thomas Karpiniec
47cd054976 Use the statusnet namespace for notice_id 2017-02-04 21:59:30 +11:00
Thomas Karpiniec
132b932ff3 Add support for Atom entry when posting status 2017-02-04 20:04:02 +11:00
Mikael Nordfeldth
8b8e2825e3 Merge branch 'master' of git.gnu.io:gnu/gnu-social into mmn_fixes 2017-01-15 21:25:06 +01:00
mmn
7dcb229ab3 Merge branch 'improve-status-length-calculation' into 'master'
improve status length calculation for messages forwarded to Twitter

See merge request !133
2017-01-15 20:23:41 +00:00
Mikael Nordfeldth
63322989c2 if zip is fine then application/x-bzip2 is too 2017-01-11 23:30:06 +01:00
Bjoern Schiessle
f198d5d110 improve status length calculation, each link is exactly 23 characters long at Twitter 2016-12-14 15:54:02 +01:00
Roger Braun
bdac23564a Test for correct post object in retweets. 2016-12-05 18:26:46 +01:00
Roger Braun
c741d1a52a Make Mastodon retweets parse correctly. 2016-12-05 18:24:55 +01:00
Roger Braun
8c6c6039a2 Test for correct post object in retweets. 2016-12-05 18:24:13 +01:00
Bhuvan Krishna
099dafc4c2 Fix paths for Genericons font
Fix incorrect paths for Genericons font files.

Remove embedded woff in favor of file on disk. This make it easier when
packaging for distributions if the distribution wants to package
Genericons package separately.
2016-11-17 18:02:11 +05:30
Mikael Nordfeldth
c5a4921176 log with var_export (our shorthand _ve()) 2016-10-23 12:14:02 +02:00
Mikael Nordfeldth
6bfc97c95d Less spammy logs 2016-10-22 23:24:13 +02:00
Mikael Nordfeldth
6ebc5f0bff some debugging calls and make sure $hints['feedurl'] gets set with $feeduri in case that variable is used. 2016-10-22 23:08:44 +02:00
Mikael Nordfeldth
8614cd77eb A good plugin but not necessary as default. 2016-10-22 19:27:07 +02:00
Mikael Nordfeldth
1c5e364880 Merge branch 'master' into mmn_fixes 2016-09-13 11:26:03 +02:00
Mikael Nordfeldth
7d67eefdf5 wrong variable was referenced 2016-09-13 11:24:57 +02:00
vinzv
3e5ae79c5a Added chimo's plugins 2016-09-02 11:37:53 +02:00
vinzv
25e4b9a35e Add Qvitter and QvitterPlus 2016-09-02 11:34:50 +02:00
vinzv
a1c7c0ab01 Adding SensitiveContent Plugin for nsfw filtering 2016-09-02 11:34:29 +02:00
vinzv
845a0f8e2d Merge branch 'nightly' of https://git.gnu.io/gnu/gnu-social into nightly
Conflicts:
	lib/util.php
2016-09-02 11:32:49 +02:00
vinzv
19df5c9b50 Merge remote-tracking branch 'upstream/master' into nightly
Conflicts:
	lib/util.php
2016-09-02 11:26:57 +02:00
Mikael Nordfeldth
3b9b9331a8 parenthesis fail 2016-09-02 01:07:09 +02:00
Mikael Nordfeldth
500ff6be1a Merge branch 'master' into mmn_fixes 2016-09-02 01:04:54 +02:00
Mikael Nordfeldth
18670c69b2 Merge branch 'master' of git.gnu.io:gnu/gnu-social 2016-09-02 01:01:57 +02:00
Mikael Nordfeldth
a7043bf7cc Split up source and source_link. Never trust HTML!
https://community.highlandarrow.com/notice/269667
or alternatively: https://social.umeahackerspace.se/conversation/495655
2016-09-02 01:00:52 +02:00
Mikael Nordfeldth
15ab9ff9e3 common_to_alphanumeric added, filtering Notice->source in classic layout 2016-09-02 01:00:08 +02:00
Mikael Nordfeldth
59b93b23e2 Split up source and source_link. Never trust HTML!
https://community.highlandarrow.com/notice/269667
or alternatively: https://social.umeahackerspace.se/conversation/495655
2016-09-02 00:55:46 +02:00
Mikael Nordfeldth
e6b3924a5d common_to_alphanumeric added, filtering Notice->source in classic layout 2016-09-02 00:08:17 +02:00
www-data
160df2f2d1 Merge remote-tracking branch 'upstream/master' into nightly 2016-09-01 17:23:31 +02:00
Mikael Nordfeldth
af6a3aa456 Make Group actions ManagedAction so groupbyid works 2016-08-28 09:34:31 +02:00
Mikael Nordfeldth
cb5bcf4937 bad log constant 2016-08-28 00:16:31 +02:00
Mikael Nordfeldth
a32bfe7d87 TagCloud turned into plugin (performance issues on large installs) 2016-08-27 15:24:25 +02:00
Mikael Nordfeldth
5a008c3738 Don't redirect to tag cloud on /tag URL
(this is probably just while we pluginify TagCloud)
2016-08-27 15:06:12 +02:00
Mikael Nordfeldth
27022e7c39 Typing on WebFinger onRouterInitialized handler argument URLMapper $m 2016-08-27 15:00:29 +02:00
Mikael Nordfeldth
3b046ee49d Shorthand function to check if notice has been repeated. 2016-08-27 14:42:28 +02:00
Mikael Nordfeldth
f7030b538f neo-quitter display fixes for attachment since layout change 2016-08-25 11:26:09 +02:00
Mikael Nordfeldth
d13883ec86 Margin for oEmbed article etc. 2016-08-21 18:23:16 +02:00
Mikael Nordfeldth
6bc0030699 articles accidentally got aligned to center 2016-08-21 09:36:22 +02:00
Mikael Nordfeldth
1d791f81fa Attachment styling 2016-08-21 09:31:26 +02:00
Mikael Nordfeldth
4314a286e3 Less convoluted attachmentlistitem function calls 2016-08-21 09:25:16 +02:00
Mikael Nordfeldth
fc06c599bc dbqueuemanager should ignore on no-result-exceptions 2016-08-16 20:27:41 +02:00
Nym Coy
1f866fcaed ActivityGenerationTests.php fails but doesn't crash anymore.
Fixed an error where a profile id was reused after another profile was
deleted, and the new profile still had the deleted role.

Fixed ActivityGenerationTests::testNoticeInfoRepeated() which was passing
User instead of Profile, throwing errors.

tests/ActivityGenerationTests.php now passes.

CommandInterpreterTest now passes.

Moved JidValidateTest to XmppValidateTest, since Jabber functionality has
moved to the XmppPlugin. Tests work but don't pass, but they are at least
skipped if XmppPlugin is not active.

LocationTest passes, but the tests are not very good. Lots of nulls.

MediaFileTest passes.

NicknameTest passes. Nickname::normalize() now throws an error if the
nickname is too long with underscores.

UserFeedParseTest passes.

URLDetectionTest passes if $config['linkify']['(bare_ipv4|bare_ipv6|
bare_domains)'] are false. Untested otherwise.

Fixed Nickname::isBlacklisted() so it does not throw an error if
$config['nickname]['blacklist'] not set.
2016-08-14 11:55:49 +05:30
www-data
12cd0af111 Merge remote-tracking branch 'upstream/nightly' into nightly 2016-08-13 22:16:35 +02:00
Nym Coy
1f5e306760 Set object_type to ActivityObject::NOTE on notices imported from Twitter. Previously was unset which caused ActivityHandler to throw an error during onStartOpenNoticeListItemElement() and the notices would not display in the timeline. 2016-08-09 21:02:57 +05:30
Mikael Nordfeldth
557e430c7d Reference local URLs in addressee list on notices. 2016-08-06 18:32:14 +02:00
www-data
c946ddc275 Merge remote-tracking branch 'upstream/nightly' into nightly 2016-07-27 12:38:19 +02:00
Mikael Nordfeldth
563b3b1328 Using File->setTitle in oEmbed 2016-07-23 21:01:28 +02:00
Mikael Nordfeldth
d84bf83419 Created function File->setTitle(str) 2016-07-23 21:00:57 +02:00
Mikael Nordfeldth
1b3d583418 file_quota for OembedPlugin too
Don't download huge files that might kill memory limits.
2016-07-21 03:19:05 +02:00
Mikael Nordfeldth
809e2f6d07 Use File->getID() 2016-07-21 01:38:48 +02:00
Mikael Nordfeldth
e52275e37f Some comparisons were incorrect (text/html;charset=utf-8 etc.) 2016-07-21 01:38:31 +02:00
Mikael Nordfeldth
1981cb7662 Select the first generated thumbnail, which should be the proper size
...most of the time. If all works well.
2016-07-21 00:38:16 +02:00
Mikael Nordfeldth
d5c733919b Because the other part of the code works now, this is unnecessary 2016-07-21 00:34:40 +02:00
Mikael Nordfeldth
d230d332cf return false to exit event, imgPath holds the path 2016-07-21 00:27:22 +02:00
Mikael Nordfeldth
13e1f0a561 VideoThumbnails shouldn't have to recreate the thumbnail all the time 2016-07-21 00:24:05 +02:00
Mikael Nordfeldth
e8e996182f Delete file on class destruction or we do it too quickly
Source image was removed when trying to use it for resizeTo
2016-07-21 00:23:27 +02:00
Mikael Nordfeldth
fc440ba7e7 Easier debugging of VideoThumbnails plugin 2016-07-20 22:51:38 +02:00
www-data
883ef2414f Merge remote-tracking branch 'upstream/nightly' into nightly 2016-07-15 17:18:45 +02:00
Mikael Nordfeldth
46c227bf3a FileNotFoundException is more proper here 2016-07-15 13:19:16 +02:00
Mikael Nordfeldth
36cfe9f857 Delete successfully generated thumbnail (temporary sources) too. 2016-07-15 12:52:20 +02:00
Mikael Nordfeldth
1d53e7060a Changed ShowfavoritesAction to use Action functions for profiles 2016-07-07 11:11:20 +02:00
Mikael Nordfeldth
6332a4d800 Handle FileNotStoredLocallyException in attachmentlistitem 2016-07-07 00:45:31 +02:00
Mikael Nordfeldth
f02d32b718 Reworked File->getUrl to throw exception
In case you require a local URL and one can't be generated, throw
FileNotStoredLocallyException(File $file)
2016-07-07 00:44:50 +02:00
Mikael Nordfeldth
4a3ed7d0ae I don't know why we would set the mimetype as title here 2016-07-07 00:43:51 +02:00
Mikael Nordfeldth
71afb5be75 If the file is text/plain, see if we accept the extension 2016-07-06 09:34:09 +02:00
Mikael Nordfeldth
4117118e23 More specific exceptions for mimetype/extension issues. 2016-07-06 09:14:59 +02:00
Mikael Nordfeldth
b4a0bff740 Some mimetype madness! 2016-07-06 08:59:16 +02:00
www-data
14ac6e665c Merge remote-tracking branch 'upstream/nightly' into nightly 2016-07-04 23:37:45 +02:00
Martin Lyth
b0204023c0 Fix the case of a call to sameAs() 2016-07-02 17:43:47 -04:00
Martin Lyth
c9afdae01c Check if we're the current user before retrieving 2016-07-02 17:02:37 -04:00
Martin Lyth
a62755182c Test user equality better in Profile->getUser() 2016-07-02 15:45:42 -04:00
Mikael Nordfeldth
3987cad9b7 Use delivered content-type to parse XML_XRD
In issue #205 we saw data coming in with an additional line-break before
the JSON data which fuzzed the auto-detection in XML_XRD (which assumed
a { as the first character). If we use the Content-type header from HTTP
we can avoid that issue.
2016-07-02 13:44:25 +02:00
Mikael Nordfeldth
cfd9aee57b Better logging for issue #205 2016-07-02 13:32:23 +02:00
Martin Lyth
d7a29be3ac Change Profile->getUser() to match the current user
Profile->getUser() gets the User independently from common_current_user.
This means that changes to one does not affect the other, even if they
are the same user.
This changes that, so that getUser() returns common_current_user() if
they are both the same user.

This is done to fix a bug in the user profile settings, where changes in
the language and timezone are applied to the return value of
Profile->getUser() but not propagated to common_cur_user(), which causes
the profile settings to display incorrect information until the page is
refreshed.
2016-06-30 18:24:58 -04:00
Mikael Nordfeldth
a833eaa651 Make all hash algorithms available (but whitelist by default)
sha1 is whitelisted only because StatusNet requires it.
2016-06-28 11:54:39 +02:00
Mikael Nordfeldth
3166a04cef actually respond with the error message in text on Salmon calls 2016-06-25 20:50:00 +02:00
Mikael Nordfeldth
bf4acc21be A bunch of GIFs were >5MiB! 2016-06-25 20:37:00 +02:00
Mikael Nordfeldth
ad7ebd1a8c Even more phpseclib update related stuff. 2016-06-25 20:34:28 +02:00
Mikael Nordfeldth
d10ce6ac7c Give Webfinger response to group queries 2016-06-25 20:13:19 +02:00
Mikael Nordfeldth
3d6e25ee5f We have to create and populate the Notice_location table before constraint checking foreign keys. 2016-06-25 13:01:56 +02:00
Mikael Nordfeldth
d0c26fb1a4 URIFIX in Ostatus_profile, handle missing feedsub 2016-06-25 11:59:31 +02:00
Mikael Nordfeldth
f93f02f424 Managed_DataObject now has getByUri() 2016-06-25 11:59:06 +02:00
Mikael Nordfeldth
42a62da764 getByUri shorthand function for Managed_DataObject (with uri) 2016-06-25 11:52:17 +02:00
Mikael Nordfeldth
7978cd6d59 s/EmptyIdException/EmptyPkeyValueException/ 2016-06-25 11:50:59 +02:00
www-data
8470a55a41 Merge remote-tracking branch 'upstream/nightly' into nightly 2016-06-24 16:47:57 +02:00
Mikael Nordfeldth
d7a4098b56 Use a separate max download limit for remote files than file_quota too 2016-06-24 16:07:57 +02:00
Mikael Nordfeldth
af23c9f7cd StoreRemoteMedia now checks remote filesize before downloading 2016-06-24 15:56:14 +02:00
Mikael Nordfeldth
1dfac3ad63 Allow getting filesize by function 2016-06-24 15:53:23 +02:00
Mikael Nordfeldth
f1e3314bb7 StoreRemoteMedia avoids too large files 2016-06-24 15:47:02 +02:00
Mikael Nordfeldth
0adb7af9a0 Allow a quickHead request, will only return headers 2016-06-24 15:43:20 +02:00
Mikael Nordfeldth
c19f87f867 fixes issue #189 with a script lacking exception handling 2016-06-24 15:19:24 +02:00
Mikael Nordfeldth
da365be5a2 ParagonIE\ConstantTime required PHP7, going to v1.x branch 2016-06-24 14:49:52 +02:00
Mikael Nordfeldth
39e8c13afb Properly parse incoming bookmarks 2016-06-24 13:51:40 +02:00
Mikael Nordfeldth
a4051945fd Handle exception from Magic Envelope toXML function 2016-06-23 23:27:18 +02:00
Mikael Nordfeldth
6dcb293ba0 Unnecessarily verbose code 2016-06-23 23:03:58 +02:00
www-data
b83ff3f924 Merge remote-tracking branch 'upstream/nightly' into nightly 2016-06-23 01:33:15 +02:00
Mikael Nordfeldth
09412ac813 PrimaryNoticeList so we get InfiniteScroll on profile pages 2016-06-21 15:55:49 +02:00
www-data
1d39c9d66a Merge remote-tracking branch 'upstream/nightly' into nightly 2016-06-21 13:36:41 +02:00
Mikael Nordfeldth
16f4583498 throw ClientException instead of clientError 2016-06-19 03:38:00 +02:00
Mikael Nordfeldth
2726478467 Bump Diaspora plugin version because of phpseclib fix 2016-06-19 03:25:03 +02:00
Mikael Nordfeldth
bac95913e8 phpseclib defaults to OAEP but we want PKCS1 in D* 2016-06-19 03:23:26 +02:00
Mikael Nordfeldth
ed97b88b04 Err, don't need that comment. 2016-06-19 02:27:50 +02:00
Mikael Nordfeldth
76114e2748 Missed some phpseclib stuff in DiasporaPlugin 2016-06-19 02:26:44 +02:00
Mikael Nordfeldth
d00f19663b bump to beta5 since phpseclib update (which might cause some issues still) 2016-06-18 00:05:54 +02:00
Mikael Nordfeldth
47aabf4fda Let's just put the namespaced phpseclib in extlib instead of plugins/OStatus/extlib 2016-06-18 00:00:32 +02:00
Mikael Nordfeldth
d4216d09c6 extlib required by phpseclib (ParagonIE/ConstantTime) 2016-06-17 23:58:49 +02:00
Mikael Nordfeldth
5bfd9dbaa7 repost_of -> repeat_of, also trying with isset() 2016-06-17 23:53:05 +02:00
Mikael Nordfeldth
3a8ce99a9d Magicsig call for phpseclib\Math\BigInteger fixed 2016-06-17 23:47:00 +02:00
Mikael Nordfeldth
1839082f95 OStatus Magicsig adaptations to new phpseclib
Some constants have changed and the way to call RSA->sign(...) too.
2016-06-17 23:43:24 +02:00
Mikael Nordfeldth
d8af92bda2 Diaspora phpseclib update 2016-06-17 23:42:50 +02:00
Mikael Nordfeldth
09ef0c1f33 bump Linkback plugin thanks to awesome singpolyma 2016-06-17 23:22:44 +02:00
Mikael Nordfeldth
a1d064129a Handle namespaces for new phpseclib 2016-06-17 23:21:34 +02:00
Mikael Nordfeldth
28ca5d90d9 phpseclib updated, some new features that we won't use 2016-06-17 22:44:12 +02:00
mmn
a6390007b7 Merge branch 'avatar-folder-perms' into 'nightly'
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

See merge request !126
2016-06-17 16:33:20 -04:00
mmn
2e8a5aeb23 Merge branch 'tom/noreferrer' into 'nightly'
Use noreferrer when linkifying attachments and allow this value in purifier

If you click on a link in your main timeline this effectively identifies you to the site that you visited via the Referer header. (Who goes around reading other people's /user/all, honestly?)

Annoyingly our notice content is already HTML. Rather than attempt to parse and modify the tags in flight, this modification takes the simpler approach of adding the noreferrer tag to inline links by default when notices are composed.

See merge request !127
2016-06-17 16:32:39 -04:00
mmn
48efdc3593 Merge branch 'check-connection-on-install' into 'master'
Check DB connection before any possible use

This is to avoid an exception when enabling 'pgsql' backend

See merge request !121
2016-06-17 16:30:25 -04:00
mmn
005b4c8dd1 Merge branch 'strict-warnings' into 'nightly'
Fix some strict warnings (Action::prepare, Action::handle)

I know MR with changes to a bunch of files aren't great practice, but I figured since all the changes are one-liners it might not be a huge deal.

Related to #190 

See merge request !123
2016-06-17 16:29:47 -04:00
mmn
d66b495ba8 Merge branch 'notice-location' into 'nightly'
Re-enable notice locations

Removed a stray 'return' statement.

See merge request !125
2016-06-17 16:28:56 -04:00
mmn
cb8bf360c4 Merge branch 'site-notice' into 'nightly'
Site Notice: common_purify instead of HTMLPurifier

So that we can use our custom settings (e.g: extra URI schemes) in the
site notice textbox.

Ref. #170

See merge request !124
2016-06-17 16:28:01 -04:00
mmn
d4295cfb25 Merge branch 'webmention-rocks' into 'nightly'
webmention.rocks

I have improved the webmention handling so that all but two of the webmention.rocks compliance tests pass now.  Also improved parsing of time/authors on incoming webmentions.

See merge request !128
2016-06-17 16:26:21 -04:00
Mikael Nordfeldth
5e131aed80 Apparently medium.com uses @ frequently i URLs
and we skipped them because we assumed they were urlencoded when copied.
2016-06-17 11:20:36 +02:00
Stephen Paul Weber
97243c8a91 Allow 201 as well, because spec says so 2016-06-10 21:13:10 +00:00
Stephen Paul Weber
274e394d8e Pass all but two webmention.rocks tests 2016-06-10 21:03:16 +00:00
Stephen Paul Weber
1e9077f529 Set avatar where available 2016-06-10 21:02:50 +00:00
Stephen Paul Weber
6861d2f3a1 Get avatar out of entry properly 2016-06-10 21:02:34 +00:00
Stephen Paul Weber
624584f9df Need to strtotime before we can format the date 2016-06-10 21:02:08 +00:00
Stephen Paul Weber
4f3a031786 Use strpos check properly 2016-06-10 21:01:53 +00:00
Stephen Paul Weber
e96d7d48f5 400 code needs ClientException 2016-06-10 21:01:23 +00:00
Stephen Paul Weber
83e7ade714 When there is no useful title, class="p-name e-content" 2016-06-10 21:00:48 +00:00
Stephen Paul Weber
47e541eaec Allow getting notice title without implying one
Sometimes I just want explicit titles, and not the generated "blah posted on date" text
2016-06-10 21:00:01 +00:00
Thomas Karpiniec
c1537a1e82 Use noreferrer when linkifying attachments and allow this value in purifier 2016-06-09 19:56:36 +10: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
Chimo
d02c75d019 Re-enable notice locations
Removed a stray 'return' statement.
2016-06-01 21:56:42 -04:00
Chimo
e98d5d0c0c Site Notice: common_purify instead of HTMLPurifier
So that we can use our custom settings (e.g: extra URI schemes) in the
site notice textbox.

Ref. #170
2016-06-01 03:54:28 +00:00
Chimo
9de79f0a36 Update prepare() method on Action subclasses.
Fixes handle()-related strict warnings such as "Strict Standards:
Declaration of AdminPanelAction::prepare() should be compatible with
Action::prepare(array $args = Array)

Ref. #190
2016-06-01 02:26:44 +00:00
Chimo
ba2975aac8 Update handle() method on Action subclasses.
Fixes handle()-related strict warnings such as "Strict Standards:
Declaration of AdminPanelAction::handle() should be compatible with
Action::handle()"

Ref. #190
2016-06-01 02:26:44 +00:00
Sandro Santilli
3138fa0b40 Check DB connection before any possible use 2016-05-24 16:49:50 +02:00
www-data
9545219a23 Merge remote-tracking branch 'upstream/nightly' into nightly 2016-05-17 14:00:39 +02:00
Mikael Nordfeldth
bd306bdb9f Add /download action for attachments 2016-05-09 22:08:36 +02:00
Mikael Nordfeldth
bc70ec1263 Don't warp attachment page thumbnails 2016-05-04 11:59:52 +02:00
Mikael Nordfeldth
3a6733dc98 2-frame GIF animations weren't recognised as animated 2016-05-04 11:57:55 +02:00
Mikael Nordfeldth
6d6db77f06 Documentation update in File class file 2016-05-04 11:44:14 +02:00
Mikael Nordfeldth
a5a96dd857 Misplaced break/continue statements. 2016-05-04 11:44:00 +02:00
Mikael Nordfeldth
87dd0fbdb6 UseFileAsThumbnailException uses direct File object now 2016-05-04 11:34:50 +02:00
www-data
6a95a0cecb Merge remote-tracking branch 'upstream/nightly' into nightly 2016-05-01 21:44:34 +02:00
Mikael Nordfeldth
60130633f0 Linkback references to unset indexes + spelling error 2016-05-01 11:36:07 +02:00
Mikael Nordfeldth
7aa9a69c2f Link to attachment page instead of big-ass image 2016-05-01 11:35:51 +02:00
www-data
ede6dcd4ac Merge remote-tracking branch 'upstream/master' into nightly 2016-04-27 15:16:26 +02:00
Mikael Nordfeldth
e4f688fcfd naughty extlib fix (PHP7)
The explode function didn't return empty elements (which split did)
2016-04-26 02:57:14 +02:00
Mikael Nordfeldth
3e9b0d6018 split is gone, use explode. PHP7 extlib fix 2016-04-26 02:41:56 +02:00
Mikael Nordfeldth
af28160679 Naughty fix for extlib XMPPHP (PHP7)
I shouldn't fix extlibs, but here goes anyway. I will see if there's
an upstream library we can track which has fixed this themselves.
2016-04-26 02:41:04 +02:00
Mikael Nordfeldth
58274c99d4 Some PHP7 related package names 2016-04-26 01:50:40 +02:00
Mikael Nordfeldth
9b613029e6 Merge branch 'master' into mmn_fixes 2016-04-18 16:10:50 +02:00
Mikael Nordfeldth
844fe3924e put local id, href and such in ostatus:conversation element 2016-04-18 16:09:36 +02:00
Mikael Nordfeldth
0959efd7be Use constant for ATTN_PUBLIC (public collection) 2016-04-18 15:56:52 +02:00
Mikael Nordfeldth
ce65fe96ad Oembed bugs with thumbnail generation. 2016-04-18 15:33:20 +02:00
Mikael Nordfeldth
5ccf3ed714 function declaration to match parent 2016-04-18 15:21:05 +02:00
Mikael Nordfeldth
c48508d590 use getByID (also bad variable reference) 2016-04-18 15:08:47 +02:00
Mikael Nordfeldth
107f612384 strict type comparison 2016-04-18 15:04:03 +02:00
Mikael Nordfeldth
4645033b98 "In conversation" text in noticelistitem 2016-04-08 13:44:22 +02:00
Mikael Nordfeldth
6d33c003fc Maybe stop deleteRelated from failing on constraint checking 2016-04-04 12:04:20 +02:00
Mikael Nordfeldth
b1de90fe08 Send thr:in-reply-to as well, for clarity... 2016-04-01 23:21:57 +02:00
Mikael Nordfeldth
922b65d231 More debugging in Salmon since we get situations which can't find inReplyToID 2016-04-01 23:10:34 +02:00
Mikael Nordfeldth
547f92de07 Don't fail deleteRelated on NoProfileException 2016-04-01 06:51:19 +02:00
Mikael Nordfeldth
195285ac2f Fix constraint checking and only run it if not already constrained 2016-04-01 06:24:11 +02:00
Mikael Nordfeldth
558cbe5b6d Merge branch 'constraint_check_notice_table' into mmn_fixes 2016-04-01 06:14:47 +02:00
Mikael Nordfeldth
44ea8aa681 Make sure $_SERVER['HTTP_REFERER'] isset when testing value 2016-03-31 20:51:50 +02:00
Mikael Nordfeldth
8de3469957 Constraint check Notice table, need to get foreign key array! 2016-03-31 17:57:01 +02:00
Mikael Nordfeldth
299949b156 fix/legacy_http for WebFinger + some minor fixes
Now won't match possibly maliciously named remote profile URLs
(where the profile URL could be a notice URL for example, which
would mean the response would be incorrect)

When looking up remote entities, we should _only_ use the stored URI,
but that's for the future to do...
2016-03-30 01:32:11 +02:00
Mikael Nordfeldth
df3bcbb6cb Possibly replace weirdly capitalized htTPs: too 2016-03-30 01:31:17 +02:00
Mikael Nordfeldth
0177c8f1cf Use join instead of exists in SQL 2016-03-29 14:36:27 +02:00
Mikael Nordfeldth
4ea79bc396 I was too quick to save that file (File::getByUrl takes 1 arg) 2016-03-29 14:33:40 +02:00
Mikael Nordfeldth
2f91cb0df7 We should assume all verbs and such are their full URIs in our db 2016-03-29 12:57:52 +02:00
Mikael Nordfeldth
cb212ba41c Gah, bad syntax 2016-03-29 12:55:50 +02:00
Mikael Nordfeldth
72cafe03e9 Index object_type too... 2016-03-29 12:48:25 +02:00
Mikael Nordfeldth
f8765c6166 Upgrade script for Bookmark uses joins instead of exists (performance++) 2016-03-29 12:48:00 +02:00
Mikael Nordfeldth
dcffe5d992 Forgotten File::getByUrl conversations (performance++) 2016-03-29 12:13:53 +02:00
Mikael Nordfeldth
4e2be07234 Better indexing for Notice (performance++) 2016-03-29 12:13:33 +02:00
Mikael Nordfeldth
23bb45b845 Upgrade info from Bookmark plugin 2016-03-29 12:13:23 +02:00
Mikael Nordfeldth
d4041a4a1f a little bit more explicit logging 2016-03-28 16:41:29 +02:00
Mikael Nordfeldth
16517f019a Embarrasing copy-paste gone too fast 2016-03-28 16:25:29 +02:00
Mikael Nordfeldth
88e2f739a9 DOMElement not DOMDocument 2016-03-28 16:23:15 +02:00
Mikael Nordfeldth
7bef2ad4cc Update Profile Data script fixes, might work for groups too now 2016-03-28 16:19:47 +02:00
Mikael Nordfeldth
a93c69d150 OStatus update profile data script fixes 2016-03-28 15:42:41 +02:00
Mikael Nordfeldth
2e327dfcd7 Probably fixes issue with looping XMPP queue items 2016-03-28 11:33:52 +02:00
Mikael Nordfeldth
f134a423f6 rename config option site/logdebug to log/debugtrace 2016-03-27 16:36:58 +02:00
Mikael Nordfeldth
97f7e6632d Embed attachments marked up as microformats2 (I think rather properly) 2016-03-27 16:21:43 +02:00
Mikael Nordfeldth
327b8c863e Initial (not yet working) fetch remote plugin 2016-03-27 15:01:44 +02:00
Mikael Nordfeldth
97d177f42a Matching inherited function definition 2016-03-27 15:01:08 +02:00
Mikael Nordfeldth
2d0153195e Output proper remote info on WebFinger notice resources 2016-03-27 14:56:27 +02:00
Mikael Nordfeldth
7be4641040 Actually return an Ostatus_profile 2016-03-27 14:54:14 +02:00
Mikael Nordfeldth
4790db348d FetchRemoteNotice event call in Notice (not effective yet) 2016-03-27 14:00:05 +02:00
Mikael Nordfeldth
4d382a59d0 Use HTTPClient instead of Yadis HTTPFetcher in Linkback plugin 2016-03-24 03:01:18 +01:00
Mikael Nordfeldth
9fa18fa366 HTTPClient::quickGet now supports headers as argument
They should be in a numeric array, already formatted as headers,
ready to go. (Header-Name: Content of the header)
2016-03-24 02:44:11 +01:00
Mikael Nordfeldth
be22886be8 Catch some exceptions in Linkback 2016-03-24 02:00:16 +01:00
Mikael Nordfeldth
49a91885c9 Strictify Notice->isPublic() 2016-03-24 01:54:33 +01:00
Mikael Nordfeldth
f522c08438 Stricter typing in Realtime plugin functions 2016-03-24 01:41:58 +01:00
Mikael Nordfeldth
6b4c331060 Attachment and file handling since we could get NULL instead of File 2016-03-23 17:53:38 +01:00
Mikael Nordfeldth
2759c3f0db Debugging output in OStatus for easier reading+greping 2016-03-23 17:52:02 +01:00
Mikael Nordfeldth
e32f2b0a39 Not really necessary in practice but makes better queries 2016-03-23 17:51:13 +01:00
Mikael Nordfeldth
8c6d0759c7 If upgraded from http to https, keep hubsub->topic up to date too (thanks hannes2peer) 2016-03-23 15:37:55 +01:00
Mikael Nordfeldth
0767bf487e Use the new onUpdateKeys in dataobject for tasks on-update of keys
sets the hashkey column of the row to sha1(topic + '|' + callback)
2016-03-23 15:22:34 +01:00
Mikael Nordfeldth
f83b81b8c4 Change config webfinger/http_alias to fix/legacy_http
Set $config['fix']['legacy_http'] to perform some actions that are
needed if your site used to be served over http but now has upgraded
to https!
2016-03-23 15:21:02 +01:00
Mikael Nordfeldth
250d99d997 Allow actions to be performed on updateWithKeys
Avoids overloading and lets dataobject classes use onUpdateKeys()
to do special stuff, like if a key is made up of a hash of other fields etc.
2016-03-23 15:19:50 +01:00
Mikael Nordfeldth
8933022edc Forgot a microsummary route in the latest commit 2016-03-22 22:37:59 +01:00
Mikael Nordfeldth
dafe775ffa Microsummaries had issues and were removed in Firefox 6.0 anyway
It is argued there are many better ways to get a "micro summary" of
a profile or site.
2016-03-22 22:31:01 +01:00
Mikael Nordfeldth
53c1750f0d If the attachment is a photo, don't replace representation in oEmbed 2016-03-22 14:02:36 +01:00
Mikael Nordfeldth
f3f619cc41 entry attachment css 2016-03-22 00:03:22 +01:00
Mikael Nordfeldth
51840a6693 doActionPost for delete should use deleteAs 2016-03-21 18:07:29 +01:00
Mikael Nordfeldth
55544845db Just some comment clarification 2016-03-21 17:50:06 +01:00
Mikael Nordfeldth
86ce93b376 Notice->deleteRelated should be called from delete() 2016-03-21 17:34:03 +01:00
Neil E. Hodges
39ebb64b85 Added proper enabling and disabling of sending RTs to Twitter. 2016-03-21 07:12:52 -07:00
Mikael Nordfeldth
14cb2d5398 Merge branch 'master' into mmn_fixes 2016-03-21 12:27:04 +01:00
Mikael Nordfeldth
afdd6d39ec Some Google stuff that need to be there (or comments)
Note that these won't be shown to the enduser and will never be accessed automatically.

We should put the salmon-protocol stuff on ostatus.org
2016-03-21 12:25:04 +01:00
Mikael Nordfeldth
b4cbf620ab woops, accidentally deleted updates-from rel on mass Google-deletion 2016-03-21 12:13:01 +01:00
Mikael Nordfeldth
1ebd4f342e woops, accidentally deleted updates-from rel on mass Google-deletion 2016-03-21 12:12:24 +01:00
Mikael Nordfeldth
38f7deca78 Avoid "property of non-object" PHP notice. 2016-03-21 11:17:25 +01:00
Mikael Nordfeldth
51ef894a47 Merge branch 'master' of git.gnu.io:gnu/gnu-social into mmn_fixes 2016-03-21 03:24:15 +01:00
Mikael Nordfeldth
1e89369ef8 geometa.js doesn't exist anymore 2016-03-21 03:23:39 +01:00
Mikael Nordfeldth
a2d8305e21 Merge branch 'master' of git.gnu.io:gnu/gnu-social into mmn_fixes 2016-03-21 03:21:51 +01:00
mmn
9f84f63471 Merge branch 'new-avatar' into 'master'
Changed default avatar in neo-gnu for the more fun @mosphirit gnu.

For now I am going to propose only that change, the default avatar. In the future maybe we can use only one SVG instead multiple PNG but I want to do for now the less changes possible.

See merge request !116
2016-03-20 22:21:39 -04:00
Mikael Nordfeldth
241b965715 oEmbed CSS file 2016-03-21 03:12:24 +01:00
Mikael Nordfeldth
ae681b10e7 geometa.js doesn't exist anymore 2016-03-21 03:11:22 +01:00
Mikael Nordfeldth
980085a8a3 Merge branch 'master' of git.gnu.io:gnu/gnu-social into mmn_fixes
Conflicts:
	plugins/Minify/extlib/minify/README.txt
	plugins/Minify/extlib/minify/UPGRADING.txt
	plugins/Minify/extlib/minify/min/README.txt
	plugins/Minify/extlib/minify/min/builder/index.php
	plugins/Minify/extlib/minify/min/lib/JSMin.php
	plugins/Minify/extlib/minify/min/lib/Minify.php
	plugins/Minify/extlib/minify/min/lib/Minify/CSS.php
	plugins/Minify/extlib/minify/min/lib/Minify/CSS/Compressor.php
	plugins/Minify/extlib/minify/min/lib/Minify/Controller/Page.php
	plugins/Minify/extlib/minify/min/lib/Minify/Packer.php
	plugins/Recaptcha/RecaptchaPlugin.php
2016-03-21 03:10:19 +01:00
mmn
43178dfe10 Merge branch 'bashrc/remove_google_references' into 'master'
Remove Google References

This removes most references to:

 - Google Code
 - Google Buzz
 - Google Maps
 - Google Gears
 - General Google services promotion

There are still some remaining Google references, particularly a script within plugins/Minify. You might want to check that to see if it's really necessary and whether the javascript it points to is actually free software.

See merge request !117
2016-03-20 22:07:06 -04:00
Mikael Nordfeldth
50a10cf161 Minify is evil. 2016-03-21 03:02:22 +01:00
Mikael Nordfeldth
cd24f7d30a Issue #166 - we test exif data below, no need for error output 2016-03-21 02:56:47 +01:00
Mikael Nordfeldth
78e23bd4ec Fix issue #171 with latent htmLawed reference 2016-03-21 02:55:10 +01:00
Mikael Nordfeldth
b7c4c960e2 Don't use default_port for irc schemes 2016-03-21 02:48:37 +01:00
Mikael Nordfeldth
e64c3a1d87 irc and ircs schemes for HTMLPurifier 2016-03-21 02:46:28 +01:00
Mikael Nordfeldth
cdcf6cdb25 Hacky method to avoid cutting conversation "more" link out 2016-03-21 02:42:28 +01:00
Mikael Nordfeldth
aa3865c303 Split threaded notice list classes into own files. 2016-03-21 02:33:57 +01:00
Bob Mottram
11c57e7aee Remove Google References
This removes most references to Google, with some
remaining since they may point to things which are still
relevant. References to Google Code, Google Buzz and
Google Maps have been removed
2016-03-20 13:06:58 +00:00
Carlos Sanmartín Bustos
2bb5c5806f Changed default avatar in neo-gnu for the more fun @mosphirit gnu. 2016-03-19 12:53:59 +01:00
Mikael Nordfeldth
365f3d2aa5 Full-content oEmbed html doesn't take up all space (and renders properly) 2016-03-17 12:58:40 +01:00
Mikael Nordfeldth
102f7ab059 oEmbed neatifying (inspired by Qvitter) 2016-03-17 00:31:45 +01:00
Mikael Nordfeldth
99a2230fdb h5 and h6 don't need margin-bottom methinks 2016-03-17 00:31:32 +01:00
Mikael Nordfeldth
bf7c035f99 only direct .inline-attachment children 2016-03-16 20:37:57 +01:00
Mikael Nordfeldth
5f5e53a8d5 Merge branch 'master' into mmn_fixes 2016-03-15 16:55:39 +01:00
Mikael Nordfeldth
f4833c6c91 More verbose salmon debugging 2016-03-15 16:53:19 +01:00
Mikael Nordfeldth
f32414dd93 Upgrading from 1.1.x would make uri fields have length=255 2016-03-15 16:52:57 +01:00
Mikael Nordfeldth
349e842078 UPDATE ActivityVerb 2016-03-14 15:26:03 +01:00
Mikael Nordfeldth
ca8f0f84c4 Woops, forgot to include this file! 2016-03-14 15:25:05 +01:00
Mikael Nordfeldth
0f5ebb6827 Redundant font definitions in CSS 2016-03-10 15:15:06 +01:00
Mikael Nordfeldth
5ca2a28246 Make oEmbed handle our http/https setting better. 2016-03-10 14:20:21 +01:00
Mikael Nordfeldth
566977c136 forgot 'new' after throw 2016-03-10 13:46:19 +01:00
Mikael Nordfeldth
15c16ac54e Make sure File_thumbnail->getPath() doesn't throw NoResultException 2016-03-09 23:49:01 +01:00
Mikael Nordfeldth
bd75305560 Define-ify excluded end-characters of URL autolinking 2016-03-09 15:16:47 +01:00
Mikael Nordfeldth
c769924505 Reduce the number of allowed characters in auto-linking URLs. 2016-03-09 15:05:36 +01:00
Mikael Nordfeldth
a24c6fdb39 If our host matched in File lookup, it could throw exceptions on Router->map 2016-03-09 14:52:15 +01:00
Mikael Nordfeldth
d179afa303 Save allowed path/qstring/fragment characters in constants 2016-03-09 14:51:52 +01:00
Mikael Nordfeldth
723b49a22a throw exception instead of clientError 2016-03-09 14:17:55 +01:00
Mikael Nordfeldth
e2c6f2f96f Let's be consistent with URL verbs 2016-03-08 20:01:06 +01:00
Mikael Nordfeldth
e4310a57cd Profile->noticeCount minor change 2016-03-08 20:00:58 +01:00
Mikael Nordfeldth
4c7436e328 Match empty on "" and not just NULL 2016-03-08 02:00:34 +01:00
Mikael Nordfeldth
4360c65ed9 Super special case where we should copy files instead of mv 2016-03-08 01:59:58 +01:00
Mikael Nordfeldth
3b1181dae6 Display locally stored remote GIFs as thumbnails
Many newspapers seem to use animated GIFs as catchy header images, which
we would fail to show from oEmbed/OpenGraph fetching since they would
want us to "use File as Thumbnail", but the only place the image filename
was stored was in File_thumbnail, for the thumbnail of that file_id which
had a URL set.
2016-03-08 01:36:24 +01:00
Mikael Nordfeldth
e43fe85454 Note that you should run upgrade procedure as the PHP user 2016-03-07 23:37:07 +01:00
Mikael Nordfeldth
cfc82591da chmod 0775 directories we create
Security for the 'g+rx' should be handle by having the parent directory
inaccessible for global users, which is usually the case.
2016-03-07 23:23:32 +01:00
Mikael Nordfeldth
4e5c0e70a6 fillConfigVoids to set default value of empty config options 2016-03-07 22:55:52 +01:00
Mikael Nordfeldth
265fa12917 Relatively experimental change to store thumbnails in 'file/thumb/' (by default) 2016-03-07 22:33:34 +01:00
Mikael Nordfeldth
a3b265a477 Portability for filepath in File 2016-03-07 20:13:07 +01:00
Mikael Nordfeldth
41b64cb8a3 static function declaration 2016-03-07 20:09:15 +01:00
Mikael Nordfeldth
a0336ce48b Unnecessary debug output 2016-03-06 18:15:36 +01:00
Mikael Nordfeldth
d9538183bd Use information about activityschema public mention for Notice scope 2016-03-06 17:47:35 +01:00
Mikael Nordfeldth
158b323767 Declare AdminpanelAction::canAdmin as static, since that's how it's used. 2016-03-06 17:31:40 +01:00
Mikael Nordfeldth
6ec72b2978 Move mail_confirm_address out of mail.php 2016-03-06 17:27:40 +01:00
Mikael Nordfeldth
47ae21c08e Don't resend confirm_address if profile is silenced 2016-03-06 16:45:29 +01:00
Mikael Nordfeldth
e9516ea4dd Allow gopher: scheme in link href 2016-03-06 03:39:34 +01:00
mmn
0785e2910f Merge branch 'no_sandboxed_repeats_branch' into 'nightly'
Don't include repeated notices from sandboxed users in the public timeline



See merge request !115
2016-03-05 08:08:42 -05:00
Mikael Nordfeldth
97ac722b24 Accessibility navigation improvement 2016-03-05 12:42:53 +01:00
Mikael Nordfeldth
7ca0ff9a19 MediaFile::fromUpload handles missing local file better 2016-03-05 12:05:12 +01:00
Mikael Nordfeldth
1db02d7f36 filename_base option isn't optimal
For different "download filenames" we should use some other method.
2016-03-05 11:59:46 +01:00
Mikael Nordfeldth
204a8f1fcc PEAR Mail package updated to 1.3.0
1.3.0 (stable) was released on 2016-01-31
Source: https://pear.php.net/package/Mail
2016-03-05 02:54:13 +01:00
Mikael Nordfeldth
57d57b8d8f Handle reuploads via filehandle better if original is missing 2016-03-05 01:26:34 +01:00
Mikael Nordfeldth
bf34f730dd Use $this->scoped in AvatarsettingsAction 2016-03-05 01:03:48 +01:00
Mikael Nordfeldth
952f68fed5 File upload logging for dummies 2016-03-05 00:59:39 +01:00
hannes
7d4658643d the repeated notice can be from a sandboxed user too 2016-03-04 16:53:57 -05:00
mmn
a9bdf761e8 Merge branch 'remote-media-blacklist-mk2' into 'nightly'
add server blacklist to StoreRemoteMedia plugin

allows server admins to block local storage of remote media from particular servers while still allowing a default policy of acceptance

See merge request !114
2016-03-03 20:17:23 +00:00
Saul St John
30e70c4697 update readme 2016-03-02 16:05:40 +00:00
Saul St John
43754c7f17 add blacklist to StoreRemoteMedia plugin 2016-03-02 15:41:17 +00:00
Mikael Nordfeldth
feb97cfc22 Resend confirm_address stuff, please read its NOTE first 2016-03-02 15:48:18 +01:00
Mikael Nordfeldth
a262c16f06 Catch exception on delete of Confirm_address in a plugin 2016-03-02 15:37:47 +01:00
Mikael Nordfeldth
175b7e8541 Refactor some ConfirmaddressAction stuff 2016-03-02 15:31:48 +01:00
Mikael Nordfeldth
867cb225b6 Merge branch 'master' into mmn_fixes 2016-03-02 14:39:19 +01:00
Mikael Nordfeldth
97d8e4571f Fix a regression in 1f76c1e4 that stopped sending email confirmation on registration 2016-03-02 14:35:08 +01:00
Mikael Nordfeldth
dc1ceca86e Some more Microformats2 data for notices and rendering 2016-03-02 13:29:54 +01:00
Mikael Nordfeldth
6529fdd28d Proper Microformats2 h-entry p-name + u-uid markup 2016-03-02 13:10:02 +01:00
Mikael Nordfeldth
e4e0a39dad Only OStatus distribute if profile hasRight to PUBLICNOTICE 2016-03-02 12:42:09 +01:00
Mikael Nordfeldth
53772ba305 Some rights one does not have if either sandboxed or silenced 2016-03-02 12:41:56 +01:00
Mikael Nordfeldth
d6598e790c Introduce a ConfigException 2016-03-02 12:33:06 +01:00
Mikael Nordfeldth
9534969c05 Don't set is_local=LOCAL_NONPUBLIC on sandboxed user notices
Let's decide whether they are nonpublic by testing them when the notice
is shown instead.
2016-03-02 12:26:23 +01:00
Mikael Nordfeldth
a3b2118906 Make the public streams ModeratedNoticeStream (hide sandboxed users etc.)
Which streams should be put under ModeratedNoticeStream is probably open
to debate. But at least the public ones should hide the posts from users
that are sandboxed.
2016-03-02 11:50:50 +01:00
Mikael Nordfeldth
b4271a3533 Stricted typing + protected on FilteringNoticeStream->filter 2016-03-02 11:40:43 +01:00
Mikael Nordfeldth
79d68a52d0 No 'acct:' in FancyName please. 2016-03-02 10:49:33 +01:00
Mikael Nordfeldth
9a89990293 Some changes since getFancyName() is longer with full acct: URI 2016-03-02 00:13:28 +01:00
Mikael Nordfeldth
7ec69e4215 User->hasBlocked typing 2016-03-02 00:04:31 +01:00
Mikael Nordfeldth
99fbb181c1 Translation changes, use FancyName in email subject 2016-03-01 23:53:36 +01:00
Mikael Nordfeldth
4abb3f19bf Make Profile->getFancyUrl() somewhat better on fallback
It tries to get a referential identifier apart from the fullname trying
with acct: URI, profile URL and lastly URI.
2016-03-01 23:48:32 +01:00
Mikael Nordfeldth
ddd60e7142 Make Profile->getFancyName() return including the acct URI 2016-03-01 23:37:38 +01:00
Mikael Nordfeldth
47f408ca7c Strict typing for mail_notify_attn 2016-03-01 23:37:11 +01:00
Mikael Nordfeldth
e3431a2c91 Iterate through input=file attachments (not multi yet) 2016-03-01 18:20:50 +01:00
Mikael Nordfeldth
e41809af89 Nothing interesting was made in this commit. 2016-03-01 16:30:00 +01:00
Mikael Nordfeldth
a112e7f9a4 Use another method of detecting unspecified defaultImage size 2016-03-01 15:00:52 +01:00
Mikael Nordfeldth
63c087a255 Consistent behaviour for ScopingNoticeStream $scoped
We don't guess the current profile anymore if the value of the profile === -1

Also sets $this->scoped for all ScopingNoticeStream inheritors, which just
like in an Action can be null if we're not scoped in any way (logged in).
2016-03-01 14:51:47 +01:00
Mikael Nordfeldth
7862b853bf Make javascript XHR timeout a variable.
SN.V.xhrTimeout = [time in milliseconds];
2016-03-01 13:10:18 +01:00
Mikael Nordfeldth
da34491c59 Woops, undefined $type there. 2016-02-28 20:50:45 +01:00
mmn
d1b294e1ac Merge branch 'delete_group_logo' into 'nightly'
Now we can delete a group logo.

I added a function of deleting a group logo.

I'm not sure we should delete group's avatar through Avatar::deleteFromProfile like on line 426:
```php
Avatar::deleteFromProfile($this->group->getProfile());
```

See merge request !84
2016-02-28 18:45:31 +00:00
mmn
b9a11f8c21 Merge branch 'fix-author-fallback' into 'nightly'
Fix author fallback

Previously if there was no discernable author the nickname "Array"
would end up used.  This was a bug, obviously.  It is fixed now.

See merge request !111
2016-02-28 18:42:36 +00:00
Mikael Nordfeldth
b8643f73b7 No need to set $threads = 0 on the line before it's set ;) 2016-02-28 19:40:16 +01:00
mmn
23651c6142 Merge branch 'nightly' into 'nightly'
Enable configuration option for number of threads used by queuedaemons.php

Could we change the script for queuedaemon.php to using a configuration setting if not arguments such as -t or --threads is set?

Example in configuration file:

```
$config['queue']['threads'] = 15; //Spawning 15 threads for handling the queue
```

See merge request !105
2016-02-28 18:36:54 +00:00
Mikael Nordfeldth
2696e13b19 Refactoring ApiStatusesDestroyAction 2016-02-28 19:35:03 +01:00
Mikael Nordfeldth
446c930823 Change to more recent code style in ApiStatusesDestroyAction 2016-02-28 19:23:13 +01:00
Mikael Nordfeldth
781209a23b Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into mmn_fixes 2016-02-28 19:19:46 +01:00
mmn
065f707bd7 Merge branch 'mods_can_delete_others_notices_branch' into 'nightly'
moderators can delete others' notices using the api



See merge request !112
2016-02-28 18:19:11 +00:00
Mikael Nordfeldth
6c43e9c2e0 Verify loaded config function, must be completed further. 2016-02-28 13:31:21 +01:00
Mikael Nordfeldth
747c91210f HTMLPurifier cache settings, put stuff in subdir of get_sys_temp_dir() 2016-02-28 13:30:47 +01:00
Mikael Nordfeldth
cd978fa153 Edited the list of allowed rel values 2016-02-28 13:16:52 +01:00
abjectio
12ad588a9b Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly 2016-02-27 20:37:03 +01:00
hannes
6a0007c410 moderators can delete others' notices using the api 2016-02-27 01:03:24 +00:00
Stephen Paul Weber
9dc4f13579 Fix author fallback
Previously if there was no discernable author the nickname "Array"
would end up used.  This was a bug, obviously.  It is fixed now.
2016-02-26 22:06:04 +00:00
Mikael Nordfeldth
12f1707a74 Ostatus_source filled no purpose whatsoever 2016-02-26 22:37:26 +01:00
Mikael Nordfeldth
b4dc060d75 Don't auto-silence other users by IP by default 2016-02-26 16:10:03 +01:00
Mikael Nordfeldth
ba51a696d2 Slightly more correct log message in index.php 2016-02-26 14:53:12 +01:00
Mikael Nordfeldth
52a3764ae4 Resolve relative URLs (assuming URI.Base==notice URL)
The real way to do this would be to get the xml:base property from
the Atom feed but it's probably not there in any posts we see today.
2016-02-26 14:46:26 +01:00
Mikael Nordfeldth
1e6520fddd Woops, forgot to skip the / in path 2016-02-26 14:13:46 +01:00
Mikael Nordfeldth
6a4470912f Fiddling with merge request #98 to use internal routing functions 2016-02-26 14:10:32 +01:00
Mikael Nordfeldth
8356c2495c Use mb_* and strict === comparison 2016-02-26 13:52:25 +01:00
mmn
722ff4d9c0 Merge branch 'foolproof_file_redirection_branch' into 'nightly'
Foolproof file redirection

This solves an issue when our internal /attachment/{file_id} links are shortened with an remote shorteners (which caused the /attachment/{file_id} links to be saved to the File table and a thumbnail of a thumbnail being generated)

See merge request !98
2016-02-26 12:49:10 +00:00
Mikael Nordfeldth
a3c5ef59d6 Fix merge #101 by replacing a non-working Yahoo! link with Wikipedia
The link was meant to describe robots.txt crawl-delay info
2016-02-26 13:41:14 +01:00
mmn
5227483855 Merge branch 'rm-short-urls-docs' into 'nightly'
CONFIGURE: Replace short urls with their target

Transparency and resilience against shorteners going away.

See merge request !101
2016-02-26 12:38:26 +00:00
Mikael Nordfeldth
21778d057e Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into mmn_fixes 2016-02-26 13:37:32 +01:00
Mikael Nordfeldth
826503766e Jean Lucas mentioned that PEAR::Net_Socket was outdated
Updated Net_Socket to 1.0.14 (stable) was released on 2013-05-24
https://pear.php.net/package/Net_Socket
2016-02-26 13:35:53 +01:00
Mikael Nordfeldth
1414abfe95 Jean Lucas mentioned PEAR::Net_SMTP was outdated
Net_SMTP updated to 1.7.1 (stable) was released on 2015-09-07
https://pear.php.net/package/Net_SMTP
2016-02-26 13:34:07 +01:00
mmn
dc51354316 Merge branch 'readme-plugins' into 'nightly'
Readme plugins

* Adds several plugin READMEs
  They are pretty basic, but it's a start.

* Changes status.net/wiki URLs to git.gnu.io
  The status.net wiki is dead.

See merge request !103
2016-02-26 12:32:42 +00:00
mmn
fae9e27365 Merge branch 'group-autocomplete' into 'nightly'
Fix !group autocomplete

"Call to undefined method User_group::getFullname"

See merge request !108
2016-02-26 12:30:19 +00:00
mmn
d500fb8598 Merge branch 'remove-openid' into 'nightly'
Fix: Cannot remove OpenID

OpenidsettingsAction::removeOpenID() was comparing and int with a string
so always displayed "That OpenID does not belong to you."

See merge request !107
2016-02-26 12:30:01 +00:00
Mikael Nordfeldth
c58228195b Make sure the saved Notice has an ID 2016-02-26 01:11:20 +01:00
Mikael Nordfeldth
519e3308ab Use mb_strlen to see if something is an empty string 2016-02-26 01:04:59 +01:00
Mikael Nordfeldth
29662eef5e Mentioning matches (@this too) now. 2016-02-26 00:08:51 +01:00
Mikael Nordfeldth
2730510393 User friendlieness in scripts/delete_notice.php 2016-02-26 00:06:04 +01:00
Mikael Nordfeldth
2669c51265 Allow sgf files if they're recognized in mime search
They are Go game files used on lamatriz.org. Note that my server
doesn't actually recognize these files and can identify the mime type,
but my browser did for some reason.
2016-02-26 00:05:07 +01:00
Mikael Nordfeldth
aeb2e282db Commented on the mime extension matching regexp 2016-02-25 22:32:54 +01:00
Mikael Nordfeldth
4d17d95335 Try to get mime data before hashing (cpu intensive) 2016-02-25 22:31:45 +01:00
Mikael Nordfeldth
bac37d1714 syntax error 2016-02-25 22:17:44 +01:00
Mikael Nordfeldth
e6e1705852 Make uploads work properly if we accept _all_ attachment types
Also introduced $config['attachments']['extblacklist'] that can disable
certain file extensions (or rewrite them, for example php => phps)
2016-02-25 22:15:54 +01:00
Mikael Nordfeldth
28d9f82ab1 Merge branch 'master' into mmn_fixes 2016-02-25 20:13:39 +01:00
Mikael Nordfeldth
93f5043230 Merge branch 'master' into mmn_fixes 2016-02-25 19:47:51 +01:00
Mikael Nordfeldth
4239c952d2 $metadata->thumbnail_url is not guaranteed to be set
We should probably have a separate class for this, so we can more
easily combine different technologies similar to oEmbed/OpenGraph.
2016-02-25 19:46:17 +01:00
Mikael Nordfeldth
e69f878241 Notice getRendered() can now be called on uninserted notices 2016-02-25 15:48:37 +01:00
Mikael Nordfeldth
6d3aa3276a socialfy-your-domain made people think you needed manual interaction
I don't know why, but people started following those instructions for no
apparent reason and it ended up causing a bunch of federation issues or
homegrown cron script messes.

Maybe changing the name to "another" instead of "your" domain will make
people stop doing stuff randomly.
2016-02-25 12:33:28 +01:00
Mikael Nordfeldth
e3e3a91734 Correct comment on Notice->conversation in table schema 2016-02-24 19:34:44 +01:00
Chimo
54da2526ed Fix !group autocomplete
"Call to undefined method User_group::getFullname"
2016-02-24 13:00:15 -05:00
Chimo
99f2aba6e1 Fix: Cannot remove OpenID
OpenidsettingsAction::removeOpenID() was comparing and int with a string
so always displayed "That OpenID does not belong to you."
2016-02-24 12:42:41 -05:00
Mikael Nordfeldth
128a00c4ab Include feeds in Link HTTP headers, for easier discovery 2016-02-24 16:48:44 +01:00
Mikael Nordfeldth
1d0a448e07 Publish rel="me" in Link HTTP headers 2016-02-24 16:43:09 +01:00
Mikael Nordfeldth
731fd01139 Allow easy fetching of rel="me" values 2016-02-24 16:42:54 +01:00
Mikael Nordfeldth
3ef573f67c Default to profile size in Avatar::defaultAvatar 2016-02-24 16:42:35 +01:00
abjectio
6bcfc73175 Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly 2016-02-23 21:13:58 +01:00
hannes
501d081d3b getKV doesn't throw exception 2016-02-16 19:16:05 +00:00
abjectio
70d85c58e2 Enable configuration option for number of queuedaemon threads 2016-02-11 00:24:06 +01:00
Chimo
a614205663 Add plugin READMEs 2016-02-08 17:48:37 +00:00
Chimo
2c5cba28b6 Change status.net/wiki URLs to git.gnu.io 2016-02-08 17:48:10 +00:00
Chimo
7aca4e7463 CONFIGURE: Replace short urls with their target
Transparency and resilience against shorteners going away.
2016-02-04 15:20:37 +00:00
hannes
f708a5b016 Never save our /attachment/{file_id} links as links in the file table, return the old file 2016-01-29 00:36:30 +00:00
hannes
efd2326a29 the last url in the redirection chain can actually also be a redirection (e.g. if it's one of our /attachment/{file_id} links) 2016-01-29 00:34:32 +00:00
Akio Nishimura
d13454fb84 Now we can delete a group logo. 2016-01-21 08:10:35 +09:00
8224 changed files with 89963 additions and 107503 deletions

27
.gitignore vendored
View File

@@ -1,31 +1,18 @@
avatar/* avatar/
files/* files/
file/* file/
local/* local/
_darcs/* logs/
logs/* log/
log/* run/
run/*
config.php config.php
.htaccess .htaccess
httpd.conf httpd.conf
*.tmproj
dataobject.ini dataobject.ini
*~
*.bak *.bak
*.orig *.orig
*.rej *.rej
.#*
*.swp
.buildpath
.project
.settings
TODO.rym TODO.rym
config-*.php config-*.php
good-config.php good-config.php
lac08.log
php.log
.DS_Store
nbproject
*.mo *.mo

95
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,95 @@
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at mattl@gnu.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
## The Code of Conflict
GNU social has a high submission standard and we want to keep quality code in the
codebase and bad code out of it. As such your code will be closely scrutinized,
and you might take this criticism personally. Please understand that this is
meant to keep the standards of the codebase up, and isn't meant personally. All
the same, this isn't an excuse for poor behaviour, and a reviewer shouldn't be
misbehaving towards submitters.
If however, anyone feels personally abused, threatened, or otherwise
uncomfortable due to this process, that is not acceptable. If so, please
contact the project team at mattl@gnu.org, and they will work to resolve the issue
to the best of their ability.
As a reviewer of code, please strive to keep things civil and focused on the
technical issues involved. We are all humans, and frustrations can be high on
both sides of the process. Try to keep in mind the immortal words of Bill and
Ted, "Be excellent to each other."

784
CONFIGURE
View File

@@ -1,784 +0,0 @@
Configuration options
=====================
The main configuration file for StatusNet (excepting configurations for
dependency software) is config.php in your StatusNet directory. If you
edit any other file in the directory, like lib/default.php (where most
of the defaults are defined), you will lose your configuration options
in any upgrade, and you will wish that you had been more careful.
Starting with version 0.9.0, a Web based configuration panel has been
added to StatusNet. The preferred method for changing config options is
to use this panel.
A command-line script, setconfig.php, can be used to set individual
configuration options. It's in the scripts/ directory.
Starting with version 0.7.1, you can put config files in the
/etc/statusnet/ directory on your server, if it exists. Config files
will be included in this order:
* /etc/statusnet/statusnet.php - server-wide config
* /etc/statusnet/<servername>.php - for a virtual host
* /etc/statusnet/<servername>_<pathname>.php - for a path
* INSTALLDIR/config.php - for a particular implementation
Almost all configuration options are made through a two-dimensional
associative array, cleverly named $config. A typical configuration
line will be:
$config['section']['option'] = value;
For brevity, the following documentation describes each section and
option.
site
----
This section is a catch-all for site-wide variables.
name: the name of your site, like 'YourCompany Microblog'.
server: the server part of your site's URLs, like 'example.net'.
path: The path part of your site's URLs, like 'statusnet' or ''
(installed in root).
fancy: whether or not your site uses fancy URLs (see Fancy URLs
section above). Default is false.
logfile: full path to a file for StatusNet to save logging
information to. You may want to use this if you don't have
access to syslog.
logdebug: whether to log additional debug info like backtraces on
hard errors. Default false.
locale_path: full path to the directory for locale data. Unless you
store all your locale data in one place, you probably
don't need to use this.
language: default language for your site. Defaults to US English.
Note that this is overridden if a user is logged in and has
selected a different language. It is also overridden if the
user is NOT logged in, but their browser requests a different
langauge. Since pretty much everybody's browser requests a
language, that means that changing this setting has little or
no effect in practice.
languages: A list of languages supported on your site. Typically you'd
only change this if you wanted to disable support for one
or another language:
"unset($config['site']['languages']['de'])" will disable
support for German.
theme: Theme for your site (see Theme section). Two themes are
provided by default: 'default' and 'stoica' (the one used by
Identi.ca). It's appreciated if you don't use the 'stoica' theme
except as the basis for your own.
email: contact email address for your site. By default, it's extracted
from your Web server environment; you may want to customize it.
broughtbyurl: name of an organization or individual who provides the
service. Each page will include a link to this name in the
footer. A good way to link to the blog, forum, wiki,
corporate portal, or whoever is making the service available.
broughtby: text used for the "brought by" link.
timezone: default timezone for message display. Users can set their
own time zone. Defaults to 'UTC', which is a pretty good default.
closed: If set to 'true', will disallow registration on your site.
This is a cheap way to restrict accounts to only one
individual or group; just register the accounts you want on
the service, *then* set this variable to 'true'.
inviteonly: If set to 'true', will only allow registration if the user
was invited by an existing user.
private: If set to 'true', anonymous users will be redirected to the
'login' page. Also, API methods that normally require no
authentication will require it. Note that this does not turn
off registration; use 'closed' or 'inviteonly' for the
behaviour you want.
notice: A plain string that will appear on every page. A good place
to put introductory information about your service, or info about
upgrades and outages, or other community info. Any HTML will
be escaped.
logo: URL of an image file to use as the logo for the site. Overrides
the logo in the theme, if any.
ssllogo: URL of an image file to use as the logo on SSL pages. If unset,
theme logo is used instead.
ssl: Whether to use SSL and https:// URLs for some or all pages.
Possible values are 'always' (use it for all pages), 'never'
(don't use it for any pages), or 'sometimes' (use it for
sensitive pages that include passwords like login and registration,
but not for regular pages). Default to 'never'.
sslproxy: Whether to force GNUsocial to think it is HTTPS when the
server gives no such information. I.e. when you're using a reverse
proxy that adds the encryption layer but the webserver that runs PHP
isn't configured with a key and certificate.
sslserver: use an alternate server name for SSL URLs, like
'secure.example.org'. You should be careful to set cookie
parameters correctly so that both the SSL server and the
"normal" server can access the session cookie and
preferably other cookies as well.
shorturllength: ignored. See 'url' section below.
dupelimit: minimum time allowed for one person to say the same thing
twice. Default 60s. Anything lower is considered a user
or UI error.
textlimit: default max size for texts in the site. Defaults to 0 (no limit).
Can be fine-tuned for notices, messages, profile bios and group descriptions.
db
--
This section is a reference to the configuration options for
DB_DataObject (see <http://ur1.ca/7xp>). The ones that you may want to
set are listed below for clarity.
database: a DSN (Data Source Name) for your StatusNet database. This is
in the format 'protocol://username:password@hostname/databasename',
where 'protocol' is 'mysql' or 'mysqli' (or possibly 'postgresql', if you
really know what you're doing), 'username' is the username,
'password' is the password, and etc.
ini_yourdbname: if your database is not named 'statusnet', you'll need
to set this to point to the location of the
statusnet.ini file. Note that the real name of your database
should go in there, not literally 'yourdbname'.
db_driver: You can try changing this to 'MDB2' to use the other driver
type for DB_DataObject, but note that it breaks the OpenID
libraries, which only support PEAR::DB.
debug: On a database error, you may get a message saying to set this
value to 5 to see debug messages in the browser. This breaks
just about all pages, and will also expose the username and
password
quote_identifiers: Set this to true if you're using postgresql.
type: either 'mysql' or 'postgresql' (used for some bits of
database-type-specific SQL in the code). Defaults to mysql.
mirror: you can set this to an array of DSNs, like the above
'database' value. If it's set, certain read-only actions will
use a random value out of this array for the database, rather
than the one in 'database' (actually, 'database' is overwritten).
You can offload a busy DB server by setting up MySQL replication
and adding the slaves to this array. Note that if you want some
requests to go to the 'database' (master) server, you'll need
to include it in this array, too.
utf8: whether to talk to the database in UTF-8 mode. This is the default
with new installations, but older sites may want to turn it off
until they get their databases fixed up. See "UTF-8 database"
above for details.
schemacheck: when to let plugins check the database schema to add
tables or update them. Values can be 'runtime' (default)
or 'script'. 'runtime' can be costly (plugins check the
schema on every hit, adding potentially several db
queries, some quite long), but not everyone knows how to
run a script. If you can, set this to 'script' and run
scripts/checkschema.php whenever you install or upgrade a
plugin.
syslog
------
By default, StatusNet sites log error messages to the syslog facility.
(You can override this using the 'logfile' parameter described above).
appname: The name that StatusNet uses to log messages. By default it's
"statusnet", but if you have more than one installation on the
server, you may want to change the name for each instance so
you can track log messages more easily.
priority: level to log at. Currently ignored.
facility: what syslog facility to used. Defaults to LOG_USER, only
reset if you know what syslog is and have a good reason
to change it.
queue
-----
You can configure the software to queue time-consuming tasks, like
sending out SMS email or XMPP messages, for off-line processing. See
'Queues and daemons' above for how to set this up.
enabled: Whether to uses queues. Defaults to false.
daemon: Wather to use queuedaemon. Defaults to false, which means
you'll use OpportunisticQM plugin.
subsystem: Which kind of queueserver to use. Values include "db" for
our hacked-together database queuing (no other server
required) and "stomp" for a stomp server.
stomp_server: "broker URI" for stomp server. Something like
"tcp://hostname:61613". More complicated ones are
possible; see your stomp server's documentation for
details.
queue_basename: a root name to use for queues (stomp only). Typically
something like '/queue/sitename/' makes sense. If running
multiple instances on the same server, make sure that
either this setting or $config['site']['nickname'] are
unique for each site to keep them separate.
stomp_username: username for connecting to the stomp server; defaults
to null.
stomp_password: password for connecting to the stomp server; defaults
to null.
stomp_persistent: keep items across queue server restart, if enabled.
Under ActiveMQ, the server configuration determines if and how
persistent storage is actually saved.
If using a message queue server other than ActiveMQ, you may
need to disable this if it does not support persistence.
stomp_transactions: use transactions to aid in error detection.
A broken transaction will be seen quickly, allowing a message
to be redelivered immediately if a daemon crashes.
If using a message queue server other than ActiveMQ, you may
need to disable this if it does not support transactions.
stomp_acks: send acknowledgements to aid in flow control.
An acknowledgement of successful processing tells the server
we're ready for more and can help keep things moving smoothly.
This should *not* be turned off when running with ActiveMQ, but
if using another message queue server that does not support
acknowledgements you might need to disable this.
softlimit: an absolute or relative "soft memory limit"; daemons will
restart themselves gracefully when they find they've hit
this amount of memory usage. Defaults to 90% of PHP's global
memory_limit setting.
inboxes: delivery of messages to receiver's inboxes can be delayed to
queue time for best interactive performance on the sender.
This may however be annoyingly slow when using the DB queues,
so you can set this to false if it's causing trouble.
breakout: for stomp, individual queues are by default grouped up for
best scalability. If some need to be run by separate daemons,
etc they can be manually adjusted here.
Default will share all queues for all sites within each group.
Specify as <group>/<queue> or <group>/<queue>/<site>,
using nickname identifier as site.
'main/distrib' separate "distrib" queue covering all sites
'xmpp/xmppout/mysite' separate "xmppout" queue covering just 'mysite'
max_retries: for stomp, drop messages after N failed attempts to process.
Defaults to 10.
dead_letter_dir: for stomp, optional directory to dump data on failed
queue processing events after discarding them.
stomp_no_transactions: for stomp, the server does not support transactions,
so do not try to user them. This is needed for http://www.morbidq.com/.
stomp_no_acks: for stomp, the server does not support acknowledgements.
so do not try to user them. This is needed for http://www.morbidq.com/.
license
-------
The default license to use for your users notices. The default is the
Creative Commons Attribution 3.0 license, which is probably the right
choice for any public site. Note that some other servers will not
accept notices if you apply a stricter license than this.
type: one of 'cc' (for Creative Commons licenses), 'allrightsreserved'
(default copyright), or 'private' (for private and confidential
information).
owner: for 'allrightsreserved' or 'private', an assigned copyright
holder (for example, an employer for a private site). If
not specified, will be attributed to 'contributors'.
url: URL of the license, used for links.
title: Title for the license, like 'Creative Commons Attribution 3.0'.
image: A button shown on each page for the license.
mail
----
This is for configuring out-going email. We use PEAR's Mail module,
see: http://pear.php.net/manual/en/package.mail.mail.factory.php
backend: the backend to use for mail, one of 'mail', 'sendmail', and
'smtp'. Defaults to PEAR's default, 'mail'.
params: if the mail backend requires any parameters, you can provide
them in an associative array.
nickname
--------
This is for configuring nicknames in the service.
blacklist: an array of strings for usernames that may not be
registered. A default array exists for strings that are
used by StatusNet (e.g. 'doc', 'main', 'avatar', 'theme')
but you may want to add others if you have other software
installed in a subdirectory of StatusNet or if you just
don't want certain words used as usernames.
featured: an array of nicknames of 'featured' users of the site.
Can be useful to draw attention to well-known users, or
interesting people, or whatever.
avatar
------
For configuring avatar access.
dir: Directory to look for avatar files and to put them into.
Defaults to avatar subdirectory of install directory; if
you change it, make sure to change path, too.
path: Path to avatars. Defaults to path for avatar subdirectory,
but you can change it if you wish. Note that this will
be included with the avatar server, too.
server: If set, defines another server where avatars are stored in the
root directory. Note that the 'avatar' subdir still has to be
writeable. You'd typically use this to split HTTP requests on
the client to speed up page loading, either with another
virtual server or with an NFS or SAMBA share. Clients
typically only make 2 connections to a single server at a
time <http://ur1.ca/6ih>, so this can parallelize the job.
Defaults to null.
ssl: Whether to access avatars using HTTPS. Defaults to null, meaning
to guess based on site-wide SSL settings.
public
------
For configuring the public stream.
localonly: If set to true, only messages posted by users of this
service (rather than other services, filtered through OStatus)
are shown in the public stream. Default true.
blacklist: An array of IDs of users to hide from the public stream.
Useful if you have someone making excessive Twitterfeed posts
to the site, other kinds of automated posts, testing bots, etc.
autosource: Sources of notices that are from automatic posters, and thus
should be kept off the public timeline. Default empty.
theme
-----
server: Like avatars, you can speed up page loading by pointing the
theme file lookup to another server (virtual or real).
Defaults to NULL, meaning to use the site server.
dir: Directory where theme files are stored. Used to determine
whether to show parts of a theme file. Defaults to the theme
subdirectory of the install directory.
path: Path part of theme URLs, before the theme name. Relative to the
theme server. It may make sense to change this path when upgrading,
(using version numbers as the path) to make sure that all files are
reloaded by caching clients or proxies. Defaults to null,
which means to use the site path + '/theme'.
ssl: Whether to use SSL for theme elements. Default is null, which means
guess based on site SSL settings.
sslserver: SSL server to use when page is HTTPS-encrypted. If
unspecified, site ssl server and so on will be used.
sslpath: If sslserver if defined, path to use when page is HTTPS-encrypted.
javascript
----------
server: You can speed up page loading by pointing the
theme file lookup to another server (virtual or real).
Defaults to NULL, meaning to use the site server.
path: Path part of Javascript URLs. Defaults to null,
which means to use the site path + '/js/'.
ssl: Whether to use SSL for JavaScript files. Default is null, which means
guess based on site SSL settings.
sslserver: SSL server to use when page is HTTPS-encrypted. If
unspecified, site ssl server and so on will be used.
sslpath: If sslserver if defined, path to use when page is HTTPS-encrypted.
bustframes: If true, all web pages will break out of framesets. If false,
can comfortably live in a frame or iframe... probably. Default
to true.
xmpp
----
For configuring the XMPP sub-system.
enabled: Whether to accept and send messages by XMPP. Default false.
server: server part of XMPP ID for update user.
port: connection port for clients. Default 5222, which you probably
shouldn't need to change.
user: username for the client connection. Users will receive messages
from 'user'@'server'.
resource: a unique identifier for the connection to the server. This
is actually used as a prefix for each XMPP component in the system.
password: password for the user account.
host: some XMPP domains are served by machines with a different
hostname. (For example, @gmail.com GTalk users connect to
talk.google.com). Set this to the correct hostname if that's the
case with your server.
encryption: Whether to encrypt the connection between StatusNet and the
XMPP server. Defaults to true, but you can get
considerably better performance turning it off if you're
connecting to a server on the same machine or on a
protected network.
debug: if turned on, this will make the XMPP library blurt out all of
the incoming and outgoing messages as XML stanzas. Use as a
last resort, and never turn it on if you don't have queues
enabled, since it will spit out sensitive data to the browser.
public: an array of JIDs to send _all_ notices to. This is useful for
participating in third-party search and archiving services.
invite
------
For configuring invites.
enabled: Whether to allow users to send invites. Default true.
tag
---
Miscellaneous tagging stuff.
dropoff: Decay factor for tag listing, in seconds.
Defaults to exponential decay over ten days; you can twiddle
with it to try and get better results for your site.
popular
-------
Settings for the "popular" section of the site.
dropoff: Decay factor for popularity listing, in seconds.
Defaults to exponential decay over ten days; you can twiddle
with it to try and get better results for your site.
daemon
------
For daemon processes.
piddir: directory that daemon processes should write their PID file
(process ID) to. Defaults to /var/run/, which is where this
stuff should usually go on Unix-ish systems.
user: If set, the daemons will try to change their effective user ID
to this user before running. Probably a good idea, especially if
you start the daemons as root. Note: user name, like 'daemon',
not 1001.
group: If set, the daemons will try to change their effective group ID
to this named group. Again, a name, not a numerical ID.
emailpost
---------
For post-by-email.
enabled: Whether to enable post-by-email. Defaults to true. You will
also need to set up maildaemon.php.
sms
---
For SMS integration.
enabled: Whether to enable SMS integration. Defaults to true. Queues
should also be enabled.
integration
-----------
A catch-all for integration with other systems.
taguri: base for tag:// URIs. Defaults to site-server + ',2009'.
inboxes
-------
For notice inboxes.
enabled: No longer used. If you set this to something other than true,
StatusNet will no longer run.
throttle
--------
For notice-posting throttles.
enabled: Whether to throttle posting. Defaults to false.
count: Each user can make this many posts in 'timespan' seconds. So, if count
is 100 and timespan is 3600, then there can be only 100 posts
from a user every hour.
timespan: see 'count'.
profile
-------
Profile management.
biolimit: max character length of bio; 0 means no limit; null means to use
the site text limit default.
backup: whether users can backup their own profiles. Defaults to true.
restore: whether users can restore their profiles from backup files. Defaults
to true.
delete: whether users can delete their own accounts. Defaults to false.
move: whether users can move their accounts to another server. Defaults
to true.
newuser
-------
Options with new users.
default: nickname of a user account to automatically subscribe new
users to. Typically this would be system account for e.g.
service updates or announcements. Users are able to unsub
if they want. Default is null; no auto subscribe.
welcome: nickname of a user account that sends welcome messages to new
users. Can be the same as 'default' account, although on
busy servers it may be a good idea to keep that one just for
'urgent' messages. Default is null; no message.
If either of these special user accounts are specified, the users should
be created before the configuration is updated.
attachments
-----------
The software lets users upload files with their notices. You can configure
the types of accepted files by mime types and a trio of quota options:
per file, per user (total), per user per month.
We suggest the use of the pecl file_info extension to handle mime type
detection.
supported: an array of mime types you accept to store and distribute,
like 'image/gif', 'video/mpeg', 'audio/mpeg', etc. Make sure you
setup your server to properly recognize the types you want to
support.
uploads: false to disable uploading files with notices (true by default).
For quotas, be sure you've set the upload_max_filesize and post_max_size
in php.ini to be large enough to handle your upload. In httpd.conf
(if you're using apache), check that the LimitRequestBody directive isn't
set too low (it's optional, so it may not be there at all).
process_links: follow redirects and save all available file information
(mimetype, date, size, oembed, etc.). Defaults to true.
file_quota: maximum size for a single file upload in bytes. A user can send
any amount of notices with attachments as long as each attachment
is smaller than file_quota.
user_quota: total size in bytes a user can store on this server. Each user
can store any number of files as long as their total size does
not exceed the user_quota.
monthly_quota: total size permitted in the current month. This is the total
size in bytes that a user can upload each month.
dir: directory accessible to the Web process where uploads should go.
Defaults to the 'file' subdirectory of the install directory, which
should be writeable by the Web user.
server: server name to use when creating URLs for uploaded files.
Defaults to null, meaning to use the default Web server. Using
a virtual server here can speed up Web performance.
path: URL path, relative to the server, to find files. Defaults to
main path + '/file/'.
ssl: whether to use HTTPS for file URLs. Defaults to null, meaning to
guess based on other SSL settings.
sslserver: if specified, this server will be used when creating HTTPS
URLs. Otherwise, the site SSL server will be used, with /file/ path.
sslpath: if this and the sslserver are specified, this path will be used
when creating HTTPS URLs. Otherwise, the attachments|path value
will be used.
show_thumbs: show thumbnails in notice lists for uploaded images, and photos
and videos linked remotely that provide oEmbed info. Defaults to true.
show_html: show (filtered) text/html attachments (and oEmbed HTML etc.).
Doesn't affect AJAX calls. Defaults to false.
filename_base: for new files, choose one: 'upload', 'hash'. Defaults to hash.
group
-----
Options for group functionality.
maxaliases: maximum number of aliases a group can have. Default 3. Set
to 0 or less to prevent aliases in a group.
desclimit: maximum number of characters to allow in group descriptions.
null (default) means to use the site-wide text limits. 0
means no limit.
addtag: Whether to add a tag for the group nickname for every group post
(pre-1.0.x behaviour). Defaults to false.
search
------
Some stuff for search.
type: type of search. Ignored if PostgreSQL or Sphinx are enabled. Can either
be 'fulltext' or 'like' (default). The former is faster and more efficient
but requires the lame old MyISAM engine for MySQL. The latter
will work with InnoDB but could be miserably slow on large
systems. We'll probably add another type sometime in the future,
with our own indexing system (maybe like MediaWiki's).
sessions
--------
Session handling.
handle: boolean. Whether we should register our own PHP session-handling
code (using the database and cache layers if enabled). Defaults to false.
Setting this to true makes some sense on large or multi-server
sites, but it probably won't hurt for smaller ones, either.
debug: whether to output debugging info for session storage. Can help
with weird session bugs, sometimes. Default false.
ping
----
Using the "XML-RPC Ping" method initiated by weblogs.com, the site can
notify third-party servers of updates.
notify: an array of URLs for ping endpoints. Default is the empty
array (no notification).
notice
------
Configuration options specific to notices.
contentlimit: max length of the plain-text content of a notice.
Default is null, meaning to use the site-wide text limit.
0 means no limit.
defaultscope: default scope for notices. If null, the default
scope depends on site/private. It's 1 if the site is private,
0 otherwise. Set this value to override.
message
-------
Configuration options specific to messages.
contentlimit: max length of the plain-text content of a message.
Default is null, meaning to use the site-wide text limit.
0 means no limit.
logincommand
------------
Configuration options for the login command.
disabled: whether to enable this command. If enabled, users who send
the text 'login' to the site through any channel will
receive a link to login to the site automatically in return.
Possibly useful for users who primarily use an XMPP or SMS
interface and can't be bothered to remember their site
password. Note that the security implications of this are
pretty serious and have not been thoroughly tested. You
should enable it only after you've convinced yourself that
it is safe. Default is 'false'.
singleuser
----------
If an installation has only one user, this can simplify a lot of the
interface. It also makes the user's profile the root URL.
enabled: Whether to run in "single user mode". Default false.
nickname: nickname of the single user. If no nickname is specified,
the site owner account will be used (if present).
robotstxt
---------
We put out a default robots.txt file to guide the processing of
Web crawlers. See http://www.robotstxt.org/ for more information
on the format of this file.
crawldelay: if non-empty, this value is provided as the Crawl-Delay:
for the robots.txt file. see http://ur1.ca/l5a0
for more information. Default is zero, no explicit delay.
disallow: Array of (virtual) directories to disallow. Default is 'main',
'search', 'message', 'settings', 'admin'. Ignored when site
is private, in which case the entire site ('/') is disallowed.
api
---
Options for the Twitter-like API.
realm: HTTP Basic Auth realm (see http://tools.ietf.org/html/rfc2617
for details). Some third-party tools like ping.fm want this to be
'Identi.ca API', so set it to that if you want to. default = null,
meaning 'something based on the site name'.
nofollow
--------
We optionally put 'rel="nofollow"' on some links in some pages. The
following configuration settings let you fine-tune how or when things
are nofollowed. See http://en.wikipedia.org/wiki/Nofollow for more
information on what 'nofollow' means.
subscribers: whether to nofollow links to subscribers on the profile
and personal pages. Default is true.
members: links to members on the group page. Default true.
peopletag: links to people listed in the peopletag page. Default true.
external: external links in notices. One of three values: 'sometimes',
'always', 'never'. If 'sometimes', then external links are not
nofollowed on profile, notice, and favorites page. Default is
'sometimes'.
url
---
These are some options for fine-tuning how and when the server will
shorten URLs.
shortener: URL shortening service to use by default. Users can override
individually. 'internal' by default.
maxurllength: If an URL is strictly longer than this limit, it will be
shortened. Note that the URL shortener service may return an
URL longer than this limit. Defaults to 100. Users can
override. If set to 0, all URLs will be shortened.
maxnoticelength: If a notice is strictly longer than this limit, all
URLs in the notice will be shortened. Users can override.
-1 means the text limit for notices.
router
------
We use a router class for mapping URLs to code. This section controls
how that router works.
cache: whether to cache the router in cache layers. Defaults to true,
but may be set to false for developers (who might be actively
adding pages, so won't want the router cached) or others who see
strange behavior. You're unlikely to need this unless developing..
http
----
Settings for the HTTP client.
ssl_cafile: location of the CA file for SSL. If not set, won't verify
SSL peers. Default unset.
curl: Use cURL <http://curl.haxx.se/> for doing HTTP calls. You must
have the PHP curl extension installed for this to work.
proxy_host: Host to use for proxying HTTP requests. If unset, doesn't
do any HTTP proxy stuff. Default unset.
proxy_port: Port to use to connect to HTTP proxy host. Default null.
proxy_user: Username to use for authenticating to the HTTP proxy. Default null.
proxy_password: Password to use for authenticating to the HTTP proxy. Default null.
proxy_auth_scheme: Scheme to use for authenticating to the HTTP proxy. Default null.
plugins
-------
default: associative array mapping plugin name to array of arguments. To disable
a default plugin, unset its value in this array.
locale_path: path for finding plugin locale files. In the plugin's directory
by default.
server: Server to find static files for a plugin when the page is plain old HTTP.
Defaults to site/server (same as pages). Use this to move plugin CSS and
JS files to a CDN.
sslserver: Server to find static files for a plugin when the page is HTTPS. Defaults
to site/server (same as pages). Use this to move plugin CSS and JS files
to a CDN.
path: Path to the plugin files. defaults to site/path + '/plugins/'. Expects that
each plugin will have a subdirectory at plugins/NameOfPlugin. Change this
if you're using a CDN.
sslpath: Path to use on the SSL server. Same as plugins/path.
performance
-----------
high: if you need high performance, or if you're seeing bad
performance, set this to true. It will turn off some high-intensity code from
the site.
oldschool
---------
enabled: enable certain old-style user settings options, like stream-only mode,
conversation trees, and nicknames in streams. Off by default, and
may not be well supported in future versions.

112
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,112 @@
# Contributing to GNU social
First of all, if you're reading this intending to contribute to GNU social,
thanks! Free software development only happens when people like you take an
interest in giving back to the software they themselves use, and their
community.
When contributing to this repository, please first discuss the change you wish to
make via issue, email, or any other method with the owners of this repository before
making a change.
There's a few files you should read before going forward with a merge request
or a patch submission. They detail what this file touches on in brief. They
are:
* `DOCUMENTATION/DEVELOPERS/CONTRIBUTING/coding_standards.md`: How your code should be structured and formatted to be
accepted into the GNU social codebase.
* `/DOCUMENTATION/DEVELOPERS/CONTRIBUTING/merge_request_checklist.md`: A quick checklist to review before submission.
## Merge Request Process
1. Ensure you strip any trailing spaces off and checked the file with php-cs-fixer
2. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.
## Coding Standards
Since we will be expected to maintain your code once it's submitted, we ask you
to adhere to certain coding standards that make it easier for us to do so. If
code doesn't follow them, it will be rejected, so please read up on these.
## Bug Reports
Please report bugs to the issue tracker at
<https://notabug.org/diogo/gnu-social/issues> Avoid assigning the labels
yourself, as these are for the development team to assign priority and area of
coverage to a subject. Please only submit something here if you are certain it
is a bug or represents a feature enhancement that we do not presently have. If
you are uncertain whether it's a bug, please feel free to ask
at #social IRC channel on freenode.net https://www.freenode.net/.
When reporting a bug, please try to include as much information as possible,
including the environment being run on (if it's a common LAMP stack just give
us version numbers of the main stack components, that's fine), and the specific
error you get. If you do not get a client-facing error, please check the PHP
error_log and ensure there isn't something silently reported there, as well as
the GNU social log. Try to include steps to reproduce the error as well, as if
we cannot reproduce the error, we can't fix it!
It is perfectly acceptable to reference the archive page of a discussion on the
mailing list for the bug report, by the way, as long as it includes all the
information we need for a bug report.
## Submitting Feature Requests / Enhancement Requests
Social media is constantly evolving, and we welcome ideas about how we can
change and evolve GNU social to keep it the excellent piece of software that it
is. However, there are a few things we ask you do when submitting feature
requests:
1. Understand that since we have a limited amount of developers and these people
contribute in their free time, we may prioritize things differently than you
value them. Oftentimes this is because certain requests involve less changes
to the existing codebase than others, and therefore this makes them easier
to add.
2. Please search the existing feature requests and enhancements to see if a
similar request exists. If one does but you have different ideas about how
to do it or what it should entail, please add a comment to the existing idea
rather than create a new one for your "version" of it. Duplicate submissions
mean we spend more time maintaining the tracker and less time actually
working on the codebase!
3. When outlining the way that you see something working, don't be afraid to be
as detailed as possible! We may not implement it exactly as you describe for
any variety of reasons, but the more concrete and fleshed out an idea is, the
easier it is for us to know what you want and be able to implement it in a
sane and secure fashion.
4. When describing a possible new idea and its mechanisms of operation, the key
words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the issue submission
are to be interpreted as described in RFC 2119.
<https://tools.ietf.org/html/rfc2119>
Finally, and just as a call back to the first point, realize just because we
might not rush to implement something, doesn't mean that we don't want to
implement it! We would rather take the time to do something right the first
time, then hurriedly apply a new idea, or a fix, only to have to patch it later.
## Branch of Code Submissions
Unless you've been specifically directed otherwise, all submissions of code
should be against the `nightly` branch, so make sure any modifications are based
on Nightly.
## Copyright / Licensing
You acknowledge that by submitting code to GNU social, you are licensing it under
the GNU AGPLv3 unless there is an extenuating circumstance where it would be
licensed differently (such as modifications to an external library we include
such as Stomp).
You also acknowledge that unless you assign a copyright explicitly, it will be
assumed to be assigned to GNU social.
Thanks for considering submission, and happy hacking!

99
CREDITS.md Normal file
View File

@@ -0,0 +1,99 @@
Credits for GNU social
======================
The following is an incomplete list of developers
who've worked on GNU social, or its predecessors
StatusNet and Free Social. Apologies for any
oversight; please let mattl@gnu.org know if
anyone's been overlooked in error.
Current team
------------
* Matt Lee
* Mikael Nordfeldth
* Diogo Cordeiro
* Bruno Casteleiro
* Miguel Dantas
* Alexei Sorokin
Additional Contributors
-----------------------
* Ciaran Gultnieks
* Michael Landers
* Ori Avtalion
* Garret Buell
* Mike Cochrane
* Matthew Gregg
* Sean Murphy
* Leslie Michael Orchard
* Eric Helgeson
* Ken Sedgwick
* Brian Hendrickson
* Tobias Diekershoff
* Dan Moore
* Fil
* Jeff Mitchell
* Brenda Wallace
* Jeffery To
* Federico Marani
* mEDI
* Brett Taylor
* Brigitte Schuster
* Craig Andrews
* Donald Robertson
* Deb Nicholson
* Ian Denhart
* Steven DuBois
* Blaine Cook
* Henry Story
* Melvin Carvalho
* chimo
* Akio
* Maiyannah Bishop
* Bob Mottram
* David Yip
* Neil E Hodges
* Moonman
* Normandy
* Verius
* Alexei Sorokin
* Daniel Supernault
Credits for StatusNet
--------------
Leads
* Evan Prodromou
* Zach Copley
Team
* Earle Martin
* Marie-Claude Doyon
* Sarven Capadisli
* Robin Millette
* Brion Vibber
* James Walker
* Samantha Doherty
* Florian Biree
* Erik Stambaugh
* 'drry'
* Gina Haeussge
* Tryggvi Björgvinsson
* Adrian Lang
* Ori Avtalion
* Meitar Moscovitz
* Ken Sheppardson
* Simon Waters, Surevine
* Joshua Judson Rosen (rozzin)
Translators
-----------
* Siebrand Mazeland
* Tiago 'gouki' Faria
* TranslateWiki.net
A special thanks to the thousands of people who
have tried out GNU social, told their friends, and
built the fediverse network to what it is today.
License help from
-----------------
* Bradley M. Kuhn

View File

@@ -0,0 +1,61 @@
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* Description of this file.
*
* @package samples
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
namespace samples;
defined('GNUSOCIAL') || die();
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'SampleHandler.php');
/**
* Description of this class.
*
* @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class MySampleClass
{
/**
* Constructor for the sample class.
*
* @param string $dummy_word just because.
* @param int $result another just because.
*/
public function __construct(string $dummy_word = '', int $result = null)
{
global $demo;
$this->niceWorld();
}
/**
* How cool is this function.
*
* @return string
*/
public function niceWorld() : string
{
return 'hello, world.';
}
}

View File

@@ -0,0 +1,275 @@
GNU social Coding Style
===========================
Please comply with [PSR-2](https://www.php-fig.org/psr/psr-2/) and the following standard when working on GNU social
if you want your patches accepted and modules included in supported releases.
If you see code which doesn't comply with the below, please fix it :)
Strings
-------------------------------------------------------------------------------
Use `'` instead of `"` for strings, where substitutions aren't required.
This is a performance issue, and prevents a lot of inconsistent coding styles.
When using substitutions, use curly braces around your variables - like so:
$var = "my_var: {$my_var}";
Comments and Documentation
-------------------------------------------------------------------------------
Comments go on the line ABOVE the code, NOT to the right of the code, unless it is very short.
All functions and methods are to be documented using PhpDocumentor - https://docs.phpdoc.org/guides/
File Headers
-------------------------------------------------------------------------------
File headers follow a consistent format, as such:
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* Description of this file.
*
* @package samples
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
Please use it.
A few notes:
* The description of the file doesn't have to be exhaustive. Rather it's
meant to be a short summary of what's in this file and what it does. Try
to keep it to 1-5 lines. You can get more in-depth when documenting
individual functions!
* You'll probably see files with multiple authors, this is by
design - many people contributed to GNU social or its forebears! If you
are modifying an existing file, APPEND your own author line, and update
the copyright year if needed. Do not replace existing ones.
You may find `boilerplate.php` useful when creating a new file from scratch.
Paragraph spacing
-------------------------------------------------------------------------------
Where-ever possible, try to keep the lines to 80 characters. Don't
sacrifice readability for it though - if it makes more sense to have it in
one longer line, and it's more easily read that way, that's fine.
With assignments, avoid breaking them down into multiple lines unless
neccesary, except for enumerations and arrays.
'If' statements format
-------------------------------------------------------------------------------
Use switch statements where many else if's are going to be used. Switch/case is faster
if ($var == 'example') {
echo 'This is only an example';
} else {
echo 'This is not a test. This is the real thing';
}
Do NOT make if statements like this:
if ($var == 'example'){ echo 'An example'; }
OR this
if($var = 'example')
echo "An {$var}";
Associative arrays
-------------------------------------------------------------------------------
Always use `[]` instead of `array()`. Associative arrays must be written in the
following manner:
$array = [
'var' => 'value',
'var2' => 'value2'
];
Note that spaces are preferred around the '=>'.
A note about shorthands
-------------------------------------------------------------------------------
Some short hands are evil:
- Use the long format for `<?php`. Do NOT use `<?`.
- Use the long format for `<?php` echo. Do NOT use `<?=`.
Naming conventions
-------------------------------------------------------------------------------
Respect PSR2 first.
- Classes use PascalCase (e.g. MyClass).
- Functions/Methods use camelCase (e.g. myFunction).
- Variables use snake_case (e.g. my_variable).
A note on variable names, etc. It must be possible to understand what is meant
without neccesarialy seeing it in context, because the code that calls something
might not always make it clear.
So if you have something like:
$notice->post($contents);
Well I can easily tell what you're doing there because the names are straight-
forward and clear.
Something like this:
foo->bar();
Is much less clear.
Also, whereever possible, avoid ambiguous terms. For example, don't use text
as a term for a variable. Call back to "contents" above.
Comparisons
-------------------------------------------------------------------------------
Always use symbol based comparison operators (&&, ||) instead of text based
operators (AND, OR) as they are evaluated in different orders and at different
speeds. This is will prevent any confusion or strange results.
Use English
-------------------------------------------------------------------------------
All variables, classes, methods, functions and comments must be in English.
Bad english is easier to work with than having to babelfish code to work out
how it works.
Encoding
-------------------------------------------------------------------------------
Files should be in UTF-8 encoding with UNIX line endings.
No ending tag
-------------------------------------------------------------------------------
Files should not end with an ending php tag "?>". Any whitespace after the
closing tag is sent to the browser and cause errors, so don't include them.
Nesting Functions
-------------------------------------------------------------------------------
Avoid, if at all possible. When not possible, document the living daylights
out of why you're nesting it. It's not always avoidable, but PHP 5 has a lot
of obscure problems that come up with using nested functions.
If you must use a nested function, be sure to have robust error-handling.
This is a must and submissions including nested functions that do not have
robust error handling will be rejected and you'll be asked to add it.
Scoping
-------------------------------------------------------------------------------
Properly enforcing scope of functions is something many PHP programmers don't
do, but should.
In general:
* Variables unique to a class should be protected and use interfacing to
change them. This allows for input validation and making sure we don't have
injection, especially when something's exposed to the API, that any program
can use, and not all of them are going to be be safe and trusted.
* Variables not unique to a class should be validated prior to every call,
which is why it's generally not a good idea to re-use stuff across classes
unless there's significant performance gains to doing so.
* Classes should protect functions that they do not want overriden, but they
should avoid protecting the constructor and destructor and related helper
functions as this prevents proper inheritance.
Typecasting
-------------------------------------------------------------------------------
PHP is a soft-typed language and it falls to us developers to make sure that
we are using the proper inputs. Where ever possible use explicit type casting.
Where it in't, you're going to have to make sure that you check all your
inputs before you pass them.
All outputs should be cast as an explicit PHP type.
Not properly typecasting is a shooting offence. Soft types let programmers
get away with a lot of lazy code, but lazy code is buggy code, and frankly, I
don't want it in GNU social if it's going to be buggy.
Consistent exception handling
-------------------------------------------------------------------------------
Consistency is key to good code to begin with, but it is especially important
to be consistent with how we handle errors. GNU social has a variety of built-
in exception classes. Use them, wherever it's possible and appropriate, and
they will do the heavy lifting for you.
Additionally, ensure you clean up any and all records and variables that need
cleanup in a function using try { } finally { } even if you do not plan on
catching exceptions (why wouldn't you, though? That's silly.)
If you do not call an exception handler, you must, at a minimum, record errors
to the log using common_log(level, message)
Ensure all possible control flows of a function have exception handling and
cleanup, where appropriate. Don't leave endpoints with unhandled exceptions.
Try not to leave something in an error state if it's avoidable.
Return values
-------------------------------------------------------------------------------
All functions must return a value. Every single one. This is not optional.
If you are simply making a procedure call, for example as part of a helper
function, then return boolean TRUE on success, and the exception on failure.
When returning the exception, return the whole nine yards, which is to say the
actual PHP exception object, not just an error message.
All return values not the above should be type cast, and you should sanitize
anything returned to ensure it fits into the cast. You might technically make
an integer a string, for instance, but you should be making sure that integer
SHOULD be a string, if you're returning it, and that it is a valid return
value.
A vast majority of programming errors come down to not checking your inputs
and outputs properly, so please try to do so as best and thoroughly as you can.
Layout and Location of files
-------------------------------------------------------------------------------
`/actions/` contains files that determine what happens when something "happens":
for instance, when someone favourites or repeats a notice. Code that is
related to a "happening" should go here.
`/classes/` contains abstract definitions of certain "things" in the codebase
such as a user or notice. If you're making a new "thing", it goes here.
`/lib/` is basically the back-end. Actions will call something in here to get
stuff done usually, which in turn will probably manipulate information stored
in one or more records represented by a class.
`/extlib/` is where external libraries are located. If you include a new
external library, it goes here.
`/plugins/` This is a great way to modularize your own new features. If you want
to create new core features for GNU social, it is probably best to create a
module unless you absolutely must override or modify the core behaviours.

View File

@@ -0,0 +1,32 @@
Submission Checklist
================================================================================
This document serves as a handy checklist for submitted merges and patches to
the postActiv project. Following it isn't a gaurantee a patch will be accepted,
but it will help you avoid common problems.
1. Ensure all code control paths in all functions return a value.
2. Ensure all exceptions are trapped in an exception class, or minimally,
written to the log with common_log
3. Ensure the coding format standards are adhered to (see coding_standards.md)
4. Ensure that any new class that deals in public data has a corresponding new
API endpoint.
5. Ensure that all new API endpoints sanitize inputs and outputs properly.
6. Ensure that your version of the code works with PHP 7 on a standard
LAMP and LEMP stack (Linux+Apache+MariaDB+PHP and Linux+nginx+MariaDB+PHP)
7. If implementing new database functions, ensure they work with MariaDB
and postgreSQL.
8. Ensure all data that federates does so properly and has mechanisms to
catch and accomodate for federation transmission failure.
9. Ensure that nothing is left in an error state when it is avoidable.
10. Ensure that all code submitted is properly documented.
11. Ensure that there are no PHP Strict Standards or Parse errors in the code.

View File

@@ -42,11 +42,10 @@ EndShowUAStyles: End showing custom User-Agent links; good place to add user-age
StartShowScripts: Showing JavaScript links StartShowScripts: Showing JavaScript links
- $action: the current action - $action: the current action
EndShowScripts: End showing JavaScript links; good place to add custom EndShowScripts: End showing JavaScript links; good place to add custom links
links like Google Analytics
- $action: the current action - $action: the current action
StartShowJQueryScripts: Showing JQuery script links (use this to link to e.g. Google mirrors) StartShowJQueryScripts: Showing JQuery script links
- $action: the current action - $action: the current action
EndShowJQueryScripts: End showing JQuery script links EndShowJQueryScripts: End showing JQuery script links

View File

@@ -77,7 +77,7 @@ Plugins are configured using public instance attributes. To set their values,
site administrators use this syntax: site administrators use this syntax:
```php ```php
addPlugin('Sample', array('attr1' => 'foo', 'attr2' => 'bar')); addPlugin('Sample', ('attr1' => 'foo', 'attr2' => 'bar'));
``` ```
The same plugin class can be initialized multiple times with different arguments: The same plugin class can be initialized multiple times with different arguments:
@@ -260,11 +260,11 @@ Take arguments for running
This method is called first, and it lets the action class get all its arguments This method is called first, and it lets the action class get all its arguments
and validate them. It's also the time to fetch any relevant data from the database. and validate them. It's also the time to fetch any relevant data from the database.
Action classes should run parent::prepare($args) as the first line of this Action classes should run parent::prepare(array $args = []) as the first line
method to make sure the default argument-processing happens. of this method to make sure the default argument-processing happens.
```php ```php
function prepare($args) function prepare(array $args = [])
{ {
parent::prepare($args); parent::prepare($args);
@@ -286,9 +286,9 @@ should be done in the prepare() method; by the time handle() is called the
action should be more or less ready to go. action should be more or less ready to go.
```php ```php
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }

View File

@@ -0,0 +1,957 @@
Configuration options
================================================================================
The main configuration file for GNU social (excepting configurations for
dependency software) is config.php in your GNU social directory. If you edit any
other file in the directory, like `lib/default.php` (where most of the defaults
are defined), you will lose your configuration options in any upgrade, and you
will wish that you had been more careful.
Starting with version 0.9.0, a Web based configuration panel has been added to
GNU social. The preferred method for changing config options is to use this
panel.
A command-line script, setconfig.php, can be used to set individual
configuration options. It's in the scripts/ directory.
Starting with version 0.7.1, you can put config files in the /etc/GNU social/
directory on your server, if it exists. Config files will be included in this
order:
* `/etc/GNU social/statusnet.php` - server-wide config
* `/etc/GNU social/<servername>.php` - for a virtual host
* `/etc/GNU social/<servername>_<pathname>.php` - for a path
* `INSTALLDIR/config.php` - for a particular implementation
Almost all configuration options are made through a two-dimensional
associative array, cleverly named $config. A typical configuration
line will be:
$config['section']['option'] = value;
For brevity, the following documentation describes each section and
option.
site
-------------------------------------------------------------------------------
This section is a catch-all for site-wide variables.
* `name` (string, required, default "Another GNU social Instance"): the name of
your site, like 'YourCompany Microblog'.
* `server` (string, required, default null): the server part of your site's URLs,
like 'example.net'.
* `path` (string, required, default ''): The path part of your site's URLs, like
'statusnet' or '' (installed in root).
* `fancy` (string, default false): whether or not your site uses fancy URLs (see Fancy URLs
section above).
* `logfile` (string, default './'): full path to a file for GNU social to save
logging information to. You may want to use this if you don't have access
to syslog.
* `logdebug` (boolean, default false): whether to log additional debug info like
backtraces on hard errors.
* `locale_path` (string, default null): full path to the directory for locale
data. Unless you store all your locale data in one place, you probably
don't need to use this.
* `language` (string, default "en_us"): default language for your site. Defaults
to US English. Note that this is overridden if a user is logged in and has
selected a different language. It is also overridden if the user is NOT
logged in, but their browser requests a different langauge. Since pretty
much everybody's browser requests a language, that means that changing
this setting has little or no effect in practice.
* `languages` (array, default null): A list of languages supported on your site.
Typically you'd only change this if you wanted to disable support for one or
another language:
"unset($config['site']['languages']['de'])" will disable
support for German.
* `theme` (string, default 'default'): Theme for your site (see Theme section).
Two themes are provided by default: 'default' and 'stoica' (the one used by
Identi.ca). It's appreciated if you don't use the 'stoica' theme except as
the basis for your own.
* `email` (string, required): contact email address for your site. By default,
it's extracted from your Web server environment; you may want to customize it.
* `broughtbyurl` (string, default null): name of an organization or individual
who provides the service. Each page will include a link to this name in the
footer. A good way to link to the blog, forum, wiki, corporate portal, or
whoever is making the service available.
* `broughtby` (string, default null): text used for the "brought by" link.
* `timezone` (string, default 'UTC'): default timezone for message display. Users
can set their own time zone. Defaults to 'UTC', which is a pretty good
default.
* `closed` (boolean, default false): If set to 'true', will disallow registration
on your site. This is a cheap way to restrict accounts to only one
individual or group; just register the accounts you want on the service,
*then* set this variable to 'true'.
* `inviteonly` (boolean, default false): If set to 'true', will only allow
registration if the user was invited by an existing user.
* `private` (boolean, default false): If set to 'true', anonymous users will be
redirected to the 'login' page. Also, API methods that normally require no
authentication will require it. Note that this does not turn off
registration; use 'closed' or 'inviteonly' for the behaviour you want.
* `notice` (string, default null): A plain string that will appear on every
page. A good place to put introductory information about your service, or
info about upgrades and outages, or other community info. Any HTML will be
escaped.
* `logo` (string, default null): URL of an image file to use as the logo for the
site. Overrides the logo in the theme, if any.
* `ssllogo` (string, default null): URL of an image file to use as the logo on
SSL pages. If unset, theme logo is used instead.
* `ssl` (enum['always','sometimes','never'], default 'never'): Whether to use SSL
and https:// URLs for some or all pages.
Possible values are 'always' (use it for all pages), 'never' (don't use it
for any pages), or 'sometimes' (use it for sensitive pages that include
passwords like login and registration, but not for regular pages).
* `sslproxy` (boolean, default false): Whether to force GNUsocial to think it
is HTTPS when the server gives no such information. I.e. when you're using
a reverse proxy that adds the encryption layer but the webserver that runs
PHP isn't configured with a key and certificate.
* `sslserver` (string, default null): use an alternate server name for SSL URLs,
like 'secure.example.org'. You should be careful to set cookie parameters
correctly so that both the SSL server and the "normal" server can access
the session cookie and preferably other cookies as well.
* `dupelimit` (integer, default 60): minimum time allowed for one person to say
the same thing twice. Default 60s. Anything lower is considered a user or
UI error.
* `textlimit` (integer, default 0): default max size for texts in the site. Can
be fine-tuned for notices, messages, profile bios and group descriptions.
Zero indicates no limit.
db
-------------------------------------------------------------------------------
This section is a reference to the configuration options for
`DB_DataObject` (see
<http://pear.php.net/manual/en/package.database.db-dataobject.intro-configuration.php>).
The ones that you may want to set are listed below for clarity.
* `database` (string, required, default null): a DSN (Data Source Name) for your
GNU social database. This is in the format
'protocol://username:password@hostname/databasename', where 'protocol' is '
mysql' or 'mysqli' (or possibly 'postgresql', if you really know what
you're doing), 'username' is the username, 'password' is the password,
and etc.
* `ini_yourdbname` (string, default null): if your database is not named 'statusnet',
you'll need to set this to point to the location of the statusnet.ini file.
Note that the real name of your database should go in there, not literally
'yourdbname'.
* `db_driver`(enum['DB','MDB2'], default null): You can try changing this to
'MDB2' to use the other driver type for DB_DataObject, but note that it
breaks the OpenID libraries, which only support PEAR::DB.
* `quote_identifiers`(boolean, default false): Set this to true if you're using
postgresql.
* `type` (enum["mysql", "postgresql"], default 'mysql'): Used for certain
database-specific optimization code. Assumes mysql if not set. MySQL also
covers MySQLi and MariaDB.
* `mirror` (array, default null): you can set this to an array of DSNs, in the
format of the above 'database' value. If it's set, certain read-only
actions will use a random value out of this array for the database, rather
than the one in 'database' (actually, 'database' is overwritten). You can
offload a busy DB server by setting up MySQL replication and adding the
slaves to this array. Note that if you want some requests to go to the
'database' (master) server, you'll need to include it in this array, too.
* `utf8` (boolean, true): whether to talk to the database in UTF-8 mode. This is
the default with new installations, but older sites may want to turn it off
until they get their databases fixed up. See "UTF-8 database" above for
details.
* `schemacheck` (enum["runtime", "script"], default "runtime"): when to let
plugins check the database schema to add tables or update them. 'runtime'
can be costly (plugins check the schema on every hit, adding potentially
several db queries, some quite long), but not everyone knows how to run a
script or has the access in their hosting environment to do so. If you can,
set this to 'script' and run scripts/checkschema.php whenever you install
or upgrade a plugin.
syslog
-------------------------------------------------------------------------------
By default, GNU social sites log error messages to the syslog facility.
(You can override this using the 'logfile' parameter described above).
* `appname` (string, default `'GNU social'`): The name that GNU social uses to log
messages. By default it's "GNU social", but if you have more than one
installation on the server, you may want to change the name for each
instance so you can track log messages more easily.
* `facility` (string, default `'LOG_USER'`): what syslog facility to use. Only set
this if you know what syslog is and have a good reason to change it.
queue
-------------------------------------------------------------------------------
You can configure the software to queue time-consuming tasks, like
sending out SMS email or XMPP messages, for off-line processing. See
'Queues and daemons' above for how to set this up.
* `enabled` (boolean, default false): Whether to uses queues.
* `daemon` (boolean, default false): Wather to use queuedaemon. False means
you'll use OpportunisticQM plugin.
* `subsystem` (enum["db", "stomp"], default 'db'): Which kind of queueserver to
use. Values include "db" for our hacked-together database queuing (no
other server required), "stomp" for a stomp server, and "redis" for a Redis
server.
* `threads` (int): How many queue "threads" (actually processes) to run. Defaults to
number of cpu cores in unix-like systems or 1 on other OSes.
* `items_to_handle` (int): How many items to handle before a daemon process exits.
Default to unlimited.
* `stomp_server` (string, default null): "broker URI" for stomp server.
Something like "tcp://hostname:61613". More complicated ones are possible;
see your stomp server's documentation for details.
* `queue_basename` (string, default null): a root name to use for queues (stomp
only). Typically something like '/queue/sitename/' makes sense. If running
multiple instances on the same server, make sure that either this setting
or $config['site']['nickname'] are unique for each site to keep them
separate.
* `stomp_username` (string, default null): username for connecting to the stomp
server.
* `stomp_password` (string, default null): password for connecting to the stomp
server.
* `stomp_persistent` (boolean, default true): Keep items across queue server
restart, if enabled. Note: Under ActiveMQ, the server configuration
determines if and how persistent storage is actually saved.
If using a message queue server other than ActiveMQ, you may
need to disable this if it does not support persistence.
* `stomp_transactions` (boolean, default true): use transactions to aid in error
detection. A broken transaction will be seen quickly, allowing a message to
be redelivered immediately if a daemon crashes.
If using a message queue server other than ActiveMQ, you may need to
disable this if it does not support transactions.
* `stomp_acks` (boolean, default true): send acknowledgements to aid in flow
control. An acknowledgement of successful processing tells the server we're
ready for more and can help keep things moving smoothly.
This should *not* be turned off when running with ActiveMQ, (it breaks if
you do), but if using another message queue server that does not support
acknowledgements you might need to disable this.
* `softlimit` (integer): an absolute or relative "soft memory limit"; daemons
will restart themselves gracefully when they find they've hit this amount
of memory usage. Defaults to 90% of PHP's global memory_limit setting.
* `inboxes` (boolean, default true): delivery of messages to receiver's inboxes
can be delayed to queue time for best interactive performance on the
sender. This may however be annoyingly slow when using the DB queues, so
you can set this to false if it's causing trouble.
* `breakout` (array, default null): for stomp, individual queues are by default
grouped up for best scalability. If some need to be run by separate daemons,
etc they can be manually adjusted here.
Default will share all queues for all sites within each group.
Specify as <group>/<queue> or <group>/<queue>/<site>,
using nickname identifier as site.
'main/distrib' separate "distrib" queue covering all sites
'xmpp/xmppout/mysite' separate "xmppout" queue covering just 'mysite'
* `max_retries` (integer, default 10): for stomp, drop messages after N failed
attempts to process.
* `dead_letter_dir` (string, default null): for stomp, optional directory to dump
data on failed queue processing events after discarding them.
* `stomp_no_transactions` (boolean, default false): for stomp, the server does
not support transactions, so do not try to user them. This is needed for
http://www.morbidq.com/
* `stomp_no_acks` (boolean, default false): for stomp, the server does not
support acknowledgements so do not try to user them. This is needed for
http://www.morbidq.com/.
license
-------------------------------------------------------------------------------
The default license to use for your users notices. The default is the
Creative Commons Attribution 3.0 license, which is probably the right
choice for any public site. Note that some other servers will not
accept notices if you apply a stricter license than this.
As of 2016, this is largely disregarded in the Fediverse -mb
* `type` (enum["cc", "allrightsreserved", "private"], default 'cc'): one of
'cc' (for Creative Commons licenses), 'allrightsreserved' (default
copyright), or 'private' (for private and confidential information).
* `owner` (string, default 'contributors'): for 'allrightsreserved' or
'private', an assigned copyright holder (for example, an employer for a
private site).
* `url` (string, default null): URL of the license, used for links.
* `title` (string, default null): Title for the license, like 'Creative Commons
Attribution 3.0'.
* `image` (string, default null): URL of a button shown on each page for the
license.
mail
-------------------------------------------------------------------------------
This is for configuring out-going email. We use PEAR's Mail module,
see: http://pear.php.net/manual/en/package.mail.mail.factory.php
* `backend` (enum["mail", "sendmail", "smtp"], default 'mail'): The backend to
use for mail. While this defaults to PEAR mail, we recommend SMTP where your
setup supports it as it is of the three the more difficult one for script
exploits to abuse (relatively speaking - they all have potential problems.)
* `params` (array, default null): if the mail backend requires any parameters,
you can provide them in an associative array.
* `templates_path` (string, default null): alias for `site->mail_path`
nickname
-------------------------------------------------------------------------------
This is for configuring nicknames in the service.
* `blacklist` (array, default null): an array of strings for usernames that
may not be registered. A hard-coded default array exists for strings that
are used by GNU social (e.g. 'doc', 'main', 'avatar', 'theme') but you may
want to add others if you have other software installed in a subdirectory
of GNU social or if you just don't want certain words used as usernames.
* `featured` (array, default null): an array of nicknames of 'featured' users of
the site. Can be useful to draw attention to well-known users, or
interesting people, or whatever.
avatar
-------------------------------------------------------------------------------
For configuring avatar access.
* `dir` (string, default './avatar'): Directory to look for avatar files and to
put them into. Defaults to avatar subdirectory of install directory; if
you change it, make sure to change path, too.
* `path` (string, 'default './avatar'): Path to avatars. Defaults to path for
avatar subdirectory, but you can change it if you wish. Note that this will
be included with the avatar server, too.
* `server` (string, default null): If set, defines another server where avatars
are stored in the root directory. Note that the 'avatar' subdir still has
to be writeable. You'd typically use this to split HTTP requests on the
client to speed up page loading, either with another virtual server or
with an NFS or SAMBA share. Clients typically only make 2 connections to a
single server at a time
<https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4>,
so this can parallelize the job.
* `ssl` (boolean, default null): Whether to access avatars using HTTPS. Defaults
to null, meaning to guess based on site-wide SSL settings.
public
-------------------------------------------------------------------------------
For configuring the public stream.
* `localonly` (boolean, default true): If set to true, only messages posted by
users of this service (rather than other services, filtered through
OStatus) are shown in the public stream. Default true.
* `blacklist` (array, default null): An array of IDs of users to hide from the
public stream. Useful if you have someone making excessive Twitterfeed
posts to the site, other kinds of automated posts, testing bots, etc.
* `autosource` (array, default null): Sources of notices that are from automatic
posters, and thus should be kept off the public timeline.
theme
-------------------------------------------------------------------------------
* `server` (string, default null): Like avatars, you can speed up page loading
by pointing the theme file lookup to another server (virtual or real).
The default of null will use the same server as PA.
* `dir` (string, default "./themes"): Directory where theme files are stored.
Used to determine whether to show parts of a theme file. Defaults to the
theme subdirectory of the install directory.
* `path` (string, default null): Path part of theme URLs, before the theme name. Relative to the
theme server. It may make sense to change this path when upgrading,
(using version numbers as the path) to make sure that all files are
reloaded by caching clients or proxies. Defaults to null,
which means to use the site path + '/theme'.
* `ssl` (boolean, default null): Whether to use SSL for theme elements. Default
is null, which means guess based on site SSL settings.
* `sslserver` (string, default null): SSL server to use when page is
HTTPS-encrypted. If unspecified, site ssl server and so on will be used.
* `sslpath` (string, default null): If sslserver if defined, path to use when
page is HTTPS-encrypted.
javascript
-------------------------------------------------------------------------------
* `server` (string, default null): You can speed up page loading by pointing the
theme file lookup to another server (virtual or real). Defaults to NULL,
meaning to use the site server.
* `path` (string default null): Path part of Javascript URLs. Defaults to null,
which means to use the site path + '/js/'.
* `ssl` (boolean, default null): Whether to use SSL for JavaScript files.
Default is null, which means guess based on site SSL settings.
* `sslserver` (string, default null): SSL server to use when page is HTTPS-
encrypted. If unspecified, site ssl server and so on will be used.
* `sslpath` (string, default null): If sslserver if defined, path to use when
page is HTTPS-encrypted.
* `bustframes` (boolean, default true): If true, all web pages will break out of
framesets. If false, can comfortably live in a frame or iframe... probably.
xmpp
-------------------------------------------------------------------------------
For configuring the XMPP sub-system.
* `enabled` (boolean, default false): Whether to accept and send messages by
XMPP. Default false.
* `server` (string, default null): Server part of XMPP ID for update user.
* `port` (integer, default 5222): Connection port for clients.
* `user` (string, default null): Username for the client connection. Users will
receive messages from 'user'@'server'.
* `resource`: a unique identifier for the connection to the server. This
is actually used as a prefix for each XMPP component in the system.
* `password`: password for the user account.
* `host`: some XMPP domains are served by machines with a different
hostname. Set this to the correct hostname if that's the
case with your server.
* `encryption`: Whether to encrypt the connection between GNU social and the
XMPP server. Defaults to true, but you can get
considerably better performance turning it off if you're
connecting to a server on the same machine or on a
protected network.
* `debug`: if turned on, this will make the XMPP library blurt out all of
the incoming and outgoing messages as XML stanzas. Use as a
last resort, and never turn it on if you don't have queues
enabled, since it will spit out sensitive data to the browser.
* `public`: an array of JIDs to send _all_ notices to. This is useful for
participating in third-party search and archiving services.
invite
-------------------------------------------------------------------------------
For configuring invites.
* `enabled`: Whether to allow users to send invites. Default true.
tag
-------------------------------------------------------------------------------
Miscellaneous tagging stuff.
* `dropoff`: Decay factor for tag listing, in seconds.
Defaults to exponential decay over ten days; you can twiddle
with it to try and get better results for your site.
popular
-------------------------------------------------------------------------------
Settings for the "popular" section of the site.
* `dropoff`: Decay factor for popularity listing, in seconds.
Defaults to exponential decay over ten days; you can twiddle
with it to try and get better results for your site.
daemon
-------------------------------------------------------------------------------
For daemon processes.
* `piddir`: directory that daemon processes should write their PID file
(process ID) to. Defaults to /var/run/, which is where this
stuff should usually go on Unix-ish systems.
* `user`: If set, the daemons will try to change their effective user ID
to this user before running. Probably a good idea, especially if
you start the daemons as root. Note: user name, like 'daemon',
not 1001.
* `group`: If set, the daemons will try to change their effective group ID
to this named group. Again, a name, not a numerical ID.
emailpost
-------------------------------------------------------------------------------
For post-by-email.
* `enabled`: Whether to enable post-by-email. Defaults to true. You will
also need to set up maildaemon.php.
sms
-------------------------------------------------------------------------------
For SMS integration.
* `enabled`: Whether to enable SMS integration. Defaults to true. Queues
should also be enabled.
integration
-------------------------------------------------------------------------------
A catch-all for integration with other systems.
* `taguri`: base for tag:// URIs. Defaults to site-server + ',2009'.
inboxes
-------------------------------------------------------------------------------
For notice inboxes.
* `enabled`: No longer used. If you set this to something other than true,
GNU social will no longer run.
throttle
-------------------------------------------------------------------------------
For notice-posting throttles.
* `enabled`: Whether to throttle posting. Defaults to false.
* `count`: Each user can make this many posts in 'timespan' seconds. So, if count
is 100 and timespan is 3600, then there can be only 100 posts
from a user every hour.
* `timespan`: see 'count'.
profile
-------------------------------------------------------------------------------
Profile management.
* `biolimit`: max character length of bio; 0 means no limit; null means to use
the site text limit default.
* `backup`: whether users can backup their own profiles. Defaults to true.
* `restore`: whether users can restore their profiles from backup files. Defaults
to true.
* `delete`: whether users can delete their own accounts. Defaults to false.
* `move`: whether users can move their accounts to another server. Defaults
to true.
newuser
-------------------------------------------------------------------------------
Options with new users.
* `default`: nickname of a user account to automatically subscribe new
users to. Typically this would be system account for e.g.
service updates or announcements. Users are able to unsub
if they want. Default is null; no auto subscribe.
* `welcome`: nickname of a user account that sends welcome messages to new
users. Can be the same as 'default' account, although on
busy servers it may be a good idea to keep that one just for
'urgent' messages. Default is null; no message.
If either of these special user accounts are specified, the users should
be created before the configuration is updated.
attachments
-------------------------------------------------------------------------------
The software lets users upload files with their notices. You can configure
the types of accepted files by mime types and a trio of quota options:
per file, per user (total), per user per month.
We suggest the use of the pecl file_info extension to handle mime type
detection.
* `supported`: an array of mime types you accept to store and distribute,
like 'image/gif', 'video/mpeg', 'audio/mpeg', etc. Make sure you
setup your server to properly recognize the types you want to
support. It's important to use the result of calling `image_type_to_extension`
for the appropriate image type, in the case of images. This is so all parts of
the code see the same extension for each image type (jpg vs jpeg).
For example, to enable BMP uploads, add this to the config.php file:
$config['attachments']['supported'][image_type_to_mime_type(IMAGETYPE_GIF)]
= image_type_to_extension(IMAGETYPE_GIF);
See https://www.php.net/manual/en/function.image-type-to-mime-type.php for a
list of such constants. If a filetype is not listed there, it's possible to add
the mimetype and the extension by hand, but they need to match those returned by
the file command.
* `uploads`: false to disable uploading files with notices (true by default).
For quotas, be sure you've set the upload_max_filesize and post_max_size
in php.ini to be large enough to handle your upload. In httpd.conf
(if you're using apache), check that the LimitRequestBody directive isn't
set too low (it's optional, so it may not be there at all).
* `process_links`: follow redirects and save all available file information
(mimetype, date, size, oembed, etc.). Defaults to true.
* `file_quota`: maximum size for a single file upload in bytes. A user can send
any amount of notices with attachments as long as each attachment
is smaller than file_quota.
* `user_quota`: total size in bytes a user can store on this server. Each user
can store any number of files as long as their total size does
not exceed the user_quota.
* `monthly_quota`: total size permitted in the current month. This is the total
size in bytes that a user can upload each month.
* `dir`: directory accessible to the Web process where uploads should go.
Defaults to the 'file' subdirectory of the install directory, which
should be writeable by the Web user.
* `server`: server name to use when creating URLs for uploaded files.
Defaults to null, meaning to use the default Web server. Using
a virtual server here can speed up Web performance.
* `path`: URL path, relative to the server, to find files. Defaults to
main path + '/file/'.
* `ssl`: whether to use HTTPS for file URLs. Defaults to null, meaning to
guess based on other SSL settings.
* `sslserver`: if specified, this server will be used when creating HTTPS
URLs. Otherwise, the site SSL server will be used, with /file/ path.
* `sslpath`: if this and the sslserver are specified, this path will be used
when creating HTTPS URLs. Otherwise, the attachments|path value
will be used.
* `show_thumbs`: show thumbnails in notice lists for uploaded images, and photos
and videos linked remotely that provide oEmbed info. Defaults to true.
* `show_html`: show (filtered) text/html attachments (and oEmbed HTML etc.).
Doesn't affect AJAX calls. Defaults to false.
* `filename_base`: for new files, choose one: 'upload', 'hash'. Defaults to hash.
group
-------------------------------------------------------------------------------
Options for group functionality.
* `maxaliases`: maximum number of aliases a group can have. Default 3. Set
to 0 or less to prevent aliases in a group.
* `desclimit`: maximum number of characters to allow in group descriptions.
null (default) means to use the site-wide text limits. 0
means no limit.
* `addtag`: Whether to add a tag for the group nickname for every group post
(pre-1.0.x behaviour). Defaults to false.
search
-------------------------------------------------------------------------------
Some stuff for search.
* `type`: type of search. Ignored if PostgreSQL or Sphinx are enabled. Can either
be 'fulltext' or 'like' (default). The former is faster and more efficient
but requires the lame old MyISAM engine for MySQL. The latter
will work with InnoDB but could be miserably slow on large
systems. We'll probably add another type sometime in the future,
with our own indexing system (maybe like MediaWiki's).
sessions
-------------------------------------------------------------------------------
Session handling.
* `handle`: boolean. Whether we should register our own PHP session-handling
code (using the database and cache layers if enabled). Defaults to false.
Setting this to true makes some sense on large or multi-server
sites, but it probably won't hurt for smaller ones, either.
* `debug`: whether to output debugging info for session storage. Can help
with weird session bugs, sometimes. Default false.
ping
-------------------------------------------------------------------------------
Using the "XML-RPC Ping" method initiated by weblogs.com, the site can
notify third-party servers of updates.
* `notify`: an array of URLs for ping endpoints. Default is the empty
array (no notification).
notice
-------------------------------------------------------------------------------
Configuration options specific to notices.
* `contentlimit`: max length of the plain-text content of a notice.
Default is null, meaning to use the site-wide text limit.
0 means no limit.
* `defaultscope`: default scope for notices. If null, the default
scope depends on site/private. It's 1 if the site is private,
0 otherwise. Set this value to override.
message
-------------------------------------------------------------------------------
Configuration options specific to messages.
* `contentlimit`: max length of the plain-text content of a message.
Default is null, meaning to use the site-wide text limit.
0 means no limit.
logincommand
-------------------------------------------------------------------------------
Configuration options for the login command.
* `disabled`: whether to enable this command. If enabled, users who send
the text 'login' to the site through any channel will
receive a link to login to the site automatically in return.
Possibly useful for users who primarily use an XMPP or SMS
interface and can't be bothered to remember their site
password. Note that the security implications of this are
pretty serious and have not been thoroughly tested. You
should enable it only after you've convinced yourself that
it is safe. Default is 'false'.
singleuser
-------------------------------------------------------------------------------
If an installation has only one user, this can simplify a lot of the
interface. It also makes the user's profile the root URL.
* `enabled` (boolean, default true): Whether to run in "single user mode".
* `nickname` (string, default null): nickname of the single user. If no nickname is
specified, the site owner account will be used (if present).
robotstxt
-------------------------------------------------------------------------------
We put out a default robots.txt file to guide the processing of
Web crawlers. See http://www.robotstxt.org/ for more information
on the format of this file.
* `crawldelay`: if non-empty, this value is provided as the Crawl-Delay:
for the robots.txt file. see <https://en.wikipedia.org/wiki/Robots_exclusion_standard#Crawl-delay_directive>
for more information. Default is zero, no explicit delay.
* `disallow`: Array of (virtual) directories to disallow. Default is 'main',
'search', 'message', 'settings', 'admin'. Ignored when site
is private, in which case the entire site ('/') is disallowed.
api
---
Options for the Twitter-like API.
* `realm`: HTTP Basic Auth realm (see http://tools.ietf.org/html/rfc2617
for details). Some third-party tools like ping.fm want this to be
'Identi.ca API', so set it to that if you want to. default = null,
meaning 'something based on the site name'.
nofollow
--------
We optionally put 'rel="nofollow"' on some links in some pages. The
following configuration settings let you fine-tune how or when things
are nofollowed. See http://en.wikipedia.org/wiki/Nofollow for more
information on what 'nofollow' means.
* `subscribers`: whether to nofollow links to subscribers on the profile
and personal pages. Default is true.
* `members`: links to members on the group page. Default true.
* `peopletag`: links to people listed in the peopletag page. Default true.
* `external`: external links in notices. One of three values: 'sometimes',
'always', 'never'. If 'sometimes', then external links are not
nofollowed on profile, notice, and favorites page. Default is
'sometimes'.
url
---
These are some options for fine-tuning how and when the server will
shorten URLs.
* `shortener`: URL shortening service to use by default. Users can override
individually. 'internal' by default.
* `maxurllength`: If an URL is strictly longer than this limit, it will be
shortened. Note that the URL shortener service may return an
URL longer than this limit. Defaults to 100. Users can
override. If set to 0, all URLs will be shortened.
* `maxnoticelength`: If a notice is strictly longer than this limit, all
URLs in the notice will be shortened. Users can override.
-1 means the text limit for notices.
router
------
We use a router class for mapping URLs to code. This section controls
how that router works.
* `cache`: whether to cache the router in cache layers. Defaults to true,
but may be set to false for developers (who might be actively
adding pages, so won't want the router cached) or others who see
strange behavior. You're unlikely to need this unless developing..
http
----
Settings for the HTTP client.
* `ssl_cafile`: location of the CA file for SSL. If not set, won't verify
SSL peers. Default unset.
* `curl`: Use cURL <http://curl.haxx.se/> for doing HTTP calls. You must
have the PHP curl extension installed for this to work.
* `proxy_host`: Host to use for proxying HTTP requests. If unset, doesn't
do any HTTP proxy stuff. Default unset.
* `proxy_port`: Port to use to connect to HTTP proxy host. Default null.
* `proxy_user`: Username to use for authenticating to the HTTP proxy. Default null.
* `proxy_password`: Password to use for authenticating to the HTTP proxy. Default null.
* `proxy_auth_scheme`: Scheme to use for authenticating to the HTTP proxy. Default null.
plugins
-------
* `default`: associative array mapping plugin name to array of arguments. To disable
a default plugin, unset its value in this array.
* `locale_path`: path for finding plugin locale files. In the plugin's directory
by default.
* `server`: Server to find static files for a plugin when the page is plain old HTTP.
Defaults to site/server (same as pages). Use this to move plugin CSS and
JS files to a CDN.
* `sslserver`: Server to find static files for a plugin when the page is HTTPS. Defaults
to site/server (same as pages). Use this to move plugin CSS and JS files
to a CDN.
* `path`: Path to the plugin files. defaults to site/path + '/plugins/'. Expects that
each plugin will have a subdirectory at plugins/NameOfPlugin. Change this
if you're using a CDN.
* `sslpath`: Path to use on the SSL server. Same as plugins/path.
performance
-----------
* `high`: if you need high performance, or if you're seeing bad
performance, set this to true. It will turn off some high-intensity code from
the site.
oldschool
---------
* `enabled`: enable certain old-style user settings options, like stream-only mode,
conversation trees, and nicknames in streams. Off by default, and
may not be well supported in future versions.

View File

@@ -10,13 +10,13 @@ and has a choice of accepting or rejecting the events.
In the simplest case, you can add a function to config.php and use the In the simplest case, you can add a function to config.php and use the
Event::addHandler() function to hook an event: Event::addHandler() function to hook an event:
function AddGoogleLink($action) function AddMyWebsiteLink($action)
{ {
$action->menuItem('http://www.google.com/', _('Google'), _('Search engine')); $action->menuItem('http://mywebsite.net/', _('My web site'), _('Example web link'));
return true; return true;
} }
Event::addHandler('EndPrimaryNav', 'AddGoogleLink'); Event::addHandler('EndPrimaryNav', 'AddMyWebsiteLink');
This adds a menu item to the end of the main navigation menu. You can This adds a menu item to the end of the main navigation menu. You can
see the list of existing events, and parameters that handlers must see the list of existing events, and parameters that handlers must

View File

@@ -11,6 +11,9 @@ and follow this procedure:
0. Backup your data. The StatusNet upgrade discussions below have some 0. Backup your data. The StatusNet upgrade discussions below have some
guidelines to back up the database and files (mysqldump and rsync). guidelines to back up the database and files (mysqldump and rsync).
MAKE SURE YOU ARE THE SAME USER THAT RUNS THE PHP FILES WHILE PERFORMING
THE COMMANDS BELOW (I usually prepend the commands with 'sudo -u social')
1. Stop your queue daemons (you can run this command even if you do not 1. Stop your queue daemons (you can run this command even if you do not
use the queue daemons): use the queue daemons):
$ bash scripts/stopdaemons.sh $ bash scripts/stopdaemons.sh

View File

@@ -0,0 +1,89 @@
server {
listen [::]:80;
listen 80;
# FIXME: Change domain name here (and also make sure you do the same in the next 'server' section)
server_name social.example.org;
# redirect all traffic to HTTPS
rewrite ^ https://$host$request_uri? permanent;
}
server {
# HTTPS is mandatory on GNU social unless you are using Tor network. Seriously.
# Set it up with a cert (any cert) before you run the install.
listen [::]:443 ssl http2;
listen 443 ssl http2;
# Root
# FIXME: Change the path below to where you installed GNU social
root /path/to/gnusocial/root;
# Server name
# FIXME: Change "social.example.org" to your site's domain name
server_name social.example.org;
# SSL
# FIXME: Change the paths to setup your SSL key/cert. See https://cipherli.st/ for more information
ssl_certificate ssl/certs/social.example.org.crt;
ssl_certificate_key ssl/private/social.example.org.key;
# Index
index index.php;
# PHP
location ~ ^/(index|install)\.php$ {
#location ^~ /index.php {
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
# Don't allow any PHP file other than index.php to be executed
# This will ensure that nor config.php nor plugin files with eventual hardcoded security information are downloadable
# And this is better than allowing php files to be executed in case of forgotten `if (!defined('GNUSOCIAL')) { exit(1); }`
location ~ \.php$ {
deny all;
}
# Location
location / {
try_files $uri $uri/ @index_handler;
}
# Fancy URLs
error_page 404 @index_handler;
location @index_handler {
rewrite ^(.*)$ /index.php?p=$1 last;
}
# Restrict access that is unnecessary anyway
location ~ /\.(ht|git) {
deny all;
}
#
# Hardening (optional)
#
# add_header Strict-Transport-Security "max-age=15768000; preload;";
# add_header X-Content-Type-Options nosniff;
# add_header Referrer-Policy strict-origin-when-cross-origin;
# add_header Content-Security-Policy "default-src 'self' 'unsafe-inline'; frame-ancestors 'self'; form-action 'self'; style-src 'self' 'unsafe-inline'; img-src * blob: data:;";
# add_header X-Permitted-Cross-Domain-Policies none;
# add_header X-Robots-Tag all; # Not really hardening, just here for strictness purposes
#
# client_max_body_size 15M;
# client_body_buffer_size 128k;
# gzip_vary on;
#
# location ~* \.(?:css|js|woff|svg|gif|png|webp|ttf|ico|jpe?g)$ {
# gzip on;
# gzip_comp_level 4;
# add_header Cache-Control "public";
# expires 30d;
# access_log off;
# log_not_found off;
# }
}

View File

@@ -16,6 +16,7 @@ TABLE OF CONTENTS
* After installation * After installation
- Backups - Backups
- Upgrading - Upgrading
* Additional configuration
Prerequisites Prerequisites
============= =============
@@ -26,32 +27,32 @@ PHP modules
The following software packages are *required* for this software to The following software packages are *required* for this software to
run correctly. run correctly.
- PHP 5.5+ For newer versions, some functions that are used may be - PHP 7+ PHP7.x is also supported.
disabled by default, such as the pcntl_* family. See the - MariaDB 5+ MariaDB 10.x is also supported.
section on 'Queues and daemons' for more information.
- MariaDB 5+ GNU Social uses, by default, a MariaDB server for data
storage. Versions 5.x and 10.x have both reportedly
worked well. It is also possible to run MySQL 5.5+.
- Web server Apache, lighttpd and nginx will all work. CGI mode is - Web server Apache, lighttpd and nginx will all work. CGI mode is
recommended and also some variant of 'suexec' (or a recommended and also some variant of 'suexec' (or a
proper setup php-fpm pool) proper setup php-fpm pool)
NOTE: mod_rewrite or its equivalent is extremely useful. NOTE: mod_rewrite or its equivalent is extremely useful.
Your PHP installation must include the following PHP extensions for a Your PHP installation must include the following PHP extensions for a
functional setup of GNU Social: functional setup of GNU social:
- openssl (compiled in for Debian, enabled manually in Arch Linux) - openssl (compiled in for Debian, enabled manually in Arch Linux)
- php5-curl Fetching files by HTTP. - php-curl Fetching files by HTTP.
- php5-gd Image manipulation (scaling). - php-exif Exchangeable image information.
- php5-gmp For Salmon signatures (part of OStatus). - php-gd Image manipulation (scaling).
- php5-intl Internationalization support (transliteration et al). - php-intl Internationalization support (transliteration et al).
- php5-json For WebFinger lookups and more. - php-json For WebFinger lookups and more.
- php5-mysqlnd The native driver for PHP5 MariaDB connections. If you - php-mbstring String manipulation
use MySQL, 'php5-mysql' or 'php5-mysqli' may be enough. - php-mysql The native driver for MariaDB connections.
- php-gmp For Salmon signatures (part of OStatus)
- php-bcmath Arbitrary Precision Mathematics
- php-opcache Improved PHP performance by precompilation
- php-readline For interactive scripts
- php-xml XML parser
- php-ds Faster data structures
The above package names are for Debian based systems. In the case of NOTE: Some distros require manual enabling in the relevant php.ini for some modules.
Arch Linux, PHP is compiled with support for most extensions but they
require manual enabling in the relevant php.ini file (mostly php5-gmp).
Better performance Better performance
------------------ ------------------
@@ -69,6 +70,7 @@ For some functionality, you will also need the following extensions:
- gettext For multiple languages. Default on many PHP installs; - gettext For multiple languages. Default on many PHP installs;
will be emulated if not present. will be emulated if not present.
- exif For thumbnails to be properly oriented. - exif For thumbnails to be properly oriented.
- php-ds For faster data structures; will be emulated if not present.
You may also experience better performance from your site if you configure You may also experience better performance from your site if you configure
a PHP cache/accelerator. Most distributions come with "opcache" support. a PHP cache/accelerator. Most distributions come with "opcache" support.
@@ -124,17 +126,7 @@ especially if you've previously installed PHP/MariaDB packages.
that user's default group instead. As a last resort, you can create that user's default group instead. As a last resort, you can create
a new group like "gnusocial" and add the Web server's user to the group. a new group like "gnusocial" and add the Web server's user to the group.
4. You should also take this moment to make your 'avatar' and 'file' sub- 4. Create a database to hold your site data. Something like this
directories writeable by the Web server. The _insecure_ way to do
this is:
chmod a+w /var/www/gnusocial/avatar
chmod a+w /var/www/gnusocial/file
You can also make the avatar, and file directories just writable by
the Web server group, as noted above.
5. Create a database to hold your site data. Something like this
should work (you will be prompted for your database password): should work (you will be prompted for your database password):
mysqladmin -u "root" -p create social mysqladmin -u "root" -p create social
@@ -147,7 +139,7 @@ especially if you've previously installed PHP/MariaDB packages.
a tool like phpMyAdmin to create a database. Check your hosting a tool like phpMyAdmin to create a database. Check your hosting
service's documentation for how to create a new MariaDB database.) service's documentation for how to create a new MariaDB database.)
6. Create a new database account that GNU Social will use to access the 5. Create a new database account that GNU Social will use to access the
database. If you have shell access, this will probably work from the database. If you have shell access, this will probably work from the
MariaDB shell: MariaDB shell:
@@ -159,7 +151,7 @@ especially if you've previously installed PHP/MariaDB packages.
to your preferred new database username and password. You may want to to your preferred new database username and password. You may want to
test logging in to MariaDB as this new user. test logging in to MariaDB as this new user.
7. In a browser, navigate to the GNU Social install script; something like: 6. In a browser, navigate to the GNU Social install script; something like:
https://social.example.net/install.php https://social.example.net/install.php
@@ -167,7 +159,7 @@ especially if you've previously installed PHP/MariaDB packages.
install program will configure your site and install the initial, install program will configure your site and install the initial,
almost-empty database. almost-empty database.
8. You should now be able to navigate to your social site's main directory 7. You should now be able to navigate to your social site's main directory
and see the "Public Timeline", which will probably be empty. You can and see the "Public Timeline", which will probably be empty. You can
now register new user, post some notices, edit your profile, etc. now register new user, post some notices, edit your profile, etc.
@@ -229,10 +221,10 @@ following files:
display.css: a CSS2 file for "default" styling for all browsers. display.css: a CSS2 file for "default" styling for all browsers.
logo.png: a logo image for the site. logo.png: a logo image for the site.
default-avatar-profile.png: a 96x96 pixel image to use as the avatar for default-avatar-profile.png: a 96x96 pixel image to use as the avatar for
users who don't upload their own. users who don't upload their own.
default-avatar-stream.png: Ditto, but 48x48. For streams of notices. default-avatar-stream.png: Ditto, but 48x48. For streams of notices.
default-avatar-mini.png: Ditto ditto, but 24x24. For subscriptions default-avatar-mini.png: Ditto ditto, but 24x24. For subscriptions
listing on profile pages. listing on profile pages.
You may want to start by copying the files from the default theme to You may want to start by copying the files from the default theme to
your own directory. your own directory.
@@ -464,3 +456,8 @@ Upgrading
Upgrading is strongly recommended to stay up to date with security fixes Upgrading is strongly recommended to stay up to date with security fixes
and new features. For instructions on how to upgrade GNU social code, and new features. For instructions on how to upgrade GNU social code,
please see the UPGRADE file. please see the UPGRADE file.
Additional configuration
------------------------
Please refer to DOCUMENTATION/SYSTEM_ADMINISTRATORS/CONFIGURE for information.

166
README.md
View File

@@ -1,27 +1,22 @@
# GNU social 1.2.x # GNU social 1.20.x
2015 (c) 2010-2019 Free Software Foundation, Inc
(c) Free Software Foundation, Inc
(c) StatusNet, Inc
This is the README file for GNU social, the free This is the README file for GNU social, the free
software social networking platform. It includes software social networking platform. It includes
general information about the software and the general information about the software and the
project. project.
Some other files to review: The file INSTALL.md has useful instructions on how to
install this software.
- INSTALL: instructions on how to install the software. System administrators may find the `DOCUMENTATION/SYSTEM_ADMINISTRATORS`
- UPGRADE: upgrading from earlier versions directory useful, namely:
- CONFIGURE: configuration options in gruesome detail.
- PLUGINS.txt: how to install and configure plugins.
- EVENTS.txt: events supported by the plugin system
- COPYING: full text of the software license
Information on using GNU social can be found in - upgrade_from: upgrading from different software
the "doc" subdirectory or in the "help" section - CONFIGURE.md: configuration options in gruesome detail.
on-line, or you can catch us on IRC in #social on - PLUGINS.md: how to install and configure plugins.
the freenode network.
Developers may find the `DOCUMENTATION/DEVELOPERS` directory useful.
## About ## About
@@ -32,16 +27,16 @@ polls, announce events, or other social activities
(and you can add more!). Users can choose which (and you can add more!). Users can choose which
people to "follow" and receive only their friends' people to "follow" and receive only their friends'
or colleagues' status messages. It provides a or colleagues' status messages. It provides a
similar service to sites like Twitter, Google+ or similar service to proprietary social network sites,
Facebook, but is much more awesome. but is much more awesome.
With a little work, status messages can be sent to With a little work, status messages can be sent to
mobile phones, instant messenger programs (using mobile phones, instant messenger programs (using
XMPP), and specially-designed desktop clients that XMPP), and specially-designed desktop clients that
support the Twitter API. support the Twitter API.
GNU social supports an open standard called GNU social supports open standards (such as OStatus
OStatus <https://www.w3.org/community/ostatus/> that lets users in <https://www.w3.org/community/ostatus/>) that lets users in
different networks follow each other. It enables a different networks follow each other. It enables a
distributed social network spread all across the distributed social network spread all across the
Web. Web.
@@ -98,31 +93,7 @@ liberal terms, but those terms may differ in detail from the AGPL's
particulars. See each package's license file in the extlib directory particulars. See each package's license file in the extlib directory
for additional terms. for additional terms.
## New this version Refer to COPYING.md for full text of the software license..
This is the development branch for the 1.2.x version of GNU social.
All daring 1.1.x admins should upgrade to this version.
So far it includes the following changes:
- Backing up a user's account is more and more complete.
- Emojis 😸 (utf8mb4 support)
The last release, 1.1.3, gave us these improvements:
- XSS security fix (thanks Simon Waters, <https://www.surevine.com/>)
- Many improvements to ease adoption of the Qvitter front-end <https://github.com/hannesmannerheim/qvitter>
- Protocol adaptions for improved performance and stability
Upgrades from _StatusNet_ 1.1.1 will also experience these improvements:
- Fixes for SQL injection errors in profile lists.
- Improved ActivityStreams JSON representation of activities and objects.
- Upgrade to the Twitter 1.1 API.
- More robust handling of errors in distribution.
- Fix error in OStatus subscription for remote groups.
- Fix error in XMPP distribution.
- Tracking of conversation URI metadata (more coherent convos)
### Troubleshooting ### Troubleshooting
@@ -144,17 +115,19 @@ to install the development version of GNU social.
To get it, use the git version control tool To get it, use the git version control tool
<http://git-scm.com/> like so: <http://git-scm.com/> like so:
git clone git@git.gnu.io:gnu/gnu-social.git git clone git@notabug.org:diogo/gnu-social.git
In the current phase of development it is probably In the current phase of development it is probably
recommended to use git as a means to stay up to date recommended to use git as a means to stay up to date
with the source code. You can choose between these with the source code. You can choose between these
branches: branches:
- 1.2.x "stable", few updates, well tested code * 1.20.x "oldstable", few updates, well tested coded
- master "testing", more updates, usually working well * master "stable", usually working well
- nightly "unstable", most updates, not always working * nightly "testing", most updates, not always working as expected
To keep it up-to-date, use 'git pull'. Watch for conflicts! To keep it up-to-date, use `git pull`. Watch for conflicts!
As in any upgrade, do __not__ forget to run `/scripts/upgrade.php`.
## Further information ## Further information
@@ -163,89 +136,22 @@ There are several ways to get more information about GNU social.
* The #social IRC channel on freenode.net <https://www.freenode.net/>. * The #social IRC channel on freenode.net <https://www.freenode.net/>.
* The unofficial XMPP room linked to IRC on <xmpp:gnusocial@conference.bka.li> * The unofficial XMPP room linked to IRC on <xmpp:gnusocial@conference.bka.li>
* The GNU social website <https://gnu.io/social/> * The GNU social website <https://gnu.io/social/>
* Following us on GNU social -- <https://quitter.se/gnusocial>
* GNU social has a bug tracker for any defects you may find, or ideas for * GNU social has a bug tracker for any defects you may find, or ideas for
making things better. <https://git.gnu.io/gnu/gnu-social/issues/> making things better. <https://notabug.org/diogo/gnu-social/issues>
* Patches are welcome, preferrably to our repository on git.gnu.io. <https://git.gnu.io/gnu/gnu-social> * Patches are welcome, preferrably to our repository on notabug.org. <https://notabug.org/diogo/gnu-social>
Credits ## Credits
=======
The following is an incomplete list of developers An incomplete list of developers who've worked on GNU social,
who've worked on GNU social, or its predecessors or its predecessors StatusNet and Free Social has been made available
StatusNet and Free Social. Apologies for any in `CREDITS.md`.
oversight; please let mattl@gnu.org know if
anyone's been overlooked in error.
## Project Founders ### Current team
* Matt Lee (GNU social)
* Evan Prodromou (StatusNet)
* Mikael Nordfeldth (Free Social)
Thanks to all of the StatusNet developers:
* Zach Copley, StatusNet, Inc.
* Earle Martin, StatusNet, Inc.
* Marie-Claude Doyon, designer, StatusNet, Inc.
* Sarven Capadisli, StatusNet, Inc.
* Robin Millette, StatusNet, Inc.
* Ciaran Gultnieks
* Michael Landers
* Ori Avtalion
* Garret Buell
* Mike Cochrane
* Matthew Gregg
* Florian Biree
* Erik Stambaugh
* 'drry'
* Gina Haeussge
* Tryggvi Björgvinsson
* Adrian Lang
* Ori Avtalion
* Meitar Moscovitz
* Ken Sheppardson (Trac server, man-about-town)
* Tiago 'gouki' Faria (i18n manager)
* Sean Murphy
* Leslie Michael Orchard
* Eric Helgeson
* Ken Sedgwick
* Brian Hendrickson
* Tobias Diekershoff
* Dan Moore
* Fil
* Jeff Mitchell
* Brenda Wallace
* Jeffery To
* Federico Marani
* mEDI
* Brett Taylor
* Brigitte Schuster
* Siebrand Mazeland and the amazing volunteer translators at translatewiki.net
* Brion Vibber, StatusNet, Inc.
* James Walker, StatusNet, Inc.
* Samantha Doherty, designer, StatusNet, Inc.
* Simon Waters, Surevine
* Joshua Judson Rosen (rozzin)
### Extra special thanks to the GNU socialites
* Craig Andrews
* Donald Robertson
* Deb Nicholson
* Ian Denhart
* Steven DuBois
* Blaine Cook
* Henry Story
* Melvin Carvalho
Thanks also to the developers of our upstream
library code and to the thousands of people who
have tried out GNU social, told their friends, and
built the fediverse network to what it is today.
### License help from
* Bradley M. Kuhn
* Matt Lee
* Mikael Nordfeldth
* Diogo Cordeiro
* Bruno Casteleiro
* Miguel Dantas
* Alexei Sorokin

View File

@@ -1,12 +0,0 @@
Things to be done
=================
* Create a theme for GNU social
* Create a set of plugins to give StatusNet a more social-network UI
* Work on improvements for annoying things in StatusNet (ie. no
redirect to login page when you need to be logged in, etc)
* Work on adding further Activities, such as sharing photos/video,
events, UI for managing relationships.

View File

@@ -65,7 +65,7 @@ class AddpeopletagAction extends Action
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -119,7 +119,7 @@ class AddpeopletagAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
// Throws exception on error // Throws exception on error
$ptag = Profile_tag::setTag($this->user->id, $this->tagged->id, $ptag = Profile_tag::setTag($this->user->id, $this->tagged->id,

View File

@@ -170,12 +170,6 @@ class AllAction extends ShowstreamAction
} }
$ibs->show(); $ibs->show();
} }
// XXX: make this a little more convenient
if (!common_config('performance', 'high')) {
$pop = new InboxTagCloudSection($this, $this->target);
$pop->show();
}
} }
} }

View File

@@ -46,7 +46,7 @@ class AllrssAction extends TargetedRss10Action
{ {
protected function getNotices() protected function getNotices()
{ {
$stream = new InboxNoticeStream($this->target); $stream = new InboxNoticeStream($this->target, $this->scoped);
return $stream->getNotices(0, $this->limit)->fetchAll(); return $stream->getNotices(0, $this->limit)->fetchAll();
} }

View File

@@ -31,7 +31,9 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } if (!defined('GNUSOCIAL')) {
exit(1);
}
/** /**
* We don't have a rate limit, but some clients check this method. * We don't have a rate limit, but some clients check this method.
@@ -47,20 +49,33 @@ if (!defined('GNUSOCIAL')) { exit(1); }
*/ */
class ApiAccountRateLimitStatusAction extends ApiBareAuthAction class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
{ {
/**
* Return true if read only.
*
* MAY override
*
* @param array $args other arguments
*
* @return boolean is read only action?
*/
public function isReadOnly($args)
{
return true;
}
/** /**
* Handle the request * Handle the request
* *
* Return some Twitter-ish data about API limits * Return some Twitter-ish data about API limits
* *
* @param array $args $_REQUEST data (unused)
*
* @return void * @return void
* @throws ClientException
*/ */
protected function handle() protected function handle()
{ {
parent::handle(); parent::handle();
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, ['xml', 'json'])) {
$this->clientError( $this->clientError(
// TRANS: Client error displayed when coming across a non-supported API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), _('API method not found.'),
@@ -76,44 +91,31 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
if ($this->format == 'xml') { if ($this->format == 'xml') {
$this->elementStart('hash'); $this->elementStart('hash');
$this->element('remaining-hits', array('type' => 'integer'), 150); $this->element('remaining-hits', ['type' => 'integer'], "150");
$this->element('hourly-limit', array('type' => 'integer'), 150); $this->element('hourly-limit', ['type' => 'integer'], "150");
$this->element( $this->element(
'reset-time', array('type' => 'datetime'), 'reset-time',
['type' => 'datetime'],
common_date_iso8601($reset->format('r')) common_date_iso8601($reset->format('r'))
); );
$this->element( $this->element(
'reset_time_in_seconds', 'reset_time_in_seconds',
array('type' => 'integer'), ['type' => 'integer'],
strtotime('+1 hour') strtotime('+1 hour')
); );
$this->elementEnd('hash'); $this->elementEnd('hash');
} elseif ($this->format == 'json') { } elseif ($this->format == 'json') {
$out = array( $out = [
'reset_time_in_seconds' => strtotime('+1 hour'), 'reset_time_in_seconds' => strtotime('+1 hour'),
'remaining_hits' => 150, 'remaining_hits' => 150,
'hourly_limit' => 150, 'hourly_limit' => 150,
'reset_time' => common_date_rfc2822( 'reset_time' => common_date_rfc2822(
$reset->format('r') $reset->format('r')
) )
); ];
print json_encode($out); print json_encode($out);
} }
$this->endDocument($this->format); $this->endDocument($this->format);
} }
/**
* Return true if read only.
*
* MAY override
*
* @param array $args other arguments
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
} }

View File

@@ -54,7 +54,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -73,9 +73,9 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError( $this->clientError(

View File

@@ -51,7 +51,7 @@ class ApiAtomServiceAction extends ApiBareAuthAction
* @return boolean success flag * @return boolean success flag
* *
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$this->user = $this->getTargetUser($this->arg('id')); $this->user = $this->getTargetUser($this->arg('id'));
@@ -71,9 +71,9 @@ class ApiAtomServiceAction extends ApiBareAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
header('Content-Type: application/atomsvc+xml'); header('Content-Type: application/atomsvc+xml');

View File

@@ -58,7 +58,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -77,9 +77,9 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$sitename = common_config('site', 'name'); $sitename = common_config('site', 'name');
// TRANS: Message is used as a title when listing the lastest 20 groups. %s is a site name. // TRANS: Message is used as a title when listing the lastest 20 groups. %s is a site name.

View File

@@ -28,9 +28,7 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
/** /**
* Returns the string "ok" in the requested format with a 200 OK HTTP status code. * Returns the string "ok" in the requested format with a 200 OK HTTP status code.
@@ -44,29 +42,9 @@ if (!defined('STATUSNET')) {
*/ */
class ApiHelpTestAction extends ApiPrivateAuthAction class ApiHelpTestAction extends ApiPrivateAuthAction
{ {
/** protected function handle()
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{ {
parent::prepare($args); parent::handle();
return true;
}
/**
* Handle the request
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($this->format == 'xml') { if ($this->format == 'xml') {
$this->initDocument('xml'); $this->initDocument('xml');
@@ -77,12 +55,8 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
print '"ok"'; print '"ok"';
$this->endDocument('json'); $this->endDocument('json');
} else { } else {
$this->clientError(
// TRANS: Client error displayed when coming across a non-supported API method. // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'), throw new ClientException(_('API method not found.'), 404);
404,
$this->format
);
} }
} }

View File

@@ -33,7 +33,7 @@ class ApiListSubscriberAction extends ApiBareAuthAction
{ {
var $list = null; var $list = null;
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -52,9 +52,9 @@ class ApiListSubscriberAction extends ApiBareAuthAction
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$arr = array('profile_tag_id' => $this->list->id, $arr = array('profile_tag_id' => $this->list->id,
'profile_id' => $this->target->id); 'profile_id' => $this->target->id);

View File

@@ -52,9 +52,9 @@ class ApiOAuthAccessTokenAction extends ApiOAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$datastore = new ApiGNUsocialOAuthDataStore(); $datastore = new ApiGNUsocialOAuthDataStore();
$server = new OAuthServer($datastore); $server = new OAuthServer($datastore);

View File

@@ -60,7 +60,7 @@ class ApiOAuthAuthorizeAction extends ApiOAuthAction
return false; return false;
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -88,9 +88,9 @@ class ApiOAuthAuthorizeAction extends ApiOAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {

View File

@@ -49,7 +49,7 @@ class ApiOAuthRequestTokenAction extends ApiOAuthAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -69,9 +69,9 @@ class ApiOAuthRequestTokenAction extends ApiOAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$datastore = new ApiGNUsocialOAuthDataStore(); $datastore = new ApiGNUsocialOAuthDataStore();
$server = new OAuthServer($datastore); $server = new OAuthServer($datastore);

View File

@@ -88,7 +88,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
* *
* @return boolean success * @return boolean success
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -128,9 +128,9 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
common_debug("In apisearchatom handle()"); common_debug("In apisearchatom handle()");
$this->showAtom(); $this->showAtom();
} }
@@ -337,21 +337,21 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
// @todo: Here is where we'd put in a link to an atom feed for threads // @todo: Here is where we'd put in a link to an atom feed for threads
$source = null; $source = null;
$source_link = null;
$ns = $notice->getSource(); $ns = $notice->getSource();
if ($ns instanceof Notice_source) { if ($ns instanceof Notice_source) {
if (!empty($ns->name) && !empty($ns->url)) {
$source = '<a href="'
. htmlspecialchars($ns->url)
. '" rel="nofollow">'
. htmlspecialchars($ns->name)
. '</a>';
} else {
$source = $ns->code; $source = $ns->code;
if (!empty($ns->url)) {
$source_link = $ns->url;
if (!empty($ns->name)) {
$source = $ns->name;
}
} }
} }
$this->element("twitter:source", null, $source); $this->element("twitter:source", null, $source);
$this->element("twitter:source_link", null, $source_link);
$this->elementStart('author'); $this->elementStart('author');

View File

@@ -57,7 +57,7 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
* *
* @return boolean true if nothing goes wrong * @return boolean true if nothing goes wrong
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -95,9 +95,9 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showResults(); $this->showResults();
} }

View File

@@ -34,9 +34,7 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
/** /**
* Deletes one of the authenticating user's statuses (notices). * Deletes one of the authenticating user's statuses (notices).
@@ -55,87 +53,46 @@ if (!defined('STATUSNET')) {
*/ */
class ApiStatusesDestroyAction extends ApiAuthAction class ApiStatusesDestroyAction extends ApiAuthAction
{ {
var $status = null; protected function prepare(array $args=array())
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
$this->user = $this->auth_user; if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
$this->notice_id = (int)$this->trimmed('id'); // TRANS: Client error displayed trying to delete a status not using POST or DELETE.
// TRANS: POST and DELETE should not be translated.
if (empty($notice_id)) { throw new ClientException(_('This method requires a POST or DELETE.'));
$this->notice_id = (int)$this->arg('id');
} }
$this->notice = Notice::getKV((int)$this->notice_id); // FIXME: Return with a Not Acceptable status code?
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when coming across a non-supported API method.
throw new ClientException(_('API method not found.'), 404);
}
try {
$this->notice = Notice::getByID($this->trimmed('id'));
} catch (NoResultException $e) {
// TRANS: Client error displayed trying to delete a status with an invalid ID.
throw new ClientException(_('No status found with that ID.'), 404);
}
return true; return true;
} }
/** protected function handle()
* Handle the request
*
* Delete the notice and all related replies
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{ {
parent::handle($args); parent::handle();
if (!in_array($this->format, array('xml', 'json'))) { if (!$this->scoped->sameAs($this->notice->getProfile()) && !$this->scoped->hasRight(Right::DELETEOTHERSNOTICE)) {
$this->clientError( // TRANS: Client error displayed trying to delete a status of another user.
// TRANS: Client error displayed when coming across a non-supported API method. throw new AuthorizationException(_('You may not delete another user\'s status.'));
_('API method not found.'),
404
);
return;
} }
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { if (Event::handle('StartDeleteOwnNotice', array($this->scoped->getUser(), $this->notice))) {
$this->clientError(
// TRANS: Client error displayed trying to delete a status not using POST or DELETE.
// TRANS: POST and DELETE should not be translated.
_('This method requires a POST or DELETE.'),
400,
$this->format
);
return;
}
if (empty($this->notice)) {
$this->clientError(
// TRANS: Client error displayed trying to delete a status with an invalid ID.
_('No status found with that ID.'),
404, $this->format
);
return;
}
if ($this->user->id == $this->notice->profile_id) {
if (Event::handle('StartDeleteOwnNotice', array($this->user, $this->notice))) {
$this->notice->deleteAs($this->scoped); $this->notice->deleteAs($this->scoped);
Event::handle('EndDeleteOwnNotice', array($this->user, $this->notice)); Event::handle('EndDeleteOwnNotice', array($this->scoped->getUser(), $this->notice));
} }
$this->showNotice(); $this->showNotice();
} else {
$this->clientError(
// TRANS: Client error displayed trying to delete a status of another user.
_('You may not delete another user\'s status.'),
403,
$this->format
);
}
} }
/** /**

View File

@@ -46,7 +46,7 @@
/api/statuses/update.:format /api/statuses/update.:format
@par Formats (:format) @par Formats (:format)
xml, json xml, json, atom
@par HTTP Method(s) @par HTTP Method(s)
POST POST
@@ -174,7 +174,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
foreach (array_unique($matches[0]) as $match) { foreach (array_unique($matches[0]) as $match) {
try { try {
$this->media_ids[$match] = File::getByID($match); $this->media_ids[$match] = File::getByID($match);
} catch (EmptyIdException $e) { } catch (EmptyPkeyValueException $e) {
// got a zero from the client, at least Twidere does this on occasion // got a zero from the client, at least Twidere does this on occasion
} catch (NoResultException $e) { } catch (NoResultException $e) {
// File ID was not found. Do we abort and report to the client? // File ID was not found. Do we abort and report to the client?
@@ -339,6 +339,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$this->showSingleXmlStatus($this->notice); $this->showSingleXmlStatus($this->notice);
} elseif ($this->format == 'json') { } elseif ($this->format == 'json') {
$this->show_single_json_status($this->notice); $this->show_single_json_status($this->notice);
} elseif ($this->format == 'atom') {
$this->showSingleAtomStatus($this->notice);
} }
} }
} }

View File

@@ -92,7 +92,7 @@
<truncated>false</truncated> <truncated>false</truncated>
<created_at>Wed Mar 31 01:33:02 +0000 2010</created_at> <created_at>Wed Mar 31 01:33:02 +0000 2010</created_at>
<in_reply_to_status_id/> <in_reply_to_status_id/>
<source>&lt;a href="http://code.google.com/p/microblog-purple/"&gt;mbpidgin&lt;/a&gt;</source> <source>&lt;a href="http://somesourcecode.net/microblog/"&gt;mbpidgin&lt;/a&gt;</source>
<id>26674201</id> <id>26674201</id>
<in_reply_to_user_id/> <in_reply_to_user_id/>
<in_reply_to_screen_name/> <in_reply_to_screen_name/>

View File

@@ -34,7 +34,9 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } if (!defined('GNUSOCIAL')) {
exit(1);
}
/** /**
* Returns the most recent notices (default 20) posted by the authenticating * Returns the most recent notices (default 20) posted by the authenticating
@@ -55,9 +57,64 @@ if (!defined('GNUSOCIAL')) { exit(1); }
*/ */
class ApiTimelineUserAction extends ApiBareAuthAction class ApiTimelineUserAction extends ApiBareAuthAction
{ {
var $notices = null; public $notices = null;
var $next_id = null; public $next_id = null;
/**
* We expose AtomPub here, so non-GET/HEAD reqs must be read/write.
*
* @param array $args other arguments
*
* @return boolean true
*/
public function isReadOnly($args)
{
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
}
/**
* When was this feed last modified?
*
* @return string datestamp of the latest notice in the stream
*/
public function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return strtotime($this->notices[0]->created);
}
return null;
}
/**
* An entity tag for this stream
*
* Returns an Etag based on the action name, language, user ID, and
* timestamps of the first and last notice in the timeline
*
* @return string etag
*/
public function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->scoped),
common_language(),
$this->target->getID(),
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))
)
. '"';
}
return null;
}
/** /**
* Take arguments for running * Take arguments for running
@@ -65,8 +122,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction
* @param array $args $_REQUEST args * @param array $args $_REQUEST args
* *
* @return boolean success flag * @return boolean success flag
* @throws AuthorizationException
* @throws ClientException
*/ */
protected function prepare(array $args=array()) protected function prepare(array $args = [])
{ {
parent::prepare($args); parent::prepare($args);
@@ -86,169 +145,22 @@ class ApiTimelineUserAction extends ApiBareAuthAction
return true; return true;
} }
/**
* Handle the request
*
* Just show the notices
*
* @return void
*/
protected function handle()
{
parent::handle();
if ($this->isPost()) {
$this->handlePost();
} else {
$this->showTimeline();
}
}
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
// We'll use the shared params from the Atom stub
// for other feed types.
$atom = new AtomUserNoticeFeed($this->target->getUser(), $this->scoped);
$link = common_local_url(
'showstream',
array('nickname' => $this->target->getNickname())
);
$self = $this->getSelfUri();
// FriendFeed's SUP protocol
// Also added RSS and Atom feeds
$suplink = common_local_url('sup', null, null, $this->target->getID());
header('X-SUP-ID: ' . $suplink);
// paging links
$nextUrl = !empty($this->next_id)
? common_local_url('ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->getID()),
array('max_id' => $this->next_id))
: null;
$prevExtra = array();
if (!empty($this->notices)) {
assert($this->notices[0] instanceof Notice);
$prevExtra['since_id'] = $this->notices[0]->id;
}
$prevUrl = common_local_url('ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->getID()),
$prevExtra);
$firstUrl = common_local_url('ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->getID()));
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline(
$this->notices,
$atom->title,
$link,
$atom->subtitle,
$suplink,
$atom->logo,
$self
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom->setId($self);
$atom->setSelfLink($self);
// Add navigation links: next, prev, first
// Note: we use IDs rather than pages for navigation; page boundaries
// change too quickly!
if (!empty($this->next_id)) {
$atom->addLink($nextUrl,
array('rel' => 'next',
'type' => 'application/atom+xml'));
}
if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) {
$atom->addLink($prevUrl,
array('rel' => 'prev',
'type' => 'application/atom+xml'));
}
if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) {
$atom->addLink($firstUrl,
array('rel' => 'first',
'type' => 'application/atom+xml'));
}
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->scoped);
$doc->setTitle($atom->title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
if (!empty($this->next_id)) {
$doc->addLink($nextUrl,
array('rel' => 'next',
'type' => ActivityStreamJSONDocument::CONTENT_TYPE));
}
if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) {
$doc->addLink($prevUrl,
array('rel' => 'prev',
'type' => ActivityStreamJSONDocument::CONTENT_TYPE));
}
if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) {
$doc->addLink($firstUrl,
array('rel' => 'first',
'type' => ActivityStreamJSONDocument::CONTENT_TYPE));
}
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404);
}
}
/** /**
* Get notices * Get notices
* *
* @return array notices * @return array notices
*/ */
function getNotices() public function getNotices()
{ {
$notices = array(); $notices = [];
$notice = $this->target->getNotices(($this->page-1) * $this->count, $notice = $this->target->getNotices(
($this->page - 1) * $this->count,
$this->count + 1, $this->count + 1,
$this->since_id, $this->since_id,
$this->max_id, $this->max_id,
$this->scoped); $this->scoped
);
while ($notice->fetch()) { while ($notice->fetch()) {
if (count($notices) < $this->count) { if (count($notices) < $this->count) {
@@ -263,61 +175,26 @@ class ApiTimelineUserAction extends ApiBareAuthAction
} }
/** /**
* We expose AtomPub here, so non-GET/HEAD reqs must be read/write. * Handle the request
* *
* @param array $args other arguments * Just show the notices
* *
* @return boolean true * @return void
* @throws ClientException
* @throws ServerException
*/ */
protected function handle()
function isReadOnly($args)
{ {
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD'); parent::handle();
if ($this->isPost()) {
$this->handlePost();
} else {
$this->showTimeline();
}
} }
/** public function handlePost()
* When was this feed last modified?
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return strtotime($this->notices[0]->created);
}
return null;
}
/**
* An entity tag for this stream
*
* Returns an Etag based on the action name, language, user ID, and
* timestamps of the first and last notice in the timeline
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->scoped),
common_language(),
$this->target->getID(),
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))
)
. '"';
}
return null;
}
function handlePost()
{ {
if (!$this->scoped instanceof Profile || if (!$this->scoped instanceof Profile ||
!$this->target->sameAs($this->scoped)) { !$this->target->sameAs($this->scoped)) {
@@ -354,7 +231,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$activity = new Activity($dom->documentElement); $activity = new Activity($dom->documentElement);
common_debug('AtomPub: Ignoring right now, but this POST was made to collection: '.$activity->id); common_debug('AtomPub: Ignoring right now, but this POST was made to collection: ' . $activity->id);
// Reset activity data so we can handle it in the same functions as with OStatus // Reset activity data so we can handle it in the same functions as with OStatus
// because we don't let clients set their own UUIDs... Not sure what AtomPub thinks // because we don't let clients set their own UUIDs... Not sure what AtomPub thinks
@@ -378,4 +255,155 @@ class ApiTimelineUserAction extends ApiBareAuthAction
'format' => 'atom'))); 'format' => 'atom')));
$this->showSingleAtomStatus($stored); $this->showSingleAtomStatus($stored);
} }
/**
* Show the timeline of notices
*
* @return void
* @throws ClientException
* @throws ServerException
* @throws UserNoProfileException
*/
public function showTimeline()
{
// We'll use the shared params from the Atom stub
// for other feed types.
$atom = new AtomUserNoticeFeed($this->target->getUser(), $this->scoped);
$link = common_local_url(
'showstream',
array('nickname' => $this->target->getNickname())
);
$self = $this->getSelfUri();
// FriendFeed's SUP protocol
// Also added RSS and Atom feeds
$suplink = common_local_url('sup', null, null, $this->target->getID());
header('X-SUP-ID: ' . $suplink);
// paging links
$nextUrl = !empty($this->next_id)
? common_local_url(
'ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->getID()),
array('max_id' => $this->next_id)
)
: null;
$prevExtra = [];
if (!empty($this->notices)) {
assert($this->notices[0] instanceof Notice);
$prevExtra['since_id'] = $this->notices[0]->id;
}
$prevUrl = common_local_url(
'ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->getID()),
$prevExtra
);
$firstUrl = common_local_url(
'ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->getID())
);
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline(
$this->notices,
$atom->title,
$link,
$atom->subtitle,
$suplink,
$atom->logo,
$self
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom->setId($self);
$atom->setSelfLink($self);
// Add navigation links: next, prev, first
// Note: we use IDs rather than pages for navigation; page boundaries
// change too quickly!
if (!empty($this->next_id)) {
$atom->addLink(
$nextUrl,
array('rel' => 'next',
'type' => 'application/atom+xml')
);
}
if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) {
$atom->addLink(
$prevUrl,
array('rel' => 'prev',
'type' => 'application/atom+xml')
);
}
if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) {
$atom->addLink(
$firstUrl,
array('rel' => 'first',
'type' => 'application/atom+xml')
);
}
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->scoped);
$doc->setTitle($atom->title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
if (!empty($this->next_id)) {
$doc->addLink(
$nextUrl,
array('rel' => 'next',
'type' => ActivityStreamJSONDocument::CONTENT_TYPE)
);
}
if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) {
$doc->addLink(
$prevUrl,
array('rel' => 'prev',
'type' => ActivityStreamJSONDocument::CONTENT_TYPE)
);
}
if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) {
$doc->addLink(
$firstUrl,
array('rel' => 'first',
'type' => ActivityStreamJSONDocument::CONTENT_TYPE)
);
}
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404);
}
}
} }

View File

@@ -53,7 +53,7 @@ class ApiTrendsAction extends ApiPrivateAuthAction
* *
* @return boolean false if user doesn't exist * @return boolean false if user doesn't exist
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
return true; return true;
@@ -66,9 +66,9 @@ class ApiTrendsAction extends ApiPrivateAuthAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showTrends(); $this->showTrends();
} }

View File

@@ -50,7 +50,7 @@ class ApprovegroupAction extends Action
/** /**
* Prepare to run * Prepare to run
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -139,9 +139,9 @@ class ApprovegroupAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
try { try {
if ($this->approve) { if ($this->approve) {

View File

@@ -50,7 +50,7 @@ class ApprovesubAction extends Action
/** /**
* Prepare to run * Prepare to run
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -97,9 +97,9 @@ class ApprovesubAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$cur = common_current_user(); $cur = common_current_user();
try { try {

View File

@@ -96,7 +96,7 @@ class AttachmentAction extends ManagedAction
{ {
if (empty($this->attachment->filename)) { if (empty($this->attachment->filename)) {
// if it's not a local file, gtfo // if it's not a local file, gtfo
common_redirect($this->attachment->url, 303); common_redirect($this->attachment->getUrl(), 303);
} }
parent::showPage(); parent::showPage();
@@ -132,9 +132,5 @@ class AttachmentAction extends ManagedAction
function showSections() { function showSections() {
$ns = new AttachmentNoticeSection($this); $ns = new AttachmentNoticeSection($this);
$ns->show(); $ns->show();
if (!common_config('performance', 'high')) {
$atcs = new AttachmentTagCloudSection($this);
$atcs->show();
}
} }
} }

View File

@@ -0,0 +1,20 @@
<?php
if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Download notice attachment
*
* @category Personal
* @package GNUsocial
* @author Mikael Nordfeldth <mmn@hethane.se>
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link https:/gnu.io/social
*/
class Attachment_downloadAction extends AttachmentAction
{
public function showPage()
{
common_redirect($this->attachment->getUrl(), 302);
}
}

View File

@@ -62,6 +62,6 @@ class Attachment_thumbnailAction extends AttachmentAction
common_redirect($e->file->getUrl(), 302); common_redirect($e->file->getUrl(), 302);
} }
common_redirect(File_thumbnail::url($thumbnail->filename), 302); common_redirect(File_thumbnail::url($thumbnail->getFilename()), 302);
} }
} }

View File

@@ -49,6 +49,20 @@ class AvatarsettingsAction extends SettingsAction
var $imagefile = null; var $imagefile = null;
var $filename = null; var $filename = null;
function prepare(array $args=array())
{
$avatarpath = Avatar::path('');
if (!is_writable($avatarpath)) {
throw new Exception(_("The administrator of your site needs to
add write permissions on the avatar upload folder before
you're able to set one."));
}
parent::prepare($args);
return true;
}
/** /**
* Title of the page * Title of the page
* *
@@ -92,16 +106,6 @@ class AvatarsettingsAction extends SettingsAction
function showUploadForm() function showUploadForm()
{ {
$user = common_current_user();
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
}
$this->elementStart('form', array('enctype' => 'multipart/form-data', $this->elementStart('form', array('enctype' => 'multipart/form-data',
'method' => 'post', 'method' => 'post',
'id' => 'form_settings_avatar', 'id' => 'form_settings_avatar',
@@ -116,7 +120,7 @@ class AvatarsettingsAction extends SettingsAction
if (Event::handle('StartAvatarFormData', array($this))) { if (Event::handle('StartAvatarFormData', array($this))) {
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
try { try {
$original = Avatar::getUploaded($profile); $original = Avatar::getUploaded($this->scoped);
$this->elementStart('li', array('id' => 'avatar_original', $this->elementStart('li', array('id' => 'avatar_original',
'class' => 'avatar_view')); 'class' => 'avatar_view'));
@@ -126,7 +130,7 @@ class AvatarsettingsAction extends SettingsAction
$this->element('img', array('src' => $original->displayUrl(), $this->element('img', array('src' => $original->displayUrl(),
'width' => $original->width, 'width' => $original->width,
'height' => $original->height, 'height' => $original->height,
'alt' => $user->nickname)); 'alt' => $this->scoped->getNickname()));
$this->elementEnd('div'); $this->elementEnd('div');
$this->elementEnd('li'); $this->elementEnd('li');
} catch (NoAvatarException $e) { } catch (NoAvatarException $e) {
@@ -134,7 +138,7 @@ class AvatarsettingsAction extends SettingsAction
} }
try { try {
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); $avatar = $this->scoped->getAvatar(AVATAR_PROFILE_SIZE);
$this->elementStart('li', array('id' => 'avatar_preview', $this->elementStart('li', array('id' => 'avatar_preview',
'class' => 'avatar_view')); 'class' => 'avatar_view'));
// TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2). // TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2).
@@ -143,7 +147,7 @@ class AvatarsettingsAction extends SettingsAction
$this->element('img', array('src' => $avatar->displayUrl(), $this->element('img', array('src' => $avatar->displayUrl(),
'width' => AVATAR_PROFILE_SIZE, 'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname)); 'alt' => $this->scoped->getNickname()));
$this->elementEnd('div'); $this->elementEnd('div');
if (!empty($avatar->filename)) { if (!empty($avatar->filename)) {
// TRANS: Button on avatar upload page to delete current avatar. // TRANS: Button on avatar upload page to delete current avatar.
@@ -180,16 +184,6 @@ class AvatarsettingsAction extends SettingsAction
function showCropForm() function showCropForm()
{ {
$user = common_current_user();
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
}
$this->elementStart('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'form_settings_avatar', 'id' => 'form_settings_avatar',
'class' => 'form_settings', 'class' => 'form_settings',
@@ -211,7 +205,7 @@ class AvatarsettingsAction extends SettingsAction
$this->element('img', array('src' => Avatar::url($this->filedata['filename']), $this->element('img', array('src' => Avatar::url($this->filedata['filename']),
'width' => $this->filedata['width'], 'width' => $this->filedata['width'],
'height' => $this->filedata['height'], 'height' => $this->filedata['height'],
'alt' => $user->nickname)); 'alt' => $this->scoped->getNickname()));
$this->elementEnd('div'); $this->elementEnd('div');
$this->elementEnd('li'); $this->elementEnd('li');
@@ -224,7 +218,7 @@ class AvatarsettingsAction extends SettingsAction
$this->element('img', array('src' => Avatar::url($this->filedata['filename']), $this->element('img', array('src' => Avatar::url($this->filedata['filename']),
'width' => AVATAR_PROFILE_SIZE, 'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname)); 'alt' => $this->scoped->getNickname()));
$this->elementEnd('div'); $this->elementEnd('div');
foreach (array('avatar_crop_x', 'avatar_crop_y', foreach (array('avatar_crop_x', 'avatar_crop_y',

View File

@@ -74,6 +74,9 @@ class BackupaccountAction extends FormAction
// @fixme atom feed logic is in getString... // @fixme atom feed logic is in getString...
// but we just want it to output to the outputter. // but we just want it to output to the outputter.
$this->raw($stream->getString()); $this->raw($stream->getString());
// Don't print the page HTML
exit(0);
} }
public function isReadOnly($args) { public function isReadOnly($args) {

View File

@@ -53,7 +53,7 @@ class BlockAction extends ProfileFormAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
if (!parent::prepare($args)) { if (!parent::prepare($args)) {
return false; return false;
@@ -78,7 +78,7 @@ class BlockAction extends ProfileFormAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('no')) { if ($this->arg('no')) {

View File

@@ -151,7 +151,7 @@ class GroupBlockList extends ProfileList
$this->group = $group; $this->group = $group;
} }
function newListItem($profile) function newListItem(Profile $profile)
{ {
return new GroupBlockListItem($profile, $this->group, $this->action); return new GroupBlockListItem($profile, $this->group, $this->action);
} }

View File

@@ -50,7 +50,7 @@ class CancelgroupAction extends Action
/** /**
* Prepare to run * Prepare to run
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -127,9 +127,9 @@ class CancelgroupAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
try { try {
$this->request->abort(); $this->request->abort();

View File

@@ -27,9 +27,7 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
/** /**
* Confirm an address * Confirm an address
@@ -44,25 +42,14 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ConfirmaddressAction extends Action class ConfirmaddressAction extends ManagedAction
{ {
/** type of confirmation. */ /** type of confirmation. */
var $address; protected $address;
/** protected function doPreparation()
* Accept a confirmation code
*
* Checks the code and confirms the address in the
* user record
*
* @param args $args $_REQUEST array
*
* @return void
*/
function handle($args)
{ {
parent::handle($args);
if (!common_logged_in()) { if (!common_logged_in()) {
common_set_returnto($this->selfUrl()); common_set_returnto($this->selfUrl());
common_redirect(common_local_url('login')); common_redirect(common_local_url('login'));
@@ -70,32 +57,45 @@ class ConfirmaddressAction extends Action
$code = $this->trimmed('code'); $code = $this->trimmed('code');
if (!$code) { if (!$code) {
// TRANS: Client error displayed when not providing a confirmation code in the contact address confirmation action. // TRANS: Client error displayed when not providing a confirmation code in the contact address confirmation action.
$this->clientError(_('No confirmation code.')); throw new ClientException(_('No confirmation code.'));
} }
$confirm = Confirm_address::getKV('code', $code); $confirm = Confirm_address::getKV('code', $code);
if (!$confirm) { if (!$confirm instanceof Confirm_address) {
// TRANS: Client error displayed when providing a non-existing confirmation code in the contact address confirmation action. // TRANS: Client error displayed when providing a non-existing confirmation code in the contact address confirmation action.
$this->clientError(_('Confirmation code not found.')); throw new ClientException(_('Confirmation code not found.'), 404);
} }
$cur = common_current_user();
if ($cur->id != $confirm->user_id) { try {
$profile = Profile::getByID($confirm->user_id);
} catch (NoResultException $e) {
common_log(LOG_INFO, 'Tried to confirm the email for a deleted profile: '._ve(['id'=>$confirm->user_id, 'email'=>$confirm->address]));
$confirm->delete();
throw $e;
}
if (!$profile->sameAs($this->scoped)) {
// TRANS: Client error displayed when not providing a confirmation code for another user in the contact address confirmation action. // TRANS: Client error displayed when not providing a confirmation code for another user in the contact address confirmation action.
$this->clientError(_('That confirmation code is not for you!')); throw new AuthorizationException(_('That confirmation code is not for you!'));
} }
$type = $confirm->address_type; $type = $confirm->address_type;
$transports = array(); $transports = array();
Event::handle('GetImTransports', array(&$transports)); Event::handle('GetImTransports', array(&$transports));
if (!in_array($type, array('email', 'sms')) && !in_array($type, array_keys($transports))) { if (!in_array($type, array('email', 'sms')) && !in_array($type, array_keys($transports))) {
// TRANS: Server error for an unknown address type, which can be 'email', 'sms', or the name of an IM network (such as 'xmpp' or 'aim') // TRANS: Server error for an unknown address type, which can be 'email', 'sms', or the name of an IM network (such as 'xmpp' or 'aim')
$this->serverError(sprintf(_('Unrecognized address type %s'), $type)); throw new ServerException(sprintf(_('Unrecognized address type %s'), $type));
} }
$this->address = $confirm->address; $this->address = $confirm->address;
$cur = $this->scoped->getUser();
$cur->query('BEGIN'); $cur->query('BEGIN');
if (in_array($type, array('email', 'sms'))) if (in_array($type, array('email', 'sms'))) {
{ common_debug("Confirming {$type} address for user {$this->scoped->getID()}");
if ($cur->$type == $confirm->address) { if ($cur->$type == $confirm->address) {
// Already verified, so delete the confirm_address entry
$confirm->delete();
// TRANS: Client error for an already confirmed email/jabber/sms address. // TRANS: Client error for an already confirmed email/jabber/sms address.
$this->clientError(_('That address has already been confirmed.')); throw new AlreadyFulfilledException(_('That address has already been confirmed.'));
} }
$orig_user = clone($cur); $orig_user = clone($cur);
@@ -122,44 +122,39 @@ class ConfirmaddressAction extends Action
$user_im_prefs->user_id = $cur->id; $user_im_prefs->user_id = $cur->id;
if ($user_im_prefs->find() && $user_im_prefs->fetch()) { if ($user_im_prefs->find() && $user_im_prefs->fetch()) {
if($user_im_prefs->screenname == $confirm->address){ if($user_im_prefs->screenname == $confirm->address){
// Already verified, so delete the confirm_address entry
$confirm->delete();
// TRANS: Client error for an already confirmed IM address. // TRANS: Client error for an already confirmed IM address.
$this->clientError(_('That address has already been confirmed.')); throw new AlreadyFulfilledException(_('That address has already been confirmed.'));
} }
$user_im_prefs->screenname = $confirm->address; $user_im_prefs->screenname = $confirm->address;
$result = $user_im_prefs->update(); $result = $user_im_prefs->update();
if (!$result) { if ($result === false) {
common_log_db_error($user_im_prefs, 'UPDATE', __FILE__); common_log_db_error($user_im_prefs, 'UPDATE', __FILE__);
// TRANS: Server error displayed when updating IM preferences fails. // TRANS: Server error displayed when updating IM preferences fails.
$this->serverError(_('Could not update user IM preferences.')); throw new ServerException(_('Could not update user IM preferences.'));
} }
}else{ }else{
$user_im_prefs = new User_im_prefs(); $user_im_prefs = new User_im_prefs();
$user_im_prefs->screenname = $confirm->address; $user_im_prefs->screenname = $confirm->address;
$user_im_prefs->transport = $confirm->address_type; $user_im_prefs->transport = $confirm->address_type;
$user_im_prefs->user_id = $cur->id; $user_im_prefs->user_id = $cur->id;
$user_im_prefs->created = common_sql_now();
$result = $user_im_prefs->insert(); $result = $user_im_prefs->insert();
if (!$result) { if ($result === false) {
common_log_db_error($user_im_prefs, 'INSERT', __FILE__); common_log_db_error($user_im_prefs, 'INSERT', __FILE__);
// TRANS: Server error displayed when adding IM preferences fails. // TRANS: Server error displayed when adding IM preferences fails.
$this->serverError(_('Could not insert user IM preferences.')); throw new ServerException(_('Could not insert user IM preferences.'));
} }
} }
} }
$result = $confirm->delete(); $confirm->delete();
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error displayed when an address confirmation code deletion from the
// TRANS: database fails in the contact address confirmation action.
$this->serverError(_('Could not delete address confirmation.'));
}
$cur->query('COMMIT'); $cur->query('COMMIT');
$this->showPage();
} }
/** /**
@@ -180,8 +175,6 @@ class ConfirmaddressAction extends Action
*/ */
function showContent() function showContent()
{ {
$cur = common_current_user();
$this->element('p', null, $this->element('p', null,
// TRANS: Success message for the contact address confirmation action. // TRANS: Success message for the contact address confirmation action.
// TRANS: %s can be 'email', 'jabber', or 'sms'. // TRANS: %s can be 'email', 'jabber', or 'sms'.

View File

@@ -28,7 +28,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } if (!defined('GNUSOCIAL')) {
exit(1);
}
/** /**
* Conversation tree in the browser * Conversation tree in the browser
@@ -45,9 +47,11 @@ if (!defined('GNUSOCIAL')) { exit(1); }
*/ */
class ConversationAction extends ManagedAction class ConversationAction extends ManagedAction
{ {
var $conv = null; protected $redirectAfterLogin = true;
var $page = null;
var $notices = null; public $conv = null;
public $page = null;
public $notices = null;
protected function doPreparation() protected function doPreparation()
{ {
@@ -59,7 +63,7 @@ class ConversationAction extends ManagedAction
* *
* @return string page title * @return string page title
*/ */
function title() public function title()
{ {
// TRANS: Title for page with a conversion (multiple notices in context). // TRANS: Title for page with a conversion (multiple notices in context).
return _('Conversation'); return _('Conversation');
@@ -72,48 +76,48 @@ class ConversationAction extends ManagedAction
* *
* @return void * @return void
*/ */
function showContent() public function showContent()
{ {
if (Event::handle('StartShowConversation', array($this, $this->conv, $this->scoped))) { if (Event::handle('StartShowConversation', [$this, $this->conv, $this->scoped])) {
$notices = $this->conv->getNotices($this->scoped); $notices = $this->conv->getNotices($this->scoped);
$nl = new FullThreadedNoticeList($notices, $this, $this->scoped); $nl = new FullThreadedNoticeList($notices, $this, $this->scoped);
$cnt = $nl->show(); $cnt = $nl->show();
} }
Event::handle('EndShowConversation', array($this, $this->conv, $this->scoped)); Event::handle('EndShowConversation', [$this, $this->conv, $this->scoped]);
} }
function isReadOnly($args) public function isReadOnly($args)
{ {
return true; return true;
} }
function getFeeds() public function getFeeds()
{ {
return [
return array(new Feed(Feed::JSON, new Feed(Feed::JSON,
common_local_url('apiconversation', common_local_url('apiconversation',
array( ['id' => $this->conv->getID(),
'id' => $this->conv->getID(), 'format' => 'as']),
'format' => 'as')),
// TRANS: Title for link to notice feed. // TRANS: Title for link to notice feed.
// TRANS: %s is a user nickname. // TRANS: %s is a user nickname.
_('Conversation feed (Activity Streams JSON)')), _('Conversation feed (Activity Streams JSON)')
),
new Feed(Feed::RSS2, new Feed(Feed::RSS2,
common_local_url('apiconversation', common_local_url('apiconversation',
array( ['id' => $this->conv->getID(),
'id' => $this->conv->getID(), 'format' => 'rss']),
'format' => 'rss')),
// TRANS: Title for link to notice feed. // TRANS: Title for link to notice feed.
// TRANS: %s is a user nickname. // TRANS: %s is a user nickname.
_('Conversation feed (RSS 2.0)')), _('Conversation feed (RSS 2.0)')
),
new Feed(Feed::ATOM, new Feed(Feed::ATOM,
common_local_url('apiconversation', common_local_url('apiconversation',
array( ['id' => $this->conv->getID(),
'id' => $this->conv->getID(), 'format' => 'atom']),
'format' => 'atom')),
// TRANS: Title for link to notice feed. // TRANS: Title for link to notice feed.
// TRANS: %s is a user nickname. // TRANS: %s is a user nickname.
_('Conversation feed (Atom)'))); _('Conversation feed (Atom)')
)
];
} }
} }

View File

@@ -56,20 +56,20 @@ class DeleteaccountAction extends Action
/** /**
* For initializing members of the class. * For initializing members of the class.
* *
* @param array $argarray misc. arguments * @param array $args misc. arguments
* *
* @return boolean true * @return boolean true
* @throws ClientException
*/ */
function prepare($argarray) function prepare(array $args = [])
{ {
parent::prepare($argarray); parent::prepare($args);
$cur = common_current_user(); $cur = common_current_user();
if (empty($cur)) { if (empty($cur)) {
// TRANS: Client exception displayed trying to delete a user account while not logged in. // TRANS: Client exception displayed trying to delete a user account while not logged in.
throw new ClientException(_("Only logged-in users ". throw new ClientException(_("Only logged-in users can delete their account."), 403);
"can delete their account."), 403);
} }
if (!$cur->hasRight(Right::DELETEACCOUNT)) { if (!$cur->hasRight(Right::DELETEACCOUNT)) {
@@ -83,20 +83,71 @@ class DeleteaccountAction extends Action
/** /**
* Handler method * Handler method
* *
* @param array $argarray is ignored since it's now passed in in prepare()
*
* @return void * @return void
* @throws AuthorizationException
* @throws ServerException
*/ */
function handle($argarray=null) function handle()
{ {
parent::handle($argarray); parent::handle();
if ($this->isPost()) { if ($this->isPost()) {
$this->deleteAccount(); $this->deleteAccount();
} else { } else {
$this->showPage(); $this->showPage();
} }
return; return null;
}
/**
* Delete the current user's account
*
* Checks for the "I am sure." string to make sure the user really
* wants to delete their account.
*
* Then, marks the account as deleted and begins the deletion process
* (actually done by a back-end handler).
*
* If successful it logs the user out, and shows a brief completion message.
*
* @return void
* @throws AuthorizationException
* @throws ServerException
*/
function deleteAccount()
{
$this->checkSessionToken();
// !!! If this string is changed, it also needs to be changed in DeleteAccountForm::formData()
// TRANS: Confirmation text for user deletion. The user has to type this exactly the same, including punctuation.
$iamsure = _('I am sure.');
if ($this->trimmed('iamsure') != $iamsure) {
// TRANS: Notification for user about the text that must be input to be able to delete a user account.
// TRANS: %s is the text that needs to be input.
$this->_error = sprintf(_('You must write "%s" exactly in the box.'), $iamsure);
$this->showPage();
return null;
}
$cur = common_current_user();
// Mark the account as deleted and shove low-level deletion tasks
// to background queues. Removing a lot of posts can take a while...
if (!$cur->hasRole(Profile_role::DELETED)) {
$cur->grantRole(Profile_role::DELETED);
}
$qm = QueueManager::get();
$qm->enqueue($cur, 'deluser');
// The user is really-truly logged out
common_set_user(null);
common_real_login(false); // not logged in
common_forgetme(); // don't log back in!
$this->_complete = true;
$this->showPage();
} }
/** /**
@@ -139,55 +190,6 @@ class DeleteaccountAction extends Action
return null; return null;
} }
/**
* Delete the current user's account
*
* Checks for the "I am sure." string to make sure the user really
* wants to delete their account.
*
* Then, marks the account as deleted and begins the deletion process
* (actually done by a back-end handler).
*
* If successful it logs the user out, and shows a brief completion message.
*
* @return void
*/
function deleteAccount()
{
$this->checkSessionToken();
// !!! If this string is changed, it also needs to be changed in DeleteAccountForm::formData()
// TRANS: Confirmation text for user deletion. The user has to type this exactly the same, including punctuation.
$iamsure = _('I am sure.');
if ($this->trimmed('iamsure') != $iamsure ) {
// TRANS: Notification for user about the text that must be input to be able to delete a user account.
// TRANS: %s is the text that needs to be input.
$this->_error = sprintf(_('You must write "%s" exactly in the box.'), $iamsure);
$this->showPage();
return;
}
$cur = common_current_user();
// Mark the account as deleted and shove low-level deletion tasks
// to background queues. Removing a lot of posts can take a while...
if (!$cur->hasRole(Profile_role::DELETED)) {
$cur->grantRole(Profile_role::DELETED);
}
$qm = QueueManager::get();
$qm->enqueue($cur, 'deluser');
// The user is really-truly logged out
common_set_user(null);
common_real_login(false); // not logged in
common_forgetme(); // don't log back in!
$this->_complete = true;
$this->showPage();
}
/** /**
* Shows the page content. * Shows the page content.
* *
@@ -204,7 +206,7 @@ class DeleteaccountAction extends Action
$this->element('p', 'confirmation', $this->element('p', 'confirmation',
// TRANS: Confirmation that a user account has been deleted. // TRANS: Confirmation that a user account has been deleted.
_('Account deleted.')); _('Account deleted.'));
return; return null;
} }
if (!empty($this->_error)) { if (!empty($this->_error)) {
@@ -276,15 +278,12 @@ class DeleteAccountForm extends Form
$cur = common_current_user(); $cur = common_current_user();
// TRANS: Form text for user deletion form. // TRANS: Form text for user deletion form.
$msg = '<p>' . _('This will <strong>permanently delete</strong> '. $msg = '<p>' . _('This will <strong>permanently delete</strong> your account data from this server.') . '</p>';
'your account data from this server.') . '</p>';
if ($cur->hasRight(Right::BACKUPACCOUNT)) { if ($cur->hasRight(Right::BACKUPACCOUNT)) {
// TRANS: Additional form text for user deletion form shown if a user has account backup rights. // TRANS: Additional form text for user deletion form shown if a user has account backup rights.
// TRANS: %s is a URL to the backup page. // TRANS: %s is a URL to the backup page.
$msg .= '<p>' . sprintf(_('You are strongly advised to '. $msg .= '<p>' . sprintf(_('You are strongly advised to <a href="%s">back up your data</a> before deletion.'),
'<a href="%s">back up your data</a>'.
' before deletion.'),
common_local_url('backupaccount')) . '</p>'; common_local_url('backupaccount')) . '</p>';
} }
@@ -301,8 +300,8 @@ class DeleteAccountForm extends Form
null, null,
// TRANS: Input title for the delete account field. // TRANS: Input title for the delete account field.
// TRANS: %s is the text that needs to be input. // TRANS: %s is the text that needs to be input.
sprintf(_('Enter "%s" to confirm that '. sprintf(_('Enter "%s" to confirm that ' .
'you want to delete your account.'),$iamsure )); 'you want to delete your account.'), $iamsure));
} }
/** /**

View File

@@ -51,7 +51,7 @@ class DeleteapplicationAction extends Action
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
if (!parent::prepare($args)) { if (!parent::prepare($args)) {
return false; return false;
@@ -89,7 +89,7 @@ class DeleteapplicationAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {

View File

@@ -55,7 +55,7 @@ class DeletegroupAction extends RedirectingAction
* @fixme merge common setup code with other group actions * @fixme merge common setup code with other group actions
* @fixme allow group admins to delete their own groups * @fixme allow group admins to delete their own groups
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -114,9 +114,9 @@ class DeletegroupAction extends RedirectingAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('no')) { if ($this->arg('no')) {
$this->returnToPrevious(); $this->returnToPrevious();

View File

@@ -80,7 +80,7 @@ class DeleteuserAction extends ProfileFormAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('no')) { if ($this->arg('no')) {

View File

@@ -57,7 +57,7 @@ class EditApplicationAction extends Action
/** /**
* Prepare to run * Prepare to run
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -94,9 +94,9 @@ class EditApplicationAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->handlePost($args); $this->handlePost($args);

View File

@@ -29,7 +29,7 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { if (!defined('STATUSNET') && !defined('LACONICA') && !defined('GNUSOCIAL')) {
exit(1); exit(1);
} }
@@ -42,24 +42,63 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @package StatusNet * @package StatusNet
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net> * @author Zach Copley <zach@status.net>
* @author Alexei Sorokin <sor.alexei@meowr.ru>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class EditgroupAction extends GroupAction class EditgroupAction extends GroupAction
{ {
var $msg; public $message = null;
public $success = null;
protected $canPost = true;
function title() public function title()
{ {
// TRANS: Title for form to edit a group. %s is a group nickname. // TRANS: Title for form to edit a group. %s is a group nickname.
return sprintf(_('Edit %s group'), $this->group->nickname); return sprintf(_('Edit %s group'), $this->group->nickname);
} }
public function showContent()
{
$form = new GroupEditForm($this, $this->group);
$form->show();
}
public function showPageNoticeBlock()
{
parent::showPageNoticeBlock();
if ($this->message) {
$this->element(
'p',
($this->success) ? 'success' : 'error',
$this->message
);
} else {
$this->element(
'p',
'instructions',
// TRANS: Form instructions for group edit form.
_('Use this form to edit the group.')
);
}
}
public function showScripts()
{
parent::showScripts();
$this->autofocus('fullname');
}
/** /**
* Prepare to run * Prepare to run
* @param array $args
* @return bool
* @throws ClientException
* @throws NicknameException
*/ */
protected function prepare(array $args=array()) protected function prepare(array $args = [])
{ {
parent::prepare($args); parent::prepare($args);
@@ -74,7 +113,7 @@ class EditgroupAction extends GroupAction
// Permanent redirect on non-canonical nickname // Permanent redirect on non-canonical nickname
if ($nickname_arg != $nickname) { if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname); $args = ['nickname' => $nickname];
common_redirect(common_local_url('editgroup', $args), 301); common_redirect(common_local_url('editgroup', $args), 301);
} }
@@ -109,75 +148,32 @@ class EditgroupAction extends GroupAction
return true; return true;
} }
/** protected function handlePost()
* Handle the request
*
* On GET, show the form. On POST, try to save the group.
*
* @return void
*/
protected function handle()
{ {
parent::handle(); parent::handlePost();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->trySave();
} else {
$this->showForm();
}
}
function showForm($msg=null)
{
$this->msg = $msg;
$this->showPage();
}
function showContent()
{
$form = new GroupEditForm($this, $this->group);
$form->show();
}
function showPageNotice()
{
if ($this->msg) {
$this->element('p', 'error', $this->msg);
} else {
$this->element('p', 'instructions',
// TRANS: Form instructions for group edit form.
_('Use this form to edit the group.'));
}
}
function showScripts()
{
parent::showScripts();
$this->autofocus('fullname');
}
function trySave()
{
$cur = common_current_user(); $cur = common_current_user();
if (!$cur->isAdmin($this->group)) { if (!$cur->isAdmin($this->group)) {
// TRANS: Client error displayed trying to edit a group while not being a group admin. // TRANS: Client error displayed trying to edit a group while not being a group admin.
$this->clientError(_('You must be an admin to edit the group.'), 403); $this->clientError(_('You must be an admin to edit the group.'), 403);
} }
if (Event::handle('StartGroupSaveForm', array($this))) { if (Event::handle('StartGroupSaveForm', [$this])) {
// $nickname will only be set if this changenick value is true. // $nickname will only be set if this changenick value is true.
$nickname = null;
if (common_config('profile', 'changenick') == true) { if (common_config('profile', 'changenick') == true) {
try { try {
$nickname = Nickname::normalize($this->trimmed('newnickname'), true); $nickname = Nickname::normalize($this->trimmed('newnickname'), true);
} catch (NicknameTakenException $e) { } catch (NicknameTakenException $e) {
// Abort only if the nickname is occupied by _another_ group // Abort only if the nickname is occupied by _another_ group
if ($e->profile->id != $this->group->profile_id) { if ($e->profile->id != $this->group->profile_id) {
$this->showForm($e->getMessage()); $this->setMessage($e->getMessage(), true);
return; return;
} }
$nickname = Nickname::normalize($this->trimmed('newnickname')); // without in-use check this time $nickname = Nickname::normalize($this->trimmed('newnickname')); // without in-use check this time
} catch (NicknameException $e) { } catch (NicknameException $e) {
$this->showForm($e->getMessage()); $this->setMessage($e->getMessage(), true);
return; return;
} }
} }
@@ -200,40 +196,49 @@ class EditgroupAction extends GroupAction
if (!is_null($homepage) && (strlen($homepage) > 0) && if (!is_null($homepage) && (strlen($homepage) > 0) &&
!common_valid_http_url($homepage)) { !common_valid_http_url($homepage)) {
// TRANS: Group edit form validation error. // TRANS: Group edit form validation error.
$this->showForm(_('Homepage is not a valid URL.')); $this->setMessage(_('Homepage is not a valid URL.'), true);
return; return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) { } elseif (!is_null($fullname) && mb_strlen($fullname) > 255) {
// TRANS: Group edit form validation error. // TRANS: Group edit form validation error.
$this->showForm(_('Full name is too long (maximum 255 characters).')); $this->setMessage(_('Full name is too long (maximum 255 characters).'), true);
return; return;
} else if (User_group::descriptionTooLong($description)) { } elseif (User_group::descriptionTooLong($description)) {
$this->showForm(sprintf( $this->setMessage(sprintf(
// TRANS: Group edit form validation error. // TRANS: Group edit form validation error.
_m('Description is too long (maximum %d character).', _m(
'Description is too long (maximum %d character).',
'Description is too long (maximum %d characters).', 'Description is too long (maximum %d characters).',
User_group::maxDescription()), User_group::maxDescription()
User_group::maxDescription())); ),
User_group::maxDescription()
), true);
return; return;
} else if (!is_null($location) && mb_strlen($location) > 255) { } elseif (!is_null($location) && mb_strlen($location) > 255) {
// TRANS: Group edit form validation error. // TRANS: Group edit form validation error.
$this->showForm(_('Location is too long (maximum 255 characters).')); $this->setMessage(_('Location is too long (maximum 255 characters).'), true);
return; return;
} }
if (!empty($aliasstring)) { if (!empty($aliasstring)) {
$aliases = array_map(array('Nickname', 'normalize'), $aliases = array_map(
array_unique(preg_split('/[\s,]+/', $aliasstring))); ['Nickname', 'normalize'],
array_unique(preg_split('/[\s,]+/', $aliasstring))
);
} else { } else {
$aliases = array(); $aliases = [];
} }
if (count($aliases) > common_config('group', 'maxaliases')) { if (count($aliases) > common_config('group', 'maxaliases')) {
// TRANS: Group edit form validation error. // TRANS: Group edit form validation error.
// TRANS: %d is the maximum number of allowed aliases. // TRANS: %d is the maximum number of allowed aliases.
$this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.', $this->setMessage(sprintf(
_m(
'Too many aliases! Maximum %d allowed.', 'Too many aliases! Maximum %d allowed.',
common_config('group', 'maxaliases')), 'Too many aliases! Maximum %d allowed.',
common_config('group', 'maxaliases'))); common_config('group', 'maxaliases')
),
common_config('group', 'maxaliases')
), true);
return; return;
} }
@@ -242,10 +247,10 @@ class EditgroupAction extends GroupAction
$orig = clone($this->group); $orig = clone($this->group);
if (common_config('profile', 'changenick') == true && $this->group->nickname !== $nickname) { if (common_config('profile', 'changenick') == true && $this->group->nickname !== $nickname) {
assert(Nickname::normalize($nickname)===$nickname); assert(Nickname::normalize($nickname) === $nickname);
common_debug("Changing group nickname from '{$profile->nickname}' to '{$nickname}'."); common_debug("Changing group nickname from '{$this->group->nickname}' to '{$nickname}'.");
$this->group->nickname = $nickname; $this->group->nickname = $nickname;
$this->group->mainpage = common_local_url('showgroup', array('nickname' => $this->group->nickname)); $this->group->mainpage = common_local_url('showgroup', ['nickname' => $this->group->nickname]);
} }
$this->group->fullname = $fullname; $this->group->fullname = $fullname;
$this->group->homepage = $homepage; $this->group->homepage = $homepage;
@@ -271,14 +276,20 @@ class EditgroupAction extends GroupAction
$this->group->query('COMMIT'); $this->group->query('COMMIT');
Event::handle('EndGroupSaveForm', array($this)); Event::handle('EndGroupSaveForm', [$this]);
}
if ($this->group->nickname != $orig->nickname) { if ($this->group->nickname != $orig->nickname) {
common_redirect(common_local_url('editgroup', array('nickname' => $this->group->nickname)), 303); common_redirect(common_local_url('editgroup', ['nickname' => $this->group->nickname]), 303);
} else {
// TRANS: Group edit form success message.
$this->showForm(_('Options saved.'));
} }
} }
// TRANS: Group edit form success message.
$this->setMessage(_('Options saved.'));
}
public function setMessage($msg, $error = false)
{
$this->message = $msg;
$this->success = !$error;
}
} }

View File

@@ -60,7 +60,7 @@ class EditpeopletagAction extends Action
* Prepare to run * Prepare to run
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -135,9 +135,9 @@ class EditpeopletagAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->trySave(); $this->trySave();
} else { } else {

View File

@@ -369,8 +369,7 @@ class EmailsettingsAction extends SettingsAction
throw new ServerException(_('Could not insert confirmation code.')); throw new ServerException(_('Could not insert confirmation code.'));
} }
common_debug('Sending confirmation address for user '.$user->getID().' to email '.$email); $confirm->sendConfirmation();
mail_confirm_address($user, $confirm->code, $user->getNickname(), $email);
Event::handle('EndAddEmailAddress', array($user, $email)); Event::handle('EndAddEmailAddress', array($user, $email));
} }
@@ -401,13 +400,7 @@ class EmailsettingsAction extends SettingsAction
throw new AlreadyFulfilledException(_('No pending confirmation to cancel.')); throw new AlreadyFulfilledException(_('No pending confirmation to cancel.'));
} }
$result = $confirm->delete(); $confirm->delete();
if ($result === false) {
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling e-mail address confirmation.
throw new ServerException(_('Could not delete email confirmation.'));
}
// TRANS: Message given after successfully canceling e-mail address confirmation. // TRANS: Message given after successfully canceling e-mail address confirmation.
return _('Email confirmation cancelled.'); return _('Email confirmation cancelled.');

View File

@@ -54,7 +54,7 @@ class FeaturedAction extends Action
return true; return true;
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -74,9 +74,9 @@ class FeaturedAction extends Action
} }
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }

View File

@@ -35,7 +35,7 @@ class FoafGroupAction extends Action
return true; return true;
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -76,9 +76,9 @@ class FoafGroupAction extends Action
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
header('Content-Type: application/rdf+xml'); header('Content-Type: application/rdf+xml');

View File

@@ -47,7 +47,7 @@ class GeocodeAction extends Action
var $lon = null; var $lon = null;
var $location = null; var $location = null;
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$token = $this->trimmed('token'); $token = $this->trimmed('token');
@@ -70,7 +70,7 @@ class GeocodeAction extends Action
* @return nothing * @return nothing
* *
*/ */
function handle($args) function handle()
{ {
header('Content-Type: application/json; charset=utf-8'); header('Content-Type: application/json; charset=utf-8');
$location_object = array(); $location_object = array();

View File

@@ -49,7 +49,7 @@ class GrantRoleAction extends ProfileFormAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
if (!parent::prepare($args)) { if (!parent::prepare($args)) {
return false; return false;

View File

@@ -52,7 +52,7 @@ class GroupblockAction extends RedirectingAction
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
@@ -110,9 +110,9 @@ class GroupblockAction extends RedirectingAction
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($this->arg('no')) { if ($this->arg('no')) {
$this->returnToPrevious(); $this->returnToPrevious();

View File

@@ -42,7 +42,7 @@ if (!defined('GNUSOCIAL')) { exit(1); }
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class GroupbyidAction extends ManagedAction class GroupbyidAction extends ShowgroupAction
{ {
/** group we're viewing. */ /** group we're viewing. */
protected $group = null; protected $group = null;
@@ -55,10 +55,10 @@ class GroupbyidAction extends ManagedAction
protected function doPreparation() protected function doPreparation()
{ {
$this->group = User_group::getByID($this->arg('id')); $this->group = User_group::getByID($this->arg('id'));
} $this->target = $this->group->getProfile();
public function showPage() if ($this->target->isLocal()) {
{ common_redirect($this->target->getUrl());
common_redirect($this->group->homeUrl(), 303); }
} }
} }

View File

@@ -28,7 +28,9 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } if (!defined('GNUSOCIAL')) {
exit(1);
}
/** /**
* Upload an avatar * Upload an avatar
@@ -40,21 +42,257 @@ if (!defined('GNUSOCIAL')) { exit(1); }
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net> * @author Zach Copley <zach@status.net>
* @author Sarven Capadisli <csarven@status.net> * @author Sarven Capadisli <csarven@status.net>
* @author Alexei Sorokin <sor.alexei@meowr.ru>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class GrouplogoAction extends GroupAction class GrouplogoAction extends GroupAction
{ {
var $mode = null; public $mode = null;
var $imagefile = null; public $imagefile = null;
var $filename = null; public $filename = null;
var $msg = null; public $message = null;
var $success = null; public $success = null;
protected $canPost = true;
/**
* Title of the page
*
* @return string Title of the page
*/
public function title()
{
// TRANS: Title for group logo settings page.
return _('Group logo');
}
/**
* Content area of the page
*
* Shows a form for uploading an avatar.
*
* @return void
*/
public function showContent()
{
if ($this->mode == 'crop') {
$this->showCropForm();
} else {
$this->showUploadForm();
}
}
public function showCropForm()
{
$this->elementStart('form', array('method' => 'post',
'id' => 'form_settings_avatar',
'class' => 'form_settings',
'action' =>
common_local_url(
'grouplogo',
array('nickname' => $this->group->nickname)
)));
$this->elementStart('fieldset');
// TRANS: Legend for group logo settings fieldset.
$this->element('legend', null, _('Avatar settings'));
$this->hidden('token', common_session_token());
$this->elementStart('ul', 'form_data');
$this->elementStart(
'li',
array('id' => 'avatar_original',
'class' => 'avatar_view')
);
// TRANS: Header for originally uploaded file before a crop on the group logo page.
$this->element('h2', null, _('Original'));
$this->elementStart('div', array('id' => 'avatar_original_view'));
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
'width' => $this->filedata['width'],
'height' => $this->filedata['height'],
'alt' => $this->group->nickname));
$this->elementEnd('div');
$this->elementEnd('li');
$this->elementStart(
'li',
array('id' => 'avatar_preview',
'class' => 'avatar_view')
);
// TRANS: Header for the cropped group logo on the group logo page.
$this->element('h2', null, _('Preview'));
$this->elementStart('div', array('id' => 'avatar_preview_view'));
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $this->group->nickname));
$this->elementEnd('div');
foreach (array('avatar_crop_x', 'avatar_crop_y',
'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
$this->element('input', array('name' => $crop_info,
'type' => 'hidden',
'id' => $crop_info));
}
// TRANS: Button text for cropping an uploaded group logo.
$this->submit('crop', _('Crop'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
public function showUploadForm()
{
$user = common_current_user();
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
}
$original = $this->group->original_logo;
$this->elementStart('form', array('enctype' => 'multipart/form-data',
'method' => 'post',
'id' => 'form_settings_avatar',
'class' => 'form_settings',
'action' =>
common_local_url(
'grouplogo',
array('nickname' => $this->group->nickname)
)));
$this->elementStart('fieldset');
// TRANS: Group logo form legend.
$this->element('legend', null, _('Group logo'));
$this->hidden('token', common_session_token());
$this->elementStart('ul', 'form_data');
if ($original) {
$this->elementStart('li', array('id' => 'avatar_original',
'class' => 'avatar_view'));
// TRANS: Uploaded original file in group logo form.
$this->element('h2', null, _('Original'));
$this->elementStart('div', array('id' => 'avatar_original_view'));
$this->element('img', array('src' => $this->group->original_logo,
'alt' => $this->group->nickname));
$this->elementEnd('div');
$this->elementEnd('li');
}
if ($this->group->homepage_logo) {
$this->elementStart('li', array('id' => 'avatar_preview',
'class' => 'avatar_view'));
// TRANS: Header for preview of to be displayed group logo.
$this->element('h2', null, _('Preview'));
$this->elementStart('div', array('id' => 'avatar_preview_view'));
$this->element('img', array('src' => $this->group->homepage_logo,
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $this->group->nickname));
$this->elementEnd('div');
if (!empty($this->group->homepage_logo)) {
// TRANS: Button on group logo upload page to delete current group logo.
$this->submit('delete', _('Delete'));
}
$this->elementEnd('li');
}
$this->elementStart('li', array('id' => 'settings_attach'));
$this->element('input', array('name' => 'MAX_FILE_SIZE',
'type' => 'hidden',
'id' => 'MAX_FILE_SIZE',
'value' => ImageFile::maxFileSizeInt()));
$this->element('input', array('name' => 'avatarfile',
'type' => 'file',
'id' => 'avatarfile'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementStart('ul', 'form_actions');
$this->elementStart('li');
// TRANS: Submit button for uploading a group logo.
$this->submit('upload', _('Upload'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
public function showPageNoticeBlock()
{
parent::showPageNoticeBlock();
if ($this->message) {
$this->element(
'div',
($this->success) ? 'success' : 'error',
$this->message
);
} else {
$inst = $this->getInstructions();
$output = common_markup_to_html($inst);
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
}
}
/**
* Instructions for use
*
* @return string instructions for use
*/
public function getInstructions()
{
// TRANS: Instructions for group logo page.
// TRANS: %s is the maximum file size for that site.
return sprintf(_('You can upload a logo image for your group. The maximum file size is %s.'), ImageFile::maxFileSize());
}
/**
* Add the jCrop stylesheet
*
* @return void
*/
public function showStylesheets()
{
parent::showStylesheets();
$this->cssLink('js/extlib/jquery-jcrop/css/jcrop.css', 'base', 'screen, projection, tv');
}
/**
* Add the jCrop scripts
*
* @return void
*/
public function showScripts()
{
parent::showScripts();
if ($this->mode == 'crop') {
$this->script('extlib/jquery-jcrop/jcrop.js');
$this->script('jcrop.go.js');
}
$this->autofocus('avatarfile');
}
/** /**
* Prepare to run * Prepare to run
* @param array $args
* @return bool
* @throws ClientException
* @throws NicknameException
*/ */
protected function prepare(array $args=array()) protected function prepare(array $args = [])
{ {
parent::prepare($args); parent::prepare($args);
@@ -104,220 +342,30 @@ class GrouplogoAction extends GroupAction
return true; return true;
} }
protected function handle()
{
parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->handlePost();
} else {
$this->showForm();
}
}
function showForm($msg = null, $success = false)
{
$this->msg = $msg;
$this->success = $success;
$this->showPage();
}
/**
* Title of the page
*
* @return string Title of the page
*/
function title()
{
// TRANS: Title for group logo settings page.
return _('Group logo');
}
/**
* Instructions for use
*
* @return instructions for use
*/
function getInstructions()
{
// TRANS: Instructions for group logo page.
// TRANS: %s is the maximum file size for that site.
return sprintf(_('You can upload a logo image for your group. The maximum file size is %s.'), ImageFile::maxFileSize());
}
/**
* Content area of the page
*
* Shows a form for uploading an avatar.
*
* @return void
*/
function showContent()
{
if ($this->mode == 'crop') {
$this->showCropForm();
} else {
$this->showUploadForm();
}
}
function showUploadForm()
{
$user = common_current_user();
$profile = $user->getProfile();
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_('User has no profile.'));
}
$original = $this->group->original_logo;
$this->elementStart('form', array('enctype' => 'multipart/form-data',
'method' => 'post',
'id' => 'form_settings_avatar',
'class' => 'form_settings',
'action' =>
common_local_url('grouplogo',
array('nickname' => $this->group->nickname))));
$this->elementStart('fieldset');
// TRANS: Group logo form legend.
$this->element('legend', null, _('Group logo'));
$this->hidden('token', common_session_token());
$this->elementStart('ul', 'form_data');
if ($original) {
$this->elementStart('li', array('id' => 'avatar_original',
'class' => 'avatar_view'));
// TRANS: Uploaded original file in group logo form.
$this->element('h2', null, _('Original'));
$this->elementStart('div', array('id'=>'avatar_original_view'));
$this->element('img', array('src' => $this->group->original_logo,
'alt' => $this->group->nickname));
$this->elementEnd('div');
$this->elementEnd('li');
}
if ($this->group->homepage_logo) {
$this->elementStart('li', array('id' => 'avatar_preview',
'class' => 'avatar_view'));
// TRANS: Header for preview of to be displayed group logo.
$this->element('h2', null, _('Preview'));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
$this->element('img', array('src' => $this->group->homepage_logo,
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $this->group->nickname));
$this->elementEnd('div');
$this->elementEnd('li');
}
$this->elementStart('li', array ('id' => 'settings_attach'));
$this->element('input', array('name' => 'MAX_FILE_SIZE',
'type' => 'hidden',
'id' => 'MAX_FILE_SIZE',
'value' => ImageFile::maxFileSizeInt()));
$this->element('input', array('name' => 'avatarfile',
'type' => 'file',
'id' => 'avatarfile'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementStart('ul', 'form_actions');
$this->elementStart('li');
// TRANS: Submit button for uploading a group logo.
$this->submit('upload', _('Upload'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
function showCropForm()
{
$this->elementStart('form', array('method' => 'post',
'id' => 'form_settings_avatar',
'class' => 'form_settings',
'action' =>
common_local_url('grouplogo',
array('nickname' => $this->group->nickname))));
$this->elementStart('fieldset');
// TRANS: Legend for group logo settings fieldset.
$this->element('legend', null, _('Avatar settings'));
$this->hidden('token', common_session_token());
$this->elementStart('ul', 'form_data');
$this->elementStart('li',
array('id' => 'avatar_original',
'class' => 'avatar_view'));
// TRANS: Header for originally uploaded file before a crop on the group logo page.
$this->element('h2', null, _('Original'));
$this->elementStart('div', array('id'=>'avatar_original_view'));
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
'width' => $this->filedata['width'],
'height' => $this->filedata['height'],
'alt' => $this->group->nickname));
$this->elementEnd('div');
$this->elementEnd('li');
$this->elementStart('li',
array('id' => 'avatar_preview',
'class' => 'avatar_view'));
// TRANS: Header for the cropped group logo on the group logo page.
$this->element('h2', null, _('Preview'));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE,
'alt' => $this->group->nickname));
$this->elementEnd('div');
foreach (array('avatar_crop_x', 'avatar_crop_y',
'avatar_crop_w', 'avatar_crop_h') as $crop_info) {
$this->element('input', array('name' => $crop_info,
'type' => 'hidden',
'id' => $crop_info));
}
// TRANS: Button text for cropping an uploaded group logo.
$this->submit('crop', _('Crop'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
/** /**
* Handle a post * Handle a post
* *
* We mux on the button name to figure out what the user actually wanted. * We mux on the button name to figure out what the user actually wanted.
* *
* @return void * @return void
* @throws ClientException
* @throws NoResultException
* @throws UnsupportedMediaException
* @throws UseFileAsThumbnailException
*/ */
function handlePost() protected function handlePost()
{ {
// CSRF protection parent::handlePost();
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
// TRANS: Form validation error message.
$this->show_form(_('There was a problem with your session token. '.
'Try again, please.'));
return;
}
if ($this->arg('upload')) { if ($this->arg('upload')) {
$this->uploadLogo(); $this->uploadLogo();
} else if ($this->arg('crop')) { } elseif ($this->arg('crop')) {
$this->cropLogo(); $this->cropLogo();
} elseif ($this->arg('delete')) {
$this->deleteLogo();
} else { } else {
// TRANS: Form validation error message when an unsupported argument is used. // TRANS: Form validation error message when an unsupported argument is used.
$this->showForm(_('Unexpected form submission.')); $this->setMessage(_('Unexpected form submission.'), true);
} }
} }
@@ -329,20 +377,22 @@ class GrouplogoAction extends GroupAction
* *
* @return void * @return void
*/ */
function uploadLogo() public function uploadLogo()
{ {
try { try {
$imagefile = ImageFile::fromUpload('avatarfile'); $imagefile = ImageFile::fromUpload('avatarfile');
} catch (Exception $e) { } catch (Exception $e) {
$this->showForm($e->getMessage()); $this->setMessage($e->getMessage(), true);
return; return;
} }
$type = $imagefile->preferredType(); $type = $imagefile->preferredType();
$filename = Avatar::filename($this->group->id, $filename = Avatar::filename(
$this->group->id,
image_type_to_extension($type), image_type_to_extension($type),
null, null,
'group-temp-'.common_timestamp()); 'group-temp-' . common_timestamp()
);
$filepath = Avatar::path($filename); $filepath = Avatar::path($filename);
@@ -361,16 +411,24 @@ class GrouplogoAction extends GroupAction
$this->mode = 'crop'; $this->mode = 'crop';
// TRANS: Form instructions on the group logo page. // TRANS: Form instructions on the group logo page.
$this->showForm(_('Pick a square area of the image to be the logo.'), $this->setMessage(_('Pick a square area of the image to be the logo.'));
true); }
public function setMessage($msg, $error = false)
{
$this->message = $msg;
$this->success = !$error;
} }
/** /**
* Handle the results of jcrop. * Handle the results of jcrop.
* *
* @return void * @return void
* @throws NoResultException
* @throws UnsupportedMediaException
* @throws UseFileAsThumbnailException
*/ */
function cropLogo() public function cropLogo()
{ {
$filedata = $_SESSION['FILEDATA']; $filedata = $_SESSION['FILEDATA'];
@@ -380,10 +438,10 @@ class GrouplogoAction extends GroupAction
} }
// If image is not being cropped assume pos & dimentions of original // If image is not being cropped assume pos & dimentions of original
$dest_x = $this->arg('avatar_crop_x') ? $this->arg('avatar_crop_x'):0; $dest_x = $this->arg('avatar_crop_x') ? $this->arg('avatar_crop_x') : 0;
$dest_y = $this->arg('avatar_crop_y') ? $this->arg('avatar_crop_y'):0; $dest_y = $this->arg('avatar_crop_y') ? $this->arg('avatar_crop_y') : 0;
$dest_w = $this->arg('avatar_crop_w') ? $this->arg('avatar_crop_w'):$filedata['width']; $dest_w = $this->arg('avatar_crop_w') ? $this->arg('avatar_crop_w') : $filedata['width'];
$dest_h = $this->arg('avatar_crop_h') ? $this->arg('avatar_crop_h'):$filedata['height']; $dest_h = $this->arg('avatar_crop_h') ? $this->arg('avatar_crop_h') : $filedata['height'];
$size = min($dest_w, $dest_h, common_config('avatar', 'maxsize')); $size = min($dest_w, $dest_h, common_config('avatar', 'maxsize'));
$box = array('width' => $size, 'height' => $size, $box = array('width' => $size, 'height' => $size,
'x' => $dest_x, 'y' => $dest_y, 'x' => $dest_x, 'y' => $dest_y,
@@ -392,8 +450,12 @@ class GrouplogoAction extends GroupAction
$profile = $this->group->getProfile(); $profile = $this->group->getProfile();
$imagefile = new ImageFile(null, $filedata['filepath']); $imagefile = new ImageFile(null, $filedata['filepath']);
$filename = Avatar::filename($profile->getID(), image_type_to_extension($imagefile->preferredType()), $filename = Avatar::filename(
$size, common_timestamp()); $profile->getID(),
image_type_to_extension($imagefile->preferredType()),
$size,
common_timestamp()
);
$imagefile->resizeTo(Avatar::path($filename), $box); $imagefile->resizeTo(Avatar::path($filename), $box);
@@ -402,53 +464,33 @@ class GrouplogoAction extends GroupAction
unset($_SESSION['FILEDATA']); unset($_SESSION['FILEDATA']);
$this->mode = 'upload'; $this->mode = 'upload';
// TRANS: Form success message after updating a group logo. // TRANS: Form success message after updating a group logo.
$this->showForm(_('Logo updated.'), true); $this->setMessage(_('Logo updated.'));
} else { } else {
// TRANS: Form failure message after failing to update a group logo. // TRANS: Form failure message after failing to update a group logo.
$this->showForm(_('Failed updating logo.')); $this->setMessage(_('Failed updating logo.'), true);
}
}
function showPageNotice()
{
if ($this->msg) {
$this->element('div', ($this->success) ? 'success' : 'error',
$this->msg);
} else {
$inst = $this->getInstructions();
$output = common_markup_to_html($inst);
$this->elementStart('div', 'instructions');
$this->raw($output);
$this->elementEnd('div');
} }
} }
/** /**
* Add the jCrop stylesheet * Get rid of the current group logo.
* *
* @return void * @return void
*/ */
function showStylesheets() public function deleteLogo()
{ {
parent::showStylesheets(); $orig = clone($this->group);
$this->cssLink('js/extlib/jquery-jcrop/css/jcrop.css','base','screen, projection, tv'); Avatar::deleteFromProfile($this->group->getProfile());
} @unlink(Avatar::path(basename($this->group->original_logo)));
@unlink(Avatar::path(basename($this->group->homepage_logo)));
@unlink(Avatar::path(basename($this->group->stream_logo)));
@unlink(Avatar::path(basename($this->group->mini_logo)));
$this->group->original_logo = User_group::defaultLogo(AVATAR_PROFILE_SIZE);
$this->group->homepage_logo = User_group::defaultLogo(AVATAR_PROFILE_SIZE);
$this->group->stream_logo = User_group::defaultLogo(AVATAR_STREAM_SIZE);
$this->group->mini_logo = User_group::defaultLogo(AVATAR_MINI_SIZE);
$this->group->update($orig);
/** // TRANS: Success message for deleting the group logo.
* Add the jCrop scripts $this->setMessage(_('Logo deleted.'));
*
* @return void
*/
function showScripts()
{
parent::showScripts();
if ($this->mode == 'crop') {
$this->script('extlib/jquery-jcrop/jcrop.js');
$this->script('jcrop.go.js');
}
$this->autofocus('avatarfile');
} }
} }

View File

@@ -27,12 +27,7 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
require_once(INSTALLDIR.'/lib/profilelist.php');
require_once INSTALLDIR.'/lib/publicgroupnav.php';
/** /**
* List of group members * List of group members
@@ -52,15 +47,6 @@ class GroupmembersAction extends GroupAction
return true; return true;
} }
protected function prepare(array $args=array())
{
parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
return true;
}
function title() function title()
{ {
if ($this->page == 1) { if ($this->page == 1) {

View File

@@ -153,7 +153,7 @@ class GroupqueueAction extends GroupAction
// @todo FIXME: documentation missing. // @todo FIXME: documentation missing.
class GroupQueueList extends GroupMemberList class GroupQueueList extends GroupMemberList
{ {
function newListItem($profile) function newListItem(Profile $profile)
{ {
return new GroupQueueListItem($profile, $this->group, $this->action); return new GroupQueueListItem($profile, $this->group, $this->action);
} }

View File

@@ -67,16 +67,16 @@ class GroupsAction extends Action
} }
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }

View File

@@ -52,7 +52,7 @@ class GroupunblockAction extends Action
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
@@ -103,9 +103,9 @@ class GroupunblockAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->unblockProfile(); $this->unblockProfile();
} }

View File

@@ -359,13 +359,7 @@ class ImsettingsAction extends SettingsAction
throw new AlreadyFulfilledException(_('No pending confirmation to cancel.')); throw new AlreadyFulfilledException(_('No pending confirmation to cancel.'));
} }
$result = $confirm->delete(); $confirm->delete();
if ($result === false) {
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling IM address confirmation.
throw new ServerException(_('Could not delete confirmation.'));
}
// TRANS: Message given after successfully canceling IM address confirmation. // TRANS: Message given after successfully canceling IM address confirmation.
return _('IM confirmation cancelled.'); return _('IM confirmation cancelled.');

View File

@@ -38,9 +38,9 @@ class InviteAction extends Action
return false; return false;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if (!common_config('invite', 'enabled')) { if (!common_config('invite', 'enabled')) {
// TRANS: Client error displayed when trying to sent invites while they have been disabled. // TRANS: Client error displayed when trying to sent invites while they have been disabled.
$this->clientError(_('Invites have been disabled.')); $this->clientError(_('Invites have been disabled.'));

View File

@@ -54,7 +54,7 @@ class MakeadminAction extends RedirectingAction
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
if (!common_logged_in()) { if (!common_logged_in()) {
@@ -111,9 +111,9 @@ class MakeadminAction extends RedirectingAction
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->makeAdmin(); $this->makeAdmin();
} }

View File

@@ -1,82 +0,0 @@
<?php
/**
* Microsummary action, see https://wiki.mozilla.org/Microsummaries
*
* PHP version 5
*
* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Robin Millette <millette@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2008, 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
/**
* Microsummary action class.
*
* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Robin Millette <millette@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class MicrosummaryAction extends Action
{
/**
* Class handler.
*
* @param array $args array of arguments
*
* @return nothing
*/
function handle($args)
{
parent::handle($args);
$nickname = common_canonical_nickname($this->arg('nickname'));
$user = User::getKV('nickname', $nickname);
if (!$user) {
// TRANS: Client error displayed trying to make a micro summary without providing a valid user.
$this->clientError(_('No such user.'), 404);
}
$notice = $user->getCurrentNotice();
if (!$notice) {
// TRANS: Client error displayed trying to make a micro summary without providing a status.
$this->clientError(_('No current status.'), 404);
}
header('Content-Type: text/plain');
print $user->nickname . ': ' . $notice->content;
}
function isReadOnly($args)
{
return true;
}
}

View File

@@ -49,25 +49,36 @@ class NetworkpublicAction extends SitestreamAction
// Network public tag cloud? // Network public tag cloud?
} }
/**
* Output <head> elements for RSS and Atom feeds
*
* @return array
*/
function getFeeds() function getFeeds()
{ {
return array(new Feed(Feed::JSON, return [
common_local_url('ApiTimelineNetworkPublic',
array('format' => 'as')),
// TRANS: Link description for the _global_ network public timeline feed.
_('Network Public Timeline Feed (Activity Streams JSON)')),
new Feed(Feed::RSS1, common_local_url('publicrss'),
// TRANS: Link description for the _global_ network public timeline feed.
_('Network Public Timeline Feed (RSS 1.0)')),
new Feed(Feed::RSS2,
common_local_url('ApiTimelineNetworkPublic',
array('format' => 'rss')),
// TRANS: Link description for the _global_ network public timeline feed.
_('Network Public Timeline Feed (RSS 2.0)')),
new Feed(Feed::ATOM, new Feed(Feed::ATOM,
common_local_url('ApiTimelineNetworkPublic', common_local_url('ApiTimelinePublic',
array('format' => 'atom')), array('format' => 'atom')),
// TRANS: Link description for the _global_ network public timeline feed. // TRANS: Link description for public timeline feed.
_('Network Public Timeline Feed (Atom)'))); _('Public Timeline Feed (Atom)')
),
new Feed(Feed::JSON,
common_local_url('ApiTimelinePublic',
array('format' => 'as')),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (Activity Streams JSON)')
),
new Feed(Feed::RSS1, common_local_url('publicrss'),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (RSS 1.0)')
),
new Feed(Feed::RSS2,
common_local_url('ApiTimelinePublic',
array('format' => 'rss')),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (RSS 2.0)')
),
];
} }
} }

View File

@@ -47,6 +47,8 @@ class NewnoticeAction extends FormAction
{ {
protected $form = 'Notice'; protected $form = 'Notice';
protected $inreplyto = null;
/** /**
* Title of the page * Title of the page
* *
@@ -75,6 +77,11 @@ class NewnoticeAction extends FormAction
} }
} }
if ($this->int('inreplyto')) {
// Throws exception if the inreplyto Notice is given but not found.
$this->inreplyto = Notice::getByID($this->int('inreplyto'));
}
// Backwards compatibility for "share this" widget things. // Backwards compatibility for "share this" widget things.
// If no 'content', use 'status_textarea' // If no 'content', use 'status_textarea'
$this->formOpts['content'] = $this->trimmed('content') ?: $this->trimmed('status_textarea'); $this->formOpts['content'] = $this->trimmed('content') ?: $this->trimmed('status_textarea');
@@ -115,7 +122,7 @@ class NewnoticeAction extends FormAction
// simply no attached media to the new notice // simply no attached media to the new notice
if (empty($content)) { if (empty($content)) {
// TRANS: Client error displayed trying to send a notice without content. // TRANS: Client error displayed trying to send a notice without content.
$this->clientError(_('No content!')); throw new ClientException(_('No content!'));
} }
} }
@@ -132,13 +139,6 @@ class NewnoticeAction extends FormAction
return; return;
} }
if ($this->int('inreplyto')) {
// Throws exception if the inreplyto Notice is given but not found.
$parent = Notice::getByID($this->int('inreplyto'));
} else {
$parent = null;
}
$act = new Activity(); $act = new Activity();
$act->verb = ActivityVerb::POST; $act->verb = ActivityVerb::POST;
$act->time = time(); $act->time = time();
@@ -157,9 +157,9 @@ class NewnoticeAction extends FormAction
$act->context = new ActivityContext(); $act->context = new ActivityContext();
if ($parent instanceof Notice) { if ($this->inreplyto instanceof Notice) {
$act->context->replyToID = $parent->getUri(); $act->context->replyToID = $this->inreplyto->getUri();
$act->context->replyToUrl = $parent->getUrl(true); // maybe we don't have to send true here to force a URL? $act->context->replyToUrl = $this->inreplyto->getUrl(true); // maybe we don't have to send true here to force a URL?
} }
if ($this->scoped->shareLocation()) { if ($this->scoped->shareLocation()) {
@@ -188,14 +188,14 @@ class NewnoticeAction extends FormAction
// FIXME: We should be able to get the attentions from common_render_content! // FIXME: We should be able to get the attentions from common_render_content!
// and maybe even directly save whether they're local or not! // and maybe even directly save whether they're local or not!
$act->context->attention = common_get_attentions($content, $this->scoped, $parent); $act->context->attention = common_get_attentions($content, $this->scoped, $this->inreplyto);
// $options gets filled with possible scoping settings // $options gets filled with possible scoping settings
ToSelector::fillActivity($this, $act, $options); ToSelector::fillActivity($this, $act, $options);
$actobj = new ActivityObject(); $actobj = new ActivityObject();
$actobj->type = ActivityObject::NOTE; $actobj->type = ActivityObject::NOTE;
$actobj->content = common_render_content($content, $this->scoped, $parent); $actobj->content = common_render_content($content, $this->scoped, $this->inreplyto);
// Finally add the activity object to our activity // Finally add the activity object to our activity
$act->objects[] = $actobj; $act->objects[] = $actobj;
@@ -224,6 +224,9 @@ class NewnoticeAction extends FormAction
if ($this->getInfo() && $this->stored instanceof Notice) { if ($this->getInfo() && $this->stored instanceof Notice) {
$this->showNotice($this->stored); $this->showNotice($this->stored);
} elseif (!$this->getError()) { } elseif (!$this->getError()) {
if (!GNUsocial::isAjax() && $this->inreplyto instanceof Notice) {
$this->showNotice($this->inreplyto);
}
parent::showContent(); parent::showContent();
} }
} }

View File

@@ -50,14 +50,14 @@ class NoticesearchAction extends SearchAction
{ {
protected $q = null; protected $q = null;
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$this->q = $this->trimmed('q'); $this->q = $this->trimmed('q');
// FIXME: very dependent on tag format // FIXME: very dependent on tag format
if (preg_match('/^#([\pL\pN_\-\.]{1,64})/ue', $this->q)) { if (preg_match('/^\#([\pL\pN_\-\.]{1,64})/u', $this->q)) {
common_redirect(common_local_url('tag', common_redirect(common_local_url('tag',
array('tag' => common_canonical_tag(substr($this->q, 1)))), array('tag' => common_canonical_tag(substr($this->q, 1)))),
303); 303);
@@ -65,8 +65,7 @@ class NoticesearchAction extends SearchAction
if (!empty($this->q)) { if (!empty($this->q)) {
$profile = Profile::current(); $stream = new SearchNoticeStream($this->q, $this->scoped);
$stream = new SearchNoticeStream($this->q, $profile);
$page = $this->trimmed('page'); $page = $this->trimmed('page');
if (empty($page)) { if (empty($page)) {
@@ -186,7 +185,7 @@ class SearchNoticeList extends NoticeList {
$this->terms = $terms; $this->terms = $terms;
} }
function newListItem($notice) function newListItem(Notice $notice)
{ {
return new SearchNoticeListItem($notice, $this->out, $this->terms); return new SearchNoticeListItem($notice, $this->out, $this->terms);
} }

View File

@@ -55,9 +55,9 @@ class NudgeAction extends Action
* *
* @return nothing * @return nothing
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if (!common_logged_in()) { if (!common_logged_in()) {
// TRANS: Error message displayed when trying to perform an action that requires a logged in user. // TRANS: Error message displayed when trying to perform an action that requires a logged in user.

View File

@@ -53,9 +53,9 @@ class OpensearchAction extends Action
* *
* @return boolean false if user doesn't exist * @return boolean false if user doesn't exist
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$type = $this->trimmed('type'); $type = $this->trimmed('type');
$short_name = ''; $short_name = '';
if ($type == 'people') { if ($type == 'people') {

View File

@@ -53,7 +53,7 @@ class OtpAction extends Action
var $returnto; var $returnto;
var $lt; var $lt;
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -110,9 +110,9 @@ class OtpAction extends Action
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
// success! // success!
if (!common_set_user($this->user)) { if (!common_set_user($this->user)) {

View File

@@ -28,7 +28,9 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET')) { exit(1); } if (!defined('STATUSNET')) {
exit(1);
}
/** /**
* Change password * Change password
@@ -40,7 +42,6 @@ if (!defined('STATUSNET')) { exit(1); }
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class PasswordsettingsAction extends SettingsAction class PasswordsettingsAction extends SettingsAction
{ {
/** /**
@@ -49,37 +50,36 @@ class PasswordsettingsAction extends SettingsAction
* @return string Title of the page * @return string Title of the page
*/ */
function title() public function title()
{ {
// TRANS: Title for page where to change password. // TRANS: Title for page where to change password.
return _m('TITLE','Change password'); return _m('TITLE', 'Change password');
} }
/** /**
* Instructions for use * Instructions for use
* *
* @return instructions for use * @return string instructions for use
*/ */
function getInstructions() public function getInstructions()
{ {
// TRANS: Instructions for page where to change password. // TRANS: Instructions for page where to change password.
return _('Change your password.'); return _('Change your password.');
} }
function showScripts() public function showScripts()
{ {
parent::showScripts(); parent::showScripts();
$this->autofocus('oldpassword'); $this->autofocus('oldpassword');
} }
function showContent() public function showContent()
{ {
$this->elementStart('form', array('method' => 'POST', $this->elementStart('form', ['method' => 'POST',
'id' => 'form_password', 'id' => 'form_password',
'class' => 'form_settings', 'class' => 'form_settings',
'action' => 'action' => common_local_url('passwordsettings')]);
common_local_url('passwordsettings')));
$this->elementStart('fieldset'); $this->elementStart('fieldset');
// TRANS: Fieldset legend on page where to change password. // TRANS: Fieldset legend on page where to change password.
$this->element('legend', null, _('Password change')); $this->element('legend', null, _('Password change'));
@@ -102,14 +102,14 @@ class PasswordsettingsAction extends SettingsAction
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on page where to change password. In this field the new password should be typed a second time. // TRANS: Field label on page where to change password. In this field the new password should be typed a second time.
$this->password('confirm', _m('LABEL','Confirm'), $this->password('confirm', _m('LABEL', 'Confirm'),
// TRANS: Field title on page where to change password. // TRANS: Field title on page where to change password.
_('Same as password above.')); _('Same as password above.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
// TRANS: Button text on page where to change password. // TRANS: Button text on page where to change password.
$this->submit('changepass', _m('BUTTON','Change')); $this->submit('changepass', _m('BUTTON', 'Change'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
@@ -127,7 +127,7 @@ class PasswordsettingsAction extends SettingsAction
if (strlen($newpassword) < 6) { if (strlen($newpassword) < 6) {
// TRANS: Form validation error on page where to change password. // TRANS: Form validation error on page where to change password.
throw new ClientException(_('Password must be 6 or more characters.')); throw new ClientException(_('Password must be 6 or more characters.'));
} else if (0 != strcmp($newpassword, $confirm)) { } elseif (0 != strcmp($newpassword, $confirm)) {
// TRANS: Form validation error on password change when password confirmation does not match. // TRANS: Form validation error on password change when password confirmation does not match.
throw new ClientException(_('Passwords do not match.')); throw new ClientException(_('Passwords do not match.'));
} }
@@ -142,11 +142,12 @@ class PasswordsettingsAction extends SettingsAction
} }
} }
if (Event::handle('StartChangePassword', array($this->scoped, $oldpassword, $newpassword))) { if (Event::handle('StartChangePassword', [$this->scoped, $oldpassword, $newpassword])) {
//no handler changed the password, so change the password internally // no handler changed the password, so change the password internally
$user = $this->scoped->getUser();
$user->setPassword($newpassword); $user->setPassword($newpassword);
Event::handle('EndChangePassword', array($this->scoped)); Event::handle('EndChangePassword', [$this->scoped]);
} }
// TRANS: Form validation notice on page where to change password. // TRANS: Form validation notice on page where to change password.

View File

@@ -62,7 +62,7 @@ class PeopletagAction extends Action
} }
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -84,9 +84,9 @@ class PeopletagAction extends Action
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }

View File

@@ -44,7 +44,7 @@ class PeopletagautocompleteAction extends Action
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -112,7 +112,7 @@ class PeopletagautocompleteAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
//common_log(LOG_DEBUG, 'Autocomplete data: ' . json_encode($this->tags)); //common_log(LOG_DEBUG, 'Autocomplete data: ' . json_encode($this->tags));
if ($this->tags) { if ($this->tags) {

View File

@@ -53,7 +53,7 @@ class PeopletaggedAction extends Action
return true; return true;
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -117,9 +117,9 @@ class PeopletaggedAction extends Action
} }
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }
@@ -167,7 +167,7 @@ class PeopletagMemberList extends ProfileList
$this->peopletag = $peopletag; $this->peopletag = $peopletag;
} }
function newListItem($profile) function newListItem(Profile $profile)
{ {
return new PeopletagMemberListItem($profile, $this->peopletag, $this->action); return new PeopletagMemberListItem($profile, $this->peopletag, $this->action);
} }

View File

@@ -68,7 +68,7 @@ class PeopletagsbyuserAction extends Action
} }
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -135,9 +135,9 @@ class PeopletagsbyuserAction extends Action
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
# Post from the tag dropdown; redirect to a GET # Post from the tag dropdown; redirect to a GET

View File

@@ -54,7 +54,7 @@ class PeopletagsforuserAction extends Action
} }
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -95,9 +95,9 @@ class PeopletagsforuserAction extends Action
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }

View File

@@ -53,7 +53,7 @@ class PeopletagsubscribersAction extends Action
return true; return true;
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -117,9 +117,9 @@ class PeopletagsubscribersAction extends Action
} }
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }
@@ -167,7 +167,7 @@ class PeopletagSubscriberList extends ProfileList
$this->peopletag = $peopletag; $this->peopletag = $peopletag;
} }
function newListItem($profile) function newListItem(Profile $profile)
{ {
return new PeopletagSubscriberListItem($profile, $this->peopletag, $this->action); return new PeopletagSubscriberListItem($profile, $this->peopletag, $this->action);
} }

View File

@@ -56,7 +56,7 @@ class PeopletagsubscriptionsAction extends Action
} }
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -97,9 +97,9 @@ class PeopletagsubscriptionsAction extends Action
return true; return true;
} }
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }

View File

@@ -64,7 +64,7 @@ class PluginEnableAction extends Action
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -121,7 +121,7 @@ class PluginEnableAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
$key = 'disable-' . $this->plugin; $key = 'disable-' . $this->plugin;
Config::save('plugins', $key, $this->overrideValue()); Config::save('plugins', $key, $this->overrideValue());

View File

@@ -68,7 +68,7 @@ class ProfilecompletionAction extends Action
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -120,7 +120,7 @@ class ProfilecompletionAction extends Action
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
$this->msg = null; $this->msg = null;

View File

@@ -45,7 +45,7 @@ class ProfiletagbyidAction extends Action
return true; return true;
} }
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -83,7 +83,7 @@ class ProfiletagbyidAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
common_redirect($this->peopletag->homeUrl(), 303); common_redirect($this->peopletag->homeUrl(), 303);
} }

View File

@@ -86,12 +86,6 @@ class PublicAction extends SitestreamAction
$ibs->show(); $ibs->show();
} }
$p = Profile::current();
if (!common_config('performance', 'high')) {
$cloud = new PublicTagCloudSection($this);
$cloud->show();
}
$feat = new FeaturedUsersSection($this); $feat = new FeaturedUsersSection($this);
$feat->show(); $feat->show();
} }
@@ -99,27 +93,33 @@ class PublicAction extends SitestreamAction
/** /**
* Output <head> elements for RSS and Atom feeds * Output <head> elements for RSS and Atom feeds
* *
* @return void * @return array
*/ */
function getFeeds() function getFeeds()
{ {
return array(new Feed(Feed::JSON, return [
common_local_url('ApiTimelinePublic',
array('format' => 'as')),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (Activity Streams JSON)')),
new Feed(Feed::RSS1, common_local_url('publicrss'),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (RSS 1.0)')),
new Feed(Feed::RSS2,
common_local_url('ApiTimelinePublic',
array('format' => 'rss')),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (RSS 2.0)')),
new Feed(Feed::ATOM, new Feed(Feed::ATOM,
common_local_url('ApiTimelinePublic', common_local_url('ApiTimelinePublic',
array('format' => 'atom')), array('format' => 'atom')),
// TRANS: Link description for public timeline feed. // TRANS: Link description for public timeline feed.
_('Public Timeline Feed (Atom)'))); _('Public Timeline Feed (Atom)')
),
new Feed(Feed::JSON,
common_local_url('ApiTimelinePublic',
array('format' => 'as')),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (Activity Streams JSON)')
),
new Feed(Feed::RSS1, common_local_url('publicrss'),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (RSS 1.0)')
),
new Feed(Feed::RSS2,
common_local_url('ApiTimelinePublic',
array('format' => 'rss')),
// TRANS: Link description for public timeline feed.
_('Public Timeline Feed (RSS 2.0)')
),
];
} }
} }

View File

@@ -29,9 +29,9 @@ class RecoverpasswordAction extends Action
var $msg = null; var $msg = null;
var $success = null; var $success = null;
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if (common_logged_in()) { if (common_logged_in()) {
// TRANS: Client error displayed trying to recover password while already logged in. // TRANS: Client error displayed trying to recover password while already logged in.
$this->clientError(_('You are already logged in!')); $this->clientError(_('You are already logged in!'));
@@ -79,13 +79,7 @@ class RecoverpasswordAction extends Action
// Burn this code // Burn this code
$result = $confirm->delete(); $confirm->delete();
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error displayed removing a password recovery code from the database.
$this->serverError(_('Error with confirmation code.'));
}
// These should be reaped, but for now we just check mod time // These should be reaped, but for now we just check mod time
// Note: it's still deleted; let's avoid a second attempt! // Note: it's still deleted; let's avoid a second attempt!

View File

@@ -63,7 +63,7 @@ class RedirectAction extends Action
* *
* @return nothing * @return nothing
*/ */
function handle($args) function handle()
{ {
common_redirect(common_local_url($this->arg('nextAction'), $this->arg('args'))); common_redirect(common_local_url($this->arg('nextAction'), $this->arg('args')));
} }

View File

@@ -120,9 +120,9 @@ class RegisterAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
parent::handle($args); parent::handle();
if (common_config('site', 'closed')) { if (common_config('site', 'closed')) {
// TRANS: Client error displayed when trying to register to a closed site. // TRANS: Client error displayed when trying to register to a closed site.

View File

@@ -66,7 +66,7 @@ class RemovepeopletagAction extends Action
* *
* @return boolean success flag * @return boolean success flag
*/ */
function prepare($args) function prepare(array $args = array())
{ {
parent::prepare($args); parent::prepare($args);
@@ -120,7 +120,7 @@ class RemovepeopletagAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) function handle()
{ {
// Throws exception on error // Throws exception on error

View File

@@ -63,13 +63,14 @@ class RestoreaccountAction extends Action
/** /**
* For initializing members of the class. * For initializing members of the class.
* *
* @param array $argarray misc. arguments * @param array $args misc. arguments
* *
* @return boolean true * @return boolean true
* @throws ClientException
*/ */
function prepare($argarray) function prepare(array $args = [])
{ {
parent::prepare($argarray); parent::prepare($args);
$cur = common_current_user(); $cur = common_current_user();
@@ -89,20 +90,19 @@ class RestoreaccountAction extends Action
/** /**
* Handler method * Handler method
* *
* @param array $argarray is ignored since it's now passed in in prepare()
*
* @return void * @return void
* @throws ClientException
*/ */
function handle($argarray=null) function handle()
{ {
parent::handle($argarray); parent::handle();
if ($this->isPost()) { if ($this->isPost()) {
$this->restoreAccount(); $this->restoreAccount();
} else { } else {
$this->showPage(); $this->showPage();
} }
return; return null;
} }
/** /**
@@ -111,6 +111,8 @@ class RestoreaccountAction extends Action
* Uses the UserActivityStream class; may take a long time! * Uses the UserActivityStream class; may take a long time!
* *
* @return void * @return void
* @throws ClientException
* @throws Exception
*/ */
function restoreAccount() function restoreAccount()
{ {
@@ -128,41 +130,33 @@ class RestoreaccountAction extends Action
// TRANS: Client exception thrown when an uploaded file is larger than set in php.ini. // TRANS: Client exception thrown when an uploaded file is larger than set in php.ini.
throw new ClientException(_('The uploaded file exceeds the ' . throw new ClientException(_('The uploaded file exceeds the ' .
'upload_max_filesize directive in php.ini.')); 'upload_max_filesize directive in php.ini.'));
return;
case UPLOAD_ERR_FORM_SIZE: case UPLOAD_ERR_FORM_SIZE:
throw new ClientException( throw new ClientException(
// TRANS: Client exception. // TRANS: Client exception.
_('The uploaded file exceeds the MAX_FILE_SIZE directive' . _('The uploaded file exceeds the MAX_FILE_SIZE directive' .
' that was specified in the HTML form.')); ' that was specified in the HTML form.'));
return;
case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_PARTIAL:
@unlink($_FILES['restorefile']['tmp_name']); @unlink($_FILES['restorefile']['tmp_name']);
// TRANS: Client exception. // TRANS: Client exception.
throw new ClientException(_('The uploaded file was only' . throw new ClientException(_('The uploaded file was only' .
' partially uploaded.')); ' partially uploaded.'));
return;
case UPLOAD_ERR_NO_FILE: case UPLOAD_ERR_NO_FILE:
// TRANS: Client exception. No file; probably just a non-AJAX submission. // TRANS: Client exception. No file; probably just a non-AJAX submission.
throw new ClientException(_('No uploaded file.')); throw new ClientException(_('No uploaded file.'));
return;
case UPLOAD_ERR_NO_TMP_DIR: case UPLOAD_ERR_NO_TMP_DIR:
// TRANS: Client exception thrown when a temporary folder is not present to store a file upload. // TRANS: Client exception thrown when a temporary folder is not present to store a file upload.
throw new ClientException(_('Missing a temporary folder.')); throw new ClientException(_('Missing a temporary folder.'));
return;
case UPLOAD_ERR_CANT_WRITE: case UPLOAD_ERR_CANT_WRITE:
// TRANS: Client exception thrown when writing to disk is not possible during a file upload operation. // TRANS: Client exception thrown when writing to disk is not possible during a file upload operation.
throw new ClientException(_('Failed to write file to disk.')); throw new ClientException(_('Failed to write file to disk.'));
return;
case UPLOAD_ERR_EXTENSION: case UPLOAD_ERR_EXTENSION:
// TRANS: Client exception thrown when a file upload operation has been stopped by an extension. // TRANS: Client exception thrown when a file upload operation has been stopped by an extension.
throw new ClientException(_('File upload stopped by extension.')); throw new ClientException(_('File upload stopped by extension.'));
return;
default: default:
common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " . common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
$_FILES['restorefile']['error']); $_FILES['restorefile']['error']);
// TRANS: Client exception thrown when a file upload operation has failed with an unknown reason. // TRANS: Client exception thrown when a file upload operation has failed with an unknown reason.
throw new ClientException(_('System error uploading file.')); throw new ClientException(_('System error uploading file.'));
return;
} }
$filename = $_FILES['restorefile']['tmp_name']; $filename = $_FILES['restorefile']['tmp_name'];
@@ -210,7 +204,7 @@ class RestoreaccountAction extends Action
// Enqueue for processing. // Enqueue for processing.
$qm = QueueManager::get(); $qm = QueueManager::get();
$qm->enqueue(array(common_current_user(), $xml, false), 'feedimp'); $qm->enqueue([common_current_user(), $xml, false], 'feedimp');
if ($qm instanceof UnQueueManager) { if ($qm instanceof UnQueueManager) {
// No active queuing means we've actually just completed the job! // No active queuing means we've actually just completed the job!

Some files were not shown because too many files have changed in this diff Show More