Compare commits
785 Commits
Author | SHA1 | Date | |
---|---|---|---|
5bb162322c | |||
90404f225a | |||
cc589e846d | |||
d265428c6c | |||
e1f46ae830 | |||
1feb411bd6 | |||
4d4c0007ae | |||
58bd748595 | |||
53b5bb581c | |||
972dd24c2b | |||
9d97db2025 | |||
09f48b47a1 | |||
aa2bb12335 | |||
412607fd12 | |||
029067b632 | |||
fc44237b3e | |||
1828e58b8a | |||
a14a75265c | |||
b9e7548f78 | |||
e147898521 | |||
d4e50a358b | |||
1a69e04d8c | |||
7ea72da491 | |||
8b0f5408f6 | |||
0b784ff93f | |||
fac10baaee | |||
a0a5b1335c | |||
b977776afc | |||
b456c997da | |||
4b0e7aa33a | |||
3dcccb72e1 | |||
e9cc30e5a4 | |||
7382caa63d | |||
831650987c | |||
2405477555 | |||
730ec0b5a1 | |||
4e89184f21 | |||
70d7478d1c | |||
c327e6b0fa | |||
350130acbe | |||
920f271ee4 | |||
f0fcaaed24 | |||
536ba9e6b3 | |||
3cb8178a0d | |||
bf788db964 | |||
53618152e6 | |||
058449948f | |||
85ddf36fa8 | |||
161029471a | |||
3d602957d3 | |||
8045256d37 | |||
e3044d09b3 | |||
f2a4ec38f7 | |||
4cd4980ccc | |||
da907aa4c1 | |||
8a3c90d37c | |||
74363530ec | |||
450abe5d92 | |||
226f152a46 | |||
959a2b6d90 | |||
1a5a22eb88 | |||
4fef129951 | |||
14cd9a5153 | |||
177ddeef58 | |||
a0e3d27388 | |||
8d8a27cf41 | |||
de0f4289ba | |||
875d9b0af8 | |||
0c28b5b59f | |||
caa26cd1ea | |||
9174356265 | |||
ea7b0e82a5 | |||
f2f843e540 | |||
781c964c4c | |||
445e41a25f | |||
3e65438e3d | |||
372ae4ddcd | |||
52ccbd7663 | |||
e675be840b | |||
ea694b98a5 | |||
25fc749e27 | |||
1da455529b | |||
587850b61c | |||
2f680f0579 | |||
f7f2ca64d0 | |||
f0cf124dea | |||
17c59eba23 | |||
ef3907c5ce | |||
4be3e6b4fd | |||
718a1cfa00 | |||
0896073b9b | |||
1ee86700cd | |||
b859a236a8 | |||
c266f2ea45 | |||
f0b0103007 | |||
a5f6484843 | |||
203739dd43 | |||
17a602fdd1 | |||
fd6d94e5a6 | |||
83d5419e8e | |||
90d1057492 | |||
7fa3ef2a43 | |||
858d7d6353 | |||
c4e4d7b489 | |||
ceafd68894 | |||
189deae1cf | |||
db66198dee | |||
493d9f307a | |||
69a8c3605c | |||
1e376f52bb | |||
6e0bc5481f | |||
6ab48520ec | |||
ad8ccfe9cb | |||
d27ef05ea5 | |||
b36a87019a | |||
e490264725 | |||
43972172ff | |||
ed06978230 | |||
f35cdeb3a0 | |||
4dc7b9f6ad | |||
bf3ea2dbf4 | |||
3af1c8d5b8 | |||
6c24844935 | |||
3621d23a37 | |||
8905dde7fb | |||
36c0bf53f5 | |||
746e82f5a5 | |||
513f9a59f2 | |||
54fe0e3356 | |||
bee5ef35a5 | |||
7ff7010c34 | |||
67b6055196 | |||
b176d1efb4 | |||
cf24d39b9a | |||
40cdd0ddb9 | |||
e9395cca4d | |||
6669676bae | |||
2f2f2f3c1b | |||
8cf28c910b | |||
08a010599e | |||
8248ad2840 | |||
0ee85db921 | |||
b8829df18a | |||
f215034928 | |||
1d226d54d1 | |||
abe5fb0d0e | |||
64e7fd9765 | |||
3ecf6fa6bf | |||
fb1e4bf37a | |||
f9db90f031 | |||
d62e0859e4 | |||
f307fd50bc | |||
f6062d5c68 | |||
e524c1e199 | |||
ffba3b04cd | |||
eca23ede6e | |||
ed86e30fe2 | |||
72e9b51b8f | |||
f6c459d134 | |||
ed02dd066f | |||
d9802557a6 | |||
f2f1c4e458 | |||
410f3a6890 | |||
b667703092 | |||
4dacbbf332 | |||
201d3a4710 | |||
02f4051ef3 | |||
4f9ddb5634 | |||
32832519a1 | |||
290e26cb63 | |||
02955f0f43 | |||
c7ee370f4e | |||
d4cce046eb | |||
21a0fa9e1b | |||
2823d81758 | |||
6c3484e67f | |||
99d02b27b3 | |||
7cc52cd8e4 | |||
461f0f3e19 | |||
65135d36a3 | |||
2745ede24a | |||
033a36c4bf | |||
91ba9b4248 | |||
e881e4a002 | |||
f1c8e01b44 | |||
61d8069b76 | |||
512ee523d7 | |||
63316a7b8a | |||
aab22b89e1 | |||
094e5d2bd3 | |||
66735e0c59 | |||
adbaa6a7d9 | |||
189922a500 | |||
2a610015d6 | |||
ff448fb1ad | |||
7fb319ed75 | |||
b9f8b78cc4 | |||
6c54104977 | |||
75d4dfc18e | |||
102b5643cf | |||
dce66940fc | |||
ea44b3fa47 | |||
671b5b08e3 | |||
38805aaf65 | |||
f802210bd4 | |||
1165ee3b67 | |||
57b4a9cef1 | |||
c586ee2001 | |||
c38ea4bb68 | |||
eb5cebf360 | |||
0c56893b05 | |||
f42785d9b2 | |||
56ecbddbda | |||
d74eed052d | |||
5894116a74 | |||
fca583c683 | |||
fcf23af78d | |||
3ec8ab5db5 | |||
83a79e0693 | |||
5e4da8f2ca | |||
32210df8a5 | |||
beef878da9 | |||
bc4c34c1b4 | |||
309977c6cb | |||
c97400d7ce | |||
bd1b8bebac | |||
89596fe643 | |||
f8f0603df9 | |||
f6265108b2 | |||
bb1c3a1b59 | |||
b40c1e518a | |||
81b05fe550 | |||
80c0d01b81 | |||
8c93ea1629 | |||
7b6dde0460 | |||
5ce876afb2 | |||
a62297c82d | |||
41cf7bf2ff | |||
fcf186fe46 | |||
8cb6cf52d5 | |||
dbf6f31e98 | |||
71ae7f061c | |||
d1316a89bc | |||
cd3a446a54 | |||
a920baaa83 | |||
7c44bbb263 | |||
303118ad92 | |||
ed08db7c24 | |||
cc2773c2d2 | |||
5d5ecbe8a9 | |||
d7f21964b5 | |||
ee80807b5e | |||
6112a16718 | |||
bfa2fc4009 | |||
daa5299450 | |||
91d3a550fb | |||
8a2a3def51 | |||
a604fa9a8c | |||
b0a538459d | |||
a6976d1a56 | |||
adcfbd2e30 | |||
6ccdb2d1b5 | |||
d7031e7a21 | |||
3a19961640 | |||
3e19711ae0 | |||
b3d8f9bc36 | |||
42a7df1f5a | |||
3853cbd9e2 | |||
cd18ee6701 | |||
73bf61ccb1 | |||
eaa8085914 | |||
b99c86075c | |||
f6b3fd69c2 | |||
0eea52779f | |||
77c75931b8 | |||
2f7b0e058e | |||
1f730f59e7 | |||
d3ab19a83b | |||
11023c3cda | |||
491116531f | |||
afd3e5d566 | |||
44c025dc29 | |||
6b3d3ba169 | |||
ce9197822e | |||
608a859573 | |||
abeeee18a6 | |||
1460b0021e | |||
94e0aa6066 | |||
ce70a68884 | |||
06515408b2 | |||
016da48242 | |||
47e5d97de2 | |||
6f9d9185b0 | |||
b5033238f6 | |||
910674455f | |||
f54750dfea | |||
9233c87f1f | |||
252b063a1d | |||
792e1db128 | |||
150d360876 | |||
3f98e44f9c | |||
d1af92ab22 | |||
352a3ef234 | |||
efd11f28fb | |||
dc56f6b737 | |||
ae0e6f85db | |||
7eb03c4340 | |||
1dabd10883 | |||
03aaa13aca | |||
6e950c506b | |||
c2b9b431a0 | |||
a99d81acaf | |||
1be46fb794 | |||
0e1af27684 | |||
17303a5909 | |||
41b454fa0e | |||
e747bcc2d9 | |||
0b6b01b9ed | |||
cc79e17b93 | |||
b6f75980d2 | |||
042e6f4226 | |||
7e836f5615 | |||
e014326bc1 | |||
5bbd7b86f9 | |||
fa15d9f286 | |||
c09c7118a0 | |||
61e1f2f64e | |||
f951089db7 | |||
1471396934 | |||
82b3167779 | |||
793c238d97 | |||
0b47ec6447 | |||
279d449704 | |||
aec3f0d675 | |||
29198b0d5a | |||
8776048502 | |||
3bc800cbf5 | |||
be9843edd3 | |||
85f97b1c3a | |||
2c49d4d527 | |||
a7e5250ac0 | |||
530fcc216b | |||
61d88d74e7 | |||
8238963319 | |||
e10cad84c4 | |||
d1b9d1303a | |||
e1931d98ad | |||
fbe181e23b | |||
040d3f83b8 | |||
f056fbe0e1 | |||
cab2ea1004 | |||
ce7789b9e7 | |||
1c0b8f302c | |||
b503dd4ad8 | |||
39b2536a09 | |||
6c80d9e478 | |||
d91ae7cc04 | |||
4d51c91b22 | |||
c7b94a02f8 | |||
911395f8c7 | |||
7d405ad1d0 | |||
eff39f1243 | |||
5f89a419b1 | |||
2bfc07c58d | |||
298ad1adf0 | |||
abe6d97c54 | |||
974ae06b27 | |||
5104877c14 | |||
c5d6a3eabe | |||
d22d91057a | |||
bbe082c014 | |||
4bc40c1280 | |||
ab361bbca6 | |||
a59d46b286 | |||
c9e04bc690 | |||
a9eba5ac83 | |||
45e5f3fd4b | |||
551ca72065 | |||
168de14d6b | |||
c11f7eae2a | |||
c732eb299a | |||
b0a8460fb7 | |||
8b8b15b885 | |||
1db2e57e23 | |||
06a254cfdd | |||
e6fa1a7aef | |||
52ec156577 | |||
5aa38adce7 | |||
dcebd777af | |||
cee6509dfa | |||
339d10e94c | |||
03f28612a8 | |||
e51f00f7bc | |||
4eeff3100a | |||
9463cc91e4 | |||
4e38e01c0e | |||
dddccbc46d | |||
f5e399cb50 | |||
e06d9ada34 | |||
2a05f2dca9 | |||
f6edabc3cc | |||
93e8922c4c | |||
c8b0448d4b | |||
8734ccea00 | |||
f852f7f68c | |||
3b187f6cd4 | |||
f2c80e8e56 | |||
eb3b1e3606 | |||
e3aec9fbea | |||
364e3fcf65 | |||
6f4044fb72 | |||
8a052b52b3 | |||
5995640f1c | |||
cdf1d910a9 | |||
9508d3f2b7 | |||
c11f8d32ec | |||
575321ac10 | |||
49c2d31ccb | |||
06497b6c99 | |||
f73293c138 | |||
a4a555bcef | |||
0fb945fcde | |||
6fce47d9b6 | |||
ba31880a1f | |||
8c8edfe44e | |||
61d926bd68 | |||
d23f5dd3e6 | |||
c299218795 | |||
5a1b0f09b8 | |||
5eab10985e | |||
909ce7bf96 | |||
599b97c6f3 | |||
99284792a8 | |||
bcb5483bc6 | |||
538f189285 | |||
f1161d2744 | |||
1cd166b67b | |||
cd1daacebf | |||
8cd60d567f | |||
cfd1173178 | |||
dff6b47d25 | |||
98ddfa2401 | |||
242274b1b6 | |||
399b8e2638 | |||
22e13fe753 | |||
c30158ab1c | |||
04425ecd04 | |||
53954c3917 | |||
2c71f243e2 | |||
aaffec4006 | |||
07c362cb15 | |||
6713e2f654 | |||
fc9459f814 | |||
ad5b477cce | |||
2c51652c8b | |||
daca6e01fc | |||
2b4c6eda84 | |||
7fd4143c71 | |||
e7590171f3 | |||
ce7cc612ac | |||
f33bf7da19 | |||
36528fab7a | |||
e4d3eafb49 | |||
47372684a1 | |||
78f54a5dc2 | |||
1ee91a710c | |||
384ecc9ed4 | |||
2b9a3e7885 | |||
e2b9419499 | |||
156aa6ed6b | |||
38ca5cfa61 | |||
c3840a10de | |||
1584001aaf | |||
af00d15975 | |||
f986054aee | |||
61757a9ffe | |||
6d094abaae | |||
4b5e30dfc9 | |||
944b14662d | |||
b70dd192c3 | |||
29987d84ce | |||
92de2eb40e | |||
815d9488ff | |||
c446db7ebb | |||
5cf9234791 | |||
065f528a1f | |||
539cd7e521 | |||
8377fa6961 | |||
85927fec44 | |||
8675e50ba4 | |||
fb2f088402 | |||
9fb4ea7b13 | |||
a142488ccc | |||
d4ff2f3ed9 | |||
1de809b3bc | |||
a029d3baac | |||
ed624a586f | |||
1f6990a2fc | |||
853d0996dd | |||
140a20c13e | |||
66eebcf21c | |||
60227262ac | |||
50cc0d6207 | |||
ca4a0d7a37 | |||
f0a2e731c0 | |||
1d703439f2 | |||
fe33636194 | |||
cb3d85d11a | |||
b8dcb87e08 | |||
953ecdfa53 | |||
961d5f5ec2 | |||
732ae3901a | |||
ff5f097d77 | |||
7337955af3 | |||
349e2f19ae | |||
bf91280b50 | |||
2e7a18f10f | |||
cc8cf1b992 | |||
bb6fe3418d | |||
7ff38c9d1a | |||
7eddd7eccb | |||
941a2eacfc | |||
8b45ca2660 | |||
5ec1a640e8 | |||
9b27de8c45 | |||
2eae693cb1 | |||
08ccf30f8e | |||
65ba89198f | |||
3790b69a3e | |||
c58ad19dcc | |||
2db6118cbe | |||
05773071cb | |||
5d9f453a48 | |||
5e63ef5cda | |||
58cd93a93a | |||
b6ddcf38e7 | |||
a653aef496 | |||
5fcdfc0f03 | |||
8d2271109a | |||
f4f84f5f68 | |||
08a409324d | |||
a2b6bcdfa7 | |||
b3ae89c9fa | |||
406c4a958b | |||
33d72b07cb | |||
f882241bce | |||
e8c798235c | |||
be6d49897c | |||
eb4fbac464 | |||
f6d3f9a4ab | |||
76cc72d459 | |||
c508af96b3 | |||
ec310c1749 | |||
a4f5634b52 | |||
be72e12590 | |||
9c8afadab5 | |||
7632204dc1 | |||
fb68c2e7e1 | |||
0c1c203427 | |||
c1e0f92b91 | |||
d05d35c55e | |||
e3b6ceccc9 | |||
c7b17838c6 | |||
941e6569c5 | |||
d49894dd4f | |||
46c9d3d836 | |||
19aa62f289 | |||
03662ada43 | |||
3ae2693b99 | |||
d373691a25 | |||
7b71a3cccb | |||
8abc0be61b | |||
50d08956ec | |||
0b6bb751c3 | |||
c58c37f476 | |||
c73419b220 | |||
efaf4fc876 | |||
2751260700 | |||
ce9a66d60e | |||
ef7dd30233 | |||
cc606cf278 | |||
50d086de36 | |||
2731a3589f | |||
7cdc02e817 | |||
105dceae08 | |||
73f56ccc7d | |||
737afe81a3 | |||
b277db4493 | |||
f407444918 | |||
ef90fa3045 | |||
1ebba738d8 | |||
5b1a82f4b6 | |||
54bde739e6 | |||
105073e0ec | |||
36ce21f0b9 | |||
8198038055 | |||
60ca514d5a | |||
52e9012a14 | |||
b650be47fd | |||
fde620cecc | |||
0d1925f168 | |||
e9b0a21300 | |||
cdeaba3a6b | |||
d89d57eddd | |||
3fd7591968 | |||
d5318a298f | |||
a02efcd1dc | |||
0ecfe27a92 | |||
986801889e | |||
bbcc751464 | |||
0a8f5eec28 | |||
a4e8152d4c | |||
b8af7b66e7 | |||
d746bf15c6 | |||
05dee1b4b9 | |||
19164cf0cc | |||
ccdc8de9d3 | |||
f7e445991f | |||
1eb0b17ae7 | |||
ab018b8a70 | |||
74188463c3 | |||
5a2deb4142 | |||
4d4518457d | |||
d30e7b01ae | |||
ec582bc69c | |||
9b4341ae1e | |||
bc328dd978 | |||
1e59f624f0 | |||
c0d3d872b1 | |||
1ae319b6c1 | |||
a7140a1f0f | |||
a855a7dc0e | |||
f1ee9dfc54 | |||
2f4d02de1d | |||
a0f8c5aa79 | |||
6fa780dbcc | |||
7f8d897a0b | |||
b83382ceee | |||
e9a74c07d7 | |||
773c98b9a7 | |||
fb5a711b2e | |||
c655bb450e | |||
629ef90722 | |||
0ed4a5f425 | |||
25e40067fb | |||
bb09665916 | |||
d3e9af255b | |||
9cd61c21a9 | |||
8fa2039379 | |||
29794f103c | |||
60726530f3 | |||
997131e327 | |||
f1d50b8a51 | |||
bc5a359434 | |||
584dcbfa0a | |||
5dad30418f | |||
95be079e1c | |||
e7d34e597e | |||
c885d9e08b | |||
eadb4be415 | |||
f36b518758 | |||
6a6388fbd9 | |||
4ab4573230 | |||
b94d647e98 | |||
7c46532d7a | |||
91a8fd0c72 | |||
1d9e9553ae | |||
dd9aba4e01 | |||
1e3ea67b2b | |||
d0be44facc | |||
fb62d9f165 | |||
658e2b6a5e | |||
16b2bf2186 | |||
cb62eef752 | |||
2894386112 | |||
7e1a709b17 | |||
c58e382ad0 | |||
30bcee3e4a | |||
c413b84ce7 | |||
cefbd93e1f | |||
271d5a533c | |||
b0e46845ab | |||
a932e44eab | |||
7a1c66eba5 | |||
b5767cfad8 | |||
e60f487117 | |||
099f65e210 | |||
332d073b11 | |||
bc59c3bad7 | |||
b2041e776a | |||
fdbba15fbd | |||
5a80fad2c7 | |||
f63cfd3a4b | |||
06010e34b3 | |||
b4b6a62ee7 | |||
e46b0195c2 | |||
1ed4722894 | |||
31759a0ef8 | |||
b3a30ef34d | |||
efff663955 | |||
a2d25ee30d | |||
f3f696aa5e | |||
8eadbc8cb3 | |||
cd1ae416f8 | |||
9cb1bd6638 | |||
96874a7cae | |||
ecf6c9bca4 | |||
f440a95d92 | |||
0c1e2ee8f8 | |||
e7e0afd088 | |||
dc9673c6b4 | |||
09da36cf36 | |||
4512a7fdfc | |||
1bfedfb09b | |||
337a6fbf82 | |||
feb2a7d594 | |||
2ebf144992 | |||
040f4cba23 | |||
ebddf89ae3 | |||
51b17a3059 | |||
9c0e6d28e6 | |||
2aadb4cf0e | |||
588301c29f | |||
ffb635d499 | |||
ba21f4e5cf | |||
96eef131e1 | |||
9a52bd5071 | |||
9faebbc970 | |||
7275126cea | |||
e79e80646c | |||
5d28ffbddc | |||
3e64be4198 | |||
72ef267f2e | |||
6736697bcd | |||
f5d311fc36 | |||
813df6af57 | |||
fc901df6b7 | |||
f9f5587cfa | |||
7d86475948 | |||
2af7d7d745 | |||
45c3413d7b | |||
8ba364bd4d | |||
e51e06a9b4 | |||
0ea368e92e | |||
9ae6ab79e9 | |||
ef49d3e940 | |||
f0d7b5af80 | |||
57f0937590 | |||
4ee2a1128d | |||
5c3a5c8608 | |||
ab9e0ad798 | |||
6d5e8beada | |||
0bc123b387 | |||
2b78e5cb38 | |||
1925a391b8 | |||
923eb1e3cc | |||
fd9a18aa02 | |||
cfc9e185d6 | |||
2d820429c9 | |||
66c025d767 | |||
2e1d5fed16 | |||
f9ffa3b60d | |||
4e21f29e83 | |||
e96b77617d | |||
548d5f643e | |||
c7b89a5ace | |||
36d7628865 | |||
2cea5d54fa | |||
230600c87d | |||
c150666394 | |||
75e3402971 | |||
df9030cded | |||
d6b3b63264 | |||
190de76e2e | |||
6407555750 | |||
92f25e09dd | |||
d69e416f0e | |||
0c516f1dff | |||
b355e43cb6 | |||
284dd0b3c5 | |||
378f4e29f3 | |||
fa2a1743d6 | |||
f84f194709 | |||
61876c7566 | |||
1134d3f7a4 |
11
CITATION.cff
Normal file
11
CITATION.cff
Normal 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"
|
10
FUNDING.yml
10
FUNDING.yml
|
@ -1,8 +1,8 @@
|
||||||
# These are supported funding model platforms
|
# 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
|
patreon: catswords # Replace with a single Patreon username
|
||||||
open_collective: # Replace with a single Open Collective username
|
ko_fi: catswords
|
||||||
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
|
|
||||||
|
|
107
KOREAN.MD
107
KOREAN.MD
|
@ -1,55 +1,98 @@
|
||||||
## 기반 소프트웨어
|
# 본 웹 어플리케이션에 대하여
|
||||||
|
본 웹 어플리케이션은 ReasonableFramework 기반으로 작성됨. https://github.com/gnh1201/reasonableframework
|
||||||
본 웹 소프트웨어는 ReasonableFramework 기반으로 작성되었습니다.
|
|
||||||
|
|
||||||
https://github.com/gnh1201/reasonableframework
|
|
||||||
|
|
||||||
## 적재된 모듈 목록
|
## 적재된 모듈 목록
|
||||||
|
|
||||||
* System: base (시스템 기반)
|
* System: base (시스템 기반)
|
||||||
|
|
||||||
* System: config (시스템 설정)
|
* System: config (시스템 설정)
|
||||||
|
|
||||||
* System: database (데이터베이스)
|
* System: database (데이터베이스)
|
||||||
|
|
||||||
* System: logger (로그)
|
* System: logger (로그)
|
||||||
|
|
||||||
* System: uri (URI 및 URL 제어)
|
* System: uri (URI 및 URL 제어)
|
||||||
|
|
||||||
* System: security (보안)
|
* System: security (보안)
|
||||||
|
|
||||||
* Helper: paginate (페이지 네비게이션)
|
* Helper: paginate (페이지 네비게이션)
|
||||||
|
|
||||||
* Helper: gnuboard, gnuboard.config, gnuboard.lib (그누보드 설정 및 라이브러리 연동)
|
* Helper: gnuboard, gnuboard.config, gnuboard.lib (그누보드 설정 및 라이브러리 연동)
|
||||||
|
|
||||||
* Helper: vworld (국토교통부 vworld 연동)
|
* Helper: vworld (국토교통부 vworld 연동)
|
||||||
|
|
||||||
* Helper: wprest (워드프레스[wordpress] REST API 클라이언트)
|
* Helper: wprest (워드프레스[wordpress] REST API 클라이언트)
|
||||||
|
|
||||||
* Hepler: webpagetool (Proxy 설정, UA 설정, JSON/DOM 파서를 지원하는 HTTP 클라이언트)
|
* Hepler: webpagetool (Proxy 설정, UA 설정, JSON/DOM 파서를 지원하는 HTTP 클라이언트)
|
||||||
|
|
||||||
* Helper: noreporting, allreporting (오류 출력 범위를 설정)
|
* Helper: noreporting, allreporting (오류 출력 범위를 설정)
|
||||||
|
|
||||||
* Helper: isemail.lnk (is_email 지원 -> /vendor/isemail)
|
* Helper: isemail.lnk (is_email 지원 -> /vendor/isemail)
|
||||||
|
|
||||||
* Helper: metaparser.lnk (HTML META 데이터 파싱 지원 -> /vendor/PHP-MetaParser)
|
* Helper: metaparser.lnk (HTML META 데이터 파싱 지원 -> /vendor/PHP-MetaParser)
|
||||||
|
|
||||||
* Helper: simple_html_dom (HTML DOM 처리기)
|
* Helper: simple_html_dom (HTML DOM 처리기)
|
||||||
|
|
||||||
* Helper: oracle (오라클 데이터베이스 접속 및 쿼리)
|
* Helper: oracle (오라클 데이터베이스 접속 및 쿼리)
|
||||||
|
|
||||||
* Helper: exectool (PHP 명령행 실행 지원)
|
* Helper: exectool (PHP 명령행 실행 지원)
|
||||||
|
* 그 외 다양한 사양 지원을 위한 모듈들
|
||||||
|
|
||||||
## 기술지원
|
## 오픈소스 라이선스
|
||||||
|
* 이 프로젝트는 LGPL 3.0 오픈소스 라이선스 하에 배포됨.
|
||||||
* Website: https://exts.kr/go/home
|
|
||||||
|
|
||||||
* E-mail: support@exts.kr
|
|
||||||
|
|
||||||
## 저작권
|
|
||||||
|
|
||||||
* LGPL (별도의 오픈소스 라이센스 문서에 기입 요망)
|
|
||||||
|
|
||||||
## 최근변경
|
## 최근변경
|
||||||
|
* 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
|
||||||
|
|
108
README.md
108
README.md
|
@ -1,15 +1,18 @@
|
||||||
# ReasonableFramework
|
# ReasonableFramework
|
||||||
- ReasonableFramework is `RVHM` structured PHP Web Framework, Securely, Compatibility.
|

