本文整理汇总了PHP中CMain::IsHTTPS方法的典型用法代码示例。如果您正苦于以下问题:PHP CMain::IsHTTPS方法的具体用法?PHP CMain::IsHTTPS怎么用?PHP CMain::IsHTTPS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMain
的用法示例。
在下文中一共展示了CMain::IsHTTPS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstallDB
function InstallDB()
{
global $DB, $APPLICATION;
$this->errors = false;
if(!$DB->Query("SELECT 'x' FROM b_pull_stack", true))
$this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/pull/install/db/".strtolower($DB->type)."/install.sql");
if($this->errors !== false)
{
$APPLICATION->ThrowException(implode("", $this->errors));
return false;
}
RegisterModule("pull");
RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php");
RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema");
RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache");
RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache");
COption::SetOptionString("pull", "path_to_listener", (CMain::IsHTTPS() ? "https" : "http")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/sub/');
COption::SetOptionString("pull", "path_to_websocket", (CMain::IsHTTPS() ? "wss" : "ws")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/subws/');
COption::SetOptionString("pull", "path_to_publish", 'http://127.0.0.1:8895/bitrix/pub/');
COption::SetOptionString("pull", "websocket", 'N');
COption::SetOptionString("pull", "nginx", 'N');
COption::SetOptionString("pull", "push", 'N');
CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+30, "FULL"));
return true;
}
示例2: createSmartFilterSeoXML
function createSmartFilterSeoXML()
{
if (CModule::IncludeModule("iblock")) {
$resElDB = CIBlockElement::GetList(array("SORT" => "ASC"), array('IBLOCK_ID' => SEO_IBLOCK), false, false, array('PROPERTY_TARGET_ON', 'PROPERTY_INDEX', 'PROPERTY_FOLLOW', 'IBLOCK_ID', 'ID', 'NAME'));
$protocol = CMain::IsHTTPS() ? "https" : "http";
$host = $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443 && $_SERVER['SERVER_PORT'] > 0 && strpos($_SERVER['HTTP_HOST'], ":") === false) {
$host .= ":" . $_SERVER['SERVER_PORT'];
}
$curDate = date("Y-m-d\\TH:i:s P");
$strBeginSmartFilter = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
$index = 0;
while ($res = $resElDB->fetch()) {
$exp = explode('*', $res['PROPERTY_TARGET_ON_VALUE']['TEXT']);
$urlFilter = trim($exp[0]);
//clean url of smart filter
if ($index == 0) {
$strBeginSmartFilter .= "\t<url>\n\t\t";
$index++;
} else {
$strBeginSmartFilter .= "<url>\n\t\t";
}
$strBeginSmartFilter .= "<loc>" . $protocol . "://" . $host . $urlFilter . "</loc>\n\t\t";
$strBeginSmartFilter .= "<lastmod>" . $curDate . "</lastmod>\n\t";
$strBeginSmartFilter .= "</url>";
}
$strBeginSmartFilter .= "</urlset\n>";
$smartXmlFileName = 'sitemap_iblock_' . SEO_IBLOCK . '.xml';
$el = fopen($_SERVER['DOCUMENT_ROOT'] . '/' . $smartXmlFileName, "w");
fwrite($el, $strBeginSmartFilter);
fclose($el);
return "createSmartFilterSeoXML();";
}
}
示例3: GetRedirectUrl
function GetRedirectUrl($identity, $return_to = false)
{
if (strlen($identity) <= 0) {
$GLOBALS['APPLICATION']->ThrowException(GetMessage('OPENID_CLIENT_EMPTY_IDENTITY'));
return false;
}
if (strlen($identity) > 1024) {
$identity = substr($identity, 0, 1024);
}
// may be 256 ????
if (strpos(strtolower($identity), 'http://') === false && strpos(strtolower($identity), 'https://') === false) {
$identity = 'http://' . $identity;
}
$_SESSION['BX_OPENID_IDENTITY'] = $identity;
if ($arOpenidServerTags = $this->GetOpenIDServerTags($identity)) {
if (!$this->CheckTrustProviders($arOpenidServerTags['server'])) {
$GLOBALS['APPLICATION']->ThrowException(GetMessage('OPENID_CLIENT_CHECK_TRUST_PRIVIDERS_FAULT'));
return false;
}
$protocol = CMain::IsHTTPS() ? "https" : "http";
$port = $_SERVER['SERVER_PORT'] > 0 && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443 ? ':' . $_SERVER['SERVER_PORT'] : '';
$server_name = $protocol . '://' . $_SERVER['SERVER_NAME'] . $port;
if ($return_to === false) {
$return_to = $server_name . $GLOBALS['APPLICATION']->GetCurPageParam('', array('SEF_APPLICATION_CUR_PAGE_URL'), false);
}
if (strlen($arOpenidServerTags['delegate']) > 0) {
$identity = $arOpenidServerTags['delegate'];
}
$trust_root = $server_name . '/';
$url = $arOpenidServerTags['server'] . (strpos($arOpenidServerTags['server'], '?') !== false ? '&' : '?') . 'openid.mode=checkid_setup' . '&openid.return_to=' . urlencode($return_to) . '&openid.identity=' . urlencode($identity) . '&openid.trust_root=' . urlencode($trust_root) . '&openid.sreg.required=email,fullname' . '&openid.sreg.optional=gender,dob,postcode,country,timezone';
$_SESSION['BX_OPENID_RETURN_TO'] = $return_to;
return $url;
}
return false;
}
示例4: ToAbsoluteUrl
public static function ToAbsoluteUrl($url)
{
$url = trim(strval($url));
if ($url === '') {
return '';
} elseif (self::GetUrlScheme($url) !== '') {
return $url;
}
$scheme = CMain::IsHTTPS() ? 'https' : 'http';
$host = '';
if (defined('SITE_SERVER_NAME') && is_string(SITE_SERVER_NAME)) {
$host = SITE_SERVER_NAME;
}
if ($host === '') {
$host = COption::GetOptionString('main', 'server_name', '');
}
if ($host === '') {
$host = $_SERVER['SERVER_NAME'];
}
$port = intval($_SERVER['SERVER_PORT']);
if (preg_match('/^\\//', $url)) {
$url = substr($url, 1);
}
return $scheme . '://' . $host . ($port !== 80 && $port !== 443 ? ':' . $port : '') . '/' . $url;
}
示例5: AddNewUser
function AddNewUser($SITE_ID, $arFields, &$strError)
{
$ID_ADDED = 0;
$iDepartmentId = intval($arFields["DEPARTMENT_ID"]);
$bExtranet = $iDepartmentId <= 0;
$strEmail = trim($arFields["ADD_EMAIL"]);
$strName = trim($arFields["ADD_NAME"]);
$strLastName = trim($arFields["ADD_LAST_NAME"]);
$strPosition = trim($arFields["ADD_POSITION"]);
$strPassword = self::GeneratePassword($SITE_ID, $bExtranetUser);
self::setSendPassword($arFields["ADD_SEND_PASSWORD"] == "Y");
if (strlen($strEmail) <= 0) {
if (!isset($arFields["ADD_MAILBOX_ACTION"]) || !in_array($arFields["ADD_MAILBOX_ACTION"], array("create", "connect")) || strlen($arFields['ADD_MAILBOX_USER']) <= 0 || strlen($arFields['ADD_MAILBOX_DOMAIN']) <= 0) {
$strError = GetMessage("BX24_INVITE_DIALOG_ERROR_EMPTY_EMAIL");
} else {
// email from mailbox
$strEmail = $arFields['ADD_MAILBOX_USER'] . "@" . $arFields['ADD_MAILBOX_DOMAIN'];
}
}
if (!$strError) {
$arUser = array("LOGIN" => $strEmail, "NAME" => $strName, "LAST_NAME" => $strLastName, "EMAIL" => $strEmail, "PASSWORD" => $strPassword, "GROUP_ID" => CIntranetInviteDialog::getUserGroups($SITE_ID, $bExtranet), "WORK_POSITION" => $strPosition, "UF_DEPARTMENT" => $iDepartmentId > 0 ? array($iDepartmentId) : array(0));
if (!self::getSendPassword()) {
$arUser["CONFIRM_CODE"] = randString(8);
}
$obUser = new CUser();
$ID_ADDED = $obUser->Add($arUser);
if (!$ID_ADDED) {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$strError = $e->GetString();
} else {
$strError = $obUser->LAST_ERROR;
}
} else {
if (self::getSendPassword()) {
$db_events = GetModuleEvents("main", "OnUserInitialize", true);
foreach ($db_events as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID_ADDED, $arUser));
}
}
$SiteIdToSend = $bExtranet && CModule::IncludeModule("extranet") ? CExtranet::GetExtranetSiteID() : CSite::GetDefSite();
$rsSites = CSite::GetByID($SiteIdToSend);
$arSite = $rsSites->Fetch();
$serverName = strlen($arSite["SERVER_NAME"]) > 0 ? $arSite["SERVER_NAME"] : (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
$event = new CEvent();
if (self::getSendPassword()) {
$url = (CMain::IsHTTPS() ? "https" : "http") . "://" . $serverName . $arSite["DIR"];
$event->SendImmediate("INTRANET_USER_ADD", $SITE_ID, array("EMAIL_TO" => $arUser["EMAIL"], "LINK" => $url, "PASSWORD" => $strPassword, "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
} else {
$dbUser = CUser::GetByID($ID_ADDED);
$arUser = $dbUser->Fetch();
if (IsModuleInstalled("bitrix24")) {
$event->SendImmediate("BITRIX24_USER_INVITATION", $SITE_ID, array("EMAIL_FROM" => $GLOBALS["USER"]->GetEmail(), "EMAIL_TO" => $arUser["EMAIL"], "LINK" => CHTTP::URN2URI("/bitrix/tools/intranet_invite_dialog.php?user_id=" . $ID_ADDED . "&checkword=" . urlencode($arUser["CONFIRM_CODE"]), $serverName), "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
} else {
$event->SendImmediate("INTRANET_USER_INVITATION", $SITE_ID, array("EMAIL_TO" => $arUser["EMAIL"], "LINK" => CHTTP::URN2URI("/bitrix/tools/intranet_invite_dialog.php?user_id=" . $ID_ADDED . "&checkword=" . urlencode($arUser["CONFIRM_CODE"]), $serverName), "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
}
}
}
}
return $ID_ADDED;
}
示例6: CSeoPageChecker
function CSeoPageChecker($site, $url, $get = true, $check_errors = true)
{
global $APPLICATION;
if (CModule::IncludeModule('search')) {
$this->bSearch = true;
} else {
$APPLICATION->ThrowException(GetMessage('SEO_ERROR_NO_SEARCH'));
}
// don't return false or set bError!
$this->__bCheckErrors = $check_errors;
$this->__site = $site;
$dbRes = CSite::GetByID($this->__site);
if ($arRes = $dbRes->Fetch()) {
$this->__lang = $arRes['LANGUAGE_ID'];
$this->__server_name = $arRes['SERVER_NAME'];
if (strlen($this->__server_name) <= 0) {
$this->__server_name = COption::GetOptionString('main', 'server_name', '');
}
if (strlen($this->__server_name) > 0) {
$this->__url = (CMain::IsHTTPS() ? "https://" : "http://") . CBXPunycode::ToASCII($this->__server_name, $e = null) . $url;
return $get ? $this->GetHTTPData() : true;
} else {
$this->bError = true;
$APPLICATION->ThrowException(str_replace('#SITE_ID#', $this->__site, GetMessage('SEO_ERROR_NO_SERVER_NAME')));
return false;
}
}
return false;
}
示例7: init
function init()
{
$this->username = CSalePaySystemAction::GetParamValue("USER");
$this->pwd = CSalePaySystemAction::GetParamValue("PWD");
$this->signature = CSalePaySystemAction::GetParamValue("SIGNATURE");
$this->currency = CSalePaySystemAction::GetParamValue("CURRENCY");
$this->testMode = CSalePaySystemAction::GetParamValue("TEST") == "Y";
if ($this->testMode) {
$this->domain = "sandbox.";
}
if (strlen($_REQUEST["token"]) > 0) {
$this->token = $_REQUEST["token"];
}
if (strlen($_REQUEST["PayerID"]) > 0) {
$this->payerId = $_REQUEST["PayerID"];
}
$this->version = "98.0";
$dbSite = CSite::GetByID(SITE_ID);
$arSite = $dbSite->Fetch();
$this->serverName = $arSite["SERVER_NAME"];
if (strLen($this->serverName) <= 0) {
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
$this->serverName = SITE_SERVER_NAME;
} else {
$this->serverName = COption::GetOptionString("main", "server_name", "www.bitrixsoft.com");
}
}
$this->serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . $this->serverName;
if (strlen($this->username) <= 0 || strlen($this->username) <= 0 || strlen($this->username) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("CSalePaySystempaypal: init error", "CSalePaySystempaypal_init_error");
return false;
}
return true;
}
示例8: url
/**
* get current url
*/
public static function url($full)
{
if (isset($_SERVER['REQUEST_URI'])) {
$uri = $_SERVER['REQUEST_URI'];
} else {
if (isset($_SERVER['argv'])) {
$uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0];
} elseif (isset($_SERVER['QUERY_STRING'])) {
$uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
} else {
$uri = $_SERVER['SCRIPT_NAME'];
}
}
// Prevent multiple slashes to avoid cross site requests via the FAPI.
$uri = '/' . ltrim($uri, '/');
$host = $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443 && $_SERVER['SERVER_PORT'] > 0 && strpos($_SERVER['HTTP_HOST'], ":") === false) {
$host .= ":" . $_SERVER['SERVER_PORT'];
}
$protocol = CMain::IsHTTPS() ? "https" : "http";
if ($full) {
$uri = $protocol . "://" . $_SERVER['SERVER_NAME'] . $uri;
}
return $uri;
}
示例9: OnEndBufferContent
/**
*
* @param string &$content
* @return void
*
*/
public function OnEndBufferContent(&$content)
{
if (isset($_GET["nocdn"])) {
return;
}
self::$proto = CMain::IsHTTPS() ? "https" : "http";
self::$config = CBitrixCloudCDNConfig::getInstance()->loadFromOptions();
if (self::$config->isExpired()) {
if (self::$config->lock()) {
try {
try {
$delayExpiration = true;
self::$config = CBitrixCloudCDNConfig::getInstance()->loadRemoteXML();
self::$config->saveToOptions();
self::$config->unlock();
} catch (CBitrixCloudException $e) {
//In case of documented XML error we'll disable CDN
if ($e->getErrorCode() !== "") {
self::SetActive(false);
$delayExpiration = false;
}
throw $e;
}
} catch (exception $e) {
if ($delayExpiration) {
self::$config->setExpired(time() + 1800);
}
CAdminNotify::Add(array("MESSAGE" => GetMessage("BCL_CDN_NOTIFY", array("#HREF#" => "/bitrix/admin/bitrixcloud_cdn.php?lang=" . LANGUAGE_ID)), "TAG" => "bitrixcloud_off", "MODULE_ID" => "bitrixcloud", "ENABLE_CLOSE" => "Y"));
self::$config->unlock();
return;
}
}
}
if (!self::$config->isActive()) {
return false;
}
$sites = self::$config->getSites();
if (defined("ADMIN_SECTION")) {
if (!isset($sites["admin"])) {
return;
}
} elseif (defined("SITE_ID")) {
if (!isset($sites[SITE_ID])) {
return;
}
} else {
return;
}
self::$ajax = preg_match("/<head>/i", substr($content, 0, 512)) === 0;
$arPrefixes = array_map(array("CBitrixCloudCDN", "_preg_quote"), self::$config->getLocationsPrefixes());
$arExtensions = array_map(array("CBitrixCloudCDN", "_preg_quote"), self::$config->getLocationsExtensions());
if (!empty($arPrefixes) && !empty($arExtensions)) {
$prefix_regex = "(?:" . implode("|", $arPrefixes) . ")";
$extension_regex = "(?:" . implode("|", $arExtensions) . ")";
$regex = "/\n\t\t\t\t((?i:\n\t\t\t\t\thref=\n\t\t\t\t\t|src=\n\t\t\t\t\t|BX\\.loadCSS\\(\n\t\t\t\t\t|BX\\.loadScript\\(\n\t\t\t\t\t|jsUtils\\.loadJSFile\\(\n\t\t\t\t\t|background\\s*:\\s*url\\(\n\t\t\t\t)) #attribute\n\t\t\t\t(\"|') #open_quote\n\t\t\t\t(" . $prefix_regex . ") #prefix\n\t\t\t\t([^?'\"]+\\.) #href body\n\t\t\t\t(" . $extension_regex . ") #extension\n\t\t\t\t(|\\?\\d+|\\?v=\\d+) #params\n\t\t\t\t(\\2) #close_quote\n\t\t\t/x";
$content = preg_replace_callback($regex, array("CBitrixCloudCDN", "_filter"), $content);
}
}
示例10: floatval
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
if (!isset($arParams['GOOGLE_VERSION']))
$arParams['GOOGLE_VERSION'] = '3';
$arParams['DEV_MODE'] = $arParams['DEV_MODE'] == 'Y' ? 'Y' : 'N';
if (!defined('FX_GMAP_SCRIPT_LOADED'))
{
CUtil::InitJSCore();
if ($arParams['DEV_MODE'] != 'Y')
{
$scheme = (CMain::IsHTTPS() ? "https" : "http");
$APPLICATION->AddHeadString('<script src="'.$scheme.'://maps.google.com/maps/api/js?sensor=false&language='.LANGUAGE_ID.'" charset="utf-8"></script>');
define('FX_GMAP_SCRIPT_LOADED', 1);
}
}
$arParams['MAP_ID'] =
(strlen($arParams["MAP_ID"])<=0 || !preg_match("/^[A-Za-z_][A-Za-z01-9_]*$/", $arParams["MAP_ID"])) ?
'MAP_'.RandString() : $arParams['MAP_ID'];
$arParams['INIT_MAP_LON'] = floatval($arParams['INIT_MAP_LON']);
$arParams['INIT_MAP_LON'] = $arParams['INIT_MAP_LON'] ? $arParams['INIT_MAP_LON'] : 37.64;
$arParams['INIT_MAP_LAT'] = floatval($arParams['INIT_MAP_LAT']);
$arParams['INIT_MAP_LAT'] = $arParams['INIT_MAP_LAT'] ? $arParams['INIT_MAP_LAT'] : 55.76;
$arParams['INIT_MAP_SCALE'] = intval($arParams['INIT_MAP_SCALE']);
$arParams['INIT_MAP_SCALE'] = $arParams['INIT_MAP_SCALE'] ? $arParams['INIT_MAP_SCALE'] : 10;
示例11: array
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$sbParams = array("FB_USE", "TW_USE", "GP_USE", "VK_USE");
foreach ($sbParams as $param) {
if (isset($arParams[$param]) && $arParams[$param] == "Y") {
$arResult[$param] = true;
} else {
$arResult[$param] = false;
}
}
if (isset($arParams["URL_TO_LIKE"])) {
$arResult["URL_TO_LIKE"] = $arParams["URL_TO_LIKE"];
} else {
$protocol = CMain::IsHTTPS() ? "https://" : "http://";
$arResult["URL_TO_LIKE"] = $protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
}
$arResult["URL_TO_LIKE_ENCODED"] = urlencode($arResult["URL_TO_LIKE"]);
if (isset($arParams["TITLE"])) {
$arResult["TITLE"] = $arParams["TITLE"];
} else {
$arResult["TITLE"] = "";
}
if (isset($arParams["DESCRIPTION"])) {
$arResult["DESCRIPTION"] = $arParams["DESCRIPTION"];
} else {
$arResult["DESCRIPTION"] = "";
}
if (isset($arParams["IMAGE"])) {
$arResult["IMAGE"] = $arParams["IMAGE"];
示例12: ShowPanel
function ShowPanel()
{
global $USER, $APPLICATION;
if (defined("ADMIN_SECTION") && ADMIN_SECTION == true) {
return;
}
if ($USER->IsAdmin()) {
if ($_REQUEST['add_new_site_sol'] == 'sol' && check_bitrix_sessid()) {
$dbrSites = CSite::GetList($by, $ord);
$arSitesID = array();
$arSitesPath = array();
$siteCnt = 0;
while ($arSite = $dbrSites->Fetch()) {
if ($arSite["ACTIVE"] == "Y") {
$siteCnt++;
}
$arSitesID[] = strtolower($arSite["ID"]);
$arSitesPath[] = strtolower($arSite["PATH"]);
}
$newSiteID = "";
while (true) {
$newSiteID = chr(rand(ord("a"), ord("z"))) . chr(rand(ord("a"), ord("z")));
if (!in_array($newSiteID, $arSitesID) && !in_array("/site" . $newSiteID . "/", $arSitesPath) && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/site" . $newSiteID)) {
break;
}
}
$culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => FORMAT_DATE, "=FORMAT_DATETIME" => FORMAT_DATETIME, "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => SITE_CHARSET)));
if ($culture) {
$cultureId = $culture["ID"];
} else {
$addResult = CultureTable::add(array("NAME" => $newSiteID, "CODE" => $newSiteID, "FORMAT_DATE" => FORMAT_DATE, "FORMAT_DATETIME" => FORMAT_DATETIME, "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => SITE_CHARSET));
$cultureId = $addResult->getId();
}
$arFields = array("LID" => $newSiteID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $newSiteID, "DIR" => "/site_" . $newSiteID . "/", "SITE_NAME" => $newSiteID, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId);
$obSite = new CSite();
$result = $obSite->Add($arFields);
if ($result) {
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/site_" . $newSiteID . "/");
$indexContent = '<' . '?' . 'define("B_PROLOG_INCLUDED", true);' . 'define("WIZARD_DEFAULT_SITE_ID", "' . $newSiteID . '");' . 'define("WIZARD_DEFAULT_TONLY", true);' . 'define("PRE_LANGUAGE_ID","' . LANGUAGE_ID . '");' . 'define("PRE_INSTALL_CHARSET","' . SITE_CHARSET . '");' . 'include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/install/wizard/wizard.php");' . '?' . '>';
$handler = fopen($_SERVER["DOCUMENT_ROOT"] . "/site_" . $newSiteID . "/index.php", "wb");
fwrite($handler, $indexContent);
fclose($handler);
LocalRedirect("/site_" . $newSiteID . "/");
} else {
echo $obSite->LAST_ERROR;
}
}
if ($_REQUEST['delete_button_sol'] == 'sol' && check_bitrix_sessid()) {
UnRegisterModuleDependences('main', 'OnBeforeProlog', 'main', 'CWizardSolPanel', 'ShowPanel', '/modules/main/install/wizard_sol/panel_button.php');
LocalRedirect($APPLICATION->GetCurPage());
}
$arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?add_new_site_sol=sol&" . bitrix_sessid_get() . "')", "TEXT" => "<b>" . GetMessage("SOL_BUTTON_TEST_TEXT", array("#BR#" => " ")) . "</b>", "TITLE" => GetMessage("SOL_BUTTON_TEST_TITLE")));
$arMenu[] = array("ACTION" => "if(confirm('" . AddSlashes(GetMessage("SOL_BUTTON_CONFIRM_W2")) . "')) jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?delete_button_sol=sol&" . bitrix_sessid_get() . "');", "TEXT" => GetMessage("SOL_BUTTON_DEL_TEXT"), "TITLE" => GetMessage("SOL_BUTTON_DEL_TITLE"));
$protocol = CMain::IsHTTPS() ? 'https://' : 'http://';
$arSites = array();
$dbrSites = CSite::GetList($by, $ord, array("ACTIVE" => "Y"));
while ($arSite = $dbrSites->GetNext()) {
$url = $arSite["DIR"];
if ($arSite["DOMAIN_LIMITED"] == "Y" && $arSite["LID"] != SITE_ID) {
$site = trim(preg_replace("#^(http://|https://)#i", "", $arSite["SERVER_NAME"]), " \t\n\r\v/");
if ($site != '') {
$url = $protocol . $site . '/' . ltrim($url, '/');
}
}
$arSites[] = array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "');", "ICON" => $arSite["LID"] == SITE_ID ? "checked" : "", "TEXT" => $arSite["NAME"], "TITLE" => GetMessage("SOL_BUTTON_GOTOSITE") . " " . $arSite["NAME"]);
}
$arMenu[] = array("SEPARATOR" => true);
$arMenu[] = array("TEXT" => GetMessage("SOL_BUTTON_GOTOSITE"), "MENU" => $arSites);
$APPLICATION->AddPanelButton(array("HREF" => SITE_DIR . "?add_new_site_sol=sol&" . bitrix_sessid_get(), "ID" => "solutions_wizard", "ICON" => "bx-panel-install-solution-icon", "TYPE" => "BIG", "ALT" => GetMessage("SOL_BUTTON_TEST_TITLE"), "TEXT" => GetMessage("SOL_BUTTON_TEST_TEXT"), "MAIN_SORT" => 2520, "SORT" => 20, "MENU" => $arMenu, 'HINT' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_TEXT_HINT')), 'HINT_MENU' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_MENU_HINT'))));
}
}
示例13: getHostName
/**
* Return host name for site checking
* @return string
*/
protected function getHostName()
{
$sheme = (CMain::IsHTTPS() ? "https" : "http")."://";
$serverPort = self::getServerPort();
$url = self::getDomainName();
$url .= ($serverPort && strpos($url, ":") === false) ? ":".$serverPort : "";
return $sheme.$url;
}
示例14: SendRequestToJoinGroup
function SendRequestToJoinGroup($senderID, $userID, $groupID, $message, $bMail = true)
{
global $APPLICATION;
$senderID = IntVal($senderID);
if ($senderID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_SENDERID");
return false;
}
$userID = IntVal($userID);
if ($userID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USERID");
return false;
}
$groupID = IntVal($groupID);
if ($groupID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
return false;
}
$arGroup = CSocNetGroup::GetByID($groupID);
if (!$arGroup || !is_array($arGroup)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_GROUP_ID"), "ERROR_NO_GROUP");
return false;
}
$arGroupSites = array();
$rsGroupSite = CSocNetGroup::GetSite($groupID);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arGroupSites[] = $arGroupSite["LID"];
}
$userRole = CSocNetUserToGroup::GetUserRole($senderID, $groupID);
$bUserIsMember = $userRole && in_array($userRole, array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR, SONET_ROLES_USER));
$bCanInitiate = $GLOBALS["USER"]->IsAdmin() || CSocNetUser::IsCurrentUserModuleAdmin($arGroupSites) || $userRole && ($arGroup["INITIATE_PERMS"] == SONET_ROLES_OWNER && $senderID == $arGroup["OWNER_ID"] || $arGroup["INITIATE_PERMS"] == SONET_ROLES_MODERATOR && in_array($userRole, array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR)) || $arGroup["INITIATE_PERMS"] == SONET_ROLES_USER && $bUserIsMember);
if (!$bCanInitiate) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_PERMS"), "ERROR_NO_PERMS");
return false;
}
$arFields = array("USER_ID" => $userID, "GROUP_ID" => $groupID, "ROLE" => SONET_ROLES_REQUEST, "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => str_replace(array("#TEXT#", "#GROUP_NAME#"), array($message, $arGroup["NAME"]), empty($message) ? GetMessage("SONET_UG_INVITE_CONFIRM_TEXT_EMPTY") : GetMessage("SONET_UG_INVITE_CONFIRM_TEXT")), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP, "INITIATED_BY_USER_ID" => $senderID, "SEND_MAIL" => $bMail ? "Y" : "N");
$ID = CSocNetUserToGroup::Add($arFields);
if (!$ID) {
$errorMessage = "";
if ($e = $APPLICATION->GetException()) {
$errorMessage = $e->GetString();
}
if (StrLen($errorMessage) <= 0) {
$errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");
}
$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_USER2GROUP");
return false;
}
$userIsConfirmed = true;
$rsInvitedUser = CUser::GetByID($userID);
$arInvitedUser = $rsInvitedUser->Fetch();
if ((!is_array($arInvitedUser["UF_DEPARTMENT"]) || intval($arInvitedUser["UF_DEPARTMENT"][0]) <= 0) && $arInvitedUser["LAST_LOGIN"] <= 0 && strlen($arInvitedUser["LAST_ACTIVITY_DATE"]) <= 0) {
$userIsConfirmed = false;
}
if (CModule::IncludeModule("im") && $userIsConfirmed) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arFields['USER_ID']), "FROM_USER_ID" => intval($arFields['INITIATED_BY_USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_CONFIRM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "invite_group_btn", "NOTIFY_TAG" => "SOCNET|INVITE_GROUP|" . intval($arFields['USER_ID']) . "|" . intval($ID), "NOTIFY_TITLE" => str_replace("#GROUP_NAME#", $arGroup["NAME"], GetMessage("SONET_UG_INVITE_CONFIRM_TEXT_EMPTY")), "NOTIFY_MESSAGE" => str_replace(array("#TEXT#", "#GROUP_NAME#"), array($message, $arGroup["NAME"]), empty($message) ? GetMessage("SONET_UG_INVITE_CONFIRM_TEXT_EMPTY") : GetMessage("SONET_UG_INVITE_CONFIRM_TEXT")), "NOTIFY_BUTTONS" => array(array('TITLE' => GetMessage('SONET_UG_INVITE_CONFIRM'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => GetMessage('SONET_UG_INVITE_REJECT'), 'VALUE' => 'N', 'TYPE' => 'cancel')));
if ((!is_array($arInvitedUser["UF_DEPARTMENT"]) || intval($arInvitedUser["UF_DEPARTMENT"][0]) <= 0) && CModule::IncludeModule('extranet')) {
$siteId = CExtranet::GetExtranetSiteID();
} else {
$siteId = SITE_ID;
}
$dbSite = CSite::GetByID($siteId);
$arSite = $dbSite->Fetch();
$serverName = htmlspecialcharsEx($arSite["SERVER_NAME"]);
if (strlen($serverName) <= 0) {
$serverName = defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", "");
}
if (strlen($serverName) <= 0) {
$serverName = $_SERVER["SERVER_NAME"];
}
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . $serverName;
$requestUrl = COption::GetOptionString("socialnetwork", "user_request_page", IsModuleInstalled("intranet") ? "/company/personal/user/#USER_ID#/requests/" : "/club/user/#USER_ID#/requests/", $siteId);
$requestUrl = $serverName . str_replace(array("#USER_ID#", "#user_id#"), $userID, $requestUrl);
$groupUrl = $serverName . str_replace("#group_id#", $groupID, COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $siteId));
$arMessageFields['NOTIFY_MESSAGE_OUT'] = $arMessageFields['NOTIFY_MESSAGE'];
$arMessageFields['NOTIFY_MESSAGE_OUT'] .= "\n\n" . GetMessage('SONET_UG_GROUP_LINK') . $groupUrl;
$arMessageFields['NOTIFY_MESSAGE_OUT'] .= "\n\n" . GetMessage('SONET_UG_INVITE_CONFIRM') . ": " . $requestUrl . '?INVITE_GROUP=' . $ID . '&CONFIRM=Y';
$arMessageFields['NOTIFY_MESSAGE_OUT'] .= "\n\n" . GetMessage('SONET_UG_INVITE_REJECT') . ": " . $requestUrl . '?INVITE_GROUP=' . $ID . '&CONFIRM=N';
CIMNotify::Add($arMessageFields);
}
$events = GetModuleEvents("socialnetwork", "OnSocNetSendRequestToJoinGroup");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
CSocNetUserToGroup::__SpeedFileCreate($userID);
return true;
}
示例15: array_merge
$arParamsKill = array_merge($arParamsKill, $arParams["VARIABLE_ALIASES"], array_values($arVariableAliases));
$arResult["PATH_TO_" . strToUpper($url)] = $GLOBALS["APPLICATION"]->GetCurPageParam($value, $arParamsKill);
}
if (array_key_exists($arVariables["page"], $arDefaultUrlTemplatesN404)) {
$componentPage = $arVariables["page"];
}
if (empty($componentPage) || !array_key_exists($componentPage, $arDefaultUrlTemplatesN404)) {
$componentPage = "index";
}
if ($_REQUEST["auth"] == "Y") {
$componentPage = "auth";
}
}
if ($arRedirectSite) {
if ($arParams["SEF_MODE"] == "Y") {
$url = (strlen(trim($arRedirectSite["SERVER_NAME"])) > 0 && $arRedirectSite["SERVER_NAME"] != SITE_SERVER_NAME ? (CMain::IsHTTPS() ? "https" : "http") . "://" . $arRedirectSite["SERVER_NAME"] : '') . COption::GetOptionString("socialnetwork", "user_page", false, $arRedirectSite["LID"]) . CComponentEngine::MakePathFromTemplate($arDefaultUrlTemplates404[$componentPage], $arVariables);
LocalRedirect($url);
}
}
if (COption::GetOptionString("socialnetwork", "allow_frields", "Y") == "Y") {
$tmpVal = COption::GetOptionString("socialnetwork", "friends_page", false, SITE_ID);
if ($arParams["SEF_FOLDER"] && (!$tmpVal || substr($tmpVal, 0, strlen($arParams["SEF_FOLDER"])) !== $arParams["SEF_FOLDER"])) {
COption::SetOptionString("socialnetwork", "friends_page", $arResult["PATH_TO_USER_FRIENDS"], false, SITE_ID);
}
}
$tmpVal = COption::GetOptionString("socialnetwork", "userblogpost_page", false, SITE_ID);
if ($arParams["SEF_FOLDER"] && (!$tmpVal || substr($tmpVal, 0, strlen($arParams["SEF_FOLDER"])) !== $arParams["SEF_FOLDER"])) {
COption::SetOptionString("socialnetwork", "userblogpost_page", $arResult["PATH_TO_USER_BLOG_POST"], false, SITE_ID);
}
if (!COption::GetOptionString("socialnetwork", "userbloggroup_id", false, SITE_ID)) {
COption::SetOptionString("socialnetwork", "userbloggroup_id", $arParams["BLOG_GROUP_ID"], false, SITE_ID);