3 Commits

Autor SHA1 Mensagem Data
Diogo Cordeiro e9fa80d87f [Oembed] Added option to not keep a copy of original image 2019-06-28 15:06:03 +01:00
Diogo Cordeiro 6382d1509b [OEmbed] Revert filename change introduced with 96ce758c 2019-06-28 15:05:34 +01:00
Diogo Cordeiro b35dd03f7a [Oembed] Refactoring and some improvements (namely documentation)
Imported some changes from postActiv
2019-06-28 15:05:29 +01:00
6798 arquivos alterados com 89979 adições e 446465 exclusões
-1
Ver Arquivo
@@ -16,4 +16,3 @@ TODO.rym
config-*.php
good-config.php
*.mo
/vendor/
-109
Ver Arquivo
@@ -1,109 +0,0 @@
# GNU social - Log of Changes
## 2.0.0 - THIS. IS. GNU SOCIAL!!! [WIP]
Release name chosen after 300 by Frank Miller where the main protagonist Leonidas, King of Sparta, declines peace with the
Persians, after being disrespected, by shouting at the Persian Messenger "This is Sparta!" and kicking him into a large well
proceeded by the killing of the other Persian messengers.
### Major changes from previous release:
Load and Storage:
- New media handling system
- GS is now structurely divided in includes and public
- OEmbed upgraded to Embed plugin (Now we provide Open Graph information too)
- Added Redis based caching and queues
- Improved memcached support
Federation:
- Add ActivityPub support
- RemoteFollow: Remote follow ActivityPub and OStatus remote actors via the click of a button
- ActorLists: Allow to create collections of Actors and to interact with them - supports both OStatus and ActivityPub
- The Free Network: Automagically migrate internal remote profiles between Free Network protocols
- Enable the search box to import remote notices and profiles
- Improvements on Nodeinfo (and new route)
General:
- Composer was integrated
Modules:
- Restored built-in plugins
- New modules system: core plugins and plugins physically separated
- Bug fixes of core modules logic
- Improved plugin management tool (now all available plugins are shown and third party can be uploaded and deleted)
## v1.20.9release - The Invicta Crusade
Dropped Support for PHP5.6.x. Minimum PHP version now is 7.0.0.
Release name chosen after Porto city. Porto is one of the oldest cities in Europe and thanks to its fierce resistance during
two battles and sieges in history, it has earned the epithet of ‘Cidade Invicta’ (Invincible City). The dev team behind this
release studies in Porto, Portugal.
Major changes from previous release:
- Various patches on PEAR related components
- Various database related improvements
- Improved XMPP support
- Added Nodeinfo support
- Various i18n and l10n bug fixes
- Improvements on Internal Session Handler
- Improvements on OpenID support
- Improved Media handling and safer upload
- Redirect to previous page after login
- Initial work on full conversion to PHP7
- Initial work on a better documentation
- Allow login with email
- Various bug fixes
## v1.2.0beta4 - The good reign of PHP5
Dropped support for PHP5.4.
New this version
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)
## v1.1.3release - The Spanish Invasion
New this version
This is a security fix and bug fix release since 1.1.3-beta2. All 1.1.x sites should upgrade to this version.
So far it includes the following changes:
- 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
- Backing up a user's account now appears to work as it should
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)
+112 -1
Ver Arquivo
@@ -1 +1,112 @@
GNU social's contributing resources and instructions are made available at [DOCUMENTATION/DEVELOPERS](https://notabug.org/diogo/gnu-social/src/nightly/DOCUMENTATION/DEVELOPERS).
# 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!
@@ -27,7 +27,7 @@ namespace samples;
defined('GNUSOCIAL') || die();
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SampleHandler.php';
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'SampleHandler.php');
/**
* Description of this class.
@@ -43,7 +43,7 @@ class MySampleClass
* @param string $dummy_word just because.
* @param int $result another just because.
*/
public function __construct(string $dummy_word = '', ?int $result = null)
public function __construct(string $dummy_word = '', int $result = null)
{
global $demo;
$this->niceWorld();
@@ -54,7 +54,7 @@ class MySampleClass
*
* @return string
*/
public function niceWorld(): string
public function niceWorld() : string
{
return 'hello, world.';
}
@@ -1,7 +1,7 @@
Submission Checklist
================================================================================
This document serves as a handy checklist for submitted merges and patches to
the GNU social project. Following it isn't a gaurantee a patch will be accepted,
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.
+8 -18
Ver Arquivo
@@ -229,6 +229,12 @@ StartPersonalGroupNav: beginning of personal group nav menu
EndPersonalGroupNav: end of personal group nav menu (good place to add a menu item)
- $action: action object being shown
StartGroupGroupNav: Showing the group nav menu
- $action: the current action
EndGroupGroupNav: At the end of the group nav menu
- $action: the current action
StartEndHTML: just before the </html> tag
- $action: action object being shown
@@ -349,12 +355,6 @@ EndAvatarSaveForm: after saving the avatar
StartNewQueueManager: before trying to start a new queue manager; good for plugins implementing new queue manager classes
- $qm: empty queue manager to set
StartInitializeQueueManager: about to register queue handlers in the queue manager; good for plugins to register own handlers
- $qm: queue manager
EndInitializeQueueManager: after registering queue handlers in the queue manager; good for plugins to register own handlers
- $qm: queue manager
RedirectToLogin: event when we force a redirect to login (like when going to a settings page on a remembered login)
- $action: action object being shown
- $user: current user
@@ -1497,15 +1497,5 @@ StartDocNav: Before outputting the docs Nav
EndDocNav: After outputting the docs Nav
- $nav: The DoclNav widget
StartNoticeSearch: Before finding notices that match the given query
- string $query: The text query
StartNoticeSearchShowResults: Before displaying notices matching the query
- $out: HTMLOutputter used to output
- $query: The text query
- $notices: Array of DB notice objects
EndNoticeSearchShowResults: After displaying notices matching the query
- $out: HTMLOutputter used to output
- $query: The text query
- $notices: Array of DB notice objects
NodeInfoProtocols: List of protocols to be reported on NodeInfo requests
- &$protocols - Add protocol to the list so it is informed upon request
+73 -68
Ver Arquivo
@@ -1,8 +1,8 @@
Plugin Development
==================
=======================
SamplePlugin.php
----------------
-----------------------
Each plugin requires a main class to interact with the GNU social system.
@@ -15,7 +15,7 @@ have pre-defined arguments, based on which event they're handling. A typical
event handler:
```php
public function onSomeEvent($paramA, &$paramB): bool
function onSomeEvent($paramA, &$paramB)
{
if ($paramA == 'jed') {
throw new Exception(sprintf(_m("Invalid parameter %s"), $paramA));
@@ -26,7 +26,7 @@ public function onSomeEvent($paramA, &$paramB): bool
```
Event Handlers
--------------
-----------------------
Event handlers must return a Boolean value.
@@ -41,43 +41,50 @@ If the handler throws an exception, processing will stop, and the exception's
error will be shown to the user.
Installation
------------
------------------
To enable a plugin (like the SamplePlugin), site admins add the following code to their
To install a plugin (like this one), site admins add the following code to their
config.php file:
```php
addPlugin('Sample');
```
Third Party Plugins must be installed in `local/plugins/{$name}/{$pluginclass}.php`
Plugins must be installed in one of the following directories:
* local/plugins/{$pluginclass}.php
* local/plugins/{$name}/{$pluginclass}.php
* local/{$pluginclass}.php
* local/{$name}/{$pluginclass}.php
* plugins/{$pluginclass}.php
* plugins/{$name}/{$pluginclass}.php
Here, `{$name}` is the name of the plugin, like 'Sample', and `{$pluginclass}`
is the name of the main class, like 'SamplePlugin'. Plugins that are part of
the main GNU social distribution go in 'plugins' and third-party or local ones
go in 'local'.
Simple plugins can be implemented as a single plugin. Others are more complex
and require additional plugins; these should use their own directory, like
Simple plugins can be implemented as a single module. Others are more complex
and require additional modules; these should use their own directory, like
'local/plugins/{$name}/'. All files related to the plugin, including images,
JavaScript, CSS, external libraries or PHP plugins should go in the plugin
JavaScript, CSS, external libraries or PHP modules should go in the plugin
directory.
Plugin Configuration
--------------------
------------------
Plugins are configured using public instance attributes. To set their values,
site administrators use this syntax:
```php
addPlugin('Sample', ['attr1' => 'foo', 'attr2' => 'bar']);
addPlugin('Sample', ('attr1' => 'foo', 'attr2' => 'bar'));
```
The same plugin class can be initialized multiple times with different arguments:
```php
addPlugin('EmailNotify', ['sendTo' => 'evan@status.net']);
addPlugin('EmailNotify', ['sendTo' => 'brionv@status.net']);
addPlugin('EmailNotify', array('sendTo' => 'evan@status.net'));
addPlugin('EmailNotify', array('sendTo' => 'brionv@status.net'));
```
```php
@@ -89,34 +96,34 @@ class SamplePlugin extends Plugin
```
Initialization
--------------
------------------
Plugins overload this method to do any initialization they need, like connecting
to remote servers or creating paths or so on. @return bool hook value; true
to remote servers or creating paths or so on. @return boolean hook value; true
means continue processing, false means stop.
```php
public function initialize(): bool
function initialize()
{
return true;
}
```
Clean Up
--------
------------------
Plugins overload this method to do any cleanup they need, like disconnecting from
remote servers or deleting temp files or so on.
```php
public function cleanup(): bool
function cleanup()
{
return true;
}
```
Database schema setup
---------------------
------------------
Plugins can add their own tables to the GNU social database. Plugins should use
GNU social's schema interface to add or delete tables. The ensureTable() method
@@ -128,26 +135,25 @@ the checkschema.php script is run, greatly improving performance. However, they
need to remember to run that script after installing or upgrading a plugin!
```php
public function onCheckSchema(): bool
function onCheckSchema()
{
$schema = Schema::get();
// '''For storing user-submitted flags on profiles'''
$schema->ensureTable('user_greeting_count',[
new ColumnDef('user_id', 'integer', null, true, 'PRI'),
new ColumnDef('greeting_count', 'integer')
]
);
$schema->ensureTable('user_greeting_count',
array(new ColumnDef('user_id', 'integer', null,
true, 'PRI'),
new ColumnDef('greeting_count', 'integer')));
return true;
}
```
Load related plugins when needed
--------------------------------
Load related modules when needed
------------------
Most non-trivial plugins will require extra plugins to do their work. Typically
Most non-trivial plugins will require extra modules to do their work. Typically
these include data classes, action classes, widget classes, or external libraries.
This method receives a class name and loads the PHP file related to that class.
@@ -160,26 +166,26 @@ in this plugin! So, make sure to return true by default to let other plugins,
and the core code, get a chance.
```php
public function onAutoload($cls): bool
function onAutoload($cls)
{
$dir = __DIR__;
$dir = dirname(__FILE__);
switch ($cls)
{
case 'HelloAction':
include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
return false;
case 'User_greeting_count':
include_once $dir . '/'.$cls.'.php';
return false;
default:
return true;
case 'HelloAction':
include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
return false;
case 'User_greeting_count':
include_once $dir . '/'.$cls.'.php';
return false;
default:
return true;
}
}
```
Map URLs to actions
-------------------
------------------
This event handler lets the plugin map URLs on the site to actions (and thus an
action handler class). Note that the action handler class for an action will be
@@ -187,28 +193,28 @@ named 'FoobarAction', where action = 'foobar'. The class must be loaded in the
onAutoload() method.
```php
public function onRouterInitialized($m): bool
function onRouterInitialized($m)
{
$m->connect('main/hello',
['action' => 'hello']);
array('action' => 'hello'));
return true;
}
```
Modify the default menu to link to our custom action
-----------------------------------------------------
------------------
Using event handlers, it's possible to modify the default UI for pages almost
without limit. In this method, we add a menu item to the default primary menu
for the interface to link to our action.
Action Class
------------
------------------
The Action class provides a rich set of events to hook, as well as output methods.
```php
public function onEndPrimaryNav($action): bool
function onEndPrimaryNav($action)
{
// '''common_local_url()''' gets the correct URL for the action name we provide
@@ -217,22 +223,20 @@ public function onEndPrimaryNav($action): bool
return true;
}
public function onPluginVersion(&$versions): bool
function onPluginVersion(&$versions)
{
$versions[] = [
'name' => 'Sample',
'version' => GNUSOCIAL_VERSION,
'author' => 'Brion Vibber, Evan Prodromou',
'homepage' => 'http://example.org/plugin',
'rawdescription' =>
_m('A sample plugin to show basics of development for new hackers.')
];
$versions[] = array('name' => 'Sample',
'version' => STATUSNET_VERSION,
'author' => 'Brion Vibber, Evan Prodromou',
'homepage' => 'http://example.org/plugin',
'rawdescription' =>
_m('A sample plugin to show basics of development for new hackers.'));
return true;
}
```
hello.php
---------
------------------
This section is taken directly from the 'hello.php'. ( plugins/Sample/hello.php )
@@ -251,7 +255,7 @@ class HelloAction extends Action
```
Take arguments for running
--------------------------
------------------
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.
@@ -259,8 +263,8 @@ and validate them. It's also the time to fetch any relevant data from the databa
Action classes should run parent::prepare(array $args = []) as the first line
of this method to make sure the default argument-processing happens.
```php
public function prepare(array $args = []): bool
```php
function prepare(array $args = [])
{
parent::prepare($args);