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


PHP CBlogUser::GetUserIP方法代码示例

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


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

示例1: CallBack_AddComment

 public static function CallBack_AddComment($arFields)
 {
     if (!CModule::IncludeModule('blog')) {
         return false;
     }
     $arResult = array();
     $arLog = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID", "RATING_ENTITY_ID"))->Fetch();
     if ($arLog) {
         $arIdeaPost = CBlogPost::GetById($arLog["SOURCE_ID"]);
         if ($arIdeaPost) {
             $UserIP = CBlogUser::GetUserIP();
             $IdeaCommentId = CBlogComment::Add(array("BLOG_ID" => $arIdeaPost["BLOG_ID"], "POST_ID" => $arIdeaPost["ID"], "AUTHOR_ID" => $arFields["USER_ID"], "POST_TEXT" => $arFields["MESSAGE"], "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "PARENT_ID" => false, "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1]));
             $arResult = array("SOURCE_ID" => $IdeaCommentId);
             if ($arLog["RATING_ENTITY_ID"] > 0) {
                 $arResult["RATING_TYPE_ID"] = "BLOG_COMMENT";
                 $arResult["RATING_ENTITY_ID"] = $IdeaCommentId;
             }
             if (intval($IdeaCommentId) == 0) {
                 global $APPLICATION;
                 if ($ex = $APPLICATION->GetException()) {
                     $arResult["ERROR"] = $ex->GetString();
                 }
             } else {
                 //clear cache on succcess
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/first_page/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/pages/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/comment/" . $arIdeaPost["ID"] . "/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/post/" . $arIdeaPost["ID"] . "/");
             }
         }
     }
     return $arResult;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:33,代码来源:idea_sonet_notify.php

示例2: array

             $link = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_CONPANY_DEPARTMENT"], array("ID" => $vv["ENTITY_ID"]));
         }
         if (strlen($name) > 0) {
             if (strlen($link) > 0) {
                 if ($type == "U" && IntVal($id) > 0) {
                     $arNewRightsName[] = "[user=" . $id . "]" . htmlspecialcharsback($name) . "[/user]";
                 } else {
                     $arNewRightsName[] = "[url=" . $link . "]" . htmlspecialcharsback($name) . "[/url]";
                 }
             } else {
                 $arNewRightsName[] = htmlspecialcharsback($name);
             }
         }
     }
 }
 $UserIP = CBlogUser::GetUserIP();
 $arComFields = array("POST_ID" => $arParams["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "POST_TEXT" => (count($arNewRightsName) > 1 ? GetMessage("B_B_SHARE") : GetMessage("B_B_SHARE_1")) . implode(", ", $arNewRightsName), "DATE_CREATE" => ConvertTimeStamp(time() + $arResult["TZ_OFFSET"], "FULL"), "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1], "PARENT_ID" => false, "AUTHOR_ID" => $user_id, "SHARE_DEST" => implode(",", $arNewRights));
 if ($comId = CBlogComment::Add($arComFields)) {
     BXClearCache(true, "/blog/comment/" . intval($arParams["ID"] / 100) . "/" . $arParams["ID"] . "/");
     if (is_callable("CBlogComment::AddLiveComment")) {
         CBlogComment::addLiveComment($comId, "", array());
     }
     if ($arPost["AUTHOR_ID"] != $user_id) {
         $arFieldsIM = array("TYPE" => "SHARE", "TITLE" => htmlspecialcharsback($arPost["TITLE"]), "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $arParams["ID"], "user_id" => $arPost["AUTHOR_ID"])), "ID" => $arParams["ID"], "FROM_USER_ID" => $user_id, "TO_USER_ID" => array($arPost["AUTHOR_ID"]));
         CBlogPost::NotifyIm($arFieldsIM);
     }
     if (!empty($arUsers2Notify)) {
         $arFieldsIM = array("TYPE" => "SHARE2USERS", "TITLE" => htmlspecialcharsback($arPost["TITLE"]), "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $arParams["ID"], "user_id" => $arPost["AUTHOR_ID"])), "ID" => $arParams["ID"], "FROM_USER_ID" => $user_id, "TO_USER_ID" => $arUsers2Notify);
         CBlogPost::NotifyIm($arFieldsIM);
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例3: AddComment_Photo_Blog

 public static function AddComment_Photo_Blog($arFields, $BLOG_ID, $arLog)
 {
     if (!CModule::IncludeModule("blog")) {
         return false;
     }
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     $arElement = false;
     $arFilter = array("ID" => $arLog["SOURCE_ID"]);
     $arSelectedFields = array("IBLOCK_ID", "ID", "NAME", "TAGS", "CODE", "IBLOCK_SECTION_ID", "DETAIL_PAGE_URL", "CREATED_BY", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PROPERTY_BLOG_POST_ID", "PROPERTY_BLOG_COMMENT_CNT", "PROPERTY_REAL_PICTURE");
     $db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
     if ($db_res && ($res = $db_res->GetNext())) {
         $arElement = $res;
     }
     if ($arElement) {
         // check iblock properties
         $ELEMENT_BLOG_POST_ID = CSocNetLogTools::AddComment_Review_CheckIBlock_Blog($arElement);
         if ($ELEMENT_BLOG_POST_ID <= 0) {
             // Add Post
             $POST_ID = CSocNetLogTools::AddComment_Review_CreateRoot_Blog($arElement, $BLOG_ID);
             $bNewPost = true;
         } else {
             $POST_ID = $ELEMENT_BLOG_POST_ID;
         }
         if (intval($POST_ID) > 0) {
             // Add comment
             $commentID = false;
             $UserIP = CBlogUser::GetUserIP();
             $arFieldsComment = array("POST_ID" => $POST_ID, "BLOG_ID" => $BLOG_ID, "POST_TEXT" => trim($arFields["TEXT_MESSAGE"]), "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1], "PARENT_ID" => false);
             if ($GLOBALS["USER"]->IsAuthorized()) {
                 $arFieldsComment["AUTHOR_ID"] = $GLOBALS["USER"]->GetID();
             }
             $commentID = CBlogComment::Add($arFieldsComment);
             if (!$commentID) {
                 $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
             } else {
                 CSocNetLogTools::AddComment_Review_UpdateElement_Blog($arElement, $POST_ID, $BLOG_ID, $bNewPost);
             }
         } else {
             $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
         }
     } else {
         $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
     }
     return array("SOURCE_ID" => $commentID, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $commentID, "ERROR" => $strError, "NOTES" => "", "IM_MESSAGE" => $arFieldsComment ? $arFieldsComment["POST_TEXT"] : false);
 }
开发者ID:rasuldev,项目名称:torino,代码行数:47,代码来源:log_tools_photo.php

示例4: AddComment_Microblog

 function AddComment_Microblog($arFields)
 {
     if (!CModule::IncludeModule("blog")) {
         return false;
     }
     $dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID"));
     if ($arLog = $dbResult->Fetch()) {
         $arPost = CBlogPost::GetByID($arLog["SOURCE_ID"]);
         if ($arPost) {
             $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
             $userID = $GLOBALS["USER"]->GetID();
             $arLogSites = array();
             $rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
             while ($arLogSite = $rsLogSite->Fetch()) {
                 $arLogSites[] = $arLogSite["LID"];
             }
             $bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin($arLogSites);
             $strPermission = BLOG_PERMS_DENY;
             $strPostPermission = BLOG_PERMS_DENY;
             if ($arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
                 if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "full_post", $bCurrentUserIsAdmin)) {
                     $strPostPermission = BLOG_PERMS_FULL;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "premoderate_post")) {
                     $strPostPermission = BLOG_PERMS_PREMODERATE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "write_post")) {
                     $strPostPermission = BLOG_PERMS_WRITE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "moderate_post")) {
                     $strPostPermission = BLOG_PERMS_MODERATE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "view_post")) {
                     $strPostPermission = BLOG_PERMS_READ;
                 }
                 if ($strPostPermission > BLOG_PERMS_DENY) {
                     if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "full_comment", $bCurrentUserIsAdmin)) {
                         $strPermission = BLOG_PERMS_FULL;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "moderate_comment")) {
                         $strPermission = BLOG_PERMS_MODERATE;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "write_comment")) {
                         $strPermission = BLOG_PERMS_WRITE;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "premoderate_comment")) {
                         $strPermission = BLOG_PERMS_PREMODERATE;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "blog", "view_comment")) {
                         $strPermission = BLOG_PERMS_READ;
                     }
                 }
             } else {
                 if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "full_post", $bCurrentUserIsAdmin) || $GLOBALS["APPLICATION"]->GetGroupRight("blog") >= "W" || $arParams["USER_ID"] == $user_id) {
                     $strPostPermission = BLOG_PERMS_FULL;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "moderate_post")) {
                     $strPostPermission = BLOG_PERMS_MODERATE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "write_post")) {
                     $strPostPermission = BLOG_PERMS_WRITE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "premoderate_post")) {
                     $strPostPermission = BLOG_PERMS_PREMODERATE;
                 } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "view_post")) {
                     $strPostPermission = BLOG_PERMS_READ;
                 }
                 if ($strPostPermission > BLOG_PERMS_DENY) {
                     if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "full_comment", $bCurrentUserIsAdmin) || $GLOBALS["APPLICATION"]->GetGroupRight("blog") >= "W" || $arParams["USER_ID"] == $user_id) {
                         $strPermission = BLOG_PERMS_FULL;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "moderate_comment")) {
                         $strPermission = BLOG_PERMS_MODERATE;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "write_comment")) {
                         $strPermission = BLOG_PERMS_WRITE;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "premoderate_comment")) {
                         $strPermission = BLOG_PERMS_PREMODERATE;
                     } elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "blog", "view_comment")) {
                         $strPermission = BLOG_PERMS_READ;
                     }
                 }
             }
             $UserIP = CBlogUser::GetUserIP();
             $path_to_post = $arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arFields["PATH_TO_GROUP_MICROBLOG_POST"] : $arFields["PATH_TO_USER_MICROBLOG_POST"];
             $arFieldsComment = array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "POST_TEXT" => $arFields["TEXT_MESSAGE"], "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1], "AUTHOR_ID" => $userID, "PARENT_ID" => false);
             if ($strPermission == BLOG_PERMS_PREMODERATE) {
                 $arFieldsComment["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_READY;
                 $strNotes = GetMessage("SONET_GL_ADD_COMMENT_BLOG_PREMODERATE");
             }
             $commentUrl = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($path_to_post), array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arFields["BLOG_ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arFields["ENTITY_ID"] : false));
             $arFieldsComment["PATH"] = $commentUrl . (strpos($arFieldsComment["PATH"], "?") !== false ? "&" : "?") . "commentId=#comment_id###comment_id#";
             $commentId = CBlogComment::Add($arFieldsComment);
             if ($strPermission == BLOG_PERMS_PREMODERATE) {
                 unset($commentId);
             }
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/comment/" . $arPost["ID"] . "/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/post/" . $arPost["ID"] . "/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/first_page/");
             BXClearCache(True, "/" . SITE_ID . "/blog/last_comments/");
             BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/rss_out/" . $arPost["POST_ID"] . "/C/");
             BXClearCache(True, "/" . SITE_ID . "/blog/last_messages/");
             BXClearCache(True, "/" . SITE_ID . "/blog/commented_posts/");
             BXClearCache(True, "/" . SITE_ID . "/blog/popular_posts/");
         } else {
             $strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
         }
     }
     return array("SOURCE_ID" => $commentId, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $commentId, "ERROR" => $strError, "NOTES" => $strNotes);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:97,代码来源:log_tools.php


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