コード例 #1
0
ファイル: memcache.php プロジェクト: DarneoStudio/bitrix
    function SaveConfig($arServerList)
    {
        self::$arList = false;
        $isOnline = false;
        $content = '<' . '?
define("BX_MEMCACHE_CLUSTER", "' . EscapePHPString(CMain::GetServerUniqID()) . '");
$arList = array(
';
        $defGroup = 1;
        $arGroups = array();
        $rsGroups = CClusterGroup::GetList(array("ID" => "DESC"));
        while ($arGroup = $rsGroups->Fetch()) {
            $defGroup = $arGroups[$arGroup["ID"]] = intval($arGroup["ID"]);
        }
        foreach ($arServerList as $i => $arServer) {
            $isOnline |= $arServer["STATUS"] == "ONLINE";
            $GROUP_ID = intval($arServer["GROUP_ID"]);
            if (!array_key_exists($arServer["GROUP_ID"], $arGroups)) {
                $GROUP_ID = $defGroup;
            }
            $content .= "\t" . intval($i) . " => array(\n";
            $content .= "\t\t'ID' => \"" . EscapePHPString($arServer["ID"]) . "\",\n";
            $content .= "\t\t'GROUP_ID' => " . $GROUP_ID . ",\n";
            $content .= "\t\t'HOST' => \"" . EscapePHPString($arServer["HOST"]) . "\",\n";
            $content .= "\t\t'PORT' => " . intval($arServer["PORT"]) . ",\n";
            $content .= "\t\t'WEIGHT' => " . intval($arServer["WEIGHT"]) . ",\n";
            if ($arServer["STATUS"] == "ONLINE") {
                $content .= "\t\t'STATUS' => \"ONLINE\",\n";
            } elseif ($arServer["STATUS"] == "OFFLINE") {
                $content .= "\t\t'STATUS' => \"OFFLINE\",\n";
            } else {
                $content .= "\t\t'STATUS' => \"READY\",\n";
            }
            $content .= "\t),\n";
        }
        $content .= ');
?' . '>';
        file_put_contents($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/cluster/memcache.php", $content);
        bx_accelerator_reset();
        self::$systemConfigurationUpdate = null;
        $cache = \Bitrix\Main\Config\Configuration::getValue('cache');
        if ($isOnline) {
            if (!is_array($cache) || !isset($cache['type']) || !is_array($cache['type']) || !isset($cache['type']['class_name']) || !$cache['type']['class_name'] === 'CPHPCacheMemcacheCluster') {
                \Bitrix\Main\Config\Configuration::setValue('cache', array('type' => array('class_name' => 'CPHPCacheMemcacheCluster', 'extension' => 'memcache', 'required_file' => 'modules/cluster/classes/general/memcache_cache.php')));
                self::$systemConfigurationUpdate = true;
            }
        } else {
            if (is_array($cache) && isset($cache['type']) && is_array($cache['type']) && isset($cache['type']['class_name']) && $cache['type']['class_name'] === 'CPHPCacheMemcacheCluster') {
                \Bitrix\Main\Config\Configuration::setValue('cache', null);
                self::$systemConfigurationUpdate = false;
            }
        }
    }
コード例 #2
0
ファイル: memcache.php プロジェクト: ASDAFF/bxApiDocs
	public static function SaveConfig($arServerList)
	{
		self::$arList = false;
		$content = '<'.'?
// define("BX_MEMCACHE_CLUSTER", "'.EscapePHPString(CMain::GetServerUniqID()).'");
$arList = array(
';
		$defGroup = 1;
		$arGroups = array();
		$rsGroups = CClusterGroup::GetList(array("ID" => "DESC"));
		while($arGroup = $rsGroups->Fetch())
			$defGroup = $arGroups[$arGroup["ID"]] = intval($arGroup["ID"]);

		foreach($arServerList as $i => $arServer)
		{
			$GROUP_ID = intval($arServer["GROUP_ID"]);
			if(!array_key_exists($arServer["GROUP_ID"], $arGroups))
				$GROUP_ID = $defGroup;

			$content .= "\t".intval($i)." => array(\n";
			$content .= "\t\t'ID' => \"".EscapePHPString($arServer["ID"])."\",\n";
			$content .= "\t\t'GROUP_ID' => ".$GROUP_ID.",\n";
			$content .= "\t\t'HOST' => \"".EscapePHPString($arServer["HOST"])."\",\n";
			$content .= "\t\t'PORT' => ".intval($arServer["PORT"]).",\n";
			$content .= "\t\t'WEIGHT' => ".intval($arServer["WEIGHT"]).",\n";
			if($arServer["STATUS"] == "ONLINE")
				$content .= "\t\t'STATUS' => \"ONLINE\",\n";
			elseif($arServer["STATUS"] == "OFFLINE")
				$content .= "\t\t'STATUS' => \"OFFLINE\",\n";
			else
				$content .= "\t\t'STATUS' => \"READY\",\n";
			$content .= "\t),\n";
		}

		$content .= ');
?'.'>';
		file_put_contents(
			$_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/cluster/memcache.php"
			,$content
		);
	}
コード例 #3
0
ファイル: agent.php プロジェクト: Satariall/izurit
 /**
  * @param $feedType
  * @param $siteId
  * @param $interval
  * @param bool|false $once
  * @return bool|int
  * @throws ArgumentNullException
  * @throws ArgumentOutOfRangeException
  */
 public static function add($feedType, $siteId, $interval, $once = false)
 {
     if ($interval <= 0) {
         return 0;
     }
     if (empty($siteId)) {
         throw new ArgumentNullException('siteId');
     }
     $siteId = \EscapePHPString($siteId);
     if ($feedType == "ORDER") {
         $sort = 50;
     } elseif ($feedType == "PRODUCT") {
         $sort = 100;
     } elseif ($feedType == "INVENTORY" || $feedType == "IMAGE") {
         $sort = 150;
     } else {
         throw new ArgumentOutOfRangeException('feedType');
     }
     $intervalSeconds = $interval * 60;
     $timeToStart = ConvertTimeStamp(strtotime(date('Y-m-d H:i:s', time() + $intervalSeconds)), 'FULL');
     $result = \CAgent::AddAgent(self::createAgentNameForAdd($feedType, $siteId, $once), 'sale', "N", $interval * 60, $timeToStart, "Y", $timeToStart, $sort);
     Ebay::log(Logger::LOG_LEVEL_DEBUG, "EBAY_AGENT_ADDING_RESULT", $feedType, "Feed: " . $feedType . ", site: " . $siteId . ", interval: " . $interval . " once: " . ($once ? 'true' : 'false') . " agentId: '" . $result . "'", $siteId);
     return $result;
 }
コード例 #4
0
         $strSectionName = "\$sSectionName = \"" . EscapePHPString($pageTitle) . "\";\n";
     }
 }
 //Properties
 $strDirProperties = "";
 if (isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"])) {
     $bNeedComma = false;
     foreach ($_POST["PROPERTY"] as $arProperty) {
         $arProperty["CODE"] = isset($arProperty["CODE"]) ? trim($arProperty["CODE"]) : "";
         $arProperty["VALUE"] = isset($arProperty["VALUE"]) ? trim($arProperty["VALUE"]) : "";
         if (preg_match("/[a-zA-Z_-~]+/i", $arProperty["CODE"])) {
             if ($createNewFolder && strlen($arProperty["VALUE"]) > 0) {
                 if ($bNeedComma) {
                     $strDirProperties .= ",\n";
                 }
                 $strDirProperties .= "   \"" . EscapePHPString($arProperty["CODE"]) . "\" => \"" . EscapePHPString($arProperty["VALUE"]) . "\"";
                 $bNeedComma = true;
             } else {
                 $fileContent = SetPrologProperty($fileContent, $arProperty["CODE"], $arProperty["VALUE"]);
             }
         }
     }
 }
 if ($createNewFolder) {
     $sectionFileContent = "<" . "?\n" . $strSectionName . "\$arDirProperties = Array(\n" . $strDirProperties . "\n);\n" . "?" . ">";
     $sectionPath = substr($path, 1) . $fileName;
     $success = BXCreateSection($fileContent, $sectionFileContent, $absoluteFilePath, $sectionPath);
     $arUndoParams = array('module' => 'fileman', 'undoType' => 'new_section', 'undoHandler' => 'CFileman::UndoNewSection', 'arContent' => array('absPath' => $absoluteFilePath, 'path' => rtrim($path, "/") . "/" . $fileName, 'site' => $site));
 } else {
     //Tags only for pages
     if ($pageTags !== false && IsModuleInstalled("search")) {
コード例 #5
0
ファイル: updater.php プロジェクト: Satariall/izurit
 /**
  * Returns Php\Statement object with escaped php code repeated for body? prefixed with $prefix and suffixed with $suffix.
  *
  * @param string $prefix Prefix string for each from body.
  * @param array|string $body Strings to be escaped.
  * @param string $suffix Suffix string for each from body.
  *
  * @return \Bitrix\Perfmon\Php\Statement
  */
 protected function createStatement($prefix, $body, $suffix)
 {
     $result = new Php\Statement();
     if (is_array($body)) {
         foreach ($body as $line) {
             $result->addLine($prefix . EscapePHPString($line) . $suffix);
         }
     } else {
         $result->addLine($prefix . EscapePHPString($body) . $suffix);
     }
     return $result;
 }
コード例 #6
0
ファイル: options.php プロジェクト: ASDAFF/open_bx
	array("DIV" => "edit8", "TAB" => GetMessage("MAIN_TAB_8"), "ICON" => "main_settings", "TITLE" => GetMessage("MAIN_OPTION_EVENT_LOG")),
	array("DIV" => "edit5", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => "main_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS")),
);

$tabControl = new CAdminTabControl("tabControl", $aTabs);

$SET_LICENSE_KEY = "";
if($_SERVER["REQUEST_METHOD"]=="POST" && strlen($_POST["Update"])>0 && ($USER->CanDoOperation('edit_other_settings') && $USER->CanDoOperation('edit_groups')) && check_freetrix_sessid())
{
	if(LICENSE_KEY !== $_POST["SET_LICENSE_KEY"])
	{
		$SET_LICENSE_KEY = preg_replace("/[^A-Za-z0-9_.-]/", "", $_POST["SET_LICENSE_KEY"]);

		file_put_contents(
			$_SERVER["DOCUMENT_ROOT"].FX_ROOT."/license_key.php",
			"<"."? $"."LICENSE_KEY = \"".EscapePHPString($SET_LICENSE_KEY)."\"; ?".">"
		);
	}

	foreach($arAllOptions as $aOptGroup)
	{
		foreach($aOptGroup as $option)
		{
			__AdmSettingsSaveOption("main", $option);
		}
	}
	COption::SetOptionString("main", "admin_lid", $_POST["admin_lid"]);
	COption::SetOptionString("main", "show_panel_for_users", serialize($_POST["show_panel_for_users"]));

	$cleanup_days = COption::GetOptionInt("main", "new_user_registration_cleanup_days", 7);
	if($cleanup_days > 0 && COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") === "Y")
コード例 #7
0
ファイル: translate_edit.php プロジェクト: Satariall/izurit
             } else {
                 $safeKey = str_replace('.', '_', $k . "_" . $lng);
                 if (isset($_POST[$safeKey])) {
                     $ms_value = $_POST[$safeKey];
                 }
             }
             if (isset($_POST[$k . "_" . $lng . "_PREV"])) {
                 $ms_value_prev = $_POST[$k . "_" . $lng . "_PREV"];
             } else {
                 $safeKey = str_replace('.', '_', $k . "_" . $lng . "_PREV");
                 if (isset($_POST[$safeKey])) {
                     $ms_value_prev = $_POST[$safeKey];
                 }
             }
             if ($ms_del != "Y" && strlen($ms_value) > 0) {
                 $arTEXT[$arLangFiles[$ms_lang]][] = "\$MESS[\"" . EscapePHPString($k) . "\"] = \"" . EscapePHPString(str_replace("\r", "", $ms_value)) . "\"";
             } elseif (strlen($ms_value_prev) > 0) {
                 $arTEXT[$arLangFiles[$ms_lang]][] = "";
             }
         }
     }
 }
 // collect all the variables and write to files
 while (list($fpath, $arM) = each($arTEXT)) {
     $strContent = "";
     foreach ($arM as $M) {
         if (strlen($M) > 0) {
             $strContent .= "\n" . $M . ";";
         }
     }
     if (!TR_BACKUP($fpath)) {
コード例 #8
0
ファイル: controllergroup.php プロジェクト: ASDAFF/bxApiDocs
	public function GetOptionPHPCode($arAllValues)
	{
		$arValues = $arAllValues[$this->id];
		$arOptions = $this->GetOptionArray();
		$str = "";
		foreach($arOptions as $id=>$arOptionParams)
		{
			if(isset($arValues[$id]))
				$str .= 'CControllerClient::SetOptionString("'.EscapePHPString($this->id).'", "'.EscapePHPString($id).'", "'.EscapePHPString($arValues[$id]).'");'."\r\n";
			elseif(substr($id, 0, 2)!='__')
				$str .= 'CControllerClient::RestoreOption("'.EscapePHPString($this->id).'", "'.EscapePHPString($id).'");'."\r\n";
		}
		return $str;
	}
コード例 #9
0
ファイル: fileman.php プロジェクト: Satariall/izurit
 function UndoFileDelete($Params, $type)
 {
     global $APPLICATION;
     $documentRoot = CSite::GetSiteDocRoot($Params['site']);
     // Restore file
     if (strlen($Params['path']) > 0) {
         $APPLICATION->SaveFileContent($documentRoot . $Params['path'], $Params['content']);
     }
     // Update disk quota
     if (COption::GetOptionInt("main", "disk_space") > 0) {
         $io = CBXVirtualIo::GetInstance();
         $f = $io->GetFile($documentRoot . $Params['path']);
         $file_size = $f->GetFileSize();
         $quota = new CDiskQuota();
         $quota->UpdateDiskQuota("file", $file_size, "delete");
     }
     // Restore file access permissions
     if (is_array($Params['perm']) && count($Params['perm']) > 0) {
         for ($i = 0, $l = count($Params['perm']); $i < $l; $i++) {
             $permFile = $Params['perm'][$i]['permFile'];
             $permContent = $APPLICATION->GetFileContent($permFile);
             $permContent = substr($permContent, 0, strpos($permContent, "?" . ">"));
             $permContent .= "\$PERM[\"" . EscapePHPString($Params['perm'][$i]['file']) . "\"][\"" . EscapePHPString($Params['perm'][$i]['group']) . "\"]=\"" . EscapePHPString($Params['perm'][$i]['perm']) . "\";\n";
             $permContent .= "?" . ">\n";
             $APPLICATION->SaveFileContent($permFile, $permContent);
         }
     }
     // Restore menu
     if (is_array($Params['menu']) && count($Params['menu']) > 0) {
         for ($i = 0, $l = count($Params['menu']); $i < $l; $i++) {
             $menuFile = $Params['menu'][$i]['menuFile'];
             $menuIndex = $Params['menu'][$i]['menuIndex'];
             $menuItem = $Params['menu'][$i]['menuItem'];
             $arMenu = CFileman::GetMenuArray($documentRoot . $menuFile);
             $arFound = false;
             if (count($arMenu["aMenuLinks"]) <= $menuIndex) {
                 $arMenu["aMenuLinks"][] = $menuItem;
             } else {
                 $arMenu["aMenuLinks"] = array_merge(array_slice($arMenu["aMenuLinks"], 0, $menuIndex), array($menuItem), array_slice($arMenu["aMenuLinks"], $menuIndex));
             }
             CFileMan::SaveMenu(array($Params['site'], $menuFile), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
         }
     }
     // Restore UrlRewriter
     if (is_array($Params['SEF']) && count($Params['SEF']) > 0) {
         for ($i = 0, $l = count($Params['SEF']); $i < $l; $i++) {
             CUrlRewriter::Add(array("SITE_ID" => $Params['site'], "CONDITION" => $Params['SEF'][$i]["CONDITION"], "ID" => $Params['SEF'][$i]["ID"], "PATH" => $Params['SEF'][$i]["PATH"], "RULE" => $Params['SEF'][$i]["RULE"]));
         }
     }
     $GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
 }
コード例 #10
0
ファイル: asset.php プロジェクト: ASDAFF/1C_Bitrix_info_site
 /**
  * @param array $arFile
  * @param bool $unique
  * @param string $prefix
  * @param string $setName
  * @param string $type
  * @return array
  */
 private function optimizeAsset($arFile = array(), $unique = false, $prefix = 'default', $setName = '', $type = 'css')
 {
     if (!is_array($arFile) || empty($arFile)) {
         return array('RESULT' => '', 'FILES' => array());
     }
     $this->setTemplateID();
     $res = $assetMD5 = $strFiles = $contents = '';
     $prefix = trim($prefix);
     $prefix = strlen($prefix) < 1 ? 'default' : $prefix;
     $add2End = strncmp($prefix, 'kernel', 6) == 0;
     $type = $type == 'js' ? 'js' : 'css';
     $arIEContent = array();
     /** @var bool $noCheckOnly when we cant frite files */
     $noCheckOnly = !defined('BX_HEADFILES_CACHE_CHECK_ONLY');
     $prefix = $unique ? $prefix : $prefix . '_' . $this->getAssetChecksum($arFile);
     $dbType = ToUpper(\Bitrix\Main\Application::getInstance()->getConnection()->getType());
     $documentRoot = Main\Loader::getDocumentRoot();
     $optimPath = BX_PERSONAL_ROOT . '/cache/' . $type . '/' . SITE_ID . '/' . $this->siteTemplateID . '/' . $prefix . '/';
     $infoFile = $documentRoot . BX_PERSONAL_ROOT . '/managed_cache/' . $dbType . '/' . $type . '/' . SITE_ID . '/' . $this->siteTemplateID . '/' . $prefix . '/info.php';
     $optimFile = $optimPath . $prefix . ($type == 'css' ? '.css' : '.js');
     $optimFName = $documentRoot . $optimFile;
     $cssFNameIE = $optimPath . $prefix . '#CNT#.css';
     $cssFPathIE = $documentRoot . $cssFNameIE;
     $tmpInfo = $this->isAssetChanged($arFile, $infoFile, $optimFName, $unique);
     $arFilesInfo = $tmpInfo['INFO'];
     $action = $tmpInfo['ACTION'];
     $arFile = $tmpInfo['FILE'];
     $optimFileExist = $tmpInfo['FILE_EXIST'];
     $writeResult = $action == 'NEW' ? false : true;
     if ($action != 'NO') {
         if ($type == 'css') {
             $this->fileList['CSS'][$setName]['UP_NEW_FILES'] = $tmpInfo['FILE'];
         } else {
             $this->fileList['JS'][$setName]['UP_NEW_FILES'] = $tmpInfo['FILE'];
         }
         $arFilesInfo['CUR_IE_CNT'] = intval($arFilesInfo['CUR_IE_CNT']);
         $arFilesInfo['CUR_SEL_CNT'] = intval($arFilesInfo['CUR_SEL_CNT']);
         if ($action == 'UP') {
             if ($noCheckOnly) {
                 $contents .= file_get_contents($optimFName);
                 if ($type == 'css') {
                     if ($arFilesInfo['CUR_SEL_CNT'] < self::MAX_ADD_CSS_SELECTOR) {
                         $css = str_replace('#CNT#', $arFilesInfo['CUR_IE_CNT'], $cssFPathIE);
                         if (file_exists($css)) {
                             $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= file_get_contents($css);
                             $arFilesInfo['CUR_SEL_CNT'] = $this->getCssSelectCnt($arIEContent[$arFilesInfo['CUR_IE_CNT']]);
                         }
                     } else {
                         $arFilesInfo['CUR_IE_CNT']++;
                         $arFilesInfo['CUR_SEL_CNT'] = 0;
                     }
                 }
             } else {
                 $writeResult = false;
             }
         }
         $needWrite = false;
         if ($noCheckOnly) {
             $tmpStr = '';
             foreach ($arFile as $file) {
                 $tmpContent = file_get_contents($file['FILE_PATH']);
                 if ($type == 'css') {
                     $f_cnt = $this->getCssSelectCnt($tmpContent);
                     $new_cnt = $f_cnt + $arFilesInfo['CUR_SEL_CNT'];
                     $strFiles .= "/* " . $file['PATH'] . " */\n";
                     $tmpContent = $this->fixCSSIncludes($tmpContent, $file['PATH']);
                     $tmpContent = "\n/* Start:" . $file['PATH'] . "*/\n" . $tmpContent . "\n/* End */\n";
                     if ($new_cnt < self::MAX_CSS_SELECTOR) {
                         $arFilesInfo['CUR_SEL_CNT'] = $new_cnt;
                         $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= $tmpContent;
                     } else {
                         $arFilesInfo['CUR_SEL_CNT'] = $f_cnt;
                         $arFilesInfo['CUR_IE_CNT']++;
                         $arIEContent[$arFilesInfo['CUR_IE_CNT']] .= $tmpContent;
                     }
                     $tmpStr .= "\n\n" . $tmpContent;
                 } else {
                     $strFiles .= "; /* " . $file['PATH'] . "*/\n";
                     $tmpStr .= "\n; /* Start:" . $file['PATH'] . "*/\n" . $tmpContent . "\n/* End */\n;";
                 }
                 $arFilesInfo['FILES'][$file['PATH']] = $this->getAssetTime($file['FULL_PATH']);
                 $needWrite = true;
             }
             if ($needWrite) {
                 // Write packed files and meta information
                 $contents = $add2End ? $strFiles . $contents . $tmpStr : $tmpStr . $contents . $strFiles;
                 if ($writeResult = $this->write($optimFName, $contents)) {
                     $cacheInfo = '<? $arFilesInfo = array( \'FILES\' => array(';
                     foreach ($arFilesInfo['FILES'] as $key => $time) {
                         $cacheInfo .= '"' . EscapePHPString($key) . '" => "' . $time . '",';
                     }
                     $cacheInfo .= "), 'CUR_SEL_CNT' => '" . $arFilesInfo['CUR_SEL_CNT'] . "', 'CUR_IE_CNT' => '" . $arFilesInfo['CUR_IE_CNT'] . "'); ?>";
                     $this->write($infoFile, $cacheInfo, false);
                     if ($type == 'css') {
                         foreach ($arIEContent as $key => $ieContent) {
                             $css = str_replace('#CNT#', $key, $cssFPathIE);
                             $this->write($css, $ieContent);
                         }
                     }
                 }
             } elseif ($optimFileExist) {
                 $writeResult = true;
             }
             unset($contents, $arIEContent);
         }
     }
     $label = $prefix == 'template' || substr($prefix, 0, 9) == 'template_' ? ' data-template-style="true" ' : '';
     if ($type == 'css' && $this->isIE && $writeResult) {
         for ($i = 0; $i <= $arFilesInfo['CUR_IE_CNT']; $i++) {
             $css = \CUtil::GetAdditionalFileURL(str_replace('#CNT#', $i, $cssFNameIE));
             $res .= '<link href="' . $this->cssDomain . $css . '" type="text/css" ' . ($i == 0 ? $label : '') . ' rel="stylesheet"' . ($this->xhtmlStyle ? ' /' : '') . '>' . "\n";
             $this->fileList['CSS'][$setName]['FILES'][] = $this->cssDomain . $css;
         }
     } else {
         if ($type == 'css') {
             if ($writeResult || !$writeResult && $unique && $action == 'UP') {
                 $css = \CUtil::GetAdditionalFileURL($optimFile);
                 $res .= '<link href="' . $this->cssDomain . $css . '" type="text/css" ' . $label . ' rel="stylesheet"' . ($this->xhtmlStyle ? ' /' : '') . '>' . "\n";
                 $this->fileList['CSS'][$setName]['FILES'][] = $this->cssDomain . $css;
             }
             if (!$writeResult) {
                 if ($this->isIE) {
                     $cnt = 0;
                     $resContent = '';
                     $ruleCount = 0;
                     foreach ($arFile as $file) {
                         if ($cnt < $this->maxStylesCnt) {
                             $res .= '<link href="' . $this->cssDomain . $file['FULL_PATH'] . '" ' . ($cnt == 0 ? $label : '') . ' type="text/css" rel="stylesheet"' . ($this->xhtmlStyle ? ' /' : '') . '>' . "\n";
                             $this->fileList['CSS'][$setName]['FILES'][] = $this->cssDomain . $file['FULL_PATH'];
                         } else {
                             $tmpInfo = $this->showInlineCssIE($file['FILE_PATH'], $file['FULL_PATH'], $ruleCount, true);
                             $ruleCount = $tmpInfo['CNT'];
                             $resContent .= $tmpInfo['CONTENT'];
                         }
                         $cnt++;
                     }
                     if ($resContent != '') {
                         $res .= '<style type="text/css">' . "\n" . $resContent . "\n</style>\n";
                     }
                 } else {
                     foreach ($arFile as $file) {
                         $res .= '<link href="' . $this->cssDomain . $file['FULL_PATH'] . '" type="text/css" ' . $label . ' rel="stylesheet"' . ($this->xhtmlStyle ? ' /' : '') . '>' . "\n";
                         $this->fileList['CSS'][$setName]['FILES'][] = $this->jsDomain . $file['FULL_PATH'];
                     }
                 }
             }
         } else {
             if ($writeResult || !$writeResult && $unique && $action == 'UP') {
                 $js = \CUtil::GetAdditionalFileURL($optimFile);
                 $res .= '<script type="text/javascript" src="' . $this->jsDomain . $js . '"></script>' . "\n";
                 $this->fileList['JS'][$setName]['FILES'][] = $this->jsDomain . $js;
             }
             if (!$writeResult) {
                 foreach ($arFile as $file) {
                     $res .= '<script type="text/javascript" src="' . $this->jsDomain . $file['FULL_PATH'] . '"></script>' . "\n";
                     $this->fileList['JS'][$setName]['FILES'][] = $this->jsDomain . $file['FULL_PATH'];
                 }
             }
         }
     }
     $arF = array();
     foreach ($arFilesInfo['FILES'] as $key => $time) {
         $arF[] = str_replace($documentRoot, '', $key) . '?' . $time;
     }
     unset($arFile, $arFilesInfo);
     return array('RESULT' => $res, 'FILES' => $arF);
 }
コード例 #11
0
        $errorMessage .= GetMessage("ACCESS_DENIED");
    }
    $newLicenseKey = $APPLICATION->UnJSEscape($_REQUEST["NEW_LICENSE_KEY"]);
    $newLicenseKey = preg_replace("/[^A-Za-z0-9_.-]/", "", $newLicenseKey);
    if (strlen($newLicenseKey) <= 0) {
        $errorMessage .= "[PULK01] " . GetMessage("SUP_ENTER_KEY") . ". ";
    } elseif (strtolower($newLicenseKey) == "demo") {
        $errorMessage .= "[PULK02] " . GetMessage("SUP_ENTER_CORRECT_KEY") . ". ";
    }
    if (strlen($errorMessage) <= 0) {
        if (!($fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/license_key.php", "w"))) {
            $errorMessage .= "[PULK03] " . GetMessage("SUP_CANT_OPEN_FILE") . ". ";
        }
    }
    if (strlen($errorMessage) <= 0) {
        fputs($fp, "<" . "? \$" . "LICENSE_KEY = \"" . EscapePHPString($newLicenseKey) . "\"; ?" . ">");
        fclose($fp);
        if (function_exists("accelerator_reset")) {
            accelerator_reset();
        }
        echo "Y";
    } else {
        echo $errorMessage;
    }
} elseif ($queryType == "register") {
    if (CUpdateClient::RegisterVersion($errorMessage, LANG, $stableVersionsOnly)) {
        CUpdateClient::AddMessage2Log("Registered", "UPD_SUCCESS");
        echo "Y";
    } else {
        CUpdateClient::AddMessage2Log("Error: " . $errorMessage, "UPD_ERROR");
        echo $errorMessage;
コード例 #12
0
ファイル: wizard.php プロジェクト: spas-viktor/books
 function CreateLicenseFile()
 {
     $wizard =& $this->GetWizard();
     $_1048905712 = $wizard->GetVar(___125355289(1336));
     if ($GLOBALS['____1308158154'][317]($_1048905712) < min(148, 0, 49.333333333333)) {
         $_1048905712 = ___125355289(1337);
     }
     $_932830850 = $_SERVER[___125355289(1338)] . ___125355289(1339);
     if (!($_1318943328 = @$GLOBALS['____1308158154'][318]($_932830850, ___125355289(1340)))) {
         return false;
     }
     $_1583459965 = ___125355289(1341) . ___125355289(1342) . ___125355289(1343) . EscapePHPString($_1048905712) . ___125355289(1344) . ___125355289(1345);
     if (!$GLOBALS['____1308158154'][319]($_1318943328, $_1583459965)) {
         return false;
     }
     @$GLOBALS['____1308158154'][320]($_1318943328);
     if ($this->filePermission > 1168 / 2 - 584) {
         @$GLOBALS['____1308158154'][321]($_932830850, $GLOBALS['____1308158154'][322]($this->filePermission));
     }
     return true;
 }
コード例 #13
0
 /**
  * Sets license key Bitrix CMS.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param string $licenseKey
  */
 protected function configureLicenseKey(InputInterface $input, OutputInterface $output, $licenseKey)
 {
     if (!is_string($licenseKey)) {
         throw new \InvalidArgumentException('Config "licenseKey" must be string type.');
     }
     $licenseFileContent = "<" . "? \$" . "LICENSE_KEY = \"" . EscapePHPString($licenseKey) . "\"; ?" . ">";
     File::putFileContents(Application::getDocumentRoot() . BX_ROOT . '/license_key.php', $licenseFileContent);
 }
コード例 #14
0
ファイル: site_template.php プロジェクト: spas-viktor/books
 function Update($ID, $arFields)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     if (!$this->CheckFields($arFields, $ID)) {
         return false;
     }
     $path = getLocalPath("templates/" . $ID, BX_PERSONAL_ROOT);
     if ($path === false) {
         return false;
     }
     if (isset($arFields["CONTENT"])) {
         $p = strpos($arFields["CONTENT"], "#WORK_AREA#");
         $header = substr($arFields["CONTENT"], 0, $p);
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . $path . "/header.php", $header);
         $footer = substr($arFields["CONTENT"], $p + strlen("#WORK_AREA#"));
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . $path . "/footer.php", $footer);
     }
     if (isset($arFields["STYLES"])) {
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . $path . "/styles.css", $arFields["STYLES"]);
     }
     if (isset($arFields["TEMPLATE_STYLES"])) {
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . $path . "/template_styles.css", $arFields["TEMPLATE_STYLES"]);
     }
     if (isset($arFields["NAME"]) || isset($arFields["DESCRIPTION"]) || isset($arFields["SORT"])) {
         $db_t = CSiteTemplate::GetList(array(), array("ID" => $ID), array("NAME", "DESCRIPTION", "SORT"));
         $ar_t = $db_t->Fetch();
         if (!isset($arFields["NAME"])) {
             $arFields["NAME"] = $ar_t["NAME"];
         }
         if (!isset($arFields["DESCRIPTION"])) {
             $arFields["DESCRIPTION"] = $ar_t["DESCRIPTION"];
         }
         if (!isset($arFields["SORT"])) {
             $arFields["SORT"] = $ar_t["SORT"];
         }
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . $path . "/description.php", '<' . '?' . '$arTemplate = array(' . "\n" . '	"NAME" => "' . EscapePHPString($arFields['NAME']) . '",' . "\n" . '	"DESCRIPTION" => "' . EscapePHPString($arFields['DESCRIPTION']) . '",' . "\n" . '	"SORT" => ' . (intval($arFields['SORT']) > 0 ? intval($arFields['SORT']) : '""') . ',' . "\n" . ');' . "\n" . '?' . '>');
     }
     if (isset($arFields["STYLES_DESCRIPTION"]) && is_array($arFields["STYLES_DESCRIPTION"])) {
         $str = '<' . '?' . "\nreturn array(\n";
         foreach ($arFields["STYLES_DESCRIPTION"] as $code => $val) {
             $str .= "\t\"" . EscapePHPString($code) . '" => "' . EscapePHPString($val) . "\",\n";
         }
         $str .= ");\n" . '?' . '>';
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . $path . "/.styles.php", $str);
     }
     return true;
 }
コード例 #15
0
 function UpdateCounters($member_id, $task_id = false)
 {
     global $DB, $APPLICATION;
     $member_id = intval($member_id);
     $arMember = CControllerMember::GetMember($member_id);
     if (!$arMember) {
         $e = new CApplicationException("Member #" . $member_id . " is not found.");
         $APPLICATION->ThrowException($e);
         return false;
     }
     $dbr_group = CControllerGroup::GetByID($arMember["CONTROLLER_GROUP_ID"]);
     if (!($ar_group = $dbr_group->Fetch())) {
         $e = new CApplicationException("Group #" . $arMember["CONTROLLER_GROUP_ID"] . " is not found.");
         $APPLICATION->ThrowException($e);
         return false;
     }
     $strCommand = '$arResult = array("DATE_FORMAT" => CSite::GetDateFormat());';
     if ($ar_group["CHECK_COUNTER_FREE_SPACE"] == "Y") {
         $strCommand .= "\n" . '$quota = new CDiskQuota(); $disk_quota = $quota->GetDiskQuota(); if(is_bool($disk_quota))$arResult["COUNTER_FREE_SPACE"] = -1; else $arResult["COUNTER_FREE_SPACE"] = round($disk_quota/1024, 2);';
     }
     if ($ar_group["CHECK_COUNTER_SITES"] == "Y") {
         $strCommand .= "\n" . '$dbr = CSite::GetList(($by="sort"), ($order="asc"), array("ACTIVE"=>Y)); $arResult["COUNTER_SITES"] = $dbr->SelectedRowsCount();';
     }
     if ($ar_group["CHECK_COUNTER_USERS"] == "Y") {
         $strCommand .= "\n" . '$dbr = $GLOBALS["DB"]->Query("SELECT COUNT(1) as USER_COUNT FROM b_user U WHERE (U.EXTERNAL_AUTH_ID IS NULL OR U.EXTERNAL_AUTH_ID=\'\')"); $ar = $dbr->Fetch(); $arResult["COUNTER_USERS"] = $ar["USER_COUNT"];';
     }
     if ($ar_group["CHECK_COUNTER_LAST_AUTH"] == "Y") {
         $strCommand .= "\n" . '$dbr = $GLOBALS["DB"]->Query("SELECT MAX(U.LAST_LOGIN) as LAST_LOGIN FROM b_user U"); $ar = $dbr->Fetch(); $arResult["COUNTER_LAST_AUTH"] = $ar["LAST_LOGIN"];';
     }
     $rsCounters = CControllerCounter::GetMemberCounters($member_id);
     while ($arCounter = $rsCounters->Fetch()) {
         $strCommand .= "\n" . '$arResult[' . $arCounter['ID'] . '] = eval("' . EscapePHPString($arCounter["COMMAND"]) . '");';
     }
     $strCommand .= "\n" . 'foreach($arResult as $k=>$v) echo urlencode($k),"=",urlencode($v),"&";';
     foreach (GetModuleEvents("controller", "OnBeforeUpdateCounters", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($arMember, $ar_group, &$strCommand));
     }
     $command_result = CControllerMember::RunCommand($member_id, $strCommand, array(), $task_id, 'run_immediate');
     if ($command_result === false) {
         $e = $APPLICATION->GetException();
         if (!is_object($e)) {
             $e = new CApplicationException("Command execution error.");
             $APPLICATION->ThrowException($e);
         }
         return false;
     }
     $ar_command_result = array();
     parse_str($command_result, $ar_command_result);
     //Try to guess encoding and convert to controller site charset
     foreach ($ar_command_result as $k => $v) {
         $ar_command_result[$k] = CUtil::ConvertToLangCharset($v);
     }
     $arFields = array("TIMESTAMP" => $arMember["TIMESTAMP_X"], "~COUNTERS_UPDATED" => $DB->CurrentTimeFunction());
     if (array_key_exists('COUNTER_FREE_SPACE', $ar_command_result)) {
         $arFields['COUNTER_FREE_SPACE'] = intval($ar_command_result['COUNTER_FREE_SPACE']);
     }
     if (array_key_exists('COUNTER_SITES', $ar_command_result)) {
         $arFields['COUNTER_SITES'] = intval($ar_command_result['COUNTER_SITES']);
     }
     if (array_key_exists('COUNTER_USERS', $ar_command_result)) {
         $arFields['COUNTER_USERS'] = intval($ar_command_result['COUNTER_USERS']);
     }
     if (array_key_exists('COUNTER_LAST_AUTH', $ar_command_result)) {
         $arFields['COUNTER_LAST_AUTH'] = $DB->FormatDate($ar_command_result['COUNTER_LAST_AUTH'], 'YYYY-MM-DD HH:MI:SS', CSite::GetDateFormat());
     }
     if (!CControllerMember::Update($member_id, $arFields)) {
         $e = $APPLICATION->GetException();
         $e = new CApplicationException(GetMessage("CTRLR_MEM_COUNTERS_ERR1") . $e->GetString());
         $APPLICATION->ThrowException($e);
         return false;
     }
     CControllerCounter::UpdateMemberValues($member_id, $ar_command_result);
     return $arFields;
 }
コード例 #16
0
ファイル: updater.php プロジェクト: mrdeadmouse/u136006
 /**
  * Returns escaped php code repeated for body? prefixed with $prefix and suffixed with $suffix.
  *
  * @param string $prefix Prefix string for each from body.
  * @param array|string $body Strings to be escaped.
  * @param string $suffix Suffix string for each from body.
  *
  * @return string
  */
 protected function multiLinePhp($prefix, $body, $suffix)
 {
     $result = array();
     if (is_array($body)) {
         foreach ($body as $line) {
             $result[] = $prefix . EscapePHPString($line) . $suffix;
         }
     } else {
         $result[] = $prefix . EscapePHPString($body) . $suffix;
     }
     return implode("", $result);
 }
コード例 #17
0
ファイル: main.php プロジェクト: k-kalashnikov/geekcon_new
 function Update($ID, $arFields)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     if (!$this->CheckFields($arFields, $ID)) {
         return false;
     }
     CheckDirPath($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ID);
     if (is_set($arFields, "CONTENT")) {
         $p = strpos($arFields["CONTENT"], "#WORK_AREA#");
         $header = substr($arFields["CONTENT"], 0, $p);
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ID . "/header.php", $header);
         $footer = substr($arFields["CONTENT"], $p + strlen("#WORK_AREA#"));
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ID . "/footer.php", $footer);
     }
     if (is_set($arFields, "STYLES")) {
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ID . "/styles.css", $arFields["STYLES"]);
     }
     if (is_set($arFields, "TEMPLATE_STYLES")) {
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ID . "/template_styles.css", $arFields["TEMPLATE_STYLES"]);
     }
     if (is_set($arFields, "NAME") || is_set($arFields, "DESCRIPTION")) {
         $db_t = CSiteTemplate::GetList(array(), array("ID" => $ID));
         $ar_t = $db_t->Fetch();
         if (!is_set($arFields, "NAME")) {
             $arFields["NAME"] = $ar_t["NAME"];
         }
         if (!is_set($arFields, "DESCRIPTION")) {
             $arFields["DESCRIPTION"] = $ar_t["DESCRIPTION"];
         }
         $APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ID . "/description.php", '<' . '?' . '$arTemplate = array("NAME"=>"' . EscapePHPString($arFields['NAME']) . '", "DESCRIPTION"=>"' . EscapePHPString($arFields['DESCRIPTION']) . '");' . '?' . '>');
     }
     return true;
 }
コード例 #18
0
                    echo "\t */\n";
                    echo "\tpublic static function " . $validateFunctionName . "()\n";
                    echo "\t{\n";
                    echo "\t\treturn array(\n";
                    echo "\t\t\tnew Entity\\Validator\\Length(null, " . $validator["length"] . "),\n";
                    echo "\t\t);\n";
                    echo "\t}\n";
                }
                echo "}\n";
                echo "</pre>";
                echo "File: /bitrix/modules/" . $tableParts[0] . "/lang/ru/lib/" . strtolower($className) . ".php";
                echo "<hr>";
                echo "<pre>";
                echo "&lt;", "?\n";
                foreach ($arMessages as $messageId => $messageText) {
                    echo "\$MESS[\"" . $messageId . "\"] = \"" . EscapePHPString($messageText) . "\";\n";
                }
                echo "?", "&gt;\n";
                echo "</pre>";
                break;
        }
    }
}
$lAdmin->BeginPrologContent();
?>
<h4><?php 
echo GetMessage("PERFMON_TABLES_ALL");
?>
</h4>
<script>
	hrefs = "";
コード例 #19
0
ファイル: catalog_cond.php プロジェクト: ASDAFF/entask.ru
	public static function Generate($arOneCondition, $arParams, $arControl, $arSubs = false)
	{
		$strResult = '';

		if (is_string($arControl))
		{
			$arControl = static::GetControls($arControl);
		}
		$boolError = !is_array($arControl);

		if (!$boolError)
		{
			$arValues = static::Check($arOneCondition, $arOneCondition, $arControl, false);
			$boolError = ($arValues === false);
		}

		if (!$boolError)
		{
			$boolError = !isset($arControl['MULTIPLE']);
		}

		if (!$boolError)
		{
			$arLogic = static::SearchLogic($arValues['logic'], $arControl['LOGIC']);
			if (!isset($arLogic['OP'][$arControl['MULTIPLE']]) || empty($arLogic['OP'][$arControl['MULTIPLE']]))
			{
				$boolError = true;
			}
			else
			{
				if ($arControl['PARENT'] && !isset($arLogic['PARENT']))
					$arControl['PARENT'] = false;
				$strParent = $arParams['FIELD'].'[\'PARENT_'.$arControl['FIELD'].'\']';
				$strField = $arParams['FIELD'].'[\''.$arControl['FIELD'].'\']';
				switch ($arControl['FIELD_TYPE'])
				{
					case 'int':
					case 'double':
						$strParentResult = str_replace(array('#FIELD#', '#VALUE#'), array($strParent, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
						$strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
						break;
					case 'char':
					case 'string':
					case 'text':
						$strParentResult = str_replace(array('#FIELD#', '#VALUE#'), array($strParent, '"'.EscapePHPString($arValues['value']).'"'), $arLogic['OP'][$arControl['MULTIPLE']]);
						$strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, '"'.EscapePHPString($arValues['value']).'"'), $arLogic['OP'][$arControl['MULTIPLE']]);
						break;
					case 'date':
					case 'datetime':
						$strParentResult = str_replace(array('#FIELD#', '#VALUE#'), array($strParent, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
						$strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
						if (!(BT_COND_LOGIC_EQ == $arLogic['ID'] || BT_COND_LOGIC_NOT_EQ == $arLogic['ID']))
						{
							$strParentResult = 'null !== '.$strParent.' && \'\' !== '.$strParent.' && '.$strResult;
							$strResult = 'null !== '.$strField.' && \'\' !== '.$strField.' && '.$strResult;
						}
						break;
				}
				$strResult = 'isset('.$strField.') && ('.$strResult.')';
				if ($arControl['PARENT'])
				{
					$strResult = '(isset('.$strParent.') ? (('.$strResult.')'.$arLogic['PARENT'].$strParentResult.') : ('.$strResult.'))';
				}
			}
		}

		return (!$boolError ? $strResult : false);
	}
コード例 #20
0
ファイル: options.php プロジェクト: webgksupport/alpina
     CAgent::AddAgent("CSaleOrder::RemindPayment();", "sale", "N", 86400, "", "Y");
 }
 //subscribe product
 $rsAgents = CAgent::GetList(array("ID" => "DESC"), array("MODULE_ID" => "sale", "NAME" => "CSaleBasket::ClearProductSubscribe(%"));
 while ($arAgent = $rsAgents->Fetch()) {
     CAgent::Delete($arAgent["ID"]);
 }
 if (!empty($subscribProd)) {
     foreach ($siteList as $vv) {
         $lid = $vv["ID"];
         $val = $subscribProd[$lid];
         if ($val["use"] == "Y") {
             if (IntVal($val["del_after"]) <= 0) {
                 $subscribProd[$lid]["del_after"] = 30;
             }
             CAgent::AddAgent("CSaleBasket::ClearProductSubscribe('" . EscapePHPString($lid) . "');", "sale", "N", IntVal($subscribProd[$lid]["del_after"]) * 24 * 60 * 60, "", "Y");
         }
     }
     COption::SetOptionString("sale", "subscribe_prod", serialize($subscribProd));
 }
 //viewed product
 if (!empty($viewed)) {
     foreach ($viewed as $lid => $val) {
         if (IntVal($val["time"]) <= 0) {
             $viewed[$lid]["time"] = 90;
         }
         if (IntVal($val["count"]) <= 0) {
             $viewed[$lid]["count"] = 1000;
         }
     }
     COption::SetOptionString("sale", "viewed_product", serialize($viewed));
コード例 #21
0
ファイル: template.php プロジェクト: ASDAFF/bitrix_tehnomir
	function GetContent($arParams)
	{
		//check theme
		$dir = $_SERVER["DOCUMENT_ROOT"].BX_ROOT."/components/bitrix/forum/templates/.default/themes/";
		$theme = '';
		if(is_dir($dir) && $directory = opendir($dir))
		{
			while (($file = readdir($directory)) !== false)
			{
				if ($file != "." && $file != ".." && is_dir($dir.$file) && $file == $_POST['forum_THEME'])
				{
					$theme = $_POST['forum_THEME'];
					break;
				}
			}
			closedir($directory);
		}
		
		//check forums
		$arForums = $this->CheckArray($_POST['forum_FID']);
		
		//check voting user groups
		$arGroups = $this->CheckArray($_POST['forum_VOTE_GROUP_ID']);
		
		$vote_channel = 0;
		if(IsModuleInstalled("vote") && $GLOBALS["APPLICATION"]->GetGroupRight("vote") >= "W" && $_POST['forum_SHOW_VOTE'] == 'Y')
		{
			if($_POST['forum_NEW_VOTE_CHANNEL'] == 'Y')
			{
				//new voting channel for forum
				//total bullshit - need vote module API 
				$arFields = array(
					"TIMESTAMP_X"		=> $GLOBALS['DB']->GetNowFunction(),
					"C_SORT"			=> "'100'",
					"FIRST_SITE_ID"		=> "'".$GLOBALS['DB']->ForSql($arParams['site'], 2)."'",
					"ACTIVE"			=> "'Y'",
					"VOTE_SINGLE"		=> "'N'",
					"TITLE"				=> "'".$GLOBALS['DB']->ForSql(GetMessage("forum_template_vote_name"), 255)."'",
					"SYMBOLIC_NAME"		=> "'FORUM_POLLS'",
				);
				$vote_channel = $GLOBALS['DB']->Insert("b_vote_channel", $arFields);
	
				if(VOTE_CACHE_TIME !== false) 
					$GLOBALS['CACHE_MANAGER']->CleanDir("b_vote_channel");
				
				if($vote_channel > 0)
				{
					$GLOBALS['DB']->Query("INSERT INTO b_vote_channel_2_site (CHANNEL_ID, SITE_ID) VALUES ('".$vote_channel."', '".$GLOBALS['DB']->ForSql($arParams['site'], 2)."')");
	
					if(VOTE_CACHE_TIME !== false) 
						$GLOBALS['CACHE_MANAGER']->Clean("b_vote_channel_2_site");
	
					foreach($arGroups as $group)
					{
						$arFields = array(
							"CHANNEL_ID"	=> "'".$vote_channel."'",
							"GROUP_ID"		=> "'".$group."'",
							"PERMISSION"	=> "'2'"
						);
						$GLOBALS['DB']->Insert("b_vote_channel_2_group", $arFields);
					}
	
					if(VOTE_CACHE_TIME!==false) 
						$GLOBALS['CACHE_MANAGER']->CleanDir("b_vote_perm");
				}
			}
			else
			{
				$vote_channel = intval($_POST['forum_VOTE_CHANNEL_ID']);
			}
		}

		$s = '<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
?><?$APPLICATION->IncludeComponent("bitrix:forum", ".default", array(
	"THEME" => "'.EscapePHPString($theme).'",
	"SHOW_TAGS" => "Y",
	"SHOW_AUTH_FORM" => "Y",
	"SHOW_NAVIGATION" => "Y",
	"TMPLT_SHOW_ADDITIONAL_MARKER" => "",
	"SMILES_COUNT" => "100",
	"USE_LIGHT_VIEW" => "Y",
	"FID" => array('.implode(',', $arForums).'),
	"FILES_COUNT" => "5",
	"SEF_MODE" => "Y",
	"SEF_FOLDER" => "'.EscapePHPString($arParams["path"]).'",
	"CACHE_TYPE" => "A",
	"CACHE_TIME" => "3600",
	"CACHE_TIME_USER_STAT" => "60",
	"FORUMS_PER_PAGE" => "15",
	"TOPICS_PER_PAGE" => "10",
	"MESSAGES_PER_PAGE" => "3",
	"TIME_INTERVAL_FOR_USER_STAT" => "10",
	"IMAGE_SIZE" => "500",
	"SET_TITLE" => "Y",
	"USE_RSS" => "Y",
	"RSS_COUNT" => "30",
	"SHOW_VOTE" => "'.($_POST['forum_SHOW_VOTE'] == 'Y' && $vote_channel > 0? 'Y':'N').'",
	"VOTE_CHANNEL_ID" => "'.$vote_channel.'",
	"VOTE_GROUP_ID" => array('.implode(',', $arGroups).'),
	"VOTE_TEMPLATE" => "light",
	"SHOW_SUBSCRIBE_LINK" => "N",
	"SHOW_LEGEND" => "Y",
	"SHOW_STATISTIC_BLOCK" => array(
		0 => "STATISTIC",
		1 => "BIRTHDAY",
		2 => "USERS_ONLINE"),
	"SHOW_NAME_LINK" => "Y",
	"SHOW_FORUMS" => "Y",
	"SHOW_FIRST_POST" => "N",
	"SHOW_AUTHOR_COLUMN" => "N",
	"PATH_TO_SMILE" => "/bitrix/images/forum/smile/",
	"PATH_TO_ICON" => "/bitrix/images/forum/icon/",
	"PAGE_NAVIGATION_TEMPLATE" => "forum",
	"PAGE_NAVIGATION_WINDOW" => "5",
	"WORD_WRAP_CUT" => "23",
	"WORD_LENGTH" => "50",
	"SEO_USER" => "N",
	"USER_PROPERTY" => array(),
	"HELP_CONTENT" => "",
	"RULES_CONTENT" => "",
	"CHECK_CORRECT_PATH_TEMPLATES" => "Y",
	"RSS_CACHE" => "1800",
	"PATH_TO_AUTH_FORM" => "",
	"DATE_FORMAT" => "d.m.Y",
	"DATE_TIME_FORMAT" => "d.m.Y H:i:s",
	"SEND_MAIL" => "E",
	"SEND_ICQ" => "A",
	"SET_NAVIGATION" => "Y",
	"SET_PAGE_PROPERTY" => "Y",
	"DISPLAY_PANEL" => "N",
	"SHOW_FORUM_ANOTHER_SITE" => "Y",
	"RSS_TYPE_RANGE" => array("RSS2"),
	"RSS_TN_TITLE" => "",
	"RSS_TN_DESCRIPTION" => "",
	"VOTE_COUNT_QUESTIONS" => "10",
	"VOTE_COUNT_ANSWERS" => "20",
	"SEF_URL_TEMPLATES" => array(
		"index" => "'.EscapePHPString($arParams["file"]).'",
		"list" => "forum#FID#/",
		"read" => "forum#FID#/topic#TID#/",
		"message" => "messages/forum#FID#/topic#TID#/message#MID#/",
		"help" => "help/",
		"rules" => "rules/",
		"message_appr" => "messages/approve/forum#FID#/topic#TID#/",
		"message_move" => "messages/move/forum#FID#/topic#TID#/message#MID#/",
		"pm_list" => "pm/folder#FID#/",
		"pm_edit" => "pm/folder#FID#/message#MID#/user#UID#/#mode#/",
		"pm_read" => "pm/folder#FID#/message#MID#/",
		"pm_search" => "pm/search/",
		"pm_folder" => "pm/folders/",
		"rss" => "rss/#TYPE#/#MODE#/#IID#/",
		"search" => "search/",
		"subscr_list" => "subscribe/",
		"active" => "topic/new/",
		"topic_move" => "topic/move/forum#FID#/topic#TID#/",
		"topic_new" => "topic/add/forum#FID#/",
		"topic_search" => "topic/search/",
		"user_list" => "users/",
		"profile" => "user/#UID#/edit/",
		"profile_view" => "user/#UID#/",
		"user_post" => "user/#UID#/post/#mode#/",
		"message_send" => "user/#UID#/send/#TYPE#/",
	)
	),
	false
);?><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>';
		return $s;
	}
コード例 #22
0
ファイル: bitrixsetup.php プロジェクト: alex19pov31/webenv
	</table>';
    $ar = array('FORM' => $form, 'TITLE' => LoaderGetMessage("LOADER_TITLE"), 'HEAD' => LoaderGetMessage("LOADER_MENU_LIST"), 'TEXT' => $txt, 'TEXT_ALIGN' => 'top', 'BOTTOM' => (file_exists($_SERVER['DOCUMENT_ROOT'] . '/index.php') ? '<input type="button" value="&nbsp;&nbsp;&nbsp;' . LoaderGetMessage("LOADER_BACK") . '&nbsp;&nbsp;&nbsp;" onclick="document.location=\'/index.php?lang=' . LANG . '\'">&nbsp;' : '') . '<input type="submit" value="&nbsp;&nbsp;&nbsp;' . LoaderGetMessage("LOADER_NEW_LOAD") . '&nbsp;&nbsp;&nbsp;" id="download_button" disabled>');
    /*************************************************/
} elseif ($strAction == "LOAD") {
    /*********************************************************************/
    if (LANG == "ru") {
        $site = "http://www.1c-bitrix.ru/";
    } else {
        $site = "http://www.bitrixsoft.com/";
    }
    if ($_REQUEST['licence_type'] == 'src' || $_REQUEST['LICENSE_KEY']) {
        $path = 'private/download/';
        $suffix = '_source.tar.gz';
        @mkdir($_SERVER['DOCUMENT_ROOT'] . '/bitrix');
        $fres = @fopen($_SERVER['DOCUMENT_ROOT'] . '/bitrix/license_key.php', 'wb');
        @fwrite($fres, '<' . '? $LICENSE_KEY = "' . EscapePHPString($_REQUEST['LICENSE_KEY']) . '"; ?' . '>') && fclose($fres);
    } else {
        @unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/license_key.php');
        $path = 'download/';
        if (version_compare(phpversion(), '5.0.0') == -1) {
            $suffix = '_encode_php4.tar.gz';
        } else {
            $suffix = '_encode_php5.tar.gz';
        }
    }
    $ED = $arEditions[LANG][$_REQUEST['edition']];
    if (is_array($ED['LIST'])) {
        $url = $_REQUEST['url'];
    } else {
        $url = $ED['LIST'];
    }
コード例 #23
0
ファイル: translate_edit.php プロジェクト: ASDAFF/entask.ru
			$arTEXT = array();
			foreach ($KEYS as $k)
			{
				$ms_key = $k;
				$ms_del = ${"DEL_".$k}=="Y" ? "Y" : "N";
				if (is_array($LANGS))
				{
					foreach ($LANGS as $lng)
					{
						$ms_lang = $lng;
						$ms_value = ${$k."_".$lng};
						$ms_value_prev = ${$k."_".$lng."_PREV"};
						if ($ms_del!="Y" && strlen($ms_value)>0)
						{
							$arTEXT[$arLangFiles[$ms_lang]][] = "\$MESS[\"".EscapePHPString($k)."\"] = \"".
								EscapePHPString(str_replace("\r", "", $ms_value))."\"";
						}
						elseif (strlen($ms_value_prev)>0)
						{
							$arTEXT[$arLangFiles[$ms_lang]][] = "";
						}
					}
				}
			}

			// collect all the variables and write to files
			while (list($fpath, $arM)=each($arTEXT))
			{
				$strContent = "";
				foreach ($arM as $M)
				{
コード例 #24
0
 function PHP2PHP($var)
 {
     if (is_array($var)) {
         $res = "array(\n";
         foreach ($var as $k => $v) {
             $res .= $this->PHP2PHP($k) . " => " . $this->PHP2PHP($v) . ",\n";
         }
         $res .= ")";
     } elseif (is_null($var)) {
         $res = 'null';
     } elseif (is_int($var)) {
         $res = $var;
     } elseif (is_double($var)) {
         $res = $var;
     } elseif (is_bool($var)) {
         $res = $var ? 'true' : 'false';
     } else {
         $res = '"' . EscapePHPString($var) . '"';
     }
     return $res;
 }
コード例 #25
0
ファイル: urlrewriter.php プロジェクト: ASDAFF/entask.ru
 function printArray($arr)
 {
     $output = "\$arUrlRewrite = array(\n";
     foreach ($arr as $val) {
         $output .= "\tarray(\n";
         foreach ($val as $key1 => $val1) {
             $output .= "\t\t\"" . EscapePHPString($key1) . "\" => \"" . EscapePHPString($val1) . "\",\n";
         }
         $output .= "\t),\n";
     }
     $output .= ");\n";
     return $output;
 }
コード例 #26
0
ファイル: sale_act.php プロジェクト: DarneoStudio/bitrix
 public static function Generate($arOneCondition, $arParams, $arControl, $arSubs = false)
 {
     $strResult = '';
     $resultValues = array();
     $arValues = false;
     if (is_string($arControl)) {
         $arControl = static::GetControls($arControl);
     }
     $boolError = !is_array($arControl);
     if (!$boolError) {
         $arValues = static::Check($arOneCondition, $arOneCondition, $arControl, false);
         $boolError = $arValues === false;
     }
     if (!$boolError) {
         $arLogic = static::SearchLogic($arValues['logic'], $arControl['LOGIC']);
         if (!isset($arLogic['OP'][$arControl['MULTIPLE']]) || empty($arLogic['OP'][$arControl['MULTIPLE']])) {
             $boolError = true;
         } else {
             $strField = $arParams['BASKET_ROW'] . '[\'CATALOG\'][\'' . $arControl['FIELD'] . '\']';
             switch ($arControl['FIELD_TYPE']) {
                 case 'int':
                 case 'double':
                     if (is_array($arValues['value'])) {
                         if (!isset($arLogic['MULTI_SEP'])) {
                             $boolError = true;
                         } else {
                             foreach ($arValues['value'] as &$value) {
                                 $resultValues[] = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $value), $arLogic['OP'][$arControl['MULTIPLE']]);
                             }
                             unset($value);
                             $strResult = '(' . implode($arLogic['MULTI_SEP'], $resultValues) . ')';
                             unset($resultValues);
                         }
                     } else {
                         $strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
                     }
                     break;
                 case 'char':
                 case 'string':
                 case 'text':
                     if (is_array($arValues['value'])) {
                         $boolError = true;
                     } else {
                         $strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, '"' . EscapePHPString($arValues['value']) . '"'), $arLogic['OP'][$arControl['MULTIPLE']]);
                     }
                     break;
                 case 'date':
                 case 'datetime':
                     if (is_array($arValues['value'])) {
                         $boolError = true;
                     } else {
                         $strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
                     }
                     break;
             }
             $strResult = '(isset(' . $arParams['BASKET_ROW'] . '[\'CATALOG\']) && isset(' . $strField . ') && ' . $strResult . ')';
         }
     }
     return !$boolError ? $strResult : false;
 }
コード例 #27
0
ファイル: include.php プロジェクト: DarneoStudio/bitrix
function GetDefaultProlog($title)
{
    return "<" . "?\n" . "require(\$_SERVER[\"DOCUMENT_ROOT\"].\"/bitrix/modules/main/include/prolog_before.php\");\n" . "\$APPLICATION->SetTitle(\"" . EscapePHPString($title) . "\");\n" . "require(\$_SERVER[\"DOCUMENT_ROOT\"].\"/bitrix/modules/main/include/prolog_after.php\");\n" . "?" . ">\n";
}
コード例 #28
0
ファイル: php_parser.php プロジェクト: rasuldev/torino
 public static function ReturnPHPStr2($arVals, $arParams = array())
 {
     $res = "";
     foreach ($arVals as $key => $val) {
         $res .= "\t\t\"" . EscapePHPString($key) . "\" => ";
         $comm = $arParams[$key]["NAME"] != '' ? "\t// " . $arParams[$key]["NAME"] : "";
         $res .= PHPParser::ReturnPHPStrRec($val, 1, $comm);
     }
     return trim($res, " \t,\r\n");
 }
コード例 #29
0
ファイル: sale_cond.php プロジェクト: akniyev/arteva.ru
	public static function Generate($arOneCondition, $arParams, $arControl, $arSubs = false)
	{
		$strResult = '';

		if (is_string($arControl))
		{
			$arControl = static::GetControls($arControl);
		}
		$boolError = !is_array($arControl);

		if (!$boolError)
		{
			$arValues = static::Check($arOneCondition, $arOneCondition, $arControl, false);
			$boolError = (false === $arValues);
		}

		if (!$boolError)
		{
			$arLogic = static::SearchLogic($arValues['logic'], $arControl['LOGIC']);
			if (!isset($arLogic['OP'][$arControl['MULTIPLE']]) || empty($arLogic['OP'][$arControl['MULTIPLE']]))
			{
				$boolError = true;
			}
			else
			{
				$boolMulti = false;
				if (isset($arControl['JS_VALUE']['multiple']) && 'Y' == $arControl['JS_VALUE']['multiple'])
				{
					$boolMulti = true;
					$strJoinOperator = (isset($arLogic['MULTI_SEP']) ? $arLogic['MULTI_SEP'] : ' && ');
				}
				$strField = $arParams['ORDER'].'[\''.$arControl['FIELD'].'\']';
				switch ($arControl['FIELD_TYPE'])
				{
					case 'int':
					case 'double':
						if (!$boolMulti)
						{
							$strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
						}
						else
						{
							$arResult = array();
							foreach ($arValues['value'] as &$mxValue)
							{
								$arResult[] = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $mxValue), $arLogic['OP'][$arControl['MULTIPLE']]);
							}
							if (isset($mxValue))
								unset($mxValue);
							$strResult = '(('.implode(')'.$strJoinOperator.'(', $arResult).'))';
						}
						break;
					case 'char':
					case 'string':
					case 'text':
						if (!$boolMulti)
						{
							$strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, '"'.EscapePHPString($arValues['value']).'"'), $arLogic['OP'][$arControl['MULTIPLE']]);
						}
						else
						{
							$arResult = array();
							foreach ($arValues['value'] as &$mxValue)
							{
								$arResult[] = str_replace(array('#FIELD#', '#VALUE#'), array($strField, '"'.EscapePHPString($mxValue).'"'), $arLogic['OP'][$arControl['MULTIPLE']]);
							}
							if (isset($mxValue))
								unset($mxValue);
							$strResult = '(('.implode(')'.$strJoinOperator.'(', $arResult).'))';
						}
						break;
					case 'date':
					case 'datetime':
						if (!$boolMulti)
						{
							$strResult = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $arValues['value']), $arLogic['OP'][$arControl['MULTIPLE']]);
						}
						else
						{
							$arResult = array();
							foreach ($arValues['value'] as &$mxValue)
							{
								$arResult[] = str_replace(array('#FIELD#', '#VALUE#'), array($strField, $mxValue), $arLogic['OP'][$arControl['MULTIPLE']]);
							}
							if (isset($mxValue))
								unset($mxValue);
							$strResult = '(('.implode(')'.$strJoinOperator.'(', $arResult).'))';
						}
						break;
				}
				$strResult = 'isset('.$strField.') && '.$strResult;
			}
		}

		return (!$boolError ? $strResult : false);
	}
コード例 #30
0
function UpdateActivateCoupon($coupon, &$errorMessage)
{
    global $MESS;
    $postDataString = "coupon=" . urlencode($coupon) . "&query_type=" . urlencode("reincarnate");
    $content = UpdateGetHTTPPage($postDataString, $errorMessage);
    if (strlen($content) <= 0) {
        $errorMessage .= $MESS['ERROR_EMPTY_CONTENT'] . ". ";
        return false;
    }
    $arContent = UpdateParseServerData($content, $errorMessage);
    if (!is_array($arContent) || count($arContent) <= 0) {
        if (strlen($errorMessage) <= 0) {
            $errorMessage .= $MESS['ERROR_INVALID_CONTENT'] . ". ";
        }
        return false;
    }
    UpdateSetOption('~SAAS_MODE', "Y");
    UpdateSetOption('admin_passwordh', $arContent["V1"]);
    if (is_writable($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/admin/define.php")) {
        if ($fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/admin/define.php", 'w')) {
            fwrite($fp, "<" . "?Define(\"TEMPORARY_CACHE\", \"" . $arContent["V2"] . "\");?" . ">");
            fclose($fp);
        } else {
            $errorMessage .= $MESS['ERROR_NOT_FOPEN'] . ". ";
        }
    } else {
        $errorMessage .= $MESS['ERROR_NOT_WRITABLE'] . ". ";
    }
    if (isset($arContent["DATE_TO_SOURCE"])) {
        UpdateSetOption("~support_finish_date", $arContent["DATE_TO_SOURCE"]);
    }
    if (isset($arContent["MAX_SITES"])) {
        UpdateSetOption("PARAM_MAX_SITES", intval($arContent["MAX_SITES"]));
    }
    if (isset($arContent["MAX_USERS"])) {
        UpdateSetOption("PARAM_MAX_USERS", intval($arContent["MAX_USERS"]));
    }
    if (isset($arContent["ISLC"])) {
        if (is_writable($_SERVER['DOCUMENT_ROOT'] . "/bitrix/license_key.php")) {
            if ($fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/bitrix/license_key.php", "wb")) {
                fputs($fp, '<' . '?$LICENSE_KEY = "' . EscapePHPString($coupon) . '";?' . '>');
                fclose($fp);
            } else {
                $errorMessage .= $MESS['ERROR_NOT_FOPEN'] . ". ";
            }
        } else {
            $errorMessage .= $MESS['ERROR_NOT_WRITABLE'] . ". ";
        }
    }
    return true;
}