diff --git a/index.php b/index.php index 9311c79..48858dc 100644 --- a/index.php +++ b/index.php @@ -12,10 +12,16 @@ $viewDir = '/views/'; // Define your routes using regular expressions + +// TODO: re-add auto detection of files in /views as routes $routes = [ '/' => 'home.php', - '/admin' => 'admin.php', - '/about' => 'about.php', + '/new' => 'new_twt.php', + '/add' => 'add_feed.php', + '/following' => 'following.php', + '/refresh' => 'load_twt_files.php', + '/login' => 'login.php', + '/logout' => 'logout.php', '/profile/([a-zA-Z0-9_-]+)' => 'profile.php', '/conv/([a-zA-Z0-9]{7})' => 'conv.php', // matches only twtHash of exactly 7 alphanumeric characters '/post/([a-zA-Z0-9]{7})' => 'post.php', // matches only twtHash of exactly 7 alphanumeric characters diff --git a/libs/Slimdown.php b/libs/Slimdown.php index 81e26dd..6e2c8d2 100644 --- a/libs/Slimdown.php +++ b/libs/Slimdown.php @@ -24,10 +24,8 @@ class Slimdown { public static $rules = array ( '/```(.*?)```/s' => self::class .'::code_parse', // code blocks - //'/\n(#+)(.*)/' => self::class .'::header', // headers - '/\n(#\s+)(.*)/' => self::class .'::header', // headers - only with a space between # and text, to avoid matching with `#hashtags` - //'/\!\[([^\[]+)\]\(([^\)]+)\)/' => self::class .'::img', // images - '/\!\[(.*?)\]\(([^\)]+)\)/' => self::class .'::img', // images 2 + '/\n(#+)\s+(.*)/' => self::class .'::header', // headers + '/\!\[([^\[]*?)\]\(([^\)]+)\)/' => self::class .'::img', // images '/\[([^\[]+)\]\(([^\)]+)\)/' => self::class .'::link', // links '/(\*\*|__)(?=(?:(?:[^`]*`[^`\r\n]*`)*[^`]*$))(?![^\/<]*>.*<\/.+>)(.*?)\1/' => '\2', // bold '/(\*|_)(?=(?:(?:[^`]*`[^`\r\n]*`)*[^`]*$))(?![^\/<]*>.*<\/.+>)(.*?)\1/' => '\2', // emphasis @@ -79,6 +77,7 @@ class Slimdown { } if (! empty ($trimmed)) { //return sprintf ("\n
%s
\n", $trimmed); + return sprintf ("\n%s\n", $trimmed); } return $trimmed; } diff --git a/libs/session.php b/libs/session.php index 5407aab..28ffa4a 100644 --- a/libs/session.php +++ b/libs/session.php @@ -13,11 +13,6 @@ if(isset($_POST['submit_pass']) && $_POST['pass']) } else { - $error="Incorrect Pssword"; + $error="Incorrect Password"; } } - -if(isset($_POST['page_logout'])) -{ - unset($_SESSION['password']); -} \ No newline at end of file diff --git a/libs/twtxt.php b/libs/twtxt.php index e857f8e..8a1abfb 100644 --- a/libs/twtxt.php +++ b/libs/twtxt.php @@ -124,7 +124,8 @@ function replaceMentionsFromTwt(string $twtString): string { // Example output: Hello @eapl.mx@eapl.mx/twtxt.txt, how are you? @nick@server.com/something/twtxt.txt $pattern = '/@<([^ ]+)\s([^>]+)>/'; - $replacement = '@$1'; + //$replacement = '@$1'; + $replacement = '@$1'; #$twtString = '@