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


PHP CEventLog::log方法代码示例

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


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

示例1: doLog

 /**
  * @param string $severity
  * @param string $auditType
  * @param string $itemName
  * @param string $itemDescription
  * @return bool
  */
 public function doLog($severity, $auditType, $itemName, $itemDescription)
 {
     $savedInDB = $savedInFile = $savedInSyslog = false;
     if ($this->isDBEngineActive) {
         $savedInDB = CEventLog::log($severity, $auditType, "security", $itemName, base64_encode($itemDescription));
     }
     $message = "";
     if ($this->isSyslogEngineActive) {
         $message = $this->messageFormatter->format($auditType, $itemName, $itemDescription);
         $savedInSyslog = syslog($this->syslogPriority, $message);
     }
     if ($this->isFileEngineActive) {
         if (!$message) {
             $message = $this->messageFormatter->format($auditType, $itemName, $itemDescription);
         }
         $message .= "\n";
         $savedInFile = file_put_contents($this->filePath, $message, FILE_APPEND) > 0;
     }
     return $savedInDB || $savedInSyslog || $savedInFile;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:27,代码来源:event.php

示例2: doLog

 /**
  * @param string $pSeverity
  * @param string $pAuditType
  * @param string $pItemName
  * @param string $pItemDescription
  * @return bool
  */
 public function doLog($pSeverity, $pAuditType, $pItemName, $pItemDescription)
 {
     $savedInDB = $savedInFile = $savedInSyslog = false;
     if ($this->isDBEngineActive) {
         $savedInDB = CEventLog::log($pSeverity, $pAuditType, "security", $pItemName, $pItemDescription);
     }
     if ($this->isSyslogEngineActive) {
         $message = self::formatMessage($pAuditType, $pItemName, $pItemDescription, $this->isUserInfoNeeded);
         $savedInSyslog = syslog($this->syslogPriority, $message);
     }
     if ($this->isFileEngineActive) {
         $message = self::formatMessage($pAuditType, $pItemName, $pItemDescription, $this->isUserInfoNeeded);
         $message .= "\n";
         $savedInFile = file_put_contents($this->filePath, $message, FILE_APPEND) > 0;
     }
     return $savedInDB || $savedInSyslog || $savedInFile;
 }
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:24,代码来源:event.php

示例3: setAuthentication

 public static function setAuthentication(CurrentUser $user, $isPersistent = false)
 {
     /** @var $context \Freetrix\Main\HttpContext */
     $context = \Freetrix\Main\Application::getInstance()->getContext();
     $context->setUser($user);
     static::copyToSession($user);
     /** @var $response \Freetrix\Main\HttpResponse */
     $response = $context->getResponse();
     if (!$user->isAuthenticated()) {
         $cookie = new \Freetrix\Main\Web\Cookie("UIDH", "", time() - 3600);
         $response->addCookie($cookie);
         return;
     }
     $connection = \Freetrix\Main\Application::getDbConnection();
     $sqlHelper = $connection->getSqlHelper();
     $connection->queryExecute("UPDATE b_user SET " . "   STORED_HASH = NULL, " . "   LAST_LOGIN = " . $sqlHelper->getCurrentDateTimeFunction() . ", " . "   TIMESTAMP_X = TIMESTAMP_X,  " . "   LOGIN_ATTEMPTS = 0, " . "   TIME_ZONE_OFFSET = " . \CTimeZone::getOffset() . " " . "WHERE ID = " . $user->getUserId() . " ");
     $cookie = new \Freetrix\Main\Web\Cookie("LOGIN", $user->getLogin(), time() + 60 * 60 * 24 * 30 * 60);
     $cookie->setSpread(\Freetrix\Main\Config\Option::get("main", "auth_multisite", "N") == "Y" ? \Freetrix\Main\Web\Cookie::SPREAD_SITES : \Freetrix\Main\Web\Cookie::SPREAD_DOMAIN);
     $response->addCookie($cookie);
     if ($isPersistent || \Freetrix\Main\Config\Option::get("main", "auth_multisite", "N") == "Y") {
         $hash = $user->getSessionHash();
         /** @var $request \Freetrix\Main\HttpRequest */
         $request = $context->getRequest();
         if ($isPersistent) {
             $cookie = new \Freetrix\Main\Web\Cookie("UIDH", $hash, time() + 60 * 60 * 24 * 30 * 60);
         } else {
             $cookie = new \Freetrix\Main\Web\Cookie("UIDH", $hash, 0);
         }
         $cookie->setSecure(\Freetrix\Main\Config\Option::get("main", "use_secure_password_cookies", "N") == "Y" && $request->isHttps());
         $response->addCookie($cookie);
         $storedId = static::getStoredHashId($user, $hash);
         if ($storedId) {
             $connection->queryExecute("UPDATE b_user_stored_auth SET " . "\tLAST_AUTH = " . $sqlHelper->getCurrentDateTimeFunction() . ", " . "\t" . ($user->getAuthType() === static::AUTHENTICATED_BY_HASH ? "" : "TEMP_HASH='" . ($isPersistent ? "N" : "Y") . "', ") . " " . "\tIP_ADDR = '" . sprintf("%u", ip2long($request->getRemoteAddress())) . "' " . "WHERE ID = " . intval($storedId));
         } else {
             $sqlTmp1 = "";
             $sqlTmp2 = "";
             if ($connection->getType() === "oracle") {
                 $storedId = $connection->getIdentity("sq_b_user_stored_auth");
                 $sqlTmp1 = "ID, ";
                 $sqlTmp2 = intval($storedId) . ", ";
             }
             $sql = "INSERT INTO b_user_stored_auth (" . $sqlTmp1 . "USER_ID, DATE_REG, LAST_AUTH, TEMP_HASH, " . "   IP_ADDR, STORED_HASH) " . "VALUES (" . $sqlTmp2 . intval($user->getUserId()) . ", " . $sqlHelper->getCurrentDateTimeFunction() . ", " . "   " . $sqlHelper->getCurrentDateTimeFunction() . ", '" . ($isPersistent ? "N" : "Y") . "', " . "   '" . $sqlHelper->forSql(sprintf("%u", ip2long($request->getRemoteAddress()))) . "', " . "   '" . $sqlHelper->forSql($hash) . "')";
             $connection->queryExecute($sql);
             if ($connection->getType() !== "oracle") {
                 $storedId = $connection->getIdentity();
             }
         }
         $user->setStoredAuthId($storedId);
     }
     $event = new Main\Event("main", "OnUserLogin", array("USER" => $user));
     $event->send();
     if (\Freetrix\Main\Config\Option::get("main", "event_log_login_success", "N") === "Y") {
         \CEventLog::log("SECURITY", "USER_AUTHORIZE", "main", $user->getUserId());
     }
 }
开发者ID:ASDAFF,项目名称:open_bx,代码行数:55,代码来源:authentication.php


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