Compare commits
1135 Commits
7109d2a6a8
...
eeadc00e83
Author | SHA1 | Date | |
---|---|---|---|
eeadc00e83 | |||
e54267e0cf | |||
1f889b6086 | |||
3f9b8ec1e5 | |||
b6cc2ddc48 | |||
455b3faa14 | |||
0d4ea4b7f0 | |||
e733adcaae | |||
45ee7d55f0 | |||
d39f4014e4 | |||
5110c11885 | |||
0fee47e0c6 | |||
20374ab5a2 | |||
c9f92f41fb | |||
275347b087 | |||
f2188835e7 | |||
06ea61f0ed | |||
6a17223289 | |||
b1b0bfc280 | |||
eb9af005f0 | |||
29330a4205 | |||
9da21bf680 | |||
2d9633a595 | |||
472bde99a4 | |||
fca1abbafe | |||
36a8962333 | |||
7458721f9f | |||
a633532475 | |||
cef408c842 | |||
f9dcb7c6d4 | |||
8f22b4f33d | |||
feb74b4d9a | |||
b79daee21b | |||
86a486f62b | |||
9d38671ec9 | |||
b4db8fe8d2 | |||
a522267c9d | |||
5392bafbb4 | |||
2372e50e3b | |||
39607b20e2 | |||
76e9c4daa2 | |||
07f7585e40 | |||
1cc0c1148e | |||
e28be36086 | |||
b315f2135f | |||
0baff45243 | |||
15f6031113 | |||
e057b39f68 | |||
738e63f73e | |||
43fd9eb77c | |||
ddc0c2e240 | |||
00f4845fe6 | |||
8ac3f58a1c | |||
a96a8de651 | |||
40777d08c1 | |||
18f69f6f73 | |||
fb2d193a6c | |||
aa94a131b8 | |||
e1b45c7fba | |||
7beee99f31 | |||
b3504dfdee | |||
1899c53516 | |||
49078069f9 | |||
f7a8c109e9 | |||
52e3126cba | |||
9718484f9e | |||
c7e53cb9b4 | |||
af4164b86a | |||
43aa9cddc5 | |||
9a8f6f2150 | |||
ed520a3f39 | |||
d25fc9de9b | |||
3756f933a6 | |||
cdf180c58d | |||
83e34ef8e7 | |||
5817709562 | |||
60dd9bed5e | |||
704cc34981 | |||
b84ad5578f | |||
057eefcbe2 | |||
847396ac38 | |||
e73ef3e925 | |||
bde1d5b02e | |||
ce14c81e1f | |||
301fd13ced | |||
d77fa441db | |||
912493f673 | |||
c69705d34e | |||
2e6ab0e312 | |||
44b2b97e80 | |||
22c1cd3cd1 | |||
f49c85e9b8 | |||
d609d70bd2 | |||
30973647a6 | |||
c60464a4be | |||
f37750d679 | |||
b0cc0f0d7b | |||
1c789d487b | |||
2ae3ae0b8a | |||
63c661c783 | |||
2497817c2a | |||
060936d31e | |||
0c5158b85d | |||
777afb45fc | |||
590f92ba42 | |||
91cc6d5a94 | |||
a5931f7ffd | |||
d096dbe276 | |||
f84e76d893 | |||
d33dc131ff | |||
f8b70ef9f0 | |||
0128bbdb08 | |||
7d20798e97 | |||
9e61720875 | |||
f114ad1883 | |||
f95a33da70 | |||
eb856275f2 | |||
3d3ccdad77 | |||
8a6da56738 | |||
3546f5b189 | |||
38f5e28e33 | |||
0d2c302beb | |||
2d624e900d | |||
07520719f7 | |||
244b65e5fc | |||
c54bca43a5 | |||
e0cdb8a940 | |||
710a805623 | |||
c76795f0f8 | |||
3576855e71 | |||
0e543b2d4a | |||
d26b0ed5a2 | |||
7072a71788 | |||
2338a268d3 | |||
6af4bfae21 | |||
ae8f1a1c5b | |||
7bb60776c6 | |||
d74345782a | |||
5288ed46d4 | |||
0b2c013db4 | |||
8576610c54 | |||
991c5fa6de | |||
4fc01c93ce | |||
5b52533749 | |||
951b221e21 | |||
e1823c7138 | |||
800f94495b | |||
8f56aa316b | |||
846709eba8 | |||
d9361f2b81 | |||
2fa9d49632 | |||
ed805d1af2 | |||
290b14a000 | |||
c38dcc2f41 | |||
8690b311a8 | |||
86b9cef273 | |||
bc70bc23a4 | |||
c554af9c30 | |||
94801986b6 | |||
27c738f90f | |||
a8428264f0 | |||
4e5794c99d | |||
d2b23d57e4 | |||
46607598f3 | |||
d60c405390 | |||
0209c39e0a | |||
c8d4b73871 | |||
7dfe517c77 | |||
5312b23f03 | |||
a2f386cd2f | |||
cfd09663e7 | |||
89efa73195 | |||
d05910a6e5 | |||
ff5da9bc71 | |||
e4702ed464 | |||
baf2f7565a | |||
0d95535137 | |||
afd1dba774 | |||
2f3f41ed9c | |||
eb1cfd09a9 | |||
a5aa44f189 | |||
e72d17c3af | |||
5d3248d57b | |||
58cc270da8 | |||
23f31883f5 | |||
a79be5e697 | |||
35ce394948 | |||
884a265c5a | |||
3ce4a1fee4 | |||
bf7df13855 | |||
183e9dc7b2 | |||
84fc8973e7 | |||
fc1ef084f4 | |||
5e176b52a5 | |||
62376d2e62 | |||
a65aa75234 | |||
1454f3bc2a | |||
fe2c4f7c4b | |||
412ba461e7 | |||
236a4c819b | |||
2eb170bdbd | |||
04945f9c98 | |||
0a296c3f02 | |||
cc048bca38 | |||
d786f225ee | |||
1a1e452fae | |||
539ac4f2b8 | |||
c7811576cc | |||
106dac5508 | |||
870fd1a52b | |||
46660c9462 | |||
2722ef82cf | |||
2362e28c40 | |||
71a7f2d503 | |||
a71fb8d7f3 | |||
e78471c847 | |||
d87585477c | |||
7aa5407bbd | |||
607d26e906 | |||
b1860d4121 | |||
c70d657885 | |||
f3dc69c226 | |||
fc246424a9 | |||
0af2be14ee | |||
1622ce0a99 | |||
e7574356d8 | |||
2761972742 | |||
ab1ff53b18 | |||
b29e520a25 | |||
19d11c08d4 | |||
5fd5819321 | |||
c6ca844f33 | |||
6496ed4c19 | |||
019bb56668 | |||
04d997548c | |||
85db716894 | |||
e86a2e047d | |||
74be29e822 | |||
3e431bda1e | |||
69e2b45f39 | |||
5d1aeea41e | |||
a521c1adaf | |||
c285e4160b | |||
75d857c595 | |||
d270a98e86 | |||
c95882125d | |||
d84dad20ca | |||
9cd72cfec6 | |||
60a6503f6f | |||
350f542220 | |||
fc675a1736 | |||
d9e69fc543 | |||
15eba181a0 | |||
6fddcb2c04 | |||
741469a5c5 | |||
7fcc813028 | |||
3fcf35a5bc | |||
5954af2e81 | |||
7d51fa47d5 | |||
16f5dc92f8 | |||
74ff7bae59 | |||
d590df9a72 | |||
35cf093086 | |||
c8b43e688f | |||
99e20d1b00 | |||
63a628460e | |||
b9cb94c432 | |||
498a957009 | |||
8d1bc02f8f | |||
e5ff71f839 | |||
05f8303034 | |||
6965614f00 | |||
215c332a94 | |||
5e40b47a17 | |||
59088161e8 | |||
de83be11ac | |||
9b8b1be3e7 | |||
9778b60e64 | |||
2205ef0574 | |||
458f22d303 | |||
7fb0f018df | |||
8145454707 | |||
76f4ba7685 | |||
8543174bf1 | |||
a260e97b6f | |||
c6e627d45c | |||
733543505b | |||
38fa76d6b5 | |||
e62be24e6b | |||
71c1530303 | |||
c632675976 | |||
b93f100c97 | |||
6deb93256a | |||
73742812d1 | |||
818cdf83ca | |||
ce69026964 | |||
ace80ca1b4 | |||
d5e005f90d | |||
32a9f39768 | |||
445a0b61dd | |||
2be0ad7697 | |||
08d64f3c57 | |||
28c7fda6e9 | |||
fbd4b54656 | |||
6753eeab8b | |||
5bff6f38d7 | |||
4f98d2c74a | |||
7833da5196 | |||
62f982cf7e | |||
5c74113bf6 | |||
552a30e1f3 | |||
1c8690a872 | |||
cfe5101b9b | |||
23a8245fb0 | |||
10154e532e | |||
b3ca1e2bfb | |||
10e423237e | |||
f79c810236 | |||
1a8722c1f6 | |||
a5be5b27e3 | |||
3d73c452df | |||
82c2e686d7 | |||
a0752b1161 | |||
2f42606c43 | |||
349436a77a | |||
1b71b963d7 | |||
04450bbbd4 | |||
e5a531d3b5 | |||
1d8c9276f3 | |||
22e2578b23 | |||
9f03622841 | |||
16b76919c0 | |||
b6f7d31036 | |||
fa80c69d94 | |||
8cb7d4a9bd | |||
36c7aea214 | |||
3b01d12bb5 | |||
303d556ab0 | |||
e4dda7d2ca | |||
82972744a9 | |||
8f82fb9a22 | |||
edaff99307 | |||
6c59987418 | |||
684fceada9 | |||
f664208157 | |||
e6f8b8c6e0 | |||
3b3192933d | |||
e389fe945f | |||
dbbbef368f | |||
edc6851f0e | |||
a660718099 | |||
a649d117e2 | |||
7a39dfe23b | |||
f27d9cb73e | |||
942d1e15f6 | |||
8b2a3805b6 | |||
eda197070d | |||
98f4a68890 | |||
7e58052994 | |||
e32654381b | |||
60f18f6f56 | |||
34f21b40f4 | |||
5ea22197ac | |||
8d37828c70 | |||
84b2a35e05 | |||
ae76fa1174 | |||
b83526ad0b | |||
0d53c69610 | |||
2baa56d478 | |||
1bc72f5b55 | |||
1d00947bcd | |||
146f874c2e | |||
8e0196fec3 | |||
431eb34a1c | |||
5201d87b3f | |||
910a76812a | |||
c56e4222dc | |||
13cc638062 | |||
226e857387 | |||
8012968506 | |||
ed1a879b7b | |||
f905220923 | |||
1b0f7e5add | |||
f61dbf76a7 | |||
b51b537711 | |||
6b2a936f16 | |||
a2559d6241 | |||
a27ffda59f | |||
5b5c38f9ab | |||
35ca4961d2 | |||
8f5d6fdf72 | |||
e4fd9d425f | |||
f9c0d5a14b | |||
fbcc56d42d | |||
1ced4673fe | |||
7402bc9f50 | |||
4a94078091 | |||
2035a7a178 | |||
71f4dd0d20 | |||
7676aa7908 | |||
da93373e8d | |||
a01cdccb05 | |||
cd3e842f76 | |||
f31e617f5d | |||
79235b6db1 | |||
00808326c2 | |||
a3d8a59b00 | |||
75b01f669a | |||
037e181f82 | |||
bb9afc520b | |||
150c0e0750 | |||
97a3587e58 | |||
ca7af7a64b | |||
bbd1c34292 | |||
99e1c64b1a | |||
2794100cbc | |||
49db646922 | |||
0ea219f728 | |||
72b3bbb23c | |||
7d86cb1a1e | |||
6c2f42ed03 | |||
b2f962c0ce | |||
978fe26f4c | |||
c03784eaa9 | |||
d44968cd10 | |||
9c383e2004 | |||
e73451d89b | |||
10e0672981 | |||
25ba8bfb53 | |||
8eda9dfe7c | |||
3cf0b9b9fd | |||
24e4dfa541 | |||
8eca961aeb | |||
dddf17b5c5 | |||
ebe512edfd | |||
8b41d62a88 | |||
c0c414ab95 | |||
77c68d10e8 | |||
624231c665 | |||
3288efb323 | |||
0ba111d99c | |||
7898f9cccb | |||
437419bbd9 | |||
de76e860ad | |||
d6a7303991 | |||
1ec4c14501 | |||
e391328cbf | |||
de25d3a7ee | |||
bded1c3989 | |||
0e160040d4 | |||
bfe220c344 | |||
c00004f6ea | |||
5e7e2b65b2 | |||
6b36bd893b | |||
73ba7d8005 | |||
a7639a2341 | |||
3092975523 | |||
f7167acc74 | |||
56c4727fe1 | |||
934766c364 | |||
4e6b6fd76b | |||
85f57e69fa | |||
a6d060b0e4 | |||
361908ce3b | |||
d43e393921 | |||
5b2ac7b944 | |||
6877f8a473 | |||
6ebf0f860b | |||
a01872a117 | |||
a60467ed78 | |||
6d74d74a26 | |||
0e2c2cd0e0 | |||
4c64c6ed98 | |||
db987999b5 | |||
9fbdcb5459 | |||
b56e6f4b5b | |||
25e1412174 | |||
3ac3b3d2af | |||
272911527c | |||
4e53ba0c20 | |||
29190fae73 | |||
012f486eb6 | |||
e6933a28da | |||
50316bbb80 | |||
051253a745 | |||
3607aa32ca | |||
e60dfef0d0 | |||
7c058153b5 | |||
801ee5c17f | |||
51b21b6709 | |||
719c294fb5 | |||
f45b358393 | |||
597f1ba9e3 | |||
a5f601718f | |||
b6d62003a6 | |||
54289b2d08 | |||
765b50bde8 | |||
ce56cabd9f | |||
d8ad95ac39 | |||
3ef7ae2f74 | |||
d0b16b2fc1 | |||
6c73077bbc | |||
f88722bf7f | |||
f4d49e561c | |||
907deed523 | |||
34418d790d | |||
ed7b175491 | |||
a95e93c725 | |||
08b9d11d46 | |||
acfc11c436 | |||
1cecc51796 | |||
8879d93aad | |||
29ee2473d7 | |||
fe402c3850 | |||
efc35ddb00 | |||
c4c1bd2908 | |||
c2c563be26 | |||
4291e0def5 | |||
74bab60989 | |||
bb67f6e219 | |||
9dd1cf8316 | |||
92807d86a3 | |||
c11e2b0795 | |||
d402fe364e | |||
55640eec87 | |||
a3fb499735 | |||
0ec7238da4 | |||
6b555f64da | |||
01558d6dda | |||
fa5e7585a3 | |||
7c7cb8373c | |||
9de6350154 | |||
849ce8f203 | |||
18f0d3d31e | |||
62ec2b5610 | |||
f4e2c7a11d | |||
3e5a820679 | |||
bd7582e841 | |||
7effc07fd6 | |||
32eb50506d | |||
960477cfaa | |||
2f29031f2a | |||
313f3d8515 | |||
53b46855ef | |||
9f70c2a1d7 | |||
33088b3446 | |||
e1b259fc4c | |||
c88125348f | |||
6a434588a9 | |||
32847f3398 | |||
3ee594bb1f | |||
a6ff817f47 | |||
0bd0046b9f | |||
8bbf3f3699 | |||
0d1869be7d | |||
32aa8bd198 | |||
1f08b2c1c0 | |||
d2ea58428d | |||
14ebc4a821 | |||
7c6d54c989 | |||
a5af1408d6 | |||
a8eabae12f | |||
8e67d28997 | |||
c356c962f1 | |||
7b563fd307 | |||
c4aaa08693 | |||
352b7a0ac3 | |||
25992b063a | |||
f600f68907 | |||
5501f703ae | |||
3d7e4cb9f4 | |||
9fb447fefd | |||
733509561a | |||
6bf5c344f5 | |||
548fd3201d | |||
d2ba254a5a | |||
41be03a7c3 | |||
d4cbfeb54c | |||
187a28abda | |||
77e87da441 | |||
6dcc964ed8 | |||
fa3db8737b | |||
9751cadfbf | |||
d4bb5223a4 | |||
eec48057dc | |||
70ea419fcc | |||
d1a85f1fa4 | |||
99c6e65be4 | |||
5f074bc4e7 | |||
83c04ac433 | |||
99df11e99b | |||
6f93ee7e49 | |||
a147038c2e | |||
2a4985cd46 | |||
a4eb6f971f | |||
24804eb042 | |||
5a2a8db21f | |||
643d18b108 | |||
e084dd964b | |||
a91944af24 | |||
0c8242af64 | |||
525eab395c | |||
de5097b772 | |||
acc3c2d2c7 | |||
90567772bd | |||
3d5b81e4ef | |||
877369d964 | |||
8609fe2f5e | |||
336c8eba4f | |||
d77fece367 | |||
805fa6024f | |||
6460218c0e | |||
c07af2a0ed | |||
528e1661e4 | |||
565ade02a4 | |||
99c319734d | |||
45badbf0f8 | |||
2edbd1a3e2 | |||
061653a9a5 | |||
d7946dd985 | |||
7a39be8270 | |||
efaf84631d | |||
74b10708ae | |||
8a71bdc1a0 | |||
e354f48765 | |||
cdbfa34066 | |||
19db2ab184 | |||
d1abb690a0 | |||
944f4733be | |||
47ad922f9a | |||
fa675de710 | |||
a6d96bf1b7 | |||
293f147867 | |||
81b21c4131 | |||
5204d79dee | |||
9621279572 | |||
12fb897f54 | |||
e7fd4a4cd1 | |||
5dc9319bb2 | |||
db7af4c45b | |||
ec92f7a81c | |||
09e01b9356 | |||
01c2a775e4 | |||
00883c9dcb | |||
53f3454874 | |||
403b025b5d | |||
348156dbcf | |||
eca52627c1 | |||
59c97234f8 | |||
584e7a7e6d | |||
eff7740a67 | |||
1a54fc2140 | |||
952e6c688c | |||
3a7586e3f7 | |||
ba0b83b0b0 | |||
9d455a5d0b | |||
3259bd17dc | |||
5c05a3b0f6 | |||
744d0fdde4 | |||
91949f0292 | |||
8dfd560b52 | |||
1ec70f9640 | |||
fe547b7851 | |||
cbe8d463b1 | |||
48b1dceb19 | |||
2d0af812b1 | |||
6df187478d | |||
c3cae0ae96 | |||
10e48a34f2 | |||
0eaa2eae84 | |||
89338684b5 | |||
27e59e3819 | |||
cb0fde5d7d | |||
d53f51fce3 | |||
eb6b03b555 | |||
d21da2dc0a | |||
a1a0b6512c | |||
cac42d349c | |||
a8759a9b86 | |||
66819fadfd | |||
63fc315ea0 | |||
17a3a48210 | |||
5d9ce80007 | |||
e6db31a462 | |||
9506bf6989 | |||
21d1659982 | |||
4dc96daeb3 | |||
b1eba05e93 | |||
03cfb69a64 | |||
f8c3083f35 | |||
eedde86a37 | |||
07d42d6af2 | |||
5b70df63de | |||
ca3dcdad04 | |||
863977da66 | |||
f9ab5b0669 | |||
256c8ab170 | |||
71ab9e13f2 | |||
87bb4d44a2 | |||
3550257d9c | |||
477bec1977 | |||
3b03da3259 | |||
ad1d160634 | |||
59b48c2d84 | |||
6d7cfc8450 | |||
815d8975e6 | |||
7c66073e4b | |||
a36a4b6192 | |||
4998d15e85 | |||
82c631eae3 | |||
75360f3b8c | |||
3f6ec3dd31 | |||
d6e12d412b | |||
cb5e18838c | |||
60dec7f164 | |||
e6ada08e1b | |||
5916544bc8 | |||
45c4439119 | |||
33d1df3c6d | |||
3226b00995 | |||
55365aa4da | |||
d3bbed176f | |||
e9393fb509 | |||
a7e576fda0 | |||
f2cf3d0072 | |||
143d8a6d6d | |||
a8ab85065b | |||
4a626ef101 | |||
386c08aa05 | |||
6af025246e | |||
6313780094 | |||
48da6f2f51 | |||
a68c790c64 | |||
cae2e17436 | |||
df8644c59c | |||
a8c23e8cee | |||
64fad2913d | |||
99d54dc711 | |||
246021fdfa | |||
3bd6acba7e | |||
8161a32b77 | |||
48090d1b70 | |||
0c92610f6c | |||
327cf17b07 | |||
0a20566199 | |||
561f22cdc4 | |||
939a80ceb0 | |||
4ecf6d9d63 | |||
18f54f4425 | |||
4fb7e9b023 | |||
5ab1cf44f9 | |||
e612137a9d | |||
c7dbe0b610 | |||
e7051580e4 | |||
664071a0b1 | |||
57a207fd8c | |||
bb97776dfb | |||
d524f55e3e | |||
a81708091f | |||
a6b09529fd | |||
2da2ac6826 | |||
78a8ed6fe7 | |||
f13c91b320 | |||
89fde911f9 | |||
1c80969db9 | |||
3bdc20df15 | |||
e6a5c172ce | |||
6cb6841866 | |||
7c7fc624f3 | |||
d82e8284f0 | |||
44af6e4bc2 | |||
379eeb49eb | |||
cdfd51310e | |||
594c17546b | |||
a9265220af | |||
33c9d17bdb | |||
fb04eb107b | |||
64f290a055 | |||
39908f9083 | |||
dd0811aec9 | |||
5530b6fc75 | |||
1c65098013 | |||
be6809ecdd | |||
457c34dd13 | |||
a1d57abfe4 | |||
a98d321376 | |||
028d823d96 | |||
0104930fb3 | |||
c8636db9f6 | |||
30b9a57a37 | |||
029a539774 | |||
9e315a75d8 | |||
ec02664773 | |||
bd9292fe19 | |||
db3404e8a3 | |||
d5b29b1c61 | |||
ae5dde9f5e | |||
46152ab400 | |||
210200d330 | |||
5d2a25a86e | |||
bf638b6bf6 | |||
fb07ba2e3b | |||
1f4ca51cc8 | |||
205f19da38 | |||
1d7d8788bd | |||
e582cd4543 | |||
e10d714ef5 | |||
4b5c6994b2 | |||
174151d4d0 | |||
d0318b3df6 | |||
eecd5020ac | |||
b202354bbb | |||
fe3713b8f3 | |||
f1f40fbbf7 | |||
92813dd2e4 | |||
bc7d21183d | |||
40fb820aef | |||
56ac879c92 | |||
3e33ec0c0f | |||
ea49ab6e04 | |||
c6ca3400ec | |||
b9f0985467 | |||
52f74b6312 | |||
5bc0480fc2 | |||
9fa3df3cbf | |||
aa2b4e15a3 | |||
db12814f3b | |||
70d0f087b7 | |||
c7638e0d0c | |||
e763f57d29 | |||
c107c5ff0d | |||
4dd2d7ebab | |||
9aa05eb911 | |||
8cec89195b | |||
f7d42764de | |||
198d38545d | |||
a09558e8a8 | |||
9bb9bf5668 | |||
8124dedbf6 | |||
119f9d9d27 | |||
16b3db343b | |||
f50368c9cb | |||
55744b6ccb | |||
8ec5d10bf4 | |||
811e144e9e | |||
6c745c8522 | |||
8092bfe277 | |||
23dda5d510 | |||
da3041a4d4 | |||
fa123bd765 | |||
891f686dcf | |||
3dbce995fd | |||
7208576f67 | |||
1ba9a65fd8 | |||
57d11d7f2e | |||
f1f4561002 | |||
a89f235044 | |||
5b682eb5fb | |||
9fcdb405e8 | |||
a20c6e3216 | |||
0f9e2b6da4 | |||
78d063f35a | |||
0d4c7f769e | |||
12a352f441 | |||
fcd7819f95 | |||
88d04dfbdb | |||
e0dc7a471e | |||
1847347c3a | |||
842e51194e | |||
da1c13368b | |||
dbc9bde97a | |||
2b2fa4471f | |||
4ab260042c | |||
ffa31d6641 | |||
e56d34c2b7 | |||
eb22f6732b | |||
998e425a15 | |||
7c4a7bff2e | |||
2c90ab69d6 | |||
97722177d5 | |||
cf2b28fffd | |||
2c7a60eb0e | |||
64d02c6636 | |||
d05ee962f9 | |||
2cf1e1074b | |||
1f1c2d8ca6 | |||
cdacc3f4fb | |||
5ef76e8f14 | |||
df69dc0edb | |||
baa97febef | |||
41565326e3 | |||
94d615fbb7 | |||
8f62278703 | |||
82cd6ff91d | |||
eb9da2967e | |||
87291e30a4 | |||
b5d01337d9 | |||
3554894577 | |||
437472d0a6 | |||
0e47d5b0aa | |||
8e6f676719 | |||
170d776a2b | |||
2907b84eb2 | |||
d9075add1a | |||
58d6e7e2bb | |||
a1e6e13a9f | |||
5de8fe3a48 | |||
3020dfbeeb | |||
c9d6a3f044 | |||
e9e7a73a63 | |||
4d3c0e1c57 | |||
969b4f991e | |||
6bf65eb515 | |||
2ffa8e6516 | |||
54ac93a4fc | |||
39765e6018 | |||
f826ce70ce | |||
c5076bec18 | |||
07dd548a10 | |||
9561910e83 | |||
3865733e18 | |||
6a205b2e10 | |||
eae1383f48 | |||
b402a760a8 | |||
a183723254 | |||
96a36568e2 | |||
f569ccbbc2 | |||
3c169b534e | |||
e24078a4d2 | |||
8bba8663fb | |||
f44c9e7975 | |||
01c0c0a1ba | |||
fed17d031c | |||
2bdf2b02e3 | |||
a2adb1cd93 | |||
b99e7a9e92 | |||
f418687a71 | |||
e31533d0d3 | |||
deccea0228 | |||
c65fff6f93 | |||
0c4ebce391 | |||
498d7f690a | |||
03e09627e4 | |||
4189e01987 | |||
80dc593159 | |||
606dd9f5e6 | |||
80a897f2f3 | |||
ff2af0a2e3 | |||
3c50d5b70f | |||
2f1336339f | |||
42199d9264 | |||
22bfd3b4d6 | |||
3456ae7809 | |||
158d21db14 | |||
039a4b8c72 | |||
913a4a5dc0 | |||
ceffd0ef6c | |||
71e82bc861 | |||
b1cf4cbbd5 | |||
db82bdfc44 | |||
5306bb3e31 | |||
a7e9457ef2 | |||
842a4bb904 | |||
2555596158 | |||
ebd175872d | |||
1a0b63659b | |||
f54a886a5e | |||
f03c5c7f89 | |||
9b310b0dd7 | |||
5f92473c6e | |||
dc2d96a502 | |||
142b399c84 | |||
a3651e464d | |||
bf9f09182e | |||
05b15f2824 | |||
54b89365bb | |||
b5bc1b0844 | |||
b72d727a06 | |||
19155a4bb2 | |||
e8fe0c52e7 | |||
b4b9f426db | |||
6040dfa5e8 | |||
c3df570324 | |||
52cc6ff3cb | |||
965314f213 | |||
40f734da58 | |||
854c8e6685 | |||
4978765b90 | |||
a9963dc54b | |||
7b3caca276 | |||
44a9683008 | |||
cafb23f8f0 | |||
f15878195c | |||
7b35c570f9 | |||
134f98e22e | |||
a1997d73c2 | |||
f1cbb41a60 | |||
d76a2b6ad6 | |||
37ff477b55 | |||
fa8a32e83c | |||
f83784cc63 | |||
b3f9cef94a | |||
a11c125f81 | |||
fc2cdd3992 | |||
8ad83e5d5c | |||
0ac1c5fbf2 | |||
c815bbab52 | |||
84201f0915 | |||
fad1763e28 | |||
ee71086133 | |||
22198ea495 | |||
bf39b5a948 | |||
f609386ca1 | |||
1235814b02 | |||
5868e5ac90 | |||
dd1482d791 | |||
5985563149 | |||
eecc456e0c | |||
b4ffb0bde0 | |||
8dda6144a9 | |||
bfe68702db | |||
a729f3255d | |||
7c4611af19 | |||
0b66b6e0d5 | |||
940619325d | |||
66a4c30eb7 | |||
eaf1485c6f | |||
92f1a4533b | |||
ce64148c8d | |||
5a21458ae9 | |||
4930737cc4 | |||
660912351c | |||
d3e167c77c | |||
693db1b750 | |||
cfbba97e0a | |||
5b2af862d4 | |||
867e23054d | |||
d47d78f2d4 | |||
de6eabde58 | |||
956f196f7c | |||
979e226d27 | |||
ae6d67ed1f | |||
83390d4b00 | |||
c9f17e1ef5 | |||
b36d4eb0dd | |||
47d9f91009 | |||
d2da2492b7 | |||
ba9f145ef7 | |||
058abc0336 | |||
ee1acba9eb | |||
7fc37832f7 | |||
429b2e0992 | |||
11944dda32 | |||
c54bfd423a | |||
95fe66e0b9 | |||
692566d93b | |||
d8fe8b1e8b | |||
196dda9487 | |||
5874de4743 | |||
69b13155f9 | |||
f4dbd69e0e | |||
d369f1e1e0 | |||
4a2f67aa9a | |||
a2eb0c7378 | |||
315ed3ed22 | |||
3a8bcb3fbf | |||
dfb5792773 | |||
fb2b2f5c58 | |||
7ac86e49d1 | |||
99d5441007 | |||
ae82737445 | |||
f3abef0979 | |||
c36da392f8 | |||
2773ac9909 | |||
66b9cace9f | |||
bbe05f523f | |||
54d3d03252 | |||
26e0469de7 | |||
abe02a646c | |||
3a2f5091d9 | |||
33a7260c35 | |||
6f68679375 | |||
abf52c0c11 | |||
ab9b60b9d2 | |||
27376a3dae | |||
d43122c6d8 | |||
810ea228f0 | |||
27e9f2b223 | |||
33ac39c335 | |||
497fc4e432 | |||
e198edf652 | |||
fdfa1f8630 | |||
20291ddc2b | |||
8c084fedad | |||
e96fd5166a | |||
4ff7c37f85 | |||
62a0d55fc8 | |||
54951b7be6 | |||
b1de40cb42 | |||
9bac8153ae | |||
66b0d5e847 | |||
a994b76ebc | |||
3a158d00eb | |||
018858934b | |||
b33b70f0ab | |||
9ffa053c90 | |||
f371095d3a | |||
b4661b35fd | |||
f8f0dfa91a | |||
bcc1350f1d | |||
e556dc3c31 | |||
d826fe0a3b | |||
7e06127d74 | |||
a192e099ab | |||
d6fe212a49 | |||
9383d7849b | |||
49ed627aed | |||
1585f711ee | |||
8e1af9277a | |||
f71a5b20e5 | |||
f862d73f49 | |||
34c3f189fc | |||
1f9fc13d03 | |||
ebf3b7e62d | |||
85ed0742cf | |||
8f92d1cc8e | |||
da66730e4f | |||
1cf66ba0cc | |||
3e868416c7 | |||
88aceeb27f | |||
e5ae5c7e67 | |||
5a800e2d09 | |||
b5d3651f3f | |||
a67a364b91 | |||
aeb4645ba6 |
|
@ -0,0 +1,258 @@
|
|||
name: my-friendica
|
||||
type: php
|
||||
docroot: ""
|
||||
php_version: "7.3"
|
||||
webserver_type: apache-fpm
|
||||
router_http_port: "80"
|
||||
router_https_port: "443"
|
||||
xdebug_enabled: false
|
||||
additional_hostnames: []
|
||||
additional_fqdns: []
|
||||
database:
|
||||
type: mariadb
|
||||
version: "10.4"
|
||||
nfs_mount_enabled: false
|
||||
mutagen_enabled: false
|
||||
use_dns_when_possible: true
|
||||
composer_version: "1"
|
||||
web_environment: []
|
||||
nodejs_version: "16"
|
||||
webimage_extra_packages: [php7.3-gmp]
|
||||
|
||||
# Key features of ddev's config.yaml:
|
||||
|
||||
# name: <projectname> # Name of the project, automatically provides
|
||||
# http://projectname.ddev.site and https://projectname.ddev.site
|
||||
|
||||
# type: <projecttype> # drupal6/7/8, backdrop, typo3, wordpress, php
|
||||
|
||||
# docroot: <relative_path> # Relative path to the directory containing index.php.
|
||||
|
||||
# php_version: "7.4" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"
|
||||
|
||||
# You can explicitly specify the webimage but this
|
||||
# is not recommended, as the images are often closely tied to ddev's' behavior,
|
||||
# so this can break upgrades.
|
||||
|
||||
# webimage: <docker_image> # nginx/php docker image.
|
||||
|
||||
# database:
|
||||
# type: <dbtype> # mysql, mariadb
|
||||
# version: <version> # database version, like "10.3" or "8.0"
|
||||
# Note that mariadb_version or mysql_version from v1.18 and earlier
|
||||
# will automatically be converted to this notation with just a "ddev config --auto"
|
||||
|
||||
# router_http_port: <port> # Port to be used for http (defaults to port 80)
|
||||
# router_https_port: <port> # Port for https (defaults to 443)
|
||||
|
||||
# xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart"
|
||||
# Note that for most people the commands
|
||||
# "ddev xdebug" to enable xdebug and "ddev xdebug off" to disable it work better,
|
||||
# as leaving xdebug enabled all the time is a big performance hit.
|
||||
|
||||
# xhprof_enabled: false # Set to true to enable xhprof and "ddev start" or "ddev restart"
|
||||
# Note that for most people the commands
|
||||
# "ddev xhprof" to enable xhprof and "ddev xhprof off" to disable it work better,
|
||||
# as leaving xhprof enabled all the time is a big performance hit.
|
||||
|
||||
# webserver_type: nginx-fpm # or apache-fpm
|
||||
|
||||
# timezone: Europe/Berlin
|
||||
# This is the timezone used in the containers and by PHP;
|
||||
# it can be set to any valid timezone,
|
||||
# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
# For example Europe/Dublin or MST7MDT
|
||||
|
||||
# composer_root: <relative_path>
|
||||
# Relative path to the composer root directory from the project root. This is
|
||||
# the directory which contains the composer.json and where all Composer related
|
||||
# commands are executed.
|
||||
|
||||
# composer_version: "2"
|
||||
# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1
|
||||
# to use the latest major version available at the time your container is built.
|
||||
# It is also possible to use each other Composer version channel. This includes:
|
||||
# - 2.2 (latest Composer LTS version)
|
||||
# - stable
|
||||
# - preview
|
||||
# - snapshot
|
||||
# Alternatively, an explicit Composer version may be specified, for example "2.2.18".
|
||||
# To reinstall Composer after the image was built, run "ddev debug refresh".
|
||||
|
||||
# nodejs_version: "16"
|
||||
# change from the default system Node.js version to another supported version, like 12, 14, 17, 18.
|
||||
# Note that you can use 'ddev nvm' or nvm inside the web container to provide nearly any
|
||||
# Node.js version, including v6, etc.
|
||||
|
||||
# additional_hostnames:
|
||||
# - somename
|
||||
# - someothername
|
||||
# would provide http and https URLs for "somename.ddev.site"
|
||||
# and "someothername.ddev.site".
|
||||
|
||||
# additional_fqdns:
|
||||
# - example.com
|
||||
# - sub1.example.com
|
||||
# would provide http and https URLs for "example.com" and "sub1.example.com"
|
||||
# Please take care with this because it can cause great confusion.
|
||||
|
||||
# upload_dir: custom/upload/dir
|
||||
# would set the destination path for ddev import-files to <docroot>/custom/upload/dir
|
||||
# When mutagen is enabled this path is bind-mounted so that all the files
|
||||
# in the upload_dir don't have to be synced into mutagen
|
||||
|
||||
# working_dir:
|
||||
# web: /var/www/html
|
||||
# db: /home
|
||||
# would set the default working directory for the web and db services.
|
||||
# These values specify the destination directory for ddev ssh and the
|
||||
# directory in which commands passed into ddev exec are run.
|
||||
|
||||
# omit_containers: [db, dba, ddev-ssh-agent]
|
||||
# Currently only these containers are supported. Some containers can also be
|
||||
# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit
|
||||
# the "db" container, several standard features of ddev that access the
|
||||
# database container will be unusable. In the global configuration it is also
|
||||
# possible to omit ddev-router, but not here.
|
||||
|
||||
# nfs_mount_enabled: false
|
||||
# Great performance improvement but requires host configuration first.
|
||||
# See https://ddev.readthedocs.io/en/latest/users/install/performance/#nfs
|
||||
|
||||
# mutagen_enabled: false
|
||||
# Performance improvement using mutagen asynchronous updates.
|
||||
# See https://ddev.readthedocs.io/en/latest/users/install/performance/#mutagen
|
||||
|
||||
# fail_on_hook_fail: False
|
||||
# Decide whether 'ddev start' should be interrupted by a failing hook
|
||||
|
||||
# host_https_port: "59002"
|
||||
# The host port binding for https can be explicitly specified. It is
|
||||
# dynamic unless otherwise specified.
|
||||
# This is not used by most people, most people use the *router* instead
|
||||
# of the localhost port.
|
||||
|
||||
# host_webserver_port: "59001"
|
||||
# The host port binding for the ddev-webserver can be explicitly specified. It is
|
||||
# dynamic unless otherwise specified.
|
||||
# This is not used by most people, most people use the *router* instead
|
||||
# of the localhost port.
|
||||
|
||||
# host_db_port: "59002"
|
||||
# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic
|
||||
# unless explicitly specified.
|
||||
|
||||
# phpmyadmin_port: "8036"
|
||||
# phpmyadmin_https_port: "8037"
|
||||
# The PHPMyAdmin ports can be changed from the default 8036 and 8037
|
||||
|
||||
# host_phpmyadmin_port: "8036"
|
||||
# The phpmyadmin (dba) port is not normally bound on the host at all, instead being routed
|
||||
# through ddev-router, but it can be specified and bound.
|
||||
|
||||
# mailhog_port: "8025"
|
||||
# mailhog_https_port: "8026"
|
||||
# The MailHog ports can be changed from the default 8025 and 8026
|
||||
|
||||
# host_mailhog_port: "8025"
|
||||
# The mailhog port is not normally bound on the host at all, instead being routed
|
||||
# through ddev-router, but it can be bound directly to localhost if specified here.
|
||||
|
||||
# webimage_extra_packages: [php7.4-tidy, php-bcmath]
|
||||
# Extra Debian packages that are needed in the webimage can be added here
|
||||
|
||||
# dbimage_extra_packages: [telnet,netcat]
|
||||
# Extra Debian packages that are needed in the dbimage can be added here
|
||||
|
||||
# use_dns_when_possible: true
|
||||
# If the host has internet access and the domain configured can
|
||||
# successfully be looked up, DNS will be used for hostname resolution
|
||||
# instead of editing /etc/hosts
|
||||
# Defaults to true
|
||||
|
||||
# project_tld: ddev.site
|
||||
# The top-level domain used for project URLs
|
||||
# The default "ddev.site" allows DNS lookup via a wildcard
|
||||
# If you prefer you can change this to "ddev.local" to preserve
|
||||
# pre-v1.9 behavior.
|
||||
|
||||
# ngrok_args: --basic-auth username:pass1234
|
||||
# Provide extra flags to the "ngrok http" command, see
|
||||
# https://ngrok.com/docs#http or run "ngrok http -h"
|
||||
|
||||
# disable_settings_management: false
|
||||
# If true, ddev will not create CMS-specific settings files like
|
||||
# Drupal's settings.php/settings.ddev.php or TYPO3's AdditionalConfiguration.php
|
||||
# In this case the user must provide all such settings.
|
||||
|
||||
# You can inject environment variables into the web container with:
|
||||
# web_environment:
|
||||
# - SOMEENV=somevalue
|
||||
# - SOMEOTHERENV=someothervalue
|
||||
|
||||
# no_project_mount: false
|
||||
# (Experimental) If true, ddev will not mount the project into the web container;
|
||||
# the user is responsible for mounting it manually or via a script.
|
||||
# This is to enable experimentation with alternate file mounting strategies.
|
||||
# For advanced users only!
|
||||
|
||||
# bind_all_interfaces: false
|
||||
# If true, host ports will be bound on all network interfaces,
|
||||
# not just the localhost interface. This means that ports
|
||||
# will be available on the local network if the host firewall
|
||||
# allows it.
|
||||
|
||||
# default_container_timeout: 120
|
||||
# The default time that ddev waits for all containers to become ready can be increased from
|
||||
# the default 120. This helps in importing huge databases, for example.
|
||||
|
||||
#web_extra_exposed_ports:
|
||||
#- name: nodejs
|
||||
# container_port: 3000
|
||||
# http_port: 2999
|
||||
# https_port: 3000
|
||||
#- name: something
|
||||
# container_port: 4000
|
||||
# https_port: 4000
|
||||
# http_port: 3999
|
||||
# Allows a set of extra ports to be exposed via ddev-router
|
||||
# The port behavior on the ddev-webserver must be arranged separately, for example
|
||||
# using web_extra_daemons.
|
||||
# For example, with a web app on port 3000 inside the container, this config would
|
||||
# expose that web app on https://<project>.ddev.site:9999 and http://<project>.ddev.site:9998
|
||||
# web_extra_exposed_ports:
|
||||
# - container_port: 3000
|
||||
# http_port: 9998
|
||||
# https_port: 9999
|
||||
|
||||
#web_extra_daemons:
|
||||
#- name: "http-1"
|
||||
# command: "/var/www/html/node_modules/.bin/http-server -p 3000"
|
||||
# directory: /var/www/html
|
||||
#- name: "http-2"
|
||||
# command: "/var/www/html/node_modules/.bin/http-server /var/www/html/sub -p 3000"
|
||||
# directory: /var/www/html
|
||||
|
||||
# override_config: false
|
||||
# By default, config.*.yaml files are *merged* into the configuration
|
||||
# But this means that some things can't be overridden
|
||||
# For example, if you have 'nfs_mount_enabled: true'' you can't override it with a merge
|
||||
# and you can't erase existing hooks or all environment variables.
|
||||
# However, with "override_config: true" in a particular config.*.yaml file,
|
||||
# 'nfs_mount_enabled: false' can override the existing values, and
|
||||
# hooks:
|
||||
# post-start: []
|
||||
# or
|
||||
# web_environment: []
|
||||
# or
|
||||
# additional_hostnames: []
|
||||
# can have their intended affect. 'override_config' affects only behavior of the
|
||||
# config.*.yaml file it exists in.
|
||||
|
||||
# Many ddev commands can be extended to run tasks before or after the
|
||||
# ddev command is executed, for example "post-start", "post-import-db",
|
||||
# "pre-composer", "post-composer"
|
||||
# See https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/ for more
|
||||
# information on the commands that can be extended and the tasks you can define
|
||||
# for them. Example:
|
||||
#hooks:
|
|
@ -10,10 +10,9 @@ home.html
|
|||
robots.txt
|
||||
|
||||
#ignore local config
|
||||
/config/local.config.php
|
||||
/config/addon.config.php
|
||||
/config/local.ini.php
|
||||
/config/addon.ini.php
|
||||
!/config/local-sample.config.php
|
||||
/config/*.config.php
|
||||
/config/*.ini.php
|
||||
|
||||
#ignore documentation, it should be newly built
|
||||
/doc/api
|
||||
|
|
|
@ -51,6 +51,6 @@ AddType audio/ogg .oga
|
|||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
|
||||
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA,B]
|
||||
|
||||
</IfModule>
|
||||
|
|
|
@ -39,7 +39,7 @@ pipeline:
|
|||
branch: [ develop, '*-rc' ]
|
||||
event: push
|
||||
composer_install:
|
||||
image: friendicaci/php7.4:php7.4.18
|
||||
image: friendicaci/php7.4:php7.4.33
|
||||
commands:
|
||||
- export COMPOSER_HOME=.composer
|
||||
- composer validate
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
matrix:
|
||||
include:
|
||||
- PHP_MAJOR_VERSION: 7.4
|
||||
PHP_VERSION: 7.4.18
|
||||
PHP_VERSION: 7.4.33
|
||||
|
||||
branches:
|
||||
exclude: [ stable ]
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
matrix:
|
||||
include:
|
||||
- PHP_MAJOR_VERSION: 7.3
|
||||
PHP_VERSION: 7.3.28
|
||||
PHP_VERSION: 7.3.33
|
||||
- PHP_MAJOR_VERSION: 7.4
|
||||
PHP_VERSION: 7.4.18
|
||||
PHP_VERSION: 7.4.33
|
||||
- PHP_MAJOR_VERSION: 8.0
|
||||
PHP_VERSION: 8.0.5
|
||||
PHP_VERSION: 8.0.25
|
||||
- PHP_MAJOR_VERSION: 8.1
|
||||
PHP_VERSION: 8.1.12
|
||||
|
||||
# This forces PHP Unit executions at the "opensocial" labeled location (because of much more power...)
|
||||
labels:
|
||||
location: opensocial
|
||||
|
||||
pipeline:
|
||||
php-lint:
|
||||
|
|
|
@ -37,7 +37,7 @@ pipeline:
|
|||
branch: stable
|
||||
event: tag
|
||||
composer_install:
|
||||
image: friendicaci/php7.4:php7.4.18
|
||||
image: friendicaci/php7.4:php7.4.33
|
||||
commands:
|
||||
- export COMPOSER_HOME=.composer
|
||||
- composer validate
|
||||
|
|
67
CHANGELOG
67
CHANGELOG
|
@ -1,3 +1,70 @@
|
|||
Version 2022.12 (2022-12-20)
|
||||
Friendica Core
|
||||
Updates to the translations DE, FR, HU, PL, RU
|
||||
Updated to the documentation [foss-, MarekBenjamin, MrPetovan, tobiasd]
|
||||
Updates to the themes (frio, vier) [loma-one, MarekBenjamin, MrPetovan, tobiasd]
|
||||
Improved the display of the system settings in the admin panel [MarekBenjamin]
|
||||
Improved the API [annando, HankG, Schnoop]
|
||||
Improved getting system information [VVelox]
|
||||
Improved the PHP 8.1 compatibility [MrPetovan]
|
||||
Improved the bulk delivery of postings [annando]
|
||||
Improved the display of attached images to postings [MarekBenjamin]
|
||||
General code cleanup [annando, MrPetovan, nupplaphil, Quix0r]
|
||||
Added a blur hash for images else not displayable [annando]
|
||||
Added a /about route for the /friendica page [nupplaphil]
|
||||
Added reporting endpoints to the API [annando]
|
||||
Added support for the "fedifinder" [annando]
|
||||
Added rel-me verification for the profile homepage [tobiasd]
|
||||
Added admin notification for new registrations [annando]
|
||||
Added a moderation section to the admin panel [annando]
|
||||
Added an option to make the calendar public [matthiasmoritz]
|
||||
Fixed a bug in the federation with Diaspora* [annando]
|
||||
Fixec a problem in the federation with GoTo Social and Owncast [annando]
|
||||
Deprecated old themes (duepuntozero, quattro, smoothy)
|
||||
|
||||
NOTE: The Apache2 rewrite rule in the .htaccess-dist has been changed.
|
||||
The change has to be applied manually to the existing .htaccess.
|
||||
|
||||
Friendica Addons
|
||||
Updates to the translations DE, FR, HU, SV
|
||||
fancybox:
|
||||
Added an addon to display images in postings with a fancybox [brockhaus]
|
||||
impressum:
|
||||
Fixed a bug when saving informations [tobiasd]
|
||||
js_upload:
|
||||
Improved wording [MarekBenjamin]
|
||||
monolog:
|
||||
Moved the functionality into an addon [nupplaphil]
|
||||
nitter:
|
||||
Updated the wording [AndyHee]
|
||||
nsfw:
|
||||
Enhanced regex handling [MrPetovan]
|
||||
pumpio:
|
||||
Fixed logger message [MrPetovan]
|
||||
rendertime:
|
||||
Fixed empty minimal time [nupplaphil]
|
||||
Adapt ignored_modules [nupplaphil]
|
||||
twitter:
|
||||
Fixed a problem when the image array was missing [MrPetovan]
|
||||
Added an option to automatically follow contacts in the Fediverse [annando]
|
||||
|
||||
Deprecated unmaintained addons: namethingy, superblock, windowsphonepush
|
||||
|
||||
BREAKING: The functions from the boot.php file have been moved into better
|
||||
fitting classes this may break your custom addons. See the pull
|
||||
requests #1293 and #1294 in the addon repository about the needed
|
||||
changes to your addons.
|
||||
|
||||
Closed Issues
|
||||
5095, 7574, 9286, 9920, 10100, 10188, 10518, 10875, 11011, 11284,
|
||||
11553, 11774, 11804, 11875, 11911, 11941, 11998, 12009, 12013, 12023,
|
||||
12035, 12054, 12059, 12073, 12084, 12085, 12090, 12096, 12112, 12149,
|
||||
12163, 12182, 12191, 12192, 12193, 12197, 12199, 12201, 12219, 12220,
|
||||
12229, 12237, 12245, 12262, 12266, 12273, 12275, 12285, 12312, 12327,
|
||||
12338, 12339, 12342, 12344, 12345, 12355, 12373, 12376, 12382, 12386,
|
||||
12399, 12401, 12405, 12406, 12408, 12411, 12413, 12421, 12431, 12437,
|
||||
12441, 12448, 12450, 12456, 12466, 12468, 12476
|
||||
|
||||
Version 2022.10 (2022-10-14)
|
||||
Friendica Core
|
||||
Added GD translation, updates to the translations AR, DE, FR, HU, PL, SV, ZH CN
|
||||
|
|
13
CREDITS.txt
13
CREDITS.txt
|
@ -38,6 +38,7 @@ aweiher
|
|||
axelt
|
||||
balderino
|
||||
Balázs Úr
|
||||
Bartosz Małkowski
|
||||
Beanow
|
||||
beardyunixer
|
||||
Beatriz Vital
|
||||
|
@ -108,7 +109,7 @@ Filip Bugaj
|
|||
Filip H.F. "FiXato" Slagter
|
||||
Finn Dean
|
||||
FlxAlbroscheit
|
||||
foss
|
||||
foss-
|
||||
Francesco Apruzzese
|
||||
Frank Dieckmann
|
||||
Frederico Gonçalves Guimarães
|
||||
|
@ -119,7 +120,9 @@ Gidi Kroon
|
|||
GLComo
|
||||
greeneyedred
|
||||
Gregory Smith
|
||||
Grischa Brockhaus
|
||||
gudzpoz
|
||||
GunChleoc
|
||||
guzzisti
|
||||
Haakon Meland Eriksen
|
||||
Hank Grabowski
|
||||
|
@ -164,6 +167,7 @@ Koyu Berteon
|
|||
kPherox
|
||||
Kris
|
||||
Kristoffer Grundström
|
||||
KulikAlex
|
||||
Lea1995polish
|
||||
Leberwurscht
|
||||
Leonard Lausen
|
||||
|
@ -175,10 +179,12 @@ Ludovic Grossard
|
|||
Lynn Stephenson
|
||||
maase2
|
||||
Mai Anh Nguyen
|
||||
Makary
|
||||
Manuel Pérez Monís
|
||||
Marcin Klessa
|
||||
Marcin Mikołajczak
|
||||
Marcus Müller
|
||||
Marek Bachmann
|
||||
Marie Olive
|
||||
Mariusz Pisz
|
||||
marmor
|
||||
|
@ -216,6 +222,7 @@ pankraz
|
|||
Paolo Wave
|
||||
Pascal
|
||||
Pascal Deklerck
|
||||
Paul Saunders
|
||||
Pavel Morozov
|
||||
PerigGouanvic
|
||||
peter
|
||||
|
@ -251,11 +258,13 @@ RJ Madsen
|
|||
Roger Meyer
|
||||
Roland Häder
|
||||
rwa
|
||||
Ryan Voots
|
||||
S.Krumbholz
|
||||
Sakałoŭ Alaksiej
|
||||
Sam
|
||||
Samuli Valavuo
|
||||
Sandro Santilli
|
||||
Schnoop
|
||||
Sebastian Egbers
|
||||
sella
|
||||
Senex Petrovic
|
||||
|
@ -287,6 +296,7 @@ teho
|
|||
Thecross
|
||||
Thomas
|
||||
Thomas Willingham
|
||||
Thorsten
|
||||
thorsten23
|
||||
Till Mohr
|
||||
Tim Stahel
|
||||
|
@ -318,7 +328,6 @@ very-ape
|
|||
Viktor Nilsson
|
||||
Vinzenz Vietzke
|
||||
vislav
|
||||
vladimir N
|
||||
Vladimir Núñez
|
||||
VVelox
|
||||
Vít Šesták 'v6ak'
|
||||
|
|
2
Doxyfile
2
Doxyfile
|
@ -1,4 +1,4 @@
|
|||
INPUT = README.md index.php boot.php update.php bin/ mod/ include/ view/ src/ VERSION
|
||||
INPUT = README.md index.php update.php bin/ mod/ view/ src/ VERSION
|
||||
RECURSIVE = YES
|
||||
PROJECT_NAME = "Friendica"
|
||||
PROJECT_LOGO = images/friendica-64.png
|
||||
|
|
|
@ -9,7 +9,7 @@ Our mission is to free friends, family and colleagues from data-harvesting corpo
|
|||
|
||||
Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on [Friendica]( https://friendi.ca), [Mastodon](https://joinmastodon.org/), [Diaspora](https://diasporafoundation.org/), [GnuSocial](https://gnu.io/social/), [Pleroma](https://pleroma.social/), or [Hubzilla](https://hubzilla.org/), regardless where each user profile is hosted.
|
||||
|
||||
With Friendica, you can also fully interact with anyone on Twitter, post on Facebook and receive any content on Tumblr, Wordpress or RSS. Friendica allows you to integrate most things on the web via a range of addons such as ITTT, Buffer; you will be able to easily control your own data as you decide.
|
||||
With Friendica, you can also fully interact with anyone on Twitter and receive any content from Tumblr, Wordpress or RSS. Friendica allows you to integrate most things on the web via a range of addons such as ITTT, Buffer; you will be able to easily control your own data as you decide.
|
||||
|
||||
Join today and [get your Friendica profile!](https://dir.friendica.social/servers 'Join Friendica today!')
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
server_ip = "192.168.22.10"
|
||||
server_ip = "192.168.56.10"
|
||||
server_memory = "2048" # MB
|
||||
server_timezone = "UTC"
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ if (php_sapi_name() !== 'cli') {
|
|||
}
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\DI;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
@ -33,6 +34,8 @@ require dirname(__DIR__) . '/vendor/autoload.php';
|
|||
$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
|
||||
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]);
|
||||
|
||||
/// @fixme Necessary until Hooks inside the Logger can get loaded without the DI-class
|
||||
DI::init($dice);
|
||||
\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class));
|
||||
|
||||
(new Friendica\Core\Console($dice, $argv))->execute();
|
||||
|
|
|
@ -45,7 +45,7 @@ $longopts = ['foreground'];
|
|||
$options = getopt($shortopts, $longopts);
|
||||
|
||||
// Ensure that daemon.php is executed from the base path of the installation
|
||||
if (!file_exists('boot.php') && (sizeof($_SERVER['argv']) != 0)) {
|
||||
if (!file_exists('index.php') && (sizeof($_SERVER['argv']) != 0)) {
|
||||
$directory = dirname($_SERVER['argv'][0]);
|
||||
|
||||
if (substr($directory, 0, 1) != '/') {
|
||||
|
|
|
@ -45,13 +45,13 @@ apt-get install -qq apache2
|
|||
a2enmod rewrite actions ssl
|
||||
cp /vagrant/bin/dev/vagrant_vhost.sh /usr/local/bin/vhost
|
||||
chmod guo+x /usr/local/bin/vhost
|
||||
vhost -s 192.168.22.10.xip.io -d /var/www -p /etc/ssl/xip.io -c xip.io -a friendica.local
|
||||
vhost -s 192.168.56.10.xip.io -d /var/www -p /etc/ssl/xip.io -c xip.io -a friendica.local
|
||||
a2dissite 000-default
|
||||
service apache2 restart
|
||||
|
||||
#Install php
|
||||
echo ">>> Installing PHP7"
|
||||
apt-get install -qq php libapache2-mod-php php-cli php-mysql php-curl php-gd php-mbstring php-xml imagemagick php-imagick php-zip
|
||||
apt-get install -qq php libapache2-mod-php php-cli php-mysql php-curl php-gd php-mbstring php-xml imagemagick php-imagick php-zip php-gmp
|
||||
systemctl restart apache2
|
||||
|
||||
echo ">>> Installing PHP8"
|
||||
|
@ -59,7 +59,7 @@ apt-get install -qq -y lsb-release ca-certificates apt-transport-https software-
|
|||
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
|
||||
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
|
||||
apt update
|
||||
apt-get install -qq php8.0 php8.0-cli php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-imagick php8.0-zip
|
||||
apt-get install -qq php8.0 php8.0-cli php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-imagick php8.0-zip php8.0-gmp
|
||||
systemctl restart apache2
|
||||
|
||||
#Install mysql
|
||||
|
|
|
@ -40,7 +40,7 @@ $longopts = ['spawn', 'no_cron'];
|
|||
$options = getopt($shortopts, $longopts);
|
||||
|
||||
// Ensure that worker.php is executed from the base path of the installation
|
||||
if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
||||
if (!file_exists("index.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
||||
$directory = dirname($_SERVER["argv"][0]);
|
||||
|
||||
if (substr($directory, 0, 1) != '/') {
|
||||
|
|
194
boot.php
194
boot.php
|
@ -1,194 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Friendica is a communications platform for integrated social communications
|
||||
* utilising decentralised communications and linkage to several indie social
|
||||
* projects - as well as popular mainstream providers.
|
||||
*
|
||||
* Our mission is to free our friends and families from the clutches of
|
||||
* data-harvesting corporations, and pave the way to a future where social
|
||||
* communications are free and open and flow between alternate providers as
|
||||
* easily as email does today.
|
||||
*/
|
||||
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
define('FRIENDICA_PLATFORM', 'Friendica');
|
||||
define('FRIENDICA_CODENAME', 'Giant Rhubarb');
|
||||
define('FRIENDICA_VERSION', '2022.10');
|
||||
define('DFRN_PROTOCOL_VERSION', '2.23');
|
||||
define('NEW_TABLE_STRUCTURE_VERSION', 1288);
|
||||
|
||||
/**
|
||||
* Constant with a HTML line break.
|
||||
*
|
||||
* Contains a HTML line break (br) element and a real carriage return with line
|
||||
* feed for the source.
|
||||
* This can be used in HTML and JavaScript where needed a line break.
|
||||
*/
|
||||
define('EOL', "<br />\r\n");
|
||||
|
||||
/**
|
||||
* @name CP
|
||||
*
|
||||
* Type of the community page
|
||||
* @{
|
||||
*/
|
||||
define('CP_NO_INTERNAL_COMMUNITY', -2);
|
||||
define('CP_NO_COMMUNITY_PAGE', -1);
|
||||
define('CP_USERS_ON_SERVER', 0);
|
||||
define('CP_GLOBAL_COMMUNITY', 1);
|
||||
define('CP_USERS_AND_GLOBAL', 2);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Gravity
|
||||
*
|
||||
* Item weight for query ordering
|
||||
* @{
|
||||
*/
|
||||
define('GRAVITY_PARENT', 0);
|
||||
define('GRAVITY_ACTIVITY', 3);
|
||||
define('GRAVITY_COMMENT', 6);
|
||||
define('GRAVITY_UNKNOWN', 9);
|
||||
/* @}*/
|
||||
|
||||
/**
|
||||
* @name Priority
|
||||
*
|
||||
* Process priority for the worker
|
||||
* @{
|
||||
*/
|
||||
define('PRIORITY_UNDEFINED', 0);
|
||||
define('PRIORITY_CRITICAL', 10);
|
||||
define('PRIORITY_HIGH', 20);
|
||||
define('PRIORITY_MEDIUM', 30);
|
||||
define('PRIORITY_LOW', 40);
|
||||
define('PRIORITY_NEGLIGIBLE', 50);
|
||||
define('PRIORITIES', [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE]);
|
||||
/* @}*/
|
||||
|
||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||
if (!defined('SIGTERM')) {
|
||||
define('SIGTERM', 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Depending on the PHP version this constant does exist - or not.
|
||||
* See here: http://php.net/manual/en/curl.constants.php#117928
|
||||
*/
|
||||
if (!defined('CURLE_OPERATION_TIMEDOUT')) {
|
||||
define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED);
|
||||
}
|
||||
|
||||
if (!function_exists('exif_imagetype')) {
|
||||
function exif_imagetype($file)
|
||||
{
|
||||
$size = getimagesize($file);
|
||||
return $size[2];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user id of locally logged in user or false.
|
||||
*
|
||||
* @return int|bool user id or false
|
||||
*/
|
||||
function local_user()
|
||||
{
|
||||
if (!empty($_SESSION['authenticated']) && !empty($_SESSION['uid'])) {
|
||||
return intval($_SESSION['uid']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the public contact id of logged in user or false.
|
||||
*
|
||||
* @return int|bool public contact id or false
|
||||
*/
|
||||
function public_contact()
|
||||
{
|
||||
static $public_contact_id = false;
|
||||
|
||||
if (!$public_contact_id && !empty($_SESSION['authenticated'])) {
|
||||
if (!empty($_SESSION['my_address'])) {
|
||||
// Local user
|
||||
$public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0, false));
|
||||
} elseif (!empty($_SESSION['visitor_home'])) {
|
||||
// Remote user
|
||||
$public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0, false));
|
||||
}
|
||||
} elseif (empty($_SESSION['authenticated'])) {
|
||||
$public_contact_id = false;
|
||||
}
|
||||
|
||||
return $public_contact_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns public contact id of authenticated site visitor or false
|
||||
*
|
||||
* @return int|bool visitor_id or false
|
||||
*/
|
||||
function remote_user()
|
||||
{
|
||||
if (empty($_SESSION['authenticated'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['visitor_id'])) {
|
||||
return intval($_SESSION['visitor_id']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an error message to user.
|
||||
*
|
||||
* This function save text in session, to be shown to the user at next page load
|
||||
*
|
||||
* @param string $s - Text of notice
|
||||
*
|
||||
* @return void
|
||||
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
|
||||
*/
|
||||
function notice(string $s)
|
||||
{
|
||||
\Friendica\DI::sysmsg()->addNotice($s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an info message to user.
|
||||
*
|
||||
* This function save text in session, to be shown to the user at next page load
|
||||
*
|
||||
* @param string $s - Text of notice
|
||||
*
|
||||
* @return void
|
||||
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
|
||||
*/
|
||||
function info(string $s)
|
||||
{
|
||||
\Friendica\DI::sysmsg()->addInfo($s);
|
||||
}
|
|
@ -41,15 +41,15 @@
|
|||
"michelf/php-markdown": "^1.7",
|
||||
"minishlink/web-push": "^6.0",
|
||||
"mobiledetect/mobiledetectlib": "^2.8",
|
||||
"monolog/monolog": "^1.25",
|
||||
"nikic/fast-route": "^1.3",
|
||||
"paragonie/hidden-string": "^1.0",
|
||||
"patrickschur/language-detection": "^5.0.0",
|
||||
"pear/console_table": "^1.3",
|
||||
"phpseclib/phpseclib": "^2.0",
|
||||
"phpseclib/phpseclib": "^3.0",
|
||||
"pragmarx/google2fa": "^5.0",
|
||||
"pragmarx/recovery": "^0.2",
|
||||
"psr/container": "^1.0",
|
||||
"psr/log": "^1.1",
|
||||
"seld/cli-prompt": "^1.0",
|
||||
"smarty/smarty": "^4",
|
||||
"ua-parser/uap-php": "^3.9",
|
||||
|
@ -59,7 +59,6 @@
|
|||
"bower-asset/chart-js": "^2.8",
|
||||
"bower-asset/dompurify": "^1.0",
|
||||
"bower-asset/fork-awesome": "^1.1",
|
||||
"bower-asset/vue": "^2.6",
|
||||
"npm-asset/cropperjs": "1.2.2",
|
||||
"npm-asset/es-jquery-sortable": "^0.9.13",
|
||||
"npm-asset/fullcalendar": "^3.10",
|
||||
|
@ -71,7 +70,9 @@
|
|||
"npm-asset/moment": "^2.24",
|
||||
"npm-asset/perfect-scrollbar": "0.6.16",
|
||||
"npm-asset/textcomplete": "^0.18.2",
|
||||
"npm-asset/typeahead.js": "^0.11.1"
|
||||
"npm-asset/typeahead.js": "^0.11.1",
|
||||
"kornrunner/blurhash": "^1.2",
|
||||
"psr/clock": "^1.0"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
|
@ -83,10 +84,7 @@
|
|||
"psr-4": {
|
||||
"Friendica\\": "src/",
|
||||
"Friendica\\Addon\\": "addon/"
|
||||
},
|
||||
"files": [
|
||||
"boot.php"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f5922f03b367e68a5930df6ed80c5c2f",
|
||||
"content-hash": "5af9ac9003f4653f3aa1860dd5a4d821",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asika/simple-console",
|
||||
|
@ -241,22 +241,6 @@
|
|||
],
|
||||
"time": "2021-08-26T18:46:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/vue",
|
||||
"version": "v2.7.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vuejs/vue.git",
|
||||
"reference": "ee57d9fd1d51abe245c6c37e6f8f2d45977b929e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vuejs/vue/zipball/ee57d9fd1d51abe245c6c37e6f8f2d45977b929e",
|
||||
"reference": "ee57d9fd1d51abe245c6c37e6f8f2d45977b929e",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "bower-asset-library"
|
||||
},
|
||||
{
|
||||
"name": "brick/math",
|
||||
"version": "0.9.3",
|
||||
|
@ -1132,6 +1116,50 @@
|
|||
],
|
||||
"time": "2022-06-20T21:43:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "kornrunner/blurhash",
|
||||
"version": "v1.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/kornrunner/php-blurhash.git",
|
||||
"reference": "bc8a4596cb0a49874f0158696a382ab3933fefe4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/kornrunner/php-blurhash/zipball/bc8a4596cb0a49874f0158696a382ab3933fefe4",
|
||||
"reference": "bc8a4596cb0a49874f0158696a382ab3933fefe4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.3|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-gd": "*",
|
||||
"ocramius/package-versions": "^1.4|^2.0",
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpunit/phpunit": "^9",
|
||||
"vimeo/psalm": "^4.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"kornrunner\\Blurhash\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Boris Momčilović",
|
||||
"email": "boris.momcilovic@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Pure PHP implementation of Blurhash",
|
||||
"homepage": "https://github.com/kornrunner/php-blurhash",
|
||||
"time": "2022-07-13T19:38:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/html-to-markdown",
|
||||
"version": "4.10.0",
|
||||
|
@ -1543,88 +1571,6 @@
|
|||
],
|
||||
"time": "2022-02-17T19:24:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.27.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "904713c5929655dc9b97288b69cfeedad610c9a1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1",
|
||||
"reference": "904713c5929655dc9b97288b69cfeedad610c9a1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"graylog2/gelf-php": "~1.0",
|
||||
"php-amqplib/php-amqplib": "~2.4",
|
||||
"php-console/php-console": "^3.1.3",
|
||||
"phpstan/phpstan": "^0.12.59",
|
||||
"phpunit/phpunit": "~4.5",
|
||||
"ruflin/elastica": ">=0.90 <3.0",
|
||||
"sentry/sentry": "^0.13",
|
||||
"swiftmailer/swiftmailer": "^5.3|^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
||||
"sentry/sentry": "Allow sending log messages to a Sentry server"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "http://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"homepage": "http://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Seldaek",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-09T08:53:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/fast-route",
|
||||
"version": "v1.3.0",
|
||||
|
@ -3050,32 +2996,32 @@
|
|||
},
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
"version": "2.0.38",
|
||||
"version": "3.0.17",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpseclib/phpseclib.git",
|
||||
"reference": "b03536539f43a4f9aa33c4f0b2f3a1c752088fcd"
|
||||
"reference": "dbc2307d5c69aeb22db136c52e91130d7f2ca761"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b03536539f43a4f9aa33c4f0b2f3a1c752088fcd",
|
||||
"reference": "b03536539f43a4f9aa33c4f0b2f3a1c752088fcd",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/dbc2307d5c69aeb22db136c52e91130d7f2ca761",
|
||||
"reference": "dbc2307d5c69aeb22db136c52e91130d7f2ca761",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"paragonie/constant_time_encoding": "^1|^2",
|
||||
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
|
||||
"php": ">=5.6.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phing/phing": "~2.7",
|
||||
"phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4",
|
||||
"squizlabs/php_codesniffer": "~2.0"
|
||||
"phpunit/phpunit": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-dom": "Install the DOM extension to load XML formatted public keys.",
|
||||
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
|
||||
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
|
||||
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
|
||||
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations.",
|
||||
"ext-xml": "Install the XML extension to load XML formatted public keys."
|
||||
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
|
@ -3083,7 +3029,7 @@
|
|||
"phpseclib/bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"phpseclib\\": "phpseclib/"
|
||||
"phpseclib3\\": "phpseclib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
@ -3152,7 +3098,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-09-02T17:04:26+00:00"
|
||||
"time": "2022-10-24T10:51:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pragmarx/google2fa",
|
||||
|
@ -3383,6 +3329,50 @@
|
|||
],
|
||||
"time": "2016-08-06T20:24:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/clock",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/clock.git",
|
||||
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
|
||||
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.0 || ^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Clock\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "https://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for reading the clock.",
|
||||
"homepage": "https://github.com/php-fig/clock",
|
||||
"keywords": [
|
||||
"clock",
|
||||
"now",
|
||||
"psr",
|
||||
"psr-20",
|
||||
"time"
|
||||
],
|
||||
"time": "2022-11-25T14:36:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
"version": "1.1.1",
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Addon configuration
|
||||
|
||||
// Copy this configuration file to addon.config.php and edit it if you want to configure addons, see below example for the twitter addon
|
||||
|
||||
return [
|
||||
'twitter' => [
|
||||
'consumerkey' => '1234567890',
|
||||
'consumersecret' => 'ABCDEFGHIJKLMONPQRSTUVWXYZ',
|
||||
],
|
||||
];
|
250
database.sql
250
database.sql
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2022.09-rc (Giant Rhubarb)
|
||||
-- DB_UPDATE_VERSION 1484
|
||||
-- Friendica 2022.12 (Giant Rhubarb)
|
||||
-- DB_UPDATE_VERSION 1502
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -59,6 +59,7 @@ CREATE TABLE IF NOT EXISTS `user` (
|
|||
`language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
|
||||
`register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
|
||||
`login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
|
||||
`last-activity` date COMMENT 'Day of the last activity',
|
||||
`default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
|
||||
`allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
|
||||
`theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
|
||||
|
@ -80,7 +81,7 @@ CREATE TABLE IF NOT EXISTS `user` (
|
|||
`pwdreset` varchar(255) COMMENT 'Password reset request token',
|
||||
`pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
|
||||
`maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
|
||||
`expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
|
||||
`expire` int unsigned NOT NULL DEFAULT 0 COMMENT 'Delay in days before deleting user-related posts. Scope is controlled by pConfig.',
|
||||
`account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
|
||||
`account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
|
||||
`account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
|
||||
|
@ -128,6 +129,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
|||
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT 'XMPP address',
|
||||
`matrix` varchar(255) NOT NULL DEFAULT '' COMMENT 'Matrix address',
|
||||
`avatar` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`blurhash` varbinary(255) COMMENT 'BlurHash representation of the avatar',
|
||||
`header` varbinary(383) COMMENT 'Header picture',
|
||||
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`nurl` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
|
@ -309,6 +311,20 @@ CREATE TABLE IF NOT EXISTS `2fa_trusted_browser` (
|
|||
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication trusted browsers';
|
||||
|
||||
--
|
||||
-- TABLE account-suggestion
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `account-suggestion` (
|
||||
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the account url',
|
||||
`uid` mediumint unsigned NOT NULL COMMENT 'User ID',
|
||||
`level` smallint unsigned COMMENT 'level of closeness',
|
||||
`ignore` boolean NOT NULL DEFAULT '0' COMMENT 'If set, this account will not be suggested again',
|
||||
PRIMARY KEY(`uid`,`uri-id`),
|
||||
INDEX `uri-id_uid` (`uri-id`,`uid`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Account suggestion';
|
||||
|
||||
--
|
||||
-- TABLE account-user
|
||||
--
|
||||
|
@ -563,6 +579,40 @@ CREATE TABLE IF NOT EXISTS `delayed-post` (
|
|||
FOREIGN KEY (`wid`) REFERENCES `workerqueue` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Posts that are about to be distributed at a later time';
|
||||
|
||||
--
|
||||
-- TABLE diaspora-contact
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `diaspora-contact` (
|
||||
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the contact URL',
|
||||
`addr` varchar(255) COMMENT '',
|
||||
`alias` varchar(255) COMMENT '',
|
||||
`nick` varchar(255) COMMENT '',
|
||||
`name` varchar(255) COMMENT '',
|
||||
`given-name` varchar(255) COMMENT '',
|
||||
`family-name` varchar(255) COMMENT '',
|
||||
`photo` varchar(255) COMMENT '',
|
||||
`photo-medium` varchar(255) COMMENT '',
|
||||
`photo-small` varchar(255) COMMENT '',
|
||||
`batch` varchar(255) COMMENT '',
|
||||
`notify` varchar(255) COMMENT '',
|
||||
`poll` varchar(255) COMMENT '',
|
||||
`subscribe` varchar(255) COMMENT '',
|
||||
`searchable` boolean COMMENT '',
|
||||
`pubkey` text COMMENT '',
|
||||
`gsid` int unsigned COMMENT 'Global Server ID',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
|
||||
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
|
||||
`interacting_count` int unsigned DEFAULT 0 COMMENT 'Number of contacts this contact interactes with',
|
||||
`interacted_count` int unsigned DEFAULT 0 COMMENT 'Number of contacts that interacted with this contact',
|
||||
`post_count` int unsigned DEFAULT 0 COMMENT 'Number of posts and comments',
|
||||
PRIMARY KEY(`uri-id`),
|
||||
UNIQUE INDEX `addr` (`addr`),
|
||||
INDEX `alias` (`alias`),
|
||||
INDEX `gsid` (`gsid`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
|
||||
|
||||
--
|
||||
-- TABLE diaspora-interaction
|
||||
--
|
||||
|
@ -618,39 +668,6 @@ CREATE TABLE IF NOT EXISTS `event` (
|
|||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
|
||||
|
||||
--
|
||||
-- TABLE fcontact
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `fcontact` (
|
||||
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
|
||||
`guid` varbinary(255) NOT NULL DEFAULT '' COMMENT 'unique id',
|
||||
`url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the fcontact url',
|
||||
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`photo` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`request` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`batch` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`notify` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`poll` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`confirm` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
|
||||
`network` char(4) NOT NULL DEFAULT '' COMMENT '',
|
||||
`alias` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
`pubkey` text COMMENT '',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
|
||||
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
|
||||
`interacting_count` int unsigned DEFAULT 0 COMMENT 'Number of contacts this contact interactes with',
|
||||
`interacted_count` int unsigned DEFAULT 0 COMMENT 'Number of contacts that interacted with this contact',
|
||||
`post_count` int unsigned DEFAULT 0 COMMENT 'Number of posts and comments',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `addr` (`addr`(32)),
|
||||
UNIQUE INDEX `url` (`url`(190)),
|
||||
UNIQUE INDEX `uri-id` (`uri-id`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
|
||||
|
||||
--
|
||||
-- TABLE fetch-entry
|
||||
--
|
||||
|
@ -1073,6 +1090,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
|||
`height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
|
||||
`width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
|
||||
`datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
|
||||
`blurhash` varbinary(255) COMMENT 'BlurHash representation of the photo',
|
||||
`data` mediumblob NOT NULL COMMENT '',
|
||||
`scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
|
||||
`profile` boolean NOT NULL DEFAULT '0' COMMENT '',
|
||||
|
@ -1186,6 +1204,7 @@ CREATE TABLE IF NOT EXISTS `post-content` (
|
|||
`content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`body` mediumtext COMMENT 'item body content',
|
||||
`raw-body` mediumtext COMMENT 'Body without embedded media links',
|
||||
`quote-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the quoted uri',
|
||||
`location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
|
||||
`coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
|
||||
`language` text COMMENT 'Language information about this post',
|
||||
|
@ -1202,7 +1221,9 @@ CREATE TABLE IF NOT EXISTS `post-content` (
|
|||
INDEX `plink` (`plink`(191)),
|
||||
INDEX `resource-id` (`resource-id`),
|
||||
FULLTEXT INDEX `title-content-warning-body` (`title`,`content-warning`,`body`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
INDEX `quote-uri-id` (`quote-uri-id`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`quote-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
|
||||
|
||||
--
|
||||
|
@ -1277,6 +1298,9 @@ CREATE TABLE IF NOT EXISTS `post-link` (
|
|||
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
|
||||
`url` varbinary(511) NOT NULL COMMENT 'External URL',
|
||||
`mimetype` varchar(60) COMMENT '',
|
||||
`height` smallint unsigned COMMENT 'Height of the media',
|
||||
`width` smallint unsigned COMMENT 'Width of the media',
|
||||
`blurhash` varbinary(255) COMMENT 'BlurHash representation of the link',
|
||||
PRIMARY KEY(`id`),
|
||||
UNIQUE INDEX `uri-id-url` (`uri-id`,`url`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
|
@ -1289,11 +1313,13 @@ CREATE TABLE IF NOT EXISTS `post-media` (
|
|||
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
|
||||
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
|
||||
`url` varbinary(1024) NOT NULL COMMENT 'Media URL',
|
||||
`media-uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the activities uri-id',
|
||||
`type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Media type',
|
||||
`mimetype` varchar(60) COMMENT '',
|
||||
`height` smallint unsigned COMMENT 'Height of the media',
|
||||
`width` smallint unsigned COMMENT 'Width of the media',
|
||||
`size` bigint unsigned COMMENT 'Media size',
|
||||
`blurhash` varbinary(255) COMMENT 'BlurHash representation of the image',
|
||||
`preview` varbinary(512) COMMENT 'Preview URL',
|
||||
`preview-height` smallint unsigned COMMENT 'Height of the preview picture',
|
||||
`preview-width` smallint unsigned COMMENT 'Width of the preview picture',
|
||||
|
@ -1308,7 +1334,9 @@ CREATE TABLE IF NOT EXISTS `post-media` (
|
|||
PRIMARY KEY(`id`),
|
||||
UNIQUE INDEX `uri-id-url` (`uri-id`,`url`(512)),
|
||||
INDEX `uri-id-id` (`uri-id`,`id`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
INDEX `media-uri-id` (`media-uri-id`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`media-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Attached media';
|
||||
|
||||
--
|
||||
|
@ -1571,6 +1599,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
|
|||
`education` text COMMENT 'Deprecated',
|
||||
`contact` text COMMENT 'Deprecated',
|
||||
`homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`homepage_verified` boolean NOT NULL DEFAULT '0' COMMENT 'was the homepage verified by a rel-me link back to the profile',
|
||||
`xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT 'XMPP address',
|
||||
`matrix` varchar(255) NOT NULL DEFAULT '' COMMENT 'Matrix address',
|
||||
`photo` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||
|
@ -1639,6 +1668,37 @@ CREATE TABLE IF NOT EXISTS `register` (
|
|||
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
|
||||
|
||||
--
|
||||
-- TABLE report
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `report` (
|
||||
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
|
||||
`uid` mediumint unsigned COMMENT 'Reporting user',
|
||||
`cid` int unsigned NOT NULL COMMENT 'Reported contact',
|
||||
`comment` text COMMENT 'Report',
|
||||
`forward` boolean COMMENT 'Forward the report to the remote server',
|
||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
|
||||
`status` tinyint unsigned COMMENT 'Status of the report',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `uid` (`uid`),
|
||||
INDEX `cid` (`cid`),
|
||||
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
|
||||
|
||||
--
|
||||
-- TABLE report-post
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `report-post` (
|
||||
`rid` int unsigned NOT NULL COMMENT 'Report id',
|
||||
`uri-id` int unsigned NOT NULL COMMENT 'Uri-id of the reported post',
|
||||
`status` tinyint unsigned COMMENT 'Status of the reported post',
|
||||
PRIMARY KEY(`rid`,`uri-id`),
|
||||
INDEX `uri-id` (`uri-id`),
|
||||
FOREIGN KEY (`rid`) REFERENCES `report` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
|
||||
|
||||
--
|
||||
-- TABLE search
|
||||
--
|
||||
|
@ -1807,6 +1867,8 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
`post-user`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread-user`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post-user`.`wall` AS `wall`,
|
||||
`post-user`.`gravity` AS `gravity`,
|
||||
|
@ -1944,9 +2006,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
`parent-post-author`.`url` AS `parent-author-link`,
|
||||
`parent-post-author`.`name` AS `parent-author-name`,
|
||||
`parent-post-author`.`nick` AS `parent-author-nick`,
|
||||
`parent-post-author`.`network` AS `parent-author-network`,
|
||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
||||
`parent-post-author`.`network` AS `parent-author-network`
|
||||
FROM `post-user`
|
||||
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
|
||||
|
@ -1962,6 +2022,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
|
||||
|
@ -1985,6 +2046,8 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`post-user`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread-user`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post-thread-user`.`wall` AS `wall`,
|
||||
`post-user`.`gravity` AS `gravity`,
|
||||
|
@ -2120,9 +2183,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`parent-post`.`author-id` AS `parent-author-id`,
|
||||
`parent-post-author`.`url` AS `parent-author-link`,
|
||||
`parent-post-author`.`name` AS `parent-author-name`,
|
||||
`parent-post-author`.`network` AS `parent-author-network`,
|
||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
||||
`parent-post-author`.`network` AS `parent-author-network`
|
||||
FROM `post-thread-user`
|
||||
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
|
||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||
|
@ -2138,6 +2199,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
|
||||
|
@ -2157,6 +2219,8 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`post`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post`.`gravity` AS `gravity`,
|
||||
`external-item-uri`.`uri` AS `extid`,
|
||||
|
@ -2263,9 +2327,7 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`parent-post`.`author-id` AS `parent-author-id`,
|
||||
`parent-post-author`.`url` AS `parent-author-link`,
|
||||
`parent-post-author`.`name` AS `parent-author-name`,
|
||||
`parent-post-author`.`network` AS `parent-author-network`,
|
||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
||||
`parent-post-author`.`network` AS `parent-author-network`
|
||||
FROM `post`
|
||||
STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
|
||||
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
|
||||
|
@ -2279,6 +2341,7 @@ CREATE VIEW `post-view` AS SELECT
|
|||
LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
|
||||
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
|
||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
|
||||
|
@ -2296,6 +2359,8 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`post`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`conversation-item-uri`.`uri` AS `conversation`,
|
||||
`post-thread`.`conversation-id` AS `conversation-id`,
|
||||
`quote-item-uri`.`uri` AS `quote-uri`,
|
||||
`post-content`.`quote-uri-id` AS `quote-uri-id`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`post`.`gravity` AS `gravity`,
|
||||
`external-item-uri`.`uri` AS `extid`,
|
||||
|
@ -2396,15 +2461,15 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`post-question`.`end-time` AS `question-end-time`,
|
||||
0 AS `has-categories`,
|
||||
EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread`.`uri-id`) AS `has-media`,
|
||||
(SELECT COUNT(*) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6) AS `total-comments`,
|
||||
(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6) AS `total-actors`,
|
||||
`diaspora-interaction`.`interaction` AS `signed_text`,
|
||||
`parent-item-uri`.`guid` AS `parent-guid`,
|
||||
`parent-post`.`network` AS `parent-network`,
|
||||
`parent-post`.`author-id` AS `parent-author-id`,
|
||||
`parent-post-author`.`url` AS `parent-author-link`,
|
||||
`parent-post-author`.`name` AS `parent-author-name`,
|
||||
`parent-post-author`.`network` AS `parent-author-network`,
|
||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
||||
`parent-post-author`.`network` AS `parent-author-network`
|
||||
FROM `post-thread`
|
||||
INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
|
||||
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
|
||||
|
@ -2418,6 +2483,7 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
|
||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
|
||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`
|
||||
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
|
||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`;
|
||||
|
@ -2457,6 +2523,24 @@ CREATE VIEW `collection-view` AS SELECT
|
|||
INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`
|
||||
INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`;
|
||||
|
||||
--
|
||||
-- VIEW media-view
|
||||
--
|
||||
DROP VIEW IF EXISTS `media-view`;
|
||||
CREATE VIEW `media-view` AS SELECT
|
||||
`post-media`.`uri-id` AS `uri-id`,
|
||||
`post-media`.`type` AS `type`,
|
||||
`post`.`received` AS `received`,
|
||||
`post`.`created` AS `created`,
|
||||
`post`.`private` AS `private`,
|
||||
`post`.`visible` AS `visible`,
|
||||
`post`.`deleted` AS `deleted`,
|
||||
`post`.`thr-parent-id` AS `thr-parent-id`,
|
||||
`post`.`author-id` AS `author-id`,
|
||||
`post`.`gravity` AS `gravity`
|
||||
FROM `post-media`
|
||||
INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`;
|
||||
|
||||
--
|
||||
-- VIEW tag-view
|
||||
--
|
||||
|
@ -2616,6 +2700,7 @@ CREATE VIEW `owner-view` AS SELECT
|
|||
`user`.`language` AS `language`,
|
||||
`user`.`register_date` AS `register_date`,
|
||||
`user`.`login_date` AS `login_date`,
|
||||
`user`.`last-activity` AS `last-activity`,
|
||||
`user`.`default-location` AS `default-location`,
|
||||
`user`.`allow_location` AS `allow_location`,
|
||||
`user`.`theme` AS `theme`,
|
||||
|
@ -2656,6 +2741,7 @@ CREATE VIEW `owner-view` AS SELECT
|
|||
`profile`.`postal-code` AS `postal-code`,
|
||||
`profile`.`country-name` AS `country-name`,
|
||||
`profile`.`homepage` AS `homepage`,
|
||||
`profile`.`homepage_verified` AS `homepage_verified`,
|
||||
`profile`.`dob` AS `dob`
|
||||
FROM `user`
|
||||
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
|
||||
|
@ -2721,11 +2807,11 @@ CREATE VIEW `account-view` AS SELECT
|
|||
`contact`.`blocked` AS `blocked`,
|
||||
`contact`.`notify` AS `dfrn-notify`,
|
||||
`contact`.`poll` AS `dfrn-poll`,
|
||||
`fcontact`.`guid` AS `diaspora-guid`,
|
||||
`fcontact`.`batch` AS `diaspora-batch`,
|
||||
`fcontact`.`notify` AS `diaspora-notify`,
|
||||
`fcontact`.`poll` AS `diaspora-poll`,
|
||||
`fcontact`.`alias` AS `diaspora-alias`,
|
||||
`item-uri`.`guid` AS `diaspora-guid`,
|
||||
`diaspora-contact`.`batch` AS `diaspora-batch`,
|
||||
`diaspora-contact`.`notify` AS `diaspora-notify`,
|
||||
`diaspora-contact`.`poll` AS `diaspora-poll`,
|
||||
`diaspora-contact`.`alias` AS `diaspora-alias`,
|
||||
`apcontact`.`uuid` AS `ap-uuid`,
|
||||
`apcontact`.`type` AS `ap-type`,
|
||||
`apcontact`.`following` AS `ap-following`,
|
||||
|
@ -2743,7 +2829,7 @@ CREATE VIEW `account-view` AS SELECT
|
|||
FROM `contact`
|
||||
LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
|
||||
LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
|
||||
LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
|
||||
LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = contact.`uri-id`
|
||||
LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
|
||||
WHERE `contact`.`uid` = 0;
|
||||
|
||||
|
@ -2822,14 +2908,14 @@ CREATE VIEW `account-user-view` AS SELECT
|
|||
`ucontact`.`reason` AS `reason`,
|
||||
`contact`.`notify` AS `dfrn-notify`,
|
||||
`contact`.`poll` AS `dfrn-poll`,
|
||||
`fcontact`.`guid` AS `diaspora-guid`,
|
||||
`fcontact`.`batch` AS `diaspora-batch`,
|
||||
`fcontact`.`notify` AS `diaspora-notify`,
|
||||
`fcontact`.`poll` AS `diaspora-poll`,
|
||||
`fcontact`.`alias` AS `diaspora-alias`,
|
||||
`fcontact`.`interacting_count` AS `diaspora-interacting_count`,
|
||||
`fcontact`.`interacted_count` AS `diaspora-interacted_count`,
|
||||
`fcontact`.`post_count` AS `diaspora-post_count`,
|
||||
`item-uri`.`guid` AS `diaspora-guid`,
|
||||
`diaspora-contact`.`batch` AS `diaspora-batch`,
|
||||
`diaspora-contact`.`notify` AS `diaspora-notify`,
|
||||
`diaspora-contact`.`poll` AS `diaspora-poll`,
|
||||
`diaspora-contact`.`alias` AS `diaspora-alias`,
|
||||
`diaspora-contact`.`interacting_count` AS `diaspora-interacting_count`,
|
||||
`diaspora-contact`.`interacted_count` AS `diaspora-interacted_count`,
|
||||
`diaspora-contact`.`post_count` AS `diaspora-post_count`,
|
||||
`apcontact`.`uuid` AS `ap-uuid`,
|
||||
`apcontact`.`type` AS `ap-type`,
|
||||
`apcontact`.`following` AS `ap-following`,
|
||||
|
@ -2848,7 +2934,7 @@ CREATE VIEW `account-user-view` AS SELECT
|
|||
INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
|
||||
LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
|
||||
LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
|
||||
LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr'
|
||||
LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = `ucontact`.`uri-id`
|
||||
LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`;
|
||||
|
||||
--
|
||||
|
@ -2925,3 +3011,37 @@ CREATE VIEW `profile_field-view` AS SELECT
|
|||
`profile_field`.`edited` AS `edited`
|
||||
FROM `profile_field`
|
||||
INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`;
|
||||
|
||||
--
|
||||
-- VIEW diaspora-contact-view
|
||||
--
|
||||
DROP VIEW IF EXISTS `diaspora-contact-view`;
|
||||
CREATE VIEW `diaspora-contact-view` AS SELECT
|
||||
`diaspora-contact`.`uri-id` AS `uri-id`,
|
||||
`item-uri`.`uri` AS `url`,
|
||||
`item-uri`.`guid` AS `guid`,
|
||||
`diaspora-contact`.`addr` AS `addr`,
|
||||
`diaspora-contact`.`alias` AS `alias`,
|
||||
`diaspora-contact`.`nick` AS `nick`,
|
||||
`diaspora-contact`.`name` AS `name`,
|
||||
`diaspora-contact`.`given-name` AS `given-name`,
|
||||
`diaspora-contact`.`family-name` AS `family-name`,
|
||||
`diaspora-contact`.`photo` AS `photo`,
|
||||
`diaspora-contact`.`photo-medium` AS `photo-medium`,
|
||||
`diaspora-contact`.`photo-small` AS `photo-small`,
|
||||
`diaspora-contact`.`batch` AS `batch`,
|
||||
`diaspora-contact`.`notify` AS `notify`,
|
||||
`diaspora-contact`.`poll` AS `poll`,
|
||||
`diaspora-contact`.`subscribe` AS `subscribe`,
|
||||
`diaspora-contact`.`searchable` AS `searchable`,
|
||||
`diaspora-contact`.`pubkey` AS `pubkey`,
|
||||
`gserver`.`url` AS `baseurl`,
|
||||
`diaspora-contact`.`gsid` AS `gsid`,
|
||||
`diaspora-contact`.`created` AS `created`,
|
||||
`diaspora-contact`.`updated` AS `updated`,
|
||||
`diaspora-contact`.`interacting_count` AS `interacting_count`,
|
||||
`diaspora-contact`.`interacted_count` AS `interacted_count`,
|
||||
`diaspora-contact`.`post_count` AS `post_count`
|
||||
FROM `diaspora-contact`
|
||||
INNER JOIN `item-uri` ON `item-uri`.`id` = `diaspora-contact`.`uri-id`
|
||||
LEFT JOIN `gserver` ON `gserver`.`id` = `diaspora-contact`.`gsid`;
|
||||
|
|
|
@ -47,6 +47,7 @@ These endpoints use the [Mastodon API entities](https://docs.joinmastodon.org/en
|
|||
- [`POST /api/v1/accounts/:id/unmute`](https://docs.joinmastodon.org/methods/accounts/)
|
||||
- [`GET /api/v1/accounts/relationships`](https://docs.joinmastodon.org/methods/accounts/)
|
||||
- [`GET /api/v1/accounts/search`](https://docs.joinmastodon.org/methods/accounts)
|
||||
- [`PATCH /api/v1/accounts/update_credentials`](https://docs.joinmastodon.org/methods/accounts/#update_credentials)
|
||||
- [`GET /api/v1/accounts/verify_credentials`](https://docs.joinmastodon.org/methods/accounts)
|
||||
- [`POST /api/v1/apps`](https://docs.joinmastodon.org/methods/apps/)
|
||||
- [`GET /api/v1/apps/verify_credentials`](https://docs.joinmastodon.org/methods/apps/)
|
||||
|
@ -72,7 +73,7 @@ These endpoints use the [Mastodon API entities](https://docs.joinmastodon.org/en
|
|||
- `:id` is a follow request ID, not a regular account id
|
||||
- Returns a [Relationship](https://docs.joinmastodon.org/entities/relationship) object.
|
||||
|
||||
|
||||
- [`GET /api/v1/followed_tags'](https://docs.joinmastodon.org/methods/followed_tags/)
|
||||
- [`GET /api/v1/instance`](https://docs.joinmastodon.org/methods/instance#fetch-instance)
|
||||
- `GET /api/v1/instance/rules` Undocumented, returns Terms of Service
|
||||
- [`GET /api/v1/instance/peers`](https://docs.joinmastodon.org/methods/instance#list-of-connected-domains)
|
||||
|
@ -100,35 +101,44 @@ These endpoints use the [Mastodon API entities](https://docs.joinmastodon.org/en
|
|||
- [`GET /api/v1/push/subscription`](https://docs.joinmastodon.org/methods/notifications/push/)
|
||||
- [`PUSH /api/v1/push/subscription`](https://docs.joinmastodon.org/methods/notifications/push/)
|
||||
- [`PUT /api/v1/push/subscription`](https://docs.joinmastodon.org/methods/notifications/push/)
|
||||
- [`POST /api/v1/reports`](https://docs.joinmastodon.org/methods/accounts/reports/)
|
||||
- [`GET /api/v1/scheduled_statuses`](https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/)
|
||||
- [`DELETE /api/v1/scheduled_statuses/:id`](https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/)
|
||||
- [`GET /api/v1/scheduled_statuses/:id`](https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/)
|
||||
- [`GET /api/v1/search`](https://docs.joinmastodon.org/methods/search/)
|
||||
- [`POST /api/v1/statuses`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses`](https://docs.joinmastodon.org/methods/statuses/#create)
|
||||
- Additionally to the static values `public`, `unlisted` and `private`, the `visibility` parameter can contain a numeric value with a group id.
|
||||
- [`GET /api/v1/statuses/:id`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`DELETE /api/v1/statuses/:id`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`GET /api/v1/statuses/:id/card`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`GET /api/v1/statuses/:id/context`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`GET /api/v1/statuses/:id/reblogged_by`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`GET /api/v1/statuses/:id/favourited_by`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/favourite`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/unfavourite`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/reblog`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/unreblog`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/bookmark`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/unbookmark`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/mute`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/unmute`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/pin`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`POST /api/v1/statuses/:id/unpin`](https://docs.joinmastodon.org/methods/statuses/)
|
||||
- [`GET /api/v1/statuses/:id`](https://docs.joinmastodon.org/methods/statuses/#get)
|
||||
- [`DELETE /api/v1/statuses/:id`](https://docs.joinmastodon.org/methods/statuses/#delete)
|
||||
- [`GET /api/v1/statuses/:id/context`](https://docs.joinmastodon.org/methods/statuses/#context)
|
||||
- [`GET /api/v1/statuses/:id/reblogged_by`](https://docs.joinmastodon.org/methods/statuses/#reblogged_by)
|
||||
- [`GET /api/v1/statuses/:id/favourited_by`](https://docs.joinmastodon.org/methods/statuses/#favourited_by)
|
||||
- [`POST /api/v1/statuses/:id/favourite`](https://docs.joinmastodon.org/methods/statuses/#favourite)
|
||||
- [`POST /api/v1/statuses/:id/unfavourite`](https://docs.joinmastodon.org/methods/statuses/#unfavourite)
|
||||
- [`POST /api/v1/statuses/:id/reblog`](https://docs.joinmastodon.org/methods/statuses/#boost)
|
||||
- [`POST /api/v1/statuses/:id/unreblog`](https://docs.joinmastodon.org/methods/statuses/#unreblog)
|
||||
- [`POST /api/v1/statuses/:id/bookmark`](https://docs.joinmastodon.org/methods/statuses/#bookmark)
|
||||
- [`POST /api/v1/statuses/:id/unbookmark`](https://docs.joinmastodon.org/methods/statuses/#unbookmark)
|
||||
- [`POST /api/v1/statuses/:id/mute`](https://docs.joinmastodon.org/methods/statuses/#mute)
|
||||
- [`POST /api/v1/statuses/:id/unmute`](https://docs.joinmastodon.org/methods/statuses/#unmute)
|
||||
- [`POST /api/v1/statuses/:id/pin`](https://docs.joinmastodon.org/methods/statuses/#pin)
|
||||
- [`POST /api/v1/statuses/:id/unpin`](https://docs.joinmastodon.org/methods/statuses/#unpin)
|
||||
- [`POST /api/v1/statuses/:id`](https://docs.joinmastodon.org/methods/statuses/#edit)
|
||||
- [`GET /api/v1/statuses/:id/source`](https://docs.joinmastodon.org/methods/statuses/#source)
|
||||
- [`GET /api/v1/statuses/:id/card`](https://docs.joinmastodon.org/methods/statuses/#card)
|
||||
- [`GET /api/v1/suggestions`](https://docs.joinmastodon.org/methods/accounts/suggestions/)
|
||||
- [`GET /api/v1/tags/:id`](https://docs.joinmastodon.org/methods/tags/#get)
|
||||
- [`GET /api/v1/tags/:id/follow`](https://docs.joinmastodon.org/methods/tags/#follow)
|
||||
- [`GET /api/v1/tags/:id/unfollow`](https://docs.joinmastodon.org/methods/tags/#unfollow)
|
||||
- [`GET /api/v1/timelines/direct`](https://docs.joinmastodon.org/methods/timelines/)
|
||||
- [`GET /api/v1/timelines/home`](https://docs.joinmastodon.org/methods/timelines/)
|
||||
- [`GET /api/v1/timelines/list/:id`](https://docs.joinmastodon.org/methods/timelines/)
|
||||
- [`GET /api/v1/timelines/public`](https://docs.joinmastodon.org/methods/timelines/)
|
||||
- [`GET /api/v1/timelines/tag/:hashtag`](https://docs.joinmastodon.org/methods/timelines/)
|
||||
- [`GET /api/v1/trends`](https://docs.joinmastodon.org/methods/instance/trends/)
|
||||
- [`GET /api/v1/trends/links`](https://github.com/mastodon/mastodon/pull/16917)
|
||||
- [`GET /api/v1/trends/statuses`](https://docs.joinmastodon.org/methods/trends/#statuses)
|
||||
- [`GET /api/v1/trends/tags`](https://docs.joinmastodon.org/methods/trends/#tags)
|
||||
- [`GET /api/v2/search`](https://docs.joinmastodon.org/methods/search/)
|
||||
|
||||
|
||||
|
@ -136,15 +146,10 @@ These endpoints use the [Mastodon API entities](https://docs.joinmastodon.org/en
|
|||
|
||||
These emdpoints are planned to be implemented somewhere in the future.
|
||||
|
||||
- [`PATCH /api/v1/accounts/update_credentials`](https://docs.joinmastodon.org/methods/accounts/)
|
||||
- [`POST /api/v1/accounts/:id/remove_from_followers`](https://github.com/mastodon/mastodon/pull/16864)
|
||||
- [`GET /api/v1/accounts/familiar_followers`](https://github.com/mastodon/mastodon/pull/17700)
|
||||
- [`GET /api/v1/accounts/lookup`](https://github.com/mastodon/mastodon/pull/15740)
|
||||
- [`GET /api/v1/trends/links`](https://github.com/mastodon/mastodon/pull/16917)
|
||||
- [`GET /api/v1/trends/statuses`](https://github.com/mastodon/mastodon/pull/17431)
|
||||
- [`GET /api/v1/trends/tags`](https://github.com/mastodon/mastodon/pull/16917)
|
||||
- [`POST /api/v1/polls/:id/votes`](https://docs.joinmastodon.org/methods/statuses/polls/)
|
||||
- [`GET /api/v1/statuses/{id:\d+}/source`](https://github.com/mastodon/mastodon/pull/16697)
|
||||
- [`GET /api/v1/featured_tags`](https://docs.joinmastodon.org/methods/accounts/featured_tags/)
|
||||
- [`POST /api/v1/featured_tags`](https://docs.joinmastodon.org/methods/accounts/featured_tags/)
|
||||
- [`DELETE /api/v1/featured_tags/:id`](https://docs.joinmastodon.org/methods/accounts/featured_tags/)
|
||||
|
@ -189,7 +194,6 @@ They refer to features or data that don't exist in Friendica yet.
|
|||
- [`DELETE /api/v1/filters/:id`](https://docs.joinmastodon.org/methods/accounts/filters/)
|
||||
- [`GET /api/v1/instance/activity`](https://docs.joinmastodon.org/methods/instance#weekly-activity)
|
||||
- [`POST /api/v1/markers`](https://docs.joinmastodon.org/methods/timelines/markers/)
|
||||
- [`POST /api/v1/reports`](https://docs.joinmastodon.org/methods/accounts/reports/)
|
||||
- [`PUT /api/v1/scheduled_statuses/:id`](https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/)
|
||||
- [`GET /api/v1/statuses/{id:\d+}/history`](https://github.com/mastodon/mastodon/pull/16697)
|
||||
- [`GET /api/v1/streaming`](https://docs.joinmastodon.org/methods/timelines/streaming/)
|
||||
|
|
|
@ -19,6 +19,7 @@ General
|
|||
* c - Community
|
||||
* s - Search
|
||||
* a - Admin
|
||||
* m - Moderation
|
||||
* f - Notifications
|
||||
* u - User menu
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ $data = [
|
|||
'submit' => [
|
||||
'catavatar-usecat' => DI::l10n()->t('Use Cat as Avatar'),
|
||||
'catavatar-morecat' => DI::l10n()->t('Another random Cat!'),
|
||||
'catavatar-emailcat' => DI::pConfig()->get(local_user(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
|
||||
'catavatar-emailcat' => DI::pConfig()->get(Session::getLocalUser(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
|
||||
],
|
||||
];
|
||||
```
|
||||
|
@ -790,10 +790,6 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
|
|||
Hook::callAll('post_local', $datarray);
|
||||
Hook::callAll('post_local_end', $datarray);
|
||||
|
||||
### mod/editpost.php
|
||||
|
||||
Hook::callAll('jot_tool', $jotplugins);
|
||||
|
||||
### src/Render/FriendicaSmartyEngine.php
|
||||
|
||||
Hook::callAll("template_vars", $arr);
|
||||
|
@ -855,6 +851,10 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
|
|||
|
||||
Hook::callAll('lockview_content', $item);
|
||||
|
||||
### src/Module/Post/Edit.php
|
||||
|
||||
Hook::callAll('jot_tool', $jotplugins);
|
||||
|
||||
### src/Module/Settings/Delegation.php
|
||||
|
||||
Hook::callAll('authenticate', $addon_auth);
|
||||
|
@ -919,6 +919,10 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
|
|||
Hook::callAll('block', $hook_data);
|
||||
Hook::callAll('unblock', $hook_data);
|
||||
|
||||
### src/Core/Logger/Factory.php
|
||||
|
||||
Hook::callAll('logger_instance', $data);
|
||||
|
||||
### src/Core/StorageManager
|
||||
|
||||
Hook::callAll('storage_instance', $data);
|
||||
|
|
|
@ -191,7 +191,7 @@ code</code></td>
|
|||
You should not read any further if you want to be surprised.<br>
|
||||
<span id="spoiler-wrap-0716e642" class="spoiler-wrap fakelink" onclick="openClose('spoiler-0716e642');">Click to open/close</span>
|
||||
<blockquote class="spoiler" id="spoiler-0716e642" style="display: none;">There is a happy end.</blockquote>
|
||||
<div class="body-attach"><div class="clear"></div></div>
|
||||
<div class="body-attach"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -202,7 +202,7 @@ code</code></td>
|
|||
<strong class="spoiler">Author wrote:</strong><br>
|
||||
<span id="spoiler-wrap-a893765a" class="spoiler-wrap fakelink" onclick="openClose('spoiler-a893765a');">Click to open/close</span>
|
||||
<blockquote class="spoiler" id="spoiler-a893765a" style="display: none;">Spoiler quote</blockquote>
|
||||
<div class="body-attach"><div class="clear"></div></div>
|
||||
<div class="body-attach"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -6,7 +6,7 @@ Using Composer
|
|||
|
||||
Friendica uses [Composer](https://getcomposer.org) to manage dependencies libraries and the class autoloader both for libraries and namespaced Friendica classes.
|
||||
|
||||
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
|
||||
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application.
|
||||
|
||||
* [Class autoloading](help/autoloader)
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ The `config` directory holds key configuration files and can have different conf
|
|||
All of them have to end with `.config.php` and must not include `-sample` in their name.
|
||||
|
||||
Some examples of common known configuration files:
|
||||
- `local.config.php` holds the current node custom configuration.
|
||||
- `addon.config.php` is optional and holds the custom configuration for specific addons.
|
||||
- `local.config.php` holds the base node custom configuration.
|
||||
- Any other file in this folder is meant for additional configuration (e.g. for addons).
|
||||
|
||||
Addons can define their own default configuration values in `addon/[addon]/config/[addon].config.php` which is loaded when the addon is activated.
|
||||
|
||||
|
@ -59,7 +59,7 @@ Currently, the following configurations are included:
|
|||
The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
|
||||
|
||||
The migration is pretty straightforward:
|
||||
If you had any addon-specific configuration in your `.htconfig.php`, just copy `config/addon-sample.config.php` to `config/addon.config.php` and move your configuration values.
|
||||
If you had any addon-specific configuration in your `.htconfig.php`, copy `config/local-sample.config.php` to `config/addon.config.php` and move your configuration values.
|
||||
Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `.htconfig.php` to check your node is working as expected before deleting it.
|
||||
|
||||
<style>
|
||||
|
@ -206,7 +206,7 @@ $lang = "value";
|
|||
The legacy `config/local.ini.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
|
||||
|
||||
The migration is pretty straightforward:
|
||||
If you had any addon-specific configuration in your `config/addon.ini.php`, just copy `config/addon-sample.config.php` to `config/addon.config.php` and move your configuration values.
|
||||
If you had any addon-specific configuration in your `config/addon.ini.php`, copy `config/local-sample.config.php` to `config/addon.config.php` and move your configuration values.
|
||||
Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `config/local.ini.php` file to check your node is working as expected before deleting it.
|
||||
|
||||
<table class="config">
|
||||
|
@ -278,16 +278,16 @@ key[] = value3
|
|||
|
||||
### Database Settings
|
||||
|
||||
The configuration variables database.hostname, database.username, database.password, database.database and database.charset are holding your credentials for the database connection.
|
||||
If you need to specify a port to access the database, you can do so by appending ":portnumber" to the database.hostname variable.
|
||||
The configuration variables `database.hostname` (or `database.socket`), `database.username`, `database.password`, `database.database` and optionally `database.charset` are holding your credentials for the database connection.
|
||||
If you need to specify a port to access the database, you can do so by appending ":portnumber" to the `database.hostname` variable.
|
||||
|
||||
'database' => [
|
||||
'hostname' => 'your.mysqlhost.com:123456',
|
||||
]
|
||||
|
||||
If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
|
||||
If all the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
|
||||
|
||||
MYSQL_HOST
|
||||
MYSQL_HOST or MYSQL_SOCKET
|
||||
MYSQL_PORT
|
||||
MYSQL_USERNAME
|
||||
MYSQL_PASSWORD
|
||||
|
@ -316,7 +316,7 @@ Enabling the admin panel for an account, and thus making the account holder admi
|
|||
|
||||
|
||||
Where you have to match the email address used for the account with the one you enter to the `config/local.config.php` file.
|
||||
If more then one account should be able to access the admin panel, separate the email addresses with a comma.
|
||||
If more than one account should be able to access the admin panel, separate the email addresses with a comma.
|
||||
|
||||
'config' => [
|
||||
'admin_email' => 'someone@example.com,someoneelse@example.com',
|
||||
|
|
|
@ -9,8 +9,8 @@ There is also a connector for accessing your email INBOX.
|
|||
|
||||
If the following network connectors are installed on your system, select the following links to visit the appropriate settings page and configure them for your account:
|
||||
|
||||
* [Twitter](/settings/addon)
|
||||
* [GNU Social](/settings/addon)
|
||||
* [Twitter](/settings/addons)
|
||||
* [GNU Social](/settings/addons)
|
||||
* [Email](/settings)
|
||||
|
||||
Instructions For Connecting To People On Specific Services
|
||||
|
|
|
@ -30,7 +30,7 @@ function doSomething(array $intros)
|
|||
}
|
||||
}
|
||||
|
||||
$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => local_user()]);
|
||||
$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => Session::getLocalUser()]);
|
||||
|
||||
doSomething($intros);
|
||||
```
|
||||
|
@ -47,7 +47,7 @@ function doSomething(\Friendica\Contact\Introductions\Collection\Introductions $
|
|||
}
|
||||
|
||||
/** @var $intros \Friendica\Contact\Introductions\Collection\Introductions */
|
||||
$intros = \Friendica\DI::intro()->selecForUser(local_user());
|
||||
$intros = \Friendica\DI::intro()->selecForUser(Session::getLocalUser());
|
||||
|
||||
doSomething($intros);
|
||||
```
|
||||
|
|
|
@ -47,7 +47,7 @@ Friendica uses an implementation of [Domain-Driven-Design](help/Developer-Domain
|
|||
|
||||
Friendica uses [Composer](https://getcomposer.org) to manage dependencies libraries and the class autoloader both for libraries and namespaced Friendica classes.
|
||||
|
||||
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
|
||||
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application.
|
||||
|
||||
If you want to have git automatically update the dependencies with composer, you can use the `post-merge` [git-hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) with a script similar to this one:
|
||||
|
||||
|
|
32
doc/FAQ.md
32
doc/FAQ.md
|
@ -50,7 +50,7 @@ We recommend to talk to the admin(s) of the affected friendica server. (Admins,
|
|||
### How can I upload images, files, links, videos and sound files to posts?
|
||||
|
||||
You can upload images from your computer using the [editor](help/Text_editor).
|
||||
An overview of all uploaded images is listed at *yourpage.com/photos/profilename*.
|
||||
An overview of all uploaded images is listed at *yourpage.com/profile/profilename/photos*.
|
||||
On that page, you can also upload images directly and choose if your contacts will receive a message about this upload.
|
||||
|
||||
Generally, you can attach any kind of file to a post.
|
||||
|
@ -178,47 +178,39 @@ The available features are client specific and may differ.
|
|||
#### Android
|
||||
|
||||
* [AndStatus](http://andstatus.org) ([F-Droid](https://f-droid.org/repository/browse/?fdid=org.andstatus.app), [Google Play](https://play.google.com/store/apps/details?id=org.andstatus.app))
|
||||
* [B4X for Pleroma & Mastodon](https://github.com/AnywhereSoftware/B4X-Pleroma)
|
||||
* [Fedi](https://play.google.com/store/apps/details?id=com.fediverse.app)
|
||||
* [Fedi](https://github.com/Big-Fig/Fediverse.app) ([Google Play](https://play.google.com/store/apps/details?id=com.fediverse.app))
|
||||
* [Fedilab](https://fedilab.app) ([F-Droid](https://f-droid.org/app/fr.gouv.etalab.mastodon), [Google Play](https://play.google.com/store/apps/details?id=app.fedilab.android))
|
||||
* [Friendiqa](https://git.friendi.ca/lubuwest/Friendiqa) ([F-Droid](https://git.friendi.ca/lubuwest/Friendiqa#install), [Google Play](https://play.google.com/store/apps/details?id=org.qtproject.friendiqa))
|
||||
* [Husky](https://git.sr.ht/~captainepoch/husky) ([F-Droid](https://f-droid.org/repository/browse/?fdid=su.xash.husky), [Google Play](https://play.google.com/store/apps/details?id=su.xash.husky))
|
||||
* [Mastodon for Android](https://github.com/mastodon/mastodon-android) (F-Droid: Pending, [Google-Play](https://play.google.com/store/apps/details?id=org.joinmastodon.android))
|
||||
* [Subway Tooter](https://github.com/tateisu/SubwayTooter)
|
||||
* [Tooot](https://tooot.app/)
|
||||
* [Mastodon](https://github.com/mastodon/mastodon-android) ([F-Droid](https://f-droid.org/en/packages/org.joinmastodon.android/), [Google Play](https://play.google.com/store/apps/details?id=org.joinmastodon.android))
|
||||
* [Subway Tooter](https://github.com/tateisu/SubwayTooter) ([F-Droid](https://android.izzysoft.de/repo/apk/jp.juggler.subwaytooter))
|
||||
* [Tooot](https://tooot.app/) ([Google Play](https://play.google.com/store/apps/details?id=com.xmflsct.app.tooot))
|
||||
* [Tusky](https://tusky.app) ([F-Droid](https://f-droid.org/repository/browse/?fdid=com.keylesspalace.tusky), [Google Play](https://play.google.com/store/apps/details?id=com.keylesspalace.tusky))
|
||||
* [Twidere](https://github.com/TwidereProject/Twidere-Android) ([F-Droid](https://f-droid.org/repository/browse/?fdid=org.mariotaku.twidere), [Google Play](https://play.google.com/store/apps/details?id=com.twidere.twiderex))
|
||||
* [TwidereX](https://github.com/TwidereProject/TwidereX-Android) ([F-Droid](https://f-droid.org/en/packages/com.twidere.twiderex/), [Google Play](https://play.google.com/store/apps/details?id=com.twidere.twiderex))
|
||||
* [Yuito](https://github.com/accelforce/Yuito) ([Google Play](https://play.google.com/store/apps/details?id=net.accelf.yuito))
|
||||
|
||||
#### SailfishOS
|
||||
|
||||
* [Friendly](https://openrepos.net/content/fabrixxm/friendly), last update: 2018
|
||||
|
||||
#### iOS
|
||||
|
||||
* [B4X for Pleroma & Mastodon](https://github.com/AnywhereSoftware/B4X-Pleroma) ([AppStore](https://apps.apple.com/app/b4x-pleroma/id1538396871))
|
||||
* [Fedi](https://fediapp.com) ([AppStore](https://apps.apple.com/de/app/fedi-for-pleroma-and-mastodon/id1478806281))
|
||||
* [Mastodon for iPhone and iPad](https://joinmastodon.org/apps) ([AppStore](https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974))
|
||||
* [Mastodon](https://joinmastodon.org/apps) ([AppStore](https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974))
|
||||
* [Stella*](https://www.stella-app.net/) ([AppStore](https://apps.apple.com/us/app/stella-for-mastodon-twitter/id921372048))
|
||||
* [Tooot](https://github.com/tooot-app) ([AppStore](https://apps.apple.com/app/id1549772269), Data collection (not linked to identity)
|
||||
* [Tootle](https://mastodon.cloud/@tootleapp) ([AppStore](https://apps.apple.com/de/app/tootle-for-mastodon/id1236013466)), last update: 2020
|
||||
* [Tooot](https://github.com/tooot-app) ([AppStore](https://apps.apple.com/app/id1549772269)
|
||||
* [TwidereX](https://github.com/TwidereProject/TwidereX-iOS) ([AppStore](https://apps.apple.com/app/twidere-x/id1530314034))
|
||||
|
||||
#### Linux
|
||||
|
||||
* [Choqok](https://choqok.kde.org)
|
||||
* [Whalebird](https://whalebird.social)
|
||||
* [TheDesk](https://ja.mstdn.wiki/TheDesk)
|
||||
* [Whalebird](https://whalebird.social/en/desktop/contents) ([GitHub](https://github.com/h3poteto/whalebird-desktop))
|
||||
* [TheDesk](https://thedesk.top/en/) ([GitHub](https://github.com/cutls/TheDesk))
|
||||
* [Toot](https://toot.readthedocs.io/en/latest/)
|
||||
* [Tootle](https://github.com/bleakgrey/tootle)
|
||||
|
||||
#### macOS
|
||||
|
||||
* [Mastonaut](https://mastonaut.app/) ([AppStore](https://apps.apple.com/us/app/mastonaut/id1450757574)), closed source
|
||||
* [TheDesk](https://thedesk.top/en/) ([GitHub](https://github.com/cutls/TheDesk))
|
||||
* [Whalebird](https://whalebird.social/en/desktop/contents) ([AppStore](https://apps.apple.com/de/app/whalebird/id1378283354), [GitHub](https://github.com/h3poteto/whalebird-desktop))
|
||||
|
||||
#### Windows
|
||||
|
||||
* [TheDesk](https://thedesk.top/en/) ([GitHub](https://github.com/cutls/TheDesk))
|
||||
* [Whalebird](https://whalebird.social/en/desktop/contents) ([Website Download](https://whalebird.social/en/desktop/contents/downloads#windows), [GitHub](https://github.com/h3poteto/whalebird-desktop))
|
||||
|
||||
#### Web Frontend
|
||||
|
|
|
@ -34,7 +34,7 @@ Due to the large variety of operating systems and PHP platforms in existence we
|
|||
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
|
||||
* Some form of email server or email gateway such that PHP mail() works.
|
||||
If you cannot set up your own email server, you can use the [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) addon and use a remote SMTP server.
|
||||
* MySQL 5.6+ or an equivalent alternative for MySQL (MariaDB, Percona Server etc.)
|
||||
* MySQL with support of InnoDB and Barracuda (we suggest a MariaDB server as all development is done using these, but alternatives like MySQL or Percona Server etc. might work as well)
|
||||
* ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks (Windows)
|
||||
* installation into a top-level domain or sub-domain (without a directory/path component in the URL) is RECOMMENDED. Directory paths will not be as convenient to use and have not been thoroughly tested. This is REQUIRED if you wish to communicate with the Diaspora network.
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ How to move your account between servers
|
|||
* Go to "Settings" -> "[Export personal data](uexport)"
|
||||
* Click on "Export account" to save your account data.
|
||||
* **Save the file in a secure place!** It contains your details, your contacts, groups, and personal settings. It also contains your secret keys to authenticate yourself to your contacts.
|
||||
* Go to your new server, and open *http://newserver.com/uimport* (there is not a direct link to this page at the moment). Please consider that this is only possible on servers with open registration. On other systems only the administrator can add accounts with an uploaded file.
|
||||
* Do NOT create a new account prior to importing your old settings - uimport should be used *instead* of register.
|
||||
* Go to your new server, and open *http://newserver.com/user/import* (there is not a direct link to this page at the moment). Please consider that this is only possible on servers with open registration. On other systems only the administrator can add accounts with an uploaded file.
|
||||
* Do NOT create a new account prior to importing your old settings - user import should be used *instead* of register.
|
||||
* Load your saved account file and click "Import".
|
||||
* After the move, the account on the old server will not work reliably anymore, and should be not used.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ Remove Account
|
|||
|
||||
We don't like to see people leave Friendica, but if you need to remove your account, you should visit the URL
|
||||
|
||||
http://sitename/removeme
|
||||
http://sitename/settings/removeme
|
||||
|
||||
with your web browser.
|
||||
You will need to be logged in at the time.
|
||||
|
|
|
@ -30,13 +30,3 @@ Here you can find an overview of the different ways to comment and sort existing
|
|||
<P style="clear: both;"></p>
|
||||
|
||||
<img src="doc/img/post_choose.png" width="27" height="32" alt="post_choose.png" align="left"> This symbol is used to choose more than one post to delete in a single step. After selecting all posts, go to the end of the page and click "Delete Selected Items".<P style="clear: both;"></p>
|
||||
|
||||
**Symbols of other themes**
|
||||
|
||||
Darkbubble <img src="doc/img/darkbubble.png" alt="darkbubble.png" style="padding-left: 20px; vertical-align:middle;">
|
||||
|
||||
Darkzero <img src="doc/img/darkzero.png" alt="darkzero.png" style="padding-left: 35px; vertical-align:middle;">
|
||||
|
||||
<span style="padding-left: 10px; font-style:italic;">(incl. more "zero"-themes, slackr, comix, easterbunny, facepark)</span>
|
||||
|
||||
Dispy <img src="doc/img/dispy.png" alt="dispy.png" style="padding-left: 57px; vertical-align:middle;"> <i>(incl. smoothly, testbubble)</i>
|
||||
|
|
|
@ -24,10 +24,6 @@ Below are examples of the post editor in 3 of Friendica's common themes:
|
|||
<figcaption>Post editor, with the <b>Vier</b> theme.</figcaption>
|
||||
</figure>
|
||||
<p style="clear:both;"></p>
|
||||
<figure>
|
||||
<img src="doc/img/editor_dpzero.png" alt="duepuntozero editor">
|
||||
<figcaption>Post editor, with the <b>Duepuntozero</b> theme.</figcaption>
|
||||
</figure>
|
||||
|
||||
Post title is optional, you can set it by clicking on "Set title".
|
||||
|
||||
|
@ -73,11 +69,6 @@ These icons can change depending on the theme. Some examples:
|
|||
<td><img src="doc/img/vier_icons.png" alt="vier.png" style="vertical-align:middle;"></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Smoothly: </td>
|
||||
<td><img src="doc/img/editor_darkbubble.png" alt="darkbubble.png" style="vertical-align:middle;"></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<i><b>*</b> how to [upload](help/FAQ#upload) files</i>
|
||||
<p style="clear:both;"> </p>
|
||||
|
|
|
@ -10,7 +10,7 @@ Getting started
|
|||
No need to setup up a webserver, database etc. before actually starting.
|
||||
Vagrant creates a virtual machine for you that you can just run inside VirtualBox and start to work directly on Friendica.
|
||||
|
||||
It brings an Debian Bullseye with PHP 7.4 and MariaDB 10.5.11.
|
||||
It brings an Debian Bullseye with PHP 8.0 and MariaDB 10.5.11.
|
||||
|
||||
What you need to do:
|
||||
|
||||
|
@ -24,7 +24,7 @@ This will start the virtual machine.
|
|||
Be patient: When it runs for the first time, it downloads a Debian Server image and installs Friendica.
|
||||
4. Run `vagrant ssh` to log into the virtual machine to log in to the VM in case you need to debug something on the server.
|
||||
5. Open you test installation in a browser.
|
||||
Go to friendica.local (or 192.168.22.10).
|
||||
Go to friendica.local (or 192.168.56.10).
|
||||
friendica.local is using a self-signed TLS certificate, so you will need to add an exception to trust the certificate the first time you are visiting the page.
|
||||
The mysql database is called "friendica", the mysql user and password both are "friendica".
|
||||
6. Work on Friendica's code in your git clone on your machine (not in the VM).
|
||||
|
|
|
@ -6,7 +6,7 @@ Autoloader with Composer
|
|||
|
||||
Friendica uses [Composer](https://getcomposer.org) to manage dependencies libraries and the class autoloader both for libraries and namespaced Friendica classes.
|
||||
|
||||
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
|
||||
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application.
|
||||
|
||||
* [Using Composer](help/Composer)
|
||||
|
||||
|
@ -39,7 +39,6 @@ Namespaces are useful to keep classes separated and avoid names conflicts (could
|
|||
|
||||
Let's say now that you need to load some items in a view, maybe in a fictional `mod/network.php`.
|
||||
In order for the Composer autoloader to work, it must first be included.
|
||||
In Friendica this is already done at the top of `boot.php`, with `require_once('vendor/autoload.php');`.
|
||||
|
||||
The code will be something like:
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ Database Tables
|
|||
| [2fa_app_specific_password](help/database/db_2fa_app_specific_password) | Two-factor app-specific _password |
|
||||
| [2fa_recovery_codes](help/database/db_2fa_recovery_codes) | Two-factor authentication recovery codes |
|
||||
| [2fa_trusted_browser](help/database/db_2fa_trusted_browser) | Two-factor authentication trusted browsers |
|
||||
| [account-suggestion](help/database/db_account-suggestion) | Account suggestion |
|
||||
| [account-user](help/database/db_account-user) | Remote and local accounts |
|
||||
| [addon](help/database/db_addon) | registered addons |
|
||||
| [apcontact](help/database/db_apcontact) | ActivityPub compatible contacts - used in the ActivityPub implementation |
|
||||
|
@ -22,10 +23,10 @@ Database Tables
|
|||
| [contact-relation](help/database/db_contact-relation) | Contact relations |
|
||||
| [conv](help/database/db_conv) | private messages |
|
||||
| [delayed-post](help/database/db_delayed-post) | Posts that are about to be distributed at a later time |
|
||||
| [diaspora-contact](help/database/db_diaspora-contact) | Diaspora compatible contacts - used in the Diaspora implementation |
|
||||
| [diaspora-interaction](help/database/db_diaspora-interaction) | Signed Diaspora Interaction |
|
||||
| [endpoint](help/database/db_endpoint) | ActivityPub endpoints - used in the ActivityPub implementation |
|
||||
| [event](help/database/db_event) | Events |
|
||||
| [fcontact](help/database/db_fcontact) | Diaspora compatible contacts - used in the Diaspora implementation |
|
||||
| [fetch-entry](help/database/db_fetch-entry) | |
|
||||
| [fetched-activity](help/database/db_fetched-activity) | Id of fetched activities |
|
||||
| [fsuggest](help/database/db_fsuggest) | friend suggestion stuff |
|
||||
|
@ -74,6 +75,8 @@ Database Tables
|
|||
| [profile_field](help/database/db_profile_field) | Custom profile fields |
|
||||
| [push_subscriber](help/database/db_push_subscriber) | Used for OStatus: Contains feed subscribers |
|
||||
| [register](help/database/db_register) | registrations requiring admin approval |
|
||||
| [report](help/database/db_report) | |
|
||||
| [report-post](help/database/db_report-post) | |
|
||||
| [search](help/database/db_search) | |
|
||||
| [session](help/database/db_session) | web session storage |
|
||||
| [storage](help/database/db_storage) | Data stored by Database storage backend |
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
Table account-suggestion
|
||||
===========
|
||||
|
||||
Account suggestion
|
||||
|
||||
Fields
|
||||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ------ | ------------------------------------------------------------ | ------------------ | ---- | --- | ------- | ----- |
|
||||
| uri-id | Id of the item-uri table entry that contains the account url | int unsigned | NO | PRI | NULL | |
|
||||
| uid | User ID | mediumint unsigned | NO | PRI | NULL | |
|
||||
| level | level of closeness | smallint unsigned | YES | | NULL | |
|
||||
| ignore | If set, this account will not be suggested again | boolean | NO | | 0 | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
||||
| Name | Fields |
|
||||
| ---------- | ----------- |
|
||||
| PRIMARY | uid, uri-id |
|
||||
| uri-id_uid | uri-id, uid |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
||||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
| uid | [user](help/database/db_user) | uid |
|
||||
|
||||
Return to [database documentation](help/database)
|
|
@ -21,6 +21,7 @@ Fields
|
|||
| xmpp | XMPP address | varchar(255) | NO | | | |
|
||||
| matrix | Matrix address | varchar(255) | NO | | | |
|
||||
| avatar | | varbinary(383) | NO | | | |
|
||||
| blurhash | BlurHash representation of the avatar | varbinary(255) | YES | | NULL | |
|
||||
| header | Header picture | varbinary(383) | YES | | NULL | |
|
||||
| url | | varbinary(383) | NO | | | |
|
||||
| nurl | | varbinary(383) | NO | | | |
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
Table diaspora-contact
|
||||
===========
|
||||
|
||||
Diaspora compatible contacts - used in the Diaspora implementation
|
||||
|
||||
Fields
|
||||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ----------------- | ------------------------------------------------------------ | ------------ | ---- | --- | ------------------- | ----- |
|
||||
| uri-id | Id of the item-uri table entry that contains the contact URL | int unsigned | NO | PRI | NULL | |
|
||||
| addr | | varchar(255) | YES | | NULL | |
|
||||
| alias | | varchar(255) | YES | | NULL | |
|
||||
| nick | | varchar(255) | YES | | NULL | |
|
||||
| name | | varchar(255) | YES | | NULL | |
|
||||
| given-name | | varchar(255) | YES | | NULL | |
|
||||
| family-name | | varchar(255) | YES | | NULL | |
|
||||
| photo | | varchar(255) | YES | | NULL | |
|
||||
| photo-medium | | varchar(255) | YES | | NULL | |
|
||||
| photo-small | | varchar(255) | YES | | NULL | |
|
||||
| batch | | varchar(255) | YES | | NULL | |
|
||||
| notify | | varchar(255) | YES | | NULL | |
|
||||
| poll | | varchar(255) | YES | | NULL | |
|
||||
| subscribe | | varchar(255) | YES | | NULL | |
|
||||
| searchable | | boolean | YES | | NULL | |
|
||||
| pubkey | | text | YES | | NULL | |
|
||||
| gsid | Global Server ID | int unsigned | YES | | NULL | |
|
||||
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| updated | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| interacting_count | Number of contacts this contact interactes with | int unsigned | YES | | 0 | |
|
||||
| interacted_count | Number of contacts that interacted with this contact | int unsigned | YES | | 0 | |
|
||||
| post_count | Number of posts and comments | int unsigned | YES | | 0 | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
||||
| Name | Fields |
|
||||
| ------- | ------------ |
|
||||
| PRIMARY | uri-id |
|
||||
| addr | UNIQUE, addr |
|
||||
| alias | alias |
|
||||
| gsid | gsid |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
||||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
| gsid | [gserver](help/database/db_gserver) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
|
@ -1,51 +0,0 @@
|
|||
Table fcontact
|
||||
===========
|
||||
|
||||
Diaspora compatible contacts - used in the Diaspora implementation
|
||||
|
||||
Fields
|
||||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ----------------- | ------------------------------------------------------------- | ---------------- | ---- | --- | ------------------- | -------------- |
|
||||
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||
| guid | unique id | varbinary(255) | NO | | | |
|
||||
| url | | varbinary(383) | NO | | | |
|
||||
| uri-id | Id of the item-uri table entry that contains the fcontact url | int unsigned | YES | | NULL | |
|
||||
| name | | varchar(255) | NO | | | |
|
||||
| photo | | varbinary(383) | NO | | | |
|
||||
| request | | varbinary(383) | NO | | | |
|
||||
| nick | | varchar(255) | NO | | | |
|
||||
| addr | | varchar(255) | NO | | | |
|
||||
| batch | | varbinary(383) | NO | | | |
|
||||
| notify | | varbinary(383) | NO | | | |
|
||||
| poll | | varbinary(383) | NO | | | |
|
||||
| confirm | | varbinary(383) | NO | | | |
|
||||
| priority | | tinyint unsigned | NO | | 0 | |
|
||||
| network | | char(4) | NO | | | |
|
||||
| alias | | varbinary(383) | NO | | | |
|
||||
| pubkey | | text | YES | | NULL | |
|
||||
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| updated | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| interacting_count | Number of contacts this contact interactes with | int unsigned | YES | | 0 | |
|
||||
| interacted_count | Number of contacts that interacted with this contact | int unsigned | YES | | 0 | |
|
||||
| post_count | Number of posts and comments | int unsigned | YES | | 0 | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
||||
| Name | Fields |
|
||||
| ------- | ---------------- |
|
||||
| PRIMARY | id |
|
||||
| addr | addr(32) |
|
||||
| url | UNIQUE, url(190) |
|
||||
| uri-id | UNIQUE, uri-id |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
||||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
|
@ -25,6 +25,7 @@ Fields
|
|||
| height | | smallint unsigned | NO | | 0 | |
|
||||
| width | | smallint unsigned | NO | | 0 | |
|
||||
| datasize | | int unsigned | NO | | 0 | |
|
||||
| blurhash | BlurHash representation of the photo | varbinary(255) | YES | | NULL | |
|
||||
| data | | mediumblob | NO | | NULL | |
|
||||
| scale | | tinyint unsigned | NO | | 0 | |
|
||||
| profile | | boolean | NO | | 0 | |
|
||||
|
|
|
@ -13,6 +13,7 @@ Fields
|
|||
| content-warning | | varchar(255) | NO | | | |
|
||||
| body | item body content | mediumtext | YES | | NULL | |
|
||||
| raw-body | Body without embedded media links | mediumtext | YES | | NULL | |
|
||||
| quote-uri-id | Id of the item-uri table that contains the quoted uri | int unsigned | YES | | NULL | |
|
||||
| location | text location where this item originated | varchar(255) | NO | | | |
|
||||
| coord | longitude/latitude pair representing location where this item originated | varchar(255) | NO | | | |
|
||||
| language | Language information about this post | text | YES | | NULL | |
|
||||
|
@ -35,6 +36,7 @@ Indexes
|
|||
| plink | plink(191) |
|
||||
| resource-id | resource-id |
|
||||
| title-content-warning-body | FULLTEXT, title, content-warning, body |
|
||||
| quote-uri-id | quote-uri-id |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
@ -42,5 +44,6 @@ Foreign Keys
|
|||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
| quote-uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
||||
|
|
|
@ -7,11 +7,14 @@ Fields
|
|||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| -------- | --------------------------------------------------------- | -------------- | ---- | --- | ------- | -------------- |
|
||||
| -------- | --------------------------------------------------------- | ----------------- | ---- | --- | ------- | -------------- |
|
||||
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | | NULL | |
|
||||
| url | External URL | varbinary(511) | NO | | NULL | |
|
||||
| mimetype | | varchar(60) | YES | | NULL | |
|
||||
| height | Height of the media | smallint unsigned | YES | | NULL | |
|
||||
| width | Width of the media | smallint unsigned | YES | | NULL | |
|
||||
| blurhash | BlurHash representation of the link | varbinary(255) | YES | | NULL | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
|
|
@ -7,15 +7,17 @@ Fields
|
|||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| --------------- | --------------------------------------------------------- | ----------------- | ---- | --- | ------- | -------------- |
|
||||
| --------------- | ------------------------------------------------------------------ | ----------------- | ---- | --- | ------- | -------------- |
|
||||
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||
| uri-id | Id of the item-uri table entry that contains the item uri | int unsigned | NO | | NULL | |
|
||||
| url | Media URL | varbinary(1024) | NO | | NULL | |
|
||||
| media-uri-id | Id of the item-uri table entry that contains the activities uri-id | int unsigned | YES | | NULL | |
|
||||
| type | Media type | tinyint unsigned | NO | | 0 | |
|
||||
| mimetype | | varchar(60) | YES | | NULL | |
|
||||
| height | Height of the media | smallint unsigned | YES | | NULL | |
|
||||
| width | Width of the media | smallint unsigned | YES | | NULL | |
|
||||
| size | Media size | bigint unsigned | YES | | NULL | |
|
||||
| blurhash | BlurHash representation of the image | varbinary(255) | YES | | NULL | |
|
||||
| preview | Preview URL | varbinary(512) | YES | | NULL | |
|
||||
| preview-height | Height of the preview picture | smallint unsigned | YES | | NULL | |
|
||||
| preview-width | Width of the preview picture | smallint unsigned | YES | | NULL | |
|
||||
|
@ -32,10 +34,11 @@ Indexes
|
|||
------------
|
||||
|
||||
| Name | Fields |
|
||||
| ---------- | ------------------------ |
|
||||
| ------------ | ------------------------ |
|
||||
| PRIMARY | id |
|
||||
| uri-id-url | UNIQUE, uri-id, url(512) |
|
||||
| uri-id-id | uri-id, id |
|
||||
| media-uri-id | media-uri-id |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
@ -43,5 +46,6 @@ Foreign Keys
|
|||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
| media-uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
||||
|
|
|
@ -7,7 +7,7 @@ Fields
|
|||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ------------ | --------------------------------------------- | ------------------ | ---- | --- | ---------- | -------------- |
|
||||
| ----------------- | -------------------------------------------------------------- | ------------------ | ---- | --- | ---------- | -------------- |
|
||||
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||
| uid | Owner User id | mediumint unsigned | NO | | 0 | |
|
||||
| profile-name | Deprecated | varchar(255) | YES | | NULL | |
|
||||
|
@ -45,6 +45,7 @@ Fields
|
|||
| education | Deprecated | text | YES | | NULL | |
|
||||
| contact | Deprecated | text | YES | | NULL | |
|
||||
| homepage | | varchar(255) | NO | | | |
|
||||
| homepage_verified | was the homepage verified by a rel-me link back to the profile | boolean | NO | | 0 | |
|
||||
| xmpp | XMPP address | varchar(255) | NO | | | |
|
||||
| matrix | Matrix address | varchar(255) | NO | | | |
|
||||
| photo | | varbinary(383) | NO | | | |
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
Table report-post
|
||||
===========
|
||||
|
||||
|
||||
|
||||
Fields
|
||||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ------ | --------------------------- | ---------------- | ---- | --- | ------- | ----- |
|
||||
| rid | Report id | int unsigned | NO | PRI | NULL | |
|
||||
| uri-id | Uri-id of the reported post | int unsigned | NO | PRI | NULL | |
|
||||
| status | Status of the reported post | tinyint unsigned | YES | | NULL | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
||||
| Name | Fields |
|
||||
| ------- | ----------- |
|
||||
| PRIMARY | rid, uri-id |
|
||||
| uri-id | uri-id |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
||||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| rid | [report](help/database/db_report) | id |
|
||||
| uri-id | [item-uri](help/database/db_item-uri) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
|
@ -0,0 +1,36 @@
|
|||
Table report
|
||||
===========
|
||||
|
||||
|
||||
|
||||
Fields
|
||||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ------- | --------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
|
||||
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
|
||||
| uid | Reporting user | mediumint unsigned | YES | | NULL | |
|
||||
| cid | Reported contact | int unsigned | NO | | NULL | |
|
||||
| comment | Report | text | YES | | NULL | |
|
||||
| forward | Forward the report to the remote server | boolean | YES | | NULL | |
|
||||
| created | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| status | Status of the report | tinyint unsigned | YES | | NULL | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
||||
| Name | Fields |
|
||||
| ------- | ------ |
|
||||
| PRIMARY | id |
|
||||
| uid | uid |
|
||||
| cid | cid |
|
||||
|
||||
Foreign Keys
|
||||
------------
|
||||
|
||||
| Field | Target Table | Target Field |
|
||||
|-------|--------------|--------------|
|
||||
| uid | [user](help/database/db_user) | uid |
|
||||
| cid | [contact](help/database/db_contact) | id |
|
||||
|
||||
Return to [database documentation](help/database)
|
|
@ -7,7 +7,7 @@ Fields
|
|||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ------------------------ | --------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
|
||||
| ------------------------ | --------------------------------------------------------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
|
||||
| uid | sequential ID | mediumint unsigned | NO | PRI | NULL | auto_increment |
|
||||
| parent-uid | The parent user that has full control about this user | mediumint unsigned | YES | | NULL | |
|
||||
| guid | A unique identifier for this user | varchar(64) | NO | | | |
|
||||
|
@ -21,6 +21,7 @@ Fields
|
|||
| language | default language | varchar(32) | NO | | en | |
|
||||
| register_date | timestamp of registration | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| login_date | timestamp of last login | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| last-activity | Day of the last activity | date | YES | | NULL | |
|
||||
| default-location | Default for item.location | varchar(255) | NO | | | |
|
||||
| allow_location | 1 allows to display the location | boolean | NO | | 0 | |
|
||||
| theme | user theme preference | varchar(255) | NO | | | |
|
||||
|
@ -42,7 +43,7 @@ Fields
|
|||
| pwdreset | Password reset request token | varchar(255) | YES | | NULL | |
|
||||
| pwdreset_time | Timestamp of the last password reset request | datetime | YES | | NULL | |
|
||||
| maxreq | | int unsigned | NO | | 10 | |
|
||||
| expire | | int unsigned | NO | | 0 | |
|
||||
| expire | Delay in days before deleting user-related posts. Scope is controlled by pConfig. | int unsigned | NO | | 0 | |
|
||||
| account_removed | if 1 the account is removed | boolean | NO | | 0 | |
|
||||
| account_expired | | boolean | NO | | 0 | |
|
||||
| account_expires_on | timestamp when account expires and will be deleted | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
|
|
|
@ -309,10 +309,6 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
|
|||
Hook::callAll('post_local', $datarray);
|
||||
Hook::callAll('post_local_end', $datarray);
|
||||
|
||||
### mod/editpost.php
|
||||
|
||||
Hook::callAll('jot_tool', $jotplugins);
|
||||
|
||||
### src/Network/FKOAuth1.php
|
||||
|
||||
Hook::callAll('logged_in', $a->user);
|
||||
|
@ -405,6 +401,10 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
|
|||
Hook::callAll('block', $hook_data);
|
||||
Hook::callAll('unblock', $hook_data);
|
||||
|
||||
### src/Core/Logger/Factory.php
|
||||
|
||||
Hook::callAll('logger_instance', $data);
|
||||
|
||||
### src/Core/StorageManager
|
||||
|
||||
Hook::callAll('storage_instance', $data);
|
||||
|
@ -418,6 +418,10 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
|
|||
|
||||
Hook::callAll('lockview_content', $item);
|
||||
|
||||
### src/Module/Post/Edit.php
|
||||
|
||||
Hook::callAll('jot_tool', $jotplugins);
|
||||
|
||||
### src/Worker/Directory.php
|
||||
|
||||
Hook::callAll('globaldir_update', $arr);
|
||||
|
|
|
@ -192,7 +192,7 @@ Zeilen</code></td>
|
|||
Du solltest nicht weiter lesen, wenn du das Ende des Films nicht vorher erfahren willst. <br>
|
||||
<span id="spoiler-wrap-0716e642" class="spoiler-wrap fakelink" onclick="openClose('spoiler-0716e642');">Zum öffnen/schließen klicken</span>
|
||||
<blockquote class="spoiler" id="spoiler-0716e642" style="display: none;">Es gibt ein Happy End.</blockquote>
|
||||
<div class="body-attach"><div class="clear"></div></div>
|
||||
<div class="body-attach"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -203,7 +203,7 @@ Zeilen</code></td>
|
|||
<strong class="spoiler">Autor hat geschrieben</strong><br>
|
||||
<span id="spoiler-wrap-a893765a" class="spoiler-wrap fakelink" onclick="openClose('spoiler-a893765a');">Zum öffnen/schließen klicken</span>
|
||||
<blockquote class="spoiler" id="spoiler-a893765a" style="display: none;">Spoiler Alarm</blockquote>
|
||||
<div class="body-attach"><div class="clear"></div></div>
|
||||
<div class="body-attach"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -69,7 +69,7 @@ Andere erlauben nur kostenpflichtige Zertifikate als eigenes Angebot bzw. von an
|
|||
### Wie kann ich Bilder, Dateien, Links, Video und Audio in Beiträge einfügen?
|
||||
|
||||
Bilder können direkt im [Beitragseditor](help/Text_editor) vom Computer hochgeladen werden.
|
||||
Eine Übersicht aller Bilder, die auf Deinem Server liegen, findest Du unter <i>deineSeite.de/photos/profilname</i>.
|
||||
Eine Übersicht aller Bilder, die auf Deinem Server liegen, findest Du unter <i>deineSeite.de/profile/profilname/photos</i>.
|
||||
Dort kannst Du auch direkt Bilder hochladen und festlegen, ob Deine Kontakte eine Nachricht über das neue Bild bekommen.
|
||||
|
||||
Alle Arten von Dateien können grundsätzlich als Anhang in Friendica hochgeladen werden.
|
||||
|
|
|
@ -31,7 +31,7 @@ Requirements
|
|||
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert)
|
||||
* Einen E-Mail Server, so dass PHP `mail()` funktioniert.
|
||||
Wenn kein eigener E-Mail Server zur Verfügung steht, kann alternativ das [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) Addon mit einem externen SMTP Account verwendet werden.
|
||||
* Mysql 5.6+ (oder eine äquivalente Alternative: MariaDB, Percona Server etc.)
|
||||
* Mysql Server mit Unterstützung vom InnoDB und Barracuda (wir empfehlen MariaDB da die Entwicklung mit solchen Server erfolgt, aber Alternativen wie MySQL, Percona Server etc. sollten auch funktionieren)
|
||||
* die Möglichkeit, wiederkehrende Aufgaben mit cron (Linux/Mac) oder "Scheduled Tasks" einzustellen (Windows) [Beachte: andere Optionen sind in Abschnitt 7 dieser Dokumentation zu finden]
|
||||
* Installation in einer Top-Level-Domain oder Subdomain (ohne eine Verzeichnis/Pfad-Komponente in der URL) wird bevorzugt. Verzeichnispfade sind für diesen Zweck nicht so günstig und wurden auch nicht ausführlich getestet.
|
||||
|
||||
|
|
|
@ -15,14 +15,14 @@ Außerdem enthält sie deinen geheimen Schlüssel mit dem du dich deinen Kontakt
|
|||
|
||||
**Speichere diese Datei an einem sicheren Ort**!
|
||||
|
||||
Rufe nun dem neuen Server die Seite *http://newserver.com/uimport* auf (es gibt derzeit keinen direkten Link auf diese Seite).
|
||||
Rufe nun dem neuen Server die Seite *http://newserver.com/user/import* auf (es gibt derzeit keinen direkten Link auf diese Seite).
|
||||
|
||||
Bitte beachte, dass dies nur auf Servern möglich ist, an denen man sich offen anmelden kann.
|
||||
Bei Servern, bei denen der Administrator Accounts freigeben muss, ist das Hochladen nicht möglich.
|
||||
Hier kann dies nur der Administrator selber durchführen.
|
||||
|
||||
Lege auf dem neuen Server auf keinen Fall einen gleichnamigen Account an!
|
||||
uimport muss anstelle des Registrierens verwendet werden.
|
||||
user import muss anstelle des Registrierens verwendet werden.
|
||||
|
||||
Wähle die gesicherte Account Datei aus und klicke "Importieren".
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ Accounts löschen
|
|||
|
||||
Wir freuen uns nicht, wenn Leute Friendica verlassen, aber wenn du deinen Account löschen willst, dann besuche die folgende URL
|
||||
|
||||
[Lösche mich (http://NamederSeite/removeme)](../removeme)
|
||||
[Lösche mich (http://NamederSeite/settings/removeme)](../settings/removeme)
|
||||
|
||||
in deinem Webbrowser. Du musst dabei eingeloggt sein.
|
||||
|
||||
|
|
|
@ -47,13 +47,3 @@ Wähle eine vorhandene Gruppe oder gib einen neuen Namen ein. Die erstellten Gru
|
|||
<img src="doc/img/post_choose.png" width="27" height="32" alt="post_choose.png" align="left"> Mit diesem Symbol kannst du mehrere Beiträge auswählen und gesammelt löschen.
|
||||
Hierfür gehst du nach dem Markieren aller gewünschten Beiträge auf "Lösche die markierten Beiträge" am Ende der Seite mit allen Beiträgen.
|
||||
<P style="clear: both;"></p>
|
||||
|
||||
**Im Folgenden findest du Symbole weiterer Themen**
|
||||
|
||||
Darkbubble <img src="doc/img/darkbubble.png" alt="darkbubble.png" style="padding-left: 20px; vertical-align:middle;">
|
||||
|
||||
Darkzero <img src="doc/img/darkzero.png" alt="darkzero.png" style="padding-left: 35px; vertical-align:middle;">
|
||||
|
||||
<span style="padding-left: 10px; font-style:italic;">(inkl. weiterer "zero"-Themen, slackr, comix, easterbunny, facepark)</span>
|
||||
|
||||
Dispy <img src="doc/img/dispy.png" alt="dispy.png" style="padding-left: 57px; vertical-align:middle;"> <i>(inkl. smoothly, testbubble)</i>
|
||||
|
|
|
@ -9,35 +9,35 @@ Achtung: für dieses Beispiel wurde das Thema <b>"Diabook"</b> genutzt.
|
|||
Wenn du ein anderes Design benutzt, wirst du manche dieser Symbole gar nicht oder in anderer Form vorfinden.
|
||||
</span>
|
||||
|
||||
<img src="doc/img/friendica_editor.png" width="538" height="218" alt="editor">
|
||||
<img src="doc/img/friendica_rich_editor.png" width="538" height="218" alt="editor">
|
||||
|
||||
<i>Die einzelnen Symbole</i>
|
||||
|
||||
<img src="doc/img/camera.png" width="44" height="33" alt="editor" align="left" style="padding-bottom: 20px;"> Wenn du auf dieses Symbol klickst, dann kannst du ein Bild von deinem Computer hinzufügen.
|
||||
<img src="doc/img/camera.png" alt="editor" align="left" style="margin: 0 10px 10px 0;"> Wenn du auf dieses Symbol klickst, dann kannst du ein Bild von deinem Computer hinzufügen.
|
||||
Wenn du eine Internetadresse (URL) eingeben willst, dann kannst du das "Baum"-Symbol im oberen Teil des Editors nutzen.
|
||||
Wenn du ein Bild ausgewählt hast, dann erscheint eine Miniaturdarstellung des Bildes im Editor.*
|
||||
<p style="clear:both;"></p>
|
||||
|
||||
<img src="doc/img/paper_clip.png" width="44" height="33" alt="paper_clip" align="left"> Wenn du dieses Symbol anklickst, dann kannst du weitere Dateien von deinem Computer einfügen. Eine Vorschau des Dateiinhalts erfolgt nicht.*
|
||||
<img src="doc/img/paper_clip.png" alt="paper_clip" align="left" style="margin: 0 10px 10px 0;"> Wenn du dieses Symbol anklickst, dann kannst du weitere Dateien von deinem Computer einfügen. Eine Vorschau des Dateiinhalts erfolgt nicht.*
|
||||
<p style="clear:both;"></p>
|
||||
|
||||
<img src="doc/img/chain.png" width="44" height="33" alt="chain" align="left"> Wenn du die Kette anklickst, dann kannst du eine Internetadresse (URL) einfügen.
|
||||
<img src="doc/img/chain.png" alt="chain" align="left" style="margin: 0 10px 10px 0;"> Wenn du die Kette anklickst, dann kannst du eine Internetadresse (URL) einfügen.
|
||||
Im Editor erscheint automatisch eine kurze Information zum eingefügten Link.*
|
||||
<p style="clear:both;"></p>
|
||||
|
||||
<img src="doc/img/video.png" width="44" height="33" alt="video" align="left" style="padding-bottom: 40px;"> Mit dieser Funktion kannst du die Internetadresse (URL) einer Videodatei einfügen.
|
||||
<img src="doc/img/video.png" alt="video" align="left" style="margin: 0 10px 10px 0;"> Mit dieser Funktion kannst du die Internetadresse (URL) einer Videodatei einfügen.
|
||||
Das Video erscheint dann mit einem Player in deinem Beitrag.
|
||||
Da Friendica zur Einbindung [HTML5](http://en.wikipedia.org/wiki/HTML5_video) verwendet, werden je nach Browser verschiedene Videoformate unterstützt (z.B. WebM oder MP4).
|
||||
Außerdem kannst du hier die URLs von Videos auf Youtube, Vimeo und manchen anderen Videohostern eingeben.
|
||||
Die Videos werden dann mit Vorschaubild angezeigt, nach einem Klick öffnet sich ein eingebetteter Player.*
|
||||
<p style="clear:both;"></p>
|
||||
|
||||
<img src="doc/img/mic.png" width="44" height="33" alt="mic" align="left" style="padding-bottom: 40px;"> Mit dieser Funktion kannst du die Internetadresse (URL) einer Sound-Datei einfügen.
|
||||
<img src="doc/img/mic.png" alt="mic" align="left" style="margin: 0 10px 10px 0;"> Mit dieser Funktion kannst du die Internetadresse (URL) einer Sound-Datei einfügen.
|
||||
Da Friendica zur Einbindung [HTML5](http://en.wikipedia.org/wiki/HTML5_video) verwendet, werden je nach Browser und Betriebssystem MP3, Ogg oder AAC unterstützt.
|
||||
Außerdem kannst du hier auch URLs von manchen Audiohostern wie Soundcloud eingeben, um eine dort gespeicherte Audiodatei mit Player in deinem Beitrag anzuzeigen.*
|
||||
<p style="clear:both;"></p>
|
||||
|
||||
<img src="doc/img/globe.png" width="44" height="33" alt="globe" align="left"> Wenn du dieses Symbol wählst, dann kannst du deinen Standort festlegen.
|
||||
<img src="doc/img/globe.png" alt="globe" align="left" style="margin: 0 10px 10px 0;"> Wenn du dieses Symbol wählst, dann kannst du deinen Standort festlegen.
|
||||
Hier reicht schon eine Angabe wie "Berlin" oder "10775".
|
||||
Dieser Eintrag führt anschließend zu einer Suchanfrage bei Google Maps.
|
||||
<p style="clear:both;"></p>
|
||||
|
@ -46,12 +46,6 @@ Dieser Eintrag führt anschließend zu einer Suchanfrage bei Google Maps.
|
|||
|
||||
**Im Folgenden findest du Symbole weiterer Themen**
|
||||
|
||||
Cleanzero <img src="doc/img/editor_zero.png" alt="cleanzero.png" style="padding-left: 20px; vertical-align:middle;">
|
||||
|
||||
<span style="padding-left: 10px; font-style:italic;">(inkl. weiterer "zero"-Themen, comix, easterbunny, facepark, slackr </span>
|
||||
|
||||
Darkbubble <img src="doc/img/editor_darkbubble.png" alt="darkbubble.png" style="padding-left: 14px; vertical-align:middle;"> <i>(inkl. smoothly, testbubble)</i>
|
||||
|
||||
Frio <img src="doc/img/editor_frio.png" alt="frio.png" style="padding-left: 44px; vertical-align:middle;">
|
||||
|
||||
Vier <img src="doc/img/editor_vier.png" alt="vier.png" style="padding-left: 44px; vertical-align:middle;"> <i>(inkl. dispy)</i>
|
||||
Vier <img src="doc/img/editor_vier.png" alt="vier.png" style="padding-left: 44px; vertical-align:middle;">
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
166
doc/themes.md
166
doc/themes.md
|
@ -17,7 +17,7 @@ The below for a more detailed description of theme heritage.
|
|||
|
||||
Some themes also allow users to select *variants* of the theme.
|
||||
Those theme variants most often contain an additional [CSS](https://en.wikipedia.org/wiki/CSS) file to override some styling of the default theme values.
|
||||
From the themes in the main repository *duepunto zero* and *vier* are using this methods for variations.
|
||||
From the themes in the main repository *vier* and *vier* are using this methods for variations.
|
||||
Quattro is using a slightly different approach.
|
||||
|
||||
Third you can start your theme from scratch.
|
||||
|
@ -60,145 +60,6 @@ they will be overwritten by files in
|
|||
|
||||
/view/theme/**your-theme-name**/js.
|
||||
|
||||
## Expand an existing Theme
|
||||
|
||||
### Theme Variations
|
||||
|
||||
Many themes are more *theme families* than only one theme.
|
||||
*duepunto zero* and *vier* allow easily to add new theme variation.
|
||||
We will go through the process of creating a new variation for *duepunto zero*.
|
||||
The same (well almost, some names change) procedure applies to the *vier* theme.
|
||||
And similar steps are needed for *quattro* but this theme is using [lesscss](http://lesscss.org/#docs) to maintain the CSS files..
|
||||
|
||||
In
|
||||
|
||||
/view/theme/duepuntozero/deriv
|
||||
|
||||
you find a couple of CSS files that define color derivations from the duepunto theme.
|
||||
These resemble some of the now as unsupported marked themes, that were inherited by the duepunto theme.
|
||||
Darkzero and Easter Bunny for example.
|
||||
|
||||
The selection of the colorset is done in a combination of a template for a new form in the settings and aome functions in the theme.php file.
|
||||
The template (theme_settings.tpl)
|
||||
|
||||
{{include file="field_select.tpl" field=$colorset}}
|
||||
<div class="settings-submit-wrapper">
|
||||
<input type="submit" value="{{$submit}}" class="settings-submit" name="duepuntozero-settings-submit" />
|
||||
</div>
|
||||
|
||||
defines a formular consisting of a [select](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select) pull-down which contains all aviable variants and s submit button.
|
||||
See the documentation about [SMARTY3 templates](/help/snarty3-templates.md) for a summary of friendica specific blocks other than the select element.
|
||||
But we don't really need to change anything at the template itself.
|
||||
|
||||
The template alone wont work though.
|
||||
You make friendica aware of its existance and tell it how to use the template file, by defining a config.php file.
|
||||
It needs to define at least the following functions
|
||||
|
||||
* theme_content
|
||||
* theme_post
|
||||
|
||||
and may also define functions for the admin interface
|
||||
|
||||
* theme_admin
|
||||
* theme_admin_post.
|
||||
|
||||
theme_content and theme_admin are used to make the form available in the settings, repectively the admin panel.
|
||||
The _post functions handle the processing of the send form, in this case they save to selected variand in friendicas database.
|
||||
|
||||
To make your own variation appear in the menu, all you need to do is to create a new CSS file in the deriv directoy and include it in the array in the config.php:
|
||||
|
||||
$colorset = array(
|
||||
'default'=>DI::l10n()->t('default'),
|
||||
'greenzero'=>DI::l10n()->t('greenzero'),
|
||||
'purplezero'=>DI::l10n()->t('purplezero'),
|
||||
'easterbunny'=>DI::l10n()->t('easterbunny'),
|
||||
'darkzero'=>DI::l10n()->t('darkzero'),
|
||||
'comix'=>DI::l10n()->t('comix'),
|
||||
'slackr'=>DI::l10n()->t('slackr'),
|
||||
);
|
||||
|
||||
the 1st part of the line is the name of the CSS file (without the .css) the 2nd part is the common name of the variant.
|
||||
Calling the DI::l10n()->t() function with the common name makes the string translateable.
|
||||
The selected 1st part will be saved in the database by the theme_post function.
|
||||
|
||||
function theme_post(App $a){
|
||||
// non local users shall not pass
|
||||
if (! local_user()) {
|
||||
return;
|
||||
}
|
||||
// if the one specific submit button was pressed then proceed
|
||||
if (isset($_POST['duepuntozero-settings-submit'])){
|
||||
// and save the selection key into the personal config of the user
|
||||
DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
|
||||
}
|
||||
}
|
||||
|
||||
Now that this information is set in the database, what should friendica do with it?
|
||||
For this, have a look at the theme.php file of the *duepunto zero*.
|
||||
There you'll find somethink alike
|
||||
|
||||
$colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
|
||||
if (!$colorset)
|
||||
$colorset = DI::config()->get('duepuntozero', 'colorset');
|
||||
if ($colorset) {
|
||||
if ($colorset == 'greenzero')
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
|
||||
/* some more variants */
|
||||
}
|
||||
|
||||
which tells friendica to get the personal config of a user.
|
||||
Check if it is set and if not look for the global config.
|
||||
And finally if a config for the colorset was found, apply it by adding a link to the CSS file into the HTML header of the page.
|
||||
So you'll just need to add a if selection, fitting your variant keyword and link to the CSS file of it.
|
||||
|
||||
Done.
|
||||
Now you can use the variant on your system.
|
||||
But remember once the theme.php or the config.php you have to readd your variant to them.
|
||||
If you think your color variation could be benifical for other friendica users as well, feel free to generate a pull request at github so we can include your work into the repository.
|
||||
|
||||
### Inheritation
|
||||
|
||||
Say, you like the duepuntozero but you want to have the content of the outer columns left and right exchanged.
|
||||
That would be not a color variation as shown above.
|
||||
Instead we will create a new theme, duepuntozero_lr, inherit the properties of duepuntozero and make small changes to the underlying php files.
|
||||
|
||||
So create a directory called duepunto_lr and create a file called theme.php with your favorite text editor.
|
||||
The content of this file should be something like
|
||||
|
||||
<?php
|
||||
/* meta informations for the theme, see below */
|
||||
use Friendica\App;
|
||||
|
||||
function duepuntozero_lr_init(App $a) {
|
||||
$a->setThemeInfoValue('extends', 'duepuntozero');
|
||||
|
||||
$a->set_template_engine('smarty3');
|
||||
/* and more stuff e.g. the JavaScript function for the header */
|
||||
}
|
||||
|
||||
Next take the default.php file found in the /view direcotry and exchange the aside and right_aside elements.
|
||||
So the central part of the file now looks like this:
|
||||
|
||||
<body>
|
||||
<?php if(!empty($page['nav'])) echo $page['nav']; ?>
|
||||
<aside><?php if(!empty($page['right_aside'])) echo $page['right_aside']; ?></aside>
|
||||
<section><?php if(!empty($page['content'])) echo $page['content']; ?>
|
||||
<div id="page-footer"></div>
|
||||
</section>
|
||||
<right_aside><?php if(!empty($page['aside'])) echo $page['aside']; ?></right_aside>
|
||||
<footer><?php if(!empty($page['footer'])) echo $page['footer']; ?></footer>
|
||||
</body>
|
||||
|
||||
Finally we need a style.css file, inheriting the definitions from the parent theme and containing out changes for the new theme.
|
||||
***Note***:You need to create the style.css and at lest import the base CSS file from the parent theme.
|
||||
|
||||
@import url('../duepuntozero/style.css');
|
||||
|
||||
Done.
|
||||
But I agree it is not really useful at this state.
|
||||
Nevertheless, to use it, you just need to activate in the admin panel.
|
||||
That done, you can select it in the settings like any other activated theme.
|
||||
|
||||
## Creating a Theme from Scratch
|
||||
|
||||
Keep patient.
|
||||
|
@ -231,15 +92,19 @@ Supported formats are PNG and JPEG.
|
|||
|
||||
This is the main definition file of the theme.
|
||||
In the header of that file, some meta information is stored.
|
||||
For example, have a look at the theme.php of the *quattro* theme:
|
||||
For example, have a look at the theme.php of the *vier* theme:
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Name: Quattro
|
||||
* Version: 0.6
|
||||
* [Licence]
|
||||
*
|
||||
* Name: Vier
|
||||
* Version: 1.2
|
||||
* Author: Fabio <http://kirgroup.com/profile/fabrixxm>
|
||||
* Maintainer: Fabio <http://kirgroup.com/profile/fabrixxm>
|
||||
* Maintainer: Tobias <https://f.diekershoff.de/profile/tobias>
|
||||
* Author: Ike <http://pirati.ca/profile/heluecht>
|
||||
* Author: Beanow <https://fc.oscp.info/profile/beanow>
|
||||
* Maintainer: Ike <http://pirati.ca/profile/heluecht>
|
||||
* Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
|
||||
*/
|
||||
|
||||
You see the definition of the theme's name, it's version and the initial author of the theme.
|
||||
|
@ -255,9 +120,9 @@ This will make our job a little easier, as we don't have to specify the full nam
|
|||
|
||||
The next crucial part of the theme.php file is a definition of an init function.
|
||||
The name of the function is <theme-name>_init.
|
||||
So in the case of quattro it is
|
||||
So in the case of vier it is
|
||||
|
||||
function quattro_init(App $a) {
|
||||
function vier_init(App $a) {
|
||||
$a->theme_info = array();
|
||||
$a->set_template_engine('smarty3');
|
||||
}
|
||||
|
@ -269,12 +134,6 @@ At the moment you should use the *smarty3* engine.
|
|||
There once was a friendica specific templating engine as well but that is not used anymore.
|
||||
If you like to use another templating engine, please implement it.
|
||||
|
||||
When you want to inherit stuff from another theme you have to *announce* this in the theme_info:
|
||||
|
||||
$a->setThemeInfoValue('extends', 'duepuntozero');
|
||||
|
||||
which declares *duepuntozero* as parent of the theme.
|
||||
|
||||
If you want to add something to the HTML header of the theme, one way to do so is by adding it to the theme.php file.
|
||||
To do so, add something alike
|
||||
|
||||
|
@ -282,7 +141,6 @@ To do so, add something alike
|
|||
/* stuff you want to add to the header */
|
||||
EOT;
|
||||
|
||||
The $a variable holds the friendica application.
|
||||
So you can access the properties of this friendica session from the theme.php file as well.
|
||||
|
||||
### default.php
|
||||
|
|
298
mod/cal.php
298
mod/cal.php
|
@ -1,298 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The calendar module
|
||||
*
|
||||
* This calendar is for profile visitors and contains only the events
|
||||
* of the profile owner
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseProfile;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
function cal_init(App $a)
|
||||
{
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc() < 2) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
||||
|
||||
Nav::setSelected('events');
|
||||
|
||||
// if it's a json request abort here becaus we don't
|
||||
// need the widget data
|
||||
if (!empty(DI::args()->getArgv()[2]) && (DI::args()->getArgv()[2] === 'json')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
|
||||
if (empty($owner)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
}
|
||||
|
||||
if (empty(DI::page()['aside'])) {
|
||||
DI::page()['aside'] = '';
|
||||
}
|
||||
|
||||
DI::page()['aside'] .= Widget\VCard::getHTML($owner);
|
||||
DI::page()['aside'] .= Widget\CalendarExport::getHTML($owner['uid']);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function cal_content(App $a)
|
||||
{
|
||||
$owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
|
||||
if (empty($owner)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
}
|
||||
|
||||
Nav::setSelected('events');
|
||||
|
||||
// get the translation strings for the callendar
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.min.css');
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.print.min.css', 'print');
|
||||
DI::page()->registerFooterScript('view/asset/moment/min/moment-with-locales.min.js');
|
||||
DI::page()->registerFooterScript('view/asset/fullcalendar/dist/fullcalendar.min.js');
|
||||
|
||||
$htpl = Renderer::getMarkupTemplate('event_head.tpl');
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
|
||||
'$module_url' => '/cal/' . $owner['nickname'],
|
||||
'$modparams' => 2,
|
||||
'$i18n' => $i18n,
|
||||
]);
|
||||
|
||||
$mode = 'view';
|
||||
$y = 0;
|
||||
$m = 0;
|
||||
$ignored = (!empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0);
|
||||
|
||||
$format = 'ical';
|
||||
if (DI::args()->getArgc() == 4 && DI::args()->getArgv()[2] == 'export') {
|
||||
$mode = 'export';
|
||||
$format = DI::args()->getArgv()[3];
|
||||
}
|
||||
|
||||
// Setup permissions structures
|
||||
$owner_uid = intval($owner['uid']);
|
||||
$nick = $owner['nickname'];
|
||||
|
||||
$contact_id = Session::getRemoteContactID($owner['uid']);
|
||||
|
||||
$remote_contact = $contact_id && DBA::exists('contact', ['id' => $contact_id, 'uid' => $owner['uid']]);
|
||||
|
||||
$is_owner = local_user() == $owner['uid'];
|
||||
|
||||
if ($owner['hidewall'] && !$is_owner && !$remote_contact) {
|
||||
notice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// get the permissions
|
||||
$sql_perms = Item::getPermissionsSQLByUserId($owner_uid);
|
||||
// we only want to have the events of the profile owner
|
||||
$sql_extra = " AND `event`.`cid` = 0 " . $sql_perms;
|
||||
|
||||
// get the tab navigation bar
|
||||
$tabs = BaseProfile::getTabsHTML($a, 'cal', false, $owner['nickname'], $owner['hide-friends']);
|
||||
|
||||
// The view mode part is similiar to /mod/events.php
|
||||
if ($mode == 'view') {
|
||||
$thisyear = DateTimeFormat::localNow('Y');
|
||||
$thismonth = DateTimeFormat::localNow('m');
|
||||
if (!$y) {
|
||||
$y = intval($thisyear);
|
||||
}
|
||||
|
||||
if (!$m) {
|
||||
$m = intval($thismonth);
|
||||
}
|
||||
|
||||
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
|
||||
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
|
||||
|
||||
if ($y < 1901) {
|
||||
$y = 1900;
|
||||
}
|
||||
|
||||
if ($y > 2099) {
|
||||
$y = 2100;
|
||||
}
|
||||
|
||||
$nextyear = $y;
|
||||
$nextmonth = $m + 1;
|
||||
if ($nextmonth > 12) {
|
||||
$nextmonth = 1;
|
||||
$nextyear ++;
|
||||
}
|
||||
|
||||
$prevyear = $y;
|
||||
if ($m > 1) {
|
||||
$prevmonth = $m - 1;
|
||||
} else {
|
||||
$prevmonth = 12;
|
||||
$prevyear --;
|
||||
}
|
||||
|
||||
$dim = Temporal::getDaysInMonth($y, $m);
|
||||
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
|
||||
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
||||
|
||||
|
||||
if (!empty(DI::args()->getArgv()[2]) && (DI::args()->getArgv()[2] === 'json')) {
|
||||
if (!empty($_GET['start'])) {
|
||||
$start = $_GET['start'];
|
||||
}
|
||||
|
||||
if (!empty($_GET['end'])) {
|
||||
$finish = $_GET['end'];
|
||||
}
|
||||
}
|
||||
|
||||
$start = DateTimeFormat::utc($start);
|
||||
$finish = DateTimeFormat::utc($finish);
|
||||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = [
|
||||
'event_id' => intval($_GET['id'] ?? 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'ignore' => $ignored,
|
||||
];
|
||||
|
||||
// get events by id or by date
|
||||
if ($event_params['event_id']) {
|
||||
$r = Event::getListById($owner_uid, $event_params['event_id'], $sql_extra);
|
||||
} else {
|
||||
$r = Event::getListByDate($owner_uid, $event_params, $sql_extra);
|
||||
}
|
||||
|
||||
$links = [];
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
$r = Event::sortByDate($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = DateTimeFormat::local($rr['start'], 'j');
|
||||
if (empty($links[$j])) {
|
||||
$links[$j] = DI::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// transform the event in a usable array
|
||||
$events = Event::prepareListForTemplate($r);
|
||||
|
||||
if (!empty(DI::args()->getArgv()[2]) && (DI::args()->getArgv()[2] === 'json')) {
|
||||
System::jsonExit($events);
|
||||
}
|
||||
|
||||
// links: array('href', 'text', 'extra css classes', 'title')
|
||||
if (!empty($_GET['id'])) {
|
||||
$tpl = Renderer::getMarkupTemplate("event.tpl");
|
||||
} else {
|
||||
$tpl = Renderer::getMarkupTemplate("events_js.tpl");
|
||||
}
|
||||
|
||||
// Get rid of dashes in key names, Smarty3 can't handle them
|
||||
foreach ($events as $key => $event) {
|
||||
$event_item = [];
|
||||
foreach ($event['item'] as $k => $v) {
|
||||
$k = str_replace('-', '_', $k);
|
||||
$event_item[$k] = $v;
|
||||
}
|
||||
$events[$key]['item'] = $event_item;
|
||||
}
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$tabs' => $tabs,
|
||||
'$title' => DI::l10n()->t('Events'),
|
||||
'$view' => DI::l10n()->t('View'),
|
||||
'$previous' => [DI::baseUrl() . "/events/$prevyear/$prevmonth", DI::l10n()->t('Previous'), '', ''],
|
||||
'$next' => [DI::baseUrl() . "/events/$nextyear/$nextmonth", DI::l10n()->t('Next'), '', ''],
|
||||
'$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'),
|
||||
'$events' => $events,
|
||||
"today" => DI::l10n()->t("today"),
|
||||
"month" => DI::l10n()->t("month"),
|
||||
"week" => DI::l10n()->t("week"),
|
||||
"day" => DI::l10n()->t("day"),
|
||||
"list" => DI::l10n()->t("list"),
|
||||
]);
|
||||
|
||||
if (!empty($_GET['id'])) {
|
||||
System::httpExit($o);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
if ($mode == 'export') {
|
||||
if (!$owner_uid) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the export data by uid
|
||||
$evexport = Event::exportListByUserId($owner_uid, $format);
|
||||
|
||||
if (!$evexport["success"]) {
|
||||
if ($evexport["content"]) {
|
||||
notice(DI::l10n()->t('This calendar format is not supported'));
|
||||
} else {
|
||||
notice(DI::l10n()->t('No exportable data found'));
|
||||
}
|
||||
|
||||
// If it the own calendar return to the events page
|
||||
// otherwise to the profile calendar page
|
||||
if (local_user() === $owner_uid) {
|
||||
$return_path = "events";
|
||||
} else {
|
||||
$return_path = "cal/" . $nick;
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
||||
// If nothing went wrong we can echo the export content
|
||||
if ($evexport["success"]) {
|
||||
header('content-disposition: attachment; filename="' . DI::l10n()->t('calendar') . '-' . $nick . '.' . $evexport["extension"] . '"');
|
||||
System::httpExit($evexport["content"], Response::TYPE_BLANK, 'text/calendar');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
371
mod/display.php
371
mod/display.php
|
@ -1,371 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\ActivityPub\Objects;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function display_init(App $a)
|
||||
{
|
||||
if (ActivityPub::isRequest()) {
|
||||
(new Objects(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), $_SERVER, ['guid' => DI::args()->getArgv()[1] ?? null]))->run();
|
||||
}
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nick = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
|
||||
|
||||
$item = null;
|
||||
$item_user = local_user();
|
||||
|
||||
$fields = ['uri-id', 'parent-uri-id', 'author-id', 'author-link', 'body', 'uid', 'guid', 'gravity'];
|
||||
|
||||
// If there is only one parameter, then check if this parameter could be a guid
|
||||
if (DI::args()->getArgc() == 2) {
|
||||
$nick = '';
|
||||
|
||||
// Does the local user have this item?
|
||||
if (local_user()) {
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'uid' => local_user()]);
|
||||
if (DBA::isResult($item)) {
|
||||
$nick = $a->getLoggedInUserNickname();
|
||||
}
|
||||
}
|
||||
|
||||
// Is this item private but could be visible to the remove visitor?
|
||||
if (!DBA::isResult($item) && remote_user()) {
|
||||
$item = Post::selectFirst($fields, ['guid' => DI::args()->getArgv()[1], 'private' => Item::PRIVATE, 'origin' => true]);
|
||||
if (DBA::isResult($item)) {
|
||||
if (!Contact::isFollower(remote_user(), $item['uid'])) {
|
||||
$item = null;
|
||||
} else {
|
||||
$item_user = $item['uid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Is it an item with uid=0?
|
||||
if (!DBA::isResult($item)) {
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]);
|
||||
}
|
||||
} elseif (DI::args()->getArgc() >= 3 && $nick == 'feed-item') {
|
||||
$uri_id = DI::args()->getArgv()[2];
|
||||
if (substr($uri_id, -5) == '.atom') {
|
||||
$uri_id = substr($uri_id, 0, -5);
|
||||
}
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, ['uri-id' => $uri_id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0]);
|
||||
}
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc() >= 3 && $nick == 'feed-item') {
|
||||
displayShowFeed($item['uri-id'], $item['uid'], DI::args()->getArgc() > 3 && DI::args()->getArgv()[3] == 'conversation.atom');
|
||||
}
|
||||
|
||||
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
|
||||
Logger::debug('Directly serving XML', ['uri-id' => $item['uri-id']]);
|
||||
displayShowFeed($item['uri-id'], $item['uid'], false);
|
||||
}
|
||||
|
||||
if ($item['gravity'] != GRAVITY_PARENT) {
|
||||
$parent = Post::selectFirstForUser($item_user, $fields, ['uid' => [0, $item_user], 'uri-id' => $item['parent-uri-id']], ['order' => ['uid' => true]]);
|
||||
$item = $parent ?: $item;
|
||||
}
|
||||
|
||||
$author = display_fetchauthor($item);
|
||||
|
||||
if (\Friendica\Util\Network::isLocalLink($author['url'])) {
|
||||
\Friendica\Model\Profile::load(DI::app(), $author['nick'], false);
|
||||
} else {
|
||||
DI::page()['aside'] = Widget\VCard::getHTML($author);
|
||||
}
|
||||
$a->setProfileOwner($item['uid']);
|
||||
}
|
||||
|
||||
function display_fetchauthor($item)
|
||||
{
|
||||
if (Diaspora::isReshare($item['body'], true)) {
|
||||
$shared = Item::getShareArray($item);
|
||||
if (!empty($shared['profile'])) {
|
||||
$contact = Contact::getByURLForUser($shared['profile'], local_user());
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($contact)) {
|
||||
$contact = Contact::getById($item['author-id']);
|
||||
}
|
||||
|
||||
return $contact;
|
||||
}
|
||||
|
||||
function display_content(App $a, $update = false, $update_uid = 0)
|
||||
{
|
||||
if (DI::config()->get('system','block_public') && !Session::isAuthenticated()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.'));
|
||||
}
|
||||
|
||||
$o = '';
|
||||
|
||||
$item = null;
|
||||
|
||||
$force = (bool)($_REQUEST['force'] ?? false);
|
||||
|
||||
if ($update) {
|
||||
$uri_id = $_REQUEST['uri_id'];
|
||||
$item = Post::selectFirst(['uid', 'parent-uri-id'], ['uri-id' => $uri_id, 'uid' => [0, $update_uid]], ['order' => ['uid' => true]]);
|
||||
if (!empty($item)) {
|
||||
if ($item['uid'] != 0) {
|
||||
$a->setProfileOwner($item['uid']);
|
||||
} else {
|
||||
$a->setProfileOwner($update_uid);
|
||||
}
|
||||
$parent_uri_id = $item['parent-uri-id'];
|
||||
}
|
||||
if (empty($_REQUEST['force'])) {
|
||||
$browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval'));
|
||||
if (!empty($browser_update)) {
|
||||
$update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500));
|
||||
if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) {
|
||||
Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
|
||||
return '';
|
||||
} else {
|
||||
Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger::debug('Forced content update', ['uri-id' => $uri_id, 'uid' => $update_uid]);
|
||||
}
|
||||
} else {
|
||||
$uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0);
|
||||
$parent_uri_id = $uri_id;
|
||||
|
||||
if (DI::args()->getArgc() == 2) {
|
||||
$fields = ['uri-id', 'parent-uri-id', 'uid'];
|
||||
|
||||
if (local_user()) {
|
||||
$condition = ['guid' => DI::args()->getArgv()[1], 'uid' => [0, local_user()]];
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, $condition, ['order' => ['uid' => true]]);
|
||||
if (DBA::isResult($item)) {
|
||||
$uri_id = $item['uri-id'];
|
||||
$parent_uri_id = $item['parent-uri-id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (($parent_uri_id == 0) && remote_user()) {
|
||||
$item = Post::selectFirst($fields, ['guid' => DI::args()->getArgv()[1], 'private' => Item::PRIVATE, 'origin' => true]);
|
||||
if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) {
|
||||
$uri_id = $item['uri-id'];
|
||||
$parent_uri_id = $item['parent-uri-id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($parent_uri_id == 0) {
|
||||
$condition = ['private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => DI::args()->getArgv()[1], 'uid' => 0];
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, $condition);
|
||||
if (DBA::isResult($item)) {
|
||||
$uri_id = $item['uri-id'];
|
||||
$parent_uri_id = $item['parent-uri-id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($item)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.'));
|
||||
}
|
||||
|
||||
if (!DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
|
||||
DI::notification()->setAllSeenForUser(local_user(), ['parent-uri-id' => $item['parent-uri-id']]);
|
||||
DI::notify()->setAllSeenForUser(local_user(), ['parent-uri-id' => $item['parent-uri-id']]);
|
||||
}
|
||||
|
||||
// We are displaying an "alternate" link if that post was public. See issue 2864
|
||||
$is_public = Post::exists(['uri-id' => $uri_id, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
|
||||
if ($is_public) {
|
||||
// For the atom feed the nickname doesn't matter at all, we only need the item id.
|
||||
$alternate = DI::baseUrl().'/display/feed-item/'.$uri_id.'.atom';
|
||||
$conversation = DI::baseUrl().'/display/feed-item/' . $parent_uri_id . '/conversation.atom';
|
||||
} else {
|
||||
$alternate = '';
|
||||
$conversation = '';
|
||||
}
|
||||
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'),
|
||||
['$alternate' => $alternate,
|
||||
'$conversation' => $conversation]);
|
||||
|
||||
$is_remote_contact = false;
|
||||
$item_uid = local_user();
|
||||
$page_uid = 0;
|
||||
|
||||
$parent = null;
|
||||
if (!local_user() && !empty($parent_uri_id)) {
|
||||
$parent = Post::selectFirst(['uid'], ['uri-id' => $parent_uri_id, 'wall' => true]);
|
||||
}
|
||||
|
||||
if (DBA::isResult($parent)) {
|
||||
$page_uid = $page_uid ?? 0 ?: $parent['uid'];
|
||||
$is_remote_contact = Session::getRemoteContactID($page_uid);
|
||||
if ($is_remote_contact) {
|
||||
$item_uid = $parent['uid'];
|
||||
}
|
||||
} else {
|
||||
$page_uid = $item['uid'];
|
||||
}
|
||||
|
||||
if (!empty($page_uid) && ($page_uid != local_user())) {
|
||||
$page_user = User::getById($page_uid);
|
||||
}
|
||||
|
||||
$is_owner = local_user() && (in_array($page_uid, [local_user(), 0]));
|
||||
|
||||
if (!empty($page_user['hidewall']) && !$is_owner && !$is_remote_contact) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
}
|
||||
|
||||
// We need the editor here to be able to reshare an item.
|
||||
if ($is_owner && !$update) {
|
||||
$o .= DI::conversation()->statusEditor([], 0, true);
|
||||
}
|
||||
$sql_extra = Item::getPermissionsSQLByUserId($page_uid);
|
||||
|
||||
if (local_user() && (local_user() == $page_uid)) {
|
||||
$condition = ['parent-uri-id' => $parent_uri_id, 'uid' => local_user(), 'unseen' => true];
|
||||
$unseen = Post::exists($condition);
|
||||
} else {
|
||||
$unseen = false;
|
||||
}
|
||||
|
||||
if ($update && !$unseen && !$force) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$condition = ["`uri-id` = ? AND `uid` IN (0, ?) " . $sql_extra, $uri_id, $item_uid];
|
||||
$fields = ['parent-uri-id', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', 'owner-id', 'contact-id'];
|
||||
$item = Post::selectFirstForUser($page_uid, $fields, $condition);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.'));
|
||||
}
|
||||
|
||||
$item['uri-id'] = $item['parent-uri-id'];
|
||||
|
||||
if ($unseen) {
|
||||
$condition = ['parent-uri-id' => $parent_uri_id, 'uid' => local_user(), 'unseen' => true];
|
||||
Item::update(['unseen' => false], $condition);
|
||||
}
|
||||
|
||||
if (!$update && local_user()) {
|
||||
$o .= "<script> var netargs = '?uri_id=" . $item['uri-id'] . "'; </script>";
|
||||
}
|
||||
|
||||
$o .= DI::conversation()->create([$item], 'display', $update_uid, false, 'commented', $item_uid);
|
||||
|
||||
// Preparing the meta header
|
||||
$description = trim(BBCode::toPlaintext($item['body']));
|
||||
$title = trim(BBCode::toPlaintext($item['title'] ?? ''));
|
||||
$author_name = $item['author-name'];
|
||||
|
||||
$image = DI::baseUrl()->remove($item['author-avatar']);
|
||||
|
||||
if ($title == '') {
|
||||
$title = $author_name;
|
||||
}
|
||||
|
||||
// Limit the description to 160 characters
|
||||
if (strlen($description) > 160) {
|
||||
$description = substr($description, 0, 157) . '...';
|
||||
}
|
||||
|
||||
$description = htmlspecialchars($description, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
||||
$title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
||||
$author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
|
||||
|
||||
$page = DI::page();
|
||||
|
||||
if (DBA::exists('contact', ['unsearchable' => true, 'id' => [$item['contact-id'], $item['author-id'], $item['owner-id']]])) {
|
||||
$page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
|
||||
}
|
||||
|
||||
DI::page()['htmlhead'] .= '<meta name="author" content="'.$author_name.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="title" content="'.$title.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="fulltitle" content="'.$title.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="description" content="'.$description.'" />'."\n";
|
||||
|
||||
// Schema.org microdata
|
||||
$page['htmlhead'] .= '<meta itemprop="name" content="'.$title.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta itemprop="description" content="'.$description.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta itemprop="image" content="'.$image.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta itemprop="author" content="'.$author_name.'" />'."\n";
|
||||
|
||||
// Twitter cards
|
||||
$page['htmlhead'] .= '<meta name="twitter:card" content="summary" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="twitter:image" content="'.DI::baseUrl().'/'.$image.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="twitter:url" content="'.$item["plink"].'" />'."\n";
|
||||
|
||||
// Dublin Core
|
||||
$page['htmlhead'] .= '<meta name="DC.title" content="'.$title.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="DC.description" content="'.$description.'" />'."\n";
|
||||
|
||||
// Open Graph
|
||||
$page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n";
|
||||
$page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta property="og:image" content="'.DI::baseUrl().'/'.$image.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta property="og:url" content="'.$item["plink"].'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n";
|
||||
$page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";
|
||||
// article:tag
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
function displayShowFeed(int $uri_id, int $uid, bool $conversation)
|
||||
{
|
||||
$xml = DFRN::itemFeed($uri_id, $uid, $conversation);
|
||||
if ($xml == '') {
|
||||
throw new HTTPException\InternalServerErrorException(DI::l10n()->t('The feed for this item is unavailable.'));
|
||||
}
|
||||
|
||||
System::httpExit($xml, Response::TYPE_ATOM);
|
||||
}
|
166
mod/editpost.php
166
mod/editpost.php
|
@ -1,166 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Crypto;
|
||||
|
||||
function editpost_content(App $a)
|
||||
{
|
||||
$o = '';
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
|
||||
|
||||
if (!$post_id) {
|
||||
notice(DI::l10n()->t('Item not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
||||
'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'];
|
||||
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
notice(DI::l10n()->t('Item not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getById(local_user());
|
||||
|
||||
$geotag = '';
|
||||
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"), [
|
||||
'$title' => DI::l10n()->t('Edit post')
|
||||
]);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$ispublic' => ' ', // DI::l10n()->t('Visible to <strong>everybody</strong>'),
|
||||
'$geotag' => $geotag,
|
||||
'$nickname' => $a->getLoggedInUserNickname(),
|
||||
'$is_mobile' => DI::mode()->isMobile(),
|
||||
]);
|
||||
|
||||
if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
|
||||
$lockstate = 'lock';
|
||||
} else {
|
||||
$lockstate = 'unlock';
|
||||
}
|
||||
|
||||
$jotplugins = '';
|
||||
$jotnets = '';
|
||||
|
||||
Hook::callAll('jot_tool', $jotplugins);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('jot.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$is_edit' => true,
|
||||
'$return_path' => '/display/' . $item['guid'],
|
||||
'$action' => 'item',
|
||||
'$share' => DI::l10n()->t('Save'),
|
||||
'$loading' => DI::l10n()->t('Loading...'),
|
||||
'$upload' => DI::l10n()->t('Upload photo'),
|
||||
'$shortupload' => DI::l10n()->t('upload photo'),
|
||||
'$attach' => DI::l10n()->t('Attach file'),
|
||||
'$shortattach' => DI::l10n()->t('attach file'),
|
||||
'$weblink' => DI::l10n()->t('Insert web link'),
|
||||
'$shortweblink' => DI::l10n()->t('web link'),
|
||||
'$video' => DI::l10n()->t('Insert video link'),
|
||||
'$shortvideo' => DI::l10n()->t('video link'),
|
||||
'$audio' => DI::l10n()->t('Insert audio link'),
|
||||
'$shortaudio' => DI::l10n()->t('audio link'),
|
||||
'$setloc' => DI::l10n()->t('Set your location'),
|
||||
'$shortsetloc' => DI::l10n()->t('set location'),
|
||||
'$noloc' => DI::l10n()->t('Clear browser location'),
|
||||
'$shortnoloc' => DI::l10n()->t('clear location'),
|
||||
'$wait' => DI::l10n()->t('Please wait'),
|
||||
'$permset' => DI::l10n()->t('Permission settings'),
|
||||
'$wall' => $item['wall'],
|
||||
'$posttype' => $item['post-type'],
|
||||
'$content' => undo_post_tagging($item['body']),
|
||||
'$post_id' => $post_id,
|
||||
'$defloc' => $user['default-location'],
|
||||
'$visitor' => 'none',
|
||||
'$pvisit' => 'none',
|
||||
'$emailcc' => DI::l10n()->t('CC: email addresses'),
|
||||
'$public' => DI::l10n()->t('Public post'),
|
||||
'$jotnets' => $jotnets,
|
||||
'$title' => $item['title'],
|
||||
'$placeholdertitle' => DI::l10n()->t('Set title'),
|
||||
'$category' => Post\Category::getCSVByURIId($item['uri-id'], local_user(), Post\Category::CATEGORY),
|
||||
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : ''),
|
||||
'$emtitle' => DI::l10n()->t('Example: bob@example.com, mary@example.com'),
|
||||
'$lockstate' => $lockstate,
|
||||
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
|
||||
'$bang' => ($lockstate === 'lock' ? '!' : ''),
|
||||
'$profile_uid' => $_SESSION['uid'],
|
||||
'$preview' => DI::l10n()->t('Preview'),
|
||||
'$jotplugins' => $jotplugins,
|
||||
'$cancel' => DI::l10n()->t('Cancel'),
|
||||
'$rand_num' => Crypto::randomDigits(12),
|
||||
|
||||
// Formatting button labels
|
||||
'$edbold' => DI::l10n()->t('Bold'),
|
||||
'$editalic' => DI::l10n()->t('Italic'),
|
||||
'$eduline' => DI::l10n()->t('Underline'),
|
||||
'$edquote' => DI::l10n()->t('Quote'),
|
||||
'$edcode' => DI::l10n()->t('Code'),
|
||||
'$edurl' => DI::l10n()->t('Link'),
|
||||
'$edattach' => DI::l10n()->t('Link or Media'),
|
||||
|
||||
//jot nav tab (used in some themes)
|
||||
'$message' => DI::l10n()->t('Message'),
|
||||
'$browser' => DI::l10n()->t('Browser'),
|
||||
'$shortpermset' => DI::l10n()->t('Permissions'),
|
||||
|
||||
'$compose_link_title' => DI::l10n()->t('Open Compose page'),
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
function undo_post_tagging($s) {
|
||||
$matches = null;
|
||||
$cnt = preg_match_all('/([!#@])\[url=(.*?)\](.*?)\[\/url\]/ism', $s, $matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
if (in_array($mtch[1], ['!', '@'])) {
|
||||
$contact = Contact::getByURL($mtch[2], false, ['addr']);
|
||||
$mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
|
||||
}
|
||||
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
}
|
539
mod/events.php
539
mod/events.php
|
@ -1,539 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The events module
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Widget\CalendarExport;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseProfile;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
function events_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty(DI::page()['aside'])) {
|
||||
DI::page()['aside'] = '';
|
||||
}
|
||||
|
||||
$cal_widget = CalendarExport::getHTML(local_user());
|
||||
|
||||
DI::page()['aside'] .= $cal_widget;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function events_post(App $a)
|
||||
{
|
||||
Logger::debug('post', ['request' => $_REQUEST]);
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$event_id = !empty($_POST['event_id']) ? intval($_POST['event_id']) : 0;
|
||||
$cid = !empty($_POST['cid']) ? intval($_POST['cid']) : 0;
|
||||
$uid = local_user();
|
||||
|
||||
$start_text = Strings::escapeHtml($_REQUEST['start_text'] ?? '');
|
||||
$finish_text = Strings::escapeHtml($_REQUEST['finish_text'] ?? '');
|
||||
|
||||
$nofinish = intval($_POST['nofinish'] ?? 0);
|
||||
|
||||
$share = intval($_POST['share'] ?? 0);
|
||||
|
||||
// The default setting for the `private` field in event_store() is false, so mirror that
|
||||
$private_event = false;
|
||||
|
||||
$start = DBA::NULL_DATETIME;
|
||||
$finish = DBA::NULL_DATETIME;
|
||||
|
||||
if ($start_text) {
|
||||
$start = $start_text;
|
||||
}
|
||||
|
||||
if ($finish_text) {
|
||||
$finish = $finish_text;
|
||||
}
|
||||
|
||||
$start = DateTimeFormat::convert($start, 'UTC', $a->getTimeZone());
|
||||
if (!$nofinish) {
|
||||
$finish = DateTimeFormat::convert($finish, 'UTC', $a->getTimeZone());
|
||||
}
|
||||
|
||||
// Don't allow the event to finish before it begins.
|
||||
// It won't hurt anything, but somebody will file a bug report
|
||||
// and we'll waste a bunch of time responding to it. Time that
|
||||
// could've been spent doing something else.
|
||||
|
||||
$summary = trim($_POST['summary'] ?? '');
|
||||
$desc = trim($_POST['desc'] ?? '');
|
||||
$location = trim($_POST['location'] ?? '');
|
||||
$type = 'event';
|
||||
|
||||
$params = [
|
||||
'summary' => $summary,
|
||||
'description' => $desc,
|
||||
'location' => $location,
|
||||
'start' => $start_text,
|
||||
'finish' => $finish_text,
|
||||
'nofinish' => $nofinish,
|
||||
];
|
||||
|
||||
$action = ($event_id == '') ? 'new' : 'event/' . $event_id;
|
||||
$onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
|
||||
|
||||
if (strcmp($finish, $start) < 0 && !$nofinish) {
|
||||
notice(DI::l10n()->t('Event can not end before it has started.'));
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
System::httpExit(DI::l10n()->t('Event can not end before it has started.'));
|
||||
}
|
||||
DI::baseUrl()->redirect($onerror_path);
|
||||
}
|
||||
|
||||
if (!$summary || ($start === DBA::NULL_DATETIME)) {
|
||||
notice(DI::l10n()->t('Event title and start time are required.'));
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
System::httpExit(DI::l10n()->t('Event title and start time are required.'));
|
||||
}
|
||||
DI::baseUrl()->redirect($onerror_path);
|
||||
}
|
||||
|
||||
$self = \Friendica\Model\Contact::getPublicIdByUserId($uid);
|
||||
|
||||
$aclFormatter = DI::aclFormatter();
|
||||
|
||||
if ($share) {
|
||||
$user = User::getById($uid, ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);
|
||||
if (!DBA::isResult($user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$str_contact_allow = isset($_REQUEST['contact_allow']) ? $aclFormatter->toString($_REQUEST['contact_allow']) : $user['allow_cid'] ?? '';
|
||||
$str_group_allow = isset($_REQUEST['group_allow']) ? $aclFormatter->toString($_REQUEST['group_allow']) : $user['allow_gid'] ?? '';
|
||||
$str_contact_deny = isset($_REQUEST['contact_deny']) ? $aclFormatter->toString($_REQUEST['contact_deny']) : $user['deny_cid'] ?? '';
|
||||
$str_group_deny = isset($_REQUEST['group_deny']) ? $aclFormatter->toString($_REQUEST['group_deny']) : $user['deny_gid'] ?? '';
|
||||
|
||||
$visibility = $_REQUEST['visibility'] ?? '';
|
||||
if ($visibility === 'public') {
|
||||
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
||||
$str_contact_allow = $str_group_allow = $str_contact_deny = $str_group_deny = '';
|
||||
} else if ($visibility === 'custom') {
|
||||
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
||||
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
||||
// See https://github.com/friendica/friendica/issues/9672
|
||||
$str_contact_allow .= $aclFormatter->toString($self);
|
||||
}
|
||||
} else {
|
||||
$str_contact_allow = $aclFormatter->toString($self);
|
||||
$str_group_allow = $str_contact_deny = $str_group_deny = '';
|
||||
}
|
||||
|
||||
// Make sure to set the `private` field as true. This is necessary to
|
||||
// have the posts show up correctly in Diaspora if an event is created
|
||||
// as visible only to self at first, but then edited to display to others.
|
||||
if (strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) {
|
||||
$private_event = true;
|
||||
}
|
||||
|
||||
$datarray = [];
|
||||
$datarray['start'] = $start;
|
||||
$datarray['finish'] = $finish;
|
||||
$datarray['summary'] = $summary;
|
||||
$datarray['desc'] = $desc;
|
||||
$datarray['location'] = $location;
|
||||
$datarray['type'] = $type;
|
||||
$datarray['nofinish'] = $nofinish;
|
||||
$datarray['uid'] = $uid;
|
||||
$datarray['cid'] = $cid;
|
||||
$datarray['allow_cid'] = $str_contact_allow;
|
||||
$datarray['allow_gid'] = $str_group_allow;
|
||||
$datarray['deny_cid'] = $str_contact_deny;
|
||||
$datarray['deny_gid'] = $str_group_deny;
|
||||
$datarray['private'] = $private_event;
|
||||
$datarray['id'] = $event_id;
|
||||
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
System::httpExit(Event::getHTML($datarray));
|
||||
}
|
||||
|
||||
$event_id = Event::store($datarray);
|
||||
|
||||
$item = ['network' => Protocol::DFRN, 'protocol' => Conversation::PARCEL_DIRECT, 'direction' => Conversation::PUSH];
|
||||
$item = Event::getItemArrayForId($event_id, $item);
|
||||
if (Item::insert($item)) {
|
||||
$uri_id = $item['uri-id'];
|
||||
} else {
|
||||
$uri_id = 0;
|
||||
}
|
||||
|
||||
if (!$cid && $uri_id) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('events');
|
||||
}
|
||||
|
||||
function events_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc() == 1) {
|
||||
$_SESSION['return_path'] = DI::args()->getCommand();
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'ignore') && intval(DI::args()->getArgv()[2])) {
|
||||
DBA::update('event', ['ignore' => true], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[1] === 'unignore') && intval(DI::args()->getArgv()[2])) {
|
||||
DBA::update('event', ['ignore' => false], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
|
||||
}
|
||||
|
||||
if ($a->getThemeInfoValue('events_in_profile')) {
|
||||
Nav::setSelected('home');
|
||||
} else {
|
||||
Nav::setSelected('events');
|
||||
}
|
||||
|
||||
// get the translation strings for the callendar
|
||||
$i18n = Event::getStrings();
|
||||
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.min.css');
|
||||
DI::page()->registerStylesheet('view/asset/fullcalendar/dist/fullcalendar.print.min.css', 'print');
|
||||
DI::page()->registerFooterScript('view/asset/moment/min/moment-with-locales.min.js');
|
||||
DI::page()->registerFooterScript('view/asset/fullcalendar/dist/fullcalendar.min.js');
|
||||
|
||||
$htpl = Renderer::getMarkupTemplate('event_head.tpl');
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
|
||||
'$module_url' => '/events',
|
||||
'$modparams' => 1,
|
||||
'$i18n' => $i18n,
|
||||
]);
|
||||
|
||||
$o = '';
|
||||
$tabs = '';
|
||||
// tabs
|
||||
if ($a->getThemeInfoValue('events_in_profile')) {
|
||||
$tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->getLoggedInUserNickname(), false);
|
||||
}
|
||||
|
||||
$mode = 'view';
|
||||
$y = 0;
|
||||
$m = 0;
|
||||
$ignored = !empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0;
|
||||
|
||||
if (DI::args()->getArgc() > 1) {
|
||||
if (DI::args()->getArgc() > 2 && DI::args()->getArgv()[1] == 'event') {
|
||||
$mode = 'edit';
|
||||
$event_id = intval(DI::args()->getArgv()[2]);
|
||||
}
|
||||
if (DI::args()->getArgc() > 2 && DI::args()->getArgv()[1] == 'drop') {
|
||||
$mode = 'drop';
|
||||
$event_id = intval(DI::args()->getArgv()[2]);
|
||||
}
|
||||
if (DI::args()->getArgc() > 2 && DI::args()->getArgv()[1] == 'copy') {
|
||||
$mode = 'copy';
|
||||
$event_id = intval(DI::args()->getArgv()[2]);
|
||||
}
|
||||
if (DI::args()->getArgv()[1] === 'new') {
|
||||
$mode = 'new';
|
||||
$event_id = 0;
|
||||
}
|
||||
if (DI::args()->getArgc() > 2 && intval(DI::args()->getArgv()[1]) && intval(DI::args()->getArgv()[2])) {
|
||||
$mode = 'view';
|
||||
$y = intval(DI::args()->getArgv()[1]);
|
||||
$m = intval(DI::args()->getArgv()[2]);
|
||||
}
|
||||
}
|
||||
|
||||
// The view mode part is similiar to /mod/cal.php
|
||||
if ($mode == 'view') {
|
||||
$thisyear = DateTimeFormat::localNow('Y');
|
||||
$thismonth = DateTimeFormat::localNow('m');
|
||||
if (!$y) {
|
||||
$y = intval($thisyear);
|
||||
}
|
||||
if (!$m) {
|
||||
$m = intval($thismonth);
|
||||
}
|
||||
|
||||
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
|
||||
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
|
||||
|
||||
if ($y < 1901) {
|
||||
$y = 1900;
|
||||
}
|
||||
if ($y > 2099) {
|
||||
$y = 2100;
|
||||
}
|
||||
|
||||
$dim = Temporal::getDaysInMonth($y, $m);
|
||||
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
|
||||
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
||||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = [
|
||||
'event_id' => intval($_GET['id'] ?? 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'ignore' => $ignored,
|
||||
];
|
||||
|
||||
// get events by id or by date
|
||||
if ($event_params['event_id']) {
|
||||
$r = Event::getListById(local_user(), $event_params['event_id']);
|
||||
} else {
|
||||
$r = Event::getListByDate(local_user(), $event_params);
|
||||
}
|
||||
|
||||
$links = [];
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
$r = Event::sortByDate($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = DateTimeFormat::local($rr['start'], 'j');
|
||||
if (empty($links[$j])) {
|
||||
$links[$j] = DI::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$events = [];
|
||||
|
||||
// transform the event in a usable array
|
||||
if (DBA::isResult($r)) {
|
||||
$r = Event::sortByDate($r);
|
||||
$events = Event::prepareListForTemplate($r);
|
||||
}
|
||||
|
||||
if (!empty($_GET['id'])) {
|
||||
$tpl = Renderer::getMarkupTemplate("event.tpl");
|
||||
} else {
|
||||
$tpl = Renderer::getMarkupTemplate("events_js.tpl");
|
||||
}
|
||||
|
||||
// Get rid of dashes in key names, Smarty3 can't handle them
|
||||
foreach ($events as $key => $event) {
|
||||
$event_item = [];
|
||||
foreach ($event['item'] as $k => $v) {
|
||||
$k = str_replace('-', '_', $k);
|
||||
$event_item[$k] = $v;
|
||||
}
|
||||
$events[$key]['item'] = $event_item;
|
||||
}
|
||||
|
||||
// ACL blocks are loaded in modals in frio
|
||||
DI::page()->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js'));
|
||||
DI::page()->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js'));
|
||||
DI::page()->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
|
||||
DI::page()->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$tabs' => $tabs,
|
||||
'$title' => DI::l10n()->t('Events'),
|
||||
'$view' => DI::l10n()->t('View'),
|
||||
'$new_event' => [DI::baseUrl() . '/events/new', DI::l10n()->t('Create New Event'), '', ''],
|
||||
'$previous' => [DI::baseUrl() . '/events/$prevyear/$prevmonth', DI::l10n()->t('Previous'), '', ''],
|
||||
'$next' => [DI::baseUrl() . '/events/$nextyear/$nextmonth', DI::l10n()->t('Next'), '', ''],
|
||||
'$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'),
|
||||
|
||||
'$events' => $events,
|
||||
|
||||
'$today' => DI::l10n()->t('today'),
|
||||
'$month' => DI::l10n()->t('month'),
|
||||
'$week' => DI::l10n()->t('week'),
|
||||
'$day' => DI::l10n()->t('day'),
|
||||
'$list' => DI::l10n()->t('list'),
|
||||
]);
|
||||
|
||||
if (!empty($_GET['id'])) {
|
||||
System::httpExit($o);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
if (($mode === 'edit' || $mode === 'copy') && $event_id) {
|
||||
$orig_event = DBA::selectFirst('event', [], ['id' => $event_id, 'uid' => local_user()]);
|
||||
}
|
||||
|
||||
// Passed parameters overrides anything found in the DB
|
||||
if (in_array($mode, ['edit', 'new', 'copy'])) {
|
||||
$share_checked = '';
|
||||
$share_disabled = '';
|
||||
|
||||
if (empty($orig_event)) {
|
||||
$orig_event = User::getById(local_user(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']);;
|
||||
} elseif ($orig_event['allow_cid'] !== '<' . local_user() . '>'
|
||||
|| $orig_event['allow_gid']
|
||||
|| $orig_event['deny_cid']
|
||||
|| $orig_event['deny_gid']) {
|
||||
$share_checked = ' checked="checked" ';
|
||||
}
|
||||
|
||||
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
|
||||
if (!empty($_REQUEST['nofinish'])) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
||||
if (!empty($_REQUEST['summary'])) {$orig_event['summary'] = $_REQUEST['summary'];}
|
||||
if (!empty($_REQUEST['desc'])) {$orig_event['desc'] = $_REQUEST['desc'];}
|
||||
if (!empty($_REQUEST['location'])) {$orig_event['location'] = $_REQUEST['location'];}
|
||||
if (!empty($_REQUEST['start'])) {$orig_event['start'] = $_REQUEST['start'];}
|
||||
if (!empty($_REQUEST['finish'])) {$orig_event['finish'] = $_REQUEST['finish'];}
|
||||
|
||||
$n_checked = (!empty($orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||
|
||||
$t_orig = $orig_event['summary'] ?? '';
|
||||
$d_orig = $orig_event['desc'] ?? '';
|
||||
$l_orig = $orig_event['location'] ?? '';
|
||||
$eid = $orig_event['id'] ?? 0;
|
||||
$cid = $orig_event['cid'] ?? 0;
|
||||
$uri = $orig_event['uri'] ?? '';
|
||||
|
||||
if ($cid || $mode === 'edit') {
|
||||
$share_disabled = 'disabled="disabled"';
|
||||
}
|
||||
|
||||
$sdt = $orig_event['start'] ?? 'now';
|
||||
$fdt = $orig_event['finish'] ?? 'now';
|
||||
|
||||
$syear = DateTimeFormat::local($sdt, 'Y');
|
||||
$smonth = DateTimeFormat::local($sdt, 'm');
|
||||
$sday = DateTimeFormat::local($sdt, 'd');
|
||||
|
||||
$shour = !empty($orig_event) ? DateTimeFormat::local($sdt, 'H') : '00';
|
||||
$sminute = !empty($orig_event) ? DateTimeFormat::local($sdt, 'i') : '00';
|
||||
|
||||
$fyear = DateTimeFormat::local($fdt, 'Y');
|
||||
$fmonth = DateTimeFormat::local($fdt, 'm');
|
||||
$fday = DateTimeFormat::local($fdt, 'd');
|
||||
|
||||
$fhour = !empty($orig_event) ? DateTimeFormat::local($fdt, 'H') : '00';
|
||||
$fminute = !empty($orig_event) ? DateTimeFormat::local($fdt, 'i') : '00';
|
||||
|
||||
if (!$cid && in_array($mode, ['new', 'copy'])) {
|
||||
$acl = ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), false, ACL::getDefaultUserPermissions($orig_event));
|
||||
} else {
|
||||
$acl = '';
|
||||
}
|
||||
|
||||
// If we copy an old event, we need to remove the ID and URI
|
||||
// from the original event.
|
||||
if ($mode === 'copy') {
|
||||
$eid = 0;
|
||||
$uri = '';
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('event_form.tpl');
|
||||
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$post' => DI::baseUrl() . '/events',
|
||||
'$eid' => $eid,
|
||||
'$cid' => $cid,
|
||||
'$uri' => $uri,
|
||||
|
||||
'$title' => DI::l10n()->t('Event details'),
|
||||
'$desc' => DI::l10n()->t('Starting date and Title are required.'),
|
||||
'$s_text' => DI::l10n()->t('Event Starts:') . ' <span class="required" title="' . DI::l10n()->t('Required') . '">*</span>',
|
||||
'$s_dsel' => Temporal::getDateTimeField(
|
||||
new DateTime(),
|
||||
DateTime::createFromFormat('Y', intval($syear) + 5),
|
||||
DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"),
|
||||
DI::l10n()->t('Event Starts:'),
|
||||
'start_text',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
),
|
||||
'$n_text' => DI::l10n()->t('Finish date/time is not known or not relevant'),
|
||||
'$n_checked' => $n_checked,
|
||||
'$f_text' => DI::l10n()->t('Event Finishes:'),
|
||||
'$f_dsel' => Temporal::getDateTimeField(
|
||||
new DateTime(),
|
||||
DateTime::createFromFormat('Y', intval($fyear) + 5),
|
||||
DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"),
|
||||
DI::l10n()->t('Event Finishes:'),
|
||||
'finish_text',
|
||||
true,
|
||||
true,
|
||||
'start_text'
|
||||
),
|
||||
'$d_text' => DI::l10n()->t('Description:'),
|
||||
'$d_orig' => $d_orig,
|
||||
'$l_text' => DI::l10n()->t('Location:'),
|
||||
'$l_orig' => $l_orig,
|
||||
'$t_text' => DI::l10n()->t('Title:') . ' <span class="required" title="' . DI::l10n()->t('Required') . '">*</span>',
|
||||
'$t_orig' => $t_orig,
|
||||
'$summary' => ['summary', DI::l10n()->t('Title:'), $t_orig, '', '*'],
|
||||
'$sh_text' => DI::l10n()->t('Share this event'),
|
||||
'$share' => ['share', DI::l10n()->t('Share this event'), $share_checked, '', $share_disabled],
|
||||
'$sh_checked' => $share_checked,
|
||||
'$nofinish' => ['nofinish', DI::l10n()->t('Finish date/time is not known or not relevant'), $n_checked],
|
||||
'$preview' => DI::l10n()->t('Preview'),
|
||||
'$acl' => $acl,
|
||||
'$submit' => DI::l10n()->t('Submit'),
|
||||
'$basic' => DI::l10n()->t('Basic'),
|
||||
'$advanced' => DI::l10n()->t('Advanced'),
|
||||
'$permissions' => DI::l10n()->t('Permissions'),
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
// Remove an event from the calendar and its related items
|
||||
if ($mode === 'drop' && $event_id) {
|
||||
$ev = Event::getListById(local_user(), $event_id);
|
||||
|
||||
// Delete only real events (no birthdays)
|
||||
if (DBA::isResult($ev) && $ev[0]['type'] == 'event') {
|
||||
Item::deleteForUser(['id' => $ev[0]['itemid']], local_user());
|
||||
}
|
||||
|
||||
if (Post::exists(['id' => $ev[0]['itemid']])) {
|
||||
notice(DI::l10n()->t('Failed to remove event'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('events');
|
||||
}
|
||||
}
|
160
mod/fbrowser.php
160
mod/fbrowser.php
|
@ -1,160 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Friendica\modules
|
||||
* @subpackage FileBrowser
|
||||
* @author Fabio Comuni <fabrixxm@kirgroup.com>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
* @param App $a
|
||||
* @return string
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
function fbrowser_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
System::exit();
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc() == 1) {
|
||||
System::exit();
|
||||
}
|
||||
|
||||
// Needed to match the correct template in a module that uses a different theme than the user/site/default
|
||||
$theme = Strings::sanitizeFilePathItem($_GET['theme'] ?? '');
|
||||
if ($theme && is_file("view/theme/$theme/config.php")) {
|
||||
$a->setCurrentTheme($theme);
|
||||
}
|
||||
|
||||
$template_file = "filebrowser.tpl";
|
||||
|
||||
$o = '';
|
||||
|
||||
switch (DI::args()->getArgv()[1]) {
|
||||
case "image":
|
||||
$path = ['' => DI::l10n()->t('Photos')];
|
||||
$albums = false;
|
||||
$sql_extra = "";
|
||||
$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
|
||||
|
||||
if (DI::args()->getArgc() == 2) {
|
||||
$photos = DBA::toArray(DBA::p("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = ? AND NOT `photo-type` IN (?, ?)",
|
||||
local_user(),
|
||||
Photo::CONTACT_AVATAR,
|
||||
Photo::CONTACT_BANNER
|
||||
));
|
||||
|
||||
$albums = array_column($photos, 'album');
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc() == 3) {
|
||||
$album = DI::args()->getArgv()[2];
|
||||
$sql_extra = sprintf("AND `album` = '%s' ", DBA::escape($album));
|
||||
$sql_extra2 = "";
|
||||
$path[$album] = $album;
|
||||
}
|
||||
|
||||
$r = DBA::toArray(DBA::p("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`type`) AS `type`,
|
||||
min(`scale`) AS `hiq`, max(`scale`) AS `loq`, ANY_VALUE(`desc`) AS `desc`, ANY_VALUE(`created`) AS `created`
|
||||
FROM `photo` WHERE `uid` = ? $sql_extra AND NOT `photo-type` IN (?, ?)
|
||||
GROUP BY `resource-id` $sql_extra2",
|
||||
local_user(),
|
||||
Photo::CONTACT_AVATAR,
|
||||
Photo::CONTACT_BANNER
|
||||
));
|
||||
|
||||
function _map_files1($rr)
|
||||
{
|
||||
$a = DI::app();
|
||||
$types = Images::supportedTypes();
|
||||
$ext = $types[$rr['type']];
|
||||
$filename_e = $rr['filename'];
|
||||
|
||||
// Take the largest picture that is smaller or equal 640 pixels
|
||||
$photo = Photo::selectFirst(['scale'], ["`resource-id` = ? AND `height` <= ? AND `width` <= ?", $rr['resource-id'], 640, 640], ['order' => ['scale']]);
|
||||
$scale = $photo['scale'] ?? $rr['loq'];
|
||||
|
||||
return [
|
||||
DI::baseUrl() . '/photos/' . $a->getLoggedInUserNickname() . '/image/' . $rr['resource-id'],
|
||||
$filename_e,
|
||||
DI::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext,
|
||||
$rr['desc']
|
||||
];
|
||||
}
|
||||
$files = array_map("_map_files1", $r);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate($template_file);
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$type' => 'image',
|
||||
'$path' => $path,
|
||||
'$folders' => $albums,
|
||||
'$files' => $files,
|
||||
'$cancel' => DI::l10n()->t('Cancel'),
|
||||
'$nickname' => $a->getLoggedInUserNickname(),
|
||||
'$upload' => DI::l10n()->t('Upload')
|
||||
]);
|
||||
|
||||
break;
|
||||
case "file":
|
||||
if (DI::args()->getArgc()==2) {
|
||||
$files = DBA::selectToArray('attach', ['id', 'filename', 'filetype'], ['uid' => local_user()]);
|
||||
|
||||
function _map_files2($rr)
|
||||
{
|
||||
list($m1, $m2) = explode("/", $rr['filetype']);
|
||||
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
|
||||
$filename_e = $rr['filename'];
|
||||
|
||||
return [DI::baseUrl() . '/attach/' . $rr['id'], $filename_e, DI::baseUrl() . '/images/icons/16/' . $filetype . '.png'];
|
||||
}
|
||||
$files = array_map("_map_files2", $files);
|
||||
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate($template_file);
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$type' => 'file',
|
||||
'$path' => ['' => DI::l10n()->t('Files')],
|
||||
'$folders' => false,
|
||||
'$files' => $files,
|
||||
'$cancel' => DI::l10n()->t('Cancel'),
|
||||
'$nickname' => $a->getLoggedInUserNickname(),
|
||||
'$upload' => DI::l10n()->t('Upload')
|
||||
]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($_GET['mode'])) {
|
||||
return $o;
|
||||
} else {
|
||||
System::httpExit($o);
|
||||
}
|
||||
}
|
210
mod/follow.php
210
mod/follow.php
|
@ -1,210 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function follow_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['cancel'])) {
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
|
||||
$url = Probe::cleanURI($_REQUEST['url']);
|
||||
|
||||
follow_process($a, $url);
|
||||
}
|
||||
|
||||
function follow_content(App $a)
|
||||
{
|
||||
$return_path = 'contact';
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$uid = local_user();
|
||||
|
||||
$url = Probe::cleanURI(trim($_REQUEST['url'] ?? ''));
|
||||
|
||||
// Issue 6874: Allow remote following from Peertube
|
||||
if (strpos($url, 'acct:') === 0) {
|
||||
$url = str_replace('acct:', '', $url);
|
||||
}
|
||||
|
||||
if (!$url) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
||||
$submit = DI::l10n()->t('Submit Request');
|
||||
|
||||
// Don't try to add a pending contact
|
||||
$user_contact = DBA::selectFirst('contact', ['pending'], ["`uid` = ? AND ((`rel` != ?) OR (`network` = ?)) AND
|
||||
(`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||
$uid, Contact::FOLLOWER, Protocol::DFRN, Strings::normaliseLink($url),
|
||||
Strings::normaliseLink($url), $url, Protocol::STATUSNET]);
|
||||
|
||||
if (DBA::isResult($user_contact)) {
|
||||
if ($user_contact['pending']) {
|
||||
notice(DI::l10n()->t('You already added this contact.'));
|
||||
$submit = '';
|
||||
}
|
||||
}
|
||||
|
||||
$contact = Contact::getByURL($url, true);
|
||||
|
||||
// Possibly it is a mail contact
|
||||
if (empty($contact)) {
|
||||
$contact = Probe::uri($url, Protocol::MAIL, $uid);
|
||||
}
|
||||
|
||||
if (empty($contact) || ($contact['network'] == Protocol::PHANTOM)) {
|
||||
// Possibly it is a remote item and not an account
|
||||
follow_remote_item($url);
|
||||
|
||||
notice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added."));
|
||||
$submit = '';
|
||||
$contact = ['url' => $url, 'network' => Protocol::PHANTOM, 'name' => $url, 'keywords' => ''];
|
||||
}
|
||||
|
||||
$protocol = Contact::getProtocol($contact['url'], $contact['network']);
|
||||
|
||||
if (($protocol == Protocol::DIASPORA) && !DI::config()->get('system', 'diaspora_enabled')) {
|
||||
notice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
}
|
||||
|
||||
if (($protocol == Protocol::OSTATUS) && DI::config()->get('system', 'ostatus_disabled')) {
|
||||
notice(DI::l10n()->t("OStatus support is disabled. Contact can't be added."));
|
||||
$submit = '';
|
||||
}
|
||||
|
||||
if ($protocol == Protocol::MAIL) {
|
||||
$contact['url'] = $contact['addr'];
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['auto'])) {
|
||||
follow_process($a, $contact['url']);
|
||||
}
|
||||
|
||||
$request = DI::baseUrl() . '/follow';
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (empty($owner)) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$myaddr = $owner['url'];
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => DI::l10n()->t('Connect/Follow'),
|
||||
'$pls_answer' => DI::l10n()->t('Please answer the following:'),
|
||||
'$your_address' => DI::l10n()->t('Your Identity Address:'),
|
||||
'$url_label' => DI::l10n()->t('Profile URL'),
|
||||
'$keywords_label'=> DI::l10n()->t('Tags:'),
|
||||
'$submit' => $submit,
|
||||
'$cancel' => DI::l10n()->t('Cancel'),
|
||||
|
||||
'$request' => $request,
|
||||
'$name' => $contact['name'],
|
||||
'$url' => $contact['url'],
|
||||
'$zrl' => Profile::zrl($contact['url']),
|
||||
'$myaddr' => $myaddr,
|
||||
'$keywords' => $contact['keywords'],
|
||||
|
||||
'$does_know_you' => ['knowyou', DI::l10n()->t('%s knows you', $contact['name'])],
|
||||
'$addnote_field' => ['dfrn-request-message', DI::l10n()->t('Add a personal note:')],
|
||||
]);
|
||||
|
||||
DI::page()['aside'] = '';
|
||||
|
||||
if (!in_array($protocol, [Protocol::PHANTOM, Protocol::MAIL])) {
|
||||
DI::page()['aside'] = Widget\VCard::getHTML($contact);
|
||||
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'),
|
||||
['$title' => DI::l10n()->t('Status Messages and Posts')]
|
||||
);
|
||||
|
||||
// Show last public posts
|
||||
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
function follow_process(App $a, string $url)
|
||||
{
|
||||
$return_path = 'follow?url=' . urlencode($url);
|
||||
|
||||
$result = Contact::createFromProbeForUser($a->getLoggedInUserId(), $url);
|
||||
|
||||
if ($result['success'] == false) {
|
||||
// Possibly it is a remote item and not an account
|
||||
follow_remote_item($url);
|
||||
|
||||
if ($result['message']) {
|
||||
notice($result['message']);
|
||||
}
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
} elseif ($result['cid']) {
|
||||
DI::baseUrl()->redirect('contact/' . $result['cid']);
|
||||
}
|
||||
|
||||
notice(DI::l10n()->t('The contact could not be added.'));
|
||||
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
||||
function follow_remote_item($url)
|
||||
{
|
||||
$item_id = Item::fetchByLink($url, local_user());
|
||||
if (!$item_id) {
|
||||
// If the user-specific search failed, we search and probe a public post
|
||||
$item_id = Item::fetchByLink($url);
|
||||
}
|
||||
|
||||
if (!empty($item_id)) {
|
||||
$item = Post::selectFirst(['guid'], ['id' => $item_id]);
|
||||
if (DBA::isResult($item)) {
|
||||
DI::baseUrl()->redirect('display/' . $item['guid']);
|
||||
}
|
||||
}
|
||||
}
|
262
mod/item.php
262
mod/item.php
|
@ -34,8 +34,8 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Attach;
|
||||
|
@ -57,11 +57,11 @@ use Friendica\Util\DateTimeFormat;
|
|||
use Friendica\Util\ParseUrl;
|
||||
|
||||
function item_post(App $a) {
|
||||
if (!Session::isAuthenticated()) {
|
||||
if (!DI::userSession()->isAuthenticated()) {
|
||||
throw new HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
$uid = local_user();
|
||||
$uid = DI::userSession()->getLocalUserId();
|
||||
|
||||
if (!empty($_REQUEST['dropitems'])) {
|
||||
$arr_drop = explode(',', $_REQUEST['dropitems']);
|
||||
|
@ -77,8 +77,6 @@ function item_post(App $a) {
|
|||
|
||||
Logger::debug('postvars', ['_REQUEST' => $_REQUEST]);
|
||||
|
||||
$api_source = $_REQUEST['api_source'] ?? false;
|
||||
|
||||
$return_path = $_REQUEST['return'] ?? '';
|
||||
$preview = intval($_REQUEST['preview'] ?? 0);
|
||||
|
||||
|
@ -90,7 +88,7 @@ function item_post(App $a) {
|
|||
if (!$preview && !empty($_REQUEST['post_id_random'])) {
|
||||
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
|
||||
Logger::warning('duplicate post');
|
||||
item_post_return(DI::baseUrl(), $api_source, $return_path);
|
||||
item_post_return(DI::baseUrl(), $return_path);
|
||||
} else {
|
||||
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
|
||||
}
|
||||
|
@ -106,7 +104,7 @@ function item_post(App $a) {
|
|||
$toplevel_user_id = null;
|
||||
|
||||
$objecttype = null;
|
||||
$profile_uid = ($_REQUEST['profile_uid'] ?? 0) ?: local_user();
|
||||
$profile_uid = DI::userSession()->getLocalUserId();
|
||||
$posttype = ($_REQUEST['post_type'] ?? '') ?: Item::PT_ARTICLE;
|
||||
|
||||
if ($parent_item_id || $thr_parent_uri) {
|
||||
|
@ -122,13 +120,13 @@ function item_post(App $a) {
|
|||
$thr_parent_uri = $parent_item['uri'];
|
||||
$toplevel_item = $parent_item;
|
||||
|
||||
if ($parent_item['gravity'] != GRAVITY_PARENT) {
|
||||
if ($parent_item['gravity'] != Item::GRAVITY_PARENT) {
|
||||
$toplevel_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $toplevel_item['parent']]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!DBA::isResult($toplevel_item)) {
|
||||
notice(DI::l10n()->t('Unable to locate original post.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate original post.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -138,7 +136,7 @@ function item_post(App $a) {
|
|||
// When commenting on a public post then store the post for the current user
|
||||
// This enables interaction like starring and saving into folders
|
||||
if ($toplevel_item['uid'] == 0) {
|
||||
$stored = Item::storeForUserByUriId($toplevel_item['uri-id'], local_user(), ['post-reason' => Item::PR_ACTIVITY]);
|
||||
$stored = Item::storeForUserByUriId($toplevel_item['uri-id'], DI::userSession()->getLocalUserId(), ['post-reason' => Item::PR_ACTIVITY]);
|
||||
Logger::info('Public item stored for user', ['uri-id' => $toplevel_item['uri-id'], 'uid' => $uid, 'stored' => $stored]);
|
||||
if ($stored) {
|
||||
$toplevel_item = Post::selectFirst(Item::ITEM_FIELDLIST, ['id' => $stored]);
|
||||
|
@ -168,17 +166,17 @@ function item_post(App $a) {
|
|||
}
|
||||
|
||||
// Ensure that the user id in a thread always stay the same
|
||||
if (!is_null($toplevel_user_id) && in_array($toplevel_user_id, [local_user(), 0])) {
|
||||
if (!is_null($toplevel_user_id) && in_array($toplevel_user_id, [DI::userSession()->getLocalUserId(), 0])) {
|
||||
$profile_uid = $toplevel_user_id;
|
||||
}
|
||||
|
||||
// Allow commenting if it is an answer to a public post
|
||||
$allow_comment = local_user() && $toplevel_item_id && in_array($toplevel_item['private'], [Item::PUBLIC, Item::UNLISTED]) && in_array($toplevel_item['network'], Protocol::FEDERATED);
|
||||
$allow_comment = DI::userSession()->getLocalUserId() && $toplevel_item_id && in_array($toplevel_item['private'], [Item::PUBLIC, Item::UNLISTED]) && in_array($toplevel_item['network'], Protocol::FEDERATED);
|
||||
|
||||
// Now check that valid personal details have been provided
|
||||
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
|
||||
Logger::warning('Permission denied.', ['local' => local_user(), 'profile_uid' => $profile_uid, 'toplevel_item_id' => $toplevel_item_id, 'network' => $toplevel_item['network']]);
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
Logger::warning('Permission denied.', ['local' => DI::userSession()->getLocalUserId(), 'toplevel_item_id' => $toplevel_item_id, 'network' => $toplevel_item['network']]);
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -241,6 +239,8 @@ function item_post(App $a) {
|
|||
|
||||
$att_bbcode = "\n" . PageInfo::getFooterFromData($attachment);
|
||||
$body .= $att_bbcode;
|
||||
} elseif (preg_match("/\[attachment\](.*?)\[\/attachment\]/ism", $body, $matches)) {
|
||||
$body = preg_replace("/\[attachment].*?\[\/attachment\]/ism", PageInfo::getFooterFromUrl($matches[1]), $body);
|
||||
}
|
||||
|
||||
// Convert links with empty descriptions to links without an explicit description
|
||||
|
@ -307,7 +307,7 @@ function item_post(App $a) {
|
|||
// for non native networks use the network of the original post as network of the item
|
||||
if (($toplevel_item['network'] != Protocol::DIASPORA)
|
||||
&& ($toplevel_item['network'] != Protocol::OSTATUS)
|
||||
&& ($network == "")) {
|
||||
&& ($network == '')) {
|
||||
$network = $toplevel_item['network'];
|
||||
}
|
||||
|
||||
|
@ -322,19 +322,12 @@ function item_post(App $a) {
|
|||
|
||||
$pubmail_enabled = ($_REQUEST['pubmail_enable'] ?? false) && !$private;
|
||||
|
||||
// if using the API, we won't see pubmail_enable - figure out if it should be set
|
||||
if ($api_source && $profile_uid && $profile_uid == local_user() && !$private) {
|
||||
if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
|
||||
$pubmail_enabled = DBA::exists('mailacct', ["`uid` = ? AND `server` != ? AND `pubmail`", local_user(), '']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strlen($body)) {
|
||||
if ($preview) {
|
||||
System::jsonExit(['preview' => '']);
|
||||
}
|
||||
|
||||
notice(DI::l10n()->t('Empty post discarded.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Empty post discarded.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -362,11 +355,11 @@ function item_post(App $a) {
|
|||
$self = false;
|
||||
$contact_id = 0;
|
||||
|
||||
if (local_user() && ((local_user() == $profile_uid) || $allow_comment)) {
|
||||
if (DI::userSession()->getLocalUserId() && ((DI::userSession()->getLocalUserId() == $profile_uid) || $allow_comment)) {
|
||||
$self = true;
|
||||
$author = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
|
||||
} elseif (!empty(Session::getRemoteContactID($profile_uid))) {
|
||||
$author = DBA::selectFirst('contact', [], ['id' => Session::getRemoteContactID($profile_uid)]);
|
||||
$author = DBA::selectFirst('contact', [], ['uid' => DI::userSession()->getLocalUserId(), 'self' => true]);
|
||||
} elseif (!empty(DI::userSession()->getRemoteContactID($profile_uid))) {
|
||||
$author = DBA::selectFirst('contact', [], ['id' => DI::userSession()->getRemoteContactID($profile_uid)]);
|
||||
}
|
||||
|
||||
if (DBA::isResult($author)) {
|
||||
|
@ -374,7 +367,7 @@ function item_post(App $a) {
|
|||
}
|
||||
|
||||
// get contact info for owner
|
||||
if ($profile_uid == local_user() || $allow_comment) {
|
||||
if ($profile_uid == DI::userSession()->getLocalUserId() || $allow_comment) {
|
||||
$contact_record = $author ?: [];
|
||||
} else {
|
||||
$contact_record = DBA::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]) ?: [];
|
||||
|
@ -384,8 +377,8 @@ function item_post(App $a) {
|
|||
if ($posttype != Item::PT_PERSONAL_NOTE) {
|
||||
// Look for any tags and linkify them
|
||||
$item = [
|
||||
'uid' => local_user() ? local_user() : $profile_uid,
|
||||
'gravity' => $toplevel_item_id ? GRAVITY_COMMENT : GRAVITY_PARENT,
|
||||
'uid' => DI::userSession()->getLocalUserId() ? DI::userSession()->getLocalUserId() : $profile_uid,
|
||||
'gravity' => $toplevel_item_id ? Item::GRAVITY_COMMENT : Item::GRAVITY_PARENT,
|
||||
'network' => $network,
|
||||
'body' => $body,
|
||||
'postopts' => $postopts,
|
||||
|
@ -462,7 +455,7 @@ function item_post(App $a) {
|
|||
|
||||
$data = BBCode::getAttachmentData($body);
|
||||
$match = [];
|
||||
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"]))
|
||||
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data['type']))
|
||||
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
|
||||
$posttype = Item::PT_PAGE;
|
||||
$objecttype = Activity\ObjectType::BOOKMARK;
|
||||
|
@ -477,11 +470,11 @@ function item_post(App $a) {
|
|||
$objecttype = Activity\ObjectType::NOTE; // Default value
|
||||
$objectdata = BBCode::getAttachedData($body);
|
||||
|
||||
if ($objectdata["type"] == "link") {
|
||||
if ($objectdata['type'] == 'link') {
|
||||
$objecttype = Activity\ObjectType::BOOKMARK;
|
||||
} elseif ($objectdata["type"] == "video") {
|
||||
} elseif ($objectdata['type'] == 'video') {
|
||||
$objecttype = Activity\ObjectType::VIDEO;
|
||||
} elseif ($objectdata["type"] == "photo") {
|
||||
} elseif ($objectdata['type'] == 'photo') {
|
||||
$objecttype = Activity\ObjectType::IMAGE;
|
||||
}
|
||||
|
||||
|
@ -509,11 +502,11 @@ function item_post(App $a) {
|
|||
$verb = Activity::POST;
|
||||
}
|
||||
|
||||
if ($network == "") {
|
||||
if ($network == '') {
|
||||
$network = Protocol::DFRN;
|
||||
}
|
||||
|
||||
$gravity = ($toplevel_item_id ? GRAVITY_COMMENT : GRAVITY_PARENT);
|
||||
$gravity = ($toplevel_item_id ? Item::GRAVITY_COMMENT : Item::GRAVITY_PARENT);
|
||||
|
||||
// even if the post arrived via API we are considering that it
|
||||
// originated on this site by default for determining relayability.
|
||||
|
@ -532,68 +525,65 @@ function item_post(App $a) {
|
|||
$thr_parent_uri = $uri;
|
||||
}
|
||||
|
||||
$datarray = [];
|
||||
$datarray['uid'] = $profile_uid;
|
||||
$datarray['wall'] = $wall;
|
||||
$datarray['gravity'] = $gravity;
|
||||
$datarray['network'] = $network;
|
||||
$datarray['contact-id'] = $contact_id;
|
||||
$datarray['owner-name'] = $contact_record['name'] ?? '';
|
||||
$datarray['owner-link'] = $contact_record['url'] ?? '';
|
||||
$datarray['owner-avatar'] = $contact_record['thumb'] ?? '';
|
||||
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
|
||||
$datarray['author-name'] = $author['name'];
|
||||
$datarray['author-link'] = $author['url'];
|
||||
$datarray['author-avatar'] = $author['thumb'];
|
||||
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
|
||||
$datarray['created'] = empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'];
|
||||
$datarray['edited'] = $datarray['created'];
|
||||
$datarray['commented'] = $datarray['created'];
|
||||
$datarray['changed'] = $datarray['created'];
|
||||
$datarray['received'] = DateTimeFormat::utcNow();
|
||||
$datarray['extid'] = $extid;
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = $uri;
|
||||
$datarray['title'] = $title;
|
||||
$datarray['body'] = $body;
|
||||
$datarray['app'] = $app;
|
||||
$datarray['location'] = $location;
|
||||
$datarray['coord'] = $coord;
|
||||
$datarray['file'] = $categories;
|
||||
$datarray['inform'] = $inform;
|
||||
$datarray['verb'] = $verb;
|
||||
$datarray['post-type'] = $posttype;
|
||||
$datarray['object-type'] = $objecttype;
|
||||
$datarray['allow_cid'] = $str_contact_allow;
|
||||
$datarray['allow_gid'] = $str_group_allow;
|
||||
$datarray['deny_cid'] = $str_contact_deny;
|
||||
$datarray['deny_gid'] = $str_group_deny;
|
||||
$datarray['private'] = $private;
|
||||
$datarray['pubmail'] = $pubmail_enabled;
|
||||
$datarray['attach'] = $attachments;
|
||||
|
||||
$datarray['thr-parent'] = $thr_parent_uri;
|
||||
|
||||
$datarray['postopts'] = $postopts;
|
||||
$datarray['origin'] = $origin;
|
||||
$datarray['object'] = $object;
|
||||
|
||||
$datarray['attachments'] = $_REQUEST['attachments'] ?? [];
|
||||
|
||||
$datarray = [
|
||||
'uid' => $profile_uid,
|
||||
'wall' => $wall,
|
||||
'gravity' => $gravity,
|
||||
'network' => $network,
|
||||
'contact-id' => $contact_id,
|
||||
'owner-name' => $contact_record['name'] ?? '',
|
||||
'owner-link' => $contact_record['url'] ?? '',
|
||||
'owner-avatar' => $contact_record['thumb'] ?? '',
|
||||
'author-name' => $author['name'],
|
||||
'author-link' => $author['url'],
|
||||
'author-avatar' => $author['thumb'],
|
||||
'created' => empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'],
|
||||
'received' => DateTimeFormat::utcNow(),
|
||||
'extid' => $extid,
|
||||
'guid' => $guid,
|
||||
'uri' => $uri,
|
||||
'title' => $title,
|
||||
'body' => $body,
|
||||
'app' => $app,
|
||||
'location' => $location,
|
||||
'coord' => $coord,
|
||||
'file' => $categories,
|
||||
'inform' => $inform,
|
||||
'verb' => $verb,
|
||||
'post-type' => $posttype,
|
||||
'object-type' => $objecttype,
|
||||
'allow_cid' => $str_contact_allow,
|
||||
'allow_gid' => $str_group_allow,
|
||||
'deny_cid' => $str_contact_deny,
|
||||
'deny_gid' => $str_group_deny,
|
||||
'private' => $private,
|
||||
'pubmail' => $pubmail_enabled,
|
||||
'attach' => $attachments,
|
||||
'thr-parent' => $thr_parent_uri,
|
||||
'postopts' => $postopts,
|
||||
'origin' => $origin,
|
||||
'object' => $object,
|
||||
'attachments' => $_REQUEST['attachments'] ?? [],
|
||||
/*
|
||||
* These fields are for the convenience of addons...
|
||||
* 'self' if true indicates the owner is posting on their own wall
|
||||
* If parent is 0 it is a top-level post.
|
||||
*/
|
||||
$datarray['parent'] = $toplevel_item_id;
|
||||
$datarray['self'] = $self;
|
||||
|
||||
'parent' => $toplevel_item_id,
|
||||
'self' => $self,
|
||||
// This triggers posts via API and the mirror functions
|
||||
$datarray['api_source'] = $api_source;
|
||||
|
||||
'api_source' => false,
|
||||
// This field is for storing the raw conversation data
|
||||
$datarray['protocol'] = Conversation::PARCEL_DIRECT;
|
||||
$datarray['direction'] = Conversation::PUSH;
|
||||
'protocol' => Conversation::PARCEL_DIRECT,
|
||||
'direction' => Conversation::PUSH,
|
||||
];
|
||||
|
||||
// These cannot be part of above initialization ...
|
||||
$datarray['edited'] = $datarray['created'];
|
||||
$datarray['commented'] = $datarray['created'];
|
||||
$datarray['changed'] = $datarray['created'];
|
||||
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
|
||||
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
|
||||
|
||||
$datarray['edit'] = $orig_post;
|
||||
|
||||
|
@ -606,15 +596,16 @@ function item_post(App $a) {
|
|||
if ($preview) {
|
||||
// We set the datarray ID to -1 because in preview mode the dataray
|
||||
// doesn't have an ID.
|
||||
$datarray["id"] = -1;
|
||||
$datarray["uri-id"] = -1;
|
||||
$datarray["author-network"] = Protocol::DFRN;
|
||||
$datarray["author-updated"] = '';
|
||||
$datarray["author-gsid"] = 0;
|
||||
$datarray["author-uri-id"] = ItemURI::getIdByURI($datarray["author-link"]);
|
||||
$datarray["owner-updated"] = '';
|
||||
$datarray["has-media"] = false;
|
||||
$datarray['body'] = Item::improveSharedDataInBody($datarray);
|
||||
$datarray['id'] = -1;
|
||||
$datarray['uri-id'] = -1;
|
||||
$datarray['author-network'] = Protocol::DFRN;
|
||||
$datarray['author-updated'] = '';
|
||||
$datarray['author-gsid'] = 0;
|
||||
$datarray['author-uri-id'] = ItemURI::getIdByURI($datarray['author-link']);
|
||||
$datarray['owner-updated'] = '';
|
||||
$datarray['has-media'] = false;
|
||||
$datarray['quote-uri-id'] = Item::getQuoteUriId($datarray['body'], $datarray['uid']);
|
||||
$datarray['body'] = BBCode::removeSharedData($datarray['body']);
|
||||
|
||||
$o = DI::conversation()->create([array_merge($contact_record, $datarray)], 'search', false, true);
|
||||
|
||||
|
@ -635,8 +626,8 @@ function item_post(App $a) {
|
|||
unset($datarray['self']);
|
||||
unset($datarray['api_source']);
|
||||
|
||||
Post\Delayed::add($datarray['uri'], $datarray, PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
|
||||
item_post_return(DI::baseUrl(), $api_source, $return_path);
|
||||
Post\Delayed::add($datarray['uri'], $datarray, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
|
||||
item_post_return(DI::baseUrl(), $return_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,7 +646,12 @@ function item_post(App $a) {
|
|||
}
|
||||
|
||||
$datarray['uri-id'] = ItemURI::getIdByURI($datarray['uri']);
|
||||
$datarray['body'] = Item::improveSharedDataInBody($datarray);
|
||||
|
||||
$quote_uri_id = Item::getQuoteUriId($datarray['body'], $datarray['uid']);
|
||||
if (!empty($quote_uri_id)) {
|
||||
$datarray['quote-uri-id'] = $quote_uri_id;
|
||||
$datarray['body'] = BBCode::removeSharedData($datarray['body']);
|
||||
}
|
||||
|
||||
if ($orig_post) {
|
||||
$fields = [
|
||||
|
@ -684,7 +680,7 @@ function item_post(App $a) {
|
|||
$post_id = Item::insert($datarray);
|
||||
|
||||
if (!$post_id) {
|
||||
notice(DI::l10n()->t('Item wasn\'t stored.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item wasn\'t stored.'));
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -705,7 +701,7 @@ function item_post(App $a) {
|
|||
|
||||
Tag::storeFromBody($datarray['uri-id'], $datarray['body']);
|
||||
|
||||
if (!\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions') && ($datarray['gravity'] == GRAVITY_COMMENT)) {
|
||||
if (!\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions') && ($datarray['gravity'] == Item::GRAVITY_COMMENT)) {
|
||||
Tag::createImplicitMentions($datarray['uri-id'], $datarray['thr-parent-id']);
|
||||
}
|
||||
|
||||
|
@ -736,7 +732,7 @@ function item_post(App $a) {
|
|||
|
||||
Hook::callAll('post_local_end', $datarray);
|
||||
|
||||
if (strlen($emailcc) && $profile_uid == local_user()) {
|
||||
if (strlen($emailcc) && $profile_uid == DI::userSession()->getLocalUserId()) {
|
||||
$recipients = explode(',', $emailcc);
|
||||
if (count($recipients)) {
|
||||
foreach ($recipients as $recipient) {
|
||||
|
@ -752,20 +748,12 @@ function item_post(App $a) {
|
|||
|
||||
Logger::debug('post_complete');
|
||||
|
||||
if ($api_source) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
item_post_return(DI::baseUrl(), $api_source, $return_path);
|
||||
item_post_return(DI::baseUrl(), $return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
function item_post_return($baseurl, $api_source, $return_path)
|
||||
function item_post_return($baseurl, $return_path)
|
||||
{
|
||||
if ($api_source) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($return_path) {
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
||||
|
@ -782,7 +770,7 @@ function item_post_return($baseurl, $api_source, $return_path)
|
|||
|
||||
function item_content(App $a)
|
||||
{
|
||||
if (!Session::isAuthenticated()) {
|
||||
if (!DI::userSession()->isAuthenticated()) {
|
||||
throw new HTTPException\UnauthorizedException();
|
||||
}
|
||||
|
||||
|
@ -796,9 +784,9 @@ function item_content(App $a)
|
|||
switch ($args->get(1)) {
|
||||
case 'drop':
|
||||
if (DI::mode()->isAjax()) {
|
||||
Item::deleteForUser(['id' => $args->get(2)], local_user());
|
||||
Item::deleteForUser(['id' => $args->get(2)], DI::userSession()->getLocalUserId());
|
||||
// ajax return: [<item id>, 0 (no perm) | <owner id>]
|
||||
System::jsonExit([intval($args->get(2)), local_user()]);
|
||||
System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);
|
||||
} else {
|
||||
if (!empty($args->get(3))) {
|
||||
$o = drop_item($args->get(2), $args->get(3));
|
||||
|
@ -807,17 +795,18 @@ function item_content(App $a)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'block':
|
||||
$item = Post::selectFirstForUser(local_user(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
|
||||
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
|
||||
if (empty($item['author-id'])) {
|
||||
throw new HTTPException\NotFoundException('Item not found');
|
||||
}
|
||||
|
||||
Contact\User::setBlocked($item['author-id'], local_user(), true);
|
||||
Contact\User::setBlocked($item['author-id'], DI::userSession()->getLocalUserId(), true);
|
||||
|
||||
if (DI::mode()->isAjax()) {
|
||||
// ajax return: [<item id>, 0 (no perm) | <owner id>]
|
||||
System::jsonExit([intval($args->get(2)), local_user()]);
|
||||
System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);
|
||||
} else {
|
||||
item_redirect_after_action($item, $args->get(3));
|
||||
}
|
||||
|
@ -833,15 +822,15 @@ function item_content(App $a)
|
|||
* @return string
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
function drop_item(int $id, string $return = '')
|
||||
function drop_item(int $id, string $return = ''): string
|
||||
{
|
||||
// locate item to be deleted
|
||||
$fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'];
|
||||
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $id]);
|
||||
// Locate item to be deleted
|
||||
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'], ['id' => $id]);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
notice(DI::l10n()->t('Item not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
|
||||
DI::baseUrl()->redirect('network');
|
||||
//NOTREACHED
|
||||
}
|
||||
|
||||
if ($item['deleted']) {
|
||||
|
@ -851,18 +840,19 @@ function drop_item(int $id, string $return = '')
|
|||
$contact_id = 0;
|
||||
|
||||
// check if logged in user is either the author or owner of this item
|
||||
if (Session::getRemoteContactID($item['uid']) == $item['contact-id']) {
|
||||
if (DI::userSession()->getRemoteContactID($item['uid']) == $item['contact-id']) {
|
||||
$contact_id = $item['contact-id'];
|
||||
}
|
||||
|
||||
if ((local_user() == $item['uid']) || $contact_id) {
|
||||
if ((DI::userSession()->getLocalUserId() == $item['uid']) || $contact_id) {
|
||||
// delete the item
|
||||
Item::deleteForUser(['id' => $item['id']], local_user());
|
||||
Item::deleteForUser(['id' => $item['id']], DI::userSession()->getLocalUserId());
|
||||
|
||||
item_redirect_after_action($item, $return);
|
||||
//NOTREACHED
|
||||
} else {
|
||||
Logger::warning('Permission denied.', ['local' => local_user(), 'uid' => $item['uid'], 'cid' => $contact_id]);
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
Logger::warning('Permission denied.', ['local' => DI::userSession()->getLocalUserId(), 'uid' => $item['uid'], 'cid' => $contact_id]);
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('display/' . $item['guid']);
|
||||
//NOTREACHED
|
||||
}
|
||||
|
@ -870,17 +860,17 @@ function drop_item(int $id, string $return = '')
|
|||
return '';
|
||||
}
|
||||
|
||||
function item_redirect_after_action($item, $returnUrlHex)
|
||||
function item_redirect_after_action(array $item, string $returnUrlHex)
|
||||
{
|
||||
$return_url = hex2bin($returnUrlHex);
|
||||
|
||||
// removes update_* from return_url to ignore Ajax refresh
|
||||
$return_url = str_replace("update_", "", $return_url);
|
||||
$return_url = str_replace('update_', '', $return_url);
|
||||
|
||||
// Check if delete a comment
|
||||
if ($item['gravity'] == GRAVITY_COMMENT) {
|
||||
if ($item['gravity'] == Item::GRAVITY_COMMENT) {
|
||||
if (!empty($item['parent'])) {
|
||||
$parentitem = Post::selectFirstForUser(local_user(), ['guid'], ['id' => $item['parent']]);
|
||||
$parentitem = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['guid'], ['id' => $item['parent']]);
|
||||
}
|
||||
|
||||
// Return to parent guid
|
||||
|
|
|
@ -34,10 +34,10 @@ function lostpass_post(App $a)
|
|||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
|
||||
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0 AND `account_removed` = 0 AND `account_expired` = 0', $loginame, $loginame];
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('No valid account found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No valid account found.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ function lostpass_post(App $a)
|
|||
];
|
||||
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
|
||||
if ($result) {
|
||||
info(DI::l10n()->t('Password reset request issued. Check your email.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Password reset request issued. Check your email.'));
|
||||
}
|
||||
|
||||
$sitename = DI::config()->get('config', 'sitename');
|
||||
|
@ -97,7 +97,7 @@ function lostpass_content(App $a)
|
|||
|
||||
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
|
||||
|
||||
return lostpass_form();
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ function lostpass_content(App $a)
|
|||
];
|
||||
DBA::update('user', $fields, ['uid' => $user['uid']]);
|
||||
|
||||
notice(DI::l10n()->t('Request has expired, please make a new one.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Request has expired, please make a new one.'));
|
||||
|
||||
return lostpass_form();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ function lostpass_generate_password($user)
|
|||
'$newpass' => $new_password,
|
||||
]);
|
||||
|
||||
info(DI::l10n()->t("Your password has been reset."));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t("Your password has been reset."));
|
||||
|
||||
$sitename = DI::config()->get('config', 'sitename');
|
||||
$preamble = Strings::deindent(DI::l10n()->t('
|
||||
|
|
132
mod/match.php
132
mod/match.php
|
@ -1,132 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Contact as ModuleContact;
|
||||
|
||||
/**
|
||||
* Controller for /match.
|
||||
*
|
||||
* It takes keywords from your profile and queries the directory server for
|
||||
* matching keywords from other profiles.
|
||||
*
|
||||
* @param App $a App
|
||||
*
|
||||
* @return string
|
||||
* @throws ImagickException
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
function match_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
DI::page()['aside'] .= Widget::findPeople();
|
||||
DI::page()['aside'] .= Widget::follow();
|
||||
|
||||
$_SESSION['return_path'] = DI::args()->getCommand();
|
||||
|
||||
$profile = Profile::getByUID(local_user());
|
||||
|
||||
if (!DBA::isResult($profile)) {
|
||||
return '';
|
||||
}
|
||||
if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) {
|
||||
notice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
$params = [];
|
||||
$tags = trim($profile['pub_keywords'] . ' ' . $profile['prv_keywords']);
|
||||
|
||||
if (DI::mode()->isMobile()) {
|
||||
$limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
$params['s'] = $tags;
|
||||
$params['n'] = 100;
|
||||
|
||||
$entries = [];
|
||||
foreach ([Search::getGlobalDirectory(), DI::baseUrl()] as $server) {
|
||||
if (empty($server)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$msearch = json_decode(DI::httpClient()->post($server . '/msearch', $params)->getBody());
|
||||
if (!empty($msearch)) {
|
||||
$entries = match_get_contacts($msearch, $entries, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($entries)) {
|
||||
info(DI::l10n()->t('No matches'));
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$title' => DI::l10n()->t('Profile Match'),
|
||||
'$contacts' => array_slice($entries, 0, $limit),
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
function match_get_contacts($msearch, $entries, $limit)
|
||||
{
|
||||
if (empty($msearch->results)) {
|
||||
return $entries;
|
||||
}
|
||||
|
||||
foreach ($msearch->results as $profile) {
|
||||
if (!$profile) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Already known contact
|
||||
$contact = Contact::getByURL($profile->url, null, ['rel'], local_user());
|
||||
if (!empty($contact) && in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$contact = Contact::getByURLForUser($profile->url, local_user());
|
||||
if (!empty($contact)) {
|
||||
$entries[$contact['id']] = ModuleContact::getContactTemplateVars($contact);
|
||||
}
|
||||
|
||||
if (count($entries) == $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $entries;
|
||||
}
|
|
@ -39,7 +39,7 @@ function message_init(App $a)
|
|||
$tabs = '';
|
||||
|
||||
if (DI::args()->getArgc() > 1 && is_numeric(DI::args()->getArgv()[1])) {
|
||||
$tabs = render_messages(get_messages(local_user(), 0, 5), 'mail_list.tpl');
|
||||
$tabs = render_messages(get_messages(DI::userSession()->getLocalUserId(), 0, 5), 'mail_list.tpl');
|
||||
}
|
||||
|
||||
$new = [
|
||||
|
@ -65,8 +65,8 @@ function message_init(App $a)
|
|||
|
||||
function message_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,17 +80,20 @@ function message_post(App $a)
|
|||
|
||||
switch ($ret) {
|
||||
case -1:
|
||||
notice(DI::l10n()->t('No recipient selected.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.'));
|
||||
$norecip = true;
|
||||
break;
|
||||
|
||||
case -2:
|
||||
notice(DI::l10n()->t('Unable to locate contact information.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate contact information.'));
|
||||
break;
|
||||
|
||||
case -3:
|
||||
notice(DI::l10n()->t('Message could not be sent.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message could not be sent.'));
|
||||
break;
|
||||
|
||||
case -4:
|
||||
notice(DI::l10n()->t('Message collection failure.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message collection failure.'));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -107,8 +110,8 @@ function message_content(App $a)
|
|||
$o = '';
|
||||
Nav::setSelected('messages');
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
|
@ -141,29 +144,29 @@ function message_content(App $a)
|
|||
|
||||
$cmd = DI::args()->getArgv()[1];
|
||||
if ($cmd === 'drop') {
|
||||
$message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
|
||||
$message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()]);
|
||||
if(!DBA::isResult($message)){
|
||||
notice(DI::l10n()->t('Conversation not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Conversation not found.'));
|
||||
DI::baseUrl()->redirect('message');
|
||||
}
|
||||
|
||||
if (!DBA::delete('mail', ['id' => DI::args()->getArgv()[2], 'uid' => local_user()])) {
|
||||
notice(DI::l10n()->t('Message was not deleted.'));
|
||||
if (!DBA::delete('mail', ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()])) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message was not deleted.'));
|
||||
}
|
||||
|
||||
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
|
||||
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => DI::userSession()->getLocalUserId()]);
|
||||
if(!DBA::isResult($conversation)){
|
||||
DI::baseUrl()->redirect('message');
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('message/' . $conversation['id'] );
|
||||
} else {
|
||||
$parentmail = DBA::selectFirst('mail', ['parent-uri'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
|
||||
$parentmail = DBA::selectFirst('mail', ['parent-uri'], ['id' => DI::args()->getArgv()[2], 'uid' => DI::userSession()->getLocalUserId()]);
|
||||
if (DBA::isResult($parentmail)) {
|
||||
$parent = $parentmail['parent-uri'];
|
||||
|
||||
if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
|
||||
notice(DI::l10n()->t('Conversation was not removed.'));
|
||||
if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => DI::userSession()->getLocalUserId()])) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Conversation was not removed.'));
|
||||
}
|
||||
}
|
||||
DI::baseUrl()->redirect('message');
|
||||
|
@ -192,7 +195,7 @@ function message_content(App $a)
|
|||
'$subjtxt' => $_REQUEST['subject'] ?? '',
|
||||
'$text' => $_REQUEST['body'] ?? '',
|
||||
'$readonly' => '',
|
||||
'$yourmessage'=> DI::l10n()->t('Your message:'),
|
||||
'$yourmessage' => DI::l10n()->t('Your message:'),
|
||||
'$select' => $select,
|
||||
'$parent' => '',
|
||||
'$upload' => DI::l10n()->t('Upload photo'),
|
||||
|
@ -212,14 +215,14 @@ function message_content(App $a)
|
|||
|
||||
$o .= $header;
|
||||
|
||||
$total = DBA::count('mail', ['uid' => local_user()], ['distinct' => true, 'expression' => 'parent-uri']);
|
||||
$total = DBA::count('mail', ['uid' => DI::userSession()->getLocalUserId()], ['distinct' => true, 'expression' => 'parent-uri']);
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
||||
$r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());
|
||||
$r = get_messages(DI::userSession()->getLocalUserId(), $pager->getStart(), $pager->getItemsPerPage());
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
notice(DI::l10n()->t('No messages.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No messages.'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -240,14 +243,14 @@ function message_content(App $a)
|
|||
LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
|
||||
WHERE `mail`.`uid` = ? AND `mail`.`id` = ?
|
||||
LIMIT 1",
|
||||
local_user(),
|
||||
DI::userSession()->getLocalUserId(),
|
||||
DI::args()->getArgv()[1]
|
||||
);
|
||||
if (DBA::isResult($message)) {
|
||||
$contact_id = $message['contact-id'];
|
||||
|
||||
$params = [
|
||||
local_user(),
|
||||
DI::userSession()->getLocalUserId(),
|
||||
$message['parent-uri']
|
||||
];
|
||||
|
||||
|
@ -269,13 +272,13 @@ function message_content(App $a)
|
|||
|
||||
$messages = DBA::toArray($messages_stmt);
|
||||
|
||||
DBA::update('mail', ['seen' => 1], ['parent-uri' => $message['parent-uri'], 'uid' => local_user()]);
|
||||
DBA::update('mail', ['seen' => 1], ['parent-uri' => $message['parent-uri'], 'uid' => DI::userSession()->getLocalUserId()]);
|
||||
} else {
|
||||
$messages = false;
|
||||
}
|
||||
|
||||
if (!DBA::isResult($messages)) {
|
||||
notice(DI::l10n()->t('Message not available.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Message not available.'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -341,7 +344,6 @@ function message_content(App $a)
|
|||
'$canreply' => (($unknown) ? false : '1'),
|
||||
'$unknown_text' => DI::l10n()->t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."),
|
||||
'$mails' => $mails,
|
||||
|
||||
// reply
|
||||
'$header' => DI::l10n()->t('Send Reply'),
|
||||
'$to' => DI::l10n()->t('To:'),
|
||||
|
@ -368,7 +370,7 @@ function message_content(App $a)
|
|||
* @param int $limit
|
||||
* @return array
|
||||
*/
|
||||
function get_messages(int $uid, int $start, int $limit)
|
||||
function get_messages(int $uid, int $start, int $limit): array
|
||||
{
|
||||
return DBA::toArray(DBA::p('SELECT
|
||||
m.`id`,
|
||||
|
@ -414,7 +416,7 @@ function get_messages(int $uid, int $start, int $limit)
|
|||
, $uid, $uid, $start, $limit));
|
||||
}
|
||||
|
||||
function render_messages(array $msg, $t)
|
||||
function render_messages(array $msg, string $t): string
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Proxy;
|
||||
|
||||
function msearch_post(App $a)
|
||||
{
|
||||
$search = $_POST['s'] ?? '';
|
||||
$perpage = intval(($_POST['n'] ?? 0) ?: 80);
|
||||
$page = intval(($_POST['p'] ?? 0) ?: 1);
|
||||
$startrec = ($page - 1) * $perpage;
|
||||
|
||||
$total = 0;
|
||||
$results = [];
|
||||
|
||||
if (!strlen($search)) {
|
||||
$output = ['total' => 0, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
|
||||
System::jsonExit($output);
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
|
||||
$condition = ["`net-publish` AND MATCH(`pub_keywords`) AGAINST (?)", $search];
|
||||
$total = DBA::count('owner-view', $condition);
|
||||
|
||||
$search_stmt = DBA::select('owner-view', ['pub_keywords', 'name', 'nickname', 'uid'], $condition, ['limit' => [$startrec, $perpage]]);
|
||||
while ($search_result = DBA::fetch($search_stmt)) {
|
||||
$results[] = [
|
||||
'name' => $search_result['name'],
|
||||
'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'],
|
||||
'photo' => User::getAvatarUrl($search_result, Proxy::SIZE_THUMB),
|
||||
'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords'])
|
||||
];
|
||||
}
|
||||
|
||||
DBA::close($search_stmt);
|
||||
|
||||
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
|
||||
|
||||
System::jsonExit($output);
|
||||
}
|
|
@ -30,7 +30,7 @@ use Friendica\Module\BaseProfile;
|
|||
|
||||
function notes_init(App $a)
|
||||
{
|
||||
if (! local_user()) {
|
||||
if (! DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -38,21 +38,21 @@ function notes_init(App $a)
|
|||
}
|
||||
|
||||
|
||||
function notes_content(App $a, $update = false)
|
||||
function notes_content(App $a, bool $update = false)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$o = BaseProfile::getTabsHTML($a, 'notes', true, $a->getLoggedInUserNickname(), false);
|
||||
$o = BaseProfile::getTabsHTML('notes', true, $a->getLoggedInUserNickname(), false);
|
||||
|
||||
if (!$update) {
|
||||
$o .= '<h3>' . DI::l10n()->t('Personal Notes') . '</h3>';
|
||||
|
||||
$x = [
|
||||
'lockstate' => 'lock',
|
||||
'acl' => \Friendica\Core\ACL::getSelfOnlyHTML(local_user(), DI::l10n()->t('Personal notes are visible only by yourself.')),
|
||||
'acl' => \Friendica\Core\ACL::getSelfOnlyHTML(DI::userSession()->getLocalUserId(), DI::l10n()->t('Personal notes are visible only by yourself.')),
|
||||
'button' => DI::l10n()->t('Save'),
|
||||
'acl_data' => '',
|
||||
];
|
||||
|
@ -60,14 +60,14 @@ function notes_content(App $a, $update = false)
|
|||
$o .= DI::conversation()->statusEditor($x, $a->getContactId());
|
||||
}
|
||||
|
||||
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
|
||||
$condition = ['uid' => DI::userSession()->getLocalUserId(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => Item::GRAVITY_PARENT,
|
||||
'contact-id'=> $a->getContactId()];
|
||||
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ function notes_content(App $a, $update = false)
|
|||
|
||||
$params = ['order' => ['created' => true],
|
||||
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
$r = Post::selectThreadForUser(local_user(), ['uri-id'], $condition, $params);
|
||||
$r = Post::selectThreadForUser(DI::userSession()->getLocalUserId(), ['uri-id'], $condition, $params);
|
||||
|
||||
$count = 0;
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -93,9 +95,9 @@ function oexchange_init(App $a)
|
|||
System::httpExit($xml->saveXML(), Response::TYPE_XML, 'application/xrd+xml');
|
||||
}
|
||||
|
||||
function oexchange_content(App $a) {
|
||||
|
||||
if (!local_user()) {
|
||||
function oexchange_content(App $a)
|
||||
{
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
$o = Login::form();
|
||||
return $o;
|
||||
}
|
||||
|
@ -109,7 +111,7 @@ function oexchange_content(App $a) {
|
|||
$description = !empty($_REQUEST['description']) ? trim($_REQUEST['description']) : '';
|
||||
$tags = !empty($_REQUEST['tags']) ? trim($_REQUEST['tags']) : '';
|
||||
|
||||
$s = \Friendica\Content\Text\BBCode::embedURL($url, true, $title, $description, $tags);
|
||||
$s = BBCode::embedURL($url, true, $title, $description, $tags);
|
||||
|
||||
if (!strlen($s)) {
|
||||
return;
|
||||
|
@ -117,11 +119,10 @@ function oexchange_content(App $a) {
|
|||
|
||||
$post = [];
|
||||
|
||||
$post['profile_uid'] = local_user();
|
||||
$post['return'] = '/oexchange/done';
|
||||
$post['body'] = Friendica\Content\Text\HTML::toBBCode($s);
|
||||
$post['body'] = HTML::toBBCode($s);
|
||||
|
||||
$_REQUEST = $post;
|
||||
require_once('mod/item.php');
|
||||
require_once 'mod/item.php';
|
||||
item_post($a);
|
||||
}
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
function ostatus_subscribe_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('ostatus_subscribe');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$o = '<h2>' . DI::l10n()->t('Subscribing to contacts') . '</h2>';
|
||||
|
||||
$uid = local_user();
|
||||
|
||||
$counter = intval($_REQUEST['counter'] ?? 0);
|
||||
|
||||
if (DI::pConfig()->get($uid, 'ostatus', 'legacy_friends') == '') {
|
||||
|
||||
if ($_REQUEST['url'] == '') {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('No contact provided.');
|
||||
}
|
||||
|
||||
$contact = Contact::getByURL($_REQUEST['url']);
|
||||
if (!$contact) {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('Couldn\'t fetch information for contact.');
|
||||
}
|
||||
|
||||
if ($contact['network'] == Protocol::OSTATUS) {
|
||||
$api = $contact['baseurl'] . '/api/';
|
||||
|
||||
// Fetching friends
|
||||
$curlResult = DI::httpClient()->get($api . 'statuses/friends.json?screen_name=' . $contact['nick'], HttpClientAccept::JSON);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('Couldn\'t fetch friends for contact.');
|
||||
}
|
||||
|
||||
$friends = $curlResult->getBody();
|
||||
if (empty($friends)) {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('Couldn\'t fetch following contacts.');
|
||||
}
|
||||
DI::pConfig()->set($uid, 'ostatus', 'legacy_friends', $friends);
|
||||
} elseif ($apcontact = APContact::getByURL($contact['url'])) {
|
||||
if (empty($apcontact['following'])) {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('Couldn\'t fetch remote profile.');
|
||||
}
|
||||
$followings = ActivityPub::fetchItems($apcontact['following']);
|
||||
if (empty($followings)) {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('Couldn\'t fetch following contacts.');
|
||||
}
|
||||
DI::pConfig()->set($uid, 'ostatus', 'legacy_friends', json_encode($followings));
|
||||
} else {
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
return $o . DI::l10n()->t('Unsupported network');
|
||||
}
|
||||
}
|
||||
|
||||
$friends = json_decode(DI::pConfig()->get($uid, 'ostatus', 'legacy_friends'));
|
||||
|
||||
if (empty($friends)) {
|
||||
$friends = [];
|
||||
}
|
||||
|
||||
$total = sizeof($friends);
|
||||
|
||||
if ($counter >= $total) {
|
||||
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl() . '/settings/connectors">';
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_friends');
|
||||
DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact');
|
||||
$o .= DI::l10n()->t('Done');
|
||||
return $o;
|
||||
}
|
||||
|
||||
$friend = $friends[$counter++];
|
||||
|
||||
$url = $friend->statusnet_profile_url ?? $friend;
|
||||
|
||||
$o .= '<p>' . $counter . '/' . $total . ': ' . $url;
|
||||
|
||||
$probed = Contact::getByURL($url);
|
||||
if (in_array($probed['network'], Protocol::FEDERATED)) {
|
||||
$result = Contact::createFromProbeForUser($a->getLoggedInUserId(), $probed['url']);
|
||||
if ($result['success']) {
|
||||
$o .= ' - ' . DI::l10n()->t('success');
|
||||
} else {
|
||||
$o .= ' - ' . DI::l10n()->t('failed');
|
||||
}
|
||||
} else {
|
||||
$o .= ' - ' . DI::l10n()->t('ignored');
|
||||
}
|
||||
|
||||
$o .= '</p>';
|
||||
|
||||
$o .= '<p>' . DI::l10n()->t('Keep this window open until done.') . '</p>';
|
||||
|
||||
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl() . '/ostatus_subscribe?counter=' . $counter . '">';
|
||||
|
||||
return $o;
|
||||
}
|
463
mod/photos.php
463
mod/photos.php
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
|
@ -30,7 +29,6 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -42,22 +40,21 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseProfile;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Security\Security;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Security\Security;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
function photos_init(App $a) {
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
function photos_init(App $a)
|
||||
{
|
||||
if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,11 +66,11 @@ function photos_init(App $a) {
|
|||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
}
|
||||
|
||||
$is_owner = (local_user() && (local_user() == $owner['uid']));
|
||||
$is_owner = (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $owner['uid']));
|
||||
|
||||
$albums = Photo::getAlbums($owner['uid']);
|
||||
|
||||
$albums_visible = ((intval($owner['hidewall']) && !Session::isAuthenticated()) ? false : true);
|
||||
$albums_visible = ((intval($owner['hidewall']) && !DI::userSession()->isAuthenticated()) ? false : true);
|
||||
|
||||
// add various encodings to the array so we can just loop through and pick them out in a template
|
||||
$ret = ['success' => false];
|
||||
|
@ -96,7 +93,7 @@ function photos_init(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
if (local_user() && $owner['uid'] == local_user()) {
|
||||
if (DI::userSession()->getLocalUserId() && $owner['uid'] == DI::userSession()->getLocalUserId()) {
|
||||
$can_post = true;
|
||||
} else {
|
||||
$can_post = false;
|
||||
|
@ -148,23 +145,23 @@ function photos_post(App $a)
|
|||
$page_owner_uid = intval($user['uid']);
|
||||
$community_page = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
|
||||
|
||||
if (local_user() && (local_user() == $page_owner_uid)) {
|
||||
if (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
|
||||
$can_post = true;
|
||||
} elseif ($community_page && !empty(Session::getRemoteContactID($page_owner_uid))) {
|
||||
$contact_id = Session::getRemoteContactID($page_owner_uid);
|
||||
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
||||
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
|
||||
$can_post = true;
|
||||
$visitor = $contact_id;
|
||||
}
|
||||
|
||||
if (!$can_post) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$owner_record = User::getOwnerDataById($page_owner_uid);
|
||||
|
||||
if (!$owner_record) {
|
||||
notice(DI::l10n()->t('Contact information unavailable'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Contact information unavailable'));
|
||||
DI::logger()->info('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
|
||||
System::exit();
|
||||
}
|
||||
|
@ -193,7 +190,7 @@ function photos_post(App $a)
|
|||
$album = hex2bin(DI::args()->getArgv()[3]);
|
||||
|
||||
if (!DBA::exists('photo', ['album' => $album, 'uid' => $page_owner_uid, 'photo-type' => Photo::DEFAULT])) {
|
||||
notice(DI::l10n()->t('Album not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Album not found.'));
|
||||
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
@ -229,7 +226,7 @@ function photos_post(App $a)
|
|||
));
|
||||
} else {
|
||||
$r = DBA::toArray(DBA::p("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = ? AND `album` = ?",
|
||||
local_user(),
|
||||
DI::userSession()->getLocalUserId(),
|
||||
$album
|
||||
));
|
||||
}
|
||||
|
@ -247,9 +244,9 @@ function photos_post(App $a)
|
|||
|
||||
// Update the photo albums cache
|
||||
Photo::clearAlbumCache($page_owner_uid);
|
||||
notice(DI::l10n()->t('Album successfully deleted'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Album successfully deleted'));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Album was empty.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Album was empty.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +265,7 @@ function photos_post(App $a)
|
|||
$condition = ['contact-id' => $visitor, 'uid' => $page_owner_uid, 'resource-id' => DI::args()->getArgv()[3]];
|
||||
|
||||
} else {
|
||||
$condition = ['uid' => local_user(), 'resource-id' => DI::args()->getArgv()[3]];
|
||||
$condition = ['uid' => DI::userSession()->getLocalUserId(), 'resource-id' => DI::args()->getArgv()[3]];
|
||||
}
|
||||
|
||||
$photo = DBA::selectFirst('photo', ['resource-id'], $condition);
|
||||
|
@ -281,12 +278,11 @@ function photos_post(App $a)
|
|||
// Update the photo albums cache
|
||||
Photo::clearAlbumCache($page_owner_uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('Failed to delete the photo.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to delete the photo.'));
|
||||
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1]);
|
||||
return; // NOTREACHED
|
||||
DI::baseUrl()->redirect('profile/' . DI::args()->getArgv()[1] . '/photos');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,44 +522,40 @@ function photos_post(App $a)
|
|||
foreach ($taginfo as $tagged) {
|
||||
$uri = Item::newURI();
|
||||
|
||||
$arr = [];
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['wall'] = 1;
|
||||
$arr['contact-id'] = $owner_record['id'];
|
||||
$arr['owner-name'] = $owner_record['name'];
|
||||
$arr['owner-link'] = $owner_record['url'];
|
||||
$arr['owner-avatar'] = $owner_record['thumb'];
|
||||
$arr['author-name'] = $owner_record['name'];
|
||||
$arr['author-link'] = $owner_record['url'];
|
||||
$arr['author-avatar'] = $owner_record['thumb'];
|
||||
$arr['title'] = '';
|
||||
$arr['allow_cid'] = $photo['allow_cid'];
|
||||
$arr['allow_gid'] = $photo['allow_gid'];
|
||||
$arr['deny_cid'] = $photo['deny_cid'];
|
||||
$arr['deny_gid'] = $photo['deny_gid'];
|
||||
$arr['visible'] = 0;
|
||||
$arr['verb'] = Activity::TAG;
|
||||
$arr['gravity'] = GRAVITY_PARENT;
|
||||
$arr['object-type'] = Activity\ObjectType::PERSON;
|
||||
$arr['target-type'] = Activity\ObjectType::IMAGE;
|
||||
$arr['inform'] = $tagged[2];
|
||||
$arr['origin'] = 1;
|
||||
$arr['body'] = DI::l10n()->t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . DI::l10n()->t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
|
||||
$arr['body'] .= "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
|
||||
$arr = [
|
||||
'guid' => System::createUUID(),
|
||||
'uid' => $page_owner_uid,
|
||||
'uri' => $uri,
|
||||
'wall' => 1,
|
||||
'contact-id' => $owner_record['id'],
|
||||
'owner-name' => $owner_record['name'],
|
||||
'owner-link' => $owner_record['url'],
|
||||
'owner-avatar' => $owner_record['thumb'],
|
||||
'author-name' => $owner_record['name'],
|
||||
'author-link' => $owner_record['url'],
|
||||
'author-avatar' => $owner_record['thumb'],
|
||||
'title' => '',
|
||||
'allow_cid' => $photo['allow_cid'],
|
||||
'allow_gid' => $photo['allow_gid'],
|
||||
'deny_cid' => $photo['deny_cid'],
|
||||
'deny_gid' => $photo['deny_gid'],
|
||||
'visible' => 0,
|
||||
'verb' => Activity::TAG,
|
||||
'gravity' => Item::GRAVITY_PARENT,
|
||||
'object-type' => Activity\ObjectType::PERSON,
|
||||
'target-type' => Activity\ObjectType::IMAGE,
|
||||
'inform' => $tagged[2],
|
||||
'origin' => 1,
|
||||
'body' => DI::l10n()->t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . DI::l10n()->t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') . "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n",
|
||||
'object' => '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n"),
|
||||
'target' => '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>',
|
||||
];
|
||||
|
||||
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
|
||||
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
|
||||
if ($tagged[3]) {
|
||||
$arr['object'] .= XML::escape('<link rel="photo" type="' . $photo['type'] . '" href="' . $tagged[3]['photo'] . '" />' . "\n");
|
||||
}
|
||||
$arr['object'] .= '</link></object>' . "\n";
|
||||
|
||||
$arr['target'] = '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>'
|
||||
. DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>';
|
||||
$arr['target'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
|
||||
|
||||
Item::insert($arr);
|
||||
}
|
||||
}
|
||||
|
@ -571,219 +563,11 @@ function photos_post(App $a)
|
|||
DI::baseUrl()->redirect($_SESSION['photo_return']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
||||
// default post action - upload a photo
|
||||
Hook::callAll('photo_post_init', $_POST);
|
||||
|
||||
// Determine the album to use
|
||||
$album = trim($_REQUEST['album'] ?? '');
|
||||
$newalbum = trim($_REQUEST['newalbum'] ?? '');
|
||||
|
||||
Logger::debug('album= ' . $album . ' newalbum= ' . $newalbum);
|
||||
|
||||
if (!strlen($album)) {
|
||||
if (strlen($newalbum)) {
|
||||
$album = $newalbum;
|
||||
} else {
|
||||
$album = DateTimeFormat::localNow('Y');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We create a wall item for every photo, but we don't want to
|
||||
* overwhelm the data stream with a hundred newly uploaded photos.
|
||||
* So we will make the first photo uploaded to this album in the last several hours
|
||||
* visible by default, the rest will become visible over time when and if
|
||||
* they acquire comments, likes, dislikes, and/or tags
|
||||
*/
|
||||
|
||||
$r = Photo::selectToArray([], ['`album` = ? AND `uid` = ? AND `created` > ?', $album, $page_owner_uid, DateTimeFormat::utc('now - 3 hours')]);
|
||||
|
||||
if (!DBA::isResult($r) || ($album == DI::l10n()->t(Photo::PROFILE_PHOTOS))) {
|
||||
$visible = 1;
|
||||
} else {
|
||||
$visible = 0;
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['not_visible']) && $_REQUEST['not_visible'] !== 'false') {
|
||||
$visible = 0;
|
||||
}
|
||||
|
||||
$ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];
|
||||
|
||||
Hook::callAll('photo_post_file', $ret);
|
||||
|
||||
if (!empty($ret['src']) && !empty($ret['filesize'])) {
|
||||
$src = $ret['src'];
|
||||
$filename = $ret['filename'];
|
||||
$filesize = $ret['filesize'];
|
||||
$type = $ret['type'];
|
||||
$error = UPLOAD_ERR_OK;
|
||||
} elseif (!empty($_FILES['userfile'])) {
|
||||
$src = $_FILES['userfile']['tmp_name'];
|
||||
$filename = basename($_FILES['userfile']['name']);
|
||||
$filesize = intval($_FILES['userfile']['size']);
|
||||
$type = $_FILES['userfile']['type'];
|
||||
$error = $_FILES['userfile']['error'];
|
||||
} else {
|
||||
$error = UPLOAD_ERR_NO_FILE;
|
||||
}
|
||||
|
||||
if ($error !== UPLOAD_ERR_OK) {
|
||||
switch ($error) {
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
|
||||
break;
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
notice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
notice(DI::l10n()->t('Image file is missing'));
|
||||
break;
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
case UPLOAD_ERR_CANT_WRITE:
|
||||
case UPLOAD_ERR_EXTENSION:
|
||||
notice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
|
||||
break;
|
||||
}
|
||||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end', $foo);
|
||||
return;
|
||||
}
|
||||
|
||||
$type = Images::getMimeTypeBySource($src, $filename, $type);
|
||||
|
||||
Logger::info('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes');
|
||||
|
||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||
|
||||
if ($maximagesize && ($filesize > $maximagesize)) {
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
||||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end', $foo);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$filesize) {
|
||||
notice(DI::l10n()->t('Image file is empty.'));
|
||||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end', $foo);
|
||||
return;
|
||||
}
|
||||
|
||||
Logger::debug('loading contents', ['src' => $src]);
|
||||
|
||||
$imagedata = @file_get_contents($src);
|
||||
|
||||
$image = new Image($imagedata, $type);
|
||||
|
||||
if (!$image->isValid()) {
|
||||
Logger::notice('unable to process image');
|
||||
notice(DI::l10n()->t('Unable to process image.'));
|
||||
@unlink($src);
|
||||
$foo = 0;
|
||||
Hook::callAll('photo_post_end',$foo);
|
||||
return;
|
||||
}
|
||||
|
||||
$exif = $image->orient($src);
|
||||
@unlink($src);
|
||||
|
||||
$max_length = DI::config()->get('system', 'max_image_length');
|
||||
if ($max_length > 0) {
|
||||
$image->scaleDown($max_length);
|
||||
}
|
||||
|
||||
$width = $image->getWidth();
|
||||
$height = $image->getHeight();
|
||||
|
||||
$smallest = 0;
|
||||
|
||||
$resource_id = Photo::newResource();
|
||||
|
||||
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 0 , Photo::DEFAULT, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
|
||||
|
||||
if (!$r) {
|
||||
Logger::warning('image store failed');
|
||||
notice(DI::l10n()->t('Image upload failed.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($width > 640 || $height > 640) {
|
||||
$image->scaleDown(640);
|
||||
Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 1, Photo::DEFAULT, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
|
||||
$smallest = 1;
|
||||
}
|
||||
|
||||
if ($width > 320 || $height > 320) {
|
||||
$image->scaleDown(320);
|
||||
Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 2, Photo::DEFAULT, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
|
||||
$smallest = 2;
|
||||
}
|
||||
|
||||
$uri = Item::newURI();
|
||||
|
||||
// Create item container
|
||||
$lat = $lon = null;
|
||||
if (!empty($exif['GPS']) && Feature::isEnabled($page_owner_uid, 'photo_location')) {
|
||||
$lat = Photo::getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']);
|
||||
$lon = Photo::getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']);
|
||||
}
|
||||
|
||||
$arr = [];
|
||||
if ($lat && $lon) {
|
||||
$arr['coord'] = $lat . ' ' . $lon;
|
||||
}
|
||||
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['post-type'] = Item::PT_IMAGE;
|
||||
$arr['wall'] = 1;
|
||||
$arr['resource-id'] = $resource_id;
|
||||
$arr['contact-id'] = $owner_record['id'];
|
||||
$arr['owner-name'] = $owner_record['name'];
|
||||
$arr['owner-link'] = $owner_record['url'];
|
||||
$arr['owner-avatar'] = $owner_record['thumb'];
|
||||
$arr['author-name'] = $owner_record['name'];
|
||||
$arr['author-link'] = $owner_record['url'];
|
||||
$arr['author-avatar'] = $owner_record['thumb'];
|
||||
$arr['title'] = '';
|
||||
$arr['allow_cid'] = $str_contact_allow;
|
||||
$arr['allow_gid'] = $str_group_allow;
|
||||
$arr['deny_cid'] = $str_contact_deny;
|
||||
$arr['deny_gid'] = $str_group_deny;
|
||||
$arr['visible'] = $visible;
|
||||
$arr['origin'] = 1;
|
||||
|
||||
$arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $resource_id . ']'
|
||||
. '[img]' . DI::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$image->getExt() . '[/img]'
|
||||
. '[/url]';
|
||||
|
||||
$item_id = Item::insert($arr);
|
||||
// Update the photo albums cache
|
||||
Photo::clearAlbumCache($page_owner_uid);
|
||||
|
||||
Hook::callAll('photo_post_end', $item_id);
|
||||
|
||||
// addon uploaders should call "exit()" within the photo_post_end hook
|
||||
// if they do not wish to be redirected
|
||||
|
||||
DI::baseUrl()->redirect($_SESSION['photo_return']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
function photos_content(App $a)
|
||||
{
|
||||
// URLs:
|
||||
// photos/name
|
||||
// photos/name/upload
|
||||
// photos/name/upload/xxxxx (xxxxx is album name)
|
||||
// photos/name/album/xxxxx
|
||||
|
@ -793,18 +577,18 @@ function photos_content(App $a)
|
|||
// photos/name/image/xxxxx/edit
|
||||
// photos/name/image/xxxxx/drop
|
||||
|
||||
$user = User::getByNickname(DI::args()->getArgv()[1]);
|
||||
$user = User::getByNickname(DI::args()->getArgv()[1] ?? '');
|
||||
if (!DBA::isResult($user)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
}
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
notice(DI::l10n()->t('Public access denied.'));
|
||||
if (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Public access denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($user)) {
|
||||
notice(DI::l10n()->t('No photos selected'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No photos selected'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -844,10 +628,10 @@ function photos_content(App $a)
|
|||
|
||||
$community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
|
||||
|
||||
if (local_user() && (local_user() == $owner_uid)) {
|
||||
if (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $owner_uid)) {
|
||||
$can_post = true;
|
||||
} elseif ($community_page && !empty(Session::getRemoteContactID($owner_uid))) {
|
||||
$contact_id = Session::getRemoteContactID($owner_uid);
|
||||
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($owner_uid))) {
|
||||
$contact_id = DI::userSession()->getRemoteContactID($owner_uid);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
|
||||
|
||||
if (DBA::isResult($contact)) {
|
||||
|
@ -858,23 +642,22 @@ function photos_content(App $a)
|
|||
}
|
||||
|
||||
// perhaps they're visiting - but not a community page, so they wouldn't have write access
|
||||
if (!empty(Session::getRemoteContactID($owner_uid)) && !$visitor) {
|
||||
$contact_id = Session::getRemoteContactID($owner_uid);
|
||||
if (!empty(DI::userSession()->getRemoteContactID($owner_uid)) && !$visitor) {
|
||||
$contact_id = DI::userSession()->getRemoteContactID($owner_uid);
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
|
||||
|
||||
$remote_contact = DBA::isResult($contact);
|
||||
}
|
||||
|
||||
if (!$remote_contact && local_user()) {
|
||||
if (!$remote_contact && DI::userSession()->getLocalUserId()) {
|
||||
$contact_id = $_SESSION['cid'];
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
|
||||
}
|
||||
|
||||
if ($user['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
|
||||
notice(DI::l10n()->t('Access to this item is restricted.'));
|
||||
return;
|
||||
if ($user['hidewall'] && !DI::userSession()->isAuthenticated()) {
|
||||
DI::baseUrl()->redirect('profile/' . $user['nickname'] . '/restricted');
|
||||
}
|
||||
|
||||
$sql_extra = Security::getPermissionsSQLByUserId($owner_uid);
|
||||
|
@ -882,16 +665,19 @@ function photos_content(App $a)
|
|||
$o = "";
|
||||
|
||||
// tabs
|
||||
$is_owner = (local_user() && (local_user() == $owner_uid));
|
||||
$o .= BaseProfile::getTabsHTML($a, 'photos', $is_owner, $user['nickname'], $profile['hide-friends']);
|
||||
$is_owner = (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $owner_uid));
|
||||
$o .= BaseProfile::getTabsHTML('photos', $is_owner, $user['nickname'], $profile['hide-friends']);
|
||||
|
||||
// Display upload form
|
||||
if ($datatype === 'upload') {
|
||||
if (!$can_post) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// This prevents the photo upload form to return to itself without a hint the picture has been correctly uploaded.
|
||||
DI::session()->remove('photo_return');
|
||||
|
||||
$selname = (!is_null($datum) && Strings::isHex($datum)) ? hex2bin($datum) : '';
|
||||
|
||||
$albumselect = '';
|
||||
|
@ -910,7 +696,7 @@ function photos_content(App $a)
|
|||
|
||||
$uploader = '';
|
||||
|
||||
$ret = ['post_url' => 'photos/' . $user['nickname'],
|
||||
$ret = ['post_url' => 'profile/' . $user['nickname'] . '/photos',
|
||||
'addon_text' => $uploader,
|
||||
'default_upload' => true];
|
||||
|
||||
|
@ -921,7 +707,20 @@ function photos_content(App $a)
|
|||
'$submit' => DI::l10n()->t('Submit'),
|
||||
]);
|
||||
|
||||
$usage_message = '';
|
||||
// Get the relevant size limits for uploads. Abbreviated var names: MaxImageSize -> mis; upload_max_filesize -> umf
|
||||
$mis_bytes = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
$umf_bytes = Strings::getBytesFromShorthand(ini_get('upload_max_filesize'));
|
||||
|
||||
// Per Friendica definition a value of '0' means unlimited:
|
||||
If ($mis_bytes == 0) {
|
||||
$mis_bytes = INF;
|
||||
}
|
||||
|
||||
// When PHP is configured with upload_max_filesize less than maximagesize provide this lower limit.
|
||||
$maximagesize_bytes = (is_numeric($mis_bytes) && ($mis_bytes < $umf_bytes) ? $mis_bytes : $umf_bytes);
|
||||
|
||||
// @todo We may be want to use appropriate binary prefixed dynamicly
|
||||
$usage_message = DI::l10n()->t('The maximum accepted image size is %s', Strings::formatBytes($maximagesize_bytes));
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('photos_upload.tpl');
|
||||
|
||||
|
@ -1088,9 +887,9 @@ function photos_content(App $a)
|
|||
|
||||
if (!DBA::isResult($ph)) {
|
||||
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
|
||||
notice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Photo not available'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Photo not available'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1201,7 +1000,7 @@ function photos_content(App $a)
|
|||
}
|
||||
|
||||
if (
|
||||
$ph[0]['uid'] == local_user()
|
||||
$ph[0]['uid'] == DI::userSession()->getLocalUserId()
|
||||
&& (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid']))
|
||||
) {
|
||||
$tools['lock'] = DI::l10n()->t('Private Photo');
|
||||
|
@ -1233,7 +1032,7 @@ function photos_content(App $a)
|
|||
$link_item = Post::selectFirst([], ["`resource-id` = ?" . $sql_extra, $datum]);
|
||||
|
||||
if (!empty($link_item['parent']) && !empty($link_item['uid'])) {
|
||||
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], GRAVITY_COMMENT];
|
||||
$condition = ["`parent` = ? AND `gravity` = ?", $link_item['parent'], Item::GRAVITY_COMMENT];
|
||||
$total = Post::count($condition);
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
|
@ -1241,7 +1040,7 @@ function photos_content(App $a)
|
|||
$params = ['order' => ['id'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
$items = Post::toArray(Post::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params));
|
||||
|
||||
if (local_user() == $link_item['uid']) {
|
||||
if (DI::userSession()->getLocalUserId() == $link_item['uid']) {
|
||||
Item::update(['unseen' => false], ['parent' => $link_item['parent']]);
|
||||
}
|
||||
}
|
||||
|
@ -1255,15 +1054,17 @@ function photos_content(App $a)
|
|||
if (!empty($link_item['id'])) {
|
||||
// parse tags and add links
|
||||
$tag_arr = [];
|
||||
foreach (Tag::getByURIId($link_item['uri-id']) as $tag) {
|
||||
foreach (explode(',', Tag::getCSVByURIId($link_item['uri-id'])) as $tag_name) {
|
||||
if ($tag_name) {
|
||||
$tag_arr[] = [
|
||||
'name' => $tag['name'],
|
||||
'removeurl' => '/tagrm/' . $link_item['id'] . '/' . bin2hex($tag['name'])
|
||||
'name' => BBCode::toPlaintext($tag_name),
|
||||
'removeurl' => 'post/' . $link_item['id'] . '/tag/remove/' . bin2hex($tag_name) . '?return=' . urlencode(DI::args()->getCommand()),
|
||||
];
|
||||
}
|
||||
}
|
||||
$tags = ['title' => DI::l10n()->t('Tags: '), 'tags' => $tag_arr];
|
||||
if ($cmd === 'edit') {
|
||||
$tags['removeanyurl'] = 'tagrm/' . $link_item['id'];
|
||||
$tags['removeanyurl'] = 'post/' . $link_item['id'] . '/tag/remove?return=' . urlencode(DI::args()->getCommand());
|
||||
$tags['removetitle'] = DI::l10n()->t('[Select tags to remove]');
|
||||
}
|
||||
}
|
||||
|
@ -1319,7 +1120,7 @@ function photos_content(App $a)
|
|||
*/
|
||||
$qcomment = null;
|
||||
if (Addon::isEnabled('qcomment')) {
|
||||
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
|
||||
$words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'qcomment', 'words');
|
||||
$qcomment = $words ? explode("\n", $words) : [];
|
||||
}
|
||||
|
||||
|
@ -1350,7 +1151,7 @@ function photos_content(App $a)
|
|||
'attendmaybe' => []
|
||||
];
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
|
||||
if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'hide_dislike')) {
|
||||
unset($conv_responses['dislike']);
|
||||
}
|
||||
|
||||
|
@ -1375,7 +1176,7 @@ function photos_content(App $a)
|
|||
*/
|
||||
$qcomment = null;
|
||||
if (Addon::isEnabled('qcomment')) {
|
||||
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
|
||||
$words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'qcomment', 'words');
|
||||
$qcomment = $words ? explode("\n", $words) : [];
|
||||
}
|
||||
|
||||
|
@ -1404,20 +1205,20 @@ function photos_content(App $a)
|
|||
|
||||
if (($activity->match($item['verb'], Activity::LIKE) ||
|
||||
$activity->match($item['verb'], Activity::DISLIKE)) &&
|
||||
($item['gravity'] != GRAVITY_PARENT)) {
|
||||
($item['gravity'] != Item::GRAVITY_PARENT)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$author = ['uid' => 0, 'id' => $item['author-id'],
|
||||
'network' => $item['author-network'], 'url' => $item['author-link']];
|
||||
$profile_url = Contact::magicLinkByContact($author);
|
||||
if (strpos($profile_url, 'redir/') === 0) {
|
||||
if (strpos($profile_url, 'contact/redir/') === 0) {
|
||||
$sparkle = ' sparkle';
|
||||
} else {
|
||||
$sparkle = '';
|
||||
}
|
||||
|
||||
$dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == local_user()));
|
||||
$dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == DI::userSession()->getLocalUserId()));
|
||||
$drop = [
|
||||
'dropping' => $dropping,
|
||||
'pagedrop' => false,
|
||||
|
@ -1449,7 +1250,7 @@ function photos_content(App $a)
|
|||
*/
|
||||
$qcomment = null;
|
||||
if (Addon::isEnabled('qcomment')) {
|
||||
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
|
||||
$words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'qcomment', 'words');
|
||||
$qcomment = $words ? explode("\n", $words) : [];
|
||||
}
|
||||
|
||||
|
@ -1488,7 +1289,7 @@ function photos_content(App $a)
|
|||
'$dislike' => DI::l10n()->t('Dislike'),
|
||||
'$wait' => DI::l10n()->t('Please wait'),
|
||||
'$dislike_title' => DI::l10n()->t('I don\'t like this (toggle)'),
|
||||
'$hide_dislike' => DI::pConfig()->get(local_user(), 'system', 'hide_dislike'),
|
||||
'$hide_dislike' => DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'hide_dislike'),
|
||||
'$responses' => $responses,
|
||||
'$return_path' => DI::args()->getQueryString(),
|
||||
]);
|
||||
|
@ -1525,68 +1326,4 @@ function photos_content(App $a)
|
|||
|
||||
return $o;
|
||||
}
|
||||
|
||||
// Default - show recent photos with upload link (if applicable)
|
||||
//$o = '';
|
||||
$total = 0;
|
||||
$r = DBA::toArray(DBA::p("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = ? AND `photo-type` = ?
|
||||
$sql_extra GROUP BY `resource-id`",
|
||||
$user['uid'],
|
||||
Photo::DEFAULT,
|
||||
));
|
||||
if (DBA::isResult($r)) {
|
||||
$total = count($r);
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 20);
|
||||
|
||||
$r = DBA::toArray(DBA::p("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
|
||||
ANY_VALUE(`type`) AS `type`, ANY_VALUE(`album`) AS `album`, max(`scale`) AS `scale`,
|
||||
ANY_VALUE(`created`) AS `created` FROM `photo`
|
||||
WHERE `uid` = ? AND `photo-type` = ?
|
||||
$sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT ? , ?",
|
||||
$user['uid'],
|
||||
Photo::DEFAULT,
|
||||
$pager->getStart(),
|
||||
$pager->getItemsPerPage()
|
||||
));
|
||||
|
||||
$photos = [];
|
||||
if (DBA::isResult($r)) {
|
||||
// "Twist" is only used for the duepunto theme with style "slackr"
|
||||
$twist = false;
|
||||
foreach ($r as $rr) {
|
||||
$twist = !$twist;
|
||||
$ext = $phototypes[$rr['type']];
|
||||
|
||||
$alt_e = $rr['filename'];
|
||||
$name_e = $rr['album'];
|
||||
|
||||
$photos[] = [
|
||||
'id' => $rr['id'],
|
||||
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
|
||||
'link' => 'photos/' . $user['nickname'] . '/image/' . $rr['resource-id'],
|
||||
'title' => DI::l10n()->t('View Photo'),
|
||||
'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
|
||||
'alt' => $alt_e,
|
||||
'album' => [
|
||||
'link' => 'photos/' . $user['nickname'] . '/album/' . bin2hex($rr['album']),
|
||||
'name' => $name_e,
|
||||
'alt' => DI::l10n()->t('View Album'),
|
||||
],
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('photos_recent.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$title' => DI::l10n()->t('Recent Photos'),
|
||||
'$can_post' => $can_post,
|
||||
'$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $user['nickname'] . '/upload'],
|
||||
'$photos' => $photos,
|
||||
'$paginate' => $pager->renderFull($total),
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
|
234
mod/poco.php
234
mod/poco.php
|
@ -1,234 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @see https://web.archive.org/web/20160405005550/http://portablecontacts.net/draft-spec.html
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function poco_init(App $a) {
|
||||
if (intval(DI::config()->get('system', 'block_public')) || (DI::config()->get('system', 'block_local_dir'))) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc() > 1) {
|
||||
// Only the system mode is supported
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
$format = ($_GET['format'] ?? '') ?: 'json';
|
||||
|
||||
$totalResults = DBA::count('profile', ['net-publish' => true]);
|
||||
if ($totalResults == 0) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
if (!empty($_GET['startIndex'])) {
|
||||
$startIndex = intval($_GET['startIndex']);
|
||||
} else {
|
||||
$startIndex = 0;
|
||||
}
|
||||
$itemsPerPage = (!empty($_GET['count']) ? intval($_GET['count']) : $totalResults);
|
||||
|
||||
Logger::info("Start system mode query");
|
||||
$contacts = DBA::selectToArray('owner-view', [], ['net-publish' => true], ['limit' => [$startIndex, $itemsPerPage]]);
|
||||
|
||||
Logger::info("Query done");
|
||||
|
||||
$ret = [];
|
||||
if (!empty($_GET['sorted'])) {
|
||||
$ret['sorted'] = false;
|
||||
}
|
||||
if (!empty($_GET['filtered'])) {
|
||||
$ret['filtered'] = false;
|
||||
}
|
||||
if (!empty($_GET['updatedSince'])) {
|
||||
$ret['updatedSince'] = false;
|
||||
}
|
||||
$ret['startIndex'] = (int) $startIndex;
|
||||
$ret['itemsPerPage'] = (int) $itemsPerPage;
|
||||
$ret['totalResults'] = (int) $totalResults;
|
||||
$ret['entry'] = [];
|
||||
|
||||
$fields_ret = [
|
||||
'id' => false,
|
||||
'displayName' => false,
|
||||
'urls' => false,
|
||||
'updated' => false,
|
||||
'preferredUsername' => false,
|
||||
'photos' => false,
|
||||
'aboutMe' => false,
|
||||
'currentLocation' => false,
|
||||
'network' => false,
|
||||
'tags' => false,
|
||||
'address' => false,
|
||||
'contactType' => false,
|
||||
'generation' => false
|
||||
];
|
||||
|
||||
if (empty($_GET['fields'])) {
|
||||
foreach ($fields_ret as $k => $v) {
|
||||
$fields_ret[$k] = true;
|
||||
}
|
||||
} else {
|
||||
$fields_req = explode(',', $_GET['fields']);
|
||||
foreach ($fields_req as $f) {
|
||||
$fields_ret[trim($f)] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($contacts)) {
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
|
||||
if (DBA::isResult($contacts)) {
|
||||
foreach ($contacts as $contact) {
|
||||
if (!isset($contact['updated'])) {
|
||||
$contact['updated'] = '';
|
||||
}
|
||||
|
||||
if (! isset($contact['generation'])) {
|
||||
$contact['generation'] = 1;
|
||||
}
|
||||
|
||||
if (($contact['keywords'] == "") && isset($contact['pub_keywords'])) {
|
||||
$contact['keywords'] = $contact['pub_keywords'];
|
||||
}
|
||||
if (isset($contact['account-type'])) {
|
||||
$contact['contact-type'] = $contact['account-type'];
|
||||
}
|
||||
|
||||
$cacheKey = 'about:' . $contact['nick'] . ':' . DateTimeFormat::utc($contact['updated'], DateTimeFormat::ATOM);
|
||||
$about = DI::cache()->get($cacheKey);
|
||||
if (is_null($about)) {
|
||||
$about = BBCode::convertForUriId($contact['uri-id'], $contact['about']);
|
||||
DI::cache()->set($cacheKey, $about);
|
||||
}
|
||||
|
||||
// Non connected persons can only see the keywords of a Diaspora account
|
||||
if ($contact['network'] == Protocol::DIASPORA) {
|
||||
$contact['location'] = "";
|
||||
$about = "";
|
||||
}
|
||||
|
||||
$entry = [];
|
||||
if ($fields_ret['id']) {
|
||||
$entry['id'] = (int)$contact['id'];
|
||||
}
|
||||
if ($fields_ret['displayName']) {
|
||||
$entry['displayName'] = $contact['name'];
|
||||
}
|
||||
if ($fields_ret['aboutMe']) {
|
||||
$entry['aboutMe'] = $about;
|
||||
}
|
||||
if ($fields_ret['currentLocation']) {
|
||||
$entry['currentLocation'] = $contact['location'];
|
||||
}
|
||||
if ($fields_ret['generation']) {
|
||||
$entry['generation'] = (int)$contact['generation'];
|
||||
}
|
||||
if ($fields_ret['urls']) {
|
||||
$entry['urls'] = [['value' => $contact['url'], 'type' => 'profile']];
|
||||
if ($contact['addr'] && ($contact['network'] !== Protocol::MAIL)) {
|
||||
$entry['urls'][] = ['value' => 'acct:' . $contact['addr'], 'type' => 'webfinger'];
|
||||
}
|
||||
}
|
||||
if ($fields_ret['preferredUsername']) {
|
||||
$entry['preferredUsername'] = $contact['nick'];
|
||||
}
|
||||
if ($fields_ret['updated']) {
|
||||
$entry['updated'] = $contact['success_update'];
|
||||
|
||||
if ($contact['name-date'] > $entry['updated']) {
|
||||
$entry['updated'] = $contact['name-date'];
|
||||
}
|
||||
if ($contact['uri-date'] > $entry['updated']) {
|
||||
$entry['updated'] = $contact['uri-date'];
|
||||
}
|
||||
if ($contact['avatar-date'] > $entry['updated']) {
|
||||
$entry['updated'] = $contact['avatar-date'];
|
||||
}
|
||||
$entry['updated'] = date("c", strtotime($entry['updated']));
|
||||
}
|
||||
if ($fields_ret['photos']) {
|
||||
$entry['photos'] = [['value' => $contact['photo'], 'type' => 'profile']];
|
||||
}
|
||||
if ($fields_ret['network']) {
|
||||
$entry['network'] = $contact['network'];
|
||||
if ($entry['network'] == Protocol::STATUSNET) {
|
||||
$entry['network'] = Protocol::OSTATUS;
|
||||
}
|
||||
if (($entry['network'] == "") && ($contact['self'])) {
|
||||
$entry['network'] = Protocol::DFRN;
|
||||
}
|
||||
}
|
||||
if ($fields_ret['tags']) {
|
||||
$tags = str_replace(",", " ", $contact['keywords']);
|
||||
$tags = explode(" ", $tags);
|
||||
|
||||
$cleaned = [];
|
||||
foreach ($tags as $tag) {
|
||||
$tag = trim(strtolower($tag));
|
||||
if ($tag != "") {
|
||||
$cleaned[] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
$entry['tags'] = [$cleaned];
|
||||
}
|
||||
if ($fields_ret['address']) {
|
||||
$entry['address'] = [];
|
||||
|
||||
if (isset($contact['locality'])) {
|
||||
$entry['address']['locality'] = $contact['locality'];
|
||||
}
|
||||
|
||||
if (isset($contact['region'])) {
|
||||
$entry['address']['region'] = $contact['region'];
|
||||
}
|
||||
|
||||
if (isset($contact['country'])) {
|
||||
$entry['address']['country'] = $contact['country'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($fields_ret['contactType']) {
|
||||
$entry['contactType'] = intval($contact['contact-type']);
|
||||
}
|
||||
$ret['entry'][] = $entry;
|
||||
}
|
||||
} else {
|
||||
$ret['entry'][] = [];
|
||||
}
|
||||
|
||||
Logger::info("End of poco");
|
||||
|
||||
if ($format === 'json') {
|
||||
System::jsonExit($ret);
|
||||
} else {
|
||||
throw new \Friendica\Network\HTTPException\UnsupportedMediaTypeException();
|
||||
}
|
||||
}
|
158
mod/pubsub.php
158
mod/pubsub.php
|
@ -1,158 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Model\Post;
|
||||
|
||||
function hub_return($valid, $body)
|
||||
{
|
||||
if ($valid) {
|
||||
echo $body;
|
||||
} else {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
// when receiving an XML feed, always return OK
|
||||
|
||||
function hub_post_return()
|
||||
{
|
||||
throw new \Friendica\Network\HTTPException\OKException();
|
||||
}
|
||||
|
||||
function pubsub_init(App $a)
|
||||
{
|
||||
$nick = ((DI::args()->getArgc() > 1) ? trim(DI::args()->getArgv()[1]) : '');
|
||||
$contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
|
||||
|
||||
if (DI::args()->getMethod() === App\Router::GET) {
|
||||
$hub_mode = trim($_GET['hub_mode'] ?? '');
|
||||
$hub_topic = trim($_GET['hub_topic'] ?? '');
|
||||
$hub_challenge = trim($_GET['hub_challenge'] ?? '');
|
||||
$hub_verify = trim($_GET['hub_verify_token'] ?? '');
|
||||
|
||||
Logger::notice('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
|
||||
Logger::debug('Data: ', ['get' => $_GET]);
|
||||
|
||||
$subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
|
||||
|
||||
$owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (!DBA::isResult($owner)) {
|
||||
Logger::notice('Local account not found: ' . $nick);
|
||||
hub_return(false, '');
|
||||
}
|
||||
|
||||
$condition = ['uid' => $owner['uid'], 'id' => $contact_id, 'blocked' => false, 'pending' => false];
|
||||
|
||||
if (!empty($hub_verify)) {
|
||||
$condition['hub-verify'] = $hub_verify;
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
|
||||
if (!DBA::isResult($contact)) {
|
||||
Logger::notice('Contact ' . $contact_id . ' not found.');
|
||||
hub_return(false, '');
|
||||
}
|
||||
|
||||
if (!empty($hub_topic) && !Strings::compareLink($hub_topic, $contact['poll'])) {
|
||||
Logger::notice('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
|
||||
hub_return(false, '');
|
||||
}
|
||||
|
||||
// We must initiate an unsubscribe request with a verify_token.
|
||||
// Don't allow outsiders to unsubscribe us.
|
||||
|
||||
if (($hub_mode === 'unsubscribe') && empty($hub_verify)) {
|
||||
Logger::notice('Bogus unsubscribe');
|
||||
hub_return(false, '');
|
||||
}
|
||||
|
||||
if (!empty($hub_mode)) {
|
||||
Contact::update(['subhub' => $subscribe], ['id' => $contact['id']]);
|
||||
Logger::notice($hub_mode . ' success for contact ' . $contact_id . '.');
|
||||
}
|
||||
hub_return(true, $hub_challenge);
|
||||
}
|
||||
}
|
||||
|
||||
function pubsub_post(App $a)
|
||||
{
|
||||
$xml = Network::postdata();
|
||||
|
||||
Logger::info('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
|
||||
Logger::debug('Data: ' . $xml);
|
||||
|
||||
$nick = ((DI::args()->getArgc() > 1) ? trim(DI::args()->getArgv()[1]) : '');
|
||||
$contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
|
||||
|
||||
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (!DBA::isResult($importer)) {
|
||||
hub_post_return();
|
||||
}
|
||||
|
||||
$condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
$author = OStatus::salmonAuthor($xml, $importer);
|
||||
if (!empty($author['contact-id'])) {
|
||||
$condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
Logger::notice('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
|
||||
}
|
||||
if (!DBA::isResult($contact)) {
|
||||
Logger::notice('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
|
||||
hub_post_return();
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($contact['gsid'])) {
|
||||
GServer::setProtocol($contact['gsid'], Post\DeliveryData::OSTATUS);
|
||||
}
|
||||
|
||||
if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != Protocol::FEED)) {
|
||||
Logger::notice('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
|
||||
hub_post_return();
|
||||
}
|
||||
|
||||
// We only import feeds from OStatus here
|
||||
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS])) {
|
||||
Logger::warning('Unexpected network', ['contact' => $contact]);
|
||||
hub_post_return();
|
||||
}
|
||||
|
||||
Logger::info('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')');
|
||||
$feedhub = '';
|
||||
OStatus::import($xml, $importer, $contact, $feedhub);
|
||||
|
||||
hub_post_return();
|
||||
}
|
|
@ -1,147 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\PushSubscriber;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function pubsubhubbub_init(App $a) {
|
||||
// PuSH subscription must be considered "public" so just block it
|
||||
// if public access isn't enabled.
|
||||
if (DI::config()->get('system', 'block_public')) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
// Subscription request from subscriber
|
||||
// https://pubsubhubbub.googlecode.com/git/pubsubhubbub-core-0.4.html#anchor4
|
||||
// Example from GNU Social:
|
||||
// [hub_mode] => subscribe
|
||||
// [hub_callback] => http://status.local/main/push/callback/1
|
||||
// [hub_verify] => sync
|
||||
// [hub_verify_token] => af11...
|
||||
// [hub_secret] => af11...
|
||||
// [hub_topic] => http://friendica.local/dfrn_poll/sazius
|
||||
|
||||
if (DI::args()->getMethod() === App\Router::POST) {
|
||||
$hub_mode = $_POST['hub_mode'] ?? '';
|
||||
$hub_callback = $_POST['hub_callback'] ?? '';
|
||||
$hub_verify_token = $_POST['hub_verify_token'] ?? '';
|
||||
$hub_secret = $_POST['hub_secret'] ?? '';
|
||||
$hub_topic = $_POST['hub_topic'] ?? '';
|
||||
|
||||
// check for valid hub_mode
|
||||
if ($hub_mode === 'subscribe') {
|
||||
$subscribe = 1;
|
||||
} elseif ($hub_mode === 'unsubscribe') {
|
||||
$subscribe = 0;
|
||||
} else {
|
||||
Logger::notice("Invalid hub_mode=$hub_mode, ignoring.");
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
Logger::info("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (DI::args()->getArgc() > 1) {
|
||||
// Normally the url should now contain the nick name as last part of the url
|
||||
$nick = DI::args()->getArgv()[1];
|
||||
} else {
|
||||
// Get the nick name from the topic as a fallback
|
||||
$nick = $hub_topic;
|
||||
}
|
||||
// Extract nick name and strip any .atom extension
|
||||
$nick = basename($nick, '.atom');
|
||||
|
||||
if (!$nick) {
|
||||
Logger::notice('Bad hub_topic=$hub_topic, ignoring.');
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
// fetch user from database given the nickname
|
||||
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
|
||||
$owner = DBA::selectFirst('user', ['uid', 'nickname'], $condition);
|
||||
if (!DBA::isResult($owner)) {
|
||||
Logger::notice('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
// get corresponding row from contact table
|
||||
$condition = ['uid' => $owner['uid'], 'blocked' => false,
|
||||
'pending' => false, 'self' => true];
|
||||
$contact = DBA::selectFirst('contact', ['poll'], $condition);
|
||||
if (!DBA::isResult($contact)) {
|
||||
Logger::notice('Self contact for user ' . $owner['uid'] . ' not found.');
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
// sanity check that topic URLs are the same
|
||||
$hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic);
|
||||
$self = DI::baseUrl() . '/api/statuses/user_timeline/' . $owner['nickname'] . '.atom';
|
||||
|
||||
if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll']) && !Strings::compareLink($hub_topic, $self)) {
|
||||
Logger::notice('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
// do subscriber verification according to the PuSH protocol
|
||||
$hub_challenge = Strings::getRandomHex(40);
|
||||
|
||||
$params = http_build_query([
|
||||
'hub.mode' => $subscribe == 1 ? 'subscribe' : 'unsubscribe',
|
||||
'hub.topic' => $hub_topic,
|
||||
'hub.challenge' => $hub_challenge,
|
||||
'hub.verify_token' => $hub_verify_token,
|
||||
|
||||
// lease time is hard coded to one week (in seconds)
|
||||
// we don't actually enforce the lease time because GNU
|
||||
// Social/StatusNet doesn't honour it (yet)
|
||||
'hub.lease_seconds' => 604800,
|
||||
]);
|
||||
|
||||
$hub_callback = rtrim($hub_callback, ' ?&#');
|
||||
$separator = parse_url($hub_callback, PHP_URL_QUERY) === null ? '?' : '&';
|
||||
|
||||
$fetchResult = DI::httpClient()->fetchFull($hub_callback . $separator . $params);
|
||||
$body = $fetchResult->getBody();
|
||||
$ret = $fetchResult->getReturnCode();
|
||||
|
||||
// give up if the HTTP return code wasn't a success (2xx)
|
||||
if ($ret < 200 || $ret > 299) {
|
||||
Logger::notice("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
// check that the correct hub_challenge code was echoed back
|
||||
if (trim($body) !== $hub_challenge) {
|
||||
Logger::notice("Subscriber did not echo back hub.challenge, ignoring.");
|
||||
Logger::notice("\"$hub_challenge\" != \"".trim($body)."\"");
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
PushSubscriber::renew($owner['uid'], $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret);
|
||||
|
||||
throw new \Friendica\Network\HTTPException\AcceptedException();
|
||||
}
|
||||
System::exit();
|
||||
}
|
178
mod/redir.php
178
mod/redir.php
|
@ -1,178 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function redir_init(App $a) {
|
||||
if (!Session::isAuthenticated()) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
||||
|
||||
$url = $_GET['url'] ?? '';
|
||||
|
||||
if (DI::args()->getArgc() > 1 && intval(DI::args()->getArgv()[1])) {
|
||||
$cid = intval(DI::args()->getArgv()[1]);
|
||||
} else {
|
||||
$cid = 0;
|
||||
}
|
||||
|
||||
// Try magic auth before the legacy stuff
|
||||
redir_magic($a, $cid, $url);
|
||||
|
||||
if (empty($cid)) {
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException(DI::l10n()->t('Bad Request.'));
|
||||
}
|
||||
|
||||
$fields = ['id', 'uid', 'nurl', 'url', 'addr', 'name'];
|
||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('Contact not found.'));
|
||||
}
|
||||
|
||||
$contact_url = $contact['url'];
|
||||
|
||||
if (!empty($a->getContactId()) && $a->getContactId() == $cid) {
|
||||
// Local user is already authenticated.
|
||||
redir_check_url($contact_url, $url);
|
||||
$a->redirect($url ?: $contact_url);
|
||||
}
|
||||
|
||||
if ($contact['uid'] == 0 && local_user()) {
|
||||
// Let's have a look if there is an established connection
|
||||
// between the public contact we have found and the local user.
|
||||
$contact = DBA::selectFirst('contact', $fields, ['nurl' => $contact['nurl'], 'uid' => local_user()]);
|
||||
|
||||
if (DBA::isResult($contact)) {
|
||||
$cid = $contact['id'];
|
||||
}
|
||||
|
||||
if (!empty($a->getContactId()) && $a->getContactId() == $cid) {
|
||||
// Local user is already authenticated.
|
||||
redir_check_url($contact_url, $url);
|
||||
$target_url = $url ?: $contact_url;
|
||||
Logger::info($contact['name'] . " is already authenticated. Redirecting to " . $target_url);
|
||||
$a->redirect($target_url);
|
||||
}
|
||||
}
|
||||
|
||||
if (remote_user()) {
|
||||
$host = substr(DI::baseUrl()->getUrlPath() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : ''), strpos(DI::baseUrl()->getUrlPath(), '://') + 3);
|
||||
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
|
||||
|
||||
// On a local instance we have to check if the local user has already authenticated
|
||||
// with the local contact. Otherwise the local user would ask the local contact
|
||||
// for authentification everytime he/she is visiting a profile page of the local
|
||||
// contact.
|
||||
if (($host == $remotehost) && (Session::getRemoteContactID(Session::get('visitor_visiting')) == Session::get('visitor_id'))) {
|
||||
// Remote user is already authenticated.
|
||||
redir_check_url($contact_url, $url);
|
||||
$target_url = $url ?: $contact_url;
|
||||
Logger::info($contact['name'] . " is already authenticated. Redirecting to " . $target_url);
|
||||
$a->redirect($target_url);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($url)) {
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException(DI::l10n()->t('Bad Request.'));
|
||||
}
|
||||
|
||||
// If we don't have a connected contact, redirect with
|
||||
// the 'zrl' parameter.
|
||||
$my_profile = Profile::getMyURL();
|
||||
|
||||
if (!empty($my_profile) && !Strings::compareLink($my_profile, $url)) {
|
||||
$separator = strpos($url, '?') ? '&' : '?';
|
||||
|
||||
$url .= $separator . 'zrl=' . urlencode($my_profile);
|
||||
}
|
||||
|
||||
Logger::info('redirecting to ' . $url);
|
||||
$a->redirect($url);
|
||||
}
|
||||
|
||||
function redir_magic($a, $cid, $url)
|
||||
{
|
||||
$visitor = Profile::getMyURL();
|
||||
if (!empty($visitor)) {
|
||||
Logger::info('Got my url', ['visitor' => $visitor]);
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['url'], ['id' => $cid]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
Logger::info('Contact not found', ['id' => $cid]);
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('Contact not found.'));
|
||||
} else {
|
||||
$contact_url = $contact['url'];
|
||||
redir_check_url($contact_url, $url);
|
||||
$target_url = $url ?: $contact_url;
|
||||
}
|
||||
|
||||
$basepath = Contact::getBasepath($contact_url);
|
||||
|
||||
// We don't use magic auth when there is no visitor, we are on the same system or we visit our own stuff
|
||||
if (empty($visitor) || Strings::compareLink($basepath, DI::baseUrl()) || Strings::compareLink($contact_url, $visitor)) {
|
||||
Logger::info('Redirecting without magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
|
||||
DI::app()->redirect($target_url);
|
||||
}
|
||||
|
||||
// Test for magic auth on the target system
|
||||
$serverret = DI::httpClient()->head($basepath . '/magic', [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::HTML]);
|
||||
if ($serverret->isSuccess()) {
|
||||
$separator = strpos($target_url, '?') ? '&' : '?';
|
||||
$target_url .= $separator . 'zrl=' . urlencode($visitor) . '&addr=' . urlencode($contact_url);
|
||||
|
||||
Logger::info('Redirecting with magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
|
||||
System::externalRedirect($target_url);
|
||||
} else {
|
||||
Logger::info('No magic for contact', ['contact' => $contact_url]);
|
||||
}
|
||||
}
|
||||
|
||||
function redir_check_url(string $contact_url, string $url)
|
||||
{
|
||||
if (empty($contact_url) || empty($url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$url_host = parse_url($url, PHP_URL_HOST);
|
||||
if (empty($url_host)) {
|
||||
$url_host = parse_url(DI::baseUrl(), PHP_URL_HOST);
|
||||
}
|
||||
|
||||
$contact_url_host = parse_url($contact_url, PHP_URL_HOST);
|
||||
|
||||
if ($url_host == $contact_url_host) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger::error('URL check host mismatch', ['contact' => $contact_url, 'url' => $url]);
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
108
mod/removeme.php
108
mod/removeme.php
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function removeme_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($_POST['qxz_password'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($_POST['verify'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_POST['verify'] !== $_SESSION['remove_account_verify']) {
|
||||
return;
|
||||
}
|
||||
|
||||
// send notification to admins so that they can clean um the backups
|
||||
// send email to admins
|
||||
$admin_mails = explode(",", str_replace(" ", "", DI::config()->get('config', 'admin_email')));
|
||||
foreach ($admin_mails as $mail) {
|
||||
$admin = DBA::selectFirst('user', ['uid', 'language', 'email', 'username'], ['email' => $mail]);
|
||||
if (!DBA::isResult($admin)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$l10n = DI::l10n()->withLang($admin['language']);
|
||||
|
||||
$email = DI::emailer()
|
||||
->newSystemMail()
|
||||
->withMessage(
|
||||
$l10n->t('[Friendica System Notify]') . ' ' . $l10n->t('User deleted their account'),
|
||||
$l10n->t('On your Friendica node an user deleted their account. Please ensure that their data is removed from the backups.'),
|
||||
$l10n->t('The user id is %d', local_user()))
|
||||
->forUser($admin)
|
||||
->withRecipient($admin['email'])
|
||||
->build();
|
||||
DI::emailer()->send($email);
|
||||
}
|
||||
|
||||
if (User::getIdFromPasswordAuthentication($a->getLoggedInUserId(), trim($_POST['qxz_password']))) {
|
||||
User::remove($a->getLoggedInUserId());
|
||||
|
||||
unset($_SESSION['authenticated']);
|
||||
unset($_SESSION['uid']);
|
||||
DI::baseUrl()->redirect();
|
||||
// NOTREACHED
|
||||
}
|
||||
}
|
||||
|
||||
function removeme_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
$hash = Strings::getRandomHex();
|
||||
|
||||
require_once("mod/settings.php");
|
||||
settings_init($a);
|
||||
|
||||
$_SESSION['remove_account_verify'] = $hash;
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('removeme.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$basedir' => DI::baseUrl()->get(),
|
||||
'$hash' => $hash,
|
||||
'$title' => DI::l10n()->t('Remove My Account'),
|
||||
'$desc' => DI::l10n()->t('This will completely remove your account. Once this has been done it is not recoverable.'),
|
||||
'$passwd' => DI::l10n()->t('Please enter your password for verification:'),
|
||||
'$submit' => DI::l10n()->t('Remove My Account')
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
function repair_ostatus_content(App $a) {
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('ostatus_repair');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$o = '<h2>' . DI::l10n()->t('Resubscribing to OStatus contacts') . '</h2>';
|
||||
|
||||
$uid = local_user();
|
||||
|
||||
$counter = intval($_REQUEST['counter'] ?? 0);
|
||||
|
||||
$condition = ['uid' => $uid, 'network' => Protocol::OSTATUS, 'rel' => [Contact::FRIEND, Contact::SHARING]];
|
||||
$total = DBA::count('contact', $condition);
|
||||
|
||||
if (!$total) {
|
||||
return ($o . DI::l10n()->t('Error'));
|
||||
}
|
||||
|
||||
$contact = Contact::selectToArray(['url'], $condition, ['order' => ['url'], 'limit' => [$counter++, 1]]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
$o .= DI::l10n()->t('Done');
|
||||
return $o;
|
||||
}
|
||||
|
||||
$o .= '<p>' . $counter . '/' . $total . ': ' . $contact[0]['url'] . '</p>';
|
||||
|
||||
$o .= '<p>' . DI::l10n()->t('Keep this window open until done.') . '</p>';
|
||||
|
||||
Contact::createFromProbeForUser($a->getLoggedInUserId(), $contact[0]['url']);
|
||||
|
||||
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="1; URL=' . DI::baseUrl() . '/repair_ostatus?counter=' . $counter . '">';
|
||||
|
||||
return $o;
|
||||
}
|
183
mod/salmon.php
183
mod/salmon.php
|
@ -1,183 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Protocol\ActivityNamespace;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function salmon_post(App $a, $xml = '') {
|
||||
|
||||
if (empty($xml)) {
|
||||
$xml = Network::postdata();
|
||||
}
|
||||
|
||||
Logger::debug('new salmon ' . $xml);
|
||||
|
||||
$nick = trim(DI::args()->getArgv()[1] ?? '');
|
||||
|
||||
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (! DBA::isResult($importer)) {
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
|
||||
// parse the xml
|
||||
|
||||
$dom = simplexml_load_string($xml,'SimpleXMLElement',0, ActivityNamespace::SALMON_ME);
|
||||
|
||||
$base = null;
|
||||
|
||||
// figure out where in the DOM tree our data is hiding
|
||||
if (!empty($dom->provenance->data))
|
||||
$base = $dom->provenance;
|
||||
elseif (!empty($dom->env->data))
|
||||
$base = $dom->env;
|
||||
elseif (!empty($dom->data))
|
||||
$base = $dom;
|
||||
|
||||
if (empty($base)) {
|
||||
Logger::notice('unable to locate salmon data in xml');
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
// Stash the signature away for now. We have to find their key or it won't be good for anything.
|
||||
|
||||
|
||||
$signature = Strings::base64UrlDecode($base->sig);
|
||||
|
||||
// unpack the data
|
||||
|
||||
// strip whitespace so our data element will return to one big base64 blob
|
||||
$data = str_replace([" ","\t","\r","\n"],["","","",""],$base->data);
|
||||
|
||||
// stash away some other stuff for later
|
||||
|
||||
$type = $base->data[0]->attributes()->type[0];
|
||||
$keyhash = $base->sig[0]->attributes()->keyhash[0] ?? '';
|
||||
$encoding = $base->encoding;
|
||||
$alg = $base->alg;
|
||||
|
||||
// Salmon magic signatures have evolved and there is no way of knowing ahead of time which
|
||||
// flavour we have. We'll try and verify it regardless.
|
||||
|
||||
$stnet_signed_data = $data;
|
||||
|
||||
$signed_data = $data . '.' . Strings::base64UrlEncode($type) . '.' . Strings::base64UrlEncode($encoding) . '.' . Strings::base64UrlEncode($alg);
|
||||
|
||||
$compliant_format = str_replace('=', '', $signed_data);
|
||||
|
||||
|
||||
// decode the data
|
||||
$data = Strings::base64UrlDecode($data);
|
||||
|
||||
$author = OStatus::salmonAuthor($data, $importer);
|
||||
$author_link = $author["author-link"];
|
||||
|
||||
if(! $author_link) {
|
||||
Logger::notice('Could not retrieve author URI.');
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
// Once we have the author URI, go to the web and try to find their public key
|
||||
|
||||
Logger::notice('Fetching key for ' . $author_link);
|
||||
|
||||
$key = Salmon::getKey($author_link, $keyhash);
|
||||
|
||||
if(! $key) {
|
||||
Logger::notice('Could not retrieve author key.');
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
$key_info = explode('.',$key);
|
||||
|
||||
$m = Strings::base64UrlDecode($key_info[1]);
|
||||
$e = Strings::base64UrlDecode($key_info[2]);
|
||||
|
||||
Logger::info('key details', ['info' => $key_info]);
|
||||
|
||||
$pubkey = Crypto::meToPem($m, $e);
|
||||
|
||||
// We should have everything we need now. Let's see if it verifies.
|
||||
|
||||
// Try GNU Social format
|
||||
$verify = Crypto::rsaVerify($signed_data, $signature, $pubkey);
|
||||
$mode = 1;
|
||||
|
||||
if (! $verify) {
|
||||
Logger::notice('message did not verify using protocol. Trying compliant format.');
|
||||
$verify = Crypto::rsaVerify($compliant_format, $signature, $pubkey);
|
||||
$mode = 2;
|
||||
}
|
||||
|
||||
if (! $verify) {
|
||||
Logger::notice('message did not verify using padding. Trying old statusnet format.');
|
||||
$verify = Crypto::rsaVerify($stnet_signed_data, $signature, $pubkey);
|
||||
$mode = 3;
|
||||
}
|
||||
|
||||
if (! $verify) {
|
||||
Logger::notice('Message did not verify. Discarding.');
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
Logger::notice('Message verified with mode '.$mode);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* If we reached this point, the message is good. Now let's figure out if the author is allowed to send us stuff.
|
||||
*
|
||||
*/
|
||||
|
||||
$contact = DBA::selectFirst('contact', [], ["`network` IN (?, ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `uid` = ?",
|
||||
Protocol::OSTATUS, Protocol::DFRN, Strings::normaliseLink($author_link), $author_link, Strings::normaliseLink($author_link), $importer['uid']]);
|
||||
|
||||
if (!empty($contact['gsid'])) {
|
||||
GServer::setProtocol($contact['gsid'], Post\DeliveryData::OSTATUS);
|
||||
}
|
||||
|
||||
// Have we ignored the person?
|
||||
// If so we can not accept this post.
|
||||
|
||||
if (!empty($contact['blocked'])) {
|
||||
Logger::notice('Ignoring this author.');
|
||||
throw new \Friendica\Network\HTTPException\AcceptedException();
|
||||
}
|
||||
|
||||
// Placeholder for hub discovery.
|
||||
$hub = '';
|
||||
|
||||
$contact = $contact ?: [];
|
||||
|
||||
OStatus::import($data, $importer, $contact, $hub);
|
||||
|
||||
throw new \Friendica\Network\HTTPException\OKException();
|
||||
}
|
358
mod/settings.php
358
mod/settings.php
|
@ -1,358 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Protocol\Email;
|
||||
|
||||
function settings_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
BaseSettings::createAside();
|
||||
}
|
||||
|
||||
function settings_post(App $a)
|
||||
{
|
||||
if (!$a->isLoggedIn()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'addon')) {
|
||||
BaseModule::checkFormSecurityTokenRedirectOnError(DI::args()->getQueryString(), 'settings_addon');
|
||||
|
||||
Hook::callAll('addon_settings_post', $_POST);
|
||||
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getById($a->getLoggedInUserId());
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'connectors')) {
|
||||
BaseModule::checkFormSecurityTokenRedirectOnError(DI::args()->getQueryString(), 'settings_connectors');
|
||||
|
||||
if (!empty($_POST['general-submit'])) {
|
||||
DI::pConfig()->set(local_user(), 'system', 'accept_only_sharer', intval($_POST['accept_only_sharer']));
|
||||
DI::pConfig()->set(local_user(), 'system', 'disable_cw', !intval($_POST['enable_cw']));
|
||||
DI::pConfig()->set(local_user(), 'system', 'no_intelligent_shortening', !intval($_POST['enable_smart_shortening']));
|
||||
DI::pConfig()->set(local_user(), 'system', 'simple_shortening', intval($_POST['simple_shortening']));
|
||||
DI::pConfig()->set(local_user(), 'system', 'attach_link_title', intval($_POST['attach_link_title']));
|
||||
DI::pConfig()->set(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
|
||||
} elseif (!empty($_POST['mail-submit'])) {
|
||||
$mail_server = $_POST['mail_server'] ?? '';
|
||||
$mail_port = $_POST['mail_port'] ?? '';
|
||||
$mail_ssl = strtolower(trim($_POST['mail_ssl'] ?? ''));
|
||||
$mail_user = $_POST['mail_user'] ?? '';
|
||||
$mail_pass = trim($_POST['mail_pass'] ?? '');
|
||||
$mail_action = trim($_POST['mail_action'] ?? '');
|
||||
$mail_movetofolder = trim($_POST['mail_movetofolder'] ?? '');
|
||||
$mail_replyto = $_POST['mail_replyto'] ?? '';
|
||||
$mail_pubmail = $_POST['mail_pubmail'] ?? '';
|
||||
|
||||
if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
|
||||
if (!DBA::exists('mailacct', ['uid' => local_user()])) {
|
||||
DBA::insert('mailacct', ['uid' => local_user()]);
|
||||
}
|
||||
if (strlen($mail_pass)) {
|
||||
$pass = '';
|
||||
openssl_public_encrypt($mail_pass, $pass, $user['pubkey']);
|
||||
DBA::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]);
|
||||
}
|
||||
|
||||
$r = DBA::update('mailacct', [
|
||||
'server' => $mail_server,
|
||||
'port' => $mail_port,
|
||||
'ssltype' => $mail_ssl,
|
||||
'user' => $mail_user,
|
||||
'action' => $mail_action,
|
||||
'movetofolder' => $mail_movetofolder,
|
||||
'mailbox' => 'INBOX',
|
||||
'reply_to' => $mail_replyto,
|
||||
'pubmail' => $mail_pubmail
|
||||
], ['uid' => local_user()]);
|
||||
|
||||
Logger::debug('updating mailaccount', ['response' => $r]);
|
||||
$mailacct = DBA::selectFirst('mailacct', [], ['uid' => local_user()]);
|
||||
if (DBA::isResult($mailacct)) {
|
||||
$mb = Email::constructMailboxName($mailacct);
|
||||
|
||||
if (strlen($mailacct['server'])) {
|
||||
$dcrpass = '';
|
||||
openssl_private_decrypt(hex2bin($mailacct['pass']), $dcrpass, $user['prvkey']);
|
||||
$mbox = Email::connect($mb, $mail_user, $dcrpass);
|
||||
unset($dcrpass);
|
||||
if (!$mbox) {
|
||||
notice(DI::l10n()->t('Failed to connect with email account using the settings provided.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Hook::callAll('connector_settings_post', $_POST);
|
||||
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||
return;
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features')) {
|
||||
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/features', 'settings_features');
|
||||
foreach ($_POST as $k => $v) {
|
||||
if (strpos($k, 'feature_') === 0) {
|
||||
DI::pConfig()->set(local_user(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function settings_content(App $a)
|
||||
{
|
||||
$o = '';
|
||||
Nav::setSelected('settings');
|
||||
|
||||
if (!local_user()) {
|
||||
//notice(DI::l10n()->t('Permission denied.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'oauth')) {
|
||||
if ((DI::args()->getArgc() > 3) && (DI::args()->getArgv()[2] === 'delete')) {
|
||||
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth', 't');
|
||||
|
||||
DBA::delete('application-token', ['application-id' => DI::args()->getArgv()[3], 'uid' => local_user()]);
|
||||
DI::baseUrl()->redirect('settings/oauth/', true);
|
||||
return '';
|
||||
}
|
||||
|
||||
$applications = DBA::selectToArray('application-view', ['id', 'uid', 'name', 'website', 'scopes', 'created_at'], ['uid' => local_user()]);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings/oauth.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"),
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
'$title' => DI::l10n()->t('Connected Apps'),
|
||||
'$name' => DI::l10n()->t('Name'),
|
||||
'$website' => DI::l10n()->t('Home Page'),
|
||||
'$created_at' => DI::l10n()->t('Created'),
|
||||
'$delete' => DI::l10n()->t('Remove authorization'),
|
||||
'$apps' => $applications,
|
||||
]);
|
||||
return $o;
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'addon')) {
|
||||
$addon_settings_forms = [];
|
||||
foreach (DI::dba()->selectToArray('hook', ['file', 'function'], ['hook' => 'addon_settings']) as $hook) {
|
||||
$data = [];
|
||||
Hook::callSingle(DI::app(), 'addon_settings', [$hook['file'], $hook['function']], $data);
|
||||
|
||||
if (!empty($data['href'])) {
|
||||
$tpl = Renderer::getMarkupTemplate('settings/addon/link.tpl');
|
||||
$addon_settings_forms[] = Renderer::replaceMacros($tpl, [
|
||||
'$addon' => $data['addon'],
|
||||
'$title' => $data['title'],
|
||||
'$href' => $data['href'],
|
||||
]);
|
||||
} elseif(!empty($data['addon'])) {
|
||||
$tpl = Renderer::getMarkupTemplate('settings/addon/panel.tpl');
|
||||
$addon_settings_forms[$data['addon']] = Renderer::replaceMacros($tpl, [
|
||||
'$addon' => $data['addon'],
|
||||
'$title' => $data['title'],
|
||||
'$open' => (DI::args()->getArgv()[2] ?? '') === $data['addon'],
|
||||
'$html' => $data['html'] ?? '',
|
||||
'$submit' => $data['submit'] ?? DI::l10n()->t('Save Settings'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings/addons.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_addon"),
|
||||
'$title' => DI::l10n()->t('Addon Settings'),
|
||||
'$no_addons_settings_configured' => DI::l10n()->t('No Addon settings configured'),
|
||||
'$addon_settings_forms' => $addon_settings_forms,
|
||||
]);
|
||||
return $o;
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features')) {
|
||||
|
||||
$arr = [];
|
||||
$features = Feature::get();
|
||||
foreach ($features as $fname => $fdata) {
|
||||
$arr[$fname] = [];
|
||||
$arr[$fname][0] = $fdata[0];
|
||||
foreach (array_slice($fdata,1) as $f) {
|
||||
$arr[$fname][1][] = ['feature_' . $f[0], $f[1], Feature::isEnabled(local_user(), $f[0]), $f[2]];
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings/features.tpl');
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_features"),
|
||||
'$title' => DI::l10n()->t('Additional Features'),
|
||||
'$features' => $arr,
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
]);
|
||||
return $o;
|
||||
}
|
||||
|
||||
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'connectors')) {
|
||||
$accept_only_sharer = intval(DI::pConfig()->get(local_user(), 'system', 'accept_only_sharer'));
|
||||
$enable_cw = !intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw'));
|
||||
$enable_smart_shortening = !intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening'));
|
||||
$simple_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'simple_shortening'));
|
||||
$attach_link_title = intval(DI::pConfig()->get(local_user(), 'system', 'attach_link_title'));
|
||||
$legacy_contact = DI::pConfig()->get(local_user(), 'ostatus', 'legacy_contact');
|
||||
|
||||
if (!empty($legacy_contact)) {
|
||||
/// @todo Isn't it supposed to be a $a->internalRedirect() call?
|
||||
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
|
||||
}
|
||||
|
||||
$connector_settings_forms = [];
|
||||
foreach (DI::dba()->selectToArray('hook', ['file', 'function'], ['hook' => 'connector_settings']) as $hook) {
|
||||
$data = [];
|
||||
Hook::callSingle(DI::app(), 'connector_settings', [$hook['file'], $hook['function']], $data);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings/addon/connector.tpl');
|
||||
$connector_settings_forms[$data['connector']] = Renderer::replaceMacros($tpl, [
|
||||
'$connector' => $data['connector'],
|
||||
'$title' => $data['title'],
|
||||
'$image' => $data['image'] ?? '',
|
||||
'$enabled' => $data['enabled'] ?? true,
|
||||
'$open' => (DI::args()->getArgv()[2] ?? '') === $data['connector'],
|
||||
'$html' => $data['html'] ?? '',
|
||||
'$submit' => $data['submit'] ?? DI::l10n()->t('Save Settings'),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($a->isSiteAdmin()) {
|
||||
$diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora (Socialhome, Hubzilla)'), ((DI::config()->get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled')));
|
||||
$ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('OStatus (GNU Social)'), ((DI::config()->get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled')));
|
||||
} else {
|
||||
$diasp_enabled = "";
|
||||
$ostat_enabled = "";
|
||||
}
|
||||
|
||||
$mail_disabled = ((function_exists('imap_open') && (!DI::config()->get('system', 'imap_disabled'))) ? 0 : 1);
|
||||
if (!$mail_disabled) {
|
||||
$mailacct = DBA::selectFirst('mailacct', [], ['uid' => local_user()]);
|
||||
} else {
|
||||
$mailacct = null;
|
||||
}
|
||||
|
||||
$mail_server = $mailacct['server'] ?? '';
|
||||
$mail_port = (!empty($mailacct['port']) && is_numeric($mailacct['port'])) ? (int)$mailacct['port'] : '';
|
||||
$mail_ssl = $mailacct['ssltype'] ?? '';
|
||||
$mail_user = $mailacct['user'] ?? '';
|
||||
$mail_replyto = $mailacct['reply_to'] ?? '';
|
||||
$mail_pubmail = $mailacct['pubmail'] ?? 0;
|
||||
$mail_action = $mailacct['action'] ?? 0;
|
||||
$mail_movetofolder = $mailacct['movetofolder'] ?? '';
|
||||
$mail_chk = $mailacct['last_check'] ?? DBA::NULL_DATETIME;
|
||||
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings/connectors.tpl');
|
||||
|
||||
$mail_disabled_message = ($mail_disabled ? DI::l10n()->t('Email access is disabled on this site.') : '');
|
||||
|
||||
$ssl_options = ['TLS' => 'TLS', 'SSL' => 'SSL'];
|
||||
|
||||
if (DI::config()->get('system', 'insecure_imap')) {
|
||||
$ssl_options['notls'] = DI::l10n()->t('None');
|
||||
}
|
||||
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken("settings_connectors"),
|
||||
|
||||
'$title' => DI::l10n()->t('Social Networks'),
|
||||
|
||||
'$diasp_enabled' => $diasp_enabled,
|
||||
'$ostat_enabled' => $ostat_enabled,
|
||||
|
||||
'$general_settings' => DI::l10n()->t('General Social Media Settings'),
|
||||
'$accept_only_sharer' => [
|
||||
'accept_only_sharer',
|
||||
DI::l10n()->t('Followed content scope'),
|
||||
$accept_only_sharer,
|
||||
DI::l10n()->t('By default, conversations in which your follows participated but didn\'t start will be shown in your timeline. You can turn this behavior off, or expand it to the conversations in which your follows liked a post.'),
|
||||
[
|
||||
Item::COMPLETION_NONE => DI::l10n()->t('Only conversations my follows started'),
|
||||
Item::COMPLETION_COMMENT => DI::l10n()->t('Conversations my follows started or commented on (default)'),
|
||||
Item::COMPLETION_LIKE => DI::l10n()->t('Any conversation my follows interacted with, including likes'),
|
||||
]
|
||||
],
|
||||
'$enable_cw' => ['enable_cw', DI::l10n()->t('Enable Content Warning'), $enable_cw, DI::l10n()->t('Users on networks like Mastodon or Pleroma are able to set a content warning field which collapse their post by default. This enables the automatic collapsing instead of setting the content warning as the post title. Doesn\'t affect any other content filtering you eventually set up.')],
|
||||
'$enable_smart_shortening' => ['enable_smart_shortening', DI::l10n()->t('Enable intelligent shortening'), $enable_smart_shortening, DI::l10n()->t('Normally the system tries to find the best link to add to shortened posts. If disabled, every shortened post will always point to the original friendica post.')],
|
||||
'$simple_shortening' => ['simple_shortening', DI::l10n()->t('Enable simple text shortening'), $simple_shortening, DI::l10n()->t('Normally the system shortens posts at the next line feed. If this option is enabled then the system will shorten the text at the maximum character limit.')],
|
||||
'$attach_link_title' => ['attach_link_title', DI::l10n()->t('Attach the link title'), $attach_link_title, DI::l10n()->t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')],
|
||||
'$legacy_contact' => ['legacy_contact', DI::l10n()->t('Your legacy ActivityPub/GNU Social account'), $legacy_contact, DI::l10n()->t("If you enter your old account name from an ActivityPub based system or your GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.")],
|
||||
|
||||
'$repair_ostatus_url' => DI::baseUrl() . '/repair_ostatus',
|
||||
'$repair_ostatus_text' => DI::l10n()->t('Repair OStatus subscriptions'),
|
||||
|
||||
'$connector_settings_forms' => $connector_settings_forms,
|
||||
|
||||
'$h_mail' => DI::l10n()->t('Email/Mailbox Setup'),
|
||||
'$mail_desc' => DI::l10n()->t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
|
||||
'$mail_lastcheck' => ['mail_lastcheck', DI::l10n()->t('Last successful email check:'), $mail_chk, ''],
|
||||
'$mail_disabled' => $mail_disabled_message,
|
||||
'$mail_server' => ['mail_server', DI::l10n()->t('IMAP server name:'), $mail_server, ''],
|
||||
'$mail_port' => ['mail_port', DI::l10n()->t('IMAP port:'), $mail_port, ''],
|
||||
'$mail_ssl' => ['mail_ssl', DI::l10n()->t('Security:'), strtoupper($mail_ssl), '', $ssl_options],
|
||||
'$mail_user' => ['mail_user', DI::l10n()->t('Email login name:'), $mail_user, ''],
|
||||
'$mail_pass' => ['mail_pass', DI::l10n()->t('Email password:'), '', ''],
|
||||
'$mail_replyto' => ['mail_replyto', DI::l10n()->t('Reply-to address:'), $mail_replyto, 'Optional'],
|
||||
'$mail_pubmail' => ['mail_pubmail', DI::l10n()->t('Send public posts to all email contacts:'), $mail_pubmail, ''],
|
||||
'$mail_action' => ['mail_action', DI::l10n()->t('Action after import:'), $mail_action, '', [0 => DI::l10n()->t('None'), 1 => DI::l10n()->t('Delete'), 2 => DI::l10n()->t('Mark as seen'), 3 => DI::l10n()->t('Move to folder')]],
|
||||
'$mail_movetofolder' => ['mail_movetofolder', DI::l10n()->t('Move to folder:'), $mail_movetofolder, ''],
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
]);
|
||||
|
||||
Hook::callAll('display_settings', $o);
|
||||
return $o;
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\Contact as ModuleContact;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
function suggest_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
||||
}
|
||||
|
||||
$_SESSION['return_path'] = DI::args()->getCommand();
|
||||
|
||||
DI::page()['aside'] .= Widget::findPeople();
|
||||
DI::page()['aside'] .= Widget::follow();
|
||||
|
||||
$contacts = Contact\Relation::getSuggestions(local_user());
|
||||
if (!DBA::isResult($contacts)) {
|
||||
return DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
|
||||
}
|
||||
|
||||
$entries = [];
|
||||
foreach ($contacts as $contact) {
|
||||
$entries[] = ModuleContact::getContactTemplateVars($contact);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
||||
return Renderer::replaceMacros($tpl,[
|
||||
'$title' => DI::l10n()->t('Friend Suggestions'),
|
||||
'$contacts' => $entries,
|
||||
]);
|
||||
}
|
171
mod/tagger.php
171
mod/tagger.php
|
@ -1,171 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
function tagger_content(App $a) {
|
||||
|
||||
if (!Session::isAuthenticated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$term = trim($_GET['term'] ?? '');
|
||||
// no commas allowed
|
||||
$term = str_replace([',',' ', '<', '>'],['','_', '', ''], $term);
|
||||
|
||||
if (!$term) {
|
||||
return;
|
||||
}
|
||||
|
||||
$item_id = ((DI::args()->getArgc() > 1) ? trim(DI::args()->getArgv()[1]) : 0);
|
||||
|
||||
Logger::info('tagger: tag', ['term' => $term, 'item' => $item_id]);
|
||||
|
||||
|
||||
$item = Post::selectFirst([], ['id' => $item_id]);
|
||||
|
||||
if (!$item_id || !DBA::isResult($item)) {
|
||||
Logger::notice('tagger: no item ' . $item_id);
|
||||
return;
|
||||
}
|
||||
|
||||
$owner_uid = $item['uid'];
|
||||
|
||||
if (local_user() != $owner_uid) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contact = Contact::selectFirst([], ['self' => true, 'uid' => local_user()]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
Logger::warning('Self contact not found.', ['uid' => local_user()]);
|
||||
return;
|
||||
}
|
||||
|
||||
$uri = Item::newURI();
|
||||
$xterm = XML::escape($term);
|
||||
$post_type = (($item['resource-id']) ? DI::l10n()->t('photo') : DI::l10n()->t('status'));
|
||||
$targettype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE );
|
||||
$href = DI::baseUrl() . '/display/' . $item['guid'];
|
||||
|
||||
$link = XML::escape('<link rel="alternate" type="text/html" href="'. $href . '" />' . "\n");
|
||||
|
||||
$body = XML::escape($item['body']);
|
||||
|
||||
$target = <<< EOT
|
||||
<target>
|
||||
<type>$targettype</type>
|
||||
<local>1</local>
|
||||
<id>{$item['uri']}</id>
|
||||
<link>$link</link>
|
||||
<title></title>
|
||||
<content>$body</content>
|
||||
</target>
|
||||
EOT;
|
||||
|
||||
$tagid = DI::baseUrl() . '/search?tag=' . $xterm;
|
||||
$objtype = Activity\ObjectType::TAGTERM;
|
||||
|
||||
$obj = <<< EOT
|
||||
<object>
|
||||
<type>$objtype</type>
|
||||
<local>1</local>
|
||||
<id>$tagid</id>
|
||||
<link>$tagid</link>
|
||||
<title>$xterm</title>
|
||||
<content>$xterm</content>
|
||||
</object>
|
||||
EOT;
|
||||
|
||||
$bodyverb = DI::l10n()->t('%1$s tagged %2$s\'s %3$s with %4$s');
|
||||
|
||||
if (!isset($bodyverb)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$termlink = html_entity_decode('⌗') . '[url=' . DI::baseUrl() . '/search?tag=' . $term . ']'. $term . '[/url]';
|
||||
|
||||
$arr = [];
|
||||
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uri'] = $uri;
|
||||
$arr['uid'] = $owner_uid;
|
||||
$arr['contact-id'] = $contact['id'];
|
||||
$arr['wall'] = $item['wall'];
|
||||
$arr['gravity'] = GRAVITY_COMMENT;
|
||||
$arr['parent'] = $item['id'];
|
||||
$arr['thr-parent'] = $item['uri'];
|
||||
$arr['owner-name'] = $item['author-name'];
|
||||
$arr['owner-link'] = $item['author-link'];
|
||||
$arr['owner-avatar'] = $item['author-avatar'];
|
||||
$arr['author-name'] = $contact['name'];
|
||||
$arr['author-link'] = $contact['url'];
|
||||
$arr['author-avatar'] = $contact['thumb'];
|
||||
|
||||
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
||||
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]';
|
||||
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink, $termlink );
|
||||
|
||||
$arr['verb'] = Activity::TAG;
|
||||
$arr['target-type'] = $targettype;
|
||||
$arr['target'] = $target;
|
||||
$arr['object-type'] = $objtype;
|
||||
$arr['object'] = $obj;
|
||||
$arr['private'] = $item['private'];
|
||||
$arr['allow_cid'] = $item['allow_cid'];
|
||||
$arr['allow_gid'] = $item['allow_gid'];
|
||||
$arr['deny_cid'] = $item['deny_cid'];
|
||||
$arr['deny_gid'] = $item['deny_gid'];
|
||||
$arr['visible'] = 1;
|
||||
$arr['unseen'] = 1;
|
||||
$arr['origin'] = 1;
|
||||
|
||||
$post_id = Item::insert($arr);
|
||||
|
||||
if (!$item['visible']) {
|
||||
Item::update(['visible' => true], ['id' => $item['id']]);
|
||||
}
|
||||
|
||||
Tag::store($item['uri-id'], Tag::HASHTAG, $term);
|
||||
|
||||
$arr['id'] = $post_id;
|
||||
|
||||
Hook::callAll('post_local_end', $arr);
|
||||
|
||||
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $post_id]);
|
||||
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
|
||||
System::exit();
|
||||
}
|
131
mod/tagrm.php
131
mod/tagrm.php
|
@ -1,131 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Tag;
|
||||
|
||||
function tagrm_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
DI::baseUrl()->redirect($_SESSION['photo_return']);
|
||||
}
|
||||
|
||||
if (!empty($_POST['submit']) && ($_POST['submit'] === DI::l10n()->t('Cancel'))) {
|
||||
DI::baseUrl()->redirect($_SESSION['photo_return']);
|
||||
}
|
||||
|
||||
$tags = [];
|
||||
foreach ($_POST['tag'] ?? [] as $tag) {
|
||||
$tags[] = hex2bin(trim($tag));
|
||||
}
|
||||
|
||||
$item_id = $_POST['item'] ?? 0;
|
||||
update_tags($item_id, $tags);
|
||||
|
||||
DI::baseUrl()->redirect($_SESSION['photo_return']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates tags from an item
|
||||
*
|
||||
* @param $item_id
|
||||
* @param $tags array
|
||||
* @throws Exception
|
||||
*/
|
||||
function update_tags($item_id, $tags)
|
||||
{
|
||||
if (empty($item_id) || empty($tags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]);
|
||||
if (!DBA::isResult($item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($tags as $new_tag) {
|
||||
if (preg_match_all('/([#@!])\[url\=([^\[\]]*)\]([^\[\]]*)\[\/url\]/ism', $new_tag, $results, PREG_SET_ORDER)) {
|
||||
foreach ($results as $tag) {
|
||||
Tag::removeByHash($item['uri-id'], $tag[1], $tag[3], $tag[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function tagrm_content(App $a)
|
||||
{
|
||||
$o = '';
|
||||
|
||||
$photo_return = $_SESSION['photo_return'] ?? '';
|
||||
|
||||
if (!local_user()) {
|
||||
DI::baseUrl()->redirect($photo_return);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (DI::args()->getArgc()== 3) {
|
||||
update_tags(DI::args()->getArgv()[1], [trim(hex2bin(DI::args()->getArgv()[2]))]);
|
||||
DI::baseUrl()->redirect($photo_return);
|
||||
}
|
||||
|
||||
$item_id = ((DI::args()->getArgc()> 1) ? intval(DI::args()->getArgv()[1]) : 0);
|
||||
if (!$item_id) {
|
||||
DI::baseUrl()->redirect($photo_return);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]);
|
||||
if (!DBA::isResult($item)) {
|
||||
DI::baseUrl()->redirect($photo_return);
|
||||
}
|
||||
|
||||
$tag_text = Tag::getCSVByURIId($item['uri-id']);
|
||||
|
||||
$arr = explode(',', $tag_text);
|
||||
|
||||
if (empty($arr)) {
|
||||
DI::baseUrl()->redirect($photo_return);
|
||||
}
|
||||
|
||||
$o .= '<h3>' . DI::l10n()->t('Remove Item Tag') . '</h3>';
|
||||
|
||||
$o .= '<p id="tag-remove-desc">' . DI::l10n()->t('Select a tag to remove: ') . '</p>';
|
||||
|
||||
$o .= '<form id="tagrm" action="tagrm" method="post" >';
|
||||
$o .= '<input type="hidden" name="item" value="' . $item_id . '" />';
|
||||
$o .= '<ul>';
|
||||
|
||||
foreach ($arr as $x) {
|
||||
$o .= '<li><input type="checkbox" name="tag[]" value="' . bin2hex($x) . '" >' . BBCode::convert($x) . '</input></li>';
|
||||
}
|
||||
|
||||
$o .= '</ul>';
|
||||
$o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . DI::l10n()->t('Remove') .'" />';
|
||||
$o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . DI::l10n()->t('Cancel') .'" />';
|
||||
$o .= '</form>';
|
||||
|
||||
return $o;
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* View for user import
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\UserImport;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
function uimport_post(App $a)
|
||||
{
|
||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_FILES['accountfile'])) {
|
||||
UserImport::importAccount($_FILES['accountfile']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function uimport_content(App $a)
|
||||
{
|
||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
||||
notice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$max_dailies = intval(DI::config()->get('system', 'max_daily_registrations'));
|
||||
if ($max_dailies) {
|
||||
$total = DBA::count('user', ["`register_date` > UTC_TIMESTAMP - INTERVAL 1 DAY"]);
|
||||
if ($total >= $max_dailies) {
|
||||
Logger::notice('max daily registrations exceeded.');
|
||||
notice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate("uimport.tpl");
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$regbutt' => DI::l10n()->t('Import'),
|
||||
'$import' => [
|
||||
'title' => DI::l10n()->t("Move account"),
|
||||
'intro' => DI::l10n()->t("You can import an account from another Friendica server."),
|
||||
'instruct' => DI::l10n()->t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),
|
||||
'warn' => DI::l10n()->t("This feature is experimental. We can't import contacts from the OStatus network \x28GNU Social/Statusnet\x29 or from Diaspora"),
|
||||
'field' => ['accountfile', DI::l10n()->t('Account file'), '<input id="id_accountfile" name="accountfile" type="file">', DI::l10n()->t('To export your account, go to "Settings->Export your personal data" and select "Export account"')],
|
||||
],
|
||||
]);
|
||||
}
|
151
mod/unfollow.php
151
mod/unfollow.php
|
@ -1,151 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function unfollow_post(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('login');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$url = trim($_REQUEST['url'] ?? '');
|
||||
|
||||
unfollow_process($url);
|
||||
}
|
||||
|
||||
function unfollow_content(App $a)
|
||||
{
|
||||
$base_return_path = 'contact';
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect('login');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$uid = local_user();
|
||||
$url = trim($_REQUEST['url']);
|
||||
|
||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
local_user(), Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
|
||||
Strings::normaliseLink($url), $url];
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
notice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (!Protocol::supportsFollow($contact['network'])) {
|
||||
notice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
|
||||
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$request = DI::baseUrl() . '/unfollow';
|
||||
$tpl = Renderer::getMarkupTemplate('auto_request.tpl');
|
||||
|
||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
|
||||
if (!DBA::isResult($self)) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['auto'])) {
|
||||
unfollow_process($contact['url']);
|
||||
}
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => DI::l10n()->t('Disconnect/Unfollow'),
|
||||
'$page_desc' => '',
|
||||
'$your_address' => DI::l10n()->t('Your Identity Address:'),
|
||||
'$invite_desc' => '',
|
||||
'$submit' => DI::l10n()->t('Submit Request'),
|
||||
'$cancel' => DI::l10n()->t('Cancel'),
|
||||
'$url' => $contact['url'],
|
||||
'$zrl' => Contact::magicLinkByContact($contact),
|
||||
'$url_label' => DI::l10n()->t('Profile URL'),
|
||||
'$myaddr' => $self['url'],
|
||||
'$request' => $request,
|
||||
'$keywords' => '',
|
||||
'$keywords_label'=> ''
|
||||
]);
|
||||
|
||||
DI::page()['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false));
|
||||
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => DI::l10n()->t('Status Messages and Posts')]);
|
||||
|
||||
// Show last public posts
|
||||
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
function unfollow_process(string $url)
|
||||
{
|
||||
$base_return_path = 'contact';
|
||||
|
||||
$uid = local_user();
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (!$owner) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
$uid, Contact::SHARING, Contact::FRIEND, Strings::normaliseLink($url),
|
||||
Strings::normaliseLink($url), $url];
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
notice(DI::l10n()->t("You aren't following this contact."));
|
||||
DI::baseUrl()->redirect($base_return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$return_path = $base_return_path . '/' . $contact['id'];
|
||||
|
||||
try {
|
||||
Contact::unfollow($contact);
|
||||
$notice_message = DI::l10n()->t('Contact was successfully unfollowed');
|
||||
} catch (Exception $e) {
|
||||
DI::logger()->error($e->getMessage(), ['contact' => $contact]);
|
||||
$notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator');
|
||||
}
|
||||
|
||||
notice($notice_message);
|
||||
DI::baseUrl()->redirect($return_path);
|
||||
}
|
|
@ -30,7 +30,7 @@ use Friendica\Model\Contact;
|
|||
|
||||
function update_contact_content(App $a)
|
||||
{
|
||||
if (!empty(DI::args()->get(1)) && (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update'))) {
|
||||
if (!empty(DI::args()->get(1)) && (!empty($_GET['force']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update'))) {
|
||||
$contact = Contact::getById(DI::args()->get(1), ['id', 'deleted']);
|
||||
if (DBA::isResult($contact) && empty($contact['deleted'])) {
|
||||
DI::page()['aside'] = '';
|
||||
|
|
|
@ -24,11 +24,11 @@ use Friendica\App;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once("mod/notes.php");
|
||||
require_once 'mod/notes.php';
|
||||
|
||||
function update_notes_content(App $a) {
|
||||
|
||||
$profile_uid = intval($_GET["p"]);
|
||||
function update_notes_content(App $a)
|
||||
{
|
||||
$profile_uid = intval($_GET['p']);
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Attach;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function wall_attach_post(App $a) {
|
||||
|
||||
$r_json = (!empty($_GET['response']) && $_GET['response']=='json');
|
||||
|
||||
if (DI::args()->getArgc() > 1) {
|
||||
$nick = DI::args()->getArgv()[1];
|
||||
$owner = User::getOwnerDataByNick($nick);
|
||||
if (!DBA::isResult($owner)) {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$can_post = false;
|
||||
|
||||
$page_owner_uid = $owner['uid'];
|
||||
$page_owner_cid = $owner['id'];
|
||||
$community_page = $owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
|
||||
|
||||
if (local_user() && (local_user() == $page_owner_uid)) {
|
||||
$can_post = true;
|
||||
} elseif ($community_page && !empty(Session::getRemoteContactID($page_owner_uid))) {
|
||||
$contact_id = Session::getRemoteContactID($page_owner_uid);
|
||||
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
||||
}
|
||||
|
||||
if (!$can_post) {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
||||
}
|
||||
notice(DI::l10n()->t('Permission denied.') . EOL );
|
||||
System::exit();
|
||||
}
|
||||
|
||||
if (empty($_FILES['userfile'])) {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$src = $_FILES['userfile']['tmp_name'];
|
||||
$filename = basename($_FILES['userfile']['name']);
|
||||
$filesize = intval($_FILES['userfile']['size']);
|
||||
|
||||
$maxfilesize = DI::config()->get('system','maxfilesize');
|
||||
|
||||
/* Found html code written in text field of form,
|
||||
* when trying to upload a file with filesize
|
||||
* greater than upload_max_filesize. Cause is unknown.
|
||||
* Then Filesize gets <= 0.
|
||||
*/
|
||||
|
||||
if ($filesize <= 0) {
|
||||
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(DI::l10n()->t('Or - did you try to upload an empty file?'));
|
||||
@unlink($src);
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
notice($msg);
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
if ($maxfilesize && $filesize > $maxfilesize) {
|
||||
$msg = DI::l10n()->t('File exceeds size limit of %s', Strings::formatBytes($maxfilesize));
|
||||
@unlink($src);
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg . EOL;
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$newid = Attach::storeFile($src, $page_owner_uid, $filename, '<' . $page_owner_cid . '>');
|
||||
|
||||
@unlink($src);
|
||||
|
||||
if ($newid === false) {
|
||||
$msg = DI::l10n()->t('File upload failed.');
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg . EOL;
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
if ($r_json) {
|
||||
System::jsonExit(['ok' => true, 'id' => $newid]);
|
||||
}
|
||||
|
||||
$lf = "\n";
|
||||
|
||||
echo $lf . $lf . '[attachment]' . $newid . '[/attachment]' . $lf;
|
||||
System::exit();
|
||||
// NOTREACHED
|
||||
}
|
|
@ -1,286 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Module for uploading a picture to the profile wall
|
||||
*
|
||||
* By default the picture will be stored in the photo album with the name Wall Photos.
|
||||
* You can specify a different album by adding an optional query string "album="
|
||||
* to the url
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseApi;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function wall_upload_post(App $a, $desktopmode = true)
|
||||
{
|
||||
Logger::info("wall upload: starting new upload");
|
||||
|
||||
$r_json = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
||||
$album = trim($_GET['album'] ?? '');
|
||||
|
||||
if (DI::args()->getArgc() > 1) {
|
||||
if (empty($_FILES['media'])) {
|
||||
$nick = DI::args()->getArgv()[1];
|
||||
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $nick, 'blocked' => false]);
|
||||
if (!DBA::isResult($user)) {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['uid' => BaseApi::getCurrentUserID(), 'blocked' => false]);
|
||||
}
|
||||
} else {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup permissions structures
|
||||
*/
|
||||
$can_post = false;
|
||||
$visitor = 0;
|
||||
|
||||
$page_owner_uid = $user['uid'];
|
||||
$default_cid = $user['id'];
|
||||
$page_owner_nick = $user['nickname'];
|
||||
$community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
|
||||
|
||||
if ((local_user()) && (local_user() == $page_owner_uid)) {
|
||||
$can_post = true;
|
||||
} elseif ($community_page && !empty(Session::getRemoteContactID($page_owner_uid))) {
|
||||
$contact_id = Session::getRemoteContactID($page_owner_uid);
|
||||
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
||||
$visitor = $contact_id;
|
||||
}
|
||||
|
||||
if (!$can_post) {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
||||
}
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
System::exit();
|
||||
}
|
||||
|
||||
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$src = '';
|
||||
$filename = '';
|
||||
$filesize = 0;
|
||||
$filetype = '';
|
||||
if (!empty($_FILES['userfile'])) {
|
||||
$src = $_FILES['userfile']['tmp_name'];
|
||||
$filename = basename($_FILES['userfile']['name']);
|
||||
$filesize = intval($_FILES['userfile']['size']);
|
||||
$filetype = $_FILES['userfile']['type'];
|
||||
|
||||
} elseif (!empty($_FILES['media'])) {
|
||||
if (!empty($_FILES['media']['tmp_name'])) {
|
||||
if (is_array($_FILES['media']['tmp_name'])) {
|
||||
$src = $_FILES['media']['tmp_name'][0];
|
||||
} else {
|
||||
$src = $_FILES['media']['tmp_name'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_FILES['media']['name'])) {
|
||||
if (is_array($_FILES['media']['name'])) {
|
||||
$filename = basename($_FILES['media']['name'][0]);
|
||||
} else {
|
||||
$filename = basename($_FILES['media']['name']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_FILES['media']['size'])) {
|
||||
if (is_array($_FILES['media']['size'])) {
|
||||
$filesize = intval($_FILES['media']['size'][0]);
|
||||
} else {
|
||||
$filesize = intval($_FILES['media']['size']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_FILES['media']['type'])) {
|
||||
if (is_array($_FILES['media']['type'])) {
|
||||
$filetype = $_FILES['media']['type'][0];
|
||||
} else {
|
||||
$filetype = $_FILES['media']['type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($src == "") {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||
}
|
||||
notice(DI::l10n()->t('Invalid request.'));
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
||||
|
||||
Logger::info("File upload src: " . $src . " - filename: " . $filename .
|
||||
" - size: " . $filesize . " - type: " . $filetype);
|
||||
|
||||
$imagedata = @file_get_contents($src);
|
||||
$image = new Image($imagedata, $filetype);
|
||||
|
||||
if (!$image->isValid()) {
|
||||
$msg = DI::l10n()->t('Unable to process image.');
|
||||
@unlink($src);
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg. EOL;
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$image->orient($src);
|
||||
@unlink($src);
|
||||
|
||||
$max_length = DI::config()->get('system', 'max_image_length');
|
||||
if ($max_length > 0) {
|
||||
$image->scaleDown($max_length);
|
||||
$filesize = strlen($image->asString());
|
||||
Logger::info("File upload: Scaling picture to new size " . $max_length);
|
||||
}
|
||||
|
||||
$width = $image->getWidth();
|
||||
$height = $image->getHeight();
|
||||
|
||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||
|
||||
if (!empty($maximagesize) && ($filesize > $maximagesize)) {
|
||||
// Scale down to multiples of 640 until the maximum size isn't exceeded anymore
|
||||
foreach ([5120, 2560, 1280, 640] as $pixels) {
|
||||
if (($filesize > $maximagesize) && (max($width, $height) > $pixels)) {
|
||||
Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
|
||||
$image->scaleDown($pixels);
|
||||
$filesize = strlen($image->asString());
|
||||
$width = $image->getWidth();
|
||||
$height = $image->getHeight();
|
||||
}
|
||||
}
|
||||
if ($filesize > $maximagesize) {
|
||||
Logger::notice('Image size is too big', ['size' => $filesize, 'max' => $maximagesize]);
|
||||
$msg = DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize));
|
||||
@unlink($src);
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg. EOL;
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
}
|
||||
|
||||
$resource_id = Photo::newResource();
|
||||
|
||||
$smallest = 0;
|
||||
|
||||
// If we don't have an album name use the Wall Photos album
|
||||
if (!strlen($album)) {
|
||||
$album = DI::l10n()->t('Wall Photos');
|
||||
}
|
||||
|
||||
$defperm = '<' . $default_cid . '>';
|
||||
|
||||
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 0, Photo::DEFAULT, $defperm);
|
||||
|
||||
if (!$r) {
|
||||
$msg = DI::l10n()->t('Image upload failed.');
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => $msg]);
|
||||
} else {
|
||||
echo $msg. EOL;
|
||||
}
|
||||
System::exit();
|
||||
}
|
||||
|
||||
if ($width > 640 || $height > 640) {
|
||||
$image->scaleDown(640);
|
||||
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 1, Photo::DEFAULT, $defperm);
|
||||
if ($r) {
|
||||
$smallest = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($width > 320 || $height > 320) {
|
||||
$image->scaleDown(320);
|
||||
$r = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 2, Photo::DEFAULT, $defperm);
|
||||
if ($r && ($smallest == 0)) {
|
||||
$smallest = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$desktopmode) {
|
||||
$photo = Photo::selectFirst(['id', 'datasize', 'width', 'height', 'type'], ['resource-id' => $resource_id], ['order' => ['width']]);
|
||||
if (!$photo) {
|
||||
if ($r_json) {
|
||||
System::jsonExit(['error' => '']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$picture = [];
|
||||
|
||||
$picture["id"] = $photo["id"];
|
||||
$picture["size"] = $photo["datasize"];
|
||||
$picture["width"] = $photo["width"];
|
||||
$picture["height"] = $photo["height"];
|
||||
$picture["type"] = $photo["type"];
|
||||
$picture["albumpage"] = DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id;
|
||||
$picture["picture"] = DI::baseUrl() . "/photo/{$resource_id}-0." . $image->getExt();
|
||||
$picture["preview"] = DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt();
|
||||
|
||||
if ($r_json) {
|
||||
System::jsonExit(['picture' => $picture]);
|
||||
}
|
||||
Logger::info("upload done");
|
||||
return $picture;
|
||||
}
|
||||
|
||||
Logger::info("upload done");
|
||||
|
||||
if ($r_json) {
|
||||
System::jsonExit(['ok' => true]);
|
||||
}
|
||||
|
||||
echo "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id . '][img]' . DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt() . "[/img][/url]\n\n";
|
||||
System::exit();
|
||||
// NOTREACHED
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function wallmessage_post(App $a) {
|
||||
|
||||
$replyto = Profile::getMyURL();
|
||||
if (!$replyto) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$subject = trim($_REQUEST['subject'] ?? '');
|
||||
$body = Strings::escapeHtml(trim($_REQUEST['body'] ?? ''));
|
||||
|
||||
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
|
||||
if ((! $recipient) || (! $body)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getByNickname($recipient);
|
||||
if (empty($r)) {
|
||||
Logger::notice('wallmessage: no recipient');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$user['unkmail']) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
||||
if ($total > $user['cntunkmail']) {
|
||||
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = Mail::sendWall($user, $body, $subject, $replyto);
|
||||
|
||||
switch ($ret) {
|
||||
case -1:
|
||||
notice(DI::l10n()->t('No recipient selected.'));
|
||||
break;
|
||||
case -2:
|
||||
notice(DI::l10n()->t('Unable to check your home location.'));
|
||||
break;
|
||||
case -3:
|
||||
notice(DI::l10n()->t('Message could not be sent.'));
|
||||
break;
|
||||
case -4:
|
||||
notice(DI::l10n()->t('Message collection failure.'));
|
||||
break;
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('profile/'.$user['nickname']);
|
||||
}
|
||||
|
||||
|
||||
function wallmessage_content(App $a) {
|
||||
|
||||
if (!Profile::getMyURL()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
|
||||
|
||||
if (!$recipient) {
|
||||
notice(DI::l10n()->t('No recipient.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getByNickname($recipient);
|
||||
|
||||
if (empty($user)) {
|
||||
notice(DI::l10n()->t('No recipient.'));
|
||||
Logger::notice('wallmessage: no recipient');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$user['unkmail']) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
||||
if ($total > $user['cntunkmail']) {
|
||||
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
|
||||
return;
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl');
|
||||
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
'$nickname' => $user['nickname'],
|
||||
'$linkurl' => DI::l10n()->t('Please enter a link URL:')
|
||||
]);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('wallmessage.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$header' => DI::l10n()->t('Send Private Message'),
|
||||
'$subheader' => DI::l10n()->t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']),
|
||||
'$to' => DI::l10n()->t('To:'),
|
||||
'$subject' => DI::l10n()->t('Subject:'),
|
||||
'$recipname' => $user['username'],
|
||||
'$nickname' => $user['nickname'],
|
||||
'$subjtxt' => $_REQUEST['subject'] ?? '',
|
||||
'$text' => $_REQUEST['body'] ?? '',
|
||||
'$readonly' => '',
|
||||
'$yourmessage'=> DI::l10n()->t('Your message:'),
|
||||
'$parent' => '',
|
||||
'$upload' => DI::l10n()->t('Upload photo'),
|
||||
'$insert' => DI::l10n()->t('Insert web link'),
|
||||
'$wait' => DI::l10n()->t('Please wait')
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user