exec($niclcmd, $nresults); $nistr = $nresults[0]; $results[$resind]['ni'] = $nistr; // cache a copy, make the .well-known link, store the meta-data getAlg($nistr, $algfound, $hstr, $hashval); $filename = $GLOBALS["cfg_cache"] . "/" . $hstr . ";" . $hashval; rename($tfname, $filename); $results[$resind]['file'] = $filename; // make a link $wlname = $GLOBALS["cfg_wkd"] . "/{$hstr}/{$hashval}"; $rv = symlink($filename, $wlname); $results[$resind]['wku'] = $wlname; $wku = $GLOBALS["cfg_site"] . "/.well-known/ni/" . $hstr . "/" . $hashval; // make meta-data file $extrameta = "{ \"search\" : \"{$tokens}\"}"; storeMeta($hstr, $hashval, $nistr, $item->Url, $wku, $extrameta); // some output please if ($rform == "html") { print "<li>"; print "<a href=\"{$wku}\">{$nistr}</a>"; print "</li>"; } // increment, why not $resind++; } $timestamp = date(DATE_ATOM); if ($rform == "html") { print "</ul><t>Generated at: {$timestamp}</t></html>"; } if ($rform == "json") { header('MIME-Version: 1.0');
if ($jstr == NULL) { $extrameta = "{ \"publish\" : \"php\" }"; } else { $ojstr = $jstr->meta; $ojstr->publish = "php"; $tmp = json_encode($ojstr); if ($tmp === false) { $extrameta = "{ \"publish\" : \"php\" }"; } else { $extrameta = $tmp; } } } else { $extrameta = "{ \"publish\" : \"php\" }"; } $store_rv = storeMeta($hstr, $hashval, $urival, $loc1, $loc2, $extrameta); if ($store_rv) { $ni_err = true; $ni_errno = 494; $ni_errstr = "Bummer: {$ni_errno} I don't have {$urival} \nBad algorithm, no good alg found."; retErr($ni_errno, $ni_errstr); } if ($rform == "html") { header("Content-Type: text/html"); print "<html><head><title>NetInf PUBLISH results</title></head><body>"; print "<h1>NetInf PUBLISH results</h1>"; print "<br/>"; if ($respstatus == 200) { print "<t>Ok, I've put that there. (for now!)</t>"; } else { print "<t>I probably had that already ({$respstatus})</t>";