Exemplo n.º 1
0
 public function __construct($component = null)
 {
     parent::__construct($component);
     $this->scope = self::STATUS_SCOPE_WEB;
     if (is_callable(array('\\Bitrix\\MobileApp\\Mobile', 'getApiVersion')) && \Bitrix\MobileApp\Mobile::getApiVersion() >= 1 && defined("BX_MOBILE") && BX_MOBILE === true) {
         $this->scope = self::STATUS_SCOPE_MOBILE;
     }
     if ($this->isWeb()) {
         $this->setTemplateName(".default");
     } else {
         $this->setTemplateName("mobile_app");
     }
 }
Exemplo n.º 2
0
 public function __construct($component = null)
 {
     parent::__construct($component);
     \Bitrix\Main\Loader::includeModule("forum");
     $this->componentId = $this->isAjaxRequest() ? randString(7) : $this->randString();
     $this->errorCollection = new ErrorCollection();
     $this->prepareMobileData = IsModuleInstalled("mobile");
     $this->scope = self::STATUS_SCOPE_WEB;
     if (is_callable(array('\\Bitrix\\MobileApp\\Mobile', 'getApiVersion')) && \Bitrix\MobileApp\Mobile::getApiVersion() >= 1 && defined("BX_MOBILE") && BX_MOBILE === true) {
         $this->scope = self::STATUS_SCOPE_MOBILE;
     }
     self::$index++;
     if ($this->isWeb()) {
         $this->setTemplateName(".default");
     } else {
         $this->setTemplateName("mobile_app");
     }
 }
Exemplo n.º 3
0
 /**
  * Sets viewport-metadata
  */
 public static function initScripts()
 {
     global $APPLICATION;
     \CJSCore::Init();
     $APPLICATION->AddHeadString("<script type=\"text/javascript\">var mobileSiteDir=\"" . SITE_DIR . "\"; var appVersion = " . self::$apiVersion . ";var platform = \"" . self::$platform . "\";</script>", false, true);
     if (self::$platform == "android") {
         /**
          * This is workaround for android
          * We use console.log() to tell the application about successful loading of this page
          */
         $APPLICATION->AddHeadString("<script type=\"text/javascript\">console.log(\"bxdata://success\")</script>", false, true);
     }
     if (self::getInstance()->getBXScriptSupported()) {
         /**
          * If the application tells us bxscript-feature is available
          * it means that device can load cordova-scripts (including plugins) itself.
          */
         $pgJsFile = "/bitrix/js/mobileapp/__deviceload__/cordova.js";
         $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . $pgJsFile . "\"></script>", false, true);
     } else {
         $pgJsFile = "/bitrix/js/mobileapp/" . self::$platform . "-cordova-" . self::$pgVersion . ".js";
         if (!File::isFileExists(Application::getDocumentRoot() . $pgJsFile)) {
             $pgJsFile = self::$remoteScriptPath . self::$platform . "-cordova-" . self::$pgVersion . ".js";
         }
         $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . \CUtil::GetAdditionalFileURL($pgJsFile) . "\"></script>", false, true);
     }
     $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . \CUtil::GetAdditionalFileURL("/bitrix/js/mobileapp/bitrix_mobile.js") . "\"></script>", false, true);
     $APPLICATION->AddHeadString("<script type=\"text/javascript\" src=\"" . \CUtil::GetAdditionalFileURL("/bitrix/js/mobileapp/mobile_lib.js") . "\"></script>", false, true);
     if (self::$platform == "android") {
         $APPLICATION->AddHeadString("<script type=\"text/javascript\">app.bindloadPageBlank();</script>", false, false);
     }
     $APPLICATION->AddHeadString(Mobile::getInstance()->getViewPort());
 }
