diff options
author | Mario <mario@mariovavti.com> | 2021-01-18 13:40:01 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-01-18 13:40:01 +0000 |
commit | d0f3d2b2a5736b8d24c4bfc9fa82f5e32bdc2fb2 (patch) | |
tree | 1b8aec25914bcdf19dbe8358abaa5d9090bf5731 /Zotlabs/Daemon | |
parent | 3742fe80fc54115683106d2b802b086123ea7bde (diff) | |
download | volse-hubzilla-d0f3d2b2a5736b8d24c4bfc9fa82f5e32bdc2fb2.tar.gz volse-hubzilla-d0f3d2b2a5736b8d24c4bfc9fa82f5e32bdc2fb2.tar.bz2 volse-hubzilla-d0f3d2b2a5736b8d24c4bfc9fa82f5e32bdc2fb2.zip |
cleanup daemon/curlauth
Diffstat (limited to 'Zotlabs/Daemon')
-rw-r--r-- | Zotlabs/Daemon/Cron_weekly.php | 2 | ||||
-rw-r--r-- | Zotlabs/Daemon/CurlAuth.php | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/Zotlabs/Daemon/Cron_weekly.php b/Zotlabs/Daemon/Cron_weekly.php index 34d0ed1ee..407aa40ef 100644 --- a/Zotlabs/Daemon/Cron_weekly.php +++ b/Zotlabs/Daemon/Cron_weekly.php @@ -19,7 +19,7 @@ class Cron_weekly { z_check_cert(); prune_hub_reinstalls(); - + mark_orphan_hubsxchans(); // Find channels that were removed in the last three weeks, but diff --git a/Zotlabs/Daemon/CurlAuth.php b/Zotlabs/Daemon/CurlAuth.php index de41382e3..2396da9aa 100644 --- a/Zotlabs/Daemon/CurlAuth.php +++ b/Zotlabs/Daemon/CurlAuth.php @@ -2,6 +2,8 @@ namespace Zotlabs\Daemon; +use App; + // generate a curl compatible cookie file with an authenticated session for the given channel_id. // If this file is then used with curl and the destination url is sent through zid() or manually // manipulated to add a zid, it should allow curl to provide zot magic-auth across domains. @@ -10,15 +12,15 @@ namespace Zotlabs\Daemon; class CurlAuth { - static public function run($argc,$argv) { + static public function run($argc, $argv) { - if($argc != 2) + if ($argc != 2) return; - \App::$session->start(); + App::$session->start(); $_SESSION['authenticated'] = 1; - $_SESSION['uid'] = $argv[1]; + $_SESSION['uid'] = $argv[1]; $x = session_id(); @@ -29,14 +31,14 @@ class CurlAuth { $output = ''; - if($e) { + if ($e) { $lines = file($f); - if($lines) { - foreach($lines as $line) { - if(strlen($line) > 0 && $line[0] != '#' && substr_count($line, "\t") == 6) { + if ($lines) { + foreach ($lines as $line) { + if (strlen($line) > 0 && $line[0] != '#' && substr_count($line, "\t") == 6) { $tokens = explode("\t", $line); $tokens = array_map('trim', $tokens); - if($tokens[4] > time()) { + if ($tokens[4] > time()) { $output .= $line . "\n"; } } @@ -46,9 +48,9 @@ class CurlAuth { } } $t = time() + (24 * 3600); - file_put_contents($f, $output . 'HttpOnly_' . \App::get_hostname() . "\tFALSE\t/\tTRUE\t$t\tPHPSESSID\t" . $x, (($e) ? FILE_APPEND : 0)); + file_put_contents($f, $output . 'HttpOnly_' . App::get_hostname() . "\tFALSE\t/\tTRUE\t$t\tPHPSESSID\t" . $x, (($e) ? FILE_APPEND : 0)); - file_put_contents($c,$x); + file_put_contents($c, $x); return; } |