CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/proc/3/task/3/cwd/usr/local/rvglobalsoft/rvglobalsoft/lib/RVL/CpHandle/
Upload File :
Current File : //proc/self/root/proc/3/task/3/cwd/usr/local/rvglobalsoft/rvglobalsoft/lib/RVL/CpHandle/cPanel.pm

#!/bin/sh
eval 'if [ -x /usr/local/cpanel/3rdparty/bin/perl ]; then exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"$@"}; else exec /usr/bin/perl -x $0 ${1+"$@"}; fi;'
if 0;

package RVL::CpHandle::cPanel;
##LICENSE##
use strict;
use warnings;
use base qw(RVL::CpHandle);
use File::Basename qw(&basename &dirname);
BEGIN {
    unshift @INC, '/usr/local/cpanel';
}

use Cpanel::Version;
use Cpanel::AcctUtils;
use Cpanel::ContactInfo;
use Cpanel::Reseller;
eval{ use Whostmgr::ACLS; };
use Class::Std::Utils;
{
	sub new {
         my ($class) = @_;
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        my ($this) = $class->SUPER::new();
        return $this;
    }
    
    sub factory {
        my ($class, $opt) = @_;
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        my ($cpPrivilege) = ucfirst(lc(RVL::CpHandle::cPanel::_getPrivilege()));
        RVL::logMessage('CALL PRIVILEGE: ' . $cpPrivilege, __CONSTANT__::RVL_LOG_DEBUG);
        my ($callClass, $newClass);
        eval {
            require "RVL/CpHandle/cPanel/$cpPrivilege.pm";
        };
        
        if ($@) {
        	RVL::logMessage("RVL::CpHandle::cPanel::$cpPrivilege has ERROR: " . $@, __CONSTANT__::RVL_LOG_DEBUG);
        }
        
        my ($req) = RVL::Request::singleton();
        my ($moduleName) = $req->getModuleName();
        my ($customFile) = __CONSTANT__::RVL_MOD_DIR . "/$moduleName/classes/CpHandle/cPanel/$cpPrivilege.pm";
        
        if (-f $customFile) {
            require $customFile;
            $callClass = "Custom::CpHandle::cPanel::$cpPrivilege";
            
        } else {
            $callClass = "RVL::CpHandle::cPanel::$cpPrivilege";
        }
        
        RVL::logMessage('CALL PACKAGE: ' . $callClass, __CONSTANT__::RVL_LOG_DEBUG);
        
        $newClass = $callClass->new();
        
        $newClass->setCpPrivilege($cpPrivilege);
        return $newClass;
    }
    
    sub _getPrivilege {
    	my ($this) = @_;
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        my ($priv) = 'user';
        my ($oCli) = RVL::Request::singleton();
        
        if($oCli->getRequestType() eq 'Cli'){
        	if(defined $ENV{'USER'} && $ENV{'USER'} ne ''){
        		$priv = $ENV{'USER'};
        	} elsif (defined $ENV{'REMOTE_USER'} && $ENV{'REMOTE_USER'} ne '') {
        		$priv = $ENV{'REMOTE_USER'};
        	} else {
                my $call = new RVL::CpHandle;
        		$priv = $call->callBackticks('whoami');
        		chomp($priv);
        		if($priv ne 'root'){
        			$priv = 'reseller';
        		}
        	}
        } else {
        	if ($ENV{'SERVER_PORT'} eq '2086' || $ENV{'SERVER_PORT'} eq '2087') {
	           eval {
	               Whostmgr::ACLS::init_acls();
	               #ยังไม่ได้เทสในฝั่ง 3rdparty
	               if (Whostmgr::ACLS::hasroot() && $ENV{'REMOTE_USER'} eq 'root') {
	                   $priv = 'root';
	               } elsif (Cpanel::Reseller::isreseller($ENV{'REMOTE_USER'}) && $ENV{'REMOTE_USER'} ne 'root') {
	                   $priv = 'reseller';
	               }
	           };
        	}else{
        		$priv = 'user';
        	}
        }
        RVL::logMessage("Privilege is: $priv", __CONSTANT__::RVL_LOG_DEBUG);
        
        return $priv;
    }
    
    sub getRootDir {
        my ($this, $user) = @_;
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        return "/var/cpanel/rvglobalsoft";
    }
    
    sub getVersion {
        my ($this) = @_;
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        return Cpanel::Version::get_version_full();
    }
    
    sub getApiUrl {
        my ($this) = @_;
        # apiservice.url
        my ($confUrl) = RVL::Config::get('apiservice.url');
        my ($usageUrl) = (defined $confUrl && $confUrl ne '') 
           ? $confUrl 
           : 'http://api.rvglobalsoft.com';
        if ($this->isUser()) {
            return $usageUrl .'/usercp';
        } else {
            return $usageUrl .'/admincp';
        }    
    }
    
    sub getFrontScriptName{
    	my ($this) = @_;
        RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
        if ($this->isUser()) {
        	return $ENV{cp_security_token};
        } else {
        	return $ENV{cp_security_token} . '/cgi/rvglobalsoftmanager/index.cgi?action=apimanager';
        }
    }

    sub redirectUrl{
    	my ($this) = @_;
    	RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
    	my $urlRedirect;
    	if ($this->isUser()) {
    		$urlRedirect = $ENV{cp_security_token} . '';
    	} else {
    	   $urlRedirect = $ENV{cp_security_token} . '/cgi/rvglobalsoftmanager/index.cgi?action=apimanager';
    	}
        my (@header) = ();
        @header = (
            -X_Powered_By => 'RV Framework http://www.rvglobalsoft.com',
            -location => $urlRedirect,
        );
		my ($obj) = RVL::Output::singleton();
        foreach my $listOutput ($obj->getHeader()) {
            push(@header, $listOutput);
        }

		print RVL::Session::singleton()->header(@header);
        RVL::Session::singleton()->flush();
        exit;
    }
    
    
} use implements "RVL::CpHandle::CPModeInterface";
1;

__END__;

Copyright 2K16 - 2K18 Indonesian Hacker Rulez