本文整理匯總了PHP中CacheManager::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheManager::get方法的具體用法?PHP CacheManager::get怎麽用?PHP CacheManager::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CacheManager
的用法示例。
在下文中一共展示了CacheManager::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Styles_XML
function Styles_XML($Element)
{
/****************************************************************************/
$__args_types = array('string');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$CacheID = SPrintF('Styles_XML[%s]', Md5($Element));
#-----------------------------------------------------------------------------
$Result = CacheManager::get($CacheID);
if ($Result) {
return $Result;
}
#-----------------------------------------------------------------------------
$HostsIDs = Styles_HostsIDs($Element);
if (Is_Error($HostsIDs)) {
return ERROR | @Trigger_Error('[Styles_XML]: список хостов содержащих элемент не найдены');
}
#-----------------------------------------------------------------------------
$Result = array();
#-----------------------------------------------------------------------------
foreach (Array_Reverse($HostsIDs) as $HostID) {
#---------------------------------------------------------------------------
$Path = SPrintF('%s/styles/%s/%s', SYSTEM_PATH, $HostID, $Element);
#---------------------------------------------------------------------------
$File = IO_Read($Path);
if (Is_Error($File)) {
return ERROR | @Trigger_Error('[Styles_XML]: не удалось прочитать XML-файл');
}
#---------------------------------------------------------------------------
$XML = String_XML_Parse($File);
if (Is_Exception($XML)) {
return ERROR | @Trigger_Error('[Styles_XML]: не удалось разобрать XML-строку');
}
#---------------------------------------------------------------------------
$Child = Current($XML->Childs);
#---------------------------------------------------------------------------
if (isset($Child->Attribs['recursive'])) {
$Result = array();
}
#---------------------------------------------------------------------------
$Adding = $XML->ToArray();
#---------------------------------------------------------------------------
$Adding = $Adding['XML'];
#---------------------------------------------------------------------------
Array_Union($Result, $Adding);
}
#-----------------------------------------------------------------------------
CacheManager::add($CacheID, $Result);
#-----------------------------------------------------------------------------
return $Result;
}
示例2: eval
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Args = Args();
#-------------------------------------------------------------------------------
$IsCreate = (bool) @$Args['IsCreate'];
$StartDate = (int) @$Args['StartDate'];
$FinishDate = (int) @$Args['FinishDate'];
$StatisticsIDs = (array) @$Args['StatisticsIDs'];
$Details = (array) @$Args['Details'];
$ShowFired = (bool) @$Args['ShowFired'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$CacheID = Md5($__FILE__);
#-------------------------------------------------------------------------------
$Result = CacheManager::get($CacheID);
if ($Result) {
return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod', 'classes/DOM.class.php', 'libs/HTMLDoc.php'))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$GLOBALS['__USER']['IsAdmin']) {
return ERROR | @Trigger_Error(700);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例3: gException
return new gException('DOMAIN_ORDER_NOT_FOUND', 'Заказ домена не найден');
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
$WhoIs = WhoIs_Check($DomainOrder['DomainName'], $DomainOrder['SchemeName']);
#-------------------------------------------------------------------------------
switch (ValueOf($WhoIs)) {
case 'error':
#-------------------------------------------------------------------------------
# JBS-1150 - сохраняем информацию о домене и ошибке в кэше, при повторе - тупо меняем дату обновления данных whois
$CacheID = Md5(SPrintF('WhoIs-error-%s.%s', $DomainOrder['DomainName'], $DomainOrder['SchemeName']));
#-------------------------------------------------------------------------------
$IsCheck = CacheManager::get($CacheID);
#-------------------------------------------------------------------------------
if ($IsCheck) {
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('DomainOrders', array('UpdateDate' => Time()), array('ID' => $DomainOrder['ID']));
if (Is_Error($IsUpdate)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Event = array('UserID' => $DomainOrder['UserID'], 'PriorityID' => 'Warning', 'Text' => SPrintF('Повторная ошибка получения данных WhoIs для домена %s.%s, проверка пропущена', $DomainOrder['DomainName'], $DomainOrder['SchemeName']));
#-------------------------------------------------------------------------------
$Event = Comp_Load('Events/EventInsert', $Event);
if (!$Event) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例4: String_Xml_Parse
function String_Xml_Parse($String, $IsUseCache = TRUE)
{
#-------------------------------------------------------------------------------
# костыль для удаления не-UTF8 символов
$String = iconv('UTF-8', 'UTF-8//IGNORE', $String);
#-------------------------------------------------------------------------------
$Length = Mb_StrLen($String);
#-------------------------------------------------------------------------------
$IsUseCache = $IsUseCache && $Length > 1024;
#-------------------------------------------------------------------------------
if ($IsUseCache) {
#-------------------------------------------------------------------------------
$CacheID = SPrintF('String_XML_Parse[%s]', Md5(Crc32($String)));
#-------------------------------------------------------------------------------
$Result = CacheManager::get($CacheID);
if ($Result) {
return $Result;
}
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
Debug(SPrintF('[String_XML_Parse]: парсирование строки (%u bytes)', $Length));
#-------------------------------------------------------------------------------
$XmlParser = Xml_Parser_Create('UTF-8');
#-------------------------------------------------------------------------------
if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_CASE_FOLDING, FALSE)) {
return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_CASE_FOLDING)');
}
#-------------------------------------------------------------------------------
if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_SKIP_WHITE, FALSE)) {
return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_SKIP_WHITE)');
}
#-------------------------------------------------------------------------------
if (!Xml_Parse_Into_Struct($XmlParser, $String, $Nodes)) {
#-------------------------------------------------------------------------------
$ByteIndex = Xml_Get_Current_Byte_Index($XmlParser);
#-------------------------------------------------------------------------------
Debug(SPrintF('[system/libs/auto/String.php]: xml_error_string = %s', Xml_Error_String(Xml_Get_Error_Code($XmlParser))));
#-------------------------------------------------------------------------------
Debug(SPrintF('[system/libs/auto/String.php]: %s', Mb_SubStr($String, $ByteIndex - 100, $ByteIndex + 100)));
#-------------------------------------------------------------------------------
$Buffer = Mb_SubStr($String, 0, $ByteIndex);
#-------------------------------------------------------------------------------
$Line = Preg_Match_All("/(\r\n|\n)/sU", $Buffer, $Matches) + 1;
#-------------------------------------------------------------------------------
return new gException('XML_PARSE_ERROR', SPrintF('%s в линии %u', Xml_Error_String($XmlParser), $Line));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-----------------------------------------------------------------------------
Xml_Parser_Free($XmlParser);
#-----------------------------------------------------------------------------
$Root = new Tag('__ROOT__');
#-----------------------------------------------------------------------------
$Links = array(&$Root);
#-----------------------------------------------------------------------------
foreach ($Nodes as $Node) {
#---------------------------------------------------------------------------
$Current = $Links[Count($Links) - 1];
#---------------------------------------------------------------------------
switch ($Node['type']) {
case 'open':
#-----------------------------------------------------------------------
$Tag = new Tag($Node['tag']);
#-----------------------------------------------------------------------
if (isset($Node['attributes'])) {
$Tag->AddAttribs($Node['attributes']);
}
#-----------------------------------------------------------------------
if (isset($Node['value'])) {
#---------------------------------------------------------------------
$Value = $Node['value'];
#---------------------------------------------------------------------
if (Trim($Value)) {
$Tag->AddChild(new Tag('CDATA', $Value));
}
}
#-----------------------------------------------------------------------
$Current->Childs[] = $Tag;
#-----------------------------------------------------------------------
$Links[] =& $Current->Childs[Count($Current->Childs) - 1];
break;
case 'cdata':
#-----------------------------------------------------------------------
$Value = $Node['value'];
#-----------------------------------------------------------------------
if (Trim($Value)) {
#---------------------------------------------------------------------
$Tag = new Tag('CDATA', $Value);
#---------------------------------------------------------------------
$Current->Childs[] = $Tag;
}
break;
case 'complete':
#-----------------------------------------------------------------------
$Tag = new Tag($Node['tag']);
#-----------------------------------------------------------------------
if (isset($Node['attributes'])) {
$Tag->AddAttribs($Node['attributes']);
//.........這裏部分代碼省略.........
示例5: Tree_Entrance
function Tree_Entrance($TableID, $RowID)
{
/****************************************************************************/
$__args_types = array('string', 'integer');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$Regulars = Regulars();
#-----------------------------------------------------------------------------
if (!Preg_Match($Regulars['ID'], $TableID)) {
return new gException('WRONG_TABLE_ID', 'Неверный идентификатор таблицы');
}
#-----------------------------------------------------------------------------
$CacheID = SPrintF('Tree_Entrance[%s]', Md5(SPrintF('%s:%u', $TableID, $RowID)));
#-----------------------------------------------------------------------------
$Result = CacheManager::get($CacheID);
if (!$Result) {
#---------------------------------------------------------------------------
$Row = DB_Select($TableID, '*', array('UNIQ', 'ID' => $RowID));
#---------------------------------------------------------------------------
switch (ValueOf($Row)) {
case 'error':
return ERROR | @Trigger_Error('[Tree_Entrance]: не возможно найти запись');
case 'exception':
return new gException('ROW_NOT_FOUND', 'Запись не найдена');
case 'array':
#-----------------------------------------------------------------------
$Result = array($Row['ID']);
#-----------------------------------------------------------------------
$Where = SPrintF('`ParentID` = %u AND `ID` != `ParentID`', $Row['ID']);
#-----------------------------------------------------------------------
$Childs = DB_Select($TableID, '*', array('Where' => $Where));
#-----------------------------------------------------------------------
switch (ValueOf($Childs)) {
case 'error':
return ERROR | @Trigger_Error('[Tree_Entrance]: не возможно найти дочерние записи');
case 'exception':
#----->
break;
case 'array':
#-------------------------------------------------------------------
foreach ($Childs as $Child) {
#-----------------------------------------------------------------
$Entrance = Tree_Entrance($TableID, (int) $Child['ID']);
#-----------------------------------------------------------------
switch (ValueOf($Entrance)) {
case 'error':
return ERROR | @Trigger_Error('[Tree_Entrance]: не возможно определить дочерние вхождения записей');
case 'exception':
return ERROR | @Trigger_Error('[Tree_Entrance]: запись оказавшаяся дочерней не найдена');
case 'array':
$Result = Array_Merge($Result, $Entrance);
break;
default:
return ERROR | @Trigger_Error(101);
}
}
break;
default:
return ERROR | @Trigger_Error(101);
}
#-----------------------------------------------------------------------
CacheManager::add($CacheID, $Result);
break;
default:
return ERROR | @Trigger_Error(101);
}
}
#-----------------------------------------------------------------------------
return $Result;
}
示例6: Comp_Load
#-------------------------------------------------------------------------------
$Settings = $Config['Tasks']['Types']['ServersUpTime'];
#-------------------------------------------------------------------------------
$ExecuteTime = Comp_Load('Formats/Task/ExecuteTime', array('ExecutePeriod' => $Settings['ExecutePeriod']));
if (Is_Error($ExecuteTime)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (!$Settings['IsActive']) {
return 3600;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$CacheID = 'ServersUpTime';
#-------------------------------------------------------------------------------
$Cache = CacheManager::get($CacheID);
if (!$Cache) {
$Cache = array();
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Servers = DB_Select('Servers', array('ID', 'Address', 'Port', 'Monitoring', '(SELECT `Name` FROM `ServersGroups` WHERE `ServersGroups`.`ID` = `Servers`.`ServersGroupID`) AS `GroupName`'), array('SortOn' => array('ServersGroupID', 'Address')));
#-------------------------------------------------------------------------------
switch (ValueOf($Servers)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return $ExecuteTime;
case 'array':
break;
default:
示例7: array
/******************************************************************************/
/******************************************************************************/
$Result = array();
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Settings = $Config['Interface']['User']['Notes']['CheckEnterIP'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$Settings['IsActive']) {
return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Cached = CacheManager::get(Md5(SPrintF('LastLogon_%s', $GLOBALS['__USER']['Email'])));
if (!$Cached) {
return $Result;
}
#-------------------------------------------------------------------------------
if (!Is_Array($Cached)) {
return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Array = Explode(',', $Settings['ExcludeIPs']);
#-------------------------------------------------------------------------------
foreach ($Array as $IP) {
if (Trim($IP) == $Cached['EnterIP']) {
return $Result;
}
示例8: getAllBook
function getAllBook()
{
$key = 'book';
$collection = CacheManager::get($key, TRUE);
if ($collection) {
return $collection;
}
$collection = new Collection();
$this->connect();
$result = $this->conn->query("CALL sp_get_all_book()");
if ($result) {
//$row = $result->fetch_assoc();
while ($obj = $result->fetch_object()) {
$book = new Book();
$book->setBookId($obj->Book_id);
$book->setTitle($obj->Title);
$book->setPublisherId($obj->Publisher_id);
$book->setIsbn($obj->Isbn);
$book->setCategoryId($obj->Category_id);
$book->setPublisherName($obj->Publisher_name);
$book->setCategoryName($obj->Subject);
$collection->addItem($book, $obj->Book_id);
}
$result->close();
// for fetch_object()
}
//$result->free_result(); // for fetch_assoc()
$this->close();
CacheManager::set($key, $collection, TRUE);
return $collection;
}
示例9: array
#-------------------------------------------------------------------------------
$Where = array(SPrintF("`StatusID` != 'Closed' AND `UserID` = %u AND (SELECT `IsDepartment` FROM `Groups` WHERE `Groups`.`ID` = `Edesks`.`TargetGroupID`) = 'yes'", $__USER['ID']));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Count = DB_Count('Edesks', array('Where' => $Where));
if (Is_Error($Count)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Out = array('Messages' => $Count);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Where = array('UNIX_TIMESTAMP() - 10 <= `CreateDate`');
#-------------------------------------------------------------------------------
$LastID = CacheManager::get($LastIDCacheID);
#-------------------------------------------------------------------------------
if ($LastID) {
#-------------------------------------------------------------------------------
Debug(SPrintF('[comp/www/API/Events]: last selected ID, from cache = %u; user = %u', $LastID, $__USER['ID']));
#-------------------------------------------------------------------------------
$Where[] = SPrintF('`ID` > %u', $LastID);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
if (!$__USER['IsAdmin']) {
$Where[] = SPrintF('`UserID` = %u', $__USER['ID']);
}
#-------------------------------------------------------------------------------
$UserInfo = "(SELECT CONCAT(FROM_UNIXTIME(`CreateDate`,'%Y-%m-%d / %H:%i:%s / '),`Email`,' / ',`Name`) FROM `Users` WHERE `Users`.`ID` = `Events`.`UserID`)";
#-------------------------------------------------------------------------------
示例10: array
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'false':
break;
case 'true':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
$GLOBALS['__USER']['IsAdmin'] = $IsAdmin;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!isset($GLOBALS['__USER']['IsEmulate'])) {
#-------------------------------------------------------------------------------
$Cached = CacheManager::get(Md5(SPrintF('LastLogon_%s', $User['Email'])));
#-------------------------------------------------------------------------------
if (!$Cached) {
CacheManager::add(Md5(SPrintF('LastLogon_%s', $User['Email'])), array('EnterIP' => $User['EnterIP'], 'EnterDate' => $User['EnterDate']), 15 * 60);
}
#-------------------------------------------------------------------------------
#Debug(SPrintF('[comp/Users/Init]: User[EnterIP] = %s',$User['EnterIP']));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return $User;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
示例11: Md5
if (!$Settings['ShowCheckReferer']) {
return $Result;
}
#-------------------------------------------------------------------------------
# также, проверяем используется ли проверка отсутствия реферера.
# если нет - нет смысла чё-то выводить юзеру
if ($Config['Other']['Modules']['Security']['IsNoReferer']) {
return $Result;
}
#-------------------------------------------------------------------------------
$CacheID = Md5(SPrintF('no-referer-%s-%s', $GLOBALS['__USER']['ID'], $_SERVER['REMOTE_ADDR']));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!isset($_SERVER["HTTP_REFERER"])) {
#-------------------------------------------------------------------------------
$Count = IntVal(CacheManager::get($CacheID));
#-------------------------------------------------------------------------------
if ($Count > 2) {
#-------------------------------------------------------------------------------
$NoBody = new Tag('NOBODY');
#-------------------------------------------------------------------------------
$NoBody->AddHTML(TemplateReplace('Notes.User.CheckReferer'));
#-------------------------------------------------------------------------------
$Result[] = $NoBody;
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Count++;
#-------------------------------------------------------------------------------
CacheManager::add($CacheID, $Count, 600);
#-------------------------------------------------------------------------------
示例12: array
<?php
#-------------------------------------------------------------------------------
/** @author Sergey Sedov (for www.host-food.ru) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('Params');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$CacheID = SPrintF('GC[%s]', Md5('Services'));
$Services = CacheManager::get($CacheID);
if (!$Services || !Is_Array($Services)) {
$Services = DB_Select('Services', array('ID', 'Name', 'Code'), array('Where' => "`IsActive` = 'yes' AND `Code` NOT IN ('Default')"));
switch (ValueOf($Services)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return TRUE;
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-----------------------------------------------------------------------------
for ($i = 0; $i < Count($Services); $i++) {
$Query = DB_Query(SPrintF("SHOW TABLES LIKE '%s%%OrdersOwners'", $Services[$i]['Code']));
$Row = MySQL::Result($Query);
foreach (Array_Keys($Row[0]) as $Key) {
$Services[$i]['View'] = $Row[0][$Key];
示例13: WhoIs_Check
function WhoIs_Check($DomainName, $ZoneName, $IsAvalible = FALSE)
{
#-------------------------------------------------------------------------------
Debug(SPrintF('[system/libs/WhoIs]: run function WhoIs_Check, Domain = %s.%s', $DomainName, $ZoneName));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$CacheID = SPrintF('WhoIs-%s.%s', $DomainName, $ZoneName);
#-------------------------------------------------------------------------------
$Answer = CacheManager::get($CacheID);
#-------------------------------------------------------------------------------
if (!$Answer) {
#-------------------------------------------------------------------------------
# смотрим доменную зону, на предмет того использовать ли данные whois сервера, или юзать запросы к регистратору
$DomainZones = System_XML('config/DomainZones.xml');
if (Is_Error($DomainZones)) {
return ERROR | @Trigger_Error('[comp/www/API/WhoIs]: не удалось загрузить базу WhoIs серверов');
}
#-------------------------------------------------------------------------------
$IsSuppoted = FALSE;
#-------------------------------------------------------------------------------
foreach ($DomainZones as $Zone) {
#-------------------------------------------------------------------------------
if ($Zone['Name'] == $ZoneName) {
#-------------------------------------------------------------------------------
$IsSuppoted = TRUE;
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
if (!$IsSuppoted || $Zone['IsUseRegistratorWhoIs']) {
#-------------------------------------------------------------------------------
if (!$IsSuppoted) {
Debug(SPrintF('[comp/www/API/WhoIs]: доменная зона не поддерживается'));
}
#-------------------------------------------------------------------------------
if ($IsSuppoted && $Zone['IsUseRegistratorWhoIs']) {
Debug(SPrintF('[comp/www/API/WhoIs]: принудительное использование WhoIs регистратора'));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# чекаем доменную зону
$Regulars = Regulars();
#-------------------------------------------------------------------------------
if (!Preg_Match($Regulars['DomainZone'], $ZoneName)) {
return ERROR | @Trigger_Error(SPrintF('[comp/www/API/WhoIs]: неверная доменная зона (%s)', $ZoneName));
}
#-------------------------------------------------------------------------------
# достаём список серверов на которых есть такой тариф
$Servers = DB_Select('DomainSchemes', array('ServerID'), array('Where' => SPrintF('`Name` = "%s"', $ZoneName)));
#-------------------------------------------------------------------------------
switch (ValueOf($Servers)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return new gException('REGISTRATOR_SERVER_NOT_FOUND', 'Не найдены активные сервера регистраторов');
case 'array':
#-------------------------------------------------------------------------------
$Array = array();
#-------------------------------------------------------------------------------
foreach ($Servers as $Server) {
$Array[] = $Server['ServerID'];
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
# достаём список активных серверов регистраторов
$Servers = DB_Select('Servers', array('ID', 'Address', 'Params'), array('Where' => array(SPrintF('`ID` IN (%s)', Implode(',', $Array)), '`IsActive` = "yes"'), 'SortOn' => 'Address'));
#-------------------------------------------------------------------------------
switch (ValueOf($Servers)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return new gException('REGISTRATOR_SERVER_NOT_FOUND', 'Не найдены активные сервера регистраторов');
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
# перебираем регистраторов
$UseServer = FALSE;
#-------------------------------------------------------------------------------
foreach ($Servers as $iServer) {
#-------------------------------------------------------------------------------
# если это не проверка доступности и в настройках сервера не стоит галка про получение WhoIs - пропускаем
if (!$IsAvalible) {
if (!$iServer['Params']['IsFetchWhoIs']) {
continue;
}
}
#-------------------------------------------------------------------------------
# достаём использованные запросы к регистратору, на данную минуту
//.........這裏部分代碼省略.........
示例14: Time
#-------------------------------------------------------------------------------
CacheManager::add($Cache['Limit'], Time(), IntVal($Settings['ConfirmInterval']));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return array('Status' => 'Ok');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
if (empty($Confirm) && empty($Code)) {
return new gException('ERROR_CODE_EMPTY', 'Введите полученный код подтверждения, или пройдите по ссылке из сообщения');
}
#-------------------------------------------------------------------------------
$Confirm1 = CacheManager::get($Cache['Confirm1']);
#-------------------------------------------------------------------------------
$Confirm2 = CacheManager::get($Cache['Confirm2']);
#-------------------------------------------------------------------------------
Debug(SPrintF('[comp/www/API/Confirm]: Method = %s; Value = %s; Confirm1 = %s; Confirm2 = %s;', $Method, $Value, $Confirm1, $Confirm2));
if ($Confirm) {
if ($Confirm != $Confirm1) {
return new gException('BAD_CONFIRM_CODE', 'Введён неверный или просроченный код, попробуйте подтвердить ещё раз');
}
}
#-------------------------------------------------------------------------------
if ($Code) {
#-------------------------------------------------------------------------------
# если подтверждение через код в ссылке
$DOM = new DOM();
#-------------------------------------------------------------------------------
$Links =& Links();
# Коллекция ссылок
示例15: WebNames_Get_List_Domains
function WebNames_Get_List_Domains($Settings)
{
/******************************************************************************/
$__args_types = array('array', 'string');
#-------------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/******************************************************************************/
# ввиду того, что вебнеймс интерфейса нормального не предоставляет, а за частые
# запросы банит, кэшируем полученный результат и юазем кэш
$CacheID = Md5(SPrintF('%s-pispAllDomainsInfo', $Settings['Login']));
#-------------------------------------------------------------------------------
$Result = CacheManager::get($CacheID);
#-------------------------------------------------------------------------------
# если результата нет - лезем в вебнеймс
if (!$Result) {
#-------------------------------------------------------------------------------
$HTTP = WebNames_Build_HTTP($Settings);
#-------------------------------------------------------------------------------
$Query = array('thisPage' => 'pispAllDomainsInfo', 'username' => $Settings['Login'], 'password' => $Settings['Password'], 'interface_revision' => 2, 'interface_lang' => 'en');
#-------------------------------------------------------------------------------
$Result = HTTP_Send('/RegTimeSRS.pl', $HTTP, array(), $Query);
if (Is_Error($Result)) {
return ERROR | @Trigger_Error('[WebNames_Get_List_Domains]: не удалось выполнить запрос к серверу');
}
#-------------------------------------------------------------------------------
$Result = Json_Decode($Result['Body'], TRUE);
#-------------------------------------------------------------------------------
#Debug(SPrintF('[system/libs/WebNames.php]: $Result = %s',print_r($Result,true)));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (isset($Result['error'])) {
return new gException('REGISTRATOR_ERROR', 'Регистратор вернул ошибку');
}
#-------------------------------------------------------------------------------
if (!isset($Result['success'])) {
return ERROR | @Trigger_Error('[WebNames_Get_List_Domains]: неизвестный ответ');
}
#-------------------------------------------------------------------------------
# кэшируем полученный результат
CacheManager::add($CacheID, $Result, 3600);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# перебираем массив, составляем массив на выхлоп функции
$Out = array();
#-------------------------------------------------------------------------------
if (Is_Array($Result['success'])) {
#-------------------------------------------------------------------------------
foreach ($Result['success'] as $Domain) {
#-------------------------------------------------------------------------------
Debug(SPrintF('[system/libs/WebNames.php]: $Domain = %s', print_r($Domain, true)));
#-------------------------------------------------------------------------------
$Out[] = $Domain['dname'];
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (SizeOf($Out)) {
#-------------------------------------------------------------------------------
return array('Status' => 'true', 'Domains' => $Out);
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
return array('Status' => 'false', 'ErrorText' => 'No domains on account');
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}