<?php
require_once dirname(__FILE__) . '/InterfaceForAdmin.php';
require_once dirname(__FILE__) . '/NocpLibs.php';
/*
* Admin is use function in InterfaceAmin and InterfaceUser
* Admin จำเป็นต้องใช้ทุก function ของ User จึง implements ทั้ง Interface
* CpHandle_InterfaceForAdmin
* CpHandle_InterfaceForUser
* */
class CpHandle_NocpRoot extends CpHandle_NocpLibs implements CpHandle_InterfaceForAdmin
{
public function CpHandle_NocpRoot() { }
public function init()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
public function FrameTarget()
{
return 'mainFrame';
}
public function actionAJExternal($url)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isSkipAllowUserPerms()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getPathPHPsuexec()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getHomeDir($username=RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/home/' . $username;
}
/**
* get controlpael url path
* @return string
* @author siwakorn induang
*/
public function getControlPanelUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return INDEX_URL . '/sitebuilder';
}
/**
* 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);
}
public function detectPathPHP()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getLogoutUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/user/login/action/logout/';
}
public function getCPDATA($username=RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$aCpdata = array();
if (file_exists('/var/cpanel/users/' . $username)) {
/// สามารถจำลองข้อมูล user ตามระบบ cPanel ได้
$aCpLine = RvsLibs_File::file('/var/cpanel/users/' . $username);
foreach ($aCpLine as $cpLine) {
$cpLine = RvsLibs_String::preg_replace("/\r|\n/", "", $cpLine);
list($cpKey, $cpValue) = RvsLibs_String::dbeExplode("=", $cpLine);
if (isset($cpKey)) {
$aCpdata[$cpKey] = $cpValue;
}
}
} else {
/// หากไม่มีการจำลองให้ใช้ค่านี้ เป็น defauft
$aCpdata = array (
'BWLIMIT'=>'0',
'DNS'=>'rvglobalsoft.net',
'FEATURELIST'=>'rvskin',
'IP'=>'192.168.1.111',
'LANG'=>'english',
'MAXADDON'=>'0',
'MAXFTP'=>'unlimited',
'MAXLST'=>'unlimited',
'MAXPARK'=>'0',
'MAXPOP'=>'unlimited',
'MAXSQL'=>'unlimited',
'MAXSUB'=>'unlimited',
'OWNER'=>'root',
'PLAN'=>'rvdevelop',
'RS'=>'rvblue',
'STARTDATE'=>'1151982059',
'DNS2'=>'tryout.clientroot.rvglobalsoft.net'
);
}
return $aCpdata;
}
/**
* Process in cp mode
* @param $cycleNow = 0, $errorNotExit = 0, $skipMsg = 0
* @author pharadol@rvglobalsoft.com
* */
public function checkFileConfigLicenseCycle($cycleNow = 0, $errorNotExit = 0, $skipMsg = 0)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function getUserDNS($all=0)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$aDNS = array();
if ($all == 1) {
foreach ($GLOBALS['NOCP']['CPDATA'] as $key=>$val) {
if (RvsLibs_String::preg_match('/^DNS/',$key,$match)) {
array_push($aDNS, $val);
}
}
} else {
$aDNS = $GLOBALS['NOCP']['CPDATA']['DNS'];
}
return $aDNS;
}
public function isAllowExportProject()
{
return (isset($this->conf['Admin']['Owner']['AllowExportProject']))
? $this->conf['Admin']['Owner']['AllowExportProject']
: '0';
}
public function isAllowImportProject()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return (isset($this->conf['Admin']['Owner']['AllowImportProject']))
? $this->conf['Admin']['Owner']['AllowImportProject']
: '0';
}
/**
* Is mode tryout
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean False
*/
public function isTryout()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* Is mode nocp
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean True
*/
public function isNocp()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
/**
* ใช้กรณี output ออกไปใช้งานต่อ
* ไม่ได้เอาไว้เช็ค CPMODE
*/
public function isCpanel()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* 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()
{
return array(array('domain' => SGL_SERVER_NAME, 'user' => RVS_USER_NAME));
}
public function listAccts($owner=null)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$aUserList = array('pornthip', 'darawan', 'puttipong', 'duangdao', 'witoon', 'pharadol'
, 'apiruk', 'uxtest1', 'tanawat', 'parinya', 'user1', 'user2', 'user3', 'user4', 'user5'
, 'user6', 'user7', 'resellerRoute', 'reseller', 'reseller2', 'maythapon');
return $aUserList;
}
public function getResellers()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return array('reseller' ,'rvresell','reseller2','reseller3','reseller4','reseller5','reseller6','reseller7');
}
public function getWhmRemoteFrame()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return 0;
}
public function checkRVSkinWHMAddon(&$input)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function getAccessKey()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '';
}
public function whmRequest($request,$host,$user,$accesshash,$usessl)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
// return $this->_whmreq($request);
}
public function getTmpPath()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/tmp';
}
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;
}
/**
* (non-PHPdoc)
* @author
* @param $fileName
* @return $TypeFileEncode
*/
public function getTypeFileEncode($fileName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$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;
}
public function isVaildTemplatePrivate()
{
//SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* (non-PHPdoc)
* @author
* @return true/false
*/
public function skipValidTemplate()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isNotTryout()
{
//log loop SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isValidIncludeFileLang($aConfTemplateList)
{
return false;
}
/**
* 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 setCookieAndRedirect()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getRvBinPath()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return SGL_PATH . '/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, $pathLinkUpload, $userDataPath)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if (!is_link($pathLinkUpload) && is_dir($userDataPath) ) {
return symlink($userUploadPath, $pathLinkUpload);
}
return false;
}
public function createUserSymlinkUserFolder($pathUserUpload, $pathUploadLink)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
RvsLibs_User::createUserSymlinkUserFolder($pathUserUpload, $pathUploadLink);
}
public function moveUploadedFile($tempFile, $destination)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_File::moveUploadedFile($tempFile, $destination);
}
public function isUploadedFile($tempFile)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_File::isUploadedFile($tempFile);
}
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())
)
);
}
}
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));
}
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::secureCommand('makeuserdatapath');
}
/**
*
* 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