public function RunChecks() { if ($this->reportToOutput === false && $this->recipientEmail === null) { throw new BadMethodCallException('No reporting defined. Call "ReportToEmail()" or/and "ReportToOutput()" method.'); } if (Count($this->checks) === 0) { throw new BadMethodCallException('No checks defined. Add at least one check using "AddCheck()" method.'); } $errors = array(); foreach ($this->checks as $key => $check) { if ($check['pre_url'] !== null) { File_Get_Contents($check['pre_url']); } // just fetch the page, we don't need it's contents $response = File_Get_Contents($check['url']); if ($response === false) { $errors[] = array($check, 'URL not reachable'); continue; } $checkFound = false; if ($check['is_regex'] === false) { $checkFound = StrPos($response, $check['check']) !== false; } else { $matchResult = Preg_Match($check['check'], $response); if ($matchResult === false) { $errors[] = array($check, 'Regular expression is not valid'); continue; } else { if ($matchResult > 0) { $checkFound = true; } } } if ($checkFound === false) { $errors[] = array($check, 'Check string not found'); } } if (Count($errors) > 0) { $errorsBody = ''; foreach ($errors as $key => $error) { if ($this->recipientEmail !== null) { if ($this->oneEmailPerError === true) { $errorsBody .= $this->getErrorMessage($error) . "\n\n"; } else { $this->sendErrorEmail($this->getErrorMessage($error)); } } if ($this->reportToOutput === true) { if ($this->inCli === true) { echo $this->getErrorMessage($error) . "\n\n"; } else { echo Nl2Br($this->getErrorMessage($error)) . "<br /><br />"; } } } if ($this->recipientEmail !== null && $this->oneEmailPerError === true) { $this->sendErrorEmail($errorsBody); } } }
#------------------------------------------------------------------------------- case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Params['Links'] = isset($Span) ? $Span->ToXMLString() : '-'; #------------------------------------------------------------------------------- $Table = new Tag('TABLE', array('class' => 'EdeskMessage', 'cellspacing' => 5, 'height' => '100%', 'width' => '100%')); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # JBS-1177 а код в подписи-то выполняется ... #$Params['User']['Sign'] = Nl2Br(HtmlSpecialChars($Params['User']['Sign'])); $Params['User']['Sign'] = Comp_Load('Edesks/Text', array('String' => $Params['User']['Sign'], 'IsLockText' => $OwnerID != @$GLOBALS['__USER']['ID'])); if (Is_Error($Text)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- # JBS-1178 да и в имени пользователя - тоже $Params['User']['Name'] = Nl2Br(HtmlSpecialChars($Params['User']['Name'])); #------------------------------------------------------------------------------- $Table->AddHTML(TemplateReplace(SPrintF('Edesks.Message.TABLE.%s', $__USER['Params']['Settings']['EdesksDisplay'] == 'Left' ? 'Left' : 'Right'), $Params)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Table; #-------------------------------------------------------------------------------