#!/usr/bin/perl
package RVL::CpHandle::cPanel::Root;
# WebSite: http://www.rvglobalsoft.com
# Unauthorized copying is strictly forbidden and may result in severe legal action.
# Copyright (c) 2013 RV Global Soft Co.,Ltd. All rights reserved.
#
# =====YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT AND CAN NOT BE REMOVE =======
# Copyright (c) 2013 RV Global Soft Co.,Ltd. All rights reserved.
# This Agreement is a legal contract, which specifies the terms of the license
# and warranty limitation between you and RV Global Soft Co.,Ltd. and RV2Factor Product for RV Global Soft.
# You should carefully read the following terms and conditions before
# installing or using this software. Unless you have a different license
# agreement obtained from RV Global Soft Co.,Ltd., installation or use of this software
# indicates your acceptance of the license and warranty limitation terms
# contained in this Agreement. If you do not agree to the terms of this
# Agreement, promptly delete and destroy all copies of the Software.
#
# ===== Grant of License =======
# The Software may only be installed and used on a single host machine.
#
# ===== Disclaimer of Warranty =======
# THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
# WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
# WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE
# AND SOFTWARE ENVIRONMENTS INTO WHICH RV SITE BUILDER MAY BE USED, NO WARRANTY OF
# FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE
# ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF RV GLOBAL SOFT CO.,LTD. WILL BE
# LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
# IN NO CASE SHALL RV GLOBAL SOFT CO.,LTD. BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
# CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
# OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
# BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
# NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
# RV GLOBAL SOFT CO.,LTD. IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
# RV GLOBAL SOFT CO.,LTD.'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
# BY LICENSEE TO RV GLOBAL SOFT CO.,LTD.
# ===============================
use strict;
use warnings;
use base qw(RVL::CpHandle::cPanel);
use Whostmgr::AcctInfo;
use Class::Std::Utils;
{
sub new {
my ($class) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
my ($this) = $class->SUPER::new();
return $this;
}
sub getUsername {
my ($this) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
my $call = new RVL::CpHandle;
my ($oCli) = RVL::Request::singleton();
if($oCli->getRequestType() eq 'Cli'){
if(defined $ENV{'USER'} && $ENV{'USER'} ne ''){
return $ENV{'USER'};
}elsif(defined $ENV{'REMOTE_USER'} && $ENV{'REMOTE_USER'} ne ''){
return $ENV{'REMOTE_USER'};
}else{
return 'root';
}
}else{
return $ENV{'REMOTE_USER'};
}
}
sub getHomeDir {
my ($this, $user) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
return $this->getRootDir()
}
sub getOwner {
my ($this) = @_;
return $this->getUsername();
}
sub getOwnerDir {
my ($this, $user) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
return $this->getHomeDir();
}
sub getResellerList {
my ($name, $value, $resellers);
my (@buff);
@{$resellers} = @buff;
open my $FD, '<', '/var/cpanel/resellers';
while (<$FD>) {
s/\n|\s//g;
($name,$value) = split(/:/,$_,2);
push(@{$resellers}, $name) if (-f "/var/cpanel/users/$name");
}
close($FD);
return $resellers;
}
sub getAcctList {
my ($this, $owner) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
my @acctList = ();
if (defined $owner && $owner ne '') {
my %acct = Whostmgr::AcctInfo::acctlister($owner);
@acctList = (keys %acct);
} else {
my $path = '/var/cpanel/users';
if (opendir(my $DIR, $path)) {
while (my $userfile = readdir($DIR)) {
next if ($userfile =~ m/^\./);
my $realFile = $path.'/'.$userfile;
next if (!-f $realFile || -l $realFile);
push(@acctList, $userfile);
}
closedir($DIR);
}
}
return @acctList;
}
sub getUserContactEmail {
my ($this, $user) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
my $contactemail = '';
if (defined $user && $user ne '') {
$contactemail = Cpanel::ContactInfo::getcontactemail($user);
}
return $contactemail;
}
sub getUserMainDomain {
my ($this, $user) = @_;
RVL::logMessage('', __CONSTANT__::RVL_LOG_DEBUG);
my $userdomain = '';
if (defined $user && $user ne '') {
$userdomain = Cpanel::AcctUtils::getdomain($user);
}
return $userdomain;
}
sub getDomainList{
return ();
}
sub getServerName {
my ($this) = @_;
my $hostname = `hostname`;
$hostname =~ s/\r|\n//g;
return $hostname;
}
} use implements "RVL::CpHandle::PrivilegeInterface";
1;
Copyright 2K16 - 2K18 Indonesian Hacker Rulez