2013-12-22 20:51:49 +00:00
|
|
|
<?php
|
|
|
|
|
2013-12-23 00:53:26 +00:00
|
|
|
function xref_init(&$a) {
|
|
|
|
// Sets a referral URL using an xchan directly
|
|
|
|
// Link format: example.com/xref/[xchan]/[TargetURL]
|
|
|
|
// Target URL is optional.
|
|
|
|
// Cookie lasts 24 hours to survive a browser restart. Contains no personal
|
|
|
|
// information at all - just somebody else's xchan.
|
|
|
|
$referrer = argv(1);
|
2013-12-23 04:58:12 +00:00
|
|
|
$expire=time()+60*60*2;
|
2013-12-23 00:53:26 +00:00
|
|
|
$path = 'xref';
|
|
|
|
setcookie($path, $referrer, $expire, "/");
|
|
|
|
$url = '';
|
2013-12-22 20:51:49 +00:00
|
|
|
|
2013-12-23 00:53:26 +00:00
|
|
|
if (argc() > 2)
|
|
|
|
$url = argv(2);
|
2013-12-22 20:51:49 +00:00
|
|
|
|
2013-12-23 00:53:26 +00:00
|
|
|
goaway (z_root() . '/' . $url);
|
2013-12-22 20:51:49 +00:00
|
|
|
|
|
|
|
}
|