From 5fc635f7bba37e47054faa2ecc2cc246d7d16f6a Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 8 Jan 2012 14:27:48 +0100 Subject: Fixed some plugin related bugs. * Plugin backend pages did not work. * Plugin author was not transferred to database. --- ratatoeskr/backend.php | 10 +++++++++- ratatoeskr/main.php | 1 + ratatoeskr/sys/models.php | 2 +- ratatoeskr/sys/plugin_api.php | 4 ++-- ratatoeskr/sys/urlprocess.php | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) (limited to 'ratatoeskr') diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php index 80fbc26..5d736b3 100644 --- a/ratatoeskr/backend.php +++ b/ratatoeskr/backend.php @@ -57,6 +57,12 @@ function askyesno($ste, $callback, $question, $yes=NULL, $no=NULL, $moredetails= return $ste->exectemplate("systemtemplates/areyousure.html"); } +$backend_subactions = NULL; + +function build_backend_subactions() +{ +global $backend_subactions, $pluginpages_handlers; + $backend_subactions = url_action_subactions(array( "_index" => url_action_alias(array("login")), "index" => url_action_alias(array("login")), @@ -1932,7 +1938,9 @@ $backend_subactions = url_action_subactions(array( echo $ste->exectemplate("systemtemplates/confirminstall.html"); } )), - "pluginpages" => url_action_subactions($pluginpages_handlers) + "pluginpages" => url_action_subactions(&$pluginpages_handlers) )); +} + ?> diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php index b3235b4..616fed1 100644 --- a/ratatoeskr/main.php +++ b/ratatoeskr/main.php @@ -50,6 +50,7 @@ function ratatoeskr() } /* Register URL handlers */ + build_backend_subactions(); register_url_handler("_default", "frontend_url_handler"); register_url_handler("_index", "frontend_url_handler"); register_url_handler("index", "frontend_url_handler"); diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php index d371f9f..02fa0fc 100644 --- a/ratatoeskr/sys/models.php +++ b/ratatoeskr/sys/models.php @@ -1285,7 +1285,7 @@ class Plugin extends BySQLRowEnabled if(!empty($pkg->custompriv)) array2dir($pkg->custompriv, dirname(__FILE__) . "/../plugin_extradata/private/" . $this->get_id()); if(!empty($pkg->tpls)) - array2dir($pkg->tpls, dirname(__FILE__) . "/../templates/srv/plugintemplates/" . $this->get_id()); + array2dir($pkg->tpls, dirname(__FILE__) . "/../templates/src/plugintemplates/" . $this->get_id()); } protected function populate_by_sqlrow($sqlrow) diff --git a/ratatoeskr/sys/plugin_api.php b/ratatoeskr/sys/plugin_api.php index 797f42d..7a80a5b 100644 --- a/ratatoeskr/sys/plugin_api.php +++ b/ratatoeskr/sys/plugin_api.php @@ -168,13 +168,13 @@ abstract class RatatoeskrPlugin global $pluginpages_handlers; $this->ste->vars["pluginpages"][$this->id] = $label; - sort($this->ste->vars["pluginpages"]); + asort($this->ste->vars["pluginpages"]); $pluginid = $this->id; $pluginpages_handlers["p{$this->id}"] = function(&$data, $url_now, &$url_next) use($pluginid, $fx) { global $ste, $rel_path_to_root; $ste->vars["rel_path_to_pluginpage"] = "$rel_path_to_root/backend/pluginpages/p$pluginid"; - $rv = $fx($data, $url_now, $url_next); + $rv = call_user_func_array($fx, array(&$data, $url_now, &$url_next)); unset($ste->vars["rel_path_to_pluginpage"]); return $rv; }; diff --git a/ratatoeskr/sys/urlprocess.php b/ratatoeskr/sys/urlprocess.php index 14d67c1..d3c5edb 100644 --- a/ratatoeskr/sys/urlprocess.php +++ b/ratatoeskr/sys/urlprocess.php @@ -124,7 +124,7 @@ function url_process($url, $actions, &$data) try { - $cb($data, $url_now, $url_next); + call_user_func_array($cb, array(&$data, $url_now, &$url_next)); } catch(NotFoundError $e) { -- cgit v1.2.3-54-g00ecf