protected function processActionDefault() { $pathToAjax = isset($this->arParams['AJAX_PATH']) ? $this->arParams['AJAX_PATH'] : '/bitrix/components/bitrix/disk.bitrix24disk/ajax.php'; /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $quota = CDiskQuota::getDiskQuota(); $this->arResult['showDiskQuota'] = false; //$quota !== true; //now without quota $this->arResult['diskSpace'] = (double) COption::getOptionInt('main', 'disk_space') * 1024 * 1024; $this->arResult['quota'] = $quota; $this->arResult['ajaxIndex'] = $pathToAjax; $this->arResult['ajaxStorageIndex'] = '/desktop_app/storage.php'; $this->arResult['isInstalledDisk'] = \Bitrix\Disk\Desktop::isDesktopDiskInstall(); $this->arResult['personalLibIndex'] = '/company/personal/user/' . $this->getUser()->getId() . '/disk/path/'; $this->arResult['isInstalledPull'] = (bool) isModuleInstalled('pull'); $this->arResult['currentUser'] = array('id' => $this->getUser()->getId(), 'formattedName' => $this->getUser()->getFormattedName()); Asset::getInstance()->addJs('/bitrix/components/bitrix/disk.bitrix24disk/disk.js'); $this->includeComponentTemplate(); }
public static function notifyMailDomain($type, $sid, $user_id, $cnt = 0) { $user_id = intval($user_id); $cnt = intval($cnt); if (!CModule::includeModule('mail')) { return ''; } $arAdmin = CUser::getList($by, $order, array('ID' => $user_id, 'GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'EMAIL')))->fetch(); if (empty($arAdmin)) { return ''; } if ($cnt == 0) { return 'CIntranetUtils::notifyMailDomain("' . $type . '", "' . $sid . '", ' . $user_id . ', ' . ++$cnt . ');'; } includeModuleLangFile(__FILE__); if (isModuleInstalled('bitrix24')) { $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMOREB24_LINK'); $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORTB24_LINK'); } else { $learnmoreLink = getMessage('INTR_MAIL_DOMAIN_LEARNMORE_LINK'); $supportLink = getMessage('INTR_MAIL_DOMAIN_SUPPORT_LINK'); } if (in_array($type, array('nocomplete', 'nomailbox'))) { $sid = intval($sid); $service = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('=ID' => $sid)))->fetch(); if (empty($service) || $service['ACTIVE'] != 'Y' || !in_array($service['SERVICE_TYPE'], array('domain', 'crdomain'))) { return ''; } if ($service['SERVICE_TYPE'] == 'domain') { $result = CMailDomain2::getDomainStatus($service['TOKEN'], $service['SERVER'], $error); $stage = empty($result['stage']) ? null : $result['stage']; } else { $crResponse = CControllerClient::executeEvent('OnMailControllerCheckMemberDomain', array('DOMAIN' => $service['SERVER'])); $stage = empty($crResponse['result']['stage']) ? null : $crResponse['result']['stage']; } if ($type == 'nocomplete') { if (in_array($stage, array('owner-check', 'mx-check'))) { CEvent::send('INTRANET_MAILDOMAIN_NOCOMPLETE', array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink)); if ($cnt == 1) { global $pPERIOD; $pPERIOD = 3600 * 24 * 4; return 'CIntranetUtils::notifyMailDomain("nocomplete", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');'; } } } else { if ($stage == 'added') { $dbMailboxes = CMailbox::getList(array(), array('ACTIVE' => 'Y', '!USER_ID' => 0, 'SERVICE_ID' => $sid)); $adminMailbox = false; $userMailboxes = false; while ($arMailbox = $dbMailboxes->fetch()) { if ($arMailbox['USER_ID'] == $user_id) { $adminMailbox = true; } else { $userMailboxes = true; break; } } if (!$userMailboxes) { $eventType = $adminMailbox ? 'INTRANET_MAILDOMAIN_NOMAILBOX2' : 'INTRANET_MAILDOMAIN_NOMAILBOX'; CEvent::send($eventType, array($service['SITE_ID']), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink)); if ($cnt == 1) { global $pPERIOD; $pPERIOD = 3600 * 24 * 21; return 'CIntranetUtils::notifyMailDomain("nomailbox", ' . $sid . ', ' . $user_id . ', ' . ++$cnt . ');'; } } } } } else { if ($type == 'noreg') { $dbServices = \Bitrix\Mail\MailServicesTable::getList(array('filter' => array('ACTIVE' => 'Y', 'SERVICE_TYPE' => 'crdomain'))); while ($service = $dbServices->fetch()) { if ($service['FLAGS'] & CMail::F_DOMAIN_REG) { return ''; } } $r = CEvent::send('INTRANET_MAILDOMAIN_NOREG', array($sid), array('EMAIL_TO' => $arAdmin['EMAIL'], 'LEARNMORE_LINK' => $learnmoreLink, 'SUPPORT_LINK' => $supportLink)); } } return ''; }
public static function InsertMainItems() { if(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) return false; global $USER; if(!$USER->IsAuthorized()) return false; //Updates if($USER->IsAdmin() || $USER->CanDoOperation('install_updates')) { $update_res = UpdateTools::GetUpdateResult(); $updAIParams = array( "TITLE" => GetMessage("top_panel_ai_updates"), "COLOR" => 'gray', "SORT" => 12 ); //update_autocheck == true and we have something to show if ($update_res['result'] === true && $update_res['tooltip']) { $updAIParams["HTML"] = $update_res['tooltip']; $updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_instl").'</a>'; $updAIParams["ALERT"] = true; } else if ($update_res['error'] <> '') // update error { $updAIParams["TITLE"] .= " - ".GetMessage("top_panel_ai_title_err"); $updAIParams["HTML"] = trim(self::CutErrorId($update_res['error'])); $updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?refresh=Y&lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_chk").'</a>'; $updAIParams["ALERT"] = true; } else // update_autocheck == false { //last update date time $updateDate = COption::GetOptionString("main", "update_system_update", false); // remove seconds $updateDate = $updateDate ? CDatabase::FormatDate($updateDate, "DD.MM.YYYY HH:MI:SS", "DD.MM.YYYY HH:MI") : false; $updAIParams["HTML"] = '<span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_sys_ver").' '.SM_VERSION."</span><br>"; $updAIParams["HTML"] .= $updateDate ? GetMessage("top_panel_ai_upd_last").'<br>'.$updateDate : GetMessage("top_panel_ai_upd_never"); $updAIParams["FOOTER"] = '<a href="/bitrix/admin/update_system.php?refresh=Y&lang='.LANGUAGE_ID.'">'.GetMessage("top_panel_ai_upd_chk").'</a>'; $updAIParams["ALERT"] = false; } self::AddItem($updAIParams); } //Disk space (quota) $maxQuota = COption::GetOptionInt("main", "disk_space", 0)*1048576; if ($maxQuota > 0) { $quota = new CDiskQuota(); $free = $quota->GetDiskQuota(); $freeMB = CFile::FormatSize($free,1); $free = round($free/($maxQuota)*100); $qAIParams = array( "TITLE" => GetMessage("top_panel_ai_used_space"), "COLOR" => "green", "ALERT" => ($free < 10 ? true : false) ); $qAIParams["HTML"] = ' <div class="adm-informer-item-section"> <span class="adm-informer-item-l"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_all").'</span> '.CFile::FormatSize($maxQuota,1).'</span> <span class="adm-informer-item-r"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_aviable").'</span> '.$freeMB.'</span> </div> <div class="adm-informer-status-bar-block" > <div class="adm-informer-status-bar-indicator" style="width:'.(100-$free).'%; "></div> <div class="adm-informer-status-bar-text">'.(100-$free).'%</div> </div> <div class="adm-informer-item-section"><span class="adm-informer-strong-text">'.GetMessage("top_panel_ai_in_recomend").'</span> '.GetMessage("top_panel_ai_in_no").'</div>'; self::AddItem($qAIParams); } if($USER->IsAdmin() && in_array(LANGUAGE_ID, array("ru", "ua"))) { $cModules = COption::GetOptionString("main", "mp_modules_date", ""); $arModules = array(); if(strlen($cModules) > 0) $arModules = unserialize($cModules); $mCnt = count($arModules); if($mCnt > 0) { foreach($arModules as $id => $module) { if(isModuleInstalled($module["ID"])) { if($module["TMS"]+3600*24*14 < time()) { $script = " <script type=\"text/javascript\"> function hideMpAnswer(el, module) { if(el.parentNode.parentNode.parentNode) BX.hide(el.parentNode.parentNode.parentNode); BX.ajax({ 'method': 'POST', 'dataType': 'html', 'url': '/bitrix/admin/partner_modules.php', 'data': 'module='+module+'&".bitrix_sessid_get()."&act=unnotify', 'async': true, 'processData': false }); } </script>"; $arParams = array( 'TITLE' => GetMessage("top_panel_ai_marketplace"), 'COLOR' => 'green', 'FOOTER' => "<a href=\"javascript:void(0)\" onclick=\"hideMpAnswer(this, '".CUtil::JSEscape($module["ID"])."')\" style=\"float: right !important; font-size: 0.8em !important;\">".GetMessage("top_panel_ai_marketplace_hide")."</a><a href=\"http://marketplace.1c-bitrix.".LANGUAGE_ID."/solutions/#ID#/#comments\" target=\"_blank\" onclick=\"hideMpAnswer(this, '".CUtil::JSEscape($module["ID"])."')\">".GetMessage("top_panel_ai_marketplace_add")."</a>", GetMessage("top_panel_ai_marketplace_link", array("#ID#" => $module["ID"], "#ADIT#" => "")), 'ALERT' => true, 'HTML' => GetMessage("top_panel_ai_marketplace_descr", array("#NAME#" => $module["NAME"], "#ID#" => $module["ID"])).$script, ); self::AddItem($arParams); } } else unset($arModules[$id]); } if($mCnt != count($arModules)) { COption::SetOptionString("main", "mp_modules_date", serialize($arModules)); } } } foreach(GetModuleEvents("main", "OnAdminInformerInsertItems", true) as $arHandler) ExecuteModuleEventEx($arHandler); return count(self::$items); }
private function getGridData($gridId, $showDeleted = false) { $grid = array('ID' => $gridId); $gridOptions = new CGridOptions($grid['ID']); $gridSort = $gridOptions->getSorting(array('sort' => array('NAME' => 'ASC'), 'vars' => array('by' => 'by', 'order' => 'order'))); $filter = array(); $grid['SORT'] = $gridSort['sort']; $grid['SORT_VARS'] = $gridSort['vars']; $grid['MODE'] = $this->getViewMode(); $possibleColumnForSorting = array('UPDATE_TIME' => array('ALIAS' => 'UPDATE_TIME', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_UPDATE_TIME')), 'NAME' => array('ALIAS' => 'NAME', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_NAME')), 'FORMATTED_SIZE' => array('ALIAS' => 'SIZE', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_FORMATTED_SIZE'))); $byColumn = key($grid['SORT']); if (!isset($possibleColumnForSorting[$byColumn]) || strtolower($grid['SORT'][$byColumn]) !== 'desc' && strtolower($grid['SORT'][$byColumn]) !== 'asc') { $grid['SORT'] = array(); } $order = $grid['SORT']; $byColumn = key($order); $sortingColumns = array('TYPE' => array(SORT_NUMERIC, SORT_ASC), $possibleColumnForSorting[$byColumn]['ALIAS'] => strtolower($order[$byColumn]) === 'asc' ? SORT_ASC : SORT_DESC); if ($byColumn !== 'NAME') { $sortingColumns[$possibleColumnForSorting['NAME']['ALIAS']] = SORT_ASC; } $securityContext = $this->storage->getCurrentUserSecurityContext(); $proxyType = $this->storage->getProxyType(); $isStorageCurrentUser = $proxyType instanceof ProxyType\User && $proxyType->getTitleForCurrentUser() != $proxyType->getTitle(); $parameters = array('with' => array('CREATE_USER'), 'filter' => array('PARENT_ID' => $this->folder->getRealObjectId(), 'DELETED_TYPE' => ObjectTable::DELETED_TYPE_NONE)); $parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('ID', 'CREATED_BY')); $needPagination = $this->needPagination(); $pageNumber = (int) $this->request->getQuery('pageNumber'); if ($pageNumber <= 0) { $pageNumber = 1; } if ($needPagination) { $parameters['order'] = array(); foreach ($sortingColumns as $columnName => $columnData) { if (is_array($columnData)) { $parameters['order'][$columnName] = in_array(SORT_DESC, $columnData, true) ? 'DESC' : 'ASC'; } else { $parameters['order'][$columnName] = SORT_DESC === $columnData ? 'DESC' : 'ASC'; } } unset($columnName, $columnData); $parameters['limit'] = self::COUNT_ON_PAGE + 1; // +1 because we want to know about existence next page $parameters['offset'] = self::COUNT_ON_PAGE * ($pageNumber - 1); } $this->folder->preloadOperationsForChildren($securityContext); $sharedObjectIds = $this->getUserShareObjectIds(); $isDesktopDiskInstall = \Bitrix\Disk\Desktop::isDesktopDiskInstall(); $nowTime = time() + CTimeZone::getOffset(); $fullFormatWithoutSec = preg_replace('/:s$/', '', CAllDatabase::dateFormatToPHP(CSite::GetDateFormat("FULL"))); $urlManager = Driver::getInstance()->getUrlManager(); $rows = array(); $storageTitle = $proxyType->getTitle(); $isEnabledShowExtendedRights = $this->storage->isEnabledShowExtendedRights(); $result = $this->folder->getList($parameters); $countObjectsOnPage = 0; $needShowNextPagePagination = false; while ($row = $result->fetch()) { $countObjectsOnPage++; if ($needPagination && $countObjectsOnPage > self::COUNT_ON_PAGE) { $needShowNextPagePagination = true; break; } $object = BaseObject::buildFromArray($row); /** @var File|Folder $object */ $name = $object->getName(); $objectId = $object->getId(); $exportData = array('TYPE' => $object->getType(), 'NAME' => $name, 'ID' => $objectId); $relativePath = trim($this->arParams['RELATIVE_PATH'], '/'); $detailPageFile = CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FILE_VIEW'], array('FILE_ID' => $objectId, 'FILE_PATH' => ltrim($relativePath . '/' . $name, '/'))); $listingPage = rtrim(CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FOLDER_LIST'], array('PATH' => $relativePath)), '/'); $isFolder = $object instanceof Folder; $actions = $tileActions = $columns = array(); if ($object->canRead($securityContext)) { $exportData['OPEN_URL'] = $urlManager->encodeUrn($isFolder ? $listingPage . '/' . $name . '/' : $detailPageFile); $actions[] = array("PSEUDO_NAME" => "open", "DEFAULT" => true, "ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_OPEN'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $exportData['OPEN_URL'] . "')"); if (!$object->canChangeRights($securityContext) && !$object->canShare($securityContext)) { $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk.showSharingDetailWithoutEdit({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})"); } elseif ($object->canChangeRights($securityContext)) { $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showSharingDetailWithChangeRights({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})"); } elseif ($object->canShare($securityContext)) { $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showSharingDetailWithSharing({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})"); } if ($isEnabledShowExtendedRights && !$object->isLink() && $object->canChangeRights($securityContext)) { $actions[] = array("PSEUDO_NAME" => "rights", "ICONCLASS" => "rights", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_RIGHTS_SETTINGS'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showRightsOnObjectDetail({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})"); } if (!$isFolder) { $actions[] = array("PSEUDO_NAME" => "download", "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($object) . "')"); } $actions[] = array("PSEUDO_NAME" => "copy", "ICONCLASS" => "copy", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_COPY'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openCopyModalWindow({\n\t\t\t\t\t\tid: {$this->storage->getRootObjectId()},\n\t\t\t\t\t\tname: '" . CUtil::JSEscape($storageTitle) . "'\n\t\t\t\t\t}, {\n\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "'\n\t\t\t\t\t});"); if ($object->canDelete($securityContext)) { $actions[] = array("PSEUDO_NAME" => "move", "ICONCLASS" => "move", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_MOVE'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openMoveModalWindow({\n\t\t\t\t\t\t\tid: {$this->storage->getRootObjectId()},\n\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($storageTitle) . "'\n\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "'\n\t\t\t\t\t\t});"); } if (!$isStorageCurrentUser && (!isset($sharedObjectIds[$object->getRealObjectId()]) || $sharedObjectIds[$object->getRealObjectId()]['TO_ENTITY'] != Sharing::CODE_USER . $this->getUser()->getId())) { $actions[] = array("PSEUDO_NAME" => "connect", "ICONCLASS" => "connect", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_CONNECT'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].connectObjectToDisk({\n\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "',\n\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});"); } if (!$isFolder) { $actions[] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_GET_EXT_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getExternalLink({$objectId});"); $downloadLink = $urlManager->getUrlForShowFile($object, array(), true); $actions[] = array("ICONCLASS" => "show", 'PSEUDO_NAME' => 'internal_link', 'PSEUDO_VALUE' => $downloadLink, "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_COPY_INTERNAL_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getInternalLink('{$downloadLink}');"); $actions[] = array("ICONCLASS" => "history", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_HISTORY'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $exportData['OPEN_URL'] . "#tab-history')"); } } if ($object->canRename($securityContext)) { $actions[] = array("TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_RENAME'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].renameInline({$objectId})"); } if ((!empty($sharedObjectIds[$objectId]) || $object->isLink()) && $object->canRead($securityContext)) { $tileActions['SHARE_INFO'] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETAIL_SHARE_INFO'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showShareInfoSmallView({\n\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t }\n\t\t\t\t\t})"); } $columnsBizProc = array('BIZPROC' => ''); $bizprocIcon = array('BIZPROC' => ''); if ($this->arParams['STATUS_BIZPROC'] && !$isFolder) { list($actions, $columnsBizProc, $bizprocIcon) = $this->getBizProcData($object, $securityContext, $actions, $columnsBizProc, $bizprocIcon, $exportData); } if ($object->canDelete($securityContext)) { if ($object->isLink()) { $actions[] = array("PSEUDO_NAME" => "detach", "ICONCLASS" => "detach", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETACH_BUTTON'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDetach({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})"); } elseif ($object->getCode() !== Folder::CODE_FOR_UPLOADED_FILES) { $actions[] = array("PSEUDO_NAME" => "delete", "ICONCLASS" => "delete", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_MARK_DELETED'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDelete({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t },\n\t\t\t\t\t\t\t\tcanDelete: {$object->canDelete($securityContext)}\n\t\t\t\t\t\t\t})"); } } $iconClass = Ui\Icon::getIconClassByObject($object, !empty($sharedObjectIds[$objectId])); $dataAttributesForViewer = ''; if ($isFolder) { $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object); if ($grid['MODE'] === 'tile') { $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer; $dataAttributesForViewer = ''; } $nameSpecialChars = htmlspecialcharsbx($name); $columnName = "\n\t\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t"; } else { $externalId = ''; if ($isDesktopDiskInstall && $isStorageCurrentUser) { $externalId = "st{$this->storage->getId()}|{$this->storage->getRootObjectId()}|f{$objectId}"; } $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object, array('canUpdate' => $object->canUpdate($securityContext), 'relativePath' => $relativePath . '/' . $name, 'externalId' => $externalId)); if ($grid['MODE'] === 'tile') { $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer; $dataAttributesForViewer = ''; } $nameSpecialChars = htmlspecialcharsbx($name); $columnName = "\n\t\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t\t<td>{$bizprocIcon['BIZPROC']}</td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t"; } $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $object->getCreatedBy())); $timestampCreate = $object->getCreateTime()->toUserTime()->getTimestamp(); $timestampUpdate = $object->getUpdateTime()->toUserTime()->getTimestamp(); $columns = array('CREATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampCreate, $nowTime) : formatDate('x', $timestampCreate, $nowTime), 'UPDATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampUpdate, $nowTime) : formatDate('x', $timestampUpdate, $nowTime), 'NAME' => $columnName, 'FORMATTED_SIZE' => $isFolder ? '' : CFile::formatSize($object->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($object->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t"); if ($this->arParams['STATUS_BIZPROC']) { $columns['BIZPROC'] = $columnsBizProc["BIZPROC"]; } $exportData['ICON_CLASS'] = $iconClass; if ($grid['MODE'] === 'tile') { $exportData['IS_IMAGE'] = $isFolder ? false : \Bitrix\Disk\TypeFile::isImage($object); if ($exportData['IS_IMAGE']) { $exportData['SRC_IMAGE'] = $urlManager->getUrlForShowFile($object, array('exact' => 'Y', 'width' => 64, 'height' => 64)); } $exportData['UPDATE_TIME'] = $columns['UPDATE_TIME']; } $exportData['IS_SHARED'] = !empty($sharedObjectIds[$objectId]); $exportData['IS_LINK'] = $object->isLink(); $tildaExportData = array(); foreach ($exportData as $exportName => $exportValue) { $tildaExportData['~' . $exportName] = $exportValue; } unset($exportRow); $rows[] = array('data' => array_merge($exportData, $tildaExportData), 'columns' => $columns, 'actions' => $actions, 'tileActions' => $tileActions, 'TYPE' => $exportData['TYPE'], 'NAME' => $exportData['NAME'], 'UPDATE_TIME' => $object->getUpdateTime()->getTimestamp(), 'SIZE' => $isFolder ? 0 : $object->getSize()); } unset($object); if (!$needPagination) { Collection::sortByColumn($rows, $sortingColumns); } $grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'sort' => isset($possibleColumnForSorting['ID']) ? 'ID' : false, 'default' => false), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_NAME'), 'sort' => isset($possibleColumnForSorting['NAME']) ? 'NAME' : false, 'default' => true, 'editable' => array('size' => 45)), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_TIME'), 'sort' => isset($possibleColumnForSorting['CREATE_TIME']) ? 'CREATE_TIME' : false, 'default' => false), array('id' => 'UPDATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_UPDATE_TIME'), 'sort' => isset($possibleColumnForSorting['UPDATE_TIME']) ? 'UPDATE_TIME' : false, 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_USER'), 'sort' => isset($possibleColumnForSorting['CREATE_USER']) ? 'CREATE_USER' : false, 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_FORMATTED_SIZE'), 'sort' => isset($possibleColumnForSorting['FORMATTED_SIZE']) ? 'FORMATTED_SIZE' : false, 'default' => true)); if ($this->arParams['STATUS_BIZPROC']) { $grid['HEADERS'][] = array('id' => 'BIZPROC', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_BIZPROC'), 'default' => false); } $grid['DATA_FOR_PAGINATION'] = array('ENABLED' => $needPagination); if ($needPagination) { $grid['DATA_FOR_PAGINATION']['SHOW_NEXT_PAGE'] = $needShowNextPagePagination; $grid['DATA_FOR_PAGINATION']['CURRENT_PAGE'] = $pageNumber; } $grid['COLUMN_FOR_SORTING'] = $possibleColumnForSorting; $grid['ROWS'] = $rows; $grid['ROWS_COUNT'] = count($rows); $grid['FOOTER'] = array(); if (isModuleInstalled('bitrix24')) { list($freeSpace, $diskSize) = $this->getDiskSpace(); $freeSpace = CFile::formatSize($freeSpace); $diskSize = CFile::formatSize($diskSize); $grid['FOOTER'] = array(array('custom_html' => ' <td class="tar" style="width: 100%;">' . Loc::getMessage('DISK_FOLDER_LIST_B24_LABEL_DISK_SPACE', array('#FREE_SPACE#' => '<span>' . $freeSpace, '#DISK_SIZE#' => $diskSize . '</span>')) . '</span></td> '), array('custom_html' => ' <td class="tar"><a class="bx-disk-mp-link-addhdd" href="' . Loc::getMessage('DISK_FOLDER_LIST_B24_URL_DISK_SPACE') . '" target="_blank">+ <span>' . Loc::getMessage('DISK_FOLDER_LIST_B24_APPEND_DISK_SPACE') . '</span></a></td> ')); } return $grid; }
function GetUserFields($arLdapUser, &$departmentCache = FALSE) { global $APPLICATION; $arFields = array('DN' => $arLdapUser['dn'], 'LOGIN' => $arLdapUser[strtolower($this->arFields['~USER_ID_ATTR'])], 'EXTERNAL_AUTH_ID' => 'LDAP#' . $this->arFields['ID'], 'LDAP_GROUPS' => $arLdapUser[strtolower($this->arFields['~USER_GROUP_ATTR'])]); // for each field, do the conversion foreach ($this->arFields["FIELD_MAP"] as $userField => $attr) { $arFields[$userField] = $this->getLdapValueByBitrixFieldName($userField, $arLdapUser); } $APPLICATION->ResetException(); $db_events = GetModuleEvents("ldap", "OnLdapUserFields"); while ($arEvent = $db_events->Fetch()) { $arParams = array(array(&$arFields, $arLdapUser)); if (ExecuteModuleEventEx($arEvent, $arParams) === false) { if (!($err = $APPLICATION->GetException())) { $APPLICATION->ThrowException("Unknown error"); } return false; } $arFields = $arParams[0][0]; } // set a department field, if needed if (empty($arFields['UF_DEPARTMENT']) && isModuleInstalled('intranet') && $this->arFields['IMPORT_STRUCT'] && $this->arFields['IMPORT_STRUCT'] == 'Y') { //$arLdapUser[$this->arFields['USER_DN_ATTR']] $username = $arLdapUser[$this->arFields['USER_ID_ATTR']]; if ($arDepartment = $this->GetDepartmentIdForADUser($arLdapUser[$this->arFields['USER_DEPARTMENT_ATTR']], $arLdapUser[$this->arFields['USER_MANAGER_ATTR']], $username, $departmentCache)) { // fill in cache. it is done outside the function because it has many exit points if ($departmentCache) { $departmentCache[$username] = $arDepartment; } // this is not final assignment // $arFields['UF_DEPARTMENT'] sould contain array of department ids // but somehow we have to return an information whether this user is a department head // so we'll save this data here temporarily $arFields['UF_DEPARTMENT'] = $arDepartment; } else { $arFields['UF_DEPARTMENT'] = array(); } // at this point $arFields['UF_DEPARTMENT'] should be set to some value, even an empty array is ok } if (!is_array($arFields['LDAP_GROUPS'])) { $arFields['LDAP_GROUPS'] = !empty($arFields['LDAP_GROUPS']) ? array($arFields['LDAP_GROUPS']) : array(); } $primarygroupid_name_attr = 'primarygroupid'; $primarygrouptoken_name_attr = 'primarygrouptoken'; $groupMemberAttr = null; $userIdAttr = null; if ($this->arFields['USER_GROUP_ACCESSORY'] == 'Y') { $primarygroupid_name_attr = strtolower($this->arFields['GROUP_ID_ATTR']); $primarygrouptoken_name_attr = strtolower($this->arFields['USER_GROUP_ATTR']); $userIdAttr = strtolower($this->arFields['USER_ID_ATTR']); $groupMemberAttr = strtolower($this->arFields['GROUP_MEMBERS_ATTR']); } $arAllGroups = $this->GetGroupListArray(); if (!is_array($arAllGroups) || count($arAllGroups) <= 0) { return $arFields; } $arGroup = reset($arAllGroups); do { if (in_array($arGroup['ID'], $arFields['LDAP_GROUPS'])) { continue; } if (is_set($arLdapUser, $primarygroupid_name_attr) && $arGroup[$primarygrouptoken_name_attr] == $arLdapUser[$primarygroupid_name_attr] || $this->arFields['USER_GROUP_ACCESSORY'] == 'Y' && is_set($arGroup, $groupMemberAttr) && (is_array($arGroup[$groupMemberAttr]) && in_array($arLdapUser[$userIdAttr], $arGroup[$groupMemberAttr]) || $arLdapUser[$userIdAttr] == $arGroup[$groupMemberAttr])) { $arFields['LDAP_GROUPS'][] = $arGroup['ID']; if ($this->arFields['USER_GROUP_ACCESSORY'] == 'N') { break; } } } while ($arGroup = next($arAllGroups)); return $arFields; }
function DoUninstall() { global $APPLICATION, $step; $this->errors = array(); $step = IntVal($step); if ($step < 2) { if (isModuleInstalled('webdav') && Option::get('disk', 'process_converted', false) === 'Y') { $this->errors[] = GetMessage("DISK_UNINSTALL_ERROR_MIGRATE_PROCESS"); } $GLOBALS["disk_installer_errors"] = $this->errors; $APPLICATION->IncludeAdminFile(GetMessage("DISK_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/unstep1.php"); } elseif ($step == 2) { $this->UnInstallDB(array("savedata" => $_REQUEST["savedata"])); $this->UnInstallFiles(); $this->UnInstallEvents(); $GLOBALS["disk_installer_errors"] = $this->errors; $APPLICATION->IncludeAdminFile(GetMessage("DISK_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/unstep2.php"); } }
protected function processActionInitialize() { $this->enableIgnoreQuotaError(); $userStorageId = $this->getUserStorageId(); $storage = $this->getStorageObject(); $storage->setStorageId($userStorageId); $userModel = User::loadById($this->getUser()->getId()); $storageModel = Driver::getInstance()->getStorageByUserId($this->getUser()->getId()); $isExtranetUser = $userModel->isExtranetUser(); $this->sendJsonSuccessResponse(array('userId' => (string) $this->getUser()->getID(), 'userStorageId' => $storage->getStringStorageId(), 'pathToUserLib' => $this->getPathToUserLib($userModel, $storageModel), 'pathToDiscuss' => $this->getPathToDiscuss($userModel), 'userStorageExtra' => array('iblockId' => (string) $userStorageId['IBLOCK_ID'], 'sectionId' => (string) $userStorageId['IBLOCK_SECTION_ID']), 'isB24' => (bool) isModuleInstalled('bitrix24'), 'isExtranetUser' => (bool) $isExtranetUser, 'version' => self::VERSION, 'token_sid' => bitrix_sessid(), 'defaultChunkSize' => Bitrix24Disk\UploadFileManager::DEFAULT_CHUNK_SIZE)); }
public static final function needBlockByDisk() { return Option::get('disk', 'process_converted', false) === 'Y' || Option::get('webdav', 'process_converted', false) === 'Y' || isModuleInstalled('webdav') && (Option::get('disk', 'successfully_converted', false) === 'Y' || Option::get('webdav', 'successfully_converted', false) === 'Y'); }
</div> <div class="bx-disk-popup-buttons"> <a onclick="document.getElementById('form-pass').submit();" class="bx-disk-btn bx-disk-btn-big bx-disk-btn-green"><?php echo Loc::getMessage('DISK_EXT_LINK_LABEL_BTN'); ?> </a> </div> </div> </form> </div> <?php } ?> <?php if (isModuleInstalled('bitrix24')) { ?> <div class="banner_b24" style=""> <a target="_blank" href="<?php echo Loc::getMessage('DISK_EXT_LINK_B24_ADV_CREATE_LINK_HREF'); ?> " class="banner-b24-link-container"> <span class="banner-b24-link-container-cyrcle-logo <?php echo $langForBanner; ?> "></span> <span class="banner-b24-link-container-cyrcle-desc"><?php echo Loc::getMessage('DISK_EXT_LINK_B24_ADV_TEXT'); ?> </span> <span class="banner-b24-link-container-cyrcle-title l1"><span><?php
function SetUser($arLdapUser, $bAddNew = true) { global $USER, $DB; if (!is_object($USER)) { $USER = new CUser(); $bUSERGen = true; } // process previously saved department data if (isModuleInstalled('intranet') && is_array($arLdapUser['UF_DEPARTMENT'])) { $isHead = $arLdapUser['UF_DEPARTMENT']['IS_HEAD']; // replace temporary value with a real one $arLdapUser['UF_DEPARTMENT'] = array($arLdapUser['UF_DEPARTMENT']['ID']); } if (isset($arLdapUser["ID"])) { $ID = intval($arLdapUser["ID"]); self::PrepareUserPhoto($ID, $arLdapUser); $USER->Update($ID, $arLdapUser); } else { $ldapUserID = 0; if (isset($_REQUEST["ldap_user_id"]) && strlen($_REQUEST["ldap_user_id"]) == 32) { $dbUser = CUser::GetList($O, $B, array("XML_ID" => $_REQUEST["ldap_user_id"], 'EXTERNAL_AUTH_ID' => $arLdapUser['EXTERNAL_AUTH_ID'])); if ($arUser = $dbUser->Fetch()) { $ldapUserID = $arUser["ID"]; } } $res = CUser::GetList($O, $B, array('LOGIN_EQUAL_EXACT' => $arLdapUser['LOGIN'], 'EXTERNAL_AUTH_ID' => $arLdapUser['EXTERNAL_AUTH_ID'])); $arLdapUser['PASSWORD'] = uniqid(rand(), true); if (!($ar_res = $res->Fetch()) && $ldapUserID < 1) { if ($bAddNew) { if (strlen($arLdapUser["EMAIL"]) <= 0) { $arLdapUser["EMAIL"] = COption::GetOptionString("ldap", "default_email", 'no@email'); } $ID = $USER->Add($arLdapUser); } else { $ID = 0; } } else { $ID = $ldapUserID > 1 ? $ldapUserID : $ar_res['ID']; self::PrepareUserPhoto($ID, $arLdapUser); $USER->Update($ID, $arLdapUser); } $ID = intval($ID); } // - add this user to groups if ($ID > 0) { // - set as head of department if (isModuleInstalled('intranet') && $isHead) { CLdapUtil::SetDepartmentHead($ID, $arLdapUser['UF_DEPARTMENT'][0]); } // For each group finding all superior ones $arUserLdapGroups = array(); $arLdapGroups = $this->GetGroupListArray(); $this->GetAllMemberOf($arLdapUser['LDAP_GROUPS'], $arUserLdapGroups, $arLdapGroups); $arGroupMaps = $this->GetGroupMaps(); $arUserBitrixGroups = $USER->GetUserGroup($ID); $arUserBitrixGroupsNew = array(); foreach ($arGroupMaps as $fromLdapGroup => $arToUserGroups) { foreach ($arToUserGroups as $toUserGroup) { if (($k = array_search($toUserGroup, $arUserBitrixGroups)) !== false) { unset($arUserBitrixGroups[$k]); } // If there is such a group among user's if (in_array($fromLdapGroup, $arUserLdapGroups)) { $arUserBitrixGroupsNew[] = $toUserGroup; } } } $arUserBitrixGroups = array_merge($arUserBitrixGroups, $arUserBitrixGroupsNew); $USER->SetUserGroup($ID, $arUserBitrixGroups); } if ($bUSERGen) { unset($USER); } return $ID; }