Exemplo n.º 4
0
        foreach ($arChatMessage['chat'] as $key => $value) {
            $arResult['CHAT']['chat'][$key] = $value;
        }
    } else {
        foreach ($arChatMessage['chat'] as $key => $value) {
            $value['fake'] = true;
            $arResult['CHAT']['chat'][$key] = $value;
        }
    }
    foreach ($arChatMessage['userInChat'] as $key => $value) {
        $arResult['CHAT']['userInChat'][$key] = $value;
    }
    foreach ($arChatMessage['userChatBlockStatus'] as $key => $value) {
        $arResult['CHAT']['userChatBlockStatus'][$key] = $value;
    }
}
if (!isset($arResult['CONTACT_LIST']['users'][$USER->GetID()])) {
    $arUsers = CIMContactList::GetUserData(array('ID' => $USER->GetID(), 'DEPARTMENT' => 'N', 'USE_CACHE' => 'Y', 'SHOW_ONLINE' => 'N'));
    $arResult['CONTACT_LIST']['users'][$USER->GetID()] = $arUsers['users'][$USER->GetID()];
}
$jsInit = array('im_mobile', 'uploader');
CJSCore::Init($jsInit);
$arResult["ACTION"] = 'DIALOG';
$arResult["CURRENT_TAB"] = isset($_GET['id']) ? $_GET['id'] : 0;
$arResult["PATH_TO_USER_PROFILE"] = SITE_DIR . 'mobile/users/?user_id=' . $USER->GetID() . '&FROM_DIALOG=Y';
$arResult["PATH_TO_USER_PROFILE_TEMPLATE"] = SITE_DIR . 'mobile/users/?user_id=#user_id#&FROM_DIALOG=Y';
$arResult['WEBRTC_MOBILE_SUPPORT'] = \Bitrix\MobileApp\Mobile::getInstance()->isWebRtcSupported();
if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y')) {
    $this->IncludeComponentTemplate();
}
return $arResult;
Exemplo n.º 5
0
	<div class="post-user-wrap">
		<div class="avatar post-comment-block-avatar post-comment-block-avatar-#AUTHOR_AVATAR_IS#" style="background-image:url('#AUTHOR_AVATAR#')"></div>
		<div class="post-comment-cont">
			<div class="post-comment-author">#AUTHOR_NAME#</div>
			<div class="post-comment-time">#DATE#</div>
		</div>
	</div>
	<!--/noindex-->
	<div class="post-comment-text">
		<div class="comment-loading">
			<div class="newpost-progress-label"></div>
			<div id="record-#FULL_ID#-ind" class="newpost-progress-indicator"></div>
		</div>
	</div>
