From 73191e60338c864c84bffc7a217d2c7895f00533 Mon Sep 17 00:00:00 2001 From: real_nowhereman Date: Sun, 15 Feb 2009 08:33:44 +0000 Subject: [PATCH] category array on edit was assumed to be int-only: added skip --- comments.php | 4 +- fp-includes/core/core.entry.php | 1 + index.php | 82 ++++++++++++++++++++++++++++++++- 3 files changed, 83 insertions(+), 4 deletions(-) diff --git a/comments.php b/comments.php index 0570ac3..010c301 100644 --- a/comments.php +++ b/comments.php @@ -38,12 +38,12 @@ case 'atom': header('Content-type: application/atom+xml'); - $module = SHARED_TPLS . 'comment-atom.tpl'; + $module = SHARED_TPLS . 'comment-atom'; break; case 'rss2': default: header('Content-type: application/rss+xml'); - $module = SHARED_TPLS . 'comment-rss.tpl'; + $module = SHARED_TPLS . 'comment-rss'; } diff --git a/fp-includes/core/core.entry.php b/fp-includes/core/core.entry.php index 67e1841..53dd0fc 100755 --- a/fp-includes/core/core.entry.php +++ b/fp-includes/core/core.entry.php @@ -130,6 +130,7 @@ if ($del) { foreach($del as $cat) { // echo 'DEL '. $cat,"\n"; + if (!is_numeric($cat)) continue; $this_index =& $this->get_index($cat); $this_index->delitem($key); } diff --git a/index.php b/index.php index 1196c01..592b6e9 100644 --- a/index.php +++ b/index.php @@ -10,6 +10,8 @@ if (!file_exists(CONFIG_FILE)) utils_redirect('setup.php'); + + /* local function defines follow */ @@ -130,7 +132,82 @@ $params['page'] = 1; } + + $fp_uri_handlers = array(); + + function register_uri_param($handler, $function, $priority = 10) { + global $fp_uri_handlers; + if (is_callable($function)) + $fp_uri_handlers[$priority][$handler][] = $function; + } + + function unregister_uri_param($handler, $function) { + global $fp_uri_handlers; + foreach($fp_uri_handlers as $priority => $handler) { + if ($i = array_search($function, $hand)) { + unset($fp_uri_handlers[$priority][$handler][$i]); + } + } + } + + function handle_uri_params() { + global $fp_uri_handlers, $fp_params; + + $params = array(); + $module = 'default'; + + ksort($fp_uri_handlers); + foreach($fp_uri_handlers as $priority => $handler_group) { + foreach($handler_group as $handle_id => $func_group) { + if (empty($fp_params[$handle_id])) + continue; + foreach($func_group as $func) { + $continue = call_user_func_array($func, array(&$params, &$module)); + if (!$continue) break; + } + } + } + + return $module; + + } + + register_uri_param('entry', 'handle_entry'); + register_uri_param('comments', 'handle_comments'); + + function handle_entry(&$params, &$module/*&$handle*/) { + global $fpdb, $theme, $fp_params; + + $params['id'] = $fp_params['entry']; + $params['fullparse']=true; + + $fpdb->query($params); + + if (@$theme['hassingle']) + $module='single.tpl'; + + add_filter('wp_title', 'index_permatitle', 10, 2); + + $module = 'index'; + + return true; + + } + + function handle_comments(&$params, &$module) { + global $fpdb, $theme, $fp_params; + + $module = 'comments'; + $params['comments'] = true; + + include('comments.php'); + + return false; + } + + + function index_main() { global $fpdb, $smarty, $fp_config, $fp_params; @@ -198,12 +275,13 @@ function index_display() { global $smarty; + $module = handle_uri_params(); - $module = index_main(); + //$module = index_main(); theme_init($smarty); - $smarty->display($module); + $smarty->display($module.'.tpl'); unset($smarty);