本文整理汇总了PHP中Array_Key_Exists函数的典型用法代码示例。如果您正苦于以下问题:PHP Array_Key_Exists函数的具体用法?PHP Array_Key_Exists怎么用?PHP Array_Key_Exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Array_Key_Exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __IRM_InitReservation
function __IRM_InitReservation($iblockId)
{
$arResult = array();
$arResult["ALLOWED_FIELDS"] = array("ID" => array("NAME" => GetMessage("INAF_F_ID"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "int", "IS_FIELD" => true), "NAME" => array("NAME" => GetMessage("INAF_F_NAME"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "string", "IS_FIELD" => true), "DESCRIPTION" => array("NAME" => GetMessage("INAF_F_DESCRIPTION"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "text", "IS_FIELD" => true), "UF_FLOOR" => array("NAME" => GetMessage("INAF_F_FLOOR"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PLACE" => array("NAME" => GetMessage("INAF_F_PLACE"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PHONE" => array("NAME" => GetMessage("INAF_F_PHONE"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "string", "IS_FIELD" => false));
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $iblockId . "_SECTION", 0, LANGUAGE_ID);
$arKeys = Array_Keys($arResult["ALLOWED_FIELDS"]);
foreach ($arKeys as $key) {
if (!$arResult["ALLOWED_FIELDS"][$key]["IS_FIELD"]) {
if (!Array_Key_Exists($key, $arUserFields)) {
$arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => $key, "USER_TYPE_ID" => $arResult["ALLOWED_FIELDS"][$key]["TYPE"]);
$obUserField = new CUserTypeEntity();
$obUserField->Add($arFields);
}
}
}
$arResult["ALLOWED_ITEM_PROPERTIES"] = array("UF_PERSONS" => array("NAME" => GetMessage("INTASK_C29_UF_PERSONS"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "UF_PERSONS", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "UF_RES_TYPE" => array("NAME" => GetMessage("INTASK_C29_UF_RES_TYPE"), "ACTIVE" => "Y", "SORT" => 200, "CODE" => "UF_RES_TYPE", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEA"), "DEF" => "Y", "SORT" => 100, "XML_ID" => "A"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEB"), "DEF" => "N", "SORT" => 200, "XML_ID" => "B"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEC"), "DEF" => "N", "SORT" => 200, "XML_ID" => "C"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPED"), "DEF" => "N", "SORT" => 300, "XML_ID" => "D"))), "UF_PREPARE_ROOM" => array("NAME" => GetMessage("INTASK_C29_UF_PREPARE_ROOM"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "UF_PREPARE_ROOM", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_TYPE" => array("NAME" => GetMessage("INTASK_C29_PERIOD_TYPE"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_TYPE", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "NONE", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_COUNT" => array("NAME" => GetMessage("INTASK_C29_PERIOD_COUNT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_COUNT", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "EVENT_LENGTH" => array("NAME" => GetMessage("INTASK_C29_EVENT_LENGTH"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "EVENT_LENGTH", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_ADDITIONAL" => array("NAME" => GetMessage("INTASK_C29_PERIOD_ADDITIONAL"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_ADDITIONAL", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
$dbIBlockProps = CIBlock::GetProperties($iblockId);
while ($arIBlockProps = $dbIBlockProps->Fetch()) {
if (Array_Key_Exists($arIBlockProps["CODE"], $arResult["ALLOWED_ITEM_PROPERTIES"])) {
$arResult["ALLOWED_ITEM_PROPERTIES"][$arIBlockProps["CODE"]]["ID"] = $arIBlockProps["ID"];
}
}
$keys = Array_Keys($arResult["ALLOWED_ITEM_PROPERTIES"]);
foreach ($keys as $key) {
if (IntVal($arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"]) <= 0) {
$ibp = new CIBlockProperty();
$arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"] = $ibp->Add($arResult["ALLOWED_ITEM_PROPERTIES"][$key]);
}
}
return $arResult;
}
示例2: GetStatus
private function GetStatus($Challenge)
{
$Data = $this->WriteData(self::STATISTIC, $Challenge . Pack('c*', 0x0, 0x0, 0x0, 0x0));
if (!$Data) {
throw new MinecraftQueryException('Failed to receive status.');
}
$Last = '';
$Info = array();
$Data = SubStr($Data, 11);
// splitnum + 2 int
$Data = Explode("player_", $Data);
if (Count($Data) !== 2) {
throw new MinecraftQueryException('Failed to parse server\'s response.');
}
$Players = SubStr($Data[1], 0, -2);
$Data = Explode("", $Data[0]);
// Array with known keys in order to validate the result
// It can happen that server sends custom strings containing bad things (who can know!)
$Keys = array('hostname' => 'HostName', 'gametype' => 'GameType', 'version' => 'Version', 'plugins' => 'Plugins', 'map' => 'Map', 'numplayers' => 'Players', 'maxplayers' => 'MaxPlayers', 'hostport' => 'HostPort', 'hostip' => 'HostIp', 'game_id' => 'GameName');
foreach ($Data as $Key => $Value) {
if (~$Key & 1) {
if (!Array_Key_Exists($Value, $Keys)) {
$Last = false;
continue;
}
$Last = $Keys[$Value];
$Info[$Last] = '';
} else {
if ($Last != false) {
$Info[$Last] = mb_convert_encoding($Value, 'UTF-8');
}
}
}
// Ints
$Info['Players'] = IntVal($Info['Players']);
$Info['MaxPlayers'] = IntVal($Info['MaxPlayers']);
$Info['HostPort'] = IntVal($Info['HostPort']);
// Parse "plugins", if any
if ($Info['Plugins']) {
$Data = Explode(": ", $Info['Plugins'], 2);
$Info['RawPlugins'] = $Info['Plugins'];
$Info['Software'] = $Data[0];
if (Count($Data) == 2) {
$Info['Plugins'] = Explode("; ", $Data[1]);
}
} else {
$Info['Software'] = 'Vanilla';
}
$this->Info = $Info;
if (empty($Players)) {
$this->Players = null;
} else {
$this->Players = Explode("", $Players);
}
}
示例3: strlen
$cnt = strlen($arParams['INPUT_NAME_FINISH']) > 0 ? 2 : 1;
for ($i = 0; $i < $cnt; $i++):
if ($arParams['SHOW_INPUT'] == 'Y'):
?><input type="text" id="<?php
echo $arParams['INPUT_NAME' . ($i == 1 ? '_FINISH' : '')];
?>
" name="<?php
echo $arParams['INPUT_NAME' . ($i == 1 ? '_FINISH' : '')];
?>
" value="<?php
echo $arParams['INPUT_VALUE' . ($i == 1 ? '_FINISH' : '')];
?>
" <?php
echo Array_Key_Exists("~INPUT_ADDITIONAL_ATTR", $arParams) ? $arParams["~INPUT_ADDITIONAL_ATTR"] : "";
?>
/><?
endif;
?><img src="/freetrix/js/main/core/images/calendar-icon.gif" alt="<?php
echo GetMessage('calend_title');
?>
" class="calendar-icon" onclick="BX.calendar({node:this, field:'<?php
echo htmlspecialcharsbx(CUtil::JSEscape($arParams['INPUT_NAME' . ($i == 1 ? '_FINISH' : '')]));
?>
', form: '<?if ($arParams['FORM_NAME'] != ''){echo htmlspecialcharsbx(CUtil::JSEscape($arParams['FORM_NAME']));}?>', bTime: <?php
echo $arParams['SHOW_TIME'] == 'Y' ? 'true' : 'false';
?>
, currentTime: '<?php
echo time() + date("Z") + CTimeZone::GetOffset();
?>
示例4: CIBlockSection
WizardServices::CreateSectionProperty($iblockID, "UF__CAL_COL", $arFieldColorName);
WizardServices::CreateSectionProperty($iblockID, "UF__CAL_EXP", $arFieldExportName);
$ibSection = new CIBlockSection();
$arColor = array("#DDBFEB", "#CEE669", "#98AEF6");
$dbSection = CIBlockSection::GetList(array(), array("ACTIVE" => "Y", "IBLOCK_ID" => $iblockID));
$i = 0;
while ($arSection = $dbSection->Fetch()) {
$color = isset($arColor[$i]) ? $arColor[$i] : $arColor[0];
$ibSection->Update($arSection["ID"], array("ACTIVE" => "Y", "UF__CAL_COL" => $color, "UF__CAL_EXP" => "all"));
$i++;
}
$arAF = array("UF_FLOOR" => array("NAME" => GetMessage("INAF_F_FLOOR"), "TYPE" => "integer"), "UF_PLACE" => array("NAME" => GetMessage("INAF_F_PLACE"), "TYPE" => "integer"), "UF_PHONE" => array("NAME" => GetMessage("INAF_F_PHONE"), "TYPE" => "string"));
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $iblockID . "_SECTION", 0, LANGUAGE_ID);
$arKeys = Array_Keys($arAF);
foreach ($arKeys as $key) {
if (!Array_Key_Exists($key, $arUserFields)) {
$arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockID . "_SECTION", "FIELD_NAME" => $key, "USER_TYPE_ID" => $arAF[$key]["TYPE"]);
$obUserField = new CUserTypeEntity();
$obUserField->Add($arFields);
}
}
$iblockSectionObject = new CIBlockSection();
$dbrs = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $iblockID));
$ars = $dbrs->Fetch();
$iblockSectionObject->Update($ars["ID"], array("UF_FLOOR" => 1, "UF_PLACE" => 350, "UF_PHONE" => "12-34-56"));
$ars = $dbrs->Fetch();
$iblockSectionObject->Update($ars["ID"], array("UF_FLOOR" => 3, "UF_PLACE" => 10, "UF_PHONE" => "34-56-78"));
$ars = $dbrs->Fetch();
$iblockSectionObject->Update($ars["ID"], array("UF_FLOOR" => 2, "UF_PLACE" => 50, "UF_PHONE" => "56-78-90"));
$iblockElementObject = new CIBlockElement();
$dbrs = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockID));
示例5: Str_Replace
$j1 = 0;
$j2 = 48;
}
$arResult["LIMITS"]["FROM"] = 0;
$arResult["LIMITS"]["TO"] = 48;
for ($j = $j1; $j < $j2; $j++) {
if ($arResult["ITEMS_MATRIX"][$i][$j]) {
$cId = $arResult["ITEMS"][$arResult["ITEMS_MATRIX"][$i][$j]];
if (!In_Array($arElement["ID"] . "-" . $counter . "-" . $cId["ID"], $arConflict)) {
$arResult["ErrorMessage"] .= Str_Replace(array("#TIME#", "#RES1#", "#RES2#"), array(Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), MkTime(0, 0, 0, $weekMonth, $weekDay + $i - 1, $weekYear)) . " " . __RM_MkT($j), $cId["NAME"], $arElement["NAME"]), GetMessage("INTASK_C25_CONFLICT2") . ". ");
$arConflict[] = $arElement["ID"] . "-" . $counter . "-" . $cId["ID"];
}
} else {
$arResult["ITEMS_MATRIX"][$i][$j] = $arElement["ID"] . "-" . $counter;
}
}
}
}
}
}
// End Period
$ar = array();
foreach ($arParams["WEEK_HOLIDAYS"] as $v) {
if (!Array_Key_Exists($v + 1, $arResult["ITEMS_MATRIX"])) {
$ar[] = $v;
}
}
$arParams["WEEK_HOLIDAYS"] = $ar;
}
//echo "<pre>".print_r($arResult, true)."</pre>";
$this->IncludeComponentTemplate();
示例6: GetMessage
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (count($arResult["Tasks"]) <= 0) {
echo GetMessage("INTASK_LIST_EMPTY");
}
$bFirst = true;
if (Array_Key_Exists("Tasks", $arResult) && Is_Array($arResult["Tasks"])) {
foreach ($arResult["Tasks"] as $arTask) {
if (!$bFirst) {
?>
<div class="sonet-forum-line"></div><?php
}
?>
<span class="sonet-forum-post-date"><?php
if (StrLen($arTask["FIELDS"]["DATE_ACTIVE_FROM_PRINTABLE"]) > 0 && StrLen($arTask["FIELDS"]["DATE_ACTIVE_TO_PRINTABLE"]) > 0) {
echo $arTask["FIELDS"]["DATE_ACTIVE_FROM_PRINTABLE"] . " - " . $arTask["FIELDS"]["DATE_ACTIVE_TO_PRINTABLE"];
} elseif (StrLen($arTask["FIELDS"]["DATE_ACTIVE_FROM_PRINTABLE"]) <= 0 && StrLen($arTask["FIELDS"]["DATE_ACTIVE_TO_PRINTABLE"]) > 0) {
echo Str_Replace("#DATE#", $arTask["FIELDS"]["DATE_ACTIVE_TO_PRINTABLE"], GetMessage("INTASK_TO_DATE_TLP"));
} elseif (StrLen($arTask["FIELDS"]["DATE_ACTIVE_FROM_PRINTABLE"]) > 0 && StrLen($arTask["FIELDS"]["DATE_ACTIVE_TO_PRINTABLE"]) <= 0) {
echo Str_Replace("#DATE#", $arTask["FIELDS"]["DATE_ACTIVE_FROM_PRINTABLE"], GetMessage("INTASK_FROM_DATE_TLP"));
} else {
echo GetMessage("INTASK_NO_DATE_TLP");
}
?>
</span><br />
<b><a href="<?php
echo $arTask["VIEW_URL"];
?>
示例7: __InTaskCompare
function __InTaskCompare($arTask1, $arTask2, $arOrder)
{
foreach ($arOrder as $ord) {
if (Array_Key_Exists($ord["ORDER"], $arTask1["FIELDS"])) {
$v1 = $arTask1["FIELDS"][$ord["ORDER"]];
$v2 = $arTask2["FIELDS"][$ord["ORDER"]];
if ($ord["TYPE"] == "datetime") {
$v1 = CDatabase::FormatDate($v1, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS");
$v2 = CDatabase::FormatDate($v2, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS");
}
if ($ord["NULLS"]) {
if (StrLen($v1) <= 0 && StrLen($v2) > 0) {
return $ord["DIRECTION"] == "ASC" ? true : false;
} elseif (StrLen($v1) > 0 && StrLen($v2) <= 0) {
return $ord["DIRECTION"] == "ASC" ? false : true;
}
}
if ($v1 > $v2) {
return $ord["DIRECTION"] == "ASC" ? true : false;
} elseif ($v1 < $v2) {
return $ord["DIRECTION"] == "ASC" ? false : true;
}
} else {
foreach ($arTask1["PROPS"] as $key => $value) {
if (StrToUpper($key) == $ord["ORDER"]) {
$v1 = $value["VALUE"];
$v2 = $arTask2["PROPS"][$key]["VALUE"];
if ($ord["TYPE"] == "datetime") {
$v1 = CDatabase::FormatDate($v1, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS");
$v2 = CDatabase::FormatDate($v2, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS");
}
if ($ord["NULLS"]) {
if (StrLen($v1) <= 0 && StrLen($v2) > 0) {
return $ord["DIRECTION"] == "ASC" ? true : false;
} elseif (StrLen($v1) > 0 && StrLen($v2) <= 0) {
return $ord["DIRECTION"] == "ASC" ? false : true;
}
}
if ($v1 > $v2) {
return $ord["DIRECTION"] == "ASC" ? true : false;
} elseif ($v1 < $v2) {
return $ord["DIRECTION"] == "ASC" ? false : true;
}
break;
}
}
}
}
return true;
}
示例8: array
}
}
if (Count($arOrderBy) <= 0) {
$arOrderBy["NAME"] = "ASC";
$arOrderBy["ID"] = "DESC";
}
$arFilter = array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y");
if (Is_Array($arParams["FILTER"])) {
foreach ($arParams["FILTER"] as $key => $value) {
$op = "";
$opTmp = SubStr($key, 0, 1);
if (In_Array($opTmp, array("!", "<", ">"))) {
$op = $opTmp;
$key = SubStr($key, 1);
}
if (Array_Key_Exists($key, $arResult["ALLOWED_FIELDS"]) && $arResult["ALLOWED_FIELDS"][$key]["FILTERABLE"]) {
$arFilter[$op . $key] = $value;
}
}
}
}
if (StrLen($arResult["FatalError"]) <= 0) {
$arNavStartParams = array("nPageSize" => $arParams["ITEMS_COUNT"], "bShowAll" => false, "bDescPageNumbering" => false);
$arNavigation = CDBResult::GetNavParams($arNavStartParams);
$arSelectFields = array("IBLOCK_ID");
foreach ($arResult["ALLOWED_FIELDS"] as $key => $value) {
$arSelectFields[] = $key;
}
$arResult["MEETINGS_LIST"] = array();
$dbMeetingsList = CIBlockSection::GetList($arOrderBy, $arFilter, false, $arSelectFields);
while ($arMeeting = $dbMeetingsList->GetNext()) {
示例9: CreateHandle
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;
}
示例10: IspManager4_Get_CPU_Usage
//.........这里部分代码省略.........
$Resellers = array();
#-----------------------------------------------------------------------------
if (Is_Array($Elems)) {
foreach ($Elems as $Elem) {
if (!In_Array($Elem['owner'], $Resellers)) {
$Resellers[] = $Elem['owner'];
}
}
}
#-----------------------------------------------------------------------------
#Debug(SPrintF('[system/libs/IspManager4.php]: Resellers = %s',print_r($Resellers,true)));
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
$Owners = array();
#-----------------------------------------------------------------------------
if (Is_Array($Elems)) {
foreach ($Elems as $Elem) {
if (In_Array($Elem['owner'], $Resellers)) {
$Owners[$Elem['name']] = $Elem['owner'];
}
}
}
#-----------------------------------------------------------------------------
#Debug(SPrintF('[system/libs/IspManager4.php]: Owners = %s',print_r($Owners,true)));
#-------------------------------------------------------------------------------
# /manager/ispmgr?func=totalresourceusage&tfilter=2013-03-01%20-%202013-03-07&out=xml
$Request = array('authinfo' => $authinfo, 'func' => 'totalresourceusage', 'out' => 'xml', 'tfilter' => $TFilter);
#-------------------------------------------------------------------------------
$Response = HTTP_Send('/manager/ispmgr', $HTTP, array(), $Request);
if (Is_Error($Response)) {
return ERROR | @Trigger_Error('[IspManager4_Get_CPU_Usage]: не удалось соедениться с сервером');
}
#-------------------------------------------------------------------------------
$Response = Trim($Response['Body']);
#-------------------------------------------------------------------------------
$XML = String_XML_Parse($Response);
if (Is_Exception($XML)) {
return new gException('WRONG_SERVER_ANSWER', $Response, $XML);
}
#-------------------------------------------------------------------------------
$XML = $XML->ToArray('elem');
#-----------------------------------------------------------------------------
$Elems = $XML['doc'];
#-------------------------------------------------------------------------------
if (isset($Elems['error'])) {
return new gException('GET_TOTALRESOURCEUSAGE_ERROR', $Elems['error']);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# создаём выходной массив
$Out = array();
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!Is_Array($Elems)) {
return $Out;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# массив с полями
$Fields = array('memory', 'utime', 'stime', 'etime', 'io');
#-------------------------------------------------------------------------------
foreach ($Resellers as $Reseller) {
#-------------------------------------------------------------------------------
$Out[$Reseller] = array();
#-------------------------------------------------------------------------------
foreach ($Fields as $Key) {
$Out[$Reseller][$Key] = 0;
}
#-------------------------------------------------------------------------------
}
#Debug(SPrintF('[system/libs/IspManager4.php]: Elem = %s',print_r($Out,true)));
#-------------------------------------------------------------------------------
# перебираем все данные по нагрузке
foreach ($Elems as $Elem) {
#-------------------------------------------------------------------------------
if (Array_Key_Exists($Elem['account'], $Out)) {
#-------------------------------------------------------------------------------
foreach ($Fields as $Key) {
$Out[$Elem['account']][$Key] = $Out[$Elem['account']][$Key] + $Elem[$Key];
}
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
foreach ($Fields as $Key) {
$Out[$Elem['account']][$Key] = $Elem[$Key];
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
if (isset($Owners[$Elem['account']])) {
foreach ($Fields as $Key) {
$Out[$Owners[$Elem['account']]][$Key] = $Out[$Owners[$Elem['account']]][$Key] + $Elem[$Key];
}
}
#------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
return $Out;
#-------------------------------------------------------------------------------
}
示例11: GetMessage
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (count($arResult["TASKS"]) <= 0) {
echo GetMessage("INTASK_LIST_EMPTY");
}
$bFirst = true;
if (Array_Key_Exists("TASKS", $arResult) && Is_Array($arResult["TASKS"])) {
foreach ($arResult["TASKS"] as $arTask) {
if (!$bFirst) {
?>
<div class="sonet-forum-line"></div><?php
}
if ($arTask["DEADLINE"]) {
?>
<span class="sonet-forum-post-date"><?php
echo GetMessage("TASKS_DEADLINE") . ": " . tasksFormatDate($arTask["DEADLINE"]);
if (date("H:i", strtotime($arTask["DEADLINE"])) != "00:00") {
echo ' ' . FormatDateFromDB($arTask["DEADLINE"], CSite::getTimeFormat());
}
?>
</span><br /><?php
}
?>
<b><a href="<?php
echo CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TASK"], array("task_id" => $arTask["ID"], "action" => "view"));
?>
"><?php
echo $arTask["TITLE"];
示例12: foreach
foreach ($arIteratorKeys as $key) {
while ($arIterator[$key] < $fltDateTimeTo) {
$resTimeFromTmp = MkTime($arFltTimeTo[0], $arFltTimeTo[1], 0, Date("m", $arIterator[$key]), Date("d", $arIterator[$key]), Date("Y", $arIterator[$key]));
if ($resTimeFromTmp > $fltDateTimeTo) {
$resTimeFromTmp = $fltDateTimeTo;
}
if ($arIterator[$key] < $resTimeFromTmp && ($resTimeFromTmp - $arIterator[$key]) / 3600.0 >= $fltDurationDbl) {
$arResult["MEETINGS_LIST"][$key]["TIME_ITEMS"][] = array("FROM" => $arIterator[$key], "TO" => $resTimeFromTmp);
}
$arIterator[$key] = MkTime($arFltTimeFrom[0], $arFltTimeFrom[1], 0, Date("m", $arIterator[$key]), Date("d", $arIterator[$key]) + 1, Date("Y", $arIterator[$key]));
}
}
}
$arResult["ITEMS"] = array();
foreach ($arResult["MEETINGS_LIST"] as $key => $value) {
if (!Array_Key_Exists("TIME_ITEMS", $value)) {
$iterator = $fltDateTimeFrom;
while ($iterator < $fltDateTimeTo) {
$resTimeFromTmp = MkTime($arFltTimeTo[0], $arFltTimeTo[1], 0, Date("m", $iterator), Date("d", $iterator), Date("Y", $iterator));
if ($resTimeFromTmp > $fltDateTimeTo) {
$resTimeFromTmp = $fltDateTimeTo;
}
if ($iterator < $resTimeFromTmp && ($resTimeFromTmp - $iterator) / 3600.0 >= $fltDurationDbl) {
$uri = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_RESERVE_MEETING"], array("meeting_id" => $key, "item_id" => 0));
$uri .= HtmlSpecialCharsbx((StrPos($uri, "?") === false ? "?" : "&") . "start_date=" . Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), $iterator) . "&start_time=" . Date("H:i", $iterator) . "&timeout_time=" . $fltDuration);
$arResult["ITEMS"][] = array("MEETING_ID" => $key, "FREE_DATE" => Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), $iterator), "FREE_FROM" => Date("H:i", $iterator), "FREE_TO" => Date("H:i", $resTimeFromTmp), "FREE_FROM_TIME" => $iterator, "FREE_TO_TIME" => $resTimeFromTmp, "URI" => $uri);
}
$iterator = MkTime($arFltTimeFrom[0], $arFltTimeFrom[1], 0, Date("m", $iterator), Date("d", $iterator) + 1, Date("Y", $iterator));
}
} elseif (Count($value["TIME_ITEMS"]) > 0) {
foreach ($value["TIME_ITEMS"] as $key1 => $value1) {
示例13: CheckSession
private function CheckSession($Data)
{
$Data = JSON_Decode($Data, true);
if (JSON_Last_Error() !== JSON_ERROR_NONE || !Array_Key_Exists('Status', $Data)) {
return false;
}
return $Data['Status'] === 'OK';
}
示例14: array
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('Rows');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Table = new Tag('TABLE', array('class' => 'Standard'));
#-------------------------------------------------------------------------------
for ($i = 1; $i < Count($__args__); $i++) {
#-----------------------------------------------------------------------------
$__arg__ = $__args__[$i];
#-----------------------------------------------------------------------------
if (Is_Array($__arg__)) {
if (Array_Key_Exists('cellspacing', $__arg__)) {
$CellSpacing = 1;
}
#-----------------------------------------------------------------------------
$Table->AddAttribs($__arg__);
} else {
$Table->AddChild(new Tag('CAPTION', $__arg__));
}
}
#-------------------------------------------------------------------------------
if (!isset($CellSpacing)) {
$Table->AddAttribs(array('cellspacing' => 5));
}
#-------------------------------------------------------------------------------
$Max = 1;
#-------------------------------------------------------------------------------
示例15: IntVal
if ($val["IBLOCK_ID"] != $iblockId || $val["TASK_TYPE"] != $taskType || $val["OWNER_ID"] != $ownerId) {
continue;
}
$id = IntVal(SubStr($arUserOptionTmp["NAME"], $userSettingsNamePartLength));
$arResult["Views"][] = array("ID" => $id, "TITLE" => HtmlSpecialCharsbx($val["TITLE"]));
}
if (Count($arResult["Views"]) <= 0) {
__InTaskInstallViews($iblockId, $taskType, $ownerId);
}
$userSettingsId = IntVal($arParams["USER_SETTINGS_ID"]);
if (StrLen($arParams["USER_SETTINGS_ID"]) <= 0) {
$userSettingsId = IntVal($_REQUEST["user_settings_id"]);
if (StrLen($_REQUEST["user_settings_id"]) <= 0 && Array_Key_Exists("INTASK_TASKVIEW_current_view", $_SESSION) && Is_Array($_SESSION["INTASK_TASKVIEW_current_view"]) && Array_Key_Exists($taskType . "-" . $ownerId, $_SESSION["INTASK_TASKVIEW_current_view"])) {
$userSettingsId = IntVal($_SESSION["INTASK_TASKVIEW_current_view"][$taskType . "-" . $ownerId]);
}
if (!Array_Key_Exists("INTASK_TASKVIEW_current_view", $_SESSION) || !Is_Array($_SESSION["INTASK_TASKVIEW_current_view"])) {
$_SESSION["INTASK_TASKVIEW_current_view"] = array();
}
$_SESSION["INTASK_TASKVIEW_current_view"][$taskType . "-" . $ownerId] = $userSettingsId;
}
$arResult["CurrentView"] = $userSettingsId;
$strBackUrl = "back_url=" . UrlEncode($GLOBALS["APPLICATION"]->GetCurPageParam("", array()));
$arResult["Urls"]["CreateView"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_VIEW"], array("owner_id" => $ownerId, "view_id" => 0, "action" => "create"));
$arResult["Urls"]["CreateView"] .= StrPos($arResult["Urls"]["CreateView"], "?") === false ? "?" : "&";
$arResult["Urls"]["CreateView"] .= $strBackUrl;
$arResult["Urls"]["EditView"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_VIEW"], array("owner_id" => $ownerId, "view_id" => $userSettingsId, "action" => "edit"));
$arResult["Urls"]["EditView"] .= StrPos($arResult["Urls"]["EditView"], "?") === false ? "?" : "&";
$arResult["Urls"]["EditView"] .= $strBackUrl;
if ($arResult["Perms"]["create_tasks"]) {
$arResult["Urls"]["CreateTask"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TASK"], array("owner_id" => $ownerId, "task_id" => 0, "action" => "create"));
if (StrLen($strBackUrl) > 0) {