#------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $DOM->AddText('Title', 'Дополнения → Обслуживание системы → Логи системы'); #------------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Logs = SPrintF('%s/logs', $Tmp); #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------------------- if (File_Exists($Logs)) { #----------------------------------------------------------------------------- $Files = IO_Scan($Logs); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Table = $Options = array(); #----------------------------------------------------------------------------- if (Count($Files)) { #--------------------------------------------------------------------------- Sort($Files); #--------------------------------------------------------------------------- foreach ($Files as $File) { $Options[$File] = $File; } } #-----------------------------------------------------------------------------
#------------------------------------------------------------------------------- $Table[] = array(new Tag('SPAN', array('style' => 'cursor:pointer;', 'onclick' => 'ChangeCheckBox(\'ByQuarter\'); return false;'), 'По кварталам'), $Input); #------------------------------------------------------------------------------- $Table[] = 'Виды отчетов'; #------------------------------------------------------------------------------- $HostsIDs = Array_Reverse($GLOBALS['HOST_CONF']['HostsIDs']); #------------------------------------------------------------------------------- foreach ($HostsIDs as $HostID) { #----------------------------------------------------------------------------- $Path = SPrintF('%s/hosts/%s/comp/Statistics', SYSTEM_PATH, $HostID); #----------------------------------------------------------------------------- if (!File_Exists($Path)) { continue; } #----------------------------------------------------------------------------- $Files = IO_Scan($Path); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- foreach ($Files as $File) { #--------------------------------------------------------------------------- $StatisticID = SubStr($File, 0, StriPos($File, '.')); #--------------------------------------------------------------------------- $Comp = Comp_Load(SPrintF('Statistics/%s', $StatisticID), $IsCreate); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- $Input = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'StatisticsIDs[]', 'value' => $StatisticID, 'id' => $StatisticID)); if (Is_Error($Input)) {
#------------------------------------------------------------------------------- $File = SPrintF('%s/%s', SYSTEM_PATH, $Deleted); #------------------------------------------------------------------------------- if (!Is_Writable($File)) { return SPrintF("ERROR: недостаточно прав на удаление файла (%s)\n", $File); } #------------------------------------------------------------------------------- if ($Commit) { if (!@UnLink($File)) { return SPrintF("ERROR: не возможно удалить файл (%s)\n", $File); } } #------------------------------------------------------------------------------- $Dir = DirName($File); #------------------------------------------------------------------------------- $Files = IO_Scan($Dir); if (Is_Error($Files)) { return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20))); } #------------------------------------------------------------------------------- if (!Count($Files)) { #------------------------------------------------------------------------------- echo SPrintF("Удаление директории (%s)\n", $Dir); #------------------------------------------------------------------------------- if (!@RmDir($Dir)) { return SPrintF("ERROR: не возможно удалить директорию (%s)\n", $Dir); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- }
/** @author Великодный В.В. (Joonte Ltd.) */ /******************************************************************************/ /******************************************************************************/ eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Folder = SPrintF('%s/files', $Tmp); #------------------------------------------------------------------------------- if (File_Exists($Folder)) { #----------------------------------------------------------------------------- $Files = IO_Scan($Folder); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- foreach ($Files as $File) { #--------------------------------------------------------------------------- $Path = SPrintF('%s/%s', $Folder, $File); #--------------------------------------------------------------------------- if (Time() - FileMTime($Path) > 86400) { #------------------------------------------------------------------------- if (!@UnLink($Path)) { return ERROR | @Trigger_Error(SPrintF('[comp/Tasks/Temp]: не удалось удалить файл (%s)', $Path)); } } }
} #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- echo "\n\n-- Патчи файлов\n\n"; #------------------------------------------------------------------------------- foreach ($HostsIDs as $HostID) { #------------------------------------------------------------------------------- $Folder = SPrintF('%s/patches/%s/files', SYSTEM_PATH, $HostID); #------------------------------------------------------------------------------- if (!File_Exists($Folder)) { continue; } #------------------------------------------------------------------------------- $PatchesIDs = IO_Scan($Folder); if (Is_Error($PatchesIDs)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!Count($PatchesIDs)) { continue; } #------------------------------------------------------------------------------- Sort($PatchesIDs); #------------------------------------------------------------------------------- $File = SPrintF('%s/hosts/%s/.LastPatchFiles', SYSTEM_PATH, $HostID); #------------------------------------------------------------------------------- if (!File_Exists($File)) { #------------------------------------------------------------------------------- $LastPatchFiles = IntVal(End($PatchesIDs));
return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $DOM = new DOM(); #------------------------------------------------------------------------------- $Links =& Links(); #------------------------------------------------------------------------------- $Links['DOM'] =& $DOM; #------------------------------------------------------------------------------- if (Is_Error($DOM->Load('Standard'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $DOM->AddText('Title', 'Цветовая палитра'); #------------------------------------------------------------------------------- $HostsIDs = IO_Scan(SPrintF('%s/styles/', SYSTEM_PATH)); if (Is_Error($HostsIDs)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- # Все цвета в палитре $Colors = array('FFFFFF', '000000'); #------------------------------------------------------------------------------- $Palette = Styles_XML('Palette.xml'); if (Is_Error($Palette)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table = new Tag('TABLE', array('class' => 'Standard', 'cellspacing' => 0, 'cellpadding' => 0)); #------------------------------------------------------------------------------- $Gradetion = $Palette['Gradetion'];
$IsUpdate = DB_Update('Users', array('Watchword' => Md5($Password), 'UniqID' => Md5(SPrintF('%s.%s,', UniqID(), Rand(0, 1000000)))), array('ID' => $UserID)); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Path = SPrintF('%s/sessions', $Tmp); #------------------------------------------------------------------------------- if (File_Exists($Path)) { #------------------------------------------------------------------------------- $SessionIDsIDs = IO_Scan($Path); if (Is_Error($SessionIDsIDs)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- foreach ($SessionIDsIDs as $SessionID) { #------------------------------------------------------------------------------- if (@$_COOKIE['SessionID'] != $SessionID) { #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/^(REMEBMER|SESSION)%s/', MD5($UserID)), $SessionID)) { #------------------------------------------------------------------------------- if (!@UnLink(SPrintF('%s/%s', $Path, $SessionID))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- }
function IO_RmDir($Folder) { #------------------------------------------------------------------------------- $Folder = Preg_Replace('/\\/{2,}/', '/', rTrim($Folder, '/')); #------------------------------------------------------------------------------- if (StrPos(SPrintF('/%s/', $Folder), SYSTEM_PATH) === FALSE) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка безопасности при удалении (%s)', $Folder)); } #------------------------------------------------------------------------------- $Entities = IO_Scan($Folder, FALSE); if (Is_Error($Entities)) { return ERROR | @Trigger_Error('[IO_RmDir]: не удалось получить содержимое папки'); } #------------------------------------------------------------------------------- if (Count($Entities)) { #------------------------------------------------------------------------------- foreach ($Entities as $Entity) { #------------------------------------------------------------------------------- $Entity = SPrintF('%s/%s', $Folder, $Entity); #------------------------------------------------------------------------------- if (Is_Dir($Entity)) { #------------------------------------------------------------------------------- if (Is_Error(IO_RmDir($Entity))) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка рекурсивного вызова при удалении (%s)', $Entity)); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- if (!UnLink($Entity)) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении файла (%s)', $Entity)); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!@RmDir($Folder)) { return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении директории (%s)', $Folder)); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return TRUE; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- }
return TRUE; } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Count = 0; #------------------------------------------------------------------------------- $Sessions = SPrintF('%s/sessions', $Tmp); #------------------------------------------------------------------------------- if (File_Exists($Sessions)) { #------------------------------------------------------------------------------- $Files = IO_Scan($Sessions); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- foreach ($Files as $File) { #------------------------------------------------------------------------------- $Path = SPrintF('%s/%s', $Sessions, $File); #------------------------------------------------------------------------------- if (Preg_Match('/^REMEBMER/', $File) && Time() - FileMTime($Path) < 24 * 3600 * $Params['Sessions']['RememberTTL']) { continue; } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (Time() - FileMTime($Path) > $Params['Sessions']['SessionTTL']) { #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- $Names[$Hash] = $Name; #------------------------------------------------------------------------------- $IsWrite = IO_Write($NamesPath, JSON_Encode($Names), TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Size = Round($File['size'] / 1024); #------------------------------------------------------------------------------- # вывод для JS в браузере... if (!isset($GLOBALS['IsCron'])) { echo SPrintF('%s^%s^%s^', $Name, $Size, $Hash); } #------------------------------------------------------------------------------- $Files = IO_Scan($Uploads); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- foreach ($Files as $File) { #------------------------------------------------------------------------------- if ($File == 'names.txt') { continue; } #------------------------------------------------------------------------------- $Path = SPrintF('%s/%s', $Uploads, $File); #------------------------------------------------------------------------------- if (Time() - FileMTime($Path) > 600) { #------------------------------------------------------------------------------- if (isset($Names[$File])) {
$IsAdd = Comp_Load('www/API/TicketEdit', $Params); if (Is_Error($IsAdd)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $GLOBALS['__USER']['ID'] = 100; #------------------------------------------------------------------------------- $mailbox->deleteMessage($mail->mId, TRUE); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # ампутируем переменную, чтоб в один тикет не напостило все письма unset($MessageID); #------------------------------------------------------------------------------- # удаляем файлы $Files = IO_Scan($attachmentsDir); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- foreach ($Files as $File) { #----------------------------------------------------------------------------- $Path = SPrintF('%s/%s', $attachmentsDir, $File); #----------------------------------------------------------------------------- if (!UnLink($Path)) { return ERROR | @Trigger_Error(SPrintF('Не удалось удалить файл (%s)', $Path)); } } #------------------------------------------------------------------------------- } #-------------------------------------------------------------------------------