00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00057 $BACK_PATH = '';
00058 require($BACK_PATH.'init.php');
00059 require($BACK_PATH.'template.php');
00060 require_once(PATH_t3lib.'class.t3lib_page.php');
00061 require_once(PATH_t3lib.'class.t3lib_loaddbgroup.php');
00062 require_once(PATH_t3lib.'class.t3lib_transferdata.php');
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00082 class transferData extends t3lib_transferData {
00083
00084 var $formname = 'loadform';
00085 var $loading = 1;
00086
00087
00088 var $theRecord = Array();
00089
00099 function regItem($table, $id, $field, $content) {
00100 t3lib_div::loadTCA($table);
00101 $config = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
00102 switch($config['type']) {
00103 case 'input':
00104 if (isset($config['checkbox']) && $content==$config['checkbox']) {$content=''; break;}
00105 if (t3lib_div::inList($config['eval'],'date')) {$content = Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$content); }
00106 break;
00107 case 'group':
00108 break;
00109 case 'select':
00110 break;
00111 }
00112 $this->theRecord[$field]=$content;
00113 }
00114 }
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00133 class SC_show_item {
00134
00135
00136 var $table;
00137 var $uid;
00138
00139
00140 var $perms_clause;
00141 var $access;
00142 var $type;
00143 var $doc;
00144
00145
00146 var $content;
00147 var $file;
00148 var $pageinfo;
00149 var $row;
00150
00151
00158 function init() {
00159 global $BE_USER,$LANG,$BACK_PATH,$TCA;
00160
00161
00162 $this->table = t3lib_div::_GET('table');
00163 $this->uid = t3lib_div::_GET('uid');
00164
00165
00166 $this->perms_clause = $BE_USER->getPagePermsClause(1);
00167 $this->access = 0;
00168 $this->type = '';
00169
00170
00171 if (isset($TCA[$this->table])) {
00172 t3lib_div::loadTCA($this->table);
00173 $this->type = 'db';
00174 $this->uid = intval($this->uid);
00175
00176
00177 if ($this->uid && $BE_USER->check('tables_select',$this->table)) {
00178 if ((string)$this->table=='pages') {
00179 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->uid,$this->perms_clause);
00180 $this->access = is_array($this->pageinfo) ? 1 : 0;
00181 $this->row = $this->pageinfo;
00182 } else {
00183 $this->row = t3lib_BEfunc::getRecord($this->table,$this->uid);
00184 if ($this->row) {
00185 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->row['pid'],$this->perms_clause);
00186 $this->access = is_array($this->pageinfo) ? 1 : 0;
00187 }
00188 }
00189
00190 $treatData = t3lib_div::makeInstance('t3lib_transferData');
00191 $treatData->renderRecord($this->table, $this->uid, 0, $this->row);
00192 $cRow = $treatData->theRecord;
00193 }
00194 } else {
00195
00196 if (substr($this->table,0,3)=='../') {
00197 $this->file = PATH_site.ereg_replace('^\.\./','',$this->table);
00198 } else {
00199 $this->file = $this->table;
00200 }
00201 if (@is_file($this->file) && t3lib_div::isAllowedAbsPath($this->file)) {
00202 $this->type = 'file';
00203 $this->access = 1;
00204
00205 require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
00206 }
00207 }
00208
00209
00210 $this->doc = t3lib_div::makeInstance('smallDoc');
00211 $this->doc->backPath = $BACK_PATH;
00212 $this->doc->docType = 'xhtml_trans';
00213
00214
00215 $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.viewItem'));
00216 $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.viewItem'));
00217 $this->content.=$this->doc->spacer(5);
00218 }
00219
00225 function main() {
00226 global $LANG;
00227
00228 if ($this->access) {
00229 $returnLinkTag = t3lib_div::_GP('returnUrl') ? '<a href="'.t3lib_div::_GP('returnUrl').'" class="typo3-goBack">' : '<a href="#" onclick="window.close();">';
00230
00231
00232 switch($this->type) {
00233 case 'db':
00234 $this->renderDBInfo();
00235 break;
00236 case 'file':
00237 $this->renderFileInfo($returnLinkTag);
00238 break;
00239 }
00240
00241
00242 if (t3lib_div::_GP('returnUrl')) {
00243 $this->content.= $this->doc->section('','<br />'.$returnLinkTag.'<strong>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack',1).'</strong></a>');
00244 }
00245 }
00246 }
00247
00253 function renderDBInfo() {
00254 global $LANG,$TCA;
00255
00256
00257 $code = $this->doc->getHeader($this->table,$this->row,$this->pageinfo['_thePath'],1).'<br />';
00258 $this->content.= $this->doc->section('',$code);
00259
00260
00261 $tableRows = Array();
00262 $i = 0;
00263
00264
00265 $fieldList = t3lib_div::trimExplode(',',$TCA[$this->table]['interface']['showRecordFieldList'],1);
00266 foreach($fieldList as $name) {
00267 $name = trim($name);
00268 if ($TCA[$this->table]['columns'][$name]) {
00269 if (!$TCA[$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$this->table.':'.$name)) {
00270 $i++;
00271 $tableRows[] = '
00272 <tr>
00273 <td class="bgColor5">'.$LANG->sL(t3lib_BEfunc::getItemLabel($this->table,$name),1).'</td>
00274 <td class="bgColor4">'.htmlspecialchars(t3lib_BEfunc::getProcessedValue($this->table,$name,$this->row[$name])).'</td>
00275 </tr>';
00276 }
00277 }
00278 }
00279
00280
00281 $tableCode = '
00282 <table border="0" cellpadding="1" cellspacing="1" id="typo3-showitem">
00283 '.implode('',$tableRows).'
00284 </table>';
00285 $this->content.=$this->doc->section('',$tableCode);
00286 $this->content.=$this->doc->divider(2);
00287
00288
00289 $code = '';
00290 $code.= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path').': '.t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'],-48).'<br />';
00291 $code.= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.table').': '.$LANG->sL($TCA[$this->table]['ctrl']['title']).' ('.$this->table.') - UID: '.$this->uid.'<br />';
00292 $this->content.= $this->doc->section('', $code);
00293 }
00294
00301 function renderFileInfo($returnLinkTag) {
00302 global $LANG;
00303
00304
00305 $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
00306 $imgObj->init();
00307 $imgObj->mayScaleUp = 0;
00308 $imgObj->absPrefix = PATH_site;
00309
00310
00311 $imgInfo = '';
00312 $imgInfo = $imgObj->getImageDimensions($this->file);
00313
00314
00315 $fI = t3lib_div::split_fileref($this->file);
00316 $ext = $fI['fileext'];
00317
00318 $code = '';
00319
00320
00321 $icon = t3lib_BEfunc::getFileIcon($ext);
00322 $url = 'gfx/fileicons/'.$icon;
00323 $fileName = '<img src="'.$url.'" width="18" height="16" align="top" alt="" /><b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.file',1).':</b> '.$fI['file'];
00324 if (t3lib_div::isFirstPartOfStr($this->file,PATH_site)) {
00325 $code.= '<a href="../'.substr($this->file,strlen(PATH_site)).'" target="_blank">'.$fileName.'</a>';
00326 } else {
00327 $code.= $fileName;
00328 }
00329 $code.=' <b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.filesize').':</b> '.t3lib_div::formatSize(@filesize($this->file)).'<br />
00330 ';
00331 if (is_array($imgInfo)) {
00332 $code.= '<b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.dimensions').':</b> '.$imgInfo[0].'x'.$imgInfo[1].' pixels';
00333 }
00334 $this->content.=$this->doc->section('',$code);
00335 $this->content.=$this->doc->divider(2);
00336
00337
00338 if (is_array($imgInfo)) {
00339
00340 $imgInfo = $imgObj->imageMagickConvert($this->file,'web','346','200m','','','',1);
00341 $imgInfo[3] = '../'.substr($imgInfo[3],strlen(PATH_site));
00342 $code = '<br />
00343 <div align="center">'.$returnLinkTag.$imgObj->imgTag($imgInfo).'</a></div>';
00344 $this->content.= $this->doc->section('', $code);
00345 } else {
00346 $this->content.= $this->doc->spacer(10);
00347 $lowerFilename = strtolower($this->file);
00348
00349
00350 if (TYPO3_OS!='WIN' && !$GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']) {
00351 if ($ext=='zip') {
00352 $code = '';
00353 exec('unzip -l '.$this->file, $t);
00354 if (is_array($t)) {
00355 reset($t);
00356 next($t);
00357 next($t);
00358 next($t);
00359 while(list(,$val)=each($t)) {
00360 $parts = explode(' ',trim($val),7);
00361 $code.= '
00362 '.$parts[6].'<br />';
00363 }
00364 $code = '
00365 <span class="nobr">'.$code.'
00366 </span>
00367 <br /><br />';
00368 }
00369 $this->content.= $this->doc->section('', $code);
00370 } elseif($ext=='tar' || $ext=='tgz' || substr($lowerFilename,-6)=='tar.gz' || substr($lowerFilename,-5)=='tar.z') {
00371 $code = '';
00372 if ($ext=='tar') {
00373 $compr = '';
00374 } else {
00375 $compr = 'z';
00376 }
00377 exec('tar t'.$compr.'f '.$this->file, $t);
00378 if (is_array($t)) {
00379 foreach($t as $val) {
00380 $code.='
00381 '.$val.'<br />';
00382 }
00383
00384 $code.='
00385 -------<br/>
00386 '.count($t).' files';
00387
00388 $code = '
00389 <span class="nobr">'.$code.'
00390 </span>
00391 <br /><br />';
00392 }
00393 $this->content.= $this->doc->section('',$code);
00394 }
00395 } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']) {
00396 $this->content.= $this->doc->section('','Sorry, TYPO3_CONF_VARS[BE][disable_exec_function] was set, so cannot display content of archive file.');
00397 }
00398
00399
00400 if ($ext=='ttf') {
00401 $thumbScript = 'thumbs.php';
00402 $params = '&file='.rawurlencode($this->file);
00403 $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
00404 $thumb = '<br />
00405 <div align="center">'.$returnLinkTag.'<img src="'.htmlspecialchars($url).'" border="0" title="'.htmlspecialchars(trim($this->file)).'" alt="" /></a></div>';
00406 $this->content.= $this->doc->section('',$thumb);
00407 }
00408 }
00409 }
00410
00416 function printContent() {
00417 $this->content.= $this->doc->endPage();
00418 echo $this->content;
00419 }
00420 }
00421
00422
00423 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/show_item.php']) {
00424 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/show_item.php']);
00425 }
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439 $SOBE = t3lib_div::makeInstance('SC_show_item');
00440 $SOBE->init();
00441 $SOBE->main();
00442 $SOBE->printContent();
00443 ?>