| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/components/com_sobi2/includes/ |
Upload File : |
<?php
/**
* @version $Id: fsystem.class.php 5462 2010-08-18 08:25:37Z Sigrid Suski $
* @package: Sigsiu Online Business Index 2 (Sobi2)
* ===================================================
* @author
* Name: Sigrid & Radek Suski, Sigsiu.NET GmbH
* Email: sobi[at]sigsiu.net
* Url: http://www.sigsiu.net
* ===================================================
* @copyright Copyright (C) 2006 - 2010 Sigsiu.NET GmbH (http://www.sigsiu.net). All rights reserved.
* @license see http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL.
* You can use, redistribute this file and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*/
defined( '_SOBI2_' ) || exit("Restricted access");
class sobi2Fsystem {
function makePath( $config, $base, $path = null, $mode = null )
{
if( strlen( $path ) ) {
$path = DS.$path;
}
// replace possible folder separators
$path = str_replace( array( '\\', '/', '|' ) , DS, $path );
// remove doubles
$path = str_replace( array( DS.DS ) , DS, $path );
// check if dir exists
if ( file_exists( $base.$path ) ) {
return true;
}
// set mode
$origmask = umask( 0 );
if( $config->dmod ) {
$mode = octdec( $config->dmod );
}
else {
$mode = ( 0777 - $origmask );
}
$parts = explode( DS, $path );
$n = count( $parts );
$ret = true;
if ( $n < 1 ) {
$ret = mkdir( $base, $mode) ;
}
else {
$path = $base;
for ($i = 0; $i < $n; $i++) {
$path .= $parts[$i] . DS;
if ( !file_exists( $path ) ) {
if ( !mkdir( substr( $path,0,-1 ), $mode ) ) {
$ret = false;
break;
}
}
}
}
if ( isset( $origmask ) ) {
umask( $origmask );
}
return $ret;
}
/**
* creating transparent png images for IE <= 6.0
*
* @param string $icon
* @param string $alt
* @return string
*/
function checkPNGImage( $icon, $alt, $style = null, $class = null, $title = null )
{
$config =& sobi2Config::getInstance();
$class = $class ? "class='{$class}'" : null;
$style2 = $style ? "style=\"{$style}\"" : null;
$title = $title ? "title=\"{$title}\"" : null;
$image = "<img src=\"{$icon}\" alt=\"{$alt}\" {$class} {$title} {$style2}/>";
if( !$config->key("general", "use_png_fix", true ) ) {
return $image;
}
if(isset($_SERVER['HTTP_USER_AGENT']) && (sobi2_eregi("msie",$_SERVER['HTTP_USER_AGENT']) && !sobi2_eregi("opera",$_SERVER['HTTP_USER_AGENT']))) {
$v = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"msie"));
$browser = isset( $v[0] ) ? $v[0] : null;
$version = isset( $v[1] ) ? $v[1] : 0;
if(strtoupper($browser) == "MSIE") {
$version = sobi2_ereg_replace("[^0-9]", "", $version);
if($version <= 60) {
$image = "<img src=\"{$config->liveSite}/components/com_sobi2/images/blank.gif\" {$class} {$title} style=\"{$style} filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{$icon}'\", sizingMethod='crop'\"/>";
if( $config->key("general", "cachel2_ignore_ie6", true ) ) {
$config->cacheL2Enabled = false;
}
}
}
}
return $image;
}
function chmodRecursive( $path, $fmode = null, $dmode = null, $force = false )
{
$config =& sobi2Config::getInstance();
if( !$config->cmod || empty( $config->cmod ) ) {
return false;
}
if( !$force ) {
$fmode = $config->fmod;
$dmode = $config->dmod;
}
$fmode = $fmode < 600 ? decoct( $fmode ) : $fmode;
$dmode = $dmode < 600 ? decoct( $dmode ) : $dmode;
if( !strstr( strtoupper( PHP_OS ), "WIN") && function_exists( "exec" ) ) {
$path = escapeshellarg( $path );
if( $fmode ) {
$fmode = (int) $fmode;
@exec( "find {$path} -type f -exec chmod {$fmode} {} \;" );
}
if( $dmode ) {
$dmode = (int) $dmode;
@exec( "find {$path} -type d -exec chmod {$dmode} {} \;" );
}
}
else {
if( defined( '_JEXEC' ) && class_exists( 'JRequest' ) ) {
jimport( 'joomla.filesystem.path' );
return JPath::setPermission( $path, $fmode, $dmode );
}
else {
return mosChmodRecursive( $path, $fmode, $dmode );
}
}
}
/**
* Clear and remove a directory recursive
*
* @param string $dir
*/
function removeDirRecursive( $dir )
{
$dir = str_replace(array("/","\\"), DS, $dir);
$dir = str_replace(DS.DS, DS, $dir);
$return = false;
if( $dir == _SOBI_CMSROOT ||
$dir == _SOBI_FE_PATH ||
( strlen($dir) < strlen(_SOBI_CMSROOT) + 3 ) ) {
trigger_error("Trying to remove protected directory |{$dir}|", E_USER_WARNING );
return false;
}
if (is_dir($dir) && $handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($dir.DS.$file)) {
sobi2Fsystem::removeDirRecursive($dir.DS.$file);
}
else {
unlink($dir.DS.$file);
}
}
}
closedir($handle);
if(rmdir($dir)) {
$return = true;
}
}
return $return;
}
}
?>