#------------------------------------------------------------------------------- $Line = array(); #------------------------------------------------------------------------------- foreach ($Totals as $Total) { #----------------------------------------------------------------------------- $Comp = Comp_Load('Formats/Currency', $Total); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Lines[] = $Comp; #----------------------------------------------------------------------------- $Line[] = SPrintF('%01.2f', $Total); } #------------------------------------------------------------------------------- Array_Splice($Table, 1, 0, array($Lines)); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Extended', $Table); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $NoBody->AddChild($Comp); #------------------------------------------------------------------------------- $File = SPrintF('%s.jpg', Md5('VPSOrdersPlaning1')); #------------------------------------------------------------------------------- Artichow_Line('Планирование поступлений по VPS', SPrintF('%s/%s', $Folder, $File), array($Line), $Labels, array(0x233454)); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('IMG', array('src' => $File)));
/** * Производит нормализацию объекта * * Удаляет всю служебную информацию, подргужает компоненты в документ, * подготавливает объект к выводу. */ public function Normalize(&$Object = NULL) { /****************************************************************************/ $__args_types = array('object,NULL'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ if (Is_Null($Object)) { $Object =& $this->Object; } #----------------------------------------------------------------------------- $Childs =& $Object->Childs; #----------------------------------------------------------------------------- if (Count($Childs) > 0) { #--------------------------------------------------------------------------- $i = 0; #--------------------------------------------------------------------------- while ($i < Count($ChildsIDs = Array_Keys($Childs))) { #------------------------------------------------------------------------- $Child =& $Childs[$ChildID = $ChildsIDs[$i]]; #------------------------------------------------------------------------- $Name = $Child->Name; #------------------------------------------------------------------------- switch ($Name) { case 'NOBODY': #--------------------------------------------------------------------- $Object->AddAttribs($Child->Attribs); #--------------------------------------------------------------------- $Object->AddText($Child->Text); #--------------------------------------------------------------------- Array_Splice($Childs, $ChildID, 1, $Child->Childs); continue 2; case 'COMP': #--------------------------------------------------------------------- $Attribs =& $Child->Attribs; #--------------------------------------------------------------------- $IsHasChilds = Count($Object->Childs) > 0; #--------------------------------------------------------------------- $FunctionID = $IsHasChilds ? 'AddChild' : 'AddText'; #--------------------------------------------------------------------- $CompPath = (string) @$Attribs['path']; #--------------------------------------------------------------------- if (Is_Error(System_Element(SPrintF('comp/%s.comp.php', $CompPath)))) { #------------------------------------------------------------------- $String = SPrintF('Компонент не найден (%s)', $CompPath); #------------------------------------------------------------------- $Object->{$FunctionID}($IsHasChilds ? new Tag('SPAN', $String) : $String); } else { #------------------------------------------------------------------- $Args = isset($Attribs['args']) ? Explode('|', $Attribs['args']) : array(); #------------------------------------------------------------------- Array_UnShift($Args, $CompPath); #------------------------------------------------------------------- $Comp = Call_User_Func_Array('Comp_Load', $Args); #------------------------------------------------------------------- switch ($Type = ValueOf($Comp)) { case 'error': #--------------------------------------------------------------- $String = SPrintF('Ошибка загрузки компонента (%s)', $CompPath); #--------------------------------------------------------------- if (isset($Attribs['debug'])) { $Object->AddChild(new Tag('PRE', Implode("\n", $GLOBALS['__SYSLOG']))); } else { $Object->{$FunctionID}($IsHasChilds ? new Tag('SPAN', $String) : $String); } break 2; case 'exception': #--------------------------------------------------------------- $String = $Comp->String; #--------------------------------------------------------------- $Object->{$FunctionID}($IsHasChilds ? new Tag('SPAN', $String) : $String); break 2; case 'object': $Child = $Comp; break 2; case 'string': #--------------------------------------------------------------- $Object->AddText($Comp); #--------------------------------------------------------------- Array_Splice($Childs, $ChildID, 1, $Child->Childs); continue 3; case 'false': # No more... # No more... case 'true': # No more... break 2; default: #--------------------------------------------------------------- $String = SPrintF('Компонент вернул результат неверного типа (%s)', $Type); #--------------------------------------------------------------- $Object->{$FunctionID}($IsHasChilds ? new Tag('SPAN', $String) : $String); } } default: # No more... } #------------------------------------------------------------------------- $i++; #------------------------------------------------------------------------- $this->Normalize($Child); } } }
/** * Puts debug messages to system log and debug.log file. * * @param $message System message. */ function Debug($message) { #------------------------------------------------------------------------------- $__SYSLOG =& $GLOBALS['__SYSLOG']; #------------------------------------------------------------------------------- if (Count($__SYSLOG) > 500) { Array_Splice($__SYSLOG, 0, 50); } #------------------------------------------------------------------------------- $date = Date('H:i:s'); #------------------------------------------------------------------------------- list($micro, $seconds) = Explode(' ', MicroTime()); #------------------------------------------------------------------------------- $message = SPrintF('[%s.%02u][%s] %s', $date, $micro * 100, isset($_SERVER["REMOTE_PORT"]) ? $_SERVER["REMOTE_PORT"] : "console", Is_Array($message) ? 'Array' : $message); #------------------------------------------------------------------------------- $__SYSLOG[] = $message; #------------------------------------------------------------------------------- if (IS_DEBUG) { #------------------------------------------------------------------------------- umask(077); #------------------------------------------------------------------------------- $Path = SPrintF('%s/debug.log', SYSTEM_PATH); #------------------------------------------------------------------------------- if (File_Exists($Path)) { if (FileSize($Path) > 8 * 1024 * 1024 * 1024) { UnLink($Path); } } #------------------------------------------------------------------------------- @File_Put_Contents($Path, SPrintF("%s\n", $message), FILE_APPEND); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- }