当前位置: 首页>>代码示例>>PHP>>正文


PHP CMain::GetServerUniqID方法代码示例

本文整理汇总了PHP中CMain::GetServerUniqID方法的典型用法代码示例。如果您正苦于以下问题:PHP CMain::GetServerUniqID方法的具体用法?PHP CMain::GetServerUniqID怎么用?PHP CMain::GetServerUniqID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMain的用法示例。


在下文中一共展示了CMain::GetServerUniqID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SaveConfig

    function SaveConfig($arServerList)
    {
        self::$arList = false;
        $isOnline = false;
        $content = '<' . '?
define("BX_MEMCACHE_CLUSTER", "' . EscapePHPString(CMain::GetServerUniqID()) . '");
$arList = array(
';
        $defGroup = 1;
        $arGroups = array();
        $rsGroups = CClusterGroup::GetList(array("ID" => "DESC"));
        while ($arGroup = $rsGroups->Fetch()) {
            $defGroup = $arGroups[$arGroup["ID"]] = intval($arGroup["ID"]);
        }
        foreach ($arServerList as $i => $arServer) {
            $isOnline |= $arServer["STATUS"] == "ONLINE";
            $GROUP_ID = intval($arServer["GROUP_ID"]);
            if (!array_key_exists($arServer["GROUP_ID"], $arGroups)) {
                $GROUP_ID = $defGroup;
            }
            $content .= "\t" . intval($i) . " => array(\n";
            $content .= "\t\t'ID' => \"" . EscapePHPString($arServer["ID"]) . "\",\n";
            $content .= "\t\t'GROUP_ID' => " . $GROUP_ID . ",\n";
            $content .= "\t\t'HOST' => \"" . EscapePHPString($arServer["HOST"]) . "\",\n";
            $content .= "\t\t'PORT' => " . intval($arServer["PORT"]) . ",\n";
            $content .= "\t\t'WEIGHT' => " . intval($arServer["WEIGHT"]) . ",\n";
            if ($arServer["STATUS"] == "ONLINE") {
                $content .= "\t\t'STATUS' => \"ONLINE\",\n";
            } elseif ($arServer["STATUS"] == "OFFLINE") {
                $content .= "\t\t'STATUS' => \"OFFLINE\",\n";
            } else {
                $content .= "\t\t'STATUS' => \"READY\",\n";
            }
            $content .= "\t),\n";
        }
        $content .= ');
?' . '>';
        file_put_contents($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/cluster/memcache.php", $content);
        bx_accelerator_reset();
        self::$systemConfigurationUpdate = null;
        $cache = \Bitrix\Main\Config\Configuration::getValue('cache');
        if ($isOnline) {
            if (!is_array($cache) || !isset($cache['type']) || !is_array($cache['type']) || !isset($cache['type']['class_name']) || !$cache['type']['class_name'] === 'CPHPCacheMemcacheCluster') {
                \Bitrix\Main\Config\Configuration::setValue('cache', array('type' => array('class_name' => 'CPHPCacheMemcacheCluster', 'extension' => 'memcache', 'required_file' => 'modules/cluster/classes/general/memcache_cache.php')));
                self::$systemConfigurationUpdate = true;
            }
        } else {
            if (is_array($cache) && isset($cache['type']) && is_array($cache['type']) && isset($cache['type']['class_name']) && $cache['type']['class_name'] === 'CPHPCacheMemcacheCluster') {
                \Bitrix\Main\Config\Configuration::setValue('cache', null);
                self::$systemConfigurationUpdate = false;
            }
        }
    }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:53,代码来源:memcache.php

示例2: onBeforeAdd

 public static function onBeforeAdd(Entity\Event $event)
 {
     $result = new Entity\EventResult();
     $data = $event->getParameter("fields");
     if (isset($data["USER_ID"]) && isset($data['PASSWORD'])) {
         $salt = md5(\CMain::GetServerUniqID() . uniqid());
         $password = $salt . md5($salt . $data['PASSWORD']);
         $modified = array('PASSWORD' => $password);
         $user = Main\UserTable::getRowById($data["USER_ID"]);
         if ($user !== null) {
             $realm = defined('BX_HTTP_AUTH_REALM') ? BX_HTTP_AUTH_REALM : "Bitrix Site Manager";
             $digest = md5($user["LOGIN"] . ':' . $realm . ':' . $data['PASSWORD']);
             $modified['DIGEST_PASSWORD'] = $digest;
         }
         $result->modifyFields($modified);
     }
     return $result;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:18,代码来源:applicationpassword.php

示例3: SaveConfig

	public static function SaveConfig($arServerList)
	{
		self::$arList = false;
		$content = '<'.'?
// define("BX_MEMCACHE_CLUSTER", "'.EscapePHPString(CMain::GetServerUniqID()).'");
$arList = array(
';
		$defGroup = 1;
		$arGroups = array();
		$rsGroups = CClusterGroup::GetList(array("ID" => "DESC"));
		while($arGroup = $rsGroups->Fetch())
			$defGroup = $arGroups[$arGroup["ID"]] = intval($arGroup["ID"]);

		foreach($arServerList as $i => $arServer)
		{
			$GROUP_ID = intval($arServer["GROUP_ID"]);
			if(!array_key_exists($arServer["GROUP_ID"], $arGroups))
				$GROUP_ID = $defGroup;

			$content .= "\t".intval($i)." => array(\n";
			$content .= "\t\t'ID' => \"".EscapePHPString($arServer["ID"])."\",\n";
			$content .= "\t\t'GROUP_ID' => ".$GROUP_ID.",\n";
			$content .= "\t\t'HOST' => \"".EscapePHPString($arServer["HOST"])."\",\n";
			$content .= "\t\t'PORT' => ".intval($arServer["PORT"]).",\n";
			$content .= "\t\t'WEIGHT' => ".intval($arServer["WEIGHT"]).",\n";
			if($arServer["STATUS"] == "ONLINE")
				$content .= "\t\t'STATUS' => \"ONLINE\",\n";
			elseif($arServer["STATUS"] == "OFFLINE")
				$content .= "\t\t'STATUS' => \"OFFLINE\",\n";
			else
				$content .= "\t\t'STATUS' => \"READY\",\n";
			$content .= "\t),\n";
		}

		$content .= ');
?'.'>';
		file_put_contents(
			$_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/cluster/memcache.php"
			,$content
		);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:41,代码来源:memcache.php

示例4: unlock

 /**
  * @return void
  *
  */
 public static function unlock()
 {
     global $DB;
     $DB->Query("SELECT RELEASE_LOCK('" . CMain::GetServerUniqID() . "_cdn') as L");
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:9,代码来源:option.php

示例5: str_replace

	if(count($arResult["ERRORS"]) > 0)
	{
		if(COption::GetOptionString("main", "event_log_register_fail", "N") === "Y")
		{
			$arError = $arResult["ERRORS"];
			foreach($arError as $key => $error)
				if(intval($key) == 0 && $key !== 0) 
					$arError[$key] = str_replace("#FIELD_NAME#", '"'.$key.'"', $error);
			CEventLog::Log("SECURITY", "USER_REGISTER_FAIL", "main", false, implode("<br>", $arError));
		}
	}
	else // if there;s no any errors - create user
	{
		$bConfirmReq = COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y";

		$arResult['VALUES']["CHECKWORD"] = md5(CMain::GetServerUniqID().uniqid());
		$arResult['VALUES']["~CHECKWORD_TIME"] = $DB->CurrentTimeFunction();
		$arResult['VALUES']["ACTIVE"] = $bConfirmReq? "N": "Y";
		$arResult['VALUES']["CONFIRM_CODE"] = $bConfirmReq? randString(8): "";
		$arResult['VALUES']["LID"] = SITE_ID;

		$arResult['VALUES']["USER_IP"] = $_SERVER["REMOTE_ADDR"];
		$arResult['VALUES']["USER_HOST"] = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
		
		if($arResult["VALUES"]["AUTO_TIME_ZONE"] <> "Y" && $arResult["VALUES"]["AUTO_TIME_ZONE"] <> "N")
			$arResult["VALUES"]["AUTO_TIME_ZONE"] = "";

		$def_group = COption::GetOptionString("main", "new_user_registration_def_group", "");
		if($def_group != "")
			$arResult['VALUES']["GROUP_ID"] = explode(",", $def_group);
开发者ID:ASDAFF,项目名称:open_bx,代码行数:30,代码来源:component.php

示例6: Update

 function Update($ID, $arFields)
 {
     global $DB, $USER_FIELD_MANAGER;
     $ID = intval($ID);
     if (!$this->CheckFields($arFields, $ID)) {
         $Result = false;
         $arFields["RESULT_MESSAGE"] =& $this->LAST_ERROR;
     } else {
         unset($arFields["ID"]);
         if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
             $arFields["ACTIVE"] = "N";
         }
         if (is_set($arFields, "PERSONAL_GENDER") && ($arFields["PERSONAL_GENDER"] != "M" && $arFields["PERSONAL_GENDER"] != "F")) {
             $arFields["PERSONAL_GENDER"] = "";
         }
         if (is_set($arFields, "PASSWORD")) {
             $original_pass = $arFields["PASSWORD"];
             $salt = randString(8, array("abcdefghijklnmopqrstuvwxyz", "ABCDEFGHIJKLNMOPQRSTUVWXYZ", "0123456789", ",.<>/?;:[]{}\\|~!@#\$%^&*()-_+="));
             $arFields["PASSWORD"] = $salt . md5($salt . $arFields["PASSWORD"]);
             $rUser = CUser::GetByID($ID);
             if ($arUser = $rUser->Fetch()) {
                 if ($arUser["PASSWORD"] != $arFields["PASSWORD"]) {
                     $DB->Query("DELETE FROM b_user_stored_auth WHERE USER_ID=" . $ID);
                 }
             }
             if (COption::GetOptionString("main", "event_log_password_change", "N") === "Y") {
                 CEventLog::Log("SECURITY", "USER_PASSWORD_CHANGED", "main", $ID);
             }
             //$arFields["STORED_HASH"] = CUser::GetPasswordHash($arFields["PASSWORD"]);
         }
         unset($arFields["STORED_HASH"]);
         $checkword = '';
         if (!is_set($arFields, "CHECKWORD")) {
             if (is_set($arFields, "PASSWORD") || is_set($arFields, "EMAIL") || is_set($arFields, "LOGIN") || is_set($arFields, "ACTIVE")) {
                 $salt = randString(8);
                 $checkword = md5(CMain::GetServerUniqID() . uniqid());
                 $arFields["CHECKWORD"] = $salt . md5($salt . $checkword);
             }
         } else {
             $salt = randString(8);
             $checkword = $arFields["CHECKWORD"];
             $arFields["CHECKWORD"] = $salt . md5($salt . $checkword);
         }
         if (is_set($arFields, "CHECKWORD") && !is_set($arFields, "CHECKWORD_TIME")) {
             $arFields["~CHECKWORD_TIME"] = $DB->CurrentTimeFunction();
         }
         if (is_set($arFields, "WORK_COUNTRY")) {
             $arFields["WORK_COUNTRY"] = IntVal($arFields["WORK_COUNTRY"]);
         }
         if (is_set($arFields, "PERSONAL_COUNTRY")) {
             $arFields["PERSONAL_COUNTRY"] = IntVal($arFields["PERSONAL_COUNTRY"]);
         }
         if (array_key_exists("PERSONAL_PHOTO", $arFields) && is_array($arFields["PERSONAL_PHOTO"]) && (!array_key_exists("MODULE_ID", $arFields["PERSONAL_PHOTO"]) || strlen($arFields["PERSONAL_PHOTO"]["MODULE_ID"]) <= 0)) {
             $arFields["PERSONAL_PHOTO"]["MODULE_ID"] = "main";
         }
         CFile::SaveForDB($arFields, "PERSONAL_PHOTO", "main");
         if (array_key_exists("WORK_LOGO", $arFields) && is_array($arFields["WORK_LOGO"]) && (!array_key_exists("MODULE_ID", $arFields["WORK_LOGO"]) || strlen($arFields["WORK_LOGO"]["MODULE_ID"]) <= 0)) {
             $arFields["WORK_LOGO"]["MODULE_ID"] = "main";
         }
         CFile::SaveForDB($arFields, "WORK_LOGO", "main");
         $strUpdate = $DB->PrepareUpdate("b_user", $arFields);
         if (!is_set($arFields, "TIMESTAMP_X")) {
             $strUpdate .= ($strUpdate != "" ? "," : "") . " TIMESTAMP_X = " . $DB->GetNowFunction();
         }
         $strSql = "UPDATE b_user SET " . $strUpdate . " WHERE ID=" . $ID;
         $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
         $USER_FIELD_MANAGER->Update("USER", $ID, $arFields);
         if (COption::GetOptionString("main", "event_log_user_edit", "N") === "Y") {
             $res_log["user"] = $arFields["NAME"] != "" || $arFields["LAST_NAME"] != "" ? trim($arFields["NAME"] . " " . $arFields["LAST_NAME"]) : $arFields["LOGIN"];
             CEventLog::Log("SECURITY", "USER_EDIT", "main", $ID, serialize($res_log));
         }
         if (is_set($arFields, "GROUP_ID")) {
             CUser::SetUserGroup($ID, $arFields["GROUP_ID"]);
         }
         //update digest hash for http digest authorization
         if (is_set($arFields, "PASSWORD") && COption::GetOptionString('main', 'use_digest_auth', 'N') == 'Y') {
             CUser::UpdateDigest($arUser["ID"], $original_pass);
         }
         $Result = true;
         $arFields["CHECKWORD"] = $checkword;
         //update session information and cache for current user
         global $USER;
         if (is_object($USER) && $USER->GetID() == $ID) {
             static $arSessFields = array('LOGIN' => 'LOGIN', 'EMAIL' => 'EMAIL', 'FIRST_NAME' => 'NAME', 'SECOND_NAME' => 'SECOND_NAME', 'LAST_NAME' => 'LAST_NAME', 'AUTO_TIME_ZONE' => 'AUTO_TIME_ZONE', 'TIME_ZONE' => 'TIME_ZONE');
             foreach ($arSessFields as $key => $val) {
                 if (isset($arFields[$val])) {
                     $USER->SetParam($key, $arFields[$val]);
                 }
             }
             $name = $USER->GetParam("FIRST_NAME");
             $last_name = $USER->GetParam("LAST_NAME");
             $USER->SetParam("NAME", $name . ($name == '' || $last_name == '' ? "" : " ") . $last_name);
             //cache for GetByID()
             self::$CURRENT_USER = false;
         }
     }
     $arFields["ID"] = $ID;
     $arFields["RESULT"] =& $Result;
     $events = GetModuleEvents("main", "OnAfterUserUpdate");
     while ($arEvent = $events->Fetch()) {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例7: array

 $arSelectParams = array("FIELDS" => array("PERSONAL_PHOTO"));
 if ($bExtranetInstalled) {
     $arSelectParams["SELECT"] = array("UF_DEPARTMENT");
 }
 $dbuser = CUser::GetList($by = array("last_name" => "asc", "name" => "asc"), $order = false, array("ID" => $USER->GetID()), $arSelectParams);
 $curUser = $dbuser->Fetch();
 $img_src = "";
 if (intval($curUser["PERSONAL_PHOTO"]) > 0) {
     $arImage = CFile::ResizeImageGet($curUser["PERSONAL_PHOTO"], array("width" => 64, "height" => 64), BX_RESIZE_IMAGE_EXACT, false);
     if ($arImage && strlen($arImage["src"]) > 0) {
         $img_src = $arImage["src"];
     }
 }
 $bExtranetUser = $bExtranetInstalled && intval($curUser["UF_DEPARTMENT"][0]) <= 0;
 if (!$bExtranetUser || CMobile::getApiVersion() >= 9 || intval($_GET["api_version"]) >= 9) {
     $data = array("status" => "success", "page_mark" => "<!--bitrix_mobile_app-->", "sessid_md5" => bitrix_sessid(), "target" => md5($USER->GetID() . CMain::GetServerUniqID()), "photoUrl" => $img_src, "useModernStyle" => true, "appmap" => array("main" => array("url" => $params["START_PAGE"] ? $params["START_PAGE"] : "", "bx24ModernStyle" => true), "menu" => array("url" => $params["MENU_PAGE"] ? $params["MENU_PAGE"] : "")));
     if (\Bitrix\MobileApp\Mobile::getInstance()->getApiVersion() >= 10 && strlen($params["CHAT_PAGE"]) > 0) {
         $data["appmap"]["right"] = array("url" => $params["CHAT_PAGE"]);
     }
     if ($bExtranetUser) {
         $rsSites = CSite::GetByID(CExtranet::GetExtranetSiteID());
         if (($arExtranetSite = $rsSites->Fetch()) && $arExtranetSite["ACTIVE"] != "N") {
             $data["whiteList"] = array($arExtranetSite["DIR"] . "mobile/");
             $data["appmap"] = array("main" => array("url" => $arExtranetSite["DIR"] . "mobile/index.php", "bx24ModernStyle" => true), "menu" => array("url" => $arExtranetSite["DIR"] . "mobile/left.php"), "right" => array("url" => $arExtranetSite["DIR"] . "mobile/im/right.php"));
             if (\Bitrix\MobileApp\Mobile::getInstance()->getApiVersion() >= 10) {
                 $data["appmap"]["right"] = array("url" => $arExtranetSite["DIR"] . "mobile/im/right.php");
             }
         }
     }
     if (toUpper(SITE_CHARSET) != "UTF-8") {
         $data = $APPLICATION->ConvertCharsetArray($data, SITE_CHARSET, "utf-8");
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:checkout.php

示例8: Add


//.........这里部分代码省略.........
  *   "GROUP_ID"          =&gt; array(10,11),
  *   "PASSWORD"          =&gt; "123456",
  *   "CONFIRM_PASSWORD"  =&gt; "123456",
  *   "PERSONAL_PHOTO"    =&gt; $arIMAGE
  * );
  * 
  * $ID = <b>$user-&gt;Add</b>($arFields);
  * if (intval($ID) &gt; 0)
  *     echo "Пользователь успешно добавлен.";
  * else
  *     echo $user-&gt;LAST_ERROR;
  * ?&gt;
  * </pre>
  *
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cuser/index.php#flds">Поля CUser</a> </li> <li>
  * <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cuser/update.php">CUser::Update</a> </li> <li> <a
  * href="http://dev.1c-bitrix.ru/api_help/main/reference/cuser/delete.php">CUser::Delete</a> </li> </ul></b<a
  * name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/main/reference/cuser/add.php
  * @author Bitrix
  */
 public function Add($arFields)
 {
     /** @global CUserTypeManager $USER_FIELD_MANAGER */
     global $DB, $USER_FIELD_MANAGER, $CACHE_MANAGER;
     $ID = 0;
     if (!$this->CheckFields($arFields)) {
         $Result = false;
         $arFields["RESULT_MESSAGE"] =& $this->LAST_ERROR;
     } else {
         unset($arFields["ID"]);
         if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
             $arFields["ACTIVE"] = "N";
         }
         if ($arFields["PERSONAL_GENDER"] == "NOT_REF" || $arFields["PERSONAL_GENDER"] != "M" && $arFields["PERSONAL_GENDER"] != "F") {
             $arFields["PERSONAL_GENDER"] = "";
         }
         $original_pass = $arFields["PASSWORD"];
         $salt = randString(8);
         $arFields["PASSWORD"] = $salt . md5($salt . $arFields["PASSWORD"]);
         unset($arFields["STORED_HASH"]);
         $salt = randString(8);
         $checkword = $arFields["CHECKWORD"] == '' ? md5(CMain::GetServerUniqID() . uniqid()) : $arFields["CHECKWORD"];
         $arFields["CHECKWORD"] = $salt . md5($salt . $checkword);
         $arFields["~CHECKWORD_TIME"] = $DB->CurrentTimeFunction();
         if (is_set($arFields, "EMAIL")) {
             $arFields["EMAIL"] = strtolower($arFields["EMAIL"]);
         }
         if (is_set($arFields, "WORK_COUNTRY")) {
             $arFields["WORK_COUNTRY"] = intval($arFields["WORK_COUNTRY"]);
         }
         if (is_set($arFields, "PERSONAL_COUNTRY")) {
             $arFields["PERSONAL_COUNTRY"] = intval($arFields["PERSONAL_COUNTRY"]);
         }
         if (array_key_exists("PERSONAL_PHOTO", $arFields) && is_array($arFields["PERSONAL_PHOTO"]) && (!array_key_exists("MODULE_ID", $arFields["PERSONAL_PHOTO"]) || strlen($arFields["PERSONAL_PHOTO"]["MODULE_ID"]) <= 0)) {
             $arFields["PERSONAL_PHOTO"]["MODULE_ID"] = "main";
         }
         CFile::SaveForDB($arFields, "PERSONAL_PHOTO", "main");
         if (array_key_exists("WORK_LOGO", $arFields) && is_array($arFields["WORK_LOGO"]) && (!array_key_exists("MODULE_ID", $arFields["WORK_LOGO"]) || strlen($arFields["WORK_LOGO"]["MODULE_ID"]) <= 0)) {
             $arFields["WORK_LOGO"]["MODULE_ID"] = "main";
         }
         CFile::SaveForDB($arFields, "WORK_LOGO", "main");
         $arInsert = $DB->PrepareInsert("b_user", $arFields);
         if (!is_set($arFields, "DATE_REGISTER")) {
             $arInsert[0] .= ", DATE_REGISTER";
             $arInsert[1] .= ", " . $DB->GetNowFunction();
         }
         $strSql = "\n\t\t\t\tINSERT INTO b_user (\n\t\t\t\t\t" . $arInsert[0] . "\n\t\t\t\t) VALUES (\n\t\t\t\t\t" . $arInsert[1] . "\n\t\t\t\t)\n\t\t\t";
         $DB->Query($strSql);
         $ID = $DB->LastID();
         $USER_FIELD_MANAGER->Update("USER", $ID, $arFields);
         if (is_set($arFields, "GROUP_ID")) {
             CUser::SetUserGroup($ID, $arFields["GROUP_ID"]);
         }
         //update digest hash for http digest authorization
         if (COption::GetOptionString('main', 'use_digest_auth', 'N') == 'Y') {
             CUser::UpdateDigest($ID, $original_pass);
         }
         $Result = $ID;
         $arFields["ID"] =& $ID;
         $arFields["CHECKWORD"] = $checkword;
     }
     $arFields["RESULT"] =& $Result;
     foreach (GetModuleEvents("main", "OnAfterUserAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     if ($ID > 0 && defined("BX_COMP_MANAGED_CACHE")) {
         $CACHE_MANAGER->ClearByTag("USER_CARD_" . intval($ID / TAGGED_user_card_size));
         $CACHE_MANAGER->ClearByTag("USER_CARD");
         $CACHE_MANAGER->ClearByTag("USER_NAME_" . $ID);
         $CACHE_MANAGER->ClearByTag("USER_NAME");
     }
     return $Result;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:user.php

示例9: getBatchWithModifier

 protected function getBatchWithModifier($appMessages = array(), $modifier = "")
 {
     global $APPLICATION;
     $batch = "";
     if (!is_array($appMessages) || count($appMessages) <= 0) {
         return $batch;
     }
     foreach ($appMessages as $appID => $arMessages) {
         $appModifier = ";tkey=" . $appID . ";";
         foreach ($arMessages as $token => $messages) {
             if (!count($messages)) {
                 continue;
             }
             $mess = 0;
             $messCount = count($messages);
             while ($mess < $messCount) {
                 /**
                  * @var CPushMessage $message;
                  */
                 if (!$this->allowEmptyMessage && strlen(trim($messages[$mess]["MESSAGE"])) <= 0) {
                     $mess++;
                     continue;
                 }
                 $message = static::getMessageInstance($token);
                 $id = rand(1, 10000);
                 $message->setCustomIdentifier($id);
                 if ("UTF-8" != toupper(SITE_CHARSET)) {
                     $text = $APPLICATION->ConvertCharset($messages[$mess]["MESSAGE"], SITE_CHARSET, "utf-8");
                 } else {
                     $text = $messages[$mess]["MESSAGE"];
                 }
                 $message->setText($text);
                 $message->setTitle($messages[$mess]["TITLE"]);
                 if (strlen($text) > 0) {
                     if (strlen($messages[$mess]["SOUND"]) > 0) {
                         $message->setSound($messages[$mess]["SOUND"]);
                     }
                 } else {
                     $message->setSound('');
                 }
                 if ($messages[$mess]["PARAMS"]) {
                     $params = $messages[$mess]["PARAMS"];
                     if (is_array($messages[$mess]["PARAMS"])) {
                         $params = json_encode($messages[$mess]["PARAMS"]);
                     }
                     $message->setCustomProperty('params', $params);
                 }
                 if ($messages[$mess]["ACTION"]) {
                     $message->setCustomProperty('action', $messages[$mess]["ACTION"]);
                 }
                 if ($messages[$mess]["JSEVENT"]) {
                     $message->setCustomProperty('jsevent', $messages[$mess]["JSEVENT"]);
                 }
                 if ($messages[$mess]["CATEGORY"]) {
                     $message->setCategory($messages[$mess]["CATEGORY"]);
                 }
                 $message->setCustomProperty('target', md5($messages[$mess]["USER_ID"] . CMain::GetServerUniqID()));
                 if (array_key_exists("EXPIRY", $messages[$mess])) {
                     $expiry = $messages[$mess]["EXPIRY"];
                     if ($expiry === 0 || $expiry === "0") {
                         $message->setExpiry(0);
                     } else {
                         $message->setExpiry(intval($expiry) > 0 ? intval($expiry) : self::DEFAULT_EXPIRY);
                     }
                 }
                 $badge = intval($messages[$mess]["BADGE"]);
                 if (array_key_exists("BADGE", $messages[$mess]) && $badge >= 0) {
                     $message->setBadge($badge);
                 }
                 if (strlen($batch) > 0) {
                     $batch .= ";";
                 }
                 $batch .= $message->getBatch();
                 $mess++;
             }
         }
         $batch = $appModifier . $batch;
     }
     if (strlen($batch) == 0) {
         return $batch;
     }
     return $modifier . $batch;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:83,代码来源:push_service.php

示例10: PrologActions

 public static function PrologActions()
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $USER;
     if (COption::GetOptionString("main", "buffer_content", "Y") == "Y" && (!defined("BX_BUFFER_USED") || BX_BUFFER_USED !== true)) {
         ob_start(array(&$APPLICATION, "EndBufferContent"));
         $APPLICATION->buffered = true;
         // define("BX_BUFFER_USED", true);
         register_shutdown_function(function () {
             // define("BX_BUFFER_SHUTDOWN", true);
             for ($i = 0, $n = ob_get_level(); $i < $n; $i++) {
                 ob_end_flush();
             }
         });
     }
     //session expander
     if (COption::GetOptionString("main", "session_expand", "Y") != "N" && (!defined("BX_SKIP_SESSION_EXPAND") || BX_SKIP_SESSION_EXPAND === false)) {
         //only for authorized
         if (COption::GetOptionString("main", "session_auth_only", "Y") != "Y" || $USER->IsAuthorized()) {
             $arPolicy = $USER->GetSecurityPolicy();
             $phpSessTimeout = ini_get("session.gc_maxlifetime");
             if ($arPolicy["SESSION_TIMEOUT"] > 0) {
                 $sessTimeout = min($arPolicy["SESSION_TIMEOUT"] * 60, $phpSessTimeout);
             } else {
                 $sessTimeout = $phpSessTimeout;
             }
             $cookie_prefix = COption::GetOptionString('main', 'cookie_name', 'BITRIX_SM');
             $salt = $_COOKIE[$cookie_prefix . '_UIDH'] . "|" . $USER->GetID() . "|" . $_SERVER["REMOTE_ADDR"] . "|" . @filemtime($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/version.php") . "|" . LICENSE_KEY . "|" . CMain::GetServerUniqID();
             $key = md5(bitrix_sessid() . $salt);
             $bShowMess = $USER->IsAuthorized() && COption::GetOptionString("main", "session_show_message", "Y") != "N";
             CUtil::InitJSCore(array('ajax', 'ls'));
             $jsMsg = '<script type="text/javascript">' . "\n" . ($bShowMess ? 'bxSession.mess.messSessExpired = \'' . CUtil::JSEscape(GetMessage("MAIN_SESS_MESS", array("#TIMEOUT#" => round($sessTimeout / 60)))) . '\';' . "\n" : '') . 'bxSession.Expand(' . $sessTimeout . ', \'' . bitrix_sessid() . '\', ' . ($bShowMess ? 'true' : 'false') . ', \'' . $key . '\');' . "\n" . '</script>';
             $APPLICATION->AddHeadScript('/bitrix/js/main/session.js');
             $APPLICATION->AddAdditionalJS($jsMsg);
             $_SESSION["BX_SESSION_COUNTER"] = intval($_SESSION["BX_SESSION_COUNTER"]) + 1;
             if (!defined("BX_SKIP_SESSION_TERMINATE_TIME")) {
                 $_SESSION["BX_SESSION_TERMINATE_TIME"] = time() + $sessTimeout;
             }
         }
     }
     //user auto time zone via js cookies
     if (CTimeZone::Enabled() && (!defined("BX_SKIP_TIMEZONE_COOKIE") || BX_SKIP_TIMEZONE_COOKIE === false)) {
         CTimeZone::SetAutoCookie();
     }
     // check user options set via cookie
     if ($USER->IsAuthorized()) {
         $cookieName = COption::GetOptionString("main", "cookie_name", "BITRIX_SM") . "_LAST_SETTINGS";
         if (!empty($_COOKIE[$cookieName])) {
             CUserOptions::SetCookieOptions($cookieName);
         }
     }
     foreach (GetModuleEvents("main", "OnProlog", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent);
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:55,代码来源:main.php

示例11: bitrix_sess_sign

function bitrix_sess_sign()
{
    return md5("nobody" . CMain::GetServerUniqID() . "nowhere");
}
开发者ID:gitkv,项目名称:bash,代码行数:4,代码来源:tools.php

示例12: __construct

	/**
	 * @param $script - url for detail
	 */
	function __construct($params = array(), $doCheckPost = true)
	{
		global $APPLICATION;
		$this->errorCode = array(
			"BXU344" => GetMessage("UP_CID_IS_REQUIRED"),
			"BXU344.1" => GetMessage("UP_PACKAGE_INDEX_IS_REQUIRED"),
			"BXU345" => GetMessage("UP_BAD_SESSID"),
			"BXU346" => GetMessage("UP_NOT_ENOUGH_PERMISSION"),
			"BXU347" => GetMessage("UP_FILE_IS_LOST"),
			"BXU348" => GetMessage("UP_FILE_IS_NOT_UPLOADED"));
		$params = (is_array($params) ? $params : array());
		$this->script = (array_key_exists("urlToUpload", $params) ? $params["urlToUpload"] : $APPLICATION->GetCurPageParam());
		if (array_key_exists("copies", $params) && is_array($params["copies"]))
		{
			$copies = array();
			foreach($params["copies"] as $key => $val)
			{
				if (is_array($val) && (array_key_exists("width", $val) || array_key_exists("height", $val)))
					$copies[$key] = array("width" => $val["width"], "height" => $val["height"]);
			}
			if (!empty($copies))
				$this->params["copies"] = $copies;
		}
		if (array_key_exists("uploadFileWidth", $params))
			$this->params["uploadFileWidth"] = $params["uploadFileWidth"];
		if (array_key_exists("uploadFileHeight", $params))
			$this->params["uploadFileHeight"] = $params["uploadFileHeight"];
		if (array_key_exists("uploadMaxFilesize", $params))
			$this->params["uploadMaxFilesize"] = $params["uploadMaxFilesize"];

		if (array_key_exists("events", $params) && is_array($params["events"]))
		{
			foreach($params["events"] as $key => $val)
			{
				AddEventHandler(self::EVENT_NAME, $key, $val);
			}
		}
		if (array_key_exists("allowUpload", $params))
		{
			// ALLOW_UPLOAD = 'A'll files | 'I'mages | 'F'iles with selected extensions
			// ALLOW_UPLOAD_EXT = comma-separated list of allowed file extensions (ALLOW_UPLOAD='F')
			$this->params["allowUpload"] = (in_array($params["allowUpload"], array("A", "I", "F")) ? $params["allowUpload"] : "A");
			if ($params["allowUpload"] == "F" && empty($params["allowUploadExt"]))
				$this->params["allowUpload"] = "A";
			$this->params["allowUploadExt"] = $params["allowUploadExt"];
		}
		if (array_key_exists("controlId", $params))
			$this->controlId = $params["controlId"];
		$this->params["controlId"] = $this->controlId;
		$this->path = CTempFile::GetDirectoryName(
			12,
			array(
				"bxu",
				md5(serialize(array(
					$this->controlId,
					bitrix_sessid(),
					CMain::GetServerUniqID()
					))
				)
			)
		);
		if ($doCheckPost !== false && !$this->checkPost(($doCheckPost === true || $doCheckPost == "post")))
		{
			$this->showError();
		}
		return $this;
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:70,代码来源:uploader.php

示例13: getUserPrefix

 public static function getUserPrefix($userId)
 {
     $userId = intval($userId);
     return "/" . $userId . "/" . md5(\CMain::GetServerUniqID() . $userId);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:5,代码来源:cacheprovider.php

示例14: bitrix_sessid_set

function bitrix_sessid_set($val=false)
{
	if($val === false)
		$val = md5(CMain::GetServerUniqID().session_id());
	$_SESSION["fixed_session_id"] = $val;
}
开发者ID:nProfessor,项目名称:Mytb,代码行数:6,代码来源:tools.php

示例15: array

<?php

if (!Defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$data = array("status" => "failed");
if ($USER->IsAuthorized()) {
    $data = array("status" => "success", "target" => md5($USER->GetID() . CMain::GetServerUniqID()), "sessid_md5" => bitrix_sessid(), "appmap" => array("main" => array("url" => $arParams["START_PAGE"]), "menu" => array("url" => $arParams["MENU_PAGE"])));
}
开发者ID:webgksupport,项目名称:alpina,代码行数:9,代码来源:checkout.php


注:本文中的CMain::GetServerUniqID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。