diff --git a/comments.php b/comments.php index 54ec52e..d2ba28d 100644 --- a/comments.php +++ b/comments.php @@ -5,7 +5,7 @@ include INCLUDES_DIR . 'includes.php'; /* backward compatibility */ - + if (!@$_GET['entry']) { @utils_redirect(); } else { @@ -20,7 +20,7 @@ function comment_main($module) { - global $fpdb; + global $fpdb, $fp_params; // hackish solution to get title before fullparse starts dunno, I don't like it @@ -32,9 +32,9 @@ return $module; - if (!empty($_GET['feed'])){ + if (!empty($fp_params['feed'])){ - switch($_GET['feed']) { + switch($fp_params['feed']) { case 'atom': header('Content-type: application/atom+xml'); @@ -58,10 +58,10 @@ function comment_feed() { echo "\n"; echo "\n\n"; } add_action('wp_head', 'comment_feed'); @@ -185,7 +185,7 @@ function commentform() { - global $smarty, $lang, $fpdb; + global $smarty, $lang, $fpdb, $fp_params; $comment_formid = 'fp-comments'; $smarty->assign('comment_formid', $comment_formid); @@ -205,11 +205,11 @@ global $fp_config; - $id = comment_save($_GET['entry'], $arr); + $id = comment_save($fp_params['entry'], $arr); - do_action('comment_post', $_GET['entry'], array($id, $arr)); + do_action('comment_post', $fp_params['entry'], array($id, $arr)); - $q =& new FPDB_Query(array('id'=>$_GET['entry'],'fullparse'=>false), null); + $q =& new FPDB_Query(array('id'=>$fp_params['entry'],'fullparse'=>false), null); list($entryid, $e) = $q->getEntry(); diff --git a/fp-includes/core/core.system.php b/fp-includes/core/core.system.php index d82ddbd..2c50e0c 100755 --- a/fp-includes/core/core.system.php +++ b/fp-includes/core/core.system.php @@ -122,6 +122,21 @@ utils_redirect(); } } + + + function system_init_action_params() { + + global $fp_params; + + $fp_params = array(); + + if ($x = @$_GET['x']) + $fp_params = utils_kexplode($x, ':;', false); + + $fp_params = array_merge($_GET, $fp_params); + + } + function system_init() { diff --git a/fp-includes/core/core.theme.php b/fp-includes/core/core.theme.php index 8ba9836..fa354ef 100644 --- a/fp-includes/core/core.theme.php +++ b/fp-includes/core/core.theme.php @@ -239,9 +239,7 @@ function theme_init(&$smarty) { /* &$mode */ - global $fp_config; - global $lang; - global $theme; + global $fp_config, $lang, $theme, $fp_params; // avoid compiled tpl collision (i.e. change theme without this and cry) $smarty->compile_id = md5($fp_config['general']['theme']); @@ -294,7 +292,7 @@ $smarty->register_modifier('filed', 'theme_entry_categories'); - if (!isset($_GET['feed']) || empty($_GET['feed'])) { + if (!isset($fp_params['feed']) || empty($fp_params['feed'])) { $smarty->register_modifier('date_format_daily', 'theme_smarty_modifier_date_format_daily'); $smarty->register_modifier('date_format', 'theme_date_format'); } @@ -419,7 +417,7 @@ add_filter('feed_link', 'theme_def_feed_link', 0, 2); function theme_def_feed_link($str, $type) { - return BLOG_BASEURL . "?feed={$type}"; + return BLOG_BASEURL . "?x=feed:{$type}"; } function theme_feed_link ($feed='rss2') { return apply_filters('feed_link', '', $feed); @@ -427,7 +425,7 @@ add_filter('post_comments_feed_link', 'theme_def_feed_comments_link', 0, 3); function theme_def_feed_comments_link($str, $feed, $id) { - return BLOG_BASEURL . "?entry=$id&comments&feed={$feed}"; + return BLOG_BASEURL . "?x=entry:$id;comments:1;feed:{$feed}"; } function theme_comments_feed_link ($feed='rss2', $id) { return apply_filters('post_comments_feed_link', '', $feed, $id); @@ -436,7 +434,7 @@ add_filter('post_link', 'theme_def_permalink', 0, 2); function theme_def_permalink($str, $id) { - return BLOG_BASEURL . "?entry=$id"; + return BLOG_BASEURL . "?x=entry:$id"; } function get_permalink ($id) { return apply_filters('post_link', '', $id); @@ -444,7 +442,7 @@ add_filter('comments_link', 'theme_def_commentlink', 0, 2); function theme_def_commentlink($str, $id) { - return BLOG_BASEURL . "?entry=$id&comments"; + return BLOG_BASEURL . "?x=entry:$id;comments:1"; } function get_comments_link ($id) { return apply_filters('comments_link', '', $id); @@ -461,7 +459,7 @@ add_filter('category_link', 'theme_def_catlink', 0, 2); function theme_def_catlink($str, $catid) { - return BLOG_BASEURL . "?cat=$catid"; + return BLOG_BASEURL . "?x=cat:$catid"; } function get_category_link($catid) { return apply_filters('category_link', '', $catid); @@ -472,7 +470,7 @@ return wp_specialchars( apply_filters( 'year_link', - BLOG_BASEURL . '?y='. str_pad($year, 2, '0', STR_PAD_LEFT), + BLOG_BASEURL . '?x=y:'. str_pad($year, 2, '0', STR_PAD_LEFT), $year) ); } @@ -481,8 +479,8 @@ return wp_specialchars( apply_filters( 'month_link', - BLOG_BASEURL . '?y='. str_pad($year, 2, '0', STR_PAD_LEFT) . - '&m=' . str_pad($month, 2, '0', STR_PAD_LEFT), + BLOG_BASEURL . '?x=y:'. str_pad($year, 2, '0', STR_PAD_LEFT) . + ';m:' . str_pad($month, 2, '0', STR_PAD_LEFT), $year, $month) ); @@ -492,9 +490,9 @@ return wp_specialchars( apply_filters( 'month_link', - BLOG_BASEURL . '?y='. str_pad($year, 2, '0', STR_PAD_LEFT) - . '&m=' . str_pad($month, 2, '0', STR_PAD_LEFT) - . '&d=' . str_pad($day, 2, '0', STR_PAD_LEFT), + BLOG_BASEURL . '?y:'. str_pad($year, 2, '0', STR_PAD_LEFT) + . ';m:' . str_pad($month, 2, '0', STR_PAD_LEFT) + . ';d:' . str_pad($day, 2, '0', STR_PAD_LEFT), $year, $month) ); diff --git a/fp-includes/core/core.wp-default-filters.php b/fp-includes/core/core.wp-default-filters.php index 47f2850..3c2f297 100755 --- a/fp-includes/core/core.wp-default-filters.php +++ b/fp-includes/core/core.wp-default-filters.php @@ -1,6 +1,7 @@ categories)) - $_GET['category'] = $c; + $this->fp_params['cat'] = $c; } else { - $_GET['category'] = $matches[1]; + $this->fp_params['cat'] = $matches[1]; } } @@ -169,9 +170,9 @@ class Plugin_PrettyURLs { function handle_date($matches) { - $_GET['y'] = $matches[1]; - if (isset($matches[3])) $_GET['m'] = $matches[3] ; - if (isset($matches[5])) $_GET['d'] = $matches[5]; + $this->fp_params['y'] = $matches[1]; + if (isset($matches[3])) $this->fp_params['m'] = $matches[3] ; + if (isset($matches[5])) $this->fp_params['d'] = $matches[5]; $this->date_handled = true; @@ -179,40 +180,40 @@ class Plugin_PrettyURLs { function handle_static($matches) { - $_GET['page'] = $matches[1]; + $this->fp_params['page'] = $matches[1]; $this->status = 2; } function handle_entry($matches) { if (PRETTYURLS_TITLES) { - if (isset($this->index[$_GET['y']][$_GET['m']][$_GET['d']][md5($matches[1])])) { - $_GET['entry'] = $this->index[$_GET['y']][$_GET['m']][$_GET['d']][md5($matches[1])]; + if (isset($this->index[$this->fp_params['y']][$this->fp_params['m']][$this->fp_params['d']][md5($matches[1])])) { + $this->fp_params['entry'] = $this->index[$this->fp_params['y']][$this->fp_params['m']][$this->fp_params['d']][md5($matches[1])]; } else { // a bit hackish: we make up a fake url when there is no match, // so that at the higher level the system will 404... - $_GET['entry'] = 'entry000000-000000'; + $this->fp_params['entry'] = 'entry000000-000000'; } } else { - $_GET['entry'] = $matches[1]; + $this->fp_params['entry'] = $matches[1]; } } function handle_page($matches) { - $_GET['paged'] = $matches[1]; + $this->fp_params['paged'] = $matches[1]; $this->status = 2; } function handle_comment($matches) { - $_GET['comments'] = true; + $this->fp_params['comments'] = true; } function handle_feed($matches) { - $_GET['feed'] = isset($matches[2])? $matches[2]:'rss2'; + $this->fp_params['feed'] = isset($matches[2])? $matches[2]:'rss2'; } @@ -233,6 +234,10 @@ class Plugin_PrettyURLs { function cache_init() { + global $fp_params; + + $this->fp_params =& $fp_params; + if (PRETTYURLS_TITLES) { if ($f = io_load_file(PRETTYURLS_CACHE)) $this->index = unserialize($f); @@ -415,18 +420,18 @@ class Plugin_PrettyURLs { $l = BLOG_BASEURL; - if ( ( is_numeric($cid = @$_GET['category']) ) || - is_numeric($cid = @$_GET['cat']) ) + if ( ( is_numeric($cid = @$this->fp_params['category']) ) || + is_numeric($cid = @$this->fp_params['cat']) ) $l = $this->categorylink($l, $cid); - if (isset($_GET['y']) && $_GET['y']) { - $l .= '20'. $_GET['y'] . '/'; + if (isset($this->fp_params['y']) && $this->fp_params['y']) { + $l .= '20'. $this->fp_params['y'] . '/'; - if (isset($_GET['m']) && $_GET['m']) { - $l .= $_GET['m'] . '/'; + if (isset($this->fp_params['m']) && $this->fp_params['m']) { + $l .= $this->fp_params['m'] . '/'; - if (isset($_GET['d']) && $_GET['d']) - $l .= $_GET['d'] . '/'; + if (isset($this->fp_params['d']) && $this->fp_params['d']) + $l .= $this->fp_params['d'] . '/'; } @@ -434,7 +439,7 @@ class Plugin_PrettyURLs { $page = 1; - if (isset($_GET['paged']) && $_GET['paged']>1) $page = $_GET['paged']; + if (isset($this->fp_params['paged']) && $this->fp_params['paged']>1) $page = $this->fp_params['paged']; $page += $v; diff --git a/fp-plugins/readmore/plugin.readmore.php b/fp-plugins/readmore/plugin.readmore.php index b57e2bf..45f0960 100755 --- a/fp-plugins/readmore/plugin.readmore.php +++ b/fp-plugins/readmore/plugin.readmore.php @@ -33,6 +33,7 @@ Author URI: http://www.nowhereland.it/ function plugin_readmore_main($string) { + global $fp_params; $MODE = 'manual'; @@ -77,8 +78,8 @@ function plugin_readmore_main($string) { } - if ($q->single || isset($_GET['entry'])) { - $string = str_replace('[more]', "", $string); + if ($q->single || isset($fp_params['entry'])) { + $string = str_replace('[more]', "", $string); } return $string; diff --git a/index.php b/index.php index 5b874f5..6cfa554 100644 --- a/index.php +++ b/index.php @@ -45,9 +45,9 @@ function index_singlepost(&$params, &$module) { - global $fpdb, $theme; + global $fpdb, $theme, $fp_params; - $params['id'] = $_GET['entry']; + $params['id'] = $fp_params['entry']; $params['fullparse']=true; $fpdb->query($params); @@ -56,7 +56,7 @@ add_filter('wp_title', 'index_permatitle', 10, 2); - if (isset($_GET['comments'])) { + if (isset($fp_params['comments'])) { $module = 'comments.tpl'; $params['comments'] = true; @@ -95,35 +95,37 @@ function index_showposts(&$params, &$module) { - if (isset($_GET['d']) && $_GET['d']) - $params['d'] = $_GET['d']; + global $fp_params; - if (isset($_GET['m']) && $_GET['m']) - $params['m'] = $_GET['m']; + if (isset($fp_params['d']) && $fp_params['d']) + $params['d'] = $fp_params['d']; - if (isset($_GET['y']) && $_GET['y']) - $params['y'] = $_GET['y']; + if (isset($fp_params['m']) && $fp_params['m']) + $params['m'] = $fp_params['m']; - if (isset($_GET['start']) && $_GET['start']) - $params['start'] = intval($_GET['start']); + if (isset($fp_params['y']) && $fp_params['y']) + $params['y'] = $fp_params['y']; - if (isset($_GET['count']) && $_GET['count']) - $params['count'] = intval($_GET['count']); - if (isset($_GET['category']) && is_numeric($_GET['category'])) - $params['category'] = intval($_GET['category']); + if (isset($fp_params['start']) && $fp_params['start']) + $params['start'] = intval($fp_params['start']); + + if (isset($fp_params['count']) && $fp_params['count']) + $params['count'] = intval($fp_params['count']); + if (isset($fp_params['category']) && is_numeric($fp_params['category'])) + $params['category'] = intval($fp_params['category']); - if (isset($_GET['cat']) && is_numeric($_GET['cat'])) - $params['category'] = intval($_GET['cat']); + if (isset($fp_params['cat']) && is_numeric($fp_params['cat'])) + $params['category'] = intval($fp_params['cat']); - if (isset($_GET['random'])) { - if (empty($_GET['random'])) + if (isset($fp_params['random'])) { + if (empty($fp_params['random'])) $params['random'] = 1; - elseif (is_numeric($_GET['random'])) - $params['random'] = intval($_GET['random']); + elseif (is_numeric($fp_params['random'])) + $params['random'] = intval($fp_params['random']); } - if ((isset($_GET['paged'])) && is_numeric($_GET['paged']) && $_GET['paged']>0) - $params['page']=$_GET['paged']; + if ((isset($fp_params['paged'])) && is_numeric($fp_params['paged']) && $fp_params['paged']>0) + $params['page']=$fp_params['paged']; else $params['page'] = 1; @@ -131,20 +133,20 @@ function index_main() { - global $fpdb, $smarty, $fp_config; + global $fpdb, $smarty, $fp_config, $fp_params; $params = array(); $module = 'index.tpl' ; $can404 = true; - if (!empty($_GET['entry'])) { + if (!empty($fp_params['entry'])) { index_singlepost($params, $module); } elseif ( - ($explicit_req = $page = @$_GET['page']) || - (empty($_GET) && $page = @$fp_config['general']['startpage']) + ($explicit_req = $page = @$fp_params['page']) || + (empty($fp_params) && $page = @$fp_config['general']['startpage']) ) { @@ -155,11 +157,11 @@ $module = search_main(); } else { - if (!empty($_GET['feed'])){ + if (!empty($fp_params['feed'])){ $can404=false; - switch($_GET['feed']) { + switch($fp_params['feed']) { case 'atom': header('Content-type: application/atom+xml'); $module = SHARED_TPLS . 'atom.tpl';