Compare commits

..

293 Commits

Author SHA1 Message Date
5bb162322c
Create CITATION.cff 2024-05-30 12:39:46 +09:00
90404f225a
Update README.md 2024-05-30 12:38:19 +09:00
cc589e846d Update KOREAN.MD 2024-05-30 12:35:35 +09:00
d265428c6c Update KOREAN.MD 2024-05-30 12:34:28 +09:00
e1f46ae830 Update KOREAN.MD 2024-05-30 12:33:09 +09:00
1feb411bd6 Update KOREAN.MD 2024-05-30 12:32:05 +09:00
4d4c0007ae
Delete fixindent.sh 2024-05-30 12:22:30 +09:00
58bd748595
Delete bootstrap.707.sh 2024-05-30 12:21:21 +09:00
53b5bb581c
Update bootstrap.sh 2024-05-30 12:21:08 +09:00
972dd24c2b
Update uri.php 2024-04-29 22:40:51 +09:00
9d97db2025
Update uri.php 2024-04-29 22:40:32 +09:00
09f48b47a1
Update FUNDING.yml 2024-04-29 22:26:08 +09:00
aa2bb12335
Update README.md 2024-04-29 22:22:32 +09:00
412607fd12
Update README.md 2024-04-29 22:16:02 +09:00
029067b632
Update SECURITY.md 2024-04-29 22:11:10 +09:00
fc44237b3e
Update README.md 2024-04-29 22:08:59 +09:00
1828e58b8a
Update README.md 2024-04-29 22:07:59 +09:00
a14a75265c
Update README.md 2024-04-29 22:07:45 +09:00
b9e7548f78
Update README.md 2023-08-08 14:43:51 +09:00
e147898521
Update webpagetool.php 2023-04-14 18:11:32 +09:00
d4e50a358b
Update KOREAN.MD 2023-04-14 18:08:24 +09:00
1a69e04d8c
Delete CDN_HOWTO.md 2023-04-14 18:07:12 +09:00
7ea72da491
Update KOREAN.MD 2023-04-14 18:07:02 +09:00
8b0f5408f6
Update KOREAN.MD 2023-04-14 18:05:32 +09:00
0b784ff93f
Update KOREAN.MD 2023-04-14 18:01:24 +09:00
fac10baaee
Delete VERSION.MD 2023-04-14 17:58:38 +09:00
a0a5b1335c
Update README.md 2023-04-14 17:55:44 +09:00
b977776afc
Update README.md 2023-04-14 17:53:14 +09:00
b456c997da
Update README.md 2023-04-12 16:02:15 +09:00
4b0e7aa33a
Update README.md 2023-04-12 15:52:36 +09:00
3dcccb72e1
Update README.md 2023-04-12 15:51:39 +09:00
e9cc30e5a4
Update README.md 2023-04-12 15:49:52 +09:00
7382caa63d
Update README.md 2023-04-12 15:45:27 +09:00
831650987c
Update README.md 2023-04-12 15:36:46 +09:00
2405477555
Update README.md 2023-02-27 20:02:05 +09:00
730ec0b5a1
Update README.md 2023-02-27 20:01:50 +09:00
4e89184f21
Update README.md 2023-02-27 20:01:24 +09:00
70d7478d1c
Update webpagetool.php 2022-12-19 10:30:31 +09:00
c327e6b0fa
Update SECURITY.md 2022-12-12 16:23:23 +09:00
350130acbe
Update SECURITY.md 2022-12-12 16:22:54 +09:00
920f271ee4
Update SECURITY.md 2022-12-12 16:21:34 +09:00
f0fcaaed24
Update SECURITY.md 2022-12-12 16:19:27 +09:00
536ba9e6b3
Update SECURITY.md 2022-12-12 16:17:45 +09:00
3cb8178a0d Add the email contact to report abuse 2022-11-25 23:15:20 +09:00
bf788db964
Update uri.php 2022-09-29 14:17:24 +09:00
53618152e6
Update networktool.php 2022-09-16 16:11:12 +09:00
058449948f
Update networktool.php 2022-09-16 16:03:00 +09:00
85ddf36fa8
Update networktool.php 2022-09-16 16:02:35 +09:00
161029471a
Update networktool.php 2022-09-16 16:02:16 +09:00
3d602957d3
Update hiddentool.php 2022-09-13 20:42:35 +09:00
8045256d37
Update SECURITY.md 2022-01-17 10:42:37 +09:00
e3044d09b3
Update uri.php 2021-10-27 16:11:21 +09:00
f2a4ec38f7
Update uri.php 2021-10-27 14:53:54 +09:00
4cd4980ccc
Update uri.php 2021-10-27 14:53:26 +09:00
da907aa4c1
Merge pull request #140 from gnh1201/patch-master-20210817
Fix #138 Routing failure
2021-08-17 14:50:31 +09:00
8a3c90d37c
Update uri.php 2021-08-17 14:48:35 +09:00
74363530ec
Update webpagetool.php 2021-05-27 14:50:04 +09:00
450abe5d92
Update hiddentool.php 2021-05-25 00:05:37 +09:00
226f152a46
Create hiddentool.php 2021-05-24 22:18:48 +09:00
959a2b6d90
Update coupang.api.php 2021-05-22 06:00:38 +09:00
1a5a22eb88
Update coupang.api.php 2021-05-22 06:00:14 +09:00
4fef129951
Update coupang.api.php 2021-05-22 05:46:20 +09:00
14cd9a5153
Update coupang.api.php 2021-05-22 05:46:03 +09:00
177ddeef58
Update coupang.api.php 2021-05-22 05:32:24 +09:00
a0e3d27388
Update coupang.api.php 2021-05-22 05:31:40 +09:00
8d8a27cf41
Update coupang.api.php 2021-05-22 05:31:12 +09:00
de0f4289ba
Update coupang.api.php 2021-05-22 05:30:39 +09:00
875d9b0af8
Update coupang.api.php 2021-05-22 05:29:55 +09:00
0c28b5b59f
Update coupang.api.php 2021-05-22 05:29:23 +09:00
caa26cd1ea
Create coupang.api.php 2021-05-22 05:28:08 +09:00
9174356265
Update security.php 2021-05-22 05:11:41 +09:00
ea7b0e82a5
Update l10n.ini.php 2021-04-04 04:42:49 +09:00
f2f843e540
Update README.md 2021-04-02 14:09:15 +09:00
781c964c4c
Update README.md 2021-04-02 14:08:30 +09:00
445e41a25f
Update README.md 2021-04-02 14:08:01 +09:00
3e65438e3d
Fix mistyping in database.php
Fix mistyping in database.php
2021-03-23 08:13:16 +09:00
372ae4ddcd
Update webpagetool.php 2021-02-01 16:58:16 +09:00
52ccbd7663
Update webpagetool.php 2021-02-01 16:55:23 +09:00
e675be840b
Update webpagetool.php 2021-02-01 16:51:16 +09:00
ea694b98a5
Update webpagetool.php 2021-02-01 16:48:41 +09:00
25fc749e27
Update uri.php 2020-12-26 03:14:02 +09:00
1da455529b
Update uri.php 2020-12-25 23:30:23 +09:00
587850b61c
Update SECURITY.md 2020-11-30 10:56:59 +09:00
2f680f0579
Update SECURITY.md 2020-11-30 10:56:46 +09:00
f7f2ca64d0
Rename storage/conf/l10n.ini.php to storage/config/l10n.ini.php 2020-10-14 15:08:03 +09:00
f0cf124dea
Update l10n.ini.php 2020-10-14 15:07:44 +09:00
17c59eba23
Create l10n.ini.php 2020-10-14 15:07:27 +09:00
ef3907c5ce
Update webpagetool.php 2020-07-16 15:10:39 +09:00
4be3e6b4fd
Update webpagetool.php 2020-07-16 15:10:23 +09:00
718a1cfa00
Update exectool.php 2020-07-10 17:19:38 +09:00
0896073b9b
Update exectool.php 2020-07-10 17:16:30 +09:00
1ee86700cd
Update exectool.php 2020-07-10 16:38:45 +09:00
b859a236a8
Update exectool.php 2020-07-10 16:37:58 +09:00
c266f2ea45
Update README.md 2020-07-09 19:47:08 +09:00
f0b0103007
Update README.md 2020-07-09 19:45:27 +09:00
a5f6484843
Update README.md 2020-07-09 19:37:33 +09:00
203739dd43
Update README.md 2020-07-09 19:36:50 +09:00
17a602fdd1
Update README.md 2020-07-09 19:35:37 +09:00
fd6d94e5a6
Update README.md 2020-07-09 18:24:39 +09:00
83d5419e8e
Update README.md 2020-07-09 18:21:56 +09:00
90d1057492
Update README.md 2020-07-09 18:19:41 +09:00
7fa3ef2a43
Update README.md 2020-07-09 18:18:07 +09:00
858d7d6353
Update README.md 2020-07-09 18:16:37 +09:00
c4e4d7b489
Update README.md 2020-07-09 18:12:54 +09:00
ceafd68894
Update README.md 2020-07-09 18:08:44 +09:00
189deae1cf
Update README.md 2020-07-01 17:36:54 +09:00
db66198dee
Update README.md 2020-07-01 17:36:21 +09:00
493d9f307a
Update README.md 2020-07-01 17:35:03 +09:00
69a8c3605c
Update README.md 2020-07-01 11:09:17 +09:00
1e376f52bb
Update README.md 2020-07-01 11:04:25 +09:00
6e0bc5481f
Update README.md 2020-07-01 11:02:35 +09:00
6ab48520ec
Update README.md 2020-07-01 11:01:25 +09:00
ad8ccfe9cb
Update README.md 2020-07-01 10:55:26 +09:00
d27ef05ea5
Update README.md 2020-07-01 10:51:53 +09:00
b36a87019a
Update storage.php 2020-06-21 17:19:53 +09:00
e490264725
Update logger.php 2020-06-21 17:16:39 +09:00
43972172ff
Update logger.php 2020-06-21 17:16:27 +09:00
ed06978230
Update storage.php 2020-06-21 17:07:46 +09:00
f35cdeb3a0
Update storage.php 2020-06-21 17:04:18 +09:00
4dc7b9f6ad
Update logger.ini.php 2020-06-21 16:57:09 +09:00
bf3ea2dbf4
Update logger.ini.php 2020-06-21 16:40:50 +09:00
3af1c8d5b8
Update logger.ini.php 2020-06-21 16:39:21 +09:00
6c24844935
Update storage.php 2020-06-16 16:50:17 +09:00
3621d23a37
Update storage.php 2020-06-16 16:46:48 +09:00
8905dde7fb
Update storage.php 2020-06-16 16:46:12 +09:00
36c0bf53f5
Update security.ini.php 2020-06-16 16:42:54 +09:00
746e82f5a5
Update security.ini.php 2020-06-16 16:42:15 +09:00
513f9a59f2
Update security.ini.php 2020-06-16 16:36:52 +09:00
54fe0e3356
Update storage.php 2020-06-16 10:13:16 +09:00
bee5ef35a5
Update storage.php 2020-06-16 10:11:52 +09:00
7ff7010c34
Update logger.php 2020-06-14 20:09:32 +09:00
67b6055196
Update index.php 2020-06-14 18:49:33 +09:00
b176d1efb4
Update index.php 2020-06-14 18:49:21 +09:00
cf24d39b9a
Update and rename log.ini.php to logger.ini.php 2020-06-14 18:48:17 +09:00
40cdd0ddb9
Update logger.php 2020-06-14 18:46:53 +09:00
e9395cca4d
Update logger.php 2020-06-14 18:45:36 +09:00
6669676bae
Update logger.php 2020-06-14 18:45:15 +09:00
2f2f2f3c1b
Update README.md 2020-06-03 14:56:33 +09:00
8cf28c910b
Update README.md 2020-06-03 14:55:40 +09:00
08a010599e
Update README.md 2020-06-03 14:54:58 +09:00
8248ad2840
Update README.md 2020-05-29 11:11:55 +09:00
0ee85db921
Update README.md 2020-05-29 11:11:20 +09:00
b8829df18a
Update webpagetool.php 2020-05-29 09:40:58 +09:00
f215034928
Update string.utils.php 2020-05-27 11:11:02 +09:00
1d226d54d1
Update SECURITY.md 2020-05-25 15:54:10 +09:00
abe5fb0d0e
Update SECURITY.md 2020-05-25 15:53:49 +09:00
64e7fd9765
Update SECURITY.md 2020-05-25 15:51:41 +09:00
3ecf6fa6bf
Update uri.php 2020-05-21 14:15:41 +09:00
fb1e4bf37a
Update uri.php 2020-05-21 14:15:05 +09:00
f9db90f031
Update uri.php 2020-05-21 14:09:43 +09:00
d62e0859e4
Update README.md 2020-05-21 11:45:14 +09:00
f307fd50bc
Update README.md 2020-05-21 11:40:43 +09:00
f6062d5c68
Update README.md 2020-05-21 11:40:09 +09:00
e524c1e199
Update README.md 2020-05-21 11:38:53 +09:00
ffba3b04cd
Update README.md 2020-05-21 11:38:06 +09:00
eca23ede6e
Update README.md 2020-05-21 11:33:44 +09:00
ed86e30fe2
Update README.md 2020-05-21 11:33:20 +09:00
72e9b51b8f
Update README.md 2020-05-21 11:31:58 +09:00
f6c459d134
Update storage.php 2020-05-04 23:54:06 +09:00
ed02dd066f
Update storage.php 2020-05-04 23:53:15 +09:00
d9802557a6
Update database.php 2020-04-29 15:01:04 +09:00
f2f1c4e458
Update database.php 2020-04-29 14:58:05 +09:00
410f3a6890
Update zabbix.api.php 2020-04-29 13:37:40 +09:00
b667703092
Update logger.php 2020-04-28 11:40:25 +09:00
4dacbbf332
Update cli.php 2020-04-20 21:28:04 +09:00
201d3a4710
Update zabbix.api.php 2020-04-20 21:26:49 +09:00
02f4051ef3
Update cli.php 2020-04-20 20:53:07 +09:00
4f9ddb5634
Update webpagetool.php 2020-04-20 20:21:07 +09:00
32832519a1
Update cli.php 2020-04-20 20:11:46 +09:00
290e26cb63
Update README.md 2020-04-20 17:31:40 +09:00
02955f0f43
Update SSL.class.php 2020-04-17 18:21:43 +09:00
c7ee370f4e
Update SSL.class.php 2020-04-17 18:08:11 +09:00
d4cce046eb
Update UUID.class.php 2020-04-17 18:06:28 +09:00
21a0fa9e1b
Update UUID.class.php 2020-04-17 18:06:16 +09:00
2823d81758
Update UUID.class.php 2020-04-17 18:03:25 +09:00
6c3484e67f
Update SSL.class.php 2020-04-17 17:55:46 +09:00
99d02b27b3
Update SSL.class.php 2020-04-17 17:54:47 +09:00
7cc52cd8e4
Create SSL.class.php 2020-04-17 17:50:16 +09:00
461f0f3e19
Update database.php 2020-04-16 16:20:53 +09:00
65135d36a3
Update database.php 2020-04-16 16:20:38 +09:00
2745ede24a
Update README.md 2020-04-13 12:00:01 +09:00
033a36c4bf
Update README.md 2020-04-13 11:58:19 +09:00
91ba9b4248
Update CDN_HOWTO.md 2020-04-12 22:22:38 +09:00
e881e4a002
Update CDN_HOWTO.md 2020-04-12 22:18:18 +09:00
f1c8e01b44
Update uri.php 2020-04-12 21:46:20 +09:00
61d8069b76
Update uri.php 2020-04-12 21:45:37 +09:00
512ee523d7
Update uri.ini.php 2020-04-12 21:40:10 +09:00
63316a7b8a
Update uri.php 2020-04-12 21:38:41 +09:00
aab22b89e1
Update uri.php 2020-04-12 21:38:13 +09:00
094e5d2bd3
Update CDN_HOWTO.md 2020-04-12 20:47:34 +09:00
66735e0c59
Update uri.ini.php 2020-04-12 20:47:07 +09:00
adbaa6a7d9
Update CDN_HOWTO.md 2020-04-12 19:58:35 +09:00
189922a500
Update CDN_HOWTO.md 2020-04-12 19:54:29 +09:00
2a610015d6
Update CDN_HOWTO.md 2020-04-12 19:52:00 +09:00
ff448fb1ad
Update CDN_HOWTO.md 2020-04-12 19:51:45 +09:00
7fb319ed75
Update CDN_HOWTO.md 2020-04-12 19:51:17 +09:00
b9f8b78cc4
Update CDN_HOWTO.md 2020-04-12 19:49:44 +09:00
6c54104977
Update CDN_HOWTO.md 2020-04-12 19:46:37 +09:00
75d4dfc18e
Update CDN_HOWTO.md 2020-04-12 19:33:14 +09:00
102b5643cf
Update CDN_HOWTO.md 2020-04-12 19:31:42 +09:00
dce66940fc
Update CDN_HOWTO.md 2020-04-12 19:31:14 +09:00
ea44b3fa47
Update and rename test.md to CDN_HOWTO.md 2020-04-12 19:29:42 +09:00
671b5b08e3
Create test.md 2020-04-12 19:29:16 +09:00
38805aaf65
Update uri.php 2020-04-12 18:43:31 +09:00
f802210bd4
Update uri.ini.php 2020-04-12 18:39:57 +09:00
1165ee3b67
Update view_welcome.php 2020-04-12 18:39:11 +09:00
57b4a9cef1
Update deprecated.ini.php 2020-04-12 18:37:39 +09:00
c586ee2001
Update database.php 2020-04-12 18:36:37 +09:00
c38ea4bb68
Update base.php 2020-04-12 18:34:52 +09:00
eb5cebf360
Update uri.php 2020-04-12 18:21:56 +09:00
0c56893b05
Update uri.php 2020-04-12 18:21:07 +09:00
f42785d9b2
Update uri.ini.php 2020-04-12 18:12:01 +09:00
56ecbddbda
Update uri.php 2020-04-12 18:11:33 +09:00
d74eed052d
Update uri.php 2020-04-12 18:08:45 +09:00
5894116a74
Update uri.ini.php 2020-04-12 17:57:01 +09:00
fca583c683
Update webpagetool.php 2020-04-08 14:33:49 +09:00
fcf23af78d
Update webpagetool.php 2020-04-08 14:28:43 +09:00
3ec8ab5db5
Update database.php 2020-04-08 13:50:31 +09:00
83a79e0693
Update database.php 2020-04-08 13:40:26 +09:00
5e4da8f2ca
Update webpagetool.php 2020-04-06 00:02:23 +09:00
32210df8a5
Update string.utils.php 2020-03-27 15:18:19 +09:00
beef878da9
Update webpagetool.php 2020-03-26 10:20:39 +09:00
bc4c34c1b4
Update database.php 2020-03-25 12:04:33 +09:00
309977c6cb
Update database.php 2020-03-25 11:55:46 +09:00
c97400d7ce
Update database.php 2020-03-25 11:48:49 +09:00
bd1b8bebac
Update config.php 2020-03-25 11:43:55 +09:00
89596fe643
Update config.php 2020-03-25 11:43:09 +09:00
f8f0603df9
Update database.php 2020-03-25 11:42:44 +09:00
f6265108b2
Update database.php 2020-03-25 11:42:28 +09:00
bb1c3a1b59
Update config.php 2020-03-25 11:41:37 +09:00
b40c1e518a
Update database.php 2020-03-25 11:21:47 +09:00
81b05fe550
Update database.php 2020-03-25 11:21:00 +09:00
80c0d01b81
Update database.php 2020-03-25 10:32:17 +09:00
8c93ea1629
Update database.php 2020-03-25 10:25:59 +09:00
7b6dde0460
Update zabbix.api.php 2020-03-06 11:32:07 +09:00
5ce876afb2
Update zabbix.api.php 2020-03-05 10:43:24 +09:00
a62297c82d
Update zabbix.api.php 2020-03-05 10:26:47 +09:00
41cf7bf2ff
Update zabbix.api.php 2020-03-03 11:29:05 +09:00
fcf186fe46
Update perftool.php 2020-03-02 10:11:12 +09:00
8cb6cf52d5
Update perftool.php 2020-03-02 10:10:00 +09:00
dbf6f31e98
Update colona.v1.format.php 2020-03-01 02:37:45 +09:00
71ae7f061c
Update storage.php 2020-02-28 17:29:27 +09:00
d1316a89bc
Update storage.php 2020-02-28 16:57:36 +09:00
cd3a446a54
Update base.php 2020-02-26 16:12:10 +09:00
a920baaa83
Update webpagetool.php 2020-02-25 18:36:26 +09:00
7c44bbb263
Update base.php 2020-02-25 16:07:44 +09:00
303118ad92
Update perftool.php 2020-02-25 14:15:12 +09:00
ed08db7c24
Update system.ini.php 2020-02-24 17:50:50 +09:00
cc2773c2d2
Update perftool.php 2020-02-24 17:50:05 +09:00
5d5ecbe8a9
Update perftool.php 2020-02-24 14:51:56 +09:00
d7f21964b5
Update perftool.php 2020-02-24 14:50:29 +09:00
ee80807b5e
Update migrate.1.5.php 2020-02-24 14:04:15 +09:00
6112a16718
Create migrate.1.5.php 2020-02-24 14:03:45 +09:00
bfa2fc4009
Update index.php 2020-02-24 12:29:31 +09:00
daa5299450
Update perftool.php 2020-02-24 12:29:09 +09:00
91d3a550fb
Update database.php 2020-02-22 19:16:38 +09:00
8a2a3def51
Update database.php 2020-02-21 18:10:45 +09:00
a604fa9a8c
Update base.php 2020-02-21 14:19:42 +09:00
b0a538459d
Update string.utils.php 2020-02-21 14:12:01 +09:00
a6976d1a56
Update base.php 2020-02-21 14:04:42 +09:00
adcfbd2e30
Update string.utils.php 2020-02-21 13:53:12 +09:00
6ccdb2d1b5
Update string.utils.php 2020-02-21 13:51:31 +09:00
d7031e7a21
Update string.utils.php 2020-02-21 13:50:30 +09:00
3a19961640
Update deprecated.ini.php 2020-02-21 13:41:47 +09:00
3e19711ae0
Update deprecated.ini.php 2020-02-21 13:33:54 +09:00
b3d8f9bc36
Rename deprecated.ini to deprecated.ini.php 2020-02-21 13:32:07 +09:00
42a7df1f5a
Create deprecated.ini 2020-02-21 13:31:55 +09:00
3853cbd9e2
Update base.php 2020-02-21 12:06:33 +09:00
cd18ee6701
Update database.php 2020-02-20 16:41:14 +09:00
73bf61ccb1
Update database.php 2020-02-20 16:40:46 +09:00
eaa8085914
Update database.php 2020-02-20 14:30:54 +09:00
b99c86075c
Update database.php 2020-02-20 14:30:25 +09:00
f6b3fd69c2
typo fixed colona.v1.format.php 2020-02-20 12:14:41 +09:00
0eea52779f
Update database.php 2020-02-20 11:46:02 +09:00
77c75931b8
Typo fix database.php 2020-02-20 11:11:37 +09:00
2f7b0e058e
Update system.ini.php 2020-02-19 16:00:28 +09:00
1f730f59e7
Update index.php 2020-02-19 15:59:22 +09:00
d3ab19a83b
Update perftool.php 2020-02-19 15:01:39 +09:00
11023c3cda
Update perftool.php 2020-02-19 14:57:35 +09:00
491116531f
Update perftool.php 2020-02-19 14:43:33 +09:00
afd3e5d566
Create perftool.php 2020-02-19 14:43:06 +09:00
44c025dc29
Update index.php 2020-02-18 15:40:49 +09:00
6b3d3ba169
Update webpagetool.php 2020-02-18 14:01:23 +09:00
ce9197822e
Update index.php 2020-02-18 13:25:46 +09:00
608a859573
Update index.php 2020-02-18 12:39:49 +09:00
abeeee18a6
Update index.php 2020-02-18 12:38:14 +09:00
1460b0021e
Update index.php 2020-02-18 12:37:03 +09:00
94e0aa6066
Update config.php 2020-02-18 12:31:02 +09:00
ce70a68884
Update config.php 2020-02-18 12:29:47 +09:00
06515408b2
Update index.php 2020-02-18 12:24:27 +09:00
016da48242
Update config.php 2020-02-18 12:23:13 +09:00
47e5d97de2
Update config.php 2020-02-18 12:22:23 +09:00
6f9d9185b0
Update database.php 2020-02-17 21:17:58 +09:00
93 changed files with 1325 additions and 524 deletions

