Server IP : 103.119.228.120 / Your IP : 18.218.71.21 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /scripts/ |
Upload File : |
#!/usr/local/cpanel/3rdparty/bin/perl # cpanel - scripts/locale_info 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 Cpanel::Locale (); use Cpanel::SafeDir::Read (); use Getopt::Param::Tiny (); use Cpanel::Themes::Get (); use Cpanel::YAML::Syck (); my $prm = Getopt::Param::Tiny->new( { 'no_args_help' => 1, 'help_coderef' => sub { print <<"END_HELP"; Usage: $0 {Options} Provide information about existing cPanel-based locales. Options: --help This help screen --list List available locales (aside from default's aliases en_us and i_default) --locale={locale_tag} Show information about the locale specified by {locale_tag} (e.g. --locale=en) --file Show the given locale's file information --theme={theme_name} Same as option "--file" but in the context of the given theme specified by {theme_name} (e.g. --theme=x3) --3rdparty Show the given locale's 3rdparty mapping END_HELP exit; }, } ); my $locale = Cpanel::Locale->get_handle(); if ( $prm->param('list') ) { print YAML::Syck::Dump( [ sort 'en', $locale->list_available_locales() ] ); } else { my $theme = ''; if ( $prm->param('theme') ) { # this should be a method and also used in locale compiler my @theme_list; foreach my $theme_dir ( Cpanel::SafeDir::Read::read_dir('/usr/local/cpanel/base/frontend') ) { next if $theme_dir =~ m/^\./; next if -l '/usr/local/cpanel/base/frontend/' . $theme_dir; next if !Cpanel::Themes::Get::is_usable_theme($theme_dir); push @theme_list, $theme_dir; } if ( grep { $prm->param('theme') eq $_ } @theme_list ) { $theme = $prm->param('theme'); $prm->param( 'file', 1 ); # get into file context } else { print $locale->maketext( qq{Invalid value for \xE2\x80\x9C[_1]\xE2\x80\x9D.}, '--theme' ) . "\n"; print $prm->help(); exit 1; } } my $loc = $prm->param('locale') || ''; # do not default to 'en', promote explicitly asking for what you want my $working_locale; if ( $loc eq 'en' || $loc eq 'en_us' || $loc eq 'i_default' ) { local $Cpanel::CPDATA{'RS'} = $theme; # TODO: This doesn't seem to work. It works below and from CLI though ... $working_locale = Cpanel::Locale->get_handle('en_us'); } else { if ( $loc && grep { $loc eq $_ } $locale->list_available_locales() ) { local $Cpanel::CPDATA{'RS'} = $theme; $working_locale = Cpanel::Locale->get_handle($loc); } else { print $locale->maketext( qq{Invalid value for \xE2\x80\x9C[_1]\xE2\x80\x9D.}, '--locale' ) . "\n"; print $prm->help(); exit 1; } } if ( $prm->param('3rdparty') ) { for my $third_party ( $working_locale->cpanel_get_3rdparty_list() ) { print "$third_party: " . $working_locale->cpanel_get_3rdparty_lang($third_party) . "\n"; } } elsif ( $prm->param('file') ) { # TODO: one or more --key == "info" about key (does not exist, has this value, etc) print 'CDB File: ' . $working_locale->get_cdb_file_path() . "\n"; my $class = $working_locale->get_language_class(); no strict 'refs'; print "Version: ${$class . '::VERSION'}\n"; print "Encoding: ${$class . '::Encoding'}\n"; print "Build info:\n" . $working_locale->maketext('__FORENSIC') . "\n"; ## no extract maketext } else { require Cpanel::Locale::Utils::Display; print YAML::Syck::Dump( Cpanel::Locale::Utils::Display::get_locale_menu_hashref($working_locale) ); } }