function Styles_HostsIDs($Element) { /****************************************************************************/ $__args_types = array('string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $Result = array(); #----------------------------------------------------------------------------- $HostsIDs = $GLOBALS['HOST_CONF']['HostsIDs']; #----------------------------------------------------------------------------- if (isset($_COOKIE['StyleID'])) { Array_UnShift($HostsIDs, $_COOKIE['StyleID']); } #----------------------------------------------------------------------------- foreach ($HostsIDs as $HostID) { #--------------------------------------------------------------------------- $Path = SPrintF('%s/styles/%s/%s', SYSTEM_PATH, $HostID, $Element); #--------------------------------------------------------------------------- if (File_Exists($Path)) { $Result[] = $HostID; } } #----------------------------------------------------------------------------- if (Count($Result) < 1) { return ERROR | @Trigger_Error(SPrintF('[Styles_HostsIDs]: не удалось найти хосты для элемента (%s)', $Element)); } #----------------------------------------------------------------------------- return $Result; }
/** * Metainformation catalogue * -------------------------------------------------- * * Lib_XML for MicKa * * @link http://www.bnhelp.cz * @package Micka * @category Metadata * @version 20121206 * */ function applyTemplate($xmlSource, $xsltemplate) { $rs = FALSE; if (File_Exists(CSW_XSL . '/' . $xsltemplate)) { if (!extension_loaded("xsl")) { if (substr(PHP_OS, 0, 3) == "WIN") { dl("php_xsl.dll"); } else { dl("php_xsl.so"); } } $xp = new XsltProcessor(); $xml = new DomDocument(); $xsl = new DomDocument(); $xml->loadXML($xmlSource); $xsl->load(CSW_XSL . '/' . $xsltemplate); $xp->importStyleSheet($xsl); //$xp->setParameter("","lang",$lang); $xp->setParameter("", "user", $_SESSION['u']); $rs = $xp->transformToXml($xml); } if ($rs === FALSE) { setMickaLog('applyTemplate === FALSE', 'ERROR', 'micka_lib_xml.php'); } return $rs; }
public static function init() { #------------------------------------------------------------------------------- if (self::$instance === NULL) { #------------------------------------------------------------------------------- try { #------------------------------------------------------------------------------- Debug("[system/classes/auto/CacheManager.class.php]: Start initializing cache system."); #------------------------------------------------------------------------------- if (Extension_Loaded(MemcachedCache::EXT_NAME) && File_Exists(SPrintF('%s/.memcached', SYSTEM_PATH))) { #------------------------------------------------------------------------------- Debug('[system/classes/auto/CacheManager.class.php]: Force load MemcachedCache'); #------------------------------------------------------------------------------- self::$instance = MemcachedCache::getInstance(); #------------------------------------------------------------------------------- } else { if (Extension_Loaded(APCCache::EXT_NAME)) { #------------------------------------------------------------------------------- Debug('[system/classes/auto/CacheManager.class.php]: Load APCCache'); #------------------------------------------------------------------------------- self::$instance = APCCache::getInstance(); #------------------------------------------------------------------------------- } else { if (Extension_Loaded(MemcachedCache::EXT_NAME)) { #------------------------------------------------------------------------------- Debug('[system/classes/auto/CacheManager.class.php]: Load MemcachedCache'); #------------------------------------------------------------------------------- self::$instance = MemcachedCache::getInstance(); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- throw new Exception("Any supported cache not installed in your sysytem."); } } } #------------------------------------------------------------------------------- Debug("Cache system has been initialized."); #------------------------------------------------------------------------------- } catch (Exception $e) { #------------------------------------------------------------------------------- Debug("Cache system has not been installed: " . $e->getTraceAsString()); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- return self::$instance; #------------------------------------------------------------------------------- }
function WriteToLog($txt, $level) { $this->logLevel = IntVal(COption::GetOptionString("mail", "smtp_log_level", "4")); if ($this->logLevel < $level) { return; } if (MicroTime(true) - $this->startPeriodTimeTruncate > 600) { if ($this->logFile) { FClose($this->logFile); } $this->logFile = null; if (File_Exists($_SERVER["DOCUMENT_ROOT"] . $this->logFileName)) { $logSize = @FileSize($_SERVER["DOCUMENT_ROOT"] . $this->logFileName); $logSize = IntVal($logSize); if ($logSize > $this->logMaxSize) { if (($fp = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "rb")) && ($fp1 = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", "wb"))) { $iSeekLen = IntVal($logSize - $this->logMaxSize / 2.0); FSeek($fp, $iSeekLen); @FWrite($fp1, "Truncated " . Date("Y-m-d H:i:s") . "\n---------------------------------\n"); do { $data = FRead($fp, 8192); if (StrLen($data) == 0) { break; } @FWrite($fp1, $data); } while (true); @FClose($fp); @FClose($fp1); @Copy($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", $_SERVER["DOCUMENT_ROOT"] . $this->logFileName); @UnLink($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_"); } } ClearStatCache(); } $this->startPeriodTimeTruncate = MicroTime(true); } if (!$this->logFile || $this->logFile == null) { $this->logFile = FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "a"); } if (!$this->logFile) { echo "Can't write to log\n---------------------------------\n"; return; } FWrite($this->logFile, Date("Y-m-d H:i:s") . "\t" . trim($txt) . "\n"); FFlush($this->logFile); //if ($level > 4) echo trim($txt) . "\n---------------------------------\n"; }
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)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось открыть процесс'); } #----------------------------------------------------------------------------- $StdOut =& $Pipes[1]; #----------------------------------------------------------------------------- $Result = ''; #----------------------------------------------------------------------------- while (!Feof($StdOut)) { $Result .= FRead($StdOut, 1024); } #----------------------------------------------------------------------------- Proc_Close($HTMLDOC); #----------------------------------------------------------------------------- if (!UnLink($Path)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось удалить временный файл'); } #----------------------------------------------------------------------------- if (!$Result) { return ERROR | @Trigger_Error(SPrintF('[HTMLDoc_CreatePDF]: ошибка формирования PDF, смотрите (%s)', $Log)); } #----------------------------------------------------------------------------- return $Result; }
echo SPrintF("Очистка временной директории компилированных шаблонов\n"); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (File_Exists(SPrintF('%s/WhatsApp', $Tmp))) { #------------------------------------------------------------------------------- if (Is_Error(IO_RmDir(SPrintF('%s///WhatsApp', $Tmp)))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- echo SPrintF("Очистка временной директории WhatsApp\n"); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (File_Exists($MyCnf)) { UnLink($MyCnf); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IsUpdate = DB_Update('Config', array('Value' => 'TRUE'), array('Where' => "`Param` = 'IsInitDB'")); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IsFlush = CacheManager::flush(); if (!$IsFlush) { @Trigger_Error(500); } #-------------------------------------------------------------------------------
function Img($Image, $Dw = 200, $Dh = 300, $Type = 2) { if (!File_Exists($Image)) { return False; } #如果需要生成缩略图,则将原图拷贝一下重新给$Image赋值 // IF($Type!=1){ Copy($Image, Str_Replace(".", "_x.", $Image)); $Image = Str_Replace(".", "_x.", $Image); // } var_dump($Image); #取得文件的类型,根据不同的类型建立不同的对象 $ImgInfo = GetImageSize($Image); var_dump($ImgInfo); switch ($ImgInfo[2]) { case 1: $Img = @ImageCreateFromGIF($Image); break; case 2: $Img = @ImageCreateFromJPEG($Image); break; case 3: $Img = @ImageCreateFromPNG($Image); break; } #如果对象没有创建成功,则说明非图片文件 if (empty($Img)) { #如果是生成缩略图的时候出错,则需要删掉已经复制的文件 if ($Type != 1) { Unlink($Image); } return False; } #如果是执行调整尺寸操作则 if ($Type == 1) { $w = ImagesX($Img); $h = ImagesY($Img); $width = $w; $height = $h; if ($width > $Dw) { $Par = $Dw / $width; $width = $Dw; $height = $height * $Par; if ($height > $Dh) { $Par = $Dh / $height; $height = $Dh; $width = $width * $Par; } } elseif ($height > $Dh) { $Par = $Dh / $height; $height = $Dh; $width = $width * $Par; if ($width > $Dw) { $Par = $Dw / $width; $width = $Dw; $height = $height * $Par; } } else { $width = $width; $height = $height; } $nImg = ImageCreateTrueColor($width, $height); #新建一个真彩色画布 ImageCopyReSampled($nImg, $Img, 0, 0, 0, 0, $width, $height, $w, $h); #重采样拷贝部分图像并调整大小 ImageJpeg($nImg, $Image); #以JPEG格式将图像输出到浏览器或文件 return True; #如果是执行生成缩略图操作则 } else { $w = ImagesX($Img); $h = ImagesY($Img); $width = $w; $height = $h; $nImg = ImageCreateTrueColor($Dw, $Dh); if ($h / $w > $Dh / $Dw) { #高比较大 $width = $Dw; $height = $h * $Dw / $w; $IntNH = $height - $Dh; ImageCopyReSampled($nImg, $Img, 0, -$IntNH / 1.8, 0, 0, $Dw, $height, $w, $h); } else { #宽比较大 $height = $Dh; $width = $w * $Dh / $h; $IntNW = $width - $Dw; ImageCopyReSampled($nImg, $Img, -$IntNW / 1.8, 0, 0, 0, $width, $Dh, $w, $h); } ImageJpeg($nImg, $Image); return True; } }
function IO_Write($Path, $Data, $IsRewrite = FALSE, $Wait = 3) { /******************************************************************************/ $__args_types = array('string', 'string', 'boolean', 'integer'); #------------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /******************************************************************************/ Debug(SPrintF('[IO_Write]: запись в файл (%s)', $Path)); #------------------------------------------------------------------------------- if (File_Exists($Path)) { #------------------------------------------------------------------------------- $Start = Time() + $Wait; #------------------------------------------------------------------------------- do { } while (!Is_Writable($Path) && Time() < $Start); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Folder = DirName($Path); #------------------------------------------------------------------------------- if (!File_Exists($Folder)) { #------------------------------------------------------------------------------- Debug(SPrintF('[IO_Write]: создание директории (%s)', $Folder)); #------------------------------------------------------------------------------- if (!@MkDir($Folder, 0777, TRUE)) { return ERROR | @Trigger_Error(SPrintF('[IO_Write]: не возможно создать директорию (%s)', $Folder)); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $File = @Fopen($Path, $IsRewrite ? 'w' : 'a'); if (!$File) { return ERROR | @Trigger_Error('[IO_Write]: ошибка открытия файла'); } #------------------------------------------------------------------------------- if (!@Fwrite($File, $Data)) { return ERROR | @Trigger_Error('[IO_Write]: ошибка записи в файл'); } #------------------------------------------------------------------------------- if (!@Fclose($File)) { return ERROR | @Trigger_Error('[IO_Write]: ошибка закрытия файла'); } #------------------------------------------------------------------------------- # почему закомменчено - не знаю. так было. #if(Preg_Match('/\/tmp\//',$Path)) # if(!@ChMod($Path,0666)) # @Trigger_Error('[IO_Write]: ошибка установки прав на файл'); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return TRUE; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- }
function __ShutDown_Function__() { global $__SETTINGS, $__MESSAGES, $__ERRORS; echo '</TABLE>'; if (Count($__MESSAGES)) { echo '<H2>Сообщения:</H2><UL class="Standard">'; foreach ($__MESSAGES as $__MESSAGE) { echo SPrintF('<LI>%s</LI>', $__MESSAGE); } echo '</UL>'; } if (Count($__ERRORS)) { echo '<H2>Ошибки выполнения:</H2><UL class="Standard">'; foreach ($__ERRORS as $__ERROR) { echo SPrintF('<LI><PRE>%s</PRE></LI>', $__ERROR); } echo '</UL>'; } if (File_Exists(SPrintF('%s/INSTALL', SYSTEM_PATH))) { if (!@File_Put_Contents(SETTINGS_FILE, JSON_Encode($__SETTINGS))) { echo SPrintF('<P>Не удалось сохранить текущие настройки установки в файле (%s)</P>', SETTINGS_FILE); } } echo <<<EOD </BODY> </HTML> EOD; }
$dPort = 3306; } #------------------------------------------------------------------------------- $MYSQL_BIN = @$_ENV['MYSQL_BIN']; #------------------------------------------------------------------------------- if ($MYSQL_BIN) { echo SPrintF("Use mysql in (%s)\n", $MYSQL_BIN); } else { $MYSQL_BIN = 'c:\\Program Files\\MySQL\\MySQL Server 5.1\\bin\\mysql.exe'; } #------------------------------------------------------------------------------- foreach (array('structure', 'views', 'permissions', 'triggers', 'functions', 'db') as $File) { #----------------------------------------------------------------------------- $Path = SPrintF('./../../db/%s/%s.sql', $jHost, $File); #----------------------------------------------------------------------------- if (File_Exists($Path)) { #--------------------------------------------------------------------------- echo SPrintF("Install %s\n", $File); #--------------------------------------------------------------------------- $MySQL = SPrintF('%s -u %s --password=%s --host=%s --port=%u %s', $MYSQL_BIN, $dUser, $dPassword, $dServer, $dPort, $dName); #--------------------------------------------------------------------------- $Result = Exec(SPrintF('%s < %s 2>&1', $MySQL, $Path)); #--------------------------------------------------------------------------- if ($Result) { #------------------------------------------------------------------------- echo SPrintF("%s\n", $Result); #------------------------------------------------------------------------- exit("Error\n"); } } }
#------------------------------------------------------------------------------- $DOM->AddAttribs('MenuLeft', array('args' => 'Administrator/AddIns')); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $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; }
<?php /* * Main reporting code */ $m = new Memcached(); $m->addServer('/var/run/memcached/memcached.sock', 0); $MakeMojangNewsRequest = false; if (!($PSA = $m->get('mc_status_mojang'))) { $MakeMojangNewsRequest = true; } require __DIR__ . '/MinecraftStatusChecker.class.php'; $MinecraftStatus = new MinecraftStatusChecker($MakeMojangNewsRequest); $Answer = array('v' => 10, 'last_updated' => Date('H:i:s T'), 'report' => $MinecraftStatus->GetReport()); unset($MakeMojangNewsRequest, $MinecraftStatus); if (File_Exists('psa.txt')) { if ($PSA != false) { $PSA .= '<hr class="dotted">'; } $PSA .= File_Get_Contents('psa.txt'); } if ($PSA != false) { $Answer['psa'] = $PSA; unset($PSA); } $Raw = $Answer['report']; foreach ($Raw as $Service => $Report) { $Downs = (int) $m->get('mc_status_' . $Service); if ($Report['status'] === MinecraftStatusChecker::STATUS_OFFLINE) { $Answer['report'][$Service]['downtime'] = '±' . ++$Downs; }
<?php #------------------------------------------------------------------------------- /** @author Alex Keda, for www.host-food.ru */ /******************************************************************************/ /******************************************************************************/ $ConfigPath = SPrintF('%s/hosts/%s/config/Config.xml', SYSTEM_PATH, HOST_ID); #------------------------------------------------------------------------------- if (File_Exists($ConfigPath)) { #------------------------------------------------------------------------------- $File = IO_Read($ConfigPath); if (Is_Error($File)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $XML = String_XML_Parse($File); if (Is_Exception($XML)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Config = $XML->ToArray(); #------------------------------------------------------------------------------- $Config = $Config['XML']; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Config = array(); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
<?php /** Enter point. */ include File_Exists('INSTALL') ? './install/index.php' : './core/Load.php';
function __Error_Handler__($Number, $Error, $File, $Line) { #------------------------------------------------------------------------------- $Message = SPrintF('[!!%s]-%s в линии %s файла %s', $Number, $Error, $Line, $File); #------------------------------------------------------------------------------- $__ERR_CODE =& $GLOBALS['__ERR_CODE']; #------------------------------------------------------------------------------- if ((int) $Error && $__ERR_CODE == 100) { $__ERR_CODE = $Error; } #------------------------------------------------------------------------------- Debug(SPrintF('[!] %s', $Message)); //Debug(SPrintF('[!] %s',debug_print_backtrace())); #------------------------------------------------------------------------------- //Error_Reporting(E_ALL); #------------------------------------------------------------------------------- if (Error_Reporting()) { #------------------------------------------------------------------------------- $JBsErrorID = SPrintF('%s[%s]', HOST_ID, Md5(Implode(':', array($Number, $Error, $Line, $File)))); #------------------------------------------------------------------------------- $__SYSLOG =& $GLOBALS['__SYSLOG']; #------------------------------------------------------------------------------- $Log = Implode("\n", $__SYSLOG); #------------------------------------------------------------------------------- Report($JBsErrorID, $JBsErrorID); #------------------------------------------------------------------------------- foreach (array(SYSTEM_PATH, '/tmp') as $Folder) { #------------------------------------------------------------------------------- $Path = SPrintF('%s/jbs-errors.log', $Folder); #------------------------------------------------------------------------------- if (File_Exists($Path)) { if (FileSize($Path) > 1024 * 1024) { UnLink($Path); } } #------------------------------------------------------------------------------- umask(077); #------------------------------------------------------------------------------- if (!@File_Put_Contents($Path, SPrintF("%s\n\n%s\n\n", $JBsErrorID, $Log), FILE_APPEND)) { #------------------------------------------------------------------------------- Debug(SPrintF('[__Error_Handler__]: не удалось осуществить запись ошибки в системный лог (%s)', $Path)); #------------------------------------------------------------------------------- continue; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (File_Exists(SPrintF('%s/DEBUG.OUT', SYSTEM_PATH)) || !isset($_SERVER["REMOTE_PORT"])) { #------------------------------------------------------------------------------- exit($Log); } else { #------------------------------------------------------------------------------- $Errors = array(100 => 'Ошибка выполнения', 101 => 'Неизвестный результат', 201 => 'Неверные параметры', 400 => 'Ошибка данных', 500 => 'Системная ошибка', 600 => 'Ошибка политики безопасности', 601 => 'Неверный реферер', 602 => 'Отсутствует реферер', 603 => 'Неверный ключ CSRF', 700 => 'Нарушение политики прав'); #------------------------------------------------------------------------------- $FilePath = SPrintF('%s/hosts/root/templates/modules/Trigger.Error.html', SYSTEM_PATH); #------------------------------------------------------------------------------- if (Is_Readable($FilePath)) { #------------------------------------------------------------------------------- $Result = @File_Get_Contents($FilePath); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Result = SPrintF("Cannot read error file: %s<BR />\nError: %%s<BR />\n<!--%%s-->\nErrorID: %%s\n<!--%%s-->", $FilePath); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $String = SPrintF('%s (%s)', $Errors[$__ERR_CODE], $__ERR_CODE); #------------------------------------------------------------------------------- @Header(SPrintF('JBs-ErrorID: %s', $JBsErrorID)); #------------------------------------------------------------------------------- if (isset($_POST['XMLHttpRequest'])) { #------------------------------------------------------------------------------- $Answer = array('Error' => array('CodeID' => $__ERR_CODE, 'String' => $String), 'Status' => 'Error'); #------------------------------------------------------------------------------- exit(JSON_Encode($Answer)); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- exit(SPrintF($Result, $String, $String, $JBsErrorID, Date('Y', Time()))); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- }
<?php #------------------------------------------------------------------------------- $Path = SPrintF('%s/styles/%s/Images', SYSTEM_PATH, HOST_ID); #------------------------------------------------------------------------------- $Sign = SPrintF('%s/Sign.bmp', $Path); #------------------------------------------------------------------------------- if (!File_Exists($Sign)) { return TRUE; } #------------------------------------------------------------------------------- if (!@Copy($Sign, SPrintF('%s/dSign.bmp', $Path))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!@Copy($Sign, SPrintF('%s/aSign.bmp', $Path))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!@UnLink($Sign)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
$NoBody->AddChild($Comp); break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Table1[] = 'Уровень патчей файлов'; #--------------------------------------------------------------------------- $HostsIDs = $GLOBALS['HOST_CONF']['HostsIDs']; #----------------------------------------------------------------------------- foreach ($HostsIDs as $HostID) { #--------------------------------------------------------------------------- $LastPatchFile = SPrintF('%s/hosts/%s/.LastPatchFiles', SYSTEM_PATH, $HostID); #--------------------------------------------------------------------------- if (File_Exists($LastPatchFile)) { #--------------------------------------------------------------------------- $handle = fopen($LastPatchFile, "rb"); $FileVer = fread($handle, filesize($LastPatchFile)); fclose($handle); #--------------------------------------------------------------------------- $Table1[] = array($HostID, $FileVer); } } #--------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Standard', $Table1); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- $NoBody->AddChild($Comp);
public function IsExists() { #----------------------------------------------------------------------------- $SessionID = $this->SessionID; #----------------------------------------------------------------------------- if (!$SessionID) { return FALSE; } #----------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error('[Session->IsExists]: не удалось найти временную папку'); } #----------------------------------------------------------------------------- if (!File_Exists(SPrintF('%s/sessions/%s', $Tmp, $SessionID))) { return FALSE; } #----------------------------------------------------------------------------- return TRUE; }
<?php #------------------------------------------------------------------------------- $Real = SPrintF('%s/hosts/%s/domtemplates/Base.xml', SYSTEM_PATH, HOST_ID); #------------------------------------------------------------------------------- if (File_Exists($Real)) { #----------------------------------------------------------------------------- $Source = IO_Read($Real); if (Is_Error($Source)) { 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);
<?php /* *Name:Itme Emtry *Date:20150830 *Author:MeteorCat *Email:guixin2010@live.cn */ //Access Flag Defined('FLAG') or Define('FLAG', 'flag'); //Judge Folder if (!File_Exists('./CORE')) { die('ERROR! NOT CORE FILE'); } //using Basic Framework require './CORE/Basic.php'; Basic::Ini();
function Print_Contribution_Message() { if (Count($this->Get_Extension_Names()) == 0) { return False; } global $current_user; get_currentuserinfo(); $arr_extension = $this->Get_Extension_Names(); if (File_Exists(DirName(__FILE__) . '/contribution.png')) { ?> <img src="<?php echo $this->base_url; ?> /contribution.png" class="alignright" style="margin-left:10px" /> <?php } ?> <div style="text-align:justify"> <?php if ($this->is_dashboard) { ?> <h4><?php } else { ?> <h3><?php } ?> <?php PrintF($this->t('Hello %1$s!'), $current_user->display_name); ?> </h4> <?php if ($this->is_dashboard) { ?> </h4><?php } else { ?> </h3><?php } ?> <?php if (Count($arr_extension) == 1) { ?> <p> <?php PrintF($this->t('Thank you for using my WordPress plugin %s.'), $arr_extension[0]); ?> <?php echo $this->t('I am sure you will enjoy the new features and you will surely find out fast that this plugin is very useful for you.'); ?> <p> <p> <?php echo $this->t('You can use and test it without any limitation of functionality or availability for your personal purposes.'); ?> </p> <?php } else { ?> <p> <?php PrintF($this->t('Thank you for using %1$s of my WordPress plugins: %2$s.'), $this->Number_to_Word(Count($arr_extension)), $this->Extended_Implode($arr_extension, ', ', ' ' . $this->t('and') . ' ')); ?> <?php echo $this->t('I am sure you will enjoy the new features and you will surely find out fast that these plugins are very useful for you.'); ?> </p> <p> <?php echo $this->t('You can use and test these plugins without any limitation of functionality or availability for your personal purposes.'); ?> </p> <?php } ?> <p> <?php echo $this->t('But please make a contribution in order to support that my plugins can be developed further more.'); ?> <small><?php echo $this->t('... <em>and to remove this Notification!</em>'); ?> </small> </p> <p> (<small><?php PrintF($this->t('If you have already donated in the past and lost your voucher please %sdrop me a line%s.'), '<a href="http://dennishoppe.de/contribution-voucher-code" target="_blank">', '</a>'); ?> </small>) </p> </div> <ul> <li><?php echo $this->t('Make a gift of the Amazon Wish List'); ?> : <ul> <li>» <a href="http://amzn.com/w/1A45MS7KY75CY" title="<?php echo $this->t('Amazon USA'); ?> " target="_blank"><?php echo $this->t('Amazon USA'); ?> </a></li> <li>» <a href="http://www.amazon.de/wishlist/2AG0R8BHEOJOL" title="<?php echo $this->t('Amazon Germany'); ?> " target="_blank"><?php echo $this->t('Amazon Germany'); ?> </a></li> </ul> </li> <li class="hide_if_js"><?php echo $this->t('Make a contribution via PayPal'); ?> : <ul> <li>» <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=1220480" target="_blank">United States dollar ($)</a></li> <li>» <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=U49F54BMWKNHU" target="_blank">Pound sterling (£)</a></li> <li>» <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HECSPGLPTQL24" target="_blank">Euro (€)</a></li> </ul> </li> <li class="show_if_js" style="display:none"><?php echo $this->t('Make a contribution via PayPal'); ?> : <ul> <li>» <a href="#" title="<?php echo $this->t('Make a contribution in US Dollars'); ?> " class="dennis_hoppe_contribution_show_ui">United States Dollar ($)</a> <div class="dennis_hoppe_contribution_ui"> <?php echo $this->t('Amount'); ?> : <input type="hidden" class="dennis_hoppe_contribution_currency" value="USD" /> <select class="dennis_hoppe_contribution_amount"> <option value="" disabled="disabled" selected="selected"><?php echo $this->t('Amount in USD'); ?> </option> <?php for ($amount = 6.95; $amount < 100; $amount *= 1.3) { ?> <option value="<?php echo Number_Format($amount, 2, '.', ''); ?> ">US$<?php echo Number_Format($amount, 2); ?> </option> <?php } ?> </select> <input type="button" class="dennis_hoppe_contribution_button button-primary" value="<?php echo $this->t('Proceed to PayPal'); ?> →" title="<?php echo $this->t('Proceed to PayPal'); ?> " disabled="disabled" /> </div> </li> <li>» <a href="#" title="<?php echo $this->t('Make a contribution in Pound sterling'); ?> " class="dennis_hoppe_contribution_show_ui">Pound Sterling (£)</a> <div class="dennis_hoppe_contribution_ui hide_if_js"> <?php echo $this->t('Amount'); ?> : <input type="hidden" class="dennis_hoppe_contribution_currency" value="GBP" /> <select class="dennis_hoppe_contribution_amount"> <option value="" disabled="disabled" selected="selected"><?php echo $this->t('Amount in GBP'); ?> </option> <?php for ($amount = 5.95; $amount < 100; $amount *= 1.3) { ?> <option value="<?php echo Number_Format($amount, 2, '.', ''); ?> ">£<?php echo Number_Format($amount, 2); ?> </option> <?php } ?> </select> <input type="button" class="dennis_hoppe_contribution_button button-primary" value="<?php echo $this->t('Proceed to PayPal'); ?> →" title="<?php echo $this->t('Proceed to PayPal'); ?> " disabled="disabled" /> </div> </li> <li>» <a href="#" title="<?php echo $this->t('Make a contribution in Euro'); ?> " class="dennis_hoppe_contribution_show_ui">Euro (€)</a> <div class="dennis_hoppe_contribution_ui hide_if_js"> <?php echo $this->t('Amount'); ?> : <input type="hidden" class="dennis_hoppe_contribution_currency" value="EUR" /> <select class="dennis_hoppe_contribution_amount"> <option value="" disabled="disabled" selected="selected"><?php echo $this->t('Amount in EUR'); ?> </option> <?php for ($amount = 5.95; $amount < 100; $amount *= 1.3) { ?> <option value="<?php echo Number_Format($amount, 2, '.', ''); ?> "><?php echo Number_Format($amount, 2, ',', ''); ?> €</option> <?php } ?> </select> <input type="button" class="dennis_hoppe_contribution_button button-primary" value="<?php echo $this->t('Proceed to PayPal'); ?> →" title="<?php echo $this->t('Proceed to PayPal'); ?> " disabled="disabled" /> </div> </li> <li>» <a href="#" title="<?php echo $this->t('Make a contribution in another currency'); ?> " class="dennis_hoppe_contribution_show_ui"><?php echo $this->t('Other currency'); ?> </a> <div class="dennis_hoppe_contribution_ui hide_if_js"> <input type="hidden" class="dennis_hoppe_contribution_amount" value="" /> <select class="dennis_hoppe_contribution_currency"> <option value="" disabled="disabled" selected="selected"><?php echo $this->t('International currency'); ?> </option> <option value="CAD">Dollar canadien (C$)</option> <option value="JPY">Yen (¥)</option> <option value="AUD">Australian dollar (A$)</option> <option value="CHF">Franken (SFr)</option> <option value="NOK">Norsk krone (kr)</option> <option value="SEK">Svensk krona (kr)</option> <option value="DKK">Dansk krone (kr)</option> <option value="PLN">Polski zloty</option> <option value="HUF">Magyar forint (Ft)</option> <option value="CZK">koruna česká (Kč)</option> <option value="SGD">Ringgit Singapura (S$)</option> <option value="HKD">Hong Kong dollar (HK$)</option> <option value="ILS">שקל חדש (₪)</option> <option value="MXN">Peso mexicano (Mex$)</option> <option value="NZD">Tāra o Aotearoa (NZ$)</option> <option value="PHP">Piso ng Pilipinas (piso)</option> <option value="TWD">New Taiwan dollar (NT$)</option> </select> <input type="button" class="dennis_hoppe_contribution_button button-primary" value="<?php echo $this->t('Proceed to PayPal'); ?> →" title="<?php echo $this->t('Proceed to PayPal'); ?> " disabled="disabled" /> </div> </li> </ul> </li> </ul> <?php if ($this->is_dashboard && current_user_can('activate_plugins')) { ?> <div class="remove-notification" style="text-align:right"> <form action="<?php echo Admin_Url('plugins.php'); ?> " method="post"> <input type="hidden" name="action" value="deactivate-selected"> <?php WP_Nonce_Field('bulk-plugins'); ?> <?php foreach ($this->Get_Extension_Files() as $plugin_file) { ?> <input type="hidden" name="checked[]" value="<?php echo $plugin_file; ?> "> <?php } ?> <p> <input type="submit" value="<?php echo $this->t('No thanks. Remove this box now!'); ?> " class="button"> </p> </form> </div> <?php } ?> <div class="clear"></div><?php }
#------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/ServiceCreate]: Script = %s', $File)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (IntVal($Order['ServerID']) == 0) { return new gException('SERVER_NOT_SET', 'Для услуги не задан сервер размещения, скрипт не может быть выполнен. Создайте для услуги группу серверов, назначьте в неё сервер, после чего сделайте заказ заново'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # находим полный путь к файлу if (SubStr($File, 0, 1) != '/') { $File = SPrintF('%s/hosts/%s/scripts/%s', SYSTEM_PATH, HOST_ID, $File); } #------------------------------------------------------------------------------- # проверяем наличие файла по этому пути if (!File_Exists($File)) { return new gException('FILE_NOT_FOUND', SPrintF("Файл '%s' не найден", $File)); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Server = DB_Select('Servers', array('*'), array('UNIQ', 'ID' => $Order['ServerID'])); #------------------------------------------------------------------------------- switch (ValueOf($Server)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': break; case 'array': break; default: return ERROR | @Trigger_Error(101);
function GetFileMimeType($Table, $ID) { #------------------------------------------------------------------------------- $Path = GetFilePath($Table, $ID); #------------------------------------------------------------------------------- if (File_Exists($Path['FilePath'])) { #------------------------------------------------------------------------------- $Mime = FInfo_File(FInfo_Open(FILEINFO_MIME_TYPE), $Path['FilePath']); Debug(SPrintF('[system/libs/Upload]: get file type: %s (%s)', $Path['FilePath'], $Mime)); #------------------------------------------------------------------------------- //return Mime_Content_Type($Path['FilePath']); return $Mime; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- return 'application/octetstream'; #------------------------------------------------------------------------------- }
private function CreateHandle($Master, $URL) { $Slave = cURL_Init(); $File = $URL['File']; $Options = $this->Options; $Options[CURLOPT_URL] = $this->GenerateURL($URL['URL']); $this->Requests[(int) $Slave] = $File; if ($this->UseCache) { // If we have an ETag saved, add If-None-Match header if (Array_Key_Exists($File, $this->ETags)) { $Options[CURLOPT_HTTPHEADER] = array('If-None-Match: ' . $this->ETags[$File]); } else { if (File_Exists($File)) { $Options[CURLOPT_HTTPHEADER] = array('If-Modified-Since: ' . GMDate('D, d M Y H:i:s \\G\\M\\T', FileMTime($File))); } } } cURL_SetOpt_Array($Slave, $Options); cURL_Multi_Add_Handle($Master, $Slave); return $Slave; }
public function ReceiveMessage($senderJId, array $arMessage, CXMPPClient $senderClient) { if (!$senderClient->IsAuthenticated()) { return false; } if (strlen($senderJId) <= 0) { return false; } if (!array_key_exists("iq", $arMessage) || !array_key_exists("vcard", $arMessage["iq"]) || $arMessage["iq"]["vcard"]["."]["xmlns"] != "vcard-temp") { return false; } $type = ""; if (array_key_exists("type", $arMessage["iq"]["."])) { $type = $arMessage["iq"]["."]["type"]; } if ($type == "get") { $to = $arMessage["iq"]["."]["to"]; $arUser = CXMPPUtility::GetUserByJId($to); if ($arUser) { $photoType = ""; $photo = ""; if (intval($arUser["PERSONAL_PHOTO"]) > 0) { $imageFile = CFile::GetFileArray($arUser["PERSONAL_PHOTO"]); if ($imageFile !== false) { $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 300, "height" => 300), BX_RESIZE_IMAGE_PROPORTIONAL, false); if (is_array($arFileTmp)) { $arFileTmp = CFile::MakeFileArray($arFileTmp["src"]); } $photoType = $imageFile["CONTENT_TYPE"]; if (File_Exists($arFileTmp["tmp_name"])) { $photo = File_Get_Contents($arFileTmp["tmp_name"]); $photo = Base64_Encode($photo); } } } if (empty($photo)) { $photoType = "image/gif"; if (File_Exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/socialnetwork/nopic_user_150.gif")) { $photo = File_Get_Contents($_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/socialnetwork/nopic_user_150.gif"); $photo = Base64_Encode($photo); } } $arResult = array("iq" => array("." => array("type" => "result", "from" => $to, "to" => $senderJId, "id" => $arMessage['iq']['.']['id']), "vCard" => array("." => array("xmlns" => "vcard-temp", "prodid" => '-//HandGen//NONSGML vGen v1.0//EN', "version" => '2.0'), "FN" => array("#" => CUser::FormatName($this->nameTemplate, $arUser)), "N" => array("FAMILY" => array("#" => $arUser["LAST_NAME"]), "GIVEN" => array("#" => $arUser["NAME"]), "MIDDLE" => array("#" => $arUser["SECOND_NAME"])), "NICKNAME" => array("#" => CUser::FormatName($this->nameTemplate, $arUser)), "BDAY" => array("#" => ConvertDateTime($arUser["PERSONAL_BIRTHDAY"], "YYYY-MM-DD", SITE_ID)), "ORG" => array("ORGNAME" => array("#" => $arUser["WORK_COMPANY"]), "ORGUNIT" => array("#" => $arUser["WORK_DEPARTMENT"])), "TITLE" => array("#" => $arUser["WORK_POSITION"]), "EMAIL" => array("INTERNET" => array("#" => ""), "PREF" => array("#" => ""), "USERID" => array("#" => $arUser["EMAIL"])), "JABBERID" => array("#" => $to), "PHOTO" => array("TYPE" => array("#" => $photoType), "BINVAL" => array("#" => $photo))))); if (strlen($arUser["WORK_FAX"]) > 0) { $arResult["iq"]["vCard"]["TEL"][] = array("WORK" => array("#" => ""), "FAX" => array("#" => ""), "NUMBER" => array("#" => $arUser["WORK_FAX"])); } if (strlen($arUser["PERSONAL_MOBILE"]) > 0) { $arResult["iq"]["vCard"]["TEL"][] = array("HOME" => array("#" => ""), "CELL" => array("#" => ""), "NUMBER" => array("#" => $arUser["PERSONAL_MOBILE"])); } if (strlen($arUser["WORK_PHONE"]) > 0) { $arResult["iq"]["vCard"]["TEL"][] = array("WORK" => array("#" => ""), "VOICE" => array("#" => ""), "NUMBER" => array("#" => $arUser["WORK_PHONE"])); } if (strlen($arUser["PERSONAL_PHONE"]) > 0) { $arResult["iq"]["vCard"]["TEL"][] = array("HOME" => array("#" => ""), "VOICE" => array("#" => ""), "NUMBER" => array("#" => $arUser["PERSONAL_PHONE"])); } if (strlen($arUser["PERSONAL_FAX"]) > 0) { $arResult["iq"]["vCard"]["TEL"][] = array("HOME" => array("#" => ""), "FAX" => array("#" => ""), "NUMBER" => array("#" => $arUser["PERSONAL_FAX"])); } if (strlen($arUser["WORK_STREET"]) > 0 || strlen($arUser["WORK_CITY"]) > 0 || strlen($arUser["WORK_COUNTRY"]) > 0) { $arResult["iq"]["vCard"]["ADR"][] = array("WORK" => array("#" => ""), "EXTADD" => array("#" => ""), "STREET" => array("#" => $arUser["WORK_STREET"]), "LOCALITY" => array("#" => $arUser["WORK_CITY"]), "REGION" => array("#" => $arUser["WORK_STATE"]), "PCODE" => array("#" => $arUser["WORK_ZIP"]), "CTRY" => array("#" => GetCountryByID($arUser["WORK_COUNTRY"]))); } if (strlen($arUser["PERSONAL_STREET"]) > 0 || strlen($arUser["PERSONAL_CITY"]) > 0 || strlen($arUser["PERSONAL_COUNTRY"]) > 0) { $arResult["iq"]["vCard"]["ADR"][] = array("HOME" => array("#" => ""), "EXTADD" => array("#" => ""), "STREET" => array("#" => $arUser["PERSONAL_STREET"]), "LOCALITY" => array("#" => $arUser["PERSONAL_CITY"]), "REGION" => array("#" => $arUser["PERSONAL_STATE"]), "PCODE" => array("#" => $arUser["PERSONAL_ZIP"]), "CTRY" => array("#" => GetCountryByID($arUser["PERSONAL_COUNTRY"]))); } if ($senderJId != $to) { $arResult["iq"]["."]["from"] = $to; } //print_r($arResult);echo "\n*****************************************\n"; } else { $arResult = array("iq" => array("." => array("type" => "error", "to" => $senderJId, "id" => $arMessage['iq']['.']['id']), "vCard" => array("." => array("xmlns" => "vcard-temp")), "error" => array("." => array("type" => "cancel"), "item-not-found" => array("." => array("xmlns" => "urn:ietf:params:xml:ns:xmpp-stanzas"))))); if ($senderJId != $to) { $arResult["iq"]["."]["from"] = $to; } } } elseif ($type == "set") { $arResult = array("iq" => array("." => array("type" => "result", "from" => $senderClient->GetClientDomain(), "id" => $arMessage['iq']['.']['id']))); } return $arResult; }
<?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; #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- /** @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)); }
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', 'Область почтового адреса не найдена'); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('type', 'person')); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('fname', $Person['Name'])); $objUser->AddChild(new Tag('lname', $Person['Lastname'])); $objUser->AddChild(new Tag('mname', $Person['Sourname'])); $objUser->AddChild(new Tag('doc_issued', $Person['PasportWhom'])); } else { $objUser->AddChild(new Tag('fname', Translit($Person['Name']))); $objUser->AddChild(new Tag('lname', Translit($Person['Lastname']))); $objUser->AddChild(new Tag('mname', Translit($Person['Sourname']))); $objUser->AddChild(new Tag('doc_issued', Translit($Person['PasportWhom']))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('p_inn', '')); $objUser->AddChild(new Tag('doc_serial', $Person['PasportLine'])); $objUser->AddChild(new Tag('doc_number', $Person['PasportNum'])); $objUser->AddChild(new Tag('doc_date', $Person['PasportDate'])); $objUser->AddChild(new Tag('birth_date', $Person['BornDate'])); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('country', StrToLower(isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']))); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('zip', $Person['pIndex'])); $objUser->AddChild(new Tag('state', $pStateID)); $objUser->AddChild(new Tag('city_type', 'city')); $objUser->AddChild(new Tag('addr_type', StrToLower($Person['pType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('city', $Person['pCity'])); $objUser->AddChild(new Tag('addr', SPrintF('%s %s', $Person['pType'], $Person['pAddress']))); } else { $objUser->AddChild(new Tag('city', Translit($Person['pCity']))); $objUser->AddChild(new Tag('addr', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('pzip', $Person['pIndex'])); $objUser->AddChild(new Tag('pstate', $pStateID)); $objUser->AddChild(new Tag('pcity_type', 'city')); $objUser->AddChild(new Tag('paddr_type', StrToLower($Person['pType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('pcity', $Person['pCity'])); $objUser->AddChild(new Tag('paddr', SPrintF('%s %s', $Person['pType'], $Person['pAddress']))); $objUser->AddChild(new Tag('pto', $Person['pRecipient'])); } else { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('pcity', Translit($Person['pCity']))); $objUser->AddChild(new Tag('paddr', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])))); $objUser->AddChild(new Tag('pto', Translit($Person['pRecipient']))); } break; case 'Juridical': #------------------------------------------------------------------------- $objUser->AddChild(new Tag('type', 'organization')); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('fname', $Person['dName'])); $objUser->AddChild(new Tag('lname', $Person['dLastname'])); $objUser->AddChild(new Tag('mname', $Person['dSourname'])); $objUser->AddChild(new Tag('org', SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']))); } else { $objUser->AddChild(new Tag('fname', Translit($Person['dName']))); $objUser->AddChild(new Tag('lname', Translit($Person['dLastname']))); $objUser->AddChild(new Tag('mname', Translit($Person['dSourname']))); $objUser->AddChild(new Tag('org', SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull'])))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('o_inn', $Person['Inn'])); $objUser->AddChild(new Tag('kpp', $Person['Kpp'])); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('country', StrToLower($Person['jCountry']))); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('zip', $Person['jIndex'])); #------------------------------------------------------------------------- $jStateID = 0; #------------------------------------------------------------------------- $jState = $Person['jState']; #------------------------------------------------------------------------- foreach ($States as $State) { #----------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', StrToLower($State['title'])), StrToLower($jState))) { #--------------------------------------------------------------------- $jStateID = $State['id']; #--------------------------------------------------------------------- Debug(SPrintF('Найдена область: %s', $jStateID)); #--------------------------------------------------------------------- break; } } #------------------------------------------------------------------------- if (!$jStateID) { #----------------------------------------------------------------------- Debug(SPrintF('Область не найдена, проверьте название области (%s)', $jState)); #----------------------------------------------------------------------- return new gException('JURIDICAL_REGION_NOT_FOUND', 'Область юридического адреса не найдена'); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('state', $jStateID)); $objUser->AddChild(new Tag('city_type', 'city')); $objUser->AddChild(new Tag('addr_type', StrToLower($Person['jType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('city', $Person['jCity'])); $objUser->AddChild(new Tag('addr', SPrintF('%s %s', $Person['jType'], $Person['jAddress']))); } else { $objUser->AddChild(new Tag('city', Translit($Person['jCity']))); $objUser->AddChild(new Tag('addr', Translit(SPrintF('%s %s', $Person['jType'], $Person['jAddress'])))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('pzip', $Person['pIndex'])); #------------------------------------------------------------------------- $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', 'Область почтового адреса не найдена'); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('pstate', $pStateID)); $objUser->AddChild(new Tag('pcity_type', 'city')); $objUser->AddChild(new Tag('paddr_type', StrToLower($Person['pType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('pcity', $Person['pCity'])); $objUser->AddChild(new Tag('paddr', SPrintF('%s %s', $Person['pType'], $Person['pAddress']))); $objUser->AddChild(new Tag('pto', SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']))); } else { $objUser->AddChild(new Tag('pcity', Translit($Person['pCity']))); $objUser->AddChild(new Tag('paddr', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])))); $objUser->AddChild(new Tag('pto', SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull'])))); } break; default: return ERROR | @Trigger_Error(101); } #----------------------------------------------------------------------------- $Phone = $Person['Phone']; #----------------------------------------------------------------------------- if ($Phone) { #--------------------------------------------------------------------------- $Phone = StrPBrk($Phone, ' '); #--------------------------------------------------------------------------- $objUser->AddChild(new Tag('tel', Trim($Phone))); } else { $objUser->AddChild(new Tag('tel')); } #----------------------------------------------------------------------------- $Fax = $Person['Fax']; #----------------------------------------------------------------------------- if ($Fax) { #--------------------------------------------------------------------------- $Fax = StrPBrk($Fax, ' '); #--------------------------------------------------------------------------- $objUser->AddChild(new Tag('fax', Trim($Fax))); } else { $objUser->AddChild(new Tag('fax')); } #----------------------------------------------------------------------------- $Request = new Tag('RequestBody', $Reseller); #----------------------------------------------------------------------------- $Request->AddChild($objUser); #----------------------------------------------------------------------------- $Post = SprintF("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n%s", $Request->ToXMLString()); #----------------------------------------------------------------------------- $Responce = HTTP_Send('/', $HTTP, array(), $Post, array('Content-type: text/xml; charset=utf-8')); 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); } #----------------------------------------------------------------------------- $Answer = $Answer->ToArray(); #----------------------------------------------------------------------------- $Answer = $Answer['AnswerBody']; #----------------------------------------------------------------------------- if (isset($Answer['statusCode'])) { return new gException('REGISTRATOR_ERROR', SPrintF('[%s]=(%s)', $Answer['statusCode'], $Answer['statusMessage'])); } #----------------------------------------------------------------------------- return array('TicketID' => $Answer['user_id']); }
$Input = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'Details[]', 'value' => 'ByQuarter', 'id' => 'ByQuarter')); if (Is_Error($Input)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $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);
#------------------------------------------------------------------------------- if (!$Settings['IsActive']) { 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; } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------