2 // Handle inexistant root favicon requests and exit
\r
3 if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
\r
4 header('Content-Type: image/gif');
\r
5 echo base64_decode("R0lGODlhEAAQAJECAAAAzFZWzP///wAAACH5BAEAAAIALAAAAAAQABAAAAIplI+py+0PUQAgSGoNQFt0LWTVOE6GuX1H6onTVHaW2tEHnJ1YxPc+UwAAOw==");
\r
10 require_once( dirname(__FILE__).'/includes/load-yourls.php' );
\r
12 // Get request in YOURLS base (eg in 'http://site.com/yourls/abcd' get 'abdc')
\r
13 $request = yourls_get_request();
\r
15 // Make valid regexp pattern from authorized charset in keywords
\r
16 $pattern = yourls_make_regexp_pattern( yourls_get_shorturl_charset() );
\r
18 // Now load required template and exit
\r
20 yourls_do_action( 'pre_load_template', $request );
\r
22 // At this point, $request is not sanitized. Sanitize in loaded template.
\r
25 if( preg_match( "@^([$pattern]+)/?$@", $request, $matches ) ) {
\r
26 $keyword = isset( $matches[1] ) ? $matches[1] : '';
\r
27 $keyword = yourls_sanitize_keyword( $keyword );
\r
28 yourls_do_action( 'load_template_go', $keyword );
\r
29 include( YOURLS_ABSPATH.'/yourls-go.php' );
\r
34 if( preg_match( "@^([$pattern]+)\+(all)?/?$@", $request, $matches ) ) {
\r
35 $keyword = isset( $matches[1] ) ? $matches[1] : '';
\r
36 $keyword = yourls_sanitize_keyword( $keyword );
\r
37 $aggregate = isset( $matches[2] ) ? (bool)$matches[2] && yourls_allow_duplicate_longurls() : false;
\r
38 yourls_do_action( 'load_template_infos', $keyword );
\r
39 include( YOURLS_ABSPATH.'/yourls-infos.php' );
\r
43 // Prefix-n-Shorten sends to bookmarklet (doesn't work on Windows)
\r
44 if( preg_match( "@^[a-zA-Z]+://.+@", $request, $matches ) ) {
\r
45 $url = yourls_sanitize_url( $matches[0] );
\r
46 yourls_do_action( 'load_template_redirect_admin', $url );
\r
47 yourls_redirect( yourls_admin_url('index.php').'?u='.rawurlencode( $url ), 302 );
\r
51 // Past this point this is a request the loader could not understand
\r
52 yourls_do_action( 'loader_failed', $request );
\r
53 yourls_redirect( YOURLS_SITE, 302 );
\r