예제 #1
0
 /**
  * @return bool
  */
 public function executeComponent()
 {
     if (!CModule::IncludeModule('pull')) {
         return false;
     }
     global $USER;
     // set pull watch tag for current user
     CPullWatch::Add($USER->GetId(), 'PULL_TEST');
     $this->arResult['ajaxLink'] = $this->getPath() . '/ajax.php';
     $this->includeComponentTemplate();
     return true;
 }
예제 #2
0
    protected function joinToPull()
    {
        $text = "";
        if ($this->getUser()->isAuthorized() && CModule::IncludeModule("pull") && \CPullOptions::GetNginxStatus()) {
            if ($this->isWeb()) {
                if ($this->arParams["RIGHTS"]["MODERATE"] == "Y" || $this->arParams["RIGHTS"]["MODERATE"] == "ALL") {
                    \CPullWatch::Add($this->getUser()->getId(), 'UNICOMMENTSEXTENDED' . $this->arParams["ENTITY_XML_ID"]);
                    $text = <<<HTML
\t\t\t\t\t\t<script>
\t\t\t\t\t\t\tBX.ready(function(){BX.PULL.extendWatch("UNICOMMENTSEXTENDED{$this->arParams["ENTITY_XML_ID"]}");});
\t\t\t\t\t\t</script>
HTML;
                } else {
                    \CPullWatch::Add($this->getUser()->GetId(), 'UNICOMMENTS' . $this->arParams["ENTITY_XML_ID"]);
                    $text = <<<HTML
\t\t\t\t\t\t<script>
\t\t\t\t\t\t\tBX.ready(function(){BX.PULL.extendWatch("UNICOMMENTS{$this->arParams["ENTITY_XML_ID"]}");});
\t\t\t\t\t\t</script>
HTML;
                }
            } else {
                if ($this->arParams["RIGHTS"]["MODERATE"] == "Y" || $this->arParams["RIGHTS"]["MODERATE"] == "ALL") {
                    \CPullWatch::Add($this->getUser()->GetId(), 'UNICOMMENTSMOBILEEXTENDED' . $this->arParams["ENTITY_XML_ID"]);
                    $text .= <<<HTML
\t\t\t\t\t\t<script>
\t\t\t\t\t\t\tapp.onCustomEvent('onPullExtendWatch', {'id': "UNICOMMENTSMOBILEEXTENDED{$this->arParams["ENTITY_XML_ID"]}"});
\t\t\t\t\t\t</script>
HTML;
                } else {
                    \CPullWatch::Add($this->getUser()->GetId(), 'UNICOMMENTSMOBILE' . $this->arParams["ENTITY_XML_ID"]);
                    $text = <<<HTML
\t\t\t\t\t\t<script>
\t\t\t\t\t\t\tapp.onCustomEvent('onPullExtendWatch', {'id': "UNICOMMENTSMOBILE{$this->arParams["ENTITY_XML_ID"]}"});
\t\t\t\t\t\t</script>
HTML;
                }
                \CPullWatch::DeferredSql();
            }
        }
        return preg_replace("/\\s+/", "", $text);
    }
예제 #3
0
 public function DeleteUser($chatId, $userId, $checkPermission = true)
 {
     global $DB;
     $chatId = intval($chatId);
     $userId = intval($userId);
     if ($chatId <= 0 || $userId <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_EMPTY_USER_OR_CHAT"), "EMPTY_USER_OR_CHAT");
         return false;
     }
     $strSql = "\n\t\t\tSELECT R.CHAT_ID, C.TITLE CHAT_TITLE, C.AUTHOR_ID CHAT_AUTHOR_ID, C.EXTRANET CHAT_EXTRANET, C.TYPE CHAT_TYPE\n\t\t\tFROM b_im_relation R LEFT JOIN b_im_chat C ON R.CHAT_ID = C.ID\n\t\t\tWHERE R.USER_ID = " . $userId . " AND R.MESSAGE_TYPE IN ('" . IM_MESSAGE_OPEN . "','" . IM_MESSAGE_CHAT . "') AND R.CHAT_ID = " . $chatId;
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($arRes = $dbRes->Fetch()) {
         $extranetFlag = $arRes["CHAT_EXTRANET"] == "" ? "" : ($arRes["CHAT_EXTRANET"] == "Y" ? true : false);
         $chatTitle = $arRes['CHAT_TITLE'];
         $chatType = $arRes['CHAT_TYPE'];
         $chatAuthorId = intval($arRes['CHAT_AUTHOR_ID']);
         if ($chatAuthorId == $userId) {
             $strSql = "\n\t\t\t\t\tSELECT R.USER_ID\n\t\t\t\t\tFROM b_im_relation R\n\t\t\t\t\tWHERE R.CHAT_ID = " . $chatId . " AND R.USER_ID <> " . $chatAuthorId;
             $strSql = $DB->TopSql($strSql, 1);
             $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             if ($arRes = $dbRes->Fetch()) {
                 $strSql = "UPDATE b_im_chat SET AUTHOR_ID = " . $arRes['USER_ID'] . " WHERE ID = " . $chatId;
                 $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             }
         }
         $bSelf = true;
         $arUsers = array($userId);
         if (is_object($GLOBALS["USER"]) && $GLOBALS["USER"]->GetId() != $userId) {
             if ($checkPermission && $chatAuthorId != $GLOBALS["USER"]->GetId()) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_KICK"), "IM_ERROR_KICK");
                 return false;
             }
             $bSelf = false;
             $arUsers[] = $GLOBALS["USER"]->GetId();
         }
         $arOldRelation = CIMChat::GetRelationById($chatId);
         $arUsers = CIMContactList::GetUserData(array('ID' => array_keys($arOldRelation), 'DEPARTMENT' => 'N', 'USE_CACHE' => 'N'));
         $arUsers = $arUsers['users'];
         if ($bSelf) {
             $message = GetMessage("IM_CHAT_LEAVE_" . $arUsers[$userId]['gender'], array('#USER_NAME#' => htmlspecialcharsback($arUsers[$userId]['name'])));
         } else {
             $message = GetMessage("IM_CHAT_KICK_" . $arUsers[$GLOBALS["USER"]->GetId()]['gender'], array('#USER_1_NAME#' => htmlspecialcharsback($arUsers[$GLOBALS["USER"]->GetId()]['name']), '#USER_2_NAME#' => htmlspecialcharsback($arUsers[$userId]['name'])));
         }
         $CIMChat = new CIMChat($userId);
         $CIMChat->SetReadMessage($chatId);
         CIMContactList::CleanChatCache($userId);
         $publicPullWatch = false;
         if ($chatType == IM_MESSAGE_OPEN && CModule::IncludeModule("pull")) {
             $publicPullWatch = true;
         }
         $relationList = IM\RelationTable::getList(array("select" => array("ID", "USER_ID"), "filter" => array("=CHAT_ID" => $chatId, "=USER_ID" => $userId)));
         while ($relation = $relationList->fetch()) {
             if ($publicPullWatch && !$arUsers[$relation["USER_ID"]]['extranet']) {
                 CPullWatch::Add($relation["USER_ID"], 'IM_PUBLIC_' . $chatId, true);
             }
             Im\RelationTable::delete($relation["ID"]);
             CIMContactList::DeleteRecent($chatId, true, $relation["USER_ID"]);
             if ($extranetFlag !== false) {
                 $isExtranet = false;
                 foreach ($arUsers as $userData) {
                     if ($userData['id'] == $userId) {
                         continue;
                     }
                     if ($userData['extranet']) {
                         $isExtranet = true;
                         break;
                     }
                 }
                 if (!$isExtranet || $extranetFlag === "") {
                     IM\ChatTable::update($chatId, array('EXTRANET' => $isExtranet ? "Y" : "N"));
                 }
                 $extranetFlag = $isExtranet;
             }
         }
         CIMDisk::ChangeFolderMembers($chatId, $userId, false);
         self::AddMessage(array("TO_CHAT_ID" => $chatId, "MESSAGE" => $message, "FROM_USER_ID" => $this->user_id, "SYSTEM" => 'Y'));
         foreach ($arOldRelation as $rel) {
             CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'chatUserLeave', 'params' => array('chatId' => $chatId, 'chatTitle' => $chatTitle, 'userId' => $userId, 'message' => $bSelf ? '' : htmlspecialcharsbx($message))));
         }
         return true;
     }
     $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_USER_NOT_FOUND"), "USER_NOT_FOUND");
     return false;
 }
예제 #4
0
 public static function InitEventHandlers()
 {
     if (!CModule::IncludeModule("pull")) {
         return false;
     }
     static $inited = false;
     if ($inited) {
         return true;
     }
     CPullWatch::Add($GLOBALS['USER']->GetID(), 'saleOrder');
     $inited = true;
     return true;
 }
예제 #5
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if ($GLOBALS["USER"]->IsAuthorized() && CModule::IncludeModule("pull")) {
    CPullWatch::Add($GLOBALS["USER"]->GetID(), 'VOTE_' . $arResult["VOTE_ID"]);
    ?>
<script>BX.ready(function(){BX.PULL.extendWatch('VOTE_<?php 
    echo $arResult["VOTE_ID"];
    ?>
');});</script><?php 
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && array_key_exists("VOTING.RESULT", $arResult) && array_key_exists("arResult", $arResult["VOTING.RESULT"]) && ($questions = $arResult["VOTING.RESULT"]["arResult"]["QUESTIONS"]) && !empty($questions) && array_key_exists("PUBLIC_VOTE_ID", $_REQUEST) && $_REQUEST["PUBLIC_VOTE_ID"] == $arResult["VOTE_ID"] && array_key_exists("vote", $_REQUEST) && strlen($_REQUEST["vote"]) > 0 && ($GLOBALS["VOTING_ID"] == $arResult["VOTE_ID"] && is_array($_SESSION["VOTE_ARRAY"]) && in_array($arResult["VOTE_ID"], $_SESSION["VOTE_ARRAY"])) && CModule::IncludeModule("pull")) {
    $result = array();
    foreach ($questions as $question) {
        $result[$question["ID"]] = array();
        foreach ($question["ANSWERS"] as $arAnswer) {
            $result[$question["ID"]][$arAnswer["ID"]] = array('PERCENT' => $arAnswer["PERCENT"], 'USERS' => $arAnswer["USERS"], 'COUNTER' => $arAnswer["COUNTER"]);
        }
    }
    if (!empty($result)) {
        CPullWatch::AddToStack('VOTE_' . $arResult["VOTE_ID"], array('module_id' => 'vote', 'command' => 'voting', 'params' => array("VOTE_ID" => $arResult["VOTE_ID"], "AUTHOR_ID" => $GLOBALS["USER"]->GetId(), "QUESTIONS" => $result)));
    }
}
CJSCore::Init(array('ajax', 'popup'));
$GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/rating.vote/templates/like/popup.css');
$uid = $this->params["uid"];
$controller = $this->params["controller"];
$lastVote = intval($this->params["lastVote"]);
?>
예제 #6
0
                }
                if (strlen($jsIds) > 0) {
                    ?>
<script>BitrixMobile.LazyLoad.registerImages([<?php 
                    echo $jsIds;
                    ?>
]);</script><?php 
                }
            }
            ?>
<span id="post-comment-last-after"></span><?php 
            if ($_REQUEST["empty_get_comments"] == "Y") {
                ?>
<script>BitrixMobile.LazyLoad.showImages();</script><?php 
                if ($GLOBALS["USER"]->IsAuthorized() && CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus()) {
                    CPullWatch::Add($GLOBALS["USER"]->GetID(), "UNICOMMENTS" . $arEvent["COMMENTS_PARAMS"]["ENTITY_XML_ID"]);
                    CPullWatch::DeferredSql();
                    // epilog needed ?
                }
                $strCommentsText = ob_get_contents();
                ob_end_clean();
                echo CUtil::PhpToJSObject(array("TEXT" => $strCommentsText, "POST_NUM_COMMENTS" => intval($arParams["EVENT"]["COMMENTS_COUNT"])));
                die;
            }
            ?>
</div><?php 
            // post-comments-wrap
        } else {
            ?>
<script>
				app.setPageID('LOG_ENTRY_<?php 
예제 #7
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if ($_REQUEST["AJAX_POST"] == "Y" && $_REQUEST["ENTITY_XML_ID"] == $arParams["ENTITY_XML_ID"] && in_array($_REQUEST["MODE"], array("LIST", "RECORD"))) {
    include_once __DIR__ . "/html_parser.php";
    AddEventHandler('main.post.list', 'OnCommentsDisplayTemplate', __MPLParseRecordsHTML);
}
if (check_bitrix_sessid() && $GLOBALS["USER"]->IsAuthorized() && !!$_REQUEST["ENTITY_XML_ID"] && $_REQUEST["ENTITY_XML_ID"] == $arParams["ENTITY_XML_ID"] && is_array($arParams["PUSH&PULL"]) && $arParams["PUSH&PULL"]["ACTION"] == "REPLY" && CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus()) {
    $_SESSION["UC"][$_REQUEST["ENTITY_XML_ID"]]["RECORDS"][] = $arParams["PUSH&PULL"]["ID"];
    $res = $arParams["RECORDS"][$arParams["PUSH&PULL"]["ID"]];
    if ($res["APPROVED"] != "Y") {
        $res = array("ID" => $res["ID"], "URL" => $res["URL"], "APPROVED" => "N", "ENTITY_XML_ID" => $res["ENTITY_XML_ID"]);
    } else {
        $res["PANELS"] = array("EDIT" => "N", "MODERATE" => "N", "DELETE" => "N");
    }
    CPullWatch::AddToStack('UNICOMMENTS' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => array_merge($res, array("ACTION" => "REPLY"))));
}
if ($GLOBALS["USER"]->IsAuthorized() && CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus()) {
    CPullWatch::Add($GLOBALS["USER"]->GetId(), 'UNICOMMENTS' . $arParams["ENTITY_XML_ID"]);
    ?>
<script>
	BX.ready(function(){BX.PULL.extendWatch('UNICOMMENTS<?php 
    echo CUtil::JSEscape($arParams["ENTITY_XML_ID"]);
    ?>
');});
</script>
<?php 
}
예제 #8
0
                $arResult["newCount"] = 3;
            }
            if (IntVal($commentUrlID) > 0) {
                $arResult["newCount"] = count($arResult["CommentsResult"]);
            }
            if ($arParams["SHOW_RATING"] == "Y" && !empty($arResult["IDS"])) {
                $arResult['RATING'] = CRatings::GetRatingVoteResult('BLOG_COMMENT', $arResult["IDS"]);
            }
        }
        $arResult["urlToPost"] = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => "#source_post_id#", "user_id" => $arPost["AUTHOR_ID"]));
        if (strpos($arResult["urlToPost"], "?") !== false) {
            $arResult["urlToPost"] .= "&";
        } else {
            $arResult["urlToPost"] .= "?";
        }
        if ($USER->IsAuthorized()) {
            $arResult["urlToDelete"] = $arResult["urlToPost"] . "delete_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get();
            $arResult["urlToHide"] = $arResult["urlToPost"] . "hide_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get();
            $arResult["urlToShow"] = $arResult["urlToPost"] . "show_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get();
        }
        $arResult["urlToMore"] = $arResult["urlToPost"] . "last_comment_id=#comment_id#&comment_post_id=#post_id#&IFRAME=Y";
        $arResult["urlToNew"] = $arResult["urlToPost"] . "new_comment_id=#comment_id#&comment_post_id=#post_id#&IFRAME=Y";
        include_once $_SERVER["DOCUMENT_ROOT"] . $componentPath . "/component_adit.php";
        if (CModule::IncludeModule("pull") && IntVal($arResult["userID"]) > 0 && $arResult["is_ajax_post"] != "Y" && !$arParams["bFromList"]) {
            CPullWatch::Add($arResult["userID"], 'BLOG_POST_' . $arPost["ID"]);
        }
    }
    $arResult["Post"] = $arPost;
    $this->IncludeComponentTemplate();
    return array("CanUserComment" => $arResult["CanUserComment"], "newCountWOMark" => $arResult["newCountWOMark"]);
}
예제 #9
0
';

	MBTasks.preloadedData = false;
	MBTasks.residentTaskId = false;	// ID of task currently located on page
	MBTasks.showedBaseDataHash = false;	// This is for check, that base data changed
	MBTasks.selectedMatrix = false;
	MBTasks.gear = 'L';

	MBTasks.cache = {};


</script>
<!-- <div id="tasks-router-view" style="display:none;"> -->
	<?php 
if (CModule::IncludeModule('pull')) {
    CPullWatch::Add($arParams['USER_ID'], 'TASKS_GENERAL_' . $arParams['USER_ID']);
}
$arComParams = $arParams;
$arComParams['JUST_SHOW_BULK_TEMPLATE'] = 'Y';
$APPLICATION->IncludeComponent('bitrix:mobile.tasks.detail', '.default', $arComParams, false);
?>
<!-- </div> -->
<div id="tasks-router-edit" style="display:none;">
	This is edit form placeholder
</div>
<div id="tasks-router-removed-task" style="display:none;">
	<?php 
echo GetMessage('MB_TASKS_TASK_SNMROUTER_TASK_WAS_REMOVED');
?>
</div>
예제 #10
0
     $userId = $USER->GetId();
     if (CIMChat::GetGeneralChatId() != intval($_POST['CHAT_ID'])) {
         CUtil::decodeURIComponent($_POST);
         $CIMChat = new CIMChat();
         $CIMChat->Rename($_POST['CHAT_ID'], $_POST['CHAT_TITLE']);
     }
     echo CUtil::PhpToJsObject(array('CHAT_ID' => intval($_POST['CHAT_ID']), 'CHAT_TITLE' => $_POST['CHAT_TITLE'], 'ERROR' => ''));
 } else {
     if ($_POST['IM_CHAT_DATA_LOAD'] == 'Y') {
         CUtil::decodeURIComponent($_POST);
         $chatId = $_POST['CHAT_ID'];
         $arChat = CIMChat::GetChatData(array('ID' => $chatId, 'USE_CACHE' => 'Y', 'USER_ID' => $USER->GetId()));
         $arUser = CIMContactList::GetUserData(array('ID' => $arChat['userInChat'][$chatId]));
         if (!in_array($USER->GetId(), $arChat['userInChat'][$chatId])) {
             if ($arChat['chat'][$chatId]['messageType'] == IM_MESSAGE_OPEN && CModule::IncludeModule("pull")) {
                 CPullWatch::Add($USER->GetId(), 'IM_PUBLIC_' . $chatId, true);
             }
         }
         echo CUtil::PhpToJsObject(array('CHAT' => $arChat['chat'], 'CHAT_ID' => $_POST['CHAT_ID'], 'USER_IN_CHAT' => $arChat['userInChat'], 'USER_BLOCK_CHAT' => $arChat['userChatBlockStatus'], 'USERS' => isset($arUser['users']) ? $arUser['users'] : array(), 'USER_IN_GROUP' => isset($arUser['userInGroup']) ? $arUser['userInGroup'] : array(), 'WO_USER_IN_GROUP' => isset($arUser['woUserInGroup']) ? $arUser['woUserInGroup'] : array(), 'ERROR' => ''));
     } else {
         if ($_POST['IM_GET_EXTERNAL_DATA'] == 'Y') {
             $error = '';
             $arResult = array('TS' => $_POST['TS'], 'TYPE' => $_POST['TYPE'], 'ERROR' => '');
             $arMessage = array();
             if ($_POST['TYPE'] == 'user') {
                 $arResult['USER_ID'] = intval($_POST['USER_ID']);
                 if (CIMContactList::AllowToSend(array('TO_USER_ID' => $_POST['USER_ID']))) {
                     $ar = CIMContactList::GetUserData(array('ID' => array($_POST['USER_ID']), 'DEPARTMENT' => 'Y', 'USE_CACHE' => 'N', 'PHONES' => IsModuleInstalled('voximplant') ? 'Y' : 'N'));
                     $arResult['USERS'] = isset($ar['users']) ? $ar['users'] : array();
                     $arResult['USER_IN_GROUP'] = isset($ar['userInGroup']) ? $ar['userInGroup'] : array();
                     $arResult['WO_USER_IN_GROUP'] = isset($ar['woUserInGroup']) ? $ar['woUserInGroup'] : array();
예제 #11
0
                ?>
</div><?php 
            }
            ?>
</div><?php 
            ?>
</div><?php 
        }
        ?>
</div><?php 
        // post-item-top-wrap
        if (!$arParams["IS_LIST"]) {
            if ($arResult["Post"]["ENABLE_COMMENTS"] == "Y" && strlen($strCommentsBlock) > 0) {
                echo $strCommentsBlock;
                if ($GLOBALS["USER"]->IsAuthorized() && CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus()) {
                    CPullWatch::Add($GLOBALS["USER"]->GetID(), "UNICOMMENTSBLOG_" . intval($arResult["Post"]["ID"]));
                }
            }
        }
        ?>
</div><?php 
        // post-wrap / lenta-item
        ?>
<script type="text/javascript">
			BX.ready(function()
			{
				oMSL.arBlockToCheck[<?php 
        echo $arParams["LOG_ID"];
        ?>
] = {
					lenta_item_id: 'lenta_item_<?php 
예제 #12
0
    echo "*";
    require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
    die;
} elseif (intval($_GET["delete_comment_id"]) > 0) {
    $APPLICATION->RestartBuffer();
    while (ob_end_clean()) {
    }
    // hack!
    echo "SUCCESS";
    require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
    die;
}
include_once $_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . "/components/bitrix/socialnetwork.blog.post/mobile/functions.php";
if ($_REQUEST["empty_get_comments"] == "Y") {
    if ($GLOBALS["USER"]->IsAuthorized() && CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus()) {
        CPullWatch::Add($GLOBALS["USER"]->GetID(), "UNICOMMENTSBLOG_" . $arParams["ID"]);
        CPullWatch::DeferredSql();
    }
}
if ($arResult["is_ajax_post"] == "Y") {
    $APPLICATION->RestartBuffer();
    if ($_REQUEST["empty_get_comments"] != "Y") {
        $strBufferText = "";
        ob_start();
    }
} else {
    ?>
<script>
	app.setPageID('BLOG_POST_<?php 
    echo $arParams["ID"];
    ?>