Documentation TYPO3 par Ameos

index.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00036 unset($MCONF);
00037 require ('conf.php');
00038 require ($BACK_PATH.'init.php');
00039 require ($BACK_PATH.'template.php');
00040 $LANG->includeLLFile('EXT:imagelist/mod/locallang.php');
00041 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
00042 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00043 require_once (PATH_t3lib.'class.t3lib_recordlist.php');
00044 require_once ($BACK_PATH.'class.file_list.inc');
00045 
00046 $BE_USER->modAccess($MCONF,1);
00047 
00048 
00049 
00050 
00051 
00052 // ***************************
00053 // Script Classes
00054 // ***************************
00055 class fileList_ext extends fileList     {
00056         function generateList() {
00057                 $this->files = $this->readDirectory($this->path,'file',$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']);
00058                 $this->totalItems=count($this->files[sorting]);
00059                 $this->HTMLcode.='<BR>'.$this->getImageList($this->files);
00060         }
00061         function addElement($h,$icon,$data,$tdParams="",$lMargin="",$altLine='')        {
00062                 return '<table border=0 cellpadding=0 cellspacing=0><tr><td>'.$altLine.'</td><td>'.$data[$this->fieldArray[0]].'</td></tr></table>';
00063         }
00064         function writeBottom()  {
00065         }
00066         function getImageList($files)   {
00067                 $out='';
00068                 if (count($files[files]))       {
00069                         reset($files[files]);
00070                         while (list(,$imgArr) = each($files[files]))    {
00071                                 list($flag,$code) = $this->fwd_rwd_nav();
00072                                 $out.=$code;
00073                                 if ($flag)      {
00074                                                         // Initialization
00075                                         $out.=$this->renderImage($imgArr);
00076                                         $this->counter++;
00077                                 }
00078                                 $this->eCounter++;
00079                         }
00080                 }
00081                 return $out;
00082         }
00083         function renderImage($imgArr)   {
00084                 global $LANG;
00085                 $fI = $imgArr;
00086                 $file = $imgArr['path'].$imgArr[file];
00087                 $imgInfo='';
00088 
00089                 $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
00090                 $imgObj->init();
00091                 $imgObj->mayScaleUp=0;
00092                 $imgObj->tempPath=PATH_site.$imgObj->tempPath;
00093                 $imgInfo = $imgObj->getImageDimensions($file);
00094                 $ext = $fI['fileext'];
00095 
00096                 if ($imgInfo)   {
00097                         $imgInfo_scaled = $imgObj->imageMagickConvert($file,'web',"346",'200m',"",'',"",1);
00098                         $imgInfo_scaled[3] = $this->backPath.'../'.substr($imgInfo_scaled[3],strlen(PATH_site));
00099                         $imageHTML = $imgObj->imgTag($imgInfo_scaled);
00100 
00101                         $clipBoard = '';
00102                         $infotext='';
00103                         $infotext.='<b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.filesize').':</b><BR>'.t3lib_div::formatSize(@filesize($file)).'<BR><BR>';
00104                         $infotext.='<b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.dimensions').':</b><BR>'.$imgInfo[0].'x'.$imgInfo[1].' pixels<br><br>';
00105                         $infotext.=$clipBoard;
00106 
00107 
00108                         $content.='<table border=0 cellpadding=1 cellspacing=0 width=400>
00109                                 <tr>
00110                                         <td><img src="clear.gif" width=346 height=1></td>
00111                                         <td><img src="clear.gif" width=5 height=1></td>
00112                                         <td><img src="clear.gif" width=100 height=1></td>
00113                                 </tr>
00114                                 <tr><td colspan=3 class="bgColor5"><b>'.fw($fI['file']).'</b></td></tr>
00115                                 <tr><td valign=top>'.$imageHTML.'</td><td></td><td valign=top class="bgColor4">'.fw($infotext).'</td></tr>
00116                         </table><BR>';
00117                 }
00118                 return $content;
00119         }
00120 }
00121 class SC_mod_file_images_index {
00122         var $MCONF=array();
00123         var $MOD_MENU=array();
00124         var $MOD_SETTINGS=array();
00125 
00126         var $content;
00127         var $basicFF;
00128         var $pointer;
00129         var $imagemode;
00130         var $table;
00131         var $id;
00132         var $doc;
00133 
00134         function init() {
00135                 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00136                 $this->MCONF = $GLOBALS['MCONF'];
00137                 $this->id = t3lib_div::_GP('id');
00138 
00139                 $this->pointer = t3lib_div::_GP('pointer');
00140                 $this->imagemode = t3lib_div::_GP('imagemode');
00141                 $this->table = t3lib_div::_GP('table');
00142 
00143                 $this->basicFF = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00144                 $this->basicFF->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00145         }
00146         function main() {
00147                 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00148 
00149                 // **************************
00150                 // Initializing
00151                 // **************************
00152                 $this->doc = t3lib_div::makeInstance('mediumDoc');
00153                 $this->doc->backPath = $BACK_PATH;
00154 
00155                 $this->id = $this->basicFF->is_directory($this->id);
00156                 $access = $this->id && $this->basicFF->checkPathAgainstMounts($this->id.'/');
00157 
00158                 $filelist = t3lib_div::makeInstance('fileList_ext');
00159                 $filelist->backPath = $BACK_PATH;
00160                 $filelist->thumbs = $this->imagemode;
00161                 $filelist->script = 'index.php';
00162                 $filelist->clickMenus = 0;
00163                 $filelist->iLimit = 5;
00164 
00165 
00166                 // **************************
00167                 // Main
00168                 // **************************
00169                 if ($access)    {
00170                         $this->pointer = t3lib_div::intInRange($this->pointer,0,100000);
00171                         $filelist->start($this->id,$this->pointer,'','');
00172                         $filelist->writeTop($this->id);
00173                         $filelist->generateList($this->id,$this->table);
00174                         $filelist->writeBottom();
00175 
00176                                 // JavaScript
00177                         $this->doc->JScode = $this->doc->wrapScriptTags('
00178                                 script_ended = 0;
00179                                 function jumpToUrl(URL) {
00180                                         document.location = URL;
00181                                 }
00182                                 if (top.fsMod) top.fsMod.recentIds["file"] = unescape("'.rawurlencode($this->id).'");
00183                         ');
00184 
00185                                 // Draw the header.
00186                         $this->doc->form = '<form action="" method="post">';
00187                         $this->content.=$this->doc->startPage($LANG->getLL('title'));
00188                         $this->content.=$this->doc->section('',$filelist->HTMLcode);
00189 
00190 
00191                         if ($BE_USER->mayMakeShortcut())        {
00192                                 $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('pointer,id,target,table','',$this->MCONF['name']));
00193                         }
00194                         $this->content.=$this->doc->endPage();
00195                 } else {
00196                         $this->content='';
00197                         $this->content.=$this->doc->startPage($LANG->getLL('title'));
00198                         $this->content.=$this->doc->endPage();
00199                 }
00200         }
00201         function printContent() {
00202                 echo $this->content;
00203         }
00204 }
00205 
00206 // Include extension?
00207 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/imagelist/mod/index.php'])     {
00208         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/imagelist/mod/index.php']);
00209 }
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 // Make instance:
00223 $SOBE = t3lib_div::makeInstance('SC_mod_file_images_index');
00224 $SOBE->init();
00225 $SOBE->main();
00226 $SOBE->printContent();
00227 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6