Server IP : 184.154.167.98 / Your IP : 52.15.209.178 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/mesa/include/ |
Upload File : |
<?php require_once(INCLUDE_DIR . 'class.plugin.php'); class PluginsAjaxAPI extends AjaxController { /* * Protect all routines in this controller */ function access() { global $thisstaff; if (!$thisstaff || !$thisstaff->isAdmin()) Http::response(403, 'Access Denied'); return true; } // helper func to look up plugin & instance private function lookup($plugin_id, $instance_id=0) { if (!($plugin = PluginManager::lookup( (int) $plugin_id))) Http::response(404, 'No such plugin'); if ($instance_id && !($instance = $plugin->getInstance( (int) $instance_id))) Http::response(404, 'No such plugin instance'); return [$plugin, $instance]; } function getInstances($plugin_id) { list($plugin,)= $this->lookup($plugin_id); $pjax_container = '#items'; include(STAFFINC_DIR . 'templates/plugin-instances.tmpl.php'); } function updateInstance($plugin_id, $instance_id) { list($plugin, $instance) = $this->lookup($plugin_id, $instance_id); $errors = array(); if ($_POST && $instance->update($_POST, $errors)) Http::response(201, $this->encode([ 'redirect' => sprintf('plugins.php?id=%d#instances', $plugin->getId()) ])); $form = $instance->getForm(); $action = "#plugins/{$plugin->getId()}/instances/{$instance->getId()}/update"; include STAFFINC_DIR . 'templates/plugin-instance-modal.tmpl.php'; } function addInstance($plugin_id) { list($plugin,) = $this->lookup($plugin_id); $errors = array(); if ($_POST && ($instance=$plugin->addInstance($_POST, $errors))) Http::response(201, $this->encode([ 'redirect' => sprintf('plugins.php?id=%d#instances', $plugin->getId()) ])); // This should return cached form with errors (if any) $form = $plugin->getConfigForm(); // Set action $action = "#plugins/{$plugin->getId()}/instances/add"; include(STAFFINC_DIR . 'templates/plugin-instance-modal.tmpl.php'); } } ?>