本文整理汇总了PHP中CheckDirPath函数的典型用法代码示例。如果您正苦于以下问题:PHP CheckDirPath函数的具体用法?PHP CheckDirPath怎么用?PHP CheckDirPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckDirPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: receiveFiles
protected function receiveFiles()
{
$result = array();
$timeToKeepFiles = 24;
$tmpDir = \CTempFile::GetDirectoryName($timeToKeepFiles);
CheckDirPath($tmpDir);
$sftp = \Bitrix\Sale\TradingPlatform\Ebay\Helper::getSftp($this->siteId);
$sftp->connect();
/*
$orderFiles = $sftp->getFilesList($this->remotePath);
foreach($orderFiles as $file)
{
if($sftp->downloadFile($this->remotePath."/".$file, $tmpDir.$file))
{
$result[] = $tmpDir.$file;
Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_SOURCE_ORDERFILE_RECEIVED", $file, "File received successfully.", $this->siteId);
}
}
*/
$file = "orderLatest";
if ($sftp->downloadFile($this->orderLatest, $tmpDir . $file)) {
$result[] = $tmpDir . $file;
Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_SOURCE_ORDERFILE_RECEIVED", $file, "File received successfully.", $this->siteId);
}
return $result;
}
示例2: GetReportsList
function GetReportsList($strPath2Export)
{
$arReports = array();
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . $strPath2Export);
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"] . $strPath2Export)) {
while (($file = readdir($handle)) !== false) {
if ($file == "." || $file == "..") {
continue;
}
if (is_file($_SERVER["DOCUMENT_ROOT"] . $strPath2Export . $file) && substr($file, strlen($file) - 8) == "_run.php") {
$export_name = substr($file, 0, strlen($file) - 8);
$rep_title = $export_name;
$file_handle = fopen($_SERVER["DOCUMENT_ROOT"] . $strPath2Export . $file, "rb");
$file_contents = fread($file_handle, 1500);
fclose($file_handle);
$arMatches = array();
if (preg_match("#<title[\\s]*>([^<]*)</title[\\s]*>#i", $file_contents, $arMatches)) {
$arMatches[1] = Trim($arMatches[1]);
if (strlen($arMatches[1]) > 0) {
$rep_title = $arMatches[1];
}
}
$arReports[$export_name] = array("PATH" => $strPath2Export, "FILE_RUN" => $strPath2Export . $file, "TITLE" => $rep_title);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . $strPath2Export . $export_name . "_setup.php")) {
$arReports[$export_name]["FILE_SETUP"] = $strPath2Export . $export_name . "_setup.php";
}
}
}
}
closedir($handle);
return $arReports;
}
示例3: CronRun
public static function CronRun($profileID, $in_cron = "N")
{
define("path2export", "/bitrix/php_interface/include/catalog_export/");
$pr = CProfileAdmin::GetByID($profileID)->Fetch();
$cron_period = intval($pr['PERIOD']);
$cron_period = $cron_period <= 0 ? 86400 : $cron_period;
$data = date("d.m.Y H:i:s", $pr['DATA_START']);
$d = explode(" ", $data);
$t = explode(":", $d[1]);
$cron_hour = intval($t[0]);
$cron_minute = intval($t[1]);
$cron_hour = $cron_hour <= 0 ? 0 : $cron_hour;
$cron_minute = $cron_minute <= 0 ? 0 : $cron_minute;
$cron_php_path = COption::GetOptionString("acrit.googlemerchant", "php_path");
$cron_php_path = strlen($cron_php_path) > 0 ? $cron_php_path : getPHPExecutableFromPath();
if (file_exists($_SERVER["DOCUMENT_ROOT"] . path2export . "acrit_gm_cron.php")) {
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . path2export);
$tmp_file_size = filesize($_SERVER["DOCUMENT_ROOT"] . path2export . "acrit_gm_cron.php");
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . path2export . "acrit_gm_cron.php", "rb");
$tmp_data = fread($fp, $tmp_file_size);
fclose($fp);
$tmp_data = str_replace("#DOCUMENT_ROOT#", $_SERVER["DOCUMENT_ROOT"], $tmp_data);
$tmp_data = str_replace("#PHP_PATH#", $cron_php_path, $tmp_data);
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . path2export . "acrit_gm_cron.php", "w+");
fwrite($fp, $tmp_data);
fclose($fp);
}
$cfg_data = "";
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg")) {
$cfg_file_size = filesize($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg");
$cfg_file_size = $cfg_file_size != 0 ? $cfg_file_size : 1;
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "rb");
$cfg_data = fread($fp, $cfg_file_size);
fclose($fp);
}
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . path2export . "logs/");
if ($in_cron == "Y") {
$cfg_data = preg_replace("#^.*?" . preg_quote(path2export) . "acrit_gm_cron.php " . $profileID . " *>.*?\$#im", "", $cfg_data);
} else {
if ($cron_period > 0) {
$strTime = "0 */" . $cron_period . " * * * ";
} else {
$strTime = intval($cron_minute) . " " . intval($cron_hour) . " * * * ";
}
if (strlen($cfg_data) > 0) {
$cfg_data .= "\n";
}
$cfg_data = preg_replace("#^.*?" . preg_quote(path2export) . "acrit_gm_cron.php " . $profileID . " *>.*?\$#im", "", $cfg_data);
$cfg_data .= $strTime . $cron_php_path . " -f " . $_SERVER["DOCUMENT_ROOT"] . path2export . "acrit_gm_cron.php " . $profileID . " >" . $_SERVER["DOCUMENT_ROOT"] . path2export . "logs/" . $profileID . ".txt\n";
}
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/");
$cfg_data = preg_replace("#[\r\n]{2,}#im", "\n", $cfg_data);
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "wb");
fwrite($fp, $cfg_data);
fclose($fp);
$arRetval = array();
@exec("crontab " . $_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", $arRetval, $return_var);
}
示例4: __form_CopyFiles
function __form_CopyFiles($source_abs, $target, $bReWriteAdditionalFiles = false, $search = false, $replace = false)
{
$source_base = dirname(__FILE__);
//$source_abs = $source_base.$source;
$target_abs = $_SERVER['DOCUMENT_ROOT'] . $target;
if (file_exists($source_abs) && is_dir($source_abs)) {
//Create target directory
CheckDirPath($target_abs);
$dh = opendir($source_abs);
//Read the source
while ($file = readdir($dh)) {
if ($file == "." || $file == "..") {
continue;
}
$target_file = $target_abs . $file;
if ($bReWriteAdditionalFiles || !file_exists($target_file)) {
//Here we will write public data
$source_file = $source_abs . $file;
if (is_dir($source_file)) {
continue;
}
$fh = fopen($source_file, "rb");
$php_source = fread($fh, filesize($source_file));
fclose($fh);
//Replace real IDs
if (is_array($search) && is_array($replace)) {
$php_source = str_replace($search, $replace, $php_source);
}
//Parse GetMessage("MESSAGE_ID") with double quotes
if (preg_match_all('/GetMessage\\("(.*?)"\\)/', $php_source, $matches)) {
//Include LANGUAGE_ID file
//__IncludeLang(GetLangFileName($source_base."/lang/", $source.$file));
//Substite the stuff
foreach ($matches[0] as $i => $text) {
$php_source = str_replace($text, '"' . GetMessage($matches[1][$i]) . '"', $php_source);
}
}
//Parse GetMessage('MESSAGE_ID') with single quotes
//embedded html
if (preg_match_all('/GetMessage\\(\'(.*?)\'\\)/', $php_source, $matches)) {
//Include LANGUAGE_ID file
//__IncludeLang(GetLangFileName($source_base."/lang/", $source.$file));
//Substite the stuff
foreach ($matches[0] as $i => $text) {
$php_source = str_replace($text, GetMessage($matches[1][$i]), $php_source);
}
}
//Write to the destination directory
$fh = fopen($target_file, "wb");
fwrite($fh, $php_source);
fclose($fh);
@chmod($target_file, BX_FILE_PERMISSIONS);
}
}
}
}
示例5: __construct
public function __construct($sXmlDataFile)
{
$this->sDir = $_SERVER["DOCUMENT_ROOT"] . $this->sRelDir;
CheckDirPath($this->sDir);
$this->sXmlDataFile = $this->sDir . $sXmlDataFile;
if (intval(ini_get('max_execution_time')) > 0) {
$this->iMax_exec_time = ini_get('max_execution_time') * 0.9;
} else {
$this->iMax_exec_time = 160;
}
}
示例6: Download
function Download($url, $file)
{
CheckDirPath($file);
$this->fp = fopen($file, "wb");
if (is_resource($this->fp)) {
$res = $this->HTTPQuery('GET', $url);
fclose($this->fp);
unset($this->fp);
return $res && $this->status == 200;
}
return false;
}
示例7: __CopyForumFiles
function __CopyForumFiles($source_abs, $target_abs, $bReWriteAdditionalFiles = true, $arParams = array())
{
$source_base = dirname(__FILE__);
$source_base = str_replace(array("\\", "//"), "/", $source_base . "/");
$source_abs = str_replace(array("\\", "//"), "/", $source_abs . "/");
$target_abs = str_replace(array("\\", "//"), "/", $target_abs . "/");
$source = substr($source_abs, strLen($source_base));
$source = str_replace("//", "/", "/" . $source . "/");
$arParams = is_array($arParams) ? $arParams : array();
if (file_exists($source_abs)) {
//Create target directory
CheckDirPath($target_abs);
$dh = opendir($source_abs);
//Read the source
while ($file = readdir($dh)) {
if ($file == "." || $file == "..") {
continue;
}
if (is_dir($source_abs . $file)) {
__CopyForumFiles($source_abs . $file, $target_abs . $file, $bReWriteAdditionalFiles);
} else {
$target_file = $target_abs . $file;
if ($bReWriteAdditionalFiles || !file_exists($target_file)) {
//Here we will write public data
$source_file = $source_abs . $file;
$fh = fopen($source_file, "rb");
$php_source = fread($fh, filesize($source_file));
fclose($fh);
$arParamsForReplace = array();
foreach ($arParams as $key => $val) {
$arParamsForReplace["#" . $key . "#"] = $val;
}
$php_source = str_replace(array_keys($arParamsForReplace), $arParamsForReplace, $php_source);
//Parse localization
if (preg_match_all('/GetMessage\\("(.*?)"\\)/', $php_source, $matches)) {
//Include LANGUAGE_ID file
$path = $source_base . "lang/" . LANGUAGE_ID . $source . $file;
__IncludeLang($path);
//Substite the stuff
foreach ($matches[0] as $i => $text) {
$php_source = str_replace($text, '"' . GetMessage($matches[1][$i]) . '"', $php_source);
}
}
//Write to the destination directory
$fh = fopen($target_file, "wb");
fwrite($fh, $php_source);
fclose($fh);
@chmod($target_file, BX_FILE_PERMISSIONS);
}
}
}
}
}
示例8: SavePreviewContent
function SavePreviewContent($abs_path, $strContent)
{
CheckDirPath($abs_path);
$fd = fopen($abs_path, "wb");
if (is_resource($fd)) {
$result = fwrite($fd, $strContent);
fclose($fd);
chmod($abs_path, BX_FILE_PERMISSIONS);
return $result > 0;
} else {
return false;
}
}
示例9: DoInstall
public function DoInstall()
{
if (!check_bitrix_sessid()) {
return false;
}
$modPath = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/components";
$comPath = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components";
CopyDirFiles($modPath, $comPath, true, true);
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/maxposter/", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $this->MODULE_ID . "/install/images", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/maxposter", true, true);
RegisterModule($this->MODULE_ID);
LocalRedirect("settings.php?lang=" . LANGUAGE_ID . '&mid=' . $this->MODULE_ID);
return true;
}
示例10: __bx_share_get_handlers
function __bx_share_get_handlers($template = false)
{
if (trim($template) == ".default") {
$template = "";
}
$arBookmarkHandlerDropdown = array();
$arBookmarkHandlerDropdownDefault = array();
$shareComponent = new CBitrixComponent();
$shareComponent->InitComponent("bitrix:main.share", $template);
$shareComponent->InitComponentTemplate($template);
if (strlen($shareComponent->__template->__folder) > 0) {
$path2Handlers = $_SERVER["DOCUMENT_ROOT"] . "/" . $shareComponent->__template->__folder . "/handlers/";
CheckDirPath($path2Handlers);
$arHandlers = array();
if ($handle = opendir($path2Handlers)) {
while (($file = readdir($handle)) !== false) {
if ($file == "." || $file == "..") {
continue;
}
if (is_file($path2Handlers . $file) && strtoupper(substr($file, strlen($file) - 4)) == ".PHP") {
$name = $title = $icon_url_template = "";
$sort = 0;
include $path2Handlers . $file;
if (strlen($name) > 0) {
$arHandlers[$name] = array("TITLE" => $title, "ICON" => $icon_url_template, "SORT" => intval($sort));
}
}
}
}
foreach ($arHandlers as $name => $arSystem) {
if (strlen($arSystem["TITLE"]) > 0) {
$arBookmarkHandlerDropdown[$name] = $arSystem["TITLE"];
}
}
$arBookmarkHandlerDropdownTmp = $arBookmarkHandlerDropdown;
if (LANGUAGE != 'ru') {
if (array_key_exists("vk", $arBookmarkHandlerDropdownTmp)) {
unset($arBookmarkHandlerDropdownTmp["vk"]);
}
if (array_key_exists("mailru", $arBookmarkHandlerDropdownTmp)) {
unset($arBookmarkHandlerDropdownTmp["mailru"]);
}
}
$arBookmarkHandlerDropdownDefault = array_keys($arBookmarkHandlerDropdownTmp);
}
return array("HANDLERS" => $arBookmarkHandlerDropdown, "HANDLERS_DEFAULT" => $arBookmarkHandlerDropdownDefault);
}
示例11: testCanTOpenFile
public function testCanTOpenFile()
{
$bSuccess = CheckDirPath(self::$_docRoot . '/bitrix/tmp/obx.core/', BX_DIR_PERMISSIONS);
//umask(0777^BX_DIR_PERMISSIONS);
rmdir(self::$_docRoot . '/bitrix/tmp/obx.core/testPrivateDir');
$bSuccess = mkdir(self::$_docRoot . '/bitrix/tmp/obx.core/testPrivateDir', 00);
$this->assertTrue($bSuccess);
$exceptionCode = null;
try {
new LogFile('UnitTest testPermDenied()', '/bitrix/tmp/obx.core/testPrivateDir/test_log_file.log');
} catch (LogFileError $e) {
$exceptionCode = $e->getCode();
}
$this->assertEquals(LogFileError::E_CANT_OPEN, $exceptionCode);
chmod(self::$_docRoot . '/bitrix/tmp/obx.core/testPrivateDir', 0777);
rmdir(self::$_docRoot . '/bitrix/tmp/obx.core/testPrivateDir');
}
示例12: saveEntityClass
public function saveEntityClass($path = null)
{
if (empty($path)) {
$path = $this->config->getClassPath();
}
Tools::_fixFilePath($path);
if ('/' != substr($path, 0, 1)) {
$path = '/bitrix/modules/' . $this->config->getModuleID() . '/' . $path;
}
if (!CheckDirPath(OBX_DOC_ROOT . $path)) {
throw new Err('', Err::E_CLASS_SAVE_FAILED);
}
if (false === file_put_contents(OBX_DOC_ROOT . $path, $this->phpClass->generateClass())) {
return false;
}
return true;
}
示例13: OBX_CopyDirFilesEx
function OBX_CopyDirFilesEx($path_from, $path_to, $ReWrite = True, $Recursive = False, $bDeleteAfterCopy = False, $strExclude = "")
{
$path_from = str_replace(array("\\", "//"), "/", $path_from);
$path_to = str_replace(array("\\", "//"), "/", $path_to);
if (is_file($path_from) && !is_file($path_to)) {
if (CheckDirPath($path_to)) {
$file_name = substr($path_from, strrpos($path_from, "/") + 1);
$path_to .= $file_name;
return CopyDirFiles($path_from, $path_to, $ReWrite, $Recursive, $bDeleteAfterCopy, $strExclude);
}
}
if (is_dir($path_from) && substr($path_to, strlen($path_to) - 1) == "/") {
$folderName = substr($path_from, strrpos($path_from, "/") + 1);
$path_to .= $folderName;
}
return CopyDirFiles($path_from, $path_to, $ReWrite, $Recursive, $bDeleteAfterCopy, $strExclude);
}
示例14: InstallFiles
function InstallFiles()
{
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/bitrix/webservice.checkauth");
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/bitrix/webservice.server");
//CheckDirPath($_SERVER["DOCUMENT_ROOT"]."/ws");
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webservice/install/components/bitrix/webservice.checkauth", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/bitrix/webservice.checkauth", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webservice/install/components/bitrix/webservice.server", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/bitrix/webservice.server", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webservice/install/components/bitrix/webservice.statistic", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/bitrix/webservice.statistic", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webservice/install/tools", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/tools", true, true);
/*
CopyDirFiles(
$_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/webservice/install/ws",
$_SERVER["DOCUMENT_ROOT"]."/ws",
false);
*/
return true;
}
示例15: InstallFiles
function InstallFiles()
{
if ($_ENV["COMPUTERNAME"] != 'BX') {
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/admin", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/admin");
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/components", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/components", true, true);
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/images", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/images/catalog", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/catalog/install/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/catalog/install/panel", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/panel", true, true);
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/themes", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/themes", true, true);
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/tools", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/tools", true, true);
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/public/catalog_import", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/php_interface/include/catalog_import");
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/public/catalog_export", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/php_interface/include/catalog_export");
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/public/catalog_export/froogle_util.php", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/tools/catalog_export/froogle_util.php");
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/public/catalog_export/yandex_util.php", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/tools/catalog_export/yandex_util.php");
CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/public/catalog_export/yandex_detail.php", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/tools/catalog_export/yandex_detail.php");
CheckDirPath($_SERVER['DOCUMENT_ROOT'] . "/bitrix/catalog_export/");
}
return true;
}