本文整理汇总了PHP中IO_Write函数的典型用法代码示例。如果您正苦于以下问题:PHP IO_Write函数的具体用法?PHP IO_Write怎么用?PHP IO_Write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IO_Write函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HTTP_Send
function HTTP_Send($Target, $Settings, $Get = array(), $Post = array(), $Addins = array())
{
/******************************************************************************/
$__args_types = array('string', 'array', 'array', 'string,array', 'array');
#-------------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/******************************************************************************/
$Default = array('Protocol' => 'tcp', 'Address' => 'localhost', 'Port' => 8080, 'Host' => 'localhost', 'Basic' => '', 'Charset' => 'UTF-8', 'Hidden' => '', 'IsLogging' => TRUE);
#-------------------------------------------------------------------------------
Array_Union($Default, $Settings);
#-------------------------------------------------------------------------------
$IsLogging = (bool) $Default['IsLogging'];
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error('[HTTP_Send]: не удалось определить путь временной директории');
}
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Address = $Default['Address'];
#-------------------------------------------------------------------------------
Debug(SPrintF('[HTTP_Send]: соединяемся с (%s:%u)', $Address, $Default['Port']));
#-------------------------------------------------------------------------------
# https://bugs.php.net/bug.php?id=52913
# пришлось заменить: $Address -> $Default['Host']
$Socket = @FsockOpen(SPrintF('%s://%s', $Protocol = $Default['Protocol'], $Default['Host']), $Port = $Default['Port'], $nError, $sError, $Config['Other']['Libs']['HTTP']['SocketTimeout']);
if (!Is_Resource($Socket)) {
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/logs/http-send.log', $Tmp), SPrintF("%s://%s:%u ошибка соединения\n\n", $Protocol, $Address, $Port));
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать данные в лог файл');
}
#-------------------------------------------------------------------------------
return ERROR | @Trigger_Error('[HTTP_Send]: не удалось соединиться с удаленным хостом');
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
# added by lissyara, 2012-01-04 in 08:42:54 MSK, for JBS-130
Stream_Set_TimeOut($Socket, $Config['Other']['Libs']['HTTP']['StreamTimeout']);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Charset = $Default['Charset'];
#-------------------------------------------------------------------------------
$Method = Count($Post) > 0 ? 'POST' : 'GET';
#-------------------------------------------------------------------------------
$Hidden = $Default['Hidden'];
#-------------------------------------------------------------------------------
if (Count($Get)) {
$Target .= SPrintF('?%s', HTTP_Query($Get, $Charset, $Hidden, $IsLogging));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Headers[] = SPrintF('%s %s HTTP/1.0', $Method, $Target);
#-------------------------------------------------------------------------------
$Headers[] = SPrintF('Host: %s', $Default['Host']);
#-------------------------------------------------------------------------------
$Headers[] = 'Connection: close';
#-------------------------------------------------------------------------------
$Headers = Array_Merge($Headers, $Addins);
#-------------------------------------------------------------------------------
if ($Basic = $Default['Basic']) {
#-------------------------------------------------------------------------------
$Basic = Base64_Encode($Basic);
#-------------------------------------------------------------------------------
$Headers[] = SPrintF('Authorization: Basic %s', $Basic);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Body = '';
#-------------------------------------------------------------------------------
if ($Post) {
#-------------------------------------------------------------------------------
if (Is_Array($Post)) {
#-------------------------------------------------------------------------------
if (Count($Post) > 0) {
#-------------------------------------------------------------------------------
$Headers[] = 'Content-Type: application/x-www-form-urlencoded';
#-------------------------------------------------------------------------------
$Body = HTTP_Query($Post, $Charset, $Hidden, $IsLogging);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
$Body = Mb_Convert_Encoding($Post, $Charset);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
if ($Length = MB_StrLen($Body, 'ASCII')) {
$Headers[] = SPrintF('Content-Length: %u', $Length);
}
#-------------------------------------------------------------------------------
$Query = SPrintF("%s\r\n\r\n%s", Implode("\r\n", $Headers), $Body);
#-------------------------------------------------------------------------------
Debug(SPrintF("[HTTP_Send]: делаем запрос:\n%s", $Query));
#-------------------------------------------------------------------------------
//.........这里部分代码省略.........
示例2: Save
public function Save()
{
#-----------------------------------------------------------------------------
$SessionID = $this->SessionID;
#-----------------------------------------------------------------------------
if (!$SessionID) {
return ERROR | @Trigger_Error('[Session->Save]: пустой идентификатор сессии');
}
#-----------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error('[Session->Save]: не удалось найти временную папку');
}
#-----------------------------------------------------------------------------
#$IsWrited = IO_Write(SPrintF('%s/sessions/%s',$Tmp,$SessionID),Serialize($this->Data),TRUE);
$IsWrited = IO_Write(SPrintF('%s/sessions/%s', $Tmp, $SessionID), JSON_Encode($this->Data), TRUE);
if (Is_Error($IsWrited)) {
return ERROR | @Trigger_Error('[Session->Save]: не удалось сохранить сессию');
}
#-----------------------------------------------------------------------------
return TRUE;
}
示例3: SPrintF
#-------------------------------------------------------------------------------
echo "Ошибка применения патча\n";
#-------------------------------------------------------------------------------
$__SYSLOG =& $GLOBALS['__SYSLOG'];
#-------------------------------------------------------------------------------
echo SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20)));
#-------------------------------------------------------------------------------
if (!$Force) {
return;
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$IsWrite = IO_Write($File, (string) $PatchInt, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
echo "\n\n-- Перезагрузка базы данных\n\n";
#-------------------------------------------------------------------------------
示例4: Started_Contract_Register
function Started_Contract_Register($Settings, $PepsonID, $Person, $DomainZone)
{
/****************************************************************************/
$__args_types = array('array', 'string', 'array', 'string');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$HTTP = array('Protocol' => $Settings['Protocol'], 'Port' => $Settings['Port'], 'Address' => $Settings['Address'], 'Host' => $Settings['Address'], 'IsLogging' => $Settings['Params']['IsLogging']);
#-----------------------------------------------------------------------------
$Reseller = new Tag('reseller');
$Reseller->AddChild(new Tag('login', $Settings['Login']));
$Reseller->AddChild(new Tag('password', $Settings['Password']));
#-----------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------------------
$pCountry = isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry'];
#-----------------------------------------------------------------------------
$Path = SPrintF('%s/started/states[%s].json', $Tmp, $pCountry);
#-----------------------------------------------------------------------------
if (File_Exists($Path)) {
#---------------------------------------------------------------------------
$States = IO_Read($Path);
if (Is_Error($States)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------------------
$States = JSON_Decode($States, TRUE);
if (!$States) {
return ERROR | @Trigger_Error(500);
}
} else {
#---------------------------------------------------------------------------
$Request = new Tag('RequestBody', $Reseller);
#---------------------------------------------------------------------------
$objCountry = new Tag('objCountry');
$objCountry->AddChild(new Tag('method', 'getRegions'));
$objCountry->AddChild(new Tag('country', $pCountry));
#---------------------------------------------------------------------------
$Request->AddChild($objCountry);
#---------------------------------------------------------------------------
$Post = SprintF("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n%s", $Request->ToXMLString());
#---------------------------------------------------------------------------
$Responce = HTTP_Send('/', $HTTP, array(), $Post, array('Content-type: text/xml'));
if (Is_Error($Responce)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------------------
$Response = Trim($Responce['Body']);
#---------------------------------------------------------------------------
$Answer = String_XML_Parse($Response);
if (Is_Exception($Answer)) {
return new gException('WRONG_ANSWER', $Response, $Answer);
}
#---------------------------------------------------------------------------
$States = Current($States->ToArray('item'));
#---------------------------------------------------------------------------
$IsWrite = IO_Write($Path, JSON_Encode($States), TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
}
#-----------------------------------------------------------------------------
$objUser = new Tag('objUser');
$objUser->AddChild(new Tag('method', 'create'));
#-----------------------------------------------------------------------------
$objUser->AddChild(new Tag('email', $Person['Email']));
$objUser->AddChild(new Tag('password', SubStr(Md5(UniqID()), -8)));
#-----------------------------------------------------------------------------
$IsRussian = In_Array(isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry'], array('RU', 'BY', 'UA'));
#-----------------------------------------------------------------------------
switch ($PepsonID) {
case 'Natural':
#-------------------------------------------------------------------------
$pStateID = 0;
#-------------------------------------------------------------------------
$pState = $Person['pState'];
#-------------------------------------------------------------------------
foreach ($States as $State) {
#-----------------------------------------------------------------------
if (Preg_Match(SPrintF('/%s/', StrToLower($State['title'])), StrToLower($pState))) {
#---------------------------------------------------------------------
$pStateID = $State['id'];
#---------------------------------------------------------------------
Debug(SPrintF('Найдена область: %s', $pStateID));
#---------------------------------------------------------------------
break;
}
}
#-------------------------------------------------------------------------
if (!$pStateID) {
#-----------------------------------------------------------------------
Debug(SPrintF('Область не найдена, проверьте название области (%s)', $pState));
#-----------------------------------------------------------------------
return new gException('POST_REGION_NOT_FOUND', 'Область почтового адреса не найдена');
}
#-------------------------------------------------------------------------
//.........这里部分代码省略.........
示例5: SPrintF
<?php
#-------------------------------------------------------------------------------
$Folder = $_SERVER['DOCUMENT_ROOT'];
#-------------------------------------------------------------------------------
$Link = SPrintF('%s/styles', $Folder);
#-------------------------------------------------------------------------------
if (!File_Exists($Link)) {
#-----------------------------------------------------------------------------
if (!SymLink(SPrintF('%s/styles', SYSTEM_PATH), $Link)) {
return ERROR | @Trigger_Error(500);
}
}
#-------------------------------------------------------------------------------
$HtAccess = IO_Read(SPrintF('%s/.htaccess', $Folder));
if (Is_Error($HtAccess)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$HtAccess = Str_Replace('Styles', 'styles', $HtAccess);
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/.htaccess', $Folder), $HtAccess, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
@UnLink(SPrintF('%s/Styles', $Folder));
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
示例6: IO_Read
<?php
#-------------------------------------------------------------------------------
$Config = IO_Read($Path = SPrintF('%s/hosts/%s/config/Config.xml', SYSTEM_PATH, HOST_ID));
if (Is_Error($Config)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Config = Str_Replace('Account', 'Invoice', $Config);
#-------------------------------------------------------------------------------
$IsWrite = IO_Write($Path, $Config, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
示例7: array
#-------------------------------------------------------------------------------
if (!$IsExists) {
$Codes[UniqID('ID')] = array('IP' => $_SERVER['REMOTE_ADDR'], 'Secret' => $Secret = Rand(100000, 900000), 'Date' => Time());
}
#-------------------------------------------------------------------------------
$XML = To_XML_String($Codes);
if (Is_Error($XML)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/protect.xml', $Tmp), $XML, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Path = Styles_Element('Images/ProtectBg.png');
if (Is_Error($Path)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Im = ImageCreateFromPng($Path);
#-------------------------------------------------------------------------------
$Color = ImageColorAllocate($Im, 0, 0, 0);
#-------------------------------------------------------------------------------
$Px = (ImageSx($Im) - 8.5 * StrLen($Secret)) / 2;
#-------------------------------------------------------------------------------
示例8: Comp_Load
return ERROR | @Trigger_Error(400);
case 'string':
#---------------------------------------------------
$Comp = Comp_Load('Formats/WorkComplite/Report/Number', $ContractID, $Month);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------
$File = SPrintF('Report%s.pdf', Md5($_SERVER['REMOTE_ADDR']));
#---------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/files/%s', $Tmp, $File), $PDF, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------
$Location = SPrintF('/GetTemp?File=%s&Name=Report%s.pdf&Mime=application/pdf', $File, $Comp);
#---------------------------------------------------
if (!XML_HTTP_REQUEST) {
#-------------------------------------------------
Header(SPrintF('Location: %s', $Location));
#-------------------------------------------------
return TRUE;
}
#---------------------------------------------------
return array('Status' => 'Ok', 'Location' => $Location);
default:
示例9: SPrintF
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20)));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($Commit) {
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20)));
}
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/LastUpdate.stamp', $Tmp), (string) Time(), TRUE);
if (Is_Error($IsWrite)) {
return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20)));
}
#-------------------------------------------------------------------------------
$Event = array('UserID' => $UserID ? $UserID : 10, 'PriorityID' => 'System', 'Text' => 'Обновление биллинга: заменён файловый набор');
$Event = Comp_Load('Events/EventInsert', $Event);
if (!$Event) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return '[OK]';
#-------------------------------------------------------------------------------
示例10: Upload_Get
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Upload = Upload_Get('aSign');
#-------------------------------------------------------------------------------
switch (ValueOf($Upload)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
# No more...
break;
case 'array':
#-------------------------------------------------------------------------------
$File = SPrintF('styles/%s/Images/aSign.bmp', HOST_ID);
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/%s', SYSTEM_PATH, $File), $Upload['Data'], TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return array('Status' => 'Ok');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例11: Str_Replace
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------------------
$Replace = <<<EOD
<TD id="Context">
<TABLE cellspacing="0" cellpadding="0" width="100%" height="100%">
<TR>
<COMP id="MenuLeft" path="Menus/Left" />
<TD valign="top">
<DIV class="Title" id="Title" />
<TABLE width="100%" cellspacing="5" cellpadding="0">
<TR>
<TD id="Into" />
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
EOD;
#-----------------------------------------------------------------------------
$Source = Str_Replace('<TD id="Main" />', $Replace, $Source);
#-----------------------------------------------------------------------------
$IsWrite = IO_Write($Real, $Source, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
}
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
示例12: IO_Write
</TD>
</TR>
</TABLE>
</FORM>
</TD>
<TD>
<IFRAME name="Main" src="FileList.html" style="width:100%;height:100%;s" />
</TD>
</TR>
</TABLE>
EOD;
#-------------------------------------------------------------------------------
$DOM->AddHTML('Into', $Parse);
#-------------------------------------------------------------------------------
$Out = $DOM->Build();
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/Index.html', $JBsDocPath), $Out, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$File = IO_Read(SPrintF('%s/styles/root/Css/Standard.css', SYSTEM_PATH));
if (Is_Error($File)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/Standard.css', $JBsDocPath), $File, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例13: System_Element
$Ticket->AddChild($Messages);
#---------------------------------------------------------------------------
$Tickets->AddChild($Ticket);
}
#-----------------------------------------------------------------------------
$User->AddChild($Tickets);
#-----------------------------------------------------------------------------
$Users->AddChild($User);
}
#-------------------------------------------------------------------------------
$Dump = $Users->ToXMLString();
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$File = SPrintF('Bpanel[%s%s].xml.gz', Md5($_SERVER['REMOTE_ADDR']), Date('d.m.Y'));
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/files/%s', $Tmp, $File), GzEncode($Dump), TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
echo SPrintF('<A href="/GetTemp?File=%s&Name=Bpanel.xml.gz&Mime=application/gzip">[Сохранить файл базы данных]</A>', $File);
#-------------------------------------------------------------------------------
echo <<<EOD
</BODY>
</HTML>
EOD;
#-------------------------------------------------------------------------------
示例14: foreach
foreach ($Files as $File) {
#-------------------------------------------------------------------------------
if ($File == 'names.txt') {
continue;
}
#-------------------------------------------------------------------------------
$Path = SPrintF('%s/%s', $Uploads, $File);
#-------------------------------------------------------------------------------
if (Time() - FileMTime($Path) > 600) {
#-------------------------------------------------------------------------------
if (isset($Names[$File])) {
unset($Names[$File]);
}
#-------------------------------------------------------------------------------
if (!UnLink($Path)) {
return ERROR | @Trigger_Error(SPrintF('Не удалось удалить файл (%s)', $Path));
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$IsWrite = IO_Write($NamesPath, JSON_Encode($Names), TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return $Hash;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例15: HTMLDoc_CreatePDF
function HTMLDoc_CreatePDF($ModeID, $HTML, $Prefix = '/')
{
/****************************************************************************/
$__args_types = array('string', 'string,object', 'string');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
if (Is_Object($HTML)) {
#---------------------------------------------------------------------------
$Tables = $HTML->GetByTagName('TABLE');
#---------------------------------------------------------------------------
for ($i = 0; $i < Count($Tables); $i++) {
#-------------------------------------------------------------------------
$Table =& $Tables[$i];
#-------------------------------------------------------------------------
switch (@$Table->Attribs['class']) {
case 'Standard':
$Table->AddAttribs(array('border' => 2, 'cellspacing' => 0, 'cellpadding' => 5), TRUE);
break;
default:
# No more...
}
}
#---------------------------------------------------------------------------
$Tds = $HTML->GetByTagName('TD');
#---------------------------------------------------------------------------
for ($i = 0; $i < Count($Tds); $i++) {
#-------------------------------------------------------------------------
$Td =& $Tds[$i];
#-------------------------------------------------------------------------
switch (@$Td->Attribs['class']) {
case 'Head':
$Td->AddAttribs(array('bgcolor' => '#ADC1F0'), TRUE);
break;
case 'Separator':
$Td->AddAttribs(array('bgcolor' => '#EAEAEA'), TRUE);
break;
default:
# No more...
}
}
#---------------------------------------------------------------------------
$Imgs = $HTML->GetByTagName('IMG');
#---------------------------------------------------------------------------
for ($i = 0; $i < Count($Imgs); $i++) {
#-------------------------------------------------------------------------
$Img =& $Imgs[$i];
#-------------------------------------------------------------------------
$Img->AddAttribs(array('src' => SPrintF('%s/%s', $Prefix, $Img->Attribs['src'])), TRUE);
}
#---------------------------------------------------------------------------
$HTML = $HTML->Build();
}
#-----------------------------------------------------------------------------
$Config = Config();
#-----------------------------------------------------------------------------
$Settings = $Config['HTMLDOC'];
#-----------------------------------------------------------------------------
$Modes = $Settings['Modes'];
#-----------------------------------------------------------------------------
$Mode = isset($Modes[$ModeID]) ? $Modes[$ModeID] : $ModeID;
#-----------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: временная папка не найдена');
}
#-----------------------------------------------------------------------------
$Logs = SPrintF('%s/logs', $Tmp);
#-----------------------------------------------------------------------------
if (!File_Exists($Logs)) {
#---------------------------------------------------------------------------
if (!@MkDir($Logs, 0777, TRUE)) {
return ERROR | @Trigger_Error(500);
}
}
#-----------------------------------------------------------------------------
$HTML = @Mb_Convert_Encoding($HTML, $Settings['ConvertToCharset']);
if (!$HTML) {
return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось преобразовать кодировку');
}
#-----------------------------------------------------------------------------
$UniqID = UniqID('HTMLDOC');
#-----------------------------------------------------------------------------
$File = IO_Write($Path = SPrintF('%s/%s', $Tmp, $UniqID), $HTML);
Debug($File);
if (Is_Error($File)) {
return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось создать временный файл');
}
#-----------------------------------------------------------------------------
$Command = SPrintF('htmldoc %s %s', $Mode, $Path);
#-----------------------------------------------------------------------------
Debug($Command);
#-----------------------------------------------------------------------------
if (!PutENV('HTMLDOC_NOCGI=1')) {
return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось установить переменную окружения HTMLDOC_NOCGI');
}
#-----------------------------------------------------------------------------
$HTMLDOC = @Proc_Open($Command, array(array('pipe', 'r'), array('pipe', 'w'), array('file', $Log = SPrintF('%s/HTMLDOC.log', $Logs), 'a')), $Pipes);
if (!Is_Resource($HTMLDOC)) {
//.........这里部分代码省略.........