/**
  * Returns a <img> tag with the image file defined by $file and processed according to the properties in the TypoScript array.
  * Mostly this function is a sub-function to the IMAGE function which renders the IMAGE cObject in TypoScript. This function is called by "$this->cImage($conf['file'],$conf);" from IMAGE().
  *
  * @param	string		File TypoScript resource
  * @param	array		TypoScript configuration properties
  * @return	string		<img> tag, (possibly wrapped in links and other HTML) if any image found.
  * @access private
  * @see IMAGE()
  */
 function cImage($file, $conf)
 {
     $info = $this->getImgResource($file, $conf['file.']);
     //print_r($info);
     // added by Caspar Stuebs @ Gosign media.
     if (is_array($info) && (!empty($this->data['tx_goimageeditbe_croped_image']) || false)) {
         $editConfig = unserialize($this->data['tx_goimageeditbe_croped_image']);
         // render image with info from db
         $newFile = $this->renderGoImageEdit($info['origFile'], $editConfig ? $editConfig : array(), $conf);
         // create new image info
         $info = $this->getImgResource($newFile, $conf['file.']);
     }
     // end of add
     $GLOBALS['TSFE']->lastImageInfo = $info;
     if (is_array($info)) {
         $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
         $GLOBALS['TSFE']->imagesOnPage[] = $info[3];
         // This array is used to collect the image-refs on the page...
         if (!strlen($conf['altText']) && !is_array($conf['altText.'])) {
             // Backwards compatible:
             $conf['altText'] = $conf['alttext'];
             $conf['altText.'] = $conf['alttext.'];
         }
         //$altParam = $this->getAltParam($conf);
         if (empty($conf['altText']) && empty($conf['altText.'])) {
             // by ELIO@GOSIGN 19-01-2011: ALT-TEXT for all cImages
             $altParam = empty($this->data['altText']) ? tx_dam::media_getForFile($conf['file'])->meta['alt_text'] : $this->data['altText'];
             $altParam = ' alt="' . $altParam . '"';
         } else {
             $altParam = $this->getAltParam($conf);
         }
         $theValue = '<img src="' . htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . t3lib_div::rawUrlEncodeFP($info[3])) . '" width="' . $info[0] . '" height="' . $info[1] . '"' . $this->getBorderAttr(' border="' . intval($conf['border']) . '"') . ($conf['params'] || is_array($conf['params.']) ? ' ' . $this->stdwrap($conf['params'], $conf['params.']) : '') . $altParam . ' />';
         //print_r($theValue);
         if ($conf['linkWrap']) {
             $theValue = $this->linkWrap($theValue, $conf['linkWrap']);
         } elseif ($conf['imageLinkWrap']) {
             $theValue = $this->imageLinkWrap($theValue, $info['origFile'], $conf['imageLinkWrap.']);
         }
         return $this->wrap($theValue, $conf['wrap']);
     }
 }
    /**
     * Returns rendered previewer
     * used player:
     * http://aktuell.de.selfhtml.org/artikel/grafik/flashmusik/
     * http://loudblog.de/index.php?s=download
     *
     * @param	array		$row Meta data array
     * @param	integer		$size The maximum size of the previewer
     * @param	string		$type The wanted previewer type
     * @param	array		$conf Additional configuration values. Might be empty.
     * @return	array		True if this is the right previewer for the file
     */
    function render($row, $size, $type, $conf = array())
    {
        $outArr = array('htmlCode' => '', 'headerCode' => '');
        $absFile = tx_dam::file_absolutePath($row['file_path'] . $row['file_name']);
        $siteUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
        $fileRelPath = tx_dam::file_relativeSitePath($row['file_path'] . $row['file_name']);
        $playerRelPath = str_replace(PATH_site, '', PATH_txdam);
        #$size = 'width="200" height="55"';
        #$playerRelPath .= 'res/emff_lila.swf';
        $size = 'width="120" height="37"';
        $playerRelPath .= 'res/emff_inx.swf';
        $outArr['htmlCode'] = '<div class="previewMP3">
			<object type="application/x-shockwave-flash" data="' . htmlspecialchars($siteUrl . $playerRelPath) . '?streaming=yes&src=' . htmlspecialchars($siteUrl . t3lib_div::rawUrlEncodeFP($fileRelPath)) . '" ' . $size . '>
			<param name="movie" value="' . htmlspecialchars($siteUrl . $playerRelPath) . '?streaming=yes&src=' . htmlspecialchars($siteUrl . t3lib_div::rawUrlEncodeFP($fileRelPath)) . '" />
			<param name="quality" value="high" />
			</object>
			</div>';
        return $outArr;
    }
 /**
  * Returns a <img> tag with the image file defined by $file and processed according to the properties in the TypoScript array.
  * Mostly this function is a sub-function to the IMAGE function which renders the IMAGE cObject in TypoScript.
  * This function is called by "$this->cImage($conf['file'],$conf);" from IMAGE().
  *
  * @param	string		File TypoScript resource
  * @param	array		TypoScript configuration properties
  * @return	string		<img> tag, (possibly wrapped in links and other HTML) if any image found.
  * @access private
  * @see IMAGE()
  */
 function cImage($file, $conf)
 {
     $info = $this->getImgResource($file, $conf['file.']);
     $GLOBALS['TSFE']->lastImageInfo = $info;
     if (is_array($info)) {
         $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
         $GLOBALS['TSFE']->imagesOnPage[] = $info[3];
         // This array is used to collect the image-refs on the page...
         // Backwards compatibility if altText is not set and alttext is set
         // @deprecated since TYPO3 4.3, will be removed in TYPO3 4.6
         if (strlen($conf['alttext']) || is_array($conf['alttext.'])) {
             $GLOBALS['TSFE']->logDeprecatedTyposcript('IMAGE.alttext', 'use IMAGE.altText instead - src: ' . $info[3] . ' - original image: ' . $info['origFile']);
             if (!strlen($conf['altText']) && !is_array($conf['altText.'])) {
                 $conf['altText'] = $conf['alttext'];
                 $conf['altText.'] = $conf['alttext.'];
             }
         }
         $altParam = $this->getAltParam($conf);
         if ($conf['params'] && !isset($conf['params.'])) {
             $params = ' ' . $conf['params'];
         } else {
             $params = isset($conf['params.']) ? ' ' . $this->stdWrap($conf['params'], $conf['params.']) : '';
         }
         $theValue = '<img src="' . htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . t3lib_div::rawUrlEncodeFP($info[3])) . '" width="' . $info[0] . '" height="' . $info[1] . '"' . $this->getBorderAttr(' border="' . intval($conf['border']) . '"') . $params . $altParam . ' />';
         $linkWrap = isset($conf['linkWrap.']) ? $this->stdWrap($conf['linkWrap'], $conf['linkWrap.']) : $conf['linkWrap'];
         if ($linkWrap) {
             $theValue = $this->linkWrap($theValue, $linkWrap);
         } elseif ($conf['imageLinkWrap']) {
             $theValue = $this->imageLinkWrap($theValue, $info['origFile'], $conf['imageLinkWrap.']);
         }
         $wrap = isset($conf['wrap.']) ? $this->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
         if ($wrap) {
             $theValue = $this->wrap($theValue, $conf['wrap']);
         }
         return $theValue;
     }
 }
 /**
  *  This substitutes the http:// urls in plain text with links
  *
  * @param	string		$content: the content to use to substitute
  * @return	string		the changed content
  */
 public function substHTTPurlsInPlainText($content)
 {
     if (!$this->jumperURL_prefix) {
         return $content;
     }
     $textpieces = explode("http://", $content);
     $pieces = count($textpieces);
     $textstr = $textpieces[0];
     for ($i = 1; $i < $pieces; $i++) {
         $len = strcspn($textpieces[$i], chr(32) . TAB . CRLF);
         if (trim(substr($textstr, -1)) == '' && $len) {
             $lastChar = substr($textpieces[$i], $len - 1, 1);
             if (!preg_match('/[A-Za-z0-9\\/#]/', $lastChar)) {
                 $len--;
             }
             $parts = array();
             $parts[0] = "http://" . substr($textpieces[$i], 0, $len);
             $parts[1] = substr($textpieces[$i], $len);
             if ($this->jumperURL_useId) {
                 $this->theParts['plain']['link_ids'][$i] = $parts[0];
                 $parts[0] = $this->jumperURL_prefix . '-' . $i;
             } else {
                 $parts[0] = $this->jumperURL_prefix . t3lib_div::rawUrlEncodeFP($parts[0]);
             }
             $textstr .= $parts[0] . $parts[1];
         } else {
             $textstr .= 'http://' . $textpieces[$i];
         }
     }
     return $textstr;
 }
 /**
  * For RTE: This displays all files from folder. No thumbnails shown
  *
  * @param	string		The folder path to expand
  * @param	string		List of fileextensions to show
  * @return	string		HTML output
  */
 function expandFolder($expandFolder = 0, $extensionList = '')
 {
     global $BACK_PATH;
     $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
     $out = '';
     if ($expandFolder && $this->checkFolder($expandFolder)) {
         // Create header for filelisting:
         $out .= $this->barheader($GLOBALS['LANG']->getLL('files') . ':');
         // Prepare current path value for comparison (showing red arrow)
         if (!$this->curUrlInfo['value']) {
             $cmpPath = '';
         } else {
             $cmpPath = PATH_site . $this->curUrlInfo['info'];
         }
         // Create header element; The folder from which files are listed.
         $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
         $picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
         $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
         $picon = '<a href="#" onclick="return link_folder(\'' . t3lib_div::rawUrlEncodeFP(substr($expandFolder, strlen(PATH_site))) . '\');">' . $picon . '</a>';
         if ($this->curUrlInfo['act'] == 'folder' && $cmpPath == $expandFolder) {
             $out .= '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
         }
         $out .= $picon . '<br />';
         // Get files from the folder:
         if ($this->mode == 'wizard' && $this->act == 'folder') {
             $files = t3lib_div::get_dirs($expandFolder);
         } else {
             $files = t3lib_div::getFilesInDir($expandFolder, $extensionList, 1, 1);
             // $extensionList='', $prependPath=0, $order='')
         }
         $c = 0;
         $cc = count($files);
         if (is_array($files)) {
             foreach ($files as $filepath) {
                 $c++;
                 $fI = pathinfo($filepath);
                 if ($this->mode == 'wizard' && $this->act == 'folder') {
                     $filepath = $expandFolder . $filepath . '/';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
                 } else {
                     // File icon:
                     $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                     // Get size and icon:
                     $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes)';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
                 }
                 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
                 if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $cmpPath == $filepath) {
                     $arrCol = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
                 } else {
                     $arrCol = '';
                 }
                 // Put it all together for the file element:
                 $out .= '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/ol/join' . ($c == $cc ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . $arrCol . '<a href="#" onclick="return link_folder(\'' . t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site))) . '\');">' . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . '</a><br />';
             }
         }
     }
     return $out;
 }
 /**
  * Resizes a given image (if required) and renders the respective img tag
  * @see http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4164427
  *
  * @param string $src
  * @param string $width width of the image. This can be a numeric value representing the fixed width of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
  * @param string $height height of the image. This can be a numeric value representing the fixed height of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
  * @param integer $minWidth minimum width of the image
  * @param integer $minHeight minimum height of the image
  * @param integer $maxWidth maximum width of the image
  * @param integer $maxHeight maximum height of the image
  *
  * @return string rendered tag.
  * @author Mario Matzulla <*****@*****.**>
  */
 public function render($src, $width = NULL, $height = NULL, $minWidth = NULL, $minHeight = NULL, $maxWidth = NULL, $maxHeight = NULL)
 {
     if (TYPO3_MODE === 'BE') {
         $this->simulateFrontendEnvironment();
     }
     $setup = array('width' => $width, 'height' => $height, 'minW' => $minWidth, 'minH' => $minHeight, 'maxW' => $maxWidth, 'maxH' => $maxHeight);
     if (TYPO3_MODE === 'BE' && substr($src, 0, 3) === '../') {
         $src = substr($src, 3);
     }
     $imageInfo = $this->contentObject->getImgResource($src, $setup);
     $GLOBALS['TSFE']->lastImageInfo = $imageInfo;
     if (!is_array($imageInfo)) {
         throw new Tx_Fluid_Core_ViewHelper_Exception('Could not get image resource for "' . htmlspecialchars($src) . '".', 1253191060);
     }
     $imageInfo[3] = $this->png_to_jpg_by_imagemagick($imageInfo[3]);
     $GLOBALS['TSFE']->imagesOnPage[] = $imageInfo[3];
     $imageSource = $GLOBALS['TSFE']->absRefPrefix . t3lib_div::rawUrlEncodeFP($imageInfo[3]);
     if (TYPO3_MODE === 'BE') {
         $imageSource = '../' . $imageSource;
         $this->resetFrontendEnvironment();
     }
     $this->tag->addAttribute('src', $imageSource);
     $this->tag->addAttribute('width', $imageInfo[0]);
     $this->tag->addAttribute('height', $imageInfo[1]);
     if ($this->arguments['title'] === '') {
         $this->tag->addAttribute('title', $this->arguments['alt']);
     }
     return $this->tag->render();
 }
示例#7
0
    function catXMLExportImportAction($l10ncfgObj)
    {
        global $LANG, $BACK_PATH, $BE_USER;
        $allowedSettingFiles = array('across' => 'acrossL10nmgrConfig.dst', 'dejaVu' => 'dejaVuL10nmgrConfig.dvflt', 'memoq' => 'memoQ.mqres', 'transit' => 'StarTransit_XML_UTF_TYPO3.FFD', 'sdltrados2007' => 'SDLTradosTagEditor.ini', 'sdltrados2009' => 'TYPO3_l10nmgr.sdlfiletype', 'sdlpassolo' => 'SDLPassolo.xfg');
        /** @var $service tx_l10nmgr_l10nBaseService */
        $service = t3lib_div::makeInstance('tx_l10nmgr_l10nBaseService');
        $info = '<br/>';
        $info .= '<input type="submit" value="' . $LANG->getLL('general.action.refresh.button.title') . '" name="_" /><br /><br/>';
        $info .= '<div id="ddtabs" class="basictab" style="border:0px solid gray;margin:0px;">
                                <ul style="border:0px solid #999999; ">
                                <li><a onClick="expandcontent(\'sc1\', this)" style="margin:0px;">' . $LANG->getLL('export.xml.headline.title') . '</a></li>
                                <li><a onClick="expandcontent(\'sc2\', this)" style="margin:0px;">' . $LANG->getLL('import.xml.headline.title') . '</a></li>
                                <li><a onClick="expandcontent(\'sc3\', this)" style="margin:0px;">' . $LANG->getLL('file.settings.downloads.title') . '</a></li>
                                <li><a onClick="expandcontent(\'sc4\', this)" style="margin:0px;">' . $LANG->getLL('l10nmgr.documentation.title') . '</a></li>
				</ul></div>';
        $info .= '<div id="tabcontentcontainer" style="height:150px;border:1px solid gray;padding-right:5px;width:100%;">';
        $info .= '<div id="sc1" class="tabcontent">';
        //$info .= '<div id="sc1" class="tabcontent">';
        $_selectOptions = array('0' => '-default-');
        $_selectOptions = $_selectOptions + $this->MOD_MENU["lang"];
        $info .= '<input type="checkbox" value="1" name="check_exports" /> ' . $LANG->getLL('export.xml.check_exports.title') . '<br />';
        $info .= '<input type="checkbox" value="1" name="no_check_xml" /> ' . $LANG->getLL('export.xml.no_check_xml.title') . '<br />';
        $info .= '<input type="checkbox" value="1" name="check_utf8" /> ' . $LANG->getLL('export.xml.checkUtf8.title') . '<br />';
        $info .= $LANG->getLL('export.xml.source-language.title') . $this->_getSelectField("export_xml_forcepreviewlanguage", '0', $_selectOptions) . '<br />';
        // Add the option to send to FTP server, if FTP information is defined
        if (!empty($this->lConf['ftp_server']) && !empty($this->lConf['ftp_server_username']) && !empty($this->lConf['ftp_server_password'])) {
            $info .= '<input type="checkbox" value="1" name="ftp_upload" id="tx_l10nmgr_ftp_upload" /> <label for="tx_l10nmgr_ftp_upload">' . $GLOBALS['LANG']->getLL('export.xml.ftp.title') . '</label>';
        }
        $info .= '<br /><br/>';
        $info .= '<input type="submit" value="Export" name="export_xml" /><br /><br /><br/>';
        $info .= '</div>';
        $info .= '<div id="sc2" class="tabcontent">';
        $info .= '<input type="checkbox" value="1" name="make_preview_link" /> ' . $LANG->getLL('import.xml.make_preview_link.title') . '<br />';
        $info .= '<input type="checkbox" value="1" name="import_delL10N" /> ' . $LANG->getLL('import.xml.delL10N.title') . '<br />';
        $info .= '<input type="checkbox" value="1" name="import_oldformat" /> ' . $LANG->getLL('import.xml.old-format.title') . '<br /><br />';
        $info .= '<input type="file" size="60" name="uploaded_import_file" /><br /><br /><input type="submit" value="Import" name="import_xml" /><br /><br /> ';
        $info .= '</div>';
        $info .= '<div id="sc3" class="tabcontent">';
        $info .= $this->doc->icons(1) . $LANG->getLL('file.settings.available.title');
        for (reset($allowedSettingFiles); list($settingId, $settingFileName) = each($allowedSettingFiles);) {
            $currentFile = t3lib_div::resolveBackPath($BACK_PATH . t3lib_extMgm::extRelPath('l10nmgr') . 'settings/' . $settingFileName);
            if (is_file($currentFile) && is_readable($currentFile)) {
                $size = t3lib_div::formatSize((int) filesize($currentFile), ' Bytes| KB| MB| GB');
                $info .= '<br/><a href="' . t3lib_div::rawUrlEncodeFP($currentFile) . '" title="' . $LANG->getLL('file.settings.download.title') . '" target="_blank">' . $LANG->getLL('file.settings.' . $settingId . '.title') . ' (' . $size . ')' . '</a> ';
            }
        }
        $info .= '</div>';
        $info .= '<div id="sc4" class="tabcontent">';
        $info .= '<a href="' . t3lib_extMgm::extRelPath('l10nmgr') . 'doc/manual.sxw" target="_new">Download</a>';
        $info .= '</div>';
        $info .= '</div>';
        $actionInfo = '';
        // Read uploaded file:
        if (t3lib_div::_POST('import_xml') && $_FILES['uploaded_import_file']['tmp_name'] && is_uploaded_file($_FILES['uploaded_import_file']['tmp_name'])) {
            $uploadedTempFile = t3lib_div::upload_to_tempfile($_FILES['uploaded_import_file']['tmp_name']);
            /** @var $factory tx_l10nmgr_translationDataFactory */
            $factory = t3lib_div::makeInstance('tx_l10nmgr_translationDataFactory');
            //print "<pre>";
            //var_dump($GLOBALS['BE_USER']->user);
            //print "</pre>";
            if (t3lib_div::_POST('import_oldformat') == '1') {
                //Support for the old Format of XML Import (without pageGrp element)
                $actionInfo .= $LANG->getLL('import.xml.old-format.message');
                $translationData = $factory->getTranslationDataFromOldFormatCATXMLFile($uploadedTempFile);
                $translationData->setLanguage($this->sysLanguage);
                $service->saveTranslation($l10ncfgObj, $translationData);
                $actionInfo .= '<br/><br/>' . $this->doc->icons(1) . 'Import done<br/><br/>(Command count:' . $service->lastTCEMAINCommandsCount . ')';
            } else {
                // Relevant processing of XML Import with the help of the Importmanager
                /** @var $importManager tx_l10nmgr_CATXMLImportManager */
                $importManager = t3lib_div::makeInstance('tx_l10nmgr_CATXMLImportManager', $uploadedTempFile, $this->sysLanguage, $xmlString = "");
                if ($importManager->parseAndCheckXMLFile() === false) {
                    $actionInfo .= '<br/><br/>' . $this->doc->header($LANG->getLL('import.error.title')) . $importManager->getErrorMessages();
                } else {
                    if (t3lib_div::_POST('import_delL10N') == '1') {
                        $actionInfo .= $LANG->getLL('import.xml.delL10N.message') . '<br/>';
                        $delCount = $importManager->delL10N($importManager->getDelL10NDataFromCATXMLNodes($importManager->xmlNodes));
                        $actionInfo .= sprintf($LANG->getLL('import.xml.delL10N.count.message'), $delCount) . '<br/><br/>';
                    }
                    if (t3lib_div::_POST('make_preview_link') == '1') {
                        $pageIds = $importManager->getPidsFromCATXMLNodes($importManager->xmlNodes);
                        $actionInfo .= '<b>' . $LANG->getLL('import.xml.preview_links.title') . '</b><br/>';
                        /** @var $mkPreviewLinks tx_l10nmgr_mkPreviewLinkService */
                        $mkPreviewLinks = t3lib_div::makeInstance('tx_l10nmgr_mkPreviewLinkService', $t3_workspaceId = $importManager->headerData['t3_workspaceId'], $t3_sysLang = $importManager->headerData['t3_sysLang'], $pageIds);
                        $actionInfo .= $mkPreviewLinks->renderPreviewLinks($mkPreviewLinks->mkPreviewLinks());
                    }
                    $translationData = $factory->getTranslationDataFromCATXMLNodes($importManager->getXMLNodes());
                    $translationData->setLanguage($this->sysLanguage);
                    //$actionInfo.="<pre>".var_export($GLOBALS['BE_USER'],true)."</pre>";
                    unset($importManager);
                    $service->saveTranslation($l10ncfgObj, $translationData);
                    $actionInfo .= '<br/>' . $this->doc->icons(-1) . $LANG->getLL('import.xml.done.message') . '<br/><br/>(Command count:' . $service->lastTCEMAINCommandsCount . ')';
                }
            }
            t3lib_div::unlink_tempfile($uploadedTempFile);
        }
        // If export of XML is asked for, do that (this will exit and push a file for download, or upload to FTP is option is checked)
        if (t3lib_div::_POST('export_xml')) {
            // Save user prefs
            $BE_USER->pushModuleData('l10nmgr/cm1/checkUTF8', t3lib_div::_POST('check_utf8'));
            // Render the XML
            /** @var $viewClass tx_l10nmgr_CATXMLView */
            $viewClass = t3lib_div::makeInstance('tx_l10nmgr_CATXMLView', $l10ncfgObj, $this->sysLanguage);
            $export_xml_forcepreviewlanguage = intval(t3lib_div::_POST('export_xml_forcepreviewlanguage'));
            if ($export_xml_forcepreviewlanguage > 0) {
                $viewClass->setForcedSourceLanguage($export_xml_forcepreviewlanguage);
            }
            if ($this->MOD_SETTINGS['onlyChangedContent']) {
                $viewClass->setModeOnlyChanged();
            }
            if ($this->MOD_SETTINGS['noHidden']) {
                $viewClass->setModeNoHidden();
            }
            // Check the export
            if (t3lib_div::_POST('check_exports') == '1' && $viewClass->checkExports() == FALSE) {
                /** @var $flashMessage t3lib_FlashMessage */
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('export.process.duplicate.message'), $LANG->getLL('export.process.duplicate.title'), t3lib_FlashMessage::INFO);
                $actionInfo .= $flashMessage->render();
                $actionInfo .= $viewClass->renderExports();
            } else {
                // Upload to FTP
                if (t3lib_div::_POST('ftp_upload') == '1') {
                    try {
                        $filename = $this->uploadToFtp($viewClass);
                        // Send a mail notification
                        $this->emailNotification($filename, $l10ncfgObj, $this->sysLanguage);
                        // Prepare a success message for display
                        $title = $GLOBALS['LANG']->getLL('export.ftp.success');
                        $message = sprintf($GLOBALS['LANG']->getLL('export.ftp.success.detail'), $this->lConf['ftp_server_path'] . $filename);
                        $status = t3lib_FlashMessage::OK;
                    } catch (Exception $e) {
                        // Prepare an error message for display
                        $title = $GLOBALS['LANG']->getLL('export.ftp.error');
                        $message = $e->getMessage() . ' (' . $e->getCode() . ')';
                        $status = t3lib_FlashMessage::ERROR;
                    }
                    /** @var $flashMessage t3lib_FlashMessage */
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $message, $title, $status);
                    $actionInfo .= $flashMessage->render();
                    $actionInfo .= $viewClass->renderInternalMessagesAsFlashMessage($status);
                    // Download the XML file
                } else {
                    try {
                        $filename = $this->downloadXML($viewClass);
                        // Prepare a success message for display
                        $link = sprintf('<a href="%s" target="_blank">%s</a>', t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $filename, $filename);
                        $title = $GLOBALS['LANG']->getLL('export.download.success');
                        $message = sprintf($GLOBALS['LANG']->getLL('export.download.success.detail'), $link);
                        $status = t3lib_FlashMessage::OK;
                    } catch (Exception $e) {
                        // Prepare an error message for display
                        $title = $GLOBALS['LANG']->getLL('export.download.error');
                        $message = $e->getMessage() . ' (' . $e->getCode() . ')';
                        $status = t3lib_FlashMessage::ERROR;
                    }
                    /** @var $flashMessage t3lib_FlashMessage */
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $message, $title, $status);
                    $actionInfo .= $flashMessage->render();
                    $actionInfo .= $viewClass->renderInternalMessagesAsFlashMessage($status);
                }
            }
        }
        if (!empty($actionInfo)) {
            $info .= $this->doc->header($LANG->getLL('misc.messages.title'));
            $info .= $actionInfo;
        }
        $info .= '</div>';
        return $info;
    }
 /**
  * @param	[type]		$expandFolder: ...
  * @param	[type]		$plainFlag: ...
  * @return	[type]		...
  */
 function expandFolder($expandFolder = 0, $plainFlag = 0, $noThumbs = 0)
 {
     global $LANG;
     $expandFolder = $expandFolder ? $expandFolder : t3lib_div::_GP("expandFolder");
     $out = "";
     $resolutionLimit_x = $this->thisConfig['typo3filemanager.']['maxPlainImages.']['width'];
     $resolutionLimit_y = $this->thisConfig['typo3filemanager.']['maxPlainImages.']['height'];
     if ($expandFolder) {
         $files = t3lib_div::getFilesInDir($expandFolder, $plainFlag ? "jpg,jpeg,gif,png" : $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"], 1, 1);
         // $extensionList="",$prependPath=0,$order="")
         if (is_array($files)) {
             reset($files);
             $titleLen = intval($GLOBALS["BE_USER"]->uc["titleLen"]);
             $picon = '<img src="' . $this->doc->backPath . 'gfx/i/_icon_webfolders.gif" width="18" height="16" alt="folder" />';
             $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
             $out .= '<span class="nobr">' . $picon . '</span><br />';
             $imgObj = t3lib_div::makeInstance("t3lib_stdGraphic");
             $imgObj->init();
             $imgObj->mayScaleUp = 0;
             $imgObj->tempPath = PATH_site . $imgObj->tempPath;
             $lines = array();
             while (list(, $filepath) = each($files)) {
                 $fI = pathinfo($filepath);
                 //$iurl = $this->siteUrl.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site)));
                 $iurl = t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site)));
                 $imgInfo = $imgObj->getImageDimensions($filepath);
                 $icon = t3lib_BEfunc::getFileIcon(strtolower($fI["extension"]));
                 $pDim = $imgInfo[0] . "x" . $imgInfo[1] . " pixels";
                 $size = " (" . t3lib_div::formatSize(filesize($filepath)) . "bytes, " . $pDim . ")";
                 $icon = '<img src="' . $this->doc->backPath . 'gfx/fileicons/' . $icon . '" style="width: 18px; height: 16px; border: none;" title="' . $fI["basename"] . $size . '" class="absmiddle" alt="' . $icon . '" />';
                 if (!$plainFlag) {
                     $ATag = '<a href="#" onclick="return jumpToUrl(\'?insertMagicImage=' . rawurlencode($filepath) . '\');">';
                 } else {
                     $ATag = '<a href="#" onclick="return insertImage(\'' . $iurl . '\',' . $imgInfo[0] . ',' . $imgInfo[1] . ');">';
                 }
                 $ATag_e = "</a>";
                 if ($plainFlag && ($imgInfo[0] > $resolutionLimit_x || $imgInfo[1] > $resolutionLimit_y)) {
                     $ATag = "";
                     $ATag_e = "";
                     $ATag2 = "";
                     $ATag2_e = "";
                 } else {
                     $ATag2 = '<a href="#" onclick="launchView(\'' . rawurlencode($filepath) . '\'); return false;">';
                     $ATag2_e = "</a>";
                 }
                 $filenameAndIcon = $ATag . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . $ATag_e;
                 $lines[] = '<tr class="bgColor4"><td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td></tr><tr><td nowrap="nowrap" class="pixel">' . $pDim . '&nbsp;</td></tr>';
                 $lines[] = '<tr><td>' . ($noThumbs ? "" : $ATag2 . t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $filepath, 'hspace="5" vspace="5" border="1"', $this->thisConfig['typo3filemanager.']['thumbs.']['width'] . 'x' . $this->thisConfig['typo3filemanager.']['thumbs.']['height']) . $ATag2_e) . '</td></tr>';
                 $lines[] = '<tr><td><img src="clear.gif" style="width: 1px; height: 3px;" alt="clear" /></td></tr>';
             }
             $out .= '<table border="0" cellpadding="0" cellspacing="1">' . implode("", $lines) . '</table>';
         }
     }
     return $out;
 }
示例#9
0
 /**
  * For RTE: This displays all files from folder. No thumbnails shown
  *
  * @param	string		The folder path to expand
  * @param	string		List of fileextensions to show
  * @return	string		HTML output
  */
 function expandFolder($expandFolder = 0, $extensionList = '')
 {
     global $BACK_PATH;
     $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
     $out = '<table cellspacing="0" cellpadding="0" border="0" style="margin: 0pt; width: 100%;">';
     if ($expandFolder && $this->checkFolder($expandFolder)) {
         // Prepare current path value for comparison (showing red arrow)
         if (!$this->curUrlInfo['value']) {
             $cmpPath = '';
         } else {
             $cmpPath = PATH_site . $this->curUrlInfo['info'];
         }
         // Create header element; The folder from which files are listed.
         $titleLen = 35;
         $picon = '<td style="width: 20px;"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" /></td>';
         $piconLink = htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
         $picon .= '<td colspan="2"><a href="#" onclick="return link_insert(\'' . t3lib_div::rawUrlEncodeFP(substr($expandFolder, strlen(PATH_site))) . '\');">' . $piconLink . '</a></td>';
         if ($this->curUrlInfo['act'] == 'folder' && $cmpPath == $expandFolder) {
             $out .= '<tr style="background: #b7bac0;">';
             //$out.= '<img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
         } else {
             $out .= '<tr>';
         }
         $out .= $picon . '</tr>';
         // Get files from the folder:
         if ($this->mode == 'wizard' && $this->act == 'folder') {
             $files = t3lib_div::get_dirs($expandFolder);
         } else {
             $files = t3lib_div::getFilesInDir($expandFolder, $extensionList, 1, 1);
             // $extensionList='', $prependPath=0, $order='')
         }
         $c = 0;
         $cc = count($files);
         if (is_array($files)) {
             foreach ($files as $filepath) {
                 $c++;
                 $fI = pathinfo($filepath);
                 if ($this->mode == 'wizard' && $this->act == 'folder') {
                     $filepath = $expandFolder . $filepath . '/';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
                 } else {
                     // File icon:
                     $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                     // Get size and icon:
                     $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes)';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
                 }
                 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
                 if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $cmpPath == $filepath) {
                     $current = 'style="background: #b7bac0;"';
                     //$arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
                 } else {
                     $current = '';
                     //$arrCol='';
                 }
                 // Put it all together for the file element:
                 $out .= '<tr ' . $current . '>' . '<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/ol/join' . ($c == $cc ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" /></td>' . '<td style="width: 18px;">' . $icon . '</td>' . '<td><a href="#" onclick="return link_insert(\'' . t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site))) . '\');">' . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . '</a></td></tr>';
             }
         }
     }
     $out .= '</table>';
     return $out;
 }
 /**
  * Creates a list of uploaded files
  *
  * @param	array		$log: ...
  * @return	string		HTML content
  */
 function getUploadedFileList($files)
 {
     global $BACK_PATH, $LANG;
     $content = '';
     // init table layout
     $tableLayout = array('table' => array('<table border="0" cellpadding="1" cellspacing="1" id="typo3-filelist">', '</table>'), 'defRow' => array('tr' => array('<tr>', '</tr>'), 'defCol' => array('<td valign="middle" class="bgColor4">', '</td>'), '990' => array('<td valign="middle" class="bgColor4">', '</td>'), '996' => array('<td valign="middle" class="bgColor5">', '</td>')), '0' => array('tr' => array('<tr class="c-headLine">', '</tr>'), 'defCol' => array('<td valign="middle" class="c-headLine">', '</td>'), '2' => array('<td valign="middle" class="c-headLine" style="width:165px;">', '</td>')));
     $table = array();
     $tr = 0;
     // header
     $td = 0;
     $table[$tr][$td++] = '&nbsp;';
     $table[$tr][$td++] = '&nbsp;';
     $table[$tr][$td++] = $LANG->getLL('c_file');
     $table[$tr][$td++] = $LANG->getLL('c_fileext');
     $table[$tr][$td++] = $LANG->getLL('c_tstamp');
     $table[$tr][$td++] = $LANG->getLL('c_size');
     # $table[$tr][$td++] = $LANG->getLL('c_rw');
     $table[$tr][$td++] = '&nbsp;';
     if (is_object($this->ebObj) && !$this->rteMode) {
         $table[$tr][$td++] = '&nbsp;';
     }
     $addAllJS = '';
     foreach ($files as $item) {
         $tr++;
         $row = $item['meta'];
         $fileIcon = tx_dam::icon_getFileTypeImgTag($row, 'title="' . htmlspecialchars($row['file_type']) . '"');
         // Add row to table
         $td = 0;
         if ($row['uid']) {
             #$table[$tr][$td++] = $this->pObj->doc->icons(-1); // Ok;
             $table[$tr][$td++] = $this->enableBatchProcessing ? '<input type="checkbox" name="process_recs[]" value="' . $row['uid'] . '" />' : '';
             $table[$tr][$td++] = $fileIcon;
             // if upload is called from RTE, allow direct linking by a click on file name
             if ($this->rteMode && is_object($this->ebObj)) {
                 $row = $this->ebObj->enhanceItemArray($row, $this->ebObj->mode);
                 $onClick = 'return link_folder(' . t3lib_div::quoteJSvalue(t3lib_div::rawUrlEncodeFP(tx_dam::file_relativeSitePath($row['_ref_file_path']))) . ');';
                 $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                 $table[$tr][$td++] = $ATag_insert . htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30)) . '</a>';
             } else {
                 $table[$tr][$td++] = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30));
             }
             $table[$tr][$td++] = htmlspecialchars(strtoupper($row['file_type']));
             $table[$tr][$td++] = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['file_ctime']);
             $table[$tr][$td++] = htmlspecialchars(t3lib_div::formatSize($row['file_size']));
             $table[$tr][$td++] = $this->pObj->btn_editRec_inNewWindow('tx_dam', $item['uid']);
             if (is_object($this->ebObj)) {
                 if (intval($row['uid']) && !$this->rteMode) {
                     $row = $this->ebObj->enhanceItemArray($row, $this->ebObj->mode);
                     $iconFile = tx_dam::icon_getFileType($row);
                     $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($row);
                     // JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
                     $onClick_params = implode(', ', array("'" . $row['_ref_table'] . "'", "'" . $row['_ref_id'] . "'", "'" . $this->ebObj->mode . "'", t3lib_div::quoteJSvalue($row['file_name']), t3lib_div::quoteJSvalue($row['_ref_file_path']), "'" . $row['file_type'] . "'", "'" . $iconFile . "'"));
                     $onClick = 'return insertElement(' . $onClick_params . ');';
                     $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                     $onClick = 'return insertElement(' . $onClick_params . ', \'\', 1);';
                     $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                     $addAllJS .= 'insertElement(' . $onClick_params . '); ';
                     $table[$tr][$td++] = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a>';
                 } elseif ($this->rteMode) {
                     continue;
                 } else {
                     $table[$tr][$td++] = '';
                 }
             }
         } else {
             // failure
             $table[$tr][$td++] = $this->pObj->doc->icons(2);
             // warning
             $table[$tr][$td++] = $fileIcon;
             $table[$tr][$td++] = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30));
             $table[$tr][$td++] = htmlspecialchars(strtoupper($row['file_type']));
             $table[$tr][$td++] = '';
             $table[$tr][$td++] = '';
             $table[$tr][$td++] = htmlspecialchars($this->getErrorMsgFromItem($item));
         }
     }
     // render table
     if ($tr) {
         $code = '';
         // folder_link expects a form named ltargetform to look for link settings, so we need this if it's called from RTE
         if ($this->rteMode) {
             $code .= '<form action="" name="ltargetform" id="ltargetform"></form>';
         }
         $code .= $this->pObj->doc->table($table, $tableLayout);
         if ($addAllJS) {
             $label = $LANG->getLL('eb_addAllToList', true);
             $titleAttrib = ' title="' . $label . '"';
             $onClick = $addAllJS . 'return true;';
             $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
             $addIcon = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />';
             $addAllButton = '<div style="margin:1em 0 1em 1em;"><span class="button"' . $titleAttrib . '>' . $ATag_add . $addIcon . $label . '</a></span></div>';
             $code = $code . $addAllButton;
         }
     } else {
         $code = false;
     }
     return $code;
 }
 /**
  * Returns a <img> tag with the image file defined by $file and processed according to the properties in the TypoScript array.
  * Mostly this function is a sub-function to the IMAGE function which renders the IMAGE cObject in TypoScript. This function is called by "$this->cImage($conf['file'],$conf);" from IMAGE().
  *
  * @param	string		File TypoScript resource
  * @param	array		TypoScript configuration properties
  * @return	string		<img> tag, (possibly wrapped in links and other HTML) if any image found.
  * @access private
  * @see IMAGE()
  */
 function cImage($file, $conf)
 {
     $info = $this->getImgResource($file, $conf['file.']);
     $GLOBALS['TSFE']->lastImageInfo = $info;
     if (is_array($info)) {
         $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
         $GLOBALS['TSFE']->imagesOnPage[] = $info[3];
         // This array is used to collect the image-refs on the page...
         if (!strlen($conf['altText']) && !is_array($conf['altText.'])) {
             // Backwards compatible:
             if ($conf['altText'] || $conf['altText.']) {
                 $GLOBALS['TSFE']->logDeprecatedTyposcript('IMAGE.alttext');
             }
             $conf['altText'] = $conf['alttext'];
             $conf['altText.'] = $conf['alttext.'];
         }
         $altParam = $this->getAltParam($conf);
         $theValue = '<img src="' . htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . t3lib_div::rawUrlEncodeFP($info[3])) . '" width="' . $info[0] . '" height="' . $info[1] . '"' . $this->getBorderAttr(' border="' . intval($conf['border']) . '"') . ($conf['params'] || is_array($conf['params.']) ? ' ' . $this->stdWrap($conf['params'], $conf['params.']) : '') . $altParam . ' />';
         if ($conf['linkWrap']) {
             $theValue = $this->linkWrap($theValue, $conf['linkWrap']);
         } elseif ($conf['imageLinkWrap']) {
             $theValue = $this->imageLinkWrap($theValue, $info['origFile'], $conf['imageLinkWrap.']);
         }
         return $this->wrap($theValue, $conf['wrap']);
     }
 }
