CHips L MINI SHELL

CHips L pro

Current Path : /opt/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/lib/RVSGL/rvsLibs/
Upload File :
Current File : //opt/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/lib/RVSGL/rvsLibs/Image.php

<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// WebSite:  http://www.rvglobalsoft.com
// Unauthorized copying is strictly forbidden and may result in severe legal action.
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
//
// =====YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT AND CAN NOT BE REMOVE =======
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
// This Agreement is a legal contract, which specifies the terms of the license
// and warranty limitation between you and RV Global Soft Co.,Ltd. and RV Site Builder.
// You should carefully read the following terms and conditions before
// installing or using this software.  Unless you have a different license
// agreement obtained from RV Global Soft Co.,Ltd., installation or use of this software
// indicates your acceptance of the license and warranty limitation terms
// contained in this Agreement. If you do not agree to the terms of this
// Agreement, promptly delete and destroy all copies of the Software.
//
// =====  Grant of License =======
// The Software may only be installed and used on a single host machine.
//
// =====  Disclaimer of Warranty =======
// THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
// WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
// WARRANTIES WHETHER EXPRESSED OR IMPLIED.   BECAUSE OF THE VARIOUS HARDWARE
// AND SOFTWARE ENVIRONMENTS INTO WHICH RV SITE BUILDER MAY BE USED, NO WARRANTY OF
// FITNESS FOR A PARTICULAR PURPOSE IS OFFERED.  THE USER MUST ASSUME THE
// ENTIRE RISK OF USING THIS PROGRAM.  ANY LIABILITY OF RV GLOBAL SOFT CO.,LTD. WILL BE
// LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
// IN NO CASE SHALL RV GLOBAL SOFT CO.,LTD. BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
// CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
// OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
// BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
// NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
// RV GLOBAL SOFT CO.,LTD. IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
// RV GLOBAL SOFT CO.,LTD.'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
// BY LICENSEE TO RV GLOBAL SOFT CO.,LTD.
// +---------------------------------------------------------------------------+
// $Id$
// +---------------------------------------------------------------------------+

/**
 * RvSiteBuilder images libary
 *
 * @package RvsLibs
 * @author  Pairote Manunphol <pairote@rvglobalsoft.com>
 * @version $Revision$
 * @since   PHP 5.1
 */
