<?php
require_once dirname(__FILE__) . '/InterfaceForUser.php';
require_once dirname(__FILE__) . '/DaLibs.php';
class CpHandle_DaUser extends CpHandle_DaLibs implements CpHandle_InterfaceForUser
{
public function CpHandle_DaUser()
{
parent::SGL_Manager();
}
public function init()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function getLogoutUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/CMD_LOGOUT';
}
public function definedModulePathConfig($moduleName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return SGL_MOD_DIR . '/' . $moduleName . '/conf.ini';
}
public function setCookieAndRedirect()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
//TODO รอใส่คำพูดให้ถูกต้องที่ไฟล์ rvs_sitebuilder.html
public function detectPathPHP()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if (!function_exists('get_cfg_var')) {
return false;
}
$pathPHPini = get_cfg_var('cfg_file_path');
$pathPHPini = trim($pathPHPini);
return ($pathPHPini != '/usr/local/directadmin/plugins/rvsitebuilder/user/php.ini') ? true : false;
}
public function isValidBuyAccountUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function doAddCronJob()
{
return "";
}
public function getUrlBackToTryout()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isValidClearCacheAndRVSiteFIX()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isValidIncludeFileLang($aConfTemplateList)
{
return false;
}
public function isNotTryout()
{
//log loop SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
public function isVaildTemplatePrivate()
{
//SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isValidDataHomeReplace($data)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function actionAJExternal($url)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isRecordPublishProject()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
/**
* no process in cpanel
* nocp is process
*/
public function isValidTemplateItemPath($templateUserId, $templateItemFolder)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_Template::isValidTemplate($templateUserId, $templateItemFolder);
}
public function isLicenseValid()
{
return false;
}
public function getPathPHPsuexec()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getProjectDbMissing($userID)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
require_once dirname(dirname(__FILE__)) . '/RestoreProjectDbMissingMgr.php';
$oRestorePj = new RestoreProjectDbMissingMgr();
$aProjectNotInDb = $oRestorePj->getProjectNotInDbByUserId($userID, REAL_PROJECT_PATH);
return $aProjectNotInDb;
}
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';
}
public function getHomeDir($user=RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RVS_USER_HOME;
}
public function getCPDATA($username=RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$aCpdata = array();
$aAllData = $this->getDataAllUser();
$dns = RvsLibs_String::dbeExplode('<br>', $aAllData[$username]['list']);
$aCpdata['USER'] = $aAllData[$username]['username'];
$aCpdata['OWNER'] = $aAllData[$username]['creator'];
$aCpdata['IP'] = $aAllData[$username]['ip'];
$aCpdata['DNS'] = $aAllData[$username]['default'];
foreach ($dns as $k => $v) {
if (trim($v) != '' && $v != $aCpdata['DNS']) {
$aCpdata['DNS' . $k] = $v;
}
}
return $aCpdata;
}
public function getUserDNS($all=0)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$result = $this->socketAPI('CMD_API_ADDITIONAL_DOMAINS');
if ($all == 1) {
$aDNS = array();
$aDNS = array_keys($result);
} else {
$aDNS = key(preg_grep( "/defaultdomain=yes/", $result));
$aDNS = (isset($aDNS) && $aDNS !='')? $aDNS : '';
}
$aDNS = preg_replace('/_/', '.', $aDNS);
/*Debug เสร็จแล้วเอาออกด้วยครับ
if (is_array($aDNS)) {
foreach ($aDNS as $k => $v) {
SGL::logMessage("k=" . $k . ' v=' . $v, PEAR_LOG_DEBUG);
}
} else {
SGL::logMessage($aDNS, PEAR_LOG_DEBUG);
}
*/
return $aDNS;
}
public function getRealDIRbyDomain($domain)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$defaultDomain = $this->getUserDNS(0);
$domain = (isset($domain) && $domain) ? $domain : $defaultDomain;
$subDomainPath['DIR'] = RVS_USER_HOME . '/domains/' . $domain . '/public_html';
return $subDomainPath;
}
public function getDatabaseInfomation()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return $this->fetchDBInfomation(array());
}
public function createAutoDatabase($buildDBName, $buildDBUsername, $buildDBPasswd)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$result = $this->socketAPI('CMD_API_DATABASES'
, array('name'=> $buildDBName, 'user' => $buildDBUsername, 'passwd' => $buildDBPasswd
, 'passwd2' => $buildDBPasswd, 'action' => 'create'));
if (isset($result['error']) && $result['error'] == '1') {
SGL::logMessage('ERROR : Database connection is error ' . $result['details'] , PEAR_LOG_ERR);
return SGL::raiseError(RvsLibs_String::translate('Database connection is error'));
}
}
public function doCreateDatabase($dbname)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function doCreateDatabaseUser($username, $passwd)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function doAddDBUser($dbname, $username)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function doDeleteDatabase($dbname)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function doDeleteDatabaseUser($username)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
/**
* input $dbname
* check prefix and add prefix , return new dbname have prefix
*/
public function getRealFormatDBName($dbName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return (defined('DATABASE_PREFIX') && DATABASE_PREFIX === false)
? RVS_USER_NAME . $dbName
: RVS_USER_NAME . '_' . $dbName;
}
public function getMaxUserQuota()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$result = $this->socketAPI('CMD_API_SHOW_USER_CONFIG');
return $result['quota'];
}
public function getUserQuota()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$result = $this->socketAPI('CMD_API_SHOW_USER_USAGE');
return $result['quota'];
}
public function getDocroot()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return $_SERVER['DOCUMENT_ROOT'];
}
public function getCpUserInfo()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$result = $this->socketAPI('CMD_API_SHOW_USER_USAGE');
$result2 = $this->socketAPI('CMD_API_SHOW_USER_CONFIG');
$oCpData->quotaused = $result['quota'];
$oCpData->maxquota = $result2['quota'];
$oCpData->docroot = $_SERVER['DOCUMENT_ROOT'];
return $oCpData;
}
/**
* This function process in tryout mode.
* @author siwakorn@rvglobalsoft.com
* @param $isPhpSuExec ( 0/1 )
* @return <true>/<false>
*/
public function changePermissionRVSPreview($isPhpSuExec)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
############# Siwakorn Modify New Function ############
public function registerButtonOnlineCounter()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* Make folder component in scripts project path.
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @param String $pathComponentName
* @return mix PEAR error or Boolean True
*/
public function makeFolderComponent($pathComponentName = null)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if (isset($pathComponentName) === true && is_dir($pathComponentName) === false) {
$resMkdir = RvsLibs_System::mkDir(array('-p', $pathComponentName));
if (SGL::isError($resMkdir) === true) {
return $resMkdir;
}
}
return true;
}
public function isDisableBlogComponent($aTestOption = array())
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$license = isset($aTestOption['license'])
? $aTestOption['license']
: RvsLibs_License::getSitebuilderLicense();
$isOwnerAllowComponent = isset($aTestOption['isOwnerAllowBlog'])
? $aTestOption['isOwnerAllowBlog']
: RvsLibs_Component::isOwnerAllowComponent(RvsLibs_User::getOwnerId(), 'Blog');
if (strtolower($license) != 'pro') {
return 2;
} elseif ($isOwnerAllowComponent === false) {
return 3;
} else {
return 0;
}
}
public function getDatabaseEditURL()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$defaultDomain = $this->getDefaultDomain();
$url = INDEX_URL . '/CMD_DB?domain=' . $defaultDomain;
$aSetOutput = array('UrlManageDatabase' => $url);
return RvsLibs_String::translate('prepare your database','vprintf', $aSetOutput);
}
/**
* (non-PHPdoc)
* @author
* @return <string>path
*/
public function getTmpPath()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_File::buildPath(array(RVS_USER_HOME, 'tmp'));
}
/**
* (non-PHPdoc)
* @author
* @param <string>$action, <array>$aTemplateOption
* @return <array>$aTemplatePathUrl
*/
public function getTemplatePathUrl($action='edit', $aTemplateOption=array())
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if (count($aTemplateOption)
&& (RvsLibs_Template::isValidTemplate($aTemplateOption['templateUserId'], $aTemplateOption['templateItemFolder']) )) {
$aTemplatePathUrl = ($action == 'edit')
? RvsLibs_Template::getImportedTemplatePathUrlAdmin()
: RvsLibs_Template::getImportedTemplatePathUrlUser($aTemplateOption['templateUserId']);
} else {
$aTemplatePathUrl['path'] = TEMPLATE_PATH;
$aTemplatePathUrl['url'] = TEMPLATE_URL;
}
return $aTemplatePathUrl;
}
/**
* (non-PHPdoc)
* @author
* @return true/false
*/
public function skipValidTemplate()
{
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;
}
/**
* No process in Nocp
*/
public function isMinRvsOK($versionExport)
{
SGL::logMessage("RVSiteBuilder Export version:: " . $versionExport, PEAR_LOG_DEBUG);
return RvsLibs_License::siteBuilderVersion($versionExport);
}
public function replaceRelativeURL()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_String::str_replace('/' . PROGRAM_NAME, '', RVSITEBUILDER_URL);
}
/**
* ใช้กรณี output ออกไปใช้งานต่อ
* ไม่ได้เอาไว้เช็ค CPMODE
*/
public function isCpanel()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function isDirectAdmin()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
/**
* getHashUrl()
* @return ''
* @author pharadol@rvglobalsoft.com
* *//*
public function getHashUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '';
}
*/
/**
* 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);
require_once dirname(dirname(__FILE__)) . '/LicenseCycle.php';
$oCycle = new LicenseCycle();
$oCycle->FileConfigLicenseCycle($cycleNow, $errorNotExit, $skipMsg);
return true;
}
/**
* get controlpael url path
* @return string
* @author siwakorn induang
*/
/*
public function getControlPanelUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return INDEX_URL . '/sitebuilder';
}
*/
/**
* For process in cp mode
* check counter is existing and make new counter.
* @param $defCounterName <string> counter name
* @author pharadol@rvglobalsoft.com
*/
public function getNewCounterExisting($counterName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* process in CPANEL
* @author siwakorn induang
* @param <string>$counterName
* @return true / false
*/
public function validateCounterNameExisting($counterName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* process in CPANEL
* @author siwakorn induang
* @param <string>$counterName
* @return true / false
*/
public function validateChangeCounterName($counterName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
#File:Online_CounterMgr
public function runUpdateFileCounterData($filePreview, $cpanelTagPreview, $counterName, $newCounter)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return $newCounter;
}
#File:Online_CounterMgr
public function runUpdateCounterData($cpanelTag, $counterName, $newCounter)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function cpanelHtmlTagCounter($counterTag)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function tryoutGetBuyAccountUrl()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function createNewEmailcpSecurity()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$domain = $this->getUserDNS(0);
$createNewEmail = RvsLibs_String::translate('Online Form Step 5 Info2');
$createNewEmail .= RvsLibs_String::sprintf('<a href="%s/CMD_EMAIL_POP?domain=%s" target="_blank">' ,INDEX_URL, $domain);
$createNewEmail .= RvsLibs_String::translate('Online Form Step 5 Info3');
$createNewEmail .= '</a> ';
$createNewEmail .= RvsLibs_String::translate('Online Form Step 5 Info4');
return $createNewEmail;
}
public function runDetectPhpSuexec($dePhpSuexec)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$phpSuExec = RvsLibs_System::runDetectPhpSuexec();
if($phpSuExec != $dePhpSuexec) {
RvsLibs_Config::autoUpdatePhpSuExecToMainIpConf($phpSuExec, $this->conf);
}
return $phpSuExec;
}
######################## END #####################
public function replateAtOnUserName($userName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return $userName;
}
public function isSkipAllowUserPerms()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
public function getPathQuotaUser($aPath)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function getFileManagerUrlByUser($username)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return INDEX_URL . '/CMD_FILE_MANAGER';
}
/**
* Get path image diy in mode wysiwyg
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @param String $pathImg
* @return String Path image diy in mode wysiwyg
*/
public function getPathImgWysDiy($pathImg = null)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_File::buildPath(array(SGL_PATH . str_replace(PROGRAM_NAME,'',strstr($pathImg, PROGRAM_NAME))));
}
/**
* Validate create project on mode.
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean False
*/
public function isValidCreateProject()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* Validate get html tag counter
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean False
*/
public function isValidHtmlTagCounter()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* Validate phpsu in XML
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean False
*/
public function isValidPhpsuModeXml()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* Validate component db on mode
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean True
*/
public function isValidCompoDbMode()
{
return true;
}
/**
* Get url for edit database
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return String
*/
public function getUrlDb()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/phpMyAdmin';
}
/**
* Validate component db on flexy
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return Boolean False
*/
public function isValidCompoDbFlexy()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return false;
}
/**
* 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 false;
}
/**
* Make update tryout
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @return String null
*/
public function makeUpdateTryout()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return null;
}
/**
* Make update tryout login config
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @param Boolean $isAutoApproval
* @param String null
*/
public function makeUpdateTryoutLoginConf($isAutoApproval = false, $subdomainPath = null)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return null;
}
/**
* Make remove tryout
*
* @author Puttipong <puttipong@rvglobalsoft.com>
* @param String null
*/
public function makeRemoveTryout($option = array())
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return null;
}
####################################
########### PRIVATE FUNCTION ###########
####################################
private function _validateStatus($status)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if (strtolower($status) == 'ok') {
return true;
} else {
return SGL::raiseError($status);
}
}
public function replacePreviewOnlineCounter($cpanelCounterTag)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return $cpanelCounterTag;
}
public function getRvBinPath()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return '/usr/local/rvglobalsoft/rvsitebuilder/rvbin/rvswrapper';
}
public function isAdmin($username = RVS_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return ($username == RVS_ROOT_USER_NAME) ? true : false;
}
public function ownerIsAdmin($ownername = RVS_OWNER_USER_NAME)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
// $result = $this->socketAPI('CMD_API_SHOW_USER_CONFIG', array('user'=> RVS_OWNER_USER_NAME));
//$result['usertype']) && $result['usertype'] == $userType
return ($ownername == RVS_ROOT_USER_NAME || $ownername == 'root')? true : false;
}
public function makeUploadFolder($userUploadPath, $pathRootUpload, $rootPath)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if (is_link($userUploadPath) && is_dir($rootPath) ) {
unlink($userUploadPath);
}
if (!is_dir($userUploadPath)) {
mkdir($userUploadPath);
}
return false;
}
public function createUserSymlinkUserFolder($pathUserUpload, $pathUploadLink)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
RvsLibs_User::createUserSymlinkUserFolderDa($pathUserUpload, $pathUploadLink);
}
public function moveUploadedFile($tempFile, $destination)
{
SGL::logMessage('tempFile :: ' . $tempFile, PEAR_LOG_DEBUG);
SGL::logMessage('destination::' . $destination, PEAR_LOG_DEBUG);
return RvsLibs_System::copy(array($tempFile, $destination));
}
public function isUploadedFile($tempFile)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return is_file($tempFile);
}
public function makeLink($source, $des)
{
SGL::logMessage('tempFile :: ' . $source, PEAR_LOG_DEBUG);
SGL::logMessage('destination::' . $des, PEAR_LOG_DEBUG);
RvsLibs_System::copy(array($source, $des));
}
function secureCommandMakeLinkProjectId($projectId)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return true;
}
public function msgWaringOpenBaseDir()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
return RvsLibs_String::translate('userda contact provider to update virtualhost');
}
public function buildProjectUrlForDa()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$defaultDomain = $this->getDefaultDomain();
$oPublishReg = Publish_Registry::singleton();
$publishUrl = $oPublishReg->get('publishUrl');
$oPublisUrl = (isset($publishUrl) && $publishUrl)? $publishUrl : $defaultDomain;
$socketDomain = $this->validateDomain($defaultDomain);
if ($socketDomain === false) {
return false;
}
$dirPath = RvsLibs_File::buildPath(array(RVS_USER_HOME, 'domains', $defaultDomain, 'public_html', '.rvsitebuilderHome'));
$dirRVS = RvsLibs_File::buildPath(array(RVS_USER_HOME, 'domains', $defaultDomain, 'public_html', '.rvsitebuilder'));
$realProjectPath = RvsLibs_File::buildPath(array(RVS_USER_HOME, '.rvsitebuilder', 'projects'));
if (is_dir($dirPath) == false) {
RvsLibs_System::mkDir(array('-p','-m', 0755, $dirPath));
}
//.rvsitebuilder ไม่ควรมีใน public_html
if (is_dir($dirRVS) == true) {
RvsLibs_System::rm(array('-rf', $dirRVS));
}
// ถ้า phpsu มีปัญหาให้ validate ก่อน
// symlink /home/{user}/public_html/.rvsitebuilderHome/projects -----> /home/{user}/.rvsitebuilder/projects
// phpsu make folder /home/{user}/public_html/.rvsitebuilderHome/projects
// if (RvsLibs_System::runDetectPhpSuexec()) {
// $this->createProjectLink($realProjectPath, $dirPath . '/projects');
SGL::logMessage("To:" . $realProjectPath . ' From: ' . $dirPath . '/projects' , PEAR_LOG_DEBUG);
if (is_dir($dirPath .'/projects') == true) {
RvsLibs_System::rm(array('-rf', $dirPath .'/projects'));
}
if(is_link($dirPath .'/projects') == false) {
RvsLibs_System::ln(array('-s', $realProjectPath, $dirPath . '/projects'));
}
$pathImg = SGL_WEB_ROOT . '/images/error.gif';
$pathPublicImg = RvsLibs_File::buildPath(array(RVS_USER_HOME, 'domains', $defaultDomain, 'public_html', 'error.gif'));
if (is_file($pathPublicImg) == false) {
RvsLibs_System::copy(array($pathImg, $pathPublicImg));
}
//move .htaccess : nipaporn
RvsLibs_File::appendImagesDa($dirPath);
}
public function createLinkFolder($fullPath, $fileZip)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function createLinkFileAndFolder($fullPath)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function makeFolderLink($fullPath, $folderName)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function makeImageLink($fullPath, $filename)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
public function isRealConfigUpLoadMaxFileSize()
{
$data = $this->socketAPI('HTM_FILE_UPLOAD',array('path'=>'/'));
$reINIMaxSize = ini_get('upload_max_filesize');
$iniMaxSize = intval($reINIMaxSize);
$data = is_array($data)
? join('',array_keys($data))
: false;
if (preg_match('/Max_Filesize_:_(.*?)_MB/simx' ,$data, $regs)) {
$sevMaxSize = intval($regs[1]);
return ($sevMaxSize < $iniMaxSize) ? $sevMaxSize . 'M' : $reINIMaxSize;
} else {
return false;
}
}
/**
* Make userdata path
* @return unknown_type
*/
function makeuserdatapath($userdataPath)
{
return RvsLibs_System::secureCommand('makeuserdatapath');
}
function replaceUrlToNobase($data)
{
$data = RvsLibs_Project::replaceCpanelUrlToNobase($data);
return RvsLibs_Project::replaceNocpToNobase($data);
}
function makeFileQuota($dnsPublish)
{
return true;
}
public function getPublishMsgHttps($domain = '')
{
$domain = ($domain != '') ? $domain : self::getDefaultDomain();
$aParam = array('action' => 'view'
, 'domain' => $domain);
$res = $this->socketAPI('CMD_API_ADDITIONAL_DOMAINS', $aParam);
SGL::logMessage('domain:' . $domain, PEAR_LOG_DEBUG);
if(isset($res['private_html']) && $res['private_html'] == 'directory') {
$domain = ($domain != '') ? $domain : 'domain';
$data = RvsLibs_String::translate('Information guide for directadmin setup symbolic link from private_html to public_html.'
, 'vprintf'
, array('DOMAIN' => $domain)
);
} else {
$data = '';
}
return $data;
}
public function detectCpanelProxyMsg()
{
return false;
}
/**
*
* Make Restore Online Counter
*
* @author Puttipong <puttipong at rvglobalsoft.com>
*
* @param $projectId <STRING>
* @return TRUE
*/
public function makeRestoreOnlineCounter($projectId=null) {
return true;
}
public function getMySQLVersion()
{
return 'unknow';
}
public function getPHPVersion()
{
return PHP_VERSION;
}
public function getPerlVersion()
{
return 'unknow';
}
public function getPhpHandler()
{
$phpConf = array();
$phpConf['suexec'] = "disable";
$phpConf['default-ver'] = "5";
$phpConf['SAPI']['5'] = "suphp";
return $phpConf;
}
/**
* Directadmin explode _ and return all character
* User12345678_xxxx
*
* return User12345678
*
* (non-PHPdoc)
* @see CpHandle_InterfaceForUser::getDBMinChaName()
*/
public function getDBMinChaName($name = '')
{
SGL::logMessage("debug before: " . $name, PEAR_LOG_DEBUG);
return $name;
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez