public static function checkPermissionForProtectedHomeDirs($strFile) { $strUuid = \Config::get('protectedHomeDirRoot'); if (!$strFile) { return; } if ($strUuid && ($strProtectedHomeDirRootPath = \HeimrichHannot\HastePlus\Files::getPathFromUuid($strUuid)) !== null) { // check only if path inside the protected root dir if (StringUtil::startsWith($strFile, $strProtectedHomeDirRootPath)) { if (FE_USER_LOGGED_IN) { if (($objFrontendUser = \FrontendUser::getInstance()) !== null) { if (\Config::get('allowAccessByMemberId') && $objFrontendUser->assignProtectedDir && $objFrontendUser->protectedHomeDir) { $strProtectedHomeDirMemberRootPath = Files::getPathFromUuid($objFrontendUser->protectedHomeDir); // fe user id = dir owner member id if (StringUtil::startsWith($strFile, $strProtectedHomeDirMemberRootPath)) { return; } } if (\Config::get('allowAccessByMemberGroups')) { $arrAllowedGroups = deserialize(\Config::get('allowedMemberGroups'), true); if (array_intersect(deserialize($objFrontendUser->groups, true), $arrAllowedGroups)) { return; } } } } $intNoAccessPage = \Config::get('jumpToNoAccess'); if ($intNoAccessPage && ($objPageJumpTo = \PageModel::findByPk($intNoAccessPage)) !== null) { \Controller::redirect(\Controller::generateFrontendUrl($objPageJumpTo->row())); } else { die($GLOBALS['TL_LANG']['MSC']['noAccessDownload']); } } } }
public static function getStylesheetPaths($objLayout, $strMode) { $arrStylesheets = $strMode == static::AVISOTA_CSS_MODE_INLINE ? $objLayout->getInlineStylesheets() : $objLayout->getHeaderStylesheets(); if (!empty($arrStylesheets)) { $arrStylesheetPaths = array_map(function ($strUuid) { $strPath = TL_ROOT . '/' . Files::getPathFromUuid($strUuid); return file_exists($strPath) ? $strPath : ''; }, $arrStylesheets); // remove non-found stylesheets return array_filter($arrStylesheetPaths); } return array(); }
/** * Currently only works for products containing one single download * * @param IsotopeProduct $objProduct * @param array $arrConfig */ public function downloadSingleProduct(IsotopeProduct $objProduct, array $arrConfig = array()) { if (($objDownload = Download::findByPid($objProduct->getProductId())) !== null && ($strPath = Files::getPathFromUuid($objDownload->singleSRC))) { // TODO count downloads // start downloading the file (protected folders also supported) \Controller::redirect(Environment::getUrl() . '?file=' . $strPath); } }
<?php $arrDca =& $GLOBALS['TL_DCA']['tl_member']; /** * Palettes */ $arrDca['palettes']['default'] = str_replace('assignDir', 'assignDir,assignProtectedDir', $arrDca['palettes']['default']); /** * Subpalettes */ $arrDca['palettes']['__selector__'][] = 'assignProtectedDir'; $arrDca['subpalettes']['assignProtectedDir'] = 'protectedHomeDir'; /** * Fields */ $arrDca['fields']['assignProtectedDir'] = $arrDca['fields']['assignDir']; $arrDca['fields']['assignProtectedDir']['label'] =& $GLOBALS['TL_LANG']['tl_member']['assignProtectedDir']; $arrDca['fields']['protectedHomeDir'] = $arrDca['fields']['homeDir']; $arrDca['fields']['protectedHomeDir']['label'] =& $GLOBALS['TL_LANG']['tl_member']['protectedHomeDir']; if (\Config::get('protectedHomeDirRoot')) { $arrDca['fields']['protectedHomeDir']['eval']['path'] = \HeimrichHannot\HastePlus\Files::getPathFromUuid(\Config::get('protectedHomeDirRoot')); }