<?php 
if (\Bitrix\MobileApp\Mobile::getApiVersion() >= 10) {
    ?>
<div class="post-comment-reply"><?php 
    ?>
<div class="post-comment-reply-text"><?php 
    echo GetMessage('BLOG_C_REPLY');
    ?>
</div><?php 
    ?>
</div><?php 
}
?>
<script>
BX.ready(function()
{
	BX.addClass(BX("record-#FULL_ID#-ind"), "animate");
Exemplo n.º 6
0
     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");
     }
 }
 $needAppPass = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_APP_PASS");
 $appUUID = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_APP_UUID");
 $deviceName = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_DEVICE_NAME");
 if ($needAppPass == 'mobile' && $USER->GetParam("APPLICATION_ID") === null) {
     if (strlen($appUUID) > 0) {
         $result = ApplicationPasswordTable::getList(array('select' => array('ID'), 'filter' => array('USER_ID' => $USER->GetID(), 'CODE' => $appUUID)));
         if ($row = $result->fetch()) {
Exemplo n.º 7
0
 public static function GetMobileTemplateJS($arParams, $arTemplate)
 {
     global $USER;
     $ppStatus = 'false';
     $ppServerStatus = 'false';
     $updateStateInterval = 'auto';
     if (CModule::IncludeModule("pull")) {
         $ppStatus = CPullOptions::ModuleEnable() ? 'true' : 'false';
         $ppServerStatus = CPullOptions::GetNginxStatus() ? 'true' : 'false';
         $updateStateInterval = CPullOptions::GetNginxStatus() ? self::GetSessionLifeTime() : 80;
         if ($updateStateInterval > 100) {
             if ($updateStateInterval > 3600) {
                 $updateStateInterval = 3600;
             }
             $updateStateInterval = $updateStateInterval - 60;
         }
     }
     $diskStatus = CIMDisk::Enabled();
     $phoneSipAvailable = false;
     $phoneDeviceActive = false;
     $phoneEnabled = self::CheckPhoneStatus() && CModule::IncludeModule('mobileapp') && \Bitrix\MobileApp\Mobile::getInstance()->isWebRtcSupported();
     if ($phoneEnabled && CModule::IncludeModule('voximplant')) {
         $phoneSipAvailable = CVoxImplantConfig::GetModeStatus(CVoxImplantConfig::MODE_SIP);
         $phoneDeviceActive = CVoxImplantUser::GetPhoneActive($USER->GetId());
     }
     $mobileAction = isset($arTemplate["ACTION"]) ? $arTemplate["ACTION"] : 'none';
     $mobileCallMethod = isset($arTemplate["CALL_METHOD"]) ? $arTemplate["CALL_METHOD"] : 'device';
     $userColor = isset($arTemplate['CONTACT_LIST']['users'][$USER->GetID()]['color']) ? $arTemplate['CONTACT_LIST']['users'][$USER->GetID()]['color'] : '';
     $sJS = "\n\t\t\tBX.ready(function() {\n\t\t\t\tBXIM = new BX.ImMobile({\n\t\t\t\t\t'mobileAction': '" . $mobileAction . "',\n\t\t\t\t\t'mobileCallMethod': '" . $mobileCallMethod . "',\n\n\t\t\t\t\t'colors': " . (IM\Color::isEnabled() ? CUtil::PhpToJSObject(IM\Color::getSafeColorNames()) : 'false') . ",\n\t\t\t\t\t'mailCount': " . intval($arTemplate["MAIL_COUNTER"]) . ",\n\t\t\t\t\t'notifyCount': " . intval($arTemplate["NOTIFY_COUNTER"]) . ",\n\t\t\t\t\t'messageCount': " . intval($arTemplate["MESSAGE_COUNTER"]) . ",\n\t\t\t\t\t'counters': " . (empty($arTemplate['COUNTERS']) ? '{}' : CUtil::PhpToJSObject($arTemplate['COUNTERS'])) . ",\n\t\t\t\t\t'ppStatus': " . $ppStatus . ",\n\t\t\t\t\t'ppServerStatus': " . $ppServerStatus . ",\n\t\t\t\t\t'updateStateInterval': '" . $updateStateInterval . "',\n\t\t\t\t\t'openChatEnable': " . (CIMMessenger::CheckEnableOpenChat() ? 'true' : 'false') . ",\n\t\t\t\t\t'xmppStatus': " . (CIMMessenger::CheckXmppStatusOnline() ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixNetwork': " . (CIMMessenger::CheckNetwork() ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixNetwork2': " . (CIMMessenger::CheckNetwork2() ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrix24': " . (IsModuleInstalled('bitrix24') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrix24Admin': " . (CModule::IncludeModule('bitrix24') && CBitrix24::IsPortalAdmin($USER->GetId()) ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrix24net': " . (IsModuleInstalled('b24network') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixIntranet': " . (IsModuleInstalled('intranet') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixXmpp': " . (IsModuleInstalled('xmpp') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixMobile': " . (IsModuleInstalled('mobile') ? 'true' : 'false') . ",\n\t\t\t\t\t'desktopStatus': " . (CIMMessenger::CheckDesktopStatusOnline() ? 'true' : 'false') . ",\n\t\t\t\t\t'desktopVersion': " . CIMMessenger::GetDesktopVersion() . ",\n\t\t\t\t\t'language': '" . LANGUAGE_ID . "',\n\n\t\t\t\t\t'smile': " . (empty($arTemplate['SMILE']) ? '{}' : CUtil::PhpToJSObject($arTemplate["SMILE"])) . ",\n\t\t\t\t\t'smileSet': " . (empty($arTemplate['SMILE_SET']) ? '{}' : CUtil::PhpToJSObject($arTemplate["SMILE_SET"])) . ",\n\t\t\t\t\t'settings': " . (empty($arTemplate['SETTINGS']) ? '{}' : CUtil::PhpToJSObject($arTemplate['SETTINGS'])) . ",\n\t\t\t\t\t'settingsNotifyBlocked': " . (empty($arTemplate['SETTINGS_NOTIFY_BLOCKED']) ? '{}' : CUtil::PhpToJSObject($arTemplate['SETTINGS_NOTIFY_BLOCKED'])) . ",\n\n\t\t\t\t\t'notify': " . (empty($arTemplate['NOTIFY']['notify']) ? '{}' : CUtil::PhpToJSObject($arTemplate['NOTIFY']['notify'])) . ",\n\t\t\t\t\t'unreadNotify' : " . (empty($arTemplate['NOTIFY']['unreadNotify']) ? '{}' : CUtil::PhpToJSObject($arTemplate['NOTIFY']['unreadNotify'])) . ",\n\t\t\t\t\t'flashNotify' : " . (empty($arTemplate['NOTIFY']['flashNotify']) ? '{}' : CUtil::PhpToJSObject($arTemplate['NOTIFY']['flashNotify'])) . ",\n\t\t\t\t\t'countNotify' : " . intval($arTemplate['NOTIFY']['countNotify']) . ",\n\t\t\t\t\t'loadNotify' : " . ($arTemplate['NOTIFY']['loadNotify'] ? 'true' : 'false') . ",\n\n\t\t\t\t\t'recent': " . (empty($arTemplate['RECENT']) && $arTemplate['RECENT'] !== false ? '[]' : CUtil::PhpToJSObject($arTemplate['RECENT'])) . ",\n\t\t\t\t\t'users': " . (empty($arTemplate['CONTACT_LIST']['users']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['users'])) . ",\n\t\t\t\t\t'groups': " . (empty($arTemplate['CONTACT_LIST']['groups']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['groups'])) . ",\n\t\t\t\t\t'userInGroup': " . (empty($arTemplate['CONTACT_LIST']['userInGroup']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['userInGroup'])) . ",\n\t\t\t\t\t'woGroups': " . (empty($arTemplate['CONTACT_LIST']['woGroups']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woGroups'])) . ",\n\t\t\t\t\t'woUserInGroup': " . (empty($arTemplate['CONTACT_LIST']['woUserInGroup']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woUserInGroup'])) . ",\n\t\t\t\t\t'chat': " . (empty($arTemplate['CHAT']['chat']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CHAT']['chat'])) . ",\n\t\t\t\t\t'userInChat': " . (empty($arTemplate['CHAT']['userInChat']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CHAT']['userInChat'])) . ",\n\t\t\t\t\t'userChatBlockStatus': " . (empty($arTemplate['CHAT']['userChatBlockStatus']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CHAT']['userChatBlockStatus'])) . ",\n\t\t\t\t\t'message' : " . (empty($arTemplate['MESSAGE']['message']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['message'])) . ",\n\t\t\t\t\t'files' : " . (empty($arTemplate['MESSAGE']['files']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['files'])) . ",\n\t\t\t\t\t'showMessage' : " . (empty($arTemplate['MESSAGE']['usersMessage']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['usersMessage'])) . ",\n\t\t\t\t\t'unreadMessage' : " . (empty($arTemplate['MESSAGE']['unreadMessage']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['unreadMessage'])) . ",\n\t\t\t\t\t'flashMessage' : " . (empty($arTemplate['MESSAGE']['flashMessage']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['flashMessage'])) . ",\n\t\t\t\t\t'history' : {},\n\t\t\t\t\t'openMessenger' : " . (isset($_GET['IM_DIALOG']) ? "'" . CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_DIALOG'])) . "'" : 'false') . ",\n\t\t\t\t\t'openHistory' : " . (isset($_GET['IM_HISTORY']) ? "'" . CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_HISTORY'])) . "'" : 'false') . ",\n\t\t\t\t\t'openNotify' : " . (isset($_GET['IM_NOTIFY']) && $_GET['IM_NOTIFY'] == 'Y' ? 'true' : 'false') . ",\n\t\t\t\t\t'openSettings' : " . (isset($_GET['IM_SETTINGS']) ? $_GET['IM_SETTINGS'] == 'Y' ? "'true'" : "'" . CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_SETTINGS'])) . "'" : 'false') . ",\n\n\t\t\t\t\t'currentTab' : '" . ($arTemplate['CURRENT_TAB'] ? CUtil::JSEscape($arTemplate['CURRENT_TAB']) : 0) . "',\n\t\t\t\t\t'generalChatId': " . CIMChat::GetGeneralChatId() . ",\n\t\t\t\t\t'canSendMessageGeneralChat': " . (CIMChat::CanSendMessageToGeneralChat($USER->GetID()) ? 'true' : 'false') . ",\n\t\t\t\t\t'userId': " . $USER->GetID() . ",\n\t\t\t\t\t'userEmail': '" . CUtil::JSEscape($USER->GetEmail()) . "',\n\t\t\t\t\t'userColor': '" . IM\Color::getCode($userColor) . "',\n\t\t\t\t\t'userGender': '" . IM\User::getInstance()->getGender() . "',\n\t\t\t\t\t'userExtranet': " . (IM\User::getInstance()->isExtranet() ? 'true' : 'false') . ",\n\t\t\t\t\t'webrtc': {'turnServer' : '" . (empty($arTemplate['TURN_SERVER']) ? '' : CUtil::JSEscape($arTemplate['TURN_SERVER'])) . "', 'turnServerLogin' : '" . (empty($arTemplate['TURN_SERVER_LOGIN']) ? '' : CUtil::JSEscape($arTemplate['TURN_SERVER_LOGIN'])) . "', 'turnServerPassword' : '" . (empty($arTemplate['TURN_SERVER_PASSWORD']) ? '' : CUtil::JSEscape($arTemplate['TURN_SERVER_PASSWORD'])) . "', 'mobileSupport': " . ($arTemplate['WEBRTC_MOBILE_SUPPORT'] ? 'true' : 'false') . ", 'phoneEnabled': " . ($phoneEnabled ? 'true' : 'false') . ", 'phoneSipAvailable': " . ($phoneSipAvailable ? 'true' : 'false') . "},\n\t\t\t\t\t'disk': {'enable' : " . ($diskStatus ? 'true' : 'false') . "},\n\t\t\t\t\t'path' : {'profile' : '" . (empty($arTemplate['PATH_TO_USER_PROFILE']) ? '' : CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE'])) . "', 'profileTemplate' : '" . (empty($arTemplate['PATH_TO_USER_PROFILE_TEMPLATE']) ? '' : CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE_TEMPLATE'])) . "', 'mail' : '" . (empty($arTemplate['PATH_TO_USER_MAIL']) ? '' : CUtil::JSEscape($arTemplate['PATH_TO_USER_MAIL'])) . "'}\n\t\t\t\t});\n\t\t\t});\n\t\t";
     return $sJS;
 }