if (class_exists('RvsLibs_Image') === false) {
	class RvsLibs_Image
	{
		/**
		 * Get imagemagick path on server
		 * @author Witoon Jansri <witoon.j@rvglobalsoft.com>
		 *
		 * @return resource ;Returns path imagemagick on success, or PEAR_Error on error.
		 */
		public static function getImageMagickPath()
		{
			$which = null;
			$aPath = array('/usr/bin/convert', '/usr/local/bin/convert');
			$which = RvsLibs_Image::_getRealPath($aPath);
			$which = isset($which) && $which != '' ? $which : RvsLibs_System::exec('which convert');
			$which = str_replace("\n",'',$which);
			/*if (file_exists('/usr/bin/convert')) {
			 $which = '/usr/bin/convert';
			 } elseif (file_exists('/usr/local/bin/convert')) {
			 $which = '/usr/local/bin/convert';
			 } else {
			 if (function_exists('exec')) {
			 $which = exec('which convert');
			 $which = ereg_replace('/\n/','',$which);
			 }
			 }
			 */
			if (is_null($which) === true || is_file($which) === false) {
				return SGL::raiseError(
				RvsLibs_String::translate('Imagemagick is not install on your server.')
				);
			}

			if (is_executable($which) === false) {
				return SGL::raiseError(
				RvsLibs_String::translate('You not have permission to executable imagemagick.')
				);
			}
			return $which;
		}

		/**
		 * get publish path and publish url
		 *
		 * 1. detect by register from preview / publish
		 * 2. detect by database from publish project
		 * 3. detect by main domain
		 *
		 * @author apiruk boonruksa 28/11/2012
		 *
		 * @param $projectID
		 * @return unknown_type
		 */
		public static function _getPublishData($projectID = null)
		{
			$aData = array();
		    //1. find publish path / publish url by register
            $oPublishReg = Publish_Registry::singleton();
            $publishUrlRegis = $oPublishReg->get('publishUrl');
            $publishPathRegis = $oPublishReg->get('publishPath');

            //2. find main domain
            $dns = RvsLibs_User::getUserDNS();
            $aPath = RvsLibs_Publish::getPathByDomain($dns);

            //3. if project publish find by database
            $projectId = ($projectID)
                            ? $projectID
                            : SGL_Session::get('rvs_project_id');
            $res = DaoFactory::Publish()->findAllPublishDataByProjectIdAndUserFolderAndPublishDomainOrProjectId($projectId, null, null);
            $publishPathDb = (isset($res[$projectId]->rvs_domain_path))
                             ? $res[$projectId]->rvs_domain_path
                             : $aPath['DIR'];

            $folder =   (isset($res[$projectId]->rvs_publish_path))
                            ? $res[$projectId]->rvs_publish_path
                            : '';

            $publishUrlDb = (isset($res[$projectId]->rvs_publish_domain))
                             ? $res[$projectId]->rvs_publish_domain . $folder
                             : $dns;

            $aData['path'] = ($publishPathRegis)
                               ? $publishPathRegis
                               : $publishPathDb;
            $aData['url'] = ($publishUrlRegis)
                               ? $publishUrlRegis
                               : $publishUrlDb;
		  return $aData;
		}

		/**
		 * detects if image library is available
		 *
		 * @param $isRoot : paramiter use for unit test
		 * @return false if not detected, user friendly string of library name and version if detected
		 **/
		public static function detectGd($isRoot = FALSE)
		{
			///Debug SGL::logMessage(null, PEAR_LOG_DEBUG);

			// For root only
			if ((RvsLibs_User::getUserStatus() == RVS_ROOT_USER_NAME ) || ($isRoot === TRUE)) {
				return RvsLibs_Image::detectGdByRoot();
			}

			$aData = self::_getPublishData();
			$dns = $aData['url'];
			$pathDetect = $aData['path'];

			if (!is_writable($pathDetect)) {
				return false;
			}

			SGL::logMessage("url:" . $dns, PEAR_LOG_DEBUG);
			SGL::logMessage("path:" . $pathDetect, PEAR_LOG_DEBUG);

			// Create Random Directory
			$ranPath = 'rvphpinfo' . rand(100000,999999);
			// write php ini
			//fixed PHPMD scan 30/06/2544
            MainComponent::writeRvphpDetect(RVS_USER_NAME, $pathDetect, $ranPath,'gd');
			// Read php_info
			$site = $dns;
			$request = '/' . $ranPath . '/_rvphpinfo.php';
			//detect::urlConnnect
			//fixed PHPMD scan 30/06/2544
            $page = RvsLibs_Url::urlConnect($site, $request, 80,  null,  false,30);
			// Remove Random Directory
			unlink($pathDetect . '/' . $ranPath . '/_rvphpinfo.php');
			unlink($pathDetect . '/' . $ranPath . '/.htaccess');
			// In some servesr there is error_log generated by web server
			@unlink($pathDetect . '/' . $ranPath . '/error_log');
			rmdir($pathDetect . '/' . $ranPath);

			if (empty($page)) {
				return 2;
			}
			/// ตัวแปร $page ถ้า urlConnect fail จะ return array ทำให้เกิด warning ตอน match
			if (isset($page['CONNECT_ERROR']) && $page['CONNECT_ERROR'] == 1) {
				return 0;
			}
			// match gd library
			//fixed PHPMD scan 30/06/2544
            return (preg_match('/true/', $page['data'])) ? 1 : 0;
		}

		public static function detectGdServer()
		{
			$gdfuncList = get_extension_funcs('gd');
			ob_start();
			@phpinfo(INFO_MODULES);
			$output = ob_get_contents();
			ob_end_clean();
			$matches[1] = "";

			///TODO :: ส่วนนี้ไม่เห็นใช้งาน witoon
			/*
			if (preg_match("/GD Version[ \t]*(<[^>]+>[\t]*)+([^<>]+)/s",$output,$matches)) {
				$gdversion = $matches[2];
			}
			*/

			if ($gdfuncList) {
				if ( in_array('imagegd2',$gdfuncList) ) {
					return true;
				} else {
					return false;
				}
			} else {
				return false;
			}
		}


		public static function detectGdByRoot()
		{
			///Debug SGL::logMessage(null, PEAR_LOG_DEBUG);
			/* modify CpHandle by nipaporn*/
		    $oCp = CpHandle::factory();
		    if(SGL::isError($oCp) === true) {
		    	return $oCp;
		    	/*
		        return SGL::raiseError(RvsLibs_String::translate('CpWaring %MESSAGE', 'vprintf', array('MESSAGE' => $oCp->getMessage())));
		        */
		    }
		    $aAcctData = $oCp->listAllAcctsData();
		    if (SGL::isError($aAcctData) === true) {
		    	return $aAcctData;
		    } else {
		    	foreach ($aAcctData as $k => $aVal) {
		    		$dns = (isset($aVal['domain'])) ? $aVal['domain'] : '';
					if (RvsLibs_Config::skipDomainValidate($dns) == true) {
						continue;
					}
		    		$user = (isset($aVal['user'])) ? $aVal['user'] : '';
		    		$aUserInfo =  posix_getpwnam($user);
		    		$homeuser = $aUserInfo['dir'];
		    		$docroot = $homeuser . '/public_html';
		    		if (is_dir($docroot) && is_writable($docroot)) {
		    			// Create Random Directory
		    			$ranPath = 'rvphpinfo' . rand(100000,999999);
		    			// write php ini
		    			$res = MainComponent::writeRvphpDetect($user, $docroot, $ranPath,'gd');
		    			// Read php_info
		    			$site = $dns;
		    			$request = '/' . $ranPath . '/_rvphpinfo.php';
		    			$urlrequest = 'http://'. $site . $request;
		    			$page2 = RvsLibs_Url::urlConnect($site, $request, $port = 80, $authorizationl = null, $useSSL = false, $timeout = 30);
		    			// Remove Random Directory
		    			RvsLibs_System::unlink(RvsLibs_File::buildPath(array($docroot, $ranPath, '.htaccess')));
		    			RvsLibs_System::unlink(RvsLibs_File::buildPath(array($docroot, $ranPath, '_rvphpinfo.php')));
		    			// In some servesr there is error_log generated by web server
		    			$path = RvsLibs_File::buildPath(array($docroot, $ranPath, 'error_log'));
		    			$res = (file_exists($path)) ? RvsLibs_System::unlink($path) : '';
		    			if (SGL::isError($res) === true) {
		    				SGL_Error::pop();
		    			}
		    			rmdir($docroot . '/' . $ranPath);
		    			if (empty($page2)) {
		    				continue;
		    			}
		    			// match gd library
		    			if (preg_match('/200 OK|true/i', $page2['data'], $aMatch)) {
		    				if (preg_match('/true/', $page2['data'], $aMatch)) {
		    					return 1;
		    				}
		    				return 0;
		    			}
		    		}
		    	}
		    }
			return 2;
		}

		public static function detectImageMagic()
		{
			SGL::logMessage(null, PEAR_LOG_DEBUG);
			require_once 'Image/rvs_Transform.php';
			$haveImageMagic = true;
			$res = rvs_Transform::factory('imagemagick');
			if (SGL::isError($res)) {
				SGL_Error::pop();
				$haveImageMagic = false;
			}
			return $haveImageMagic;
		}


		public static function createThumbnail($path, $fileName)
		{
			///Debug SGL::logMessage('createThumbnail' , PEAR_LOG_DEBUG);
			$thumbPath = RvsLibs_File::buildPath(array($path, 'thumbs'));
			if (is_dir($thumbPath) === false) {
				$resMkDir = RvsLibs_System::mkDir(array('-p', $thumbPath));
				///Check Error and return
				if (SGL::isError($resMkDir) === true) {
					return SGL::raiseError(
					RvsLibs_String::translate(
                 		'Cannot generate thumbnail, because %MSG.'
                 		, 'vprintf'
                 		, array('MSG' => $resMkDir->getMessage())
                 		)
                 		);
				}
			}
			if (is_writable($thumbPath) === false) {
				///Change mode dir to 0755
				$resChmod = RvsLibs_System::chmod($thumbPath, '0755');
				///Check Error and return
				if (SGL::isError($resChmod) === true) {
					return SGL::raiseError(
					RvsLibs_String::translate(
                 		'Cannot generate thumbnail, because %MSG.'
                 		, 'vprintf'
                 		, array('MSG' => $resChmod->getMessage())
                 		)
                 		);
				}
			}
			RvsLibs_File::makeImageLink($path . '/thumbs/', $fileName);
			$res = RvsLibs_Image2::makeThumb($path . '/' . $fileName , $path . '/thumbs/' . $fileName, 120, 0);
			///Check Error and return
			if (SGL::isError($res) === true) {
				return SGL::raiseError(
				RvsLibs_String::translate(
                 	'Cannot generate thumbnail, because %MSG.'
                 	, 'vprintf'
                 	, array('MSG' => $res->getMessage())
                 	)
                 	);
			}
			return $res;
		}

	 public static function getImageSizeLayer($pathImage, $reWidth = null, $reHeight = null)
	 {
	 	$aLogoSize = array();
	 	$logoSize = array(0, 0);
	 	//RvsLibs_File::buildPath(array(PROJECT_PATH, $input->project_id, $input->project_logo))

	 	if (is_file($pathImage)) {
	 		$logoSize = RvsLibs_Image2::getImageSize($pathImage, 'gd');
	 	}
        //ถ้าหา size ไม่ได้
        $logoSizeWidth = (isset($logoSize[0])) ? $logoSize[0] : 100;
        $logoSizeHeight = (isset($logoSize[1])) ? $logoSize[1] : 100;

	 	$aLogoSize['width'] = (isset($reWidth) && $reWidth) ?  $reWidth : $logoSizeWidth;
	 	$aLogoSize['height'] = (isset($reHeight) && $reHeight) ?  $reHeight :  $logoSizeHeight;
	 	return $aLogoSize;
	 }


		public static function _getRealPath($aPath)
		{
			foreach ($aPath as $path) {
				$path = RvsLibs_File::buildPath(array($path));
				if (file_exists($path)) {
					return $path;
				}
			}
			return null;
		}

		public static function replaceRvsImagesRandom($aHtmlCode, $publishPath = null)
		{
			///Debug SGL::logMessage(null , PEAR_LOG_DEBUG);
			$aReplace = array();
			if (class_exists('PreviewMgr') === false) {
				require_once RvsLibs_File::buildPath(
				array(SGL_MOD_DIR, 'sitebuilder', 'classes', 'PreviewMgr.php')
				);
			}
			$shImageCateName = PreviewMgr::getShImageCateName();
			// replace image:url(images
			if (preg_match_all('/url\(images\/layouttemplate\/(.*?)\//si', $aHtmlCode, $aElement)) {
				if (is_array($aElement[0])) {
					foreach ($aElement[0] as $k=>$v) {
						if (preg_match("/^http/i", $aElement[0][$k])) {
							continue;
						}
						$aPatternImageUrl = preg_replace(array('/\(/', '/\//'), array('\(', '\/'), $aElement[0][$k]);
						$aReplaceImageUrl = 'url(' . SGL_BASE_URL . '/themes/default/sitebuilder/images/layouttemplate/' . $aElement[1][$k] . '/';
						$aHtmlCode = preg_replace('/' . $aPatternImageUrl . '/', $aReplaceImageUrl, $aHtmlCode);
					}
				}
			}
			// replace url_path rvs_library
			if (preg_match_all('/src=(\"|&quot;)rvs_library\/(.*?)\{RAN\}/si', $aHtmlCode, $aMatch)) {
				///Debug SGL::logMessage("-----++++++++--------" , PEAR_LOG_ERR);
				$aFileName = array();
				$aCountSizeImage = array_count_values($aMatch[0]);
				foreach ($aCountSizeImage as $k=> $num) {
					$aSize = RvsLibs_String::dbeExplode('/', $k);
					$aImageRvs[] = $aSize[1];
					$rvsLibrarySizePath = SGL_WEB_ROOT . '/rvs_library/' . $aSize[1];
					if (!is_dir($rvsLibrarySizePath)) {
						continue;
					}
					if ($dh = opendir($rvsLibrarySizePath)) {
						while (($file = readdir($dh)) !== false) {
							// keeping images where $shImageCateName
							if (    $file != "." && $file != ".." && $file != "Thumbs.db" && $file != ".svn" && $file != "wpThumbnails" && preg_match('/^(' . $shImageCateName . ')/', $file) ) {
								$aFileName[$aSize[1]][] = $file;
							}
						}
						closedir($dh);
					}
					if ( array_key_exists($aSize[1], $aFileName)) {
						$key[$aSize[1]] = array_rand($aFileName[$aSize[1]], $num);
					}
				}
				$aHtmlCode1 = RvsLibs_String::dbeExplode('img src', $aHtmlCode);
				// set aPatturn images
				foreach ($aHtmlCode1 as $k => $line) {
					if (preg_match_all('/rvs_library\/(.*?)\/{RAN(.*?)}/', $line, $aMatch)) {
						$size = $aMatch[1][0];
						//$item = $aMatch[2][0];
						$itemRan = (isset($aFileName[$size])) ? array_rand($aFileName[$size], 1) : 0;
						$line = preg_replace('/\{RAN\}/', '{RAN' . $itemRan . '}', $line);
						$aPatturn[$size . '_' . $itemRan] = '/src=(\"|&quot;)rvs_library\/' . $size . '\/(\{RAN' . $itemRan . '\})/';
						$aReplaceStart[$size][$itemRan] = $itemRan;
					}
					$aHtmlCode1[$k] = $line;
				}
				// set aReplace images
				foreach ($aReplaceStart as $size => $v) {
					if (is_array($v)) {
						foreach ($v as $k => $v2) {
							if (!isset($aFileName[$size])) {
								continue;
							}
							$aReplace[$size . '_' . $v2] = 'src="' . WEB_THEME_URL . '/rvs_library/' . $size . '/' . $aFileName[$size][$v2];
							$aImages[$size][] = $aFileName[$size][$v2];
						}
					}
				}
				// Preview and publish copy rvs_library images
				if (isset($publishPath) && file_exists($publishPath) && is_writable($publishPath) && isset($aImages) && is_array($aImages)) {
					foreach ($aImages as $size => $v) {
						if (is_array($v)) {
							foreach ($v as $k2 => $v2) {
								RvsLibs_System::mkDir(array('-p', $publishPath . '/rvs_library/' . $size));
								if (file_exists(SGL_WEB_ROOT . '/rvs_library/' . $size . '/' . $v2) && file_exists($publishPath . '/rvs_library/' . $size)) {
									if (!copy(SGL_WEB_ROOT . '/rvs_library/' . $size . '/' . $v2, $publishPath . '/rvs_library/' . $size . '/' . $v2)) {

									} else {
										copy(SGL_WEB_ROOT . '/rvs_library/' . $size . '/' . $v2, $publishPath . '/rvs_library/' . $size . '/' . $v2);
									}
								}
							}
						}
					}
				}
				$aHtmlCode1 = implode('img src', $aHtmlCode1);
				$aHtmlCode = preg_replace($aPatturn, $aReplace, $aHtmlCode1);
				return $aHtmlCode;
			} else {
				return $aHtmlCode;
			}
		}
/**
 * TODO:จะมีปัญหากับ directadmin
 * @param $data
 * @return unknown_type
 */
		public static function replaceSitebuilderUrl($data)
		{
			@ini_set("pcre.backtrack_limit", "23001337");
			@ini_set("pcre.recursion_limit", "23001337");

			$projectPath = RVSNOBASE_URL_WWW . "/project/";
			if($projectPath != "/3rdparty/rvsitebuilder/project") {
				$data = RvsLibs_String::preg_replace("#\/3rdparty\/rvsitebuilder\/project\/#si", $projectPath, $data);
			}
			$cptoken = (isset($_ENV['cp_security_token']) && $_ENV['cp_security_token']) ? $_ENV['cp_security_token'] . '/' : '/';
			$data = RvsLibs_String::preg_replace("#\/(cpsess[^\/]*?)/#si", $cptoken, $data);
			return $data;
		}

		/**
		 * change type file เปลี่ยนสกุลไฟล์ใหญ่เปลี่ยนตัวเล็ก
		 * $data = RvsLibs_Image::extensionToLower($data);
		 *
		 * @param unknown $data
		 * @return mixed
		 */
		public static function extensionToLower($data)
		{
			$doc = explode(',', SGL_Config::get('wysiwyg.documentFileType'));
			$media = explode(',', SGL_Config::get('wysiwyg.mediaFileType'));
			foreach ($doc as $v) {
				$patturn[] = '/\\'  . strtoupper(trim($v)) . '/';
				$replace[] = strtolower(trim($v));
			}
			foreach ($media as $v) {
				$patturn[] = '/\\'  . strtoupper(trim($v)) . '/';
				$replace[] = strtolower(trim($v));
			}

			$data =  preg_replace($patturn, $replace, $data);
			return $data;
		}

		public static function checkGdOrImageMagic()
		{
			if (RvsLibs_Image::detectGdServer()) {
				return 'gd';

			} elseif(RvsLibs_Image::detectImageMagic()) {
				return 'imagemagick';
			}
			return false;
		}

		/**
		 * get path from url openLibrary
		 * @param $url
		 * @param $isFolderImg
		 * @return unknown_type
		 */
		public static function getPathLibraryByUrl($url, $isFolderImg = true)
		{
			$projectId = SGL_Session::get('rvs_project_id');
			$pat4RvsLib = '/' . str_replace("/", "\/" , RVSNOBASE_URL_WWW) . '\/(rvs_library\/.*)$/im';
			$pat4LocalImg = '/\/project(?:s|)\/' . $projectId . '\/(.*)$/im';
			if (preg_match_all($pat4RvsLib, $url, $pathImg)) {
				///rvs_library (nocp,cpanel,da)
				$fileName = $pathImg[1][0];
				$isFolderImg = false;
			} elseif (preg_match_all($pat4LocalImg, $url, $pathImg)) {
				///local image (nocp,cpanel,da)
				$fileName = $pathImg[1][0];
			}
			//detect path from projects/{id}/images or www/
			if (isset($fileName)) {
				$pathImg = ($isFolderImg == true)
				            ? RvsLibs_File::buildPath(array(PROJECT_PATH, $projectId, $fileName))
				            : RvsLibs_File::buildPath(array(WEB_THEME_PATH, $fileName));
				SGL::logMessage('url:' . $url, PEAR_LOG_DEBUG);
				SGL::logMessage('path:' . $pathImg, PEAR_LOG_DEBUG);
				return $pathImg;
			} else {
				return false;
				SGL::logMessage('cannot get path from url:' . $url, PEAR_LOG_DEBUG);
			}
		}

		/**
		 *
		 * @param $url
		 * @param $path
		 * @param $imgName
		 * @return unknown_type
		 */
		public static function copyLibraryToProjectHdBanner($url, $path, $fileName)
		{
			SGL::logMessage(null, PEAR_LOG_DEBUG);
			//case: flip by library
			$desPath = RvsLibs_Image::getPathLibraryByUrl($url);
			$targetPath = RvsLibs_File::buildPath(array($path, $fileName));
			$targetPathOrg = RvsLibs_File::buildPath(array($path . 'org', $fileName));
			if (is_file($desPath)
			     && is_file($targetPath) === false
			     && is_file($targetPathOrg) === false) {
				$res = RvsLibs_System::copy(array($desPath, $targetPathOrg));
				$res = RvsLibs_System::copy(array($desPath, $targetPath));
				SGL::logMessage('desPath: ' . $desPath, PEAR_LOG_DEBUG);
				SGL::logMessage('targetPath: ' . $targetPath, PEAR_LOG_DEBUG);
                SGL::logMessage('targetPathOrg: ' . $targetPathOrg, PEAR_LOG_DEBUG);
				return $res;
			}
			return true;
		}
	}
}
?>

Copyright 2K16 - 2K18 Indonesian Hacker Rulez