public function action_manage() { $this->template = ''; $this->auto_render = FALSE; switch ($this->request->method()) { // Update the plugin case "PUT": $plugin_id = $this->request->param('id'); $item_array = json_decode($this->request->body(), TRUE); $plugin_orm = ORM::factory('Plugin', $plugin_id); if (!$plugin_orm->loaded()) { throw new HTTP_Exception_404("The requested plugin could not be found"); } $plugin_orm->plugin_enabled = $item_array['plugin_enabled']; $plugin_orm->save(); // Run the plugin installer script if it hasn't been run before if ($plugin_orm->plugin_enabled and $plugin_orm->plugin_installed != 1) { if (Swiftriver_Plugins::install($plugin_orm->plugin_path)) { $plugin_orm->plugin_installed = 1; $plugin_orm->save(); } } break; } }