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 CronController extends BaseController
{
    private static array $update_field = [
        'daily_job_hour',
        'daily_job_minute',
        'enable_daily_finance_mail',
        'enable_weekly_finance_mail',
        'enable_monthly_finance_mail',
        'enable_detect_gfw',
        'enable_detect_ban',
        'enable_detect_inactive_user',
        'detect_inactive_user_checkin_days',
        'detect_inactive_user_login_days',
        'detect_inactive_user_use_days',
        'remove_inactive_user_link_and_invite',
    ];

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

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

    public function save(ServerRequest $request, Response $response, array $args): ResponseInterface
    {
        $daily_job_hour = (int) $request->getParam('daily_job_hour');
        $daily_job_minute = (int) $request->getParam('daily_job_minute');

        if ($daily_job_hour < 0 || $daily_job_hour > 23) {
            return $response->withJson([
                'ret' => 0,
                'msg' => ' 0-23 ',
            ]);
        }

        if ($daily_job_minute < 0 || $daily_job_minute > 59) {
            return $response->withJson([
                'ret' => 0,
                'msg' => ' 0-59 ',
            ]);
        }

        foreach (self::$update_field as $item) {
            if ($item === 'daily_job_minute') {
                Config::set($item, $daily_job_minute - ($daily_job_minute % 5));
                continue;
            }

            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 CronController extends BaseController
{
    private static array $update_field = [
        'daily_job_hour',
        'daily_job_minute',
        'enable_daily_finance_mail',
        'enable_weekly_finance_mail',
        'enable_monthly_finance_mail',
        'enable_detect_gfw',
        'enable_detect_ban',
        'enable_detect_inactive_user',
        'detect_inactive_user_checkin_days',
        'detect_inactive_user_login_days',
        'detect_inactive_user_use_days',
        'remove_inactive_user_link_and_invite',
    ];

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

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

    public function save(ServerRequest $request, Response $response, array $args): ResponseInterface
    {
        $daily_job_hour = (int) $request->getParam('daily_job_hour');
        $daily_job_minute = (int) $request->getParam('daily_job_minute');

        if ($daily_job_hour < 0 || $daily_job_hour > 23) {
            return $response->withJson([
                'ret' => 0,
                'msg' => ' 0-23 ',
            ]);
        }

        if ($daily_job_minute < 0 || $daily_job_minute > 59) {
            return $response->withJson([
                'ret' => 0,
                'msg' => ' 0-59 ',
            ]);
        }

        foreach (self::$update_field as $item) {
            if ($item === 'daily_job_minute') {
                Config::set($item, $daily_job_minute - ($daily_job_minute % 5));
                continue;
            }

            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 1c3b3736d13259379ea289ba3d34b20b
Eval Count 0
Decode Time 87 ms