diff --git a/partials/timeline.php b/partials/timeline.php index 330126e..fb3380d 100644 --- a/partials/timeline.php +++ b/partials/timeline.php @@ -43,7 +43,7 @@ ?> - displayDate?> + displayDate?> diff --git a/views/webmention_endpoint.php b/views/webmention_endpoint.php index b92ed1e..8626846 100644 --- a/views/webmention_endpoint.php +++ b/views/webmention_endpoint.php @@ -38,29 +38,27 @@ if(!stristr($_POST['source'], ":~:text=")) { exit; } +// Process Webmentions with text fragment as to point to a twt in a twtxt.txt if (stristr($sourceFile, $_POST['target'])) { header($_SERVER['SERVER_PROTOCOL'] . ' 202 Accepted'); # Now do something with $sourceFile e.g. parse it for h-entry and h-card and store what you find. - // TODO: test if $datetime is to be found in $sourceFile + // TODO: test if $url_time is to be found in $sourceFile // and then write the $twt to the $log - $datetime = explode( ":~:text=", $_POST['source'] ); - $pattern = '/^'.$datetime[1].'\t(.*?)$/m'; + $url_time = explode( "#:~:text=", $_POST['source'] ); // split source into array with [0] for url and [1] for datetime + //$url = preg_replace("(^https?://)", "", $url_time[0] ); + $pattern = '/^'.$url_time[1].'\t(.*?)$/m'; preg_match($pattern, $sourceFile, $twt); // $twt[1] contains your line. - //preg_match('/^'.$datetime[1].'\t(.*?)$/m', $sourceFile, $twt); - $log = date("Y-m-d\TH:i:s\Z") . "\t" //.'You were mentioned in: '.$_POST['source'].'' // "%0A" means new line - .'You were mentioned in: '.$_POST['source'].'' // "%0A" means new line - ."
" // add a line break before blockquote + .'Mention from '.$url_time[0].' in '.$url_time[1].'' + // TODO: find a way to make this as markdown and the render it with correct rel and target + ."
" // add a twt line break before blockquote ."> " . $twt[1] - //."Recived webmention from ".$_POST['source'] - //." mentioning ".$_POST['target'] - //." (IP: ".$_SERVER['REMOTE_ADDR'].")" - .PHP_EOL; + .PHP_EOL; file_put_contents($logfile, $log, FILE_APPEND);