# HG changeset patch # User Dan # Date 1237661656 14400 # Node ID aed15c337b727aa44b06cbe66a6f5b5eac40919e # Parent 09c3ba4f6fbf5ab0186773e616f6b2cc779317e4 Added support for "Tiny URLs" (http://example.com/enano/?/Foo) diff -r 09c3ba4f6fbf -r aed15c337b72 includes/paths.php --- a/includes/paths.php Sat Mar 14 15:26:33 2009 -0400 +++ b/includes/paths.php Sat Mar 21 14:54:16 2009 -0400 @@ -142,13 +142,10 @@ { // This method really isn't supported because apache has a habit of passing dots as underscores, thus corrupting the request // If you really want to try it, the URI format is yoursite.com/?/Page_title - if ( count($_GET) > 0 ) + if ( !empty($_SERVER['QUERY_STRING']) && substr($_SERVER['QUERY_STRING'], 0, 1) == '/' ) { - list($getkey) = array_keys($_GET); - if ( substr($getkey, 0, 1) == '/' ) - { - $title = substr($getkey, 1); - } + $pos = ( ($_ = strpos($_SERVER['QUERY_STRING'], '&')) !== false ) ? $_ - 1: 0x7FFFFFFF; + $title = substr($_SERVER['QUERY_STRING'], 1, $pos); } } return ( $sanitize ) ? sanitize_page_id($title) : $title; diff -r 09c3ba4f6fbf -r aed15c337b72 install/includes/payload.php --- a/install/includes/payload.php Sat Mar 14 15:26:33 2009 -0400 +++ b/install/includes/payload.php Sat Mar 21 14:54:16 2009 -0400 @@ -192,6 +192,9 @@ case 'shortened': $sp_append = '/index.php/'; break; + case 'tiny': + $sp_append = '/?/'; + break; case 'rewrite': $sp_append = '/'; break; diff -r 09c3ba4f6fbf -r aed15c337b72 install/includes/stages/website.php --- a/install/includes/stages/website.php Sat Mar 14 15:26:33 2009 -0400 +++ b/install/includes/stages/website.php Sat Mar 21 14:54:16 2009 -0400 @@ -56,6 +56,20 @@ } else { + ajaxGet(scriptPath + '/install/install.php?/tiny&do=modrewrite_test', __ajaxMrwTest_chain_tiny); + } + } + } + var __ajaxMrwTest_chain_tiny = function() + { + if ( ajax.readyState == 4 ) + { + if ( ajax.responseText == 'good_tiny' ) + { + ajaxMrwSet('tiny'); + } + else + { ajaxGet(scriptPath + '/install/install.php?do=modrewrite_test&str=standard', __ajaxMrwTest_chain_standard); } } @@ -78,12 +92,13 @@ function ajaxMrwSet(level) { install_unset_ajax_loading(); - if ( !in_array(level, ['rewrite', 'shortened', 'standard']) ) + if ( !in_array(level, ['rewrite', 'shortened', 'standard', 'tiny']) ) return false; document.getElementById('url_radio_rewrite').checked = false; document.getElementById('url_radio_shortened').checked = false; document.getElementById('url_radio_standard').checked = false; + document.getElementById('url_radio_tiny').checked = false; document.getElementById('url_radio_' + level).checked = true; document.getElementById('url_radio_' + level).focus(); @@ -95,6 +110,9 @@ case 'shortened': var str = $lang.get('website_msg_bestmethod_shortened'); break; + case 'tiny': + var str = $lang.get('website_msg_bestmethod_tiny'); + break; case 'standard': var str = $lang.get('website_msg_bestmethod_standard'); break; @@ -148,7 +166,7 @@ ?> @@ -264,6 +282,23 @@ + + + + + +
+ + + + +

get('website_field_urlscheme_opt_tiny_hint'); ?>

+

get('website_field_urlscheme_lbl_example'); ?>

+
+
+

get('website_btn_urlscheme_detect'); ?>

diff -r 09c3ba4f6fbf -r aed15c337b72 install/install.php --- a/install/install.php Sat Mar 14 15:26:33 2009 -0400 +++ b/install/install.php Sat Mar 21 14:54:16 2009 -0400 @@ -195,6 +195,10 @@ { echo 'good_' . $_GET['str']; } + else if ( $_SERVER['QUERY_STRING'] == '/tiny&do=modrewrite_test' ) + { + echo 'good_tiny'; + } else { echo 'bad'; diff -r 09c3ba4f6fbf -r aed15c337b72 language/english/install.json --- a/language/english/install.json Sat Mar 14 15:26:33 2009 -0400 +++ b/language/english/install.json Sat Mar 21 14:54:16 2009 -0400 @@ -1,6 +1,6 @@ /* * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between - * Version 1.1.1 + * Version 1.1.6 (Caoineag beta 1) * Copyright (C) 2006-2007 Dan Fuhry * * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License @@ -248,6 +248,7 @@ msg_ajax_test_fail_body: 'None of the URL handling tests worked; you may have problems using Enano on your server.', msg_bestmethod_rewrite: 'The installer has detected that using rewritten URLs is the best level that will work.', msg_bestmethod_shortened: 'The installer has detected that using shortened URLs is the best level that will work.', + msg_bestmethod_tiny: 'The installer has detected that using tiny URLs is the best level that will work.', msg_bestmethod_standard: 'The installer has detected that using standard URLs is the only level that will work.', msg_modrewrite_enabled: 'Your copy of Enano has the Windows mod_rewrite workaround patch enabled.', msg_modrewrite_necessary: 'If you don\'t plan to use the Rewritten URLs option below, you should go back and re-download Enano without this workaround enabled. The mod_rewrite issues Enano faces under Windows are caused by a security change in Apache 2.2 that is not present in Apache 2.0. Learn more', @@ -270,6 +271,8 @@ field_urlscheme_opt_shortened_hint: 'This eliminates the "?title=" portion of your URL, and instead uses a slash. This is occasionally more friendly to search engines.', field_urlscheme_opt_rewrite: 'Rewritten URLs', field_urlscheme_opt_rewrite_hint: 'Using this option, you can completely eliminate the "index.php" from URLs. This is the most friendly option to search engines and looks very professional, but requires support for URL rewriting on your server. If you\'re running Apache and have the right permissions, Enano can configure this automatically. Otherwise, you\'ll need to configure your server manually and have a knowledge of regular expressions for this option to work.', + field_urlscheme_opt_tiny: '(Experimental) Tiny URLs', + field_urlscheme_opt_tiny_hint: 'This makes URLs very small - close to the size of Rewritten. However it doesn\'t work with every server, and we\'re still trying to experiment to find which servers it works with. If you can\'t use Rewritten URLs, you are encouraged to give this a try and let the Enano team know whether it works for you or not.', btn_urlscheme_detect: 'Auto-detect the best formatting scheme', objective_verify: 'Verify that your site information is correct. Again, all of the above settings can be changed from the administration panel.',