<?php
require_once dirname(__FILE__) . '/InterfaceForAdmin.php';
require_once dirname(__FILE__) . '/TryoutLibs.php';
/*
* Admin is use function in InterfaceAmin and InterfaceUser
* Admin จำเป็นต้องใช้ทุก function ของ User จึง implements ทั้ง Interface
* CpHandle_InterfaceForAdmin
* CpHandle_InterfaceForUser
* */
class CpHandle_TryoutRoot extends CpHandle_TryoutLibs implements CpHandle_InterfaceForAdmin
{
public function CpHandle_TryoutRoot()
{
}
public function init()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function FrameTarget()
{
return 'mainFrame';
}
/**
* no process in nocp,tryout
*/
public function actionAJExternal($url)
{
return false;
}
/**
* no process in cpanel
*/
public function getPathPHPsuexec()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isSkipAllowUserPerms()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
public function getHomeDir($username=RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RVS_USER_HOME;
}
public function listAccts($owner=null)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return array();
}
public function getResellers()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return array();
}
public function getCPDATA($username=RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function getLogoutUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/user/login/action/logout/';
}
/**
* Validate update RVSitebuilder
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return mix Array or Boolean
*/
public function getUpgradeRVSitebuilder()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return SGL::raiseError('Sorry, cannot upgrade RVsitebuilder in nocp mode.', SGL_MESSAGE_ERROR, null, true);
}
/**
* getHashUrl()
* @return ''
* @author pharadol@rvglobalsoft.com
* */
public function getHashUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '';
}
public function replateAtOnUserName($userName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return $userName;
}
public function listAllAcctsData()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return array();
}
public function getWhmRemoteFrame()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return 0;
}
public function checkRVSkinWHMAddon(&$input)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function checkFileConfigLicenseCycle($cycleNow = 0, $errorNotExit = 0, $skipMsg = 0)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
require_once dirname(dirname(__FILE__)) . '/LicenseCycle.php';
$oCycle = new LicenseCycle();
$oCycle->FileConfigLicenseCycle($cycleNow, $errorNotExit, $skipMsg);
return true;
}
public function getAccessKey()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '';
}
public function getUserDNS($all=0)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if ($all == 1) {
$aDNS = array();
foreach ($GLOBALS['NOCP']['CPDATA'] as $key=>$val) {
if (RvsLibs_String::preg_match('/^DNS/',$key,$match)) {
$aDNS[$key] = $val;
}
}
return $aDNS;
} else {
return $GLOBALS['NOCP']['CPDATA']['DNS'];
}
}
public function whmRequest($request,$host,$user,$accesshash,$usessl)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '';
}
public function detectPathPHP()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* get controlpael url path
* @return string
* @author siwakorn induang
*/
public function getControlPanelUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return INDEX_URL . '/sitebuilder';
}
public function isAllowExportProject()
{
return isset($this->conf['Admin']['Owner']['AllowExportProjectTryout'])
? $this->conf['Admin']['Owner']['AllowExportProjectTryout']
: 0;
}
public function isAllowImportProject()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return isset($this->conf['Admin']['Owner']['AllowImportProjectTryout'])
? $this->conf['Admin']['Owner']['AllowImportProjectTryout']
: 0;
}
/**
* Is mode tryout
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean True
*/
public function isTryout()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
public function isValidIncludeFileLang($aConfTemplateList)
{
return isset($aConfTemplateList['tryoutlogin']['subdomain_path']) ? true : false;
}
public function isNotTryout()
{
//log loop SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* Is mode nocp
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean False
*/
public function isNocp()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isCpanel()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function runDetectPhpSuexec($phpSuexec)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
//fix return 0
return 0;
}
public function isValidClearCacheAndRVSiteFIX()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getTypeFileEncode($fileName)
{
$TypeFileEncode = '';
if (RvsLibs_System::function_exists('finfo_open') && RvsLibs_System::function_exists('finfo_file')) {
$finfo = @finfo_open(FILEINFO_MIME_ENCODING);
$TypeFileEncode = @finfo_file($finfo, $fileName);
}
return $TypeFileEncode;
}
/**
* Make remove tryout
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @param String null
*/
public function makeRemoveTryout($option = array())
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return null;
}
public function isVaildTemplatePrivate()
{
//SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
public function skipValidTemplate()
{
return true;
}
/**
* Validate update rollback version
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean True
*/
public function isValidUpdateRollbackVersion()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isDirectAdmin()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getRvBinPath()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/var/cpanel/rvglobalsoft/rvsitebuilder/rvbin/rvswrapper';
}
public function isAdmin($username = RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return ($username == 'root')? true : false;
}
public function ownerIsAdmin($ownername = RVS_OWNER_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return ($ownername == 'root')? true : false;
}
public function UserUploadSymLinksecureCommand($realPathUserUpload)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$pathUserUploadSymLink = RvsLibs_File::buildPath(array(SGL_USERDATA_PATH, RVS_USER_NAME, 'upload'));
if (is_link($pathUserUploadSymLink) === false) {
if (file_exists($pathUserUploadSymLink) === true) {
RvsLibs_System::rm(array('-rf', $pathUserUploadSymLink));
}
///create symlink ใน path rvsitebuilder/www/userdata/$USERNAME/upload
if (is_dir(RvsLibs_File::buildPath(array(SGL_USERDATA_PATH, RVS_USER_NAME))) == false) {
$resSecure = RvsLibs_System::secureCommand('makeuserdatapath');
if (SGL::isError($resSecure)) {
SGL::raiseMsg(RvsLibs_String::translate('Cannot create user folder because '.$resSecure->getMessage()));
SGL_Error::pop();
exit;
}
}
RvsLibs_User::createUserSymlinkUserFolder($realPathUserUpload, $pathUserUploadSymLink);
}
}
public function makeUploadFolder($userUploadPath, $pathRootUpload, $rootPath)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function createUserSymlinkUserFolder($pathUserUpload, $pathUploadLink)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
RvsLibs_User::createUserSymlinkUserFolder($pathUserUpload, $pathUploadLink);
}
public function isUploadedFile($tempFile)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_File::isUploadedFile($tempFile);
}
public function moveUploadedFile($tempFile, $destination)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_File::moveUploadedFile($tempFile, $destination);
}
public function makeLink($source, $des)
{
SGL::logMessage('tempFile :: ' . $source, PEAR_LOG_DEBUG);
SGL::logMessage('destination::' . $des, PEAR_LOG_DEBUG);
RvsLibs_System::ln(array('-s', $source, $des));
}
function secureCommandMakeLinkProjectId($projectId)
{
$resSecure = RvsLibs_System::secureCommand('makeprojectsymlink', array('project-id' => $projectId));
if (SGL::isError($resSecure) === true) {
return SGL::raiseError(
RvsLibs_String::translate(
'Cannot create project folder symlink, becase %MSG.'
, 'vprintf'
, array('MSG' => $resSecure->getMessage())
)
);
}
return true;
}
public function isTryoutOpenbaseDir($user)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
public function buildProjectUrlForDa()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function isRealConfigUpLoadMaxFileSize()
{
return ini_get('upload_max_filesize');
}
/**
* Make userdata path
* @return unknown_type
*/
function makeuserdatapath($userdataPath)
{
return RvsLibs_System::mkDir(array('-p', '-m', 0755, $userdataPath));
}
/**
*
* Make Restore Online Counter
*
* @author Puttipong <puttipong at rvglobalsoft.com>
*
* @param $projectId <STRING>
* @return TRUE
*/
public function makeRestoreOnlineCounter($projectId=null) {
return true;
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez