Compare commits
90 Commits
v1.20.9rel
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
bdd55f611f | ||
|
0bb35d7e7f | ||
|
357296baeb | ||
|
bff525d26f | ||
|
e4bdb21a54 | ||
|
c0ac7f0ac8 | ||
|
eba2fe1624 | ||
|
0030fe3aeb | ||
|
aaabf82eff | ||
|
de91d28f6f | ||
|
24d5d200b8 | ||
|
573ba2ee43 | ||
|
b4fced4bd7 | ||
|
52310a8ad8 | ||
|
11d203c54a | ||
|
723f12923c | ||
|
8b106dbc6c | ||
|
955d5a136f | ||
|
2db3825940 | ||
|
db3253e5d2 | ||
|
dbde8383c9 | ||
|
6d552f15b6 | ||
|
ba15724a62 | ||
|
938d286fb6 | ||
|
2e6c7b1bb8 | ||
|
5be705ca2a | ||
|
07b4cfaeae | ||
|
c9379b3608 | ||
|
22c8c96249 | ||
|
d66828c2bf | ||
|
a244f3ba4d | ||
|
0c20d35206 | ||
|
462ea26303 | ||
|
b25632ebc4 | ||
|
2a2b3f72fb | ||
|
52819d39d9 | ||
|
1d41ff16d6 | ||
|
36dd245ee3 | ||
|
e0bc35b975 | ||
|
893bafa14b | ||
|
7d262ad50b | ||
|
d9e7862cea | ||
|
9f30c299ee | ||
|
39845444cc | ||
|
ec32db2dd6 | ||
|
411e8ed79d | ||
|
c1c2a9f1a1 | ||
|
2850e56f30 | ||
|
9c0354bbf1 | ||
|
c09f1c2443 | ||
|
912f2c3567 | ||
|
ad51998d67 | ||
|
1049080df5 | ||
|
966b00617e | ||
|
b408208e4c | ||
|
a1edc2c6a9 | ||
|
2a06261f75 | ||
|
0b58465fb9 | ||
|
f67a93eddc | ||
|
7044f0e2cf | ||
|
ed7a88ce66 | ||
|
e392160435 | ||
|
5c0a3102ff | ||
|
2032c7c1f7 | ||
|
d295d8b43c | ||
|
ee8bac9ad7 | ||
|
4863bd30d7 | ||
|
7070a14480 | ||
|
a38f25f7cd | ||
|
a5259073df | ||
|
3e5ce46e98 | ||
|
f746866b65 | ||
|
8f31a1a820 | ||
|
4187568522 | ||
|
da82048d77 | ||
|
04d1caff78 | ||
|
bea06da531 | ||
|
7643f3cf7b | ||
|
aa5c6bbf08 | ||
|
9536f2a909 | ||
|
c7475d78b4 | ||
|
3c9a07677e | ||
|
b669f57068 | ||
|
ccebe536b3 | ||
|
b9a0733062 | ||
|
5961b45140 | ||
|
5f53738376 | ||
|
5eb4a7d711 | ||
|
f717081893 | ||
|
01b5118c6f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,3 +16,4 @@ TODO.rym
|
||||
config-*.php
|
||||
good-config.php
|
||||
*.mo
|
||||
/vendor/
|
||||
|
139
CHANGELOG.md
Normal file
139
CHANGELOG.md
Normal file
@@ -0,0 +1,139 @@
|
||||
# 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)
|
||||
|
||||
General:
|
||||
- Composer was integrated
|
||||
|
||||
Modules:
|
||||
- Restored built-in plugins
|
||||
- New modules system: core plugins and plugins physically separated
|
||||
- Refactor of Plugin API to better illustrate the idea of modules
|
||||
- Bug fixes of core modules logic
|
||||
|
||||
#### TODO before alpha:
|
||||
|
||||
Load and Storage:
|
||||
- Upgrade STOMP queue
|
||||
- Add Redis based caching and queues
|
||||
- Review memcached based cache
|
||||
- Port PEAR DB to PDO_DataObject
|
||||
- Support PostgreSQL
|
||||
|
||||
Network:
|
||||
- Port PEAR HTTP to Guzzle
|
||||
- Port PEAR Mail to PHPSendMail
|
||||
- Add OAuth2 support (deprecate OAuth1)
|
||||
- Add shinny new Plugins management interface for sysadmins together with a new doc for devs
|
||||
|
||||
Federation:
|
||||
- Add ActivityPub support
|
||||
- Fix audience targeting
|
||||
- Add Group Actor Type
|
||||
- OstatusSub: Remote follow OS and AP profiles via OStatusSub
|
||||
- ActorLists: Allow to create collections of Actors and to interact with them - supports both OS and AP
|
||||
- The Free Network: Automagically migrate internal remote profiles between Free Network protocols (check Nodeinfo)
|
||||
- Enable the search box to import remote notices and profiles
|
||||
|
||||
General:
|
||||
- Fix failling unit tests
|
||||
- Improve Cronish
|
||||
- Run session garbage collection
|
||||
- Cleanup Email Registration
|
||||
- Refactoring of confirmation codes
|
||||
- Refactoring of Exceptions
|
||||
|
||||
Modules:
|
||||
- Document conversion of older plugins to the new GS 2
|
||||
- Create installer for v2 plugins
|
||||
- Introduce new metadata for plugins (category and thumb)
|
||||
- Improve plugin management tool (add install form and better UI that makes use of new metadata)
|
||||
- Add plugin management tool as a install step
|
||||
- Allow to install remote plugins and suggest popular trusted ones
|
||||
|
||||
## v1.20.9release - The Invicta Crusade
|
||||
|
||||
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.
|
||||
|
||||
Dropped Support for PHP5.6.x. Minimum PHP version now is 7.0.0.
|
||||
|
||||
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)
|
113
CONTRIBUTING.md
113
CONTRIBUTING.md
@@ -1,112 +1 @@
|
||||
# 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!
|
||||
GNU social's contributing resources and instructions are made available at [DOCUMENTATION/DEVELOPERS](https://notabug.org/diogo/gnu-social/src/nightly/DOCUMENTATION/DEVELOPERS).
|
||||
|
@@ -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 postActiv project. Following it isn't a gaurantee a patch will be accepted,
|
||||
the GNU social 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.
|
||||
|
112
DOCUMENTATION/DEVELOPERS/README.md
Normal file
112
DOCUMENTATION/DEVELOPERS/README.md
Normal 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. Run php-cs-fixer. We also recommend you to use tools like phpstan, phpactor, phpcs and phpmd
|
||||
2. Run our unit tests (`./vendor/bin/phpunit --testsuite Core`)
|
||||
3. Respect our [VERSIONING](https://notabug.org/diogo/gnu-social/src/nightly/DOCUMENTATION/VERSIONING.md) system
|
||||
4. You may merge the Merge 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!
|
@@ -146,6 +146,13 @@ This section is a catch-all for site-wide variables.
|
||||
be fine-tuned for notices, messages, profile bios and group descriptions.
|
||||
Zero indicates no limit.
|
||||
|
||||
* favicon: the path to a custom favicon, eg: favicon.png
|
||||
|
||||
* `x-static-delivery` (string, default null): when a string, use this
|
||||
as the header with wich to serve static files. Possible values are
|
||||
'X-Sendfile' (for Apache and others) and 'X-Accel-Redirect' (for
|
||||
nginx).
|
||||
|
||||
|
||||
db
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -191,13 +198,14 @@ The ones that you may want to set are listed below for clarity.
|
||||
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.
|
||||
* `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
|
||||
@@ -606,10 +614,10 @@ 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.
|
||||
* `backup`: whether users can backup their own profiles. Defaults to false.
|
||||
|
||||
* `restore`: whether users can restore their profiles from backup files. Defaults
|
||||
to true.
|
||||
to false.
|
||||
|
||||
* `delete`: whether users can delete their own accounts. Defaults to false.
|
||||
|
||||
@@ -667,6 +675,13 @@ 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).
|
||||
|
||||
* `extblacklist`: associative array to either deny certain extensions or
|
||||
change them to a different one. For example:
|
||||
|
||||
$config['attachments']['extblacklist']['php'] = 'phps'; // this turns .php into .phps
|
||||
$config['attachments']['extblacklist']['exe'] = false; // this would deny any uploads
|
||||
// of files with the "exe" extension
|
||||
|
||||
* `process_links`: follow redirects and save all available file information
|
||||
(mimetype, date, size, oembed, etc.). Defaults to true.
|
||||
|
||||
|
@@ -0,0 +1,15 @@
|
||||
#Simple way to Webfinger enable your domain -- needs PHP
|
||||
|
||||
##Step 1
|
||||
|
||||
Put the 'dot-well-known' on your website, so it loads at:
|
||||
|
||||
https://another_cool.org/.well-known/
|
||||
|
||||
(Remember the . at the beginning of this one, which is common practice
|
||||
for "hidden" files and why we have renamed it "dot-")
|
||||
|
||||
## Step 2
|
||||
|
||||
Edit the .well-known/webfinger/index.php file and replace "https://www.example.org/gnusocial/index.php" with the domain name
|
||||
you're hosting the .well-known handler on.
|
@@ -1,56 +0,0 @@
|
||||
Initial simple way to Webfinger enable your domain -- needs PHP.
|
||||
================================================================
|
||||
|
||||
This guide needs some updating, since it will only guide you to present
|
||||
XML data (while the curl command likely gives you JSON). The workaround
|
||||
is to simply make curl get 'webfinger.xml' instead, and/or have another
|
||||
file that contains JSON, but that requires editing the PHP file as well.
|
||||
|
||||
Step 1
|
||||
======
|
||||
|
||||
Put the 'dot-well-known' on your website, so it loads at:
|
||||
|
||||
https://example.com/.well-known/
|
||||
|
||||
(Remember the . at the beginning of this one, which is common practice
|
||||
for "hidden" files and why we have renamed it "dot-")
|
||||
|
||||
Step 2
|
||||
======
|
||||
|
||||
Edit the .well-known/host-meta file and replace "example.com" with the
|
||||
domain name you're hosting the .well-known directory on.
|
||||
|
||||
Using vim you can do this as a quick method:
|
||||
$ vim .well-known/host-meta [ENTER]
|
||||
:%s/example.com/domain.com/ [ENTER]
|
||||
:wq [ENTER]
|
||||
|
||||
Step 3
|
||||
======
|
||||
|
||||
For each user on your site, and this might only be you...
|
||||
|
||||
In the webfinger directory, make a copy of the example@example.com.xml file
|
||||
so that it's called (replace username and example.com with appropriate
|
||||
values, the domain name should be the same as you're "socialifying"):
|
||||
|
||||
username@example.com.xml
|
||||
|
||||
Then edit the file contents, replacing "social.example.com" with your
|
||||
GNU social instance's base path, and change the user ID number (and
|
||||
nickname for the FOAF link) to that of your account on your social
|
||||
site. If you don't know your user ID number, you can see this on your
|
||||
GNU social profile page by looking at the destination URLs in the
|
||||
Feeds links.
|
||||
|
||||
PROTIP: You can get the bulk of the contents (note the <Subject> element though)
|
||||
from curling down your real webfinger data:
|
||||
$ curl https://social.example.com/.well-known/webfinger?resource=acct:username@social.example.com
|
||||
|
||||
Finally
|
||||
=======
|
||||
|
||||
Using this method, though fiddly, you can now be @user@domain without
|
||||
the need for any prefixes for subdomains, etc.
|
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
|
||||
<Link rel="lrdd" type="application/xrd+xml"
|
||||
template="https://example.com/.well-known/webfinger?resource={uri}"/>
|
||||
</XRD>
|
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Subject>acct:username@example.com</Subject>
|
||||
<Alias>acct:username@social.example.com</Alias>
|
||||
<Alias>https://social.example.com/user/1</Alias>
|
||||
<Link rel="http://webfinger.net/rel/profile-page"
|
||||
type="text/html"
|
||||
href="https://social.example.com/user/1"/>
|
||||
|
||||
<Link rel="http://schemas.google.com/g/2010#updates-from"
|
||||
type="application/atom+xml"
|
||||
href="https://social.example.com/api/statuses/user_timeline/1.atom"/>
|
||||
|
||||
<!-- Is this/was this ever supported?
|
||||
<Link rel="http://microformats.org/profile/hcard"
|
||||
type="text/html"
|
||||
href="https://social.example.com/hcard"/> -->
|
||||
|
||||
<Link rel="http://gmpg.org/xfn/11"
|
||||
type="text/html"
|
||||
href="https://social.example.com/user/1"/>
|
||||
|
||||
<Link rel="describedby"
|
||||
type="application/rdf+xml"
|
||||
href="https://social.example.com/username/foaf"/>
|
||||
|
||||
<Link rel="http://salmon-protocol.org/ns/salmon-replies"
|
||||
href="https://social.example.com/main/salmon/user/1"/>
|
||||
|
||||
<Link rel="http://salmon-protocol.org/ns/salmon-mention"
|
||||
href="https://social.example.com/main/salmon/user/1"/>
|
||||
|
||||
<Link rel="http://ostatus.org/schema/1.0/subscribe"
|
||||
template="https://social.example.com/main/ostatussub?profile={uri}"/>
|
||||
</XRD>
|
@@ -1,43 +1,56 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* GNU social
|
||||
* Copyright (C) 2010, Free Software Foundation, 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/>.
|
||||
// FIXME: REPLACE \/ here
|
||||
define('MY_GNUSOCIAL', 'https://www.example.org/gnusocial/index.php');
|
||||
|
||||
/**
|
||||
* This is a general solution for when you can't have your GNU social instance in the domain root and for when you want to
|
||||
* socialfy from another domain.
|
||||
*/
|
||||
|
||||
|
||||
// basename should make sure we can't escape this directory
|
||||
$u = basename($_GET['resource']);
|
||||
|
||||
if (!strpos($u, '@')) {
|
||||
throw new Exception('Bad resource');
|
||||
exit(1);
|
||||
// From https://www.php.net/manual/en/function.getallheaders.php#84262 (joyview at gmail dot com)
|
||||
if (!function_exists('getallheaders')) {
|
||||
function getallheaders()
|
||||
{
|
||||
$headers = [];
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
if (substr($name, 0, 5) == 'HTTP_') {
|
||||
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
|
||||
}
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, getallheaders());
|
||||
curl_setopt($ch, CURLOPT_URL, MY_GNUSOCIAL . str_replace('webfinger/', 'webfinger', $_SERVER['REQUEST_URI']));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
$response = curl_exec($ch);
|
||||
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$body = substr($response, $header_size);
|
||||
// From https://stackoverflow.com/a/10590242 (c.hill)
|
||||
function get_headers_from_curl_response($response)
|
||||
{
|
||||
$headers = array();
|
||||
|
||||
if (mb_strpos($u, 'acct:')===0) {
|
||||
$u = substr($u, 5);
|
||||
$header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
|
||||
|
||||
foreach (explode("\r\n", $header_text) as $i => $line) {
|
||||
if ($i === 0) {
|
||||
$headers['http_code'] = $line;
|
||||
} else {
|
||||
list($key, $value) = explode(': ', $line);
|
||||
|
||||
$headers[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
// Just to be a little bit safer, you know, with all the unicode stuff going on
|
||||
$u = filter_var($u, FILTER_SANITIZE_EMAIL);
|
||||
|
||||
$f = $u . ".xml";
|
||||
|
||||
if (file_exists($f)) {
|
||||
header('Content-Disposition: attachment; filename="'.urlencode($f).'"');
|
||||
header('Content-type: application/xrd+xml');
|
||||
echo file_get_contents($f);
|
||||
$headers = get_headers_from_curl_response($response);
|
||||
foreach ($headers as $name => $value) {
|
||||
header("{$name}: $value");
|
||||
}
|
||||
echo $body;
|
||||
curl_close($ch);
|
||||
|
@@ -44,6 +44,11 @@
|
||||
# RewriteRule (.*) index.php/$1 [L,QSA]
|
||||
</IfModule>
|
||||
|
||||
# Enable X-Sendfile if available. Still needs to be enabled in the config
|
||||
<IfModule mod_xsendfile.c>
|
||||
XSendFile On
|
||||
</IfModule>
|
||||
|
||||
<FilesMatch "\.(ini)">
|
||||
<IfVersion < 2.3>
|
||||
Order allow,deny
|
||||
|
@@ -16,8 +16,8 @@ server {
|
||||
listen 443 ssl http2;
|
||||
|
||||
# Root
|
||||
# FIXME: Change the path below to where you installed GNU social
|
||||
root /path/to/gnusocial/root;
|
||||
# FIXME: Change the path below to where you installed GNU social (GNU social's root + /public)
|
||||
root /var/www/gnusocial/public;
|
||||
|
||||
# Server name
|
||||
# FIXME: Change "social.example.org" to your site's domain name
|
||||
@@ -31,8 +31,16 @@ server {
|
||||
# Index
|
||||
index index.php;
|
||||
|
||||
# X-Accel/X-Sendfile. Still needs to be enabled in the config
|
||||
location /file {
|
||||
internal;
|
||||
# FIXME: Change "/path/to/gnusocial/root/" to the folder where
|
||||
# attachments are stored (normally the same as the site root)
|
||||
root /path/to/gnusocial/root/;
|
||||
}
|
||||
|
||||
# PHP
|
||||
location ~ ^/(index|install)\.php$ {
|
||||
location ~ ^/(index|install)\.php(/.*)?$ {
|
||||
#location ^~ /index.php {
|
||||
include fastcgi_params;
|
||||
include snippets/fastcgi-php.conf;
|
||||
|
17
DOCUMENTATION/VERSIONING.md
Normal file
17
DOCUMENTATION/VERSIONING.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Versioning
|
||||
|
||||
## Release cycle
|
||||
We follow Semantic Versioning as defined on [https://semver.org/](https://semver.org).
|
||||
|
||||
The GNU social platform has a monthly release cycle. That is, we only increment the version number on day 1 of each month.
|
||||
|
||||
For GNU social plugins, we increment version number by commit. Plugins update have a propagation of the same type in the
|
||||
GNU social's monthly version bump.
|
||||
|
||||
If we have various patch type updates in a month, we only bump it by one in the end of the month. If in the same month
|
||||
we have a minor too, we will only bump the minor value.
|
||||
|
||||
# Lifecycle
|
||||
|
||||
GNU social has 'dev', 'alpha', 'beta', 'rc' and 'release' cycles. We usually are in `dev` during summer. When we finish a `dev` cycle we release an `alpha` (`dev`s aren't tagged as releases). From `alpha` to `release` it depends on how perfect GNU social is after the end of the `dev` cycle. But we use the number after `alpha` instead of `patch` number for small bug fixes when in this cycle. When we finally go from a `r`elease `c`andidate to a `release`, we party... and we use semver for all the small changes until we start working in another `dev` cycle (usually on another summer).
|
||||
|
3
Makefile
3
Makefile
@@ -7,6 +7,9 @@ plugin_mo = $(patsubst %.po,%.mo,$(wildcard plugins/*/locale/*/LC_MESSAGES/*.po)
|
||||
|
||||
translations : $(core_mo) $(plugin_mo)
|
||||
|
||||
upgrade :
|
||||
php scripts/upgrade.php
|
||||
|
||||
clean :
|
||||
rm -f $(core_mo) $(plugin_mo)
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# GNU social 1.20.x
|
||||
# GNU social 2.0.x
|
||||
(c) 2010-2019 Free Software Foundation, Inc
|
||||
|
||||
This is the README file for GNU social, the free
|
||||
|
@@ -41,9 +41,8 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
class AttachmentAction extends ManagedAction
|
||||
{
|
||||
/**
|
||||
* Attachment object to show
|
||||
* Attachment File object to show
|
||||
*/
|
||||
|
||||
var $attachment = null;
|
||||
|
||||
/**
|
||||
@@ -60,14 +59,25 @@ class AttachmentAction extends ManagedAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if ($id = $this->trimmed('attachment')) {
|
||||
$this->attachment = File::getKV($id);
|
||||
try {
|
||||
if (!empty($id = $this->trimmed('attachment'))) {
|
||||
$this->attachment = File::getByID($id);
|
||||
} elseif (!empty($filehash = $this->trimmed('filehash'))) {
|
||||
$this->attachment = File::getByHash($filehash);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Not found
|
||||
}
|
||||
|
||||
if (!$this->attachment instanceof File) {
|
||||
// TRANS: Client error displayed trying to get a non-existing attachment.
|
||||
$this->clientError(_('No such attachment.'), 404);
|
||||
}
|
||||
|
||||
$filename = $this->attachment->getFileOrThumbnailPath();
|
||||
|
||||
if (empty($filename)) {
|
||||
$this->clientError(_('Requested local URL for a file that is not stored locally.'), 404);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -94,7 +104,7 @@ class AttachmentAction extends ManagedAction
|
||||
|
||||
public function showPage()
|
||||
{
|
||||
if (empty($this->attachment->filename)) {
|
||||
if (empty($this->attachment->getFileOrThumbnailPath())) {
|
||||
// if it's not a local file, gtfo
|
||||
common_redirect($this->attachment->getUrl(), 303);
|
||||
}
|
||||
@@ -133,4 +143,93 @@ class AttachmentAction extends ManagedAction
|
||||
$ns = new AttachmentNoticeSection($this);
|
||||
$ns->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Last-modified date for file
|
||||
*
|
||||
* @return int last-modified date as unix timestamp
|
||||
*/
|
||||
public function lastModified()
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
return null;
|
||||
}
|
||||
$path = $this->attachment->getFileOrThumbnailPath();
|
||||
if (!empty($path)) {
|
||||
return filemtime($path);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* etag header for file
|
||||
*
|
||||
* This returns the same data (inode, size, mtime) as Apache would,
|
||||
* but in decimal instead of hex.
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
function etag()
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$path = $this->attachment->getFileOrThumbnailPath();
|
||||
|
||||
$cache = Cache::instance();
|
||||
if($cache) {
|
||||
if (empty($path)) {
|
||||
return null;
|
||||
}
|
||||
$key = Cache::key('attachments:etag:' . $path);
|
||||
$etag = $cache->get($key);
|
||||
if($etag === false) {
|
||||
$etag = crc32(file_get_contents($path));
|
||||
$cache->set($key,$etag);
|
||||
}
|
||||
return $etag;
|
||||
}
|
||||
|
||||
if (!empty($path)) {
|
||||
$stat = stat($path);
|
||||
return '"' . $stat['ino'] . '-' . $stat['size'] . '-' . $stat['mtime'] . '"';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Include $filepath in the response, for viewing and downloading.
|
||||
* If provided, $filesize is used to size the HTTP request,
|
||||
* otherwise it's value is calculated
|
||||
* @param string $filepath the absolute path to the file to send
|
||||
* @param $filesize optional, calculated if unkown
|
||||
*/
|
||||
static function sendFile(string $filepath, $filesize) {
|
||||
if (is_string(common_config('site', 'x-static-delivery'))) {
|
||||
$tmp = explode(INSTALLDIR, $filepath);
|
||||
$relative_path = end($tmp);
|
||||
common_debug("Using Static Delivery with header: '" .
|
||||
common_config('site', 'x-static-delivery') . ": {$relative_path}'");
|
||||
header(common_config('site', 'x-static-delivery') . ": {$relative_path}");
|
||||
} else {
|
||||
if (empty($filesize)) {
|
||||
$filesize = filesize($filepath);
|
||||
}
|
||||
header("Content-Length: {$filesize}");
|
||||
// header('Cache-Control: private, no-transform, no-store, must-revalidate');
|
||||
|
||||
$ret = @readfile($filepath);
|
||||
|
||||
if ($ret === false) {
|
||||
common_log(LOG_ERR, "Couldn't read file at {$filepath}.");
|
||||
} elseif ($ret !== $filesize) {
|
||||
common_log(LOG_ERR, "The lengths of the file as recorded on the DB (or on disk) for the file " .
|
||||
"{$filepath} differ from what was sent to the user ({$filesize} vs {$ret}).");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,28 @@ class Attachment_downloadAction extends AttachmentAction
|
||||
{
|
||||
public function showPage()
|
||||
{
|
||||
common_redirect($this->attachment->getUrl(), 302);
|
||||
// Checks file exists or throws FileNotFoundException
|
||||
$filepath = $this->attachment->getFileOrThumbnailPath();
|
||||
$filesize = $this->attachment->getFileOrThumbnailSize();
|
||||
$mimetype = $this->attachment->getFileOrThumbnailMimetype();
|
||||
|
||||
if (empty($filepath)) {
|
||||
$this->clientError(_('No such attachment'), 404);
|
||||
}
|
||||
|
||||
$filename = MediaFile::getDisplayName($this->attachment);
|
||||
|
||||
// Disable errors, to not mess with the file contents (suppress errors in case access to this
|
||||
// function is blocked, like in some shared hosts). Automatically reset at the end of the
|
||||
// script execution, and we don't want to have any more errors until then, so don't reset it
|
||||
@ini_set('display_errors', 0);
|
||||
|
||||
header("Content-Description: File Transfer");
|
||||
header("Content-Type: {$mimetype}");
|
||||
header("Content-Disposition: attachment; filename=\"{$filename}\"");
|
||||
header('Expires: 0');
|
||||
header('Content-Transfer-Encoding: binary'); // FIXME? Can this be different?
|
||||
|
||||
AttachmentAction::sendFile($filepath, $filesize);
|
||||
}
|
||||
}
|
||||
|
@@ -53,15 +53,43 @@ class Attachment_thumbnailAction extends AttachmentAction
|
||||
$this->thumb_c = $this->boolean('c');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an inline representation of an attachment of the size
|
||||
* requested in the GET variables (read in the constructor). Tries
|
||||
* to send the most appropriate file with the correct size and
|
||||
* headers or displays an error if it's not possible.
|
||||
*/
|
||||
public function showPage()
|
||||
{
|
||||
|
||||
// Returns a File_thumbnail object or throws exception if not available
|
||||
try {
|
||||
$thumbnail = $this->attachment->getThumbnail($this->thumb_w, $this->thumb_h, $this->thumb_c);
|
||||
$file = $thumbnail->getFile();
|
||||
} catch (UseFileAsThumbnailException $e) {
|
||||
common_redirect($e->file->getUrl(), 302);
|
||||
// With this exception, the file exists locally
|
||||
$file = $e->file;
|
||||
} catch(FileNotFoundException $e) {
|
||||
$this->clientError(_('No such attachment'), 404);
|
||||
}
|
||||
|
||||
common_redirect(File_thumbnail::url($thumbnail->getFilename()), 302);
|
||||
// Checks file exists or throws FileNotFoundException
|
||||
$filepath = $file->getFileOrThumbnailPath($thumbnail);
|
||||
$filesize = $this->attachment->getFileOrThumbnailSize($thumbnail);
|
||||
$mimetype = $file->getFileOrThumbnailMimetype($thumbnail);
|
||||
$filename = MediaFile::getDisplayName($file);
|
||||
|
||||
// Disable errors, to not mess with the file contents (suppress errors in case access to this
|
||||
// function is blocked, like in some shared hosts). Automatically reset at the end of the
|
||||
// script execution, and we don't want to have any more errors until then, so don't reset it
|
||||
@ini_set('display_errors', 0);
|
||||
|
||||
header("Content-Description: File Transfer");
|
||||
header("Content-Type: {$mimetype}");
|
||||
header("Content-Disposition: inline; filename=\"{$filename}\"");
|
||||
header('Expires: 0');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
||||
AttachmentAction::sendFile($filepath, $filesize);
|
||||
}
|
||||
}
|
||||
|
44
actions/attachment_view.php
Normal file
44
actions/attachment_view.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* View notice attachment
|
||||
*
|
||||
* @package GNUsocial
|
||||
* @author Miguel Dantas <biodantasgs@gmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
*/
|
||||
class Attachment_viewAction extends AttachmentAction
|
||||
{
|
||||
public function showPage()
|
||||
{
|
||||
// Checks file exists or throws FileNotFoundException
|
||||
$filepath = $this->attachment->getFileOrThumbnailPath();
|
||||
$filesize = $this->attachment->getFileOrThumbnailSize();
|
||||
$mimetype = $this->attachment->getFileOrThumbnailMimetype();
|
||||
|
||||
if (empty($filepath)) {
|
||||
$this->clientError(_('No such attachment'), 404);
|
||||
}
|
||||
|
||||
$filename = MediaFile::getDisplayName($this->attachment);
|
||||
|
||||
// Disable errors, to not mess with the file contents (suppress errors in case access to this
|
||||
// function is blocked, like in some shared hosts). Automatically reset at the end of the
|
||||
// script execution, and we don't want to have any more errors until then, so don't reset it
|
||||
@ini_set('display_errors', 0);
|
||||
|
||||
header("Content-Description: File Transfer");
|
||||
header("Content-Type: {$mimetype}");
|
||||
if (in_array(common_get_mime_media($mimetype), ['image', 'video'])) {
|
||||
header("Content-Disposition: inline; filename=\"{$filename}\"");
|
||||
} else {
|
||||
header("Content-Disposition: attachment; filename=\"{$filename}\"");
|
||||
}
|
||||
header('Expires: 0');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
||||
AttachmentAction::sendFile($filepath, $filesize);
|
||||
}
|
||||
}
|
@@ -39,9 +39,10 @@ class DeletenoticeAction extends FormAction
|
||||
{
|
||||
$this->notice = Notice::getByID($this->trimmed('notice'));
|
||||
|
||||
if (!$this->scoped->sameAs($this->notice->getProfile()) &&
|
||||
!$this->scoped->hasRight(Right::DELETEOTHERSNOTICE)) {
|
||||
// TRANS: Error message displayed trying to delete a notice that was not made by the current user.
|
||||
if ($this->notice->isVerb([ActivityVerb::DELETE]) ||
|
||||
(!$this->scoped->sameAs($this->notice->getProfile()) &&
|
||||
!$this->scoped->hasRight(Right::DELETEOTHERSNOTICE))) {
|
||||
// TRANS: Error message displayed when trying to delete a notice that was not made by the current user.
|
||||
$this->clientError(_('Cannot delete this notice.'));
|
||||
}
|
||||
|
||||
|
@@ -1,164 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009, StatusNet, Inc.
|
||||
*
|
||||
* Return a requested file
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* @category PrivateAttachments
|
||||
* @package StatusNet
|
||||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* An action for returning a requested file
|
||||
*
|
||||
* The StatusNet system will do an implicit user check if the site is
|
||||
* private before allowing this to continue
|
||||
*
|
||||
* @category PrivateAttachments
|
||||
* @package StatusNet
|
||||
* @author Jeffery To <jeffery.to@gmail.com>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GetfileAction extends Action
|
||||
{
|
||||
/**
|
||||
* Path of file to return
|
||||
*/
|
||||
var $path = null;
|
||||
|
||||
/**
|
||||
* Get file name
|
||||
*
|
||||
* @param array $args $_REQUEST array
|
||||
*
|
||||
* @return success flag
|
||||
*/
|
||||
protected function prepare(array $args=array())
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$filename = $this->trimmed('filename');
|
||||
$path = null;
|
||||
|
||||
if ($filename && File::validFilename($filename)) {
|
||||
$path = File::path($filename);
|
||||
}
|
||||
|
||||
if (empty($path) or !file_exists($path)) {
|
||||
// TRANS: Client error displayed when requesting a non-existent file.
|
||||
$this->clientError(_('No such file.'), 404);
|
||||
}
|
||||
if (!is_readable($path)) {
|
||||
// TRANS: Client error displayed when requesting a file without having read access to it.
|
||||
$this->clientError(_('Cannot read file.'), 403);
|
||||
}
|
||||
|
||||
$this->path = $path;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this page read-only?
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last-modified date for file
|
||||
*
|
||||
* @return int last-modified date as unix timestamp
|
||||
*/
|
||||
function lastModified()
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return filemtime($this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* etag for file
|
||||
*
|
||||
* This returns the same data (inode, size, mtime) as Apache would,
|
||||
* but in decimal instead of hex.
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
function etag()
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cache = Cache::instance();
|
||||
if($cache) {
|
||||
$key = Cache::key('attachments:etag:' . $this->path);
|
||||
$etag = $cache->get($key);
|
||||
if($etag === false) {
|
||||
$etag = crc32(file_get_contents($this->path));
|
||||
$cache->set($key,$etag);
|
||||
}
|
||||
return $etag;
|
||||
}
|
||||
|
||||
$stat = stat($this->path);
|
||||
return '"' . $stat['ino'] . '-' . $stat['size'] . '-' . $stat['mtime'] . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle input, produce output
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function handle()
|
||||
{
|
||||
// undo headers set by PHP sessions
|
||||
$sec = session_cache_expire() * 60;
|
||||
header('Expires: ' . date(DATE_RFC1123, time() + $sec));
|
||||
header('Cache-Control: max-age=' . $sec);
|
||||
|
||||
parent::handle();
|
||||
|
||||
$path = $this->path;
|
||||
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
|
||||
header('Content-Type: ' . $finfo->file($path));
|
||||
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
header('X-Sendfile: ' . $path);
|
||||
} else {
|
||||
header('Content-Length: ' . filesize($path));
|
||||
readfile($path);
|
||||
}
|
||||
}
|
||||
}
|
@@ -23,8 +23,8 @@ class Attention extends Managed_DataObject
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $reason; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -34,8 +34,8 @@ class Attention extends Managed_DataObject
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice_id to give attention'),
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'profile_id for feed receiver'),
|
||||
'reason' => array('type' => 'varchar', 'length' => 191, 'description' => 'Optional reason why this was brought to the attention of profile_id'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'profile_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -15,8 +15,8 @@ class Avatar extends Managed_DataObject
|
||||
public $height; // int(4) primary_key not_null
|
||||
public $mediatype; // varchar(32) not_null
|
||||
public $filename; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -28,8 +28,8 @@ class Avatar extends Managed_DataObject
|
||||
'height' => array('type' => 'int', 'not null' => true, 'description' => 'image height'),
|
||||
'mediatype' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'file type'),
|
||||
'filename' => array('type' => 'varchar', 'length' => 191, 'description' => 'local filename, if local'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'width', 'height'),
|
||||
'unique keys' => array(
|
||||
|
@@ -13,7 +13,7 @@ class Confirm_address extends Managed_DataObject
|
||||
public $address_type; // varchar(8) not_null
|
||||
public $claimed; // datetime()
|
||||
public $sent; // datetime()
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -26,7 +26,7 @@ class Confirm_address extends Managed_DataObject
|
||||
'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'),
|
||||
'claimed' => array('type' => 'datetime', 'description' => 'date this was claimed for queueing'),
|
||||
'sent' => array('type' => 'datetime', 'description' => 'date this was sent for queueing'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -13,8 +13,8 @@ class Consumer extends Managed_DataObject
|
||||
public $consumer_key; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space
|
||||
public $consumer_secret; // varchar(191) not_null not 255 because utf8mb4 takes more space
|
||||
public $seed; // char(32) not_null
|
||||
public $created; // datetime not_null
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -27,9 +27,8 @@ class Consumer extends Managed_DataObject
|
||||
'consumer_key' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'),
|
||||
'consumer_secret' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'secret value'),
|
||||
'seed' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'seed for new tokens by this consumer'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('consumer_key'),
|
||||
);
|
||||
|
@@ -37,8 +37,8 @@ class Conversation extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null auto_increment
|
||||
public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $url; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime not_null
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -47,8 +47,8 @@ class Conversation extends Managed_DataObject
|
||||
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'Unique identifier, (again) unrelated to notice id since 2016-01-06'),
|
||||
'uri' => array('type' => 'varchar', 'not null'=>true, 'length' => 191, 'description' => 'URI of the conversation'),
|
||||
'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'Resolvable URL, preferrably remote (local can be generated on the fly)'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
165
classes/File.php
165
classes/File.php
@@ -46,7 +46,7 @@ class File extends Managed_DataObject
|
||||
public $filename; // text()
|
||||
public $width; // int(4)
|
||||
public $height; // int(4)
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
const URLHASH_ALG = 'sha256';
|
||||
const FILEHASH_ALG = 'sha256';
|
||||
@@ -67,8 +67,7 @@ class File extends Managed_DataObject
|
||||
'filename' => array('type' => 'text', 'description' => 'if file is stored locally (too) this is the filename'),
|
||||
'width' => array('type' => 'int', 'description' => 'width in pixels, if it can be described as such and data is available'),
|
||||
'height' => array('type' => 'int', 'description' => 'height in pixels, if it can be described as such and data is available'),
|
||||
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
@@ -127,11 +126,11 @@ class File extends Managed_DataObject
|
||||
$args = $r->map(mb_substr($u['path'], 1));
|
||||
if ($args['action'] === 'attachment') {
|
||||
try {
|
||||
// $args['attachment'] should always be set if action===attachment, given our routing rules
|
||||
$file = File::getByID($args['attachment']);
|
||||
return $file;
|
||||
} catch (EmptyPkeyValueException $e) {
|
||||
// ...but $args['attachment'] can also be 0...
|
||||
if (!empty($args['attachment'])) {
|
||||
return File::getByID($args['attachment']);
|
||||
} elseif ($args['filehash']) {
|
||||
return File::getByHash($args['filehash']);
|
||||
}
|
||||
} catch (NoResultException $e) {
|
||||
// apparently this link goes to us, but is _not_ an existing attachment (File) ID?
|
||||
}
|
||||
@@ -336,6 +335,34 @@ class File extends Managed_DataObject
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @return string|bool Value from the 'extblacklist' array, in the config
|
||||
*/
|
||||
public static function getSafeExtension(string $filename) {
|
||||
if (preg_match('/^.+?\.([A-Za-z0-9]+)$/', $filename, $matches) === 1) {
|
||||
// we matched on a file extension, so let's see if it means something.
|
||||
$ext = mb_strtolower($matches[1]);
|
||||
$blacklist = common_config('attachments', 'extblacklist');
|
||||
// If we got an extension from $filename we want to check if it's in a blacklist
|
||||
// so we avoid people uploading restricted files
|
||||
if (array_key_exists($ext, $blacklist)) {
|
||||
if (!is_string($blacklist[$ext])) {
|
||||
// Blocked
|
||||
return false;
|
||||
}
|
||||
// return a safe replacement extension ('php' => 'phps' for example)
|
||||
return $blacklist[$ext];
|
||||
} else {
|
||||
// the attachment extension based on its filename was not blacklisted so it's ok to use it
|
||||
return $ext;
|
||||
}
|
||||
} else {
|
||||
// No extension
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $mimetype string The mimetype we've discovered for this file.
|
||||
* @param $filename string An optional filename which we can use on failure.
|
||||
@@ -351,28 +378,16 @@ class File extends Managed_DataObject
|
||||
return $ext;
|
||||
} catch (UnknownMimeExtensionException $e) {
|
||||
// We don't know the extension for this mimetype, but let's guess.
|
||||
|
||||
// If we can't recognize the extension from the MIME, we try
|
||||
// to guess based on filename, if one was supplied.
|
||||
if (!is_null($filename) && preg_match('/^.+\.([A-Za-z0-9]+)$/', $filename, $matches)) {
|
||||
// we matched on a file extension, so let's see if it means something.
|
||||
$ext = mb_strtolower($matches[1]);
|
||||
|
||||
$blacklist = common_config('attachments', 'extblacklist');
|
||||
// If we got an extension from $filename we want to check if it's in a blacklist
|
||||
// so we avoid people uploading .php files etc.
|
||||
if (array_key_exists($ext, $blacklist)) {
|
||||
if (!is_string($blacklist[$ext])) {
|
||||
// we don't have a safe replacement extension
|
||||
throw new ClientException(_('Blacklisted file extension.'));
|
||||
}
|
||||
common_debug('Found replaced extension for filename '._ve($filename).': '._ve($ext));
|
||||
|
||||
// return a safe replacement extension ('php' => 'phps' for example)
|
||||
return $blacklist[$ext];
|
||||
if (!is_null($filename)) {
|
||||
$ext = getSafeExtension($filename);
|
||||
if ($ext === false) {
|
||||
// we don't have a safe replacement extension
|
||||
throw new ClientException(_('Blacklisted file extension.'));
|
||||
} else {
|
||||
return $ext;
|
||||
}
|
||||
// the attachment extension based on its filename was not blacklisted so it's ok to use it
|
||||
return $ext;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
common_log(LOG_INFO, 'Problem when figuring out extension for mimetype: '._ve($e));
|
||||
@@ -381,9 +396,9 @@ class File extends Managed_DataObject
|
||||
// If nothing else has given us a result, try to extract it from
|
||||
// the mimetype value (this turns .jpg to .jpeg for example...)
|
||||
$matches = array();
|
||||
// FIXME: try to build a regexp that will get jpeg from image/jpeg as well as json from application/jrd+json
|
||||
if (!preg_match('/\/([a-z0-9]+)/', mb_strtolower($mimetype), $matches)) {
|
||||
throw new Exception('Malformed mimetype: '.$mimetype);
|
||||
// Will get jpeg from image/jpeg as well as json from application/jrd+json
|
||||
if (!preg_match('/[\/+-\.]([a-z0-9]+)/', mb_strtolower($mimetype), $matches)) {
|
||||
throw new Exception("Malformed mimetype: {$mimetype}");
|
||||
}
|
||||
return mb_strtolower($matches[1]);
|
||||
}
|
||||
@@ -576,11 +591,97 @@ class File extends Managed_DataObject
|
||||
return $filepath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to either a file, or it's thumbnail if the file doesn't exist.
|
||||
* This is useful in case the original file is deleted, or, as is the case for Embed
|
||||
* thumbnails, we only have a thumbnail and not a file
|
||||
* @return string Path
|
||||
* @throws FileNotFoundException
|
||||
* @throws FileNotStoredLocallyException
|
||||
* @throws InvalidFilenameException
|
||||
* @throws ServerException
|
||||
*/
|
||||
public function getFileOrThumbnailPath($thumbnail = null) : string
|
||||
{
|
||||
if (!empty($thumbnail)) {
|
||||
return $thumbnail->getPath();
|
||||
}
|
||||
if (!empty($this->filename)) {
|
||||
$filepath = self::path($this->filename);
|
||||
if (file_exists($filepath)) {
|
||||
return $filepath;
|
||||
} else {
|
||||
throw new FileNotFoundException($filepath);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return File_thumbnail::byFile($this, true)->getPath();
|
||||
} catch (NoResultException $e) {
|
||||
// File not stored locally
|
||||
throw new FileNotStoredLocallyException($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mime type of the thumbnail if we have it, or, if not, of the File
|
||||
* @return string
|
||||
* @throws FileNotFoundException
|
||||
* @throws NoResultException
|
||||
* @throws ServerException
|
||||
* @throws UnsupportedMediaException
|
||||
*/
|
||||
public function getFileOrThumbnailMimetype($thumbnail = null) : string
|
||||
{
|
||||
if (!empty($thumbnail)) {
|
||||
$filepath = $thumbnail->getPath();
|
||||
} elseif (!empty($this->filename)) {
|
||||
return $this->mimetype;
|
||||
} else {
|
||||
$filepath = File_thumbnail::byFile($this, true)->getPath();
|
||||
}
|
||||
|
||||
$info = @getimagesize($filepath);
|
||||
if ($info !== false) {
|
||||
return $info['mime'];
|
||||
} else {
|
||||
throw new UnsupportedMediaException(_("Thumbnail is not an image."));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of the thumbnail if we have it, or, if not, of the File
|
||||
* @return int
|
||||
* @throws FileNotFoundException
|
||||
* @throws NoResultException
|
||||
* @throws ServerException
|
||||
*/
|
||||
public function getFileOrThumbnailSize($thumbnail = null) : int
|
||||
{
|
||||
if (!empty($thumbnail)) {
|
||||
return filesize($thumbnail->getPath());
|
||||
} elseif (!empty($this->filename)) {
|
||||
return $this->size;
|
||||
} else {
|
||||
return filesize(File_thumbnail::byFile($this)->getPath());
|
||||
}
|
||||
}
|
||||
|
||||
public function getAttachmentUrl()
|
||||
{
|
||||
return common_local_url('attachment', array('attachment'=>$this->getID()));
|
||||
}
|
||||
|
||||
public function getAttachmentDownloadUrl()
|
||||
{
|
||||
return common_local_url('attachment_download', array('attachment'=>$this->getID()));
|
||||
}
|
||||
|
||||
public function getAttachmentViewUrl()
|
||||
{
|
||||
return common_local_url('attachment_view', array('attachment'=>$this->getID()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $use_local true means require local, null means prefer local, false means use whatever is stored
|
||||
* @return string
|
||||
@@ -591,7 +692,7 @@ class File extends Managed_DataObject
|
||||
if ($use_local !== false) {
|
||||
if (is_string($this->filename) || !empty($this->filename)) {
|
||||
// A locally stored file, so let's generate a URL for our instance.
|
||||
return self::url($this->getFilename());
|
||||
return $this->getAttachmentViewUrl();
|
||||
}
|
||||
if ($use_local) {
|
||||
// if the file wasn't stored locally (has filename) and we require a local URL
|
||||
@@ -746,7 +847,7 @@ class File extends Managed_DataObject
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
$title = $this->title ?: $this->filename;
|
||||
$title = $this->title ?: MediaFile::getDisplayName($this);
|
||||
|
||||
return $title ?: null;
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ class File_redirection extends Managed_DataObject
|
||||
public $file_id; // int(4)
|
||||
public $redirections; // int(4)
|
||||
public $httpcode; // int(4)
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -50,7 +50,7 @@ class File_redirection extends Managed_DataObject
|
||||
'file_id' => array('type' => 'int', 'description' => 'short URL for what URL/file'),
|
||||
'redirections' => array('type' => 'int', 'description' => 'redirect count'),
|
||||
'httpcode' => array('type' => 'int', 'description' => 'HTTP status code (20x, 30x, etc.)'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('urlhash'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -32,7 +32,7 @@ class File_thumbnail extends Managed_DataObject
|
||||
public $filename; // text
|
||||
public $width; // int(4) primary_key
|
||||
public $height; // int(4) primary_key
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
const URLHASH_ALG = 'sha256';
|
||||
|
||||
@@ -46,7 +46,7 @@ class File_thumbnail extends Managed_DataObject
|
||||
'filename' => array('type' => 'text', 'description' => 'if stored locally, filename is put here'),
|
||||
'width' => array('type' => 'int', 'description' => 'width of thumbnail'),
|
||||
'height' => array('type' => 'int', 'description' => 'height of thumbnail'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('file_id', 'width', 'height'),
|
||||
'indexes' => array(
|
||||
@@ -172,9 +172,9 @@ class File_thumbnail extends Managed_DataObject
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string full filesystem path to the locally stored thumbnail file
|
||||
* @throws
|
||||
* @throws FileNotFoundException
|
||||
* @throws ServerException
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
@@ -244,11 +244,9 @@ class File_thumbnail extends Managed_DataObject
|
||||
*/
|
||||
public function getHtmlAttrs(array $orig=array(), $overwrite=true)
|
||||
{
|
||||
$attrs = [
|
||||
'height' => $this->getHeight(),
|
||||
'width' => $this->getWidth(),
|
||||
'src' => $this->getUrl(),
|
||||
];
|
||||
$attrs = [ 'height' => $this->getHeight(),
|
||||
'width' => $this->getWidth(),
|
||||
'src' => $this->getUrl() ];
|
||||
return $overwrite ? array_merge($orig, $attrs) : array_merge($attrs, $orig);
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class File_to_post extends Managed_DataObject
|
||||
public $__table = 'file_to_post'; // table name
|
||||
public $file_id; // int(4) primary_key not_null
|
||||
public $post_id; // int(4) primary_key not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -42,7 +42,7 @@ class File_to_post extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'file_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of URL/file'),
|
||||
'post_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of the notice it belongs to'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('file_id', 'post_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -19,8 +19,8 @@ class Foreign_link extends Managed_DataObject
|
||||
public $profilesync; // tinyint(1) not_null default_1
|
||||
public $last_noticesync; // datetime()
|
||||
public $last_friendsync; // datetime()
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -38,8 +38,8 @@ class Foreign_link extends Managed_DataObject
|
||||
'profilesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'),
|
||||
'last_noticesync' => array('type' => 'datetime', 'description' => 'last time notices were imported'),
|
||||
'last_friendsync' => array('type' => 'datetime', 'description' => 'last time friends were imported'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id', 'foreign_id', 'service'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -13,8 +13,8 @@ class Foreign_service extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $name; // varchar(32) unique_key not_null
|
||||
public $description; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -26,8 +26,8 @@ class Foreign_service extends Managed_DataObject
|
||||
'id' => array('type' => 'int', 'not null' => true, 'description' => 'numeric key for service'),
|
||||
'name' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'name of the service'),
|
||||
'description' => array('type' => 'varchar', 'length' => 191, 'description' => 'description'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@@ -13,7 +13,7 @@ class Foreign_subscription extends Managed_DataObject
|
||||
public $service; // int(4) primary_key not_null
|
||||
public $subscriber; // int(4) primary_key not_null
|
||||
public $subscribed; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -26,7 +26,7 @@ class Foreign_subscription extends Managed_DataObject
|
||||
'service' => array('type' => 'int', 'not null' => true, 'description' => 'service where relationship happens'),
|
||||
'subscriber' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscriber on foreign service'),
|
||||
'subscribed' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'subscribed user'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('service', 'subscriber', 'subscribed'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -14,8 +14,8 @@ class Foreign_user extends Managed_DataObject
|
||||
public $service; // int(4) primary_key not_null
|
||||
public $uri; // varchar(191) unique_key not_null not 255 because utf8mb4 takes more space
|
||||
public $nickname; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -28,8 +28,8 @@ class Foreign_user extends Managed_DataObject
|
||||
'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to service'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'identifying URI'),
|
||||
'nickname' => array('type' => 'varchar', 'length' => 191, 'description' => 'nickname on foreign service'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id', 'service'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -31,7 +31,7 @@ class Group_alias extends Managed_DataObject
|
||||
public $__table = 'group_alias'; // table name
|
||||
public $alias; // varchar(64) primary_key not_null
|
||||
public $group_id; // int(4) not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -42,7 +42,7 @@ class Group_alias extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'alias' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'),
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date alias was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date alias was created'),
|
||||
),
|
||||
'primary key' => array('alias'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -32,7 +32,7 @@ class Group_block extends Managed_DataObject
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $blocked; // int(4) primary_key not_null
|
||||
public $blocker; // int(4) not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -44,7 +44,7 @@ class Group_block extends Managed_DataObject
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
|
||||
'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'),
|
||||
'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date of blocking'),
|
||||
),
|
||||
'primary key' => array('group_id', 'blocked'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -11,7 +11,7 @@ class Group_inbox extends Managed_DataObject
|
||||
public $__table = 'group_inbox'; // table name
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -23,7 +23,7 @@ class Group_inbox extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group receiving the message'),
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice received'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the notice was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the notice was created'),
|
||||
),
|
||||
'primary key' => array('group_id', 'notice_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -24,7 +24,7 @@ class Group_join_queue extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'),
|
||||
'group_id' => array('type' => 'int', 'description' => 'remote or local group to join, if any'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'group_id'),
|
||||
'indexes' => array(
|
||||
|
@@ -13,8 +13,8 @@ class Group_member extends Managed_DataObject
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $is_admin; // tinyint(1)
|
||||
public $uri; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -27,8 +27,8 @@ class Group_member extends Managed_DataObject
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
|
||||
'is_admin' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this user an admin?'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('group_id', 'profile_id'),
|
||||
'unique keys' => array(
|
||||
|
@@ -15,7 +15,7 @@ class Invitation extends Managed_DataObject
|
||||
public $address; // varchar(191) multiple_key not_null not 255 because utf8mb4 takes more space
|
||||
public $address_type; // varchar(8) multiple_key not_null
|
||||
public $registered_user_id; // int(4) not_null
|
||||
public $created; // datetime() not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -36,7 +36,7 @@ class Invitation extends Managed_DataObject
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'who sent the invitation'),
|
||||
'address' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'invitation sent to'),
|
||||
'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'registered_user_id' => array('type' => 'int', 'not null' => false, 'description' => 'if the invitation is converted, who the new user is'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
|
@@ -11,8 +11,8 @@ class Local_group extends Managed_DataObject
|
||||
public $__table = 'local_group'; // table name
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $nickname; // varchar(64) unique_key
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -24,9 +24,8 @@ class Local_group extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group represented'),
|
||||
'nickname' => array('type' => 'varchar', 'length' => 64, 'description' => 'group represented'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('group_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -33,8 +33,8 @@ class Location_namespace extends Managed_DataObject
|
||||
public $__table = 'location_namespace'; // table name
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $description; // varchar(191)
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -45,8 +45,8 @@ class Location_namespace extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'int', 'not null' => true, 'description' => 'identity for this namespace'),
|
||||
'description' => array('type' => 'varchar', 'length' => 191, 'description' => 'description of the namespace'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
);
|
||||
|
@@ -31,8 +31,8 @@ class Login_token extends Managed_DataObject
|
||||
public $__table = 'login_token'; // table name
|
||||
public $user_id; // int(4) primary_key not_null
|
||||
public $token; // char(32) not_null
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -43,8 +43,8 @@ class Login_token extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user owning this token'),
|
||||
'token' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'token useable for logging in'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -14,8 +14,8 @@ class Nonce extends Managed_DataObject
|
||||
public $tok; // char(32)
|
||||
public $nonce; // char(32) primary_key not_null
|
||||
public $ts; // datetime() primary_key not_null
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -43,9 +43,8 @@ class Nonce extends Managed_DataObject
|
||||
'tok' => array('type' => 'char', 'length' => 32, 'description' => 'buggy old value, ignored'),
|
||||
'nonce' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'nonce'),
|
||||
'ts' => array('type' => 'datetime', 'not null' => true, 'description' => 'timestamp sent'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('consumer_key', 'ts', 'nonce'),
|
||||
);
|
||||
|
@@ -59,8 +59,8 @@ class Notice extends Managed_DataObject
|
||||
public $content; // text
|
||||
public $rendered; // text
|
||||
public $url; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime multiple_key not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() multiple_key not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $reply_to; // int(4)
|
||||
public $is_local; // int(4)
|
||||
public $source; // varchar(32)
|
||||
@@ -83,8 +83,8 @@ class Notice extends Managed_DataObject
|
||||
'content' => array('type' => 'text', 'description' => 'update content', 'collate' => 'utf8mb4_general_ci'),
|
||||
'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'),
|
||||
'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'reply_to' => array('type' => 'int', 'description' => 'notice replied to (usually a guess)'),
|
||||
'is_local' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'notice was generated by a user'),
|
||||
'source' => array('type' => 'varchar', 'length' => 32, 'description' => 'source of comment, like "web", "im", or "clientname"'),
|
||||
|
@@ -11,7 +11,7 @@ class Notice_location extends Managed_DataObject
|
||||
public $lon; // decimal(10,7)
|
||||
public $location_id; // int(4)
|
||||
public $location_ns; // int(4)
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -22,7 +22,7 @@ class Notice_location extends Managed_DataObject
|
||||
'lon' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'),
|
||||
'location_id' => array('type' => 'int', 'description' => 'location id if possible'),
|
||||
'location_ns' => array('type' => 'int', 'description' => 'namespace for location'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -34,8 +34,8 @@ class Notice_prefs extends Managed_DataObject
|
||||
public $namespace; // varchar(191) not_null
|
||||
public $topic; // varchar(191) not_null
|
||||
public $data; // text
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -45,8 +45,8 @@ class Notice_prefs extends Managed_DataObject
|
||||
'namespace' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'namespace, like pluginname or category'),
|
||||
'topic' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'preference key, i.e. description, age...'),
|
||||
'data' => array('type' => 'blob', 'description' => 'topic data, may be anything'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'namespace', 'topic'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -13,8 +13,8 @@ class Notice_source extends Managed_DataObject
|
||||
public $code; // varchar(32) primary_key not_null
|
||||
public $name; // varchar(191) not_null not 255 because utf8mb4 takes more space
|
||||
public $url; // varchar(191) not_null not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -27,8 +27,8 @@ class Notice_source extends Managed_DataObject
|
||||
'name' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name of the source'),
|
||||
'url' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'url to link to'),
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
);
|
||||
|
@@ -27,7 +27,7 @@ class Notice_tag extends Managed_DataObject
|
||||
public $__table = 'notice_tag'; // table name
|
||||
public $tag; // varchar(64) primary_key not_null
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -39,7 +39,7 @@ class Notice_tag extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'tag' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'),
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice tagged'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('tag', 'notice_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -22,8 +22,8 @@ class Oauth_application extends Managed_DataObject
|
||||
public $callback_url; // varchar(191) not_null not 255 because utf8mb4 takes more space
|
||||
public $type; // tinyint(1)
|
||||
public $access_type; // tinyint(1)
|
||||
public $created; // datetime not_null
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -173,8 +173,8 @@ class Oauth_application extends Managed_DataObject
|
||||
'callback_url' => array('type' => 'varchar', 'length' => 191, 'description' => 'url to redirect to after authentication'),
|
||||
'type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'type of app, 1 = browser, 2 = desktop'),
|
||||
'access_type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'default access type, bit 1 = read, bit 2 = write'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@@ -14,8 +14,8 @@ class Oauth_application_user extends Managed_DataObject
|
||||
public $application_id; // int(4) primary_key not_null
|
||||
public $access_type; // tinyint(1)
|
||||
public $token; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime not_null
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -28,8 +28,8 @@ class Oauth_application_user extends Managed_DataObject
|
||||
'application_id' => array('type' => 'int', 'not null' => true, 'description' => 'id of the application'),
|
||||
'access_type' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'access type, bit 1 = read, bit 2 = write'),
|
||||
'token' => array('type' => 'varchar', 'length' => 191, 'description' => 'request or access token'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'application_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -13,8 +13,8 @@ class Oauth_token_association extends Managed_DataObject
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $application_id; // int(4) primary_key not_null
|
||||
public $token; // varchar(191) primary key not null not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime not_null
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -44,8 +44,8 @@ class Oauth_token_association extends Managed_DataObject
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'associated user'),
|
||||
'application_id' => array('type' => 'int', 'not null' => true, 'description' => 'the application'),
|
||||
'token' => array('type' => 'varchar', 'length' => '191', 'not null' => true, 'description' => 'token used for this association'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'application_id', 'token'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -72,8 +72,8 @@ class Old_school_prefs extends Managed_DataObject
|
||||
'size' => 'tiny',
|
||||
'default' => 1,
|
||||
'description' => 'Show nicknames for authors and addressees in streams'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -36,8 +36,8 @@ class Profile extends Managed_DataObject
|
||||
public $lon; // decimal(10,7)
|
||||
public $location_id; // int(4)
|
||||
public $location_ns; // int(4)
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -55,9 +55,8 @@ class Profile extends Managed_DataObject
|
||||
'lon' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'),
|
||||
'location_id' => array('type' => 'int', 'description' => 'location id if possible'),
|
||||
'location_ns' => array('type' => 'int', 'description' => 'namespace for location'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'indexes' => array(
|
||||
@@ -794,7 +793,7 @@ class Profile extends Managed_DataObject
|
||||
return is_null($other) ? false : $other->isSubscribed($this);
|
||||
}
|
||||
|
||||
function requiresSubscriptionApproval(Profile $other=null)
|
||||
function requiresSubscriptionApproval(Profile $other=null): bool
|
||||
{
|
||||
if (!$this->isLocal()) {
|
||||
// We don't know for remote users, and we'll always be able to send
|
||||
@@ -810,7 +809,7 @@ class Profile extends Managed_DataObject
|
||||
|
||||
// If the local user either has a private stream (implies the following)
|
||||
// or user has a moderation policy for new subscriptions, return true.
|
||||
return $this->getUser()->private_stream || $this->getUser()->subscribe_policy === User::SUBSCRIBE_POLICY_MODERATE;
|
||||
return $this->isPrivateStream() || $this->getUser()->subscribe_policy === User::SUBSCRIBE_POLICY_MODERATE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1793,13 +1792,14 @@ class Profile extends Managed_DataObject
|
||||
return $this->getUser()->shortenLinks($text, $always);
|
||||
}
|
||||
|
||||
public function isPrivateStream()
|
||||
public function isPrivateStream(): bool
|
||||
{
|
||||
// We only know of public remote users as of yet...
|
||||
if (!$this->isLocal()) {
|
||||
return false;
|
||||
}
|
||||
return $this->getUser()->private_stream ? true : false;
|
||||
$private_stream = $this->getUser()->private_stream;
|
||||
return !is_null($private_stream) && $private_stream;
|
||||
}
|
||||
|
||||
public function delPref($namespace, $topic) {
|
||||
|
@@ -33,7 +33,7 @@ class Profile_block extends Managed_DataObject
|
||||
public $__table = 'profile_block'; // table name
|
||||
public $blocker; // int(4) primary_key not_null
|
||||
public $blocked; // int(4) primary_key not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -44,7 +44,7 @@ class Profile_block extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'),
|
||||
'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date of blocking'),
|
||||
),
|
||||
'foreign keys' => array(
|
||||
'profile_block_blocker_fkey' => array('user', array('blocker' => 'id')),
|
||||
|
@@ -31,8 +31,8 @@ class Profile_list extends Managed_DataObject
|
||||
public $tag; // varchar(64)
|
||||
public $description; // text
|
||||
public $private; // tinyint(1)
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $mainpage; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $tagged_count; // smallint
|
||||
@@ -48,8 +48,8 @@ class Profile_list extends Managed_DataObject
|
||||
'description' => array('type' => 'text', 'description' => 'description of the people tag'),
|
||||
'private' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'is this tag private'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the tag was added'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the tag was added'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was modified'),
|
||||
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
||||
'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page to link to'),
|
||||
|
@@ -34,8 +34,8 @@ class Profile_prefs extends Managed_DataObject
|
||||
public $namespace; // varchar(191) not_null
|
||||
public $topic; // varchar(191) not_null
|
||||
public $data; // text
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -45,8 +45,8 @@ class Profile_prefs extends Managed_DataObject
|
||||
'namespace' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'namespace, like pluginname or category'),
|
||||
'topic' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'preference key, i.e. description, age...'),
|
||||
'data' => array('type' => 'blob', 'description' => 'topic data, may be anything'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'namespace', 'topic'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -35,7 +35,7 @@ class Profile_role extends Managed_DataObject
|
||||
public $__table = 'profile_role'; // table name
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $role; // varchar(32) primary_key not_null
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -46,7 +46,7 @@ class Profile_role extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'account having the role'),
|
||||
'role' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'string representing the role'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date the role was granted'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date the role was granted'),
|
||||
),
|
||||
'primary key' => array('profile_id', 'role'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -9,7 +9,7 @@ class Profile_tag extends Managed_DataObject
|
||||
public $tagger; // int(4) primary_key not_null
|
||||
public $tagged; // int(4) primary_key not_null
|
||||
public $tag; // varchar(64) primary_key not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -19,7 +19,7 @@ class Profile_tag extends Managed_DataObject
|
||||
'tagger' => array('type' => 'int', 'not null' => true, 'description' => 'user making the tag'),
|
||||
'tagged' => array('type' => 'int', 'not null' => true, 'description' => 'profile tagged'),
|
||||
'tag' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date the tag was added'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date the tag was added'),
|
||||
),
|
||||
'primary key' => array('tagger', 'tagged', 'tag'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -12,8 +12,8 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
public $__table = 'profile_tag_subscription'; // table name
|
||||
public $profile_tag_id; // int(4) not_null
|
||||
public $profile_id; // int(4) not_null
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -25,8 +25,8 @@ class Profile_tag_subscription extends Managed_DataObject
|
||||
'profile_tag_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile_tag'),
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('profile_tag_id', 'profile_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -13,7 +13,7 @@ class Queue_item extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $frame; // blob not_null
|
||||
public $transport; // varchar(32)
|
||||
public $created; // datetime() not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $claimed; // datetime()
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
@@ -26,7 +26,7 @@ class Queue_item extends Managed_DataObject
|
||||
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
|
||||
'frame' => array('type' => 'blob', 'not null' => true, 'description' => 'data: object reference or opaque string'),
|
||||
'transport' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'queue for what? "email", "xmpp", "sms", "irc", ...'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'claimed' => array('type' => 'datetime', 'description' => 'date this item was claimed'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
|
@@ -11,7 +11,7 @@ class Related_group extends Managed_DataObject
|
||||
public $__table = 'related_group'; // table name
|
||||
public $group_id; // int(4) primary_key not_null
|
||||
public $related_group_id; // int(4) primary_key not_null
|
||||
public $created; // datetime() not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -23,8 +23,7 @@ class Related_group extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'),
|
||||
'related_group_id' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to user_group'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('group_id', 'related_group_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -12,7 +12,7 @@ class Remember_me extends Managed_DataObject
|
||||
public $__table = 'remember_me'; // table name
|
||||
public $code; // varchar(32) primary_key not_null
|
||||
public $user_id; // int(4) not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -23,7 +23,7 @@ class Remember_me extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'),
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who is logged in'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('code'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -12,7 +12,7 @@ class Reply extends Managed_DataObject
|
||||
public $__table = 'reply'; // table name
|
||||
public $notice_id; // int(4) primary_key not_null
|
||||
public $profile_id; // int(4) primary_key not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $replied_id; // int(4)
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
@@ -24,7 +24,7 @@ class Reply extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'notice_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice that is the reply'),
|
||||
'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'profile replied to'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
'replied_id' => array('type' => 'int', 'description' => 'notice replied to (not used, see notice.reply_to)'),
|
||||
),
|
||||
'primary key' => array('notice_id', 'profile_id'),
|
||||
|
@@ -11,7 +11,7 @@ class Schema_version extends Managed_DataObject
|
||||
public $__table = 'schema_version'; // table name
|
||||
public $table_name; // varchar(64) primary_key not_null
|
||||
public $checksum; // varchar(64) not_null
|
||||
public $modified; // datetime() not_null
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -23,7 +23,7 @@ class Schema_version extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'table_name' => array('type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Table name'),
|
||||
'checksum' => array('type' => 'varchar', 'length' => '64', 'not null' => true, 'description' => 'Checksum of schema array; a mismatch indicates we should check the table more thoroughly.'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('table_name'),
|
||||
);
|
||||
|
@@ -45,8 +45,8 @@ class Session extends Managed_DataObject
|
||||
public $__table = 'session'; // table name
|
||||
public $id; // varchar(32) primary_key not_null
|
||||
public $session_data; // text()
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -62,8 +62,8 @@ class Session extends Managed_DataObject
|
||||
'fields' => [
|
||||
'id' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'session ID'],
|
||||
'session_data' => ['type' => 'text', 'description' => 'session data'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'indexes' => [
|
||||
|
@@ -13,8 +13,8 @@ class Sms_carrier extends Managed_DataObject
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $name; // varchar(64) unique_key
|
||||
public $email_pattern; // varchar(191) not_null not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -31,8 +31,8 @@ class Sms_carrier extends Managed_DataObject
|
||||
'id' => array('type' => 'int', 'not null' => true, 'description' => 'primary key for SMS carrier'),
|
||||
'name' => array('type' => 'varchar', 'length' => 64, 'description' => 'name of the carrier'),
|
||||
'email_pattern' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'sprintf pattern for making an email address from a phone number'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@@ -39,7 +39,7 @@ class Status_network extends Safe_DataObject
|
||||
public $theme; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $logo; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* Static get */
|
||||
static function getKV($k,$v=NULL) {
|
||||
|
@@ -27,7 +27,7 @@ class Status_network_tag extends Safe_DataObject
|
||||
public $__table = 'status_network_tag'; // table name
|
||||
public $site_id; // int(4) primary_key not_null
|
||||
public $tag; // varchar(64) primary_key not_null
|
||||
public $created; // datetime() not_null
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
|
||||
function __construct()
|
||||
|
@@ -35,8 +35,8 @@ class Subscription extends Managed_DataObject
|
||||
public $token; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $secret; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $uri; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
public static function schemaDef()
|
||||
{
|
||||
@@ -49,8 +49,8 @@ class Subscription extends Managed_DataObject
|
||||
'token' => array('type' => 'varchar', 'length' => 191, 'description' => 'authorization token'),
|
||||
'secret' => array('type' => 'varchar', 'length' => 191, 'description' => 'token secret'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('subscriber', 'subscribed'),
|
||||
'unique keys' => array(
|
||||
|
@@ -20,7 +20,7 @@ class Subscription_queue extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'subscriber' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'),
|
||||
'subscribed' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile being subscribed to'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
),
|
||||
'primary key' => array('subscriber', 'subscribed'),
|
||||
'indexes' => array(
|
||||
|
@@ -17,8 +17,8 @@ class Token extends Managed_DataObject
|
||||
public $state; // tinyint(1)
|
||||
public $verifier; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $verified_callback; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -34,9 +34,8 @@ class Token extends Managed_DataObject
|
||||
'state' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'for requests, 0 = initial, 1 = authorized, 2 = used'),
|
||||
'verifier' => array('type' => 'varchar', 'length' => 191, 'description' => 'verifier string for OAuth 1.0a'),
|
||||
'verified_callback' => array('type' => 'varchar', 'length' => 191, 'description' => 'verified callback URL for OAuth 1.0a'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('consumer_key', 'tok'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -48,7 +48,7 @@ class Unavailable_status_network extends Managed_DataObject
|
||||
public $__table = 'unavailable_status_network'; // table name
|
||||
|
||||
public $nickname; // varchar(64) UUID
|
||||
public $created; // datetime
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
|
||||
/**
|
||||
* The One True Thingy that must be defined and declared.
|
||||
@@ -62,7 +62,7 @@ class Unavailable_status_network extends Managed_DataObject
|
||||
'length' => 64,
|
||||
'not null' => true, 'description' => 'nickname not to use'),
|
||||
'created' => array('type' => 'datetime',
|
||||
'not null' => true),
|
||||
'not null' => true, 'default' => '0000-00-00 00:00:00'),
|
||||
),
|
||||
'primary key' => array('nickname'),
|
||||
);
|
||||
|
@@ -55,8 +55,8 @@ class User extends Managed_DataObject
|
||||
public $subscribe_policy; // tinyint(1)
|
||||
public $urlshorteningservice; // varchar(50) default_ur1.ca
|
||||
public $private_stream; // tinyint(1) default_0
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -89,9 +89,8 @@ class User extends Managed_DataObject
|
||||
'subscribe_policy' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'),
|
||||
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
|
||||
'private_stream' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to limit all notices to followers only'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
'unique keys' => array(
|
||||
|
@@ -24,8 +24,8 @@ class User_group extends Managed_DataObject
|
||||
public $homepage_logo; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $stream_logo; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $mini_logo; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $mainpage; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $join_policy; // tinyint
|
||||
@@ -58,8 +58,8 @@ class User_group extends Managed_DataObject
|
||||
'stream_logo' => array('type' => 'varchar', 'length' => 191, 'description' => 'stream-sized logo'),
|
||||
'mini_logo' => array('type' => 'varchar', 'length' => 191, 'description' => 'mini logo'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'),
|
||||
'mainpage' => array('type' => 'varchar', 'length' => 191, 'description' => 'page for group info to link to'),
|
||||
|
@@ -41,8 +41,8 @@ class User_im_prefs extends Managed_DataObject
|
||||
public $notify; // tinyint(1)
|
||||
public $replies; // tinyint(1)
|
||||
public $updatefrompresence; // tinyint(1)
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -57,8 +57,8 @@ class User_im_prefs extends Managed_DataObject
|
||||
'notify' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Notify when a new notice is sent'),
|
||||
'replies' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to'),
|
||||
'updatefrompresence' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'Send replies from people not subscribed to.'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id', 'transport'),
|
||||
'unique keys' => array(
|
||||
|
@@ -37,8 +37,8 @@ class User_location_prefs extends Managed_DataObject
|
||||
public $__table = 'user_location_prefs'; // table name
|
||||
public $user_id; // int(4) primary_key not_null
|
||||
public $share_location; // tinyint(1) default_1
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -49,8 +49,8 @@ class User_location_prefs extends Managed_DataObject
|
||||
'fields' => array(
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who has the preference'),
|
||||
'share_location' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Whether to share location data'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -31,8 +31,8 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
public $urlshorteningservice; // varchar(50) default_ur1.ca
|
||||
public $maxurllength; // int(4) not_null
|
||||
public $maxnoticelength; // int(4) not_null
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -45,9 +45,8 @@ class User_urlshortener_prefs extends Managed_DataObject
|
||||
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
|
||||
'maxurllength' => array('type' => 'int', 'not null' => true, 'description' => 'urls greater than this length will be shortened, 0 = always, null = never'),
|
||||
'maxnoticelength' => array('type' => 'int', 'not null' => true, 'description' => 'notices with content greater than this value will have all urls shortened, 0 = always, -1 = only if notice text is longer than max allowed'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('user_id'),
|
||||
'foreign keys' => array(
|
||||
|
@@ -13,8 +13,8 @@ class User_username extends Managed_DataObject
|
||||
public $user_id; // int(4) not_null
|
||||
public $provider_name; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space
|
||||
public $username; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
@@ -26,8 +26,8 @@ class User_username extends Managed_DataObject
|
||||
'provider_name' => array('type' => 'varchar', 'length' => 191, 'description' => 'provider name'),
|
||||
'username' => array('type' => 'varchar', 'length' => 191, 'description' => 'username'),
|
||||
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice id this title relates to'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
'primary key' => array('provider_name', 'username'),
|
||||
'indexes' => array(
|
||||
|
80
composer.json
Normal file
80
composer.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "gnusocial/gnusocial",
|
||||
"description": "Free software social networking platform.",
|
||||
"type": "project",
|
||||
"license": "AGPL-3.0-only",
|
||||
"require": {
|
||||
"php": "^7.3.0",
|
||||
"ext-bcmath": "*",
|
||||
"ext-curl": "*",
|
||||
"ext-dom": "*",
|
||||
"ext-gd": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-openssl": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"apereo/phpcas": "^1.3",
|
||||
"diogocomposer/xmpphp": "^3.0",
|
||||
"embed/embed": "^3.4",
|
||||
"ezyang/htmlpurifier": "^4.10",
|
||||
"hoa/consistency": "^1.17.05.02",
|
||||
"intervention/image": "^2.5",
|
||||
"masterminds/html5": "^2.6",
|
||||
"mf2/mf2": "^0.4.6",
|
||||
"michelf/php-markdown": "^1.8.0",
|
||||
"openid/php-openid": "^2.3",
|
||||
"paragonie/constant_time_encoding": "^1.0.4",
|
||||
"pear/console_getopt": "^1.4",
|
||||
"phpseclib/phpseclib": "dev-master#f815e43077da67d3dd5b4d18a45753f5b79c1ab9",
|
||||
"stomp-php/stomp-php": "^4.5.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpdocumentor/phpdocumentor": "^2.9",
|
||||
"phpunit/phpunit": "^8.2",
|
||||
"psy/psysh": "^0.9.9"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-apache": "*",
|
||||
"ext-gmp": "*",
|
||||
"ext-http": "*",
|
||||
"ext-xmlrpc": "*",
|
||||
"ext-pgsql": "*",
|
||||
"ext-mysql": "*",
|
||||
"ext-mysqli": "*",
|
||||
"ext-sqlite": "*",
|
||||
"ext-posix": "*",
|
||||
"ext-readline": "*",
|
||||
"ext-pcntl": "*",
|
||||
"ext-ldap": "*",
|
||||
"ext-fileinfo": "*",
|
||||
"ext-interbase": "*",
|
||||
"ext-imagick": "*",
|
||||
"ext-imap": "*",
|
||||
"ext-exif": "*",
|
||||
"ext-mailparse": "*",
|
||||
"ext-oci8": "*",
|
||||
"ext-memcached": "*",
|
||||
"ext-memcache": "*",
|
||||
"ext-mssql": "*",
|
||||
"ext-odbc": "*",
|
||||
"ext-zlib": "*",
|
||||
"ext-sybase": "*",
|
||||
"ext-zip": "*",
|
||||
"ext-libxml": "*"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"scripts": {
|
||||
"post-update-cmd": [
|
||||
"@php scripts/upgrade.php"
|
||||
]
|
||||
}
|
||||
}
|
6283
composer.lock
generated
Normal file
6283
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
116
extlib/AcceptHeader.php
Normal file
116
extlib/AcceptHeader.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* Note : Code is released under the GNU LGPL
|
||||
*
|
||||
* Please do not change the header of this file
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The AcceptHeader page will parse and sort the different
|
||||
* allowed types for the content negociations
|
||||
*
|
||||
* @author Pierrick Charron <pierrick@webstart.fr>
|
||||
*/
|
||||
class AcceptHeader extends \ArrayObject
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $header Value of the Accept header
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($header)
|
||||
{
|
||||
$acceptedTypes = $this->_parse($header);
|
||||
usort($acceptedTypes, [$this, '_compare']);
|
||||
parent::__construct($acceptedTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the accept header and return an array containing
|
||||
* all the informations about the Accepted types
|
||||
*
|
||||
* @param string $data Value of the Accept header
|
||||
* @return array
|
||||
*/
|
||||
private function _parse($data)
|
||||
{
|
||||
$array = [];
|
||||
$items = explode(',', $data);
|
||||
foreach ($items as $item) {
|
||||
$elems = explode(';', $item);
|
||||
|
||||
$acceptElement = [];
|
||||
$mime = current($elems);
|
||||
list($type, $subtype) = explode('/', $mime);
|
||||
$acceptElement['type'] = trim($type);
|
||||
$acceptElement['subtype'] = trim($subtype);
|
||||
$acceptElement['raw'] = $mime;
|
||||
|
||||
$acceptElement['params'] = [];
|
||||
while (next($elems)) {
|
||||
list($name, $value) = explode('=', current($elems));
|
||||
$acceptElement['params'][trim($name)] = trim($value);
|
||||
}
|
||||
|
||||
$array[] = $acceptElement;
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two Accepted types with their parameters to know
|
||||
* if one media type should be used instead of an other
|
||||
*
|
||||
* @param array $a The first media type and its parameters
|
||||
* @param array $b The second media type and its parameters
|
||||
* @return int
|
||||
*/
|
||||
private function _compare($a, $b)
|
||||
{
|
||||
$a_q = isset($a['params']['q']) ? floatval($a['params']['q']) : 1.0;
|
||||
$b_q = isset($b['params']['q']) ? floatval($b['params']['q']) : 1.0;
|
||||
if ($a_q === $b_q) {
|
||||
$a_count = count($a['params']);
|
||||
$b_count = count($b['params']);
|
||||
if ($a_count === $b_count) {
|
||||
if ($r = $this->_compareSubType($a['subtype'], $b['subtype'])) {
|
||||
return $r;
|
||||
} else {
|
||||
return $this->_compareSubType($a['type'], $b['type']);
|
||||
}
|
||||
} else {
|
||||
return $a_count < $b_count;
|
||||
}
|
||||
} else {
|
||||
return $a_q < $b_q;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two subtypes
|
||||
*
|
||||
* @param string $a First subtype to compare
|
||||
* @param string $b Second subtype to compare
|
||||
* @return int
|
||||
*/
|
||||
private function _compareSubType($a, $b)
|
||||
{
|
||||
if ($a === '*' && $b !== '*') {
|
||||
return 1;
|
||||
} elseif ($b === '*' && $a !== '*') {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,104 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2003 Richard Heyes |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Richard Heyes <richard@php.net> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: SASL.php 286825 2009-08-05 06:23:42Z cweiske $
|
||||
|
||||
/**
|
||||
* Client implementation of various SASL mechanisms
|
||||
*
|
||||
* @author Richard Heyes <richard@php.net>
|
||||
* @access public
|
||||
* @version 1.0
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
require_once('PEAR.php');
|
||||
|
||||
class Auth_SASL
|
||||
{
|
||||
/**
|
||||
* Factory class. Returns an object of the request
|
||||
* type.
|
||||
*
|
||||
* @param string $type One of: Anonymous
|
||||
* Plain
|
||||
* CramMD5
|
||||
* DigestMD5
|
||||
* Types are not case sensitive
|
||||
*/
|
||||
function &factory($type)
|
||||
{
|
||||
switch (strtolower($type)) {
|
||||
case 'anonymous':
|
||||
$filename = 'Auth/SASL/Anonymous.php';
|
||||
$classname = 'Auth_SASL_Anonymous';
|
||||
break;
|
||||
|
||||
case 'login':
|
||||
$filename = 'Auth/SASL/Login.php';
|
||||
$classname = 'Auth_SASL_Login';
|
||||
break;
|
||||
|
||||
case 'plain':
|
||||
$filename = 'Auth/SASL/Plain.php';
|
||||
$classname = 'Auth_SASL_Plain';
|
||||
break;
|
||||
|
||||
case 'external':
|
||||
$filename = 'Auth/SASL/External.php';
|
||||
$classname = 'Auth_SASL_External';
|
||||
break;
|
||||
|
||||
case 'crammd5':
|
||||
$filename = 'Auth/SASL/CramMD5.php';
|
||||
$classname = 'Auth_SASL_CramMD5';
|
||||
break;
|
||||
|
||||
case 'digestmd5':
|
||||
$filename = 'Auth/SASL/DigestMD5.php';
|
||||
$classname = 'Auth_SASL_DigestMD5';
|
||||
break;
|
||||
|
||||
default:
|
||||
return PEAR::raiseError('Invalid SASL mechanism type');
|
||||
break;
|
||||
}
|
||||
|
||||
require_once($filename);
|
||||
$obj = new $classname();
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2003 Richard Heyes |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Richard Heyes <richard@php.net> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Anonymous.php 286825 2009-08-05 06:23:42Z cweiske $
|
||||
|
||||
/**
|
||||
* Implmentation of ANONYMOUS SASL mechanism
|
||||
*
|
||||
* @author Richard Heyes <richard@php.net>
|
||||
* @access public
|
||||
* @version 1.0
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
require_once('Auth/SASL/Common.php');
|
||||
|
||||
class Auth_SASL_Anonymous extends Auth_SASL_Common
|
||||
{
|
||||
/**
|
||||
* Not much to do here except return the token supplied.
|
||||
* No encoding, hashing or encryption takes place for this
|
||||
* mechanism, simply one of:
|
||||
* o An email address
|
||||
* o An opaque string not containing "@" that can be interpreted
|
||||
* by the sysadmin
|
||||
* o Nothing
|
||||
*
|
||||
* We could have some logic here for the second option, but this
|
||||
* would by no means create something interpretable.
|
||||
*
|
||||
* @param string $token Optional email address or string to provide
|
||||
* as trace information.
|
||||
* @return string The unaltered input token
|
||||
*/
|
||||
function getResponse($token = '')
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2003 Richard Heyes |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Richard Heyes <richard@php.net> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Common.php 286825 2009-08-05 06:23:42Z cweiske $
|
||||
|
||||
/**
|
||||
* Common functionality to SASL mechanisms
|
||||
*
|
||||
* @author Richard Heyes <richard@php.net>
|
||||
* @access public
|
||||
* @version 1.0
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
class Auth_SASL_Common
|
||||
{
|
||||
/**
|
||||
* Function which implements HMAC MD5 digest
|
||||
*
|
||||
* @param string $key The secret key
|
||||
* @param string $data The data to protect
|
||||
* @return string The HMAC MD5 digest
|
||||
*/
|
||||
function _HMAC_MD5($key, $data)
|
||||
{
|
||||
if (strlen($key) > 64) {
|
||||
$key = pack('H32', md5($key));
|
||||
}
|
||||
|
||||
if (strlen($key) < 64) {
|
||||
$key = str_pad($key, 64, chr(0));
|
||||
}
|
||||
|
||||
$k_ipad = substr($key, 0, 64) ^ str_repeat(chr(0x36), 64);
|
||||
$k_opad = substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64);
|
||||
|
||||
$inner = pack('H32', md5($k_ipad . $data));
|
||||
$digest = md5($k_opad . $inner);
|
||||
|
||||
return $digest;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2003 Richard Heyes |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Richard Heyes <richard@php.net> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: CramMD5.php 286825 2009-08-05 06:23:42Z cweiske $
|
||||
|
||||
/**
|
||||
* Implmentation of CRAM-MD5 SASL mechanism
|
||||
*
|
||||
* @author Richard Heyes <richard@php.net>
|
||||
* @access public
|
||||
* @version 1.0
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
require_once('Auth/SASL/Common.php');
|
||||
|
||||
class Auth_SASL_CramMD5 extends Auth_SASL_Common
|
||||
{
|
||||
/**
|
||||
* Implements the CRAM-MD5 SASL mechanism
|
||||
* This DOES NOT base64 encode the return value,
|
||||
* you will need to do that yourself.
|
||||
*
|
||||
* @param string $user Username
|
||||
* @param string $pass Password
|
||||
* @param string $challenge The challenge supplied by the server.
|
||||
* this should be already base64_decoded.
|
||||
*
|
||||
* @return string The string to pass back to the server, of the form
|
||||
* "<user> <digest>". This is NOT base64_encoded.
|
||||
*/
|
||||
function getResponse($user, $pass, $challenge)
|
||||
{
|
||||
return $user . ' ' . $this->_HMAC_MD5($pass, $challenge);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,197 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2003 Richard Heyes |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Richard Heyes <richard@php.net> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: DigestMD5.php 294702 2010-02-07 16:03:55Z cweiske $
|
||||
|
||||
/**
|
||||
* Implmentation of DIGEST-MD5 SASL mechanism
|
||||
*
|
||||
* @author Richard Heyes <richard@php.net>
|
||||
* @access public
|
||||
* @version 1.0
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
require_once('Auth/SASL/Common.php');
|
||||
|
||||
class Auth_SASL_DigestMD5 extends Auth_SASL_Common
|
||||
{
|
||||
/**
|
||||
* Provides the (main) client response for DIGEST-MD5
|
||||
* requires a few extra parameters than the other
|
||||
* mechanisms, which are unavoidable.
|
||||
*
|
||||
* @param string $authcid Authentication id (username)
|
||||
* @param string $pass Password
|
||||
* @param string $challenge The digest challenge sent by the server
|
||||
* @param string $hostname The hostname of the machine you're connecting to
|
||||
* @param string $service The servicename (eg. imap, pop, acap etc)
|
||||
* @param string $authzid Authorization id (username to proxy as)
|
||||
* @return string The digest response (NOT base64 encoded)
|
||||
* @access public
|
||||
*/
|
||||
function getResponse($authcid, $pass, $challenge, $hostname, $service, $authzid = '')
|
||||
{
|
||||
$challenge = $this->_parseChallenge($challenge);
|
||||
$authzid_string = '';
|
||||
if ($authzid != '') {
|
||||
$authzid_string = ',authzid="' . $authzid . '"';
|
||||
}
|
||||
|
||||
if (!empty($challenge)) {
|
||||
$cnonce = $this->_getCnonce();
|
||||
$digest_uri = sprintf('%s/%s', $service, $hostname);
|
||||
$response_value = $this->_getResponseValue($authcid, $pass, $challenge['realm'], $challenge['nonce'], $cnonce, $digest_uri, $authzid);
|
||||
|
||||
if ($challenge['realm']) {
|
||||
return sprintf('username="%s",realm="%s"' . $authzid_string .
|
||||
',nonce="%s",cnonce="%s",nc=00000001,qop=auth,digest-uri="%s",response=%s,maxbuf=%d', $authcid, $challenge['realm'], $challenge['nonce'], $cnonce, $digest_uri, $response_value, $challenge['maxbuf']);
|
||||
} else {
|
||||
return sprintf('username="%s"' . $authzid_string . ',nonce="%s",cnonce="%s",nc=00000001,qop=auth,digest-uri="%s",response=%s,maxbuf=%d', $authcid, $challenge['nonce'], $cnonce, $digest_uri, $response_value, $challenge['maxbuf']);
|
||||
}
|
||||
} else {
|
||||
return PEAR::raiseError('Invalid digest challenge');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses and verifies the digest challenge*
|
||||
*
|
||||
* @param string $challenge The digest challenge
|
||||
* @return array The parsed challenge as an assoc
|
||||
* array in the form "directive => value".
|
||||
* @access private
|
||||
*/
|
||||
function _parseChallenge($challenge)
|
||||
{
|
||||
$tokens = array();
|
||||
while (preg_match('/^([a-z-]+)=("[^"]+(?<!\\\)"|[^,]+)/i', $challenge, $matches)) {
|
||||
|
||||
// Ignore these as per rfc2831
|
||||
if ($matches[1] == 'opaque' OR $matches[1] == 'domain') {
|
||||
$challenge = substr($challenge, strlen($matches[0]) + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Allowed multiple "realm" and "auth-param"
|
||||
if (!empty($tokens[$matches[1]]) AND ($matches[1] == 'realm' OR $matches[1] == 'auth-param')) {
|
||||
if (is_array($tokens[$matches[1]])) {
|
||||
$tokens[$matches[1]][] = preg_replace('/^"(.*)"$/', '\\1', $matches[2]);
|
||||
} else {
|
||||
$tokens[$matches[1]] = array($tokens[$matches[1]], preg_replace('/^"(.*)"$/', '\\1', $matches[2]));
|
||||
}
|
||||
|
||||
// Any other multiple instance = failure
|
||||
} elseif (!empty($tokens[$matches[1]])) {
|
||||
$tokens = array();
|
||||
break;
|
||||
|
||||
} else {
|
||||
$tokens[$matches[1]] = preg_replace('/^"(.*)"$/', '\\1', $matches[2]);
|
||||
}
|
||||
|
||||
// Remove the just parsed directive from the challenge
|
||||
$challenge = substr($challenge, strlen($matches[0]) + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defaults and required directives
|
||||
*/
|
||||
// Realm
|
||||
if (empty($tokens['realm'])) {
|
||||
$tokens['realm'] = "";
|
||||
}
|
||||
|
||||
// Maxbuf
|
||||
if (empty($tokens['maxbuf'])) {
|
||||
$tokens['maxbuf'] = 65536;
|
||||
}
|
||||
|
||||
// Required: nonce, algorithm
|
||||
if (empty($tokens['nonce']) OR empty($tokens['algorithm'])) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the response= part of the digest response
|
||||
*
|
||||
* @param string $authcid Authentication id (username)
|
||||
* @param string $pass Password
|
||||
* @param string $realm Realm as provided by the server
|
||||
* @param string $nonce Nonce as provided by the server
|
||||
* @param string $cnonce Client nonce
|
||||
* @param string $digest_uri The digest-uri= value part of the response
|
||||
* @param string $authzid Authorization id
|
||||
* @return string The response= part of the digest response
|
||||
* @access private
|
||||
*/
|
||||
function _getResponseValue($authcid, $pass, $realm, $nonce, $cnonce, $digest_uri, $authzid = '')
|
||||
{
|
||||
if ($authzid == '') {
|
||||
$A1 = sprintf('%s:%s:%s', pack('H32', md5(sprintf('%s:%s:%s', $authcid, $realm, $pass))), $nonce, $cnonce);
|
||||
} else {
|
||||
$A1 = sprintf('%s:%s:%s:%s', pack('H32', md5(sprintf('%s:%s:%s', $authcid, $realm, $pass))), $nonce, $cnonce, $authzid);
|
||||
}
|
||||
$A2 = 'AUTHENTICATE:' . $digest_uri;
|
||||
return md5(sprintf('%s:%s:00000001:%s:auth:%s', md5($A1), $nonce, $cnonce, md5($A2)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the client nonce for the response
|
||||
*
|
||||
* @return string The cnonce value
|
||||
* @access private
|
||||
*/
|
||||
function _getCnonce()
|
||||
{
|
||||
if (@file_exists('/dev/urandom') && $fd = @fopen('/dev/urandom', 'r')) {
|
||||
return base64_encode(fread($fd, 32));
|
||||
|
||||
} elseif (@file_exists('/dev/random') && $fd = @fopen('/dev/random', 'r')) {
|
||||
return base64_encode(fread($fd, 32));
|
||||
|
||||
} else {
|
||||
$str = '';
|
||||
for ($i=0; $i<32; $i++) {
|
||||
$str .= chr(mt_rand(0, 255));
|
||||
}
|
||||
|
||||
return base64_encode($str);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2008 Christoph Schulz |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Christoph Schulz <develop@kristov.de> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: External.php 286825 2009-08-05 06:23:42Z cweiske $
|
||||
|
||||
/**
|
||||
* Implmentation of EXTERNAL SASL mechanism
|
||||
*
|
||||
* @author Christoph Schulz <develop@kristov.de>
|
||||
* @access public
|
||||
* @version 1.0.3
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
require_once('Auth/SASL/Common.php');
|
||||
|
||||
class Auth_SASL_External extends Auth_SASL_Common
|
||||
{
|
||||
/**
|
||||
* Returns EXTERNAL response
|
||||
*
|
||||
* @param string $authcid Authentication id (username)
|
||||
* @param string $pass Password
|
||||
* @param string $authzid Autorization id
|
||||
* @return string EXTERNAL Response
|
||||
*/
|
||||
function getResponse($authcid, $pass, $authzid = '')
|
||||
{
|
||||
return $authzid;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2003 Richard Heyes |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Richard Heyes <richard@php.net> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Login.php 286825 2009-08-05 06:23:42Z cweiske $
|
||||
|
||||
/**
|
||||
* This is technically not a SASL mechanism, however
|
||||
* it's used by Net_Sieve, Net_Cyrus and potentially
|
||||
* other protocols , so here is a good place to abstract
|
||||
* it.
|
||||
*
|
||||
* @author Richard Heyes <richard@php.net>
|
||||
* @access public
|
||||
* @version 1.0
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
require_once('Auth/SASL/Common.php');
|
||||
|
||||
class Auth_SASL_Login extends Auth_SASL_Common
|
||||
{
|
||||
/**
|
||||
* Pseudo SASL LOGIN mechanism
|
||||
*
|
||||
* @param string $user Username
|
||||
* @param string $pass Password
|
||||
* @return string LOGIN string
|
||||
*/
|
||||
function getResponse($user, $pass)
|
||||
{
|
||||
return sprintf('LOGIN %s %s', $user, $pass);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2003 Richard Heyes |
|
||||
// | All rights reserved. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | o Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | o Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution.|
|
||||
// | o The names of the authors may not be used to endorse or promote |
|
||||
// | products derived from this software without specific prior written |
|
||||
// | permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||
// | |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Author: Richard Heyes <richard@php.net> |
|
||||
// +-----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Plain.php 286825 2009-08-05 06:23:42Z cweiske $
|
||||
|
||||
/**
|
||||
* Implmentation of PLAIN SASL mechanism
|
||||
*
|
||||
* @author Richard Heyes <richard@php.net>
|
||||
* @access public
|
||||
* @version 1.0
|
||||
* @package Auth_SASL
|
||||
*/
|
||||
|
||||
require_once('Auth/SASL/Common.php');
|
||||
|
||||
class Auth_SASL_Plain extends Auth_SASL_Common
|
||||
{
|
||||
/**
|
||||
* Returns PLAIN response
|
||||
*
|
||||
* @param string $authcid Authentication id (username)
|
||||
* @param string $pass Password
|
||||
* @param string $authzid Autorization id
|
||||
* @return string PLAIN Response
|
||||
*/
|
||||
function getResponse($authcid, $pass, $authzid = '')
|
||||
{
|
||||
return $authzid . chr(0) . $authcid . chr(0) . $pass;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -660,7 +660,7 @@ class DB
|
||||
$parsed['dbsyntax'] = $str;
|
||||
}
|
||||
|
||||
if (!strlen($dsn)) {
|
||||
if (empty($dsn)) {
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
@@ -1503,4 +1503,4 @@ class DB_row
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
*/
|
||||
|
@@ -1319,7 +1319,8 @@ class DB_common extends PEAR
|
||||
*/
|
||||
public function &query($query, $params = array())
|
||||
{
|
||||
if (sizeof($params) > 0) {
|
||||
$params = (array)$params;
|
||||
if (count($params)) {
|
||||
$sth = $this->prepare($query);
|
||||
if (DB::isError($sth)) {
|
||||
return $sth;
|
||||
@@ -1361,7 +1362,8 @@ class DB_common extends PEAR
|
||||
{
|
||||
$params = (array)$params;
|
||||
// modifyLimitQuery() would be nice here, but it causes BC issues
|
||||
if (sizeof($params) > 0) {
|
||||
$params = (array)$params;
|
||||
if (count($params)) {
|
||||
$sth = $this->prepare($query);
|
||||
if (DB::isError($sth)) {
|
||||
return $sth;
|
||||
@@ -1680,7 +1682,8 @@ class DB_common extends PEAR
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($params) > 0) {
|
||||
$params = (array)$params;
|
||||
if (count($params)) {
|
||||
$sth = $this->prepare($query);
|
||||
|
||||
if (DB::isError($sth)) {
|
||||
|
@@ -332,14 +332,14 @@ class DB_pgsql extends DB_common
|
||||
$query = $this->modifyQuery($query);
|
||||
if (!$this->autocommit && $ismanip) {
|
||||
if ($this->transaction_opcount == 0) {
|
||||
$result = @pg_exec($this->connection, 'begin;');
|
||||
$result = @pg_query($this->connection, 'begin;');
|
||||
if (!$result) {
|
||||
return $this->pgsqlRaiseError();
|
||||
}
|
||||
}
|
||||
$this->transaction_opcount++;
|
||||
}
|
||||
$result = @pg_exec($this->connection, $query);
|
||||
$result = @pg_query($this->connection, $query);
|
||||
if (!$result) {
|
||||
return $this->pgsqlRaiseError();
|
||||
}
|
||||
@@ -737,7 +737,7 @@ class DB_pgsql extends DB_common
|
||||
if ($this->transaction_opcount > 0) {
|
||||
// (disabled) hack to shut up error messages from libpq.a
|
||||
//@fclose(@fopen("php://stderr", "w"));
|
||||
$result = @pg_exec($this->connection, 'end;');
|
||||
$result = @pg_query($this->connection, 'end;');
|
||||
$this->transaction_opcount = 0;
|
||||
if (!$result) {
|
||||
return $this->pgsqlRaiseError();
|
||||
@@ -757,7 +757,7 @@ class DB_pgsql extends DB_common
|
||||
public function rollback()
|
||||
{
|
||||
if ($this->transaction_opcount > 0) {
|
||||
$result = @pg_exec($this->connection, 'abort;');
|
||||
$result = @pg_query($this->connection, 'abort;');
|
||||
$this->transaction_opcount = 0;
|
||||
if (!$result) {
|
||||
return $this->pgsqlRaiseError();
|
||||
@@ -917,7 +917,7 @@ class DB_pgsql extends DB_common
|
||||
* Probably received a table name.
|
||||
* Create a result resource identifier.
|
||||
*/
|
||||
$id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
|
||||
$id = @pg_query($this->connection, "SELECT * FROM $result LIMIT 0");
|
||||
$got_string = true;
|
||||
} elseif (isset($result->result)) {
|
||||
/*
|
||||
@@ -1011,7 +1011,7 @@ class DB_pgsql extends DB_common
|
||||
$tableWhere = "tab.relname = '$table_name'";
|
||||
}
|
||||
|
||||
$result = @pg_exec($this->connection, "SELECT f.attnotnull, f.atthasdef
|
||||
$result = @pg_query($this->connection, "SELECT f.attnotnull, f.atthasdef
|
||||
FROM $from
|
||||
WHERE tab.relname = typ.typname
|
||||
AND typ.typrelid = f.attrelid
|
||||
@@ -1022,7 +1022,7 @@ class DB_pgsql extends DB_common
|
||||
$flags = ($row[0] == 't') ? 'not_null ' : '';
|
||||
|
||||
if ($row[1] == 't') {
|
||||
$result = @pg_exec($this->connection, "SELECT a.adsrc
|
||||
$result = @pg_query($this->connection, "SELECT a.adsrc
|
||||
FROM $from, pg_attrdef a
|
||||
WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
|
||||
AND f.attrelid = a.adrelid AND f.attname = '$field_name'
|
||||
@@ -1034,7 +1034,7 @@ class DB_pgsql extends DB_common
|
||||
} else {
|
||||
$flags = '';
|
||||
}
|
||||
$result = @pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
|
||||
$result = @pg_query($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
|
||||
FROM $from, pg_index i
|
||||
WHERE tab.relname = typ.typname
|
||||
AND typ.typrelid = f.attrelid
|
||||
|
Binary file not shown.
@@ -1,29 +0,0 @@
|
||||
Core.ColorKeywords
|
||||
TYPE: hash
|
||||
VERSION: 2.0.0
|
||||
--DEFAULT--
|
||||
array (
|
||||
'maroon' => '#800000',
|
||||
'red' => '#FF0000',
|
||||
'orange' => '#FFA500',
|
||||
'yellow' => '#FFFF00',
|
||||
'olive' => '#808000',
|
||||
'purple' => '#800080',
|
||||
'fuchsia' => '#FF00FF',
|
||||
'white' => '#FFFFFF',
|
||||
'lime' => '#00FF00',
|
||||
'green' => '#008000',
|
||||
'navy' => '#000080',
|
||||
'blue' => '#0000FF',
|
||||
'aqua' => '#00FFFF',
|
||||
'teal' => '#008080',
|
||||
'black' => '#000000',
|
||||
'silver' => '#C0C0C0',
|
||||
'gray' => '#808080',
|
||||
)
|
||||
--DESCRIPTION--
|
||||
|
||||
Lookup array of color names to six digit hexadecimal number corresponding
|
||||
to color, with preceding hash mark. Used when parsing colors. The lookup
|
||||
is done in a case-insensitive manner.
|
||||
--# vim: et sw=4 sts=4
|
@@ -1 +0,0 @@
|
||||
4.10.0
|
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
#
|
||||
# Markdown - A text-to-HTML conversion tool for web writers
|
||||
#
|
||||
# PHP Markdown
|
||||
# Copyright (c) 2004-2015 Michel Fortin
|
||||
# <https://michelf.ca/projects/php-markdown/>
|
||||
#
|
||||
# Original Markdown
|
||||
# Copyright (c) 2004-2006 John Gruber
|
||||
# <https://daringfireball.net/projects/markdown/>
|
||||
#
|
||||
namespace Michelf;
|
||||
|
||||
|
||||
#
|
||||
# Markdown Parser Interface
|
||||
#
|
||||
|
||||
interface MarkdownInterface {
|
||||
|
||||
#
|
||||
# Initialize the parser and return the result of its transform method.
|
||||
# This will work fine for derived classes too.
|
||||
#
|
||||
public static function defaultTransform($text);
|
||||
|
||||
#
|
||||
# Main function. Performs some preprocessing on the input text
|
||||
# and pass it through the document gamut.
|
||||
#
|
||||
public function transform($text);
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user