<?php
class RVSCOMPODB
{
/**
* Returns the 2 letter language code, ie, de for German.
*
* @static
*
* @access public
*
* @return string language abbreviation
*/
function getCurrentLang()
{
if (is_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php')) {
$aTmpConf = parse_ini_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php', true);
$currentLang = $aTmpConf['template']['xml_lang'];
}
return (isset($currentLang)) ? $currentLang : SGL::getCurrentLang();
}
/**
* Returns current encoding, ie, utf-8.
*
* @static
*
* @access public
*
* @return string charset codepage
*/
function getCurrentCharset()
{
if (is_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php')) {
$aTmpConf = parse_ini_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php', true);
$GLOBALS['_SGL']['CHARSET'] = $aTmpConf['template']['charset'];
}
return $GLOBALS['_SGL']['CHARSET'];
}
/**
* return template folder
* @return unknown_type
*/
function getTemplateItemFolder()
{
if (is_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php')) {
$aTmpConf = parse_ini_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php', true);
$template = (isset($aTmpConf['template']['template_item_folder'])) ? $aTmpConf['template']['template_item_folder'] : '';
}
return (isset($template) && $template != "") ? $template : false;
}
function checkTemplateData()
{
$aData = array();
if (is_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php')) {
$aData = parse_ini_file(SGL_VAR_DIR . '/rvstemplateconf.ini.php', true);
$aData = isset($aData['template'])
? $aData['template']
: array();
}
return $aData;
}
/**
* validate is DiyTemplate
* @return unknown_type
*/
function isDiyTemplate()
{
$templatePath = (defined('RVS_USER_HOME')) ? RVS_USER_HOME . '/.rvsitebuilder/upload/template' : null;
//$template = self::getTemplateItemFolder();
$aTmpConf = self::checkTemplateData();
if (isset($aTmpConf['isResponsiveTemplate']) && $aTmpConf['isResponsiveTemplate']) {
return false;
}
$templateFolder = '';
if (isset($aTmpConf['template_item_folder'])) {
$templateFolder = $aTmpConf['template_item_folder'];
}
$templateDiyConf = $templatePath . '/' . $templateFolder . '/diyconf.ini.php';
if ($templateFolder && preg_match('/\_DiyPicture\_/', $templateFolder)
|| is_file($templateDiyConf)) {
return true;
}
return false;
}
/**
* validate is responsive Template
* @return unknown_type
*/
function isResTemplate()
{
$aTmpConf = self::checkTemplateData();
if (isset($aTmpConf['isResponsiveTemplate']) && $aTmpConf['isResponsiveTemplate']) {
return true;
}
return false;
}
/**
* validate is uikit Template
* @return unknown_type
*/
function isUikitTemplate()
{
$aTmpConf = self::checkTemplateData();
if (isset($aTmpConf['isUikit']) && $aTmpConf['isUikit']) {
return true;
}
return false;
}
/**
* file size user >= {log.sizerotate} go to rotate
*@author apiruk boonruksa
*/
public static function rvsRotateFileWebsiteLog()
{
//random 25 in rand 1-100 to do
$numCheck = 25;
$numRand = rand(1,100);
$isRotae = ($numCheck == $numRand) ? true : false;
if ($isRotae && SGL_Config::get('log.enabled')) {
$fileLogPath = SGL_LOG_DIR . '/php_log.txt';
$fileLogPath1 = SGL_LOG_DIR . '/php_log.txt.1';
$fileSizeConf = (SGL_Config::get('log.sizerotate')) ? SGL_Config::get('log.sizerotate') : 1;
$fileSize = filesize($fileLogPath); // byte
$fileSizeM = ceil(($fileSize/1024)/1024);
if (is_file($fileLogPath) && $fileSizeM >= $fileSizeConf) {
@copy($fileLogPath, $fileLogPath1);
$handle = fopen($fileLogPath, 'w');
fwrite($handle, '');
fclose($handle);
$currentPwd = @getcwd();
@chdir(SGL_LOG_DIR);
//delete .tar.gz
@unlink('php_log.txt.1.tar.gz');
@shell_exec('gzip php_log.txt.1.tar.gz php_log.txt.1');
//delete php_log.txt.1
@unlink($fileLogPath1);
@chdir($currentPwd);
}
}
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez