コード例 #1
0
ファイル: crm_activity.php プロジェクト: mrdeadmouse/u136006
 public static function Notify(&$arFields, $schemeTypeID, $tag = '')
 {
     if (!is_array($arFields)) {
         return false;
     }
     $responsibleID = $arFields['RESPONSIBLE_ID'] ? intval($arFields['RESPONSIBLE_ID']) : 0;
     if ($responsibleID <= 0) {
         return false;
     }
     if ($schemeTypeID === CCrmNotifierSchemeType::IncomingEmail) {
         $showUrl = CCrmOwnerType::GetShowUrl($arFields['OWNER_TYPE_ID'] ? intval($arFields['OWNER_TYPE_ID']) : 0, $arFields['OWNER_ID'] ? intval($arFields['OWNER_ID']) : 0);
         if ($showUrl === '') {
             return false;
         }
         $subject = isset($arFields['SUBJECT']) ? $arFields['SUBJECT'] : '';
         $addresserHtml = '';
         $communications = isset($arFields['COMMUNICATIONS']) ? $arFields['COMMUNICATIONS'] : array();
         if (!empty($communications)) {
             $comm = $communications[0];
             $caption = '';
             if (isset($comm['ENTITY_TYPE_ID']) && isset($comm['ENTITY_ID'])) {
                 $caption = CCrmOwnerType::GetCaption($comm['ENTITY_TYPE_ID'], $comm['ENTITY_ID']);
             }
             if ($caption === '') {
                 $caption = $comm['VALUE'];
             }
             $addresserShowUrl = CCrmOwnerType::GetShowUrl($comm['ENTITY_TYPE_ID'], $comm['ENTITY_ID']);
             $addresserHtml = $addresserShowUrl !== '' ? '<a target="_blank" href="' . htmlspecialcharsbx($addresserShowUrl) . '">' . htmlspecialcharsbx($caption) . '</a>' : htmlspecialcharsbx($caption);
         }
         if ($addresserHtml === '') {
             $messageTemplate = GetMessage('CRM_ACTIVITY_NOTIFY_MESSAGE_INCOMING_EMAIL');
             return CCrmNotifier::Notify($responsibleID, str_replace('#VIEW_URL#', htmlspecialcharsbx($showUrl), $messageTemplate), str_replace('#VIEW_URL#', htmlspecialcharsbx(CCrmUrlUtil::ToAbsoluteUrl($showUrl)), $messageTemplate), $schemeTypeID, $tag);
         }
         $messageTemplate = GetMessage('CRM_ACTIVITY_NOTIFY_MESSAGE_INCOMING_EMAIL_EXT');
         return CCrmNotifier::Notify($responsibleID, str_replace(array('#VIEW_URL#', '#SUBJECT#', '#ADDRESSER#'), array(htmlspecialcharsbx($showUrl), htmlspecialcharsbx($subject), $addresserHtml), $messageTemplate), str_replace(array('#VIEW_URL#', '#SUBJECT#', '#ADDRESSER#'), array(htmlspecialcharsbx(CCrmUrlUtil::ToAbsoluteUrl($showUrl)), htmlspecialcharsbx($subject), $addresserHtml), $messageTemplate), $schemeTypeID, $tag);
     }
     return false;
 }
