From ecdef9a9ca4045b19e8e2ec23fcf327c303a5a85 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Mon, 14 Jun 2010 16:26:29 +0000 Subject: [PATCH] First attempt at http://sho.rt/http://site/ rewrite rule (most likely will fail on Windows) git-svn-id: http://yourls.googlecode.com/svn/trunk@397 12232710-3e20-11de-b438-597f59cd7555 --- yourls-loader.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/yourls-loader.php b/yourls-loader.php index e187fcb..be0e05b 100644 --- a/yourls-loader.php +++ b/yourls-loader.php @@ -23,20 +23,29 @@ // At this point, $request is not sanitized. Sanitize in loaded template. // Redirection: -if( preg_match( "/^([$pattern]+)\/?$/", $request, $matches ) ) { +if( preg_match( "@^([$pattern]+)/?$@", $request, $matches ) ) { $keyword = isset( $matches[1] ) ? $matches[1] : ''; include( YOURLS_ABSPATH.'/yourls-go.php' ); exit; } // Stats: -if( preg_match( "/^([$pattern]+)\+(all)?\/?$/", $request, $matches ) ) { +if( preg_match( "@^([$pattern]+)\+(all)?/?$@", $request, $matches ) ) { $keyword = isset( $matches[1] ) ? $matches[1] : ''; $aggregate = isset( $matches[2] ) ? (bool)$matches[2] && yourls_allow_duplicate_longurls() : false; include( YOURLS_ABSPATH.'/yourls-infos.php' ); exit; } +/** Check this on Linux. Cannot run on Windows, see https://issues.apache.org/bugzilla/show_bug.cgi?id=41441 +// Bookmarklet: +if( preg_match( "@^[a-zA-Z]://.+@", $request, $matches ) ) { + $url = $matches[0]; + yourls_redirect( yourls_admin_url('index.php').'?u='.rawurlencode( $url ) ); + exit; +} +/**/ + // Past this point this is a request the loader could not understand yourls_do_action( 'loader_failed', $request ); yourls_redirect( YOURLS_SITE, 307 ); -- 2.45.0