cloudlog/application/controllers/Plugin_awards.php
Peter Goodhall 4cfab6fe4e Add plugin system and Plugin Manager
Introduce a plugin framework and management UI: adds Plugin Manager controller, Plugin_awards controller, Plugin_manager and Cloudlog_hooks libraries, Plugins_model, migration (268) to create the plugins table, and views for plugin manager and award pages. Integrates hooks into Logbook_model (qso.filter.before_save, qso.action.after_save, qso.action.after_edit), updates header to show award plugin entries and a Plugin Manager menu link, and bumps migration_version to 268. Also adds .gitignore rules, plugin index placeholder, docs and example plugin packages. The Plugin Manager supports uploading/installing ZIP packages, safe extraction, manifest validation, enable/disable/delete actions, and CSRF protection.
2026-04-29 22:33:22 +01:00

41 lines
1.3 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Plugin_awards extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('user_model');
if (!$this->user_model->authorize(2)) {
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
redirect('dashboard');
}
$this->load->library('plugin_manager');
}
public function view($slug = '')
{
$slug = strtolower(trim((string)$slug));
$result = $this->plugin_manager->render_award_page($slug);
if (!isset($result['ok']) || $result['ok'] !== true) {
$message = isset($result['message']) ? $result['message'] : 'Unable to load plugin award page.';
$this->session->set_flashdata('notice', $message);
redirect('awards');
return;
}
$data['page_title'] = $result['page_title'];
$data['plugin_award_title'] = $result['page_title'];
$data['plugin_award_content'] = $result['content'];
$data['plugin_award_slug'] = $result['plugin_slug'];
$this->load->view('interface_assets/header', $data);
$this->load->view('plugins/award_page', $data);
$this->load->view('interface_assets/footer');
}
}