/** * Get the File Type Icon * * @return string */ public function getFileIcon() { $source = $this->type == 'url' ? $this->getSource() : \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteDocumentRootPath() . '/' . $this->getSource(); return \Cx\Core_Modules\Media\Controller\MediaLibrary::getFileTypeIconWebPath($source, $this->getFileType()); }
/** * Read all files / directories of the current folder */ function _initFiles() { if (array_key_exists($this->_mediaType, $this->mediaTypePaths)) { $strPath = $this->mediaTypePaths[$this->_mediaType][0] . $this->_path; } else { $strPath = ASCMS_CONTENT_IMAGE_PATH . $this->_path; } $objDir = @opendir($strPath); $arrFiles = array(); if ($objDir) { $path = array(); if ($this->_path !== "/" && preg_match('#(.*/).+[/]?$#', $this->_path, $path)) { array_push($this->_arrDirectories, array('name' => '..', 'path' => $path[1], 'icon' => $this->_iconPath . 'Folder.png')); } $file = readdir($objDir); while ($file !== false) { // TODO: This match won't work for arbitrary thumbnail file names as they // may be created by the Image class! if ($file == '.' || $file == '..' || preg_match('/(?:\\.(?:thumb_thumbnail|thumb_medium|thumb_large)\\.[^.]+$)|(?:\\.thumb)$/i', $file) || $file == 'index.php') { $file = readdir($objDir); continue; } array_push($arrFiles, $file); $file = readdir($objDir); } closedir($objDir); sort($arrFiles, SORT_NATURAL | SORT_FLAG_CASE); foreach ($arrFiles as $file) { if (is_dir($strPath . $file)) { array_push($this->_arrDirectories, array('name' => $file, 'path' => $this->_path . $file, 'icon' => $this->_getIcon($strPath . $file))); } else { $filesize = @filesize($strPath . $file); if ($filesize > 0) { $filesize = round($filesize / 1024); } else { $filesize = 0; } $arrDimensions = array(0 => 0, 1 => 0); if (\Cx\Core_Modules\Media\Controller\MediaLibrary::_isImage($strPath . $file)) { $arrDimensions = @getimagesize($strPath . $file); } array_push($this->_arrFiles, array('name' => $file, 'path' => $this->_path . $file, 'size' => $filesize, 'icon' => $this->_getIcon($strPath . $file), 'width' => intval($arrDimensions[0]), 'height' => intval($arrDimensions[1]))); } } } }
/** * returns an array containing attachment information * * @param string $file * @return array $arrReturn 'path','webpath','extension', false if attachment doesn't exist in filesystem */ function _getAttachment($file) { $file = contrexx_addslashes($file); $cx = \Cx\Core\Core\Controller\Cx::instanciate(); $path = $cx->getWebsiteMediaForumUploadPath() . '/'; if (!file_exists($path . $file) || empty($file)) { return false; } $pathinfo = pathinfo($file); $icon = \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIconWebPath() . \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIcon($path . $file) . '.png'; return array('name' => $file, 'path' => $path . $file, 'webpath' => $cx->getWebsiteMediaForumUploadWebPath() . '/' . $file, 'extension' => $pathinfo['extension'], 'icon' => $icon, 'size' => filesize($path . $file)); }
function _modifyMedium() { global $_ARRAYLANG, $_CONFIG; if (!isset($_REQUEST['section'])) { $_REQUEST['section'] = ''; } $mediumId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $mediumTitle = ''; $mediumYoutubeID = ''; $mediumAuthor = ''; $mediumDescription = ''; $mediumSource = ''; $mediumThumbnail = ''; $mediumTemplate = ''; $mediumWidth = 0; $mediumHeight = 0; $mediumPlaylength = 0; $mediumSize = 0; $mediumStatus = 1; $mediumCategories = array(); $saveStatus = true; if ($_REQUEST['section'] != 'Podcast') { //load backend template $this->_objTpl->loadTemplatefile('module_podcast_modify_medium.html'); } else { //load frontend content as template $pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $pages = $pageRepo->findBy(array('module' => 'Podcast', 'type' => \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION, 'cmd' => 'modifyMedium')); if (count($pages)) { //overwrite template, since _modifyMedium is called in the same request as the _selectMediumSource $this->_objTpl->setTemplate(current($pages)->getContent()); } } $this->_pageTitle = $mediumId > 0 ? $_ARRAYLANG['TXT_PODCAST_MODIFY_MEDIUM'] : $_ARRAYLANG['TXT_PODCAST_ADD_MEDIUM']; $this->_objTpl->setVariable(array('TXT_PODCAST_TITLE' => $_ARRAYLANG['TXT_PODCAST_TITLE'], 'TXT_PODCAST_DESCRIPTION' => $_ARRAYLANG['TXT_PODCAST_DESCRIPTION'], 'TXT_PODCAST_SOURCE' => $_ARRAYLANG['TXT_PODCAST_SOURCE'], 'TXT_PODCAST_TEMPLATE' => $_ARRAYLANG['TXT_PODCAST_TEMPLATE'], 'TXT_PODCAST_DIMENSIONS' => $_ARRAYLANG['TXT_PODCAST_DIMENSIONS'], 'TXT_PODCAST_PIXEL_WIDTH' => $_ARRAYLANG['TXT_PODCAST_PIXEL_WIDTH'], 'TXT_PODCAST_PIXEL_HEIGHT' => $_ARRAYLANG['TXT_PODCAST_PIXEL_HEIGHT'], 'TXT_PODCAST_CATEGORIES' => $_ARRAYLANG['TXT_PODCAST_CATEGORIES'], 'TXT_PODCAST_STATUS' => $_ARRAYLANG['TXT_PODCAST_STATUS'], 'TXT_PODCAST_ACTIVE' => $_ARRAYLANG['TXT_PODCAST_ACTIVE'], 'TXT_PODCAST_SAVE' => $_ARRAYLANG['TXT_PODCAST_SAVE'], 'TXT_PODCAST_PLAYLENGHT' => $_ARRAYLANG['TXT_PODCAST_PLAYLENGHT'], 'TXT_PODCAST_PLAYLENGTH' => $_ARRAYLANG['TXT_PODCAST_PLAYLENGTH'], 'TXT_PODCAST_PLAYLENGHT_FORMAT' => $_ARRAYLANG['TXT_PODCAST_PLAYLENGHT_FORMAT'], 'TXT_PODCAST_PLAYLENGTH_FORMAT' => $_ARRAYLANG['TXT_PODCAST_PLAYLENGTH_FORMAT'], 'TXT_PODCAST_FILESIZE' => $_ARRAYLANG['TXT_PODCAST_FILESIZE'], 'TXT_PODCAST_BYTES' => $_ARRAYLANG['TXT_PODCAST_BYTES'], 'TXT_PODCAST_AUTHOR' => $_ARRAYLANG['TXT_PODCAST_AUTHOR'], 'TXT_PODCAST_EDIT_OR_ADD_IMAGE' => $_ARRAYLANG['TXT_PODCAST_EDIT_OR_ADD_IMAGE'], 'TXT_PODCAST_THUMBNAIL' => $_ARRAYLANG['TXT_PODCAST_THUMBNAIL'], 'TXT_PODCAST_SHOW_FILE' => $_ARRAYLANG['TXT_PODCAST_SHOW_FILE'])); if (isset($_POST['podcast_medium_save'])) { if (isset($_POST['podcast_medium_title'])) { $mediumTitle = trim($_POST['podcast_medium_title']); } if (isset($_POST['podcast_medium_author'])) { $mediumAuthor = trim($_POST['podcast_medium_author']); } if (isset($_POST['podcast_medium_description'])) { $mediumDescription = trim($_POST['podcast_medium_description']); } if (isset($_POST['podcast_medium_template'])) { $mediumTemplate = intval($_POST['podcast_medium_template']); } $mediumWidth = isset($_POST['podcast_medium_width']) ? intval($_POST['podcast_medium_width']) : 0; $mediumHeight = isset($_POST['podcast_medium_height']) ? intval($_POST['podcast_medium_height']) : 0; $mediumSize = isset($_POST['podcast_medium_filesize']) ? intval($_POST['podcast_medium_filesize']) : 0; if (!empty($_POST['podcast_medium_playlength'])) { $arrPlaylength = array(); if (preg_match('/^(([0-9]*):)?(([0-9]*):)?([0-9]*)$/', $_POST['podcast_medium_playlength'], $arrPlaylength)) { $minutes = empty($arrPlaylength[3]) ? $arrPlaylength[2] : $arrPlaylength[4]; $hours = empty($arrPlaylength[3]) ? $arrPlaylength[4] : $arrPlaylength[2]; $mediumPlaylength = $hours * 3600 + $minutes * 60 + $arrPlaylength[5]; } } if (isset($_POST['podcast_medium_source'])) { $mediumSource = trim($_POST['podcast_medium_source']); } if (isset($_POST['podcast_medium_thumbnail'])) { $mediumThumbnail = trim($_POST['podcast_medium_thumbnail']); } if (!empty($_POST['podcast_youtubeID'])) { $mediumYoutubeID = trim($_POST['podcast_youtubeID']); $mediumSize = 0; $mediumTemplate = $this->_getYoutubeTemplate(); } $mediumStatus = $_REQUEST['section'] != 'podcast' ? isset($_POST['podcast_medium_status']) ? intval($_POST['podcast_medium_status']) : 0 : ($this->_arrSettings['auto_validate'] ? 1 : 0); if (isset($_POST['podcast_medium_associated_category'])) { foreach ($_POST['podcast_medium_associated_category'] as $categoryId => $status) { if (intval($status) == 1) { array_push($mediumCategories, intval($categoryId)); } } } if (empty($mediumTitle)) { $saveStatus = false; $this->_strErrMessage .= $_ARRAYLANG['TXT_PODCAST_EMPTY_MEDIUM_TITLE_MSG'] . "<br />\n"; } /*elseif (!$this->_isUniqueMediumTitle($mediumTitle, $mediumId)) { $saveStatus = false; $this->_strErrMessage .= $_ARRAYLANG['TXT_PODCAST_DUPLICATE_MEDIUM_TITLE_MSG']."<br />\n"; }*/ if (empty($mediumTemplate)) { $saveStatus = false; $this->_strErrMessage .= $_ARRAYLANG['TXT_PODCAST_EMPTY_MEDIUM_TEMPLATE_MSG'] . "<br />\n"; } if ($saveStatus) { if ($mediumId > 0 && $_REQUEST['section'] != 'podcast') { if ($this->_updateMedium($mediumId, $mediumTitle, $mediumYoutubeID, $mediumAuthor, $mediumDescription, $mediumThumbnail, $mediumTemplate, $mediumWidth, $mediumHeight, $mediumPlaylength, $mediumSize, $mediumCategories, $mediumStatus)) { $this->_strOkMessage = $_ARRAYLANG['TXT_PODCAST_MEDIUM_ADDED_SUCCESSFULL']; // Class in /core_modules/index.class.php is named Cache // Class in /core_modules/admin.class.php is named CacheManager $pageId = \Cx\Core\Core\Controller\Cx::instanciate()->getPage()->getId(); $cacheManager = new \Cx\Core_Modules\Cache\Controller\CacheManager(); $cacheManager->deleteSingleFile($pageId); $this->_createRSS(); return $this->_media(); } else { $this->_strErrMessage = $_ARRAYLANG['TXT_PODCAST_MEDIUM_ADDED_FAILED']; } } else { if ($this->_addMedium($mediumTitle, $mediumYoutubeID, $mediumAuthor, $mediumDescription, $mediumSource, $mediumThumbnail, $mediumTemplate, $mediumWidth, $mediumHeight, $mediumPlaylength, $mediumSize, $mediumCategories, $mediumStatus)) { // Class in /core_modules/index.class.php is named Cache // Class in /core_modules/admin.class.php is named CacheManager $pageId = \Cx\Core\Core\Controller\Cx::instanciate()->getPage()->getId(); $cacheManager = new \Cx\Core_Modules\Cache\Controller\CacheManager(); $cacheManager->deleteSingleFile($pageId); $this->_createRSS(); if ($_REQUEST['section'] != 'Podcast') { $this->_strOkMessage = $_ARRAYLANG['TXT_PODCAST_MEDIUM_UPDATED_SUCCESSFULL']; return $this->_media(); } else { if ($this->_objTpl->blockExists('podcastThanks')) { $this->_objTpl->touchBlock('podcastThanks'); } if ($this->_objTpl->blockExists('podcastForm')) { $this->_objTpl->hideBlock('podcastForm'); } return true; } } else { $this->_strErrMessage = $_ARRAYLANG['TXT_PODCAST_MEDIUM_UPDATED_FAILED']; } } } } elseif ($mediumId > 0 && ($arrMedium =& $this->_getMedium($mediumId)) !== false && $_REQUEST['section'] != 'Podcast') { $mediumTitle = $arrMedium['title']; $mediumAuthor = $arrMedium['author']; $mediumDescription = $arrMedium['description']; $mediumYoutubeID = $arrMedium['youtube_id']; $mediumSource = $arrMedium['source']; $mediumThumbnail = $arrMedium['thumbnail']; $mediumTemplate = $arrMedium['template_id']; $mediumWidth = $arrMedium['width']; $mediumHeight = $arrMedium['height']; $mediumStatus = $arrMedium['status']; $mediumCategories = $arrMedium['category']; $mediumPlaylength = $arrMedium['playlength']; $mediumSize = $arrMedium['size']; } elseif ($mediumId == 0) { $mediumSource = ''; if (isset($_POST['podcast_medium_source_type']) && in_array($_POST['podcast_medium_source_type'], array('local', 'remote', 'youtube'))) { if ($_POST['podcast_medium_source_type'] == 'local') { if (isset($_POST['podcast_medium_local_source'])) { if (strpos($_POST['podcast_medium_local_source'], ASCMS_PATH_OFFSET) === 0) { $mediumSource = ASCMS_PROTOCOL . '://%domain%%offset%' . substr($_POST['podcast_medium_local_source'], strlen(ASCMS_PATH_OFFSET)); } else { $mediumSource = ASCMS_PROTOCOL . '://%domain%%offset%' . $_POST['podcast_medium_local_source']; } } } elseif ($_POST['podcast_medium_source_type'] == 'youtube') { $mediumYoutubeID = contrexx_addslashes(trim($_POST['youtubeID'])); $mediumSource = 'http://youtube.com/v/' . $mediumYoutubeID; } elseif (isset($_POST['podcast_medium_remote_source'])) { $mediumSource = $_POST['podcast_medium_remote_source']; } } if (empty($mediumSource)) { return $this->_selectMediumSource(); } if (!empty($mediumYoutubeID)) { $mediumTitle = $this->_getYoutubeTitle($mediumYoutubeID); $mediumThumbnail = ASCMS_PATH_OFFSET . $this->_saveYoutubeThumbnail($mediumYoutubeID); $mediumTemplate =& $this->_getYoutubeTemplate(); $mediumDescription =& $this->_getYoutubeDescription($mediumYoutubeID); $mediumWidth = $this->_youTubeDefaultWidth; $mediumSize = 0; $mediumHeight = $this->_youTubeDefaultHeight; } else { $mediumTitle = ($lastSlash = strrpos($mediumSource, '/')) !== false ? substr($mediumSource, $lastSlash + 1) : $mediumSource; $mediumTemplate =& $this->_getSuitableTemplate($mediumSource); $dimensions = isset($_POST['podcast_medium_local_source']) && \Cx\Core_Modules\Media\Controller\MediaLibrary::_isImage(ASCMS_PATH . $_POST['podcast_medium_local_source']) ? @getimagesize(ASCMS_PATH . $_POST['podcast_medium_local_source']) : false; if ($dimensions) { $mediumWidth = $dimensions[0]; $mediumHeight = $dimensions[1]; } else { $mediumWidth = $this->_arrSettings['default_width']; $mediumHeight = $this->_arrSettings['default_height']; } $mediumSize = isset($_POST['podcast_medium_local_source']) ? filesize(ASCMS_PATH . $_POST['podcast_medium_local_source']) : 0; $mediumSource = htmlentities(str_replace(array('%domain%', '%offset%'), array($_CONFIG['domainUrl'], ASCMS_PATH_OFFSET), $mediumSource), ENT_QUOTES, CONTREXX_CHARSET); } } $this->_objTpl->setVariable(array('PODCAST_MODIFY_TITLE' => $mediumId > 0 ? $_ARRAYLANG['TXT_PODCAST_MODIFY_MEDIUM'] : $_ARRAYLANG['TXT_PODCAST_ADD_MEDIUM'] . ' (' . $_ARRAYLANG['TXT_PODCAST_STEP'] . ' 2: ' . $_ARRAYLANG['TXT_PODCAST_CONFIG_MEDIUM'] . ')', 'PODCAST_MEDIUM_ID' => $mediumId, 'PODCAST_MEDIUM_TITLE' => htmlentities($mediumTitle, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_AUTHOR' => htmlentities($mediumAuthor, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_DESCRIPTION' => htmlentities($mediumDescription, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_SOURCE' => $mediumSource, 'PODCAST_MEDIUM_SOURCE_URL' => htmlentities($mediumSource, ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_TEMPLATE_MENU' => $this->_getTemplateMenu($mediumTemplate, 'name="podcast_medium_template" style="width:450px;"'), 'PODCAST_MEDIUM_WIDTH' => $mediumWidth, 'PODCAST_MEDIUM_HEIGHT' => $mediumHeight, 'PODCAST_MEDIUM_PLAYLENGHT' => $this->_getShortPlaylengthFormatOfTimestamp($mediumPlaylength), 'PODCAST_MEDIUM_PLAYLENGTH' => $this->_getShortPlaylengthFormatOfTimestamp($mediumPlaylength), 'PODCAST_MEDIUM_FILESIZE' => $mediumSize, 'PODCAST_MEDIUM_THUMBNAIL_SRC' => !empty($mediumThumbnail) ? $mediumThumbnail : $this->_noThumbnail, 'PODCAST_MEDIUM_STATUS' => $mediumStatus == 1 ? 'checked="checked"' : '', 'PODCAST_MEDIUM_YOUTUBE_DISABLED' => !empty($mediumYoutubeID) ? 'disabled="disabled"' : '', 'PODCAST_MEDIUM_YOUTUBE_ID' => !empty($mediumYoutubeID) ? $mediumYoutubeID : '', 'PODCAST_THUMB_BROWSE' => self::getMediaBrowserButton('', array('data-cx-mb-views' => 'filebrowser', 'type' => 'button', 'style' => 'display:none', 'id' => 'podcast_thumbnail_browser'), 'mediaBrowserCallback'))); $arrCategories =& $this->_getCategories(); $categoryNr = 0; $arrLanguages = \FWLanguage::getLanguageArray(); foreach ($arrCategories as $categoryId => $arrCategory) { if ($_REQUEST['section'] == 'Podcast') { if (!in_array($categoryId, $this->_communityCategories) && !empty($this->_communityCategories)) { continue; } } $column = $categoryNr % 3; $arrCatLangIds =& $this->_getLangIdsOfCategory($categoryId); array_walk($arrCatLangIds, create_function('&$cat, $k, $arrLanguages', '$cat = $arrLanguages[$cat]["lang"];'), $arrLanguages); $arrCategory['title'] .= ' (' . implode(', ', $arrCatLangIds) . ')'; $this->_objTpl->setVariable(array('PODCAST_CATEGORY_ID' => $categoryId, 'PODCAST_CATEGORY_ASSOCIATED' => in_array($categoryId, $mediumCategories) ? 'checked="checked"' : '', 'PODCAST_SHOW_MEDIA_OF_CATEGORY_TXT' => sprintf($_ARRAYLANG['TXT_PODCAST_SHOW_MEDIA_OF_CATEGORY'], $arrCategory['title']), 'PODCAST_CATEGORY_NAME' => $arrCategory['title'])); $this->_objTpl->parse('podcast_medium_associated_category_' . $column); $categoryNr++; } }
/** * Get the web path to the icon used for displaying the file type of a file * * @param string $file File of which the related file type icon path shall be returned. * File must be an absolute file system path or an URL. * @param string $fileType (optional) The file type of $file (as file extension). When supplied, the method will skip the file type detection and will run quite faster. * @return string Web path to the icon. */ public static function getFileTypeIconWebPath($file, $fileType = null) { $iconPath = \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIconPath() . \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIcon($file, $fileType) . '.png'; return \Cx\Core\Core\Controller\Cx::instanciate()->getClassLoader()->getWebFilePath($iconPath); }
/** * Returns the appropriate icon of the given file. * * @param string $file * @return string $img */ private function getFileIcon($file) { $icon = \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIcon(\Env::get('cx')->getWebsiteDocumentRootPath() . $file); $img = '<img src="' . \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIconWebPath() . $icon . '.png" alt="Attach" border="0" style="position: relative; top: 3px;" /> '; return $img; }
/** * Getting the files and folders in a ul li format for the js tree * * @param array $folder array of files and folders * @param string $path current path of the $folder array * @param string $block type of the folder array (theme or applicationTheme) * @param string $themesPage selected file in the ul li * * @return string formatted ul and li for the js tree */ function getUlLi($folder, $path, $block, $themesPage) { $result = '<ul>'; $virtualFolder = array('View', 'Template', 'Frontend'); foreach ($folder as $folderName => $fileName) { $permissionClass = 'protected'; $resetClass = ''; $relativePath = $path . '/' . (is_array($fileName) ? $folderName : $fileName); $isComponentFile = false; if (self::isFileTypeComponent($relativePath)) { $componentFilePath = self::getComponentFilePath($relativePath, $block == 'applicationTheme'); if (!$componentFilePath) { // may be a folder $componentFilePath = self::replaceComponentFolderByItsType($relativePath); } $isComponentFile = true; } $filePath = $this->websiteThemesFilePath . ($isComponentFile ? $componentFilePath : $relativePath); if (file_exists($filePath)) { $permissionClass = ''; if ($this->websiteThemesFilePath != $this->codeBaseThemesFilePath && file_exists($this->codeBaseThemesFilePath . ($isComponentFile ? $componentFilePath : $relativePath))) { $permissionClass = 'protected'; $resetClass = 'reset'; } } else { $filePath = $this->codeBaseThemesFilePath . ($isComponentFile ? $componentFilePath : $relativePath); } if (is_array($fileName)) { if ($block == 'applicationTheme' || $block == 'theme' && !in_array($folderName, $virtualFolder)) { $icon = "<img height='16' width='16' alt='icon' src='" . \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIconWebPath() . "Folder.png' class='icon'>"; $activeFolder = preg_match('#^' . $relativePath . '# i', $themesPage) ? "id='activeFolder'" : ''; $result .= '<li><a href="javascript:void(0);"' . $activeFolder . ' data-rel="' . $relativePath . '" class="folder naming ' . $permissionClass . ' ' . $resetClass . '">' . $icon . $folderName . '</a>'; } $result .= $this->getUlLi($fileName, $path . (!in_array($folderName, $virtualFolder) ? '/' . $folderName : ''), $block, $themesPage); $result .= '</li>'; } else { if (in_array($fileName, $this->filenames)) { $iconSrc = '../core/ViewManager/View/Media/Config.png'; } else { $iconSrc = \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIconWebPath() . \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIcon($filePath) . '.png'; } $icon = "<img height='16' width='16' alt='icon' src='" . $iconSrc . "' class='icon'>"; $activeFile = $themesPage == $relativePath ? "id = 'activeFile'" : ''; $result .= "<li><a href= 'javascript:void(0);' class='loadThemesPage naming {$permissionClass} {$resetClass}' {$activeFile} data-rel='" . $relativePath . "'>" . $icon . $fileName . "</a></li>"; } } $result .= '</ul>'; return $result; }
/** * returns an array containing attachment information * * @param string $file * @return array $arrReturn 'path','webpath','extension', false if attachment doesn't exist in filesystem */ function _getAttachment($file) { $file = addslashes($file); if (!file_exists(ASCMS_FORUM_UPLOAD_PATH . '/' . $file) || empty($file)) { return false; } $pathinfo = pathinfo($file); $icon = \Cx\Core_Modules\Media\Controller\MediaLibrary::_getIcon($file); return array('name' => $file, 'path' => ASCMS_FORUM_UPLOAD_PATH . '/' . $file, 'webpath' => ASCMS_FORUM_UPLOAD_WEB_PATH . '/' . $file, 'extension' => $pathinfo['extension'], 'icon' => $icon, 'size' => filesize(ASCMS_FORUM_UPLOAD_PATH . '/' . $file)); }