diff options
author | redmatrix <git@macgirvin.com> | 2016-07-03 15:58:20 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-07-03 15:58:20 -0700 |
commit | 57226b2e1378c2769709a2b2407249cc4e3b14f4 (patch) | |
tree | fbb6a4713b6ae9c5cb13ab47ffdb1d03a586c820 /Zotlabs/Daemon | |
parent | 17e161006a9ddbfbea3e0b6d5f7776ad7b8101e2 (diff) | |
parent | f46eecc1e7585e64069bb18918a2db057a16c480 (diff) | |
download | volse-hubzilla-57226b2e1378c2769709a2b2407249cc4e3b14f4.tar.gz volse-hubzilla-57226b2e1378c2769709a2b2407249cc4e3b14f4.tar.bz2 volse-hubzilla-57226b2e1378c2769709a2b2407249cc4e3b14f4.zip |
Merge branch 'dev' into perms
Diffstat (limited to 'Zotlabs/Daemon')
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 13 | ||||
-rw-r--r-- | Zotlabs/Daemon/Cron_weekly.php | 1 | ||||
-rw-r--r-- | Zotlabs/Daemon/CurlAuth.php | 55 |
3 files changed, 67 insertions, 2 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index f23cb14dc..d5b41274b 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -41,7 +41,6 @@ class Cron { require_once('include/sharedwithme.php'); apply_updates(); - // expire any expired mail q("delete from mail where expires != '%s' and expires < %s ", @@ -93,6 +92,18 @@ class Cron { intval($rr['id']) ); if($x) { + $z = q("select * from item where id = %d", + intval($message_id) + ); + if($z) { + xchan_query($z); + $sync_item = fetch_post_tags($z); + build_sync_packet($sync_item[0]['uid'], + [ + 'item' => [ encode_item($sync_item[0],true) ] + ] + ); + } Master::Summon(array('Notifier','wall-new',$rr['id'])); } } diff --git a/Zotlabs/Daemon/Cron_weekly.php b/Zotlabs/Daemon/Cron_weekly.php index 1d8420947..ba4b67ff5 100644 --- a/Zotlabs/Daemon/Cron_weekly.php +++ b/Zotlabs/Daemon/Cron_weekly.php @@ -15,7 +15,6 @@ class Cron_weekly { call_hooks('cron_weekly',datetime_convert()); - z_check_cert(); require_once('include/hubloc.php'); diff --git a/Zotlabs/Daemon/CurlAuth.php b/Zotlabs/Daemon/CurlAuth.php new file mode 100644 index 000000000..be12bc779 --- /dev/null +++ b/Zotlabs/Daemon/CurlAuth.php @@ -0,0 +1,55 @@ +<?php + +namespace Zotlabs\Daemon; + +// 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. + +// Handles expiration of stale cookies currently by deleting them and rewriting the file. + +class CurlAuth { + + static public function run($argc,$argv) { + + if($argc != 2) + killme(); + + \App::$session->start(); + + $_SESSION['authenticated'] = 1; + $_SESSION['uid'] = $argv[1]; + + $x = session_id(); + + $f = 'store/[data]/cookie_' . $argv[1]; + $c = 'store/[data]/cookien_' . $argv[1]; + + $e = file_exists($f); + + $output = ''; + + if($e) { + $lines = file($f); + 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()) { + $output .= $line . "\n"; + } + } + else + $output .= $line; + } + } + } + $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($c,$x); + + killme(); + } +}
\ No newline at end of file |