mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 17:07:39 -04:00
Compare commits
322 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c87b06caa | ||
|
|
339e702beb | ||
|
|
8750c5f7bc | ||
|
|
c3b4397ea3 | ||
|
|
a3f1189df7 | ||
|
|
2bc088e555 | ||
|
|
67d8b977b6 | ||
|
|
5b1e532791 | ||
|
|
0e1bf2cef0 | ||
|
|
4f129e05e5 | ||
|
|
3733a80c1d | ||
|
|
220571d2a9 | ||
|
|
f6b9a1dd3c | ||
|
|
393d5020f8 | ||
|
|
06ac41c005 | ||
|
|
39ee872f49 | ||
|
|
a7c51f5d65 | ||
|
|
5309c032db | ||
|
|
176298ffeb | ||
|
|
fdf19e659e | ||
|
|
e799589781 | ||
|
|
10acf90d06 | ||
|
|
b184533115 | ||
|
|
b50e06a9d9 | ||
|
|
66901dbe3e | ||
|
|
4a7879aad2 | ||
|
|
30aa0e3822 | ||
|
|
cadc7ee29e | ||
|
|
5a44b8c40c | ||
|
|
487e68ebd1 | ||
|
|
6cdbc28d79 | ||
|
|
4113bea104 | ||
|
|
294359d7f5 | ||
|
|
8ff870482f | ||
|
|
56cb6f1034 | ||
|
|
7eb23aa8b8 | ||
|
|
c793cea2f0 | ||
|
|
4e19f1c8be | ||
|
|
3d3fcd7334 | ||
|
|
61c03e4b4e | ||
|
|
dd0be272d0 | ||
|
|
b781739949 | ||
|
|
2221d8dd12 | ||
|
|
d67a0b14e3 | ||
|
|
b838632318 | ||
|
|
8c38466b75 | ||
|
|
2919b36e91 | ||
|
|
52f7b508af | ||
|
|
15f6bc93cf | ||
|
|
8c4269d037 | ||
|
|
7394c97f23 | ||
|
|
33e45d98a3 | ||
|
|
241cc1ad63 | ||
|
|
b26db5bde6 | ||
|
|
9be799de15 | ||
|
|
014737fe21 | ||
|
|
d3093dce1b | ||
|
|
61f9ad8274 | ||
|
|
7067a0adc2 | ||
|
|
eb8cab37f3 | ||
|
|
467e0b32b4 | ||
|
|
204d91c3c3 | ||
|
|
1bd52867fb | ||
|
|
898fb4f800 | ||
|
|
63a01c0214 | ||
|
|
39933052a9 | ||
|
|
719dbf091a | ||
|
|
2dad3a8fe5 | ||
|
|
d99ba64206 | ||
|
|
202b797fe6 | ||
|
|
9df96fa03b | ||
|
|
7afb01e488 | ||
|
|
ae140465d7 | ||
|
|
475cbf6510 | ||
|
|
39e5e29ce5 | ||
|
|
f4ffef967a | ||
|
|
77a6a21ea2 | ||
|
|
4e35d34226 | ||
|
|
3708896a65 | ||
|
|
7c3f28f9d2 | ||
|
|
afc8b88933 | ||
|
|
4668178dee | ||
|
|
bfec7b6901 | ||
|
|
f026afe11c | ||
|
|
f388fcaf08 | ||
|
|
9bd2b3ab17 | ||
|
|
2d0b216a2c | ||
|
|
c5bca0279c | ||
|
|
3fca63a15f | ||
|
|
c47900f366 | ||
|
|
84f64214c3 | ||
|
|
9cd01e2e13 | ||
|
|
841b4f7d81 | ||
|
|
70212cdb59 | ||
|
|
5f77e9f4ce | ||
|
|
6276f36b90 | ||
|
|
2461e709d2 | ||
|
|
1055718935 | ||
|
|
82f69018a6 | ||
|
|
c22f633ae0 | ||
|
|
c71eb401c0 | ||
|
|
5a1079750e | ||
|
|
3d03c24f06 | ||
|
|
983fc84f28 | ||
|
|
1861eeeb0a | ||
|
|
663aeca2a7 | ||
|
|
526730672a | ||
|
|
7f292d4765 | ||
|
|
99bff67168 | ||
|
|
bb3caeb629 | ||
|
|
65185a70d5 | ||
|
|
6d1f34284b | ||
|
|
2cfdbbd956 | ||
|
|
5f66ad5bc5 | ||
|
|
aff11443b4 | ||
|
|
6ced7ecf89 | ||
|
|
2d467a15ba | ||
|
|
28c8229218 | ||
|
|
0bcecc4baa | ||
|
|
78e68519e8 | ||
|
|
d2b06995c7 | ||
|
|
5cbae0fb81 | ||
|
|
2ddc087512 | ||
|
|
b0fe94b4b3 | ||
|
|
45275910e6 | ||
|
|
c04e781926 | ||
|
|
09a609ef6b | ||
|
|
213ee83a92 | ||
|
|
db5e524e3c | ||
|
|
f882c44fb3 | ||
|
|
8f9e9116df | ||
|
|
04a35dac9a | ||
|
|
ed03befa02 | ||
|
|
f944f46744 | ||
|
|
3f5c45a567 | ||
|
|
464149e22d | ||
|
|
b51ed67efb | ||
|
|
30ba0661aa | ||
|
|
afdc3d6d18 | ||
|
|
26cb32612d | ||
|
|
6a710c3cc3 | ||
|
|
7028e07535 | ||
|
|
6666bdfda9 | ||
|
|
3e57f150bc | ||
|
|
a50b3181ad | ||
|
|
de992452ee | ||
|
|
4cddc3d0df | ||
|
|
241d96e9fa | ||
|
|
8ae6e785f3 | ||
|
|
1c34c354cf | ||
|
|
0f02553d12 | ||
|
|
3f5cfc8fa2 | ||
|
|
0097840e32 | ||
|
|
082b615e50 | ||
|
|
62cbd87e71 | ||
|
|
72453c49f8 | ||
|
|
66ea277045 | ||
|
|
40a93d92c8 | ||
|
|
7df701b434 | ||
|
|
d760790643 | ||
|
|
1ed8383c33 | ||
|
|
d139f2fe87 | ||
|
|
20a8da0683 | ||
|
|
ff018b975b | ||
|
|
fcd657040e | ||
|
|
605f982520 | ||
|
|
fb1c66fbc9 | ||
|
|
d02fa7c268 | ||
|
|
5abe14982a | ||
|
|
8be9b109fd | ||
|
|
91147d5c5b | ||
|
|
08d4bd94fa | ||
|
|
76a92ac2e1 | ||
|
|
7c688de9cd | ||
|
|
93a45be181 | ||
|
|
d187c0025a | ||
|
|
4e9432263a | ||
|
|
0d4c3fd215 | ||
|
|
62aefadc27 | ||
|
|
6e0d0e3832 | ||
|
|
798e870e71 | ||
|
|
6a63a38e8d | ||
|
|
9199a1ba81 | ||
|
|
ac1e20b188 | ||
|
|
ad9fb4d530 | ||
|
|
ffc2455bea | ||
|
|
0a818191c1 | ||
|
|
c7ec3159ea | ||
|
|
4d5a7ec39f | ||
|
|
13c074f8b8 | ||
|
|
088a87914f | ||
|
|
5110dcb912 | ||
|
|
64748cf1f1 | ||
|
|
4ba4b2976e | ||
|
|
06183ba01a | ||
|
|
539ae37553 | ||
|
|
8f41d170a5 | ||
|
|
d9e97a7c1f | ||
|
|
51fe071c5e | ||
|
|
c5cab3004f | ||
|
|
9c62514c1b | ||
|
|
0428a97e00 | ||
|
|
43a2c21d87 | ||
|
|
69862bc6df | ||
|
|
388e7c88df | ||
|
|
9348bd6ea5 | ||
|
|
0c1d0f7498 | ||
|
|
81ba070e1a | ||
|
|
a7812657f1 | ||
|
|
bd5f77dbeb | ||
|
|
d862a6f075 | ||
|
|
18725c47a0 | ||
|
|
59b8c8ad48 | ||
|
|
494ff44a69 | ||
|
|
5efc6bdd2f | ||
|
|
4835758293 | ||
|
|
d0bb3a7354 | ||
|
|
14df925aa6 | ||
|
|
350f84913a | ||
|
|
78ab2e33ef | ||
|
|
75e1b70584 | ||
|
|
1dc73935d9 | ||
|
|
7d7b43c5b9 | ||
|
|
a4d63ab9a3 | ||
|
|
c009c5f43a | ||
|
|
9d56bb952e | ||
|
|
84abf28cec | ||
|
|
cad82d12d2 | ||
|
|
1846ed75bf | ||
|
|
0a6bb06f86 | ||
|
|
a10402a788 | ||
|
|
5da0cc138f | ||
|
|
2145207ad2 | ||
|
|
f086dfd8ca | ||
|
|
26cfc29303 | ||
|
|
10d1cbd3ce | ||
|
|
1299fdb7be | ||
|
|
430347a295 | ||
|
|
960354b16c | ||
|
|
481e08b904 | ||
|
|
76ce4705e2 | ||
|
|
7a5bb99d87 | ||
|
|
11d7a4c9f7 | ||
|
|
9dd63db736 | ||
|
|
f74922db39 | ||
|
|
605aa37ad3 | ||
|
|
262cebb568 | ||
|
|
bfa81490c1 | ||
|
|
219f0dfeca | ||
|
|
3a50a0b715 | ||
|
|
b25662e183 | ||
|
|
47a86f8771 | ||
|
|
07696d4bd1 | ||
|
|
52e97fe115 | ||
|
|
58033f3255 | ||
|
|
ba4773a61e | ||
|
|
977e6a02f4 | ||
|
|
6a53ddef21 | ||
|
|
2fb9c0ec0d | ||
|
|
98c3e2f93f | ||
|
|
fb4568001d | ||
|
|
5eab32a65b | ||
|
|
483221e2a8 | ||
|
|
2e575dee52 | ||
|
|
058c7d6c13 | ||
|
|
630cecd740 | ||
|
|
4d29cffde5 | ||
|
|
c6116e367a | ||
|
|
b6e6cecf70 | ||
|
|
ce15852b9a | ||
|
|
7c34a3676d | ||
|
|
1c92c7476b | ||
|
|
80e124f53e | ||
|
|
48cec94505 | ||
|
|
26c1fa07c9 | ||
|
|
78a6774206 | ||
|
|
3b812f2570 | ||
|
|
2e15207d0b | ||
|
|
716013633e | ||
|
|
1ca91c49aa | ||
|
|
7de629a8c3 | ||
|
|
592359ef49 | ||
|
|
a56d727c26 | ||
|
|
0b2781f42e | ||
|
|
b5223a4efb | ||
|
|
fe43e0994f | ||
|
|
d71c2c245f | ||
|
|
f85d2d3423 | ||
|
|
3859c010f0 | ||
|
|
526729c0f1 | ||
|
|
1cd3369f6a | ||
|
|
418b1eaf78 | ||
|
|
c26ae553e6 | ||
|
|
e0ac7b7f9f | ||
|
|
8d78698d00 | ||
|
|
d5c189753a | ||
|
|
9861e7a0c4 | ||
|
|
6d5fa9205c | ||
|
|
0fee7804fb | ||
|
|
80d1e07908 | ||
|
|
f72f5c7321 | ||
|
|
a5d483fb5d | ||
|
|
26a7cef0d8 | ||
|
|
53354a1930 | ||
|
|
c052b7fa99 | ||
|
|
9ecd38911e | ||
|
|
4002dbaa8b | ||
|
|
57e32a7912 | ||
|
|
b6a72d6e4e | ||
|
|
6e592ed200 | ||
|
|
637f39f282 | ||
|
|
842df8a799 | ||
|
|
6c033fc776 | ||
|
|
2ff84ab25a | ||
|
|
01c6fd03b7 | ||
|
|
b139e5bb00 | ||
|
|
7c4362db53 | ||
|
|
3c0d6339bb | ||
|
|
a0cfe22501 | ||
|
|
0dc959d9fe | ||
|
|
f7bf9ede72 | ||
|
|
ecdd9a4d6e |
@@ -58,7 +58,7 @@ before_script:
|
||||
- echo "USE $MYSQL_DATABASE; SHOW TABLES;" | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host="$DB_HOST" "$MYSQL_DATABASE"
|
||||
# Run the actual tests
|
||||
- touch dbfail.out
|
||||
- vendor/bin/phpunit --configuration tests/phpunit.xml --verbose --stop-on-error --coverage-text --colors=never --log-junit tests/results/junit.xml || exit_code=$?
|
||||
- vendor/bin/phpunit --configuration tests/phpunit.xml --no-progress --stop-on-error --coverage-text --colors=never --log-junit tests/results/junit.xml || exit_code=$?
|
||||
- if [ $exit_code -ne 0 ]; then echo "Test barfed!"; cat dbfail.out; exit $exit_code; fi
|
||||
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
|
||||
|
||||
@@ -83,7 +83,7 @@ before_script:
|
||||
- psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "\dt;"
|
||||
# Run the actual tests
|
||||
- touch dbfail.out
|
||||
- vendor/bin/phpunit --configuration tests/phpunit.xml --verbose --stop-on-error --coverage-text --colors=never --log-junit tests/results/junit.xml || exit_code=$?
|
||||
- vendor/bin/phpunit --configuration tests/phpunit.xml --no-progress --stop-on-error --coverage-text --colors=never --log-junit tests/results/junit.xml || exit_code=$?
|
||||
- if [ $exit_code -ne 0 ]; then echo "Test barfed!"; cat dbfail.out; exit $exit_code; fi
|
||||
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
|
||||
|
||||
|
||||
78
.phpcs.xml
Normal file
78
.phpcs.xml
Normal file
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
name="PHP_CodeSniffer"
|
||||
xsi:noNamespaceSchemaLocation="phpcs.xsd"
|
||||
>
|
||||
|
||||
<description>PHP CodeSniffer config for Hubzilla</description>
|
||||
|
||||
<file>app</file>
|
||||
<file>boot.php</file>
|
||||
<file>include</file>
|
||||
<file>index.php</file>
|
||||
<file>install</file>
|
||||
<file>library</file>
|
||||
<file>tests</file>
|
||||
<file>util</file>
|
||||
<file>view</file>
|
||||
<file>Zotlabs</file>
|
||||
|
||||
<rule ref="Generic">
|
||||
<exclude name="Generic.Arrays.ArrayIndent"/>
|
||||
<exclude name="Generic.Arrays.DisallowLongArraySyntax"/>
|
||||
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
|
||||
<exclude name="Generic.Files.EndFileNoNewline"/>
|
||||
<exclude name="Generic.Files.LowercasedFilename"/>
|
||||
<exclude name="Generic.Formatting.MultipleStatementAlignment"/>
|
||||
<exclude name="Generic.Formatting.SpaceAfterNot"/>
|
||||
<exclude name="Generic.Functions.FunctionCallArgumentSpacing"/>
|
||||
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
|
||||
<exclude name="Generic.NamingConventions.CamelCapsFunctionName"/>
|
||||
<exclude name="Generic.PHP.ClosingPHPTag"/>
|
||||
<exclude name="Generic.PHP.RequireStrictTypes"/>
|
||||
<exclude name="Generic.PHP.UpperCaseConstant"/>
|
||||
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||
<exclude name="Generic.WhiteSpace.ScopeIndent"/>
|
||||
<exclude name="Generic.Commenting.DocComment.ContentAfterOpen"/>
|
||||
<exclude name="Generic.Commenting.DocComment.ContentBeforeClose"/>
|
||||
<exclude name="Generic.Commenting.DocComment.LongNotCapital"/>
|
||||
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
|
||||
<exclude name="Generic.Commenting.DocComment.NonParamGroup"/>
|
||||
<exclude name="Generic.Commenting.DocComment.ParamNotFirst"/>
|
||||
<exclude name="Generic.Commenting.DocComment.ShortNotCapital"/>
|
||||
<exclude name="Generic.Commenting.DocComment.SpacingAfter"/>
|
||||
<exclude name="Generic.Commenting.DocComment.SpacingBeforeShort"/>
|
||||
<exclude name="Generic.Commenting.DocComment.TagValueIndent"/>
|
||||
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed"/>
|
||||
<exclude name="Generic.Files.OneClassPerFile.MultipleFound"/>
|
||||
<exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound"/>
|
||||
<exclude name="Generic.Formatting.SpaceAfterCast.NoSpace"/>
|
||||
</rule>
|
||||
|
||||
<!--
|
||||
Warn about lines longer than 100 columns, lines longer than 150
|
||||
columns will flag an error.
|
||||
-->
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<properties>
|
||||
<property name="lineLimit" value="100" />
|
||||
<property name="absoluteLineLimit" value="150" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!--
|
||||
Mark deprecated functions.
|
||||
-->
|
||||
<rule ref="Generic.PHP.DeprecatedFunctions">
|
||||
<properties>
|
||||
<property name="forbiddenFunctions" type="array" extend="true">
|
||||
<element key="load_config" value="Zotlabs\Lib\Config::Load" />
|
||||
<element key="get_config" value="Zotlabs\Lib\Config::Get" />
|
||||
<element key="set_config" value="Zotlabs\Lib\Config::Set" />
|
||||
<element key="del_config" value="Zotlabs\Lib\Config::Delete" />
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
</ruleset>
|
||||
133
CHANGELOG
133
CHANGELOG
@@ -1,3 +1,136 @@
|
||||
Hubzilla 9.4 (2024-09-25)
|
||||
- If we got an ocap token try to authenticate with it first
|
||||
- Hide comment titles
|
||||
- Adjust fix_attached_permissions() to only add the token if we got one
|
||||
- Allow uploading to comments if ocap tokens are enabled
|
||||
- Refactor get_security_ids() to remove legacy code
|
||||
- Add privacy scope sql to item_permissions_sql()
|
||||
- Removed fork awesome in favour of bootstrap icons
|
||||
- Improved content and comment collapse/expand rendering
|
||||
- Add support for inbound locations
|
||||
- Streamline item location rendering (use icon)
|
||||
- Fix html2bbcode table and add test
|
||||
- Store info/notice messages in xconfig instead of session
|
||||
- Refactor help and add tests
|
||||
- Do not run set_linkified_perms() if editing a post
|
||||
- Remove deprecated tag_deliver permissions
|
||||
- Make sure that tgroup_check() fails for group posts if they do not have the post_wall permission
|
||||
- Show repeat button to channel owners only
|
||||
- Refactor item buttons
|
||||
- Add util/update_db
|
||||
- Remove the unused f argument in various places
|
||||
- Streamline URLs used in attachments and body to ease deduplication
|
||||
- Code cleanup and remove some unused/deprecated functions
|
||||
|
||||
Bugfixes
|
||||
- Fix broken help pages search
|
||||
- Fix notes app not displaying anything - issue #1865
|
||||
|
||||
Addons
|
||||
- Cards: fix decoding issue when editing and minor cleanup
|
||||
- Articles: fix decoding issue when editing and minor cleanup
|
||||
- Wiki: fix markdown content not unescaped when undoing history - issue #1864
|
||||
- Gallery: update to photoswipe 5.4.4
|
||||
- Openstreemap: streamline location rendering
|
||||
- Socialauth: update version and contact details
|
||||
- Socialauth: fix rendering issue
|
||||
|
||||
Hubzilla 9.2.1 (2024-07-18)
|
||||
- Fix fatal error if gd function image{jpeg, png, webp}() does not exist for some reason
|
||||
- Add missing pdl for mod import
|
||||
- Escape queueworker json data
|
||||
- Fix missing object when repeating own posts
|
||||
- Improve display of system notifications in relation with page reloads
|
||||
- Add possibility to only display system notifications with notifications widget
|
||||
- Fix layout issue with socialauth addon
|
||||
- Save a db lookup if we have just reset notifications in sse addon
|
||||
- Fix php error if attachment was an empty string in pubcrawl addon
|
||||
|
||||
|
||||
Hubzilla 9.2 (2024-07-06)
|
||||
- Fail to import more gracefully if a channel has already been imported at some point but was deleted again
|
||||
- Use the doubleleft template by default for admin pages to work around some display issues
|
||||
- Reflect the censored state in the local xchan
|
||||
- Exclude toplevel posts by censored channels in the public stream
|
||||
- Update API docs for Module test case base class
|
||||
- Add helper expectRedirectTo to module test class
|
||||
- Refactor is_local_url() and add api doc
|
||||
- Use empty() to check if array entry exist in create_identity()
|
||||
- Add basic test for create_identity function
|
||||
- Allow passing callable as array to hooks
|
||||
- Use DbaTransaction class for db transactions in queueworker
|
||||
- Remove obsolete stubs from Permissions tests
|
||||
- Refactor mod rpost to fix open redirect issue and add tests
|
||||
- Configure system.baseurl for tests
|
||||
- Add basic test and fix session access for mod rpost
|
||||
- Add config file and rules for PHP Code Sniffer
|
||||
- Refactor mod setup
|
||||
- Pass the force argument to the xchan_photo daemon
|
||||
- Declare arg and return types for unparse_url()
|
||||
- Skip checking MFA status for WebDAV and CardDAV requests
|
||||
- Upgrade test framework to PHPUnit 10.5
|
||||
- Minor style update for the .abook-self CSS class
|
||||
- Update docs on tags and mentions.
|
||||
- Refactor and cleanup Rbmark module and add tests
|
||||
- Remove unused Toggle_(safesearch|mobile) modules
|
||||
- Make mod regate return to system.workflow_channel_next
|
||||
- Show register message field only if registration is set to register_approve
|
||||
- Add bbcode support for the HTML5 del tag
|
||||
- Rename HelpHelper to HelpHelperTrait
|
||||
- Remove jgrowl in favour of bootstrap toast
|
||||
- Refactor mod help
|
||||
- Reduce some global state and add some docs
|
||||
- Make save_chunk() deal with userfile and file array keys
|
||||
- Update siteinfo to remove traces of zotlabs.org
|
||||
- Minor refactor for in mod import and store import host for possible later use
|
||||
- Allow to kick off import sync process in case it did not start at all
|
||||
- Updated spanish translations
|
||||
|
||||
Bugfixes
|
||||
- Fix possible PHP error in zid()
|
||||
- Fix display issue for doubleleft template
|
||||
- Fix issue where event items were parsed multiple times on display
|
||||
- Fix return to blank page after editing post under some circumstances
|
||||
- Fix missing include in QueueWorker
|
||||
- Fix warnings exposed by tests
|
||||
- Fix timestamp handling in menu_create()
|
||||
- Fix updated arg not supported in pconfig wrapper function
|
||||
- Fix default timeouts for z_(fetch|post)_url
|
||||
- Fix hcard addon markup not available if profile entries were missing
|
||||
- Fix nested lists parsing
|
||||
- Fix help menu CSS
|
||||
- Fix get_rpost_path() broken for URL's with no port
|
||||
- Fix passing an empty filter to deliverable_abook_xchans() will return all deliverable abook xchans
|
||||
|
||||
Addons
|
||||
- Wiki: fix revert if editor is not ace
|
||||
- Wiki: do not slate deleted wiki pages for download
|
||||
- Pubcrawl: do not use mentions for addressing if post is restricted
|
||||
|
||||
|
||||
Hubzilla 9.0.2 (2024-06-07)
|
||||
- Fix buttons in event viewer
|
||||
- Fix some PHP warnings and errors
|
||||
- Fix issue when inReplyTo field is an array
|
||||
- Fix possible queueworker crash
|
||||
- Fix missing pdl file for mod home
|
||||
- Reduced default directory result set
|
||||
- Fix fatal error in likebanner addon
|
||||
- Fix fatal error in hilite addon
|
||||
|
||||
|
||||
Hubzilla 9.0.1 (2024-03-26)
|
||||
- Fix an issue where after an update initiated from a modal the modal backdrop would remain
|
||||
- Fix bootstrap namespace in conv list templates
|
||||
- Fix link to delivery report in conv list templates
|
||||
- Slightly improved handling of linefeeds in some bbcode block elements and added tests
|
||||
- Fix categories_widget() cache not being observer aware
|
||||
- Allow to run additional site specific commands at the end of util/udall in util/udall_extra
|
||||
- Fix linefeeds in table and list content removed
|
||||
- Pubcrawl: do not attrmpt to sign wall to wall messages - they will appear misattributed in mastodons
|
||||
- Pubcrawl: default to Note activity type for now
|
||||
|
||||
|
||||
Hubzilla 9.0 (2024-03-22)
|
||||
- Refactor browser to browser encryption based on sodium plus library
|
||||
- Added developer docs for the refactored test system
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Zotlabs\Access;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
/**
|
||||
* @brief PermissionRoles class.
|
||||
*
|
||||
@@ -247,7 +249,7 @@ class PermissionRoles {
|
||||
break;
|
||||
}
|
||||
|
||||
$x = get_config('system','role_perms');
|
||||
$x = Config::Get('system','role_perms');
|
||||
|
||||
// let system settings over-ride any or all
|
||||
if($x && is_array($x) && array_key_exists($role,$x))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Cache;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Cache_query {
|
||||
|
||||
@@ -11,16 +12,17 @@ class Cache_query {
|
||||
if(! $argc == 3)
|
||||
return;
|
||||
|
||||
$r = null;
|
||||
$key = $argv[1];
|
||||
|
||||
$pid = get_config('procid', $key, false);
|
||||
$pid = Config::Get('procid', $key, false);
|
||||
if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
|
||||
logger($key . ': procedure already run with pid ' . $pid, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
$pid = getmypid();
|
||||
set_config('procid', $key, $pid);
|
||||
Config::Set('procid', $key, $pid);
|
||||
|
||||
array_shift($argv);
|
||||
array_shift($argv);
|
||||
@@ -28,10 +30,12 @@ class Cache_query {
|
||||
$arr = json_decode(base64_decode($argv[0]), true);
|
||||
|
||||
$r = call_user_func_array('q', $arr);
|
||||
if($r)
|
||||
Cache::set($key, serialize($r));
|
||||
|
||||
del_config('procid', $key);
|
||||
if(is_array($r)) {
|
||||
Cache::set($key, serialize($r));
|
||||
}
|
||||
|
||||
Config::Delete('procid', $key);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/hubloc.php');
|
||||
|
||||
class Checksites {
|
||||
@@ -19,7 +21,7 @@ class Checksites {
|
||||
if ($site_id)
|
||||
$sql_options = " and site_url = '" . dbesc($argv[1]) . "' ";
|
||||
|
||||
$days = intval(get_config('system', 'sitecheckdays'));
|
||||
$days = intval(Config::Get('system', 'sitecheckdays'));
|
||||
if ($days < 1)
|
||||
$days = 30;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
|
||||
@@ -9,7 +10,7 @@ class Cron {
|
||||
|
||||
static public function run($argc, $argv) {
|
||||
|
||||
$maxsysload = intval(get_config('system', 'maxloadavg'));
|
||||
$maxsysload = intval(Config::Get('system', 'maxloadavg'));
|
||||
if ($maxsysload < 1)
|
||||
$maxsysload = 50;
|
||||
if (function_exists('sys_getloadavg')) {
|
||||
@@ -24,7 +25,7 @@ class Cron {
|
||||
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
|
||||
$lockfile = 'store/[data]/cron';
|
||||
if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))
|
||||
&& (!get_config('system', 'override_cron_lockfile'))) {
|
||||
&& (!Config::Get('system', 'override_cron_lockfile'))) {
|
||||
logger("cron: Already running");
|
||||
return;
|
||||
}
|
||||
@@ -41,7 +42,7 @@ class Cron {
|
||||
// Pull remote changes and push local changes.
|
||||
// potential issue: how do we keep from creating an endless update loop?
|
||||
|
||||
$dirmode = get_config('system', 'directory_mode');
|
||||
$dirmode = Config::Get('system', 'directory_mode');
|
||||
|
||||
if ($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
|
||||
Libzotdir::sync_directories($dirmode);
|
||||
@@ -64,7 +65,7 @@ class Cron {
|
||||
require_once('include/account.php');
|
||||
remove_expired_registrations();
|
||||
|
||||
$interval = get_config('queueworker', 'queue_interval', 500000);
|
||||
$interval = Config::Get('queueworker', 'queue_interval', 500000);
|
||||
|
||||
// expire any expired items
|
||||
|
||||
@@ -124,13 +125,13 @@ class Cron {
|
||||
$r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
|
||||
intval(PHOTO_CACHE),
|
||||
db_utcnow(),
|
||||
db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
|
||||
db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
|
||||
);
|
||||
if ($r) {
|
||||
q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
|
||||
intval(PHOTO_CACHE),
|
||||
db_utcnow(),
|
||||
db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
|
||||
db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
|
||||
);
|
||||
foreach ($r as $rr) {
|
||||
$file = dbunescbin($rr['content']);
|
||||
@@ -185,13 +186,13 @@ class Cron {
|
||||
// FIXME: add birthday updates, both locally and for xprof for use
|
||||
// by directory servers
|
||||
|
||||
$d1 = intval(get_config('system', 'last_expire_day'));
|
||||
$d1 = intval(Config::Get('system', 'last_expire_day'));
|
||||
$d2 = intval(datetime_convert('UTC', 'UTC', 'now', 'd'));
|
||||
|
||||
// Allow somebody to staggger daily activities if they have more than one site on their server,
|
||||
// or if it happens at an inconvenient (busy) hour.
|
||||
|
||||
$h1 = intval(get_config('system', 'cron_hour'));
|
||||
$h1 = intval(Config::Get('system', 'cron_hour'));
|
||||
$h2 = intval(datetime_convert('UTC', 'UTC', 'now', 'G'));
|
||||
|
||||
|
||||
@@ -225,7 +226,7 @@ class Cron {
|
||||
|
||||
// pull in some public posts if allowed
|
||||
|
||||
$disable_externals = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false || get_config('system', 'site_firehose');
|
||||
$disable_externals = Config::Get('system', 'disable_discover_tab') || Config::Get('system', 'disable_discover_tab') === false || Config::Get('system', 'site_firehose');
|
||||
if (!$disable_externals)
|
||||
Master::Summon(['Externals']);
|
||||
|
||||
@@ -245,7 +246,7 @@ class Cron {
|
||||
if (!$restart)
|
||||
Master::Summon(array('Cronhooks'));
|
||||
|
||||
set_config('system', 'lastcron', datetime_convert());
|
||||
Config::Set('system', 'lastcron', datetime_convert());
|
||||
|
||||
//All done - clear the lockfile
|
||||
//@unlink($lockfile);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
|
||||
class Cron_daily {
|
||||
@@ -68,7 +69,7 @@ class Cron_daily {
|
||||
// Clean up cache
|
||||
q("DELETE FROM cache WHERE updated < %s - INTERVAL %s",
|
||||
db_utcnow(),
|
||||
db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
|
||||
db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
|
||||
);
|
||||
|
||||
//update statistics in config
|
||||
@@ -82,7 +83,7 @@ class Cron_daily {
|
||||
|
||||
// expire old delivery reports
|
||||
|
||||
$keep_reports = intval(get_config('system', 'expire_delivery_reports'));
|
||||
$keep_reports = intval(Config::Get('system', 'expire_delivery_reports'));
|
||||
if ($keep_reports === 0)
|
||||
$keep_reports = 10;
|
||||
|
||||
@@ -103,7 +104,7 @@ class Cron_daily {
|
||||
$date = datetime_convert();
|
||||
call_hooks('cron_daily', $date);
|
||||
|
||||
set_config('system', 'last_expire_day', intval(datetime_convert('UTC', 'UTC', 'now', 'd')));
|
||||
Config::Set('system', 'last_expire_day', intval(datetime_convert('UTC', 'UTC', 'now', 'd')));
|
||||
|
||||
/**
|
||||
* End Cron Daily
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Cron_weekly {
|
||||
|
||||
static public function run($argc, $argv) {
|
||||
@@ -44,7 +46,7 @@ class Cron_weekly {
|
||||
db_utcnow(), db_quoteinterval('14 DAY')
|
||||
);
|
||||
|
||||
$dirmode = intval(get_config('system', 'directory_mode'));
|
||||
$dirmode = intval(Config::Get('system', 'directory_mode'));
|
||||
if ($dirmode === DIRECTORY_MODE_SECONDARY || $dirmode === DIRECTORY_MODE_PRIMARY) {
|
||||
logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())), true));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
use Zotlabs\Lib\Queue;
|
||||
@@ -25,7 +26,7 @@ class Directory {
|
||||
|
||||
logger('directory update', LOGGER_DEBUG);
|
||||
|
||||
$dirmode = get_config('system', 'directory_mode');
|
||||
$dirmode = Config::Get('system', 'directory_mode');
|
||||
if ($dirmode === false)
|
||||
$dirmode = DIRECTORY_MODE_NORMAL;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/items.php');
|
||||
|
||||
class Expire {
|
||||
@@ -10,14 +12,14 @@ class Expire {
|
||||
|
||||
cli_startup();
|
||||
|
||||
$pid = get_config('procid', 'expire', false);
|
||||
$pid = Config::Get('procid', 'expire', false);
|
||||
if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
|
||||
logger('procedure already run with pid ' . $pid, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
$pid = getmypid();
|
||||
set_config('procid', 'expire', $pid);
|
||||
Config::Set('procid', 'expire', $pid);
|
||||
|
||||
// perform final cleanup on previously delete items
|
||||
|
||||
@@ -38,13 +40,13 @@ class Expire {
|
||||
db_quoteinterval('36 DAY')
|
||||
);
|
||||
|
||||
if (intval(get_config('system', 'optimize_items')))
|
||||
if (intval(Config::Get('system', 'optimize_items')))
|
||||
q("optimize table item");
|
||||
|
||||
logger('expire: start with pid ' . $pid, LOGGER_DEBUG);
|
||||
|
||||
$site_expire = intval(get_config('system', 'default_expire_days', 30));
|
||||
$commented_days = intval(get_config('system', 'active_expire_days', 7));
|
||||
$site_expire = intval(Config::Get('system', 'default_expire_days', 30));
|
||||
$commented_days = intval(Config::Get('system', 'active_expire_days', 7));
|
||||
|
||||
logger('site_expire: ' . $site_expire);
|
||||
|
||||
@@ -84,7 +86,7 @@ class Expire {
|
||||
|
||||
// this should probably just fetch the channel_expire_days from the sys channel,
|
||||
// but there's no convenient way to set it.
|
||||
$expire_days = get_config('system', 'sys_expire_days');
|
||||
$expire_days = Config::Get('system', 'sys_expire_days');
|
||||
if ($expire_days === false)
|
||||
$expire_days = 30;
|
||||
|
||||
@@ -101,7 +103,7 @@ class Expire {
|
||||
logger('Expire: sys: done', LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
del_config('procid', 'expire');
|
||||
Config::Delete('procid', 'expire');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class Master {
|
||||
return;
|
||||
}
|
||||
|
||||
$phpbin = get_config('system', 'phpbin', 'php');
|
||||
$phpbin = Config::Get('system', 'phpbin', 'php');
|
||||
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', $arr);
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Lib\Activity;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Lib\Queue;
|
||||
|
||||
require_once('include/html2plain.php');
|
||||
@@ -668,7 +669,7 @@ class Notifier {
|
||||
);
|
||||
|
||||
// only create delivery reports for normal undeleted items
|
||||
if (is_array($target_item) && (!$target_item['item_deleted']) && (!get_config('system', 'disable_dreport'))) {
|
||||
if (is_array($target_item) && (!$target_item['item_deleted']) && (!Config::Get('system', 'disable_dreport'))) {
|
||||
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
|
||||
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
|
||||
dbesc($target_item['mid']),
|
||||
@@ -698,7 +699,7 @@ class Notifier {
|
||||
do_delivery(self::$deliveries);
|
||||
}
|
||||
|
||||
if ($dead_hosts && is_array($target_item) && (!$target_item['item_deleted']) && (!get_config('system', 'disable_dreport'))) {
|
||||
if ($dead_hosts && is_array($target_item) && (!$target_item['item_deleted']) && (!Config::Get('system', 'disable_dreport'))) {
|
||||
foreach ($dead_hosts as $deceased_host) {
|
||||
$r = q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
|
||||
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Zotlabs\Daemon;
|
||||
use Zotlabs\Lib\Activity;
|
||||
use Zotlabs\Lib\ActivityStreams;
|
||||
use Zotlabs\Lib\ASCollection;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
@@ -25,7 +26,7 @@ class Onepoll {
|
||||
}
|
||||
|
||||
$sql_extra = '';
|
||||
$allow_feeds = get_config('system', 'feed_contacts');
|
||||
$allow_feeds = Config::Get('system', 'feed_contacts');
|
||||
if(!$allow_feeds) {
|
||||
$sql_extra = ' and abook_feed = 0 ';
|
||||
}
|
||||
@@ -125,7 +126,7 @@ class Onepoll {
|
||||
|
||||
if ($fetch_feed) {
|
||||
|
||||
$max = intval(get_config('system', 'max_imported_posts', 30));
|
||||
$max = intval(Config::Get('system', 'max_imported_posts', 30));
|
||||
|
||||
if (intval($max)) {
|
||||
$cl = Activity::get_actor_collections($contact['abook_xchan']);
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Poller {
|
||||
|
||||
static public function run($argc, $argv) {
|
||||
|
||||
$maxsysload = intval(get_config('system', 'maxloadavg'));
|
||||
$maxsysload = intval(Config::Get('system', 'maxloadavg'));
|
||||
if ($maxsysload < 1)
|
||||
$maxsysload = 50;
|
||||
if (function_exists('sys_getloadavg')) {
|
||||
@@ -17,7 +19,7 @@ class Poller {
|
||||
}
|
||||
}
|
||||
|
||||
$interval = get_config('queueworker', 'queue_interval', 500000);
|
||||
$interval = Config::Get('queueworker', 'queue_interval', 500000);
|
||||
|
||||
logger('poller: start');
|
||||
|
||||
@@ -43,13 +45,13 @@ class Poller {
|
||||
reload_plugins();
|
||||
|
||||
// Only poll from those with suitable relationships
|
||||
$abandon_days = intval(get_config('system', 'account_abandon_days', 0));
|
||||
$abandon_days = intval(Config::Get('system', 'account_abandon_days', 0));
|
||||
$abandon_sql = (($abandon_days)
|
||||
? sprintf(" AND account_lastlog > %s - INTERVAL %s ", db_utcnow(), db_quoteinterval(intval($abandon_days) . ' DAY'))
|
||||
: ''
|
||||
);
|
||||
|
||||
$allow_feeds = get_config('system', 'feed_contacts');
|
||||
$allow_feeds = Config::Get('system', 'feed_contacts');
|
||||
if(!$allow_feeds) {
|
||||
$sql_extra .= ' and abook_feed = 0 ';
|
||||
}
|
||||
@@ -81,7 +83,7 @@ class Poller {
|
||||
if (intval($contact['abook_feed'])) {
|
||||
$min = service_class_fetch($contact['abook_channel'], 'minimum_feedcheck_minutes');
|
||||
if (!$min)
|
||||
$min = intval(get_config('system', 'minimum_feedcheck_minutes'));
|
||||
$min = intval(Config::Get('system', 'minimum_feedcheck_minutes'));
|
||||
if (!$min)
|
||||
$min = 60;
|
||||
|
||||
@@ -167,7 +169,7 @@ class Poller {
|
||||
}
|
||||
}
|
||||
|
||||
$dirmode = intval(get_config('system', 'directory_mode'));
|
||||
$dirmode = intval(Config::Get('system', 'directory_mode'));
|
||||
|
||||
if ($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
|
||||
$r = q("SELECT * FROM updates WHERE ud_update = 1 AND (ud_last = '%s' OR ud_last > %s - INTERVAL %s)",
|
||||
@@ -195,7 +197,7 @@ class Poller {
|
||||
}
|
||||
}
|
||||
|
||||
set_config('system', 'lastpoll', datetime_convert());
|
||||
Config::Set('system', 'lastpoll', datetime_convert());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Thumbnail {
|
||||
|
||||
@@ -19,9 +20,9 @@ class Thumbnail {
|
||||
|
||||
$attach = $c[0];
|
||||
|
||||
$preview_style = intval(get_config('system', 'thumbnail_security', 0));
|
||||
$preview_width = intval(get_config('system', 'thumbnail_width', 300));
|
||||
$preview_height = intval(get_config('system', 'thumbnail_height', 300));
|
||||
$preview_style = intval(Config::Get('system', 'thumbnail_security', 0));
|
||||
$preview_width = intval(Config::Get('system', 'thumbnail_width', 300));
|
||||
$preview_height = intval(Config::Get('system', 'thumbnail_height', 300));
|
||||
|
||||
$p = [
|
||||
'attach' => $attach,
|
||||
|
||||
@@ -8,14 +8,15 @@ class Xchan_photo {
|
||||
|
||||
static public function run($argc, $argv) {
|
||||
|
||||
if ($argc != 3) {
|
||||
if ($argc < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
$url = hex2bin($argv[1]);
|
||||
$xchan = hex2bin($argv[2]);
|
||||
$force = $argv[3];
|
||||
|
||||
$photos = import_xchan_photo($url, $xchan);
|
||||
$photos = import_xchan_photo($url, $xchan, false, $force);
|
||||
if ($photos) {
|
||||
$result = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
|
||||
dbescdate(datetime_convert()),
|
||||
@@ -27,8 +28,10 @@ class Xchan_photo {
|
||||
);
|
||||
|
||||
if (! $result) {
|
||||
logger("xchan update failed for $url");
|
||||
logger("xchan photo update failed for $url");
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Extend;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Route {
|
||||
|
||||
@@ -38,11 +39,11 @@ class Route {
|
||||
}
|
||||
|
||||
static function get() {
|
||||
return get_config('system','routes',[]);
|
||||
return Config::Get('system','routes',[]);
|
||||
}
|
||||
|
||||
static function set($r) {
|
||||
return set_config('system','routes',$r);
|
||||
return Config::Set('system','routes',$r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Extend;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Widget {
|
||||
|
||||
@@ -38,10 +39,10 @@ class Widget {
|
||||
}
|
||||
|
||||
static function get() {
|
||||
return get_config('system','widgets',[]);
|
||||
return Config::Get('system','widgets',[]);
|
||||
}
|
||||
|
||||
static function set($r) {
|
||||
return set_config('system','widgets',$r);
|
||||
return Config::Set('system','widgets',$r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Zotlabs\Identity;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class OAuth2Server extends \OAuth2\Server {
|
||||
|
||||
public function __construct(OAuth2Storage $storage, $config = null) {
|
||||
@@ -24,8 +26,8 @@ class OAuth2Server extends \OAuth2\Server {
|
||||
|
||||
$keyStorage = new \OAuth2\Storage\Memory( [
|
||||
'keys' => [
|
||||
'public_key' => get_config('system', 'pubkey'),
|
||||
'private_key' => get_config('system', 'prvkey')
|
||||
'public_key' => Config::Get('system', 'pubkey'),
|
||||
'private_key' => Config::Get('system', 'prvkey')
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class Activity {
|
||||
}
|
||||
|
||||
if ($items) {
|
||||
return self::encode_item(array_shift($items), true);
|
||||
return self::encode_item(array_shift($items));
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -762,7 +762,12 @@ class Activity {
|
||||
$ptr = [$ptr];
|
||||
}
|
||||
foreach ($ptr as $att) {
|
||||
if (!is_array($att)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$entry = [];
|
||||
|
||||
if (array_key_exists('href', $att) && $att['href']) {
|
||||
$entry['href'] = $att['href'];
|
||||
} elseif (array_key_exists('url', $att) && $att['url']) {
|
||||
@@ -1085,12 +1090,16 @@ class Activity {
|
||||
|
||||
static function encode_person($p, $extended = true) {
|
||||
|
||||
$ret = (($extended) ? [] : '');
|
||||
|
||||
if (!is_array($p)) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$c = ((array_key_exists('channel_id', $p)) ? $p : channelx_by_hash($p['xchan_hash']));
|
||||
|
||||
$id = (($c) ? channel_url($c) : ((filter_var($p['xchan_hash'], FILTER_VALIDATE_URL)) ? $p['xchan_hash'] : $p['xchan_url']));
|
||||
|
||||
$ret = (($extended) ? [] : '');
|
||||
|
||||
if (!$id) {
|
||||
return $ret;
|
||||
}
|
||||
@@ -1727,9 +1736,12 @@ class Activity {
|
||||
foreach ($links as $link) {
|
||||
if (is_array($link) && array_key_exists('mediaType', $link) && $link['mediaType'] === 'text/html') {
|
||||
$profile = $link['href'];
|
||||
} elseif (is_string($link)) {
|
||||
$profile = $link;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$profile) {
|
||||
if (!$profile && isset($links[0]['href'])) {
|
||||
$profile = $links[0]['href'];
|
||||
}
|
||||
}
|
||||
@@ -1863,7 +1875,7 @@ class Activity {
|
||||
}
|
||||
|
||||
if ($icon) {
|
||||
Master::Summon(['Xchan_photo', bin2hex($icon), bin2hex($url)]);
|
||||
Master::Summon(['Xchan_photo', bin2hex($icon), bin2hex($url), $force]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2104,6 +2116,13 @@ class Activity {
|
||||
$s['expires'] = datetime_convert('UTC', 'UTC', $act->obj['expires']);
|
||||
}
|
||||
|
||||
if ($act->objprop('location')) {
|
||||
$s['location'] = ((isset($act->objprop('location')['name'])) ? html2plain(purify_html($act->objprop('location')['name'])) : '');
|
||||
if (isset($act->objprop('location')['latitude'], $act->objprop('location')['longitude'])) {
|
||||
$s['coord'] = floatval($act->objprop('location')['latitude']) . ' ' . floatval($act->objprop('location')['longitude']);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($act->type, ['Invite', 'Create']) && $act->objprop('type') === 'Event') {
|
||||
$s['mid'] = $s['parent_mid'] = $act->id;
|
||||
}
|
||||
@@ -2890,7 +2909,7 @@ class Activity {
|
||||
|
||||
if (intval($parent[0]['item_private'])) {
|
||||
if (!intval($item['item_private'])) {
|
||||
$item['item_private'] = intval($parent_item['item_private']);
|
||||
$item['item_private'] = intval($parent[0]['item_private']);
|
||||
$item['allow_cid'] = '<' . $channel['channel_hash'] . '>';
|
||||
$item['allow_gid'] = $item['deny_cid'] = $item['deny_gid'] = '';
|
||||
}
|
||||
@@ -3259,7 +3278,7 @@ class Activity {
|
||||
return $content;
|
||||
}
|
||||
|
||||
if ($act['type'] === 'Event') {
|
||||
if (isset($act['type']) && $act['type'] === 'Event') {
|
||||
$adjust = false;
|
||||
$event = [];
|
||||
$event['event_hash'] = $act['id'];
|
||||
@@ -3452,7 +3471,7 @@ class Activity {
|
||||
$ret[$collection] = $actor_record[$collection];
|
||||
}
|
||||
}
|
||||
if (array_path_exists('endpoints/sharedInbox', $actor_record) && $actor_record['endpoints']['sharedInbox']) {
|
||||
if (!empty($actor_record['endpoints']['sharedInbox'])) {
|
||||
$ret['sharedInbox'] = $actor_record['endpoints']['sharedInbox'];
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ class ActivityStreams {
|
||||
|
||||
// Determine if this is a followup or response activity
|
||||
|
||||
$this->parent_id = $this->get_property_obj('inReplyTo');
|
||||
$this->parent_id = ((is_array($this->get_property_obj('inReplyTo'))) ? $this->get_property_obj('inReplyTo')['id'] : $this->get_property_obj('inReplyTo'));
|
||||
|
||||
if (!$this->parent_id && isset($this->obj['inReplyTo'])) {
|
||||
$this->parent_id = ((is_array($this->obj['inReplyTo'])) ? $this->obj['inReplyTo']['id'] : $this->obj['inReplyTo']);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/plugin.php');
|
||||
require_once('include/channel.php');
|
||||
@@ -65,7 +66,7 @@ class Apps {
|
||||
}
|
||||
|
||||
static public function get_base_apps() {
|
||||
$x = get_config('system','base_apps',[
|
||||
$x = Config::Get('system','base_apps',[
|
||||
'Connections',
|
||||
'Contact Roles',
|
||||
'Network',
|
||||
@@ -301,7 +302,7 @@ class Apps {
|
||||
break;
|
||||
default:
|
||||
if($config)
|
||||
$unset = ((get_config('system', $require[0]) == $require[1]) ? false : true);
|
||||
$unset = ((Config::Get('system', $require[0]) == $require[1]) ? false : true);
|
||||
else
|
||||
$unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true);
|
||||
if($unset)
|
||||
@@ -523,7 +524,7 @@ class Apps {
|
||||
break;
|
||||
default:
|
||||
if($config)
|
||||
$unset = ((get_config('system', $require[0]) === $require[1]) ? false : true);
|
||||
$unset = ((Config::Get('system', $require[0]) === $require[1]) ? false : true);
|
||||
else
|
||||
$unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true);
|
||||
if($unset)
|
||||
@@ -960,7 +961,7 @@ class Apps {
|
||||
|
||||
$conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
|
||||
|
||||
$x = (($uid) ? get_pconfig($uid,'system',$conf) : get_config('system',$conf));
|
||||
$x = (($uid) ? get_pconfig($uid,'system',$conf) : Config::Get('system',$conf));
|
||||
if(($x) && (! is_array($x))) {
|
||||
$y = explode(',',$x);
|
||||
$y = array_map('trim',$y);
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
/**
|
||||
* cache api
|
||||
*/
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
/**
|
||||
* cache api
|
||||
*/
|
||||
class Cache {
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,7 @@ class Cache {
|
||||
$r = q("SELECT v FROM cache WHERE k = '%s' AND updated > %s - INTERVAL %s LIMIT 1",
|
||||
dbesc($hash),
|
||||
db_utcnow(),
|
||||
db_quoteinterval(($age ? $age : get_config('system','object_cache_days', '30') . ' DAY'))
|
||||
db_quoteinterval(($age ? $age : Config::Get('system','object_cache_days', '30') . ' DAY'))
|
||||
);
|
||||
|
||||
if ($r)
|
||||
|
||||
@@ -115,7 +115,7 @@ class Config {
|
||||
* The category of the configuration value
|
||||
* @param string $key
|
||||
* The configuration key to query
|
||||
* @param string $default (optional) default false
|
||||
* @param mixed $default (optional) default false
|
||||
* @return mixed Return value or false on error or if not set
|
||||
*/
|
||||
public static function Get($family, $key, $default = false) {
|
||||
|
||||
@@ -5,8 +5,7 @@ namespace Zotlabs\Lib;
|
||||
use App;
|
||||
use Zotlabs\Access\Permissions;
|
||||
use Zotlabs\Daemon\Master;
|
||||
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Connect {
|
||||
|
||||
@@ -96,7 +95,7 @@ class Connect {
|
||||
$wf = discover_by_webbie($url,$protocol);
|
||||
|
||||
if (! $wf) {
|
||||
$feeds = get_config('system','feed_contacts');
|
||||
$feeds = Config::Get('system','feed_contacts');
|
||||
|
||||
if (($feeds) && (in_array($protocol, [ '', 'feed', 'rss' ]))) {
|
||||
$d = discover_by_url($url);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use Exception;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Crypto {
|
||||
|
||||
@@ -44,7 +45,7 @@ class Crypto {
|
||||
'encrypt_key' => false
|
||||
];
|
||||
|
||||
$conf = get_config('system', 'openssl_conf_file');
|
||||
$conf = Config::Get('system', 'openssl_conf_file');
|
||||
|
||||
if ($conf) {
|
||||
$openssl_options['config'] = $conf;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class DB_Upgrade {
|
||||
|
||||
@@ -13,9 +14,9 @@ class DB_Upgrade {
|
||||
$this->config_name = 'db_version';
|
||||
$this->func_prefix = '_';
|
||||
|
||||
$build = get_config('system', 'db_version', 0);
|
||||
$build = Config::Get('system', 'db_version', 0);
|
||||
if(! intval($build))
|
||||
$build = set_config('system', 'db_version', $db_revision);
|
||||
$build = Config::Set('system', 'db_version', $db_revision);
|
||||
|
||||
if($build == $db_revision) {
|
||||
// Nothing to be done.
|
||||
@@ -27,7 +28,7 @@ class DB_Upgrade {
|
||||
logger('Critical: check_config unable to determine database schema version');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$current = intval($db_revision);
|
||||
|
||||
if($stored < $current) {
|
||||
@@ -38,7 +39,7 @@ class DB_Upgrade {
|
||||
for($x = $stored + 1; $x <= $current; $x ++) {
|
||||
$s = '_' . $x;
|
||||
$cls = '\\Zotlabs\Update\\' . $s ;
|
||||
if(! class_exists($cls)) {
|
||||
if(! class_exists($cls)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,10 +53,10 @@ class DB_Upgrade {
|
||||
|
||||
Config::Load('database');
|
||||
|
||||
if(get_config('database', $s))
|
||||
if(Config::Get('database', $s))
|
||||
break;
|
||||
set_config('database',$s, '1');
|
||||
|
||||
Config::Set('database',$s, '1');
|
||||
|
||||
|
||||
$c = new $cls();
|
||||
|
||||
@@ -65,10 +66,10 @@ class DB_Upgrade {
|
||||
|
||||
|
||||
$source = t('Source code of failed update: ') . "\n\n" . @file_get_contents('Zotlabs/Update/' . $s . '.php');
|
||||
|
||||
|
||||
|
||||
// Prevent sending hundreds of thousands of emails by creating
|
||||
// a lockfile.
|
||||
// a lockfile.
|
||||
|
||||
$lockfile = 'store/[data]/mailsent';
|
||||
|
||||
@@ -77,7 +78,7 @@ class DB_Upgrade {
|
||||
@unlink($lockfile);
|
||||
//send the administrator an e-mail
|
||||
file_put_contents($lockfile, $x);
|
||||
|
||||
|
||||
$r = q("select account_language from account where account_email = '%s' limit 1",
|
||||
dbesc(\App::$config['system']['admin_email'])
|
||||
);
|
||||
@@ -86,7 +87,7 @@ class DB_Upgrade {
|
||||
[
|
||||
'toEmail' => \App::$config['system']['admin_email'],
|
||||
'messageSubject' => sprintf( t('Update Error at %s'), z_root()),
|
||||
'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
|
||||
'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
|
||||
[
|
||||
'$sitename' => \App::$config['system']['sitename'],
|
||||
'$siteurl' => z_root(),
|
||||
@@ -104,11 +105,11 @@ class DB_Upgrade {
|
||||
pop_lang();
|
||||
}
|
||||
else {
|
||||
set_config('database',$s, 'success');
|
||||
Config::Set('database',$s, 'success');
|
||||
}
|
||||
}
|
||||
}
|
||||
set_config('system', 'db_version', $db_revision);
|
||||
Config::Set('system', 'db_version', $db_revision);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class DReport {
|
||||
|
||||
private $location;
|
||||
@@ -70,7 +72,7 @@ class DReport {
|
||||
|
||||
static function is_storable($dr) {
|
||||
|
||||
if(get_config('system', 'disable_dreport'))
|
||||
if(Config::Get('system', 'disable_dreport'))
|
||||
return false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Zotlabs\Lib;
|
||||
* @brief File with functions and a class for generating system and email notifications.
|
||||
*/
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Enotify {
|
||||
|
||||
@@ -61,7 +62,7 @@ class Enotify {
|
||||
$product = t('$projectname'); // PLATFORM_NAME;
|
||||
$siteurl = z_root();
|
||||
$thanks = t('Thank You,');
|
||||
$sitename = get_config('system','sitename');
|
||||
$sitename = Config::Get('system','sitename');
|
||||
$site_admin = sprintf( t('%s Administrator'), $sitename);
|
||||
$opt_out1 = sprintf( t('This email was sent by %1$s at %2$s.'), t('$Projectname'), \App::get_hostname());
|
||||
$opt_out2 = sprintf( t('To stop receiving these messages, please adjust your Notification Settings at %s'), z_root() . '/settings');
|
||||
@@ -73,15 +74,15 @@ class Enotify {
|
||||
|
||||
// Do not translate 'noreply' as it must be a legal 7-bit email address
|
||||
|
||||
$reply_email = get_config('system', 'reply_address');
|
||||
$reply_email = Config::Get('system', 'reply_address');
|
||||
if(! $reply_email)
|
||||
$reply_email = 'noreply' . '@' . $hostname;
|
||||
|
||||
$sender_email = get_config('system', 'from_email');
|
||||
$sender_email = Config::Get('system', 'from_email');
|
||||
if(! $sender_email)
|
||||
$sender_email = 'Administrator' . '@' . $hostname;
|
||||
|
||||
$sender_name = get_config('system', 'from_email_name');
|
||||
$sender_name = Config::Get('system', 'from_email_name');
|
||||
if(! $sender_name)
|
||||
$sender_name = \Zotlabs\Lib\System::get_site_name();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Zotlabs\Lib;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Daemon\Master;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Libsync {
|
||||
|
||||
@@ -135,7 +136,7 @@ class Libsync {
|
||||
$info['collection_members'] = $r;
|
||||
}
|
||||
|
||||
$interval = get_config('queueworker', 'queue_interval', 500000);
|
||||
$interval = Config::Get('queueworker', 'queue_interval', 500000);
|
||||
|
||||
logger('Packet: ' . print_r($info, true), LOGGER_DATA, LOG_DEBUG);
|
||||
|
||||
@@ -157,7 +158,7 @@ class Libsync {
|
||||
/*
|
||||
$x = q("select count(outq_hash) as total from outq where outq_delivered = 0");
|
||||
|
||||
if (intval($x[0]['total']) > intval(get_config('system', 'force_queue_threshold', 3000))) {
|
||||
if (intval($x[0]['total']) > intval(Config::Get('system', 'force_queue_threshold', 3000))) {
|
||||
logger('immediate delivery deferred.', LOGGER_DEBUG, LOG_INFO);
|
||||
Queue::update($hash);
|
||||
continue;
|
||||
@@ -266,7 +267,7 @@ class Libsync {
|
||||
}
|
||||
|
||||
if ($cat !== 'hz_delpconfig') {
|
||||
set_pconfig($channel['channel_id'],$cat,$k,$v,$pconfig_updated[$k]);
|
||||
set_pconfig($channel['channel_id'], $cat, $k, $v, $pconfig_updated[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Web\HTTPSig;
|
||||
use Zotlabs\Access\Permissions;
|
||||
use Zotlabs\Access\PermissionLimits;
|
||||
use Zotlabs\Access\Permissions;
|
||||
use Zotlabs\Daemon\Master;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\HTTPSig;
|
||||
|
||||
require_once('include/crypto.php');
|
||||
|
||||
@@ -101,12 +102,12 @@ class Libzot {
|
||||
*/
|
||||
static function build_packet($channel, $type = 'activity', $recipients = null, $msg = [], $encoding = 'activitystreams', $remote_key = null, $methods = '') {
|
||||
|
||||
$sig_method = get_config('system', 'signature_algorithm', 'sha256');
|
||||
$sig_method = Config::Get('system', 'signature_algorithm', 'sha256');
|
||||
$data = [
|
||||
'type' => $type,
|
||||
'encoding' => $encoding,
|
||||
'sender' => $channel['channel_hash'],
|
||||
'site_id' => self::make_xchan_hash(z_root(), get_config('system', 'pubkey')),
|
||||
'site_id' => self::make_xchan_hash(z_root(), Config::Get('system', 'pubkey')),
|
||||
'version' => System::get_zot_revision(),
|
||||
];
|
||||
|
||||
@@ -661,7 +662,7 @@ class Libzot {
|
||||
*/
|
||||
call_hooks('import_xchan', $arr);
|
||||
|
||||
$dirmode = intval(get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL));
|
||||
$dirmode = intval(Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL));
|
||||
|
||||
$changed = false;
|
||||
$what = '';
|
||||
@@ -710,7 +711,7 @@ class Libzot {
|
||||
// if we import an entry from a site that's not ours and either or both of us is off the grid - hide the entry.
|
||||
/** @TODO: check if we're the same directory realm, which would mean we are allowed to see it */
|
||||
|
||||
$dirmode = get_config('system', 'directory_mode');
|
||||
$dirmode = Config::Get('system', 'directory_mode');
|
||||
|
||||
if (((isset($arr['site']['directory_mode']) && $arr['site']['directory_mode'] === 'standalone') || ($dirmode & DIRECTORY_MODE_STANDALONE)) && ($arr['site']['url'] != z_root()))
|
||||
$arr['searchable'] = false;
|
||||
@@ -1008,7 +1009,7 @@ class Libzot {
|
||||
logger('Headers: ' . print_r($arr['header'], true), LOGGER_DATA, LOG_DEBUG);
|
||||
}
|
||||
|
||||
$x = Crypto::unencapsulate($x, get_config('system', 'prvkey'));
|
||||
$x = Crypto::unencapsulate($x, Config::Get('system', 'prvkey'));
|
||||
|
||||
if ($x && !is_array($x)) {
|
||||
$x = json_decode($x, true);
|
||||
@@ -1416,7 +1417,7 @@ class Libzot {
|
||||
$include_sys = false;
|
||||
|
||||
if ($msg['type'] === 'activity') {
|
||||
$disable_discover_tab = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false;
|
||||
$disable_discover_tab = Config::Get('system', 'disable_discover_tab') || Config::Get('system', 'disable_discover_tab') === false;
|
||||
if (!$disable_discover_tab)
|
||||
$include_sys = true;
|
||||
|
||||
@@ -1632,8 +1633,8 @@ class Libzot {
|
||||
continue;
|
||||
}
|
||||
|
||||
$incl = get_config('system','pubstream_incl');
|
||||
$excl = get_config('system','pubstream_excl');
|
||||
$incl = Config::Get('system','pubstream_incl');
|
||||
$excl = Config::Get('system','pubstream_excl');
|
||||
|
||||
if(($incl || $excl) && !MessageFilter::evaluate($arr, $incl, $excl)) {
|
||||
$local_public = false;
|
||||
@@ -2568,9 +2569,14 @@ class Libzot {
|
||||
if (!$observer)
|
||||
return '';
|
||||
|
||||
$parsed = parse_url($observer['xchan_url']);
|
||||
$url = $observer['xchan_url'];
|
||||
if (preg_match('|^https?://|', $url) === 0) {
|
||||
$url = "https://{$url}";
|
||||
}
|
||||
|
||||
return $parsed['scheme'] . '://' . $parsed['host'] . (($parsed['port']) ? ':' . $parsed['port'] : '') . '/rpost?f=';
|
||||
$parsed = parse_url($url);
|
||||
|
||||
return $parsed['scheme'] . '://' . $parsed['host'] . (isset($parsed['port']) ? ':' . $parsed['port'] : '') . '/rpost?f=';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2924,8 +2930,8 @@ class Libzot {
|
||||
*/
|
||||
static function site_info() {
|
||||
|
||||
$signing_key = get_config('system', 'prvkey');
|
||||
$sig_method = get_config('system', 'signature_algorithm', 'sha256');
|
||||
$signing_key = Config::Get('system', 'prvkey');
|
||||
$sig_method = Config::Get('system', 'signature_algorithm', 'sha256');
|
||||
|
||||
$ret = [];
|
||||
$ret['site'] = [];
|
||||
@@ -2934,10 +2940,10 @@ class Libzot {
|
||||
$ret['site']['post'] = z_root() . '/zot';
|
||||
$ret['site']['openWebAuth'] = z_root() . '/owa';
|
||||
$ret['site']['authRedirect'] = z_root() . '/magic';
|
||||
$ret['site']['sitekey'] = get_config('system', 'pubkey');
|
||||
$ret['site']['sitekey'] = Config::Get('system', 'pubkey');
|
||||
$ret['site']['directory_mode'] = 'normal';
|
||||
|
||||
$dirmode = get_config('system', 'directory_mode');
|
||||
$dirmode = Config::Get('system', 'directory_mode');
|
||||
|
||||
if ($dirmode == DIRECTORY_MODE_PRIMARY)
|
||||
$ret['site']['directory_mode'] = 'primary';
|
||||
@@ -2956,7 +2962,7 @@ class Libzot {
|
||||
|
||||
if ($dirmode != DIRECTORY_MODE_STANDALONE) {
|
||||
|
||||
$register_policy = intval(get_config('system', 'register_policy'));
|
||||
$register_policy = intval(Config::Get('system', 'register_policy'));
|
||||
|
||||
if ($register_policy == REGISTER_CLOSED)
|
||||
$ret['site']['register_policy'] = 'closed';
|
||||
@@ -2966,7 +2972,7 @@ class Libzot {
|
||||
$ret['site']['register_policy'] = 'open';
|
||||
|
||||
|
||||
$access_policy = intval(get_config('system', 'access_policy'));
|
||||
$access_policy = intval(Config::Get('system', 'access_policy'));
|
||||
|
||||
if ($access_policy == ACCESS_PRIVATE)
|
||||
$ret['site']['access_policy'] = 'private';
|
||||
@@ -2982,7 +2988,7 @@ class Libzot {
|
||||
require_once('include/channel.php');
|
||||
$ret['site']['channels'] = channel_total();
|
||||
|
||||
$ret['site']['admin'] = get_config('system', 'admin_email');
|
||||
$ret['site']['admin'] = Config::Get('system', 'admin_email');
|
||||
|
||||
$visible_plugins = [];
|
||||
if (is_array(App::$plugins) && count(App::$plugins)) {
|
||||
@@ -2993,10 +2999,10 @@ class Libzot {
|
||||
}
|
||||
|
||||
$ret['site']['plugins'] = $visible_plugins;
|
||||
$ret['site']['sitehash'] = get_config('system', 'location_hash');
|
||||
$ret['site']['sitename'] = get_config('system', 'sitename');
|
||||
$ret['site']['sellpage'] = get_config('system', 'sellpage');
|
||||
$ret['site']['location'] = get_config('system', 'site_location');
|
||||
$ret['site']['sitehash'] = Config::Get('system', 'location_hash');
|
||||
$ret['site']['sitename'] = Config::Get('system', 'sitename');
|
||||
$ret['site']['sellpage'] = Config::Get('system', 'sellpage');
|
||||
$ret['site']['location'] = Config::Get('system', 'site_location');
|
||||
$ret['site']['realm'] = get_directory_realm();
|
||||
$ret['site']['project'] = System::get_platform_name();
|
||||
$ret['site']['version'] = System::get_project_version();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Lib\Zotfinger;
|
||||
use Zotlabs\Lib\Webfinger;
|
||||
@@ -20,7 +21,7 @@ class Libzotdir {
|
||||
|
||||
static function find_upstream_directory($dirmode) {
|
||||
|
||||
$preferred = get_config('system','directory_server');
|
||||
$preferred = Config::Get('system','directory_server');
|
||||
|
||||
// Thwart attempts to use a private directory
|
||||
|
||||
@@ -47,17 +48,17 @@ class Libzotdir {
|
||||
|
||||
$directory_fallback_servers = get_directory_fallback_servers();
|
||||
|
||||
$dirmode = intval(get_config('system','directory_mode'));
|
||||
$dirmode = intval(Config::Get('system','directory_mode'));
|
||||
if ($dirmode == DIRECTORY_MODE_NORMAL) {
|
||||
$toss = mt_rand(0,count($directory_fallback_servers));
|
||||
$preferred = $directory_fallback_servers[$toss];
|
||||
if(! $preferred) {
|
||||
$preferred = DIRECTORY_FALLBACK_MASTER;
|
||||
}
|
||||
set_config('system','directory_server',$preferred);
|
||||
Config::Set('system','directory_server',$preferred);
|
||||
}
|
||||
else {
|
||||
set_config('system','directory_server',z_root());
|
||||
Config::Set('system','directory_server',z_root());
|
||||
}
|
||||
}
|
||||
if($preferred) {
|
||||
@@ -77,7 +78,7 @@ class Libzotdir {
|
||||
|
||||
static function check_upstream_directory() {
|
||||
|
||||
$directory = get_config('system', 'directory_server');
|
||||
$directory = Config::Get('system', 'directory_server');
|
||||
|
||||
// it's possible there is no directory server configured and the local hub is being used.
|
||||
// If so, default to preserving the absence of a specific server setting.
|
||||
@@ -94,7 +95,7 @@ class Libzotdir {
|
||||
}
|
||||
|
||||
if (! $isadir)
|
||||
set_config('system', 'directory_server', '');
|
||||
Config::Set('system', 'directory_server', '');
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +107,7 @@ class Libzotdir {
|
||||
$ret = ((array_key_exists($setting,$_SESSION)) ? intval($_SESSION[$setting]) : false);
|
||||
|
||||
if($ret === false)
|
||||
$ret = get_config('directory', $setting);
|
||||
$ret = Config::Get('directory', $setting);
|
||||
|
||||
|
||||
// 'safemode' is the default if there is no observer or no established preference.
|
||||
@@ -114,7 +115,7 @@ class Libzotdir {
|
||||
if($setting === 'safemode' && $ret === false)
|
||||
$ret = 1;
|
||||
|
||||
if($setting === 'globaldir' && intval(get_config('system','localdir_hide')))
|
||||
if($setting === 'globaldir' && intval(Config::Get('system','localdir_hide')))
|
||||
$ret = 1;
|
||||
|
||||
return $ret;
|
||||
@@ -133,7 +134,7 @@ class Libzotdir {
|
||||
$globaldir = self::get_directory_setting($observer, 'globaldir');
|
||||
$pubforums = self::get_directory_setting($observer, 'pubforums');
|
||||
|
||||
$hide_local = intval(get_config('system','localdir_hide'));
|
||||
$hide_local = intval(Config::Get('system','localdir_hide'));
|
||||
if($hide_local)
|
||||
$globaldir = 1;
|
||||
|
||||
@@ -141,7 +142,7 @@ class Libzotdir {
|
||||
// Build urls without order and pubforums so it's easy to tack on the changed value
|
||||
// Probably there's an easier way to do this
|
||||
|
||||
$directory_sort_order = get_config('system','directory_sort_order');
|
||||
$directory_sort_order = Config::Get('system','directory_sort_order');
|
||||
if(! $directory_sort_order)
|
||||
$directory_sort_order = 'date';
|
||||
|
||||
@@ -232,7 +233,7 @@ class Libzotdir {
|
||||
if (! $r)
|
||||
return;
|
||||
|
||||
$dir_trusted_hosts = array_merge(get_directory_fallback_servers(), get_config('system', 'trusted_directory_servers', []));
|
||||
$dir_trusted_hosts = array_merge(get_directory_fallback_servers(), Config::Get('system', 'trusted_directory_servers', []));
|
||||
|
||||
foreach ($r as $rr) {
|
||||
if (! $rr['site_directory'])
|
||||
@@ -244,7 +245,7 @@ class Libzotdir {
|
||||
// It will take about a month for a new directory to obtain the full current repertoire of channels.
|
||||
/** @FIXME Go back and pick up earlier ratings if this is a new directory server. These do not get refreshed. */
|
||||
|
||||
$token = get_config('system','realm_token');
|
||||
$token = Config::Get('system','realm_token');
|
||||
|
||||
$syncdate = (($rr['site_sync'] <= NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']);
|
||||
$x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate) . (($token) ? '&t=' . $token : ''));
|
||||
@@ -696,7 +697,7 @@ class Libzotdir {
|
||||
|
||||
static function update($hash, $addr, $bump_date = true, $flag = null) {
|
||||
|
||||
$dirmode = intval(get_config('system', 'directory_mode'));
|
||||
$dirmode = intval(Config::Get('system', 'directory_mode'));
|
||||
|
||||
if($dirmode == DIRECTORY_MODE_NORMAL) {
|
||||
return;
|
||||
|
||||
@@ -117,7 +117,7 @@ class PermissionDescription {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an icon css class name if an appropriate one is available, e.g. "fa-globe" for Public,
|
||||
* Returns an icon css class name if an appropriate one is available, e.g. "bi-globe" for Public,
|
||||
* otherwise returns empty string.
|
||||
*
|
||||
* @return string icon css class name (often FontAwesome)
|
||||
@@ -125,12 +125,12 @@ class PermissionDescription {
|
||||
public function get_permission_icon() {
|
||||
|
||||
switch($this->channel_perm) {
|
||||
case 0:/* only me */ return 'fa-eye-slash';
|
||||
case PERMS_PUBLIC: return 'fa-globe';
|
||||
case PERMS_NETWORK: return 'fa-share-alt-square'; // fa-share-alt-square is very similiar to the hubzilla logo, but we should create our own logo class to use
|
||||
case PERMS_SITE: return 'fa-sitemap';
|
||||
case PERMS_CONTACTS: return 'fa-group';
|
||||
case PERMS_SPECIFIC: return 'fa-list';
|
||||
case 0:/* only me */ return 'bi-eye-slash';
|
||||
case PERMS_PUBLIC: return 'bi-globe';
|
||||
case PERMS_NETWORK: return 'bi-share'; // bi-share is very similiar to the hubzilla logo, but we should create our own logo class to use
|
||||
case PERMS_SITE: return 'bi-geo';
|
||||
case PERMS_CONTACTS: return 'bi-people';
|
||||
case PERMS_SPECIFIC: return 'bi-list-ul';
|
||||
case PERMS_AUTHED: return '';
|
||||
case PERMS_PENDING: return '';
|
||||
default: return '';
|
||||
|
||||
@@ -4,6 +4,9 @@ namespace Zotlabs\Lib;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\Exception\UnableToBuildUuidException;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once 'include/dba/dba_transaction.php';
|
||||
|
||||
class QueueWorker {
|
||||
|
||||
@@ -28,18 +31,6 @@ class QueueWorker {
|
||||
'Expire'
|
||||
];
|
||||
|
||||
private static function qstart() {
|
||||
q('START TRANSACTION');
|
||||
}
|
||||
|
||||
private static function qcommit() {
|
||||
q("COMMIT");
|
||||
}
|
||||
|
||||
private static function qrollback() {
|
||||
q("ROLLBACK");
|
||||
}
|
||||
|
||||
public static function Summon($argv) {
|
||||
|
||||
if ($argv[0] !== 'Queueworker') {
|
||||
@@ -65,26 +56,26 @@ class QueueWorker {
|
||||
|
||||
logger('queueworker_stats_summon: cmd:' . $argv[0] . ' ' . 'timestamp:' . time());
|
||||
|
||||
self::qstart();
|
||||
$transaction = new \DbaTransaction(\DBA::$dba);
|
||||
$r = q("INSERT INTO workerq (workerq_priority, workerq_data, workerq_uuid, workerq_cmd) VALUES (%d, '%s', '%s', '%s')",
|
||||
intval($priority),
|
||||
$workinfo_json,
|
||||
dbesc($workinfo_json),
|
||||
dbesc($uuid),
|
||||
dbesc($argv[0])
|
||||
);
|
||||
if (!$r) {
|
||||
self::qrollback();
|
||||
// Transaction is autmatically rolled back on return
|
||||
logger("INSERT FAILED", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
self::qcommit();
|
||||
$transaction->commit();
|
||||
logger('INSERTED: ' . $workinfo_json, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
$workers = self::GetWorkerCount();
|
||||
if ($workers < self::$maxworkers) {
|
||||
logger($workers . '/' . self::$maxworkers . ' workers active', LOGGER_DEBUG);
|
||||
$phpbin = get_config('system', 'phpbin', 'php');
|
||||
$phpbin = Config::Get('system', 'phpbin', 'php');
|
||||
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', ['Queueworker']);
|
||||
}
|
||||
}
|
||||
@@ -111,19 +102,19 @@ class QueueWorker {
|
||||
return;
|
||||
}
|
||||
|
||||
self::qstart();
|
||||
$transaction = new \DbaTransaction(\DBA::$dba);
|
||||
$r = q("INSERT INTO workerq (workerq_priority, workerq_data, workerq_uuid, workerq_cmd) VALUES (%d, '%s', '%s', '%s')",
|
||||
intval($priority),
|
||||
$workinfo_json,
|
||||
dbesc($workinfo_json),
|
||||
dbesc($uuid),
|
||||
dbesc($argv[0])
|
||||
);
|
||||
if (!$r) {
|
||||
self::qrollback();
|
||||
// Transaction is automatically rolled back on return
|
||||
logger("Insert failed: " . $workinfo_json, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
self::qcommit();
|
||||
$transaction->commit();
|
||||
logger('INSERTED: ' . $workinfo_json, LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
@@ -132,18 +123,18 @@ class QueueWorker {
|
||||
|
||||
public static function GetWorkerCount() {
|
||||
if (self::$maxworkers == 0) {
|
||||
self::$maxworkers = get_config('queueworker', 'max_queueworkers', 4);
|
||||
self::$maxworkers = Config::Get('queueworker', 'max_queueworkers', 4);
|
||||
self::$maxworkers = self::$maxworkers > 3 ? self::$maxworkers : 4;
|
||||
}
|
||||
if (self::$workermaxage == 0) {
|
||||
self::$workermaxage = get_config('queueworker', 'max_queueworker_age');
|
||||
self::$workermaxage = Config::Get('queueworker', 'max_queueworker_age');
|
||||
self::$workermaxage = self::$workermaxage > 120 ? self::$workermaxage : 300;
|
||||
}
|
||||
|
||||
self::qstart();
|
||||
$transaction = new \DbaTransaction(\DBA::$dba);
|
||||
|
||||
// skip locked is preferred but is not supported by mariadb < 10.6 which is still used a lot - hence make it optional
|
||||
$sql_quirks = ((get_config('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
|
||||
$sql_quirks = ((Config::Get('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
|
||||
|
||||
$r = q("SELECT workerq_id FROM workerq WHERE workerq_reservationid IS NOT NULL AND workerq_processtimeout < %s FOR UPDATE $sql_quirks",
|
||||
db_utcnow()
|
||||
@@ -158,7 +149,7 @@ class QueueWorker {
|
||||
$u = dbq("update workerq set workerq_reservationid = null where workerq_id in ($ids)");
|
||||
}
|
||||
|
||||
self::qcommit();
|
||||
$transaction->commit();
|
||||
|
||||
//q("update workerq set workerq_reservationid = null where workerq_reservationid is not null and workerq_processtimeout < %s",
|
||||
//db_utcnow()
|
||||
@@ -196,15 +187,15 @@ class QueueWorker {
|
||||
private static function getWorkId() {
|
||||
self::GetWorkerCount();
|
||||
|
||||
self::qstart();
|
||||
$transaction = new \DbaTransaction(\DBA::$dba);
|
||||
|
||||
// skip locked is preferred but is not supported by mariadb < 10.6 which is still used a lot - hence make it optional
|
||||
$sql_quirks = ((get_config('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
|
||||
$sql_quirks = ((Config::Get('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
|
||||
|
||||
$work = dbq("SELECT workerq_id, workerq_cmd FROM workerq WHERE workerq_reservationid IS NULL ORDER BY workerq_priority DESC, workerq_id ASC LIMIT 1 FOR UPDATE $sql_quirks");
|
||||
|
||||
if (!$work) {
|
||||
self::qrollback();
|
||||
// Transaction automatically rolled back on return
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -224,24 +215,24 @@ class QueueWorker {
|
||||
);
|
||||
|
||||
if (!$work) {
|
||||
self::qrollback();
|
||||
// Transaction automatically rolled back on return
|
||||
logger("Could not update workerq.", LOGGER_DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger("GOTWORK: " . json_encode($work), LOGGER_DEBUG);
|
||||
self::qcommit();
|
||||
$transaction->commit();
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
public static function Process() {
|
||||
$sleep = intval(get_config('queueworker', 'queue_worker_sleep', 100));
|
||||
$auto_queue_worker_sleep = get_config('queueworker', 'auto_queue_worker_sleep', 0);
|
||||
$sleep = intval(Config::Get('queueworker', 'queue_worker_sleep', 100));
|
||||
$auto_queue_worker_sleep = Config::Get('queueworker', 'auto_queue_worker_sleep', 0);
|
||||
|
||||
if (!self::GetWorkerID()) {
|
||||
if ($auto_queue_worker_sleep) {
|
||||
set_config('queueworker', 'queue_worker_sleep', $sleep + 100);
|
||||
Config::Set('queueworker', 'queue_worker_sleep', $sleep + 100);
|
||||
}
|
||||
|
||||
logger('Unable to get worker ID. Exiting.', LOGGER_DEBUG);
|
||||
@@ -250,7 +241,7 @@ class QueueWorker {
|
||||
|
||||
if ($auto_queue_worker_sleep && $sleep > 100) {
|
||||
$next_sleep = $sleep - 100;
|
||||
set_config('queueworker', 'queue_worker_sleep', (($next_sleep < 100) ? 100 : $next_sleep));
|
||||
Config::Set('queueworker', 'queue_worker_sleep', (($next_sleep < 100) ? 100 : $next_sleep));
|
||||
}
|
||||
|
||||
$jobs = 0;
|
||||
@@ -259,7 +250,7 @@ class QueueWorker {
|
||||
self::$workersleep = $sleep;
|
||||
self::$workersleep = ((intval(self::$workersleep) > 100) ? intval(self::$workersleep) : 100);
|
||||
|
||||
if (function_exists('sys_getloadavg') && get_config('queueworker', 'load_average_sleep')) {
|
||||
if (function_exists('sys_getloadavg') && Config::Get('queueworker', 'load_average_sleep')) {
|
||||
// very experimental!
|
||||
$load_average_sleep = true;
|
||||
}
|
||||
@@ -287,7 +278,7 @@ class QueueWorker {
|
||||
|
||||
if ($workers < self::$maxworkers) {
|
||||
logger($workers . '/' . self::$maxworkers . ' workers active', LOGGER_DEBUG);
|
||||
$phpbin = get_config('system', 'phpbin', 'php');
|
||||
$phpbin = Config::Get('system', 'phpbin', 'php');
|
||||
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', ['Queueworker']);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Access\AccessList;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/text.php');
|
||||
|
||||
@@ -41,9 +42,7 @@ class ThreadItem {
|
||||
|
||||
$this->data = $data;
|
||||
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
|
||||
$this->threaded = get_config('system','thread_allow');
|
||||
|
||||
$observer = \App::get_observer();
|
||||
$this->threaded = Config::Get('system','thread_allow');
|
||||
|
||||
// Prepare the children
|
||||
if(isset($data['children'])) {
|
||||
@@ -70,7 +69,7 @@ class ThreadItem {
|
||||
|
||||
// allow a site to configure the order and content of the reaction emoji list
|
||||
if($this->toplevel) {
|
||||
$x = get_config('system','reactions');
|
||||
$x = Config::Get('system','reactions');
|
||||
if($x && is_array($x) && count($x)) {
|
||||
$this->reactions = $x;
|
||||
}
|
||||
@@ -94,7 +93,7 @@ class ThreadItem {
|
||||
$buttons = '';
|
||||
$dropping = false;
|
||||
$star = false;
|
||||
$isstarred = "unstarred fa-star-o";
|
||||
$isstarred = "unstarred bi-star";
|
||||
$is_comment = false;
|
||||
$is_item = false;
|
||||
$osparkle = '';
|
||||
@@ -124,13 +123,13 @@ class ThreadItem {
|
||||
$locktype = 0;
|
||||
}
|
||||
|
||||
$shareable = ((($conv->get_profile_owner() == local_channel() && local_channel()) && (intval($item['item_private']) === 0)) ? true : false);
|
||||
$shareable = ((local_channel() && $conv->get_profile_owner() == local_channel()) && (intval($item['item_private']) === 0));
|
||||
|
||||
// allow an exemption for sharing stuff from your private feeds
|
||||
if($item['author']['xchan_network'] === 'rss')
|
||||
$shareable = true;
|
||||
|
||||
$repeatable = ((($conv->get_profile_owner() == local_channel() && local_channel()) && (intval($item['item_private']) === 0) && (in_array($item['author']['xchan_network'], ['zot6', 'activitypub']))) ? true : false);
|
||||
$repeatable = ((local_channel() && $conv->get_profile_owner() == local_channel()) && intval($item['item_private']) === 0 && in_array($item['author']['xchan_network'], ['zot6', 'activitypub']));
|
||||
|
||||
// @fixme
|
||||
// Have recently added code to properly handle polls in group reshares by redirecting all of the poll responses to the group.
|
||||
@@ -205,9 +204,11 @@ class ThreadItem {
|
||||
$response_verbs[] = 'dislike';
|
||||
}
|
||||
|
||||
$response_verbs[] = 'announce';
|
||||
if ($repeatable) {
|
||||
$response_verbs[] = 'announce';
|
||||
}
|
||||
|
||||
if(in_array($item['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) {
|
||||
if (in_array($item['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) {
|
||||
$response_verbs[] = 'attendyes';
|
||||
$response_verbs[] = 'attendno';
|
||||
$response_verbs[] = 'attendmaybe';
|
||||
@@ -217,18 +218,18 @@ class ThreadItem {
|
||||
}
|
||||
}
|
||||
|
||||
if($item['obj_type'] === 'Question') {
|
||||
if ($item['obj_type'] === 'Question') {
|
||||
$response_verbs[] = 'answer';
|
||||
}
|
||||
|
||||
if(! feature_enabled($conv->get_profile_owner(),'dislike'))
|
||||
if (!feature_enabled($conv->get_profile_owner(),'dislike')) {
|
||||
unset($conv_responses['dislike']);
|
||||
}
|
||||
|
||||
$responses = get_responses($conv_responses,$response_verbs,$this,$item);
|
||||
|
||||
$my_responses = [];
|
||||
foreach($response_verbs as $v) {
|
||||
|
||||
$my_responses[$v] = ((isset($conv_responses[$v][$item['mid'] . '-m'])) ? 1 : 0);
|
||||
}
|
||||
|
||||
@@ -328,11 +329,13 @@ class ThreadItem {
|
||||
$like = [];
|
||||
$dislike = [];
|
||||
$reply_to = [];
|
||||
$reactions_allowed = false;
|
||||
|
||||
if($this->is_commentable() && $observer) {
|
||||
$like = array( t("I like this \x28toggle\x29"), t("like"));
|
||||
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
|
||||
$reply_to = array( t("Reply on this comment"), t("reply"), t("Reply to"));
|
||||
$reply_to = array( t("Reply to this comment"), t("reply"), t("Reply to"));
|
||||
$reactions_allowed = true;
|
||||
}
|
||||
|
||||
$share = [];
|
||||
@@ -347,12 +350,12 @@ class ThreadItem {
|
||||
|
||||
$dreport = '';
|
||||
|
||||
$keep_reports = intval(get_config('system','expire_delivery_reports'));
|
||||
$keep_reports = intval(Config::Get('system','expire_delivery_reports'));
|
||||
if($keep_reports === 0)
|
||||
$keep_reports = 10;
|
||||
|
||||
$dreport_link = '';
|
||||
if((intval($item['item_type']) == ITEM_TYPE_POST) && (! get_config('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
|
||||
if((intval($item['item_type']) == ITEM_TYPE_POST) && (! Config::Get('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
|
||||
$dreport = t('Delivery Report');
|
||||
$dreport_link = '?mid=' . $item['mid'];
|
||||
}
|
||||
@@ -363,7 +366,8 @@ class ThreadItem {
|
||||
|
||||
localize_item($item);
|
||||
|
||||
$body = prepare_body($item,true);
|
||||
$opts = (($item['resource_type'] === 'event') ? ['is_event_item' => true] : []);
|
||||
$body = prepare_body($item, true, $opts);
|
||||
|
||||
// $viewthread (below) is only valid in list mode. If this is a channel page, build the thread viewing link
|
||||
// since we can't depend on llink or plink pointing to the right local location.
|
||||
@@ -397,7 +401,7 @@ class ThreadItem {
|
||||
$json_mids = json_encode($mids);
|
||||
|
||||
// Pinned item processing
|
||||
$allowed_type = (in_array($item['item_type'], get_config('system', 'pin_types', [ ITEM_TYPE_POST ])) ? true : false);
|
||||
$allowed_type = (in_array($item['item_type'], Config::Get('system', 'pin_types', [ ITEM_TYPE_POST ])) ? true : false);
|
||||
$pinned_items = ($allowed_type ? get_pconfig($item['uid'], 'pinned', $item['item_type'], []) : []);
|
||||
$pinned = ((!empty($pinned_items) && in_array($midb64, $pinned_items)) ? true : false);
|
||||
|
||||
@@ -539,6 +543,8 @@ class ThreadItem {
|
||||
'moderate_approve' => t('Approve'),
|
||||
'moderate_delete' => t('Delete'),
|
||||
'rtl' => in_array($item['lang'], rtl_languages()),
|
||||
'reactions_allowed' => $reactions_allowed,
|
||||
'reaction_str' => [t('Add yours'), t('Remove yours')]
|
||||
);
|
||||
|
||||
$arr = array('item' => $item, 'output' => $tmp_item);
|
||||
@@ -549,7 +555,7 @@ class ThreadItem {
|
||||
$result['children'] = array();
|
||||
$nb_children = count($children);
|
||||
|
||||
$visible_comments = get_config('system','expanded_comments');
|
||||
$visible_comments = Config::Get('system','expanded_comments');
|
||||
if($visible_comments === false)
|
||||
$visible_comments = 3;
|
||||
|
||||
@@ -567,7 +573,7 @@ class ThreadItem {
|
||||
if(($nb_children > $visible_comments) || ($thread_level > 1)) {
|
||||
$result['children'][0]['comment_firstcollapsed'] = true;
|
||||
$result['children'][0]['num_comments'] = $comment_count_txt['label'];
|
||||
$result['children'][0]['hide_text'] = sprintf( t('%s show all'), '<i class="fa fa-chevron-down"></i>');
|
||||
$result['children'][0]['hide_text'] = t('show all');
|
||||
if($thread_level > 1) {
|
||||
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
|
||||
}
|
||||
@@ -826,7 +832,7 @@ class ThreadItem {
|
||||
*/
|
||||
private function get_comment_box() {
|
||||
|
||||
if(!$this->is_toplevel() && !get_config('system','thread_allow')) {
|
||||
if(!$this->is_toplevel() && !Config::Get('system','thread_allow')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -874,7 +880,7 @@ class ThreadItem {
|
||||
'$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false),
|
||||
'$encrypt' => t('Encrypt text'),
|
||||
'$cipher' => $conv->get_cipher(),
|
||||
'$sourceapp' => \App::$sourcename,
|
||||
'$sourceapp' => App::$sourcename,
|
||||
'$observer' => get_observer_hash(),
|
||||
'$anoncomments' => ((in_array($conv->get_mode(), ['channel', 'display', 'cards', 'articles']) && perm_is_allowed($conv->get_profile_owner(),'','post_comments')) ? true : false),
|
||||
'$anonname' => [ 'anonname', t('Your full name (required)') ],
|
||||
|
||||
95
Zotlabs/Lib/Traits/HelpHelperTrait.php
Normal file
95
Zotlabs/Lib/Traits/HelpHelperTrait.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace Zotlabs\Lib\Traits;
|
||||
|
||||
use CommerceGuys\Intl\Language\LanguageRepository;
|
||||
|
||||
trait HelpHelperTrait {
|
||||
|
||||
// PHP versions before 8.2 does not support trait constants,
|
||||
// Leave this commented out until we drop support for PHP 8.1.
|
||||
//
|
||||
// const VALID_FILE_EXT = ['md', 'bb', 'html'];
|
||||
|
||||
private string $file_name = '';
|
||||
private string $file_type = '';
|
||||
|
||||
/**
|
||||
* Associative array containing the detected language.
|
||||
*/
|
||||
private array $lang = [
|
||||
'language' => 'en', //! Detected language, 2-letter ISO 639-1 code ("en")
|
||||
'from_url' => false, //! true if language from URL overrides browser default
|
||||
'missing' => false, //! true if topic not found in detected language
|
||||
];
|
||||
|
||||
/**
|
||||
* Determines help language.
|
||||
*
|
||||
* If the language was specified in the URL, override the language preference
|
||||
* of the browser. Default to English if both of these are absent.
|
||||
*
|
||||
* Updates the `$lang` property of the module.
|
||||
*/
|
||||
private function determine_help_language() {
|
||||
|
||||
$language_repository = new LanguageRepository;
|
||||
$languages = $language_repository->getList();
|
||||
|
||||
if(array_key_exists(argv(1), $languages)) {
|
||||
$this->lang['language'] = argv(1);
|
||||
$this->lang['from_url'] = true;
|
||||
} else {
|
||||
if(isset(\App::$language)) {
|
||||
$this->lang['language'] = \App::$language;
|
||||
}
|
||||
|
||||
$this->lang['from_url'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the full path name of the file, given it's base path and
|
||||
* the language of the request.
|
||||
*
|
||||
* @param string $base_path The path of the file to find, relative to the
|
||||
* doc root path, and without the extension.
|
||||
*/
|
||||
private function find_help_file(string $base_path, string $lang): void {
|
||||
|
||||
// Use local variable until we can use trait constants.
|
||||
$valid_file_ext = ['md', 'bb', 'html'];
|
||||
|
||||
$base_path_with_lang = "doc/{$lang}/${base_path}";
|
||||
|
||||
foreach ($valid_file_ext as $ext) {
|
||||
$path = "{$base_path_with_lang}.{$ext}";
|
||||
if (file_exists($path)) {
|
||||
$this->file_name = $path;
|
||||
$this->file_type = $ext;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->file_name) && $lang !== 'en') {
|
||||
$this->lang['missing'] = true;
|
||||
$this->find_help_file($base_path, 'en');
|
||||
}
|
||||
}
|
||||
|
||||
public function missing_translation(): bool {
|
||||
return !!$this->lang['missing'];
|
||||
}
|
||||
|
||||
public function missing_translation_message(): string {
|
||||
$prefered_language_name = get_language_name(
|
||||
$this->lang['language'],
|
||||
$this->lang['language']
|
||||
);
|
||||
|
||||
return bbcode(
|
||||
t("This page is not yet available in {$prefered_language_name}. See [observer.baseurl]/help/developer/developer_guide#Translations for information about how to help.")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class XConfig {
|
||||
return $default;
|
||||
|
||||
if(! array_key_exists($xchan, \App::$config))
|
||||
load_xconfig($xchan);
|
||||
self::Load($xchan);
|
||||
|
||||
if((! array_key_exists($family, \App::$config[$xchan])) || (! array_key_exists($key, \App::$config[$xchan][$family])))
|
||||
return $default;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\HTTPSig;
|
||||
|
||||
class Zotfinger {
|
||||
@@ -75,7 +76,7 @@ class Zotfinger {
|
||||
$result['data'] = json_decode($x['body'],true);
|
||||
|
||||
if($result['data'] && is_array($result['data']) && array_key_exists('encrypted',$result['data']) && $result['data']['encrypted']) {
|
||||
$result['data'] = json_decode(Crypto::unencapsulate($result['data'],get_config('system','prvkey')),true);
|
||||
$result['data'] = json_decode(Crypto::unencapsulate($result['data'],Config::Get('system','prvkey')),true);
|
||||
}
|
||||
|
||||
logger('decrypted: ' . print_r($result,true), LOGGER_DATA);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
use Zotlabs\Lib\AccessList;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
||||
@@ -414,7 +415,7 @@ class Acl extends \Zotlabs\Web\Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
$dirmode = intval(get_config('system','directory_mode'));
|
||||
$dirmode = intval(Config::Get('system','directory_mode'));
|
||||
$search = ((x($_REQUEST,'search')) ? htmlentities($_REQUEST['search'],ENT_COMPAT,'UTF-8',false) : '');
|
||||
if(! $search || mb_strlen($search) < 2)
|
||||
return array();
|
||||
@@ -443,7 +444,7 @@ class Acl extends \Zotlabs\Web\Controller {
|
||||
$url = $directory['url'] . '/dirsearch';
|
||||
}
|
||||
|
||||
$token = get_config('system','realm_token');
|
||||
$token = Config::Get('system','realm_token');
|
||||
|
||||
$count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 100);
|
||||
if($url) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/account.php');
|
||||
|
||||
/**
|
||||
@@ -149,7 +151,7 @@ class Admin extends \Zotlabs\Web\Controller {
|
||||
'$vmaster' => array( t('Repository version (master)'), $vmaster),
|
||||
'$vdev' => array( t('Repository version (dev)'), $vdev),
|
||||
'$upgrade' => $upgrade,
|
||||
'$build' => get_config('system', 'db_version')
|
||||
'$build' => Config::Get('system', 'db_version')
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Accounts {
|
||||
|
||||
@@ -76,7 +76,7 @@ class Accounts {
|
||||
if ( $ac['success'] ) {
|
||||
$rc .= '✔';
|
||||
|
||||
$auto_create = get_config('system','auto_channel_create',1);
|
||||
$auto_create = Config::Get('system','auto_channel_create',1);
|
||||
|
||||
if($auto_create) {
|
||||
$reonar = json_decode($rs[0]['reg_stuff'], true);
|
||||
@@ -87,7 +87,7 @@ class Accounts {
|
||||
if($reonar['chan.did1'])
|
||||
set_aconfig($ac['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']);
|
||||
|
||||
$permissions_role = get_config('system','default_permissions_role');
|
||||
$permissions_role = Config::Get('system','default_permissions_role');
|
||||
if($permissions_role)
|
||||
set_aconfig($ac['account']['account_id'], 'register', 'permissions_role', $permissions_role);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
use App;
|
||||
use \Zotlabs\Lib\Config;
|
||||
use \Zotlabs\Storage\GitRepo;
|
||||
use \Michelf\MarkdownExtra;
|
||||
|
||||
@@ -276,7 +277,7 @@ class Addons {
|
||||
if ($idz !== false) {
|
||||
unset(App::$plugins[$idz]);
|
||||
uninstall_plugin($plugin);
|
||||
set_config("system","addon", implode(", ",App::$plugins));
|
||||
Config::Set("system","addon", implode(", ",App::$plugins));
|
||||
}
|
||||
}
|
||||
$info['disabled'] = 1-intval($x);
|
||||
@@ -297,7 +298,7 @@ class Addons {
|
||||
$pinstalled = true;
|
||||
info( sprintf( t("Plugin %s enabled."), $plugin ) );
|
||||
}
|
||||
set_config("system","addon", implode(", ",App::$plugins));
|
||||
Config::Set("system","addon", implode(", ",App::$plugins));
|
||||
|
||||
if($pinstalled) {
|
||||
@require_once("addon/$plugin/$plugin.php");
|
||||
@@ -395,7 +396,7 @@ class Addons {
|
||||
if ($idz !== false) {
|
||||
unset(App::$plugins[$idz]);
|
||||
uninstall_plugin($id);
|
||||
set_config("system","addon", implode(", ",App::$plugins));
|
||||
Config::Set("system","addon", implode(", ",App::$plugins));
|
||||
}
|
||||
}
|
||||
$info['disabled'] = 1-intval($x);
|
||||
|
||||
@@ -14,7 +14,7 @@ class Channels {
|
||||
*/
|
||||
function post() {
|
||||
|
||||
$channels = ( x($_POST, 'channel') ? $_POST['channel'] : Array() );
|
||||
$channels = (x($_POST, 'channel') ? $_POST['channel'] : []);
|
||||
|
||||
check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels');
|
||||
|
||||
@@ -22,11 +22,28 @@ class Channels {
|
||||
|
||||
if(x($_POST, 'page_channels_block')) {
|
||||
foreach($channels as $uid) {
|
||||
q("UPDATE channel SET channel_pageflags = ( channel_pageflags $xor %d ) where channel_id = %d",
|
||||
intval(PAGE_CENSORED),
|
||||
intval( $uid )
|
||||
$channel = channelx_by_n($uid);
|
||||
|
||||
if (!$channel) {
|
||||
notice( t('Channel not found') . EOL);
|
||||
continue;
|
||||
}
|
||||
|
||||
$pflags = $channel['channel_pageflags'] ^ PAGE_CENSORED;
|
||||
|
||||
q("UPDATE channel SET channel_pageflags = %d where channel_id = %d",
|
||||
intval($pflags),
|
||||
intval($uid)
|
||||
);
|
||||
|
||||
\Zotlabs\Daemon\Master::Summon(array('Directory', $uid, 'nopush'));
|
||||
|
||||
$censored = (($pflags & PAGE_CENSORED) ? 1 : 0);
|
||||
|
||||
q("UPDATE xchan SET xchan_censored = %d WHERE xchan_hash = '%s'",
|
||||
intval($censored),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
}
|
||||
notice( sprintf( tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)) );
|
||||
}
|
||||
@@ -57,11 +74,9 @@ class Channels {
|
||||
function get() {
|
||||
if(argc() > 2) {
|
||||
$uid = argv(3);
|
||||
$channel = q("SELECT * FROM channel WHERE channel_id = %d",
|
||||
intval($uid)
|
||||
);
|
||||
$channel = channelx_by_n($uid);
|
||||
|
||||
if(! $channel) {
|
||||
if(!$channel) {
|
||||
notice( t('Channel not found') . EOL);
|
||||
goaway(z_root() . '/admin/channels' );
|
||||
}
|
||||
@@ -72,30 +87,37 @@ class Channels {
|
||||
// delete channel
|
||||
channel_remove($uid,true);
|
||||
|
||||
notice( sprintf(t("Channel '%s' deleted"), $channel[0]['channel_name']) . EOL);
|
||||
notice( sprintf(t("Channel '%s' deleted"), $channel['channel_name']) . EOL);
|
||||
}; break;
|
||||
|
||||
case "block":{
|
||||
check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels', 't');
|
||||
$pflags = $channel[0]['channel_pageflags'] ^ PAGE_CENSORED;
|
||||
$pflags = $channel['channel_pageflags'] ^ PAGE_CENSORED;
|
||||
q("UPDATE channel SET channel_pageflags = %d where channel_id = %d",
|
||||
intval($pflags),
|
||||
intval( $uid )
|
||||
intval($uid)
|
||||
);
|
||||
\Zotlabs\Daemon\Master::Summon(array('Directory',$uid,'nopush'));
|
||||
|
||||
notice( sprintf( (($pflags & PAGE_CENSORED) ? t("Channel '%s' censored"): t("Channel '%s' uncensored")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL);
|
||||
$censored = (($pflags & PAGE_CENSORED) ? 1 : 0);
|
||||
|
||||
q("UPDATE xchan SET xchan_censored = %d WHERE xchan_hash = '%s'",
|
||||
intval($censored),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
|
||||
notice( sprintf( (($censored) ? t("Channel '%s' censored"): t("Channel '%s' uncensored")) , $channel['channel_name'] . ' (' . $channel['channel_address'] . ')' ) . EOL);
|
||||
}; break;
|
||||
|
||||
case "code":{
|
||||
check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels', 't');
|
||||
$pflags = $channel[0]['channel_pageflags'] ^ PAGE_ALLOWCODE;
|
||||
$pflags = $channel['channel_pageflags'] ^ PAGE_ALLOWCODE;
|
||||
q("UPDATE channel SET channel_pageflags = %d where channel_id = %d",
|
||||
intval($pflags),
|
||||
intval( $uid )
|
||||
intval($uid)
|
||||
);
|
||||
|
||||
notice( sprintf( (($pflags & PAGE_ALLOWCODE) ? t("Channel '%s' code allowed"): t("Channel '%s' code disallowed")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL);
|
||||
notice( sprintf( (($pflags & PAGE_ALLOWCODE) ? t("Channel '%s' code allowed"): t("Channel '%s' code disallowed")) , $channel['channel_name'] . ' (' . $channel['channel_address'] . ')' ) . EOL);
|
||||
}; break;
|
||||
|
||||
default:
|
||||
@@ -104,7 +126,7 @@ class Channels {
|
||||
goaway(z_root() . '/admin/channels' );
|
||||
}
|
||||
|
||||
$key = (($_REQUEST['key']) ? dbesc($_REQUEST['key']) : 'channel_id');
|
||||
$key = ((isset($_REQUEST['key']) && $_REQUEST['key']) ? dbesc($_REQUEST['key']) : 'channel_id');
|
||||
$dir = 'asc';
|
||||
if(array_key_exists('dir',$_REQUEST))
|
||||
$dir = ((intval($_REQUEST['dir'])) ? 'asc' : 'desc');
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Dbsync {
|
||||
|
||||
@@ -12,10 +12,10 @@ class Dbsync {
|
||||
|
||||
if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') {
|
||||
// remove the old style config if it exists
|
||||
del_config('database', 'update_r' . intval(argv(3)));
|
||||
set_config('database', '_' . intval(argv(3)), 'success');
|
||||
if(intval(get_config('system','db_version')) < intval(argv(3)))
|
||||
set_config('system','db_version',intval(argv(3)));
|
||||
Config::Delete('database', 'update_r' . intval(argv(3)));
|
||||
Config::Set('database', '_' . intval(argv(3)), 'success');
|
||||
if(intval(Config::Get('system','db_version')) < intval(argv(3)))
|
||||
Config::Set('system','db_version',intval(argv(3)));
|
||||
info( t('Update has been marked successful') . EOL);
|
||||
goaway(z_root() . '/admin/dbsync');
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class Dbsync {
|
||||
}
|
||||
elseif($retval === UPDATE_SUCCESS) {
|
||||
$o .= sprintf( t('Update %s was successfully applied.'), $s);
|
||||
set_config('database',$s, 'success');
|
||||
Config::Set('database',$s, 'success');
|
||||
}
|
||||
else
|
||||
$o .= sprintf( t('Verifying update %s did not return a status. Unknown if it succeeded.'), $s);
|
||||
@@ -60,7 +60,7 @@ class Dbsync {
|
||||
}
|
||||
elseif($retval === UPDATE_SUCCESS) {
|
||||
$o .= sprintf( t('Update %s was successfully applied.'), $s);
|
||||
set_config('database',$s, 'success');
|
||||
Config::Set('database',$s, 'success');
|
||||
}
|
||||
else
|
||||
$o .= sprintf( t('Update %s did not return a status. It cannot be determined if it was successful.'), $s);
|
||||
|
||||
@@ -2,53 +2,53 @@
|
||||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Features {
|
||||
|
||||
|
||||
|
||||
function post() {
|
||||
|
||||
|
||||
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
|
||||
|
||||
|
||||
logger('postvars: ' . print_r($_POST,true));
|
||||
|
||||
|
||||
$arr = array();
|
||||
$features = get_features(false);
|
||||
|
||||
|
||||
foreach($features as $fname => $fdata) {
|
||||
foreach(array_slice($fdata,1) as $f) {
|
||||
$feature = $f[0];
|
||||
|
||||
|
||||
if(array_key_exists('feature_' . $feature,$_POST))
|
||||
$val = intval($_POST['feature_' . $feature]);
|
||||
else
|
||||
$val = 0;
|
||||
set_config('feature',$feature,$val);
|
||||
|
||||
Config::Set('feature',$feature,$val);
|
||||
|
||||
if(array_key_exists('featurelock_' . $feature,$_POST))
|
||||
set_config('feature_lock',$feature,$val);
|
||||
Config::Set('feature_lock',$feature,$val);
|
||||
else
|
||||
del_config('feature_lock',$feature);
|
||||
Config::Delete('feature_lock',$feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
goaway(z_root() . '/admin/features' );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get() {
|
||||
|
||||
|
||||
if((argc() > 1) && (argv(1) === 'features')) {
|
||||
$arr = array();
|
||||
$features = get_features(false);
|
||||
|
||||
|
||||
foreach($features as $fname => $fdata) {
|
||||
$arr[$fname] = array();
|
||||
$arr[$fname][0] = $fdata[0];
|
||||
foreach(array_slice($fdata,1) as $f) {
|
||||
|
||||
$set = get_config('feature',$f[0]);
|
||||
|
||||
$set = Config::Get('feature',$f[0]);
|
||||
if($set === false)
|
||||
$set = $f[3];
|
||||
$arr[$fname][1][] = array(
|
||||
@@ -57,7 +57,7 @@ class Features {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tpl = get_markup_template("admin_settings_features.tpl");
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("admin_manage_features"),
|
||||
@@ -65,10 +65,10 @@ class Features {
|
||||
'$features' => $arr,
|
||||
'$submit' => t('Submit'),
|
||||
));
|
||||
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Logs {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief POST handler for logs admin page.
|
||||
*
|
||||
@@ -15,20 +16,20 @@ class Logs {
|
||||
function post() {
|
||||
if (x($_POST, 'page_logs')) {
|
||||
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
|
||||
|
||||
|
||||
$logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
|
||||
$debugging = ((x($_POST,'debugging')) ? true : false);
|
||||
$loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
|
||||
|
||||
set_config('system','logfile', $logfile);
|
||||
set_config('system','debugging', $debugging);
|
||||
set_config('system','loglevel', $loglevel);
|
||||
|
||||
Config::Set('system','logfile', $logfile);
|
||||
Config::Set('system','debugging', $debugging);
|
||||
Config::Set('system','loglevel', $loglevel);
|
||||
}
|
||||
|
||||
|
||||
info( t('Log settings updated.') );
|
||||
goaway(z_root() . '/admin/logs' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Logs admin page.
|
||||
*
|
||||
@@ -36,7 +37,7 @@ class Logs {
|
||||
*/
|
||||
|
||||
function get() {
|
||||
|
||||
|
||||
$log_choices = Array(
|
||||
LOGGER_NORMAL => 'Normal',
|
||||
LOGGER_TRACE => 'Trace',
|
||||
@@ -44,15 +45,15 @@ class Logs {
|
||||
LOGGER_DATA => 'Data',
|
||||
LOGGER_ALL => 'All'
|
||||
);
|
||||
|
||||
|
||||
$t = get_markup_template('admin_logs.tpl');
|
||||
|
||||
$f = get_config('system', 'logfile');
|
||||
|
||||
|
||||
$f = Config::Get('system', 'logfile');
|
||||
|
||||
$data = '';
|
||||
|
||||
|
||||
if(!file_exists($f)) {
|
||||
$data = t("Error trying to open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f exist and is
|
||||
$data = t("Error trying to open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f exist and is
|
||||
readable.");
|
||||
}
|
||||
else {
|
||||
@@ -77,7 +78,7 @@ class Logs {
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Logs'),
|
||||
@@ -85,17 +86,17 @@ class Logs {
|
||||
'$clear' => t('Clear'),
|
||||
'$data' => $data,
|
||||
'$baseurl' => z_root(),
|
||||
'$logname' => get_config('system','logfile'),
|
||||
|
||||
'$logname' => Config::Get('system','logfile'),
|
||||
|
||||
// name, label, value, help string, extra data...
|
||||
'$debugging' => array('debugging', t("Debugging"),get_config('system','debugging'), ""),
|
||||
'$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your top-level webserver directory.")),
|
||||
'$loglevel' => array('loglevel', t("Log level"), get_config('system','loglevel'), "", $log_choices),
|
||||
|
||||
'$debugging' => array('debugging', t("Debugging"),Config::Get('system','debugging'), ""),
|
||||
'$logfile' => array('logfile', t("Log file"), Config::Get('system','logfile'), t("Must be writable by web server. Relative to your top-level webserver directory.")),
|
||||
'$loglevel' => array('loglevel', t("Log level"), Config::Get('system','loglevel'), "", $log_choices),
|
||||
|
||||
'$form_security_token' => get_form_security_token('admin_logs'),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Profs {
|
||||
|
||||
function post() {
|
||||
|
||||
|
||||
if(array_key_exists('basic',$_REQUEST)) {
|
||||
$arr = explode(',',$_REQUEST['basic']);
|
||||
array_walk($arr,'array_trim');
|
||||
@@ -19,9 +20,9 @@ class Profs {
|
||||
}
|
||||
}
|
||||
if(! $narr)
|
||||
del_config('system','profile_fields_basic');
|
||||
Config::Delete('system','profile_fields_basic');
|
||||
else
|
||||
set_config('system','profile_fields_basic',$narr);
|
||||
Config::Set('system','profile_fields_basic',$narr);
|
||||
|
||||
|
||||
if(array_key_exists('advanced',$_REQUEST)) {
|
||||
@@ -36,15 +37,15 @@ class Profs {
|
||||
}
|
||||
}
|
||||
if(! $narr)
|
||||
del_config('system','profile_fields_advanced');
|
||||
Config::Delete('system','profile_fields_advanced');
|
||||
else
|
||||
set_config('system','profile_fields_advanced',$narr);
|
||||
Config::Set('system','profile_fields_advanced',$narr);
|
||||
|
||||
}
|
||||
goaway(z_root() . '/admin/profs');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(array_key_exists('field_name',$_REQUEST)) {
|
||||
if($_REQUEST['id']) {
|
||||
$r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d",
|
||||
@@ -66,24 +67,24 @@ class Profs {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// add to chosen array basic or advanced
|
||||
|
||||
|
||||
goaway(z_root() . '/admin/profs');
|
||||
}
|
||||
|
||||
|
||||
function get() {
|
||||
|
||||
|
||||
if((argc() > 3) && argv(2) == 'drop' && intval(argv(3))) {
|
||||
$r = q("delete from profdef where id = %d",
|
||||
intval(argv(3))
|
||||
);
|
||||
// remove from allowed fields
|
||||
|
||||
goaway(z_root() . '/admin/profs');
|
||||
|
||||
goaway(z_root() . '/admin/profs');
|
||||
}
|
||||
|
||||
|
||||
if((argc() > 2) && argv(2) === 'new') {
|
||||
return replace_macros(get_markup_template('profdef_edit.tpl'),array(
|
||||
'$header' => t('New Profile Field'),
|
||||
@@ -94,7 +95,7 @@ class Profs {
|
||||
'$submit' => t('Save')
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
if((argc() > 2) && intval(argv(2))) {
|
||||
$r = q("select * from profdef where id = %d limit 1",
|
||||
intval(argv(2))
|
||||
@@ -103,7 +104,7 @@ class Profs {
|
||||
notice( t('Field definition not found') . EOL);
|
||||
goaway(z_root() . '/admin/profs');
|
||||
}
|
||||
|
||||
|
||||
return replace_macros(get_markup_template('profdef_edit.tpl'),array(
|
||||
'$id' => intval($r[0]['id']),
|
||||
'$header' => t('Edit Profile Field'),
|
||||
@@ -114,7 +115,7 @@ class Profs {
|
||||
'$submit' => t('Save')
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
$basic = '';
|
||||
$barr = array();
|
||||
$fields = get_profile_fields_basic();
|
||||
@@ -129,7 +130,7 @@ class Profs {
|
||||
$barr[] = trim($k);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$advanced = '';
|
||||
$fields = get_profile_fields_advanced();
|
||||
if(! $fields)
|
||||
@@ -143,7 +144,7 @@ class Profs {
|
||||
$advanced .= trim($k);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$all = '';
|
||||
$fields = get_profile_fields_advanced(1);
|
||||
if($fields) {
|
||||
@@ -153,7 +154,7 @@ class Profs {
|
||||
$all .= trim($k);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$r = q("select * from profdef where true");
|
||||
if($r) {
|
||||
foreach($r as $rr) {
|
||||
@@ -162,8 +163,8 @@ class Profs {
|
||||
$all .= $rr['field_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$o = replace_macros(get_markup_template('admin_profiles.tpl'),array(
|
||||
'$title' => t('Profile Fields'),
|
||||
'$basic' => array('basic',t('Basic Profile Fields'),$basic,''),
|
||||
@@ -174,17 +175,17 @@ class Profs {
|
||||
'$cust_fields' => $r,
|
||||
'$edit' => t('Edit'),
|
||||
'$drop' => t('Delete'),
|
||||
'$new' => t('Create Custom Field'),
|
||||
'$new' => t('Create Custom Field'),
|
||||
'$submit' => t('Submit')
|
||||
));
|
||||
|
||||
|
||||
return $o;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Queueworker extends Controller {
|
||||
@@ -17,18 +18,18 @@ class Queueworker extends Controller {
|
||||
|
||||
$maxqueueworkers = intval($_POST['queueworker_maxworkers']);
|
||||
$maxqueueworkers = ($maxqueueworkers > 3) ? $maxqueueworkers : 4;
|
||||
set_config('queueworker', 'max_queueworkers', $maxqueueworkers);
|
||||
Config::Set('queueworker', 'max_queueworkers', $maxqueueworkers);
|
||||
|
||||
$maxworkerage = intval($_POST['queueworker_max_age']);
|
||||
$maxworkerage = ($maxworkerage >= 120) ? $maxworkerage : 300;
|
||||
set_config('queueworker', 'queueworker_max_age', $maxworkerage);
|
||||
Config::Set('queueworker', 'queueworker_max_age', $maxworkerage);
|
||||
|
||||
$queueworkersleep = intval($_POST['queue_worker_sleep']);
|
||||
$queueworkersleep = ($queueworkersleep > 100) ? $queueworkersleep : 100;
|
||||
set_config('queueworker', 'queue_worker_sleep', $queueworkersleep);
|
||||
Config::Set('queueworker', 'queue_worker_sleep', $queueworkersleep);
|
||||
|
||||
$auto_queue_worker_sleep = intval($_POST['auto_queue_worker_sleep']);
|
||||
set_config('queueworker', 'auto_queue_worker_sleep', $auto_queue_worker_sleep);
|
||||
Config::Set('queueworker', 'auto_queue_worker_sleep', $auto_queue_worker_sleep);
|
||||
|
||||
goaway(z_root() . '/admin/queueworker');
|
||||
}
|
||||
@@ -54,7 +55,7 @@ class Queueworker extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
$maxqueueworkers = get_config('queueworker', 'max_queueworkers', 4);
|
||||
$maxqueueworkers = Config::Get('queueworker', 'max_queueworkers', 4);
|
||||
$maxqueueworkers = ($maxqueueworkers > 3) ? $maxqueueworkers : 4;
|
||||
|
||||
$sc = '';
|
||||
@@ -68,7 +69,7 @@ class Queueworker extends Controller {
|
||||
]
|
||||
]);
|
||||
|
||||
$workermaxage = get_config('queueworker', 'queueworker_max_age');
|
||||
$workermaxage = Config::Get('queueworker', 'queueworker_max_age');
|
||||
$workermaxage = ($workermaxage >= 120) ? $workermaxage : 300;
|
||||
|
||||
$sc .= replace_macros(get_markup_template('field_input.tpl'), [
|
||||
@@ -80,10 +81,10 @@ class Queueworker extends Controller {
|
||||
]
|
||||
]);
|
||||
|
||||
$queueworkersleep = get_config('queueworker', 'queue_worker_sleep');
|
||||
$queueworkersleep = Config::Get('queueworker', 'queue_worker_sleep');
|
||||
$queueworkersleep = ($queueworkersleep > 100) ? $queueworkersleep : 100;
|
||||
|
||||
$auto_queue_worker_sleep = get_config('queueworker', 'auto_queue_worker_sleep', 0);
|
||||
$auto_queue_worker_sleep = Config::Get('queueworker', 'auto_queue_worker_sleep', 0);
|
||||
|
||||
$sc .= replace_macros(get_markup_template('field_input.tpl'), [
|
||||
'$field' => [
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Security {
|
||||
|
||||
@@ -11,53 +12,53 @@ class Security {
|
||||
$allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
|
||||
$not_allowed_email = ((x($_POST,'not_allowed_email')) ? notags(trim($_POST['not_allowed_email'])) : '');
|
||||
|
||||
set_config('system','allowed_email', $allowed_email);
|
||||
set_config('system','not_allowed_email', $not_allowed_email);
|
||||
Config::Set('system','allowed_email', $allowed_email);
|
||||
Config::Set('system','not_allowed_email', $not_allowed_email);
|
||||
|
||||
$block_public = ((x($_POST,'block_public')) ? True : False);
|
||||
set_config('system','block_public',$block_public);
|
||||
Config::Set('system','block_public',$block_public);
|
||||
|
||||
$cloud_noroot = ((x($_POST,'cloud_noroot')) ? 1 : 0);
|
||||
set_config('system','cloud_disable_siteroot',1 - $cloud_noroot);
|
||||
Config::Set('system','cloud_disable_siteroot',1 - $cloud_noroot);
|
||||
|
||||
$cloud_disksize = ((x($_POST,'cloud_disksize')) ? 1 : 0);
|
||||
set_config('system','cloud_report_disksize',$cloud_disksize);
|
||||
Config::Set('system','cloud_report_disksize',$cloud_disksize);
|
||||
|
||||
$ws = $this->trim_array_elems(explode("\n",$_POST['whitelisted_sites']));
|
||||
set_config('system','whitelisted_sites',$ws);
|
||||
Config::Set('system','whitelisted_sites',$ws);
|
||||
|
||||
$bs = $this->trim_array_elems(explode("\n",$_POST['blacklisted_sites']));
|
||||
set_config('system','blacklisted_sites',$bs);
|
||||
Config::Set('system','blacklisted_sites',$bs);
|
||||
|
||||
$wc = $this->trim_array_elems(explode("\n",$_POST['whitelisted_channels']));
|
||||
set_config('system','whitelisted_channels',$wc);
|
||||
Config::Set('system','whitelisted_channels',$wc);
|
||||
|
||||
$bc = $this->trim_array_elems(explode("\n",$_POST['blacklisted_channels']));
|
||||
set_config('system','blacklisted_channels',$bc);
|
||||
Config::Set('system','blacklisted_channels',$bc);
|
||||
|
||||
$embed_sslonly = ((x($_POST,'embed_sslonly')) ? True : False);
|
||||
set_config('system','embed_sslonly',$embed_sslonly);
|
||||
Config::Set('system','embed_sslonly',$embed_sslonly);
|
||||
|
||||
$we = $this->trim_array_elems(explode("\n",$_POST['embed_allow']));
|
||||
set_config('system','embed_allow',$we);
|
||||
Config::Set('system','embed_allow',$we);
|
||||
|
||||
$be = $this->trim_array_elems(explode("\n",$_POST['embed_deny']));
|
||||
set_config('system','embed_deny',$be);
|
||||
Config::Set('system','embed_deny',$be);
|
||||
|
||||
$thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0);
|
||||
set_config('system', 'thumbnail_security' , $thumbnail_security);
|
||||
Config::Set('system', 'thumbnail_security' , $thumbnail_security);
|
||||
|
||||
$inline_pdf = ((x($_POST,'inline_pdf')) ? intval($_POST['inline_pdf']) : 0);
|
||||
set_config('system', 'inline_pdf' , $inline_pdf);
|
||||
Config::Set('system', 'inline_pdf' , $inline_pdf);
|
||||
|
||||
$ts = ((x($_POST,'transport_security')) ? True : False);
|
||||
set_config('system','transport_security_header',$ts);
|
||||
Config::Set('system','transport_security_header',$ts);
|
||||
|
||||
$cs = ((x($_POST,'content_security')) ? True : False);
|
||||
set_config('system','content_security_policy',$cs);
|
||||
Config::Set('system','content_security_policy',$cs);
|
||||
|
||||
$trusted_directory_servers = $this->trim_array_elems(explode("\n", $_POST['trusted_directory_servers']));
|
||||
set_config('system', 'trusted_directory_servers', $trusted_directory_servers);
|
||||
Config::Set('system', 'trusted_directory_servers', $trusted_directory_servers);
|
||||
|
||||
goaway(z_root() . '/admin/security');
|
||||
}
|
||||
@@ -66,31 +67,31 @@ class Security {
|
||||
|
||||
function get() {
|
||||
|
||||
$whitesites = get_config('system','whitelisted_sites');
|
||||
$whitesites = Config::Get('system','whitelisted_sites');
|
||||
$whitesites_str = ((is_array($whitesites)) ? implode("\n",$whitesites) : '');
|
||||
|
||||
$blacksites = get_config('system','blacklisted_sites');
|
||||
$blacksites = Config::Get('system','blacklisted_sites');
|
||||
$blacksites_str = ((is_array($blacksites)) ? implode("\n",$blacksites) : '');
|
||||
|
||||
|
||||
$whitechannels = get_config('system','whitelisted_channels');
|
||||
$whitechannels = Config::Get('system','whitelisted_channels');
|
||||
$whitechannels_str = ((is_array($whitechannels)) ? implode("\n",$whitechannels) : '');
|
||||
|
||||
$blackchannels = get_config('system','blacklisted_channels');
|
||||
$blackchannels = Config::Get('system','blacklisted_channels');
|
||||
$blackchannels_str = ((is_array($blackchannels)) ? implode("\n",$blackchannels) : '');
|
||||
|
||||
|
||||
$whiteembeds = get_config('system','embed_allow');
|
||||
$whiteembeds = Config::Get('system','embed_allow');
|
||||
$whiteembeds_str = ((is_array($whiteembeds)) ? implode("\n",$whiteembeds) : '');
|
||||
|
||||
$blackembeds = get_config('system','embed_deny');
|
||||
$blackembeds = Config::Get('system','embed_deny');
|
||||
$blackembeds_str = ((is_array($blackembeds)) ? implode("\n",$blackembeds) : '');
|
||||
|
||||
$trusted_directory_servers = get_config('system', 'trusted_directory_servers');
|
||||
$trusted_directory_servers = Config::Get('system', 'trusted_directory_servers');
|
||||
$trusted_directory_servers_str = ((is_array($trusted_directory_servers)) ? implode("\n", $trusted_directory_servers) : '');
|
||||
$is_dir = (intval(get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL)) !== DIRECTORY_MODE_NORMAL);
|
||||
$is_dir = (intval(Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL)) !== DIRECTORY_MODE_NORMAL);
|
||||
|
||||
$embed_coop = intval(get_config('system','embed_coop'));
|
||||
$embed_coop = intval(Config::Get('system','embed_coop'));
|
||||
|
||||
if((! $whiteembeds) && (! $blackembeds)) {
|
||||
$embedhelp1 = t("By default, unfiltered HTML is allowed in embedded media. This is inherently insecure.");
|
||||
@@ -105,22 +106,22 @@ class Security {
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Security'),
|
||||
'$form_security_token' => get_form_security_token('admin_security'),
|
||||
'$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently authenticated.")),
|
||||
'$cloud_noroot' => [ 'cloud_noroot', t('Provide a cloud root directory'), 1 - intval(get_config('system','cloud_disable_siteroot')), t('The cloud root directory lists all channel names which provide public files') ],
|
||||
'$cloud_disksize' => [ 'cloud_disksize', t('Show total disk space available to cloud uploads'), intval(get_config('system','cloud_report_disksize')), '' ],
|
||||
'$transport_security' => array('transport_security', t('Set "Transport Security" HTTP header'),intval(get_config('system','transport_security_header')),''),
|
||||
'$content_security' => array('content_security', t('Set "Content Security Policy" HTTP header'),intval(get_config('system','content_security_policy')),''),
|
||||
'$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")),
|
||||
'$not_allowed_email' => array('not_allowed_email', t("Not allowed email domains"), get_config('system','not_allowed_email'), t("Comma separated list of domains which are not allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains, unless allowed domains have been defined.")),
|
||||
'$block_public' => array('block_public', t("Block public"), Config::Get('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently authenticated.")),
|
||||
'$cloud_noroot' => [ 'cloud_noroot', t('Provide a cloud root directory'), 1 - intval(Config::Get('system','cloud_disable_siteroot')), t('The cloud root directory lists all channel names which provide public files') ],
|
||||
'$cloud_disksize' => [ 'cloud_disksize', t('Show total disk space available to cloud uploads'), intval(Config::Get('system','cloud_report_disksize')), '' ],
|
||||
'$transport_security' => array('transport_security', t('Set "Transport Security" HTTP header'),intval(Config::Get('system','transport_security_header')),''),
|
||||
'$content_security' => array('content_security', t('Set "Content Security Policy" HTTP header'),intval(Config::Get('system','content_security_policy')),''),
|
||||
'$allowed_email' => array('allowed_email', t("Allowed email domains"), Config::Get('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")),
|
||||
'$not_allowed_email' => array('not_allowed_email', t("Not allowed email domains"), Config::Get('system','not_allowed_email'), t("Comma separated list of domains which are not allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains, unless allowed domains have been defined.")),
|
||||
'$whitelisted_sites' => array('whitelisted_sites', t('Allow communications only from these sites'), $whitesites_str, t('One site per line. Leave empty to allow communication from anywhere by default')),
|
||||
'$blacklisted_sites' => array('blacklisted_sites', t('Block communications from these sites'), $blacksites_str, ''),
|
||||
'$whitelisted_channels' => array('whitelisted_channels', t('Allow communications only from these channels'), $whitechannels_str, t('One channel (hash) per line. Leave empty to allow from any channel by default')),
|
||||
'$blacklisted_channels' => array('blacklisted_channels', t('Block communications from these channels'), $blackchannels_str, ''),
|
||||
'$embed_sslonly' => array('embed_sslonly',t('Only allow embeds from secure (SSL) websites and links.'), intval(get_config('system','embed_sslonly')),''),
|
||||
'$embed_sslonly' => array('embed_sslonly',t('Only allow embeds from secure (SSL) websites and links.'), intval(Config::Get('system','embed_sslonly')),''),
|
||||
'$embed_allow' => array('embed_allow', t('Allow unfiltered embedded HTML content only from these domains'), $whiteembeds_str, t('One site per line. By default embedded content is filtered.')),
|
||||
'$embed_deny' => array('embed_deny', t('Block embedded HTML from these domains'), $blackembeds_str, ''),
|
||||
'$thumbnail_security' => [ 'thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.") ],
|
||||
'$inline_pdf' => [ 'inline_pdf', t("Allow embedded (inline) PDF files"), get_config('system','inline_pdf',0), '' ],
|
||||
'$thumbnail_security' => [ 'thumbnail_security', t("Allow SVG thumbnails in file browser"), Config::Get('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.") ],
|
||||
'$inline_pdf' => [ 'inline_pdf', t("Allow embedded (inline) PDF files"), Config::Get('system','inline_pdf',0), '' ],
|
||||
|
||||
'$trusted_directory_servers' => (($is_dir) ? ['trusted_directory_servers', t('Additional trusted directory server URLs'), $trusted_directory_servers_str, t('Accept directory flags (spam, nsfw) from those servers. One per line like https://example.tld')] : ''),
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Site {
|
||||
|
||||
@@ -125,8 +126,8 @@ class Site {
|
||||
//logger( print_r( $this->msgbg, true) );
|
||||
//logger( print_r( $this->joo, true) );
|
||||
if ($this->error === 0) {
|
||||
set_config('system', 'register_duty', $this->register_duty);
|
||||
set_config('system', 'register_duty_jso', $this->joo);
|
||||
Config::Set('system', 'register_duty', $this->register_duty);
|
||||
Config::Set('system', 'register_duty_jso', $this->joo);
|
||||
} else {
|
||||
notice('ZAR0130E,' . t('Errors') . ': ' . $this->error . EOL . $this->msgfg . EOL);
|
||||
}
|
||||
@@ -134,87 +135,87 @@ class Site {
|
||||
}
|
||||
// <-hilmar]
|
||||
|
||||
set_config('system', 'feed_contacts', $feed_contacts);
|
||||
set_config('system', 'delivery_interval', $delivery_interval);
|
||||
set_config('system', 'delivery_batch_count', $delivery_batch_count);
|
||||
set_config('system', 'poll_interval', $poll_interval);
|
||||
set_config('system', 'maxloadavg', $maxloadavg);
|
||||
set_config('system', 'frontpage', $frontpage);
|
||||
set_config('system', 'sellpage', $site_sellpage);
|
||||
set_config('system', 'workflow_channel_next', $first_page);
|
||||
set_config('system', 'site_location', $site_location);
|
||||
set_config('system', 'mirror_frontpage', $mirror_frontpage);
|
||||
set_config('system', 'sitename', $sitename);
|
||||
set_config('system', 'login_on_homepage', $login_on_homepage);
|
||||
set_config('system', 'enable_context_help', $enable_context_help);
|
||||
set_config('system', 'verify_email', $verify_email);
|
||||
set_config('system', 'max_daily_registrations', $register_perday);
|
||||
set_config('system', 'register_sameip', $register_sameip);
|
||||
set_config('system', 'register_delay', $reg_delay);
|
||||
set_config('system', 'register_expire', $reg_expire);
|
||||
set_config('system', 'default_expire_days', $default_expire_days);
|
||||
set_config('system', 'active_expire_days', $active_expire_days);
|
||||
set_config('system', 'reply_address', $reply_address);
|
||||
set_config('system', 'from_email', $from_email);
|
||||
set_config('system', 'from_email_name' , $from_email_name);
|
||||
set_config('system', 'imagick_convert_path' , $imagick_path);
|
||||
set_config('system', 'default_permissions_role', $permissions_role);
|
||||
set_config('system', 'pubstream_incl',$pub_incl);
|
||||
set_config('system', 'pubstream_excl',$pub_excl);
|
||||
Config::Set('system', 'feed_contacts', $feed_contacts);
|
||||
Config::Set('system', 'delivery_interval', $delivery_interval);
|
||||
Config::Set('system', 'delivery_batch_count', $delivery_batch_count);
|
||||
Config::Set('system', 'poll_interval', $poll_interval);
|
||||
Config::Set('system', 'maxloadavg', $maxloadavg);
|
||||
Config::Set('system', 'frontpage', $frontpage);
|
||||
Config::Set('system', 'sellpage', $site_sellpage);
|
||||
Config::Set('system', 'workflow_channel_next', $first_page);
|
||||
Config::Set('system', 'site_location', $site_location);
|
||||
Config::Set('system', 'mirror_frontpage', $mirror_frontpage);
|
||||
Config::Set('system', 'sitename', $sitename);
|
||||
Config::Set('system', 'login_on_homepage', $login_on_homepage);
|
||||
Config::Set('system', 'enable_context_help', $enable_context_help);
|
||||
Config::Set('system', 'verify_email', $verify_email);
|
||||
Config::Set('system', 'max_daily_registrations', $register_perday);
|
||||
Config::Set('system', 'register_sameip', $register_sameip);
|
||||
Config::Set('system', 'register_delay', $reg_delay);
|
||||
Config::Set('system', 'register_expire', $reg_expire);
|
||||
Config::Set('system', 'default_expire_days', $default_expire_days);
|
||||
Config::Set('system', 'active_expire_days', $active_expire_days);
|
||||
Config::Set('system', 'reply_address', $reply_address);
|
||||
Config::Set('system', 'from_email', $from_email);
|
||||
Config::Set('system', 'from_email_name' , $from_email_name);
|
||||
Config::Set('system', 'imagick_convert_path' , $imagick_path);
|
||||
Config::Set('system', 'default_permissions_role', $permissions_role);
|
||||
Config::Set('system', 'pubstream_incl',$pub_incl);
|
||||
Config::Set('system', 'pubstream_excl',$pub_excl);
|
||||
|
||||
|
||||
if($directory_server)
|
||||
set_config('system','directory_server',$directory_server);
|
||||
Config::Set('system','directory_server',$directory_server);
|
||||
|
||||
if ($banner == '') {
|
||||
del_config('system', 'banner');
|
||||
Config::Delete('system', 'banner');
|
||||
} else {
|
||||
set_config('system', 'banner', $banner);
|
||||
Config::Set('system', 'banner', $banner);
|
||||
}
|
||||
|
||||
if ($admininfo == ''){
|
||||
del_config('system', 'admininfo');
|
||||
Config::Delete('system', 'admininfo');
|
||||
} else {
|
||||
require_once('include/text.php');
|
||||
linkify_tags($admininfo, local_channel());
|
||||
set_config('system', 'admininfo', $admininfo);
|
||||
Config::Set('system', 'admininfo', $admininfo);
|
||||
}
|
||||
set_config('system','siteinfo',$siteinfo);
|
||||
//set_config('system', 'language', $language);
|
||||
set_config('system', 'theme', $theme);
|
||||
Config::Set('system','siteinfo',$siteinfo);
|
||||
//Config::Set('system', 'language', $language);
|
||||
Config::Set('system', 'theme', $theme);
|
||||
// if ( $theme_mobile === '---' ) {
|
||||
// del_config('system', 'mobile_theme');
|
||||
// Config::Delete('system', 'mobile_theme');
|
||||
// } else {
|
||||
// set_config('system', 'mobile_theme', $theme_mobile);
|
||||
// Config::Set('system', 'mobile_theme', $theme_mobile);
|
||||
// }
|
||||
// set_config('system','site_channel', $site_channel);
|
||||
set_config('system','maximagesize', $maximagesize);
|
||||
// Config::Set('system','site_channel', $site_channel);
|
||||
Config::Set('system','maximagesize', $maximagesize);
|
||||
|
||||
set_config('system','register_policy', $register_policy);
|
||||
set_config('system','register_wo_email', $register_wo_email);
|
||||
set_config('system','minimum_age', $minimum_age);
|
||||
set_config('system','auto_channel_create', $reg_autochannel);
|
||||
set_config('system', 'invitation_only', $invitation_only);
|
||||
set_config('system', 'invitation_also', $invitation_also);
|
||||
set_config('system','access_policy', $access_policy);
|
||||
set_config('system','account_abandon_days', $abandon_days);
|
||||
set_config('system','register_text', $register_text);
|
||||
set_config('system','allowed_sites', $allowed_sites);
|
||||
set_config('system','publish_all', $force_publish);
|
||||
set_config('system','disable_discover_tab', $disable_discover_tab);
|
||||
set_config('system','site_firehose', $site_firehose);
|
||||
set_config('system','open_pubstream', $open_pubstream);
|
||||
//set_config('system','force_queue_threshold', $force_queue);
|
||||
Config::Set('system','register_policy', $register_policy);
|
||||
Config::Set('system','register_wo_email', $register_wo_email);
|
||||
Config::Set('system','minimum_age', $minimum_age);
|
||||
Config::Set('system','auto_channel_create', $reg_autochannel);
|
||||
Config::Set('system', 'invitation_only', $invitation_only);
|
||||
Config::Set('system', 'invitation_also', $invitation_also);
|
||||
Config::Set('system','access_policy', $access_policy);
|
||||
Config::Set('system','account_abandon_days', $abandon_days);
|
||||
Config::Set('system','register_text', $register_text);
|
||||
Config::Set('system','allowed_sites', $allowed_sites);
|
||||
Config::Set('system','publish_all', $force_publish);
|
||||
Config::Set('system','disable_discover_tab', $disable_discover_tab);
|
||||
Config::Set('system','site_firehose', $site_firehose);
|
||||
Config::Set('system','open_pubstream', $open_pubstream);
|
||||
//Config::Set('system','force_queue_threshold', $force_queue);
|
||||
|
||||
set_config('system','no_community_page', $no_community_page);
|
||||
set_config('system','no_utf', $no_utf);
|
||||
Config::Set('system','no_community_page', $no_community_page);
|
||||
Config::Set('system','no_utf', $no_utf);
|
||||
|
||||
set_config('system','sse_enabled', $sse_enabled);
|
||||
Config::Set('system','sse_enabled', $sse_enabled);
|
||||
|
||||
set_config('system','verifyssl', $verifyssl);
|
||||
set_config('system','proxyuser', $proxyuser);
|
||||
set_config('system','proxy', $proxy);
|
||||
set_config('system','curl_timeout', $timeout);
|
||||
Config::Set('system','verifyssl', $verifyssl);
|
||||
Config::Set('system','proxyuser', $proxyuser);
|
||||
Config::Set('system','proxy', $proxy);
|
||||
Config::Set('system','curl_timeout', $timeout);
|
||||
|
||||
info( t('Site settings updated.') . EOL);
|
||||
goaway(z_root() . '/admin/site' );
|
||||
@@ -263,7 +264,7 @@ class Site {
|
||||
}
|
||||
|
||||
$dir_choices = null;
|
||||
$dirmode = get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL);
|
||||
$dirmode = Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL);
|
||||
$realm = get_directory_realm();
|
||||
|
||||
// directory server should not be set or settable unless we are a directory client
|
||||
@@ -291,14 +292,14 @@ class Site {
|
||||
|
||||
/* Banner */
|
||||
|
||||
$banner = get_config('system', 'banner');
|
||||
$banner = Config::Get('system', 'banner');
|
||||
if($banner === false)
|
||||
$banner = get_config('system','sitename');
|
||||
$banner = Config::Get('system','sitename');
|
||||
|
||||
$banner = htmlspecialchars($banner);
|
||||
|
||||
/* Admin Info */
|
||||
$admininfo = get_config('system', 'admininfo');
|
||||
$admininfo = Config::Get('system', 'admininfo');
|
||||
|
||||
/* Register policy */
|
||||
$register_choices = Array(
|
||||
@@ -306,8 +307,8 @@ class Site {
|
||||
REGISTER_APPROVE => t("Yes - with approval"),
|
||||
REGISTER_OPEN => t("Yes")
|
||||
);
|
||||
$this->register_duty = get_config('system', 'register_duty', '-:-');
|
||||
$register_perday = get_config('system','max_daily_registrations', 50);
|
||||
$this->register_duty = Config::Get('system', 'register_duty', '-:-');
|
||||
$register_perday = Config::Get('system','max_daily_registrations', 50);
|
||||
|
||||
/* Acess policy */
|
||||
$access_choices = Array(
|
||||
@@ -317,7 +318,7 @@ class Site {
|
||||
ACCESS_TIERED => t("My site offers free accounts with optional paid upgrades")
|
||||
);
|
||||
|
||||
$discover_tab = get_config('system','disable_discover_tab');
|
||||
$discover_tab = Config::Get('system','disable_discover_tab');
|
||||
|
||||
// $disable public streams by default
|
||||
if($discover_tab === false)
|
||||
@@ -326,7 +327,7 @@ class Site {
|
||||
$discover_tab = (1 - $discover_tab);
|
||||
|
||||
$perm_roles = \Zotlabs\Access\PermissionRoles::channel_roles();
|
||||
$default_role = get_config('system', 'default_permissions_role', 'personal');
|
||||
$default_role = Config::Get('system', 'default_permissions_role', 'personal');
|
||||
|
||||
if (!in_array($default_role, array_keys($perm_roles))) {
|
||||
$default_role = 'personal';
|
||||
@@ -334,8 +335,8 @@ class Site {
|
||||
|
||||
$role = array('permissions_role' , t('Default permission role for new accounts'), $default_role, t('This role will be used for the first channel created after registration.'),$perm_roles);
|
||||
|
||||
$homelogin = get_config('system','login_on_homepage');
|
||||
$enable_context_help = get_config('system','enable_context_help');
|
||||
$homelogin = Config::Get('system','login_on_homepage');
|
||||
$enable_context_help = Config::Get('system','enable_context_help');
|
||||
|
||||
// for reuse reg_delay and reg_expire
|
||||
$reg_rabots = array(
|
||||
@@ -347,7 +348,7 @@ class Site {
|
||||
'y' => t('Year(s)')
|
||||
);
|
||||
$regdelay_n = $regdelay_u = false;
|
||||
$regdelay = get_config('system','register_delay');
|
||||
$regdelay = Config::Get('system','register_delay');
|
||||
if ($regdelay)
|
||||
list($regdelay_n, $regdelay_u) = array(substr($regdelay,0,-1),substr($regdelay,-1));
|
||||
$reg_delay = replace_macros(get_markup_template('field_duration.qmc.tpl'),
|
||||
@@ -369,7 +370,7 @@ class Site {
|
||||
)
|
||||
);
|
||||
$regexpire_n = $regexpire_u = false;
|
||||
$regexpire = get_config('system','register_expire');
|
||||
$regexpire = Config::Get('system','register_expire');
|
||||
if ($regexpire)
|
||||
list($regexpire_n, $regexpire_u) = array(substr($regexpire,0,-1),substr($regexpire,-1));
|
||||
$reg_expire = replace_macros(get_markup_template('field_duration.qmc.tpl'),
|
||||
@@ -406,38 +407,38 @@ class Site {
|
||||
|
||||
'$baseurl' => z_root(),
|
||||
// name, label, value, help string, extra data...
|
||||
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
|
||||
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(Config::Get('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
|
||||
|
||||
'$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')),
|
||||
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
|
||||
'$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),
|
||||
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
|
||||
// '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
|
||||
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
|
||||
'$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
|
||||
'$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
|
||||
'$minimum_age' => array('minimum_age', t("Minimum age"), (x(get_config('system','minimum_age'))?get_config('system','minimum_age'):13), t("Minimum age (in years) for who may register on this site.")),
|
||||
'$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), t("This is displayed on the public server site list."), $access_choices),
|
||||
'$siteinfo' => array('siteinfo', t('Site Information'), Config::Get('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),
|
||||
'$theme' => array('theme', t("System theme"), Config::Get('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
|
||||
// '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), Config::Get('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
|
||||
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), Config::Get('system','site_channel'), t("Site Channel")),
|
||||
'$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),Config::Get('system','feed_contacts'),t('(Heavy system resource usage)')),
|
||||
'$maximagesize' => array('maximagesize', t("Maximum image size"), intval(Config::Get('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
|
||||
'$minimum_age' => array('minimum_age', t("Minimum age"), (x(Config::Get('system','minimum_age'))?Config::Get('system','minimum_age'):13), t("Minimum age (in years) for who may register on this site.")),
|
||||
'$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), Config::Get('system','access_policy'), t("This is displayed on the public server site list."), $access_choices),
|
||||
|
||||
// Register
|
||||
// [hilmar->
|
||||
'$register_text' => [
|
||||
'register_text',
|
||||
t("Register text"),
|
||||
htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'),
|
||||
htmlspecialchars(Config::Get('system','register_text'), ENT_QUOTES, 'UTF-8'),
|
||||
t("This text will be displayed prominently at the registration page")
|
||||
],
|
||||
'$register_policy' => [
|
||||
'register_policy',
|
||||
t("Does this site allow new member registration?"),
|
||||
get_config('system','register_policy'),
|
||||
Config::Get('system','register_policy'),
|
||||
"",
|
||||
$register_choices,
|
||||
],
|
||||
'$register_duty' => [
|
||||
'register_duty',
|
||||
t('Configure the registration open days/hours'),
|
||||
get_config('system', 'register_duty', '-:-'),
|
||||
Config::Get('system', 'register_duty', '-:-'),
|
||||
t('Empty or \'-:-\' value will keep registration open 24/7 (default)') . EOL .
|
||||
t('Weekdays and hours must be separated by colon \':\', From-To ranges with a dash `-` example: 1:800-1200') . EOL .
|
||||
t('Weekday:Hour pairs must be separated by space \' \' example: 1:900-1700 2:900-1700') . EOL .
|
||||
@@ -448,13 +449,13 @@ class Site {
|
||||
'$register_perday' => [
|
||||
'register_perday',
|
||||
t('Max account registrations per day'),
|
||||
get_config('system', 'max_daily_registrations', 50),
|
||||
Config::Get('system', 'max_daily_registrations', 50),
|
||||
t('Unlimited if zero or no value - default 50')
|
||||
],
|
||||
'$register_sameip' => [
|
||||
'register_sameip',
|
||||
t('Max account registrations from same IP'),
|
||||
get_config('system', 'register_sameip', 3),
|
||||
Config::Get('system', 'register_sameip', 3),
|
||||
t('Unlimited if zero or no value - default 3')
|
||||
],
|
||||
'$reg_delay' => $reg_delay,
|
||||
@@ -462,70 +463,70 @@ class Site {
|
||||
'$reg_autochannel' => [
|
||||
'auto_channel_create',
|
||||
t("Auto channel create"),
|
||||
get_config('system','auto_channel_create', 1),
|
||||
Config::Get('system','auto_channel_create', 1),
|
||||
t("If disabled the channel will be created in a separate step during the registration process")
|
||||
],
|
||||
'$invitation_only' => [
|
||||
'invitation_only',
|
||||
t("Require invite code"),
|
||||
get_config('system', 'invitation_only', 0)
|
||||
Config::Get('system', 'invitation_only', 0)
|
||||
],
|
||||
'$invitation_also' => [
|
||||
'invitation_also',
|
||||
t("Allow invite code"),
|
||||
get_config('system', 'invitation_also', 0)
|
||||
Config::Get('system', 'invitation_also', 0)
|
||||
],
|
||||
'$verify_email' => [
|
||||
'verify_email',
|
||||
t("Require email address"),
|
||||
get_config('system','verify_email'),
|
||||
Config::Get('system','verify_email'),
|
||||
t("The provided email address will be verified (recommended)")
|
||||
],
|
||||
'$abandon_days' => [
|
||||
'abandon_days',
|
||||
t('Abandon account after x days'),
|
||||
get_config('system','account_abandon_days'),
|
||||
Config::Get('system','account_abandon_days'),
|
||||
t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')
|
||||
],
|
||||
// <-hilmar]
|
||||
|
||||
'$role' => $role,
|
||||
'$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'pubstream' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")),
|
||||
'$mirror_frontpage' => array('mirror_frontpage', t("Preserve site homepage URL"), get_config('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')),
|
||||
'$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")),
|
||||
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory")),
|
||||
'$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), Config::Get('system','frontpage'), t("example: 'pubstream' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")),
|
||||
'$mirror_frontpage' => array('mirror_frontpage', t("Preserve site homepage URL"), Config::Get('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')),
|
||||
'$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), Config::Get('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")),
|
||||
'$force_publish' => array('publish_all', t("Force publish"), Config::Get('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory")),
|
||||
'$disable_discover_tab' => array('disable_discover_tab', t('Enable public stream'), $discover_tab, t('Enable the public stream. Warning: this content is unmoderated')),
|
||||
'$site_firehose' => array('site_firehose', t('Site only public stream'), get_config('system','site_firehose'), t('Restrict the public stream to content originating at this site')),
|
||||
'$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the public streams'), get_config('system','open_pubstream',1), t('Disable to require authentication before viewing')),
|
||||
'$incl' => array('pub_incl',t('Only import Public stream posts with this text'), get_config('system','pubstream_incl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
|
||||
'$excl' => array('pub_excl',t('Do not import Public stream posts with this text'), get_config('system','pubstream_excl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
|
||||
'$site_firehose' => array('site_firehose', t('Site only public stream'), Config::Get('system','site_firehose'), t('Restrict the public stream to content originating at this site')),
|
||||
'$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the public streams'), Config::Get('system','open_pubstream',1), t('Disable to require authentication before viewing')),
|
||||
'$incl' => array('pub_incl',t('Only import Public stream posts with this text'), Config::Get('system','pubstream_incl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
|
||||
'$excl' => array('pub_excl',t('Do not import Public stream posts with this text'), Config::Get('system','pubstream_excl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
|
||||
|
||||
|
||||
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
|
||||
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
|
||||
|
||||
'$reply_address' => [ 'reply_address', t('Reply-to email address for system generated email.'), get_config('system','reply_address','noreply@' . \App::get_hostname()),'' ],
|
||||
'$from_email' => [ 'from_email', t('Sender (From) email address for system generated email.'), get_config('system','from_email','Administrator@' . \App::get_hostname()),'' ],
|
||||
'$from_email_name' => [ 'from_email_name', t('Name of email sender for system generated email.'), get_config('system','from_email_name',\Zotlabs\Lib\System::get_site_name()),'' ],
|
||||
'$reply_address' => [ 'reply_address', t('Reply-to email address for system generated email.'), Config::Get('system','reply_address','noreply@' . \App::get_hostname()),'' ],
|
||||
'$from_email' => [ 'from_email', t('Sender (From) email address for system generated email.'), Config::Get('system','from_email','Administrator@' . \App::get_hostname()),'' ],
|
||||
'$from_email_name' => [ 'from_email_name', t('Name of email sender for system generated email.'), Config::Get('system','from_email_name',\Zotlabs\Lib\System::get_site_name()),'' ],
|
||||
|
||||
'$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null),
|
||||
'$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), Config::Get('system','directory_server'), t("Default directory server"), $dir_choices) : null),
|
||||
|
||||
'$sse_enabled' => array('sse_enabled', t('Enable SSE Notifications'), get_config('system', 'sse_enabled', 0), t('If disabled, traditional polling will be used. Warning: this setting might not be suited for shared hosting')),
|
||||
'$sse_enabled' => array('sse_enabled', t('Enable SSE Notifications'), Config::Get('system', 'sse_enabled', 0), t('If disabled, traditional polling will be used. Warning: this setting might not be suited for shared hosting')),
|
||||
|
||||
'$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
|
||||
'$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
|
||||
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
|
||||
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
|
||||
'$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
|
||||
//'$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")),
|
||||
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
|
||||
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
|
||||
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
|
||||
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days', 30)), t('0 for no expiration of imported content')),
|
||||
'$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(get_config('system','active_expire_days',7)), ''),
|
||||
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
|
||||
'$first_page' => array('first_page', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Default: profiles')),
|
||||
'$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')),
|
||||
'$proxyuser' => array('proxyuser', t("Proxy user"), Config::Get('system','proxyuser'), ""),
|
||||
'$proxy' => array('proxy', t("Proxy URL"), Config::Get('system','proxy'), ""),
|
||||
'$timeout' => array('timeout', t("Network timeout"), (x(Config::Get('system','curl_timeout'))?Config::Get('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
|
||||
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(Config::Get('system','delivery_interval'))?Config::Get('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
|
||||
'$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(Config::Get('system','delivery_batch_count'))?Config::Get('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
|
||||
//'$force_queue' => array('force_queue', t("Queue Threshold"), Config::Get('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")),
|
||||
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(Config::Get('system','poll_interval'))?Config::Get('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
|
||||
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), Config::Get('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
|
||||
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(Config::Get('system','maxloadavg')) > 0)?Config::Get('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
|
||||
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(Config::Get('system','default_expire_days', 30)), t('0 for no expiration of imported content')),
|
||||
'$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(Config::Get('system','active_expire_days',7)), ''),
|
||||
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), Config::Get('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
|
||||
'$first_page' => array('first_page', t('Page to display after creating a new channel'), Config::Get('system','workflow_channel_next','profiles'), t('Default: profiles')),
|
||||
'$location' => array('site_location', t('Optional: site location'), Config::Get('system','site_location',''), t('Region or country')),
|
||||
'$form_security_token' => get_form_security_token("admin_site"),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Module\Admin;
|
||||
|
||||
use \Michelf\MarkdownExtra;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
/**
|
||||
* @brief Admin area theme settings.
|
||||
@@ -37,7 +38,7 @@ class Themes {
|
||||
* @return string with parsed HTML
|
||||
*/
|
||||
function get(){
|
||||
$allowed_themes_str = get_config('system', 'allowed_themes');
|
||||
$allowed_themes_str = Config::Get('system', 'allowed_themes');
|
||||
$allowed_themes_raw = explode(',', $allowed_themes_str);
|
||||
$allowed_themes = array();
|
||||
if(count($allowed_themes_raw))
|
||||
@@ -100,7 +101,7 @@ class Themes {
|
||||
info(sprintf('Theme %s disabled.', $theme));
|
||||
}
|
||||
|
||||
set_config('system', 'allowed_themes', $s);
|
||||
Config::Set('system', 'allowed_themes', $s);
|
||||
goaway(z_root() . '/admin/themes' );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/api.php');
|
||||
|
||||
class Api extends \Zotlabs\Web\Controller {
|
||||
@@ -57,7 +59,7 @@ class Api extends \Zotlabs\Web\Controller {
|
||||
$consumer = new \OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
|
||||
|
||||
$verifier = md5($app['secret'] . local_channel());
|
||||
set_config('oauth', $verifier, local_channel());
|
||||
Config::Set('oauth', $verifier, local_channel());
|
||||
|
||||
|
||||
if($consumer->callback_url != null) {
|
||||
|
||||
@@ -16,21 +16,21 @@ class Appman extends \Zotlabs\Web\Controller {
|
||||
if(isset($_POST['url']) && $_POST['url']) {
|
||||
$arr = array(
|
||||
'uid' => intval($_REQUEST['uid']),
|
||||
'url' => escape_tags($_REQUEST['url']),
|
||||
'guid' => escape_tags($_REQUEST['guid']),
|
||||
'author' => escape_tags($_REQUEST['author']),
|
||||
'addr' => escape_tags($_REQUEST['addr']),
|
||||
'name' => escape_tags($_REQUEST['name']),
|
||||
'desc' => escape_tags($_REQUEST['desc']),
|
||||
'photo' => escape_tags($_REQUEST['photo']),
|
||||
'version' => escape_tags($_REQUEST['version']),
|
||||
'price' => escape_tags($_REQUEST['price']),
|
||||
'page' => escape_tags($_REQUEST['page']),
|
||||
'requires' => escape_tags($_REQUEST['requires']),
|
||||
'url' => escape_tags($_REQUEST['url'] ?? ''),
|
||||
'guid' => escape_tags($_REQUEST['guid'] ?? ''),
|
||||
'author' => escape_tags($_REQUEST['author'] ?? ''),
|
||||
'addr' => escape_tags($_REQUEST['addr'] ?? ''),
|
||||
'name' => escape_tags($_REQUEST['name'] ?? ''),
|
||||
'desc' => escape_tags($_REQUEST['desc'] ?? ''),
|
||||
'photo' => escape_tags($_REQUEST['photo'] ?? ''),
|
||||
'version' => escape_tags($_REQUEST['version'] ?? ''),
|
||||
'price' => escape_tags($_REQUEST['price'] ?? ''),
|
||||
'page' => escape_tags($_REQUEST['page'] ?? ''),
|
||||
'requires' => escape_tags($_REQUEST['requires'] ?? ''),
|
||||
'system' => intval($_REQUEST['system']),
|
||||
'plugin' => escape_tags($_REQUEST['plugin']),
|
||||
'sig' => escape_tags($_REQUEST['sig']),
|
||||
'categories' => escape_tags($_REQUEST['categories'])
|
||||
'plugin' => escape_tags($_REQUEST['plugin'] ?? ''),
|
||||
'sig' => escape_tags($_REQUEST['sig'] ?? ''),
|
||||
'categories' => escape_tags($_REQUEST['categories'] ?? '')
|
||||
);
|
||||
|
||||
$_REQUEST['appid'] = Apps::app_install(local_channel(),$arr);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
|
||||
use \Zotlabs\Lib\Config;
|
||||
use \Zotlabs\Lib as Zlib;
|
||||
|
||||
class Apps extends \Zotlabs\Web\Controller {
|
||||
@@ -46,7 +46,7 @@ class Apps extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('myapps.tpl'), array(
|
||||
'$sitename' => get_config('system','sitename'),
|
||||
'$sitename' => Config::Get('system','sitename'),
|
||||
'$cat' => $cat,
|
||||
'$title' => (($available) ? t('Available Apps') : t('Installed Apps')),
|
||||
'$apps' => $apps,
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Zotlabs\Module;
|
||||
use App;
|
||||
use Zotlabs\Lib\Activity;
|
||||
use Zotlabs\Lib\ActivityStreams;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Crypto;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Lib\PermissionDescription;
|
||||
@@ -176,7 +177,7 @@ class Channel extends Controller {
|
||||
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
$noscript_content = get_config('system', 'noscript_content', '1');
|
||||
$noscript_content = Config::Get('system', 'noscript_content', '1');
|
||||
|
||||
$category = $datequery = $datequery2 = '';
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
|
||||
/*
|
||||
@@ -112,10 +113,10 @@ class Cover_photo extends \Zotlabs\Web\Controller {
|
||||
|
||||
if($r) {
|
||||
|
||||
$max_thumb = intval(get_config('system','max_thumbnail',1600));
|
||||
$max_thumb = intval(Config::Get('system','max_thumbnail',1600));
|
||||
$iscaled = false;
|
||||
if(intval($r[0]['height']) > $max_thumb || intval($r[0]['width']) > $max_thumb) {
|
||||
$imagick_path = get_config('system','imagick_convert_path');
|
||||
$imagick_path = Config::Get('system','imagick_convert_path');
|
||||
if($imagick_path && @file_exists($imagick_path) && intval($r[0]['os_storage'])) {
|
||||
|
||||
$fname = dbunescbin($r[0]['content']);
|
||||
@@ -428,7 +429,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
|
||||
|
||||
function cover_photo_crop_ui_head(&$a, $ph, $hash, $smallest){
|
||||
|
||||
$max_length = get_config('system','max_image_length');
|
||||
$max_length = Config::Get('system','max_image_length');
|
||||
if(! $max_length)
|
||||
$max_length = MAX_IMAGE_LENGTH;
|
||||
if($max_length > 0)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Web\Controller;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Dircensor extends Controller {
|
||||
|
||||
@@ -14,7 +14,7 @@ class Dircensor extends Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
$dirmode = intval(get_config('system','directory_mode'));
|
||||
$dirmode = intval(Config::Get('system','directory_mode'));
|
||||
|
||||
if(!in_array($dirmode, [DIRECTORY_MODE_PRIMARY, DIRECTORY_MODE_SECONDARY, DIRECTORY_MODE_STANDALONE])) {
|
||||
return;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Web\Controller;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/bbcode.php');
|
||||
@@ -73,7 +73,7 @@ class Directory extends Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
if(get_config('system','block_public_directory',false) && (! get_observer_hash())) {
|
||||
if(Config::Get('system','block_public_directory',false) && (! get_observer_hash())) {
|
||||
notice( t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ class Directory extends Controller {
|
||||
$safe_mode = 1;
|
||||
$type = 0;
|
||||
|
||||
$r = suggestion_query(local_channel(),get_observer_hash(),0,60);
|
||||
$r = suggestion_query(local_channel(), get_observer_hash(), 0, 30);
|
||||
|
||||
if(! $r) {
|
||||
notice( t('No default suggestions were found.') . EOL);
|
||||
@@ -145,7 +145,7 @@ class Directory extends Controller {
|
||||
|
||||
$tpl = get_markup_template('directory_header.tpl');
|
||||
|
||||
$dirmode = intval(get_config('system','directory_mode'));
|
||||
$dirmode = intval(Config::Get('system','directory_mode'));
|
||||
|
||||
$directory_admin = false;
|
||||
|
||||
@@ -165,7 +165,7 @@ class Directory extends Controller {
|
||||
$url = $directory['url'] . '/dirsearch';
|
||||
}
|
||||
|
||||
$token = get_config('system','realm_token');
|
||||
$token = Config::Get('system','realm_token');
|
||||
|
||||
|
||||
logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
|
||||
@@ -184,11 +184,11 @@ class Directory extends Controller {
|
||||
|
||||
if($url) {
|
||||
|
||||
$numtags = get_config('system','directorytags');
|
||||
$numtags = Config::Get('system','directorytags');
|
||||
|
||||
$kw = ((intval($numtags) > 0) ? intval($numtags) : 50);
|
||||
|
||||
if(get_config('system','disable_directory_keywords'))
|
||||
if(Config::Get('system','disable_directory_keywords'))
|
||||
$kw = 0;
|
||||
|
||||
if (intval($safe_mode) === 0 && $directory_admin)
|
||||
@@ -213,7 +213,7 @@ class Directory extends Controller {
|
||||
if(! is_null($pubforums))
|
||||
$query .= '&pubforums=' . intval($pubforums);
|
||||
|
||||
$directory_sort_order = get_config('system','directory_sort_order');
|
||||
$directory_sort_order = Config::Get('system','directory_sort_order');
|
||||
if(! $directory_sort_order)
|
||||
$directory_sort_order = 'date';
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Dirsearch extends Controller {
|
||||
@@ -17,7 +18,7 @@ class Dirsearch extends Controller {
|
||||
|
||||
// logger('request: ' . print_r($_REQUEST,true));
|
||||
|
||||
$dirmode = intval(get_config('system','directory_mode'));
|
||||
$dirmode = intval(Config::Get('system','directory_mode'));
|
||||
|
||||
if($dirmode == DIRECTORY_MODE_NORMAL) {
|
||||
$ret['message'] = t('This site is not a directory server');
|
||||
@@ -26,7 +27,7 @@ class Dirsearch extends Controller {
|
||||
|
||||
$access_token = $_REQUEST['t'] ?? '';
|
||||
|
||||
$token = get_config('system','realm_token');
|
||||
$token = Config::Get('system','realm_token');
|
||||
if($token && $access_token != $token) {
|
||||
$ret['message'] = t('This directory server requires an access token');
|
||||
json_return_and_die($ret);
|
||||
@@ -79,7 +80,7 @@ class Dirsearch extends Controller {
|
||||
|
||||
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0);
|
||||
|
||||
if(get_config('system','disable_directory_keywords'))
|
||||
if(Config::Get('system','disable_directory_keywords'))
|
||||
$kw = 0;
|
||||
|
||||
|
||||
@@ -153,9 +154,13 @@ class Dirsearch extends Controller {
|
||||
}
|
||||
|
||||
|
||||
$perpage = $_REQUEST['n'] ?? 60;
|
||||
$page = ((isset($_REQUEST['p']) && $_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0);
|
||||
$startrec = (($page+1) * $perpage) - $perpage;
|
||||
$perpage = $_REQUEST['n'] ?? 30;
|
||||
if ($perpage > 30) {
|
||||
$perpage = 30;
|
||||
}
|
||||
|
||||
$page = ((isset($_REQUEST['p']) && $_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0);
|
||||
$startrec = (($page+1) * $perpage) - $perpage;
|
||||
$limit = $_REQUEST['limit'] ?? 0;
|
||||
$return_total = $_REQUEST['return_total'] ?? 0;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Display extends Controller {
|
||||
@@ -12,7 +13,7 @@ class Display extends Controller {
|
||||
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
$noscript_content = (get_config('system', 'noscript_content', '1') && (! $update));
|
||||
$noscript_content = (Config::Get('system', 'noscript_content', '1') && (! $update));
|
||||
|
||||
$module_format = 'html';
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class Editpost extends \Zotlabs\Web\Controller {
|
||||
'item' => $itm[0],
|
||||
'editor_autocomplete'=> true,
|
||||
'bbco_autocomplete'=> 'bbcode',
|
||||
'return_path' => $_SESSION['return_url'],
|
||||
'return_path' => 'hq',
|
||||
'button' => t('Submit'),
|
||||
'hide_voting' => true,
|
||||
'hide_future' => true,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Email_validation extends \Zotlabs\Web\Controller {
|
||||
|
||||
@@ -12,8 +13,8 @@ class Email_validation extends \Zotlabs\Web\Controller {
|
||||
// This will redirect internally on success unless the channel is auto_created
|
||||
if(account_approve(trim(basename($_POST['token'])))) {
|
||||
$success = true;
|
||||
if(get_config('system','auto_channel_create')) {
|
||||
$next_page = get_config('system', 'workflow_channel_next', 'profiles');
|
||||
if(Config::Get('system','auto_channel_create')) {
|
||||
$next_page = Config::Get('system', 'workflow_channel_next', 'profiles');
|
||||
}
|
||||
if($next_page) {
|
||||
goaway(z_root() . '/' . $next_page);
|
||||
@@ -40,9 +41,9 @@ class Email_validation extends \Zotlabs\Web\Controller {
|
||||
'$submit' => t('Submit'),
|
||||
'$token' => [ 'token', t('Validation token'),'','' ],
|
||||
]);
|
||||
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
|
||||
require_once('include/crypto.php');
|
||||
@@ -18,7 +19,7 @@ class Fhublocs extends \Zotlabs\Web\Controller {
|
||||
$o = '';
|
||||
|
||||
$r = q("select * from channel where channel_removed = 0");
|
||||
$sitekey = get_config('system','pubkey');
|
||||
$sitekey = Config::Get('system','pubkey');
|
||||
|
||||
if($r) {
|
||||
foreach($r as $rr) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zorlabs\Lib\Config;
|
||||
|
||||
class Go extends \Zotlabs\Web\Controller {
|
||||
|
||||
@@ -44,9 +45,9 @@ class Go extends \Zotlabs\Web\Controller {
|
||||
'network' => t('View your personal stream (this may be empty until you add some connections)'),
|
||||
|
||||
];
|
||||
|
||||
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
|
||||
$net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
|
||||
|
||||
$site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
|
||||
$net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
|
||||
|
||||
if($site_firehose || $net_firehose) {
|
||||
$options['pubstream'] = t('View the public stream. Warning: this content is not moderated');
|
||||
@@ -64,4 +65,4 @@ class Go extends \Zotlabs\Web\Controller {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Web\Controller;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
use Zotlabs\Lib\AccessList;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Group extends Controller {
|
||||
|
||||
@@ -123,7 +124,7 @@ class Group extends Controller {
|
||||
// Switch to text mode interface if we have more than 'n' contacts or group members
|
||||
$switchtotext = get_pconfig(local_channel(),'system','groupedit_image_limit');
|
||||
if($switchtotext === false)
|
||||
$switchtotext = get_config('system','groupedit_image_limit');
|
||||
$switchtotext = Config::Get('system','groupedit_image_limit');
|
||||
if($switchtotext === false)
|
||||
$switchtotext = 400;
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
require_once('include/help.php');
|
||||
use Michelf\MarkdownExtra;
|
||||
|
||||
/**
|
||||
* You can create local site resources in doc/Site.md and either link to doc/Home.md for the standard resources
|
||||
* or use our include mechanism to include it on your local page.
|
||||
*
|
||||
*@code
|
||||
* #include doc/Home.md;
|
||||
*@endcode
|
||||
@@ -14,7 +15,42 @@ require_once('include/help.php');
|
||||
*/
|
||||
class Help extends \Zotlabs\Web\Controller {
|
||||
|
||||
function get() {
|
||||
use \Zotlabs\Lib\Traits\HelpHelperTrait;
|
||||
|
||||
private string $heading_slug = '';
|
||||
|
||||
/**
|
||||
* Pre-check before processing request.
|
||||
*
|
||||
* Determine language requested, and ensure that a topic was requested.
|
||||
* If no topic was requested, redirect to the about page, and abort
|
||||
* processing.
|
||||
*/
|
||||
public function init() {
|
||||
$this->determine_help_language();
|
||||
|
||||
if (empty($_REQUEST['search']) && argc() === 1) {
|
||||
goaway("/help/{$this->lang['language']}/about/about");
|
||||
killme();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process get request for the help module.
|
||||
*
|
||||
* Loads the correct help file from the `doc/` directory, and passes it to
|
||||
* the help template in `view/tpl/help.tpl`.
|
||||
*
|
||||
* If the requested help topic does not exist for the currently selected
|
||||
* language, a 404 status is returned instead.
|
||||
*
|
||||
* This function currently also handles search and serving static assets
|
||||
* that may be used by the help files.
|
||||
*
|
||||
* @return string The rendered help page or a 404 page if help topic was
|
||||
* not found.
|
||||
*/
|
||||
public function get() {
|
||||
nav_set_selected('Help');
|
||||
|
||||
$o = '';
|
||||
@@ -26,6 +62,7 @@ class Help extends \Zotlabs\Web\Controller {
|
||||
$o .= '</div>';
|
||||
$o .= '<div class="section-content-wrapper">';
|
||||
|
||||
require_once('include/help.php');
|
||||
$r = search_doc_files($_REQUEST['search']);
|
||||
if($r) {
|
||||
$o .= '<ul class="help-searchlist">';
|
||||
@@ -81,6 +118,124 @@ class Help extends \Zotlabs\Web\Controller {
|
||||
killme();
|
||||
}
|
||||
|
||||
//
|
||||
// The args to the module will be along this pattern:
|
||||
//
|
||||
// help/<lang>/<subdir..>/<topic>
|
||||
//
|
||||
// Where `<lang>` is the language which we want to fetch the topic. This
|
||||
// element is optional, but will be used to override the browser language
|
||||
// preference if it exists.
|
||||
//
|
||||
// There may be zero or more `<subdir...>` elements. If there are any
|
||||
// present, the first subdir will be used as the slug to find the
|
||||
// heading of the help page.
|
||||
//
|
||||
// The `<topic>` should be the name of a file within the given language
|
||||
// and subdirectory tree under the `doc/` directory of the site file
|
||||
// system. The topic is given _without_ the file extension, which will be
|
||||
// determined by the module.
|
||||
//
|
||||
// The valid file extensions for help topic are:
|
||||
//
|
||||
// - `.md` for markdown formatted source files.
|
||||
// - `.bb` for bbcode formatted source files.
|
||||
// - `.html` for help topics in html format.
|
||||
//
|
||||
|
||||
// Strip away the module name from the args
|
||||
$args = array_slice(\App::$argv, 1);
|
||||
|
||||
// Remove language if necessary
|
||||
//
|
||||
// The language was determined during pre-request processing in the
|
||||
// `init` function.
|
||||
if ($this->lang['from_url']) {
|
||||
array_shift($args);
|
||||
}
|
||||
|
||||
if (empty($args)) {
|
||||
goaway("/help/{$this->lang['language']}/about/about");
|
||||
}
|
||||
|
||||
// Keep the first remaining arg as the heading slug
|
||||
$this->heading_slug = $args[0];
|
||||
|
||||
// Locate the file for the topic in the doc directory
|
||||
$this->find_help_file(implode('/', $args), $this->lang['language']);
|
||||
|
||||
$this->set_page_title();
|
||||
|
||||
if (empty($this->file_name)) {
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
|
||||
$tpl = get_markup_template("404.tpl");
|
||||
return replace_macros($tpl, array(
|
||||
'$message' => t('Page not found.')
|
||||
));
|
||||
|
||||
} else {
|
||||
$tpl = get_markup_template('help.tpl');
|
||||
return replace_macros($tpl, [ '$module' => $this ]);
|
||||
}
|
||||
}
|
||||
|
||||
public function render_content(): string {
|
||||
return $this->render_help_file($this->file_name, $this->file_type);
|
||||
}
|
||||
|
||||
public function render_help_file(string $file_name, string $file_type): string {
|
||||
$raw_text = file_get_contents($file_name);
|
||||
|
||||
switch ($file_type) {
|
||||
case 'md':
|
||||
// We need to escape the `#include` statements in the original file,
|
||||
// to be sure it's not rendered as a heading by markdown.
|
||||
$raw_text = preg_replace('/#include/ism', '%%include', $raw_text);
|
||||
$content = MarkdownExtra::defaultTransform($raw_text);
|
||||
$content = preg_replace('/%%include/ism', '#include', $content);
|
||||
break;
|
||||
|
||||
case 'bb':
|
||||
$content = zidify_links(bbcode($raw_text));
|
||||
break;
|
||||
|
||||
case 'html':
|
||||
$content = parseIdentityAwareHTML($raw_text);
|
||||
break;
|
||||
}
|
||||
|
||||
// Replace includes with the contents of the included file
|
||||
$content = preg_replace_callback(
|
||||
"/#include (.*?)\;/ism",
|
||||
function ($matches) {
|
||||
$parts = explode('.', $matches[1]);
|
||||
$sub_file_type = array_pop($parts);
|
||||
$included_content = $this->render_help_file($matches[1], $sub_file_type);
|
||||
return str_replace($matches[0], $included_content, $matches[0]);
|
||||
},
|
||||
$content
|
||||
);
|
||||
|
||||
return translate_projectname($content);
|
||||
}
|
||||
|
||||
public function get_page_title(): string {
|
||||
$title = t('$Projectname Documentation');
|
||||
$heading = $this->get_heading();
|
||||
|
||||
if (! empty($heading)) {
|
||||
$title .= ': ' . $heading;
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
public function get_toc_heading(): string {
|
||||
return t('Contents');
|
||||
}
|
||||
|
||||
|
||||
private function get_heading(): string {
|
||||
$headings = [
|
||||
'about' => t('About'),
|
||||
'member' => t('Members'),
|
||||
@@ -89,21 +244,22 @@ class Help extends \Zotlabs\Web\Controller {
|
||||
'tutorials' => t('Tutorials')
|
||||
];
|
||||
|
||||
$heading = '';
|
||||
if(array_key_exists(argv(1), $headings))
|
||||
$heading = $headings[argv(1)];
|
||||
|
||||
$content = get_help_content();
|
||||
|
||||
$language = determine_help_language()['language'];
|
||||
|
||||
return replace_macros(get_markup_template('help.tpl'), array(
|
||||
'$title' => t('$Projectname Documentation'),
|
||||
'$tocHeading' => t('Contents'),
|
||||
'$content' => $content,
|
||||
'$heading' => $heading,
|
||||
'$language' => $language
|
||||
));
|
||||
if(array_key_exists($this->heading_slug, $headings)) {
|
||||
return $headings[$this->heading_slug];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the page title to an unslugified version of the file name.
|
||||
*
|
||||
* @Note This modifies the global `App::$page['title']` property.
|
||||
*/
|
||||
private function set_page_title(): void {
|
||||
$title = basename($this->file_name, ".{$this->file_type}");
|
||||
\App::$page['title'] =
|
||||
t('Help:') . ' '
|
||||
. ucwords(str_replace(['-', '_'],' ',notags($title)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Web\Controller;
|
||||
use Zotlabs\Web\HTTPSig;
|
||||
@@ -20,7 +21,7 @@ class Home extends Controller {
|
||||
call_hooks('home_init', $ret);
|
||||
|
||||
if (Libzot::is_zot_request()) {
|
||||
$key = get_config('system', 'prvkey');
|
||||
$key = Config::Get('system', 'prvkey');
|
||||
$ret = json_encode(Libzot::site_info());
|
||||
|
||||
$headers = ['Content-Type' => 'application/x-zot+json', 'Digest' => HTTPSig::generate_digest_header($ret)];
|
||||
@@ -38,7 +39,7 @@ class Home extends Controller {
|
||||
if (local_channel() && $channel && $channel['xchan_url'] && !$splash) {
|
||||
$dest = $ret['startpage'] ?? '';
|
||||
if (!$dest)
|
||||
$dest = get_config('system', 'startpage');
|
||||
$dest = Config::Get('system', 'startpage');
|
||||
if (!$dest)
|
||||
$dest = z_root() . '/hq';
|
||||
|
||||
@@ -78,7 +79,7 @@ class Home extends Controller {
|
||||
if ($o)
|
||||
return $o;
|
||||
|
||||
$frontpage = get_config('system', 'frontpage');
|
||||
$frontpage = Config::Get('system', 'frontpage');
|
||||
if ($frontpage) {
|
||||
if (strpos($frontpage, 'include:') !== false) {
|
||||
$file = trim(str_replace('include:', '', $frontpage));
|
||||
@@ -91,7 +92,7 @@ class Home extends Controller {
|
||||
}
|
||||
if (strpos($frontpage, 'http') !== 0)
|
||||
$frontpage = z_root() . '/' . $frontpage;
|
||||
if (intval(get_config('system', 'mirror_frontpage'))) {
|
||||
if (intval(Config::Get('system', 'mirror_frontpage'))) {
|
||||
$o = '<html><head><title>' . t('$Projectname') . '</title></head><body style="margin: 0; padding: 0; border: none;" ><iframe src="' . $frontpage . '" width="100%" height="100%" style="margin: 0; padding: 0; border: none;" ></iframe></body></html>';
|
||||
echo $o;
|
||||
killme();
|
||||
@@ -99,11 +100,11 @@ class Home extends Controller {
|
||||
goaway($frontpage);
|
||||
}
|
||||
|
||||
$sitename = get_config('system', 'sitename');
|
||||
$sitename = Config::Get('system', 'sitename');
|
||||
if ($sitename)
|
||||
$o .= '<h1 class="home-welcome">' . sprintf(t('Welcome to %s'), $sitename) . '</h1>';
|
||||
|
||||
$loginbox = get_config('system', 'login_on_homepage');
|
||||
$loginbox = Config::Get('system', 'login_on_homepage');
|
||||
if (intval($loginbox) || $loginbox === false)
|
||||
$o .= login(true);
|
||||
|
||||
|
||||
@@ -4,14 +4,6 @@ namespace Zotlabs\Module;
|
||||
use App;
|
||||
use Zotlabs\Widget\Messages;
|
||||
|
||||
|
||||
require_once("include/bbcode.php");
|
||||
require_once('include/security.php');
|
||||
require_once('include/conversation.php');
|
||||
require_once('include/acl_selectors.php');
|
||||
require_once('include/items.php');
|
||||
|
||||
|
||||
class Hq extends \Zotlabs\Web\Controller {
|
||||
|
||||
function init() {
|
||||
@@ -98,7 +90,6 @@ class Hq extends \Zotlabs\Web\Controller {
|
||||
'permissions' => $channel_acl,
|
||||
'bang' => '',
|
||||
'visitor' => true,
|
||||
'profile_uid' => local_channel(),
|
||||
'return_path' => 'hq',
|
||||
'expanded' => true,
|
||||
'editor_autocomplete' => true,
|
||||
@@ -117,17 +108,6 @@ class Hq extends \Zotlabs\Web\Controller {
|
||||
|
||||
nav_set_selected('HQ');
|
||||
|
||||
if($target_item) {
|
||||
// if the target item is not a post (eg a like) we want to address its thread parent
|
||||
//$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
|
||||
|
||||
// if we got a decoded hash we must encode it again before handing to javascript
|
||||
// $mid = gen_link_id($target_item['mid']);
|
||||
}
|
||||
else {
|
||||
$mid = '';
|
||||
}
|
||||
|
||||
$o .= '<div id="live-hq"></div>' . "\r\n";
|
||||
$o .= "<script> var profile_uid = " . local_channel()
|
||||
. "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . ";</script>\r\n";
|
||||
|
||||
@@ -9,6 +9,7 @@ require_once('include/perm_upgrade.php');
|
||||
use App;
|
||||
use URLify;
|
||||
use Zotlabs\Daemon\Master;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
@@ -168,7 +169,7 @@ class Import extends Controller {
|
||||
if ($newname) {
|
||||
$x = false;
|
||||
|
||||
if (get_config('system', 'unicode_usernames')) {
|
||||
if (Config::Get('system', 'unicode_usernames')) {
|
||||
$x = punify(mb_strtolower($newname));
|
||||
}
|
||||
|
||||
@@ -191,6 +192,12 @@ class Import extends Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($channel['channel_removed']) {
|
||||
logger('Channel exists but has been marked removed on this hub. ', print_r($channel,true));
|
||||
notice( t('Channel exists but has been marked removed on this hub. Import failed.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_array($data['config'])) {
|
||||
import_config($channel, $data['config']);
|
||||
}
|
||||
@@ -227,10 +234,10 @@ class Import extends Controller {
|
||||
'hubloc_url_sig' => Libzot::sign(z_root(), $channel['channel_prvkey']),
|
||||
'hubloc_host' => App::get_hostname(),
|
||||
'hubloc_callback' => z_root() . '/zot',
|
||||
'hubloc_sitekey' => get_config('system', 'pubkey'),
|
||||
'hubloc_sitekey' => Config::Get('system', 'pubkey'),
|
||||
'hubloc_updated' => datetime_convert(),
|
||||
'hubloc_id_url' => channel_url($channel),
|
||||
'hubloc_site_id' => Libzot::make_xchan_hash(z_root(), get_config('system', 'pubkey'))
|
||||
'hubloc_site_id' => Libzot::make_xchan_hash(z_root(), Config::Get('system', 'pubkey'))
|
||||
]
|
||||
);
|
||||
|
||||
@@ -524,27 +531,31 @@ class Import extends Controller {
|
||||
// This will indirectly perform a refresh_all *and* update the directory
|
||||
Master::Summon(['Directory', $channel['channel_id']]);
|
||||
|
||||
$cf_api_compat = true;
|
||||
if ($api_path) {
|
||||
$parsed = parse_url($api_path);
|
||||
unset($parsed['path']);
|
||||
|
||||
if ($api_path && $import_posts) { // we are importing from a server and not a file
|
||||
// store the import host so we can manually kick off item/file sync later in case anything did not work out
|
||||
set_pconfig($channel['channel_id'], 'import', 'host', $parsed['host']);
|
||||
|
||||
$hz_server = unparse_url($parsed);
|
||||
}
|
||||
|
||||
$cf_api_compat = false;
|
||||
|
||||
if ($api_path && $hz_server && $import_posts) { // we are importing from a server and not a file
|
||||
if (version_compare($data['compatibility']['version'], '6.3.4', '>=')) {
|
||||
|
||||
$m = parse_url($api_path);
|
||||
|
||||
$hz_server = $m['scheme'] . '://' . $m['host'];
|
||||
$cf_api_compat = true;
|
||||
|
||||
$since = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), '0001-01-01 00:00');
|
||||
$until = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), 'now + 1 day');
|
||||
|
||||
//$poll_interval = get_config('system', 'poll_interval', 3);
|
||||
//$poll_interval = Config::Get('system', 'poll_interval', 3);
|
||||
$page = 0;
|
||||
|
||||
Master::Summon(['Content_importer', sprintf('%d', $page), $since, $until, $channel['channel_address'], urlencode($hz_server)]);
|
||||
Master::Summon(['File_importer', sprintf('%d', $page), $channel['channel_address'], urlencode($hz_server)]);
|
||||
}
|
||||
else {
|
||||
$cf_api_compat = false;
|
||||
}
|
||||
}
|
||||
|
||||
change_channel($channel['channel_id']);
|
||||
@@ -553,7 +564,7 @@ class Import extends Controller {
|
||||
goaway(z_root() . '/import_progress');
|
||||
}
|
||||
|
||||
if (!$cf_api_compat) {
|
||||
if ($import_posts && !$cf_api_compat) {
|
||||
notice(t('Automatic content and files import was not possible due to API version incompatiblity. Please import content and files manually!') . EOL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\PConfig;
|
||||
use Zotlabs\Daemon\Master;
|
||||
|
||||
@@ -21,6 +22,9 @@ class Import_progress extends \Zotlabs\Web\Controller {
|
||||
|
||||
nav_set_selected('Channel Import');
|
||||
|
||||
$channel = App::get_channel();
|
||||
$import_host = PConfig::Get(local_channel(), 'import', 'host');
|
||||
|
||||
// items
|
||||
$c = PConfig::Get(local_channel(), 'import', 'content_progress');
|
||||
|
||||
@@ -41,6 +45,24 @@ class Import_progress extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(argv(1) === 'resume_itemsync' && $import_host) {
|
||||
$alive = probe_api_path($import_host);
|
||||
if ($alive) {
|
||||
$parsed = parse_url($alive);
|
||||
unset($parsed['path']);
|
||||
|
||||
$hz_server = unparse_url($parsed);
|
||||
$since = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), '0001-01-01 00:00');
|
||||
$until = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), 'now + 1 day');
|
||||
$page = 0;
|
||||
Master::Summon(['Content_importer', sprintf('%d', $page), $since, $until, $channel['channel_address'], urlencode($hz_server)]);
|
||||
goaway('/import_progress');
|
||||
}
|
||||
else {
|
||||
notice(t('Import host does not seem to be online or compatible') . EOL);
|
||||
}
|
||||
}
|
||||
|
||||
$cprogress = 'waiting to start...';
|
||||
|
||||
if (PConfig::Get(local_channel(), 'import', 'content_completed')) {
|
||||
@@ -73,6 +95,23 @@ class Import_progress extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(argv(1) === 'resume_filesync' && $import_host) {
|
||||
$alive = probe_api_path($import_host);
|
||||
if ($alive) {
|
||||
$parsed = parse_url($alive);
|
||||
unset($parsed['path']);
|
||||
|
||||
$hz_server = unparse_url($parsed);
|
||||
$page = 0;
|
||||
|
||||
Master::Summon(['File_importer', sprintf('%d', $page), $channel['channel_address'], urlencode($hz_server)]);
|
||||
goaway('/import_progress');
|
||||
}
|
||||
else {
|
||||
notice(t('Import host does not seem to be online or compatible') . EOL);
|
||||
}
|
||||
}
|
||||
|
||||
$fprogress = 'waiting to start...';
|
||||
|
||||
if (PConfig::Get(local_channel(), 'import', 'files_completed')) {
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
/**
|
||||
@@ -76,7 +77,7 @@ class Invite extends Controller {
|
||||
$feedbk = '';
|
||||
$isajax = is_ajax();
|
||||
$eol = $isajax ? "\n" : EOL;
|
||||
$policy = intval(get_config('system','register_policy'));
|
||||
$policy = intval(Config::Get('system','register_policy'));
|
||||
if ($policy == REGISTER_CLOSED) {
|
||||
notice( 'ZAI0212E,' . t('Register is closed') . ')' . EOL);
|
||||
return;
|
||||
@@ -85,13 +86,13 @@ class Invite extends Controller {
|
||||
$flags = 0;
|
||||
elseif ($policy == REGISTER_APPROVE)
|
||||
$flags = ACCOUNT_PENDING;
|
||||
$flags = ($flags | intval(get_config('system','verify_email')));
|
||||
$flags = ($flags | intval(Config::Get('system','verify_email')));
|
||||
|
||||
// how many max recipients in one mail submit
|
||||
$maxto = get_config('system','invitation_max_recipients', 'na');
|
||||
$maxto = Config::Get('system','invitation_max_recipients', 'na');
|
||||
If (is_site_admin()) {
|
||||
// set, if admin is operator, default to 12
|
||||
if ($maxto === 'na') set_config('system','invitation_max_recipients', 12);
|
||||
if ($maxto === 'na') Config::Set('system','invitation_max_recipients', 12);
|
||||
}
|
||||
$maxto = ($maxto === 'na') ? 12 : $maxto;
|
||||
|
||||
@@ -323,7 +324,7 @@ class Invite extends Controller {
|
||||
return Apps::app_render($papp, 'module');
|
||||
}
|
||||
|
||||
if (! (get_config('system','invitation_also') || get_config('system','invitation_only')) ) {
|
||||
if (! (Config::Get('system','invitation_also') || Config::Get('system','invitation_only')) ) {
|
||||
$o = 'ZAI0103E,' . t('Invites not proposed by configuration') . '. ';
|
||||
$o .= t('Contact the site admin');
|
||||
return $o;
|
||||
@@ -331,7 +332,7 @@ class Invite extends Controller {
|
||||
|
||||
// invitation_by_user may still not configured, the default 'na' will tell this
|
||||
// if configured, 0 disables invitations by users, other numbers are how many invites a user may propagate
|
||||
$invuser = get_config('system','invitation_by_user', 'na');
|
||||
$invuser = Config::Get('system','invitation_by_user', 'na');
|
||||
|
||||
// if the mortal user drives the invitation
|
||||
If (! is_site_admin()) {
|
||||
@@ -352,7 +353,7 @@ class Invite extends Controller {
|
||||
|
||||
} else {
|
||||
// general deity admin invite limit infinite (theoretical)
|
||||
if ($invuser === 'na') set_config('system','invitation_by_user', 4);
|
||||
if ($invuser === 'na') Config::Set('system','invitation_by_user', 4);
|
||||
// for display only
|
||||
$invuser = '∞';
|
||||
}
|
||||
@@ -385,11 +386,11 @@ class Invite extends Controller {
|
||||
$wehave = ($r ? $r[0]['ct'] : 0);
|
||||
|
||||
// invites max for all users except admins
|
||||
$invmaxau = intval(get_config('system','invitations_max_users'));
|
||||
$invmaxau = intval(Config::Get('system','invitations_max_users'));
|
||||
if(! $invmaxau) {
|
||||
$invmaxau = 50;
|
||||
if (is_site_admin()) {
|
||||
set_config('system','invitations_max_users',intval($invmaxau));
|
||||
Config::Set('system','invitations_max_users',intval($invmaxau));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,7 +520,7 @@ class Invite extends Controller {
|
||||
$ts = replace_macros(get_intltext_template('invite.'.$t1.'.subject.tpl'),
|
||||
array(
|
||||
'$projectname' => t('$Projectname'),
|
||||
'$invite_loc' => get_config('system','sitename')
|
||||
'$invite_loc' => Config::Get('system','sitename')
|
||||
)
|
||||
);
|
||||
|
||||
@@ -569,7 +570,7 @@ class Invite extends Controller {
|
||||
function calcdue($duri=false) {
|
||||
// expirations, duration interval
|
||||
if ($duri===false)
|
||||
$duri = get_config('system','register_expire', '2d');
|
||||
$duri = Config::Get('system','register_expire', '2d');
|
||||
if ( preg_match( '/^[0-9]{1,2}[ihdwmy]{1}$/', $duri ) ) {
|
||||
$durq = substr($duri, -1);
|
||||
$durn = substr($duri, 0, -1);
|
||||
|
||||
@@ -404,7 +404,7 @@ class Item extends Controller {
|
||||
$pagetitle = ((x($_REQUEST, 'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : '');
|
||||
$layout_mid = ((x($_REQUEST, 'layout_mid')) ? escape_tags($_REQUEST['layout_mid']) : '');
|
||||
$plink = ((x($_REQUEST, 'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
|
||||
$obj_type = ((x($_REQUEST, 'obj_type')) ? escape_tags($_REQUEST['obj_type']) : 'Article');
|
||||
$obj_type = ((x($_REQUEST, 'obj_type')) ? escape_tags($_REQUEST['obj_type']) : 'Note');
|
||||
|
||||
// allow API to bulk load a bunch of imported items with sending out a bunch of posts.
|
||||
$nopush = ((x($_REQUEST, 'nopush')) ? intval($_REQUEST['nopush']) : 0);
|
||||
@@ -837,8 +837,10 @@ class Item extends Controller {
|
||||
|
||||
if ($results) {
|
||||
|
||||
// Set permissions based on tag replacements
|
||||
set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $private, $parent_item);
|
||||
// Set permissions based on tag replacements only if not editing an existing post
|
||||
if (!$orig_post) {
|
||||
set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $private, $parent_item);
|
||||
}
|
||||
|
||||
foreach ($results as $result) {
|
||||
$success = $result['success'];
|
||||
@@ -1262,6 +1264,11 @@ class Item extends Controller {
|
||||
|
||||
if ((x($_REQUEST, 'return')) && strlen($return_path)) {
|
||||
logger('return: ' . $return_path);
|
||||
|
||||
if ($return_path === 'hq') {
|
||||
goaway(z_root() . '/hq/' . $datarray['uuid']);
|
||||
}
|
||||
|
||||
goaway(z_root() . "/" . $return_path);
|
||||
}
|
||||
killme();
|
||||
@@ -1424,7 +1431,6 @@ class Item extends Controller {
|
||||
|
||||
require_once('include/items.php');
|
||||
|
||||
|
||||
$i = q("select id, uid, item_origin, author_xchan, owner_xchan, source_xchan, item_type from item where id = %d limit 1",
|
||||
intval(argv(2))
|
||||
);
|
||||
@@ -1654,7 +1660,7 @@ class Item extends Controller {
|
||||
$listener = Libzot::zot_record_preferred($listener);
|
||||
|
||||
$c = q("select abook_id from abook where abook_channel = %d and abook_xchan = '%s'",
|
||||
intval($profile_uid),
|
||||
intval($item['uid']),
|
||||
dbesc($listener['hubloc_hash'])
|
||||
);
|
||||
|
||||
|
||||
@@ -569,6 +569,11 @@ class Like extends Controller {
|
||||
|
||||
call_hooks('post_local_end', $arr);
|
||||
|
||||
if ($is_rsvp && in_array($verb, ['attendyes', 'attendmaybe'])) {
|
||||
event_addtocal($item_id, local_channel());
|
||||
}
|
||||
|
||||
|
||||
$r = q("select * from item where id = %d",
|
||||
intval($post_id)
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Linkinfo extends \Zotlabs\Web\Controller {
|
||||
|
||||
@@ -168,7 +169,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
|
||||
/* Execute below code only if image is present in siteinfo */
|
||||
|
||||
$total_images = 0;
|
||||
$max_images = get_config('system','max_bookmark_images');
|
||||
$max_images = Config::Get('system','max_bookmark_images');
|
||||
if($max_images === false)
|
||||
$max_images = 2;
|
||||
else
|
||||
|
||||
@@ -227,7 +227,7 @@ class Lockview extends Controller {
|
||||
$allowed_xchans = array_unique($allowed_xchans);
|
||||
foreach ($atokens as $atoken) {
|
||||
if (in_array($atoken['xchan_hash'], $allowed_xchans)) {
|
||||
$guest_access_list[] = '<div class="dropdown-item d-flex justify-content-between cursor-pointer" title="' . sprintf(t('Click to copy link to this ressource for guest %s to clipboard'), $atoken['xchan_name']) . '" data-token="' . $url . '?zat=' . $atoken['atoken_token'] . '" onclick="navigator.clipboard.writeText(this.dataset.token); $.jGrowl(\'' . t('Link copied') . '\', { sticky: false, theme: \'info\', life: 1000 });"><span>' . $atoken['xchan_name'] . '</span><i class="fa fa-copy p-1"></i></div>';
|
||||
$guest_access_list[] = '<div class="dropdown-item d-flex justify-content-between cursor-pointer" title="' . sprintf(t('Click to copy link to this ressource for guest %s to clipboard'), $atoken['xchan_name']) . '" data-token="' . $url . '?zat=' . $atoken['atoken_token'] . '" onclick="navigator.clipboard.writeText(this.dataset.token); toast(\'' . t('Link copied') . '\', \'info\');"><span>' . $atoken['xchan_name'] . '</span><i class="bi bi-copy p-1"></i></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ class Login extends \Zotlabs\Web\Controller {
|
||||
|
||||
return login(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Lostpass extends \Zotlabs\Web\Controller {
|
||||
|
||||
@@ -34,19 +34,19 @@ class Lostpass extends \Zotlabs\Web\Controller {
|
||||
|
||||
$email_tpl = get_intltext_template("lostpass_eml.tpl");
|
||||
$message = replace_macros($email_tpl, array(
|
||||
'$sitename' => get_config('system','sitename'),
|
||||
'$sitename' => Config::Get('system','sitename'),
|
||||
'$siteurl' => z_root(),
|
||||
'$username' => sprintf( t('Site Member (%s)'), $email),
|
||||
'$email' => $email,
|
||||
'$reset_link' => z_root() . '/lostpass?verify=' . $hash
|
||||
));
|
||||
|
||||
$subject = email_header_encode(sprintf( t('Password reset requested at %s'),get_config('system','sitename')), 'UTF-8');
|
||||
$subject = email_header_encode(sprintf( t('Password reset requested at %s'),Config::Get('system','sitename')), 'UTF-8');
|
||||
|
||||
$res = z_mail(
|
||||
[
|
||||
'toEmail' => $email,
|
||||
'messageSubject' => sprintf( t('Password reset requested at %s'), get_config('system','sitename')),
|
||||
'messageSubject' => sprintf( t('Password reset requested at %s'), Config::Get('system','sitename')),
|
||||
'textVersion' => $message,
|
||||
]
|
||||
);
|
||||
@@ -114,7 +114,7 @@ class Lostpass extends \Zotlabs\Web\Controller {
|
||||
$res = z_mail(
|
||||
[
|
||||
'toEmail' => $email,
|
||||
'messageSubject' => sprintf( t('Your password has changed at %s'), get_config('system','sitename')),
|
||||
'messageSubject' => sprintf( t('Your password has changed at %s'), Config::Get('system','sitename')),
|
||||
'textVersion' => $message,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use URLify;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/channel.php');
|
||||
require_once('include/permissions.php');
|
||||
@@ -20,7 +21,7 @@ class New_channel extends \Zotlabs\Web\Controller {
|
||||
|
||||
$x = false;
|
||||
|
||||
if(get_config('system','unicode_usernames')) {
|
||||
if(Config::Get('system','unicode_usernames')) {
|
||||
$x = punify(mb_strtolower($n));
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ class New_channel extends \Zotlabs\Web\Controller {
|
||||
|
||||
$x = false;
|
||||
|
||||
if(get_config('system','unicode_usernames')) {
|
||||
if(Config::Get('system','unicode_usernames')) {
|
||||
$x = punify(mb_strtolower($n));
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ class New_channel extends \Zotlabs\Web\Controller {
|
||||
|
||||
change_channel($result['channel']['channel_id']);
|
||||
|
||||
$next_page = get_config('system', 'workflow_channel_next', 'profiles');
|
||||
$next_page = Config::Get('system', 'workflow_channel_next', 'profiles');
|
||||
goaway(z_root() . '/' . $next_page);
|
||||
|
||||
}
|
||||
@@ -138,7 +139,7 @@ class New_channel extends \Zotlabs\Web\Controller {
|
||||
intval($aid)
|
||||
);
|
||||
if($r && (! intval($r[0]['total']))) {
|
||||
$default_role = get_config('system','default_permissions_role','personal');
|
||||
$default_role = Config::Get('system','default_permissions_role','personal');
|
||||
}
|
||||
|
||||
$limit = account_service_class_fetch(get_account_id(),'total_identities');
|
||||
@@ -163,7 +164,7 @@ class New_channel extends \Zotlabs\Web\Controller {
|
||||
|
||||
$nick_help = '<span id="nick_help_loading" style="display:none">' . t('Loading') . '</span><span id="nick_help_text">';
|
||||
$nick_help .= t('This will be used to create a unique network address (like an email address).');
|
||||
if(! get_config('system','unicode_usernames')) {
|
||||
if(! Config::Get('system','unicode_usernames')) {
|
||||
$nick_help .= ' ' . t('Allowed characters are a-z 0-9, - and _');
|
||||
}
|
||||
$nick_help .= '<span>';
|
||||
|
||||
@@ -13,31 +13,34 @@ class Notes extends Controller {
|
||||
|
||||
function post() {
|
||||
|
||||
if(! local_channel())
|
||||
return EMPTY_STR;
|
||||
if(!local_channel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Notes'))
|
||||
return EMPTY_STR;
|
||||
if(!Apps::system_app_installed(local_channel(), 'Notes')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = [
|
||||
'success' => false,
|
||||
'html' => ''
|
||||
];
|
||||
|
||||
|
||||
if(array_key_exists('note_text',$_REQUEST)) {
|
||||
if (array_key_exists('note_text',$_REQUEST)) {
|
||||
$body = escape_tags($_REQUEST['note_text']);
|
||||
|
||||
// I've had my notes vanish into thin air twice in four years.
|
||||
// Provide a backup copy if there were contents previously
|
||||
// and there are none being saved now.
|
||||
|
||||
if(! $body) {
|
||||
$old_text = get_pconfig(local_channel(),'notes','text');
|
||||
if($old_text)
|
||||
set_pconfig(local_channel(),'notes','text.bak',$old_text);
|
||||
if(!$body) {
|
||||
$old_text = get_pconfig(local_channel(), 'notes', 'text');
|
||||
if ($old_text) {
|
||||
set_pconfig(local_channel(), 'notes', 'text.bak', $old_text);
|
||||
}
|
||||
}
|
||||
set_pconfig(local_channel(),'notes','text',$body);
|
||||
|
||||
set_pconfig(local_channel(), 'notes', 'text', $body);
|
||||
|
||||
$ret['html'] = bbcode($body, ['tryoembed' => false]);
|
||||
$ret['success'] = true;
|
||||
@@ -55,8 +58,9 @@ class Notes extends Controller {
|
||||
}
|
||||
|
||||
function get() {
|
||||
if(! local_channel())
|
||||
if(!local_channel()) {
|
||||
return EMPTY_STR;
|
||||
}
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Notes')) {
|
||||
//Do not display any associated widgets at this point
|
||||
@@ -65,6 +69,8 @@ class Notes extends Controller {
|
||||
return Apps::app_render($papp, 'module');
|
||||
}
|
||||
|
||||
App::$profile_uid = local_channel();
|
||||
|
||||
$w = new \Zotlabs\Widget\Notes;
|
||||
$arr = ['app' => true];
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Daemon\Master;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
@@ -599,7 +600,7 @@ class Profile_photo extends Controller {
|
||||
|
||||
function profile_photo_crop_ui_head($ph, $hash, $smallest) {
|
||||
|
||||
$max_length = get_config('system', 'max_image_length');
|
||||
$max_length = Config::Get('system', 'max_image_length');
|
||||
|
||||
if (!$max_length) {
|
||||
$max_length = MAX_IMAGE_LENGTH;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
|
||||
class Profiles extends \Zotlabs\Web\Controller {
|
||||
@@ -619,14 +620,16 @@ class Profiles extends \Zotlabs\Web\Controller {
|
||||
$profile_fields_advanced = get_profile_fields_advanced();
|
||||
|
||||
if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) {
|
||||
if(feature_enabled(local_channel(),'multi_profiles'))
|
||||
if (feature_enabled(local_channel(), 'multi_profiles')) {
|
||||
$id = \App::$argv[1];
|
||||
}
|
||||
else {
|
||||
$x = q("select id from profile where uid = %d and is_default = 1",
|
||||
intval(local_channel())
|
||||
);
|
||||
if($x)
|
||||
if ($x) {
|
||||
$id = $x[0]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
|
||||
@@ -634,7 +637,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if(! $r) {
|
||||
if (!$r) {
|
||||
notice( t('Profile not found.') . EOL);
|
||||
return;
|
||||
}
|
||||
@@ -673,7 +676,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
||||
|
||||
|
||||
$opt_tpl = get_markup_template("field_checkbox.tpl");
|
||||
if (get_config('system', 'publish_all')) {
|
||||
if (Config::Get('system', 'publish_all')) {
|
||||
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
|
||||
}
|
||||
else {
|
||||
@@ -716,7 +719,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
||||
//$vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null);
|
||||
//$vcard = (($vctmp) ? get_vcard_array($vctmp,$r[0]['id']) : [] );
|
||||
|
||||
$f = get_config('system','birthday_input_format');
|
||||
$f = Config::Get('system','birthday_input_format');
|
||||
if(! $f)
|
||||
$f = 'ymd';
|
||||
|
||||
@@ -826,7 +829,8 @@ class Profiles extends \Zotlabs\Web\Controller {
|
||||
else {
|
||||
|
||||
$r = q("SELECT * FROM profile WHERE uid = %d",
|
||||
local_channel());
|
||||
intval(local_channel())
|
||||
);
|
||||
if($r) {
|
||||
|
||||
$tpl = get_markup_template('profile_entry.tpl');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/photos.php');
|
||||
|
||||
@@ -8,42 +9,42 @@ require_once('include/photos.php');
|
||||
class Profperm extends \Zotlabs\Web\Controller {
|
||||
|
||||
function init() {
|
||||
|
||||
|
||||
if(! local_channel())
|
||||
return;
|
||||
|
||||
|
||||
$channel = \App::get_channel();
|
||||
$which = $channel['channel_address'];
|
||||
|
||||
|
||||
$profile = \App::$argv[1];
|
||||
|
||||
|
||||
profile_load($which,$profile);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function get() {
|
||||
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(argc() < 2) {
|
||||
notice( t('Invalid profile identifier.') . EOL );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Switch to text mod interface if we have more than 'n' contacts or group members
|
||||
|
||||
|
||||
$switchtotext = get_pconfig(local_channel(),'system','groupedit_image_limit');
|
||||
if($switchtotext === false)
|
||||
$switchtotext = get_config('system','groupedit_image_limit');
|
||||
$switchtotext = Config::Get('system','groupedit_image_limit');
|
||||
if($switchtotext === false)
|
||||
$switchtotext = 400;
|
||||
|
||||
|
||||
|
||||
|
||||
if((argc() > 2) && intval(argv(1)) && intval(argv(2))) {
|
||||
$r = q("SELECT abook_id FROM abook WHERE abook_id = %d and abook_channel = %d limit 1",
|
||||
intval(argv(2)),
|
||||
@@ -52,8 +53,8 @@ class Profperm extends \Zotlabs\Web\Controller {
|
||||
if($r)
|
||||
$change = intval(argv(2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if((argc() > 1) && (intval(argv(1)))) {
|
||||
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d AND is_default = 0 LIMIT 1",
|
||||
intval(argv(1)),
|
||||
@@ -63,21 +64,21 @@ class Profperm extends \Zotlabs\Web\Controller {
|
||||
notice( t('Invalid profile identifier.') . EOL );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$profile = $r[0];
|
||||
|
||||
|
||||
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = '%s'",
|
||||
intval(local_channel()),
|
||||
dbesc($profile['profile_guid'])
|
||||
);
|
||||
|
||||
|
||||
$ingroup = array();
|
||||
if($r)
|
||||
foreach($r as $member)
|
||||
$ingroup[] = $member['abook_id'];
|
||||
|
||||
|
||||
$members = $r;
|
||||
|
||||
|
||||
if($change) {
|
||||
if(in_array($change,$ingroup)) {
|
||||
q("UPDATE abook SET abook_profile = '' WHERE abook_id = %d AND abook_channel = %d",
|
||||
@@ -91,42 +92,42 @@ class Profperm extends \Zotlabs\Web\Controller {
|
||||
intval($change),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
|
||||
|
||||
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
|
||||
WHERE abook_channel = %d AND abook_profile = '%s'",
|
||||
intval(local_channel()),
|
||||
dbesc($profile['profile_guid'])
|
||||
);
|
||||
|
||||
|
||||
$members = $r;
|
||||
|
||||
|
||||
$ingroup = array();
|
||||
if(count($r))
|
||||
foreach($r as $member)
|
||||
$ingroup[] = $member['abook_id'];
|
||||
}
|
||||
|
||||
|
||||
$o .= '<h2>' . t('Profile Visibility Editor') . '</h2>';
|
||||
|
||||
|
||||
$o .= '<h3>' . t('Profile') . ' \'' . $profile['profile_name'] . '\'</h3>';
|
||||
|
||||
|
||||
$o .= '<div id="prof-edit-desc">' . t('Click on a contact to add or remove.') . '</div>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$o .= '<div id="prof-update-wrapper">';
|
||||
if($change)
|
||||
$o = '';
|
||||
|
||||
|
||||
$o .= '<div id="prof-members-title">';
|
||||
$o .= '<h3>' . t('Visible To') . '</h3>';
|
||||
$o .= '</div>';
|
||||
$o .= '<div id="prof-members">';
|
||||
|
||||
|
||||
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
|
||||
|
||||
|
||||
foreach($members as $member) {
|
||||
if($member['xchan_url']) {
|
||||
$member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['abook_id'] . '); return false;';
|
||||
@@ -135,14 +136,14 @@ class Profperm extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
$o .= '</div><div id="prof-members-end"></div>';
|
||||
$o .= '<hr id="prof-separator" />';
|
||||
|
||||
|
||||
$o .= '<div id="prof-all-contcts-title">';
|
||||
$o .= '<h3>' . t("All Connections") . '</h3>';
|
||||
$o .= '</div>';
|
||||
$o .= '<div id="prof-all-contacts">';
|
||||
|
||||
|
||||
$r = abook_connections(local_channel());
|
||||
|
||||
|
||||
if($r) {
|
||||
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
|
||||
foreach($r as $member) {
|
||||
@@ -152,17 +153,17 @@ class Profperm extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$o .= '</div><div id="prof-all-contacts-end"></div>';
|
||||
|
||||
|
||||
if($change) {
|
||||
echo $o;
|
||||
killme();
|
||||
}
|
||||
$o .= '</div>';
|
||||
return $o;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzotdir;
|
||||
|
||||
class Pubsites extends \Zotlabs\Web\Controller {
|
||||
|
||||
function get() {
|
||||
$dirmode = intval(get_config('system','directory_mode'));
|
||||
$dirmode = intval(Config::Get('system','directory_mode'));
|
||||
|
||||
$url = '';
|
||||
|
||||
@@ -19,7 +20,7 @@ class Pubsites extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
$url .= '/sites';
|
||||
|
||||
$rating_enabled = get_config('system','rating_enabled');
|
||||
$rating_enabled = Config::Get('system','rating_enabled');
|
||||
|
||||
$o = '<div class="generic-content-wrapper">';
|
||||
|
||||
@@ -48,18 +49,18 @@ class Pubsites extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
$m = parse_url($jj['url']);
|
||||
$host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3));
|
||||
$rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="fa fa-check-square-o"></i> ' . t('Rate') . '</a></td>' : '');
|
||||
$rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="bi bi-check-square"></i> ' . t('Rate') . '</a></td>' : '');
|
||||
$location = '';
|
||||
if(!empty($jj['location'])) {
|
||||
$location = '<p title="' . t('Location') . '" style="margin: 5px 5px 0 0; text-align: right"><i class="fa fa-globe"></i> ' . $jj['location'] . '</p>';
|
||||
$location = '<p title="' . t('Location') . '" style="margin: 5px 5px 0 0; text-align: right"><i class="bi bi-globe"></i> ' . $jj['location'] . '</p>';
|
||||
}
|
||||
else {
|
||||
$location = '<br /> ';
|
||||
}
|
||||
$urltext = str_replace(array('https://'), '', $jj['url']);
|
||||
$o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><!--td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td--><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>';
|
||||
$o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="bi bi-link-45deg"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><!--td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="bi bi-graph-up"></i></a></td--><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>';
|
||||
if($rating_enabled)
|
||||
$o .= '<td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links ;
|
||||
$o .= '<td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="bi bi-eye"></i> ' . t('View') . '</a></td>' . $rate_links ;
|
||||
$o .= '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
require_once('include/conversation.php');
|
||||
require_once('include/acl_selectors.php');
|
||||
@@ -26,19 +27,19 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
return login();
|
||||
}
|
||||
|
||||
if(! intval(get_config('system','open_pubstream',1))) {
|
||||
if(! intval(Config::Get('system','open_pubstream',1))) {
|
||||
if(! get_observer_hash()) {
|
||||
return login();
|
||||
}
|
||||
}
|
||||
|
||||
$net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
|
||||
$net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
|
||||
|
||||
if(!$net_firehose) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
|
||||
$site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
|
||||
|
||||
$mid = $_REQUEST['mid'] ?? '';
|
||||
$identifier = 'uuid';
|
||||
@@ -107,7 +108,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
|
||||
nav_set_selected(t('Public Stream'));
|
||||
|
||||
$maxheight = get_config('system','home_divmore_height');
|
||||
$maxheight = Config::Get('system','home_divmore_height');
|
||||
if(! $maxheight)
|
||||
$maxheight = 400;
|
||||
|
||||
@@ -172,7 +173,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
$site_firehose_sql = " and owner_xchan in (select channel_hash from channel where channel_system = 0 and channel_removed = 0) ";
|
||||
}
|
||||
|
||||
if(get_config('system','public_list_mode'))
|
||||
if(Config::Get('system','public_list_mode'))
|
||||
$page_mode = 'list';
|
||||
else
|
||||
$page_mode = 'client';
|
||||
@@ -184,7 +185,6 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
$thread_top = '';
|
||||
}
|
||||
|
||||
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
|
||||
$net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : '');
|
||||
|
||||
if($update && $_SESSION['loadtime'])
|
||||
@@ -196,16 +196,17 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
|
||||
if($update) {
|
||||
|
||||
$ordering = get_config('system', 'pubstream_ordering', 'commented');
|
||||
$ordering = Config::Get('system', 'pubstream_ordering', 'commented');
|
||||
|
||||
if($load) {
|
||||
if($mid) {
|
||||
$r = q("SELECT parent AS item_id FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
$net_query
|
||||
left join xchan on item.author_xchan = xchan.xchan_hash
|
||||
WHERE item.$identifier = '%s' and item.item_private = 0
|
||||
$uids $site_firehose_sql
|
||||
$item_normal
|
||||
and xchan.xchan_censored = 0
|
||||
and (abook.abook_blocked = 0 or abook.abook_flags is null)
|
||||
$sql_extra $net_query2",
|
||||
dbesc($mid)
|
||||
@@ -215,10 +216,11 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
// Fetch a page full of parent items for this page
|
||||
$r = dbq("SELECT parent AS item_id FROM item
|
||||
left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
|
||||
$net_query
|
||||
left join xchan on item.author_xchan = xchan.xchan_hash
|
||||
WHERE item.item_private = 0 $thread_top
|
||||
$uids $site_firehose_sql
|
||||
$item_normal
|
||||
and xchan.xchan_censored = 0
|
||||
and (abook.abook_blocked = 0 or abook.abook_flags is null)
|
||||
$sql_extra $net_query2
|
||||
ORDER BY $ordering DESC $pager_sql "
|
||||
@@ -229,9 +231,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
if($mid) {
|
||||
$r = q("SELECT parent AS item_id FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
$net_query
|
||||
left join xchan on item.author_xchan = xchan.xchan_hash
|
||||
WHERE item.$identifier = '%s' and item.item_private = 0
|
||||
$uids $site_firehose_sql $item_normal_update $simple_update
|
||||
and xchan.xchan_censored = 0
|
||||
and (abook.abook_blocked = 0 or abook.abook_flags is null)
|
||||
$sql_extra $net_query2",
|
||||
dbesc($mid)
|
||||
@@ -240,10 +243,11 @@ class Pubstream extends \Zotlabs\Web\Controller {
|
||||
else {
|
||||
$r = dbq("SELECT parent AS item_id FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
$net_query
|
||||
left join xchan on item.author_xchan = xchan.xchan_hash
|
||||
WHERE item.item_private = 0 $thread_top
|
||||
$uids $site_firehose_sql $item_normal_update
|
||||
$simple_update
|
||||
and xchan.xchan_censored = 0
|
||||
and (abook.abook_blocked = 0 or abook.abook_flags is null)
|
||||
$sql_extra $net_query2"
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module; /** @file */
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
require_once('include/acl_selectors.php');
|
||||
require_once('include/crypto.php');
|
||||
@@ -23,11 +23,9 @@ require_once('include/bookmarks.php');
|
||||
* remote_return= absolute URL to return after posting is finished
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class Rbmark extends \Zotlabs\Web\Controller {
|
||||
|
||||
function post() {
|
||||
public function post(): void {
|
||||
if($_POST['submit'] !== t('Save'))
|
||||
return;
|
||||
|
||||
@@ -36,22 +34,21 @@ class Rbmark extends \Zotlabs\Web\Controller {
|
||||
$channel = \App::get_channel();
|
||||
|
||||
$t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title']));
|
||||
|
||||
bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0),
|
||||
array('menu_id' => ((x($_REQUEST,'menu_id')) ? intval($_REQUEST['menu_id']) : 0),
|
||||
'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : ''),
|
||||
'ischat' => ((x($_REQUEST['ischat'])) ? intval($_REQUEST['ischat']) : 0)
|
||||
'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : ''),
|
||||
'ischat' => ((x($_REQUEST['ischat'])) ? intval($_REQUEST['ischat']) : 0)
|
||||
));
|
||||
|
||||
goaway(z_root() . '/bookmarks');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get() {
|
||||
public function get(): string {
|
||||
|
||||
$o = '';
|
||||
|
||||
if(! local_channel()) {
|
||||
$channel_id = local_channel();
|
||||
if($channel_id === false) {
|
||||
|
||||
// The login procedure is going to bugger our $_REQUEST variables
|
||||
// so save them in the session.
|
||||
@@ -62,59 +59,46 @@ class Rbmark extends \Zotlabs\Web\Controller {
|
||||
return login();
|
||||
}
|
||||
|
||||
// If we have saved rbmark session variables, but nothing in the current $_REQUEST, recover the saved variables
|
||||
// If we have saved rbmark session variables, but nothing in the
|
||||
// current $_REQUEST, recover the saved variables
|
||||
|
||||
if((! array_key_exists('url',$_REQUEST)) && (array_key_exists('bookmark',$_SESSION))) {
|
||||
$_REQUEST = $_SESSION['bookmark'];
|
||||
unset($_SESSION['bookmark']);
|
||||
}
|
||||
|
||||
if($_REQUEST['remote_return']) {
|
||||
$_SESSION['remote_return'] = $_REQUEST['remote_return'];
|
||||
}
|
||||
if(argc() > 1 && argv(1) === 'return') {
|
||||
if($_SESSION['remote_return'])
|
||||
goaway($_SESSION['remote_return']);
|
||||
goaway(z_root() . '/bookmarks');
|
||||
}
|
||||
|
||||
$channel = \App::get_channel();
|
||||
|
||||
|
||||
$m = menu_list($channel['channel_id'],'',MENU_BOOKMARK);
|
||||
|
||||
$menus = array();
|
||||
if($m) {
|
||||
$menus = array(0 => '');
|
||||
foreach($m as $n) {
|
||||
$menus[$n['menu_id']] = $n['menu_name'];
|
||||
}
|
||||
}
|
||||
$menu_select = array('menu_id',t('Select a bookmark folder'),false,'',$menus);
|
||||
|
||||
|
||||
$o .= replace_macros(get_markup_template('rbmark.tpl'), array(
|
||||
$menu_select = [
|
||||
'menu_id',
|
||||
t('Select a bookmark folder'),
|
||||
false,
|
||||
'',
|
||||
$this->get_bookmark_folders(intval($channel_id)),
|
||||
null,
|
||||
];
|
||||
|
||||
return replace_macros(get_markup_template('rbmark.tpl'), array(
|
||||
'$header' => t('Save Bookmark'),
|
||||
'$url' => array('url',t('URL of bookmark'),escape_tags($_REQUEST['url'])),
|
||||
'$title' => array('title',t('Description'),escape_tags($_REQUEST['title'])),
|
||||
'$url' => array('url',t('URL of bookmark'),$_REQUEST['url'], null, null, null),
|
||||
'$title' => array('title',t('Description'),$_REQUEST['title'], null, null, null),
|
||||
'$ischat' => ((x($_REQUEST,'ischat')) ? intval($_REQUEST['ischat']) : 0),
|
||||
'$private' => ((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0),
|
||||
'$submit' => t('Save'),
|
||||
'$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'',''),
|
||||
'$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'','', null, null),
|
||||
'$menus' => $menu_select
|
||||
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
private function get_bookmark_folders(int $channel_id): array {
|
||||
$menu_list = menu_list($channel_id, '', MENU_BOOKMARK);
|
||||
|
||||
$menus = [ 0 => '' ];
|
||||
|
||||
if ($menu_list !== false) {
|
||||
foreach($menu_list as $n) {
|
||||
$menus[$n['menu_id']] = $n['menu_name'];
|
||||
}
|
||||
}
|
||||
|
||||
return $menus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Connect;
|
||||
use Zotlabs\Daemon\Master;
|
||||
|
||||
@@ -58,7 +59,7 @@ class Regate extends \Zotlabs\Web\Controller {
|
||||
// normally, that should never happen here
|
||||
// log suitable for fail2ban also
|
||||
$logmsg = 'ZAR1230S Unexpected registration verification request for '
|
||||
. get_config('system','sitename') . ' arrived from § ' . $ip . ' §';
|
||||
. Config::Get('system','sitename') . ' arrived from § ' . $ip . ' §';
|
||||
zar_log($logmsg);
|
||||
goaway(z_root());
|
||||
}
|
||||
@@ -118,7 +119,7 @@ class Regate extends \Zotlabs\Web\Controller {
|
||||
$isa = ($isa && ($isa['account_roles'] && ACCOUNT_ROLE_ADMIN));
|
||||
|
||||
// approve contra invite by admin
|
||||
if ($isa && get_config('system','register_policy') == REGISTER_APPROVE) {
|
||||
if ($isa && Config::Get('system','register_policy') == REGISTER_APPROVE) {
|
||||
$flags &= $flags ^ ACCOUNT_PENDING;
|
||||
}
|
||||
|
||||
@@ -159,7 +160,7 @@ class Regate extends \Zotlabs\Web\Controller {
|
||||
|
||||
$nextpage = 'new_channel';
|
||||
|
||||
$auto_create = get_config('system', 'auto_channel_create', 1);
|
||||
$auto_create = Config::Get('system', 'auto_channel_create', 1);
|
||||
|
||||
if($auto_create) {
|
||||
|
||||
@@ -179,7 +180,7 @@ class Regate extends \Zotlabs\Web\Controller {
|
||||
if($reonar['chan.did1'])
|
||||
set_aconfig($cra['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']);
|
||||
|
||||
$permissions_role = get_config('system','default_permissions_role');
|
||||
$permissions_role = Config::Get('system','default_permissions_role');
|
||||
if($permissions_role)
|
||||
set_aconfig($cra['account']['account_id'], 'register', 'permissions_role', $permissions_role);
|
||||
|
||||
@@ -206,7 +207,7 @@ class Regate extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
change_channel($channel_id);
|
||||
$nextpage = 'profiles/' . $channel_id;
|
||||
$nextpage = Config::Get('system', 'workflow_channel_next', 'profiles');
|
||||
$msg_code = 'ZAR1239I';
|
||||
$msg = t('Channel successfull created') . ' ' . $did2;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Zotfinger;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
@@ -13,55 +14,55 @@ use Zotlabs\Web\Controller;
|
||||
* We would then need a flag in the site table to indicate that they've been
|
||||
* validated by the PRIMARY directory for that realm. Sites claiming to be PRIMARY
|
||||
* but are not the realm PRIMARY will be marked invalid.
|
||||
*
|
||||
*
|
||||
* @param App &$a
|
||||
*/
|
||||
|
||||
class Regdir extends Controller {
|
||||
|
||||
function init() {
|
||||
|
||||
|
||||
$result = array('success' => false);
|
||||
|
||||
|
||||
$url = $_REQUEST['url'];
|
||||
$access_token = $_REQUEST['t'];
|
||||
$valid = 0;
|
||||
|
||||
|
||||
// we probably don't need the realm as we will find out in the probe.
|
||||
// What we may want to do is throw an error if you're trying to register in a different realm
|
||||
// so this configuration issue can be discovered.
|
||||
|
||||
|
||||
$realm = $_REQUEST['realm'];
|
||||
if(! $realm)
|
||||
$realm = DIRECTORY_REALM;
|
||||
|
||||
|
||||
if($realm === DIRECTORY_REALM) {
|
||||
$valid = 1;
|
||||
} else {
|
||||
$token = get_config('system','realm_token');
|
||||
$token = Config::Get('system','realm_token');
|
||||
if($token && $access_token != $token) {
|
||||
$result['message'] = 'This realm requires an access token';
|
||||
return;
|
||||
}
|
||||
$valid = 1;
|
||||
}
|
||||
|
||||
$dirmode = intval(get_config('system','directory_mode'));
|
||||
|
||||
|
||||
$dirmode = intval(Config::Get('system','directory_mode'));
|
||||
|
||||
if ($dirmode == DIRECTORY_MODE_NORMAL) {
|
||||
$ret['message'] = t('This site is not a directory server');
|
||||
json_return_and_die($ret);
|
||||
}
|
||||
|
||||
|
||||
$m = null;
|
||||
if ($url) {
|
||||
$m = parse_url($url);
|
||||
|
||||
|
||||
if ((! $m) || (! z_dns_check($m['host']))) {
|
||||
$result['message'] = 'unparseable url';
|
||||
json_return_and_die($result);
|
||||
}
|
||||
|
||||
|
||||
$j = Zotfinger::exec($url);
|
||||
if($j) {
|
||||
$result['success'] = true;
|
||||
@@ -79,7 +80,7 @@ class Regdir extends Controller {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
if ($dirmode == DIRECTORY_MODE_STANDALONE) {
|
||||
$r = array(array('site_url' => z_root()));
|
||||
} else {
|
||||
@@ -93,7 +94,7 @@ class Regdir extends Controller {
|
||||
$result['directories'] = array();
|
||||
foreach ($r as $rr)
|
||||
$result['directories'][] = $rr['site_url'];
|
||||
|
||||
|
||||
json_return_and_die($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
require_once('include/security.php');
|
||||
@@ -63,7 +64,7 @@ class Register extends Controller {
|
||||
$act = q("SELECT COUNT(*) AS act FROM account")[0]['act'];
|
||||
$is247 = false;
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$sameip = intval(get_config('system','register_sameip', 3));
|
||||
$sameip = intval(Config::Get('system','register_sameip', 3));
|
||||
$arr = $_POST;
|
||||
$invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : '');
|
||||
$name = '';
|
||||
@@ -73,10 +74,10 @@ class Register extends Controller {
|
||||
$password2 = ((x($arr,'password2')) ? trim($arr['password2']) : '');
|
||||
$register_msg = ((x($arr,'register_msg')) ? notags(trim($arr['register_msg'])) : '');
|
||||
$reonar = [];
|
||||
$auto_create = get_config('system','auto_channel_create', 1);
|
||||
$auto_create = Config::Get('system','auto_channel_create', 1);
|
||||
$duty = zar_register_dutystate();
|
||||
|
||||
if (!get_config('system', 'register_duty_jso')) {
|
||||
if (!Config::Get('system', 'register_duty_jso')) {
|
||||
// if not yet configured default to true
|
||||
$duty = array( 'isduty' => true, 'atfrm' => '', 'nowfmt' => '');
|
||||
}
|
||||
@@ -107,7 +108,7 @@ class Register extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
$email_verify = get_config('system', 'verify_email');
|
||||
$email_verify = Config::Get('system', 'verify_email');
|
||||
if ($email_verify && !$email) {
|
||||
notice(t('Email address required') . EOL);
|
||||
return;
|
||||
@@ -180,9 +181,9 @@ class Register extends Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
$policy = get_config('system','register_policy');
|
||||
$invonly = get_config('system','invitation_only');
|
||||
$invalso = get_config('system','invitation_also');
|
||||
$policy = Config::Get('system','register_policy');
|
||||
$invonly = Config::Get('system','invitation_only');
|
||||
$invalso = Config::Get('system','invitation_also');
|
||||
|
||||
switch($policy) {
|
||||
|
||||
@@ -306,11 +307,11 @@ class Register extends Controller {
|
||||
|
||||
if($policy == REGISTER_OPEN || $policy == REGISTER_APPROVE ) {
|
||||
|
||||
$cfgdelay = get_config('system', 'register_delay', '0i');
|
||||
$cfgdelay = Config::Get('system', 'register_delay', '0i');
|
||||
$reg_delayed = calculate_adue( $cfgdelay );
|
||||
$regdelay = (($reg_delayed) ? datetime_convert(date_default_timezone_get(), 'UTC', $reg_delayed['due']) : $now);
|
||||
|
||||
$cfgexpire = get_config('system', 'register_expire', '3d');
|
||||
$cfgexpire = Config::Get('system', 'register_expire', '3d');
|
||||
$reg_expires = calculate_adue( $cfgexpire );
|
||||
$regexpire = (($reg_expires) ? datetime_convert(date_default_timezone_get(), 'UTC', $reg_expires['due']) : datetime_convert('UTC', 'UTC', 'now + 99 years'));
|
||||
|
||||
@@ -323,12 +324,12 @@ class Register extends Controller {
|
||||
$didx = 'e';
|
||||
|
||||
push_lang(($reg['lang']) ? $reg['lang'] : App::$language);
|
||||
$reonar['from'] = get_config('system', 'from_email');
|
||||
$reonar['from'] = Config::Get('system', 'from_email');
|
||||
$reonar['to'] = $email;
|
||||
$reonar['subject'] = sprintf( t('Registration confirmation for %s'), get_config('system','sitename'));
|
||||
$reonar['subject'] = sprintf( t('Registration confirmation for %s'), Config::Get('system','sitename'));
|
||||
$reonar['txttemplate']= replace_macros(get_intltext_template('register_verify_member.tpl'),
|
||||
[
|
||||
'$sitename' => get_config('system','sitename'),
|
||||
'$sitename' => Config::Get('system','sitename'),
|
||||
'$siteurl' => z_root(),
|
||||
'$email' => $email,
|
||||
'$timeframe' => [$regdelay, $regexpire],
|
||||
@@ -428,10 +429,11 @@ class Register extends Controller {
|
||||
function get() {
|
||||
|
||||
$registration_is = '';
|
||||
$register_msg = '';
|
||||
$other_sites = '';
|
||||
|
||||
if(intval(get_config('system','register_policy')) === REGISTER_CLOSED) {
|
||||
if(intval(get_config('system','directory_mode')) === DIRECTORY_MODE_STANDALONE) {
|
||||
if(intval(Config::Get('system','register_policy')) === REGISTER_CLOSED) {
|
||||
if(intval(Config::Get('system','directory_mode')) === DIRECTORY_MODE_STANDALONE) {
|
||||
notice(t('Registration on this hub is disabled.') . EOL);
|
||||
return;
|
||||
}
|
||||
@@ -440,24 +442,25 @@ class Register extends Controller {
|
||||
return $mod->get();
|
||||
}
|
||||
|
||||
if(intval(get_config('system','register_policy')) == REGISTER_APPROVE) {
|
||||
if(intval(Config::Get('system','register_policy')) == REGISTER_APPROVE) {
|
||||
$register_msg = ['register_msg', t('Why do you want to join this hub?'), ((x($_REQUEST,'register_msg')) ? $_REQUEST['register_msg'] : ''), t('This will help to review your registration')];
|
||||
$registration_is = t('Registration on this hub is by approval only.');
|
||||
$other_sites = '<a href="pubsites">' . t('Register at another affiliated hub in case when prefered') . '</a>';
|
||||
}
|
||||
|
||||
$duty = zar_register_dutystate();
|
||||
|
||||
if (!get_config('system', 'register_duty_jso')) {
|
||||
if (!Config::Get('system', 'register_duty_jso')) {
|
||||
// if not yet configured default to true
|
||||
$duty = array( 'isduty' => true, 'atfrm' => '', 'nowfmt' => '');
|
||||
}
|
||||
|
||||
$invitations = false;
|
||||
if(intval(get_config('system','invitation_only'))) {
|
||||
if(intval(Config::Get('system','invitation_only'))) {
|
||||
$invitations = true;
|
||||
$registration_is = t('Registration on this hub is by invitation only.');
|
||||
$other_sites = '<a href="pubsites">' . t('Register at another affiliated hub') . '</a>';
|
||||
} elseif (intval(get_config('system','invitation_also'))) {
|
||||
} elseif (intval(Config::Get('system','invitation_also'))) {
|
||||
$invitations = true;
|
||||
}
|
||||
|
||||
@@ -466,7 +469,7 @@ class Register extends Controller {
|
||||
$duty['atform'] = 'disabled';
|
||||
|
||||
// Configurable terms of service link
|
||||
$tosurl = get_config('system','tos_url');
|
||||
$tosurl = Config::Get('system','tos_url');
|
||||
if(! $tosurl)
|
||||
$tosurl = z_root() . '/help/TermsOfService';
|
||||
|
||||
@@ -475,21 +478,21 @@ class Register extends Controller {
|
||||
// Configurable whether to restrict age or not - default is based on international legal requirements
|
||||
// This can be relaxed if you are on a restricted server that does not share with public servers
|
||||
|
||||
if(get_config('system','no_age_restriction')) {
|
||||
if(Config::Get('system','no_age_restriction')) {
|
||||
$label_tos = sprintf( t('I accept the %s for this website'), $toslink);
|
||||
}
|
||||
else {
|
||||
$age = get_config('system','minimum_age');
|
||||
$age = Config::Get('system','minimum_age');
|
||||
if(!$age) {
|
||||
$age = 13;
|
||||
}
|
||||
$label_tos = sprintf( t('I am over %s years of age and accept the %s for this website'), $age, $toslink);
|
||||
}
|
||||
|
||||
$enable_tos = 1 - intval(get_config('system','no_termsofservice'));
|
||||
$enable_tos = 1 - intval(Config::Get('system','no_termsofservice'));
|
||||
|
||||
$auto_create = get_config('system', 'auto_channel_create', 1);
|
||||
$email_verify = get_config('system','verify_email');
|
||||
$auto_create = Config::Get('system', 'auto_channel_create', 1);
|
||||
$email_verify = Config::Get('system','verify_email');
|
||||
|
||||
$emailval = ((x($_REQUEST,'email')) ? strip_tags(trim($_REQUEST['email'])) : "");
|
||||
$email = ['email',
|
||||
@@ -506,13 +509,11 @@ class Register extends Controller {
|
||||
$invite_code = array('invite_code', t('Please enter your invitation code'), ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : ""));
|
||||
|
||||
$name = array('name', t('Your name'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Real name is preferred'), '', '', $duty['atform']);
|
||||
$nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl'));
|
||||
$nickhub = '@' . str_replace(array('http://','https://','/'), '', Config::Get('system','baseurl'));
|
||||
$nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), t('Your nickname will be used to create an easy to remember channel address'), '', '', $duty['atform']);
|
||||
|
||||
$tos = array('tos', $label_tos, ((x($_REQUEST,'tos')) ? $_REQUEST['tos'] : ''), '', [t('No'),t('Yes')], $duty['atform']);
|
||||
|
||||
$register_msg = ['register_msg', t('Why do you want to join this hub?'), ((x($_REQUEST,'register_msg')) ? $_REQUEST['register_msg'] : ''), t('This will help to review your registration')];
|
||||
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
$o = replace_macros(get_markup_template('register.tpl'), array(
|
||||
@@ -520,7 +521,7 @@ class Register extends Controller {
|
||||
'$title' => t('Registration'),
|
||||
'$reg_is' => $registration_is,
|
||||
'$register_msg' => $register_msg,
|
||||
'$registertext' => bbcode(get_config('system','register_text')),
|
||||
'$registertext' => bbcode(Config::Get('system','register_text')),
|
||||
'$other_sites' => $other_sites,
|
||||
'$msg' => $opal['msg'],
|
||||
'$invitations' => $invitations,
|
||||
@@ -551,7 +552,7 @@ class Register extends Controller {
|
||||
// check against register, account
|
||||
$rear = array( 'is' => false, 'rn' => 0, 'an' => 0, 'msg' => '' );
|
||||
|
||||
$max_dailies = intval(get_config('system', 'max_daily_registrations', 50));
|
||||
$max_dailies = intval(Config::Get('system', 'max_daily_registrations', 50));
|
||||
|
||||
if ($max_dailies) {
|
||||
|
||||
|
||||
@@ -28,119 +28,31 @@ require_once('include/conversation.php');
|
||||
* type= choices are 'html' or 'bbcode', default is 'bbcode'
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
class Rpost extends \Zotlabs\Web\Controller {
|
||||
|
||||
function get() {
|
||||
/**
|
||||
* Handle requests.
|
||||
*
|
||||
* Despite it's name, this method handles both POST and GET requests
|
||||
* to the module.
|
||||
*/
|
||||
public function get(): string {
|
||||
|
||||
$o = '';
|
||||
$channel_id = local_channel();
|
||||
|
||||
if(! local_channel()) {
|
||||
if(remote_channel()) {
|
||||
// redirect to your own site.
|
||||
// We can only do this with a GET request so you'll need to keep the text short or risk getting truncated
|
||||
// by the wretched beast called 'suhosin'. All the browsers now allow long GET requests, but suhosin
|
||||
// blocks them.
|
||||
|
||||
$url = Libzot::get_rpost_path(App::get_observer());
|
||||
// make sure we're not looping to our own hub
|
||||
if(($url) && (! stristr($url, App::get_hostname()))) {
|
||||
foreach($_GET as $key => $arg) {
|
||||
if($key === 'q')
|
||||
continue;
|
||||
$url .= '&' . $key . '=' . $arg;
|
||||
}
|
||||
goaway($url);
|
||||
}
|
||||
}
|
||||
|
||||
// The login procedure is going to bugger our $_REQUEST variables
|
||||
// so save them in the session.
|
||||
|
||||
if(array_key_exists('body',$_REQUEST)) {
|
||||
$_SESSION['rpost'] = $_REQUEST;
|
||||
}
|
||||
return login();
|
||||
if(! $channel_id) {
|
||||
return $this->redirect_or_login();
|
||||
}
|
||||
|
||||
nav_set_selected('Post');
|
||||
|
||||
if (local_channel() && array_key_exists('userfile',$_FILES)) {
|
||||
|
||||
$channel = App::get_channel();
|
||||
$observer = App::get_observer();
|
||||
|
||||
$def_album = get_pconfig($channel['channel_id'],'system','photo_path');
|
||||
$def_attach = get_pconfig($channel['channel_id'],'system','attach_path');
|
||||
|
||||
$r = attach_store($channel, (($observer) ? $observer['xchan_hash'] : ''), '', [
|
||||
'source' => 'editor',
|
||||
'visible' => 0,
|
||||
'album' => $def_album,
|
||||
'directory' => $def_attach,
|
||||
'flags' => 1, // indicates temporary permissions are created
|
||||
'allow_cid' => '<' . $channel['channel_hash'] . '>',
|
||||
'allow_gid' => '',
|
||||
'deny_cid' => '',
|
||||
'deny_gid' => ''
|
||||
]);
|
||||
|
||||
if (! $r['success']) {
|
||||
notice( $r['message'] . EOL);
|
||||
}
|
||||
|
||||
$s = EMPTY_STR;
|
||||
|
||||
if (intval($r['data']['is_photo'])) {
|
||||
$s .= "\n\n" . $r['body'] . "\n\n";
|
||||
}
|
||||
|
||||
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
|
||||
|
||||
if (strpos($r['data']['filetype'],'video') === 0) {
|
||||
$s .= "\n\n" . '[zvideo]' . $url . '[/zvideo]' . "\n\n";
|
||||
}
|
||||
|
||||
if (strpos($r['data']['filetype'],'audio') === 0) {
|
||||
$s .= "\n\n" . '[zaudio]' . $url . '[/zaudio]' . "\n\n";
|
||||
}
|
||||
|
||||
if ($r['data']['filetype'] === 'image/svg+xml') {
|
||||
$x = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
|
||||
if ($x) {
|
||||
$bb = svg2bb($x);
|
||||
if ($bb) {
|
||||
$s .= "\n\n" . $bb;
|
||||
}
|
||||
else {
|
||||
logger('empty return from svgbb');
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger('unable to read svg data file: ' . 'store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($r['data']['filetype'] === 'text/calendar') {
|
||||
$content = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
|
||||
if ($content) {
|
||||
$ev = ical_to_ev($content);
|
||||
if ($ev) {
|
||||
$s .= "\n\n" . format_event_bbcode($ev[0]) . "\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$s .= "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n";
|
||||
$_REQUEST['body'] = ((array_key_exists('body',$_REQUEST)) ? $_REQUEST['body'] . $s : $s);
|
||||
if (! empty($_FILES['userfile'])) {
|
||||
$this->handle_attachments();
|
||||
}
|
||||
|
||||
// If we have saved rpost session variables, but nothing in the current $_REQUEST, recover the saved variables
|
||||
|
||||
if((! array_key_exists('body',$_REQUEST)) && (array_key_exists('rpost',$_SESSION))) {
|
||||
if((! array_key_exists('body',$_REQUEST)) && isset($_SESSION['rpost'])) {
|
||||
$_REQUEST = $_SESSION['rpost'];
|
||||
unset($_SESSION['rpost']);
|
||||
}
|
||||
@@ -152,21 +64,10 @@ class Rpost extends \Zotlabs\Web\Controller {
|
||||
);
|
||||
if($r) {
|
||||
require_once('include/security.php');
|
||||
$change = change_channel($r[0]['channel_id']);
|
||||
change_channel($r[0]['channel_id']);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['remote_return']) && $_REQUEST['remote_return']) {
|
||||
$_SESSION['remote_return'] = $_REQUEST['remote_return'];
|
||||
}
|
||||
if(argc() > 1 && argv(1) === 'return') {
|
||||
if($_SESSION['remote_return'])
|
||||
goaway($_SESSION['remote_return']);
|
||||
goaway(z_root() . '/network');
|
||||
}
|
||||
|
||||
$plaintext = true;
|
||||
|
||||
if(isset($_REQUEST['type']) && $_REQUEST['type'] === 'html') {
|
||||
require_once('include/html2bbcode.php');
|
||||
$_REQUEST['body'] = html2bbcode($_REQUEST['body']);
|
||||
@@ -197,12 +98,12 @@ class Rpost extends \Zotlabs\Web\Controller {
|
||||
'permissions' => $channel_acl,
|
||||
'bang' => '',
|
||||
'visitor' => true,
|
||||
'profile_uid' => local_channel(),
|
||||
'profile_uid' => $channel_id,
|
||||
'title' => $_REQUEST['title'] ?? '',
|
||||
'body' => $_REQUEST['body'] ?? '',
|
||||
'attachment' => $_REQUEST['attachment'] ?? '',
|
||||
'source' => ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : ''),
|
||||
'return_path' => 'rpost/return',
|
||||
'return_path' => 'hq',
|
||||
'bbco_autocomplete' => 'bbcode',
|
||||
'editor_autocomplete' => true,
|
||||
'bbcode' => true,
|
||||
@@ -210,19 +111,128 @@ class Rpost extends \Zotlabs\Web\Controller {
|
||||
'reset' => t('Reset form')
|
||||
);
|
||||
|
||||
$a = '';
|
||||
$editor = status_editor($x, false, 'Rpost');
|
||||
|
||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
return replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||
'$title' => t('Edit post'),
|
||||
'$cancel' => '',
|
||||
'$editor' => $editor
|
||||
'$editor' => $editor,
|
||||
'$delete' => null,
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the observer's instance if not local, or return login form.
|
||||
*
|
||||
* The request is saved in the session if there's a `body` request
|
||||
* param present. (Otherwise not.)
|
||||
*
|
||||
* @return string A login form if not redirected. If the session was
|
||||
* determned to belong to a remote channel, the function does not
|
||||
* return.
|
||||
*/
|
||||
private function redirect_or_login(): string {
|
||||
if(remote_channel()) {
|
||||
// redirect to your own site.
|
||||
// We can only do this with a GET request so you'll need to keep the text short or risk getting truncated
|
||||
// by the wretched beast called 'suhosin'. All the browsers now allow long GET requests, but suhosin
|
||||
// blocks them.
|
||||
|
||||
$url = Libzot::get_rpost_path(App::get_observer());
|
||||
// make sure we're not looping to our own hub
|
||||
if(($url) && (! stristr($url, App::get_hostname()))) {
|
||||
foreach($_GET as $key => $arg) {
|
||||
if($key === 'q')
|
||||
continue;
|
||||
$url .= '&' . $key . '=' . $arg;
|
||||
}
|
||||
goaway($url);
|
||||
}
|
||||
}
|
||||
|
||||
// The login procedure is going to bugger our $_REQUEST variables
|
||||
// so save them in the session.
|
||||
|
||||
if(array_key_exists('body',$_REQUEST)) {
|
||||
$_SESSION['rpost'] = $_REQUEST;
|
||||
}
|
||||
return login();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle uplads of attachments in the rpost call.
|
||||
*
|
||||
* This is only relevant for POST requests.
|
||||
*
|
||||
* The function will modify the `$_REQUEST['body']` superglobal
|
||||
* (or add it if it does not exist).
|
||||
*/
|
||||
private function handle_attachments(): void {
|
||||
$channel = App::get_channel();
|
||||
$observer = App::get_observer();
|
||||
|
||||
$def_album = get_pconfig($channel['channel_id'],'system','photo_path');
|
||||
$def_attach = get_pconfig($channel['channel_id'],'system','attach_path');
|
||||
|
||||
$r = attach_store($channel, (($observer) ? $observer['xchan_hash'] : ''), '', [
|
||||
'source' => 'editor',
|
||||
'visible' => 0,
|
||||
'album' => $def_album,
|
||||
'directory' => $def_attach,
|
||||
'flags' => 1, // indicates temporary permissions are created
|
||||
'allow_cid' => '<' . $channel['channel_hash'] . '>',
|
||||
'allow_gid' => '',
|
||||
'deny_cid' => '',
|
||||
'deny_gid' => ''
|
||||
]);
|
||||
|
||||
if (! $r['success']) {
|
||||
notice( $r['message'] . EOL);
|
||||
}
|
||||
|
||||
$s = EMPTY_STR;
|
||||
|
||||
if (intval($r['data']['is_photo'])) {
|
||||
$s .= "\n\n" . $r['body'] . "\n\n";
|
||||
}
|
||||
|
||||
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
|
||||
|
||||
if (strpos($r['data']['filetype'],'video') === 0) {
|
||||
$s .= "\n\n" . '[zvideo]' . $url . '[/zvideo]' . "\n\n";
|
||||
}
|
||||
|
||||
if (strpos($r['data']['filetype'],'audio') === 0) {
|
||||
$s .= "\n\n" . '[zaudio]' . $url . '[/zaudio]' . "\n\n";
|
||||
}
|
||||
|
||||
if ($r['data']['filetype'] === 'image/svg+xml') {
|
||||
$x = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
|
||||
if ($x) {
|
||||
$bb = svg2bb($x);
|
||||
if ($bb) {
|
||||
$s .= "\n\n" . $bb;
|
||||
}
|
||||
else {
|
||||
logger('empty return from svgbb');
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger('unable to read svg data file: ' . 'store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($r['data']['filetype'] === 'text/calendar') {
|
||||
$content = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
|
||||
if ($content) {
|
||||
$ev = ical_to_ev($content);
|
||||
if ($ev) {
|
||||
$s .= "\n\n" . format_event_bbcode($ev[0]) . "\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$s .= "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n";
|
||||
$_REQUEST['body'] = ((array_key_exists('body',$_REQUEST)) ? $_REQUEST['body'] . $s : $s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Lib\Activity;
|
||||
use Zotlabs\Lib\ActivityStreams;
|
||||
use Zotlabs\Web\Controller;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
use Zotlabs\Lib\Zotfinger;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Search extends Controller {
|
||||
|
||||
@@ -18,7 +19,7 @@ class Search extends Controller {
|
||||
|
||||
function get($update = 0, $load = false) {
|
||||
|
||||
if ((get_config('system', 'block_public')) || (get_config('system', 'block_public_search'))) {
|
||||
if ((Config::Get('system', 'block_public')) || (Config::Get('system', 'block_public_search'))) {
|
||||
if ((!local_channel()) && (!remote_channel())) {
|
||||
notice(t('Public access denied.') . EOL);
|
||||
return;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module; /** @file */
|
||||
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Service_limits extends \Zotlabs\Web\Controller {
|
||||
|
||||
function get() {
|
||||
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$account = \App::get_account();
|
||||
if($account['account_service_class']) {
|
||||
$x = get_config('service_class',$account['account_service_class']);
|
||||
$x = Config::Get('service_class',$account['account_service_class']);
|
||||
if($x) {
|
||||
$o = print_r($x,true);
|
||||
return $o;
|
||||
@@ -22,7 +22,7 @@ class Service_limits extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
return t('No service class restrictions found.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Zotlabs\Module\Settings;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Account {
|
||||
|
||||
function post() {
|
||||
@@ -19,7 +21,7 @@ class Account {
|
||||
if (strpos($email, '@') > 0) {
|
||||
if(! validate_email($email))
|
||||
$errs[] = t('Not valid email.');
|
||||
$adm = trim(get_config('system','admin_email'));
|
||||
$adm = trim(Config::Get('system','admin_email'));
|
||||
if(($adm) && (strcasecmp($email,$adm) == 0)) {
|
||||
$errs[] = t('Protected email address. Cannot change to that email.');
|
||||
$email = \App::$account['account_email'];
|
||||
|
||||
@@ -7,6 +7,7 @@ use Zotlabs\Access\PermissionLimits;
|
||||
use Zotlabs\Access\PermissionRoles;
|
||||
use Zotlabs\Daemon\Master;
|
||||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
|
||||
require_once('include/selectors.php');
|
||||
@@ -183,11 +184,11 @@ class Channel {
|
||||
$subdir = ((strlen(App::get_path())) ? '<br />' . t('or') . ' ' . z_root() . '/channel/' . $nickname : '');
|
||||
$webbie = $nickname . '@' . App::get_hostname();
|
||||
$intl_nickname = unpunify($nickname) . '@' . unpunify(App::get_hostname());
|
||||
$disable_discover_tab = intval(get_config('system', 'disable_discover_tab', 1)) == 1;
|
||||
$site_firehose = intval(get_config('system', 'site_firehose', 0)) == 1;
|
||||
$disable_discover_tab = intval(Config::Get('system', 'disable_discover_tab', 1)) == 1;
|
||||
$site_firehose = intval(Config::Get('system', 'site_firehose', 0)) == 1;
|
||||
|
||||
$expire = $channel['channel_expire_days'];
|
||||
$sys_expire = get_config('system', 'default_expire_days');
|
||||
$sys_expire = Config::Get('system', 'default_expire_days');
|
||||
|
||||
$tpl_addr = get_markup_template("settings_nick_set.tpl");
|
||||
$prof_addr = replace_macros($tpl_addr, [
|
||||
|
||||
@@ -11,24 +11,19 @@ class Conversation {
|
||||
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
|
||||
|
||||
check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
|
||||
|
||||
|
||||
$features = get_module_features($module);
|
||||
|
||||
process_module_features_post(local_channel(), $features, $_POST);
|
||||
|
||||
Libsync::build_sync_packet();
|
||||
|
||||
if($_POST['aj']) {
|
||||
if($_POST['auto_update'] == 1)
|
||||
info(t('Settings saved.') . EOL);
|
||||
else
|
||||
info(t('Settings saved. Reload page please.') . EOL);
|
||||
|
||||
Libsync::build_sync_packet();
|
||||
|
||||
if($_POST['aj']) {
|
||||
killme();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
function get() {
|
||||
@@ -48,7 +43,7 @@ class Conversation {
|
||||
'$features' => process_module_features_get(local_channel(), $features),
|
||||
'$submit' => t('Submit')
|
||||
));
|
||||
|
||||
|
||||
if($aj) {
|
||||
echo $o;
|
||||
killme();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Module\Settings;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
|
||||
class Display {
|
||||
@@ -85,7 +86,7 @@ class Display {
|
||||
|
||||
$yes_no = array(t('No'),t('Yes'));
|
||||
|
||||
$default_theme = get_config('system','theme');
|
||||
$default_theme = Config::Get('system','theme');
|
||||
if(! $default_theme)
|
||||
$default_theme = 'redbasic';
|
||||
|
||||
@@ -95,7 +96,7 @@ class Display {
|
||||
|
||||
$theme = (($existing_theme) ? $existing_theme : $default_theme);
|
||||
|
||||
$allowed_themes_str = get_config('system','allowed_themes');
|
||||
$allowed_themes_str = Config::Get('system','allowed_themes');
|
||||
$allowed_themes_raw = explode(',',$allowed_themes_str);
|
||||
$allowed_themes = array();
|
||||
if(count($allowed_themes_raw))
|
||||
@@ -121,7 +122,7 @@ class Display {
|
||||
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
|
||||
$is_library = file_exists('view/theme/'. $th . '/library');
|
||||
|
||||
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
|
||||
if (!$is_experimental or ($is_experimental && (Config::Get('experimentals','exp_themes')==1 or Config::Get('experimentals','exp_themes')===false))){
|
||||
$theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
|
||||
if (! $is_library) {
|
||||
$themes[$f] = $theme_name;
|
||||
|
||||
@@ -6,6 +6,7 @@ use App;
|
||||
use Zotlabs\Access\PermissionLimits;
|
||||
use Zotlabs\Access\Permissions;
|
||||
use Zotlabs\Daemon\Master;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Lib\Group;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
|
||||
@@ -81,7 +82,7 @@ class Privacy {
|
||||
|
||||
$help_txt = t('Advise: set to "Anybody on the internet" and use privacy groups to restrict access');
|
||||
$limits = PermissionLimits::Get(local_channel());
|
||||
$anon_comments = get_config('system', 'anonymous_comments', true);
|
||||
$anon_comments = Config::Get('system', 'anonymous_comments', true);
|
||||
|
||||
foreach ($global_perms as $k => $perm) {
|
||||
$options = [];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
/**
|
||||
* @file Zotlabs/Module/Setup.php
|
||||
*
|
||||
@@ -8,10 +7,12 @@ namespace Zotlabs\Module;
|
||||
* @todo This setup module could need some love and improvements.
|
||||
*/
|
||||
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
/**
|
||||
* @brief Initialisation for the setup module.
|
||||
*
|
||||
* Controller for the initial setup/installation.
|
||||
*/
|
||||
class Setup extends \Zotlabs\Web\Controller {
|
||||
|
||||
@@ -45,9 +46,9 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
if(x($_POST, 'pass')) {
|
||||
$this->install_wizard_pass = intval($_POST['pass']);
|
||||
self::$install_wizard_pass = intval($_POST['pass']);
|
||||
} else {
|
||||
$this->install_wizard_pass = 1;
|
||||
self::$install_wizard_pass = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
*/
|
||||
function post() {
|
||||
|
||||
switch($this->install_wizard_pass) {
|
||||
switch(self::$install_wizard_pass) {
|
||||
case 1:
|
||||
case 2:
|
||||
return;
|
||||
@@ -179,18 +180,18 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
$install_title = t('$Projectname Server - Setup');
|
||||
|
||||
if(x(\App::$data, 'db_conn_failed')) {
|
||||
$this->install_wizard_pass = 2;
|
||||
self::$install_wizard_pass = 2;
|
||||
$wizard_status = t('Could not connect to database.');
|
||||
}
|
||||
if(x(\App::$data, 'url_fail')) {
|
||||
$this->install_wizard_pass = 3;
|
||||
self::$install_wizard_pass = 3;
|
||||
$wizard_status = t('Could not connect to specified site URL. Possible SSL certificate or DNS issue.');
|
||||
if(\App::$data['url_error'])
|
||||
$wizard_status .= ' ' . \App::$data['url_error'];
|
||||
}
|
||||
|
||||
if(x(\App::$data, 'db_create_failed')) {
|
||||
$this->install_wizard_pass = 2;
|
||||
self::$install_wizard_pass = 2;
|
||||
$wizard_status = t('Could not create table.');
|
||||
}
|
||||
$db_return_text = '';
|
||||
@@ -214,9 +215,11 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
$tpl = get_markup_template('install.tpl');
|
||||
return replace_macros($tpl, array(
|
||||
'$title' => $install_title,
|
||||
'$icon' => null,
|
||||
'$pass' => '',
|
||||
'$status' => t('Permission denied.'),
|
||||
'$text' => '',
|
||||
'$what_next' => null,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -236,7 +239,7 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
));
|
||||
}
|
||||
|
||||
switch ($this->install_wizard_pass){
|
||||
switch (self::$install_wizard_pass){
|
||||
case 1: { // System check
|
||||
|
||||
$checks = array();
|
||||
@@ -392,7 +395,7 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
$this->check_add($checks, t('PHP version'), false, true, $help);
|
||||
}
|
||||
|
||||
if(strlen($phpath)) {
|
||||
if(!empty($phpath)) {
|
||||
$passed = file_exists($phpath);
|
||||
}
|
||||
elseif(function_exists('shell_exec')) {
|
||||
@@ -760,11 +763,11 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
*/
|
||||
function what_next() {
|
||||
// install the standard theme
|
||||
set_config('system', 'allowed_themes', 'redbasic');
|
||||
Config::Set('system', 'allowed_themes', 'redbasic');
|
||||
|
||||
// if imagick converter is installed, use it
|
||||
if(@is_executable('/usr/bin/convert')) {
|
||||
set_config('system','imagick_convert_path','/usr/bin/convert');
|
||||
Config::Set('system','imagick_convert_path','/usr/bin/convert');
|
||||
}
|
||||
|
||||
|
||||
@@ -783,7 +786,7 @@ class Setup extends \Zotlabs\Web\Controller {
|
||||
|
||||
$x = curl_version();
|
||||
if(stristr($x['ssl_version'],'openssl'))
|
||||
set_config('system','curl_ssl_ciphers','ALL:!eNULL');
|
||||
Config::Set('system','curl_ssl_ciphers','ALL:!eNULL');
|
||||
|
||||
// Create a system channel
|
||||
require_once ('include/channel.php');
|
||||
|
||||
@@ -94,6 +94,12 @@ class Share extends \Zotlabs\Web\Controller {
|
||||
else
|
||||
killme();
|
||||
|
||||
$object = Activity::fetch_item([ 'id' => $item['mid'] ]);
|
||||
|
||||
if (!$object) {
|
||||
killme();
|
||||
}
|
||||
|
||||
$arr['aid'] = $item['aid'];
|
||||
$arr['uid'] = $item['uid'];
|
||||
|
||||
@@ -121,7 +127,7 @@ class Share extends \Zotlabs\Web\Controller {
|
||||
$arr['owner_xchan'] = $item['author_xchan'];
|
||||
$arr['source_xchan'] = '';
|
||||
|
||||
$arr['obj'] = $item['obj'];
|
||||
$arr['obj'] = $object;
|
||||
$arr['obj_type'] = $item['obj_type'];
|
||||
$arr['verb'] = ACTIVITY_SHARE;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Config;
|
||||
|
||||
class Siteinfo extends \Zotlabs\Web\Controller {
|
||||
|
||||
@@ -22,18 +23,18 @@ class Siteinfo extends \Zotlabs\Web\Controller {
|
||||
'$sitenametxt' => t('Site Name'),
|
||||
'$sitename' => \Zotlabs\Lib\System::get_site_name(),
|
||||
'$headline' => t('Site Information'),
|
||||
'$site_about' => bbcode(get_config('system','siteinfo')),
|
||||
'$site_about' => bbcode(Config::Get('system','siteinfo')),
|
||||
'$admin_headline' => t('Administrator'),
|
||||
'$admin_about' => bbcode(get_config('system','admininfo')),
|
||||
'$admin_about' => bbcode(Config::Get('system','admininfo')),
|
||||
'$terms' => t('Terms of Service'),
|
||||
'$prj_header' => t('Software and Project information'),
|
||||
'$prj_name' => t('This site is powered by $Projectname'),
|
||||
'$prj_transport' => t('Federated and decentralised networking and identity services provided by Zot'),
|
||||
'$transport_link' => '<a href="https://zotlabs.org">https://zotlabs.org</a>',
|
||||
'$prj_transport' => t('Federated and decentralised networking and identity services provided by'),
|
||||
'$transport_link' => '<a href="https://hubzilla.org">https://hubzilla.org</a>',
|
||||
|
||||
'$additional_text' => t('Additional federated transport protocols:'),
|
||||
'$additional_fed' => implode(', ', $federated),
|
||||
'$prj_version' => ((get_config('system','hidden_version_siteinfo')) ? '' : sprintf( t('Version %s'), \Zotlabs\Lib\System::get_project_version())),
|
||||
'$prj_version' => ((Config::Get('system','hidden_version_siteinfo')) ? '' : sprintf( t('Version %s'), \Zotlabs\Lib\System::get_project_version())),
|
||||
'$prj_linktxt' => t('Project homepage'),
|
||||
'$prj_srctxt' => t('Developer homepage'),
|
||||
'$prj_link' => \Zotlabs\Lib\System::get_project_link(),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user