diff --git a/partials/header.php b/partials/header.php index 2ff1158..787a3ba 100644 --- a/partials/header.php +++ b/partials/header.php @@ -46,7 +46,7 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']);
No endpoint found in: ".$mention["url"]."
"; + + } else { + + $new_twt_url = $public_txt_url."#:~:text=".$datetime; + //$target_url = $mention["url"]; + $payload = "source=".$new_twt_url."&target=".$mention["url"]; + //echo $payload; + + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $targets_webmention_endpoint); + curl_setopt($curl, CURLOPT_POST, TRUE); + curl_setopt($curl, CURLOPT_POSTFIELDS, $payload); + $data = curl_exec($curl); + $status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); + curl_close($curl); + + echo "A webmention was send to: ".$targets_webmention_endpoint." (Status: $status)
"; + } } //header('Refresh:0; url=.'); - header("Location: refresh?url=".$public_txt_url); // Trying to fix issue with douple posting - exit; + //header("Location: refresh?url=".$public_txt_url); // Trying to fix issue with douple posting + //exit; } else { require_once("partials/base.php"); - $title = "New post - ".$title; - include_once 'partials/header.php'; + + +if (!isset($textareaValue)) { + $textareaValue = ''; +} + +if (isset($_GET['hash'])) { + $hash = $_GET['hash']; + $textareaValue = "(#$hash) "; + + // COPY from conv.php + // TODO: make into a partial or global function + // Get the hashes (both post and replies) as $hash from the router and return an inverted list + $twt_op = array_filter($twts, function($twt) use ($hash) { + return $twt->hash === $hash; //|| $twt->replyToHash === $hash; + }); + //$twts = array_reverse($twts, true); + + //$textareaValue .= print_r($twts); + //$textareaValue .= $twts["nick"]; + + include_once 'partials/timeline.php'; +} + ?>