From a81e2af2eaec0789a7d05306a86b1394f5f7a719 Mon Sep 17 00:00:00 2001 From: Harvie Date: Mon, 29 Nov 2010 00:34:55 +0100 Subject: [PATCH] Finaly sent all mod_rewrites to trash :-), few minor cleanups... Hromi a blesky na vas :-P --- apache/kyberia.conf | 41 ++++++++++++++++++++++------------------- wwwroot/nodes.php | 15 ++++++++------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/apache/kyberia.conf b/apache/kyberia.conf index 2dbc369..9023343 100644 --- a/apache/kyberia.conf +++ b/apache/kyberia.conf @@ -64,25 +64,28 @@ RewriteRule ^(.+) - [L] RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^id/([0-9]+)/?$ /nodes.php?node_id=$1 [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^id/([0-9]+)/([0-9]+)/(.+)/?$ /nodes.php?node_id=$1&template_id=$2&magic_word=$3 [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^id/([0-9]+)/(.+)/?$ /nodes.php?node_id=$1&template_id=$2 [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^([^/]+)/?$ /nodes.php?node_name=$1 [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^([^/]+)/([^/]+)/?$ /nodes.php?node_name=$1&template_id=$2 [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^$ /nodes.php?node_id=1 - - #base36 - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^k/([0-9a-zA-Z]+)/?$ /nodes.php?node_kid=$1 [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^k/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)/(.+)/?$ /nodes.php?node_kid=$1&template_kid=$2&magic_word=$3 [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^k/([0-9a-zA-Z]+)/(.+)/?$ /nodes.php?node_kid=$1&template_kid=$2 [L] + RewriteRule ^(.*) /nodes.php/$1 [L] + +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^id/([0-9]+)/?$ /nodes.php?node_id=$1 [L] +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^id/([0-9]+)/([0-9]+)/(.+)/?$ /nodes.php?node_id=$1&template_id=$2&magic_word=$3 [L] +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^id/([0-9]+)/(.+)/?$ /nodes.php?node_id=$1&template_id=$2 [L] +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^([^/]+)/?$ /nodes.php?node_name=$1 [L] +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^([^/]+)/([^/]+)/?$ /nodes.php?node_name=$1&template_id=$2 [L] +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^$ /nodes.php?node_id=1 +# +# #base36 +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^k/([0-9a-zA-Z]+)/?$ /nodes.php?node_kid=$1 [L] +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^k/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)/(.+)/?$ /nodes.php?node_kid=$1&template_kid=$2&magic_word=$3 [L] +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteRule ^k/([0-9a-zA-Z]+)/(.+)/?$ /nodes.php?node_kid=$1&template_kid=$2 [L] Options Indexes FollowSymLinks diff --git a/wwwroot/nodes.php b/wwwroot/nodes.php index a6b0620..eb734ab 100644 --- a/wwwroot/nodes.php +++ b/wwwroot/nodes.php @@ -1,4 +1,5 @@ "); var_dump(preg_split('/\//', $_SERVER['PATH_INFO'])); die(); //PATH_INFO Debug (usefull when messing with mod_rewrite) // output buffering forcing (mx) if (!empty($_POST['FORCE_OB']) && $_POST['FORCE_OB'] == 'true') ob_start(); @@ -20,19 +21,19 @@ error_reporting(1); if ($_SESSION['debugging']) { error_reporting(E_ALL); - echo "GET VARIABLES::
"; + echo 'GET VARIABLES::
'; print_r($_GET); - echo "POST VARIABLES::
"; + echo 'POST VARIABLES::
'; print_r($_POST); - echo "SESSION VARIABLES::
"; + echo 'SESSION VARIABLES::
'; print_r($_SESSION); } -//Path info (Experimental - thish should replace most of mod_rewrites in future...) +//Path info (Experimental - this replaced most of mod_rewrites...) @$PATH_INFO=trim($_SERVER[PATH_INFO]); if($PATH_INFO != '') { - $PATH_CHUNKS = preg_split("/\//", $PATH_INFO); + $PATH_CHUNKS = preg_split('/\//', $PATH_INFO); if(isset($PATH_CHUNKS[1])) switch($PATH_CHUNKS[1]) { case 'k': if(isset($PATH_CHUNKS[2]) && $PATH_CHUNKS[2] != '') $_GET['node_kid'] = $PATH_CHUNKS[2]; @@ -58,7 +59,7 @@ require('config/config.inc'); require(INCLUDE_DIR.'senate.inc'); if (isset($_SERVER['HTTP_REFERER'])) { - preg_match("/id\/([0-9]*)\//",$_SERVER['HTTP_REFERER'],$ref_match); + preg_match('/(k|id)\/([0-9]*)\//',$_SERVER['HTTP_REFERER'],$ref_match); $referer_id=$ref_match[1]; } @@ -94,7 +95,7 @@ $smarty = new Smarty; $smarty->template_dir = TEMPLATE_DIR; //echo TEMPLATE_DIR.TEMPLATE_SET; //echo $smarty->template_dir; -$smarty->compile_dir = SYSTEM_DATA."templates_c/"; +$smarty->compile_dir = SYSTEM_DATA.'templates_c/'; $smarty->config_dir = SMARTY_DIR.'configs/'; //XXX neexistuje $smarty->cache_dir = SMARTY_DIR.'cache/'; $smarty->plugins_dir = SMARTY_PLUGIN_DIR ; -- 2.30.2