Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); namespace App\Controllers\Admin\Setting; use App\Control..

Decoded Output download

<?php

declare(strict_types=1);

namespace App\Controllers\Admin\Setting;

use App\Controllers\BaseController;
use App\Models\Config;
use Exception;
use Psr\Http\Message\ResponseInterface;
use Slim\Http\Response;
use Slim\Http\ServerRequest;

final class LlmController extends BaseController
{
    private static array $update_field = [
        'llm_backend',
        'openai_api_key',
        'openai_model_id',
        'google_ai_api_key',
        'google_ai_model_id',
        'vertex_ai_access_token',
        'vertex_ai_location',
        'vertex_ai_project_id',
        'vertex_ai_model_id',
        'huggingface_api_key',
        'huggingface_endpoint_url',
        'cf_workers_ai_account_id',
        'cf_workers_ai_api_token',
        'cf_workers_ai_model_id',
        'anthropic_api_key',
        'anthropic_model_id',
    ];

    /**
     * @throws Exception
     */
    public function index(ServerRequest $request, Response $response, array $args): ResponseInterface
    {
        $settings = Config::getClass('llm');

        return $response->write(
            $this->view()
                ->assign('update_field', self::$update_field)
                ->assign('settings', $settings)
                ->fetch('admin/setting/llm.tpl')
        );
    }

    public function save(ServerRequest $request, Response $response, array $args): ResponseInterface
    {
        foreach (self::$update_field as $item) {
            if (! Config::set($item, $request->getParam($item))) {
                return $response->withJson([
                    'ret' => 0,
                    'msg' => ' ' . $item . ' ',
                ]);
            }
        }

        return $response->withJson([
            'ret' => 1,
            'msg' => '',
        ]);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace App\Controllers\Admin\Setting;

use App\Controllers\BaseController;
use App\Models\Config;
use Exception;
use Psr\Http\Message\ResponseInterface;
use Slim\Http\Response;
use Slim\Http\ServerRequest;

final class LlmController extends BaseController
{
    private static array $update_field = [
        'llm_backend',
        'openai_api_key',
        'openai_model_id',
        'google_ai_api_key',
        'google_ai_model_id',
        'vertex_ai_access_token',
        'vertex_ai_location',
        'vertex_ai_project_id',
        'vertex_ai_model_id',
        'huggingface_api_key',
        'huggingface_endpoint_url',
        'cf_workers_ai_account_id',
        'cf_workers_ai_api_token',
        'cf_workers_ai_model_id',
        'anthropic_api_key',
        'anthropic_model_id',
    ];

    /**
     * @throws Exception
     */
    public function index(ServerRequest $request, Response $response, array $args): ResponseInterface
    {
        $settings = Config::getClass('llm');

        return $response->write(
            $this->view()
                ->assign('update_field', self::$update_field)
                ->assign('settings', $settings)
                ->fetch('admin/setting/llm.tpl')
        );
    }

    public function save(ServerRequest $request, Response $response, array $args): ResponseInterface
    {
        foreach (self::$update_field as $item) {
            if (! Config::set($item, $request->getParam($item))) {
                return $response->withJson([
                    'ret' => 0,
                    'msg' => ' ' . $item . ' ',
                ]);
            }
        }

        return $response->withJson([
            'ret' => 1,
            'msg' => '',
        ]);
    }
}

Function Calls

None

Variables

None

Stats

MD5 bc29df989dc4359f039e14b059edc88e
Eval Count 0
Decode Time 94 ms