403Webshell
Server IP : 185.252.147.100  /  Your IP : 216.73.217.33
Web Server : nginx/1.27.3
System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User : mitr ( 1000)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/html/kanboard/app/Console/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/kanboard/app/Console/LocaleSyncCommand.php
<?php

namespace Kanboard\Console;

use DirectoryIterator;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class LocaleSyncCommand extends BaseCommand
{
    const REF_LOCALE = 'fr_FR';

    protected function configure()
    {
        $this
            ->setName('locale:sync')
            ->setDescription('Synchronize all translations based on the '.self::REF_LOCALE.' locale');
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $reference_file = APP_DIR.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.self::REF_LOCALE.DIRECTORY_SEPARATOR.'translations.php';
        $reference = include $reference_file;

        foreach (new DirectoryIterator(APP_DIR.DIRECTORY_SEPARATOR.'Locale') as $fileInfo) {
            if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== self::REF_LOCALE) {
                $filename = APP_DIR.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.$fileInfo->getFilename().DIRECTORY_SEPARATOR.'translations.php';
                echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL;

                file_put_contents($filename, $this->updateFile($reference, $filename));
            }
        }
        return 0;
    }

    public function updateFile(array $reference, $outdated_file)
    {
        $outdated = include $outdated_file;

        $output = '<?php'.PHP_EOL.PHP_EOL;
        $output .= 'return ['.PHP_EOL;

        foreach ($reference as $key => $value) {
            $escapedKey = str_replace("'", "\'", $key);
            if (! empty($outdated[$key])) {
                $output .= "    '".$escapedKey."' => '".str_replace("'", "\'", $outdated[$key])."',\n";
            } else {
                $output .= "    // '".$escapedKey."' => '',\n";
            }
        }

        $output .= "];\n";
        return $output;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit