Esempio n. 1
0
    }
} else {
    if (!empty($_REQUEST['nbrows']) && $_REQUEST['nbrows'] > $nbrows) {
        $nbrows = $_REQUEST['nbrows'];
    }
}
if ($nbrows > 16) {
    $nbrows = 16;
}
$content .= sprintf('<tr><td align="right">%s:</td>', $l['str_number_of_rows_per_record']);
$content .= sprintf('<td><input type=text name="nbrows" value="%s" size="3"></td></tr>', $nbrows);
# language row
$content .= sprintf('<tr><td align="right">%s:</td>', $l['str_language']);
$content .= '<td><select name="newlang">';
// select current available langs
$list = GetDirList('includes/strings');
reset($list);
while ($newlang = array_shift($list)) {
    $content .= sprintf('<option value="%s"%s>%s</option>', $newlang, $newlang === $lang ? ' selected' : '', $newlang);
}
$content .= '</select></td></tr>';
# disclaimer row
$content .= '<tr><td width="65%" align="right">';
$_url = sprintf('disclaimer.php?language=%s', $lang);
$_url2 = sprintf('%sdisclaimer.php', $config->mainurl);
$_winopt = sprintf("'%s','M','toolbar=no,location=no,directories=no," . "status=no,alwaysraised=yes,dependant=yes,menubar=no,scrollbars=yes," . "resizable=yes,width=640,height=480'", $_url);
$_disclaimer = sprintf('<a target=_blank href="%s" onclick="window.open(%s)">%s</a>', $_url, $_winopt, $_url2);
$content .= sprintf($l['str_i_have_read_and_i_understand_discl_available_at_x'], $_disclaimer);
$content .= '</td>';
$content .= '<td><input type="checkbox" name="ihaveread" value="1"></td></tr>';
$content .= '<tr><td colspan="2" align="center">';
Esempio n. 2
0
					}
				}
				else
					$lAdmin->AddGroupError(GetMessage("MAIN_DUMP_ERR_NAME"), $ID);
			break;
		}
	}
}
InitSorting();

$arDirs = array();
$arFiles = array();
$arTmpFiles = array();
$arFilter = array();

GetDirList(Array($site, $path), $arDir, $arTmpFiles, $arFilter, Array($by=>$order), "F");

// Clouds
if (($arAllBucket = CBackup::GetBucketList()) && $_REQUEST['mode'])
{
	foreach($arAllBucket as $arBucket)
	{
		if ($arCloudFiles = CBackup::GetBucketFileList($arBucket['ID'], BX_ROOT.'/backup/'))
		{
			foreach($arCloudFiles['file'] as $k=>$v)
			{
				$arTmpFiles[] = array(
					'NAME' => $v,
					'SIZE' => $arCloudFiles['file_size'][$k],
					'DATE' => '',
					'PERMISSION' => 'X',
Esempio n. 3
0
    function GetItems($Params)
    {
        global $APPLICATION, $USER;
        static $checkChildren, $genTmb;
        if (!isset($checkChildren, $genTmb)) {
            $checkChildren = COption::GetOptionString("fileman", "file_dialog_check_children", "Y") == 'Y';
            $genTmb = COption::GetOptionString("fileman", "file_dialog_gen_thumb", "Y") == 'Y';
        }
        if (strlen($Params["site"]) > 2) {
            if (!$USER->CanDoOperation('clouds_browse')) {
                return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_ACCESS_DENIED'), 'access_denied');
            }
            if ($Params['operation'] !== 'O') {
                return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_PATH_CORRUPT') . ' [clouds 04]', 'path_corrupt');
            }
            if (!CModule::IncludeModule('clouds')) {
                return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_PATH_CORRUPT') . ' [clouds 01]', 'path_corrupt');
            }
            $obBucket = null;
            foreach (CCloudStorageBucket::GetAllBuckets() as $arBucket) {
                if ($arBucket["ACTIVE"] == "Y" && $arBucket["BUCKET"] === $Params["site"]) {
                    $obBucket = new CCloudStorageBucket($arBucket["ID"]);
                }
            }
            if (!$obBucket) {
                return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_PATH_CORRUPT') . ' [clouds 02]', 'path_corrupt');
            }
            if (!$obBucket->Init()) {
                return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_PATH_CORRUPT') . ' [clouds 03]', 'path_corrupt');
            }
            $path = preg_replace("#[\\\\\\/]+#", "/", "/" . $APPLICATION->UnJSEscape($Params['path']));
            $path_js = $path == "" ? "/" : addslashes(htmlspecialcharsex($path));
            $path_js = str_replace("//", "/", $path_js);
            $arFiles = $obBucket->ListFiles($path);
            if (!is_array($arFiles)) {
                return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_PATH_CORRUPT') . ' [clouds 05]', 'path_corrupt');
            }
            ?>
arFDDirs['<?php 
            echo $path_js;
            ?>
'] = [];
arFDFiles['<?php 
            echo $path_js;
            ?>
'] = [];
<?php 
            foreach ($arFiles["dir"] as $ind => $dir) {
                ?>
arFDDirs['<?php 
                echo $path_js;
                ?>
'][<?php 
                echo $ind;
                ?>
] =
{
	name : '<?php 
                echo CUtil::JSEscape($dir);
                ?>
',
	path : '<?php 
                echo CUtil::JSEscape(preg_replace("#[\\\\\\/]+#", "/", $path . "/" . $dir));
                ?>
',
	empty: false,
	permission : {del : false, ren : false},
	date : '',
	timestamp : '',
	size : 0
};
<?php 
            }
            if ($Params['getFiles']) {
                foreach ($arFiles['file'] as $ind => $file) {
                    ?>
arFDFiles['<?php 
                    echo $path_js;
                    ?>
'][<?php 
                    echo $ind;
                    ?>
] =
{
	name : '<?php 
                    echo CUtil::JSEscape($file);
                    ?>
',
	path : '<?php 
                    echo CUtil::JSEscape($obBucket->GetFileSRC($path . "/" . $file));
                    ?>
',
	permission : {del : false, ren : false},
	date : '',
	timestamp : '',
	size : '<?php 
                    echo $arFiles["file_size"][$ind];
                    ?>
'
};
<?php 
                }
            }
            ?>
arFDPermission['<?php 
            echo $path_js;
            ?>
'] = {
	new_folder : false,
	upload : false
};
<?php 
            return;
        }
        $io = CBXVirtualIo::GetInstance();
        $site = $Params['site'];
        $path = $io->CombinePath("/", $APPLICATION->UnJSEscape($Params['path']));
        $path_js = $path == "" ? "/" : addslashes(htmlspecialcharsex($path));
        $path_js = str_replace("//", "/", $path_js);
        $bCheckEmpty = $Params['bCheckEmpty'];
        $rootPath = CSite::GetSiteDocRoot($site);
        if (!$io->FileExists($rootPath . $path) && !$io->DirectoryExists($rootPath . $path) && $Params['bThrowException'] === true) {
            return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_PATH_CORRUPT'), 'path_corrupt');
        } elseif (!$USER->CanDoFileOperation('fm_view_listing', array($site, $path))) {
            return $APPLICATION->ThrowException(GetMessage('BX_FD_ERROR') . ': ' . GetMessage('BX_FD_ACCESS_DENIED'), 'access_denied');
        }
        $arDirs = array();
        $arFiles = array();
        GetDirList(array($site, $path), $arDirs, $arFiles, array(), array("name" => "asc"), "DF", false, true);
        ?>
arFDDirs['<?php 
        echo $path_js;
        ?>
'] = [];
arFDFiles['<?php 
        echo $path_js;
        ?>
'] = [];
<?php 
        $ind = -1;
        foreach ($arDirs as $Dir) {
            $name = addslashes(htmlspecialcharsex($Dir["NAME"]));
            $path_i = addslashes(htmlspecialcharsex($path)) . "/" . $name;
            $path_i = str_replace("//", "/", $path_i);
            $arPath_i = array($site, $path_i);
            if (!$USER->CanDoFileOperation('fm_view_listing', $arPath_i)) {
                continue;
            }
            $ind++;
            $empty = true;
            if ($bCheckEmpty) {
                $dirTmp = $io->GetDirectory($rootPath . $path . '/' . $name);
                $arDirTmpChildren = $dirTmp->GetChildren();
                foreach ($arDirTmpChildren as $child) {
                    if (!$child->IsDirectory()) {
                        continue;
                    }
                    $empty = false;
                    break;
                }
            }
            $perm_del = $USER->CanDoFileOperation('fm_delete_folder', $arPath_i) ? 'true' : 'false';
            $perm_ren = $USER->CanDoFileOperation('fm_rename_folder', $arPath_i) ? 'true' : 'false';
            ?>
arFDDirs['<?php 
            echo $path_js;
            ?>
'][<?php 
            echo $ind;
            ?>
] =
{
	name : '<?php 
            echo $name;
            ?>
',
	path : '<?php 
            echo $path_i;
            ?>
',
	empty: <?php 
            echo $empty ? 'true' : 'false';
            ?>
,
	permission : {del : <?php 
            echo $perm_del;
            ?>
, ren : <?php 
            echo $perm_ren;
            ?>
},
	date : '<?php 
            echo $Dir["DATE"];
            ?>
',
	timestamp : '<?php 
            echo $Dir["TIMESTAMP"];
            ?>
',
	size : 0
};
<?php 
        }
        if ($Params['getFiles']) {
            $ind = -1;
            foreach ($arFiles as $File) {
                $name = addslashes(htmlspecialcharsex($File["NAME"]));
                $path_i = addslashes(htmlspecialcharsex($File["ABS_PATH"]));
                $path_i = str_replace("//", "/", $path_i);
                $arPath_i = array($site, $path_i);
                if (!$USER->CanDoFileOperation('fm_view_file', $arPath_i)) {
                    continue;
                }
                $ind++;
                $perm_del = $USER->CanDoFileOperation('fm_delete_file', $arPath_i) ? 'true' : 'false';
                $perm_ren = $USER->CanDoFileOperation('fm_rename_file', $arPath_i) ? 'true' : 'false';
                $imageAddProps = '';
                if ($genTmb) {
                    $ext = strtolower(GetFileExtension($name));
                    if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'jpe', 'bmp'))) {
                        $tmbPath = BX_PERSONAL_ROOT . "/tmp/fd_tmb" . $path_i;
                        $destinationFile = $rootPath . $tmbPath;
                        if (!file_exists($destinationFile)) {
                            $sourceFile = $File['PATH'];
                            if (CFile::ResizeImageFile($sourceFile, $destinationFile, array('width' => 140, 'height' => 110))) {
                                $imageAddProps = ",\n" . 'tmb_src : \'' . CUtil::JSEscape($tmbPath) . '\'';
                            }
                        } else {
                            $imageAddProps = ",\n" . 'tmb_src : \'' . CUtil::JSEscape($tmbPath) . '\'';
                        }
                    }
                }
                ?>
arFDFiles['<?php 
                echo $path_js;
                ?>
'][<?php 
                echo $ind;
                ?>
] =
{
	name : '<?php 
                echo $name;
                ?>
',
	path : '<?php 
                echo $path_i;
                ?>
',
	permission : {del : <?php 
                echo $perm_del;
                ?>
, ren : <?php 
                echo $perm_ren;
                ?>
},
	date : '<?php 
                echo $File["DATE"];
                ?>
',
	timestamp : '<?php 
                echo $File["TIMESTAMP"];
                ?>
',
	size : '<?php 
                echo $File["SIZE"];
                ?>
'<?php 
                echo $imageAddProps;
                ?>
};
<?php 
            }
        }
        $arPath = array($site, $path);
        ?>
arFDPermission['<?php 
        echo $path_js;
        ?>
'] = {
	new_folder : <?php 
        echo $USER->CanDoFileOperation('fm_create_new_folder', $arPath) ? 'true' : 'false';
        ?>
,
	upload : <?php 
        echo $USER->CanDoFileOperation('fm_upload_file', $arPath) ? 'true' : 'false';
        ?>
};
<?php 
    }
Esempio n. 4
0
 function GetDirList($path, &$arDirs, &$arFiles, $arFilter = array(), $sort = array(), $type = "DF", $bLogical = false, $task_mode = false)
 {
     return GetDirList($path, $arDirs, $arFiles, $arFilter, $sort, $type, $bLogical, $task_mode);
 }
Esempio n. 5
0
 function DirsRecursive($ID, $path = "", $depth = 0, $maxDepth = 1)
 {
     $arRes = array();
     $depth++;
     GetDirList(BX_PERSONAL_ROOT . "/templates/" . $ID . "/" . $path, $arDirsTmp, $arResTmp);
     foreach ($arResTmp as $file) {
         switch ($file["NAME"]) {
             case "chain_template.php":
                 $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_NAV");
                 break;
             case "":
                 $file["DESCRIPTION"] = "";
                 break;
             default:
                 if (($p = strpos($file["NAME"], ".menu_template.php")) !== false) {
                     $file["DESCRIPTION"] = str_replace("#MENU_TYPE#", substr($file["NAME"], 0, $p), GetMessage("MAIN_TEMPLATE_MENU"));
                 } elseif (($p = strpos($file["NAME"], "authorize_registration.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_AUTH_REG");
                 } elseif (($p = strpos($file["NAME"], "forgot_password.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_SEND_PWD");
                 } elseif (($p = strpos($file["NAME"], "change_password.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_CHN_PWD");
                 } elseif (($p = strpos($file["NAME"], "authorize.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_AUTH");
                 } elseif (($p = strpos($file["NAME"], "registration.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_REG");
                 }
         }
         $arRes[] = $file;
     }
     $nTemplateLen = strlen(BX_PERSONAL_ROOT . "/templates/" . $ID . "/");
     foreach ($arDirsTmp as $dir) {
         $arDir = $dir;
         $arDir["DEPTH_LEVEL"] = $depth;
         $arRes[] = $arDir;
         if ($depth < $maxDepth) {
             $dirPath = substr($arDir["ABS_PATH"], $nTemplateLen);
             $arRes = array_merge($arRes, CSiteTemplate::DirsRecursive($ID, $dirPath, $depth, $maxDepth));
         }
     }
     return $arRes;
 }
Esempio n. 6
0
 function CheckBackup()
 {
     $arCount = 0;
     $arResult = array();
     $arResult["STATUS"] = false;
     $bMcrypt = function_exists('mcrypt_encrypt');
     $bBitrixCloud = $bMcrypt && CModule::IncludeModule('bitrixcloud') && CModule::IncludeModule('clouds');
     $site = CSite::GetSiteByFullPath(DOCUMENT_ROOT);
     $path = BX_ROOT . "/backup";
     $arTmpFiles = array();
     $arFilter = array();
     GetDirList(array($site, $path), $arDir, $arTmpFiles, $arFilter, array('sort' => 'asc'), "F");
     foreach ($arTmpFiles as $ar) {
         if (strpos($ar['NAME'], ".enc.gz") || strpos($ar['NAME'], ".tar.gz") || strpos($ar['NAME'], ".tar") || strpos($ar['NAME'], ".enc")) {
             $arCount++;
         }
     }
     if ($bBitrixCloud) {
         $backup = CBitrixCloudBackup::getInstance();
         try {
             foreach ($backup->listFiles() as $ar) {
                 if (strpos($ar['FILE_NAME'], ".enc.gz") || strpos($ar['FILE_NAME'], ".tar.gz") || strpos($ar['FILE_NAME'], ".tar") || strpos($ar['FILE_NAME'], ".enc")) {
                     $arCount++;
                 }
             }
         } catch (Exception $e) {
         }
     }
     if ($arCount > 0) {
         $arResult["STATUS"] = true;
         $arResult["MESSAGE"]["PREVIEW"] = GetMessage("CL_FOUND_BACKUP", array("#count#" => $arCount));
     } else {
         $arResult["MESSAGE"]["PREVIEW"] = GetMessage("CL_NOT_FOUND_BACKUP");
     }
     return $arResult;
 }
Esempio n. 7
0
<?php

// print a box with list of available languages
$title = $l['str_languages_title'];
$mylink = "?" . $_SERVER["QUERY_STRING"];
$mylink = preg_replace("/(&amp;|&|)language=[a-z][a-z]/", "", $mylink);
if ($mylink != "?") {
    $mylink .= "&amp;";
}
$mylink = preg_replace("/&amp;/", "&", $mylink);
$mylink = preg_replace("/&/", "&amp;", $mylink);
$dirlist = GetDirList("includes/strings");
$content = '';
reset($dirlist);
while ($countrycode = array_shift($dirlist)) {
    $content .= '<a href="' . $_SERVER['PHP_SELF'] . $mylink . 'language=' . $countrycode . '"><img src="images/' . $countrycode . '.png" alt="' . $countrycode . '"></a>
    ';
}
$content = '<p>' . $content . '</p>';
print $html->box('languages', $title, $content);