示例#12
0
 /**
  * Returns the proper new src value for an img tag
  *
  * @param string $src
  * @param array $setup
  * @return string
  */
 protected function renderImage($src, $setup)
 {
     if (TYPO3_MODE === 'BE' && substr($src, 0, 3) === '../') {
         $src = substr($src, 3);
     }
     if (strpos($src, PATH_site) === 0) {
         $src = str_replace(PATH_site, '', $src);
     }
     $imageInfo = $this->contentObject->getImgResource($src, $setup);
     $GLOBALS['TSFE']->lastImageInfo = $imageInfo;
     if (!is_array($imageInfo)) {
         throw new Tx_Fluid_Core_ViewHelper_Exception('Could not get image resource for "' . htmlspecialchars($src) . '".', 1253191060);
     }
     $GLOBALS['TSFE']->imagesOnPage[] = $imageInfo[3];
     $imageSource = $GLOBALS['TSFE']->absRefPrefix . t3lib_div::rawUrlEncodeFP($imageInfo[3]);
     if (TYPO3_MODE === 'BE' && strpos($imageSource, '/') !== 0) {
         $imageSource = '/' . $imageSource;
     }
     $imageSourceOver = NULL;
     if ($this->arguments['mouseoverSuffix'] != '') {
         $srcImg = explode('.', $src);
         $srcMouseoverImg = $srcImg[0] . $this->arguments['mouseoverSuffix'] . '.' . $srcImg[1];
         $imageInfoMouseover = $this->contentObject->getImgResource($srcMouseoverImg, $setup);
         if (!is_array($imageInfoMouseover)) {
             throw new Tx_Fluid_Core_ViewHelper_Exception('Could not get image resource for "' . htmlspecialchars($srcMouseoverImg) . '".', 1253191060);
         }
         $GLOBALS['TSFE']->imagesOnPage[] = $imageInfoMouseover[3];
         $imageSourceOver = $GLOBALS['TSFE']->absRefPrefix . t3lib_div::rawUrlEncodeFP($imageInfoMouseover[3]);
         if (TYPO3_MODE === 'BE') {
             if (strpos($imageSource, '/') !== 0) {
                 $imageSourceOver = '/' . $imageSourceOver;
             }
             $this->resetFrontendEnvironment();
         }
     }
     return array($imageSource, $imageSourceOver);
 }
 /**
  * @param	[type]		$expandFolder: ...
  * @param	[type]		$plainFlag: ...
  * @return	[type]		...
  */
 function expandFolder($expandFolder = 0, $plainFlag = 0, $noThumbs = 0)
 {
     global $LANG, $BE_USER, $BACK_PATH;
     $expandFolder = $expandFolder ? $expandFolder : t3lib_div::_GP('expandFolder');
     $out = '';
     if ($expandFolder && $this->checkFolder($expandFolder)) {
         $files = t3lib_div::getFilesInDir($expandFolder, $plainFlag ? 'jpg,jpeg,gif,png' : $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 1, 1);
         // $extensionList="",$prependPath=0,$order="")
         if (is_array($files)) {
             $out .= $this->barheader(sprintf($LANG->getLL('images') . ' (%s):', count($files)));
             $titleLen = intval($BE_USER->uc['titleLen']);
             $picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
             $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
             $out .= '<span class="nobr">' . $picon . '</span><br />';
             $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
             $imgObj->init();
             $imgObj->mayScaleUp = 0;
             $imgObj->tempPath = PATH_site . $imgObj->tempPath;
             $lines = array();
             foreach ($files as $filepath) {
                 $fI = pathinfo($filepath);
                 $origFile = t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site)));
                 $iurl = $this->siteURL . $origFile;
                 $imgInfo = $imgObj->getImageDimensions($filepath);
                 // File icon:
                 $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                 $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' ' . $LANG->getLL('pixels', 1);
                 $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . $LANG->getLL('bytes', 1) . ', ' . $pDim . ')';
                 $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
                 $ATag = '<a href="#" onclick="return jumpToUrl(\'?editorNo=' . $this->editorNo . '&insertImage=' . rawurlencode($filepath) . '\');">';
                 $ATag_e = '</a>';
                 if ($plainFlag && ($imgInfo[0] > $this->plainMaxWidth || $imgInfo[1] > $this->plainMaxHeight)) {
                     $ATag = '';
                     $ATag_e = '';
                     $ATag2 = '';
                     $ATag2_e = '';
                 } else {
                     $ATag2 = '<a href="#" onClick="launchView(\'' . rawurlencode($filepath) . '\'); return false;">';
                     $ATag2_e = '</a>';
                 }
                 $filenameAndIcon = $ATag . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . $ATag_e;
                 $lines[] = '<tr class="bgColor4"><td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td><td nowrap="nowrap">' . $pDim . '&nbsp;</td></tr>';
                 $lines[] = '<tr><td colspan="2">' . ($noThumbs ? '' : $ATag2 . t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $filepath, 'hspace="5" vspace="5" border="1"') . $ATag2_e) . '</td></tr>';
                 $lines[] = '<tr><td colspan="2"><img src="clear.gif" width="1" height="3"></td></tr>';
             }
             $out .= '<table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table>';
         }
     }
     return $out;
 }
    /**
     * Render list of files.
     *
     * @param	array		List of files. See t3lib_div::getFilesInDir
     * @param	string		$mode EB mode: "db", "file", ...
     * @return	string		HTML output
     */
    function renderFileList($files, $mode = 'file', $act = '')
    {
        global $LANG, $BACK_PATH, $TCA, $TYPO3_CONF_VARS;
        $out = '';
        // sorting selector
        // TODO move to scbase (see tx_dam_list_thumbs too)
        $allFields = tx_dam_db::getFieldListForUser('tx_dam');
        if (is_array($allFields) && count($allFields)) {
            $fieldsSelItems = array();
            foreach ($allFields as $field => $title) {
                $fL = is_array($TCA['tx_dam']['columns'][$field]) ? preg_replace('#:$#', '', $GLOBALS['LANG']->sL($TCA['tx_dam']['columns'][$field]['label'])) : '[' . $field . ']';
                $fieldsSelItems[$field] = t3lib_div::fixed_lgd_cs($fL, 15);
            }
            $sortingSelector = '<label>' . $GLOBALS['LANG']->sL('LLL:EXT:dam/lib/locallang.xml:labelSorting', 1) . '</label> ';
            $sortingSelector .= t3lib_befunc::getFuncMenu($this->addParams, 'SET[txdam_sortField]', $this->damSC->MOD_SETTINGS['txdam_sortField'], $fieldsSelItems);
            if ($this->damSC->MOD_SETTINGS['txdam_sortRev']) {
                $params = (array) $this->addParams + array('SET[txdam_sortRev]' => '0');
                $href = t3lib_div::linkThisScript($params);
                $sortingSelector .= '<button name="SET[txdam_sortRev]" type="button" onclick="self.location.href=\'' . htmlspecialchars($href) . '\'">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/pil2up.gif', 'width="12" height="7"') . ' alt="" />' . '</button>';
            } else {
                $params = (array) $this->addParams + array('SET[txdam_sortRev]' => '1');
                $href = t3lib_div::linkThisScript($params);
                $sortingSelector .= '<button name="SET[txdam_sortRev]" type="button" onclick="self.location.href=\'' . htmlspecialchars($href) . '\'">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/pil2down.gif', 'width="12" height="7"') . ' alt="" />' . '</button>';
            }
            $sortingSelector = $this->getFormTag('', 'sortingSelector') . $sortingSelector . '</form>';
        }
        $out .= '<div id="medialistfunctions">';
        $out .= $this->getSelectionSelector();
        $out .= $this->getFormTag();
        $out .= $this->damSC->getSearchBox('simple', false, '', true);
        $out .= '</form>';
        $out .= $sortingSelector;
        $out .= '</div>';
        $out .= $this->doc->spacer(10);
        $out .= $this->damSC->getResultInfoBar();
        $out .= $this->doc->spacer(10);
        // Listing the files:
        if (is_array($files) and count($files)) {
            $displayThumbs = $this->displayThumbs();
            $dragdropImage = $mode == 'rte' && ($act == 'dragdrop' || $act == 'media_dragdrop');
            $addAllJS = '';
            $displayItems = '';
            if ($mode == 'rte' && $act == 'media') {
                if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn']) {
                    $displayItems = $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] ? $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] : '';
                }
            }
            // Traverse the file list:
            $lines = array();
            foreach ($files as $fI) {
                if (!$fI['__exists']) {
                    tx_dam::meta_updateStatus($fI);
                    continue;
                }
                // Create file icon:
                $iconFile = tx_dam::icon_getFileType($fI);
                $iconTag = tx_dam_guiFunc::icon_getFileTypeImgTag($fI);
                $iconAndFilename = $iconTag . htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], max($GLOBALS['BE_USER']->uc['titleLen'], 120)));
                // Create links for adding the file:
                if (strstr($fI['file_name_absolute'], ',') || strstr($fI['file_name_absolute'], '|')) {
                    // In case an invalid character is in the filepath, display error message:
                    $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |'));
                    $ATag_insert = '<a href="#" onclick="alert(' . $eMsg . ');return false;">';
                    // If filename is OK, just add it:
                } else {
                    // JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
                    $onClick_params = implode(', ', array("'" . $fI['_ref_table'] . "'", "'" . $fI['_ref_id'] . "'", "'" . $mode . "'", t3lib_div::quoteJSvalue($fI['file_name']), t3lib_div::quoteJSvalue($fI['_ref_file_path']), "'" . $fI['file_type'] . "'", "'" . $iconFile . "'"));
                    $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($fI);
                    if ($mode === 'rte' and $act === 'media') {
                        $onClick = 'return link_folder(\'' . t3lib_div::rawUrlEncodeFP(tx_dam::file_relativeSitePath($fI['_ref_file_path'])) . '\');';
                        if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'txdam')) {
                            $onClick = 'browse_links_setAdditionalValue(\'txdam\', \'' . $fI['uid'] . '\');' . $onClick;
                        }
                        if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn']) {
                            $damTitle = t3lib_div::quoteJSvalue(tx_dam_guiFunc::meta_compileHoverText($fI, $displayItems, ', '));
                            $onClick = 'if (document.getElementById(\'rtehtmlarea-dam-browse-links-useDAMColumn\') && document.getElementById(\'rtehtmlarea-dam-browse-links-useDAMColumn\').checked) { document.getElementById(\'rtehtmlarea-browse-links-anchor_title\').value = ' . $damTitle . '; }' . $onClick;
                        }
                        $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                    } elseif (!$dragdropImage) {
                        $onClick = 'return insertElement(' . $onClick_params . ');';
                        $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                        $addIcon = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a>';
                        $onClick = 'return insertElement(' . $onClick_params . ', \'\', 1);';
                        $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                        $addAllJS .= $mode === 'rte' ? '' : 'insertElement(' . $onClick_params . '); ';
                    }
                }
                // Create link to showing details about the file in a window:
                if ($fI['__exists']) {
                    $infoOnClick = 'launchView(\'' . t3lib_div::rawUrlEncodeFP($fI['file_name_absolute']) . '\', \'\'); return false;';
                    $ATag_info = '<a href="#" onclick="' . htmlspecialchars($infoOnClick) . '">';
                    $info = $ATag_info . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . '</a>';
                    $info = '<span class="button">' . $info . '</span>';
                } else {
                    $info = '&nbsp;';
                }
                // Thumbnail/size generation:
                $clickThumb = '';
                if ($displayThumbs and is_file($fI['file_name_absolute']) and tx_dam_image::isPreviewPossible($fI)) {
                    $addAttrib = array();
                    $addAttrib['title'] = tx_dam_guiFunc::meta_compileHoverText($fI);
                    $clickThumb = tx_dam_image::previewImgTag($fI, '', $addAttrib);
                    $clickThumb = '<div class="clickThumb">' . $ATag_insert . $clickThumb . '</a>' . '</div>';
                } elseif ($displayThumbs) {
                    $clickThumb = '<div style="width:68px"></div>';
                }
                // Image for drag & drop replaces the thumbnail
                if ($dragdropImage and t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) and is_file($fI['file_name_absolute'])) {
                    if (t3lib_div::_GP('noLimit')) {
                        $maxW = 10000;
                        $maxH = 10000;
                    } else {
                        $maxW = 380;
                        $maxH = 500;
                    }
                    $IW = $fI['hpixels'];
                    $IH = $fI['vpixels'];
                    if ($IW > $maxW) {
                        $IH = ceil($IH / $IW * $maxW);
                        $IW = $maxW;
                    }
                    if ($IH > $maxH) {
                        $IW = ceil($IW / $IH * $maxH);
                        $IH = $maxH;
                    }
                    $clickThumb = '<img src="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . substr($fI['file_name_absolute'], strlen(PATH_site)) . '" width="' . $IW . '" height="' . $IH . '"' . ($this->defaultClass ? ' class="' . $this->defaultClass . '"' : '') . ' alt="' . $fI['alt_text'] . '" title="' . $fI[$this->imgTitleDAMColumn] . '" txdam="' . $fI['uid'] . '" />';
                    $clickThumb = '<div class="clickThumb2">' . $clickThumb . '</div>';
                }
                // Show element:
                $lines[] = '
					<tr>
						<td valign="middle" class="bgColor4" nowrap="nowrap" style="min-width:20em">' . ($dragdropImage ? '' : $ATag_insert) . $iconAndFilename . '</a>' . '&nbsp;</td>
						<td valign="middle" class="bgColor4" width="1%">' . ($mode == 'rte' ? '' : $addIcon) . '</td>
						<td valign="middle" nowrap="nowrap" width="1%">' . $info . '</td>
					</tr>';
                $infoText = '';
                if ($this->getModSettings('extendedInfo')) {
                    $infoText = tx_dam_guiFunc::meta_compileInfoData($fI, 'file_name, file_size:filesize, _dimensions, caption:truncate:50, instructions', 'table');
                    $infoText = str_replace('<table>', '<table border="0" cellpadding="0" cellspacing="1">', $infoText);
                    $infoText = str_replace('<strong>', '<strong style="font-weight:normal;">', $infoText);
                    $infoText = str_replace('</td><td>', '</td><td class="bgColor-10">', $infoText);
                }
                if ($displayThumbs || $dragdropImage and $infoText) {
                    $lines[] = '
						<tr class="bgColor">
							<td valign="top" colspan="3">
							<table border="0" cellpadding="0" cellspacing="0"><tr>
								<td valign="top">' . $clickThumb . '</td>
								<td valign="top" style="padding-left:1em">' . $infoText . '</td></tr>
							</table>
							<div style="height:0.5em;"></div>
							</td>
						</tr>';
                } elseif ($clickThumb or $infoText) {
                    $lines[] = '
						<tr class="bgColor">
							<td valign="top" colspan="3" style="padding-left:22px">
							' . $clickThumb . $infoText . '
							<div style="height:0.5em;"></div>
							</td>
						</tr>';
                }
                $lines[] = '
						<tr>
							<td colspan="3"><div style="height:0.5em;"></div></td>
						</tr>';
            }
            // Wrap all the rows in table tags:
            $out .= '



		<!--
			File listing
		-->
				<table border="0" cellpadding="1" cellspacing="0" id="typo3-fileList">
					' . implode('', $lines) . '
				</table>';
        }
        if ($addAllJS) {
            $label = $LANG->getLL('eb_addAllToList', true);
            $titleAttrib = ' title="' . $label . '"';
            $onClick = $addAllJS . 'return true;';
            $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
            $addIcon = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />';
            $addAllButton = '<div class="addAllButton"><span class="button"' . $titleAttrib . '>' . $ATag_add . $addIcon . $label . '</a></span></div>';
            $out = $out . $addAllButton;
        }
        $out .= $this->doc->spacer(20);
        $out .= $this->damSC->getResultInfoBar();
        // Return accumulated content for filelisting:
        return $out;
    }
 private function init($conf, $image)
 {
     // IMAGE_conf
     $this->IMAGE_conf = $conf;
     // fl_conf
     $global_conf = array();
     if (is_array($GLOBALS['TSFE']->tmpl->setup['config.']['fl_realurl_image.'])) {
         $global_conf = $GLOBALS['TSFE']->tmpl->setup['config.']['fl_realurl_image.'];
     }
     $local_conf = array();
     if (is_array($conf['fl_realurl_image.'])) {
         $local_conf = $conf['fl_realurl_image.'];
     }
     $this->fl_conf = t3lib_div::array_merge_recursive_overrule($global_conf, $local_conf, 0, 0);
     // fl_config
     $this->fl_config = $GLOBALS['fl_realurl_image'];
     // image Array
     $this->image = $image;
     // new_fileName
     if ($conf['fl_realurl_image']) {
         $this->new_fileName = $conf['fl_realurl_image'];
     } else {
         $this->new_fileName = $GLOBALS['TSFE']->tmpl->setup['config.']['fl_realurl_image'];
     }
     if ($this->new_fileName == "1") {
         $this->new_fileName = "";
     }
     // enable
     if (strtolower($this->new_fileName) == "off" || $this->new_fileName === 0 || !is_array($GLOBALS['TSFE']->tmpl->setup['config.']['fl_realurl_image.'])) {
         $this->enable = FALSE;
     }
     // org_fileName
     $this->org_fileName = htmlspecialchars(trim(t3lib_div::rawUrlEncodeFP($image[3])));
 }