|
||||||
- Prefix code: `RSF` (ReasonableFramework)
|
[](https://zenodo.org/doi/10.5281/zenodo.11392416)
|
||||||
- Old prefix code `VSPF` (Very Simple PHP Framework)
|
|
||||||
|
|
||||||
## Donate us (or if you need technical support)
|
ReasonableFramework is RVHM structured PHP framework. aka, RSF, VSPF, C-2020-018490
|
||||||
- https://www.patreon.com/posts/25380536
|
|
||||||
|
|
||||||
## Specification
|
## Specifications
|
||||||
- Database connection (via PDO, MySQLi (MySQL Improved), MySQL Tranditional, MySQL CLI, Oracle(OCI))
|
- Various types of database connection drivers. e.g, PHP PDO, MySQLi, Legacy MySQL, MySQL over the shell, 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), Modal is optional.
|
- No OOP, Just `RVHM` structure
|
||||||
- AppJail(WebApp Sandbox): You can use legacy apps without modifying the source code.
|
- 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
|
## Compatible
|
||||||
- Tested in PHP 5.3.3
|
- Tested in PHP 5.3.3
|
||||||
|
@ -25,50 +28,61 @@
|
||||||
## Map of structure
|
## Map of structure
|
||||||

|

|
||||||
|
|
||||||
## Roadmap: Support legacy
|
|
||||||
- Support critical legacy web server (old: PHP 4.x ~ modern: 7.x)
|
|
||||||
- Support critical old browser (old: IE 6 ~ modern: IE 11)
|
|
||||||
- Do Clean & Modern PHP without hard studies.
|
|
||||||
|
|
||||||
## Contact me
|
|
||||||
- Go Namhyeon <gnh1201@gmail.com>
|
|
||||||
- Website: https://exts.kr/go/home
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
1. git clone https://github.com/gnh1201/reasonableframework.git
|
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. touch(make new file): `/route/example.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.
|
4. go to `http://:base_url/?route=example` or `http://:base_url/example/`(if set `.htaccess`) in the web browser.
|
||||||
5. enjoy it.
|
5. code it.
|
||||||
|
|
||||||
## Examples
|
## Use cases
|
||||||
- [REST API Integration (Naver Papago Translation REST API)](https://gist.github.com/gnh1201/081484e6f5e10bd3be819093ba5f49c8)
|
- [Send severities from Zabbix to Grafana](https://gist.github.com/gnh1201/792964e9719d2f62157cf46e394888f5)
|
||||||
- [Payment Gateway Integration (KCP)](https://github.com/gnh1201/reasonableframework/blob/master/route/orderpay.pgkcp.php)
|
- [REST API Integration (Papago Translation REST API)](https://gist.github.com/gnh1201/081484e6f5e10bd3be819093ba5f49c8)
|
||||||
- [Gnuboard CMS Integration (version 4, version 5)](https://github.com/gnh1201/reasonableframework/blob/master/route/api.gnuboard.php)
|
- [Payment Gateway Integration](https://github.com/gnh1201/reasonableframework/blob/master/route/orderpay.pgkcp.php)
|
||||||
|
|
||||||
## [NEW] Advanced security (only for sponsors)
|
## Remote logging
|
||||||
- CORS, CSRF, XSS, SQL-injection protection is common security, it is free and open-source for everyone.
|
- Remote logging feature based on [RFC3164(The BSD Syslog Protocol)](https://tools.ietf.org/html/rfc3164)
|
||||||
- Firewall, DDoS protection, and more tools are available only for sponsors. [see details](https://github.com/gnh1201/reasonableframework/blob/master/SECURITY.md)
|
|
||||||
|
|
||||||
## How to use CLI
|
## Tested on free web hostings
|
||||||
|
|
||||||
|
| 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]
|
$ php cli.php --route :route --session-id :session_id
|
||||||
```
|
```
|
||||||
|
|
||||||
## 한국어(Korean)
|
## Comment about PSR standards
|
||||||
- Resonable PHP Framework(이유있는 PHP 프레임워크)는 한국의 웹 개발 환경에 적합한 PHP 프레임워크입니다.
|
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.
|
||||||
- 일부 북미, 유럽권 무료 웹 호스팅에서도 안정적인 운영이 가능합니다.
|
|
||||||
- Composer를 포함한 별도의 개발 보조 도구, PHP 플러그인, PHP 프레임워크가 사용 불가능한 환경에 적합합니다.
|
|
||||||
- 개발 팀원을 대상으로 객체지향(OOP) 교육이 이루어지지 않아도, 그에 준하는 생존주기(Life cycle)를 보장합니다.
|
|
||||||
- Resonable PHP Framework는 CSRF, XSS, SQL Injection 보안 조치를 기본적으로 가지고 있습니다.
|
|
||||||
- 한국에서 사용되는 각종 CMS와 API와 연동되어 한국 환경에서 사용 빈도가 높은 구현 유형을 작성하는데 적합합니다.
|
|
||||||
- RVHM 구조는 MVC 구조와 함께 사용하실 수 있으며, 기존 개발 스킬로도 사용할 수 있도록 더 유연한 구조를 가집니다.
|
|
||||||
- 공식 카카오톡 오픈채팅방: 캐스플릿&리즈너블 사용자 모임 https://open.kakao.com/o/g9spGfrb
|
|
||||||
|
|
||||||
## English
|
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.
|
||||||
- It is stable in free web hosting, or other restrictive shared web hosting.
|
|
||||||
- Ideal for environments where separate development aids, including Composer, PHP extensions, and the famous PHP framework are not available.
|
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.
|
||||||
- Ensures a life-cycle similar to that of an object-oriented programming (OOP) level without trained developers.
|
|
||||||
- The Reasonable PHP Framework has CSRF, XSS, and SQL Injection security protection as defaults.
|
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.
|
||||||
- Compatible with various CMS and API used with REST API, it is suitable to create implementation type that is frequently used in various environment.
|
|
||||||
- RVHM structure can be used with MVC structure, and has more flexible structure to use as existing development skill.
|
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
|
||||||
|
- abuse@catswords.net
|
||||||
|
- ActivityPub [@catswords_oss@catswords.social](https://catswords.social/@catswords_oss)
|
||||||
|
|
30
SECURITY.md
30
SECURITY.md
|
@ -1,19 +1,23 @@
|
||||||
# Advanced security for ReasonableFramework
|
# Security Policy
|
||||||
Web hacking firewall(the advanced security against XSS, CSRF, and SQL-injection), DDoS protection, Webshell (malicious code) detection, secure configuration check. these extensions are only available for sponsors.
|
|
||||||
|
|
||||||
Even if you do not use a sponsor-only security module, the default security in our framework is usually sufficient.
|
## Supported Versions
|
||||||
|
|
||||||
Please note that this program is for those who want better security than the default.
|
Use this section to tell people about which versions of your project are
|
||||||
|
currently being supported with security updates.
|
||||||
|
|
||||||
## Related files
|
| Version | Supported |
|
||||||
- helper/php-sec-fw.lnk.php
|
| ------- | ------------------------------------------ |
|
||||||
- helper/php-sec-ddos.lnk.php
|
| 1.6.x | :white_check_mark: (Current) |
|
||||||
- helper/php-sec-shell.lnk.php
|
| 1.5.x | :x: (EOL: 2020-08-25) |
|
||||||
- helper/php-sec-scc.lnk.php
|
| < 1.5 | :x: |
|
||||||
|
|
||||||
## Minimum tier
|
## Reporting a Vulnerability
|
||||||
- 4 USD/monthly (Special thanks + Up to contributors)
|
Use this section to tell people how to report a vulnerability.
|
||||||
|
|
||||||
Thank you.
|
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.
|
||||||
|
|
||||||
https://www.patreon.com/posts/27376670
|
## Contact us
|
||||||
|
* ActivityPub [@catswords_oss@catswords.social](https://catswords.social/@catswords_oss)
|
||||||
|
* abuse@catswords.net
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Confirmed version
|
|
||||||
Last confirmed: 2018-03-09 22:00 (KST, GMT+09:00, Seoul)
|
|
BIN
assets/img/webpagetool-1.png
Normal file
BIN
assets/img/webpagetool-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 206 KiB |
BIN
assets/img/webpagetool-2.png
Normal file
BIN
assets/img/webpagetool-2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 KiB |
|
@ -18,7 +18,7 @@ function payman_load_widget(data) {
|
||||||
|
|
||||||
var check_msgs = payman_get_check_msgs();
|
var check_msgs = payman_get_check_msgs();
|
||||||
|
|
||||||
var allows_zero = ["good_mny"];
|
var allows_zero = ["good_mny", "redirect_url"];
|
||||||
|
|
||||||
for(var k in check_msgs) {
|
for(var k in check_msgs) {
|
||||||
if( !(k in data) || (allows_zero.indexOf(k) < 0 && data[k] == "") ) {
|
if( !(k in data) || (allows_zero.indexOf(k) < 0 && data[k] == "") ) {
|
||||||
|
@ -30,6 +30,10 @@ function payman_load_widget(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if("redirect_url" in data) {
|
||||||
|
req_data['redirect_url'] = data['redirect_url'];
|
||||||
|
}
|
||||||
|
|
||||||
if(is_available == true) {
|
if(is_available == true) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
|
@ -83,3 +87,21 @@ function payman_submit() {
|
||||||
$("#payman_orderform").submit();
|
$("#payman_orderform").submit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function payman_submit_nw() {
|
||||||
|
var check_msgs = payman_get_check_msgs();
|
||||||
|
for(var k in check_msgs) {
|
||||||
|
if(payman_get_data(k) == "") {
|
||||||
|
alert(check_msgs[k]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var $obj = $("#payman_orderform");
|
||||||
|
var nw = window.open("", "payman_window", "height=600,width=786,modal=yes,alwaysRaised=yes");
|
||||||
|
$obj.attr("target", "payman_window");
|
||||||
|
$obj.submit();
|
||||||
|
nw.focus();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
chmod -R 707 .
|
|
||||||
cp ./storage/example/_.htaccess ./.htaccess
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
find . -type d -exec chmod 0755 {} \;
|
#find . -type d -exec chmod 0755 {} \;
|
||||||
find . -type f -exec chmod 0644 {} \;
|
#find . -type f -exec chmod 0644 {} \;
|
||||||
|
chmod -R u+rwX,go+rX,go-w .
|
||||||
cp ./storage/example/_.htaccess ./.htaccess
|
cp ./storage/example/_.htaccess ./.htaccess
|
||||||
|
|
90
cli.php
90
cli.php
|
@ -2,28 +2,35 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file cli.php
|
* @file cli.php
|
||||||
* @date 2018-07-22
|
* @created_on 2018-07-22
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @created_on 2020-04-20
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief ReasonableFramework CLI mode
|
* @brief ReasonableFramework CLI mode
|
||||||
* @cvs http://github.com/gnh1201/reasonableframework
|
* @cvs http://github.com/gnh1201/reasonableframework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// example: php cli.php --route=welcome
|
||||||
|
|
||||||
define("_DEF_VSPF_", true); // compatible to VSPF
|
define("_DEF_VSPF_", true); // compatible to VSPF
|
||||||
define("_DEF_RSF_", true); // compatible to RSF
|
define("_DEF_RSF_", true); // compatible to RSF
|
||||||
define("APP_DEVELOPMENT", false); // set the status of development
|
define("APP_DEVELOPMENT", false); // set the status of development
|
||||||
define("DOC_EOL", "\r\n"); // set the 'end of line' commonly
|
define("DOC_EOL", "\r\n"); // set the 'end of line'
|
||||||
|
|
||||||
// check if current status is development
|
// development mode
|
||||||
if(APP_DEVELOPMENT == true) {
|
if(APP_DEVELOPMENT == true) {
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ini_set("display_errors", 1);
|
@ini_set("log_errors", 1);
|
||||||
|
@ini_set("error_log", sprintf("%s/storage/sandbox/logs/error.log", getcwd()));
|
||||||
|
} else {
|
||||||
|
error_reporting(E_ERROR | E_PARSE);
|
||||||
}
|
}
|
||||||
|
@ini_set("display_errors", 1);
|
||||||
|
|
||||||
// set empty scope
|
// set shared vars
|
||||||
$scope = array();
|
$shared_vars = array();
|
||||||
|
|
||||||
// define system modules
|
// define system modules
|
||||||
$load_systems = array("base", "storage", "config", "security", "database", "uri");
|
$load_systems = array("base", "storage", "config", "security", "database", "uri", "logger");
|
||||||
|
|
||||||
// load system modules
|
// load system modules
|
||||||
foreach($load_systems as $system_name) {
|
foreach($load_systems as $system_name) {
|
||||||
|
@ -35,10 +42,13 @@ foreach($load_systems as $system_name) {
|
||||||
} else {
|
} else {
|
||||||
loadModule($system_name);
|
loadModule($system_name);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
echo "ERROR: Dose not exists " . $system_inc_file;
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get configurations
|
// get config
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
// set max_execution_time
|
// set max_execution_time
|
||||||
|
@ -46,6 +56,13 @@ $max_execution_time = get_value_in_array("max_execution_time", $config, 0);
|
||||||
@ini_set("max_execution_time", $max_execution_time);
|
@ini_set("max_execution_time", $max_execution_time);
|
||||||
//@set_time_limit($max_execution_time);
|
//@set_time_limit($max_execution_time);
|
||||||
|
|
||||||
|
// set memory limit
|
||||||
|
$memory_limit = get_value_in_array("memory_limit", $config, "");
|
||||||
|
if(!empty($memory_limit)) {
|
||||||
|
@ini_set("memory_limit", $memory_limit);
|
||||||
|
@ini_set("suhosin.memory_limit", $memory_limit);
|
||||||
|
}
|
||||||
|
|
||||||
// autoload module
|
// autoload module
|
||||||
if(!array_key_empty("enable_autoload", $config)) {
|
if(!array_key_empty("enable_autoload", $config)) {
|
||||||
set_autoloader();
|
set_autoloader();
|
||||||
|
@ -55,49 +72,26 @@ if(!array_key_empty("enable_autoload", $config)) {
|
||||||
$default_timezone = get_value_in_array("timezone", $config, "UTC");
|
$default_timezone = get_value_in_array("timezone", $config, "UTC");
|
||||||
date_default_timezone_set($default_timezone);
|
date_default_timezone_set($default_timezone);
|
||||||
|
|
||||||
// default route
|
// set default route
|
||||||
$route = "welcome";
|
$route = "welcome";
|
||||||
|
|
||||||
// parse arguments
|
// set arguments of command line
|
||||||
$num_of_args = count($argv);
|
$opts = getopt("r::h::", array("route::", "host::"));
|
||||||
if($num_of_args > 1) {
|
if(!empty($opts['route'])) {
|
||||||
foreach($argv as $k=>$v) {
|
$route = $opts['route'];
|
||||||
switch($v) {
|
|
||||||
case "--route":
|
|
||||||
if($k < ($num_of_args - 1)) {
|
|
||||||
$route = $argv[$k + 1];
|
|
||||||
} else {
|
|
||||||
set_error("invaild argument");
|
|
||||||
show_errors();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "--static-ip":
|
|
||||||
if($k < ($num_of_args - 1)) {
|
|
||||||
$host = $argv[$k + 1];
|
|
||||||
set_scope("static_ip", $host);
|
|
||||||
} else {
|
|
||||||
set_error("invaild argument");
|
|
||||||
show_errors();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set_error("not enough arguments");
|
|
||||||
show_errors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// load route
|
// set global variables
|
||||||
if(empty($route)) {
|
set_shared_var("route", $route);
|
||||||
$route = get_value_in_array("default_route", $config, "welcome");
|
set_shared_var("host", $opts['host']);
|
||||||
} else {
|
|
||||||
$route_names = explode('/', $route);
|
// get PID(Process ID)
|
||||||
if(count($route_names) > 1) {
|
set_shared_var("mypid", getmypid());
|
||||||
$route = $route_names[0];
|
|
||||||
}
|
// set database connection
|
||||||
}
|
set_shared_var("dbc", get_db_connect());
|
||||||
|
|
||||||
// load route file
|
// load route file
|
||||||
if(!loadRoute($route, $scope)) {
|
if(!loadRoute($route, $shared_vars)) {
|
||||||
loadRoute("errors/404", $scope);
|
loadRoute("errors/404", $shared_vars);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "gnh1201/reasonableframework",
|
"name": "gnh1201/reasonableframework",
|
||||||
"description": "ReasonableFramework is RVHM structured PHP Web Framework, Securely, Compatibility.",
|
"description": "ReasonableFramework is RVHM structured PHP framework with common security",
|
||||||
"license": "LGPL-3.0",
|
"license": "LGPL-3.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Go Namhyeon",
|
"name": "Go Namhyeon",
|
||||||
"email": "gnh1201@gmail.com"
|
"email": "abuse@catswords.net"
|
||||||
}
|
|
||||||
],
|
|
||||||
"repositories": [
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://github.com/bozhinov/pChart2.0-for-PHP7"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"bozhinov/pChart2.0-for-PHP7": "dev-master",
|
"phpoffice/phpspreadsheet": "~1.8"
|
||||||
"phpoffice/phpspreadsheet": "dev-master",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
86
helper/SSL.class.php
Normal 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>';
|
||||||
|
```
|
||||||
|
*/
|
|
@ -12,6 +12,8 @@
|
||||||
* @author Andrew Moore
|
* @author Andrew Moore
|
||||||
* @link http://www.php.net/manual/en/function.uniqid.php#94959
|
* @link http://www.php.net/manual/en/function.uniqid.php#94959
|
||||||
*/
|
*/
|
||||||
|
if(!class_exists("UUID"))
|
||||||
|
{
|
||||||
class UUID
|
class UUID
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -146,9 +148,10 @@ class UUID
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function is_valid($uuid) {
|
public static function is_valid($uuid)
|
||||||
|
{
|
||||||
return preg_match('/^\{?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?'.
|
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;
|
'[0-9a-f]{4}\-?[0-9a-f]{12}\}?$/i', $uuid) === 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file api.whois.kr.php
|
* @file api.whois.kr.php
|
||||||
* @date 2019-05-26
|
* @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)
|
* @brief KISA Whois/Domain/IP/AS Query Helper (https://whois.kr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_whois_kr")) {
|
if(!is_fn("get_whois_kr")) {
|
||||||
function get_whois_kr($name, $key, $type="whois") {
|
function get_whois_kr($name, $key, $type="whois") {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
// archivetool.php
|
|
||||||
// todo
|
|
|
@ -2,12 +2,24 @@
|
||||||
/**
|
/**
|
||||||
* @file catsplit.format.php
|
* @file catsplit.format.php
|
||||||
* @date 2019-05-28
|
* @date 2019-05-28
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Catsplit format encoder
|
* @brief Catsplit format encoder
|
||||||
* @documentation https://github.com/gnh1201/catsplit-format
|
* @documentation https://github.com/gnh1201/catsplit-format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("catsplit_encode")) {
|
if(!is_fn("catsplit_unescape")) {
|
||||||
|
function catsplit_unescape($data) {
|
||||||
|
return trim($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("casplit_escape")) {
|
||||||
|
function casplit_escape($data) {
|
||||||
|
return htmlspecialchars($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("catsplit_encode")) {
|
||||||
function catsplit_encode($data) {
|
function catsplit_encode($data) {
|
||||||
$_ks = array();
|
$_ks = array();
|
||||||
$_vs = array();
|
$_vs = array();
|
||||||
|
@ -15,11 +27,14 @@ if(!check_function_exists("catsplit_encode")) {
|
||||||
$_ks[] = $k;
|
$_ks[] = $k;
|
||||||
$_vs[] = make_safe_argument($v);
|
$_vs[] = make_safe_argument($v);
|
||||||
}
|
}
|
||||||
|
$_ks = array_map("casplit_escape", $_ks);
|
||||||
|
$_vs = array_map("casplit_escape", $_vs);
|
||||||
|
|
||||||
return sprintf("('%s')<=(%s)", implode("','", $_vs), implode(",", $_ks));
|
return sprintf("('%s')<=(%s)", implode("','", $_vs), implode(",", $_ks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("catsplit_decode")) {
|
if(!is_fn("catsplit_decode")) {
|
||||||
function catsplit_decode($data) {
|
function catsplit_decode($data) {
|
||||||
$s_final = array();
|
$s_final = array();
|
||||||
|
|
||||||
|
@ -27,8 +42,8 @@ if(!check_function_exists("catsplit_decode")) {
|
||||||
$s1 = explode(")<=(", substr($data, 1, -1));
|
$s1 = explode(")<=(", substr($data, 1, -1));
|
||||||
|
|
||||||
// step 2
|
// step 2
|
||||||
$s2a = explode(",", $s1[0]);
|
$s2a = array_map("catsplit_unescape", explode(",", $s1[0]));
|
||||||
$s2b = explode(",", $s1[1]);
|
$s2b = array_map("catsplit_unescape", explode(",", $s1[1]));
|
||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
$s3 = array_combine($s2b, $s2a);
|
$s3 = array_combine($s2b, $s2a);
|
||||||
|
|
38
helper/colona.v1.format.php
Normal file
38
helper/colona.v1.format.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
// Go Namhyeon <abuse@catswords.net>
|
||||||
|
// 2019-09-25
|
||||||
|
|
||||||
|
if(!is_fn("decode_colona_format")) {
|
||||||
|
function decode_colona_format($data) {
|
||||||
|
$lines = explode_by_line(remove_utf8_bom($data));
|
||||||
|
$jobargs = array();
|
||||||
|
$eof = false;
|
||||||
|
$delimiter = ":";
|
||||||
|
|
||||||
|
$jobkey = "";
|
||||||
|
$jobvalue = "";
|
||||||
|
foreach($lines as $line) {
|
||||||
|
$pos = strpos($line, $delimiter);
|
||||||
|
|
||||||
|
if($eof) {
|
||||||
|
if($line == "EOF;") {
|
||||||
|
$jobargs[$jobkey] = $jobvalue;
|
||||||
|
$eof = false;
|
||||||
|
} else {
|
||||||
|
$jobvalue .= $line;
|
||||||
|
}
|
||||||
|
} elseif($pos !== false) {
|
||||||
|
$jobkey = rtrim(substr($line, 0, $pos));
|
||||||
|
$jobvalue = ltrim(substr($line, $pos + strlen($delimiter)));
|
||||||
|
if($jobvalue == "<<<EOF") {
|
||||||
|
$jobvalue = "";
|
||||||
|
$eof = true;
|
||||||
|
} else {
|
||||||
|
$jobargs[$jobkey] = $jobvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $jobargs;
|
||||||
|
}
|
||||||
|
}
|
31
helper/compress.zip.php
Normal file
31
helper/compress.zip.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
// @date 2019-10-13
|
||||||
|
// @author Go Namhyeon <abuse@catswords.net>
|
||||||
|
|
||||||
|
if(!is_fn("unzip")) {
|
||||||
|
function unzip($src, $dst, $options=array()) {
|
||||||
|
$flag = false;
|
||||||
|
|
||||||
|
$method = get_value_in_array("method", $options, "ZipArchive");
|
||||||
|
switch($method) {
|
||||||
|
case "ZipArchive":
|
||||||
|
$handle = new ZipArchive;
|
||||||
|
$res = $handle->open($src);
|
||||||
|
if ($res === TRUE) {
|
||||||
|
$zip->extractTo($dst);
|
||||||
|
$zip->close();
|
||||||
|
$flag = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "unzip":
|
||||||
|
if(loadHelper("exectool")) {
|
||||||
|
exec_command(sprintf("unzip -d '%s' '%s'", make_safe_argument($src), make_safe_argument($dst)));
|
||||||
|
$flag = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $flag;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,12 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* @file country.kr.php
|
* @file country.kr.php
|
||||||
* @date 2018-04-15
|
* @date 2018-04-15
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Country Helper (Korean)
|
* @brief Country Helper (Korean)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// parse telephone number
|
// parse telephone number
|
||||||
if(!check_function_exists("get_kr_parsed_tel_number")) {
|
if(!is_fn("get_kr_parsed_tel_number")) {
|
||||||
function get_kr_parsed_tel_number($tel) {
|
function get_kr_parsed_tel_number($tel) {
|
||||||
$output = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거
|
$output = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거
|
||||||
$local_code = substr($tel, 0, 2);
|
$local_code = substr($tel, 0, 2);
|
||||||
|
@ -22,7 +22,7 @@ if(!check_function_exists("get_kr_parsed_tel_number")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_kr_get_lastname")) {
|
if(!is_fn("get_kr_get_lastname")) {
|
||||||
function get_kr_get_lastname()
|
function get_kr_get_lastname()
|
||||||
if(loadHelper("string.utils")) {
|
if(loadHelper("string.utils")) {
|
||||||
$words = read_storage_file_by_line("kr.lastname.txt", array(
|
$words = read_storage_file_by_line("kr.lastname.txt", array(
|
||||||
|
@ -33,7 +33,7 @@ if(!check_function_exists("get_kr_get_lastname")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_kr_get_firstname")) {
|
if(!is_fn("get_kr_get_firstname")) {
|
||||||
function get_kr_get_firstname() {
|
function get_kr_get_firstname() {
|
||||||
if(loadHelper("string.utils")) {
|
if(loadHelper("string.utils")) {
|
||||||
$words = read_storage_file_by_line("kr.firstname.txt", array(
|
$words = read_storage_file_by_line("kr.firstname.txt", array(
|
||||||
|
@ -44,7 +44,7 @@ if(!check_function_exists("get_kr_get_firstname")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_kr_get_generated_name")) {
|
if(!is_fn("get_kr_get_generated_name")) {
|
||||||
function get_kr_get_generated_name() {
|
function get_kr_get_generated_name() {
|
||||||
return sprintf("%s%s", get_kr_get_lastname(), get_kr_get_firstname());
|
return sprintf("%s%s", get_kr_get_lastname(), get_kr_get_firstname());
|
||||||
}
|
}
|
||||||
|
|
41
helper/coupang.api.php
Normal file
41
helper/coupang.api.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file database.alt.php
|
* @file database.alt.php
|
||||||
* @date 2018-09-10
|
* @date 2018-09-10
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Database alternative driver switcher
|
* @brief Database alternative driver switcher
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_alt_callback")) {
|
if(!is_fn("exec_db_alt_callback")) {
|
||||||
function exec_db_alt_callback($rules, $params=array(), $driver="") {
|
function exec_db_alt_callback($rules, $params=array(), $driver="") {
|
||||||
$result = false;
|
$result = false;
|
||||||
$db_driver = empty($driver) ? get_db_driver() : $driver;
|
$db_driver = empty($driver) ? get_db_driver() : $driver;
|
||||||
|
@ -14,7 +14,7 @@ if(!check_function_exists("exec_db_alt_callback")) {
|
||||||
foreach($rules as $rule) {
|
foreach($rules as $rule) {
|
||||||
if($rule['driver'] == $db_driver) {
|
if($rule['driver'] == $db_driver) {
|
||||||
if(loadHelper(sprintf("database.%s", $rule['driver']))) {
|
if(loadHelper(sprintf("database.%s", $rule['driver']))) {
|
||||||
if(check_function_exists($rule['callback'])) {
|
if(is_fn($rule['callback'])) {
|
||||||
if(is_array($params) && count($params) > 0) {
|
if(is_array($params) && count($params) > 0) {
|
||||||
$result = call_user_func_array($rule['callback'], $params);
|
$result = call_user_func_array($rule['callback'], $params);
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,7 +33,7 @@ if(!check_function_exists("exec_db_alt_callback")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_db_alt_connect")) {
|
if(!is_fn("get_db_alt_connect")) {
|
||||||
function get_db_alt_connect($driver) {
|
function get_db_alt_connect($driver) {
|
||||||
$conn = false;
|
$conn = false;
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
@ -54,7 +54,7 @@ if(!check_function_exists("get_db_alt_connect")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_alt_query")) {
|
if(!is_fn("exec_db_alt_query")) {
|
||||||
function exec_db_alt_query($sql, $bind=array(), $options=array()) {
|
function exec_db_alt_query($sql, $bind=array(), $options=array()) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ if(!check_function_exists("exec_db_alt_query")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_alt_fetch_all")) {
|
if(!is_fn("exec_db_alt_fetch_all")) {
|
||||||
function exec_db_alt_fetch_all($sql, $bind=array(), $options=array()) {
|
function exec_db_alt_fetch_all($sql, $bind=array(), $options=array()) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ if(!check_function_exists("exec_db_alt_fetch_all")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_alt_fetch")) {
|
if(!is_fn("exec_db_alt_fetch")) {
|
||||||
function exec_db_alt_fetch($sql, $bind) {
|
function exec_db_alt_fetch($sql, $bind) {
|
||||||
$fetched = false;
|
$fetched = false;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ if(!check_function_exists("exec_db_alt_fetch")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_db_alt_last_id")) {
|
if(!is_fn("get_db_alt_last_id")) {
|
||||||
function get_db_alt_last_id($driver) {
|
function get_db_alt_last_id($driver) {
|
||||||
$last_id = false;
|
$last_id = false;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// database.mssql.pdo.php
|
// database.mssql.pdo.php
|
||||||
|
|
||||||
if(!check_function_exists("get_db_mssql_pdo_connect")) {
|
if(!is_fn("get_db_mssql_pdo_connect")) {
|
||||||
function get_db_mssql_pdo_connect() {
|
function get_db_mssql_pdo_connect() {
|
||||||
$conn = false;
|
$conn = false;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ if(!check_function_exists("get_db_mssql_pdo_connect")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_mssql_pdo_query")) {
|
if(!is_fn("exec_db_mssql_pdo_query")) {
|
||||||
function exec_db_mssql_pdo_query($sql, $bind=array(), $options=array()) {
|
function exec_db_mssql_pdo_query($sql, $bind=array(), $options=array()) {
|
||||||
$dbc = get_value_in_array("dbc", $options, get_dbc_object());
|
$dbc = get_value_in_array("dbc", $options, get_dbc_object());
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ if(!check_function_exists("exec_db_mssql_pdo_query")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_mssql_pdo_fetch_all")) {
|
if(!is_fn("exec_db_mssql_pdo_fetch_all")) {
|
||||||
function exec_db_mssql_pdo_fetch_all($sql, $bind=array(), $options=array()) {
|
function exec_db_mssql_pdo_fetch_all($sql, $bind=array(), $options=array()) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
|
|
|
@ -2,29 +2,77 @@
|
||||||
/**
|
/**
|
||||||
* @file database.mysql.cmd.php
|
* @file database.mysql.cmd.php
|
||||||
* @date 2019-04-06
|
* @date 2019-04-06
|
||||||
* @auther Go Namhyeon <gnh1201@gmail.com>
|
* @auther Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief MySQL(MariaDB) command line driver
|
* @brief MySQL(MariaDB) command line driver
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(function_exists("exec_db_mysql_cmd_query")) {
|
if(!is_fn("get_db_mysql_cmd_connect")) {
|
||||||
function exec_db_mysql_cmd_query($sql, $bind) {
|
function get_db_mysql_cmd_connect() {
|
||||||
$result = false;
|
$result = false;
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
$args = array("mysql");
|
|
||||||
$sql = get_db_binded_sql($sql, $bind);
|
|
||||||
|
|
||||||
if(loadHelper("exectool")) {
|
if(loadHelper("exectool")) {
|
||||||
$args[] = sprintf("-u%s", $config['db_username']);
|
$args = array("mysql");
|
||||||
$args[] = sprintf("-p%s", $config['db_password']);
|
$args[] = sprintf("-u'%s'", $config['db_username']);
|
||||||
$args[] = sprintf("-h%s", $config['db_host']);
|
$args[] = sprintf("-p'%s'", $config['db_password']);
|
||||||
$args[] = sprintf("-D %s", $config['db_name']);
|
$args[] = sprintf("-h'%s'", $config['db_host']);
|
||||||
$args[] = sprintf("-e '%s'", make_safe_argument($sql));
|
$args[] = "-s"; // --slient
|
||||||
|
$args[] = "-N"; // --skip-column-names
|
||||||
|
$args[] = "-e'select 1'";
|
||||||
|
|
||||||
$cmd = trim(implode(" ", $args));
|
$cmd = implode(" ", $args);
|
||||||
$result = exec_command($cmd);
|
$result = exec_command($cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!is_fn("exec_db_mysql_cmd_query")) {
|
||||||
|
function exec_db_mysql_cmd_query($sql, $bind) {
|
||||||
|
$result = false;
|
||||||
|
$config = get_config();
|
||||||
|
$sql = get_db_binded_sql($sql, $bind);
|
||||||
|
|
||||||
|
if(loadHelper("exectool")) {
|
||||||
|
$args = array("mysql");
|
||||||
|
$args[] = sprintf("-u'%s'", $config['db_username']);
|
||||||
|
$args[] = sprintf("-p'%s'", $config['db_password']);
|
||||||
|
$args[] = sprintf("-h'%s'", $config['db_host']);
|
||||||
|
$args[] = "-s"; // --slient
|
||||||
|
$args[] = sprintf("-D'%s'", $config['db_name']);
|
||||||
|
$args[] = sprintf("-e'%s'", make_safe_argument($sql));
|
||||||
|
|
||||||
|
$cmd = implode(" ", $args);
|
||||||
|
$result = exec_command($cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("exec_db_mysql_cmd_fetch_all")) {
|
||||||
|
function exec_db_mysql_cmd_fetch_all($sql, $bind) {
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
$tsvData = exec_db_mysql_cmd_query($sql, $bind);
|
||||||
|
$lines = explode(DOC_EOL, $tsvData);
|
||||||
|
$rows = array();
|
||||||
|
|
||||||
|
if(is_fn("str_getcsv")) {
|
||||||
|
foreach($lines as $line) {
|
||||||
|
$rows[] = str_getcsv($line, "\t");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach($lines as $line) {
|
||||||
|
$rows[] = explode("\t", $line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($rows) > 0) {
|
||||||
|
$result = $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file database.mysql.imp.php
|
* @file database.mysql.imp.php
|
||||||
* @date 2018-09-10
|
* @date 2018-09-10
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief MySQLi database helper
|
* @brief MySQLi database helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_db_mysql_imp_connect")) {
|
if(!is_fn("get_db_mysql_imp_connect")) {
|
||||||
function get_db_mysql_imp_connect() {
|
function get_db_mysql_imp_connect() {
|
||||||
$conn = false;
|
$conn = false;
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
@ -23,7 +23,7 @@ if(!check_function_exists("get_db_mysql_imp_connect")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_mysql_imp_query")) {
|
if(!is_fn("exec_db_mysql_imp_query")) {
|
||||||
function exec_db_mysql_imp_query($sql, $bind) {
|
function exec_db_mysql_imp_query($sql, $bind) {
|
||||||
$result = false;
|
$result = false;
|
||||||
$dbc = get_dbc_object();
|
$dbc = get_dbc_object();
|
||||||
|
@ -35,7 +35,7 @@ if(!check_function_exists("exec_db_mysql_imp_query")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_mysql_imp_fetch_all")) {
|
if(!is_fn("exec_db_mysql_imp_fetch_all")) {
|
||||||
function exec_db_mysql_imp_fetch_all($sql, $bind) {
|
function exec_db_mysql_imp_fetch_all($sql, $bind) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$result = exec_db_mysql_imp_query($sql, $bind);
|
$result = exec_db_mysql_imp_query($sql, $bind);
|
||||||
|
@ -48,9 +48,9 @@ if(!check_function_exists("exec_db_mysql_imp_fetch_all")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("close_db_mysql_imp_connect")) {
|
if(!is_fn("close_db_mysql_imp_connect")) {
|
||||||
function close_db_mysql_imp_connect() {
|
function close_db_mysql_imp_connect() {
|
||||||
$dbc = get_scope("dbc");
|
$dbc = get_shared_var("dbc");
|
||||||
return mysqli_close($dbc);
|
return mysqli_close($dbc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file database.mysql.old.php
|
* @file database.mysql.old.php
|
||||||
* @date 2018-09-14
|
* @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
|
* @brief MySQL-old (lower than 5.4) database helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_db_mysql_old_connect")) {
|
if(!is_fn("get_db_mysql_old_connect")) {
|
||||||
function get_db_mysql_old_connect() {
|
function get_db_mysql_old_connect() {
|
||||||
$conn = false;
|
$conn = false;
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
@ -26,7 +26,7 @@ if(!check_function_exists("get_db_mysql_old_connect")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_mysql_old_query")) {
|
if(!is_fn("exec_db_mysql_old_query")) {
|
||||||
function exec_db_mysql_old_query($sql, $bind) {
|
function exec_db_mysql_old_query($sql, $bind) {
|
||||||
$result = false;
|
$result = false;
|
||||||
$dbc = get_dbc_object();
|
$dbc = get_dbc_object();
|
||||||
|
@ -38,7 +38,7 @@ if(!check_function_exists("exec_db_mysql_old_query")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_mysql_old_fetch_all")) {
|
if(!is_fn("exec_db_mysql_old_fetch_all")) {
|
||||||
function exec_db_mysql_old_fetch_all($sql, $bind) {
|
function exec_db_mysql_old_fetch_all($sql, $bind) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$result = exec_db_mysql_old_query($sql, $bind);
|
$result = exec_db_mysql_old_query($sql, $bind);
|
||||||
|
@ -51,9 +51,9 @@ if(!check_function_exists("exec_db_mysql_old_fetch_all")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("close_db_mysql_old_connect")) {
|
if(!is_fn("close_db_mysql_old_connect")) {
|
||||||
function close_db_mysql_old_connect() {
|
function close_db_mysql_old_connect() {
|
||||||
$dbc = get_scope("dbc");
|
$dbc = get_shared_var("dbc");
|
||||||
return mysql_close($dbc);
|
return mysql_close($dbc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file oracle.php
|
* @file oracle.php
|
||||||
* @date 2018-03-27
|
* @date 2018-03-27
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Oracle database helper for ReasonableFramework
|
* @brief Oracle database helper for ReasonableFramework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("check_db_oracle_installed")) {
|
if(!is_fn("check_db_oracle_installed")) {
|
||||||
function check_db_oracle_installed() {
|
function check_db_oracle_installed() {
|
||||||
$fn = check_invalid_function(array(
|
$fn = check_invalid_function(array(
|
||||||
"NO_FUNCTION_OCI_PARSE" => "oci_parse",
|
"NO_FUNCTION_OCI_PARSE" => "oci_parse",
|
||||||
|
@ -25,13 +25,13 @@ if(!check_function_exists("check_db_oracle_installed")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_db_orable_binded_sql")) {
|
if(!is_fn("get_db_orable_binded_sql")) {
|
||||||
function get_db_orable_binded_sql($sql, $bind) {
|
function get_db_orable_binded_sql($sql, $bind) {
|
||||||
return get_db_binded_sql($sql, $bind);
|
return get_db_binded_sql($sql, $bind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_db_oracle_stmt")) {
|
if(!is_fn("get_db_oracle_stmt")) {
|
||||||
function get_db_oracle_stmt($sql, $bind) {
|
function get_db_oracle_stmt($sql, $bind) {
|
||||||
$stmt = NULL;
|
$stmt = NULL;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ if(!check_function_exists("get_db_oracle_stmt")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_oracle_connect")) {
|
if(!is_fn("exec_db_oracle_connect")) {
|
||||||
function exec_db_oracle_connect($host, $port, $user, $password, $options=array()) {
|
function exec_db_oracle_connect($host, $port, $user, $password, $options=array()) {
|
||||||
$conn = NULL;
|
$conn = NULL;
|
||||||
$envs = get_value_in_array("envs", $options, array());
|
$envs = get_value_in_array("envs", $options, array());
|
||||||
|
@ -90,7 +90,7 @@ if(!check_function_exists("exec_db_oracle_connect")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_oracle_fetch_all")) {
|
if(!is_fn("exec_db_oracle_fetch_all")) {
|
||||||
function exec_db_oracle_fetch_all($sql, $bind, $conn) {
|
function exec_db_oracle_fetch_all($sql, $bind, $conn) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ if(!check_function_exists("exec_db_oracle_fetch_all")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("exec_db_oracle_query")) {
|
if(!is_fn("exec_db_oracle_query")) {
|
||||||
function exec_db_oracle_query($sql, $bind, $conn) {
|
function exec_db_oracle_query($sql, $bind, $conn) {
|
||||||
$flag = false;
|
$flag = false;
|
||||||
|
|
||||||
|
@ -128,9 +128,9 @@ if(!check_function_exists("exec_db_oracle_query")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("close_db_oracle_connect")) {
|
if(!is_fn("close_db_oracle_connect")) {
|
||||||
function close_db_oracle_connect() {
|
function close_db_oracle_connect() {
|
||||||
$dbc = get_scope("dbc");
|
$dbc = get_shared_var("dbc");
|
||||||
|
|
||||||
if(!check_db_oracle_installed()) {
|
if(!check_db_oracle_installed()) {
|
||||||
show_errors();
|
show_errors();
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file exectool.php
|
* @file exectool.php
|
||||||
* @date 2018-07-22
|
* @created_on 2018-07-22
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated_on 2020-07-10
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @forked from https://github.com/scipag/PHPUtilities
|
* @forked from https://github.com/scipag/PHPUtilities
|
||||||
* @brief ExecTool helper
|
* @brief ExecTool helper
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +14,7 @@
|
||||||
* in the webserver configuration. The function execTests returns an array, which
|
* in the webserver configuration. The function execTests returns an array, which
|
||||||
* contains names of all successful tested PHP functions.
|
* contains names of all successful tested PHP functions.
|
||||||
*/
|
*/
|
||||||
if(!check_function_exists("exec_test")) {
|
if(!is_fn("exec_test")) {
|
||||||
function exec_test() {
|
function exec_test() {
|
||||||
$cmd = "whoami";
|
$cmd = "whoami";
|
||||||
$cmdPath = "/usr/bin/whoami";
|
$cmdPath = "/usr/bin/whoami";
|
||||||
|
@ -103,7 +104,7 @@ if(!check_function_exists("exec_test")) {
|
||||||
/*
|
/*
|
||||||
* exec_command() executes a command (like "whoami") with the submited method
|
* exec_command() executes a command (like "whoami") with the submited method
|
||||||
*/
|
*/
|
||||||
if(!check_function_exists("exec_command")) {
|
if(!is_fn("exec_command")) {
|
||||||
function exec_command($command, $method="shell_exec", $options=array()) {
|
function exec_command($command, $method="shell_exec", $options=array()) {
|
||||||
$return = false;
|
$return = false;
|
||||||
|
|
||||||
|
@ -133,7 +134,12 @@ if(!check_function_exists("exec_command")) {
|
||||||
return $return;
|
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
|
// 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")
|
// exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection")
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -157,7 +163,6 @@ if(!check_function_exists("exec_command")) {
|
||||||
|
|
||||||
case "exec":
|
case "exec":
|
||||||
exec($command, $output);
|
exec($command, $output);
|
||||||
var_dump($output);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "shell_exec":
|
case "shell_exec":
|
||||||
|
@ -201,6 +206,11 @@ if(!check_function_exists("exec_command")) {
|
||||||
|
|
||||||
$return = ob_get_clean();
|
$return = ob_get_clean();
|
||||||
|
|
||||||
|
// PID is integer
|
||||||
|
if(array_key_equals("async", $options, true)) {
|
||||||
|
$return = intval(rtrim($return));
|
||||||
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,26 +2,26 @@
|
||||||
/**
|
/**
|
||||||
* @file gnuboard.php
|
* @file gnuboard.php
|
||||||
* @date 2018-05-27
|
* @date 2018-05-27
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Database Helper for Gnuboard 4, Gnuboard 5
|
* @brief Database Helper for Gnuboard 4, Gnuboard 5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// get database prefix
|
// get database prefix
|
||||||
if(!check_function_exists("gnb_get_db_prefix")) {
|
if(!is_fn("gnb_get_db_prefix")) {
|
||||||
function gnb_get_db_prefix($version=4) {
|
function gnb_get_db_prefix($version=4) {
|
||||||
return ($version > 4) ? "g5_" : "g4_";
|
return ($version > 4) ? "g5_" : "g4_";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get table
|
// get table
|
||||||
if(!check_function_exists("gnb_get_db_table")) {
|
if(!is_fn("gnb_get_db_table")) {
|
||||||
function gnb_get_db_table($tablename) {
|
function gnb_get_db_table($tablename) {
|
||||||
return (gnb_get_db_prefix() . $tablename);
|
return (gnb_get_db_prefix() . $tablename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get write table
|
// get write table
|
||||||
if(!check_function_exists("gnb_get_write_table")) {
|
if(!is_fn("gnb_get_write_table")) {
|
||||||
function gnb_get_write_table($tablename, $version=4) {
|
function gnb_get_write_table($tablename, $version=4) {
|
||||||
$write_prefix = gnb_get_db_prefix() . "write_";
|
$write_prefix = gnb_get_db_prefix() . "write_";
|
||||||
$write_table = $write_prefix . $tablename;
|
$write_table = $write_prefix . $tablename;
|
||||||
|
@ -30,7 +30,7 @@ if(!check_function_exists("gnb_get_write_table")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get write next
|
// get write next
|
||||||
if(!check_function_exists("gnb_get_write_next")) {
|
if(!is_fn("gnb_get_write_next")) {
|
||||||
function gnb_get_write_next($tablename) {
|
function gnb_get_write_next($tablename) {
|
||||||
$row = exec_db_fetch("select min(wr_num) as min_wr_num from " . gnb_get_write_table($tablename));
|
$row = exec_db_fetch("select min(wr_num) as min_wr_num from " . gnb_get_write_table($tablename));
|
||||||
return (intval(get_value_in_array("min_wr_num", $row, 0)) - 1);
|
return (intval(get_value_in_array("min_wr_num", $row, 0)) - 1);
|
||||||
|
@ -38,7 +38,7 @@ if(!check_function_exists("gnb_get_write_next")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// write post
|
// write post
|
||||||
if(!check_function_exists("gnb_write_post")) {
|
if(!is_fn("gnb_write_post")) {
|
||||||
function gnb_write_post($tablename, $data=array(), $version=4) {
|
function gnb_write_post($tablename, $data=array(), $version=4) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
|
@ -112,14 +112,14 @@ if(!check_function_exists("gnb_write_post")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("gnb_get_posts")) {
|
if(!is_fn("gnb_get_posts")) {
|
||||||
function gnb_get_posts($table_name, $page=1, $limit=20, $options=array()) {
|
function gnb_get_posts($table_name, $page=1, $limit=20, $options=array()) {
|
||||||
$sql = "select * from " . gnb_get_write_table($table_name) . " order by wr_id desc" . get_page_range($page, $limit);
|
$sql = "select * from " . gnb_get_write_table($table_name) . " order by wr_id desc" . get_page_range($page, $limit);
|
||||||
return exec_db_fetch_all($sql);
|
return exec_db_fetch_all($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("gnb_get_post_by_id")) {
|
if(!is_fn("gnb_get_post_by_id")) {
|
||||||
function gnb_get_post_by_id($table_name, $post_id) {
|
function gnb_get_post_by_id($table_name, $post_id) {
|
||||||
$sql = "select * from " . gnb_get_write_table($table_name) . " where wr_id = :wr_id";
|
$sql = "select * from " . gnb_get_write_table($table_name) . " where wr_id = :wr_id";
|
||||||
return exec_db_fetch($sql, array(
|
return exec_db_fetch($sql, array(
|
||||||
|
@ -128,7 +128,7 @@ if(!check_function_exists("gnb_get_post_by_id")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("gnb_set_post_parameters")) {
|
if(!is_fn("gnb_set_post_parameters")) {
|
||||||
function gnb_set_post_parameters($tablename, $wr_id, $bind=array()) {
|
function gnb_set_post_parameters($tablename, $wr_id, $bind=array()) {
|
||||||
$flag = false;
|
$flag = false;
|
||||||
$excludes = array("wr_id");
|
$excludes = array("wr_id");
|
||||||
|
@ -144,7 +144,7 @@ if(!check_function_exists("gnb_set_post_parameters")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get member data
|
// get member data
|
||||||
if(!check_function_exists("gnb_get_member")) {
|
if(!is_fn("gnb_get_member")) {
|
||||||
function gnb_get_member($user_name, $tablename="member") {
|
function gnb_get_member($user_name, $tablename="member") {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ if(!check_function_exists("gnb_get_member")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get password
|
// get password
|
||||||
if(!check_function_exists("gnb_get_password")) {
|
if(!is_fn("gnb_get_password")) {
|
||||||
function gnb_get_password($password) {
|
function gnb_get_password($password) {
|
||||||
$bind = array(
|
$bind = array(
|
||||||
"password" => $password,
|
"password" => $password,
|
||||||
|
@ -171,7 +171,7 @@ if(!check_function_exists("gnb_get_password")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get config
|
// get config
|
||||||
if(!check_function_exists("gnb_get_config")) {
|
if(!is_fn("gnb_get_config")) {
|
||||||
function gnb_get_config($tablename="config") {
|
function gnb_get_config($tablename="config") {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ if(!check_function_exists("gnb_get_config")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// run login process
|
// run login process
|
||||||
if(!check_function_exists("gnb_process_safe_login")) {
|
if(!is_fn("gnb_process_safe_login")) {
|
||||||
function gnb_process_safe_login($user_name, $user_password) {
|
function gnb_process_safe_login($user_name, $user_password) {
|
||||||
$result = false;
|
$result = false;
|
||||||
$mb = gnb_get_member($user_name);
|
$mb = gnb_get_member($user_name);
|
||||||
|
@ -201,7 +201,7 @@ if(!check_function_exists("gnb_process_safe_login")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// run join member
|
// run join member
|
||||||
if(!check_function_exists("gnb_join_member")) {
|
if(!is_fn("gnb_join_member")) {
|
||||||
function gnb_join_member($user_name, $user_password, $data=array(), $tablename="member") {
|
function gnb_join_member($user_name, $user_password, $data=array(), $tablename="member") {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ if(!check_function_exists("gnb_join_member")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("gnb_make_pipelined_data")) {
|
if(!is_fn("gnb_make_pipelined_data")) {
|
||||||
function gnb_make_pipelined_data($data, $delimiter="|") {
|
function gnb_make_pipelined_data($data, $delimiter="|") {
|
||||||
foreach($data as $k=>$v) {
|
foreach($data as $k=>$v) {
|
||||||
$data[$k] = str_replace($delimiter, " ", $v);
|
$data[$k] = str_replace($delimiter, " ", $v);
|
||||||
|
|
24
helper/hiddentool.php
Normal file
24
helper/hiddentool.php
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file hybridauth.dbt.php
|
* @file hybridauth.dbt.php
|
||||||
* @date 2018-04-15
|
* @date 2018-04-15
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief HybridAuth DB Helper
|
* @brief HybridAuth DB Helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("store_hybridauth_session")) {
|
if(!is_fn("store_hybridauth_session")) {
|
||||||
function store_hybridauth_session($data, $user_id) {
|
function store_hybridauth_session($data, $user_id) {
|
||||||
$connection_id = false;
|
$connection_id = false;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ if(!check_function_exists("store_hybridauth_session")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_stored_hybridauth_session")) {
|
if(!is_fn("get_stored_hybridauth_session")) {
|
||||||
function get_stored_hybridauth_session($connection_id) {
|
function get_stored_hybridauth_session($connection_id) {
|
||||||
$stored_session = false;
|
$stored_session = false;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ if(!check_function_exists("get_stored_hybridauth_session")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_hybridauth_connection_info")) {
|
if(!is_fn("get_hybridauth_connection_info")) {
|
||||||
function get_hybridauth_connection_info($connection_id) {
|
function get_hybridauth_connection_info($connection_id) {
|
||||||
$connection_info = false;
|
$connection_info = false;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ if(!check_function_exists("get_hybridauth_connection_info")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_hybridauth_connection_id")) {
|
if(!is_fn("get_hybridauth_connection_id")) {
|
||||||
function get_hybridauth_connection_id($user_id) {
|
function get_hybridauth_connection_id($user_id) {
|
||||||
$connection_id = false;
|
$connection_id = false;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file hybridauth.lnk.php
|
* @file hybridauth.lnk.php
|
||||||
* @date 2018-09-26
|
* @date 2018-09-26
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief HybridAuth library RSF Linker
|
* @brief HybridAuth library RSF Linker
|
||||||
***/
|
***/
|
||||||
|
|
||||||
if(!check_function_exists("hybridauth_load")) {
|
if(!is_fn("hybridauth_load")) {
|
||||||
function hybridauth_load($provider="") {
|
function hybridauth_load($provider="") {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ if(!check_function_exists("hybridauth_load")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("hybridauth_check_redirect")) {
|
if(!is_fn("hybridauth_check_redirect")) {
|
||||||
function hybridauth_check_redirect() {
|
function hybridauth_check_redirect() {
|
||||||
$flag = false;
|
$flag = false;
|
||||||
$requests = get_requests();
|
$requests = get_requests();
|
||||||
|
@ -61,7 +61,7 @@ if(!check_function_exists("hybridauth_check_redirect")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("hybridauth_process")) {
|
if(!is_fn("hybridauth_process")) {
|
||||||
function hybridauth_process() {
|
function hybridauth_process() {
|
||||||
Hybrid_Endpoint::process();
|
Hybrid_Endpoint::process();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file isemail.lnk.php
|
* @file isemail.lnk.php
|
||||||
* @date 2018-03-02
|
* @date 2018-03-02
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief IsEmail library linker
|
* @brief IsEmail library linker
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("is_email")) {
|
if(!is_fn("is_email")) {
|
||||||
$inc_file = "./vendor/_dist/isemail/is_email.php";
|
$inc_file = "./vendor/_dist/isemail/is_email.php";
|
||||||
if(file_exists($inc_file)) {
|
if(file_exists($inc_file)) {
|
||||||
include($inc_file);
|
include($inc_file);
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file jCryption.lnk.php
|
* @file jCryption.lnk.php
|
||||||
* @date 2018-09-30
|
* @date 2018-09-30
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief jCryption (alternative HTTPS on javascript) Helper
|
* @brief jCryption (alternative HTTPS on javascript) Helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("jCryption_load")) {
|
if(!is_fn("jCryption_load")) {
|
||||||
function jCryption_load() {
|
function jCryption_load() {
|
||||||
$required_files = array(
|
$required_files = array(
|
||||||
"jCryption/sqAES",
|
"jCryption/sqAES",
|
||||||
|
@ -21,7 +21,7 @@ if(!check_function_exists("jCryption_load")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("jCryption_get")) {
|
if(!is_fn("jCryption_get")) {
|
||||||
function jCryption_get($idx=0, $selector="") {
|
function jCryption_get($idx=0, $selector="") {
|
||||||
$s = array();
|
$s = array();
|
||||||
$s[] = "JCryption::decrypt();";
|
$s[] = "JCryption::decrypt();";
|
||||||
|
|
69
helper/json.format.php
Normal file
69
helper/json.format.php
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
// @created_on 2019-10-13
|
||||||
|
// @updated_on 2020-01-27
|
||||||
|
// @author Go Namhyeon <abuse@catswords.net>
|
||||||
|
|
||||||
|
if(!is_fn("json_decode_ex")) {
|
||||||
|
function json_decode_ex($data, $options=array()) {
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
$is_assoc = array_key_equals("assoc", $options, true);
|
||||||
|
|
||||||
|
$invalid_fn = array(
|
||||||
|
"NO_FUNCTION_JSON_DECODE" => "json_decode",
|
||||||
|
"NO_FUNCTION_JSON_LAST_ERROR" => "json_last_error",
|
||||||
|
);
|
||||||
|
$error = check_invalid_function($invalid_fn);
|
||||||
|
if($error == JSON_ERROR_NONE) {
|
||||||
|
if($is_assoc) {
|
||||||
|
$result = json_decode($data, true);
|
||||||
|
} else {
|
||||||
|
$result = json_decode($data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = new stdClass();
|
||||||
|
$result->error = $error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("json_encode_ex")) {
|
||||||
|
function json_encode_ex($data, $options=array()) {
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
$is_adaptive = array_key_equals("adaptive", $options, true);
|
||||||
|
$is_pretty = array_key_equals("pretty", $options, true);
|
||||||
|
|
||||||
|
$invalid_fn = array(
|
||||||
|
"NO_FUNCTION_JSON_ENCODE" => "json_decode",
|
||||||
|
"NO_FUNCTION_JSON_LAST_ERROR" => "json_last_error",
|
||||||
|
);
|
||||||
|
$error = check_invalid_function($invalid_fn);
|
||||||
|
if($error == JSON_ERROR_NONE) {
|
||||||
|
if($is_adaptive) {
|
||||||
|
// 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters
|
||||||
|
$lines = array();
|
||||||
|
foreach($data as $k=>$v) {
|
||||||
|
if(is_array($v)) {
|
||||||
|
$lines[] = sprintf("\"%s\":%s", make_safe_argument($k), get_adaptive_json($v));
|
||||||
|
} else {
|
||||||
|
$lines[] = sprintf("\"%s\":\"%s\"", make_safe_argument($k), make_safe_argument($v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result = "{" . implode(",", $lines) . "}";
|
||||||
|
} else {
|
||||||
|
if($is_pretty) {
|
||||||
|
$result = json_encode($data, JSON_PRETTY_PRINT);
|
||||||
|
} else {
|
||||||
|
$result = json_encode($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = sprintf("{\"error\": \"%s\"}", $error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file kimsboard7.dbt.php
|
* @file kimsboard7.dbt.php
|
||||||
* @date 2018-08-20
|
* @date 2018-08-20
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Database Helper for Kimsboard 7 (experimental)
|
* @brief Database Helper for Kimsboard 7 (experimental)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
75
helper/lguplus.api.php
Normal file
75
helper/lguplus.api.php
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file lguplus.api.php
|
||||||
|
* @date 2019-10-07
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
|
* @brief `LGU+`or `LGUPlus` is trandmark of LGUPlus Co. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("./vendor/_dist/lguplus/openapi/message.php");
|
||||||
|
use openapi\message;
|
||||||
|
|
||||||
|
function lguplus_get_config() {
|
||||||
|
$config = get_config();
|
||||||
|
return array(
|
||||||
|
"enabled" => $config['lguplus_enabled'],
|
||||||
|
"key" => $config['lguplus_key'],
|
||||||
|
"secret" => $config['lguplus_secret'],
|
||||||
|
"from" => $config['lguplus_from'],
|
||||||
|
"country" => $config['lguplus_country'],
|
||||||
|
"subject" => $config['lguplus_subject']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function lguplus_send_message($message, $to="") {
|
||||||
|
$cnf = lguplus_get_config();
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
"response" => false,
|
||||||
|
"error" => false
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!array_key_equals("enabled", $cnf, 1)) {
|
||||||
|
$data['error'] = "this is disabled. please set lguplus_enabled to 1";
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$API_KEY = $cnf['key'];
|
||||||
|
$API_PWD = $cnf['secret'];
|
||||||
|
|
||||||
|
$msg = new message($API_KEY, $API_PWD, 1, false);
|
||||||
|
|
||||||
|
$ch = $msg->getHandle( "/v1/send" );
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
"send_type" => "S", // 발송형태(R:예약,S:즉시)
|
||||||
|
"msg_type" => "S", // SMS : S, LMS : L, MMS : M
|
||||||
|
"to" => $to, // 수신자번호, ","으로 구분하여 100개까지 지정 가능하다.
|
||||||
|
"from" => get_value_in_array("from", $cnf, "01000000000"), // 발신자 번호, 발신자 번호는 사전등록된 번호여야 한다.
|
||||||
|
"subject" => get_value_in_array("subject", $cnf, "Untitled text message"), // LMS, MMS 의 경우, 제목을 입력할 수 있다.
|
||||||
|
"msg" => $message, // 메시지 본문 내용
|
||||||
|
"device_id" => "", // 디바이스 아이디를 지정하여 특정 디바이스를 발송제어할 수 있다.
|
||||||
|
"datetime" => "", // 예약시간(YYYYMMDDHH24MI)
|
||||||
|
"country" => get_value_in_array("country", $cnf, "82"), // 국가 코드
|
||||||
|
);
|
||||||
|
|
||||||
|
$msg->setData( $ch, $data );
|
||||||
|
|
||||||
|
$response = $msg->sendPost($ch);
|
||||||
|
$data['response'] = $response;
|
||||||
|
if ($response === FALSE) {
|
||||||
|
$data['error'] = array(
|
||||||
|
"code" => curl_error($ch),
|
||||||
|
"message" => "CURL_ERROR"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch(Exception $e) {
|
||||||
|
$data['error'] = array(
|
||||||
|
"code" => $e->getCode(),
|
||||||
|
"message" => $e->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
22
helper/lguplus.install.php
Normal file
22
helper/lguplus.install.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file lguplus.install.php
|
||||||
|
* @date 2019-10-13
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
|
* @brief `LGU+`or `LGUPlus` is trandmark of LGUPlus Co. Ltd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||||
|
|
||||||
|
if(!is_fn("lguplus_install")) {
|
||||||
|
function lguplus_install() {
|
||||||
|
$response = get_web_page("https://openapi.sms.uplus.co.kr/sdkFile/php_sdk.zip");
|
||||||
|
|
||||||
|
$fw = write_storage_file($response['content'], array(
|
||||||
|
"extension" => "zip"
|
||||||
|
));
|
||||||
|
@unzip($fw, get_storage_path());
|
||||||
|
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,12 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* @file mailgun.api.php
|
* @file mailgun.api.php
|
||||||
* @date 2019-04-12
|
* @date 2019-04-12
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Mailgun REST API interface module
|
* @brief Mailgun REST API interface module
|
||||||
* @documentation https://documentation.mailgun.com/en/latest/api-sending.html
|
* @documentation https://documentation.mailgun.com/en/latest/api-sending.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("mailgun_get_config")) {
|
if(!is_fn("mailgun_get_config")) {
|
||||||
function mailgun_get_config() {
|
function mailgun_get_config() {
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ if(!check_function_exists("mailgun_get_config")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("mailgun_send_message")) {
|
if(!is_fn("mailgun_send_message")) {
|
||||||
function mailgun_send_message($content, $to, $subject="Untitled") {
|
function mailgun_send_message($content, $to, $subject="Untitled") {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file metaparser.lnk.php
|
* @file metaparser.lnk.php
|
||||||
* @date 2018-03-21
|
* @date 2018-03-21
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief PHP-Metaparser library linker
|
* @brief PHP-Metaparser library linker
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
21
helper/migrate.1.5.php
Normal file
21
helper/migrate.1.5.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,12 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* @file mobiletool.php
|
* @file mobiletool.php
|
||||||
* @date 2019-04-29
|
* @date 2019-04-29
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Mobile Tool
|
* @brief Mobile Tool
|
||||||
* @documentation https://www.w3.org/Mobile/training/device-detection/mobile_detector.txt
|
* @documentation https://www.w3.org/Mobile/training/device-detection/mobile_detector.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("detect_mobile")) {
|
if(!is_fn("detect_mobile")) {
|
||||||
function detect_mobile() {
|
function detect_mobile() {
|
||||||
// This function returns the value of a local variable ($dm)
|
// This function returns the value of a local variable ($dm)
|
||||||
// that is 0 if a desktop client is detected and > 0 for mobile.
|
// that is 0 if a desktop client is detected and > 0 for mobile.
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file networktool.php
|
* @file networktool.php
|
||||||
* @date 2018-04-11
|
* @created_on 2018-04-11
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated_on 2022-09-16
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Network tool helper
|
* @brief Network tool helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_network_event")) {
|
if(!is_fn("get_network_event")) {
|
||||||
function get_network_event() {
|
function get_network_event() {
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ if(!check_function_exists("get_network_event")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_network_client_addr")) {
|
if(!is_fn("get_network_client_addr")) {
|
||||||
function get_network_client_addr() {
|
function get_network_client_addr() {
|
||||||
$addr = '';
|
$addr = '';
|
||||||
if (isset($_SERVER['HTTP_CLIENT_IP']))
|
if (isset($_SERVER['HTTP_CLIENT_IP']))
|
||||||
|
@ -47,7 +48,7 @@ if(!check_function_exists("get_network_client_addr")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_network_server_addr")) {
|
if(!is_fn("get_network_server_addr")) {
|
||||||
function get_network_server_addr() {
|
function get_network_server_addr() {
|
||||||
$addr = '';
|
$addr = '';
|
||||||
if(isset($_SERVER['SERVER_ADDR']) && isset($_SERVER['SERVER_PORT'])) {
|
if(isset($_SERVER['SERVER_ADDR']) && isset($_SERVER['SERVER_PORT'])) {
|
||||||
|
@ -56,7 +57,7 @@ if(!check_function_exists("get_network_server_addr")) {
|
||||||
$addr = $_SERVER['SERVER_ADDR'];
|
$addr = $_SERVER['SERVER_ADDR'];
|
||||||
} else if(isset($_SERVER['LOCAL_ADDR'])) {
|
} else if(isset($_SERVER['LOCAL_ADDR'])) {
|
||||||
$addr = $_SERVER['LOCAL_ADDR'];
|
$addr = $_SERVER['LOCAL_ADDR'];
|
||||||
} else if(check_function_exists(array("gethostname", "gethostbyname"))) {
|
} else if(is_fn(array("gethostname", "gethostbyname"))) {
|
||||||
$host = gethostname();
|
$host = gethostname();
|
||||||
$addr = gethostbyname($host);
|
$addr = gethostbyname($host);
|
||||||
} else {
|
} else {
|
||||||
|
@ -66,14 +67,14 @@ if(!check_function_exists("get_network_server_addr")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_network_hostname")) {
|
if(!is_fn("get_network_hostname")) {
|
||||||
function get_network_hostname() {
|
function get_network_hostname() {
|
||||||
$host = '';
|
$host = '';
|
||||||
if(isset($_SERVER['HTTP_HOST'])) {
|
if(isset($_SERVER['HTTP_HOST'])) {
|
||||||
$host = $_SERVER['HTTP_HOST'];
|
$host = $_SERVER['HTTP_HOST'];
|
||||||
} else if(isset($_SERVER['SERVER_NAME'])) {
|
} else if(isset($_SERVER['SERVER_NAME'])) {
|
||||||
$host = $_SERVER['SERVER_NAME'];
|
$host = $_SERVER['SERVER_NAME'];
|
||||||
} else if(!check_function_exists('gethostname')) {
|
} else if(!is_fn('gethostname')) {
|
||||||
$host = gethostname();
|
$host = gethostname();
|
||||||
} else {
|
} else {
|
||||||
$host = 'UNKNOWN';
|
$host = 'UNKNOWN';
|
||||||
|
@ -83,13 +84,13 @@ if(!check_function_exists("get_network_hostname")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("check_secure_protocol")) {
|
if(!is_fn("check_secure_protocol")) {
|
||||||
function check_secure_protocol() {
|
function check_secure_protocol() {
|
||||||
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
|
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_os_platform")) {
|
if(!is_fn("get_os_platform")) {
|
||||||
function get_os_platform() {
|
function get_os_platform() {
|
||||||
$os = "";
|
$os = "";
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ if(!check_function_exists("get_os_platform")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_network_outbound_addr")) {
|
if(!is_fn("get_network_outbound_addr")) {
|
||||||
function get_network_outbound_addr($protocol="") {
|
function get_network_outbound_addr($protocol="") {
|
||||||
$addr = false;
|
$addr = false;
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
@ -126,3 +127,11 @@ if(!check_function_exists("get_network_outbound_addr")) {
|
||||||
return $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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @file obfuscator.php
|
* @file obfuscator.php
|
||||||
* @date 2018-10-21
|
* @date 2018-10-21
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief PHP Obfuscator for ReasonableFramework
|
* @brief PHP Obfuscator for ReasonableFramework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_obfuscator")) {
|
if(!is_fn("get_obfuscator")) {
|
||||||
function get_obfuscator() {
|
function get_obfuscator() {
|
||||||
$obfuscator = rand(1, 15);
|
$obfuscator = rand(1, 15);
|
||||||
set_scope("obfuscator", $obfuscator);
|
set_shared_var("obfuscator", $obfuscator);
|
||||||
return $obfuscator;
|
return $obfuscator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_obfuscated_result")) {
|
if(!is_fn("get_obfuscated_result")) {
|
||||||
function get_obfuscated_result($raw) {
|
function get_obfuscated_result($raw) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
loadVender("pChart2/");
|
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file pagenate.php
|
* @file pagenate.php
|
||||||
* @date 2018-01-01
|
* @date 2018-01-01
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Page navigation helper
|
* @brief Page navigation helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("paginate_get_current_page")) {
|
if(!is_fn("paginate_get_current_page")) {
|
||||||
function paginate_get_current_page($page=1) {
|
function paginate_get_current_page($page=1) {
|
||||||
$current_page = 1;
|
$current_page = 1;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ if(!check_function_exists("paginate_get_current_page")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("paginate_get_total_pages")) {
|
if(!is_fn("paginate_get_total_pages")) {
|
||||||
function paginate_get_total_pages($item_per_page=1.0, $total_records=1.0) {
|
function paginate_get_total_pages($item_per_page=1.0, $total_records=1.0) {
|
||||||
$total_pages = 1;
|
$total_pages = 1;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ if(!check_function_exists("paginate_get_total_pages")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("paginate_get_query_string")) {
|
if(!is_fn("paginate_get_query_string")) {
|
||||||
function paginate_get_query_string() {
|
function paginate_get_query_string() {
|
||||||
loadHelper("networktool");
|
loadHelper("networktool");
|
||||||
$net_event = get_network_event();
|
$net_event = get_network_event();
|
||||||
|
@ -39,7 +39,7 @@ if(!check_function_exists("paginate_get_query_string")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.sanwebe.com/2011/05/php-pagination-function
|
// https://www.sanwebe.com/2011/05/php-pagination-function
|
||||||
if(!check_function_exists("paginate_make_html")) {
|
if(!is_fn("paginate_make_html")) {
|
||||||
function paginate_make_html($item_per_page, $current_page, $total_records, $total_pages, $page_url, $qry='') {
|
function paginate_make_html($item_per_page, $current_page, $total_records, $total_pages, $page_url, $qry='') {
|
||||||
$pagination = '';
|
$pagination = '';
|
||||||
if($total_pages > 0 && $total_pages != 1 && $current_page <= $total_pages) { //verify total pages and current page number
|
if($total_pages > 0 && $total_pages != 1 && $current_page <= $total_pages) { //verify total pages and current page number
|
||||||
|
|
68
helper/perftool.php
Normal file
68
helper/perftool.php
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
helper/pgkcp.install.php
Normal file
39
helper/pgkcp.install.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file pgkcp.install.php
|
||||||
|
* @date 2019-10-13
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
|
* @brief KCP PG(Payment Gateway) Auto-Install Tool
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||||
|
|
||||||
|
loadHelper("pgkcp.lnk");
|
||||||
|
|
||||||
|
if(!is_fn("install_pgkcp")) {
|
||||||
|
function install_pgkcp() {
|
||||||
|
$response = get_web_page("https://admin8.kcp.co.kr/assist/download/sampleDownload", "get", array(
|
||||||
|
"type1" => "FM01",
|
||||||
|
"type2" => "FS04"
|
||||||
|
));
|
||||||
|
|
||||||
|
// step 1
|
||||||
|
$fw = write_storage_file($response['content'], array(
|
||||||
|
"extension" => "zip"
|
||||||
|
));
|
||||||
|
@unzip($fw, get_storage_path());
|
||||||
|
|
||||||
|
// step 2
|
||||||
|
$fw = write_storage_file("", array(
|
||||||
|
"mode" => "fake",
|
||||||
|
"filename" => sprintf("NHNKCP_PAYMENT_STANDARD_PHP/NHNKCP_PAYMENT_STANDARD_LINUX_PHP.zip"),
|
||||||
|
));
|
||||||
|
@unzip($fw, get_storage_path());
|
||||||
|
|
||||||
|
// step 3
|
||||||
|
exec_command("cp -r %s/NHNKCP_PAYMENT_STANDARD_LINUX_PHP/* %s/", get_storage_path(), get_pgkcp_dir());
|
||||||
|
|
||||||
|
// if success, directory exists
|
||||||
|
return is_dir(get_pgkcp_dir());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +1,31 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file pgkcp.lnk.php
|
* @file pgkcp.lnk.php
|
||||||
* @date 2018-08-25
|
* @created_on 2018-08-25
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated_on 2020-01-13
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief KCP PG(Payment Gateway) Helper
|
* @brief KCP PG(Payment Gateway) Helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||||
|
|
||||||
if(!check_function_exists("get_pgkcp_config")) {
|
loadHelper("json.format");
|
||||||
|
loadHelper("webpagetool");
|
||||||
|
loadHelper("compress.zip");
|
||||||
|
loadHelper("exectool");
|
||||||
|
|
||||||
|
if(!is_fn("get_pgkcp_config")) {
|
||||||
|
function get_pgkcp_dir() {
|
||||||
|
return get_current_working_dir() . "/vendor/_dist/pgkcp";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_pgkcp_config")) {
|
||||||
function get_pgkcp_config() {
|
function get_pgkcp_config() {
|
||||||
$pgkcp_config = array();
|
$pgkcp_config = array();
|
||||||
|
|
||||||
// include configuration file
|
// include configuration file
|
||||||
$inc_file = get_current_working_dir() . "/vendor/pgkcp/cfg/site_conf_inc.php";
|
$inc_file = get_pgkcp_dir() . "/cfg/site_conf_inc.php";
|
||||||
if(file_exists($inc_file)) {
|
if(file_exists($inc_file)) {
|
||||||
include($inc_file);
|
include($inc_file);
|
||||||
|
|
||||||
|
@ -36,11 +48,12 @@ if(!check_function_exists("get_pgkcp_config")) {
|
||||||
"storage_type" => "payman"
|
"storage_type" => "payman"
|
||||||
));
|
));
|
||||||
if(!empty($fr)) {
|
if(!empty($fr)) {
|
||||||
$api_config = json_decode($fr, true);
|
$_pgkcp_config = json_decode($fr);
|
||||||
$api_config_fields = array("g_conf_gw_url", "g_conf_js_url", "g_conf_site_cd", "g_conf_site_key", "g_conf_site_name");
|
$pgkcp_config['g_conf_gw_url'] = get_property_value("g_conf_gw_url", $_pgkcp_config);
|
||||||
foreach($api_config_fields as $name) {
|
$pgkcp_config['g_conf_js_url'] = get_property_value("g_conf_js_url", $_pgkcp_config);
|
||||||
$pgkcp_config[$name] = get_value_in_array($name, $api_config, $pgkcp_config[$name]);
|
$pgkcp_config['g_conf_site_cd'] = get_property_value("g_conf_site_cd", $_pgkcp_config);
|
||||||
}
|
$pgkcp_config['g_conf_site_key'] = get_property_value("g_conf_site_key", $_pgkcp_config);
|
||||||
|
$pgkcp_config['g_conf_site_name'] = get_property_value("g_conf_site_name", $_pgkcp_config);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set_error("PGKCP configuration file does not exists.");
|
set_error("PGKCP configuration file does not exists.");
|
||||||
|
@ -50,7 +63,7 @@ if(!check_function_exists("get_pgkcp_config")) {
|
||||||
// check installed platform
|
// check installed platform
|
||||||
$platform = get_pgkcp_platform($pgkcp_config);
|
$platform = get_pgkcp_platform($pgkcp_config);
|
||||||
if(empty($platform)) {
|
if(empty($platform)) {
|
||||||
set_error("pp_cli or pp_cli.exe file not found");
|
set_error("pp_cli(pp_cli.exe) file is not found or executable");
|
||||||
show_errors();
|
show_errors();
|
||||||
} else {
|
} else {
|
||||||
$pgkcp_config['g_conf_platform'] = $platform;
|
$pgkcp_config['g_conf_platform'] = $platform;
|
||||||
|
@ -60,17 +73,17 @@ if(!check_function_exists("get_pgkcp_config")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_pgkcp_platform")) {
|
if(!is_fn("get_pgkcp_platform")) {
|
||||||
function get_pgkcp_platform($pgkcp_config) {
|
function get_pgkcp_platform($pgkcp_config) {
|
||||||
$platform = false;
|
$platform = false;
|
||||||
|
|
||||||
$exe_files = array(
|
$executables = array(
|
||||||
"default" => $pgkcp_config['g_conf_home_dir'] . "/bin/pp_cli",
|
"default" => $pgkcp_config['g_conf_home_dir'] . "/bin/pp_cli",
|
||||||
"win32" => $pgkcp_config['g_conf_home_dir'] . "/bin/pp_cli.exe"
|
"win32" => $pgkcp_config['g_conf_home_dir'] . "/bin/pp_cli.exe"
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($exe_files as $k=>$v) {
|
foreach($executables as $k=>$v) {
|
||||||
if(file_exists($v)) {
|
if(file_exists($v) && is_executable($v)) {
|
||||||
$platform = $k;
|
$platform = $k;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -80,9 +93,9 @@ if(!check_function_exists("get_pgkcp_platform")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("load_pgkcp_library")) {
|
if(!is_fn("load_pgkcp_library")) {
|
||||||
function load_pgkcp_library() {
|
function load_pgkcp_library() {
|
||||||
$inc_file = get_current_working_dir() . "/vendor/pgkcp/res/pp_cli_hub_lib.php";
|
$inc_file = get_pgkcp_dir() . "/sample/pp_cli_hub_lib.php";
|
||||||
if(file_exists($inc_file)) {
|
if(file_exists($inc_file)) {
|
||||||
include($inc_file);
|
include($inc_file);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?php
|
|
||||||
echo "php-sec-ddos is only for sponsors: <a href=\"https://patreon.com/catswords\">https://patreon.com/catswords</a>";
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?php
|
|
||||||
echo "php-sec-fw is only for sponsors: <a href=\"https://patreon.com/catswords\">https://patreon.com/catswords</a>";
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?php
|
|
||||||
echo "php-sec-scc is only for sponsors: <a href=\"https://patreon.com/catswords\">https://patreon.com/catswords</a>";
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?php
|
|
||||||
echo "php-sec-shell is only for sponsors: <a href=\"https://patreon.com/catswords\">https://patreon.com/catswords</a>";
|
|
39
helper/rfc3164.proto.php
Normal file
39
helper/rfc3164.proto.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* @file rfc3164.proto.php
|
||||||
|
* @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
|
||||||
|
* @updated_on 2020-01-23
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!is_fn("rfc3164_get_config")) {
|
||||||
|
function rfc3164_get_config() {
|
||||||
|
$config = get_config();
|
||||||
|
return array(
|
||||||
|
"enabled" => get_value_in_array("rfc3164_enabled", $config, ""),
|
||||||
|
"host" => get_value_in_array("rfc3164_host", $config, ""),
|
||||||
|
"port" => get_value_in_array("rfc3164_port", $config, "")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("rfc3164_send_message")) {
|
||||||
|
function rfc3164_send_message($message, $component = "web", $program = "next_big_thing") {
|
||||||
|
$_config = rfc3164_get_config();
|
||||||
|
|
||||||
|
$enabled = array_key_equals("enabled", $_config, 1);
|
||||||
|
$host = get_value_in_array("host", $_config, "");
|
||||||
|
$port = get_value_in_array("port", $_config, "");
|
||||||
|
|
||||||
|
if($enabled !== false) {
|
||||||
|
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||||
|
foreach(explode("\n", $message) as $line) {
|
||||||
|
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
|
||||||
|
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
|
||||||
|
}
|
||||||
|
socket_close($sock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1206,7 +1206,7 @@ class simple_html_dom
|
||||||
|
|
||||||
$charset = null;
|
$charset = null;
|
||||||
|
|
||||||
if (!check_function_exists('get_last_retrieve_url_contents_content_type'))
|
if (!is_fn('get_last_retrieve_url_contents_content_type'))
|
||||||
{
|
{
|
||||||
$contentTypeHeader = get_last_retrieve_url_contents_content_type();
|
$contentTypeHeader = get_last_retrieve_url_contents_content_type();
|
||||||
$success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches);
|
$success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches);
|
||||||
|
@ -1248,7 +1248,7 @@ class simple_html_dom
|
||||||
{
|
{
|
||||||
// Use this in case mb_detect_charset isn't installed/loaded on this machine.
|
// Use this in case mb_detect_charset isn't installed/loaded on this machine.
|
||||||
$charset = false;
|
$charset = false;
|
||||||
if (!check_function_exists('mb_detect_encoding'))
|
if (!is_fn('mb_detect_encoding'))
|
||||||
{
|
{
|
||||||
// Have php try to detect the encoding from the text given to us.
|
// Have php try to detect the encoding from the text given to us.
|
||||||
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
|
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file socialtools.php
|
* @file socialtools.php
|
||||||
* @date 2018-09-27
|
* @date 2018-09-27
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief SocialTools (refactoring from SocioRouter)
|
* @brief SocialTools (refactoring from SocioRouter)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("social_send_message")) {
|
if(!is_fn("social_send_message")) {
|
||||||
function social_send_message($provider, $adapter, $message, $options=array()) {
|
function social_send_message($provider, $adapter, $message, $options=array()) {
|
||||||
$response = false;
|
$response = false;
|
||||||
$status = array(
|
$status = array(
|
||||||
|
@ -48,7 +48,7 @@ if(!check_function_exists("social_send_message")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("social_parse_object_id")) {
|
if(!is_fn("social_parse_object_id")) {
|
||||||
function social_parse_object_id($provider, $response) {
|
function social_parse_object_id($provider, $response) {
|
||||||
$object_id = false;
|
$object_id = false;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ if(!check_function_exists("social_parse_object_id")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("social_get_object")) {
|
if(!is_fn("social_get_object")) {
|
||||||
function social_get_object($provider, $adapter, $object_id) {
|
function social_get_object($provider, $adapter, $object_id) {
|
||||||
$result = false;
|
$result = false;
|
||||||
$access_token = $adapter->getAccessToken();
|
$access_token = $adapter->getAccessToken();
|
||||||
|
@ -90,7 +90,7 @@ if(!check_function_exists("social_get_object")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("social_get_object_facebook")) {
|
if(!is_fn("social_get_object_facebook")) {
|
||||||
function social_get_object_facebook($adapter, $object_id, $type="post") {
|
function social_get_object_facebook($adapter, $object_id, $type="post") {
|
||||||
$result = false;
|
$result = false;
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file spreadsheet-reader.lnk.php
|
* @file spreadsheet-reader.lnk.php
|
||||||
* @date 2018-09-20
|
* @date 2018-09-20
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Excel file parser
|
* @brief Excel file parser
|
||||||
***/
|
***/
|
||||||
|
|
||||||
if(!check_function_exists("parse_excel_file")) {
|
if(!is_fn("parse_excel_file")) {
|
||||||
function parse_excel_file($filepath, $format="xlsx", $setColumnName=false) {
|
function parse_excel_file($filepath, $format="xlsx", $setColumnName=false) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ if(!check_function_exists("parse_excel_file")) {
|
||||||
|
|
||||||
$spreadsheet = false;
|
$spreadsheet = false;
|
||||||
$columnNames = array();
|
$columnNames = array();
|
||||||
$fileFormat = strtolower($format);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
$fileFormat = strtolower($format);
|
||||||
if($fileFormat == "xlsx") {
|
if($fileFormat == "xlsx") {
|
||||||
$spreadsheet = new SpreadsheetReader_XLSX($filepath);
|
$spreadsheet = new SpreadsheetReader_XLSX($filepath);
|
||||||
} elseif($fileFormat == "xls") {
|
} elseif($fileFormat == "xls") {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @file staticgen.php
|
* @file staticgen.php
|
||||||
* @date 2018-07-22
|
* @date 2018-07-22
|
||||||
* @auther Go Namhyeon <gnh1201@gmail.com>
|
* @auther Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Static Web Generation Tool for ResaonableFramework
|
* @brief Static Web Generation Tool for ResaonableFramework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,57 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file string.utils.php
|
* @file string.utils.php
|
||||||
* @date 2018-05-27
|
* @created_on 2018-05-27
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated_on 2020-02-21
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief String utility helper
|
* @brief String utility helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_converted_string")) {
|
if(!is_fn("get_converted_string")) {
|
||||||
function get_converted_string($str, $to_charset, $from_charset) {
|
function get_converted_string($str, $to_charset="detect", $from_charset="detect") {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
// detect charset (input)
|
||||||
if($form_charset == "detect") {
|
if($form_charset == "detect") {
|
||||||
if(check_function_exists(array("mb_detect_encoding", "mb_detect_order"))) {
|
if(is_fn(array("mb_detect_encoding", "mb_detect_order"))) {
|
||||||
$from_charset = mb_detect_encoding($str, mb_detect_order(), true);
|
$from_charset = mb_detect_encoding($str, mb_detect_order(), true);
|
||||||
} else {
|
} else {
|
||||||
$from_charset = "ISO-8859-1";
|
$from_charset = "ISO-8859-1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(check_function_exists("iconv")) {
|
// detect charset (output)
|
||||||
|
if($to_charset == "detect") {
|
||||||
|
if(is_fn("mb_internal_encoding")) {
|
||||||
|
$to_charset = mb_internal_encoding();
|
||||||
|
} elseif(is_fn("iconv_get_encoding")) {
|
||||||
|
$to_charset = iconv_get_encoding("internal_encoding");
|
||||||
|
} else {
|
||||||
|
$_candidates = array(
|
||||||
|
ini_get("default_charset"),
|
||||||
|
ini_get("iconv.internal_encoding"),
|
||||||
|
ini_get("mbstring.internal_encoding"),
|
||||||
|
"UTF-8"
|
||||||
|
);
|
||||||
|
foreach($_candidates as $_candidate) {
|
||||||
|
if(!empty($_candidate)) {
|
||||||
|
$to_charset = $_candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// normalize charset (UPPERCASE)
|
||||||
|
$from_charset = strtoupper($from_charset);
|
||||||
|
$to_charset = strtoupper($to_charset);
|
||||||
|
|
||||||
|
// test conditions
|
||||||
|
if($from_charset == $to_charset) {
|
||||||
|
$result = $str;
|
||||||
|
} elseif(is_fn("iconv")) {
|
||||||
$result = iconv($from_charset, $to_charset, $str);
|
$result = iconv($from_charset, $to_charset, $str);
|
||||||
} elseif(check_function_exists("mb_convert_encoding")) {
|
} elseif(is_fn("mb_convert_encoding")) {
|
||||||
$result = mb_convert_encoding($str, $to_charset, $from_charset);
|
$result = mb_convert_encoding($str, $to_charset, $from_charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +59,10 @@ if(!check_function_exists("get_converted_string")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("nl2p")) {
|
if(!is_fn("nl2p")) {
|
||||||
function nl2p($string) {
|
function nl2p($str) {
|
||||||
$paragraphs = '';
|
$paragraphs = "";
|
||||||
foreach (explode("\n", $string) as $line) {
|
foreach(explode_by_line($str) as $line) {
|
||||||
if(trim($line)) {
|
if(trim($line)) {
|
||||||
$paragraphs .= '<p>' . $line . '</p>';
|
$paragraphs .= '<p>' . $line . '</p>';
|
||||||
}
|
}
|
||||||
|
@ -40,31 +71,31 @@ if(!check_function_exists("nl2p")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("br2nl")) {
|
if(!is_fn("br2nl")) {
|
||||||
function br2nl($string) {
|
function br2nl($string) {
|
||||||
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
|
return preg_replace('/\<br(\s*)?\/?\>/i', DOC_EOL, $string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("br2p")) {
|
if(!is_fn("br2p")) {
|
||||||
function br2p($string) {
|
function br2p($string) {
|
||||||
return nl2p(br2nl($string));
|
return nl2p(br2nl($string));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_formatted_number")) {
|
if(!is_fn("get_formatted_number")) {
|
||||||
function get_formatted_number($value) {
|
function get_formatted_number($value) {
|
||||||
return number_format(floatval($value));
|
return number_format(floatval($value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_cutted_string")) {
|
if(!is_fn("get_cutted_string")) {
|
||||||
function get_cutted_string($str, $start, $len=0, $charset="utf-8") {
|
function get_cutted_string($str, $start, $len=null, $charset="utf-8") {
|
||||||
$result = "";
|
$result = "";
|
||||||
|
|
||||||
if(check_function_exists("iconv_substr")) {
|
if(is_fn("iconv_substr")) {
|
||||||
$result = iconv_substr($str, $start, $len, $charset);
|
$result = iconv_substr($str, $start, $len, $charset);
|
||||||
} elseif(check_function_exists("mb_substr")) {
|
} elseif(is_fn("mb_substr")) {
|
||||||
$result = mb_substr($str, $start, $len, $charset);
|
$result = mb_substr($str, $start, $len, $charset);
|
||||||
} else {
|
} else {
|
||||||
$result = substr($str, $start, $len);
|
$result = substr($str, $start, $len);
|
||||||
|
@ -74,39 +105,110 @@ if(!check_function_exists("get_cutted_string")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("split_by_line")) {
|
if(!is_fn("get_string_length")) {
|
||||||
function split_by_line($str) {
|
function get_string_length($str, $charset="utf-8") {
|
||||||
|
$len = 0;
|
||||||
|
|
||||||
|
if(is_fn("iconv_strlen")) {
|
||||||
|
$len = iconv_strlen($str, $charset);
|
||||||
|
} elseif(is_fn("mb_strlen")) {
|
||||||
|
$len = mb_strlen($str, $charset);
|
||||||
|
} else {
|
||||||
|
$len = strlen($str);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_splitted_strings")) {
|
||||||
|
function get_splitted_strings($str, $len=32, $chsarset="utf-8") {
|
||||||
|
$strings = array();
|
||||||
|
|
||||||
|
$_len = get_string_length($str);
|
||||||
|
$_pos = 0;
|
||||||
|
if($len >= $_len) {
|
||||||
|
$strings[] = $str;
|
||||||
|
} else {
|
||||||
|
$__len = ceil($_len / $len);
|
||||||
|
for($i = 0; $i < $__len; $i++) {
|
||||||
|
$_pos = $len * $i;
|
||||||
|
$strings[] = get_cutted_string($str, $_pos, $len, $charset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_len - $_pos > 0) {
|
||||||
|
$strings[] = $strings[] = get_cutted_string($str, $_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $strings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("explode_by_line")) {
|
||||||
|
function explode_by_line($str) {
|
||||||
return preg_split('/\n|\r\n?/', $str);
|
return preg_split('/\n|\r\n?/', $str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("read_storage_file_by_line")) {
|
// Deprecated: split_by_line()
|
||||||
function read_storage_file_by_line($filename, $options=array()) {
|
if(!is_fn("split_by_line")) {
|
||||||
return split_by_line(read_storage_file($filename, $options));
|
function split_by_line($str) {
|
||||||
|
return explode_by_line($str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
|
if(!is_fn("explode_storage_file_by_line")) {
|
||||||
if(!check_function_exists("startsWith")) {
|
function explode_storage_file_by_line($filename, $options=array()) {
|
||||||
function startsWith($haystack, $needle) {
|
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);
|
$length = strlen($needle);
|
||||||
return (substr($haystack, 0, $length) === $needle);
|
return (substr($haystack, 0, $length) === $needle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("endsWith")) {
|
if(!is_fn("is_suffix")) {
|
||||||
function endsWith($haystack, $needle) {
|
function is_suffix($haystack, $needle) {
|
||||||
$length = strlen($needle);
|
$length = strlen($needle);
|
||||||
if($length == 0) {
|
if($length == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (substr($haystack, -$length) === $needle);
|
return (substr($haystack, -$length) === $needle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/4955433/php-multiple-delimiters-in-explode/27767665#27767665
|
if(!is_fn("multi_explode")) {
|
||||||
if(!check_function_exists("multi_explode")) {
|
|
||||||
function multi_explode($delimiters, $string) {
|
function multi_explode($delimiters, $string) {
|
||||||
$ready = str_replace($delimiters, $delimiters[0], $string);
|
$ready = str_replace($delimiters, $delimiters[0], $string);
|
||||||
$launch = explode($delimiters[0], $ready);
|
$launch = explode($delimiters[0], $ready);
|
||||||
|
@ -114,7 +216,7 @@ if(!check_function_exists("multi_explode")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("multi_strpos")) {
|
if(!is_fn("multi_strpos")) {
|
||||||
function multi_strpos($string, $delimiters, $offset=0) {
|
function multi_strpos($string, $delimiters, $offset=0) {
|
||||||
$last_pos = strlen($string) - 1;
|
$last_pos = strlen($string) - 1;
|
||||||
$pos = $last_pos;
|
$pos = $last_pos;
|
||||||
|
@ -134,25 +236,7 @@ if(!check_function_exists("multi_strpos")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("multi_str_split")) {
|
if(!is_fn("parse_pipelined_data")) {
|
||||||
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(!check_function_exists("parse_pipelined_data")) {
|
|
||||||
function parse_pipelined_data($pipelined_data, $keynames=array()) {
|
function parse_pipelined_data($pipelined_data, $keynames=array()) {
|
||||||
$result = array();
|
$result = array();
|
||||||
$parsed_data = explode("|", $pipelined_data);
|
$parsed_data = explode("|", $pipelined_data);
|
||||||
|
@ -171,14 +255,27 @@ if(!check_function_exists("parse_pipelined_data")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_tokenized_text")) {
|
// https://stackoverflow.com/questions/10290849/how-to-remove-multiple-utf-8-bom-sequences
|
||||||
function get_tokenized_text($text, $delimiters=array(",", " ", "|", "-", "+")) {
|
if(!is_fn("remove_utf8_bom")) {
|
||||||
return array_filter(multi_explode($delimiters, $text));
|
function remove_utf8_bom($text) {
|
||||||
|
$bom = pack('H*','EFBBBF');
|
||||||
|
$text = preg_replace("/^$bom/", '', $text);
|
||||||
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_highlighted_html_by_words")) {
|
if(!is_fn("get_tokenized_text")) {
|
||||||
function get_highlighted_html_by_word($word, $text, $delimiters=array(",", " ", "|", "-", "+")) {
|
function get_tokenized_text($text, $delimiters=array()) {
|
||||||
|
if(count($delimiters) > 0) {
|
||||||
|
return array_values(array_filter(multi_explode($delimiters, $text)));
|
||||||
|
} else {
|
||||||
|
return preg_split('/\s+/', $text, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_highlighted_html_by_words")) {
|
||||||
|
function get_highlighted_html_by_word($word, $text, $delimiters=array()) {
|
||||||
$html = $text;
|
$html = $text;
|
||||||
|
|
||||||
$words = get_tokenized_text($word, $delimiters);
|
$words = get_tokenized_text($word, $delimiters);
|
||||||
|
@ -190,14 +287,32 @@ if(!check_function_exists("get_highlighted_html_by_words")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("eregi_compatible")) {
|
if(!is_fn("get_floating_percentage")) {
|
||||||
function eregi_compatible($pattern, $subject, &$matches=NULL) {
|
function get_floating_percentage($x, $a=5) {
|
||||||
|
return round(floatval($x) / 100.0, $a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
return preg_match(sprintf("/%s/i", $pattern), $subject, $matches);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("eregi_replace_compatible")) {
|
if(!is_fn("eregi_replace")) {
|
||||||
function eregi_replace_compatible($pattern, $replacement, $subject) {
|
function eregi_replace($pattern, $replacement, $subject) {
|
||||||
return preg_replace(sprintf("/%s/i", $pattern), $replacement, $subject);
|
return preg_replace(sprintf("/%s/i", $pattern), $replacement, $subject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file tablewiz.php
|
* @file tablewiz.php
|
||||||
* @date 2018-02-26
|
* @date 2018-02-26
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief TableWiz helper
|
* @brief TableWiz helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("tablewiz_cut_str")) {
|
if(!is_fn("tablewiz_cut_str")) {
|
||||||
function tablewiz_cut_str($str, $strlimit=0) {
|
function tablewiz_cut_str($str, $strlimit=0) {
|
||||||
$plaintext = strip_tags($str);
|
$plaintext = strip_tags($str);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ if(!check_function_exists("tablewiz_cut_str")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("tablewiz_create")) {
|
if(!is_fn("tablewiz_create")) {
|
||||||
function tablewiz_create($rows, $bind=array(), $domid="", $domclass="", $strlimit=0, $thead_html=array(), $tbody_html_list=array()) {
|
function tablewiz_create($rows, $bind=array(), $domid="", $domclass="", $strlimit=0, $thead_html=array(), $tbody_html_list=array()) {
|
||||||
$html = "";
|
$html = "";
|
||||||
|
|
||||||
|
|
36
helper/thumbnail.youtube.php
Normal file
36
helper/thumbnail.youtube.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if(!is_fn("get_youtube_thumbnail")) {
|
||||||
|
function get_youtube_thumbnail($vi) {
|
||||||
|
$ytimgs = array();
|
||||||
|
$ytimg_urls = array();
|
||||||
|
|
||||||
|
$ytimg_url = "http://img.youtube.com/vi/:vi/:rs.jpg";
|
||||||
|
$ytimg_types = array(
|
||||||
|
"t0" => "0",
|
||||||
|
"t1" => "1",
|
||||||
|
"t2" => "2",
|
||||||
|
"t3" => "3",
|
||||||
|
"de" => "default",
|
||||||
|
"mq" => "mqdefault",
|
||||||
|
"hq" => "hqdefault",
|
||||||
|
"sd" => "sddefault",
|
||||||
|
"mx" => "maxresdefault"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($ytimg_types as $k=>$v) {
|
||||||
|
$url = get_web_binded_url($ytimg_url, array(
|
||||||
|
"vi" => $vi,
|
||||||
|
"rs" => $v
|
||||||
|
));
|
||||||
|
$response = get_web_page($url, "get.cache");
|
||||||
|
$ytimgs[$k] = $response['content'];
|
||||||
|
$fpath = write_storage_file($response['content'], array(
|
||||||
|
"filename" => $response['sha1']
|
||||||
|
));
|
||||||
|
$ytimg_urls[$k] = get_storage_url() . "/" . $response['sha1'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ytimg_urls;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,12 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* @file timetool.php
|
* @file timetool.php
|
||||||
* @date 2018-09-26
|
* @date 2018-09-26
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Time tools
|
* @brief Time tools
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Query a time server (C) 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */
|
/* Query a time server (C) 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */
|
||||||
if(!check_function_exists("query_time_server")) {
|
if(!is_fn("query_time_server")) {
|
||||||
function query_time_server($timeserver, $socket) {
|
function query_time_server($timeserver, $socket) {
|
||||||
// parameters: server, socket, error code, error text, timeout
|
// parameters: server, socket, error code, error text, timeout
|
||||||
$fp = fsockopen($timeserver,$socket,$err,$errstr,5);
|
$fp = fsockopen($timeserver,$socket,$err,$errstr,5);
|
||||||
|
@ -28,7 +28,7 @@ if(!check_function_exists("query_time_server")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_server_time")) {
|
if(!is_fn("get_server_time")) {
|
||||||
function get_server_time($timeserver="time.bora.net") {
|
function get_server_time($timeserver="time.bora.net") {
|
||||||
$timestamp = false;
|
$timestamp = false;
|
||||||
$timercvd = query_time_server($timeserver, 37);
|
$timercvd = query_time_server($timeserver, 37);
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* @file twilio.api.php
|
* @file twilio.api.php
|
||||||
* @date 2019-04-08
|
* @date 2019-04-08
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Twilio REST API interface module
|
* @brief Twilio REST API interface module
|
||||||
* @documentation https://www.twilio.com/docs/sms/send-messages
|
* @documentation https://www.twilio.com/docs/sms/send-messages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("twilio_get_config")) {
|
if(!is_fn("twilio_get_config")) {
|
||||||
function twilio_get_config() {
|
function twilio_get_config() {
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
|
@ -15,47 +15,70 @@ if(!check_function_exists("twilio_get_config")) {
|
||||||
"sid" => get_value_in_array("twilio_sid", $config, ""),
|
"sid" => get_value_in_array("twilio_sid", $config, ""),
|
||||||
"token" => get_value_in_array("twilio_token", $config, ""),
|
"token" => get_value_in_array("twilio_token", $config, ""),
|
||||||
"from" => get_value_in_array("twilio_from", $config, ""),
|
"from" => get_value_in_array("twilio_from", $config, ""),
|
||||||
|
"char_limit" => get_value_in_array("twilio_char_limit", $config, 160)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("twilio_send_message")) {
|
if(!is_fn("twilio_get_message_blocks")) {
|
||||||
|
function twilio_parse_messages($message) {
|
||||||
|
$strings = array();
|
||||||
|
|
||||||
|
$cnf = twilio_get_config();
|
||||||
|
|
||||||
|
if(loadHelper("string.utils")) {
|
||||||
|
$strings = get_splitted_strings($message, $cnf['char_limit']);
|
||||||
|
} else {
|
||||||
|
$strings[] = substr($messages, 0, $cnf['char_limit']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $strings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("twilio_send_message")) {
|
||||||
function twilio_send_message($message, $to) {
|
function twilio_send_message($message, $to) {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$cnf = twilio_get_config();
|
$cnf = twilio_get_config();
|
||||||
|
$messages = twilio_parse_messages($message);
|
||||||
|
|
||||||
if(loadHelper("webpagetool")) {
|
if(loadHelper("webpagetool")) {
|
||||||
$request_url = sprintf("https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json", $sid);
|
$bind = array(
|
||||||
$response = get_web_json($request_url, "post", array(
|
"sid" => $cnf['sid']
|
||||||
|
);
|
||||||
|
$request_url = get_web_binded_url("https://api.twilio.com/2010-04-01/Accounts/:sid/Messages.json", $bind);
|
||||||
|
foreach($messages as $_message) {
|
||||||
|
$response = get_web_json($request_url, "post.cmd", array(
|
||||||
"headers" => array(
|
"headers" => array(
|
||||||
"Content-Type" => "application/x-www-form-urlencoded",
|
"Content-Type" => "application/x-www-form-urlencoded",
|
||||||
"Authentication" => array("Basic", $cnf['sid'], $cnf['token']),
|
"Authentication" => array("Basic", $cnf['sid'], $cnf['token']),
|
||||||
),
|
),
|
||||||
"data" => array(
|
"data" => array(
|
||||||
"Body" => $message,
|
"Body" => $_message,
|
||||||
"From" => $cnf['from'],
|
"From" => $cnf['from'],
|
||||||
"To" => $to,
|
"To" => $to,
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("twilio_send_voice")) {
|
if(!is_fn("twilio_send_voice")) {
|
||||||
function twilio_send_voice($message="", $to) {
|
function twilio_send_voice($message="", $to) {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$cnf = twilio_get_config();
|
$cnf = twilio_get_config();
|
||||||
$url = "http://demo.twilio.com/docs/voice.xml";
|
$url = "http://catswords.re.kr/ep/storage/data/voice.xml";
|
||||||
|
|
||||||
var_dump($cnf);
|
|
||||||
|
|
||||||
|
|
||||||
if(loadHelper("webpagetool")) {
|
if(loadHelper("webpagetool")) {
|
||||||
$request_url = sprintf("https://api.twilio.com/2010-04-01/Accounts/%s/Calls.json", $cnf['sid']);
|
$bind = array(
|
||||||
|
"sid" => $cnf['sid']
|
||||||
|
);
|
||||||
|
$request_url = sprintf("https://api.twilio.com/2010-04-01/Accounts/:sid/Calls.json", $bind);
|
||||||
$response = get_web_page($request_url, "post.cmd", array(
|
$response = get_web_page($request_url, "post.cmd", array(
|
||||||
"headers" => array(
|
"headers" => array(
|
||||||
"Content-Type" => "application/x-www-form-urlencoded",
|
"Content-Type" => "application/x-www-form-urlencoded",
|
||||||
|
@ -67,8 +90,6 @@ if(!check_function_exists("twilio_send_voice")) {
|
||||||
"To" => $to,
|
"To" => $to,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
var_dump($response);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file vworld.php
|
* @file vworld.php
|
||||||
* @date 2018-01-11
|
* @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)
|
* @brief Geo Helper based on vWorld (vworld.kr, molit.go.kr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("vworld_utf8_replace")) {
|
if(!is_fn("vworld_utf8_replace")) {
|
||||||
function vworld_utf8_replace($data) {
|
function vworld_utf8_replace($data) {
|
||||||
$regex = <<<'END'
|
$regex = <<<'END'
|
||||||
/
|
/
|
||||||
|
@ -32,7 +32,7 @@ END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("vworld_geocode_keyword")) {
|
if(!is_fn("vworld_geocode_keyword")) {
|
||||||
function vworld_geocode_keyword($keyword, $category="Poi", $multiple=false) {
|
function vworld_geocode_keyword($keyword, $category="Poi", $multiple=false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ if(!check_function_exists("vworld_geocode_keyword")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get geocode from vworld
|
// get geocode from vworld
|
||||||
if(!check_function_exists("vworld_geocode_addr2coord")) {
|
if(!is_fn("vworld_geocode_addr2coord")) {
|
||||||
function vworld_geocode_addr2coord($addr) {
|
function vworld_geocode_addr2coord($addr) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ if(!check_function_exists("vworld_geocode_addr2coord")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("vworld_adaptive_addr2coord")) {
|
if(!is_fn("vworld_adaptive_addr2coord")) {
|
||||||
function vworld_adaptive_addr2coord($addr) {
|
function vworld_adaptive_addr2coord($addr) {
|
||||||
$geopoint = array(
|
$geopoint = array(
|
||||||
"address" => "",
|
"address" => "",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file webhooktool.php
|
* @file webhooktool.php
|
||||||
* @date 2019-05-04
|
* @date 2019-05-04
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief WebhookTools
|
* @brief WebhookTools
|
||||||
* @trademark
|
* @trademark
|
||||||
* * `NateOn` is trademark of SK Communications Co Ltd., SK Planet Co Ltd., or other SK businesses.
|
* * `NateOn` is trademark of SK Communications Co Ltd., SK Planet Co Ltd., or other SK businesses.
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
* * `Slack` is trademark of Slack Technologies Inc.
|
* * `Slack` is trademark of Slack Technologies Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("send_web_hook")) {
|
if(!is_fn("send_web_hook")) {
|
||||||
function send_web_hook($message, $networkid, $options=array()) {
|
function send_web_hook($message, $networkid, $options=array()) {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,34 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file webpagetool.php
|
* @file webpagetool.php
|
||||||
* @date 2018-06-01
|
* @created_on 2018-06-01
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated_on 2021-02-01
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief WebPageTool helper
|
* @brief WebPageTool helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/****** START EXAMPLES *****/
|
/****** EXAMPLES { *****/
|
||||||
/* // REQUEST GET: $response = get_web_page($url, "get", $data); */
|
/* * GET: $response = get_web_page($url, "get", $data); */
|
||||||
/* // REQUEST POST: $response = get_web_page($url, "post", $data); */
|
/* * POST: $response = get_web_page($url, "post", $data); */
|
||||||
/* // REQUEST GET with CACHE: $response = get_web_page($url, "get.cache", $data); */
|
/* * GET/ASYNC: $response = get_web_page($url, "get.async", $data); */
|
||||||
/* // REQUEST POST with CACHE: $response = get_web_page($url, "post.cache", $data); */
|
/* * GET/CACHE: $response = get_web_page($url, "get.cache", $data); */
|
||||||
/* // REQUEST GET by CMD with CACHE: $response = get_web_page($url, "get.cmd.cache"); */
|
/* * POST/CACHE: $response = get_web_page($url, "post.cache", $data); */
|
||||||
/* // REQUEST GET by SOCK with CACHE: $response = get_web_page($url, "get.sock.cache"); */
|
/* * GET/CMD/CACHE: $response = get_web_page($url, "get.cmd.cache"); */
|
||||||
/* // REQUEST GET by FGC: $response = get_web_page($url, "get.fgc"); */
|
/* * GET/CMD/CACHE: $response = get_web_page($url, "get.sock.cache"); */
|
||||||
/* // REQUEST GET by WGET: $response = get_web_page($url, "get.wget"); */
|
/* * GET/FGC: $response = get_web_page($url, "get.fgc"); */
|
||||||
/* // PRINT CONTENT: echo $response['content']; */
|
/* * GET/WGET: $response = get_web_page($url, "get.wget"); */
|
||||||
/****** END EXAMPLES *****/
|
/* * GET/ARIA: $response = get_web_page($url, "get.aria"); */
|
||||||
|
/* * GET/HTTPIE: $response = get_web_page($url, "get.httpie"); */
|
||||||
|
/* * PRINT: echo $response['content']; */
|
||||||
|
/****** } // END EXAMPLES *****/
|
||||||
|
|
||||||
if(!check_function_exists("get_web_fgc")) {
|
if(!is_fn("get_web_fgc")) {
|
||||||
function get_web_fgc($url) {
|
function get_web_fgc($url) {
|
||||||
return (ini_get("allow_url_fopen") ? file_get_contents($url) : false);
|
return (ini_get("allow_url_fopen") ? file_get_contents($url) : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_build_qs")) {
|
if(!is_fn("get_web_build_qs")) {
|
||||||
function get_web_build_qs($url="", $data) {
|
function get_web_build_qs($url="", $data) {
|
||||||
$qs = "";
|
$qs = "";
|
||||||
if(empty($url)) {
|
if(empty($url)) {
|
||||||
|
@ -32,19 +36,37 @@ if(!check_function_exists("get_web_build_qs")) {
|
||||||
} else {
|
} else {
|
||||||
$pos = strpos($url, '?');
|
$pos = strpos($url, '?');
|
||||||
if ($pos === false) {
|
if ($pos === false) {
|
||||||
$qs = $url . '?' . http_build_query($data);
|
$qs = $url . '?' . http_build_query($data, '', '&');
|
||||||
} else {
|
} else {
|
||||||
$qs = $url . '&' . http_build_query($data);
|
$qs = $url . '&' . http_build_query($data, '', '&');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $qs;
|
return $qs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_cmd")) {
|
if(!is_fn("get_web_binded_url")) {
|
||||||
|
function get_web_binded_url($url="", $bind) {
|
||||||
|
if(is_array($bind) && check_array_length($bind, 0) > 0) {
|
||||||
|
$bind_keys = array_keys($bind);
|
||||||
|
usort($bind_keys, "compare_db_key_length");
|
||||||
|
foreach($bind_keys as $k) {
|
||||||
|
$url = str_replace(":" . $k, $bind[$k], $url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_web_cmd")) {
|
||||||
function get_web_cmd($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
function get_web_cmd($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||||
$output = "";
|
$output = "";
|
||||||
|
|
||||||
|
// set method
|
||||||
|
$req_methods = explode(".", $method);
|
||||||
|
$method = $req_methods[0];
|
||||||
|
|
||||||
|
// set command
|
||||||
$args = array("curl");
|
$args = array("curl");
|
||||||
$cmd = "";
|
$cmd = "";
|
||||||
|
|
||||||
|
@ -71,13 +93,14 @@ if(!check_function_exists("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") {
|
if($method == "post") {
|
||||||
$args[] = "-X POST"; // set post request (the same as --request)
|
$args[] = "-X POST"; // set post request (the same as --request)
|
||||||
$args[] = sprintf("-A '%s'", get_web_user_agent($ua)); // set agent
|
$args[] = sprintf("-A '%s'", get_web_user_agent($ua)); // set agent
|
||||||
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
|
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
|
||||||
|
|
||||||
foreach($headers as $k=>$v) {
|
foreach($headers as $k=>$v) {
|
||||||
// the same as --header
|
// the same as --header
|
||||||
if(is_array($v)) {
|
if(is_array($v)) {
|
||||||
|
@ -92,11 +115,15 @@ if(!check_function_exists("get_web_cmd")) {
|
||||||
$args[] = sprintf("-H '%s: %s'", make_safe_argument($k), make_safe_argument($v));
|
$args[] = sprintf("-H '%s: %s'", make_safe_argument($k), make_safe_argument($v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_data = array();
|
||||||
foreach($data as $k=>$v) {
|
foreach($data as $k=>$v) {
|
||||||
if(substr($v, 0, 1) == "@") { // if this is a file
|
if(substr($v, 0, 1) == "@") { // if this is a file
|
||||||
// the same as --form
|
// the same as --form
|
||||||
$args[] = sprintf("-F %s='%s'", make_safe_argument($k), make_safe_argument($v));
|
$args[] = sprintf("-F %s='%s'", make_safe_argument($k), make_safe_argument($v));
|
||||||
} else {
|
} else {
|
||||||
|
$_data[$k] = $v;
|
||||||
|
/*
|
||||||
if(array_key_equals("Content-Type", $headers, "multipart/form-data")) {
|
if(array_key_equals("Content-Type", $headers, "multipart/form-data")) {
|
||||||
$args[] = sprintf("-F %s='%s'", make_safe_argument($k), make_safe_argument($v));
|
$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")) {
|
} elseif(array_key_equals("Content-Type", $headers, "application/x-www-form-urlencoded")) {
|
||||||
|
@ -104,19 +131,38 @@ if(!check_function_exists("get_web_cmd")) {
|
||||||
} else { // the same as --data
|
} else { // the same as --data
|
||||||
$args[] = sprintf("-d %s='%s'", make_safe_argument($k), make_safe_argument($v));
|
$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;
|
$args[] = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($method == "jsondata") {
|
if($method == "jsondata" || $method == "rawdata") {
|
||||||
$_data = json_encode($data);
|
|
||||||
$args[] = "-X POST"; // set post request (the same as -X)
|
$args[] = "-X POST"; // set post request (the same as -X)
|
||||||
$args[] = sprintf("-A '%s'", get_web_user_agent($ua)); // set agent
|
$args[] = sprintf("-A '%s'", get_web_user_agent($ua)); // set agent
|
||||||
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
|
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
|
||||||
|
|
||||||
|
if($method == "jsondata") {
|
||||||
|
$_data = json_encode($data);
|
||||||
$headers['Content-Type'] = "application/json;charset=utf-8";
|
$headers['Content-Type'] = "application/json;charset=utf-8";
|
||||||
$headers['Accept'] = "application/json, text/plain, */*";
|
$headers['Accept'] = "application/json, text/plain, */*";
|
||||||
|
} else {
|
||||||
|
// possible: application/octet-stream (RFC2046)
|
||||||
|
$_data = $data;
|
||||||
|
$headers['Content-Type'] = "text/plain;charset=utf-8";
|
||||||
|
$headers['Accept'] = "text/plain, */*";
|
||||||
|
}
|
||||||
|
|
||||||
|
// get content size
|
||||||
$headers['Content-Length'] = strlen($_data);
|
$headers['Content-Length'] = strlen($_data);
|
||||||
|
|
||||||
|
// set headers
|
||||||
foreach($headers as $k=>$v) {
|
foreach($headers as $k=>$v) {
|
||||||
// the same as --header
|
// the same as --header
|
||||||
if(is_array($v)) {
|
if(is_array($v)) {
|
||||||
|
@ -132,12 +178,17 @@ if(!check_function_exists("get_web_cmd")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$args[] = sprintf("--data '%s'", $_data);
|
$args[] = sprintf("--data '%s'", $_data);
|
||||||
$args[] = $url;
|
$args[] = sprintf("'%s'", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// complete and run command
|
// complete and run command
|
||||||
$cmd = trim(implode(" ", $args));
|
$cmd = trim(implode(" ", $args));
|
||||||
|
|
||||||
|
// do async(background)
|
||||||
|
if(in_array("async", $req_methods)) {
|
||||||
|
$cmd = sprintf("%s 1>/dev/null 2>&1 & echo $!;", $cmd);
|
||||||
|
}
|
||||||
|
|
||||||
// run command
|
// run command
|
||||||
if(!empty($cmd)) {
|
if(!empty($cmd)) {
|
||||||
$output = exec_command($cmd);
|
$output = exec_command($cmd);
|
||||||
|
@ -148,7 +199,7 @@ if(!check_function_exists("get_web_cmd")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.epiloum.net/109
|
// http://dev.epiloum.net/109
|
||||||
if(!check_function_exists("get_web_sock")) {
|
if(!is_fn("get_web_sock")) {
|
||||||
function get_web_sock($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_sock($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
$output = "";
|
$output = "";
|
||||||
|
|
||||||
|
@ -235,19 +286,19 @@ if(!check_function_exists("get_web_sock")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_wget")) {
|
if(!is_fn("get_web_wget")) {
|
||||||
function get_web_wget($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_wget($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
$content = false;
|
$content = false;
|
||||||
|
|
||||||
$filename = make_random_id(32);
|
$filename = make_random_id(32);
|
||||||
$filepath = write_storage_file("", array(
|
$fw = write_storage_file("", array(
|
||||||
"filename" => $filename,
|
"filename" => $filename,
|
||||||
"mode" => "fake",
|
"mode" => "fake",
|
||||||
));
|
));
|
||||||
|
|
||||||
$cmd = sprintf("wget '%s' -O %s", $url, $filepath);
|
$cmd = sprintf("wget '%s' -O %s", $url, $fw);
|
||||||
if(loadHelper("exectool")) {
|
if(loadHelper("exectool")) {
|
||||||
exec_command($cmd, "shell_exec");
|
exec_command($cmd);
|
||||||
$content = read_storage_file($filename);
|
$content = read_storage_file($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +306,134 @@ if(!check_function_exists("get_web_wget")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_curl")) {
|
if(!is_fn("get_web_aria")) {
|
||||||
|
function get_web_aria($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||||
|
$content = false;
|
||||||
|
|
||||||
|
$filename = make_random_id(32);
|
||||||
|
$fw = write_storage_file("", array(
|
||||||
|
"filename" => $filename,
|
||||||
|
"mode" => "fake"
|
||||||
|
));
|
||||||
|
|
||||||
|
// init args
|
||||||
|
$args = array();
|
||||||
|
|
||||||
|
// make args
|
||||||
|
$args[] = "aria2c";
|
||||||
|
$args[] = "--out=" . $fw; // set output file
|
||||||
|
$args[] = "--connect-timeout=" . $ct_out; // connection timeout (seconds)
|
||||||
|
$args[] = "--timeout=" . $t_out; // timeout (seconds)
|
||||||
|
|
||||||
|
// set proxy
|
||||||
|
if(!empty($proxy)) {
|
||||||
|
$args[] = "--http-proxy=" . $proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set user agent
|
||||||
|
if(!empty($ua)) {
|
||||||
|
$args[] = "--user-agent=" . $ua;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set headers
|
||||||
|
foreach($headers as $k=>$v) {
|
||||||
|
if(is_array($v)) {
|
||||||
|
if($k == "Authentication") {
|
||||||
|
if($v[0] == "Basic" && check_array_length($v, 3) == 0) {
|
||||||
|
$args[] = sprintf("--header='%s: Basic %s'", $k, base64_decode($v[1] . ":" . $v[2]));
|
||||||
|
} else {
|
||||||
|
$args[] = sprintf("--header='%s: %s %s'", $k, make_safe_argument(implode(" ", $v)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$args[] = sprintf("--header='%s: %s'", make_safe_argument($k), make_safe_argument($v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set URL
|
||||||
|
$args[] = $url;
|
||||||
|
|
||||||
|
// build a command
|
||||||
|
$cmd = implode(" ", $args);
|
||||||
|
|
||||||
|
// execute a command
|
||||||
|
exec_command($cmd);
|
||||||
|
|
||||||
|
// read contents
|
||||||
|
$content = read_storage_file($filename);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_web_httpie")) {
|
||||||
|
function get_web_httpie($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||||
|
$content = false;
|
||||||
|
|
||||||
|
$filename = make_random_id(32);
|
||||||
|
$fw = write_storage_file("", array(
|
||||||
|
"filename" => $filename,
|
||||||
|
"mode" => "fake"
|
||||||
|
));
|
||||||
|
|
||||||
|
// init args
|
||||||
|
$args = array();
|
||||||
|
|
||||||
|
// make args
|
||||||
|
$args[] = "http";
|
||||||
|
|
||||||
|
// set method, URL
|
||||||
|
if($method == "jsondata") {
|
||||||
|
$args[] = "POST";
|
||||||
|
$args[] = $url;
|
||||||
|
$args[] = sprintf("body='%s'", json_encode($data));
|
||||||
|
} elseif($method == "post") {
|
||||||
|
$args[] = "POST";
|
||||||
|
$args[] = $url;
|
||||||
|
$args[] = sprintf("body='%s'", get_web_build_qs("", $data));
|
||||||
|
} else {
|
||||||
|
$args[] = get_web_build_qs($url, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set timeout
|
||||||
|
$args[] = "--timeout=" . $t_out;
|
||||||
|
|
||||||
|
// set proxy
|
||||||
|
if(!empty($proxy)) {
|
||||||
|
$args[] = "--proxy=" . $proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set headers
|
||||||
|
foreach($headers as $k=>$v) {
|
||||||
|
if(is_array($v)) {
|
||||||
|
if($k == "Authentication") {
|
||||||
|
if($v[0] == "Basic" && check_array_length($v, 3) == 0) {
|
||||||
|
$args[] = sprintf("-a '%s:%s'", $v[1], $v[2]);
|
||||||
|
} else {
|
||||||
|
$args[] = sprintf("'%s:%s'", $k, make_safe_argument(implode(" ", $v)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$args[] = sprintf("'%s:%s'", make_safe_argument($k), make_safe_argument($v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set output file
|
||||||
|
$args[] = ">";
|
||||||
|
$args[] = $fw;
|
||||||
|
|
||||||
|
// execute a command
|
||||||
|
$cmd = implode(" ", $args);
|
||||||
|
exec_command($cmd);
|
||||||
|
|
||||||
|
// read contents
|
||||||
|
$content = read_storage_file($filename);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_web_curl")) {
|
||||||
function get_web_curl($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
function get_web_curl($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||||
$content = false;
|
$content = false;
|
||||||
$_headers = array();
|
$_headers = array();
|
||||||
|
@ -291,8 +469,8 @@ if(!check_function_exists("get_web_curl")) {
|
||||||
if(count($data) > 0) {
|
if(count($data) > 0) {
|
||||||
if($method == "post") {
|
if($method == "post") {
|
||||||
foreach($data as $k=>$v) {
|
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(check_function_exists("curl_file_create")) { // php 5.5+
|
if(is_fn("curl_file_create")) { // php 5.5+
|
||||||
$data[$k] = curl_file_create(substr($v, 1));
|
$data[$k] = curl_file_create(substr($v, 1));
|
||||||
} else {
|
} else {
|
||||||
$data[$k] = "@" . realpath(substr($v, 1));
|
$data[$k] = "@" . realpath(substr($v, 1));
|
||||||
|
@ -301,8 +479,12 @@ if(!check_function_exists("get_web_curl")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$options[CURLOPT_POST] = 1;
|
$options[CURLOPT_POST] = 1;
|
||||||
|
if(is_array($data)) {
|
||||||
|
$options[CURLOPT_POSTFIELDS] = get_web_build_qs("", $data);
|
||||||
|
} else {
|
||||||
$options[CURLOPT_POSTFIELDS] = $data;
|
$options[CURLOPT_POSTFIELDS] = $data;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($method == "get") {
|
if($method == "get") {
|
||||||
$options[CURLOPT_URL] = get_web_build_qs($url, $data);
|
$options[CURLOPT_URL] = get_web_build_qs($url, $data);
|
||||||
|
@ -317,12 +499,22 @@ if(!check_function_exists("get_web_curl")) {
|
||||||
$headers['Accept'] = "application/json, text/plain, */*";
|
$headers['Accept'] = "application/json, text/plain, */*";
|
||||||
$headers['Content-Length'] = strlen($_data);
|
$headers['Content-Length'] = strlen($_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($method == "rawdata") {
|
||||||
|
$_data = $data;
|
||||||
|
$options[CURLOPT_CUSTOMREQUEST] = "POST";
|
||||||
|
$options[CURLOPT_POST] = 1;
|
||||||
|
$options[CURLOPT_POSTFIELDS] = $_data;
|
||||||
|
$headers['Content-Type'] = "application/octet-stream";
|
||||||
|
$headers['Accept'] = "application/octet-stream, */*";
|
||||||
|
$headers['Content-Length'] = strlen($_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($headers) > 0) {
|
if(count($headers) > 0) {
|
||||||
foreach($headers as $k=>$v) {
|
foreach($headers as $k=>$v) {
|
||||||
if(is_array($v)) {
|
if(is_array($v)) {
|
||||||
if($k == "Authentication") {
|
if($k == "Authorization" || $k == "Authentication") {
|
||||||
if($v[0] == "Basic" && check_array_length($v, 3) == 0) {
|
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]));
|
$options[CURLOPT_USERPWD] = sprintf("%s:%s", make_safe_argument($v[1]), make_safe_argument($v[2]));
|
||||||
} else {
|
} else {
|
||||||
|
@ -353,7 +545,7 @@ if(!check_function_exists("get_web_curl")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_page")) {
|
if(!is_fn("get_web_page")) {
|
||||||
function get_web_page($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_page($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
$status = false;
|
$status = false;
|
||||||
$resno = false;
|
$resno = false;
|
||||||
|
@ -361,9 +553,22 @@ if(!check_function_exists("get_web_page")) {
|
||||||
$content = false;
|
$content = false;
|
||||||
$_method = $method;
|
$_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
|
// set user agent
|
||||||
$ua = get_web_user_agent($ua);
|
$ua = get_web_user_agent($ua);
|
||||||
|
|
||||||
|
// set method
|
||||||
|
$method = strtolower($method);
|
||||||
|
$req_methods = explode(".", $method);
|
||||||
|
|
||||||
// redefine data
|
// redefine data
|
||||||
$headers = array();
|
$headers = array();
|
||||||
if(array_key_is_array("headers", $data)) {
|
if(array_key_is_array("headers", $data)) {
|
||||||
|
@ -371,26 +576,45 @@ if(!check_function_exists("get_web_page")) {
|
||||||
$data = $data['data'];
|
$data = $data['data'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// set method
|
// redefine data (JSON-RPC 1.1 / JSON-RPC 2.0)
|
||||||
$method = strtolower($method);
|
if(in_array("jsonrpc", $req_methods) && in_array("compatible", $req_methods)) {
|
||||||
$res_methods = explode(".", $method);
|
$req_methods[] = "jsondata";
|
||||||
|
$headers['Content-Type'] = "application/json-rpc";
|
||||||
|
$data = array_merge(array(
|
||||||
|
"jsonrpc" => "1.1"
|
||||||
|
), $data);
|
||||||
|
} elseif(in_array("jsonrpc", $req_methods) || in_array("jsonrpc2", $req_methods)) {
|
||||||
|
$req_methods[] = "jsondata";
|
||||||
|
$headers['Content-Type'] = "application/json-rpc";
|
||||||
|
$data = array_merge(array(
|
||||||
|
"jsonrpc" => "2.0"
|
||||||
|
), $data);
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array("cache", $res_methods)) {
|
// do request
|
||||||
$content = get_web_cache($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
|
if(in_array("cache", $req_methods)) {
|
||||||
} elseif(in_array("cmd", $res_methods)) {
|
$content = get_web_cache($url, $method, $data, $proxy, $ua, $ct_out, $t_out, $headers);
|
||||||
$content = get_web_cmd($url, $res_methods[0], $data, $proxy, $ua, $ct_out, $t_out, $headers);
|
} elseif(in_array("async", $req_methods)) {
|
||||||
} elseif(in_array("fgc", $res_methods)) {
|
$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)) {
|
||||||
$content = get_web_fgc($url);
|
$content = get_web_fgc($url);
|
||||||
} elseif(in_array("sock", $res_methods)) {
|
} elseif(in_array("sock", $req_methods)) {
|
||||||
$content = get_web_sock($url, $res_methods[0], $data, $proxy, $ua, $ct_out, $t_out);
|
$content = get_web_sock($url, $req_methods[0], $data, $proxy, $ua, $ct_out, $t_out);
|
||||||
} elseif(in_array("wget", $res_methods)) {
|
} elseif(in_array("wget", $req_methods)) {
|
||||||
$content = get_web_wget($url, $res_methods[0], $data, $proxy, $ua, $ct_out, $t_out);
|
$content = get_web_wget($url, $req_methods[0], $data, $proxy, $ua, $ct_out, $t_out);
|
||||||
} elseif(in_array("jsondata", $res_methods)) {
|
} elseif(in_array("aria", $req_methods)) {
|
||||||
$_result = get_web_curl($url, "jsondata", $data, $proxy, $ua, $ct_out, $t_out, $headers);
|
$content = get_web_aria($url, $req_methods[0], $data, $proxy, $ua, $ct_out, $t_out);
|
||||||
$content = $_result['content'];
|
} elseif(in_array("httpie", $req_methods)) {
|
||||||
$status = $_result['status'];
|
$content = get_web_httpie($url, $req_methods[0], $data, $proxy, $ua, $ct_out, $t_out);
|
||||||
$resno = $_result['resno'];
|
} elseif(in_array("jsondata", $req_methods)) {
|
||||||
$errno = $_result['errno'];
|
$response = get_web_curl($url, "jsondata", $data, $proxy, $ua, $ct_out, $t_out, $headers);
|
||||||
|
$content = $response['content'];
|
||||||
|
$status = $response['status'];
|
||||||
|
$resno = $response['resno'];
|
||||||
|
$errno = $response['errno'];
|
||||||
|
|
||||||
if(!($content !== false)) {
|
if(!($content !== false)) {
|
||||||
$content = get_web_cmd($url, "jsondata", $data, $proxy, $ua, $ct_out, $t_out, $headers);
|
$content = get_web_cmd($url, "jsondata", $data, $proxy, $ua, $ct_out, $t_out, $headers);
|
||||||
|
@ -421,6 +645,7 @@ if(!check_function_exists("get_web_page")) {
|
||||||
"resno" => $resno,
|
"resno" => $resno,
|
||||||
"errno" => $errno,
|
"errno" => $errno,
|
||||||
"id" => get_web_identifier($url, $method, $data),
|
"id" => get_web_identifier($url, $method, $data),
|
||||||
|
"pid" => $pid,
|
||||||
"md5" => get_hashed_text($content, "md5"),
|
"md5" => get_hashed_text($content, "md5"),
|
||||||
"sha1" => get_hashed_text($content, "sha1"),
|
"sha1" => get_hashed_text($content, "sha1"),
|
||||||
"gz_content" => get_hashed_text($gz_content, "base64"),
|
"gz_content" => get_hashed_text($gz_content, "base64"),
|
||||||
|
@ -429,49 +654,106 @@ if(!check_function_exists("get_web_page")) {
|
||||||
"gz_sha1" => get_hashed_text($gz_content, "sha1"),
|
"gz_sha1" => get_hashed_text($gz_content, "sha1"),
|
||||||
"gz_ratio" => $gz_ratio,
|
"gz_ratio" => $gz_ratio,
|
||||||
"method" => $_method,
|
"method" => $_method,
|
||||||
"params" => $data,
|
"headers" => $headers,
|
||||||
|
"params" => $data
|
||||||
);
|
);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_identifier")) {
|
if(!is_fn("get_web_identifier")) {
|
||||||
function get_web_identifier($url, $method="get", $data=array()) {
|
function get_web_identifier($url, $method="get", $data=array(), $headers=array()) {
|
||||||
$hash_data = (count($data) > 0) ? get_hashed_text(serialize($data)) : "*";
|
$checksum_data = (count($data) > 0) ? get_hashed_text(serialize($data)) : "*";
|
||||||
return get_hashed_text(sprintf("%s.%s.%s", get_hashed_text($method), get_hashed_text($url), $hash_data));
|
$checksum_header = (count($headers) > 0) ? get_hashed_text(serialize($data)) : "*";
|
||||||
|
$checksum_method = get_hashed_text($method);
|
||||||
|
$checksum_url = get_hashed_text($url);
|
||||||
|
|
||||||
|
$checksums = array($checksum_method, $checksum_url, $checksum_data);
|
||||||
|
if($checksum_header != "*") { // compatible below 1.6
|
||||||
|
$checksums[] = $checksum_header;
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_hashed_text(implode(".", $checksums));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_cache")) {
|
if(!is_fn("get_web_async")) {
|
||||||
function get_web_cache($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_async($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||||
|
$pid = 0;
|
||||||
|
|
||||||
|
$_method = sprintf("%s.%s", $method, "async");
|
||||||
|
$pid = get_web_cmd($url, $_method, $data, $proxy, $ua, $ct_out, $t_out, $headers);
|
||||||
|
|
||||||
|
return $pid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_web_cache")) {
|
||||||
|
function get_web_cache($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||||
$content = false;
|
$content = false;
|
||||||
|
$config = get_config();
|
||||||
|
|
||||||
|
$cache_enabled = array_key_equals("cache_enabled", $config, 1);
|
||||||
|
// max_age(seconds), the value 0 is forever
|
||||||
|
$cache_max_age = intval(get_value_in_array("cache_max_age", $config, 0));
|
||||||
|
$cache_hits = 0;
|
||||||
|
|
||||||
|
$gz_content = false;
|
||||||
|
if($cache_enabled) {
|
||||||
$identifier = get_web_identifier($url, $method, $data);
|
$identifier = get_web_identifier($url, $method, $data);
|
||||||
$gz_content = read_storage_file($identifier, array(
|
$gz_content = read_storage_file($identifier, array(
|
||||||
"storage_type" => "cache"
|
"storage_type" => "cache",
|
||||||
|
"max_age" => $cache_max_age
|
||||||
));
|
));
|
||||||
|
|
||||||
if($gz_content === false) {
|
write_common_log("cache_max_age: " . $cache_max_age, "helper/webpagetool");
|
||||||
$no_cache_method = str_replace(".cache", "", $method);
|
if($gz_content !== false) {
|
||||||
$response = get_web_page($url, $no_cache_method, $data, $proxy, $ua, $ct_out, $t_out);
|
$content = gzinflate($gz_content);
|
||||||
$content = $response['content'];
|
$cache_hits++;
|
||||||
$gz_content = gzdeflate($content);
|
write_common_log(sprintf("Cache hit. %s, %s, %s", $identifier, strlen($content), strlen($gz_content)), "helper/webpagetool");
|
||||||
|
} else {
|
||||||
|
write_common_log(sprintf("Cache no hit. %s", $identifier), "helper/webpagetool");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// save web page cache
|
if($cache_hits == 0) {
|
||||||
write_storage_file($gz_content, array(
|
$_old_methods = explode(".", $method);
|
||||||
|
$_new_methods = array();
|
||||||
|
foreach($_old_methods as $v) {
|
||||||
|
if($v != "cache") {
|
||||||
|
$_new_methods[] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$_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);
|
||||||
|
$content = $response['content'];
|
||||||
|
if($cache_enabled) {
|
||||||
|
$gz_content = gzdeflate($content);
|
||||||
|
$fw = write_storage_file($gz_content, array(
|
||||||
"storage_type" => "cache",
|
"storage_type" => "cache",
|
||||||
"filename" => $identifier
|
"filename" => $identifier
|
||||||
));
|
));
|
||||||
} else {
|
if(!$fw) {
|
||||||
$content = gzinflate($gz_content);
|
write_common_log("Failed to write cache file", "helper/webpagetool");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_json")) {
|
if(!is_fn("get_web_json")) {
|
||||||
function get_web_json($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_json($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
@ -484,7 +766,7 @@ if(!check_function_exists("get_web_json")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_dom")) {
|
if(!is_fn("get_web_dom")) {
|
||||||
function get_web_dom($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_dom($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
$result = false;
|
$result = false;
|
||||||
$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);
|
||||||
|
@ -498,7 +780,7 @@ if(!check_function_exists("get_web_dom")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_meta")) {
|
if(!is_fn("get_web_meta")) {
|
||||||
function get_web_meta($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_meta($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
$result = false;
|
$result = false;
|
||||||
$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);
|
||||||
|
@ -515,7 +797,7 @@ if(!check_function_exists("get_web_meta")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_xml")) {
|
if(!is_fn("get_web_xml")) {
|
||||||
function get_web_xml($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
function get_web_xml($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
@ -528,7 +810,22 @@ if(!check_function_exists("get_web_xml")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_parsed_json")) {
|
if(!is_fn("get_web_cspt")) {
|
||||||
|
function get_web_cspt($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
$response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
|
||||||
|
if($response['size'] > 0) {
|
||||||
|
if(loadHelper("casplit.format")) {
|
||||||
|
$result = catsplit_decode($response['content']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("get_parsed_json")) {
|
||||||
function get_parsed_json($raw, $options=array()) {
|
function get_parsed_json($raw, $options=array()) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
|
@ -542,11 +839,11 @@ if(!check_function_exists("get_parsed_json")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_parsed_xml")) {
|
if(!is_fn("get_parsed_xml")) {
|
||||||
function get_parsed_xml($raw, $options=array()) {
|
function get_parsed_xml($raw, $options=array()) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
if(check_function_exists("simplexml_load_string")) {
|
if(is_fn("simplexml_load_string")) {
|
||||||
$result = simplexml_load_string($response['content'], null, LIBXML_NOCDATA);
|
$result = simplexml_load_string($response['content'], null, LIBXML_NOCDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,12 +851,12 @@ if(!check_function_exists("get_parsed_xml")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_parsed_dom")) {
|
if(!is_fn("get_parsed_dom")) {
|
||||||
function get_parsed_dom($raw, $options=array()) {
|
function get_parsed_dom($raw, $options=array()) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
if(loadHelper("simple_html_dom")) {
|
if(loadHelper("simple_html_dom")) {
|
||||||
$result = check_function_exists("str_get_html") ? str_get_html($response['content']) : $raw;
|
$result = is_fn("str_get_html") ? str_get_html($response['content']) : $raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -567,25 +864,16 @@ if(!check_function_exists("get_parsed_dom")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters
|
// 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters
|
||||||
if(!check_function_exists("get_adaptive_json")) {
|
if(!is_fn("get_adaptive_json")) {
|
||||||
function get_adaptive_json($data) {
|
function get_adaptive_json($data) {
|
||||||
$result = "";
|
if(loadHelper("json.format")) {
|
||||||
$lines = array();
|
return json_encode_ex($data, array("adaptive" => true));
|
||||||
foreach($data as $k=>$v) {
|
|
||||||
if(is_array($v)) {
|
|
||||||
$lines[] = sprintf("\"%s\":%s", make_safe_argument($k), get_adaptive_json($v));
|
|
||||||
} else {
|
|
||||||
$lines[] = sprintf("\"%s\":\"%s\"", make_safe_argument($k), make_safe_argument($v));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result = "{" . implode(",", $lines) . "}";
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2018-09-10: support webproxy
|
// 2018-09-10: support webproxy
|
||||||
if(!check_function_exists("get_webproxy_url")) {
|
if(!is_fn("get_webproxy_url")) {
|
||||||
function get_webproxy_url($url, $route="webproxy") {
|
function get_webproxy_url($url, $route="webproxy") {
|
||||||
return get_route_link($route, array(
|
return get_route_link($route, array(
|
||||||
"url" => $url
|
"url" => $url
|
||||||
|
@ -593,10 +881,10 @@ if(!check_function_exists("get_webproxy_url")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_web_user_agent")) {
|
if(!is_fn("get_web_user_agent")) {
|
||||||
function get_web_user_agent($ua="") {
|
function get_web_user_agent($ua="") {
|
||||||
if(empty($ua)) {
|
if(empty($ua)) {
|
||||||
$ua = "ReasonableFramework/1.4 (https://github.com/gnh1201/reasonableframework)";
|
$ua = "ReasonableFramework/1.6.7-preview1 (Server; PHP " . phpversion() . "; https://catswords.social/@catswords_oss; abuse@catswords.net)";
|
||||||
} else {
|
} else {
|
||||||
$ua = make_safe_argument($ua);
|
$ua = make_safe_argument($ua);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* @file wprest.php
|
* @file wprest.php
|
||||||
* @date 2018-03-14
|
* @date 2018-03-14
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Wordpress Rest API helper
|
* @brief Wordpress Rest API helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_wp_posts")) {
|
if(!is_fn("get_wp_posts")) {
|
||||||
function get_wp_posts($wp_server_url) {
|
function get_wp_posts($wp_server_url) {
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ if(!check_function_exists("get_wp_posts")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("parse_wp_posts")) {
|
if(!is_fn("parse_wp_posts")) {
|
||||||
function parse_wp_posts($wp_server_url) {
|
function parse_wp_posts($wp_server_url) {
|
||||||
$rest_no_route = false;
|
$rest_no_route = false;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ if(!check_function_exists("parse_wp_posts")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_wp_new_message")) {
|
if(!is_fn("get_wp_new_message")) {
|
||||||
function get_wp_new_message($title, $content, $link="") {
|
function get_wp_new_message($title, $content, $link="") {
|
||||||
$new_message = "";
|
$new_message = "";
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ if(!check_function_exists("get_wp_new_message")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("authenticate_wp")) {
|
if(!is_fn("authenticate_wp")) {
|
||||||
function authenticate_wp($wp_server_url, $client_id, $client_secret, $route="", $code="", $scope="basic", $state="") {
|
function authenticate_wp($wp_server_url, $client_id, $client_secret, $route="", $code="", $scope="basic", $state="") {
|
||||||
$flag = false;
|
$flag = false;
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ if(!check_function_exists("authenticate_wp")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("write_wp_post")) {
|
if(!is_fn("write_wp_post")) {
|
||||||
function write_wp_post($wp_server_url, $access_token, $data=array()) {
|
function write_wp_post($wp_server_url, $access_token, $data=array()) {
|
||||||
$default_data = array(
|
$default_data = array(
|
||||||
"title" => "Untitled",
|
"title" => "Untitled",
|
||||||
|
@ -201,7 +201,7 @@ if(!check_function_exists("write_wp_post")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_wp_categories")) {
|
if(!is_fn("get_wp_categories")) {
|
||||||
function get_wp_categories($wp_server_url, $access_token) {
|
function get_wp_categories($wp_server_url, $access_token) {
|
||||||
$response = get_web_json(get_web_build_qs($wp_server_url, array(
|
$response = get_web_json(get_web_build_qs($wp_server_url, array(
|
||||||
"rest_route" => "/wp/v2/categories"
|
"rest_route" => "/wp/v2/categories"
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file zabbix.api.php
|
* @file zabbix.api.php
|
||||||
* @date 2019-04-08
|
* @created_on 2019-04-08
|
||||||
* @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
|
* @brief Zabbix JSON-RPC API (3.0) interface module
|
||||||
* @documentation https://www.zabbix.com/documentation/3.0/manual/api
|
* @documentation https://www.zabbix.com/documentation/current/ (4.4)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!check_function_exists("get_zabbix_config")) {
|
if(!is_fn("get_zabbix_config")) {
|
||||||
function get_zabbix_config() {
|
function get_zabbix_config() {
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
|
@ -20,20 +21,20 @@ if(!check_function_exists("get_zabbix_config")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zabbix_get_base_url")) {
|
if(!is_fn("zabbix_get_base_url")) {
|
||||||
function zabbix_get_api_url() {
|
function zabbix_get_api_url() {
|
||||||
$cnf = get_zabbix_config();
|
$cnf = get_zabbix_config();
|
||||||
return sprintf("%s://%s/zabbix/api_jsonrpc.php", $cnf['protocol'], $cnf['host']);
|
return sprintf("%s://%s/zabbix/api_jsonrpc.php", $cnf['protocol'], $cnf['host']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zabbix_get_id")) {
|
if(!is_fn("zabbix_get_id")) {
|
||||||
function zabbix_get_id() {
|
function zabbix_get_id() {
|
||||||
return rand(10000, 99999) * rand(10000, 99999);
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zabbix_authenticate")) {
|
if(!is_fn("zabbix_authenticate")) {
|
||||||
function zabbix_authenticate() {
|
function zabbix_authenticate() {
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
@ -45,93 +46,276 @@ if(!check_function_exists("zabbix_authenticate")) {
|
||||||
|
|
||||||
// connect to zabbix server
|
// connect to zabbix server
|
||||||
if(loadHelper("webpagetool")) {
|
if(loadHelper("webpagetool")) {
|
||||||
$response = get_web_json($zabbix_api_url, "jsondata", array(
|
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
|
||||||
"headers" => array(
|
|
||||||
"Content-Type" => "application/json-rpc",
|
|
||||||
),
|
|
||||||
"data" => array(
|
|
||||||
"jsonrpc" => "2.0",
|
|
||||||
"method" => "user.login",
|
"method" => "user.login",
|
||||||
"params" => array(
|
"params" => array(
|
||||||
"user" => $cnf['username'],
|
"user" => $cnf['username'],
|
||||||
"password" => $cnf['password'],
|
"password" => $cnf['password'],
|
||||||
),
|
),
|
||||||
"id" => zabbix_get_id(),
|
"id" => zabbix_get_id(),
|
||||||
"auth" => null,
|
"auth" => null
|
||||||
),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set connection to global scope
|
// set connection to global scope
|
||||||
set_scope("zabbix_api_url", $zabbix_api_url);
|
set_shared_var("zabbix_api_url", $zabbix_api_url);
|
||||||
set_scope("zabbix_auth", get_property_value("result", $response));
|
set_shared_var("zabbix_auth", get_property_value("result", $response));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zabbix_retrieve_hosts")) {
|
if(!is_fn("zabbix_get_hostgroups")) {
|
||||||
function zabbix_retrieve_hosts() {
|
function zabbix_get_hostgroups() {
|
||||||
|
$hostgroups = false;
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
// get zabbix authentication
|
// get zabbix authentication
|
||||||
$zabbix_api_url = get_scope("zabbix_api_url");
|
$zabbix_api_url = get_shared_var("zabbix_api_url");
|
||||||
$zabbix_auth = get_scope("zabbix_auth");
|
$zabbix_auth = get_shared_var("zabbix_auth");
|
||||||
|
|
||||||
// connect to zabbix server
|
// connect to zabbix server
|
||||||
if(loadHelper("webpagetool")) {
|
if(loadHelper("webpagetool")) {
|
||||||
$response = get_web_json($zabbix_api_url, "jsondata", array(
|
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
|
||||||
"headers" => array(
|
"method" => "hostgroup.get",
|
||||||
"Content-Type" => "application/json-rpc",
|
|
||||||
),
|
|
||||||
"data" => array(
|
|
||||||
"jsonrpc" => "2.0",
|
|
||||||
"method" => "host.get",
|
|
||||||
"params" => array(
|
"params" => array(
|
||||||
"output" => array("hostid", "host"),
|
"output" => "extend"
|
||||||
"selectInterfaces" => array("interfaceid", "ip"),
|
|
||||||
),
|
),
|
||||||
"id" => zabbix_get_id(),
|
"id" => zabbix_get_id(),
|
||||||
"auth" => $zabbix_auth,
|
"auth" => $zabbix_auth
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$hostgroups = get_property_value("result", $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $hostgroups;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zabbix_get_items")) {
|
if(!is_fn("zabbix_get_hosts")) {
|
||||||
function zabbix_get_items($hostids="") {
|
function zabbix_get_hosts() {
|
||||||
|
$hosts = false;
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
// get zabbix authentication
|
// get zabbix authentication
|
||||||
$zabbix_api_url = get_scope("zabbix_api_url");
|
$zabbix_api_url = get_shared_var("zabbix_api_url");
|
||||||
$zabbix_auth = get_scope("zabbix_auth");
|
$zabbix_auth = get_shared_var("zabbix_auth");
|
||||||
|
|
||||||
// connect to zabbix server
|
// connect to zabbix server
|
||||||
if(loadHelper("webpagetool")) {
|
if(loadHelper("webpagetool")) {
|
||||||
$response = get_web_json($zabbix_api_url, "jsondata", array(
|
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
|
||||||
"headers" => array(
|
"method" => "host.get",
|
||||||
"Content-Type" => "application/json-rpc",
|
"params" => array(
|
||||||
|
"output" => array("hostid", "host", "status"),
|
||||||
|
"selectInterfaces" => array("interfaceid", "ip"),
|
||||||
|
"selectGroups" => "extend"
|
||||||
),
|
),
|
||||||
"data" => array(
|
"id" => zabbix_get_id(),
|
||||||
"jsonrpc" => "2.0",
|
"auth" => $zabbix_auth
|
||||||
|
));
|
||||||
|
|
||||||
|
$hosts = get_property_value("result", $response);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $hosts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("zabbix_retrieve_hosts")) {
|
||||||
|
function zabbix_retrieve_hosts() {
|
||||||
|
return zabbix_get_hosts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("zabbix_get_items")) {
|
||||||
|
function zabbix_get_items($hostids=null) {
|
||||||
|
$items = false;
|
||||||
|
$results = 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" => "host.get",
|
"method" => "host.get",
|
||||||
"params" => array(
|
"params" => array(
|
||||||
"selectInventory" => true,
|
"selectInventory" => true,
|
||||||
"selectItems" => array("name", "lastvalue", "units", "itemid", "lastclock", "value_type", "itemid"),
|
"selectItems" => array("name", "key_", "status", "lastvalue", "units", "itemid", "lastclock", "value_type", "itemid"),
|
||||||
"output" => "extend",
|
"output" => "extend",
|
||||||
"hostids" => $hostids,
|
"hostids" => $hostids,
|
||||||
"expandDescription" => 1,
|
"expandDescription" => 1,
|
||||||
"expandData" => 1,
|
"expandData" => 1,
|
||||||
),
|
),
|
||||||
"id" => zabbix_get_id(),
|
"id" => zabbix_get_id(),
|
||||||
"auth" => $zabbix_auth,
|
"auth" => $zabbix_auth
|
||||||
|
));
|
||||||
|
$results = get_property_value("result", $response);
|
||||||
|
foreach($results as $result) {
|
||||||
|
$items = get_property_value("items", $result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("zabbix_get_problems")) {
|
||||||
|
function zabbix_get_problems($hostids=null) {
|
||||||
|
$problems = 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" => "problem.get",
|
||||||
|
"params" => array(
|
||||||
|
"output" => "extend",
|
||||||
|
"selectAcknowledges" => "extend",
|
||||||
|
"selectTags" => "extend",
|
||||||
|
"selectSuppressionData" => "extend",
|
||||||
|
"hostids" => $hostids,
|
||||||
|
"recent" => "false",
|
||||||
|
//"suppressed" => "false",
|
||||||
|
//"acknowledged" => "false",
|
||||||
|
//"sortfield" => ["eventid"],
|
||||||
|
//"sortorder" => "DESC",
|
||||||
|
//"time_from" => get_current_datetime(array("adjust" => "1 hour"))
|
||||||
),
|
),
|
||||||
|
"id" => zabbix_get_id(),
|
||||||
|
"auth" => $zabbix_auth
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
$problems = get_property_value("result", $response);
|
||||||
|
|
||||||
|
return $problems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("zabbix_get_triggers")) {
|
||||||
|
function zabbix_get_triggers($hostids=null) {
|
||||||
|
$triggers = false;
|
||||||
|
$response = false;
|
||||||
|
|
||||||
|
// get zabbix authentication
|
||||||
|
$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(
|
||||||
|
"method" => "trigger.get",
|
||||||
|
"params" => array(
|
||||||
|
"hostids" => $hostids,
|
||||||
|
"output" => "extend",
|
||||||
|
"selectFunctions" => "extend",
|
||||||
|
"filter" => array(
|
||||||
|
"value" => 1,
|
||||||
|
"status" => 0
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"id" => zabbix_get_id(),
|
||||||
|
"auth" => $zabbix_auth
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$triggers = get_property_value("result", $response);
|
||||||
|
|
||||||
|
return $triggers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("zabbix_get_alerts")) {
|
||||||
|
function zabbix_get_alerts($hostids=null, $time_from=0, $time_till=0) {
|
||||||
|
$alerts = false;
|
||||||
|
$response = false;
|
||||||
|
|
||||||
|
// get zabbix authentication
|
||||||
|
$zabbix_api_url = get_shared_var("zabbix_api_url");
|
||||||
|
$zabbix_auth = get_shared_var("zabbix_auth");
|
||||||
|
|
||||||
|
if(loadHelper("webpagetool")) {
|
||||||
|
$params = array(
|
||||||
|
"output" => "extend",
|
||||||
|
"hostids" => $hostids,
|
||||||
|
"sortfield" => array("clock", "eventid"),
|
||||||
|
"sortorder" => "DESC"
|
||||||
|
);
|
||||||
|
|
||||||
|
if($time_from > 0) {
|
||||||
|
$params['time_from'] = $time_from - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($time_till > 0) {
|
||||||
|
$params['time_till'] = $time_till + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
|
||||||
|
"method" => "event.get",
|
||||||
|
"params" => array(
|
||||||
|
"output" => "extend",
|
||||||
|
"hostids" => $hostids,
|
||||||
|
"sortfield" => array("clock", "eventid"),
|
||||||
|
"sortorder" => "DESC"
|
||||||
|
),
|
||||||
|
"auth" => $zabbix_auth,
|
||||||
|
"id" => zabbix_get_id()
|
||||||
|
));
|
||||||
|
|
||||||
|
$alerts = get_property_value("result", $response);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $alerts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_fn("zabbix_get_records")) {
|
||||||
|
function zabbix_get_records($itemids, $now_dt="", $adjust="-24h", $value_type=3) {
|
||||||
|
$records = false;
|
||||||
|
$response = false;
|
||||||
|
|
||||||
|
// get current datetime
|
||||||
|
if(empty($now_dt)) {
|
||||||
|
$now_dt = get_current_datetime();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get zabbix authentication
|
||||||
|
$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));
|
||||||
|
$time_till = get_current_timestamp(array("now" => $now_dt));
|
||||||
|
|
||||||
|
// get history
|
||||||
|
// 0-numeric float; 1-character; 2-log; 3-numeric unsigned; 4-text
|
||||||
|
if(loadHelper("webpagetool")) {
|
||||||
|
$params = array(
|
||||||
|
"output" => "extend",
|
||||||
|
"history" => $value_type,
|
||||||
|
"itemids" => $itemids,
|
||||||
|
"sortfield" => "clock",
|
||||||
|
"sortorder" => "DESC",
|
||||||
|
"time_from" => $time_from,
|
||||||
|
"time_till" => $time_till
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = get_web_json($zabbix_api_url, "jsonrpc2.cache", array(
|
||||||
|
"method" => "history.get",
|
||||||
|
"params" => $params,
|
||||||
|
"auth" => $zabbix_auth,
|
||||||
|
"id" => zabbix_get_id()
|
||||||
|
));
|
||||||
|
|
||||||
|
$records = get_property_value("result", $response);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $records;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,26 +2,26 @@
|
||||||
/**
|
/**
|
||||||
* @file zeroboard4.dbt.php
|
* @file zeroboard4.dbt.php
|
||||||
* @date 2018-08-20
|
* @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)
|
* @brief Database Helper for Zeroboard 4 PL 9 (experimental)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// get database prefix
|
// get database prefix
|
||||||
if(!check_function_exists("zb4_get_db_prefix")) {
|
if(!is_fn("zb4_get_db_prefix")) {
|
||||||
function zb4_get_db_prefix() {
|
function zb4_get_db_prefix() {
|
||||||
return "zetyx_";
|
return "zetyx_";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get table
|
// get table
|
||||||
if(!check_function_exists("zb4_get_db_table")) {
|
if(!is_fn("zb4_get_db_table")) {
|
||||||
function zb4_get_db_table($tablename) {
|
function zb4_get_db_table($tablename) {
|
||||||
return (zb4_get_db_prefix() . $tablename);
|
return (zb4_get_db_prefix() . $tablename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get write table
|
// get write table
|
||||||
if(!check_function_exists("zb4_get_write_table")) {
|
if(!is_fn("zb4_get_write_table")) {
|
||||||
function zb4_get_write_table($tablename, $version=4) {
|
function zb4_get_write_table($tablename, $version=4) {
|
||||||
$write_prefix = zb4_get_db_prefix() . "board_";
|
$write_prefix = zb4_get_db_prefix() . "board_";
|
||||||
$write_table = $write_prefix . $tablename;
|
$write_table = $write_prefix . $tablename;
|
||||||
|
@ -30,7 +30,7 @@ if(!check_function_exists("zb4_get_write_table")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// write post
|
// write post
|
||||||
if(!check_function_exists("zb4_write_post")) {
|
if(!is_fn("zb4_write_post")) {
|
||||||
function zb4_write_post($tablename, $data=array()) {
|
function zb4_write_post($tablename, $data=array()) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$write_table = zb4_get_write_table($tablename);
|
$write_table = zb4_get_write_table($tablename);
|
||||||
|
@ -105,14 +105,14 @@ if(!check_function_exists("zb4_write_post")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zb4_get_posts")) {
|
if(!is_fn("zb4_get_posts")) {
|
||||||
function zb4_get_posts($table_name, $page=1, $limit=20, $options=array()) {
|
function zb4_get_posts($table_name, $page=1, $limit=20, $options=array()) {
|
||||||
$sql = "select * from " . zb4_get_write_table($table_name) . " order by no desc" . get_page_range($page, $limit);
|
$sql = "select * from " . zb4_get_write_table($table_name) . " order by no desc" . get_page_range($page, $limit);
|
||||||
return exec_db_fetch_all($sql);
|
return exec_db_fetch_all($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("zb4_get_post_by_id")) {
|
if(!is_fn("zb4_get_post_by_id")) {
|
||||||
function zb4_get_post_by_id($table_name, $post_id) {
|
function zb4_get_post_by_id($table_name, $post_id) {
|
||||||
$sql = "select * from " . zb4_get_write_table($table_name) . " where no = :no";
|
$sql = "select * from " . zb4_get_write_table($table_name) . " where no = :no";
|
||||||
return exec_db_fetch($sql, array(
|
return exec_db_fetch($sql, array(
|
||||||
|
|
86
index.php
86
index.php
|
@ -1,30 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file index.php
|
* @file index.php
|
||||||
* @date 2018-05-27
|
* @created_on 2018-05-27
|
||||||
* @updated 2019-06-04
|
* @updated_on 2020-06-14
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief ReasonableFramework
|
* @brief ReasonableFramework is RVHM structured PHP framework with common security
|
||||||
* @cvs https://github.com/gnh1201/reasonableframework
|
* @cvs https://github.com/gnh1201/reasonableframework
|
||||||
* @sponsor https://patreon.com/catswords (Check this link if you want use the advanced security)
|
* @sponsor https://patreon.com/catswords (with advanced security)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("_DEF_VSPF_", true); // compatible to VSPF
|
define("_DEF_VSPF_", true); // compatible to VSPF
|
||||||
define("_DEF_RSF_", true); // compatible to RSF
|
define("_DEF_RSF_", true); // compatible to RSF
|
||||||
define("APP_DEVELOPMENT", false); // set the status of development
|
define("APP_DEVELOPMENT", false); // set the status of development
|
||||||
define("DOC_EOL", "\r\n"); // set the 'end of line' commonly
|
define("DOC_EOL", "\r\n"); // set the 'end of line'
|
||||||
define("CORS_DOMAINS", false); // common security: allow origin domains
|
define("CORS_DOMAINS", false); // common security: allow origin domains (e.g. example.org,*.example.org)
|
||||||
define("PHP_FIREWALL_REQUEST_URI", false); // advanced security
|
define("PHP_FIREWALL_REQUEST_URI", strip_tags($_SERVER['REQUEST_URI'])); // advanced security
|
||||||
define("PHP_FIREWALL_ACTIVATION", false); // advanced security
|
define("PHP_FIREWALL_ACTIVATION", false); // advanced security
|
||||||
define("PHP_DDOS_PROTECTION", false); // advanced security
|
define("PHP_DDOS_PROTECTION", false); // advanced security
|
||||||
define("PHP_WEBSHELL_DETECTION", false); // advanced security
|
|
||||||
define("PHP_SECURE_CONFIG_CHECK", false); // advanced security
|
|
||||||
|
|
||||||
// check if current status is development
|
// development mode
|
||||||
if(APP_DEVELOPMENT == true) {
|
if(APP_DEVELOPMENT == true) {
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ini_set("display_errors", 1);
|
@ini_set("log_errors", 1);
|
||||||
|
@ini_set("error_log", sprintf("%s/storage/sandbox/logs/error.log", getcwd()));
|
||||||
|
} else {
|
||||||
|
error_reporting(E_ERROR | E_PARSE);
|
||||||
}
|
}
|
||||||
|
@ini_set("display_errors", 1);
|
||||||
|
|
||||||
// CORS Security (https or http)
|
// CORS Security (https or http)
|
||||||
if(CORS_DOMAINS !== false) {
|
if(CORS_DOMAINS !== false) {
|
||||||
|
@ -58,8 +60,8 @@ if(CORS_DOMAINS !== false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set empty scope
|
// set shared vars
|
||||||
$scope = array();
|
$shared_vars = array();
|
||||||
|
|
||||||
// define system modules
|
// define system modules
|
||||||
$load_systems = array("base", "storage", "config", "security", "database", "uri", "logger");
|
$load_systems = array("base", "storage", "config", "security", "database", "uri", "logger");
|
||||||
|
@ -83,9 +85,37 @@ foreach($load_systems as $system_name) {
|
||||||
// get config
|
// get config
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
|
// get requests
|
||||||
|
$requests = get_requests();
|
||||||
|
|
||||||
|
// 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
|
// set max_execution_time
|
||||||
$max_execution_time = get_value_in_array("max_execution_time", $config, 0);
|
$max_execution_time = get_value_in_array("max_execution_time", $config, -1);
|
||||||
@ini_set("max_execution_time", $max_execution_time);
|
set_max_execution_time($max_execution_time);
|
||||||
|
|
||||||
|
// set 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, -1);
|
||||||
|
set_upload_max_filesize($upload_max_filesize);
|
||||||
|
|
||||||
|
// set 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();
|
||||||
|
|
||||||
// set autoloader
|
// set autoloader
|
||||||
if(!array_key_empty("enable_autoload", $config)) {
|
if(!array_key_empty("enable_autoload", $config)) {
|
||||||
|
@ -97,12 +127,28 @@ $default_timezone = get_value_in_array("timezone", $config, "UTC");
|
||||||
date_default_timezone_set($default_timezone);
|
date_default_timezone_set($default_timezone);
|
||||||
|
|
||||||
// write visit log
|
// 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
|
// get requested route
|
||||||
$route = read_route();
|
$route = read_route();
|
||||||
|
|
||||||
// load route file
|
// advanced security: PHP firewall
|
||||||
if(!loadRoute($route, $scope)) {
|
if(PHP_FIREWALL_ACTIVATION !== false) {
|
||||||
loadRoute("errors/404", $scope);
|
loadHelper("php-firewall.lnk");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// advanced security: DDOS protection
|
||||||
|
if(PHP_DDOS_PROTECTION !== false) {
|
||||||
|
loadHelper("php-ddos.lnk");
|
||||||
|
}
|
||||||
|
|
||||||
|
// load route
|
||||||
|
if(!loadRoute($route, $shared_vars)) {
|
||||||
|
loadRoute("errors/404", $shared_vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
// disconnect database
|
||||||
|
close_db_connect();
|
||||||
|
|
||||||
|
// EOF
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file api.getorder.pgkcp.php
|
* @file api.getorder.pgkcp.php
|
||||||
* @date 2018-09-24
|
* @date 2018-09-24
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief KCP PG(Payment Gateway) get completed order
|
* @brief KCP PG(Payment Gateway) get completed order
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file api.gnuboard.php
|
* @file api.gnuboard.php
|
||||||
* @date 2018-05-31
|
* @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
|
* @brief Integration controller for Gnuboard CMS 4.x, 5.x
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file api.mailgun.php
|
* @file api.mailgun.php
|
||||||
* @date 2019-04-15
|
* @date 2019-04-15
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Mailgun API controller
|
* @brief Mailgun API controller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file api.setconfig.pgkcp.php
|
* @file api.setconfig.pgkcp.php
|
||||||
* @date 2018-09-30
|
* @date 2018-09-30
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief KCP PG(Payment Gateway) set configuration API
|
* @brief KCP PG(Payment Gateway) set configuration API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file api.social.php
|
* @file api.social.php
|
||||||
* @date 2018-09-26
|
* @date 2018-09-26
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief SocialTools API (refactoring from SocioRouter API)
|
* @brief SocialTools API (refactoring from SocioRouter API)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,27 +2,57 @@
|
||||||
/**
|
/**
|
||||||
* @file api.twilio.php
|
* @file api.twilio.php
|
||||||
* @date 2019-04-15
|
* @date 2019-04-15
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Twilio API controller
|
* @brief Twilio API controller (or domestic API)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
loadHelper("twilio.api");
|
loadHelper("twilio.api"); // for voice, or international
|
||||||
|
loadHelper("lguplus.api"); // for domestic
|
||||||
|
loadHelper("string.utils");
|
||||||
|
|
||||||
$action = get_requested_value("action", array("_JSON", "_ALL"));
|
$action = get_requested_value("action", array("_JSON", "_ALL"));
|
||||||
$message = get_requested_value("message", array("_JSON", "_ALL"));
|
$message = get_requested_value("message", array("_JSON", "_ALL"));
|
||||||
$to = get_requested_value("to", array("_JSON", "_ALL"));
|
$to = get_requested_value("to", array("_JSON", "_ALL"));
|
||||||
|
|
||||||
|
$country = get_requested_value("country", array("_JSON", "_ALL"));
|
||||||
|
$is_domestic = array_key_equals("lguplus_country", $config, $country);
|
||||||
|
if(!$is_domestic) {
|
||||||
|
$to = sprintf("+%s%s", $country, $to);
|
||||||
|
} else {
|
||||||
|
$to = sprintf("%s%s", (substr($to, 0, 1) == "0" ? "" : "0"), $to);
|
||||||
|
}
|
||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
// temporary filter (example)
|
||||||
|
$terms = get_tokenized_text($message);
|
||||||
|
if(in_array("fuck", $terms) || in_array("bitch", $terms) || in_array("hell", $terms)) {
|
||||||
|
$action = "denied";
|
||||||
|
}
|
||||||
|
|
||||||
switch($action) {
|
switch($action) {
|
||||||
case "text":
|
case "text":
|
||||||
|
if(!$is_domestic) {
|
||||||
$response = twilio_send_message($message, $to);
|
$response = twilio_send_message($message, $to);
|
||||||
|
} else {
|
||||||
|
$response = lguplus_send_message($message, $to);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "voice":
|
case "voice":
|
||||||
$response = twilio_send_voice($message, $to);
|
$response = twilio_send_voice($message, $to);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "denied":
|
||||||
|
$response = array("error" => "action is denied");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$response = array("error" => "action is required");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write_common_log(sprintf("message: %s, to: %s", $message, $to), "api.twilio");
|
||||||
|
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file api.uuid.php
|
* @file api.uuid.php
|
||||||
* @date 2018-08-19
|
* @date 2018-08-19
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief UUID Generator API
|
* @brief UUID Generator API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file api.zabbix.php
|
* @file api.zabbix.php
|
||||||
* @date 2019-04-15
|
* @date 2019-04-15
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Zabbix API
|
* @brief Zabbix API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file mobileswitcher.php
|
* @file mobileswitcher.php
|
||||||
* @date 2019-04-29
|
* @date 2019-04-29
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief mobile device switcher
|
* @brief mobile device switcher
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file ordercomplete.pgkcp.php
|
* @file ordercomplete.pgkcp.php
|
||||||
* @date 2018-09-03
|
* @created_on 2018-09-03
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated_on 2020-01-25
|
||||||
* @brief KCP PG(Payment Gateway) contoller when complete
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
|
* @brief KCP PG(Payment Gateway) contoller when completed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// detect CSRF attack
|
// detect CSRF attack
|
||||||
if(check_token_abuse_by_requests("_token", "_POST")) {
|
if(check_token_abuse_by_requests("_token", "_POST")) {
|
||||||
set_error("Access denied. (Expired session or Website attacker)");
|
set_error("Access denied because of security violation");
|
||||||
show_errors();
|
show_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,16 +27,16 @@ $pay_method_alias = get_requested_value("pay_method_alias");
|
||||||
// A001: free plan (무료)
|
// A001: free plan (무료)
|
||||||
// A002: hand-writing payment (수기결제, 무통장입금 등)
|
// A002: hand-writing payment (수기결제, 무통장입금 등)
|
||||||
$action = "cancel";
|
$action = "cancel";
|
||||||
if(in_array($res_cd, array("0000", "A001")) {
|
if(in_array($res_cd, array("0000", "A001"))) {
|
||||||
$action = "complete";
|
$action = "complete";
|
||||||
} elseif(in_array($res_cd, array("A002")) {
|
} elseif(in_array($res_cd, array("A002"))) {
|
||||||
$action = "hold";
|
$action = "hold";
|
||||||
}
|
}
|
||||||
|
|
||||||
// check ordr_idxx
|
// check ordr_idxx
|
||||||
if(empty($ordr_idxx)) {
|
if(empty($ordr_idxx)) {
|
||||||
set_error("ordr_idxx can not empty");
|
set_error("ordr_idxx is required");
|
||||||
set_errors();
|
show_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
// write storage file
|
// write storage file
|
||||||
|
@ -51,9 +52,37 @@ if(!$fw) {
|
||||||
show_errors();
|
show_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// response
|
||||||
|
$_token = get_session_token();
|
||||||
|
if(empty($redirect_url)) {
|
||||||
|
$jscontent = <<<EOF
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript">//<!--<![CDATA[
|
||||||
|
if(window.opener && !window.opener.closed) {
|
||||||
|
window.opener.payman_callback({
|
||||||
|
"token": "$_token",
|
||||||
|
"ordr_idxx": "$ordr_idxx",
|
||||||
|
"res_cd": "$res_cd",
|
||||||
|
"pay_method_alias": "$pay_method_alias"
|
||||||
|
});
|
||||||
|
window.close();
|
||||||
|
self.close();
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
//]]>--></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF;
|
||||||
|
echo $jscontent;
|
||||||
|
} else {
|
||||||
// redirect
|
// redirect
|
||||||
redirect_uri(get_final_link($redirect_url, array(
|
redirect_uri(get_final_link($redirect_url, array(
|
||||||
"_token" => get_session_token(),
|
"_token" => $_token,
|
||||||
"_route" => get_requested_value("route"),
|
"_route" => get_requested_value("route"),
|
||||||
"_action" => $action,
|
"_action" => $action,
|
||||||
"_ordr_idxx" => $ordr_idxx,
|
"_ordr_idxx" => $ordr_idxx,
|
||||||
|
@ -62,3 +91,4 @@ redirect_uri(get_final_link($redirect_url, array(
|
||||||
), false), array(
|
), false), array(
|
||||||
"check_origin" => true
|
"check_origin" => true
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file orderform.php
|
* @file orderform.php
|
||||||
* @date 2018-09-03
|
* @date 2018-09-03
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief order form
|
* @brief order form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ $data = array(
|
||||||
"buyr_mail" => get_requested_value("buyr_mail"),
|
"buyr_mail" => get_requested_value("buyr_mail"),
|
||||||
"buyr_tel1" => get_requested_value("buyr_tel1"),
|
"buyr_tel1" => get_requested_value("buyr_tel1"),
|
||||||
"pay_data" => get_requested_value("pay_data"),
|
"pay_data" => get_requested_value("pay_data"),
|
||||||
|
"eng_flag" => get_requested_value("eng_flag")
|
||||||
);
|
);
|
||||||
|
|
||||||
renderView("view_orderform.widget", $data);
|
renderView("view_orderform.widget", $data);
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
/**
|
/**
|
||||||
* @file orderpay.pgkcp.php
|
* @file orderpay.pgkcp.php
|
||||||
* @date 2018-08-25
|
* @date 2018-08-25
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated 2019-10-14
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief KCP PG(Payment Gateway) Controller
|
* @brief KCP PG(Payment Gateway) Controller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||||
|
|
||||||
$debug = get_requested_value("debug");
|
$debug = get_requested_value("debug");
|
||||||
|
$mode = get_requested_value("mode");
|
||||||
|
|
||||||
if($debug != "true") {
|
if($debug != "true") {
|
||||||
// 필수 항목 체크
|
// 필수 항목 체크
|
||||||
|
@ -20,8 +22,8 @@ if($debug != "true") {
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect CSRF attack
|
// detect CSRF attack
|
||||||
if(check_token_abuse_by_requests("_token")) {
|
if($mode != "widget" && check_token_abuse_by_requests("_token")) {
|
||||||
set_error("Access denied. (Expired session or Website attacker)");
|
set_error("Access denied because of security violation");
|
||||||
show_errors();
|
show_errors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +50,7 @@ $data = array(
|
||||||
|
|
||||||
// 1. 주문 정보 입력: 결제에 필요한 주문 정보를 입력 및 설정합니다.
|
// 1. 주문 정보 입력: 결제에 필요한 주문 정보를 입력 및 설정합니다.
|
||||||
$fieldnames = array(
|
$fieldnames = array(
|
||||||
|
"redirect_url", // Redirect URL
|
||||||
"pay_method", // 지불 방법
|
"pay_method", // 지불 방법
|
||||||
"pay_method_alias", // 지불 방법 별칭
|
"pay_method_alias", // 지불 방법 별칭
|
||||||
"ordr_idxx", // 주문 번호
|
"ordr_idxx", // 주문 번호
|
||||||
|
@ -108,6 +111,8 @@ $payinfo['res_msg'] = "";
|
||||||
$payinfo['enc_info'] = "";
|
$payinfo['enc_info'] = "";
|
||||||
$payinfo['enc_data'] = "";
|
$payinfo['enc_data'] = "";
|
||||||
$payinfo['ret_pay_method'] = "";
|
$payinfo['ret_pay_method'] = "";
|
||||||
|
$payinfo['tran_cd'] = ""; // tran_cd가 유효하여야만 이후 tno 반환
|
||||||
|
$payinfo['use_pay_method'] = "";
|
||||||
$payinfo['ordr_chk'] = ""; // 주문정보 검증 관련 정보
|
$payinfo['ordr_chk'] = ""; // 주문정보 검증 관련 정보
|
||||||
|
|
||||||
// 변경 제한 영역: 현금영수증 관련 정보
|
// 변경 제한 영역: 현금영수증 관련 정보
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file orderpay.step2.pgkcp.php
|
* @file orderpay.step2.pgkcp.php
|
||||||
* @date 2018-08-27
|
* @created_on 2018-08-27
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @updated_on 2020-01-25
|
||||||
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief KCP PG(Payment Gateway) contoller when done
|
* @brief KCP PG(Payment Gateway) contoller when done
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -10,13 +11,13 @@ if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||||
|
|
||||||
// detect CSRF attack
|
// detect CSRF attack
|
||||||
if(check_token_abuse_by_requests("_token", "_POST")) {
|
if(check_token_abuse_by_requests("_token", "_POST")) {
|
||||||
set_error("Access denied. (Expired session or Website attacker)");
|
set_error("Access denied because of security violation");
|
||||||
show_errors();
|
show_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadHelper("webpagetool"); // load webpage tools
|
loadHelper("webpagetool"); // load webpage tools
|
||||||
loadHelper("networktool"); // load network tools
|
loadHelper("networktool"); // load network tools
|
||||||
loadHelper("string.urils"); // load string utility
|
loadHelper("string.utils"); // load string utility
|
||||||
loadHelper("pgkcp.lnk"); // load KCP PG Helper
|
loadHelper("pgkcp.lnk"); // load KCP PG Helper
|
||||||
loadHelper("JSLoader.class"); // load javascript loader
|
loadHelper("JSLoader.class"); // load javascript loader
|
||||||
|
|
||||||
|
@ -274,6 +275,11 @@ if($req_tx == "pay") {
|
||||||
}
|
}
|
||||||
} // End of [res_cd = "0000"]
|
} // End of [res_cd = "0000"]
|
||||||
|
|
||||||
|
// set encoding
|
||||||
|
foreach($payres as $k=>$v) {
|
||||||
|
$payres[$k] = get_converted_string($v, "utf-8", "cp949");
|
||||||
|
}
|
||||||
|
|
||||||
// set result
|
// set result
|
||||||
extract($payres);
|
extract($payres);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file orderpay.step3.pgkcp.php
|
* @file orderpay.step3.pgkcp.php
|
||||||
* @date 2018-08-27
|
* @date 2018-08-27
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief KCP PG(Payment Gateway) contoller when done
|
* @brief KCP PG(Payment Gateway) contoller when done
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||||
|
|
||||||
// detect CSRF attack
|
// detect CSRF attack
|
||||||
if(check_token_abuse_by_requests("_token", "_POST")) {
|
if(check_token_abuse_by_requests("_token", "_POST")) {
|
||||||
set_error("Access denied. (Expired session or Website attacker)");
|
set_error("Access denied because of security violation");
|
||||||
show_errors();
|
show_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
"name" => "Hong gil dong",
|
"name" => "Hong gil dong",
|
||||||
"email" => "support@exts.kr",
|
"email" => "abuse@catswords.net",
|
||||||
"tel" => ""01000000000",
|
"tel" => ""01000000000",
|
||||||
"base_url" => base_url()
|
"base_url" => base_url()
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file webapp.php
|
* @file webapp.php
|
||||||
* @date 2019-02-23
|
* @date 2019-02-23
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <abuse@catswords.net>
|
||||||
* @brief Isolator(Compatibility mode) for legacy application
|
* @brief Isolator(Compatibility mode) for legacy application
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ zabbix_password=
|
||||||
zabbix_protocol=http
|
zabbix_protocol=http
|
||||||
twilio_sid=
|
twilio_sid=
|
||||||
twilio_token=
|
twilio_token=
|
||||||
|
twilio_from=
|
||||||
|
twilio_char_limit=160
|
||||||
vworld_api_key=
|
vworld_api_key=
|
||||||
vworld_api_domain=
|
vworld_api_domain=
|
||||||
mailgun_domain=
|
mailgun_domain=
|
||||||
|
|
|
@ -6,5 +6,8 @@ db_host = localhost
|
||||||
db_name = dbname
|
db_name = dbname
|
||||||
db_username = dbusername
|
db_username = dbusername
|
||||||
db_password = dbpassword
|
db_password = dbpassword
|
||||||
|
db_retry_limit = 3
|
||||||
|
db_fetch_mode = sql
|
||||||
|
db_separated_tables =
|
||||||
storage_dir = storage
|
storage_dir = storage
|
||||||
EOF;
|
EOF;
|
||||||
|
|
5
storage/config/deprecated.ini.php
Normal file
5
storage/config/deprecated.ini.php
Normal 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;
|
6
storage/config/l10n.ini.php
Normal file
6
storage/config/l10n.ini.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
return <<<EOF
|
||||||
|
[l10n]
|
||||||
|
l10n_enabled=0
|
||||||
|
l10n_default_language=ko
|
||||||
|
EOF;
|
11
storage/config/lguplus.ini.php
Normal file
11
storage/config/lguplus.ini.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
return <<<EOF
|
||||||
|
lguplus_enabled = 1
|
||||||
|
lguplus_key = ""
|
||||||
|
lguplus_secret = ""
|
||||||
|
lguplus_id = ""
|
||||||
|
lguplus_pw = ""
|
||||||
|
lguplus_from = ""
|
||||||
|
lguplus_country = "82"
|
||||||
|
lguplus_subject = "Untitled text message"
|
||||||
|
EOF;
|
9
storage/config/logger.ini.php
Normal file
9
storage/config/logger.ini.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
return <<<EOF
|
||||||
|
[logger]
|
||||||
|
rfc3164_enabled=0
|
||||||
|
rfc3164_host=logs6.papertrailapp.com
|
||||||
|
rfc3164_port=42986
|
||||||
|
log_rotate_size=104857600
|
||||||
|
log_rotate_ratio=0.9
|
||||||
|
EOF;
|
|
@ -9,4 +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
|
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
|
https=auto
|
||||||
hashalgos=md5,sha1,crypt,crc32,base64,sql_password
|
hashalgos=md5,sha1,crypt,crc32,base64,sql_password
|
||||||
|
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;
|
EOF;
|
||||||
|
|
|
@ -2,7 +2,17 @@
|
||||||
return <<<EOF
|
return <<<EOF
|
||||||
[system]
|
[system]
|
||||||
max_execution_time=0
|
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
|
session_dir=session
|
||||||
enable_autoload=0
|
enable_autoload=0
|
||||||
default_route=welcome
|
default_route=welcome
|
||||||
|
cache_enabled=1
|
||||||
|
cache_max_age=180
|
||||||
|
temp_max_age=60
|
||||||
|
old_version=0
|
||||||
EOF;
|
EOF;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
return <<<EOF
|
return <<<EOF
|
||||||
[uri]
|
[uri]
|
||||||
base_url = /
|
base_route =
|
||||||
|
base_url =
|
||||||
|
base_cdn_url =
|
||||||
|
base_vod_url =
|
||||||
EOF;
|
EOF;
|
||||||
|
|
1
storage/sandbox/logs/index.php
Normal file
1
storage/sandbox/logs/index.php
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
storage/sandbox/sessions/index.php
Normal file
1
storage/sandbox/sessions/index.php
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user