0
0
mirror of https://codeberg.org/crimeflare/cloudflare-tor synced 2024-12-22 23:50:31 +00:00
This commit is contained in:
Jordan Pritchard 2020-12-11 14:38:59 +01:00
parent 36b7c2d9c2
commit eb020fa0d3

View File

@ -12,22 +12,15 @@ define('GIT_COMMIT_MAIL', substr(sha1(gmdate('U').$d),mt_rand(1,7),mt_rand(4,18)
/* /*
: EditFile : EditFile
: php -f ef.php [--up|upload|down|download FILE] [--to|from /PATH] : php -f ef.php [--up|upload|down|download FILE] [--to|from /PATH]
: if not working, try: : or php -f ef.php -- [--up|upload|down|download FILE] [--to|from /PATH]
: php -f ef.php -- [--up|upload|down|download FILE] [--to|from /PATH]
: :
: php -f ef.php --up PATH_TO_FILE --to /FILENAME.md : php -f ef.php --up PATH_TO_FILE --to /FILENAME.md
: Upload & Overwrite PATH_TO_FILE to {master branch} /FILENAME.md. : Upload & Overwrite PATH_TO_FILE to {master branch} /FILENAME.md.
: example: --up myedit.md --to /readme/en.md : example: --to /HISTORY.md --upload "my edit.txt"
: example: --to /HISTORY.md --upload "my amazing edit.txt"
: :
: php -f ef.php --down PATH_TO_FILE --from /FILENAME.md : php -f ef.php --down PATH_TO_FILE --from /FILENAME.md
: Download /FILENAME.md and Save(overwrite) to PATH_TO_FILE. : Download /FILENAME.md and Save(overwrite) to PATH_TO_FILE.
: example: --from /readme/en.md --download export.txt : example: --from /readme/en.md --download export.txt
: example: --down "backup file.txt" --from /README.md
:
: You are free to edit this code.
: Vive la résistance!
:
*/ */
if (strlen(ACCESS_API_KEY) != 40) { if (strlen(ACCESS_API_KEY) != 40) {
echo('[ERROR] ACCESS_API_KEY is empty!'); echo('[ERROR] ACCESS_API_KEY is empty!');
@ -128,7 +121,7 @@ function gitea_file_upload($f, $d) {
echo("upload..."); echo("upload...");
gitea_query(GITEA_SERVER . '/api/v1/repos/' . GITEA_SPACE . '/contents' . $f, 'PUT', ['author' => ['email' => GIT_COMMIT_MAIL, 'name' => GIT_COMMIT_NAME], 'committer' => ['email' => GIT_COMMIT_MAIL, 'name' => GIT_COMMIT_NAME], 'message' => basename($f), 'branch' => 'master', 'sha' => $got['sha'], 'content' => base64_encode(file_get_contents($d)) ]); gitea_query(GITEA_SERVER . '/api/v1/repos/' . GITEA_SPACE . '/contents' . $f, 'PUT', ['author' => ['email' => GIT_COMMIT_MAIL, 'name' => GIT_COMMIT_NAME], 'committer' => ['email' => GIT_COMMIT_MAIL, 'name' => GIT_COMMIT_NAME], 'message' => basename($f), 'branch' => 'master', 'sha' => $got['sha'], 'content' => base64_encode(file_get_contents($d)) ]);
} else { } else {
echo("internet_error!\n"); echo("error!\n");
} }
} }
if ($opmode == 'u') { if ($opmode == 'u') {
@ -139,7 +132,7 @@ if ($opmode == 'u') {
if (strlen($got) >= 1) { if (strlen($got) >= 1) {
file_put_contents($var_file, $got); file_put_contents($var_file, $got);
} else { } else {
echo("internet_error!\n"); echo("error!\n");
} }
} }
echo("ok\n"); echo("ok\n");