'; $links = array(); if (preg_match_all('/\[\[(.*)\]\]/', $content, $links, PREG_SET_ORDER)) { foreach($links as $link) { $divcontent .= '
'; } } $links = array(); if (preg_match_all('/(https?:.*)\b/', $content, $links, PREG_SET_ORDER)) { foreach($links as $link) { $url = $link[1]; $title = webpagetitle($url); $divcontent .= ''; } } $divcontent .= ''; return $divcontent; } function computepreview($title, $content) { require 'libs/Parsedown.php'; $pos = 0; if (str_starts_with($content, '---')) { $pos = strpos($content, '---', 3) + 3; } $Parsedown = new Parsedown(); $Parsedown->setBreaksEnabled(true); $preview = $Parsedown->text('# ' . $title . "\r\n" . substr($content, $pos)); return $preview; } // authent if ($password && (!isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_PW'] != $password)) { header('WWW-Authenticate: Basic realm="bbn"'); header('HTTP/1.0 401 Unauthorized'); echo 'Access denied.