コード例 #2
0
ファイル: diskmanager.php プロジェクト: DarneoStudio/bitrix
 public static function getFileInfo($fileID, $checkPermissions = true, $options = null)
 {
     if (!Loader::includeModule('disk')) {
         return null;
     }
     $fileID = (int) $fileID;
     if ($fileID <= 0) {
         return null;
     }
     /** @var File $file */
     $file = File::loadById($fileID);
     if (!$file) {
         return null;
     }
     if (!is_array($options)) {
         $options = array();
     }
     $ownerID = isset($options['OWNER_ID']) ? $options['OWNER_ID'] : 0;
     $ownerTypeID = isset($options['OWNER_TYPE_ID']) ? $options['OWNER_TYPE_ID'] : \CCrmOwnerType::Undefined;
     $canRead = true;
     $viewUrl = '';
     if ($ownerID > 0 && \CCrmOwnerType::isDefined($ownerTypeID)) {
         $viewUrlParams = array('fileId' => $fileID, 'ownerTypeId' => $ownerTypeID, 'ownerId' => $ownerID);
         if (isset($options['VIEW_PARAMS']) && is_array($options['VIEW_PARAMS'])) {
             $viewUrlParams = array_merge($viewUrlParams, $options['VIEW_PARAMS']);
         }
         $viewUrl = \CHTTP::urlAddParams('/bitrix/tools/crm_show_file.php', $viewUrlParams);
         if (isset($options['USE_ABSOLUTE_PATH']) && $options['USE_ABSOLUTE_PATH']) {
             $viewUrl = \CCrmUrlUtil::ToAbsoluteUrl($viewUrl);
         }
     } elseif ($checkPermissions) {
         $canRead = $file->canRead($file->getStorage()->getSecurityContext(\CCrmSecurityHelper::getCurrentUserID()));
         if ($canRead) {
             $viewUrl = Driver::getInstance()->getUrlManager()->getUrlForDownloadFile($file);
         }
     }
     return array('ID' => $fileID, 'NAME' => $file->getName(), 'SIZE' => \CFile::FormatSize($file->getSize()), 'CAN_READ' => $canRead, 'VIEW_URL' => $viewUrl);
 }
