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


PHP CMain::isHTTPS方法代码示例

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


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

示例1: checkMailDomain

 public static function checkMailDomain($service_id, $user_id, $cnt = 1)
 {
     $service_id = intval($service_id);
     $user_id = intval($user_id);
     $cnt = intval($cnt);
     if (!CModule::includeModule('mail')) {
         return '';
     }
     $arAdmin = CUser::getList($by, $order, array('ID' => $user_id, 'GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'TIME_ZONE_OFFSET')))->fetch();
     if (empty($arAdmin)) {
         return '';
     }
     $service = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('=ID' => $service_id)))->fetch();
     if (empty($service) || $service['ACTIVE'] != 'Y' || !in_array($service['SERVICE_TYPE'], array('domain', 'crdomain'))) {
         return '';
     }
     if ($service['SERVICE_TYPE'] == 'domain') {
         $result = CMailDomain2::getDomainStatus($service['TOKEN'], $service['SERVER']);
         $stage = empty($result['stage']) ? null : $result['stage'];
     } else {
         $crResponse = CControllerClient::executeEvent('OnMailControllerCheckMemberDomain', array('DOMAIN' => $service['SERVER']));
         $stage = empty($crResponse['result']['stage']) ? null : $crResponse['result']['stage'];
     }
     if (!in_array($stage, array('none', 'owner-check', 'mx-check', 'added'))) {
         return false;
     } else {
         if (in_array($stage, array('none', 'added'))) {
             if ($stage == 'added') {
                 if (CModule::includeModule('im')) {
                     includeModuleLangFile(__FILE__);
                     $siteUrl = sprintf('http%s://%s%s', CMain::isHTTPS() ? 's' : '', $_SERVER['SERVER_NAME'], in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? '' : ':' . $_SERVER['SERVER_PORT']);
                     CIMNotify::add(array('TO_USER_ID' => $user_id, 'FROM_USER_ID' => 0, 'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM, 'NOTIFY_MODULE' => 'intranet', 'NOTIFY_MESSAGE' => str_replace(array('#DOMAIN#', '#SERVER#'), array(htmlspecialcharsbx($service['SERVER']), $siteUrl), getMessage('INTR_MAIL_DOMAINREADY_NOTICE'))));
                 }
                 $timeout = new DateTime(intval($arAdmin['TIME_ZONE_OFFSET']) . ' seconds +7 days');
                 if ($timeout->format('N') > 5) {
                     $timeout->modify('next monday');
                 }
                 CAgent::addAgent('CIntranetUtils::notifyMailDomain("nomailbox", ' . $service_id . ', ' . $user_id . ');', 'intranet', 'N', $timeout->getTimestamp() - intval($arAdmin['TIME_ZONE_OFFSET']) - time());
             }
             return '';
         } else {
             if ($cnt > 100) {
                 return '';
             }
             global $pPERIOD;
             $pPERIOD = $pPERIOD * $cnt;
             if ($pPERIOD > 3600 * 4) {
                 $pPERIOD = 3600 * 4;
             }
             return 'CIntranetUtils::checkMailDomain(' . $service_id . ', ' . $user_id . ', ' . ++$cnt . ');';
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:53,代码来源:utils.php

示例2: getHostUrl

 /**
  * Gets host url with port and scheme.
  * @return string
  * @throws \Bitrix\Main\ArgumentNullException
  */
 public function getHostUrl()
 {
     $protocol = \CMain::isHTTPS() ? 'https' : 'http';
     if (defined("SITE_SERVER_NAME") && SITE_SERVER_NAME) {
         $host = SITE_SERVER_NAME;
     } else {
         $host = Option::get('main', 'server_name', Context::getCurrent()->getServer()->getHttpHost());
     }
     $port = Context::getCurrent()->getServer()->getServerPort();
     if ($port != 80 && $port != 443 && $port > 0 && strpos($host, ':') === false) {
         $host .= ':' . $port;
     } elseif ($protocol == 'http' && $port == 80) {
         $host = str_replace(':80', '', $host);
     } elseif ($protocol == 'https' && $port == 443) {
         $host = str_replace(':443', '', $host);
     }
     return $protocol . '://' . $host;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:23,代码来源:urlmanager.php


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