function calc_size($adr,&$total,&$dir,&$size){ $adr=realpath($adr); $dp=OpenDir($adr); do{ $itm=ReadDir($dp); if (($itm!=".")&&($itm!="..")&&($itm!="")&&Is_Dir("$adr/$itm")){ calc_size("$adr/$itm",$total,$dir,$size); $dir++; } elseif (($itm!=".")&&($itm!="..")&&($itm!="")){ $size = $size+FileSize("$adr/$itm"); $total++; } } while ($itm!=false); CloseDir($dp); }
#------------------------------------------------------------------------------- $Module = SPrintF('%s/%s', $Path, $File); #------------------------------------------------------------------------------- Debug(SPrintF('[JBs core]: загружается модуль (%s)', $Module)); #------------------------------------------------------------------------------- if (Load($Module) === ERROR) { return ERROR | Trigger_Error('[JBs core]: не удалось загрузить модуль'); } #------------------------------------------------------------------------------- $Loaded[] = $File; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- CloseDir($Folder); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- /** * Configure Smarty template engine. */ #------------------------------------------------------------------------------- $smarty = JSmarty::get(); #------------------------------------------------------------------------------- // Sets template paths. $templatePaths = array(); #------------------------------------------------------------------------------- foreach ($HostsIDs as $HostID) { $templatePaths[] = SPrintF('%s/hosts/%s/templates', SYSTEM_PATH, $HostID);
function IO_Scan($Path, $IsHidden = TRUE) { /****************************************************************************/ $__args_types = array('string', 'boolean'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $Result = array(); #----------------------------------------------------------------------------- $Folder = @OpenDir($Path); if (!$Folder) { return ERROR | @Trigger_Error(SPrintF('[IO_Scan]: не возможно открыть директорию (%s)', $Path)); } #----------------------------------------------------------------------------- $Ignored = array('.', '..'); #----------------------------------------------------------------------------- if ($IsHidden) { $Ignored = Array_Merge($Ignored, array('.svn')); } #----------------------------------------------------------------------------- # ReadDir changed to ScanDir by lissyara, for JBS-335 $Files = ScanDir($Path); #while($File = ReadDir($Folder)){ foreach ($Files as $File) { #--------------------------------------------------------------------------- if (In_Array($File, $Ignored)) { continue; } #--------------------------------------------------------------------------- $Result[] = $File; } #----------------------------------------------------------------------------- CloseDir($Folder); #----------------------------------------------------------------------------- return $Result; }