コード例 #3
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
                if (is_array($arCommunication["ENTITY_SETTINGS"]) && isset($arCommunication["ENTITY_SETTINGS"]["COMPANY_TITLE"])) {
                    $arTmp["COMPANY"] = $arCommunication["ENTITY_SETTINGS"]["COMPANY_TITLE"];
                }
                $arResult["CLIENTS_FOR_JS"][] = $arTmp;
            }
        }
        $arResult["STORAGE_ELEMENTS"] = array();
        $arResult["RECORDS"] = array();
        if ($arActivity["TYPE_ID"] == CCrmActivityType::Call && !empty($arActivity["STORAGE_ELEMENT_IDS"])) {
            $arStorageElementID = unserialize($arActivity["STORAGE_ELEMENT_IDS"]);
            if (is_array($arStorageElementID) && !empty($arStorageElementID)) {
                $arMediaExtensions = array("flv", "mp3", "mp4", "vp6", "aac");
                foreach ($arStorageElementID as $elementID) {
                    $info = Bitrix\Crm\Integration\StorageManager::getFileInfo($elementID, $arActivity["STORAGE_TYPE_ID"], false);
                    if (is_array($info) && in_array(GetFileExtension(strtolower($info["NAME"])), $arMediaExtensions)) {
                        //Hacks for flv player
                        $recordUrl = CCrmUrlUtil::ToAbsoluteUrl($info["VIEW_URL"]);
                        if (substr($recordUrl, -1) !== "/") {
                            $recordUrl .= "/";
                        }
                        $recordUrl .= !empty($info["NAME"]) ? $info["NAME"] : "dummy.flv";
                        $arResult["RECORDS"][] = array("URL" => $recordUrl, "NAME" => $info["NAME"]);
                    }
                    $arResult["STORAGE_ELEMENTS"][] = $info;
                }
            }
        }
    }
}
$this->IncludeComponentTemplate();
return array("CACHED_CSS_PATH" => $this->getTemplate()->GetFolder() . "/style.css", "CACHED_JS_PATH" => $this->getTemplate()->GetFolder() . "/script.js");
コード例 #4
0
ファイル: template.php プロジェクト: mrdeadmouse/u136006
if (!empty($arResult["RECORDS"]) && is_array($arResult["RECORDS"])) {
    ?>
<div class="crm-feed-deal-description">
			<div class="crm-feed-deal-descr-title"><?php 
    echo GetMessage("C_T_CRM_LFA_RECORDS");
    ?>
:</div>
			<div class="crm-feed-deal-descr-text"><?php 
    $cnt = 0;
    foreach ($arResult["RECORDS"] as $key => $arRecord) {
        ?>
<div style="padding-top: <?php 
        echo !$cnt ? "0" : "10";
        ?>
px;"><?php 
        $APPLICATION->IncludeComponent("bitrix:player", "", array("PLAYER_TYPE" => "flv", "CHECK_FILE" => $arParams["ACTIVITY"]["STORAGE_TYPE_ID"] == CCrmActivityStorageType::WebDav ? "N" : "Y", "USE_PLAYLIST" => "N", "PATH" => CCrmUrlUtil::ToAbsoluteUrl($arRecord["URL"]), "WIDTH" => 398, "HEIGHT" => 24, "PREVIEW" => false, "LOGO" => false, "FULLSCREEN" => "N", "SKIN_PATH" => "/bitrix/components/bitrix/player/mediaplayer/skins", "SKIN" => "", "CONTROLBAR" => "bottom", "WMODE" => "transparent", "WMODE_WMV" => "windowless", "HIDE_MENU" => "N", "SHOW_CONTROLS" => "Y", "SHOW_STOP" => "N", "SHOW_DIGITS" => "Y", "CONTROLS_BGCOLOR" => "FFFFFF", "CONTROLS_COLOR" => "000000", "CONTROLS_OVER_COLOR" => "000000", "SCREEN_COLOR" => "000000", "AUTOSTART" => "N", "REPEAT" => "N", "VOLUME" => "90", "DISPLAY_CLICK" => "play", "MUTE" => "N", "HIGH_QUALITY" => "N", "ADVANCED_MODE_SETTINGS" => "Y", "BUFFER_LENGTH" => "10", "DOWNLOAD_LINK" => false, "DOWNLOAD_LINK_TARGET" => "_self", "ALLOW_SWF" => "N", "ADDITIONAL_PARAMS" => array('LOGO' => false, 'NUM' => false, 'HEIGHT_CORRECT' => false), "PLAYER_ID" => "bitrix_crm_activity_" . $arParams["ACTIVITY"]["ID"] . "_" . $key), false, array("HIDE_ICONS" => "Y"));
        ?>
</div><?php 
        $cnt++;
    }
    ?>
</div>
		</div><?php 
}
if (!empty($arResult["DESCRIPTION"])) {
    ?>
<div class="crm-feed-deal-description">
			<div class="crm-feed-deal-descr-title"><?php 
    echo GetMessage("C_T_CRM_LFA_DESCRIPTION");
    ?>
:</div>
コード例 #5
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
        return;
    }
    $arFields['FM'] = array();
    $dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $entityID));
    if ($dbMultiFields) {
        while ($arMultiField = $dbMultiFields->Fetch()) {
            $arFields['FM'][$arMultiField['TYPE_ID']][$arMultiField['ID']] = array('VALUE' => $arMultiField['VALUE'], 'VALUE_TYPE' => $arMultiField['VALUE_TYPE']);
        }
    }
    CCrmMobileHelper::PrepareCompanyItem($arFields, $arParams, array('COMPANY_TYPE' => $arResult['COMPANY_TYPE'], 'INDUSTRY' => $arResult['INDUSTRY'], 'EMPLOYEES_LIST' => $arResult['EMPLOYEES']));
}
$arResult['ENTITY'] = $arFields;
$sid = bitrix_sessid();
$serviceURLTemplate = $arParams["SERVICE_URL_TEMPLATE"] ? $arParams["SERVICE_URL_TEMPLATE"] : '#SITE_DIR#bitrix/components/bitrix/mobile.crm.company.edit/ajax.php?site_id=#SITE#&sessid=#SID#';
$arResult['SERVICE_URL'] = CComponentEngine::makePathFromTemplate($serviceURLTemplate, array('SID' => $sid));
$arResult['UPLOAD_URL'] = CCrmUrlUtil::ToAbsoluteUrl(CComponentEngine::makePathFromTemplate('#SITE_DIR#mobile/crm/company/file.php?id=#ID#&sessid=#SID#', array('SID' => $sid, 'ID' => $entityID)));
// CONTEXT_ID -->
$contextID = isset($arParams['CONTEXT_ID']) ? $arParams['CONTEXT_ID'] : '';
if ($contextID === '' && isset($_REQUEST['context_id'])) {
    $contextID = $_REQUEST['context_id'];
}
if ($contextID === '') {
    $contextID = "{$uid}_{$entityID}";
}
$arResult['CONTEXT_ID'] = $arParams['CONTEXT_ID'] = $contextID;
//<-- CONTEXT_ID
// ENABLE_CONTACT -->
if (isset($arParams['ENABLE_CONTACT'])) {
    $arResult['ENABLE_CONTACT'] = (bool) $arParams['ENABLE_CONTACT'];
} else {
    $arResult['ENABLE_CONTACT'] = !isset($_REQUEST['enable_contact']) || $_REQUEST['enable_contact'] !== 'N';
コード例 #6
0
ファイル: crm_invoice.php プロジェクト: mrdeadmouse/u136006
 private static function SynchronizeLiveFeedEvent($invoiceID, $params)
 {
     $invoiceID = intval($invoiceID);
     if ($invoiceID <= 0) {
         return;
     }
     if (!is_array($params)) {
         $params = array();
     }
     $processParents = isset($params['PROCESS_PARENTS']) ? (bool) $params['PROCESS_PARENTS'] : false;
     $parents = isset($params['PARENTS']) && is_array($params['PARENTS']) ? $params['PARENTS'] : array();
     $hasParents = !empty($parents);
     if ($processParents) {
         CCrmSonetRelation::UnRegisterRelationsByEntity(CCrmOwnerType::Invoice, $invoiceID, array('QUICK' => $hasParents));
     }
     $userID = CCrmSecurityHelper::GetCurrentUserID();
     $startResponsibleID = isset($params['START_RESPONSIBLE_ID']) ? intval($params['START_RESPONSIBLE_ID']) : 0;
     $finalResponsibleID = isset($params['FINAL_RESPONSIBLE_ID']) ? intval($params['FINAL_RESPONSIBLE_ID']) : 0;
     $enableMessages = ($startResponsibleID > 0 || $finalResponsibleID > 0) && IsModuleInstalled('im') && CModule::IncludeModule('im');
     $topic = isset($params['TOPIC']) ? $params['TOPIC'] : $invoiceID;
     $slEntities = CCrmLiveFeed::GetLogEvents(array(), array('ENTITY_TYPE_ID' => CCrmOwnerType::Invoice, 'ENTITY_ID' => $invoiceID), array('ID', 'EVENT_ID'));
     foreach ($slEntities as &$slEntity) {
         $slID = intval($slEntity['ID']);
         $slEventType = $slEntity['EVENT_ID'];
         if (isset($params['REFRESH_DATE']) ? (bool) $params['REFRESH_DATE'] : false) {
             //Update LOG_UPDATE for force event to rise in global feed
             //Update LOG_DATE for force event to rise in entity feed
             global $DB;
             CCrmLiveFeed::UpdateLogEvent($slID, array('=LOG_UPDATE' => $DB->CurrentTimeFunction(), '=LOG_DATE' => $DB->CurrentTimeFunction()));
         } else {
             //HACK: FAKE UPDATE FOR INVALIDATE CACHE
             CCrmLiveFeed::UpdateLogEvent($slID, array('ENTITY_TYPE_ID' => CCrmOwnerType::Invoice, 'ENTITY_ID' => $invoiceID));
         }
         if ($processParents && $hasParents) {
             CCrmSonetRelation::RegisterRelationBundle($slID, $slEventType, CCrmOwnerType::Invoice, $invoiceID, $parents, array('TYPE_ID' => CCrmSonetRelationType::Ownership));
         }
         if ($enableMessages) {
             $messageFields = array('MESSAGE_TYPE' => IM_MESSAGE_SYSTEM, 'FROM_USER_ID' => $userID, 'NOTIFY_TYPE' => IM_NOTIFY_FROM, 'NOTIFY_MODULE' => 'crm', 'LOG_ID' => $slID, 'NOTIFY_EVENT' => 'invoice_responsible_changed', 'NOTIFY_TAG' => "CRM|INVOICE|{$invoiceID}");
             $eventUrl = CCrmLiveFeed::GetShowUrl($slID);
             if ($startResponsibleID > 0 && $startResponsibleID !== $userID) {
                 $messageFields['TO_USER_ID'] = $startResponsibleID;
                 $messageFields['NOTIFY_MESSAGE'] = GetMessage('CRM_INVOICE_NOT_RESPONSIBLE_IM_NOTIFY', array('#title#' => '<a href="' . htmlspecialcharsbx($eventUrl) . '">' . htmlspecialcharsbx($topic) . '</a>'));
                 $messageFields['NOTIFY_MESSAGE_OUT'] = GetMessage('CRM_INVOICE_NOT_RESPONSIBLE_IM_NOTIFY', array('#title#' => htmlspecialcharsbx($topic))) . " (" . CCrmUrlUtil::ToAbsoluteUrl($eventUrl) . ")";
                 CIMNotify::Add($messageFields);
             }
             if ($finalResponsibleID > 0 && $finalResponsibleID !== $userID) {
                 $messageFields['TO_USER_ID'] = $finalResponsibleID;
                 $messageFields['NOTIFY_MESSAGE'] = GetMessage('CRM_INVOICE_RESPONSIBLE_IM_NOTIFY', array('#title#' => '<a href="' . htmlspecialcharsbx($eventUrl) . '">' . htmlspecialcharsbx($topic) . '</a>'));
                 $messageFields['NOTIFY_MESSAGE_OUT'] = GetMessage('CRM_INVOICE_RESPONSIBLE_IM_NOTIFY', array('#title#' => htmlspecialcharsbx($topic))) . " (" . CCrmUrlUtil::ToAbsoluteUrl($eventUrl) . ")";
                 CIMNotify::Add($messageFields);
             }
         }
     }
     unset($slEntity);
 }
コード例 #7
0
ファイル: file_proxy.php プロジェクト: DarneoStudio/bitrix
 public static function TryResolveFile($var, &$file, $options = array())
 {
     if (!is_array($options)) {
         $options = array();
     }
     $result = null;
     if (is_array($var)) {
         if (isset($options['ENABLE_UPLOAD']) && $options['ENABLE_UPLOAD'] && self::IsUploadedFile($var)) {
             $result = $var;
         }
     } elseif (is_numeric($var)) {
         if (isset($options['ENABLE_ID']) && $options['ENABLE_ID']) {
             $result = CFile::MakeFileArray($var);
         }
     } elseif (is_string($var)) {
         $path = CCrmUrlUtil::ToAbsoluteUrl($var);
         //Parent directories and not secure URLs are not allowed.
         if ($path !== '' && !CHTTP::isPathTraversalUri($path) && CCrmUrlUtil::IsSecureUrl($path)) {
             $result = CFile::MakeFileArray($path);
         }
     }
     if (is_array($result)) {
         $result['MODULE_ID'] = 'crm';
         $file = $result;
         return true;
     }
     return false;
 }
コード例 #8
0
ファイル: file_proxy.php プロジェクト: mrdeadmouse/u136006
 public static function TryResolveFile(&$path, &$file, $arOptions = array())
 {
     $result = null;
     if (is_numeric($path)) {
         if (is_array($arOptions) && isset($arOptions['ENABLE_ID']) && $arOptions['ENABLE_ID']) {
             $result = CFile::MakeFileArray($path);
         }
     } elseif (is_string($path)) {
         $absPath = CCrmUrlUtil::ToAbsoluteUrl($path);
         //Parent directories and not secure URLs are not allowed.
         if ($absPath !== '' && preg_match('/[\\/,\\\\]\\.\\.[\\/,\\\\]/', $absPath) !== 1 && CCrmUrlUtil::IsSecureUrl($absPath)) {
             $result = CFile::MakeFileArray($absPath);
         }
     }
     if (is_array($result)) {
         $result['MODULE_ID'] = 'crm';
         $file = $result;
         return true;
     }
     return false;
 }