11
CITATION.cff Normal file
View File

@ -0,0 +1,11 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Go"
given-names: "Namhyeon"
orcid: "https://orcid.org/0009-0006-8421-0911"
title: "ReasonableFramework"
version: v1.6.8
doi: 10.5281/zenodo.11392417
date-released: 2024-05-30
url: "https://github.com/gnh1201/reasonableframework"

View File

@ -1,8 +1,8 @@
# These are supported funding model platforms
github: gnh1201, catswords # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: gnh1201
open_collective: welsonjs
liberapay: catswords
custom: ['https://www.buymeacoffee.com/catswords', 'https://toss.me/catswords']
patreon: catswords # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL
ko_fi: catswords

107
KOREAN.MD
View File

@ -1,55 +1,98 @@
## 기반 소프트웨어
본 웹 소프트웨어는 ReasonableFramework 기반으로 작성되었습니다.
https://github.com/gnh1201/reasonableframework
# 본 웹 어플리케이션에 대하여
본 웹 어플리케이션은 ReasonableFramework 기반으로 작성됨. https://github.com/gnh1201/reasonableframework
## 적재된 모듈 목록
* System: base (시스템 기반)
* System: config (시스템 설정)
* System: database (데이터베이스)
* System: logger (로그)
* System: uri (URI 및 URL 제어)
* System: security (보안)
* Helper: paginate (페이지 네비게이션)
* Helper: gnuboard, gnuboard.config, gnuboard.lib (그누보드 설정 및 라이브러리 연동)
* Helper: vworld (국토교통부 vworld 연동)
* Helper: wprest (워드프레스[wordpress] REST API 클라이언트)
* Hepler: webpagetool (Proxy 설정, UA 설정, JSON/DOM 파서를 지원하는 HTTP 클라이언트)
* Helper: noreporting, allreporting (오류 출력 범위를 설정)
* Helper: isemail.lnk (is_email 지원 -> /vendor/isemail)
* Helper: metaparser.lnk (HTML META 데이터 파싱 지원 -> /vendor/PHP-MetaParser)
* Helper: simple_html_dom (HTML DOM 처리기)
* Helper: oracle (오라클 데이터베이스 접속 및 쿼리)
* Helper: exectool (PHP 명령행 실행 지원)
* 그 외 다양한 사양 지원을 위한 모듈들
## 기술지원
* Website: https://exts.kr/go/home
* E-mail: support@exts.kr
## 저작권
* LGPL (별도의 오픈소스 라이센스 문서에 기입 요망)
## 오픈소스 라이선스
* 이 프로젝트는 LGPL 3.0 오픈소스 라이선스 하에 배포됨.
## 최근변경
* 2024-05-30
* 2018-07-22
## 정적 파일 호스팅 관련 지침 (카페24 CDN 또는 Amazon S3)
본 지침은 버전 v1.6.8를 기준으로 한다.
### 정적 파일 호스팅 서비스의 예시
- 카페24 ([10G 광아우토반 FullSSD+](https://hosting.cafe24.com/?controller=new_product_page&page=autobahn) 웹 호스팅 상품 기준)
- Amazon S3
- Object Storage
### 카페24 정적 파일 호스팅 사용자
1. 카페24(cafe24.com) 관리자 페이지에 로그인하여, CDN/스트리밍 도메인 정보를 얻는다.
1. 메인 웹 사이트 로그인 -> `나의서비스관리` 클릭
2. 좌측 메뉴에서 `서비스 접속관리` -> `서비스 접속 정보` 클릭
3. CDN/스트리밍 정보 확인
```
*** CDN ***
CDN 하드 용량: 200M
CDN 트래픽 용량: 500M
FTP 주소: iup.cdn2.cafe24.com
FTP 포트: 21
FTP 아이디: [사용자 아이디]
*** 스트리밍 ***
스트리밍 하드 용량: 200M
스트리밍 트래픽 용량: 500M
FTP 주소: wm-004.cafe24.com
FTP 포트: 5565
FTP 아이디: [사용자 아이디]
```
4. CDN의 경우, `https://[사용자 아이디].cdn2.cafe24.com`(예시)가 접속 주소가 된다.
5. 스트리밍의 경우, `mms://wm-004.cafe24.com/[사용자 아이디]/abc.mp3`(예시)가 접속 주소가 된다.
2. ResonableFramework v1.6.8 설치 및 CDN/스트리밍 설정
1. [깃허브 저장소](https://github.com/gnh1201/reasonableframework) 접속 후 `Release` 탭을 누르고 `v1.6.8` 또는 최신 버전을 내려받는다.
2. `storage/config/uri.ini.php` 파일의 CDN/스트리밍 관련 부분을 아래와 같이 수정한다.
```
base_cdn_url = https://[사용자 아이디].cdn2.cafe24.com
base_vod_url = mms://wm-004.cafe24.com/[사용자 아이디]
```
3. `route` 폴더 밑에 `cdntest.php` 이름의 빈 파일을 만들고, 아래와 같이 입력 후 저장한다.
```
<?php
$data = array(
"imageurl" => get_cdn_link("/picture.jpg");
);
renderView("view_cdntest", $data);
```
4. `view` 폴더 밑에 `view_cdntest.php` 이름의 빈 파일을 만들고, 아래와 같이 입력 후 저장한다.
```
<img src="<?php echo $imageurl; ?>" alt="this is cdn test">
```
5. 사용하고 있는 웹 호스팅에 reasonableframework-master 폴더 아래의 모든 파일을 업로드한다.
6. 1번에서 얻은 FTP 정보를 이용하여, CDN 서버에 `picture.jpg` 이름으로 임의의 JPG 그림 파일을 업로드한다.
7. 웹 브라우저를 열고 `http://[웹 호스팅 주소]/?route=cdntest`에 접속하여 그림이 잘 뜨는지 확인한다.
### Amazon S3 또는 Object Storage 사용자
- 해당 정적 파일 호스팅 업체에서 제공하는 공통 링크를 확인한 뒤, 해당 링크를 `storage/config/uri.ini.php` 파일의 `base_cdn_url`에 반영한다.
## 기술지원 및 문의사항
- 웹사이트: https://catswords.social/@catswords_oss
- 이메일: abuse@catswords.net

107
README.md
View File

@ -1,21 +1,18 @@
# ReasonableFramework
![Discord](https://img.shields.io/discord/359930650330923008.svg)
![View Licence](https://img.shields.io/github/license/gnh1201/reasonableframework.svg)
![Librapay](http://img.shields.io/liberapay/receives/catswords.svg?logo=liberapay)
![License LGPLv3](https://img.shields.io/github/license/gnh1201/reasonableframework.svg)
[![DOI](https://zenodo.org/badge/114566493.svg)](https://zenodo.org/doi/10.5281/zenodo.11392416)
- ReasonableFramework is `RVHM` structured PHP framework with common security
- Prefix code: `RSF` (ReasonableFramework)
- Old prefix code: `VSPF` (Very Simple PHP Framework)
ReasonableFramework is RVHM structured PHP framework. aka, RSF, VSPF, C-2020-018490
![This project open source licensed under LGPL version 3](https://github.com/gnh1201/reasonableframework/raw/master/lgplv3-147x51.png)
## technical support (donate us)
- [Technical support and improved web security for ReasonableFramework](https://catswords.re.kr/go/rsfsecurity) ($4/Monthly, pay on Patreon)
## Specification
- Database connection (via PDO, MySQLi (MySQL Improved), MySQL Tranditional, MySQL CLI, Oracle(OCI))
- RVHM structure: `R` is Route (like as `controller`), `V` is View, `H` is Helper (like as `import` on Python/Go/NodeJS), `M` is Model and implemented with `KV bind`(like as `Map` data structure), Model is not required.
- Controllable shared variables: Minimize abuse of global variables (Inspired by the `scope` of AngularJS, and `SharedPreferences` of Android Framework)
## Specifications
- Various types of database connection drivers. e.g, PHP PDO, MySQLi, Legacy MySQL, MySQL over the shell, Oracle(OCI)
- No OOP, Just `RVHM` structure
- R is Route. like as `controller`
- V is View
- H is Helper. like a `import` on Python, Go, NodeJS
- M is Model. it implemented with `KV bind`(like as `Map` data structure), Model is optional.
- Controllable shared variables: Minimize abuse of global variables. Inspired by the `scope` of AngularJS, and `SharedPreferences` of Android Framework
- CGI style compatibility prepared for industrial applications: This framework can utilize both the latest object-oriented style and the CGI style required in industrial applications.
## Compatible
- Tested in PHP 5.3.3
@ -31,51 +28,61 @@
## Map of structure
![Map of structure](https://github.com/gnh1201/reasonableframework/raw/master/assets/img/reasonableframework.jpg)
## Roadmap
- Support critial and special-purposed web environment (industry, scientific, legacy, or more)
## Quick Start
1. git clone https://github.com/gnh1201/reasonableframework.git
2. set up database configuration: `/storage/config/database.ini.php`
2. edit database configuration: `/storage/config/database.ini.php`
3. create new file: `/route/example.php`
4. go to `http://[base_url]/?route=example` or `http://[base_url]/example/`(if set `.htaccess`) in your web browser.
5. enjoy it.
4. go to `http://:base_url/?route=example` or `http://:base_url/example/`(if set `.htaccess`) in the web browser.
5. code it.
## Examples
- [REST API Integration (Naver Papago Translation REST API)](https://gist.github.com/gnh1201/081484e6f5e10bd3be819093ba5f49c8)
- [Payment Gateway Integration (KCP)](https://github.com/gnh1201/reasonableframework/blob/master/route/orderpay.pgkcp.php)
## Use cases
- [Send severities from Zabbix to Grafana](https://gist.github.com/gnh1201/792964e9719d2f62157cf46e394888f5)
- [REST API Integration (Papago Translation REST API)](https://gist.github.com/gnh1201/081484e6f5e10bd3be819093ba5f49c8)
- [Payment Gateway Integration](https://github.com/gnh1201/reasonableframework/blob/master/route/orderpay.pgkcp.php)
## [NEW] Advanced security (only for sponsors)
- CORS, CSRF, XSS, SQL-injection protection is common security, it is free and open-source for everyone.
- Firewall, DDoS protection, and more security tools are available only for sponsors. [more](https://github.com/gnh1201/reasonableframework/blob/master/SECURITY.md)
## Remote logging
- Remote logging feature based on [RFC3164(The BSD Syslog Protocol)](https://tools.ietf.org/html/rfc3164)
## [NEW] Remote Debugging (free for all)
- Remote debugging feature based on [RFC3164(The BSD Syslog Protocol)](https://catswords.re.kr/go/rfc3164), with [Papertrail](https://catswords.re.kr/go/papertrail)
## Tested on free web hostings
## How to use CLI (Command line interface)
| Provider | Pass? | Tested version | Note
| ---------------------- | ------ | -------------- | -------------------------- |
| [vultr.com](https://catswords.re.kr/go/vultr) (Vultr Holdings Co.) | :heavy_check_mark: Passed | v1.6.5.2 | Paid, Pre-configured LAMP server |
| cafe24.com (Cafe24 Inc.) | :heavy_check_mark: Passed | v1.6.2 | Paid |
| woobi.co.kr (MyCGI) | :heavy_check_mark: Passed | v1.6.2 | |
| dothome.co.kr (Anysecure Inc.) | :heavy_check_mark: Passed | v1.5 | |
| ivyro.net (Smileserv Inc.) | :heavy_check_mark: Passed | v1.5 | |
| 000webhost.com | :warning: Warn | v1.5 | Advertising logo |
| freewebhostingarea.com | :heavy_check_mark: Passed | v1.5 | |
| infinityfree.net | :warning: Warn | v1.5 | Anti-crawling |
| freehosting.io | :heavy_check_mark: Passed | v1.5 | |
| freehostingeu.com | :warning: Warn | v1.5 | CURL blocked |
| freehostingnoads.net | :warning: Warn | v1.5 | CURL blocked |
| awardspace.com | :warning: Warn | v1.5 | CURL blocked |
## How to use CLI (Command-line interface)
```
$ php cli.php --route [route name] --session-id [session ID]
$ php cli.php --route :route --session-id :session_id
```
## 한국어(Korean)
- **리즈너블(이유있는) 프레임워크**는 거친 웹 개발 환경을 위해 설계된 PHP 프레임워크입니다.
- **레거시 개발**이나 **과학기술연구** 등 특수 목적을 가진 개발에 특화된 설계로 높은 안정성과 보안을 제공합니다.
- PHP를 기반으로 하는 무료 웹 호스팅에서도 원활하게 돌아가도록 지원합니다.
- 객체지향, 모듈러(MVC), 시큐어 코딩 등 현대적인 웹 기술을 모르더라도 **더 견고한** 기준을 제공합니다.
- 리즈너블 프레임워크는 CSRF, XSS, SQL 인젝션 등 기초적인 **보안 위협에 사전 대응**하도록 설계되어 있습니다.
- PHP 버전 4 부터 버전 7까지 다양한 개인 및 기업 **적용 사례**를 보유하고 있습니다.
- [카카오톡 채팅방](https://catswords.re.kr/go/kakaotalk)을 통해 실시간 버그 및 보안 이슈 해결이 가능합니다.
## Comment about PSR standards
Many people are saying that this project seems to be distant from the [PSR](https://www.php-fig.org/psr/) standards, and that claim is correct.
## English
- **Reasonable Framework** is a PHP framework designed for rugged web development environments.
- Designed for special purpose development such as **legacy development** or **science and technology research**, it provides high stability and security.
- It also works smoothly on free web hosting based on PHP.
- It provides a **stronger standard** even if you don't know modern web technologies, such as object-oriented, modular (MVC), and secure coding.
- Resonable Framework is designed to **proactively respond to fundamental security threats** such as CSRF, XSS, and SQL injection.
- We have **various enterprise cases** from PHP version 4(legacy) to 7(modern).
- You can quickly resolve bugs and security issues in [our chatting room](https://catswords.re.kr/go/kakaotalk).
The coding convention of this project is similar to the CGI style that was widely used in the early 2000s. Moreover, this style is still observed in solutions written in PHP that are sold in markets such as [WordPress](https://wordpress.org/) plugins, [a local-optimized CMS](https://github.com/gnuboard/gnuboard5), or [Codecanyon](https://codecanyon.net/) in 2023.
Although this project hardly uses object-oriented concepts and does not use package managers like Composer much, it still incorporates concepts such as Model, View, Controller, Router, and Helper that are proposed in modern frameworks, and we have made efforts to provide a similar experience as much as possible.
We made efforts to address common security vulnerabilities (XSS, CSRF, SQL injection) in web applications, and included many code snippets that were designed to minimize reliance on specific DBMS or communication drivers.
The specifications that this project offers are still in demand in enterprise environments, so it can be a useful solution if you happen to be in such a situation.
Whenever this project was introduced, I received a lot of questions about PSR, and I also made efforts to find customers who were willing to pay for a PSR version, such as holding conferences for existing customers. However, there is still no good news. Until good news comes, my plan is to mainly maintain this project.
If you want to comply with the PSR standards and your colleagues are also ready to learn them humbly, we recommend that you consider [Codeigniter](https://github.com/bcit-ci/CodeIgniter) (which has a similar structure to this project) or [Silm Framework](https://github.com/slimphp/Slim).
## Security Policy
- [Security policy](SECURITY.md)
## Contact us
- gnh1201@gmail.com
- support@exts.kr
- catswords@protonmail (if you require confidential)
- abuse@catswords.net
- ActivityPub [@catswords_oss@catswords.social](https://catswords.social/@catswords_oss)

View File

@ -1,15 +1,23 @@
# Advanced security for ReasonableFramework
the advanced security against XSS, CSRF, SQL injection, DDoS, Webshell (malicious code), weak configurations, which extensions available only for sponsors . Generally, the default security is sufficient to you in our framework. so, you have to use it after did understand what is this.
# Security Policy
## Including files
- index.php
- helper/php-firewall.php
- helper/php-ddos.php
- and more
## Supported Versions
## Minimum tier
- 16 USD/monthly (Technical support)
Use this section to tell people about which versions of your project are
currently being supported with security updates.
Thank you.
| Version | Supported |
| ------- | ------------------------------------------ |
| 1.6.x | :white_check_mark: (Current) |
| 1.5.x | :x: (EOL: 2020-08-25) |
| < 1.5 | :x: |
https://www.patreon.com/posts/advanced-security-27376670
## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
## Contact us
* ActivityPub [@catswords_oss@catswords.social](https://catswords.social/@catswords_oss)
* abuse@catswords.net

View File

@ -1,2 +0,0 @@
# Confirmed version
Last confirmed: 2018-03-09 22:00 (KST, GMT+09:00, Seoul)

View File

@ -1,3 +0,0 @@
#!/bin/bash
chmod -R 707 .
cp ./storage/example/_.htaccess ./.htaccess

View File

@ -1,4 +1,5 @@
#!/bin/bash
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
#find . -type d -exec chmod 0755 {} \;
#find . -type f -exec chmod 0644 {} \;
chmod -R u+rwX,go+rX,go-w .
cp ./storage/example/_.htaccess ./.htaccess

30
cli.php
View File

@ -3,12 +3,14 @@
/**
* @file cli.php
* @created_on 2018-07-22
* @created_on 2020-01-28
* @author Go Namhyeon <gnh1201@gmail.com>
* @created_on 2020-04-20
* @author Go Namhyeon <abuse@catswords.net>
* @brief ReasonableFramework CLI mode
* @cvs http://github.com/gnh1201/reasonableframework
*/
// example: php cli.php --route=welcome
define("_DEF_VSPF_", true); // compatible to VSPF
define("_DEF_RSF_", true); // compatible to RSF
define("APP_DEVELOPMENT", false); // set the status of development
@ -61,7 +63,6 @@ if(!empty($memory_limit)) {
@ini_set("suhosin.memory_limit", $memory_limit);
}
// autoload module
if(!array_key_empty("enable_autoload", $config)) {
set_autoloader();
@ -75,19 +76,20 @@ date_default_timezone_set($default_timezone);
$route = "welcome";
// set arguments of command line
$opts = setopt("r::h::", array("route::", "host::"));
set_shared_var("route", $opts['route']);
$opts = getopt("r::h::", array("route::", "host::"));
if(!empty($opts['route'])) {
$route = $opts['route'];
}
// set global variables
set_shared_var("route", $route);
set_shared_var("host", $opts['host']);
// load route
if(empty($route)) {
$route = get_value_in_array("default_route", $config, "welcome");
} else {
$route_names = explode('/', $route);
if(count($route_names) > 1) {
$route = $route_names[0];
}
}
// get PID(Process ID)
set_shared_var("mypid", getmypid());
// set database connection
set_shared_var("dbc", get_db_connect());
// load route file
if(!loadRoute($route, $shared_vars)) {

View File

@ -5,7 +5,7 @@
"authors": [
{
"name": "Go Namhyeon",
"email": "gnh1201@gmail.com"
"email": "abuse@catswords.net"
}
],
"require": {

View File

@ -1,3 +0,0 @@
#!/bin/bash
find ./ -type f -name "*.php" -exec sed -i 's/\t/ /g' {} \;
echo "done"

86
helper/SSL.class.php Normal file
View File

@ -0,0 +1,86 @@
<?php
// https://stackoverflow.com/questions/3464113/is-it-possible-to-read-ssl-information-in-php-from-any-website
if(!class_exists("SSL")) {
class SSL {
public $domain, $validFrom, $validTo, $issuer, $validity, $validitytot, $crtValRemaining;
private static function instantiate($url, $info) {
$obj = new static;
$obj->domain = $url;
$obj->validFrom = $info['validFrom'];
$obj->validTo = $info['validTo'];
$obj->issuer = $info['issuer'];
$obj->validity = $info['validity'];
$obj->validitytot = $info['validitytot'];
$obj->crtValRemaining = $info['crtValRemaining'];
return $obj;
}
public static function getSSLinfo($url, $port=443) {
$ssl_info = [];
$certinfo = static::getCertificateDetails($url, $port);
$validFrom_time_t_m = static::dateFormatMonth($certinfo['validFrom_time_t']);
$validTo_time_t_m = static::dateFormatMonth($certinfo['validTo_time_t']);
$validFrom_time_t = static::dateFormat($certinfo['validFrom_time_t']);
$validTo_time_t = static::dateFormat($certinfo['validTo_time_t']);
$current_t = static::dateFormat(time());
$ssl_info['validFrom'] = $validFrom_time_t_m;
$ssl_info['validTo'] = $validTo_time_t_m;
$ssl_info['issuer'] = $certinfo['issuer']['O'];
$ssl_info['validity'] = static::diffDate($current_t, $validTo_time_t)." days";
$ssl_info['validitytot'] = (static::diffDate($validFrom_time_t, $validTo_time_t)-1).' days';
$ssl_info['crtValRemaining'] = $certinfo['validTo_time_t'];
return static::instantiate($url, $ssl_info); // return an object
}
private static function getCertificateDetails($url, $port=443) {
$urlStr = strtolower(trim($url));
$parsed = parse_url($urlStr);// add http://
if (empty($parsed['scheme'])) {
$urlStr = 'http://' . ltrim($urlStr, '/');
}
$orignal_parse = parse_url($urlStr, PHP_URL_HOST);
$get = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE)));
$read = stream_socket_client("ssl://".$orignal_parse.":".$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $get);
$cert = stream_context_get_params($read);
$certinfo = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
return $certinfo;
}
private static function dateFormat($stamp) {
return strftime("%Y-%m-%d", $stamp);
}
private static function dateFormatMonth($stamp) {
return strftime("%Y-%b-%d", $stamp);
}
private static function diffDate($from, $to) {
$date1=date_create($from);
$date2=date_create($to);
$diff=date_diff($date1,$date2);
return ltrim($diff->format("%R%a"), "+");
}
}
}
/*
## Example
```
$certInfo = SSL::getSSLinfo('stackoverflow.com');
echo $certInfo->validFrom .'<br>';
echo $certInfo->validTo .'<br>';
echo $certInfo->issuer .'<br>';
echo $certInfo->validity .'<br>';
echo $certInfo->validitytot .'<br>';
echo $certInfo->crtValRemaining .'<br>';
```
*/

View File

@ -12,143 +12,146 @@
* @author Andrew Moore
* @link http://www.php.net/manual/en/function.uniqid.php#94959
*/
class UUID
if(!class_exists("UUID"))
{
/**
* Generate v3 UUID
*
* Version 3 UUIDs are named based. They require a namespace (another
* valid UUID) and a value (the name). Given the same namespace and
* name, the output is always the same.
*
* @param uuid $namespace
* @param string $name
*/
public static function v3($namespace, $name)
class UUID
{
if(!self::is_valid($namespace)) return false;
// Get hexadecimal components of namespace
$nhex = str_replace(array('-','{','}'), '', $namespace);
// Binary Value
$nstr = '';
// Convert Namespace UUID to bits
for($i = 0; $i < strlen($nhex); $i+=2)
/**
* Generate v3 UUID
*
* Version 3 UUIDs are named based. They require a namespace (another
* valid UUID) and a value (the name). Given the same namespace and
* name, the output is always the same.
*
* @param uuid $namespace
* @param string $name
*/
public static function v3($namespace, $name)
{
$nstr .= chr(hexdec($nhex[$i].$nhex[$i+1]));
if(!self::is_valid($namespace)) return false;
// Get hexadecimal components of namespace
$nhex = str_replace(array('-','{','}'), '', $namespace);
// Binary Value
$nstr = '';
// Convert Namespace UUID to bits
for($i = 0; $i < strlen($nhex); $i+=2)
{
$nstr .= chr(hexdec($nhex[$i].$nhex[$i+1]));
}
// Calculate hash value
$hash = md5($nstr . $name);
return sprintf('%08s-%04s-%04x-%04x-%12s',
// 32 bits for "time_low"
substr($hash, 0, 8),
// 16 bits for "time_mid"
substr($hash, 8, 4),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 3
(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
// 48 bits for "node"
substr($hash, 20, 12)
);
}
// Calculate hash value
$hash = md5($nstr . $name);
return sprintf('%08s-%04s-%04x-%04x-%12s',
// 32 bits for "time_low"
substr($hash, 0, 8),
// 16 bits for "time_mid"
substr($hash, 8, 4),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 3
(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
// 48 bits for "node"
substr($hash, 20, 12)
);
}
/**
*
* Generate v4 UUID
*
* Version 4 UUIDs are pseudo-random.
*/
public static function v4()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
mt_rand(0, 0x0fff) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
/**
* Generate v5 UUID
*
* Version 5 UUIDs are named based. They require a namespace (another
* valid UUID) and a value (the name). Given the same namespace and
* name, the output is always the same.
*
* @param uuid $namespace
* @param string $name
*/
public static function v5($namespace, $name)
{
if(!self::is_valid($namespace)) return false;
// Get hexadecimal components of namespace
$nhex = str_replace(array('-','{','}'), '', $namespace);
// Binary Value
$nstr = '';
// Convert Namespace UUID to bits
for($i = 0; $i < strlen($nhex); $i+=2)
/**
*
* Generate v4 UUID
*
* Version 4 UUIDs are pseudo-random.
*/
public static function v4()
{
$nstr .= chr(hexdec($nhex[$i].$nhex[$i+1]));
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
mt_rand(0, 0x0fff) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
// Calculate hash value
$hash = sha1($nstr . $name);
/**
* Generate v5 UUID
*
* Version 5 UUIDs are named based. They require a namespace (another
* valid UUID) and a value (the name). Given the same namespace and
* name, the output is always the same.
*
* @param uuid $namespace
* @param string $name
*/
public static function v5($namespace, $name)
{
if(!self::is_valid($namespace)) return false;
return sprintf('%08s-%04s-%04x-%04x-%12s',
// Get hexadecimal components of namespace
$nhex = str_replace(array('-','{','}'), '', $namespace);
// 32 bits for "time_low"
substr($hash, 0, 8),
// Binary Value
$nstr = '';
// 16 bits for "time_mid"
substr($hash, 8, 4),
// Convert Namespace UUID to bits
for($i = 0; $i < strlen($nhex); $i+=2)
{
$nstr .= chr(hexdec($nhex[$i].$nhex[$i+1]));
}
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 5
(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x5000,
// Calculate hash value
$hash = sha1($nstr . $name);
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
return sprintf('%08s-%04s-%04x-%04x-%12s',
// 48 bits for "node"
substr($hash, 20, 12)
);
}
// 32 bits for "time_low"
substr($hash, 0, 8),
public static function is_valid($uuid) {
return preg_match('/^\{?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?'.
'[0-9a-f]{4}\-?[0-9a-f]{12}\}?$/i', $uuid) === 1;
// 16 bits for "time_mid"
substr($hash, 8, 4),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 5
(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x5000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
// 48 bits for "node"
substr($hash, 20, 12)
);
}
public static function is_valid($uuid)
{
return preg_match('/^\{?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?'.
'[0-9a-f]{4}\-?[0-9a-f]{12}\}?$/i', $uuid) === 1;
}
}
}
?>

View File

@ -2,7 +2,7 @@
/**
* @file api.whois.kr.php
* @date 2019-05-26
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KISA Whois/Domain/IP/AS Query Helper (https://whois.kr)
*/

View File

@ -2,7 +2,7 @@
/**
* @file catsplit.format.php
* @date 2019-05-28
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Catsplit format encoder
* @documentation https://github.com/gnh1201/catsplit-format
*/

View File

@ -1,10 +1,10 @@
<?php
// Go Namhyeon <gnh1201@gmail.com>
// Go Namhyeon <abuse@catswords.net>
// 2019-09-25
if(!is_fn("decode_colona_format") {
if(!is_fn("decode_colona_format")) {
function decode_colona_format($data) {
$lines = split_by_line(remove_utf8_bom($data));
$lines = explode_by_line(remove_utf8_bom($data));
$jobargs = array();
$eof = false;
$delimiter = ":";

View File

@ -1,6 +1,6 @@
<?php
// @date 2019-10-13
// @author Go Namhyeon <gnh1201@gmail.com>
// @author Go Namhyeon <abuse@catswords.net>
if(!is_fn("unzip")) {
function unzip($src, $dst, $options=array()) {

View File

@ -2,7 +2,7 @@
/**
* @file country.kr.php
* @date 2018-04-15
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Country Helper (Korean)
*/

41
helper/coupang.api.php Normal file
View File

@ -0,0 +1,41 @@
<?php
// Coupang Products Search API
// https://coupa.ng/bZ3Kba
// https://developers.coupangcorp.com/hc/ko/articles/360033461914-HMAC-Signature-%EC%83%9D%EC%84%B1
loadHelper("webpagetool");
if(!is_fn("coupang_get_signature")) {
function coupang_get_signature($method, $path, $query, $ACCESS_KEY, $SECRET_KEY) {
$datetime = date("ymd") . 'T' . date("His") . 'Z';
$message = $datetime . strtoupper($method) . str_replace("?", "", $path) . http_build_query($query);
$algorithm = "HmacSHA256";
$signature = hmacsha256_sign_message($message, $SECRET_KEY);
return "CEA algorithm=HmacSHA256, access-key=" . $ACCESS_KEY . ", signed-date=" . $datetime . ", signature=" . $signature;
}
}
if(!is_fn("coupang_search_items")) {
function coupang_search_items($keyword, $ACCESS_KEY, $SECRET_KEY) {
$URL_PARTS = array("https://api-gateway.coupang.com", "/v2/providers/affiliate_open_api/apis/openapi/v1", "/products/search");
$BASE_URL = $URL_PARTS[0] . $URL_PARTS[1];
$method = "get";
$path = $URL_PARTS[1] . $URL_PARTS[2];
$query = array(
"keyword" => $keyword,
"limit" => 20, // default is 20
//"subId" => "" // default is null
);
$response = get_web_page($BASE_URL . $URL_PARTS[2], $method, array(
"headers" => array(
"Authorization" => coupang_get_signature($method, $path, $query, $ACCESS_KEY, $SECRET_KEY)
),
"data" => $query
));
var_dump($response);
}
}

View File

@ -2,7 +2,7 @@
/**
* @file database.alt.php
* @date 2018-09-10
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Database alternative driver switcher
*/

View File

@ -2,7 +2,7 @@
/**
* @file database.mysql.cmd.php
* @date 2019-04-06
* @auther Go Namhyeon <gnh1201@gmail.com>
* @auther Go Namhyeon <abuse@catswords.net>
* @brief MySQL(MariaDB) command line driver
*/

View File

@ -2,7 +2,7 @@
/**
* @file database.mysql.imp.php
* @date 2018-09-10
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief MySQLi database helper
*/

View File

@ -2,7 +2,7 @@
/**
* @file database.mysql.old.php
* @date 2018-09-14
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief MySQL-old (lower than 5.4) database helper
*/

View File

@ -2,7 +2,7 @@
/**
* @file oracle.php
* @date 2018-03-27
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Oracle database helper for ReasonableFramework
*/

View File

@ -1,8 +1,9 @@
<?php
/**
* @file exectool.php
* @date 2018-07-22
* @author Go Namhyeon <gnh1201@gmail.com>
* @created_on 2018-07-22
* @updated_on 2020-07-10
* @author Go Namhyeon <abuse@catswords.net>
* @forked from https://github.com/scipag/PHPUtilities
* @brief ExecTool helper
*/
@ -133,7 +134,12 @@ if(!is_fn("exec_command")) {
return $return;
}
if ($method == "") {
// An 'async' option will be return PID
if(array_key_equals("async", $options, true)) {
$command = sprintf("%s 1>/dev/null 2>&1 & echo $!;", $command);
}
if (empty($method)) {
// ob_start() will turn on output buffering to collect all output from
// exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection")
ob_start();
@ -157,7 +163,6 @@ if(!is_fn("exec_command")) {
case "exec":
exec($command, $output);
var_dump($output);
break;
case "shell_exec":
@ -201,6 +206,11 @@ if(!is_fn("exec_command")) {
$return = ob_get_clean();
// PID is integer
if(array_key_equals("async", $options, true)) {
$return = intval(rtrim($return));
}
return $return;
}
}

View File

@ -2,7 +2,7 @@
/**
* @file gnuboard.php
* @date 2018-05-27
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Database Helper for Gnuboard 4, Gnuboard 5
*/

24
helper/hiddentool.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/**
* @file hiddentool.php
* @created_on 2021-05-24
* @updated_on 2022-09-13
* @author Go Namhyeon <abuse@catswords.net>
* @brief Tools for Hidden Services (e.g. Tor, I2P, etc...)
*/
if (!is_fn("detect_hidden_service")) {
function detect_hidden_service() {
$score = 0;
$suffixes = array("onion", "i2p", "crypto");
$forwarded_host = get_header_value("X-Forwarded-Host");
if (!empty($forwarded_host)) {
if (in_array(end(explode('.', $forwarded_host)), $suffixes)) {
$score += 1;
}
}
return $score;
};
}

View File

@ -2,7 +2,7 @@
/**
* @file hybridauth.dbt.php
* @date 2018-04-15
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief HybridAuth DB Helper
*/

View File

@ -2,7 +2,7 @@
/**
* @file hybridauth.lnk.php
* @date 2018-09-26
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief HybridAuth library RSF Linker
***/

View File

@ -2,7 +2,7 @@
/**
* @file isemail.lnk.php
* @date 2018-03-02
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief IsEmail library linker
*/

View File

@ -2,7 +2,7 @@
/**
* @file jCryption.lnk.php
* @date 2018-09-30
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief jCryption (alternative HTTPS on javascript) Helper
*/

View File

@ -1,7 +1,7 @@
<?php
// @created_on 2019-10-13
// @updated_on 2020-01-27
// @author Go Namhyeon <gnh1201@gmail.com>
// @author Go Namhyeon <abuse@catswords.net>
if(!is_fn("json_decode_ex")) {
function json_decode_ex($data, $options=array()) {

View File

@ -2,7 +2,7 @@
/**
* @file kimsboard7.dbt.php
* @date 2018-08-20
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Database Helper for Kimsboard 7 (experimental)
*/

View File

@ -2,7 +2,7 @@
/**
* @file lguplus.api.php
* @date 2019-10-07
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief `LGU+`or `LGUPlus` is trandmark of LGUPlus Co. Ltd.
*/

View File

@ -2,7 +2,7 @@
/**
* @file lguplus.install.php
* @date 2019-10-13
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief `LGU+`or `LGUPlus` is trandmark of LGUPlus Co. Ltd.
*/

View File

@ -2,7 +2,7 @@
/**
* @file mailgun.api.php
* @date 2019-04-12
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Mailgun REST API interface module
* @documentation https://documentation.mailgun.com/en/latest/api-sending.html
*/

View File

@ -2,7 +2,7 @@
/**
* @file metaparser.lnk.php
* @date 2018-03-21
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief PHP-Metaparser library linker
*/

21
helper/migrate.1.5.php Normal file
View File

@ -0,0 +1,21 @@
<?php
// @file migrate.1.5.php
// migration helper from ResaonbleFramework 1.5
if(!is_fn("check_function_exists")) {
function check_function_exists($fn) {
return is_fn($fn);
}
}
if(!is_fn("set_scope")) {
function set_scope($k, $v) {
return set_shared_var($k, $v);
}
}
if(!is_fn("get_scope")) {
function get_scope($k) {
return get_shared_var($k);
}
}

View File

@ -2,7 +2,7 @@
/**
* @file mobiletool.php
* @date 2019-04-29
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Mobile Tool
* @documentation https://www.w3.org/Mobile/training/device-detection/mobile_detector.txt
*/

View File

@ -1,8 +1,9 @@
<?php
/**
* @file networktool.php
* @date 2018-04-11
* @author Go Namhyeon <gnh1201@gmail.com>
* @created_on 2018-04-11
* @updated_on 2022-09-16
* @author Go Namhyeon <abuse@catswords.net>
* @brief Network tool helper
*/
@ -126,3 +127,11 @@ if(!is_fn("get_network_outbound_addr")) {
return $addr;
}
}
if(!is_fn("detect_perf_agent")) {
function detect_perf_agent() {
$evt = get_network_event();
$agent = $evt['agent'];
return preg_match('(PingdomPageSpeed|GTmetrix)', $agent) === 1;
}
}

View File

@ -2,7 +2,7 @@
/**
* @file obfuscator.php
* @date 2018-10-21
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief PHP Obfuscator for ReasonableFramework
*/

View File

@ -2,7 +2,7 @@
/**
* @file pagenate.php
* @date 2018-01-01
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Page navigation helper
*/

68
helper/perftool.php Normal file
View File

@ -0,0 +1,68 @@
<?php
/**
* @file perftool.php
* @created_on 2020-02-19
* @updated_on 2020-02-24
* @author Go Namhyeon <abuse@catswords.net>
* @brief PerfTool helper
*/
if(!is_fn("get_cpu_idle")) {
function get_cpu_idle() {
$idle = false;
if(loadHelper("exectool")) {
$idle = floatval(trim(exec_command("top -n 1 -b | grep -i Cpu\(s\) | awk '{print \$8}'"))) / 100.0;
}
return $idle;
}
}
if(!is_fn("get_cpu_idle2")) {
function get_cpu_idle2() {
$idle = false;
if(loadHelper("exectool")) {
$idle = floatval(trim(exec_command("grep 'cpu ' /proc/stat | awk '{idle=(\$5)/(\$2+\$4+\$5)} END {print idle}'")));
}
return $idle;
}
}
if(!is_fn("set_min_cpu_idle")) {
function set_min_cpu_idle($ratio=0.01) {
$wait = 0;
// default (cpu_sleep_time): 3 seconds
$cpu_sleep_time = floatval(get_value_in_array("cpu_sleep_time", $config, 3));
if($ratio > 0 && $ratio < 1) {
while(get_cpu_idle() < $ratio) {
if($wait == 0) {
write_common_log("CPU usage exceeded. wait a few seconds...", "helper/preftool");
}
sleep($cpu_sleep_time);
$wait++;
}
}
if($wait > 0) {
write_common_log(sprintf("CPU usage recovered. waited %s seconds ago", ($wait * $cpu_sleep_time)), "helper/preftool");
}
}
}
if(!is_fn("set_cpu_usage_limit")) {
function set_cpu_usage_limit($ratio=0.9) {
$config = get_config();
$num_cores = get_value_in_array("cpu_num_cores", $config, 1);
$pid = get_shared_var("mypid");
if(!empty($pid) && loadHelper("exectool")) {
write_common_log(sprintf("Limited CPU usage (%s, %s)<=(PID, LIMIT)", $pid, ($ratio * $num_cores) * 100), "helper/perftool");
exec_command(sprintf("cpulimit --pid %s --limit %s", $pid, ($ratio * $num_cores) * 100));
}
}
}

View File

@ -2,7 +2,7 @@
/**
* @file pgkcp.install.php
* @date 2019-10-13
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) Auto-Install Tool
*/

View File

@ -3,7 +3,7 @@
* @file pgkcp.lnk.php
* @created_on 2018-08-25
* @updated_on 2020-01-13
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) Helper
*/

View File

@ -1,7 +1,7 @@
<?php
/*
* @file rfc3164.proto.php
* @author Go Namhyeon <gnh1201@gmail.com> (Modified)
* @author Go Namhyeon <abuse@catswords.net> (Modified)
* @author Troy Davis (@tory) - https://gist.github.com/troy/2220679 (Original)
* @brief Helper for RFC3164(The BSD Syslog Protocol) - https://tools.ietf.org/html/rfc3164
* @created_on 2018-03-02

View File

@ -2,7 +2,7 @@
/**
* @file socialtools.php
* @date 2018-09-27
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief SocialTools (refactoring from SocioRouter)
*/

View File

@ -2,7 +2,7 @@
/**
* @file spreadsheet-reader.lnk.php
* @date 2018-09-20
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Excel file parser
***/

View File

@ -1,7 +1,7 @@
/**
* @file staticgen.php
* @date 2018-07-22
* @auther Go Namhyeon <gnh1201@gmail.com>
* @auther Go Namhyeon <abuse@catswords.net>
* @brief Static Web Generation Tool for ResaonableFramework
*/

View File

@ -2,8 +2,8 @@
/**
* @file string.utils.php
* @created_on 2018-05-27
* @updated_on 2020-01-25
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated_on 2020-02-21
* @author Go Namhyeon <abuse@catswords.net>
* @brief String utility helper
*/
@ -60,10 +60,10 @@ if(!is_fn("get_converted_string")) {
}
if(!is_fn("nl2p")) {
function nl2p($string) {
$paragraphs = '';
foreach (explode("\n", $string) as $line) {
if (trim($line)) {
function nl2p($str) {
$paragraphs = "";
foreach(explode_by_line($str) as $line) {
if(trim($line)) {
$paragraphs .= '<p>' . $line . '</p>';
}
}
@ -73,7 +73,7 @@ if(!is_fn("nl2p")) {
if(!is_fn("br2nl")) {
function br2nl($string) {
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
return preg_replace('/\<br(\s*)?\/?\>/i', DOC_EOL, $string);
}
}
@ -145,38 +145,69 @@ if(!is_fn("get_splitted_strings")) {
}
}
if(!is_fn("split_by_line")) {
function split_by_line($str) {
if(!is_fn("explode_by_line")) {
function explode_by_line($str) {
return preg_split('/\n|\r\n?/', $str);
}
}
if(!is_fn("read_storage_file_by_line")) {
function read_storage_file_by_line($filename, $options=array()) {
return split_by_line(read_storage_file($filename, $options));
// Deprecated: split_by_line()
if(!is_fn("split_by_line")) {
function split_by_line($str) {
return explode_by_line($str);
}
}
// https://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
if(!is_fn("startsWith")) {
function startsWith($haystack, $needle) {
if(!is_fn("explode_storage_file_by_line")) {
function explode_storage_file_by_line($filename, $options=array()) {
return explode_by_line(read_storage_file($filename, $options));
}
}
if(!is_fn("strlike")) {
function strlike($haystack, $needle) {
$flag = false;
$s = explode("%", $needle);
$d = count($s);
switch($d) {
case 3:
$flag = (strpos($haystack, $s[1]) !== false);
break;
case 2:
if($s[1] == "") {
//$flag = (strpos($haystack, $s[0]) === 0);
$flag = is_prefix($haystack, $s[0]);
} elseif($s[0] == "") {
//$flag = (strpos($haystack, $s[1]) !== false);
$flag = is_suffix($haystack, $s[1]);
}
break;
default:
$flag = ($needle === $haystack);
}
return $flag;
}
}
if(!is_fn("is_prefix")) {
function is_prefix($haystack, $needle) {
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
}
if(!is_fn("endsWith")) {
function endsWith($haystack, $needle) {
if(!is_fn("is_suffix")) {
function is_suffix($haystack, $needle) {
$length = strlen($needle);
if($length == 0) {
return true;
}
return (substr($haystack, -$length) === $needle);
}
}
// https://stackoverflow.com/questions/4955433/php-multiple-delimiters-in-explode/27767665#27767665
if(!is_fn("multi_explode")) {
function multi_explode($delimiters, $string) {
$ready = str_replace($delimiters, $delimiters[0], $string);
@ -205,24 +236,6 @@ if(!is_fn("multi_strpos")) {
}
}
if(!is_fn("multi_str_split")) {
function multi_str_split($string, $delimiters) {
$strings = array();
if(is_string($string)) {
$offset = 0;
$pos = -1;
while(!($pos !== false)) {
$offset = $pos + 1;
$pos = multi_strpos($string, $delimiters, $offset);
$strings[] = substr($string, $offset, $pos - $offset);
}
}
return $strings;
}
}
if(!is_fn("parse_pipelined_data")) {
function parse_pipelined_data($pipelined_data, $keynames=array()) {
$result = array();
@ -275,19 +288,31 @@ if(!is_fn("get_highlighted_html_by_words")) {
}
if(!is_fn("get_floating_percentage")) {
function get_floating_percentage($x, $a=2) {
return round(floatval($x) / 100, floatval($a));
function get_floating_percentage($x, $a=5) {
return round(floatval($x) / 100.0, $a);
}
}
if(!is_fn("eregi_compatible")) {
function eregi_compatible($pattern, $subject, &$matches=NULL) {
// https://stackoverflow.com/questions/13108157
if(!is_fn("get_csv_from_array")) {
function get_csv_from_array($data, $delimiter = ',', $enclosure = '"', $escape_char = "\\") {
$f = fopen('php://memory', 'r+');
foreach ($data as $item) {
fputcsv($f, $item, $delimiter, $enclosure, $escape_char);
}
rewind($f);
return stream_get_contents($f);
}
}
if(!is_fn("eregi")) {
function eregi($pattern, $subject, &$matches=NULL) {
return preg_match(sprintf("/%s/i", $pattern), $subject, $matches);
}
}
if(!is_fn("eregi_replace_compatible")) {
function eregi_replace_compatible($pattern, $replacement, $subject) {
if(!is_fn("eregi_replace")) {
function eregi_replace($pattern, $replacement, $subject) {
return preg_replace(sprintf("/%s/i", $pattern), $replacement, $subject);
}
}

View File

@ -2,7 +2,7 @@
/**
* @file tablewiz.php
* @date 2018-02-26
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief TableWiz helper
*/

View File

@ -2,7 +2,7 @@
/**
* @file timetool.php
* @date 2018-09-26
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Time tools
*/

View File

@ -2,7 +2,7 @@
/**
* @file twilio.api.php
* @date 2019-04-08
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Twilio REST API interface module
* @documentation https://www.twilio.com/docs/sms/send-messages
*/

View File

@ -2,7 +2,7 @@
/**
* @file vworld.php
* @date 2018-01-11
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Geo Helper based on vWorld (vworld.kr, molit.go.kr)
*/

View File

@ -2,7 +2,7 @@
/**
* @file webhooktool.php
* @date 2019-05-04
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief WebhookTools
* @trademark
* * `NateOn` is trademark of SK Communications Co Ltd., SK Planet Co Ltd., or other SK businesses.

View File

@ -2,8 +2,8 @@
/**
* @file webpagetool.php
* @created_on 2018-06-01
* @updated_on 2020-02-13
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated_on 2021-02-01
* @author Go Namhyeon <abuse@catswords.net>
* @brief WebPageTool helper
*/
@ -36,9 +36,9 @@ if(!is_fn("get_web_build_qs")) {
} else {
$pos = strpos($url, '?');
if ($pos === false) {
$qs = $url . '?' . http_build_query($data);
$qs = $url . '?' . http_build_query($data, '', '&');
} else {
$qs = $url . '&' . http_build_query($data);
$qs = $url . '&' . http_build_query($data, '', '&');
}
}
return $qs;
@ -93,13 +93,14 @@ if(!is_fn("get_web_cmd")) {
}
}
$args[] = get_web_build_qs($url, $data);
$args[] = sprintf("'%s'", make_safe_argument(get_web_build_qs($url, $data)));
}
if($method == "post") {
$args[] = "-X POST"; // set post request (the same as --request)
$args[] = sprintf("-A '%s'", get_web_user_agent($ua)); // set agent
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
foreach($headers as $k=>$v) {
// the same as --header
if(is_array($v)) {
@ -114,11 +115,15 @@ if(!is_fn("get_web_cmd")) {
$args[] = sprintf("-H '%s: %s'", make_safe_argument($k), make_safe_argument($v));
}
}
$_data = array();
foreach($data as $k=>$v) {
if(substr($v, 0, 1) == "@") { // if this is a file
// the same as --form
$args[] = sprintf("-F %s='%s'", make_safe_argument($k), make_safe_argument($v));
} else {
$_data[$k] = $v;
/*
if(array_key_equals("Content-Type", $headers, "multipart/form-data")) {
$args[] = sprintf("-F %s='%s'", make_safe_argument($k), make_safe_argument($v));
} elseif(array_key_equals("Content-Type", $headers, "application/x-www-form-urlencoded")) {
@ -126,8 +131,15 @@ if(!is_fn("get_web_cmd")) {
} else { // the same as --data
$args[] = sprintf("-d %s='%s'", make_safe_argument($k), make_safe_argument($v));
}
*/
}
}
// #110 [helper/webpagetool] post array data, but (string)`Array` given
if(count($_data) > 0) {
$args[] = sprintf("--data '%s'", get_web_build_qs("", $_data));
}
$args[] = $url;
}
@ -378,7 +390,7 @@ if(!is_fn("get_web_httpie")) {
} elseif($method == "post") {
$args[] = "POST";
$args[] = $url;
$args[] = sprintf("body='%s'", http_build_query($data));
$args[] = sprintf("body='%s'", get_web_build_qs("", $data));
} else {
$args[] = get_web_build_qs($url, $data);
}
@ -457,7 +469,7 @@ if(!is_fn("get_web_curl")) {
if(count($data) > 0) {
if($method == "post") {
foreach($data as $k=>$v) {
if(substr($v, 0, 1) == "@") { // if this is a file
if(is_string($v) && substr($v, 0, 1) == "@") { // if this is a file
if(is_fn("curl_file_create")) { // php 5.5+
$data[$k] = curl_file_create(substr($v, 1));
} else {
@ -468,7 +480,7 @@ if(!is_fn("get_web_curl")) {
$options[CURLOPT_POST] = 1;
if(is_array($data)) {
$options[CURLOPT_POSTFIELDS] = http_build_query($data);
$options[CURLOPT_POSTFIELDS] = get_web_build_qs("", $data);
} else {
$options[CURLOPT_POSTFIELDS] = $data;
}
@ -493,8 +505,8 @@ if(!is_fn("get_web_curl")) {
$options[CURLOPT_CUSTOMREQUEST] = "POST";
$options[CURLOPT_POST] = 1;
$options[CURLOPT_POSTFIELDS] = $_data;
$headers['Content-Type'] = "text/plain;charset=utf-8";
$headers['Accept'] = "text/plain, */*";
$headers['Content-Type'] = "application/octet-stream";
$headers['Accept'] = "application/octet-stream, */*";
$headers['Content-Length'] = strlen($_data);
}
}
@ -502,7 +514,7 @@ if(!is_fn("get_web_curl")) {
if(count($headers) > 0) {
foreach($headers as $k=>$v) {
if(is_array($v)) {
if($k == "Authentication") {
if($k == "Authorization" || $k == "Authentication") {
if($v[0] == "Basic" && check_array_length($v, 3) == 0) {
$options[CURLOPT_USERPWD] = sprintf("%s:%s", make_safe_argument($v[1]), make_safe_argument($v[2]));
} else {
@ -540,6 +552,15 @@ if(!is_fn("get_web_page")) {
$errno = false;
$content = false;
$_method = $method;
// check request method
if (!is_string($method)) {
set_error("method must be string");
show_errors();
}
// get process ID
$pid = getmyid();
// set user agent
$ua = get_web_user_agent($ua);
@ -574,7 +595,8 @@ if(!is_fn("get_web_page")) {
if(in_array("cache", $req_methods)) {
$content = get_web_cache($url, $method, $data, $proxy, $ua, $ct_out, $t_out, $headers);
} elseif(in_array("async", $req_methods)) {
$content = get_web_async($url, $req_methods[0], $data, $proxy, $ua, $ct_out, $t_out, $headers);
$pid = get_web_async($url, $req_methods[0], $data, $proxy, $ua, $ct_out, $t_out, $headers);
$content = posix_getpgid($pid);
} elseif(in_array("cmd", $req_methods)) {
$content = get_web_cmd($url, $req_methods[0], $data, $proxy, $ua, $ct_out, $t_out, $headers);
} elseif(in_array("fgc", $req_methods)) {
@ -622,7 +644,8 @@ if(!is_fn("get_web_page")) {
"status" => $status,
"resno" => $resno,
"errno" => $errno,
"id" => get_web_identifier($url, $method, $data, $headers),
"id" => get_web_identifier($url, $method, $data),
"pid" => $pid,
"md5" => get_hashed_text($content, "md5"),
"sha1" => get_hashed_text($content, "sha1"),
"gz_content" => get_hashed_text($gz_content, "base64"),
@ -631,7 +654,8 @@ if(!is_fn("get_web_page")) {
"gz_sha1" => get_hashed_text($gz_content, "sha1"),
"gz_ratio" => $gz_ratio,
"method" => $_method,
"params" => $data,
"headers" => $headers,
"params" => $data
);
return $response;
@ -649,9 +673,7 @@ if(!is_fn("get_web_identifier")) {
if($checksum_header != "*") { // compatible below 1.6
$checksums[] = $checksum_header;
}
//write_common_log(json_encode($checksums), "get_web_identifier");
return get_hashed_text(implode(".", $checksums));
}
}
@ -704,8 +726,16 @@ if(!is_fn("get_web_cache")) {
}
}
$_method = implode(".", $_new_methods);
$_data = $data;
if(count($headers) > 0) {
$_data = array(
"headers" => $headers,
"data" => $data
);
}
$response = get_web_page($url, $_method, $data, $proxy, $ua, $ct_out, $t_out);
$response = get_web_page($url, $_method, $_data, $proxy, $ua, $ct_out, $t_out);
$content = $response['content'];
if($cache_enabled) {
$gz_content = gzdeflate($content);
@ -854,7 +884,7 @@ if(!is_fn("get_webproxy_url")) {
if(!is_fn("get_web_user_agent")) {
function get_web_user_agent($ua="") {
if(empty($ua)) {
$ua = "ReasonableFramework/1.6-dev (https://github.com/gnh1201/reasonableframework)";
$ua = "ReasonableFramework/1.6.7-preview1 (Server; PHP " . phpversion() . "; https://catswords.social/@catswords_oss; abuse@catswords.net)";
} else {
$ua = make_safe_argument($ua);
}

View File

@ -2,7 +2,7 @@
/**
* @file wprest.php
* @date 2018-03-14
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Wordpress Rest API helper
*/

View File

@ -2,8 +2,8 @@
/**
* @file zabbix.api.php
* @created_on 2019-04-08
* @updated_on 2020-02-05
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated_on 2020-03-05
* @author Go Namhyeon <abuse@catswords.net>
* @brief Zabbix JSON-RPC API (3.0) interface module
* @documentation https://www.zabbix.com/documentation/current/ (4.4)
*/
@ -58,29 +58,57 @@ if(!is_fn("zabbix_authenticate")) {
}
// set connection to global scope
set_scope("zabbix_api_url", $zabbix_api_url);
set_scope("zabbix_auth", get_property_value("result", $response));
set_shared_var("zabbix_api_url", $zabbix_api_url);
set_shared_var("zabbix_auth", get_property_value("result", $response));
return $response;
}
}
if(!is_fn("zabbix_get_hostgroups")) {
function zabbix_get_hostgroups() {
$hostgroups = false;
$response = false;
// get zabbix authentication
$zabbix_api_url = get_shared_var("zabbix_api_url");
$zabbix_auth = get_shared_var("zabbix_auth");
// connect to zabbix server
if(loadHelper("webpagetool")) {
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
"method" => "hostgroup.get",
"params" => array(
"output" => "extend"
),
"id" => zabbix_get_id(),
"auth" => $zabbix_auth
));
$hostgroups = get_property_value("result", $response);
}
return $hostgroups;
}
}
if(!is_fn("zabbix_get_hosts")) {
function zabbix_get_hosts() {
$hosts = false;
$response = false;
// get zabbix authentication
$zabbix_api_url = get_scope("zabbix_api_url");
$zabbix_auth = get_scope("zabbix_auth");
$zabbix_api_url = get_shared_var("zabbix_api_url");
$zabbix_auth = get_shared_var("zabbix_auth");
// connect to zabbix server
if(loadHelper("webpagetool")) {
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
"method" => "host.get",
"params" => array(
"output" => array("hostid", "host"),
"output" => array("hostid", "host", "status"),
"selectInterfaces" => array("interfaceid", "ip"),
"selectGroups" => "extend"
),
"id" => zabbix_get_id(),
"auth" => $zabbix_auth
@ -106,8 +134,8 @@ if(!is_fn("zabbix_get_items")) {
$response = false;
// get zabbix authentication
$zabbix_api_url = get_scope("zabbix_api_url");
$zabbix_auth = get_scope("zabbix_auth");
$zabbix_api_url = get_shared_var("zabbix_api_url");
$zabbix_auth = get_shared_var("zabbix_auth");
// connect to zabbix server
if(loadHelper("webpagetool")) {
@ -141,8 +169,8 @@ if(!is_fn("zabbix_get_problems")) {
$response = false;
// get zabbix authentication
$zabbix_api_url = get_scope("zabbix_api_url");
$zabbix_auth = get_scope("zabbix_auth");
$zabbix_api_url = get_shared_var("zabbix_api_url");
$zabbix_auth = get_shared_var("zabbix_auth");
// connect to zabbix server
if(loadHelper("webpagetool")) {
@ -178,8 +206,8 @@ if(!is_fn("zabbix_get_triggers")) {
$response = false;
// get zabbix authentication
$zabbix_api_url = get_scope("zabbix_api_url");
$zabbix_auth = get_scope("zabbix_auth");
$zabbix_api_url = get_shared_var("zabbix_api_url");
$zabbix_auth = get_shared_var("zabbix_auth");
if(loadHelper("webpagetool")) {
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
@ -209,8 +237,8 @@ if(!is_fn("zabbix_get_alerts")) {
$response = false;
// get zabbix authentication
$zabbix_api_url = get_scope("zabbix_api_url");
$zabbix_auth = get_scope("zabbix_auth");
$zabbix_api_url = get_shared_var("zabbix_api_url");
$zabbix_auth = get_shared_var("zabbix_auth");
if(loadHelper("webpagetool")) {
$params = array(
@ -258,8 +286,8 @@ if(!is_fn("zabbix_get_records")) {
}
// get zabbix authentication
$zabbix_api_url = get_scope("zabbix_api_url");
$zabbix_auth = get_scope("zabbix_auth");
$zabbix_api_url = get_shared_var("zabbix_api_url");
$zabbix_auth = get_shared_var("zabbix_auth");
// set time range variables
$time_from = get_current_timestamp(array("now" => $now_dt, "adjust" => $adjust));

View File

@ -2,7 +2,7 @@
/**
* @file zeroboard4.dbt.php
* @date 2018-08-20
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Database Helper for Zeroboard 4 PL 9 (experimental)
*/

View File

@ -2,9 +2,9 @@
/**
* @file index.php
* @created_on 2018-05-27
* @updated_on 2020-01-17
* @author Go Namhyeon <gnh1201@gmail.com>
* @brief ReasonableFramework
* @updated_on 2020-06-14
* @author Go Namhyeon <abuse@catswords.net>
* @brief ReasonableFramework is RVHM structured PHP framework with common security
* @cvs https://github.com/gnh1201/reasonableframework
* @sponsor https://patreon.com/catswords (with advanced security)
*/
@ -84,34 +84,35 @@ foreach($load_systems as $system_name) {
// get config
$config = get_config();
// get requests
$requests = get_requests();
// set shared vars
set_shared_var("dbc", get_db_connect());
// get PID(Process ID)
set_shared_var("mypid", getmypid());
// set database connection
// variable _unset_dbc: will not connect to database
$_unset_dbc = get_requested_value("_unset_dbc");
if(empty($_unset_dbc)) {
set_shared_var("dbc", get_db_connect());
}
// set max_execution_time
$max_execution_time = get_value_in_array("max_execution_time", $config, 0);
@ini_set("max_execution_time", $max_execution_time);
//@set_time_limit($max_execution_time);
$max_execution_time = get_value_in_array("max_execution_time", $config, -1);
set_max_execution_time($max_execution_time);
// set memory limit
$memory_limit = get_value_in_array("memory_limit", $config, 0);
if(!empty($memory_limit)) {
@ini_set("memory_limit", $memory_limit);
@ini_set("suhosin.memory_limit", $memory_limit);
}
$memory_limit = get_value_in_array("memory_limit", $config, -1);
set_memory_limit($memory_limit);
// set upload max filesize
$upload_max_filesize = get_value_in_array("upload_max_filesize", $config, 0);
if(!empty($upload_max_filesize)) {
@ini_set("upload_max_filesize", $upload_max_filesize);
}
$upload_max_filesize = get_value_in_array("upload_max_filesize", $config, -1);
set_upload_max_filesize($upload_max_filesize);
// set post max size
$post_max_size = get_value_in_array("post_max_size", $config, 0);
if(!empty($post_max_size)) {
@ini_set("post_max_size", $post_max_size);
}
$post_max_size = get_value_in_array("post_max_size", $config, -1);
set_post_max_size($post_max_size);
// start session
start_isolated_session();
@ -126,7 +127,8 @@ $default_timezone = get_value_in_array("timezone", $config, "UTC");
date_default_timezone_set($default_timezone);
// write visit log
write_visit_log();
$log_mode_visit = get_value_in_array("log_mode_visit", $config, "");
write_visit_log($log_mode_visit);
// get requested route
$route = read_route();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -2,7 +2,7 @@
/**
* @file api.getorder.pgkcp.php
* @date 2018-09-24
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) get completed order
*/

View File

@ -2,7 +2,7 @@
/**
* @file api.gnuboard.php
* @date 2018-05-31
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Integration controller for Gnuboard CMS 4.x, 5.x
*/

View File

@ -2,7 +2,7 @@
/**
* @file api.mailgun.php
* @date 2019-04-15
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Mailgun API controller
*/

View File

@ -2,7 +2,7 @@
/**
* @file api.setconfig.pgkcp.php
* @date 2018-09-30
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) set configuration API
*/

View File

@ -2,7 +2,7 @@
/**
* @file api.social.php
* @date 2018-09-26
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief SocialTools API (refactoring from SocioRouter API)
*/

View File

@ -2,7 +2,7 @@
/**
* @file api.twilio.php
* @date 2019-04-15
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Twilio API controller (or domestic API)
*/

View File

@ -2,7 +2,7 @@
/**
* @file api.uuid.php
* @date 2018-08-19
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief UUID Generator API
*/

View File

@ -2,7 +2,7 @@
/**
* @file api.zabbix.php
* @date 2019-04-15
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Zabbix API
*/

View File

@ -2,7 +2,7 @@
/**
* @file mobileswitcher.php
* @date 2019-04-29
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief mobile device switcher
*/

View File

@ -3,7 +3,7 @@
* @file ordercomplete.pgkcp.php
* @created_on 2018-09-03
* @updated_on 2020-01-25
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) contoller when completed
*/

View File

@ -2,7 +2,7 @@
/**
* @file orderform.php
* @date 2018-09-03
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief order form
*/

View File

@ -3,7 +3,7 @@
* @file orderpay.pgkcp.php
* @date 2018-08-25
* @updated 2019-10-14
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) Controller
*/

View File

@ -3,7 +3,7 @@
* @file orderpay.step2.pgkcp.php
* @created_on 2018-08-27
* @updated_on 2020-01-25
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) contoller when done
*/

View File

@ -2,7 +2,7 @@
/**
* @file orderpay.step3.pgkcp.php
* @date 2018-08-27
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) contoller when done
*/

View File

@ -3,7 +3,7 @@ if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
$data = array(
"name" => "Hong gil dong",
"email" => "support@exts.kr",
"email" => "abuse@catswords.net",
"tel" => ""01000000000",
"base_url" => base_url()
);

View File

@ -2,7 +2,7 @@
/**
* @file webapp.php
* @date 2019-02-23
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Isolator(Compatibility mode) for legacy application
*/

View File

@ -0,0 +1,5 @@
<?php
return <<<EOF
[deprecated]
deprecated_fn=check_invalid_function,check_function_exists,array_multikey_empty,split_by_line,startsWith,endsWith
EOF;

View File

@ -0,0 +1,6 @@
<?php
return <<<EOF
[l10n]
l10n_enabled=0
l10n_default_language=ko
EOF;

View File

@ -1,7 +1,9 @@
<?php
return <<<EOF
[log]
[logger]
rfc3164_enabled=0
rfc3164_host=logs6.papertrailapp.com
rfc3164_port=42986
log_rotate_size=104857600
log_rotate_ratio=0.9
EOF;

View File

@ -9,5 +9,7 @@ adjectives=warty,hoary,breezy,dapper,edgy,feisty,gutsy,hardy,intrepid,jaunty,kar
animals=warthog,hedgehog,badger,drake,eft,fawn,gibbon,heron,ibex,jackalope,koala,lynx,meerkat,narwhal,ocelot,pangolin,quetzal,ringtail,salamander,tahr,unicorn,vervet,werewolf,xerus,yak,zapus
https=auto
hashalgos=md5,sha1,crypt,crc32,base64,sql_password
sandboxdisabled=0
sandboxdisabled=1
allowextensionsdisabled=1
allowextensions=png,gif,jpg,jpeg,tif,xls,ppt,doc,xlsx,pptx,docx,odt,odp,ods,xlsm,tiff,pdf,xlsm,mp3,ogg,m4a,wma,wav
EOF;

View File

@ -5,6 +5,9 @@ max_execution_time=0
memory_limit=0
upload_max_filesize=0
post_max_size=0
min_cpu_idle=0
cpu_sleep_time=3
cpu_num_cores=1
session_dir=session
enable_autoload=0
default_route=welcome

View File

@ -1,5 +1,8 @@
<?php
return <<<EOF
[uri]
base_url = /
base_route =
base_url =
base_cdn_url =
base_vod_url =
EOF;

View File

@ -3,7 +3,7 @@
* @file base.php
* @created_on 2018-04-13
* @updated_on 2020-02-10
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Base module
*/
@ -34,6 +34,32 @@ if(!(is_not_fn("is_fn") < 0)) {
}
}
if(!is_fn("is_deprecated_fn")) {
function is_deprecated_fn($fn) {
$flag = false;
$config = get_config();
$deprecated_fn = get_value_in_array("deprecated_fn", $config, array());
$deprecated_fn_list = explode(",", $deprecated_fn);
if(is_array($fn)) {
foreach($fn as $k=>$v) {
if(in_array($v, $deprecated_fn_list)) {
$flag = true;
write_common_log(sprintf("Deprecated: %s()", $v), "system/base");
}
}
} else {
if(in_array($fn, $deprecated_fn_list)) {
$flag = true;
write_common_log(sprintf("Deprecated: %s()", $fn), "system/base");
}
}
return $flag;
}
}
// set_shared_var: void
if(!is_fn("set_shared_var")) {
function set_shared_var($k, $v) {
@ -232,6 +258,15 @@ if(!is_fn("array_key_is_array")) {
}
}
// example: array_key_unset(array_search("apple", $fruits), $fruits);
if(!is_fn("array_key_unset")) {
function array_key_unset($key, &$array) {
if(array_key_exists($key, $array)) {
unset($array[$key]);
}
}
}
if(!is_fn("array_keys_empty")) {
function array_keys_empty($keys, $array) {
$flag = false;
@ -289,6 +324,12 @@ if(!is_fn("check_is_empty")) {
}
}
if(!is_fn("get_key_in_array")) {
function get_key_in_array($val, $arr) {
return array_search($val, $arr);
}
}
// error handler (set error)
if(!is_fn("set_error")) {
function set_error($msg, $code="ERROR") {

View File

@ -2,22 +2,22 @@
/**
* @file config.php
* @date 2018-04-13
* @updated 2019-10-13
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated 2020-03-25
* @author Go Namhyeon <abuse@catswords.net>
* @brief Configuration module
*/
if(!is_fn("read_config")) {
function read_config() {
$config = array();
$is_legacy_version = version_compare(phpversion(), "5.3.0", "<");
$is_compatible = version_compare(phpversion(), "5.3.0", "<");
$files = retrieve_storage_dir("config");
foreach($files as $file) {
$ini = array();
// `parse_ini_string` function is not supported under 5.3.0. Use only 'ini' file
if(!$is_legacy_version && check_file_extension($file, "ini.php", array("multiple" => true))) {
if(!$is_compatible && check_file_extension($file, "ini.php", array("multiple" => true))) {
$str = include($file);
$ini = parse_ini_string($str);
} elseif(check_file_extension($file, "ini")) {
@ -94,7 +94,7 @@ if(!is_fn("get_current_timestamp")) {
$units = array(
"s" => array( 1, "second", "seconds"),
"m" => array( 60, "minute", "minutes"),
"h" => array( 120, "hour", "hours" ),
"h" => array( 3600, "hour", "hours" ),
"d" => array(86400, "day", "days" )
);
$_L = intval(substr($adjust, 0, -1));
@ -116,6 +116,21 @@ if(!is_fn("get_current_timestamp")) {
}
}
if(!is_fn("get_seconds")) {
function get_seconds($interval) {
$time = 0;
$_U = array("s" => 1, "m" => 60, "h" => 3600, "d" => 86400);
$_L = intval(substr($interval, 0, -1));
$_R = substr($interval, -1);
if(array_key_exists($_R, $_U)) {
$time = $_L * $_U[$_R];
}
return $time;
}
}
if(!is_fn("get_current_datetime")) {
function get_current_datetime($options=array()) {
$config = get_config();
@ -142,3 +157,37 @@ if(!is_fn("get_old_version")) {
return get_value_in_array("old_version", $config, 0);
}
}
if(!is_fn("set_max_execution_time")) {
function set_max_execution_time($time) {
if($time > -1) {
@ini_set("max_execution_time", $time);
@set_time_limit($time);
}
}
}
if(!is_fn("set_memory_limit")) {
function set_memory_limit($limit) {
if($limit > -1) {
@ini_set("memory_limit", $limit);
@ini_set("suhosin.memory_limit", $limit);
}
}
}
if(!is_fn("set_upload_max_filesize")) {
function set_upload_max_filesize($size) {
if($size > -1) {
@ini_set("upload_max_filesize", $size);
}
}
}
if(!is_fn("set_post_max_size")) {
function set_post_max_size($size) {
if($size > -1) {
@ini_set("post_max_size", $size);
}
}
}

View File

@ -2,8 +2,8 @@
/**
* @file database.php
* @created_on 2018-04-13
* @updated_on 2020-02-17
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated_on 2020-04-16
* @author Go Namhyeon <abuse@catswords.net>
* @brief Database module
*/
@ -132,7 +132,7 @@ if(!is_fn("get_db_last_id")) {
if(in_array($db_driver, array("mysql", "mysql.pdo"))) {
$last_id = $dbc->lastInsertId();
} elseif(loadHelper("database.dbt")) {
} elseif(loadHelper("database.alt")) {
$last_id = call_user_func("get_db_alt_last_id", $db_driver);
}
@ -285,9 +285,10 @@ if(!is_fn("get_bind_to_sql_insert")) {
// get not duplicatable fieldnames
$setkeys = get_array(get_value_in_array("setkeys", $options, false));
$setfixeds = get_array(get_value_in_array("setfixeds", $options, false));
$setignores = get_array(get_value_in_array("setignores", $options, false));
$setwheres = get_array(get_value_in_array("setwheres", $options, false));
// safemode_off (default: false)
$safemode_off = array_key_equals("safemode_off", $options, true);
@ -302,10 +303,12 @@ if(!is_fn("get_bind_to_sql_insert")) {
$_bind_K = array();
$_bind_V = array();
foreach($bind as $k=>$v) {
if(in_array($k, $setkeys)) {
$_bind_K[$k] = $v;
} else {
$_bind_V[$k] = $v;
if(!in_array($k, $setfixeds)) {
if(in_array($k, $setkeys)) {
$_bind_K[$k] = $v;
} else {
$_bind_V[$k] = $v;
}
}
}
$_options = array(
@ -318,11 +321,13 @@ if(!is_fn("get_bind_to_sql_insert")) {
}
}
// preventing accidentally query
$num_conditions = sum($num_keys, $num_wheres);
if($num_conditions == 0 && $safemode_off !== true) {
write_common_log("Blocked accidentally query. Set safemode_off to TRUE if you want disable", "system/database");
return false;
// preventing incident query
if($num_duplicates > 0) {
$num_conditions = array_sum(array($num_keys, $num_wheres));
if($num_conditions == 0 && $safemode_off !== true) {
write_common_log("this is suspicious incident query. blocked. (safemode=1)", "system/database");
return false;
}
}
// check ignores
@ -363,7 +368,7 @@ if(!is_fn("exec_db_bulk_start")) {
function exec_db_bulk_start() {
$bulkid = make_random_id();
set_shared_var("bulk_" . $bulkid, array());
//write_common_log("bulk started: " . $bulkid);
//write_common_log("bulk started: " . $bulkid, "system/database");
return $bulkid;
}
}
@ -373,13 +378,19 @@ if(!is_fn("exec_db_bulk_push")) {
$rows = get_shared_var("bulk_" . $bulkid);
$rows[] = $bind;
set_shared_var("bulk_" . $bulkid, $rows);
//write_common_log("bulk pushed: " . $bulkid . " / " . count($rows));
//write_common_log("bulk pushed: " . $bulkid . " / " . count($rows), "system/database");
}
}
if(!is_fn("exec_db_bulk_end")) {
function exec_db_bulk_end($bulkid, $tablename, $bindkeys) {
$result = false;
$rows = get_shared_var("bulk_" . $bulkid);
if(count($rows) == 0) {
write_common_log("bulk ended: empty", "system/database");
return;
}
$sql = "insert into `%s` (%s) values (%s)";
$s1 = $tablename;
@ -392,10 +403,11 @@ if(!is_fn("exec_db_bulk_end")) {
$s3 = implode("), (", $s3a);
$sql = sprintf($sql, $s1, $s2, $s3);
$result = exec_db_query($sql);
//write_common_log("bulk ended: " . $sql);
write_common_log("bulk ended: " . substr($sql, 0, 200) . "...", "system/database");
return exec_db_query($sql);
return $result;
}
}
@ -428,8 +440,15 @@ if(!is_fn("get_bind_to_sql_where")) {
$s1a = get_bind_to_sql_fields($setfields);
}
if(!array_keys_empty(array("settimefield", "setminutes"), $options)) {
$s3 .= get_bind_to_sql_past_minutes($options['settimefield'], $options['setminutes']);
// set time range
if(!array_key_empty("settimefield", $options)) {
if(!array_key_empty("setpast", $options)) {
$s3 .= get_bind_to_sql_past($options['settimefield'], $options['setpast']);
}
if(!array_key_empty("setlast", $options)) {
$s3 .= get_bind_to_sql_last($options['settimefield'], $options['setlast']);
}
}
if(!array_key_empty("setwheres", $options)) {
@ -487,6 +506,14 @@ if(!is_fn("get_bind_to_sql_where")) {
}
$s3 .= sprintf(" %s (%s)", $opts[0], implode(" and ", $s3a));
}
} elseif($opts[1][0] == "inset") {
if(check_array_length($opts[1][2], 0) > 0) {
$s3a = array();
foreach($opts[1][2] as $word) {
$s3a[] = sprintf("find_in_set('%s', %s)", $word, $opts[1][1]);
}
$s3 .= sprintf(" %s (%s)", $opts[0], implode(" or ", $s3a));
}
} elseif($opts[1][0] == "interval") {
$s3u = array("s" => 1, "m" => 60, "h" => 120, "d" => 86400);
// todo
@ -595,7 +622,7 @@ if(!is_fn("get_db_tablenames")) {
if(!is_fn("get_bind_to_sql_fields")) {
function get_bind_to_sql_fields($fields) {
$s1a = array()
$s1a = array();
foreach($setfields as $k=>$v) {
// add
@ -664,6 +691,22 @@ if(!is_fn("get_bind_to_sql_select")) {
function get_bind_to_sql_select($tablename, $bind=array(), $options=array()) {
$sql = "select %s from `%s` where %s %s %s";
// setcreatedtime: range of table creation time
$created_start_dt = "";
$created_end_dt = "";
if(!array_key_empty("setcreatedtime", $options)) {
if(is_string($options['setcreatedtime'])) {
$created_end_dt = $options['setcreatedtime'];
} elseif(is_array($options['setcreatedtime'])) {
if(array_key_exists("end", $options['setcreatedtime'])) {
$created_end_dt = $options['setcreatedtime']['end'];
}
if(array_key_exists("start", $options['setcreatedtime'])) {
$created_start_dt = $options['setcreatedtime']['start'];
}
}
}
// is_separated: check it is seperated table
$is_separated = check_table_is_separated($tablename);
@ -734,7 +777,7 @@ if(!is_fn("get_bind_to_sql_select")) {
$sql = sprintf($sql, $s1, $s2, $s3, $s4, $s5);
} else {
$separated_sqls = array();
$tablenames = get_db_tablenames($tablename);
$tablenames = get_db_tablenames($tablename, $created_end_dt, $created_start_dt);
foreach($tablenames as $_tablename) {
$separated_sqls[] = sprintf($sql, $s1, $_tablename, $s3, $s4, $s5);
}
@ -811,13 +854,29 @@ if(!is_fn("get_bind_to_sql_delete")) {
}
}
if(!is_fn("get_bind_to_sql_past_minutes")) {
function get_bind_to_sql_past_minutes($fieldname, $minutes=5) {
$sql_past_minutes = "";
if($minutes > 0) {
$sql_past_minutes = sprintf(" and %s > DATE_SUB(now(), INTERVAL %d MINUTE)", $fieldname, $minutes);
if(!is_fn("get_bind_to_sql_past")) {
function get_bind_to_sql_past($fieldname, $interval) {
$sql_past = "";
$time = get_seconds($interval);
if($time > 0) {
$sql_past = sprintf(" and `%s` < DATE_SUB(NOW(), INTERVAL %d SECOND)", $fieldname, $time);
}
return $sql_past_minutes;
return $sql_past;
}
}
if(!is_fn("get_bind_to_sql_last")) {
function get_bind_to_sql_last($fieldname, $interval) {
$sql_last = "";
$time = get_seconds($interval);
if($time > 0) {
$sql_last = sprintf(" and `%s` >= DATE_SUB(NOW(), INTERVAL %d SECOND)", $fieldname, $time);
}
return $sql_last;
}
}
@ -844,11 +903,11 @@ if(!is_fn("sql_query")) {
}
// get timediff
if(!is_fn("get_timediff_on_query")) {
function get_timediff_on_query($a, $b) {
if(!is_fn("get_db_timediff")) {
function get_db_timediff($a, $b) {
$dt = 0;
$sql = "select timediff(:a, :b) as dt";
$sql = "select time_to_sec(timediff(:a, :b)) as dt";
$bind = array(
"a" => $a,
"b" => $b
@ -912,13 +971,33 @@ if(!is_fn("exec_db_table_create")) {
$_tablename_p = sprintf("%s%s", $_prefix, $tablename);
$_tablename_s = sprintf("%s%s", $tablename, $_suffix);
$_tablename_t = sprintf("%s.tables", $_tablename_p);
// get global configuration
$config = get_config();
// get index options
$config = get_config();
$setindex = get_value_in_array("setindex", $options, false);
$setunique = get_value_in_array("setunique", $options, false);
$setfulltext = get_value_in_array("setfulltext", $options, false);
$setspatial = get_value_in_array("setspatial", $options, false);
// get event options
$settimefield = get_value_in_array("settimefield", $options, false);
$setexpire = get_value_in_array("setexpire", $options, false);
// check before options
$before = get_value_in_array("before", $options, false);
if(is_array($before)) {
foreach($before as $v) {
if($v == "truncate") {
$sql = sprintf("truncate `%`", $_tablename);
exec_db_query($sql);
} elseif($v == "auto_increment_1") {
$sql = sprintf("alter table `%s` AUTO_INCREMENT = 1", $_tablename);
exec_db_query($sql);
}
}
}
// check if exists table
$bind = array(
@ -988,6 +1067,49 @@ if(!is_fn("exec_db_table_create")) {
$sql = sprintf("create spatial index `%s` on `%s` (%s)", $k, $_tablename, implode(", ", $v));
exec_db_query($sql);
}
// set expire time
if(!empty($setexpire)) {
$_eventname = sprintf("scheduled_%s", make_random_id());
$_seconds = get_seconds($setexpire);
$_query = get_bind_to_sql_delete($_tablename, $bind, array(
"settimefield" => $settimefield,
"setpast" => $_seconds
));
$sql = sprintf("CREATE EVENT `%s` ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL %s SECOND DO %s", $_eventname, $_seconds, $_query);
exec_db_query($sql);
}
foreach($setevent as $event) {
if(check_array_length($event, 3) == 0) {
$mode = $event[0];
$interval = $event[1];
$query = "";
// _arg3: bind(array) or query(string)
$_arg3 = $event[2];
if(is_array($_arg3)) {
if($mode == "expire") {
$bind = $_arg3;
$query = get_bind_to_sql_delete($_tablename, $bind, array(
"settimefield" => $settimefield,
"setpast" => $interval
));
}
} else {
if($mode == "query") {
$query = $_arg3;
}
}
if(!empty($query)) {
$sql = sprintf("create event `scheduled_%s` on schedule at CURRENT_TIMESTAMP + INTERVAL %s MINUTES DO (%s)", make_random_id(), $interval, $query);
exec_db_query($sql);
}
}
}
}
return $_tablename;

View File

@ -2,38 +2,79 @@
/**
* @file logger.php
* @created_on 2018-05-27
* @updated_on 2020-01-23
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated_on 2020-06-21
* @author Go Namhyeon <abuse@catswords.net>
* @brief Logger module for ReasonableFramework
*/
if(!is_fn("append_log_to_file")) {
function append_log_to_file($data, $filename) {
$config = get_config();
$rotate_size = get_value_in_array("log_rotate_size", $config, 0);
$rotate_ratio = get_value_in_array("log_rotate_ratio", $config, 0.9);
return append_storage_file($data, array(
"storage_type" => "logs",
"filename" => $filename,
"chmod" => 0644,
"nl" => "<",
"rotate_size" => $rotate_size,
"rotate_ratio" => $rotate_ratio,
));
}
}
if(!is_fn("write_visit_log")) {
function write_visit_log() {
function write_visit_log($mode="") {
$fw = false;
$data = "";
$nevt = false;
if(loadHelper("networktool")) {
$nevt = get_network_event();
if(loadHelper("catsplit.format")) {
$data = catsplit_encode($nevt);
} else {
$data = json_encode($nevt);
}
$fw = append_log_to_file($data, "network.log");
}
if($nevt === false) return $fw;
if($mode == "database") {
$tablename = exec_db_table_create(array(
"datetime" => array("datetime"),
"server" => array("varchar", 255),
"hostname" => array("varchar", 255),
"client" => array("varchar", 255),
"agent" => array("text"),
"referrer" => array("text"),
"self" => array("varchar", 255),
"method" => array("varchar", 255)
), "rsf_visit_log", array(
"setindex" => array(
"index_1" => array("datetime"),
"index_2" => array("client")
)
));
$bind = array(
"datetime" => $nevt['datetime'],
"server" => $nevt['server'],
"hostname" => $nevt['hostname'],
"client" => $nevt['client'],
"agent" => $nevt['agent'],
"referrer" => $nevt['referrer'],
"self" => $nevt['self'],
"method" => $nevt['method']
);
$sql = get_bind_to_sql_insert($tablename, $bind);
exec_db_query($sql, $bind);
} else {
$line = "";
if(loadHelper("catsplit.format")) {
$line = catsplit_encode($nevt);
} else {
$line = json_encode($nevt);
}
$fw = append_log_to_file($line, "network.log");
}
return $fw;
}
}
@ -41,8 +82,9 @@ if(!is_fn("write_visit_log")) {
if(!is_fn("write_common_log")) {
function write_common_log($message, $component="None", $program="") {
$fw = false;
$data = implode("\t", array(get_current_datetime(), $component, $message));
$mypid = get_shared_var("mypid");
$data = implode("\t", array(get_current_datetime(), $mypid, $component, $message));
$fw = append_log_to_file($data, "common.log");
// if enabled RFC3164 remote debugging

View File

@ -3,7 +3,7 @@
* @file security.php
* @created_on 2018-05-27
* @updated_on 2020-02-04
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief Security module for ReasonableFramework
* @sponsor https://patreon.com/catswords (with advanced security)
*/
@ -702,3 +702,10 @@ if(!is_fn("expire_isolated_session")) {
session_destroy();
}
}
// Add support HmacSHA256 algorithm #137
if(!is_fn("hmacsha256_sign_message")) {
function hmacsha256_sign_message($message, $secret_key) {
return hash_hmac("sha256", $message, $secret_key);
}
}

View File

@ -2,8 +2,8 @@
/**
* @file storage.php
* @date 2018-05-27
* @updated 2019-10-13
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated 2020-06-16
* @author Go Namhyeon <abuse@catswords.net>
* @brief Stroage module for ReasonableFramework
*/
@ -28,14 +28,13 @@ if(!is_fn("get_current_working_dir")) {
break;
case "windows":
if(loadHelper("exectool")) {
$exec_contents = implode("\r\n", array("@echo off", "SET var=%cd%", "ECHO %var%"));
$exec_contents = implode("\r\n", array("@echo off", "ECHO %cd%"));
$exec_file = write_storage_file($exec_contents, array(
"filename" => "pwd.bat"
));
$working_dir = exec_command($exec_file);
}
break;
}
return $working_dir;
@ -56,11 +55,11 @@ if(!is_fn("get_safe_path")) {
if(!is_fn("get_storage_path")) {
function get_storage_path($type="data") {
$dir_path = sprintf("./%s/%s", get_storage_dir(), get_safe_path($type));
$dir_path = sprintf("%s/%s/%s", get_current_working_dir(), get_storage_dir(), get_safe_path($type));
if(!is_dir($dir_path)) {
if(!@mkdir($dir_path, 0777)) {
set_error("can not create directory. " . $dir_path);
set_error("Could not create directory. " . $dir_path);
show_errors();
}
}
@ -70,40 +69,29 @@ if(!is_fn("get_storage_path")) {
if(!is_fn("get_storage_url")) {
function get_storage_url($type="data") {
return sprintf("%s%s/%s", base_url(), get_storage_dir(), get_safe_path($type));
return sprintf("%s/%s/%s", base_url(), get_storage_dir(), get_safe_path($type));
}
}
if(!is_fn("move_uploaded_file_to_storage")) {
function move_uploaded_file_to_stroage($options=array()) {
if(!is_fn("allocate_uploaded_files")) {
function allocate_uploaded_files($options=array()) {
$response = array(
"files" => array()
);
$config = get_config();
$requests = get_requests();
$files = $requests['_FILES'];
$storage_type = get_value_in_array("storage_type", $options, "data");
$upload_base_path = get_storage_path($storage_type);
$upload_base_url = get_storage_url($storage_type);
$upload_allow_ext = array();
if(!array_key_empty("only_image", $options)) {
$upload_allow_ext = array(
"png", "gif", "jpg", "jpeg", "tif"
);
} elseif(!array_key_empty("only_docs", $options)) {
$upload_allow_ext = array(
"png", "gif", "jpg", "jpeg", "tif",
"xls", "ppt", "doc", "xlsx", "pptx",
"docx", "odt", "odp", "ods", "xlsm",
"tiff", "pdf", "xlsm"
);
} elseif(!array_key_empty("only_audio", $options)) {
$upload_allow_ext = array(
"mp3", "ogg", "m4a", "wma", "wav"
);
} else {
$upload_allow_ext = array();
// storage/config/security.ini -> allowextensionsdisabled, allowextensions
$allow_extensions_disabled = get_value_in_array("allowextensionsdisabled", $config, 0);
if(empty($allow_extensions_disabled)) {
$allow_extensions = get_value_in_array("allowextensions", $config, $upload_allow_ext);
}
foreach($files as $k=>$file) {
@ -345,6 +333,23 @@ if(!is_fn("write_storage_file")) {
if($mode == "fake") {
$result = $upload_filename;
} elseif($fhandle = fopen($upload_filename, $mode)) {
// if it is append, check the `rotate_size` option
if($mode == "a") {
$rotate_size = intval(get_value_in_array("rotate_size", $options, 0));
$rotate_ratio = floatval(get_value_in_array("rotate_ratio", $options, 0.9));
$size_limit = floor($rotate_size * $rotate_ratio);
if($rotate_size > 0) {
if($rotate_size > filesize($upload_filename)) {
if(loadHelper("exectool")) {
exec_command(sprintf("tail -c %s '%s' > '%s'", $size_limit, $upload_filename, $upload_filename));
} else {
write_common_log("failed load exectool helper", "system/storage");
}
}
}
}
// write a file
if(fwrite($fhandle, $data)) {
$result = $upload_filename;
if(!array_key_empty("chmod", $options)) {
@ -356,8 +361,8 @@ if(!is_fn("write_storage_file")) {
}
fclose($fhandle);
} else {
set_error("maybe, your storage is write-protected. " . $upload_filename);
show_errors();
write_common_log("maybe, your storage is write-protected. " . $upload_filename, "system/storage");
$result = false;
}
}

View File

@ -2,14 +2,27 @@
/**
* @file uri.php
* @created_on 2018-04-13
* @updated_on 2020-01-19
* @author Go Namhyeon <gnh1201@gmail.com>
* @updated_on 2024-04-29
* @author Go Namhyeon <abuse@catswords.net>
* @brief URI module
*/
if(!is_fn("base_url")) {
function base_url() {
return get_config_value("base_url");
$base_url = "";
// #133 Add support 'X-Forwarded-Host' header
$forwarded_host = get_header_value("X-Forwarded-Host");
if(!empty($forwarded_host)) {
$base_url = sprintf("https://%s", $forwarded_host);
} else {
$base_url = get_config_value("base_url");
if(empty($base_url)) {
$base_url = sprintf("https://%s", $_SERVER['HTTP_HOST']);
}
}
return $base_url;
}
}
@ -33,30 +46,41 @@ if(!is_fn("get_uri")) {
}
if(!is_fn("read_route")) {
function read_route($route=false) {
function read_route() {
$route = false;
$config = get_config();
$requests = get_requests();
// get base route
$base_route = get_value_in_array("base_route", $config, "/");
// get requested route
$route = get_requested_value("route");
// if empty route: URI Route
// get route in URI
if(empty($route)) {
if(loadHelper("networktool")) {
$nevt = get_network_event();
$d0 = explode(str_replace("index.php", "", $nevt['self']), $requests['_URI']);
$s0 = end($d0);
$d1 = explode("/", $s0);
$s1 = current($d1);
if(!empty($s1)) {
$route = $s1;
//$nevt = get_network_event(); // unused
$uri = $requests['_URI'];
if(strpos($uri, '?') !== false) {
$uri = substr($uri, 0, strpos($uri, '?'));
}
if(strpos($uri, $base_route) == 0) {
$_routes = explode("/", substr($uri, strlen($base_route)));
foreach($_routes as $_route) {
if($_route != "index.php") {
$route = $_route;
break;
}
}
}
}
}
// if empty route: default route
// default route: welcome
if(empty($route)) {
$route = get_value_in_array("default_route", $config, "welcome");
}
@ -88,8 +112,10 @@ if(!is_fn("read_requests")) {
"_RAW" => file_get_contents("php://input"),
"_JSON" => false,
"_SEAL" => false,
"_YAML" => false,
"_CSPT" => false,
"_SERVER" => array_map("make_safe_argument", get_array($_SERVER)),
"_HEADER" => getallheaders()
);
// check if json or serialized request
@ -105,7 +131,7 @@ if(!is_fn("read_requests")) {
}
}
// check if `JSONData` request (referenced from NHBank API competition)
// check if `JSONData` request (referenced from `2018 NHBank-KISA-TheLoop API competition`)
$jsondata = false;
if(!array_key_empty("JSONData", $requests['_ALL'])) {
$options['json'] = true;
@ -123,6 +149,13 @@ if(!is_fn("read_requests")) {
$requests['_SEAL'] = unserialize($requests['_RAW']);
}
// check if yaml request
if(array_key_equals("yaml", $options, true)) {
if(is_fn("yaml_parse")) {
$requests['_YAML'] = yaml_parse($requests['_RAW']);
}
}
// check if cspt(catsplit) request
if(array_key_equals("catsplit", $options, true)) {
if(loadHelper("catsplit.format")) {
@ -231,6 +264,30 @@ if(!is_fn("get_route_link")) {
}
}
// only for static resources (html, css, jpg, png, gif, ...)
if(!is_fn("get_cdn_link")) {
function get_cdn_link($uri) {
$config = get_config();
$base_url = get_value_in_array("base_url", $config, "");
$base_cdn_url = get_value_in_array("base_cdn_url", $config, $base_url);
return sprintf("%s%s", $base_cdn_url, $uri);
}
}
// only for video resources (avi, mp4, mpeg, ...)
if(!is_fn("get_vod_link")) {
function get_vod_link($uri) {
$config = get_config();
$base_url = get_value_in_array("base_url", $config, "");
$base_vod_url = get_value_in_array("base_vod_url", $config, $base_url);
return sprintf("%s%s", $base_vod_url, $uri);
}
}
// URI: Uniform Resource Identifier
// URL: Uniform Resource Locator
if(!is_fn("redirect_uri")) {
@ -241,8 +298,26 @@ if(!is_fn("redirect_uri")) {
show_errors();
}
}
if(array_key_equals("method", $options, "html")) {
echo <<<EOF
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="1;url=$uri">
<title>Redirect</title>
</head>
<body>
<a id="goto" href="$uri">Go to the page</a>
<script>window.onload = function() { document.getElementById("goto").click(); };</script>
</body>
</html>
EOF;
} else {
header("Location: " . $uri, true, $permanent ? 301 : 302);
}
header("Location: " . $uri, true, $permanent ? 301 : 302);
exit();
}
}
@ -283,17 +358,17 @@ if(!is_fn("get_requested_value")) {
}
}
if(is_string($value)) {
// security: set escape quotes
if($escape_quotes == true) {
$value = addslashes($value);
}
if(is_string($value)) {
// security: set escape quotes
if($escape_quotes == true) {
$value = addslashes($value);
}
// security: set escape tags
if($escape_tags == true) {
$value = htmlspecialchars($value);
}
}
// security: set escape tags
if($escape_tags == true) {
$value = htmlspecialchars($value);
}
}
return $value;
}
@ -362,6 +437,7 @@ if(!is_fn("set_header_content_type")) {
"json" => "application/json",
"xml" => "text/xml",
"txt" => "text/plain",
"yaml" => "application/x-yaml",
"html" => "text/html",
"xhtml" => "application/xhtml+xml",
"cspt" => "application/catsplit",
@ -370,13 +446,40 @@ if(!is_fn("set_header_content_type")) {
if(array_key_exists($type, $rules)) {
header(sprintf("Content-type: %s", $rules[$type]));
} else {
header("Content-type: plain/text");
header("Content-type: text/plain");
}
}
}
if(!is_fn("get_requested_jsondata")) {
function get_requested_jsondata($name, $escape_quotes=true, $escape_tags=false) {
return get_requested_jsondata($name, "_JSON", $escape_quotes, $escape_tags);
if(!is_fn("get_header_value")) {
function get_header_value($name) {
$value = false;
$requests = get_requests();
foreach ($requests['_HEADER'] as $k=>$v) {
if (strtolower($k) == strtolower($name)) {
$value = $v;
}
}
return $value;
}
}
if(!is_fn("test_user_agent")) {
function test_user_agent($ua, $tua) {
$result = false;
if (!empty($ua)) {
$words = explode(" ", str_replace("/", " ", $ua));
foreach($words as $word) {
if (in_array($word, $tua)) {
$result = true;
break;
}
}
}
return $result;
}
}

View File

@ -18,7 +18,7 @@
<div class="content">
<h2 id="default-form" class="content-subhead">결제 환불 문의</h2>
<p>결제 환불 관련 문의는 <code>support@exts.kr</code>으로 해주시기 바랍니다.</p>
<p>결제 환불 관련 문의는 <code>abuse@catswords.net</code>으로 해주시기 바랍니다.</p>
<form id="orderform" name="orderform" method="post" class="pure-form pure-form-aligned" action="<?php echo base_url(); ?>">
<fieldset>

View File

@ -2,7 +2,7 @@
/**
* @file view_orderpay.pgkcp.php
* @date 2018-08-25
* @author Go Namhyeon <gnh1201@gmail.com>
* @author Go Namhyeon <abuse@catswords.net>
* @brief KCP PG(Payment Gateway) View
*/

View File

@ -4,8 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to ReasonableFramework</title>
<link href="<?php echo base_url(); ?>vendor/_dist/min/entireframework.min.css" rel="stylesheet" type="text/css">
<link href="<?php echo base_url(); ?>vendor/_dist/min/welcome.css" rel="stylesheet" type="text/css">
<link href="<?php echo base_url(); ?>/vendor/_dist/min/entireframework.min.css" rel="stylesheet" type="text/css">
<link href="<?php echo base_url(); ?>/vendor/_dist/min/welcome.css" rel="stylesheet" type="text/css">
</head>
<body>
<nav class="nav" tabindex="-1" onclick="this.focus()">