CHips L MINI SHELL

CHips L pro

Current Path : /proc/2/root/usr/local/rvglobalsoft/rvglobalsoft/modules/rvglobalsoft/classes/
Upload File :
Current File : //proc/2/root/usr/local/rvglobalsoft/rvglobalsoft/modules/rvglobalsoft/classes/RvglobalsoftMgr.pm

package RvglobalsoftMgr;

#@LICENSE@#
use strict;
use warnings;
use base qw(RVL::Manager);
use Class::Std::Utils;
{
	sub new {
		my ( $class, $opt ) = @_;
		my ($this) = $class->SUPER::new($opt);
		$this->{pageTitle} = 'Home';
		$this->{template}  = 'home.html';

		$this->{_aActionsMapping} = { 'view' => ['view'], };

		return $this;
	}

	sub validate {
		my ( $this, $req, $input ) = @_;
		RVL::logMessage( '', __CONSTANT__::RVL_LOG_DEBUG );
		${$input}->{masterTemplate} = $this->{masterTemplate};
		${$input}->{template}       = $this->{template};
		${$input}->{pageTitle}      = $this->{pageTitle};
		$this->{validated} = 1;

		${$input}->{action} =
		  $req->get('action') ? $req->get('action') : 'view';

		my ($obj) = RVL::Output::singleton();
		if ( !Libs::Rvglobalsoft::singleton()->isAcceptLicense() ) {
			$obj->redirect( 'rvglobalsoft', 'licenseagreement', '' );
			$this->{validated} = 0;
		}
		elsif ( !Libs::Rvglobalsoft::singleton()->isSetupApiKey() ) {
			RVL::raiseMsg( 'This is your first time visit. You need to set up API key before proceeding. <br />You have to insert your Registered Email and API Key',
				0, __CONSTANT__::RVL_MESSAGE_ERROR );
			$obj->redirect( 'rvglobalsoft', 'apikeysetup', '' );
			$this->{validated} = 0;
		}
		elsif ( !Libs::Rvglobalsoft::singleton()->isAllowResellerAccess() ) {
			RVL::raiseMsg(
				'Sorry, ROOT is disabled resellers access to RV Global Store.',
				0, __CONSTANT__::RVL_MESSAGE_ERROR
			);
			$obj->redirect( 'rvglobalsoft', 'notprivilege', '' );
			$this->{validated} = 0;
		}
	}

	sub _cmd_view {
		my ( $this, $input, $output ) = @_;
		RVL::logMessage( '', __CONSTANT__::RVL_LOG_DEBUG );
		${$output}->{latestVersion} = $this->_get_latestVersion();
		${$output}->{curentVersion} = $this->_get_curentVersion();
		${$output}->{isSetupApiKey} = Libs::Rvglobalsoft::singleton()->isSetupApiKey();
		${$output}->{isAllowResellerAccess} = Libs::Rvglobalsoft::singleton()->isAllowResellerAccess();
	}

	sub _get_curentVersion {
		my ($this)    = @_;
		
		my $versionFile = '/usr/local/rvglobalsoft/rvglobalsoft/rvglobalsoftversion.txt';
		my @version = Libs::Rvglobalsoft::parseFile($versionFile);
        my $current_version = $version[0];
        chomp($current_version);
        
        return $current_version;
	}

	sub _get_latestVersion {
		my ($this)    = @_;
		my($request) = "/latestversion.php?program=rvglobalsoft";
	    
	    my($host) = 'download.rvglobalsoft.com';
	    
	    my $response = Libs::Rvglobalsoft::LWP_get_contents($host.$request);
	    my @resp = split(/\n+/, $response);
	    my $latest_version = '-';
	    foreach my $line (@resp) {
	        $line = Libs::Rvglobalsoft::trim($line);
	        next if ($line =~ /^$/);
	        $latest_version = $line;
            my ($pname, $pversion) = split(/:/, $latest_version,2);
            $pversion =~ s/^\s+|\s+$|\<br\>//g;
            $latest_version = $pversion;
	    }
	    
	    return $latest_version;
	}

	sub display {
		my ( $this, $output ) = @_;
		RVL::logMessage( '', __CONSTANT__::RVL_LOG_DEBUG );

	}
}
1;

Copyright 2K16 - 2K18 Indonesian Hacker Rulez